fl-web-component 1.0.4 → 1.0.6
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/dist/fl-web-component.common.1.js +1 -2
- package/dist/fl-web-component.common.2.js +1 -2
- package/dist/fl-web-component.common.3.js +1 -2
- package/dist/fl-web-component.common.js +6 -11
- package/dist/fl-web-component.umd.1.js +1 -2
- package/dist/fl-web-component.umd.2.js +1 -2
- package/dist/fl-web-component.umd.3.js +1 -2
- package/dist/fl-web-component.umd.js +6 -11
- package/dist/fl-web-component.umd.min.1.js +1 -2
- package/dist/fl-web-component.umd.min.2.js +1 -2
- package/dist/fl-web-component.umd.min.3.js +1 -2
- package/dist/fl-web-component.umd.min.js +1 -2
- package/package.json +1 -1
- package/src/main.js +0 -3
- package/src/utils/instance-parser.js +2 -2
- package/dist/fl-web-component.common.1.js.map +0 -1
- package/dist/fl-web-component.common.2.js.map +0 -1
- package/dist/fl-web-component.common.3.js.map +0 -1
- package/dist/fl-web-component.common.js.map +0 -1
- package/dist/fl-web-component.umd.1.js.map +0 -1
- package/dist/fl-web-component.umd.2.js.map +0 -1
- package/dist/fl-web-component.umd.3.js.map +0 -1
- package/dist/fl-web-component.umd.js.map +0 -1
- package/dist/fl-web-component.umd.min.1.js.map +0 -1
- package/dist/fl-web-component.umd.min.2.js.map +0 -1
- package/dist/fl-web-component.umd.min.3.js.map +0 -1
- package/dist/fl-web-component.umd.min.js.map +0 -1
|
@@ -291,5 +291,4 @@ const d={LEFT:1,RIGHT:2,MIDDLE:4},f=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,SCREE
|
|
|
291
291
|
* @license
|
|
292
292
|
* Copyright 2010-2025 Three.js Authors
|
|
293
293
|
* SPDX-License-Identifier: MIT
|
|
294
|
-
*/function gv(){var t=null,e=!1,n=null,i=null;function r(e,a){n(e,a),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function yv(t){var e=new WeakMap;function n(e,n){var i,r=e.array,a=e.usage,o=r.byteLength,s=t.createBuffer();if(t.bindBuffer(n,s),t.bufferData(n,r,a),e.onUploadCallback(),r instanceof Float32Array)i=t.FLOAT;else if(r instanceof Uint16Array)i=e.isFloat16BufferAttribute?t.HALF_FLOAT:t.UNSIGNED_SHORT;else if(r instanceof Int16Array)i=t.SHORT;else if(r instanceof Uint32Array)i=t.UNSIGNED_INT;else if(r instanceof Int32Array)i=t.INT;else if(r instanceof Int8Array)i=t.BYTE;else if(r instanceof Uint8Array)i=t.UNSIGNED_BYTE;else{if(!(r instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);i=t.UNSIGNED_BYTE}return{buffer:s,type:i,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version,size:o}}function i(e,n,i){var r=n.array,a=n.updateRanges;if(t.bindBuffer(i,e),0===a.length)t.bufferSubData(i,0,r);else{a.sort((function(t,e){return t.start-e.start}));for(var o=0,s=1;s<a.length;s++){var l=a[o],h=a[s];h.start<=l.start+l.count+1?l.count=Math.max(l.count,h.start+h.count-l.start):(++o,a[o]=h)}a.length=o+1;for(var u=0,c=a.length;u<c;u++){var d=a[u];t.bufferSubData(i,d.start*r.BYTES_PER_ELEMENT,r,d.start,d.count)}n.clearUpdateRanges()}n.onUploadCallback()}function r(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)}function a(n){n.isInterleavedBufferAttribute&&(n=n.data);var i=e.get(n);i&&(t.deleteBuffer(i.buffer),e.delete(n))}function o(t,r){if(t.isInterleavedBufferAttribute&&(t=t.data),t.isGLBufferAttribute){var a=e.get(t);(!a||a.version<t.version)&&e.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version})}else{var o=e.get(t);if(void 0===o)e.set(t,n(t,r));else if(o.version<t.version){if(o.size!==t.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(o.buffer,t,r),o.version=t.version}}}return{get:r,remove:a,update:o}}var _v="#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",xv="#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",bv="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",wv="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",Sv="#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",Mv="#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",Av="#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",Ev="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",Tv="#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",Cv="#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",kv="vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",Lv="vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",Pv="float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",Rv="#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",Nv="#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",Iv="#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",Ov="#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",Dv="#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",Fv="#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",Uv="#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",qv="#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",Bv="#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",zv="#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",Hv="#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",Gv="#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",Vv="vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",jv="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",Wv="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",Xv="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",Yv="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",Kv="gl_FragColor = linearToOutputTexel( gl_FragColor );",Zv="vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",Jv="#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",Qv="#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",$v="#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",tg="#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",eg="#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",ng="#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",ig="#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",rg="#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",ag="#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",og="#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",sg="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lg="LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",hg="varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",ug="uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",cg="#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",dg="ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",fg="varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",pg="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",mg="varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",vg="PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",gg="struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",yg="\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",_g="#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",xg="#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",bg="#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",wg="#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",Sg="#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",Mg="#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",Ag="#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",Eg="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",Tg="#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",Cg="#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",kg="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",Lg="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",Pg="#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",Rg="#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",Ng="#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",Ig="#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",Og="#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",Dg="float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",Fg="#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",Ug="#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",qg="#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",Bg="#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",zg="#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",Hg="#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",Gg="#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",Vg="#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",jg="#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",Wg="#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",Xg="vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",Yg="#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",Kg="vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",Zg="#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",Jg="#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",Qg="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",$g="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",ty="#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",ey="#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",ny="#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",iy="float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",ry="#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",ay="#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",oy="#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",sy="#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",ly="float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",hy="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",uy="#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",cy="#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",dy="#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",fy="#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",py="#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",my="#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",vy="#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",gy="#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",yy="varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",_y="uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",xy="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",by="#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",wy="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",Sy="uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",My="#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",Ay="#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",Ey="#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",Ty="#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",Cy="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",ky="uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",Ly="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",Py="uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",Ry="#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",Ny="uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Iy="#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",Oy="#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Dy="#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",Fy="#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Uy="#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",qy="#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",By="#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",zy="#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Hy="#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",Gy="#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Vy="#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",jy="#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Wy="uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",Xy="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",Yy="#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",Ky="uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",Zy="uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",Jy="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",Qy={alphahash_fragment:_v,alphahash_pars_fragment:xv,alphamap_fragment:bv,alphamap_pars_fragment:wv,alphatest_fragment:Sv,alphatest_pars_fragment:Mv,aomap_fragment:Av,aomap_pars_fragment:Ev,batching_pars_vertex:Tv,batching_vertex:Cv,begin_vertex:kv,beginnormal_vertex:Lv,bsdfs:Pv,iridescence_fragment:Rv,bumpmap_pars_fragment:Nv,clipping_planes_fragment:Iv,clipping_planes_pars_fragment:Ov,clipping_planes_pars_vertex:Dv,clipping_planes_vertex:Fv,color_fragment:Uv,color_pars_fragment:qv,color_pars_vertex:Bv,color_vertex:zv,common:Hv,cube_uv_reflection_fragment:Gv,defaultnormal_vertex:Vv,displacementmap_pars_vertex:jv,displacementmap_vertex:Wv,emissivemap_fragment:Xv,emissivemap_pars_fragment:Yv,colorspace_fragment:Kv,colorspace_pars_fragment:Zv,envmap_fragment:Jv,envmap_common_pars_fragment:Qv,envmap_pars_fragment:$v,envmap_pars_vertex:tg,envmap_physical_pars_fragment:cg,envmap_vertex:eg,fog_vertex:ng,fog_pars_vertex:ig,fog_fragment:rg,fog_pars_fragment:ag,gradientmap_pars_fragment:og,lightmap_pars_fragment:sg,lights_lambert_fragment:lg,lights_lambert_pars_fragment:hg,lights_pars_begin:ug,lights_toon_fragment:dg,lights_toon_pars_fragment:fg,lights_phong_fragment:pg,lights_phong_pars_fragment:mg,lights_physical_fragment:vg,lights_physical_pars_fragment:gg,lights_fragment_begin:yg,lights_fragment_maps:_g,lights_fragment_end:xg,logdepthbuf_fragment:bg,logdepthbuf_pars_fragment:wg,logdepthbuf_pars_vertex:Sg,logdepthbuf_vertex:Mg,map_fragment:Ag,map_pars_fragment:Eg,map_particle_fragment:Tg,map_particle_pars_fragment:Cg,metalnessmap_fragment:kg,metalnessmap_pars_fragment:Lg,morphinstance_vertex:Pg,morphcolor_vertex:Rg,morphnormal_vertex:Ng,morphtarget_pars_vertex:Ig,morphtarget_vertex:Og,normal_fragment_begin:Dg,normal_fragment_maps:Fg,normal_pars_fragment:Ug,normal_pars_vertex:qg,normal_vertex:Bg,normalmap_pars_fragment:zg,clearcoat_normal_fragment_begin:Hg,clearcoat_normal_fragment_maps:Gg,clearcoat_pars_fragment:Vg,iridescence_pars_fragment:jg,opaque_fragment:Wg,packing:Xg,premultiplied_alpha_fragment:Yg,project_vertex:Kg,dithering_fragment:Zg,dithering_pars_fragment:Jg,roughnessmap_fragment:Qg,roughnessmap_pars_fragment:$g,shadowmap_pars_fragment:ty,shadowmap_pars_vertex:ey,shadowmap_vertex:ny,shadowmask_pars_fragment:iy,skinbase_vertex:ry,skinning_pars_vertex:ay,skinning_vertex:oy,skinnormal_vertex:sy,specularmap_fragment:ly,specularmap_pars_fragment:hy,tonemapping_fragment:uy,tonemapping_pars_fragment:cy,transmission_fragment:dy,transmission_pars_fragment:fy,uv_pars_fragment:py,uv_pars_vertex:my,uv_vertex:vy,worldpos_vertex:gy,background_vert:yy,background_frag:_y,backgroundCube_vert:xy,backgroundCube_frag:by,cube_vert:wy,cube_frag:Sy,depth_vert:My,depth_frag:Ay,distanceRGBA_vert:Ey,distanceRGBA_frag:Ty,equirect_vert:Cy,equirect_frag:ky,linedashed_vert:Ly,linedashed_frag:Py,meshbasic_vert:Ry,meshbasic_frag:Ny,meshlambert_vert:Iy,meshlambert_frag:Oy,meshmatcap_vert:Dy,meshmatcap_frag:Fy,meshnormal_vert:Uy,meshnormal_frag:qy,meshphong_vert:By,meshphong_frag:zy,meshphysical_vert:Hy,meshphysical_frag:Gy,meshtoon_vert:Vy,meshtoon_frag:jy,points_vert:Wy,points_frag:Xy,shadow_vert:Yy,shadow_frag:Ky,sprite_vert:Zy,sprite_frag:Jy},$y={common:{diffuse:{value:new Zo(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Yr},alphaMap:{value:null},alphaMapTransform:{value:new Yr},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Yr}},envmap:{envMap:{value:null},envMapRotation:{value:new Yr},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Yr}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Yr}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Yr},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Yr},normalScale:{value:new Xr(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Yr},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Yr}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Yr}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Yr}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Zo(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Zo(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Yr},alphaTest:{value:0},uvTransform:{value:new Yr}},sprite:{diffuse:{value:new Zo(16777215)},opacity:{value:1},center:{value:new Xr(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Yr},alphaMap:{value:null},alphaMapTransform:{value:new Yr},alphaTest:{value:0}}},t_={basic:{uniforms:Gs([$y.common,$y.specularmap,$y.envmap,$y.aomap,$y.lightmap,$y.fog]),vertexShader:Qy.meshbasic_vert,fragmentShader:Qy.meshbasic_frag},lambert:{uniforms:Gs([$y.common,$y.specularmap,$y.envmap,$y.aomap,$y.lightmap,$y.emissivemap,$y.bumpmap,$y.normalmap,$y.displacementmap,$y.fog,$y.lights,{emissive:{value:new Zo(0)}}]),vertexShader:Qy.meshlambert_vert,fragmentShader:Qy.meshlambert_frag},phong:{uniforms:Gs([$y.common,$y.specularmap,$y.envmap,$y.aomap,$y.lightmap,$y.emissivemap,$y.bumpmap,$y.normalmap,$y.displacementmap,$y.fog,$y.lights,{emissive:{value:new Zo(0)},specular:{value:new Zo(1118481)},shininess:{value:30}}]),vertexShader:Qy.meshphong_vert,fragmentShader:Qy.meshphong_frag},standard:{uniforms:Gs([$y.common,$y.envmap,$y.aomap,$y.lightmap,$y.emissivemap,$y.bumpmap,$y.normalmap,$y.displacementmap,$y.roughnessmap,$y.metalnessmap,$y.fog,$y.lights,{emissive:{value:new Zo(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Qy.meshphysical_vert,fragmentShader:Qy.meshphysical_frag},toon:{uniforms:Gs([$y.common,$y.aomap,$y.lightmap,$y.emissivemap,$y.bumpmap,$y.normalmap,$y.displacementmap,$y.gradientmap,$y.fog,$y.lights,{emissive:{value:new Zo(0)}}]),vertexShader:Qy.meshtoon_vert,fragmentShader:Qy.meshtoon_frag},matcap:{uniforms:Gs([$y.common,$y.bumpmap,$y.normalmap,$y.displacementmap,$y.fog,{matcap:{value:null}}]),vertexShader:Qy.meshmatcap_vert,fragmentShader:Qy.meshmatcap_frag},points:{uniforms:Gs([$y.points,$y.fog]),vertexShader:Qy.points_vert,fragmentShader:Qy.points_frag},dashed:{uniforms:Gs([$y.common,$y.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Qy.linedashed_vert,fragmentShader:Qy.linedashed_frag},depth:{uniforms:Gs([$y.common,$y.displacementmap]),vertexShader:Qy.depth_vert,fragmentShader:Qy.depth_frag},normal:{uniforms:Gs([$y.common,$y.bumpmap,$y.normalmap,$y.displacementmap,{opacity:{value:1}}]),vertexShader:Qy.meshnormal_vert,fragmentShader:Qy.meshnormal_frag},sprite:{uniforms:Gs([$y.sprite,$y.fog]),vertexShader:Qy.sprite_vert,fragmentShader:Qy.sprite_frag},background:{uniforms:{uvTransform:{value:new Yr},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Qy.background_vert,fragmentShader:Qy.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Yr}},vertexShader:Qy.backgroundCube_vert,fragmentShader:Qy.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Qy.cube_vert,fragmentShader:Qy.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Qy.equirect_vert,fragmentShader:Qy.equirect_frag},distanceRGBA:{uniforms:Gs([$y.common,$y.displacementmap,{referencePosition:{value:new Ta},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Qy.distanceRGBA_vert,fragmentShader:Qy.distanceRGBA_frag},shadow:{uniforms:Gs([$y.lights,$y.fog,{color:{value:new Zo(0)},opacity:{value:1}}]),vertexShader:Qy.shadow_vert,fragmentShader:Qy.shadow_frag}};t_.physical={uniforms:Gs([t_.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Yr},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Yr},clearcoatNormalScale:{value:new Xr(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Yr},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Yr},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Yr},sheen:{value:0},sheenColor:{value:new Zo(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Yr},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Yr},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Yr},transmissionSamplerSize:{value:new Xr},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Yr},attenuationDistance:{value:0},attenuationColor:{value:new Zo(0)},specularColor:{value:new Zo(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Yr},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Yr},anisotropyVector:{value:new Xr},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Yr}}]),vertexShader:Qy.meshphysical_vert,fragmentShader:Qy.meshphysical_frag};var e_={r:0,b:0,g:0},n_=new po,i_=new io;function r_(t,e,n,i,r,a,o){var s,l,h=new Zo(0),u=!0===a?0:1,c=null,d=0,f=null;function p(t){var i=!0===t.isScene?t.background:null;if(i&&i.isTexture){var r=t.backgroundBlurriness>0;i=(r?n:e).get(i)}return i}function m(e){var n=!1,r=p(e);null===r?g(h,u):r&&r.isColor&&(g(r,1),n=!0);var a=t.xr.getEnvironmentBlendMode();"additive"===a?i.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===a&&i.buffers.color.setClear(0,0,0,0,o),(t.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function v(e,n){var i=p(n);i&&(i.isCubeTexture||i.mapping===We)?(void 0===l&&(l=new Us(new zs(1,1,1),new Zs({name:"BackgroundCubeMaterial",uniforms:Hs(t_.backgroundCube.uniforms),vertexShader:t_.backgroundCube.vertexShader,fragmentShader:t_.backgroundCube.fragmentShader,side:Wt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(l)),n_.copy(n.backgroundRotation),n_.x*=-1,n_.y*=-1,n_.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(n_.y*=-1,n_.z*=-1),l.material.uniforms.envMap.value=i,l.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(i_.makeRotationFromEuler(n_)),l.material.toneMapped=ua.getTransfer(i.colorSpace)!==Ri,c===i&&d===i.version&&f===t.toneMapping||(l.material.needsUpdate=!0,c=i,d=i.version,f=t.toneMapping),l.layers.enableAll(),e.unshift(l,l.geometry,l.material,0,0,null)):i&&i.isTexture&&(void 0===s&&(s=new Us(new qc(2,2),new Zs({name:"BackgroundMaterial",uniforms:Hs(t_.background.uniforms),vertexShader:t_.background.vertexShader,fragmentShader:t_.background.fragmentShader,side:jt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),s.geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(s)),s.material.uniforms.t2D.value=i,s.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,s.material.toneMapped=ua.getTransfer(i.colorSpace)!==Ri,!0===i.matrixAutoUpdate&&i.updateMatrix(),s.material.uniforms.uvTransform.value.copy(i.matrix),c===i&&d===i.version&&f===t.toneMapping||(s.material.needsUpdate=!0,c=i,d=i.version,f=t.toneMapping),s.layers.enableAll(),e.unshift(s,s.geometry,s.material,0,0,null))}function g(e,n){e.getRGB(e_,js(t)),i.buffers.color.setClear(e_.r,e_.g,e_.b,n,o)}function y(){void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0),void 0!==s&&(s.geometry.dispose(),s.material.dispose(),s=void 0)}return{getClearColor:function(){return h},setClearColor:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;h.set(t),u=e,g(h,u)},getClearAlpha:function(){return u},setClearAlpha:function(t){u=t,g(h,u)},render:m,addToRenderList:v,dispose:y}}function a_(t,e){var n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},r=d(null),a=r,o=!1;function s(n,i,r,s,l){var u=!1,d=c(s,r,i);a!==d&&(a=d,h(a.object)),u=f(n,s,r,l),u&&p(n,s,r,l),null!==l&&e.update(l,t.ELEMENT_ARRAY_BUFFER),(u||o)&&(o=!1,x(n,i,r,s),null!==l&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(l).buffer))}function l(){return t.createVertexArray()}function h(e){return t.bindVertexArray(e)}function u(e){return t.deleteVertexArray(e)}function c(t,e,n){var r=!0===n.wireframe,a=i[t.id];void 0===a&&(a={},i[t.id]=a);var o=a[e.id];void 0===o&&(o={},a[e.id]=o);var s=o[r];return void 0===s&&(s=d(l()),o[r]=s),s}function d(t){for(var e=[],i=[],r=[],a=0;a<n;a++)e[a]=0,i[a]=0,r[a]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:r,object:t,attributes:{},index:null}}function f(t,e,n,i){var r=a.attributes,o=e.attributes,s=0,l=n.getAttributes();for(var h in l){var u=l[h];if(u.location>=0){var c=r[h],d=o[h];if(void 0===d&&("instanceMatrix"===h&&t.instanceMatrix&&(d=t.instanceMatrix),"instanceColor"===h&&t.instanceColor&&(d=t.instanceColor)),void 0===c)return!0;if(c.attribute!==d)return!0;if(d&&c.data!==d.data)return!0;s++}}return a.attributesNum!==s||a.index!==i}function p(t,e,n,i){var r={},o=e.attributes,s=0,l=n.getAttributes();for(var h in l){var u=l[h];if(u.location>=0){var c=o[h];void 0===c&&("instanceMatrix"===h&&t.instanceMatrix&&(c=t.instanceMatrix),"instanceColor"===h&&t.instanceColor&&(c=t.instanceColor));var d={};d.attribute=c,c&&c.data&&(d.data=c.data),r[h]=d,s++}}a.attributes=r,a.attributesNum=s,a.index=i}function m(){for(var t=a.newAttributes,e=0,n=t.length;e<n;e++)t[e]=0}function v(t){g(t,0)}function g(e,n){var i=a.newAttributes,r=a.enabledAttributes,o=a.attributeDivisors;i[e]=1,0===r[e]&&(t.enableVertexAttribArray(e),r[e]=1),o[e]!==n&&(t.vertexAttribDivisor(e,n),o[e]=n)}function y(){for(var e=a.newAttributes,n=a.enabledAttributes,i=0,r=n.length;i<r;i++)n[i]!==e[i]&&(t.disableVertexAttribArray(i),n[i]=0)}function _(e,n,i,r,a,o,s){!0===s?t.vertexAttribIPointer(e,n,i,a,o):t.vertexAttribPointer(e,n,i,r,a,o)}function x(n,i,r,a){m();var o=a.attributes,s=r.getAttributes(),l=i.defaultAttributeValues;for(var h in s){var u=s[h];if(u.location>=0){var c=o[h];if(void 0===c&&("instanceMatrix"===h&&n.instanceMatrix&&(c=n.instanceMatrix),"instanceColor"===h&&n.instanceColor&&(c=n.instanceColor)),void 0!==c){var d=c.normalized,f=c.itemSize,p=e.get(c);if(void 0===p)continue;var x=p.buffer,b=p.type,w=p.bytesPerElement,S=b===t.INT||b===t.UNSIGNED_INT||c.gpuType===cn;if(c.isInterleavedBufferAttribute){var M=c.data,A=M.stride,E=c.offset;if(M.isInstancedInterleavedBuffer){for(var T=0;T<u.locationSize;T++)g(u.location+T,M.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=M.meshPerAttribute*M.count)}else for(var C=0;C<u.locationSize;C++)v(u.location+C);t.bindBuffer(t.ARRAY_BUFFER,x);for(var k=0;k<u.locationSize;k++)_(u.location+k,f/u.locationSize,b,d,A*w,(E+f/u.locationSize*k)*w,S)}else{if(c.isInstancedBufferAttribute){for(var L=0;L<u.locationSize;L++)g(u.location+L,c.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=c.meshPerAttribute*c.count)}else for(var P=0;P<u.locationSize;P++)v(u.location+P);t.bindBuffer(t.ARRAY_BUFFER,x);for(var R=0;R<u.locationSize;R++)_(u.location+R,f/u.locationSize,b,d,f*w,f/u.locationSize*R*w,S)}}else if(void 0!==l){var N=l[h];if(void 0!==N)switch(N.length){case 2:t.vertexAttrib2fv(u.location,N);break;case 3:t.vertexAttrib3fv(u.location,N);break;case 4:t.vertexAttrib4fv(u.location,N);break;default:t.vertexAttrib1fv(u.location,N)}}}}y()}function b(){for(var t in M(),i){var e=i[t];for(var n in e){var r=e[n];for(var a in r)u(r[a].object),delete r[a];delete e[n]}delete i[t]}}function w(t){if(void 0!==i[t.id]){var e=i[t.id];for(var n in e){var r=e[n];for(var a in r)u(r[a].object),delete r[a];delete e[n]}delete i[t.id]}}function S(t){for(var e in i){var n=i[e];if(void 0!==n[t.id]){var r=n[t.id];for(var a in r)u(r[a].object),delete r[a];delete n[t.id]}}}function M(){A(),o=!0,a!==r&&(a=r,h(a.object))}function A(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:s,reset:M,resetDefaultState:A,dispose:b,releaseStatesOfGeometry:w,releaseStatesOfProgram:S,initAttributes:m,enableAttribute:v,disableUnusedAttributes:y}}function o_(t,e,n){var i;function r(t){i=t}function a(e,r){t.drawArrays(i,e,r),n.update(r,i,1)}function o(e,r,a){0!==a&&(t.drawArraysInstanced(i,e,r,a),n.update(r,i,a))}function s(t,r,a){if(0!==a){var o=e.get("WEBGL_multi_draw");o.multiDrawArraysWEBGL(i,t,0,r,0,a);for(var s=0,l=0;l<a;l++)s+=r[l];n.update(s,i,1)}}function l(t,r,a,s){if(0!==a){var l=e.get("WEBGL_multi_draw");if(null===l)for(var h=0;h<t.length;h++)o(t[h],r[h],s[h]);else{l.multiDrawArraysInstancedWEBGL(i,t,0,r,0,s,0,a);for(var u=0,c=0;c<a;c++)u+=r[c]*s[c];n.update(u,i,1)}}}this.setMode=r,this.render=a,this.renderInstances=o,this.renderMultiDraw=s,this.renderMultiDrawInstances=l}function s_(t,e,n,i){var r;function a(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){var n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(e){return e===bn||i.convert(e)===t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT)}function s(n){var r=n===pn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(n!==sn&&i.convert(n)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==fn&&!r)}function l(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var h=void 0!==n.precision?n.precision:"highp",u=l(h);u!==h&&(console.warn("THREE.WebGLRenderer:",h,"not supported, using",u,"instead."),h=u);var c=!0===n.logarithmicDepthBuffer,d=!0===n.reverseDepthBuffer&&e.has("EXT_clip_control"),f=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),p=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=t.getParameter(t.MAX_TEXTURE_SIZE),v=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),g=t.getParameter(t.MAX_VERTEX_ATTRIBS),y=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),_=t.getParameter(t.MAX_VARYING_VECTORS),x=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),b=p>0,w=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:s,precision:h,logarithmicDepthBuffer:c,reverseDepthBuffer:d,maxTextures:f,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:v,maxAttributes:g,maxVertexUniforms:y,maxVaryings:_,maxFragmentUniforms:x,vertexTextures:b,maxSamples:w}}function l_(t){var e=this,n=null,i=0,r=!1,a=!1,o=new sh,s=new Yr,l={value:null,needsUpdate:!1};function h(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(t,n,i,r){var a=null!==t?t.length:0,h=null;if(0!==a){if(h=l.value,!0!==r||null===h){var u=i+4*a,c=n.matrixWorldInverse;s.getNormalMatrix(c),(null===h||h.length<u)&&(h=new Float32Array(u));for(var d=0,f=i;d!==a;++d,f+=4)o.copy(t[d]).applyMatrix4(c,s),o.normal.toArray(h,f),h[f+3]=o.constant}l.value=h,l.needsUpdate=!0}return e.numPlanes=a,e.numIntersection=0,h}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e){var n=0!==t.length||e||0!==i||r;return r=e,i=t.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(t,e){n=u(t,e,0)},this.setState=function(e,o,s){var c=e.clippingPlanes,d=e.clipIntersection,f=e.clipShadows,p=t.get(e);if(!r||null===c||0===c.length||a&&!f)a?u(null):h();else{var m=a?0:i,v=4*m,g=p.clippingState||null;l.value=g,g=u(c,o,v,s);for(var y=0;y!==v;++y)g[y]=n[y];p.clippingState=g,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=m}}}function h_(t){var e=new WeakMap;function n(t,e){return e===Ve?t.mapping=He:e===je&&(t.mapping=Ge),t}function i(i){if(i&&i.isTexture){var a=i.mapping;if(a===Ve||a===je){if(e.has(i)){var o=e.get(i).texture;return n(o,i.mapping)}var s=i.image;if(s&&s.height>0){var l=new ol(s.height);return l.fromEquirectangularTexture(t,i),e.set(i,l),i.addEventListener("dispose",r),n(l.texture,i.mapping)}return null}}return i}function r(t){var n=t.target;n.removeEventListener("dispose",r);var i=e.get(n);void 0!==i&&(e.delete(n),i.dispose())}function a(){e=new WeakMap}return{get:i,dispose:a}}var u_=4,c_=[.125,.215,.35,.446,.526,.582],d_=20,f_=new of,p_=new Zo,m_=null,v_=0,g_=0,y_=!1,__=(1+Math.sqrt(5))/2,x_=1/__,b_=[new Ta(-__,x_,0),new Ta(__,x_,0),new Ta(-x_,0,__),new Ta(x_,0,__),new Ta(0,__,-x_),new Ta(0,__,x_),new Ta(-1,1,-1),new Ta(1,1,-1),new Ta(-1,1,1),new Ta(1,1,1)],w_=new Ta,S_=function(){function t(e){st()(this,t),this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}return ht()(t,[{key:"fromScene",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=r.size,o=void 0===a?256:a,s=r.position,l=void 0===s?w_:s;m_=this._renderer.getRenderTarget(),v_=this._renderer.getActiveCubeFace(),g_=this._renderer.getActiveMipmapLevel(),y_=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);var h=this._allocateTargets();return h.depthBuffer=!0,this._sceneToCubeUV(t,n,i,h,l),e>0&&this._blur(h,0,0,e),this._applyPMREM(h),this._cleanup(h),h}},{key:"fromEquirectangular",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(t,e)}},{key:"fromCubemap",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(t,e)}},{key:"compileCubemapShader",value:function(){null===this._cubemapMaterial&&(this._cubemapMaterial=k_(),this._compileMaterial(this._cubemapMaterial))}},{key:"compileEquirectangularShader",value:function(){null===this._equirectMaterial&&(this._equirectMaterial=C_(),this._compileMaterial(this._equirectMaterial))}},{key:"dispose",value:function(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}},{key:"_setSize",value:function(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}},{key:"_dispose",value:function(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(var t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}},{key:"_cleanup",value:function(t){this._renderer.setRenderTarget(m_,v_,g_),this._renderer.xr.enabled=y_,t.scissorTest=!1,E_(t,0,0,t.width,t.height)}},{key:"_fromTexture",value:function(t,e){t.mapping===He||t.mapping===Ge?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),m_=this._renderer.getRenderTarget(),v_=this._renderer.getActiveCubeFace(),g_=this._renderer.getActiveMipmapLevel(),y_=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;var n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}},{key:"_allocateTargets",value:function(){var t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:en,minFilter:en,generateMipmaps:!1,type:pn,format:bn,colorSpace:Li,depthBuffer:!1},i=A_(t,e,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=A_(t,e,n);var r=this._lodMax,a=M_(r);this._sizeLods=a.sizeLods,this._lodPlanes=a.lodPlanes,this._sigmas=a.sigmas,this._blurMaterial=T_(r,t,e)}return i}},{key:"_compileMaterial",value:function(t){var e=new Us(this._lodPlanes[0],t);this._renderer.compile(e,f_)}},{key:"_sceneToCubeUV",value:function(t,e,n,i,r){var a=90,o=1,s=new el(a,o,e,n),l=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],u=this._renderer,c=u.autoClear,d=u.toneMapping;u.getClearColor(p_),u.toneMapping=Pe,u.autoClear=!1;var f=new ts({name:"PMREM.Background",side:Wt,depthWrite:!1,depthTest:!1}),p=new Us(new zs,f),m=!1,v=t.background;v?v.isColor&&(f.color.copy(v),t.background=null,m=!0):(f.color.copy(p_),m=!0);for(var g=0;g<6;g++){var y=g%3;0===y?(s.up.set(0,l[g],0),s.position.set(r.x,r.y,r.z),s.lookAt(r.x+h[g],r.y,r.z)):1===y?(s.up.set(0,0,l[g]),s.position.set(r.x,r.y,r.z),s.lookAt(r.x,r.y+h[g],r.z)):(s.up.set(0,l[g],0),s.position.set(r.x,r.y,r.z),s.lookAt(r.x,r.y,r.z+h[g]));var _=this._cubeSize;E_(i,y*_,g>2?_:0,_,_),u.setRenderTarget(i),m&&u.render(p,s),u.render(t,s)}p.geometry.dispose(),p.material.dispose(),u.toneMapping=d,u.autoClear=c,t.background=v}},{key:"_textureToCubeUV",value:function(t,e){var n=this._renderer,i=t.mapping===He||t.mapping===Ge;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=k_()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=C_());var r=i?this._cubemapMaterial:this._equirectMaterial,a=new Us(this._lodPlanes[0],r),o=r.uniforms;o["envMap"].value=t;var s=this._cubeSize;E_(e,0,0,3*s,2*s),n.setRenderTarget(e),n.render(a,f_)}},{key:"_applyPMREM",value:function(t){var e=this._renderer,n=e.autoClear;e.autoClear=!1;for(var i=this._lodPlanes.length,r=1;r<i;r++){var a=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),o=b_[(i-r-1)%b_.length];this._blur(t,r-1,r,a,o)}e.autoClear=n}},{key:"_blur",value:function(t,e,n,i,r){var a=this._pingPongRenderTarget;this._halfBlur(t,a,e,n,i,"latitudinal",r),this._halfBlur(a,t,n,n,i,"longitudinal",r)}},{key:"_halfBlur",value:function(t,e,n,i,r,a,o){var s=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var h=3,u=new Us(this._lodPlanes[i],l),c=l.uniforms,d=this._sizeLods[n]-1,f=isFinite(r)?Math.PI/(2*d):2*Math.PI/(2*d_-1),p=r/f,m=isFinite(r)?1+Math.floor(h*p):d_;m>d_&&console.warn("sigmaRadians, ".concat(r,", is too large and will clip, as it requested ").concat(m," samples when the maximum is set to ").concat(d_));for(var v=[],g=0,y=0;y<d_;++y){var _=y/p,x=Math.exp(-_*_/2);v.push(x),0===y?g+=x:y<m&&(g+=2*x)}for(var b=0;b<v.length;b++)v[b]=v[b]/g;c["envMap"].value=t.texture,c["samples"].value=m,c["weights"].value=v,c["latitudinal"].value="latitudinal"===a,o&&(c["poleAxis"].value=o);var w=this._lodMax;c["dTheta"].value=f,c["mipInt"].value=w-n;var S=this._sizeLods[i],M=3*S*(i>w-u_?i-w+u_:0),A=4*(this._cubeSize-S);E_(e,M,A,3*S,2*S),s.setRenderTarget(e),s.render(u,f_)}}])}();function M_(t){for(var e=[],n=[],i=[],r=t,a=t-u_+1+c_.length,o=0;o<a;o++){var s=Math.pow(2,r);n.push(s);var l=1/s;o>t-u_?l=c_[o-t+u_-1]:0===o&&(l=0),i.push(l);for(var h=1/(s-2),u=-h,c=1+h,d=[u,u,c,u,c,c,u,u,c,c,u,c],f=6,p=6,m=3,v=2,g=1,y=new Float32Array(m*p*f),_=new Float32Array(v*p*f),x=new Float32Array(g*p*f),b=0;b<f;b++){var w=b%3*2/3-1,S=b>2?0:-1,M=[w,S,0,w+2/3,S,0,w+2/3,S+1,0,w,S,0,w+2/3,S+1,0,w,S+1,0];y.set(M,m*p*b),_.set(d,v*p*b);var A=[b,b,b,b,b,b];x.set(A,g*p*b)}var E=new Es;E.setAttribute("position",new hs(y,m)),E.setAttribute("uv",new hs(_,v)),E.setAttribute("faceIndex",new hs(x,g)),e.push(E),r>u_&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function A_(t,e,n){var i=new ba(t,e,n);return i.texture.mapping=We,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function E_(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function T_(t,e,n){var i=new Float32Array(d_),r=new Ta(0,1,0),a=new Zs({name:"SphericalGaussianBlur",defines:{n:d_,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:"".concat(t,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:L_(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:Yt,depthTest:!1,depthWrite:!1});return a}function C_(){return new Zs({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:L_(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:Yt,depthTest:!1,depthWrite:!1})}function k_(){return new Zs({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:L_(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:Yt,depthTest:!1,depthWrite:!1})}function L_(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function P_(t){var e=new WeakMap,n=null;function i(i){if(i&&i.isTexture){var o=i.mapping,s=o===Ve||o===je,l=o===He||o===Ge;if(s||l){var h=e.get(i),u=void 0!==h?h.texture.pmremVersion:0;if(i.isRenderTargetTexture&&i.pmremVersion!==u)return null===n&&(n=new S_(t)),h=s?n.fromEquirectangular(i,h):n.fromCubemap(i,h),h.texture.pmremVersion=i.pmremVersion,e.set(i,h),h.texture;if(void 0!==h)return h.texture;var c=i.image;return s&&c&&c.height>0||l&&c&&r(c)?(null===n&&(n=new S_(t)),h=s?n.fromEquirectangular(i):n.fromCubemap(i),h.texture.pmremVersion=i.pmremVersion,e.set(i,h),i.addEventListener("dispose",a),h.texture):null}}return i}function r(t){for(var e=0,n=6,i=0;i<n;i++)void 0!==t[i]&&e++;return e===n}function a(t){var n=t.target;n.removeEventListener("dispose",a);var i=e.get(n);void 0!==i&&(e.delete(n),i.dispose())}function o(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}return{get:i,dispose:o}}function R_(t){var e={};function n(n){if(void 0!==e[n])return e[n];var i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i}return{has:function(t){return null!==n(t)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(t){var e=n(t);return null===e&&na("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function N_(t,e,n,i){var r={},a=new WeakMap;function o(t){var s=t.target;for(var l in null!==s.index&&e.remove(s.index),s.attributes)e.remove(s.attributes[l]);s.removeEventListener("dispose",o),delete r[s.id];var h=a.get(s);h&&(e.remove(h),a.delete(s)),i.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(t,e){return!0===r[e.id]||(e.addEventListener("dispose",o),r[e.id]=!0,n.memory.geometries++),e}function l(n){var i=n.attributes;for(var r in i)e.update(i[r],t.ARRAY_BUFFER)}function h(t){var n=[],i=t.index,r=t.attributes.position,o=0;if(null!==i){var s=i.array;o=i.version;for(var l=0,h=s.length;l<h;l+=3){var u=s[l+0],c=s[l+1],d=s[l+2];n.push(u,c,c,d,d,u)}}else{if(void 0===r)return;var f=r.array;o=r.version;for(var p=0,m=f.length/3-1;p<m;p+=3){var v=p+0,g=p+1,y=p+2;n.push(v,g,g,y,y,v)}}var _=new(Zr(n)?vs:ps)(n,1);_.version=o;var x=a.get(t);x&&e.remove(x),a.set(t,_)}function u(t){var e=a.get(t);if(e){var n=t.index;null!==n&&e.version<n.version&&h(t)}else h(t);return a.get(t)}return{get:s,update:l,getWireframeAttribute:u}}function I_(t,e,n){var i,r,a;function o(t){i=t}function s(t){r=t.type,a=t.bytesPerElement}function l(e,o){t.drawElements(i,o,r,e*a),n.update(o,i,1)}function h(e,o,s){0!==s&&(t.drawElementsInstanced(i,o,r,e*a,s),n.update(o,i,s))}function u(t,a,o){if(0!==o){var s=e.get("WEBGL_multi_draw");s.multiDrawElementsWEBGL(i,a,0,r,t,0,o);for(var l=0,h=0;h<o;h++)l+=a[h];n.update(l,i,1)}}function c(t,o,s,l){if(0!==s){var u=e.get("WEBGL_multi_draw");if(null===u)for(var c=0;c<t.length;c++)h(t[c]/a,o[c],l[c]);else{u.multiDrawElementsInstancedWEBGL(i,o,0,r,t,0,l,0,s);for(var d=0,f=0;f<s;f++)d+=o[f]*l[f];n.update(d,i,1)}}}this.setMode=o,this.setIndex=s,this.render=l,this.renderInstances=h,this.renderMultiDraw=u,this.renderMultiDrawInstances=c}function O_(t){var e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(e,i,r){switch(n.calls++,i){case t.TRIANGLES:n.triangles+=r*(e/3);break;case t.LINES:n.lines+=r*(e/2);break;case t.LINE_STRIP:n.lines+=r*(e-1);break;case t.LINE_LOOP:n.lines+=r*e;break;case t.POINTS:n.points+=r*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i);break}}function r(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:r,update:i}}function D_(t,e,n){var i=new WeakMap,r=new _a;function a(a,o,s){var l=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=void 0!==h?h.length:0,c=i.get(o);if(void 0===c||c.count!==u){var d=function(){S.dispose(),i.delete(o),o.removeEventListener("dispose",d)};void 0!==c&&c.texture.dispose();var f=void 0!==o.morphAttributes.position,p=void 0!==o.morphAttributes.normal,m=void 0!==o.morphAttributes.color,v=o.morphAttributes.position||[],g=o.morphAttributes.normal||[],y=o.morphAttributes.color||[],_=0;!0===f&&(_=1),!0===p&&(_=2),!0===m&&(_=3);var x=o.attributes.position.count*_,b=1;x>e.maxTextureSize&&(b=Math.ceil(x/e.maxTextureSize),x=e.maxTextureSize);var w=new Float32Array(x*b*4*u),S=new wa(w,x,b,u);S.type=fn,S.needsUpdate=!0;for(var M=4*_,A=0;A<u;A++)for(var E=v[A],T=g[A],C=y[A],k=x*b*4*A,L=0;L<E.count;L++){var P=L*M;!0===f&&(r.fromBufferAttribute(E,L),w[k+P+0]=r.x,w[k+P+1]=r.y,w[k+P+2]=r.z,w[k+P+3]=0),!0===p&&(r.fromBufferAttribute(T,L),w[k+P+4]=r.x,w[k+P+5]=r.y,w[k+P+6]=r.z,w[k+P+7]=0),!0===m&&(r.fromBufferAttribute(C,L),w[k+P+8]=r.x,w[k+P+9]=r.y,w[k+P+10]=r.z,w[k+P+11]=4===C.itemSize?r.w:1)}c={count:u,texture:S,size:new Xr(x,b)},i.set(o,c),o.addEventListener("dispose",d)}if(!0===a.isInstancedMesh&&null!==a.morphTexture)s.getUniforms().setValue(t,"morphTexture",a.morphTexture,n);else{for(var R=0,N=0;N<l.length;N++)R+=l[N];var I=o.morphTargetsRelative?1:1-R;s.getUniforms().setValue(t,"morphTargetBaseInfluence",I),s.getUniforms().setValue(t,"morphTargetInfluences",l)}s.getUniforms().setValue(t,"morphTargetsTexture",c.texture,n),s.getUniforms().setValue(t,"morphTargetsTextureSize",c.size)}return{update:a}}function F_(t,e,n,i){var r=new WeakMap;function a(a){var o=i.render.frame,l=a.geometry,h=e.get(a,l);if(r.get(h)!==o&&(e.update(h),r.set(h,o)),a.isInstancedMesh&&(!1===a.hasEventListener("dispose",s)&&a.addEventListener("dispose",s),r.get(a)!==o&&(n.update(a.instanceMatrix,t.ARRAY_BUFFER),null!==a.instanceColor&&n.update(a.instanceColor,t.ARRAY_BUFFER),r.set(a,o))),a.isSkinnedMesh){var u=a.skeleton;r.get(u)!==o&&(u.update(),r.set(u,o))}return h}function o(){r=new WeakMap}function s(t){var e=t.target;e.removeEventListener("dispose",s),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:a,dispose:o}}var U_=new ya,q_=new su(1,1),B_=new wa,z_=new Ma,H_=new al,G_=[],V_=[],j_=new Float32Array(16),W_=new Float32Array(9),X_=new Float32Array(4);function Y_(t,e,n){var i=t[0];if(i<=0||i>0)return t;var r=e*n,a=G_[r];if(void 0===a&&(a=new Float32Array(r),G_[r]=a),0!==e){i.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=n,t[o].toArray(a,s)}return a}function K_(t,e){if(t.length!==e.length)return!1;for(var n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function Z_(t,e){for(var n=0,i=e.length;n<i;n++)t[n]=e[n]}function J_(t,e){var n=V_[e];void 0===n&&(n=new Int32Array(e),V_[e]=n);for(var i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function Q_(t,e){var n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function $_(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(K_(n,e))return;t.uniform2fv(this.addr,e),Z_(n,e)}}function tx(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(K_(n,e))return;t.uniform3fv(this.addr,e),Z_(n,e)}}function ex(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(K_(n,e))return;t.uniform4fv(this.addr,e),Z_(n,e)}}function nx(t,e){var n=this.cache,i=e.elements;if(void 0===i){if(K_(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Z_(n,e)}else{if(K_(n,i))return;X_.set(i),t.uniformMatrix2fv(this.addr,!1,X_),Z_(n,i)}}function ix(t,e){var n=this.cache,i=e.elements;if(void 0===i){if(K_(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Z_(n,e)}else{if(K_(n,i))return;W_.set(i),t.uniformMatrix3fv(this.addr,!1,W_),Z_(n,i)}}function rx(t,e){var n=this.cache,i=e.elements;if(void 0===i){if(K_(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Z_(n,e)}else{if(K_(n,i))return;j_.set(i),t.uniformMatrix4fv(this.addr,!1,j_),Z_(n,i)}}function ax(t,e){var n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function ox(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(K_(n,e))return;t.uniform2iv(this.addr,e),Z_(n,e)}}function sx(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(K_(n,e))return;t.uniform3iv(this.addr,e),Z_(n,e)}}function lx(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(K_(n,e))return;t.uniform4iv(this.addr,e),Z_(n,e)}}function hx(t,e){var n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function ux(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(K_(n,e))return;t.uniform2uiv(this.addr,e),Z_(n,e)}}function cx(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(K_(n,e))return;t.uniform3uiv(this.addr,e),Z_(n,e)}}function dx(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(K_(n,e))return;t.uniform4uiv(this.addr,e),Z_(n,e)}}function fx(t,e,n){var i,r=this.cache,a=n.allocateTextureUnit();r[0]!==a&&(t.uniform1i(this.addr,a),r[0]=a),this.type===t.SAMPLER_2D_SHADOW?(q_.compareFunction=Qi,i=q_):i=U_,n.setTexture2D(e||i,a)}function px(t,e,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||z_,r)}function mx(t,e,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||H_,r)}function vx(t,e,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||B_,r)}function gx(t){switch(t){case 5126:return Q_;case 35664:return $_;case 35665:return tx;case 35666:return ex;case 35674:return nx;case 35675:return ix;case 35676:return rx;case 5124:case 35670:return ax;case 35667:case 35671:return ox;case 35668:case 35672:return sx;case 35669:case 35673:return lx;case 5125:return hx;case 36294:return ux;case 36295:return cx;case 36296:return dx;case 35678:case 36198:case 36298:case 36306:case 35682:return fx;case 35679:case 36299:case 36307:return px;case 35680:case 36300:case 36308:case 36293:return mx;case 36289:case 36303:case 36311:case 36292:return vx}}function yx(t,e){t.uniform1fv(this.addr,e)}function _x(t,e){var n=Y_(e,this.size,2);t.uniform2fv(this.addr,n)}function xx(t,e){var n=Y_(e,this.size,3);t.uniform3fv(this.addr,n)}function bx(t,e){var n=Y_(e,this.size,4);t.uniform4fv(this.addr,n)}function wx(t,e){var n=Y_(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Sx(t,e){var n=Y_(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Mx(t,e){var n=Y_(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Ax(t,e){t.uniform1iv(this.addr,e)}function Ex(t,e){t.uniform2iv(this.addr,e)}function Tx(t,e){t.uniform3iv(this.addr,e)}function Cx(t,e){t.uniform4iv(this.addr,e)}function kx(t,e){t.uniform1uiv(this.addr,e)}function Lx(t,e){t.uniform2uiv(this.addr,e)}function Px(t,e){t.uniform3uiv(this.addr,e)}function Rx(t,e){t.uniform4uiv(this.addr,e)}function Nx(t,e,n){var i=this.cache,r=e.length,a=J_(n,r);K_(i,a)||(t.uniform1iv(this.addr,a),Z_(i,a));for(var o=0;o!==r;++o)n.setTexture2D(e[o]||U_,a[o])}function Ix(t,e,n){var i=this.cache,r=e.length,a=J_(n,r);K_(i,a)||(t.uniform1iv(this.addr,a),Z_(i,a));for(var o=0;o!==r;++o)n.setTexture3D(e[o]||z_,a[o])}function Ox(t,e,n){var i=this.cache,r=e.length,a=J_(n,r);K_(i,a)||(t.uniform1iv(this.addr,a),Z_(i,a));for(var o=0;o!==r;++o)n.setTextureCube(e[o]||H_,a[o])}function Dx(t,e,n){var i=this.cache,r=e.length,a=J_(n,r);K_(i,a)||(t.uniform1iv(this.addr,a),Z_(i,a));for(var o=0;o!==r;++o)n.setTexture2DArray(e[o]||B_,a[o])}function Fx(t){switch(t){case 5126:return yx;case 35664:return _x;case 35665:return xx;case 35666:return bx;case 35674:return wx;case 35675:return Sx;case 35676:return Mx;case 5124:case 35670:return Ax;case 35667:case 35671:return Ex;case 35668:case 35672:return Tx;case 35669:case 35673:return Cx;case 5125:return kx;case 36294:return Lx;case 36295:return Px;case 36296:return Rx;case 35678:case 36198:case 36298:case 36306:case 35682:return Nx;case 35679:case 36299:case 36307:return Ix;case 35680:case 36300:case 36308:case 36293:return Ox;case 36289:case 36303:case 36311:case 36292:return Dx}}var Ux=ht()((function t(e,n,i){st()(this,t),this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.setValue=gx(n.type)})),qx=ht()((function t(e,n,i){st()(this,t),this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=Fx(n.type)})),Bx=function(){function t(e){st()(this,t),this.id=e,this.seq=[],this.map={}}return ht()(t,[{key:"setValue",value:function(t,e,n){for(var i=this.seq,r=0,a=i.length;r!==a;++r){var o=i[r];o.setValue(t,e[o.id],n)}}}])}(),zx=/(\w+)(\])?(\[|\.)?/g;function Hx(t,e){t.seq.push(e),t.map[e.id]=e}function Gx(t,e,n){var i=t.name,r=i.length;zx.lastIndex=0;while(1){var a=zx.exec(i),o=zx.lastIndex,s=a[1],l="]"===a[2],h=a[3];if(l&&(s|=0),void 0===h||"["===h&&o+2===r){Hx(n,void 0===h?new Ux(s,t,e):new qx(s,t,e));break}var u=n.map,c=u[s];void 0===c&&(c=new Bx(s),Hx(n,c)),n=c}}var Vx=function(){function t(e,n){st()(this,t),this.seq=[],this.map={};for(var i=e.getProgramParameter(n,e.ACTIVE_UNIFORMS),r=0;r<i;++r){var a=e.getActiveUniform(n,r),o=e.getUniformLocation(n,a.name);Gx(a,o,this)}}return ht()(t,[{key:"setValue",value:function(t,e,n,i){var r=this.map[e];void 0!==r&&r.setValue(t,n,i)}},{key:"setOptional",value:function(t,e,n){var i=e[n];void 0!==i&&this.setValue(t,n,i)}}],[{key:"upload",value:function(t,e,n,i){for(var r=0,a=e.length;r!==a;++r){var o=e[r],s=n[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,i)}}},{key:"seqWithValue",value:function(t,e){for(var n=[],i=0,r=t.length;i!==r;++i){var a=t[i];a.id in e&&n.push(a)}return n}}])}();function jx(t,e,n){var i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}var Wx=37297,Xx=0;function Yx(t,e){for(var n=t.split("\n"),i=[],r=Math.max(e-6,0),a=Math.min(e+6,n.length),o=r;o<a;o++){var s=o+1;i.push("".concat(s===e?">":" "," ").concat(s,": ").concat(n[o]))}return i.join("\n")}var Kx=new Yr;function Zx(t){ua._getMatrix(Kx,ua.workingColorSpace,t);var e="mat3( ".concat(Kx.elements.map((function(t){return t.toFixed(4)}))," )");switch(ua.getTransfer(t)){case Pi:return[e,"LinearTransferOETF"];case Ri:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function Jx(t,e,n){var i=t.getShaderParameter(e,t.COMPILE_STATUS),r=t.getShaderInfoLog(e).trim();if(i&&""===r)return"";var a=/ERROR: 0:(\d+)/.exec(r);if(a){var o=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+Yx(t.getShaderSource(e),o)}return r}function Qx(t,e){var n=Zx(e);return["vec4 ".concat(t,"( vec4 value ) {"),"\treturn ".concat(n[1],"( vec4( value.rgb * ").concat(n[0],", value.a ) );"),"}"].join("\n")}function $x(t,e){var n;switch(e){case Re:n="Linear";break;case Ne:n="Reinhard";break;case Ie:n="Cineon";break;case Oe:n="ACESFilmic";break;case Fe:n="AgX";break;case Ue:n="Neutral";break;case De:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}var tb=new Ta;function eb(){ua.getLuminanceCoefficients(tb);var t=tb.x.toFixed(4),e=tb.y.toFixed(4),n=tb.z.toFixed(4);return["float luminance( const in vec3 rgb ) {","\tconst vec3 weights = vec3( ".concat(t,", ").concat(e,", ").concat(n," );"),"\treturn dot( weights, rgb );","}"].join("\n")}function nb(t){var e=[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""];return e.filter(ab).join("\n")}function ib(t){var e=[];for(var n in t){var i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}function rb(t,e){for(var n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),r=0;r<i;r++){var a=t.getActiveAttrib(e,r),o=a.name,s=1;a.type===t.FLOAT_MAT2&&(s=2),a.type===t.FLOAT_MAT3&&(s=3),a.type===t.FLOAT_MAT4&&(s=4),n[o]={type:a.type,location:t.getAttribLocation(e,o),locationSize:s}}return n}function ab(t){return""!==t}function ob(t,e){var n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function sb(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var lb=/^[ \t]*#include +<([\w\d./]+)>/gm;function hb(t){return t.replace(lb,cb)}var ub=new Map;function cb(t,e){var n=Qy[e];if(void 0===n){var i=ub.get(e);if(void 0===i)throw new Error("Can not resolve #include <"+e+">");n=Qy[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i)}return hb(n)}var db=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function fb(t){return t.replace(db,pb)}function pb(t,e,n,i){for(var r="",a=parseInt(e);a<parseInt(n);a++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return r}function mb(t){var e="precision ".concat(t.precision," float;\n\tprecision ").concat(t.precision," int;\n\tprecision ").concat(t.precision," sampler2D;\n\tprecision ").concat(t.precision," samplerCube;\n\tprecision ").concat(t.precision," sampler3D;\n\tprecision ").concat(t.precision," sampler2DArray;\n\tprecision ").concat(t.precision," sampler2DShadow;\n\tprecision ").concat(t.precision," samplerCubeShadow;\n\tprecision ").concat(t.precision," sampler2DArrayShadow;\n\tprecision ").concat(t.precision," isampler2D;\n\tprecision ").concat(t.precision," isampler3D;\n\tprecision ").concat(t.precision," isamplerCube;\n\tprecision ").concat(t.precision," isampler2DArray;\n\tprecision ").concat(t.precision," usampler2D;\n\tprecision ").concat(t.precision," usampler3D;\n\tprecision ").concat(t.precision," usamplerCube;\n\tprecision ").concat(t.precision," usampler2DArray;\n\t");return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function vb(t){var e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===Ht?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===Gt?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===Vt&&(e="SHADOWMAP_TYPE_VSM"),e}function gb(t){var e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case He:case Ge:e="ENVMAP_TYPE_CUBE";break;case We:e="ENVMAP_TYPE_CUBE_UV";break}return e}function yb(t){var e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case Ge:e="ENVMAP_MODE_REFRACTION";break}return e}function _b(t){var e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case Ce:e="ENVMAP_BLENDING_MULTIPLY";break;case ke:e="ENVMAP_BLENDING_MIX";break;case Le:e="ENVMAP_BLENDING_ADD";break}return e}function xb(t){var e=t.envMapCubeUVHeight;if(null===e)return null;var n=Math.log2(e)-2,i=1/e,r=1/(3*Math.max(Math.pow(2,n),112));return{texelWidth:r,texelHeight:i,maxMip:n}}function bb(t,e,n,i){var r,a,o=t.getContext(),s=n.defines,l=n.vertexShader,h=n.fragmentShader,u=vb(n),c=gb(n),d=yb(n),f=_b(n),p=xb(n),m=nb(n),v=ib(s),g=o.createProgram(),y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(r=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v].filter(ab).join("\n"),r.length>0&&(r+="\n"),a=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v].filter(ab).join("\n"),a.length>0&&(a+="\n")):(r=[mb(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(ab).join("\n"),a=[mb(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Pe?"#define TONE_MAPPING":"",n.toneMapping!==Pe?Qy["tonemapping_pars_fragment"]:"",n.toneMapping!==Pe?$x("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Qy["colorspace_pars_fragment"],Qx("linearToOutputTexel",n.outputColorSpace),eb(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(ab).join("\n")),l=hb(l),l=ob(l,n),l=sb(l,n),h=hb(h),h=ob(h,n),h=sb(h,n),l=fb(l),h=fb(h),!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",r=[m,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+r,a=["#define varying in",n.glslVersion===fr?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===fr?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+a);var _,x,b=y+r+l,w=y+a+h,S=jx(o,o.VERTEX_SHADER,b),M=jx(o,o.FRAGMENT_SHADER,w);function A(e){if(t.debug.checkShaderErrors){var n=o.getProgramInfoLog(g).trim(),i=o.getShaderInfoLog(S).trim(),s=o.getShaderInfoLog(M).trim(),l=!0,h=!0;if(!1===o.getProgramParameter(g,o.LINK_STATUS))if(l=!1,"function"===typeof t.debug.onShaderError)t.debug.onShaderError(o,g,S,M);else{var u=Jx(o,S,"vertex"),c=Jx(o,M,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(g,o.VALIDATE_STATUS)+"\n\nMaterial Name: "+e.name+"\nMaterial Type: "+e.type+"\n\nProgram Info Log: "+n+"\n"+u+"\n"+c)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==s||(h=!1);h&&(e.diagnostics={runnable:l,programLog:n,vertexShader:{log:i,prefix:r},fragmentShader:{log:s,prefix:a}})}o.deleteShader(S),o.deleteShader(M),_=new Vx(o,g),x=rb(o,g)}o.attachShader(g,S),o.attachShader(g,M),void 0!==n.index0AttributeName?o.bindAttribLocation(g,0,n.index0AttributeName):!0===n.morphTargets&&o.bindAttribLocation(g,0,"position"),o.linkProgram(g),this.getUniforms=function(){return void 0===_&&A(this),_},this.getAttributes=function(){return void 0===x&&A(this),x};var E=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===E&&(E=o.getProgramParameter(g,Wx)),E},this.destroy=function(){i.releaseStatesOfProgram(this),o.deleteProgram(g),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Xx++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=S,this.fragmentShader=M,this}var wb=0,Sb=function(){function t(){st()(this,t),this.shaderCache=new Map,this.materialCache=new Map}return ht()(t,[{key:"update",value:function(t){var e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(t);return!1===a.has(i)&&(a.add(i),i.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}},{key:"remove",value:function(t){var e,n=this.materialCache.get(t),i=pv(n);try{for(i.s();!(e=i.n()).done;){var r=e.value;r.usedTimes--,0===r.usedTimes&&this.shaderCache.delete(r.code)}}catch(a){i.e(a)}finally{i.f()}return this.materialCache.delete(t),this}},{key:"getVertexShaderID",value:function(t){return this._getShaderStage(t.vertexShader).id}},{key:"getFragmentShaderID",value:function(t){return this._getShaderStage(t.fragmentShader).id}},{key:"dispose",value:function(){this.shaderCache.clear(),this.materialCache.clear()}},{key:"_getShaderCacheForMaterial",value:function(t){var e=this.materialCache,n=e.get(t);return void 0===n&&(n=new Set,e.set(t,n)),n}},{key:"_getShaderStage",value:function(t){var e=this.shaderCache,n=e.get(t);return void 0===n&&(n=new Mb(t),e.set(t,n)),n}}])}(),Mb=ht()((function t(e){st()(this,t),this.id=wb++,this.code=e,this.usedTimes=0}));function Ab(t,e,n,i,r,a,o){var s=new mo,l=new Sb,h=new Set,u=[],c=r.logarithmicDepthBuffer,d=r.vertexTextures,f=r.precision,p={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 m(t){return h.add(t),0===t?"uv":"uv".concat(t)}function v(a,s,u,v,g){var y=v.fog,_=g.geometry,x=a.isMeshStandardMaterial?v.environment:null,b=(a.isMeshStandardMaterial?n:e).get(a.envMap||x),w=b&&b.mapping===We?b.image.height:null,S=p[a.type];null!==a.precision&&(f=r.getMaxPrecision(a.precision),f!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",f,"instead."));var M,A,E,T,C=_.morphAttributes.position||_.morphAttributes.normal||_.morphAttributes.color,k=void 0!==C?C.length:0,L=0;if(void 0!==_.morphAttributes.position&&(L=1),void 0!==_.morphAttributes.normal&&(L=2),void 0!==_.morphAttributes.color&&(L=3),S){var P=t_[S];M=P.vertexShader,A=P.fragmentShader}else M=a.vertexShader,A=a.fragmentShader,l.update(a),E=l.getVertexShaderID(a),T=l.getFragmentShaderID(a);var R=t.getRenderTarget(),N=t.state.buffers.depth.getReversed(),I=!0===g.isInstancedMesh,O=!0===g.isBatchedMesh,D=!!a.map,F=!!a.matcap,U=!!b,q=!!a.aoMap,B=!!a.lightMap,z=!!a.bumpMap,H=!!a.normalMap,G=!!a.displacementMap,V=!!a.emissiveMap,j=!!a.metalnessMap,W=!!a.roughnessMap,X=a.anisotropy>0,Y=a.clearcoat>0,K=a.dispersion>0,Z=a.iridescence>0,J=a.sheen>0,Q=a.transmission>0,$=X&&!!a.anisotropyMap,tt=Y&&!!a.clearcoatMap,et=Y&&!!a.clearcoatNormalMap,nt=Y&&!!a.clearcoatRoughnessMap,it=Z&&!!a.iridescenceMap,rt=Z&&!!a.iridescenceThicknessMap,at=J&&!!a.sheenColorMap,ot=J&&!!a.sheenRoughnessMap,st=!!a.specularMap,lt=!!a.specularColorMap,ht=!!a.specularIntensityMap,ut=Q&&!!a.transmissionMap,ct=Q&&!!a.thicknessMap,dt=!!a.gradientMap,ft=!!a.alphaMap,pt=a.alphaTest>0,mt=!!a.alphaHash,vt=!!a.extensions,gt=Pe;a.toneMapped&&(null!==R&&!0!==R.isXRRenderTarget||(gt=t.toneMapping));var yt={shaderID:S,shaderType:a.type,shaderName:a.name,vertexShader:M,fragmentShader:A,defines:a.defines,customVertexShaderID:E,customFragmentShaderID:T,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:f,batching:O,batchingColor:O&&null!==g._colorsTexture,instancing:I,instancingColor:I&&null!==g.instanceColor,instancingMorph:I&&null!==g.morphTexture,supportsVertexTextures:d,outputColorSpace:null===R?t.outputColorSpace:!0===R.isXRRenderTarget?R.texture.colorSpace:Li,alphaToCoverage:!!a.alphaToCoverage,map:D,matcap:F,envMap:U,envMapMode:U&&b.mapping,envMapCubeUVHeight:w,aoMap:q,lightMap:B,bumpMap:z,normalMap:H,displacementMap:d&&G,emissiveMap:V,normalMapObjectSpace:H&&a.normalMapType===Ti,normalMapTangentSpace:H&&a.normalMapType===Ei,metalnessMap:j,roughnessMap:W,anisotropy:X,anisotropyMap:$,clearcoat:Y,clearcoatMap:tt,clearcoatNormalMap:et,clearcoatRoughnessMap:nt,dispersion:K,iridescence:Z,iridescenceMap:it,iridescenceThicknessMap:rt,sheen:J,sheenColorMap:at,sheenRoughnessMap:ot,specularMap:st,specularColorMap:lt,specularIntensityMap:ht,transmission:Q,transmissionMap:ut,thicknessMap:ct,gradientMap:dt,opaque:!1===a.transparent&&a.blending===Kt&&!1===a.alphaToCoverage,alphaMap:ft,alphaTest:pt,alphaHash:mt,combine:a.combine,mapUv:D&&m(a.map.channel),aoMapUv:q&&m(a.aoMap.channel),lightMapUv:B&&m(a.lightMap.channel),bumpMapUv:z&&m(a.bumpMap.channel),normalMapUv:H&&m(a.normalMap.channel),displacementMapUv:G&&m(a.displacementMap.channel),emissiveMapUv:V&&m(a.emissiveMap.channel),metalnessMapUv:j&&m(a.metalnessMap.channel),roughnessMapUv:W&&m(a.roughnessMap.channel),anisotropyMapUv:$&&m(a.anisotropyMap.channel),clearcoatMapUv:tt&&m(a.clearcoatMap.channel),clearcoatNormalMapUv:et&&m(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:nt&&m(a.clearcoatRoughnessMap.channel),iridescenceMapUv:it&&m(a.iridescenceMap.channel),iridescenceThicknessMapUv:rt&&m(a.iridescenceThicknessMap.channel),sheenColorMapUv:at&&m(a.sheenColorMap.channel),sheenRoughnessMapUv:ot&&m(a.sheenRoughnessMap.channel),specularMapUv:st&&m(a.specularMap.channel),specularColorMapUv:lt&&m(a.specularColorMap.channel),specularIntensityMapUv:ht&&m(a.specularIntensityMap.channel),transmissionMapUv:ut&&m(a.transmissionMap.channel),thicknessMapUv:ct&&m(a.thicknessMap.channel),alphaMapUv:ft&&m(a.alphaMap.channel),vertexTangents:!!_.attributes.tangent&&(H||X),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!_.attributes.color&&4===_.attributes.color.itemSize,pointsUvs:!0===g.isPoints&&!!_.attributes.uv&&(D||ft),fog:!!y,useFog:!0===a.fog,fogExp2:!!y&&y.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:c,reverseDepthBuffer:N,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==_.morphAttributes.position,morphNormals:void 0!==_.morphAttributes.normal,morphColors:void 0!==_.morphAttributes.color,morphTargetsCount:k,morphTextureStride:L,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:t.shadowMap.enabled&&u.length>0,shadowMapType:t.shadowMap.type,toneMapping:gt,decodeVideoTexture:D&&!0===a.map.isVideoTexture&&ua.getTransfer(a.map.colorSpace)===Ri,decodeVideoTextureEmissive:V&&!0===a.emissiveMap.isVideoTexture&&ua.getTransfer(a.emissiveMap.colorSpace)===Ri,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===Xt,flipSided:a.side===Wt,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:vt&&!0===a.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(vt&&!0===a.extensions.multiDraw||O)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return yt.vertexUv1s=h.has(1),yt.vertexUv2s=h.has(2),yt.vertexUv3s=h.has(3),h.clear(),yt}function g(e){var n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(var i in e.defines)n.push(i),n.push(e.defines[i]);return!1===e.isRawShaderMaterial&&(y(n,e),_(n,e),n.push(t.outputColorSpace)),n.push(e.customProgramCacheKey),n.join()}function y(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.numLightProbes),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}function _(t,e){s.disableAll(),e.supportsVertexTextures&&s.enable(0),e.instancing&&s.enable(1),e.instancingColor&&s.enable(2),e.instancingMorph&&s.enable(3),e.matcap&&s.enable(4),e.envMap&&s.enable(5),e.normalMapObjectSpace&&s.enable(6),e.normalMapTangentSpace&&s.enable(7),e.clearcoat&&s.enable(8),e.iridescence&&s.enable(9),e.alphaTest&&s.enable(10),e.vertexColors&&s.enable(11),e.vertexAlphas&&s.enable(12),e.vertexUv1s&&s.enable(13),e.vertexUv2s&&s.enable(14),e.vertexUv3s&&s.enable(15),e.vertexTangents&&s.enable(16),e.anisotropy&&s.enable(17),e.alphaHash&&s.enable(18),e.batching&&s.enable(19),e.dispersion&&s.enable(20),e.batchingColor&&s.enable(21),t.push(s.mask),s.disableAll(),e.fog&&s.enable(0),e.useFog&&s.enable(1),e.flatShading&&s.enable(2),e.logarithmicDepthBuffer&&s.enable(3),e.reverseDepthBuffer&&s.enable(4),e.skinning&&s.enable(5),e.morphTargets&&s.enable(6),e.morphNormals&&s.enable(7),e.morphColors&&s.enable(8),e.premultipliedAlpha&&s.enable(9),e.shadowMapEnabled&&s.enable(10),e.doubleSided&&s.enable(11),e.flipSided&&s.enable(12),e.useDepthPacking&&s.enable(13),e.dithering&&s.enable(14),e.transmission&&s.enable(15),e.sheen&&s.enable(16),e.opaque&&s.enable(17),e.pointsUvs&&s.enable(18),e.decodeVideoTexture&&s.enable(19),e.decodeVideoTextureEmissive&&s.enable(20),e.alphaToCoverage&&s.enable(21),t.push(s.mask)}function x(t){var e,n=p[t.type];if(n){var i=t_[n];e=Xs.clone(i.uniforms)}else e=t.uniforms;return e}function b(e,n){for(var i,r=0,o=u.length;r<o;r++){var s=u[r];if(s.cacheKey===n){i=s,++i.usedTimes;break}}return void 0===i&&(i=new bb(t,n,e,a),u.push(i)),i}function w(t){if(0===--t.usedTimes){var e=u.indexOf(t);u[e]=u[u.length-1],u.pop(),t.destroy()}}function S(t){l.remove(t)}function M(){l.dispose()}return{getParameters:v,getProgramCacheKey:g,getUniforms:x,acquireProgram:b,releaseProgram:w,releaseShaderCache:S,programs:u,dispose:M}}function Eb(){var t=new WeakMap;function e(e){return t.has(e)}function n(e){var n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n}function i(e){t.delete(e)}function r(e,n,i){t.get(e)[n]=i}function a(){t=new WeakMap}return{has:e,get:n,remove:i,update:r,dispose:a}}function Tb(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Cb(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function kb(){var t=[],e=0,n=[],i=[],r=[];function a(){e=0,n.length=0,i.length=0,r.length=0}function o(n,i,r,a,o,s){var l=t[e];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:a,renderOrder:n.renderOrder,z:o,group:s},t[e]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=o,l.group=s),e++,l}function s(t,e,a,s,l,h){var u=o(t,e,a,s,l,h);a.transmission>0?i.push(u):!0===a.transparent?r.push(u):n.push(u)}function l(t,e,a,s,l,h){var u=o(t,e,a,s,l,h);a.transmission>0?i.unshift(u):!0===a.transparent?r.unshift(u):n.unshift(u)}function h(t,e){n.length>1&&n.sort(t||Tb),i.length>1&&i.sort(e||Cb),r.length>1&&r.sort(e||Cb)}function u(){for(var n=e,i=t.length;n<i;n++){var r=t[n];if(null===r.id)break;r.id=null,r.object=null,r.geometry=null,r.material=null,r.group=null}}return{opaque:n,transmissive:i,transparent:r,init:a,push:s,unshift:l,finish:u,sort:h}}function Lb(){var t=new WeakMap;function e(e,n){var i,r=t.get(e);return void 0===r?(i=new kb,t.set(e,[i])):n>=r.length?(i=new kb,r.push(i)):i=r[n],i}function n(){t=new WeakMap}return{get:e,dispose:n}}function Pb(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new Ta,color:new Zo};break;case"SpotLight":n={position:new Ta,direction:new Ta,color:new Zo,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Ta,color:new Zo,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Ta,skyColor:new Zo,groundColor:new Zo};break;case"RectAreaLight":n={color:new Zo,position:new Ta,halfWidth:new Ta,halfHeight:new Ta};break}return t[e.id]=n,n}}}function Rb(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Xr};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Xr};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Xr,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}var Nb=0;function Ib(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Ob(t){for(var e=new Pb,n=Rb(),i={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},r=0;r<9;r++)i.probe.push(new Ta);var a=new Ta,o=new io,s=new io;function l(r){for(var a=0,o=0,s=0,l=0;l<9;l++)i.probe[l].set(0,0,0);var h=0,u=0,c=0,d=0,f=0,p=0,m=0,v=0,g=0,y=0,_=0;r.sort(Ib);for(var x=0,b=r.length;x<b;x++){var w=r[x],S=w.color,M=w.intensity,A=w.distance,E=w.shadow&&w.shadow.map?w.shadow.map.texture:null;if(w.isAmbientLight)a+=S.r*M,o+=S.g*M,s+=S.b*M;else if(w.isLightProbe){for(var T=0;T<9;T++)i.probe[T].addScaledVector(w.sh.coefficients[T],M);_++}else if(w.isDirectionalLight){var C=e.get(w);if(C.color.copy(w.color).multiplyScalar(w.intensity),w.castShadow){var k=w.shadow,L=n.get(w);L.shadowIntensity=k.intensity,L.shadowBias=k.bias,L.shadowNormalBias=k.normalBias,L.shadowRadius=k.radius,L.shadowMapSize=k.mapSize,i.directionalShadow[h]=L,i.directionalShadowMap[h]=E,i.directionalShadowMatrix[h]=w.shadow.matrix,p++}i.directional[h]=C,h++}else if(w.isSpotLight){var P=e.get(w);P.position.setFromMatrixPosition(w.matrixWorld),P.color.copy(S).multiplyScalar(M),P.distance=A,P.coneCos=Math.cos(w.angle),P.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),P.decay=w.decay,i.spot[c]=P;var R=w.shadow;if(w.map&&(i.spotLightMap[g]=w.map,g++,R.updateMatrices(w),w.castShadow&&y++),i.spotLightMatrix[c]=R.matrix,w.castShadow){var N=n.get(w);N.shadowIntensity=R.intensity,N.shadowBias=R.bias,N.shadowNormalBias=R.normalBias,N.shadowRadius=R.radius,N.shadowMapSize=R.mapSize,i.spotShadow[c]=N,i.spotShadowMap[c]=E,v++}c++}else if(w.isRectAreaLight){var I=e.get(w);I.color.copy(S).multiplyScalar(M),I.halfWidth.set(.5*w.width,0,0),I.halfHeight.set(0,.5*w.height,0),i.rectArea[d]=I,d++}else if(w.isPointLight){var O=e.get(w);if(O.color.copy(w.color).multiplyScalar(w.intensity),O.distance=w.distance,O.decay=w.decay,w.castShadow){var D=w.shadow,F=n.get(w);F.shadowIntensity=D.intensity,F.shadowBias=D.bias,F.shadowNormalBias=D.normalBias,F.shadowRadius=D.radius,F.shadowMapSize=D.mapSize,F.shadowCameraNear=D.camera.near,F.shadowCameraFar=D.camera.far,i.pointShadow[u]=F,i.pointShadowMap[u]=E,i.pointShadowMatrix[u]=w.shadow.matrix,m++}i.point[u]=O,u++}else if(w.isHemisphereLight){var U=e.get(w);U.skyColor.copy(w.color).multiplyScalar(M),U.groundColor.copy(w.groundColor).multiplyScalar(M),i.hemi[f]=U,f++}}d>0&&(!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=$y.LTC_FLOAT_1,i.rectAreaLTC2=$y.LTC_FLOAT_2):(i.rectAreaLTC1=$y.LTC_HALF_1,i.rectAreaLTC2=$y.LTC_HALF_2)),i.ambient[0]=a,i.ambient[1]=o,i.ambient[2]=s;var q=i.hash;q.directionalLength===h&&q.pointLength===u&&q.spotLength===c&&q.rectAreaLength===d&&q.hemiLength===f&&q.numDirectionalShadows===p&&q.numPointShadows===m&&q.numSpotShadows===v&&q.numSpotMaps===g&&q.numLightProbes===_||(i.directional.length=h,i.spot.length=c,i.rectArea.length=d,i.point.length=u,i.hemi.length=f,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=m,i.pointShadowMap.length=m,i.spotShadow.length=v,i.spotShadowMap.length=v,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=m,i.spotLightMatrix.length=v+g-y,i.spotLightMap.length=g,i.numSpotLightShadowsWithMaps=y,i.numLightProbes=_,q.directionalLength=h,q.pointLength=u,q.spotLength=c,q.rectAreaLength=d,q.hemiLength=f,q.numDirectionalShadows=p,q.numPointShadows=m,q.numSpotShadows=v,q.numSpotMaps=g,q.numLightProbes=_,i.version=Nb++)}function h(t,e){for(var n=0,r=0,l=0,h=0,u=0,c=e.matrixWorldInverse,d=0,f=t.length;d<f;d++){var p=t[d];if(p.isDirectionalLight){var m=i.directional[n];m.direction.setFromMatrixPosition(p.matrixWorld),a.setFromMatrixPosition(p.target.matrixWorld),m.direction.sub(a),m.direction.transformDirection(c),n++}else if(p.isSpotLight){var v=i.spot[l];v.position.setFromMatrixPosition(p.matrixWorld),v.position.applyMatrix4(c),v.direction.setFromMatrixPosition(p.matrixWorld),a.setFromMatrixPosition(p.target.matrixWorld),v.direction.sub(a),v.direction.transformDirection(c),l++}else if(p.isRectAreaLight){var g=i.rectArea[h];g.position.setFromMatrixPosition(p.matrixWorld),g.position.applyMatrix4(c),s.identity(),o.copy(p.matrixWorld),o.premultiply(c),s.extractRotation(o),g.halfWidth.set(.5*p.width,0,0),g.halfHeight.set(0,.5*p.height,0),g.halfWidth.applyMatrix4(s),g.halfHeight.applyMatrix4(s),h++}else if(p.isPointLight){var y=i.point[r];y.position.setFromMatrixPosition(p.matrixWorld),y.position.applyMatrix4(c),r++}else if(p.isHemisphereLight){var _=i.hemi[u];_.direction.setFromMatrixPosition(p.matrixWorld),_.direction.transformDirection(c),u++}}}return{setup:l,setupView:h,state:i}}function Db(t){var e=new Ob(t),n=[],i=[];function r(t){h.camera=t,n.length=0,i.length=0}function a(t){n.push(t)}function o(t){i.push(t)}function s(){e.setup(n)}function l(t){e.setupView(n,t)}var h={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:h,setupLights:s,setupLightsView:l,pushLight:a,pushShadow:o}}function Fb(t){var e=new WeakMap;function n(n){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=e.get(n);return void 0===a?(i=new Db(t),e.set(n,[i])):r>=a.length?(i=new Db(t),a.push(i)):i=a[r],i}function i(){e=new WeakMap}return{get:n,dispose:i}}var Ub="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",qb="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}";function Bb(t,e,n){var i=new uh,r=new Xr,a=new Xr,o=new _a,s=new ad({depthPacking:Si}),l=new od,h={},u=n.maxTextureSize,c=At()(At()(At()({},jt,Wt),Wt,jt),Xt,Xt),d=new Zs({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Xr},radius:{value:4}},vertexShader:Ub,fragmentShader:qb}),f=d.clone();f.defines.HORIZONTAL_PASS=1;var p=new Es;p.setAttribute("position",new hs(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var m=new Us(p,d),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ht;var g=this.type;function y(n,i){var a=e.update(m);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,f.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new ba(r.x,r.y)),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,a,d,m,null),f.uniforms.shadow_pass.value=n.mapPass.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,a,f,m,null)}function _(e,n,i,r){var a=null,o=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==o)a=o;else if(a=!0===i.isPointLight?l:s,t.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||!0===n.alphaToCoverage){var u=a.uuid,d=n.uuid,f=h[u];void 0===f&&(f={},h[u]=f);var p=f[d];void 0===p&&(p=a.clone(),f[d]=p,n.addEventListener("dispose",b)),a=p}if(a.visible=n.visible,a.wireframe=n.wireframe,a.side=r===Vt?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:c[n.side],a.alphaMap=n.alphaMap,a.alphaTest=!0===n.alphaToCoverage?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial){var m=t.properties.get(a);m.light=i}return a}function x(n,r,a,o,s){if(!1!==n.visible){var l=n.layers.test(r.layers);if(l&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===Vt)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var h=e.update(n),u=n.material;if(Array.isArray(u))for(var c=h.groups,d=0,f=c.length;d<f;d++){var p=c[d],m=u[p.materialIndex];if(m&&m.visible){var v=_(n,m,o,s);n.onBeforeShadow(t,n,r,a,h,v,p),t.renderBufferDirect(a,null,h,v,n,p),n.onAfterShadow(t,n,r,a,h,v,p)}}else if(u.visible){var g=_(n,u,o,s);n.onBeforeShadow(t,n,r,a,h,g,null),t.renderBufferDirect(a,null,h,g,n,null),n.onAfterShadow(t,n,r,a,h,g,null)}}for(var y=n.children,b=0,w=y.length;b<w;b++)x(y[b],r,a,o,s)}}function b(t){var e=t.target;for(var n in e.removeEventListener("dispose",b),h){var i=h[n],r=t.target.uuid;if(r in i){var a=i[r];a.dispose(),delete i[r]}}}this.render=function(e,n,s){if(!1!==v.enabled&&(!1!==v.autoUpdate||!1!==v.needsUpdate)&&0!==e.length){var l=t.getRenderTarget(),h=t.getActiveCubeFace(),c=t.getActiveMipmapLevel(),d=t.state;d.setBlending(Yt),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(var f=g!==Vt&&this.type===Vt,p=g===Vt&&this.type!==Vt,m=0,_=e.length;m<_;m++){var b=e[m],w=b.shadow;if(void 0!==w){if(!1!==w.autoUpdate||!1!==w.needsUpdate){r.copy(w.mapSize);var S=w.getFrameExtents();if(r.multiply(S),a.copy(w.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(a.x=Math.floor(u/S.x),r.x=a.x*S.x,w.mapSize.x=a.x),r.y>u&&(a.y=Math.floor(u/S.y),r.y=a.y*S.y,w.mapSize.y=a.y)),null===w.map||!0===f||!0===p){var M=this.type!==Vt?{minFilter:Ze,magFilter:Ze}:{};null!==w.map&&w.map.dispose(),w.map=new ba(r.x,r.y,M),w.map.texture.name=b.name+".shadowMap",w.camera.updateProjectionMatrix()}t.setRenderTarget(w.map),t.clear();for(var A=w.getViewportCount(),E=0;E<A;E++){var T=w.getViewport(E);o.set(a.x*T.x,a.y*T.y,a.x*T.z,a.y*T.w),d.viewport(o),w.updateMatrices(b,E),i=w.getFrustum(),x(n,s,w.camera,b,this.type)}!0!==w.isPointLightShadow&&this.type===Vt&&y(w,s),w.needsUpdate=!1}}else console.warn("THREE.WebGLShadowMap:",b,"has no shadow.")}g=this.type,v.needsUpdate=!1,t.setRenderTarget(l,h,c)}}}var zb=At()(At()(At()(At()(At()(At()(At()(At()({},xe,be),we,Ee),Me,Te),Se,Ae),be,xe),Ee,we),Te,Me),Ae,Se);function Hb(t,e){var n;function i(){var e=!1,n=new _a,i=null,r=new _a(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,a,o,s){!0===s&&(e*=o,i*=o,a*=o),n.set(e,i,a,o),!1===r.equals(n)&&(t.clearColor(e,i,a,o),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}}function r(){var n=!1,i=!1,r=null,a=null,o=null;return{setReversed:function(t){if(i!==t){var n=e.get("EXT_clip_control");t?n.clipControlEXT(n.LOWER_LEFT_EXT,n.ZERO_TO_ONE_EXT):n.clipControlEXT(n.LOWER_LEFT_EXT,n.NEGATIVE_ONE_TO_ONE_EXT),i=t;var r=o;o=null,this.setClear(r)}},getReversed:function(){return i},setTest:function(e){e?V(t.DEPTH_TEST):j(t.DEPTH_TEST)},setMask:function(e){r===e||n||(t.depthMask(e),r=e)},setFunc:function(e){if(i&&(e=zb[e]),a!==e){switch(e){case xe:t.depthFunc(t.NEVER);break;case be:t.depthFunc(t.ALWAYS);break;case we:t.depthFunc(t.LESS);break;case Se:t.depthFunc(t.LEQUAL);break;case Me:t.depthFunc(t.EQUAL);break;case Ae:t.depthFunc(t.GEQUAL);break;case Ee:t.depthFunc(t.GREATER);break;case Te:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}a=e}},setLocked:function(t){n=t},setClear:function(e){o!==e&&(i&&(e=1-e),t.clearDepth(e),o=e)},reset:function(){n=!1,r=null,a=null,o=null,i=!1}}}function a(){var e=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,h=null;return{setTest:function(n){e||(n?V(t.STENCIL_TEST):j(t.STENCIL_TEST))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,o){i===e&&r===n&&a===o||(t.stencilFunc(e,n,o),i=e,r=n,a=o)},setOp:function(e,n,i){o===e&&s===n&&l===i||(t.stencilOp(e,n,i),o=e,s=n,l=i)},setLocked:function(t){e=t},setClear:function(e){h!==e&&(t.clearStencil(e),h=e)},reset:function(){e=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,h=null}}}var o=new i,s=new r,l=new a,h=new WeakMap,u=new WeakMap,c={},d={},f=new WeakMap,p=[],m=null,v=!1,g=null,y=null,_=null,x=null,b=null,w=null,S=null,M=new Zo(0,0,0),A=0,E=!1,T=null,C=null,k=null,L=null,P=null,R=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),N=!1,I=0,O=t.getParameter(t.VERSION);-1!==O.indexOf("WebGL")?(I=parseFloat(/^WebGL (\d)/.exec(O)[1]),N=I>=1):-1!==O.indexOf("OpenGL ES")&&(I=parseFloat(/^OpenGL ES (\d)/.exec(O)[1]),N=I>=2);var D=null,F={},U=t.getParameter(t.SCISSOR_BOX),q=t.getParameter(t.VIEWPORT),B=(new _a).fromArray(U),z=(new _a).fromArray(q);function H(e,n,i,r){var a=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var s=0;s<i;s++)e===t.TEXTURE_3D||e===t.TEXTURE_2D_ARRAY?t.texImage3D(n,0,t.RGBA,1,1,r,0,t.RGBA,t.UNSIGNED_BYTE,a):t.texImage2D(n+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,a);return o}var G={};function V(e){!0!==c[e]&&(t.enable(e),c[e]=!0)}function j(e){!1!==c[e]&&(t.disable(e),c[e]=!1)}function W(e,n){return d[e]!==n&&(t.bindFramebuffer(e,n),d[e]=n,e===t.DRAW_FRAMEBUFFER&&(d[t.FRAMEBUFFER]=n),e===t.FRAMEBUFFER&&(d[t.DRAW_FRAMEBUFFER]=n),!0)}function X(e,n){var i=p,r=!1;if(e){i=f.get(n),void 0===i&&(i=[],f.set(n,i));var a=e.textures;if(i.length!==a.length||i[0]!==t.COLOR_ATTACHMENT0){for(var o=0,s=a.length;o<s;o++)i[o]=t.COLOR_ATTACHMENT0+o;i.length=a.length,r=!0}}else i[0]!==t.BACK&&(i[0]=t.BACK,r=!0);r&&t.drawBuffers(i)}function Y(e){return m!==e&&(t.useProgram(e),m=e,!0)}G[t.TEXTURE_2D]=H(t.TEXTURE_2D,t.TEXTURE_2D,1),G[t.TEXTURE_CUBE_MAP]=H(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),G[t.TEXTURE_2D_ARRAY]=H(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),G[t.TEXTURE_3D]=H(t.TEXTURE_3D,t.TEXTURE_3D,1,1),o.setClear(0,0,0,1),s.setClear(1),l.setClear(0),V(t.DEPTH_TEST),s.setFunc(Se),$(!1),tt(Ut),V(t.CULL_FACE),J(Yt);var K=At()(At()(At()({},te,t.FUNC_ADD),ee,t.FUNC_SUBTRACT),ne,t.FUNC_REVERSE_SUBTRACT);K[ie]=t.MIN,K[re]=t.MAX;var Z=(n={},At()(At()(At()(At()(At()(At()(At()(At()(At()(At()(n,ae,t.ZERO),oe,t.ONE),se,t.SRC_COLOR),he,t.SRC_ALPHA),me,t.SRC_ALPHA_SATURATE),fe,t.DST_COLOR),ce,t.DST_ALPHA),le,t.ONE_MINUS_SRC_COLOR),ue,t.ONE_MINUS_SRC_ALPHA),pe,t.ONE_MINUS_DST_COLOR),At()(At()(At()(At()(At()(n,de,t.ONE_MINUS_DST_ALPHA),ve,t.CONSTANT_COLOR),ge,t.ONE_MINUS_CONSTANT_COLOR),ye,t.CONSTANT_ALPHA),_e,t.ONE_MINUS_CONSTANT_ALPHA));function J(e,n,i,r,a,o,s,l,h,u){if(e!==Yt){if(!1===v&&(V(t.BLEND),v=!0),e===$t)a=a||n,o=o||i,s=s||r,n===y&&a===b||(t.blendEquationSeparate(K[n],K[a]),y=n,b=a),i===_&&r===x&&o===w&&s===S||(t.blendFuncSeparate(Z[i],Z[r],Z[o],Z[s]),_=i,x=r,w=o,S=s),!1!==l.equals(M)&&h===A||(t.blendColor(l.r,l.g,l.b,h),M.copy(l),A=h),g=e,E=!1;else if(e!==g||u!==E){if(y===te&&b===te||(t.blendEquation(t.FUNC_ADD),y=te,b=te),u)switch(e){case Kt:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case Zt:t.blendFunc(t.ONE,t.ONE);break;case Jt:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case Qt:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",e);break}else switch(e){case Kt:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case Zt:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case Jt:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case Qt:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",e);break}_=null,x=null,w=null,S=null,M.set(0,0,0),A=0,g=e,E=u}}else!0===v&&(j(t.BLEND),v=!1)}function Q(e,n){e.side===Xt?j(t.CULL_FACE):V(t.CULL_FACE);var i=e.side===Wt;n&&(i=!i),$(i),e.blending===Kt&&!1===e.transparent?J(Yt):J(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.blendColor,e.blendAlpha,e.premultipliedAlpha),s.setFunc(e.depthFunc),s.setTest(e.depthTest),s.setMask(e.depthWrite),o.setMask(e.colorWrite);var r=e.stencilWrite;l.setTest(r),r&&(l.setMask(e.stencilWriteMask),l.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),l.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),nt(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?V(t.SAMPLE_ALPHA_TO_COVERAGE):j(t.SAMPLE_ALPHA_TO_COVERAGE)}function $(e){T!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),T=e)}function tt(e){e!==Ft?(V(t.CULL_FACE),e!==C&&(e===Ut?t.cullFace(t.BACK):e===qt?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):j(t.CULL_FACE),C=e}function et(e){e!==k&&(N&&t.lineWidth(e),k=e)}function nt(e,n,i){e?(V(t.POLYGON_OFFSET_FILL),L===n&&P===i||(t.polygonOffset(n,i),L=n,P=i)):j(t.POLYGON_OFFSET_FILL)}function it(e){e?V(t.SCISSOR_TEST):j(t.SCISSOR_TEST)}function rt(e){void 0===e&&(e=t.TEXTURE0+R-1),D!==e&&(t.activeTexture(e),D=e)}function at(e,n,i){void 0===i&&(i=null===D?t.TEXTURE0+R-1:D);var r=F[i];void 0===r&&(r={type:void 0,texture:void 0},F[i]=r),r.type===e&&r.texture===n||(D!==i&&(t.activeTexture(i),D=i),t.bindTexture(e,n||G[e]),r.type=e,r.texture=n)}function ot(){var e=F[D];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)}function st(){try{t.compressedTexImage2D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function lt(){try{t.compressedTexImage3D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function ht(){try{t.texSubImage2D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function ut(){try{t.texSubImage3D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function ct(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function dt(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function ft(){try{t.texStorage2D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function pt(){try{t.texStorage3D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function mt(){try{t.texImage2D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function vt(){try{t.texImage3D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function gt(e){!1===B.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),B.copy(e))}function yt(e){!1===z.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),z.copy(e))}function _t(e,n){var i=u.get(n);void 0===i&&(i=new WeakMap,u.set(n,i));var r=i.get(e);void 0===r&&(r=t.getUniformBlockIndex(n,e.name),i.set(e,r))}function xt(e,n){var i=u.get(n),r=i.get(e);h.get(n)!==r&&(t.uniformBlockBinding(n,r,e.__bindingPointIndex),h.set(n,r))}function bt(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),s.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),c={},D=null,F={},d={},f=new WeakMap,p=[],m=null,v=!1,g=null,y=null,_=null,x=null,b=null,w=null,S=null,M=new Zo(0,0,0),A=0,E=!1,T=null,C=null,k=null,L=null,P=null,B.set(0,0,t.canvas.width,t.canvas.height),z.set(0,0,t.canvas.width,t.canvas.height),o.reset(),s.reset(),l.reset()}return{buffers:{color:o,depth:s,stencil:l},enable:V,disable:j,bindFramebuffer:W,drawBuffers:X,useProgram:Y,setBlending:J,setMaterial:Q,setFlipSided:$,setCullFace:tt,setLineWidth:et,setPolygonOffset:nt,setScissorTest:it,activeTexture:rt,bindTexture:at,unbindTexture:ot,compressedTexImage2D:st,compressedTexImage3D:lt,texImage2D:mt,texImage3D:vt,updateUBOMapping:_t,uniformBlockBinding:xt,texStorage2D:ft,texStorage3D:pt,texSubImage2D:ht,texSubImage3D:ut,compressedTexSubImage2D:ct,compressedTexSubImage3D:dt,scissor:gt,viewport:yt,reset:bt}}function Gb(t,e,n,i,r,a,o){var s,l=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,h="undefined"!==typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),u=new Xr,c=new WeakMap,d=new WeakMap,f=!1;try{f="undefined"!==typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(it){}function p(t,e){return f?new OffscreenCanvas(t,e):$r("canvas")}function m(t,e,n){var i=1,r=nt(t);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!==typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!==typeof VideoFrame&&t instanceof VideoFrame){var a=Math.floor(i*r.width),o=Math.floor(i*r.height);void 0===s&&(s=p(a,o));var l=e?p(a,o):s;l.width=a,l.height=o;var h=l.getContext("2d");return h.drawImage(t,0,0,a,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+a+"x"+o+")."),l}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),t}return t}function v(t){return t.generateMipmaps}function g(e){t.generateMipmap(e)}function y(e){return e.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:e.isWebGL3DRenderTarget?t.TEXTURE_3D:e.isWebGLArrayRenderTarget||e.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function _(n,i,r,a){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var s=i;if(i===t.RED&&(r===t.FLOAT&&(s=t.R32F),r===t.HALF_FLOAT&&(s=t.R16F),r===t.UNSIGNED_BYTE&&(s=t.R8)),i===t.RED_INTEGER&&(r===t.UNSIGNED_BYTE&&(s=t.R8UI),r===t.UNSIGNED_SHORT&&(s=t.R16UI),r===t.UNSIGNED_INT&&(s=t.R32UI),r===t.BYTE&&(s=t.R8I),r===t.SHORT&&(s=t.R16I),r===t.INT&&(s=t.R32I)),i===t.RG&&(r===t.FLOAT&&(s=t.RG32F),r===t.HALF_FLOAT&&(s=t.RG16F),r===t.UNSIGNED_BYTE&&(s=t.RG8)),i===t.RG_INTEGER&&(r===t.UNSIGNED_BYTE&&(s=t.RG8UI),r===t.UNSIGNED_SHORT&&(s=t.RG16UI),r===t.UNSIGNED_INT&&(s=t.RG32UI),r===t.BYTE&&(s=t.RG8I),r===t.SHORT&&(s=t.RG16I),r===t.INT&&(s=t.RG32I)),i===t.RGB_INTEGER&&(r===t.UNSIGNED_BYTE&&(s=t.RGB8UI),r===t.UNSIGNED_SHORT&&(s=t.RGB16UI),r===t.UNSIGNED_INT&&(s=t.RGB32UI),r===t.BYTE&&(s=t.RGB8I),r===t.SHORT&&(s=t.RGB16I),r===t.INT&&(s=t.RGB32I)),i===t.RGBA_INTEGER&&(r===t.UNSIGNED_BYTE&&(s=t.RGBA8UI),r===t.UNSIGNED_SHORT&&(s=t.RGBA16UI),r===t.UNSIGNED_INT&&(s=t.RGBA32UI),r===t.BYTE&&(s=t.RGBA8I),r===t.SHORT&&(s=t.RGBA16I),r===t.INT&&(s=t.RGBA32I)),i===t.RGB&&r===t.UNSIGNED_INT_5_9_9_9_REV&&(s=t.RGB9_E5),i===t.RGBA){var l=o?Pi:ua.getTransfer(a);r===t.FLOAT&&(s=t.RGBA32F),r===t.HALF_FLOAT&&(s=t.RGBA16F),r===t.UNSIGNED_BYTE&&(s=l===Ri?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(s=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(s=t.RGB5_A1)}return s!==t.R16F&&s!==t.R32F&&s!==t.RG16F&&s!==t.RG32F&&s!==t.RGBA16F&&s!==t.RGBA32F||e.get("EXT_color_buffer_float"),s}function x(e,n){var i;return e?null===n||n===dn||n===gn?i=t.DEPTH24_STENCIL8:n===fn?i=t.DEPTH32F_STENCIL8:n===un&&(i=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===dn||n===gn?i=t.DEPTH_COMPONENT24:n===fn?i=t.DEPTH_COMPONENT32F:n===un&&(i=t.DEPTH_COMPONENT16),i}function b(t,e){return!0===v(t)||t.isFramebufferTexture&&t.minFilter!==Ze&&t.minFilter!==en?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function w(t){var e=t.target;e.removeEventListener("dispose",w),M(e),e.isVideoTexture&&c.delete(e)}function S(t){var e=t.target;e.removeEventListener("dispose",S),E(e)}function M(t){var e=i.get(t);if(void 0!==e.__webglInit){var n=t.source,r=d.get(n);if(r){var a=r[e.__cacheKey];a.usedTimes--,0===a.usedTimes&&A(t),0===Object.keys(r).length&&d.delete(n)}i.remove(t)}}function A(e){var n=i.get(e);t.deleteTexture(n.__webglTexture);var r=e.source,a=d.get(r);delete a[n.__cacheKey],o.memory.textures--}function E(e){var n=i.get(e);if(e.depthTexture&&(e.depthTexture.dispose(),i.remove(e.depthTexture)),e.isWebGLCubeRenderTarget)for(var r=0;r<6;r++){if(Array.isArray(n.__webglFramebuffer[r]))for(var a=0;a<n.__webglFramebuffer[r].length;a++)t.deleteFramebuffer(n.__webglFramebuffer[r][a]);else t.deleteFramebuffer(n.__webglFramebuffer[r]);n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[r])}else{if(Array.isArray(n.__webglFramebuffer))for(var s=0;s<n.__webglFramebuffer.length;s++)t.deleteFramebuffer(n.__webglFramebuffer[s]);else t.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&t.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(var l=0;l<n.__webglColorRenderbuffer.length;l++)n.__webglColorRenderbuffer[l]&&t.deleteRenderbuffer(n.__webglColorRenderbuffer[l]);n.__webglDepthRenderbuffer&&t.deleteRenderbuffer(n.__webglDepthRenderbuffer)}for(var h=e.textures,u=0,c=h.length;u<c;u++){var d=i.get(h[u]);d.__webglTexture&&(t.deleteTexture(d.__webglTexture),o.memory.textures--),i.remove(h[u])}i.remove(e)}var T=0;function C(){T=0}function k(){var t=T;return t>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+r.maxTextures),T+=1,t}function L(t){var e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}function P(e,r){var a=i.get(e);if(e.isVideoTexture&&tt(e),!1===e.isRenderTargetTexture&&e.version>0&&a.__version!==e.version){var o=e.image;if(null===o)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==o.complete)return void B(a,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(t.TEXTURE_2D,a.__webglTexture,t.TEXTURE0+r)}function R(e,r){var a=i.get(e);e.version>0&&a.__version!==e.version?B(a,e,r):n.bindTexture(t.TEXTURE_2D_ARRAY,a.__webglTexture,t.TEXTURE0+r)}function N(e,r){var a=i.get(e);e.version>0&&a.__version!==e.version?B(a,e,r):n.bindTexture(t.TEXTURE_3D,a.__webglTexture,t.TEXTURE0+r)}function I(e,r){var a=i.get(e);e.version>0&&a.__version!==e.version?z(a,e,r):n.bindTexture(t.TEXTURE_CUBE_MAP,a.__webglTexture,t.TEXTURE0+r)}var O=At()(At()(At()({},Xe,t.REPEAT),Ye,t.CLAMP_TO_EDGE),Ke,t.MIRRORED_REPEAT),D=At()(At()(At()(At()(At()(At()({},Ze,t.NEAREST),Je,t.NEAREST_MIPMAP_NEAREST),$e,t.NEAREST_MIPMAP_LINEAR),en,t.LINEAR),nn,t.LINEAR_MIPMAP_NEAREST),an,t.LINEAR_MIPMAP_LINEAR),F=At()(At()(At()(At()(At()(At()(At()(At()({},Ki,t.NEVER),nr,t.ALWAYS),Zi,t.LESS),Qi,t.LEQUAL),Ji,t.EQUAL),er,t.GEQUAL),$i,t.GREATER),tr,t.NOTEQUAL);function U(n,a){if(a.type!==fn||!1!==e.has("OES_texture_float_linear")||a.magFilter!==en&&a.magFilter!==nn&&a.magFilter!==$e&&a.magFilter!==an&&a.minFilter!==en&&a.minFilter!==nn&&a.minFilter!==$e&&a.minFilter!==an||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(n,t.TEXTURE_WRAP_S,O[a.wrapS]),t.texParameteri(n,t.TEXTURE_WRAP_T,O[a.wrapT]),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,O[a.wrapR]),t.texParameteri(n,t.TEXTURE_MAG_FILTER,D[a.magFilter]),t.texParameteri(n,t.TEXTURE_MIN_FILTER,D[a.minFilter]),a.compareFunction&&(t.texParameteri(n,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(n,t.TEXTURE_COMPARE_FUNC,F[a.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){if(a.magFilter===Ze)return;if(a.minFilter!==$e&&a.minFilter!==an)return;if(a.type===fn&&!1===e.has("OES_texture_float_linear"))return;if(a.anisotropy>1||i.get(a).__currentAnisotropy){var o=e.get("EXT_texture_filter_anisotropic");t.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy}}}function q(e,n){var i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",w));var r=n.source,a=d.get(r);void 0===a&&(a={},d.set(r,a));var s=L(n);if(s!==e.__cacheKey){void 0===a[s]&&(a[s]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,i=!0),a[s].usedTimes++;var l=a[e.__cacheKey];void 0!==l&&(a[e.__cacheKey].usedTimes--,0===l.usedTimes&&A(n)),e.__cacheKey=s,e.__webglTexture=a[s].texture}return i}function B(e,o,s){var l=t.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(l=t.TEXTURE_2D_ARRAY),o.isData3DTexture&&(l=t.TEXTURE_3D);var h=q(e,o),u=o.source;n.bindTexture(l,e.__webglTexture,t.TEXTURE0+s);var c=i.get(u);if(u.version!==c.__version||!0===h){n.activeTexture(t.TEXTURE0+s);var d=ua.getPrimaries(ua.workingColorSpace),f=o.colorSpace===Ci?null:ua.getPrimaries(o.colorSpace),p=o.colorSpace===Ci||d===f?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,o.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,o.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);var y=m(o.image,!1,r.maxTextureSize);y=et(o,y);var w,S=a.convert(o.format,o.colorSpace),M=a.convert(o.type),A=_(o.internalFormat,S,M,o.colorSpace,o.isVideoTexture);U(l,o);var E=o.mipmaps,T=!0!==o.isVideoTexture,C=void 0===c.__version||!0===h,k=u.dataReady,L=b(o,y);if(o.isDepthTexture)A=x(o.format===Sn,o.type),C&&(T?n.texStorage2D(t.TEXTURE_2D,1,A,y.width,y.height):n.texImage2D(t.TEXTURE_2D,0,A,y.width,y.height,0,S,M,null));else if(o.isDataTexture)if(E.length>0){T&&C&&n.texStorage2D(t.TEXTURE_2D,L,A,E[0].width,E[0].height);for(var P=0,R=E.length;P<R;P++)w=E[P],T?k&&n.texSubImage2D(t.TEXTURE_2D,P,0,0,w.width,w.height,S,M,w.data):n.texImage2D(t.TEXTURE_2D,P,A,w.width,w.height,0,S,M,w.data);o.generateMipmaps=!1}else T?(C&&n.texStorage2D(t.TEXTURE_2D,L,A,y.width,y.height),k&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,y.width,y.height,S,M,y.data)):n.texImage2D(t.TEXTURE_2D,0,A,y.width,y.height,0,S,M,y.data);else if(o.isCompressedTexture)if(o.isCompressedArrayTexture){T&&C&&n.texStorage3D(t.TEXTURE_2D_ARRAY,L,A,E[0].width,E[0].height,y.depth);for(var N=0,I=E.length;N<I;N++)if(w=E[N],o.format!==bn)if(null!==S)if(T){if(k)if(o.layerUpdates.size>0){var O,D=sm(w.width,w.height,o.format,o.type),F=pv(o.layerUpdates);try{for(F.s();!(O=F.n()).done;){var B=O.value,z=w.data.subarray(B*D/w.data.BYTES_PER_ELEMENT,(B+1)*D/w.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,N,0,0,B,w.width,w.height,1,S,z)}}catch(it){F.e(it)}finally{F.f()}o.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,N,0,0,0,w.width,w.height,y.depth,S,w.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,N,A,w.width,w.height,y.depth,0,w.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else T?k&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,N,0,0,0,w.width,w.height,y.depth,S,M,w.data):n.texImage3D(t.TEXTURE_2D_ARRAY,N,A,w.width,w.height,y.depth,0,S,M,w.data)}else{T&&C&&n.texStorage2D(t.TEXTURE_2D,L,A,E[0].width,E[0].height);for(var H=0,G=E.length;H<G;H++)w=E[H],o.format!==bn?null!==S?T?k&&n.compressedTexSubImage2D(t.TEXTURE_2D,H,0,0,w.width,w.height,S,w.data):n.compressedTexImage2D(t.TEXTURE_2D,H,A,w.width,w.height,0,w.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):T?k&&n.texSubImage2D(t.TEXTURE_2D,H,0,0,w.width,w.height,S,M,w.data):n.texImage2D(t.TEXTURE_2D,H,A,w.width,w.height,0,S,M,w.data)}else if(o.isDataArrayTexture)if(T){if(C&&n.texStorage3D(t.TEXTURE_2D_ARRAY,L,A,y.width,y.height,y.depth),k)if(o.layerUpdates.size>0){var V,j=sm(y.width,y.height,o.format,o.type),W=pv(o.layerUpdates);try{for(W.s();!(V=W.n()).done;){var X=V.value,Y=y.data.subarray(X*j/y.data.BYTES_PER_ELEMENT,(X+1)*j/y.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,X,y.width,y.height,1,S,M,Y)}}catch(it){W.e(it)}finally{W.f()}o.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,y.width,y.height,y.depth,S,M,y.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,A,y.width,y.height,y.depth,0,S,M,y.data);else if(o.isData3DTexture)T?(C&&n.texStorage3D(t.TEXTURE_3D,L,A,y.width,y.height,y.depth),k&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,y.width,y.height,y.depth,S,M,y.data)):n.texImage3D(t.TEXTURE_3D,0,A,y.width,y.height,y.depth,0,S,M,y.data);else if(o.isFramebufferTexture){if(C)if(T)n.texStorage2D(t.TEXTURE_2D,L,A,y.width,y.height);else for(var K=y.width,Z=y.height,J=0;J<L;J++)n.texImage2D(t.TEXTURE_2D,J,A,K,Z,0,S,M,null),K>>=1,Z>>=1}else if(E.length>0){if(T&&C){var Q=nt(E[0]);n.texStorage2D(t.TEXTURE_2D,L,A,Q.width,Q.height)}for(var $=0,tt=E.length;$<tt;$++)w=E[$],T?k&&n.texSubImage2D(t.TEXTURE_2D,$,0,0,S,M,w):n.texImage2D(t.TEXTURE_2D,$,A,S,M,w);o.generateMipmaps=!1}else if(T){if(C){var rt=nt(y);n.texStorage2D(t.TEXTURE_2D,L,A,rt.width,rt.height)}k&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,S,M,y)}else n.texImage2D(t.TEXTURE_2D,0,A,S,M,y);v(o)&&g(l),c.__version=u.version,o.onUpdate&&o.onUpdate(o)}e.__version=o.version}function z(e,o,s){if(6===o.image.length){var l=q(e,o),h=o.source;n.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+s);var u=i.get(h);if(h.version!==u.__version||!0===l){n.activeTexture(t.TEXTURE0+s);var c=ua.getPrimaries(ua.workingColorSpace),d=o.colorSpace===Ci?null:ua.getPrimaries(o.colorSpace),f=o.colorSpace===Ci||c===d?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,o.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,o.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,f);for(var p=o.isCompressedTexture||o.image[0].isCompressedTexture,y=o.image[0]&&o.image[0].isDataTexture,x=[],w=0;w<6;w++)x[w]=p||y?y?o.image[w].image:o.image[w]:m(o.image[w],!0,r.maxCubemapSize),x[w]=et(o,x[w]);var S,M=x[0],A=a.convert(o.format,o.colorSpace),E=a.convert(o.type),T=_(o.internalFormat,A,E,o.colorSpace),C=!0!==o.isVideoTexture,k=void 0===u.__version||!0===l,L=h.dataReady,P=b(o,M);if(U(t.TEXTURE_CUBE_MAP,o),p){C&&k&&n.texStorage2D(t.TEXTURE_CUBE_MAP,P,T,M.width,M.height);for(var R=0;R<6;R++){S=x[R].mipmaps;for(var N=0;N<S.length;N++){var I=S[N];o.format!==bn?null!==A?C?L&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+R,N,0,0,I.width,I.height,A,I.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+R,N,T,I.width,I.height,0,I.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):C?L&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+R,N,0,0,I.width,I.height,A,E,I.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+R,N,T,I.width,I.height,0,A,E,I.data)}}}else{if(S=o.mipmaps,C&&k){S.length>0&&P++;var O=nt(x[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,P,T,O.width,O.height)}for(var D=0;D<6;D++)if(y){C?L&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,0,0,x[D].width,x[D].height,A,E,x[D].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,T,x[D].width,x[D].height,0,A,E,x[D].data);for(var F=0;F<S.length;F++){var B=S[F],z=B.image[D].image;C?L&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+D,F+1,0,0,z.width,z.height,A,E,z.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+D,F+1,T,z.width,z.height,0,A,E,z.data)}}else{C?L&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,0,0,A,E,x[D]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,T,A,E,x[D]);for(var H=0;H<S.length;H++){var G=S[H];C?L&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+D,H+1,0,0,A,E,G.image[D]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+D,H+1,T,A,E,G.image[D])}}}v(o)&&g(t.TEXTURE_CUBE_MAP),u.__version=h.version,o.onUpdate&&o.onUpdate(o)}e.__version=o.version}}function H(e,r,o,s,h,u){var c=a.convert(o.format,o.colorSpace),d=a.convert(o.type),f=_(o.internalFormat,c,d,o.colorSpace),p=i.get(r),m=i.get(o);if(m.__renderTarget=r,!p.__hasExternalTextures){var v=Math.max(1,r.width>>u),g=Math.max(1,r.height>>u);h===t.TEXTURE_3D||h===t.TEXTURE_2D_ARRAY?n.texImage3D(h,u,f,v,g,r.depth,0,c,d,null):n.texImage2D(h,u,f,v,g,0,c,d,null)}n.bindFramebuffer(t.FRAMEBUFFER,e),$(r)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,s,h,m.__webglTexture,0,Q(r)):(h===t.TEXTURE_2D||h>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&h<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,s,h,m.__webglTexture,u),n.bindFramebuffer(t.FRAMEBUFFER,null)}function G(e,n,i){if(t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer){var r=n.depthTexture,o=r&&r.isDepthTexture?r.type:null,s=x(n.stencilBuffer,o),h=n.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,u=Q(n),c=$(n);c?l.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,u,s,n.width,n.height):i?t.renderbufferStorageMultisample(t.RENDERBUFFER,u,s,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,s,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,h,t.RENDERBUFFER,e)}else for(var d=n.textures,f=0;f<d.length;f++){var p=d[f],m=a.convert(p.format,p.colorSpace),v=a.convert(p.type),g=_(p.internalFormat,m,v,p.colorSpace),y=Q(n);i&&!1===$(n)?t.renderbufferStorageMultisample(t.RENDERBUFFER,y,g,n.width,n.height):$(n)?l.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,y,g,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,g,n.width,n.height)}t.bindRenderbuffer(t.RENDERBUFFER,null)}function V(e,r){var a=r&&r.isWebGLCubeRenderTarget;if(a)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");var o=i.get(r.depthTexture);o.__renderTarget=r,o.__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),P(r.depthTexture,0);var s=o.__webglTexture,h=Q(r);if(r.depthTexture.format===wn)$(r)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,s,0,h):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,s,0);else{if(r.depthTexture.format!==Sn)throw new Error("Unknown depthTexture format");$(r)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,s,0,h):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,s,0)}}function j(e){var r=i.get(e),a=!0===e.isWebGLCubeRenderTarget;if(r.__boundDepthTexture!==e.depthTexture){var o=e.depthTexture;if(r.__depthDisposeCallback&&r.__depthDisposeCallback(),o){var s=function(){delete r.__boundDepthTexture,delete r.__depthDisposeCallback,o.removeEventListener("dispose",s)};o.addEventListener("dispose",s),r.__depthDisposeCallback=s}r.__boundDepthTexture=o}if(e.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");var l=e.texture.mipmaps;l&&l.length>0?V(r.__webglFramebuffer[0],e):V(r.__webglFramebuffer,e)}else if(a){r.__webglDepthbuffer=[];for(var h=0;h<6;h++)if(n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[h]),void 0===r.__webglDepthbuffer[h])r.__webglDepthbuffer[h]=t.createRenderbuffer(),G(r.__webglDepthbuffer[h],e,!1);else{var u=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,c=r.__webglDepthbuffer[h];t.bindRenderbuffer(t.RENDERBUFFER,c),t.framebufferRenderbuffer(t.FRAMEBUFFER,u,t.RENDERBUFFER,c)}}else{var d=e.texture.mipmaps;if(d&&d.length>0?n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),void 0===r.__webglDepthbuffer)r.__webglDepthbuffer=t.createRenderbuffer(),G(r.__webglDepthbuffer,e,!1);else{var f=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,p=r.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,p),t.framebufferRenderbuffer(t.FRAMEBUFFER,f,t.RENDERBUFFER,p)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function W(e,n,r){var a=i.get(e);void 0!==n&&H(a.__webglFramebuffer,e,e.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),void 0!==r&&j(e)}function X(e){var r=e.texture,s=i.get(e),l=i.get(r);e.addEventListener("dispose",S);var h=e.textures,u=!0===e.isWebGLCubeRenderTarget,c=h.length>1;if(c||(void 0===l.__webglTexture&&(l.__webglTexture=t.createTexture()),l.__version=r.version,o.memory.textures++),u){s.__webglFramebuffer=[];for(var d=0;d<6;d++)if(r.mipmaps&&r.mipmaps.length>0){s.__webglFramebuffer[d]=[];for(var f=0;f<r.mipmaps.length;f++)s.__webglFramebuffer[d][f]=t.createFramebuffer()}else s.__webglFramebuffer[d]=t.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){s.__webglFramebuffer=[];for(var p=0;p<r.mipmaps.length;p++)s.__webglFramebuffer[p]=t.createFramebuffer()}else s.__webglFramebuffer=t.createFramebuffer();if(c)for(var m=0,y=h.length;m<y;m++){var x=i.get(h[m]);void 0===x.__webglTexture&&(x.__webglTexture=t.createTexture(),o.memory.textures++)}if(e.samples>0&&!1===$(e)){s.__webglMultisampledFramebuffer=t.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(var b=0;b<h.length;b++){var w=h[b];s.__webglColorRenderbuffer[b]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,s.__webglColorRenderbuffer[b]);var M=a.convert(w.format,w.colorSpace),A=a.convert(w.type),E=_(w.internalFormat,M,A,w.colorSpace,!0===e.isXRRenderTarget),T=Q(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,T,E,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+b,t.RENDERBUFFER,s.__webglColorRenderbuffer[b])}t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(s.__webglDepthRenderbuffer=t.createRenderbuffer(),G(s.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(u){n.bindTexture(t.TEXTURE_CUBE_MAP,l.__webglTexture),U(t.TEXTURE_CUBE_MAP,r);for(var C=0;C<6;C++)if(r.mipmaps&&r.mipmaps.length>0)for(var k=0;k<r.mipmaps.length;k++)H(s.__webglFramebuffer[C][k],e,r,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+C,k);else H(s.__webglFramebuffer[C],e,r,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+C,0);v(r)&&g(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(c){for(var L=0,P=h.length;L<P;L++){var R=h[L],N=i.get(R);n.bindTexture(t.TEXTURE_2D,N.__webglTexture),U(t.TEXTURE_2D,R),H(s.__webglFramebuffer,e,R,t.COLOR_ATTACHMENT0+L,t.TEXTURE_2D,0),v(R)&&g(t.TEXTURE_2D)}n.unbindTexture()}else{var I=t.TEXTURE_2D;if((e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(I=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(I,l.__webglTexture),U(I,r),r.mipmaps&&r.mipmaps.length>0)for(var O=0;O<r.mipmaps.length;O++)H(s.__webglFramebuffer[O],e,r,t.COLOR_ATTACHMENT0,I,O);else H(s.__webglFramebuffer,e,r,t.COLOR_ATTACHMENT0,I,0);v(r)&&g(I),n.unbindTexture()}e.depthBuffer&&j(e)}function Y(t){for(var e=t.textures,r=0,a=e.length;r<a;r++){var o=e[r];if(v(o)){var s=y(t),l=i.get(o).__webglTexture;n.bindTexture(s,l),g(s),n.unbindTexture()}}}var K=[],Z=[];function J(e){if(e.samples>0)if(!1===$(e)){var r=e.textures,a=e.width,o=e.height,s=t.COLOR_BUFFER_BIT,l=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,u=i.get(e),c=r.length>1;if(c)for(var d=0;d<r.length;d++)n.bindFramebuffer(t.FRAMEBUFFER,u.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,u.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,u.__webglMultisampledFramebuffer);var f=e.texture.mipmaps;f&&f.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,u.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,u.__webglFramebuffer);for(var p=0;p<r.length;p++){if(e.resolveDepthBuffer&&(e.depthBuffer&&(s|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&e.resolveStencilBuffer&&(s|=t.STENCIL_BUFFER_BIT)),c){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,u.__webglColorRenderbuffer[p]);var m=i.get(r[p]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,m,0)}t.blitFramebuffer(0,0,a,o,0,0,a,o,s,t.NEAREST),!0===h&&(K.length=0,Z.length=0,K.push(t.COLOR_ATTACHMENT0+p),e.depthBuffer&&!1===e.resolveDepthBuffer&&(K.push(l),Z.push(l),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,Z)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,K))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),c)for(var v=0;v<r.length;v++){n.bindFramebuffer(t.FRAMEBUFFER,u.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+v,t.RENDERBUFFER,u.__webglColorRenderbuffer[v]);var g=i.get(r[v]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,u.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+v,t.TEXTURE_2D,g,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,u.__webglMultisampledFramebuffer)}else if(e.depthBuffer&&!1===e.resolveDepthBuffer&&h){var y=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[y])}}function Q(t){return Math.min(r.maxSamples,t.samples)}function $(t){var n=i.get(t);return t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function tt(t){var e=o.render.frame;c.get(t)!==e&&(c.set(t,e),t.update())}function et(t,e){var n=t.colorSpace,i=t.format,r=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||n!==Li&&n!==Ci&&(ua.getTransfer(n)===Ri?i===bn&&r===sn||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),e}function nt(t){return"undefined"!==typeof HTMLImageElement&&t instanceof HTMLImageElement?(u.width=t.naturalWidth||t.width,u.height=t.naturalHeight||t.height):"undefined"!==typeof VideoFrame&&t instanceof VideoFrame?(u.width=t.displayWidth,u.height=t.displayHeight):(u.width=t.width,u.height=t.height),u}this.allocateTextureUnit=k,this.resetTextureUnits=C,this.setTexture2D=P,this.setTexture2DArray=R,this.setTexture3D=N,this.setTextureCube=I,this.rebindTextures=W,this.setupRenderTarget=X,this.updateRenderTargetMipmap=Y,this.updateMultisampleRenderTarget=J,this.setupDepthRenderbuffer=j,this.setupFrameBufferTexture=H,this.useMultisampledRTT=$}function Vb(t,e){function n(n){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ci,a=ua.getTransfer(r);if(n===sn)return t.UNSIGNED_BYTE;if(n===mn)return t.UNSIGNED_SHORT_4_4_4_4;if(n===vn)return t.UNSIGNED_SHORT_5_5_5_1;if(n===yn)return t.UNSIGNED_INT_5_9_9_9_REV;if(n===ln)return t.BYTE;if(n===hn)return t.SHORT;if(n===un)return t.UNSIGNED_SHORT;if(n===cn)return t.INT;if(n===dn)return t.UNSIGNED_INT;if(n===fn)return t.FLOAT;if(n===pn)return t.HALF_FLOAT;if(n===_n)return t.ALPHA;if(n===xn)return t.RGB;if(n===bn)return t.RGBA;if(n===wn)return t.DEPTH_COMPONENT;if(n===Sn)return t.DEPTH_STENCIL;if(n===Mn)return t.RED;if(n===An)return t.RED_INTEGER;if(n===En)return t.RG;if(n===Tn)return t.RG_INTEGER;if(n===kn)return t.RGBA_INTEGER;if(n===Ln||n===Pn||n===Rn||n===Nn)if(a===Ri){if(i=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===i)return null;if(n===Ln)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Pn)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Rn)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Nn)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(i=e.get("WEBGL_compressed_texture_s3tc"),null===i)return null;if(n===Ln)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Pn)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Rn)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Nn)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===In||n===On||n===Dn||n===Fn){if(i=e.get("WEBGL_compressed_texture_pvrtc"),null===i)return null;if(n===In)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===On)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Dn)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Fn)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===Un||n===qn||n===Bn){if(i=e.get("WEBGL_compressed_texture_etc"),null===i)return null;if(n===Un||n===qn)return a===Ri?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===Bn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}if(n===zn||n===Hn||n===Gn||n===Vn||n===jn||n===Wn||n===Xn||n===Yn||n===Kn||n===Zn||n===Jn||n===Qn||n===$n||n===ti){if(i=e.get("WEBGL_compressed_texture_astc"),null===i)return null;if(n===zn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Hn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Gn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Vn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===jn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Wn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Xn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Yn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Kn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Zn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Jn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Qn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===$n)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ti)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===ei||n===ni||n===ii){if(i=e.get("EXT_texture_compression_bptc"),null===i)return null;if(n===ei)return a===Ri?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===ni)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===ii)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===ri||n===ai||n===oi||n===si){if(i=e.get("EXT_texture_compression_rgtc"),null===i)return null;if(n===ei)return i.COMPRESSED_RED_RGTC1_EXT;if(n===ai)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===oi)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===si)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===gn?t.UNSIGNED_INT_24_8:void 0!==t[n]?t[n]:null}return{convert:n}}var jb="\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",Wb="\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",Xb=function(){function t(){st()(this,t),this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}return ht()(t,[{key:"init",value:function(t,e,n){if(null===this.texture){var i=new ya,r=t.properties.get(i);r.__webglTexture=e.texture,e.depthNear===n.depthNear&&e.depthFar===n.depthFar||(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}},{key:"getMesh",value:function(t){if(null!==this.texture&&null===this.mesh){var e=t.cameras[0].viewport,n=new Zs({vertexShader:jb,fragmentShader:Wb,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new Us(new qc(20,20),n)}return this.mesh}},{key:"reset",value:function(){this.texture=null,this.mesh=null}},{key:"getDepthTexture",value:function(){return this.texture}}])}(),Yb=function(t){function e(t,n){var i;st()(this,e),i=dv(this,e);var r=i,a=null,o=1,s=null,l="local-floor",h=1,u=null,d=null,f=null,p=null,m=null,v=null,g=new Xb,y=n.getContextAttributes(),_=null,x=null,b=[],w=[],S=new Xr,M=null,A=new el;A.viewport=new _a;var E=new el;E.viewport=new _a;var T=[A,E],C=new Cf,k=null,L=null;function P(t){var e=w.indexOf(t.inputSource);if(-1!==e){var n=b[e];void 0!==n&&(n.update(t.inputSource,t.frame,u||s),n.dispatchEvent({type:t.type,data:t.inputSource}))}}function R(){a.removeEventListener("select",P),a.removeEventListener("selectstart",P),a.removeEventListener("selectend",P),a.removeEventListener("squeeze",P),a.removeEventListener("squeezestart",P),a.removeEventListener("squeezeend",P),a.removeEventListener("end",R),a.removeEventListener("inputsourceschange",N);for(var e=0;e<b.length;e++){var n=w[e];null!==n&&(w[e]=null,b[e].disconnect(n))}k=null,L=null,g.reset(),t.setRenderTarget(_),m=null,p=null,f=null,a=null,x=null,z.stop(),r.isPresenting=!1,t.setPixelRatio(M),t.setSize(S.width,S.height,!1),r.dispatchEvent({type:"sessionend"})}function N(t){for(var e=0;e<t.removed.length;e++){var n=t.removed[e],i=w.indexOf(n);i>=0&&(w[i]=null,b[i].disconnect(n))}for(var r=0;r<t.added.length;r++){var a=t.added[r],o=w.indexOf(a);if(-1===o){for(var s=0;s<b.length;s++){if(s>=w.length){w.push(a),o=s;break}if(null===w[s]){w[s]=a,o=s;break}}if(-1===o)break}var l=b[o];l&&l.connect(a)}}i.cameraAutoUpdate=!0,i.enabled=!1,i.isPresenting=!1,i.getController=function(t){var e=b[t];return void 0===e&&(e=new hl,b[t]=e),e.getTargetRaySpace()},i.getControllerGrip=function(t){var e=b[t];return void 0===e&&(e=new hl,b[t]=e),e.getGripSpace()},i.getHand=function(t){var e=b[t];return void 0===e&&(e=new hl,b[t]=e),e.getHandSpace()},i.setFramebufferScaleFactor=function(t){o=t,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},i.setReferenceSpaceType=function(t){l=t,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},i.getReferenceSpace=function(){return u||s},i.setReferenceSpace=function(t){u=t},i.getBaseLayer=function(){return null!==p?p:m},i.getBinding=function(){return f},i.getFrame=function(){return v},i.getSession=function(){return a},i.setSession=function(){var e=gt()(c.a.mark((function e(i){var d,v,g,b,w,A;return c.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(a=i,null===a){e.next=28;break}if(_=t.getRenderTarget(),a.addEventListener("select",P),a.addEventListener("selectstart",P),a.addEventListener("selectend",P),a.addEventListener("squeeze",P),a.addEventListener("squeezestart",P),a.addEventListener("squeezeend",P),a.addEventListener("end",R),a.addEventListener("inputsourceschange",N),!0===y.xrCompatible){e.next=14;break}return e.next=14,n.makeXRCompatible();case 14:return M=t.getPixelRatio(),t.getSize(S),d="undefined"!==typeof XRWebGLBinding&&"createProjectionLayer"in XRWebGLBinding.prototype,d?(g=null,b=null,w=null,y.depth&&(w=y.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,g=y.stencil?Sn:wn,b=y.stencil?gn:dn),A={colorFormat:n.RGBA8,depthFormat:w,scaleFactor:o},f=new XRWebGLBinding(a,n),p=f.createProjectionLayer(A),a.updateRenderState({layers:[p]}),t.setPixelRatio(1),t.setSize(p.textureWidth,p.textureHeight,!1),x=new ba(p.textureWidth,p.textureHeight,{format:bn,type:sn,depthTexture:new su(p.textureWidth,p.textureHeight,b,void 0,void 0,void 0,void 0,void 0,void 0,g),stencilBuffer:y.stencil,colorSpace:t.outputColorSpace,samples:y.antialias?4:0,resolveDepthBuffer:!1===p.ignoreDepthValues,resolveStencilBuffer:!1===p.ignoreDepthValues})):(v={antialias:y.antialias,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:o},m=new XRWebGLLayer(a,n,v),a.updateRenderState({baseLayer:m}),t.setPixelRatio(1),t.setSize(m.framebufferWidth,m.framebufferHeight,!1),x=new ba(m.framebufferWidth,m.framebufferHeight,{format:bn,type:sn,colorSpace:t.outputColorSpace,stencilBuffer:y.stencil,resolveDepthBuffer:!1===m.ignoreDepthValues,resolveStencilBuffer:!1===m.ignoreDepthValues})),x.isXRRenderTarget=!0,this.setFoveation(h),u=null,e.next=23,a.requestReferenceSpace(l);case 23:s=e.sent,z.setContext(a),z.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"});case 28:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),i.getEnvironmentBlendMode=function(){if(null!==a)return a.environmentBlendMode},i.getDepthTexture=function(){return g.getDepthTexture()};var I=new Ta,O=new Ta;function D(t,e,n){I.setFromMatrixPosition(e.matrixWorld),O.setFromMatrixPosition(n.matrixWorld);var i=I.distanceTo(O),r=e.projectionMatrix.elements,a=n.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),l=(r[9]+1)/r[5],h=(r[9]-1)/r[5],u=(r[8]-1)/r[0],c=(a[8]+1)/a[0],d=o*u,f=o*c,p=i/(-u+c),m=p*-u;if(e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(p),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert(),-1===r[10])t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{var v=o+p,g=s+p,y=d-m,_=f+(i-m),x=l*s/g*v,b=h*s/g*v;t.projectionMatrix.makePerspective(y,_,x,b,v,g),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}}function F(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}function U(t,e,n){null===n?t.matrix.copy(e.matrixWorld):(t.matrix.copy(n.matrixWorld),t.matrix.invert(),t.matrix.multiply(e.matrixWorld)),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*Sr*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}i.updateCamera=function(t){if(null!==a){var e=t.near,n=t.far;null!==g.texture&&(g.depthNear>0&&(e=g.depthNear),g.depthFar>0&&(n=g.depthFar)),C.near=E.near=A.near=e,C.far=E.far=A.far=n,k===C.near&&L===C.far||(a.updateRenderState({depthNear:C.near,depthFar:C.far}),k=C.near,L=C.far),A.layers.mask=2|t.layers.mask,E.layers.mask=4|t.layers.mask,C.layers.mask=A.layers.mask|E.layers.mask;var i=t.parent,r=C.cameras;F(C,i);for(var o=0;o<r.length;o++)F(r[o],i);2===r.length?D(C,A,E):C.projectionMatrix.copy(A.projectionMatrix),U(t,C,i)}},i.getCamera=function(){return C},i.getFoveation=function(){if(null!==p||null!==m)return h},i.setFoveation=function(t){h=t,null!==p&&(p.fixedFoveation=t),null!==m&&void 0!==m.fixedFoveation&&(m.fixedFoveation=t)},i.hasDepthSensing=function(){return null!==g.texture},i.getDepthSensingMesh=function(){return g.getMesh(C)};var q=null;function B(e,n){if(d=n.getViewerPose(u||s),v=n,null!==d){var i=d.views;null!==m&&(t.setRenderTargetFramebuffer(x,m.framebuffer),t.setRenderTarget(x));var o=!1;i.length!==C.cameras.length&&(C.cameras.length=0,o=!0);for(var l=0;l<i.length;l++){var h=i[l],c=null;if(null!==m)c=m.getViewport(h);else{var y=f.getViewSubImage(p,h);c=y.viewport,0===l&&(t.setRenderTargetTextures(x,y.colorTexture,y.depthStencilTexture),t.setRenderTarget(x))}var _=T[l];void 0===_&&(_=new el,_.layers.enable(l),_.viewport=new _a,T[l]=_),_.matrix.fromArray(h.transform.matrix),_.matrix.decompose(_.position,_.quaternion,_.scale),_.projectionMatrix.fromArray(h.projectionMatrix),_.projectionMatrixInverse.copy(_.projectionMatrix).invert(),_.viewport.set(c.x,c.y,c.width,c.height),0===l&&(C.matrix.copy(_.matrix),C.matrix.decompose(C.position,C.quaternion,C.scale)),!0===o&&C.cameras.push(_)}var S=a.enabledFeatures,M=S&&S.includes("depth-sensing")&&"gpu-optimized"==a.depthUsage;if(M&&f){var A=f.getDepthInformation(i[0]);A&&A.isValid&&A.texture&&g.init(t,A,a.renderState)}}for(var E=0;E<b.length;E++){var k=w[E],L=b[E];null!==k&&void 0!==L&&L.update(k,n,u||s)}q&&q(e,n),n.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:n}),v=null}var z=new gv;return z.setAnimationLoop(B),i.setAnimationLoop=function(t){q=t},i.dispose=function(){},i}return mt()(e,t),ht()(e)}(_r),Kb=new po,Zb=new io;function Jb(t,e){function n(t,e){!0===t.matrixAutoUpdate&&t.updateMatrix(),e.value.copy(t.matrix)}function i(e,n){n.color.getRGB(e.fogColor.value,js(t)),n.isFog?(e.fogNear.value=n.near,e.fogFar.value=n.far):n.isFogExp2&&(e.fogDensity.value=n.density)}function r(t,e,n,i,r){e.isMeshBasicMaterial||e.isMeshLambertMaterial?a(t,e):e.isMeshToonMaterial?(a(t,e),c(t,e)):e.isMeshPhongMaterial?(a(t,e),u(t,e)):e.isMeshStandardMaterial?(a(t,e),d(t,e),e.isMeshPhysicalMaterial&&f(t,e,r)):e.isMeshMatcapMaterial?(a(t,e),p(t,e)):e.isMeshDepthMaterial?a(t,e):e.isMeshDistanceMaterial?(a(t,e),m(t,e)):e.isMeshNormalMaterial?a(t,e):e.isLineBasicMaterial?(o(t,e),e.isLineDashedMaterial&&s(t,e)):e.isPointsMaterial?l(t,e,n,i):e.isSpriteMaterial?h(t,e):e.isShadowMaterial?(t.color.value.copy(e.color),t.opacity.value=e.opacity):e.isShaderMaterial&&(e.uniformsNeedUpdate=!1)}function a(t,i){t.opacity.value=i.opacity,i.color&&t.diffuse.value.copy(i.color),i.emissive&&t.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(t.map.value=i.map,n(i.map,t.mapTransform)),i.alphaMap&&(t.alphaMap.value=i.alphaMap,n(i.alphaMap,t.alphaMapTransform)),i.bumpMap&&(t.bumpMap.value=i.bumpMap,n(i.bumpMap,t.bumpMapTransform),t.bumpScale.value=i.bumpScale,i.side===Wt&&(t.bumpScale.value*=-1)),i.normalMap&&(t.normalMap.value=i.normalMap,n(i.normalMap,t.normalMapTransform),t.normalScale.value.copy(i.normalScale),i.side===Wt&&t.normalScale.value.negate()),i.displacementMap&&(t.displacementMap.value=i.displacementMap,n(i.displacementMap,t.displacementMapTransform),t.displacementScale.value=i.displacementScale,t.displacementBias.value=i.displacementBias),i.emissiveMap&&(t.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,t.emissiveMapTransform)),i.specularMap&&(t.specularMap.value=i.specularMap,n(i.specularMap,t.specularMapTransform)),i.alphaTest>0&&(t.alphaTest.value=i.alphaTest);var r=e.get(i),a=r.envMap,o=r.envMapRotation;a&&(t.envMap.value=a,Kb.copy(o),Kb.x*=-1,Kb.y*=-1,Kb.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(Kb.y*=-1,Kb.z*=-1),t.envMapRotation.value.setFromMatrix4(Zb.makeRotationFromEuler(Kb)),t.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,t.reflectivity.value=i.reflectivity,t.ior.value=i.ior,t.refractionRatio.value=i.refractionRatio),i.lightMap&&(t.lightMap.value=i.lightMap,t.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,t.lightMapTransform)),i.aoMap&&(t.aoMap.value=i.aoMap,t.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,t.aoMapTransform))}function o(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform))}function s(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function l(t,e,i,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*r,e.map&&(t.map.value=e.map,n(e.map,t.uvTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}function h(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}function u(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}function c(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}function d(t,e){t.metalness.value=e.metalness,e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap,n(e.metalnessMap,t.metalnessMapTransform)),t.roughness.value=e.roughness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap,n(e.roughnessMap,t.roughnessMapTransform)),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function f(t,e,i){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,n(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,n(e.sheenRoughnessMap,t.sheenRoughnessMapTransform))),e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,n(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,n(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,n(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),e.side===Wt&&t.clearcoatNormalScale.value.negate())),e.dispersion>0&&(t.dispersion.value=e.dispersion),e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,n(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,n(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform))),e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,n(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,n(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)),e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,n(e.anisotropyMap,t.anisotropyMapTransform))),t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,n(e.specularColorMap,t.specularColorMapTransform)),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,n(e.specularIntensityMap,t.specularIntensityMapTransform))}function p(t,e){e.matcap&&(t.matcap.value=e.matcap)}function m(t,n){var i=e.get(n).light;t.referencePosition.value.setFromMatrixPosition(i.matrixWorld),t.nearDistance.value=i.shadow.camera.near,t.farDistance.value=i.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function Qb(t,e,n,i){var r={},a={},o=[],s=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(t,e){var n=e.program;i.uniformBlockBinding(t,n)}function h(t,n){var o=r[t.id];void 0===o&&(p(t),o=u(t),r[t.id]=o,t.addEventListener("dispose",v));var s=n.program;i.updateUBOMapping(t,s);var l=e.render.frame;a[t.id]!==l&&(d(t),a[t.id]=l)}function u(e){var n=c();e.__bindingPointIndex=n;var i=t.createBuffer(),r=e.__size,a=e.usage;return t.bindBuffer(t.UNIFORM_BUFFER,i),t.bufferData(t.UNIFORM_BUFFER,r,a),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,n,i),i}function c(){for(var t=0;t<s;t++)if(-1===o.indexOf(t))return o.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(e){var n=r[e.id],i=e.uniforms,a=e.__cache;t.bindBuffer(t.UNIFORM_BUFFER,n);for(var o=0,s=i.length;o<s;o++)for(var l=Array.isArray(i[o])?i[o]:[i[o]],h=0,u=l.length;h<u;h++){var c=l[h];if(!0===f(c,o,h,a)){for(var d=c.__offset,p=Array.isArray(c.value)?c.value:[c.value],v=0,g=0;g<p.length;g++){var y=p[g],_=m(y);"number"===typeof y||"boolean"===typeof y?(c.__data[0]=y,t.bufferSubData(t.UNIFORM_BUFFER,d+v,c.__data)):y.isMatrix3?(c.__data[0]=y.elements[0],c.__data[1]=y.elements[1],c.__data[2]=y.elements[2],c.__data[3]=0,c.__data[4]=y.elements[3],c.__data[5]=y.elements[4],c.__data[6]=y.elements[5],c.__data[7]=0,c.__data[8]=y.elements[6],c.__data[9]=y.elements[7],c.__data[10]=y.elements[8],c.__data[11]=0):(y.toArray(c.__data,v),v+=_.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,d,c.__data)}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function f(t,e,n,i){var r=t.value,a=e+"_"+n;if(void 0===i[a])return i[a]="number"===typeof r||"boolean"===typeof r?r:r.clone(),!0;var o=i[a];if("number"===typeof r||"boolean"===typeof r){if(o!==r)return i[a]=r,!0}else if(!1===o.equals(r))return o.copy(r),!0;return!1}function p(t){for(var e=t.uniforms,n=0,i=16,r=0,a=e.length;r<a;r++)for(var o=Array.isArray(e[r])?e[r]:[e[r]],s=0,l=o.length;s<l;s++)for(var h=o[s],u=Array.isArray(h.value)?h.value:[h.value],c=0,d=u.length;c<d;c++){var f=u[c],p=m(f),v=n%i,g=v%p.boundary,y=v+g;n+=g,0!==y&&i-y<p.storage&&(n+=i-y),h.__data=new Float32Array(p.storage/Float32Array.BYTES_PER_ELEMENT),h.__offset=n,n+=p.storage}var _=n%i;return _>0&&(n+=i-_),t.__size=n,t.__cache={},this}function m(t){var e={boundary:0,storage:0};return"number"===typeof t||"boolean"===typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.storage=64):t.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",t),e}function v(e){var n=e.target;n.removeEventListener("dispose",v);var i=o.indexOf(n.__bindingPointIndex);o.splice(i,1),t.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}function g(){for(var e in r)t.deleteBuffer(r[e]);o=[],r={},a={}}return{bind:l,update:h,dispose:g}}var $b=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};st()(this,t);var n,i=e.canvas,r=void 0===i?ta():i,a=e.context,o=void 0===a?null:a,s=e.depth,l=void 0===s||s,h=e.stencil,u=void 0!==h&&h,d=e.alpha,f=void 0!==d&&d,p=e.antialias,m=void 0!==p&&p,v=e.premultipliedAlpha,g=void 0===v||v,y=e.preserveDrawingBuffer,_=void 0!==y&&y,x=e.powerPreference,b=void 0===x?"default":x,w=e.failIfMajorPerformanceCaveat,S=void 0!==w&&w,M=e.reverseDepthBuffer,A=void 0!==M&&M;if(this.isWebGLRenderer=!0,null!==o){if("undefined"!==typeof WebGLRenderingContext&&o instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");n=o.getContextAttributes().alpha}else n=f;var E=new Uint32Array(4),T=new Int32Array(4),C=null,k=null,L=[],P=[];this.domElement=r,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Pe,this.toneMappingExposure=1,this.transmissionResolutionScale=1;var R=this,N=!1;this._outputColorSpace=ki;var I=0,O=0,D=null,F=-1,U=null,q=new _a,B=new _a,z=null,H=new Zo(0),G=0,V=r.width,j=r.height,W=1,X=null,Y=null,K=new _a(0,0,V,j),Z=new _a(0,0,V,j),J=!1,Q=new uh,$=!1,tt=!1,et=new io,nt=new io,it=new Ta,rt=new _a,at={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},ot=!1;function lt(){return null===D?W:1}var ht,ut,ct,dt,ft,pt,mt,vt,yt,_t,xt,bt,wt,St,Mt,At,Et,Tt,Ct,kt,Lt,Pt,Rt,Nt,Ot=o;function Dt(t,e){return r.getContext(t,e)}try{var Ft={alpha:!0,depth:l,stencil:u,antialias:m,premultipliedAlpha:g,preserveDrawingBuffer:_,powerPreference:b,failIfMajorPerformanceCaveat:S};if("setAttribute"in r&&r.setAttribute("data-engine","three.js r".concat(It)),r.addEventListener("webglcontextlost",zt,!1),r.addEventListener("webglcontextrestored",Ht,!1),r.addEventListener("webglcontextcreationerror",Gt,!1),null===Ot){var Ut="webgl2";if(Ot=Dt(Ut,Ft),null===Ot)throw Dt(Ut)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(ve){throw console.error("THREE.WebGLRenderer: "+ve.message),ve}function qt(){ht=new R_(Ot),ht.init(),Pt=new Vb(Ot,ht),ut=new s_(Ot,ht,e,Pt),ct=new Hb(Ot,ht),ut.reverseDepthBuffer&&A&&ct.buffers.depth.setReversed(!0),dt=new O_(Ot),ft=new Eb,pt=new Gb(Ot,ht,ct,ft,ut,Pt,dt),mt=new h_(R),vt=new P_(R),yt=new yv(Ot),Rt=new a_(Ot,yt),_t=new N_(Ot,yt,dt,Rt),xt=new F_(Ot,_t,yt,dt),Ct=new D_(Ot,ut,pt),At=new l_(ft),bt=new Ab(R,mt,vt,ht,ut,Rt,At),wt=new Jb(R,ft),St=new Lb,Mt=new Fb(ht),Tt=new r_(R,mt,vt,ct,xt,n,g),Et=new Bb(R,xt,ut),Nt=new Qb(Ot,dt,ut,ct),kt=new o_(Ot,ht,dt),Lt=new I_(Ot,ht,dt),dt.programs=bt.programs,R.capabilities=ut,R.extensions=ht,R.properties=ft,R.renderLists=St,R.shadowMap=Et,R.state=ct,R.info=dt}qt();var Bt=new Yb(R,Ot);function zt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),N=!0}function Ht(){console.log("THREE.WebGLRenderer: Context Restored."),N=!1;var t=dt.autoReset,e=Et.enabled,n=Et.autoUpdate,i=Et.needsUpdate,r=Et.type;qt(),dt.autoReset=t,Et.enabled=e,Et.autoUpdate=n,Et.needsUpdate=i,Et.type=r}function Gt(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function Vt(t){var e=t.target;e.removeEventListener("dispose",Vt),Yt(e)}function Yt(t){Kt(t),ft.remove(t)}function Kt(t){var e=ft.get(t).programs;void 0!==e&&(e.forEach((function(t){bt.releaseProgram(t)})),t.isShaderMaterial&&bt.releaseShaderCache(t))}function Zt(t,e,n){!0===t.transparent&&t.side===Xt&&!1===t.forceSinglePass?(t.side=Wt,t.needsUpdate=!0,se(t,e,n),t.side=jt,t.needsUpdate=!0,se(t,e,n),t.side=Xt):se(t,e,n)}this.xr=Bt,this.getContext=function(){return Ot},this.getContextAttributes=function(){return Ot.getContextAttributes()},this.forceContextLoss=function(){var t=ht.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=ht.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return W},this.setPixelRatio=function(t){void 0!==t&&(W=t,this.setSize(V,j,!1))},this.getSize=function(t){return t.set(V,j)},this.setSize=function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];Bt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(V=t,j=e,r.width=Math.floor(t*W),r.height=Math.floor(e*W),!0===n&&(r.style.width=t+"px",r.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(t){return t.set(V*W,j*W).floor()},this.setDrawingBufferSize=function(t,e,n){V=t,j=e,W=n,r.width=Math.floor(t*n),r.height=Math.floor(e*n),this.setViewport(0,0,t,e)},this.getCurrentViewport=function(t){return t.copy(q)},this.getViewport=function(t){return t.copy(K)},this.setViewport=function(t,e,n,i){t.isVector4?K.set(t.x,t.y,t.z,t.w):K.set(t,e,n,i),ct.viewport(q.copy(K).multiplyScalar(W).round())},this.getScissor=function(t){return t.copy(Z)},this.setScissor=function(t,e,n,i){t.isVector4?Z.set(t.x,t.y,t.z,t.w):Z.set(t,e,n,i),ct.scissor(B.copy(Z).multiplyScalar(W).round())},this.getScissorTest=function(){return J},this.setScissorTest=function(t){ct.setScissorTest(J=t)},this.setOpaqueSort=function(t){X=t},this.setTransparentSort=function(t){Y=t},this.getClearColor=function(t){return t.copy(Tt.getClearColor())},this.setClearColor=function(){var t;(t=Tt).setClearColor.apply(t,arguments)},this.getClearAlpha=function(){return Tt.getClearAlpha()},this.setClearAlpha=function(){var t;(t=Tt).setClearAlpha.apply(t,arguments)},this.clear=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=0;if(t){var r=!1;if(null!==D){var a=D.texture.format;r=a===kn||a===Tn||a===An}if(r){var o=D.texture.type,s=o===sn||o===dn||o===un||o===gn||o===mn||o===vn,l=Tt.getClearColor(),h=Tt.getClearAlpha(),u=l.r,c=l.g,d=l.b;s?(E[0]=u,E[1]=c,E[2]=d,E[3]=h,Ot.clearBufferuiv(Ot.COLOR,0,E)):(T[0]=u,T[1]=c,T[2]=d,T[3]=h,Ot.clearBufferiv(Ot.COLOR,0,T))}else i|=Ot.COLOR_BUFFER_BIT}e&&(i|=Ot.DEPTH_BUFFER_BIT),n&&(i|=Ot.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Ot.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){r.removeEventListener("webglcontextlost",zt,!1),r.removeEventListener("webglcontextrestored",Ht,!1),r.removeEventListener("webglcontextcreationerror",Gt,!1),Tt.dispose(),St.dispose(),Mt.dispose(),ft.dispose(),mt.dispose(),vt.dispose(),xt.dispose(),Rt.dispose(),Nt.dispose(),bt.dispose(),Bt.dispose(),Bt.removeEventListener("sessionstart",$t),Bt.removeEventListener("sessionend",te),ee.stop()},this.renderBufferDirect=function(t,e,n,i,r,a){null===e&&(e=at);var o=r.isMesh&&r.matrixWorld.determinant()<0,s=ue(t,e,n,i,r);ct.setMaterial(i,o);var l=n.index,h=1;if(!0===i.wireframe){if(l=_t.getWireframeAttribute(n),void 0===l)return;h=2}var u=n.drawRange,c=n.attributes.position,d=u.start*h,f=(u.start+u.count)*h;null!==a&&(d=Math.max(d,a.start*h),f=Math.min(f,(a.start+a.count)*h)),null!==l?(d=Math.max(d,0),f=Math.min(f,l.count)):void 0!==c&&null!==c&&(d=Math.max(d,0),f=Math.min(f,c.count));var p=f-d;if(!(p<0||p===1/0)){var m;Rt.setup(r,i,s,n,l);var v=kt;if(null!==l&&(m=yt.get(l),v=Lt,v.setIndex(m)),r.isMesh)!0===i.wireframe?(ct.setLineWidth(i.wireframeLinewidth*lt()),v.setMode(Ot.LINES)):v.setMode(Ot.TRIANGLES);else if(r.isLine){var g=i.linewidth;void 0===g&&(g=1),ct.setLineWidth(g*lt()),r.isLineSegments?v.setMode(Ot.LINES):r.isLineLoop?v.setMode(Ot.LINE_LOOP):v.setMode(Ot.LINE_STRIP)}else r.isPoints?v.setMode(Ot.POINTS):r.isSprite&&v.setMode(Ot.TRIANGLES);if(r.isBatchedMesh)if(null!==r._multiDrawInstances)na("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),v.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances);else if(ht.get("WEBGL_multi_draw"))v.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else for(var y=r._multiDrawStarts,_=r._multiDrawCounts,x=r._multiDrawCount,b=l?yt.get(l).bytesPerElement:1,w=ft.get(i).currentProgram.getUniforms(),S=0;S<x;S++)w.setValue(Ot,"_gl_DrawID",S),v.render(y[S]/b,_[S]);else if(r.isInstancedMesh)v.renderInstances(d,p,r.count);else if(n.isInstancedBufferGeometry){var M=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,A=Math.min(n.instanceCount,M);v.renderInstances(d,p,A)}else v.render(d,p)}},this.compile=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;null===n&&(n=t),k=Mt.get(n),k.init(e),P.push(k),n.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(k.pushLight(t),t.castShadow&&k.pushShadow(t))})),t!==n&&t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(k.pushLight(t),t.castShadow&&k.pushShadow(t))})),k.setupLights();var i=new Set;return t.traverse((function(t){if(t.isMesh||t.isPoints||t.isLine||t.isSprite){var e=t.material;if(e)if(Array.isArray(e))for(var r=0;r<e.length;r++){var a=e[r];Zt(a,n,t),i.add(a)}else Zt(e,n,t),i.add(e)}})),k=P.pop(),i},this.compileAsync=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=this.compile(t,e,n);return new Promise((function(e){function n(){i.forEach((function(t){var e=ft.get(t),n=e.currentProgram;n.isReady()&&i.delete(t)})),0!==i.size?setTimeout(n,10):e(t)}null!==ht.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)}))};var Jt=null;function Qt(t){Jt&&Jt(t)}function $t(){ee.stop()}function te(){ee.start()}var ee=new gv;function ne(t,e,n,i){if(!1!==t.visible){var r=t.layers.test(e.layers);if(r)if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)k.pushLight(t),t.castShadow&&k.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||Q.intersectsSprite(t)){i&&rt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(nt);var a=xt.update(t),o=t.material;o.visible&&C.push(t,a,o,n,rt.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||Q.intersectsObject(t))){var s=xt.update(t),l=t.material;if(i&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),rt.copy(t.boundingSphere.center)):(null===s.boundingSphere&&s.computeBoundingSphere(),rt.copy(s.boundingSphere.center)),rt.applyMatrix4(t.matrixWorld).applyMatrix4(nt)),Array.isArray(l))for(var h=s.groups,u=0,c=h.length;u<c;u++){var d=h[u],f=l[d.materialIndex];f&&f.visible&&C.push(t,s,f,n,rt.z,d)}else l.visible&&C.push(t,s,l,n,rt.z,null)}for(var p=t.children,m=0,v=p.length;m<v;m++)ne(p[m],e,n,i)}}function ie(t,e,n,i){var r=t.opaque,a=t.transmissive,o=t.transparent;k.setupLightsView(n),!0===$&&At.setGlobalState(R.clippingPlanes,n),i&&ct.viewport(q.copy(i)),r.length>0&&ae(r,e,n),a.length>0&&ae(a,e,n),o.length>0&&ae(o,e,n),ct.buffers.depth.setTest(!0),ct.buffers.depth.setMask(!0),ct.buffers.color.setMask(!0),ct.setPolygonOffset(!1)}function re(t,e,n,i){var r=!0===n.isScene?n.overrideMaterial:null;if(null===r){void 0===k.state.transmissionRenderTarget[i.id]&&(k.state.transmissionRenderTarget[i.id]=new ba(1,1,{generateMipmaps:!0,type:ht.has("EXT_color_buffer_half_float")||ht.has("EXT_color_buffer_float")?pn:sn,minFilter:an,samples:4,stencilBuffer:u,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ua.workingColorSpace}));var a=k.state.transmissionRenderTarget[i.id],o=i.viewport||q;a.setSize(o.z*R.transmissionResolutionScale,o.w*R.transmissionResolutionScale);var s=R.getRenderTarget();R.setRenderTarget(a),R.getClearColor(H),G=R.getClearAlpha(),G<1&&R.setClearColor(16777215,.5),R.clear(),ot&&Tt.render(n);var l=R.toneMapping;R.toneMapping=Pe;var h=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),k.setupLightsView(i),!0===$&&At.setGlobalState(R.clippingPlanes,i),ae(t,n,i),pt.updateMultisampleRenderTarget(a),pt.updateRenderTargetMipmap(a),!1===ht.has("WEBGL_multisampled_render_to_texture")){for(var c=!1,d=0,f=e.length;d<f;d++){var p=e[d],m=p.object,v=p.geometry,g=p.material,y=p.group;if(g.side===Xt&&m.layers.test(i.layers)){var _=g.side;g.side=Wt,g.needsUpdate=!0,oe(m,n,i,v,g,y),g.side=_,g.needsUpdate=!0,c=!0}}!0===c&&(pt.updateMultisampleRenderTarget(a),pt.updateRenderTargetMipmap(a))}R.setRenderTarget(s),R.setClearColor(H,G),void 0!==h&&(i.viewport=h),R.toneMapping=l}}function ae(t,e,n){for(var i=!0===e.isScene?e.overrideMaterial:null,r=0,a=t.length;r<a;r++){var o=t[r],s=o.object,l=o.geometry,h=o.group,u=o.material;!0===u.allowOverride&&null!==i&&(u=i),s.layers.test(n.layers)&&oe(s,e,n,l,u,h)}}function oe(t,e,n,i,r,a){t.onBeforeRender(R,e,n,i,r,a),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(R,e,n,i,t,a),!0===r.transparent&&r.side===Xt&&!1===r.forceSinglePass?(r.side=Wt,r.needsUpdate=!0,R.renderBufferDirect(n,e,i,r,t,a),r.side=jt,r.needsUpdate=!0,R.renderBufferDirect(n,e,i,r,t,a),r.side=Xt):R.renderBufferDirect(n,e,i,r,t,a),t.onAfterRender(R,e,n,i,r,a)}function se(t,e,n){!0!==e.isScene&&(e=at);var i=ft.get(t),r=k.state.lights,a=k.state.shadowsArray,o=r.state.version,s=bt.getParameters(t,r.state,a,e,n),l=bt.getProgramCacheKey(s),h=i.programs;i.environment=t.isMeshStandardMaterial?e.environment:null,i.fog=e.fog,i.envMap=(t.isMeshStandardMaterial?vt:mt).get(t.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===t.envMap?e.environmentRotation:t.envMapRotation,void 0===h&&(t.addEventListener("dispose",Vt),h=new Map,i.programs=h);var u=h.get(l);if(void 0!==u){if(i.currentProgram===u&&i.lightsStateVersion===o)return he(t,s),u}else s.uniforms=bt.getUniforms(t),t.onBeforeCompile(s,R),u=bt.acquireProgram(s,l),h.set(l,u),i.uniforms=s.uniforms;var c=i.uniforms;return(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(c.clippingPlanes=At.uniform),he(t,s),i.needsLights=de(t),i.lightsStateVersion=o,i.needsLights&&(c.ambientLightColor.value=r.state.ambient,c.lightProbe.value=r.state.probe,c.directionalLights.value=r.state.directional,c.directionalLightShadows.value=r.state.directionalShadow,c.spotLights.value=r.state.spot,c.spotLightShadows.value=r.state.spotShadow,c.rectAreaLights.value=r.state.rectArea,c.ltc_1.value=r.state.rectAreaLTC1,c.ltc_2.value=r.state.rectAreaLTC2,c.pointLights.value=r.state.point,c.pointLightShadows.value=r.state.pointShadow,c.hemisphereLights.value=r.state.hemi,c.directionalShadowMap.value=r.state.directionalShadowMap,c.directionalShadowMatrix.value=r.state.directionalShadowMatrix,c.spotShadowMap.value=r.state.spotShadowMap,c.spotLightMatrix.value=r.state.spotLightMatrix,c.spotLightMap.value=r.state.spotLightMap,c.pointShadowMap.value=r.state.pointShadowMap,c.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=u,i.uniformsList=null,u}function le(t){if(null===t.uniformsList){var e=t.currentProgram.getUniforms();t.uniformsList=Vx.seqWithValue(e.seq,t.uniforms)}return t.uniformsList}function he(t,e){var n=ft.get(t);n.outputColorSpace=e.outputColorSpace,n.batching=e.batching,n.batchingColor=e.batchingColor,n.instancing=e.instancing,n.instancingColor=e.instancingColor,n.instancingMorph=e.instancingMorph,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.morphColors=e.morphColors,n.morphTargetsCount=e.morphTargetsCount,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents,n.toneMapping=e.toneMapping}function ue(t,e,n,i,r){!0!==e.isScene&&(e=at),pt.resetTextureUnits();var a=e.fog,o=i.isMeshStandardMaterial?e.environment:null,s=null===D?R.outputColorSpace:!0===D.isXRRenderTarget?D.texture.colorSpace:Li,l=(i.isMeshStandardMaterial?vt:mt).get(i.envMap||o),h=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,u=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),c=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,f=!!n.morphAttributes.color,p=Pe;i.toneMapped&&(null!==D&&!0!==D.isXRRenderTarget||(p=R.toneMapping));var m=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==m?m.length:0,g=ft.get(i),y=k.state.lights;if(!0===$&&(!0===tt||t!==U)){var _=t===U&&i.id===F;At.setState(i,t,_)}var x=!1;i.version===g.__version?g.needsLights&&g.lightsStateVersion!==y.state.version||g.outputColorSpace!==s||r.isBatchedMesh&&!1===g.batching?x=!0:r.isBatchedMesh||!0!==g.batching?r.isBatchedMesh&&!0===g.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===g.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===g.instancing?x=!0:r.isInstancedMesh||!0!==g.instancing?r.isSkinnedMesh&&!1===g.skinning?x=!0:r.isSkinnedMesh||!0!==g.skinning?r.isInstancedMesh&&!0===g.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===g.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===g.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===g.instancingMorph&&null!==r.morphTexture||g.envMap!==l||!0===i.fog&&g.fog!==a?x=!0:void 0===g.numClippingPlanes||g.numClippingPlanes===At.numPlanes&&g.numIntersection===At.numIntersection?(g.vertexAlphas!==h||g.vertexTangents!==u||g.morphTargets!==c||g.morphNormals!==d||g.morphColors!==f||g.toneMapping!==p||g.morphTargetsCount!==v)&&(x=!0):x=!0:x=!0:x=!0:x=!0:(x=!0,g.__version=i.version);var b=g.currentProgram;!0===x&&(b=se(i,e,r));var w=!1,S=!1,M=!1,A=b.getUniforms(),E=g.uniforms;if(ct.useProgram(b.program)&&(w=!0,S=!0,M=!0),i.id!==F&&(F=i.id,S=!0),w||U!==t){var T=ct.buffers.depth.getReversed();T?(et.copy(t.projectionMatrix),ra(et),aa(et),A.setValue(Ot,"projectionMatrix",et)):A.setValue(Ot,"projectionMatrix",t.projectionMatrix),A.setValue(Ot,"viewMatrix",t.matrixWorldInverse);var C=A.map.cameraPosition;void 0!==C&&C.setValue(Ot,it.setFromMatrixPosition(t.matrixWorld)),ut.logarithmicDepthBuffer&&A.setValue(Ot,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&A.setValue(Ot,"isOrthographic",!0===t.isOrthographicCamera),U!==t&&(U=t,S=!0,M=!0)}if(r.isSkinnedMesh){A.setOptional(Ot,r,"bindMatrix"),A.setOptional(Ot,r,"bindMatrixInverse");var L=r.skeleton;L&&(null===L.boneTexture&&L.computeBoneTexture(),A.setValue(Ot,"boneTexture",L.boneTexture,pt))}r.isBatchedMesh&&(A.setOptional(Ot,r,"batchingTexture"),A.setValue(Ot,"batchingTexture",r._matricesTexture,pt),A.setOptional(Ot,r,"batchingIdTexture"),A.setValue(Ot,"batchingIdTexture",r._indirectTexture,pt),A.setOptional(Ot,r,"batchingColorTexture"),null!==r._colorsTexture&&A.setValue(Ot,"batchingColorTexture",r._colorsTexture,pt));var P=n.morphAttributes;if(void 0===P.position&&void 0===P.normal&&void 0===P.color||Ct.update(r,n,b),(S||g.receiveShadow!==r.receiveShadow)&&(g.receiveShadow=r.receiveShadow,A.setValue(Ot,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(E.envMap.value=l,E.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==e.environment&&(E.envMapIntensity.value=e.environmentIntensity),S&&(A.setValue(Ot,"toneMappingExposure",R.toneMappingExposure),g.needsLights&&ce(E,M),a&&!0===i.fog&&wt.refreshFogUniforms(E,a),wt.refreshMaterialUniforms(E,i,W,j,k.state.transmissionRenderTarget[t.id]),Vx.upload(Ot,le(g),E,pt)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Vx.upload(Ot,le(g),E,pt),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&A.setValue(Ot,"center",r.center),A.setValue(Ot,"modelViewMatrix",r.modelViewMatrix),A.setValue(Ot,"normalMatrix",r.normalMatrix),A.setValue(Ot,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial)for(var N=i.uniformsGroups,I=0,O=N.length;I<O;I++){var q=N[I];Nt.update(q,b),Nt.bind(q,b)}return b}function ce(t,e){t.ambientLightColor.needsUpdate=e,t.lightProbe.needsUpdate=e,t.directionalLights.needsUpdate=e,t.directionalLightShadows.needsUpdate=e,t.pointLights.needsUpdate=e,t.pointLightShadows.needsUpdate=e,t.spotLights.needsUpdate=e,t.spotLightShadows.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function de(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}ee.setAnimationLoop(Qt),"undefined"!==typeof self&&ee.setContext(self),this.setAnimationLoop=function(t){Jt=t,Bt.setAnimationLoop(t),null===t?ee.stop():ee.start()},Bt.addEventListener("sessionstart",$t),Bt.addEventListener("sessionend",te),this.render=function(t,e){if(void 0===e||!0===e.isCamera){if(!0!==N){if(!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===Bt.enabled&&!0===Bt.isPresenting&&(!0===Bt.cameraAutoUpdate&&Bt.updateCamera(e),e=Bt.getCamera()),!0===t.isScene&&t.onBeforeRender(R,t,e,D),k=Mt.get(t,P.length),k.init(e),P.push(k),nt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),Q.setFromProjectionMatrix(nt),tt=this.localClippingEnabled,$=At.init(this.clippingPlanes,tt),C=St.get(t,L.length),C.init(),L.push(C),!0===Bt.enabled&&!0===Bt.isPresenting){var n=R.xr.getDepthSensingMesh();null!==n&&ne(n,e,-1/0,R.sortObjects)}ne(t,e,0,R.sortObjects),C.finish(),!0===R.sortObjects&&C.sort(X,Y),ot=!1===Bt.enabled||!1===Bt.isPresenting||!1===Bt.hasDepthSensing(),ot&&Tt.addToRenderList(C,t),this.info.render.frame++,!0===$&&At.beginShadows();var i=k.state.shadowsArray;Et.render(i,t,e),!0===$&&At.endShadows(),!0===this.info.autoReset&&this.info.reset();var r=C.opaque,a=C.transmissive;if(k.setupLights(),e.isArrayCamera){var o=e.cameras;if(a.length>0)for(var s=0,l=o.length;s<l;s++){var h=o[s];re(r,a,t,h)}ot&&Tt.render(t);for(var u=0,c=o.length;u<c;u++){var d=o[u];ie(C,t,d,d.viewport)}}else a.length>0&&re(r,a,t,e),ot&&Tt.render(t),ie(C,t,e);null!==D&&0===O&&(pt.updateMultisampleRenderTarget(D),pt.updateRenderTargetMipmap(D)),!0===t.isScene&&t.onAfterRender(R,t,e),Rt.resetDefaultState(),F=-1,U=null,P.pop(),P.length>0?(k=P[P.length-1],!0===$&&At.setGlobalState(R.clippingPlanes,k.state.camera)):k=null,L.pop(),C=L.length>0?L[L.length-1]:null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.getActiveCubeFace=function(){return I},this.getActiveMipmapLevel=function(){return O},this.getRenderTarget=function(){return D},this.setRenderTargetTextures=function(t,e,n){var i=ft.get(t);i.__autoAllocateDepthBuffer=!1===t.resolveDepthBuffer,!1===i.__autoAllocateDepthBuffer&&(i.__useRenderToTexture=!1),ft.get(t.texture).__webglTexture=e,ft.get(t.depthTexture).__webglTexture=i.__autoAllocateDepthBuffer?void 0:n,i.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(t,e){var n=ft.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e};var fe=Ot.createFramebuffer();this.setRenderTarget=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;D=t,I=e,O=n;var i=!0,r=null,a=!1,o=!1;if(t){var s=ft.get(t);if(void 0!==s.__useDefaultFramebuffer)ct.bindFramebuffer(Ot.FRAMEBUFFER,null),i=!1;else if(void 0===s.__webglFramebuffer)pt.setupRenderTarget(t);else if(s.__hasExternalTextures)pt.rebindTextures(t,ft.get(t.texture).__webglTexture,ft.get(t.depthTexture).__webglTexture);else if(t.depthBuffer){var l=t.depthTexture;if(s.__boundDepthTexture!==l){if(null!==l&&ft.has(l)&&(t.width!==l.image.width||t.height!==l.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");pt.setupDepthRenderbuffer(t)}}var h=t.texture;(h.isData3DTexture||h.isDataArrayTexture||h.isCompressedArrayTexture)&&(o=!0);var u=ft.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=Array.isArray(u[e])?u[e][n]:u[e],a=!0):r=t.samples>0&&!1===pt.useMultisampledRTT(t)?ft.get(t).__webglMultisampledFramebuffer:Array.isArray(u)?u[n]:u,q.copy(t.viewport),B.copy(t.scissor),z=t.scissorTest}else q.copy(K).multiplyScalar(W).floor(),B.copy(Z).multiplyScalar(W).floor(),z=J;0!==n&&(r=fe);var c=ct.bindFramebuffer(Ot.FRAMEBUFFER,r);if(c&&i&&ct.drawBuffers(t,r),ct.viewport(q),ct.scissor(B),ct.setScissorTest(z),a){var d=ft.get(t.texture);Ot.framebufferTexture2D(Ot.FRAMEBUFFER,Ot.COLOR_ATTACHMENT0,Ot.TEXTURE_CUBE_MAP_POSITIVE_X+e,d.__webglTexture,n)}else if(o){var f=ft.get(t.texture),p=e;Ot.framebufferTextureLayer(Ot.FRAMEBUFFER,Ot.COLOR_ATTACHMENT0,f.__webglTexture,n,p)}else if(null!==t&&0!==n){var m=ft.get(t.texture);Ot.framebufferTexture2D(Ot.FRAMEBUFFER,Ot.COLOR_ATTACHMENT0,Ot.TEXTURE_2D,m.__webglTexture,n)}F=-1},this.readRenderTargetPixels=function(t,e,n,i,r,a,o){if(t&&t.isWebGLRenderTarget){var s=ft.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){ct.bindFramebuffer(Ot.FRAMEBUFFER,s);try{var l=t.texture,h=l.format,u=l.type;if(!ut.textureFormatReadable(h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!ut.textureTypeReadable(u))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&Ot.readPixels(e,n,i,r,Pt.convert(h),Pt.convert(u),a)}finally{var c=null!==D?ft.get(D).__webglFramebuffer:null;ct.bindFramebuffer(Ot.FRAMEBUFFER,c)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.readRenderTargetPixelsAsync=function(){var t=gt()(c.a.mark((function t(e,n,i,r,a,o,s){var l,h,u,d,f,p,m;return c.a.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(e&&e.isWebGLRenderTarget){t.next=2;break}throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");case 2:if(l=ft.get(e).__webglFramebuffer,e.isWebGLCubeRenderTarget&&void 0!==s&&(l=l[s]),!l){t.next=32;break}if(!(n>=0&&n<=e.width-r&&i>=0&&i<=e.height-a)){t.next=31;break}if(ct.bindFramebuffer(Ot.FRAMEBUFFER,l),h=e.texture,u=h.format,d=h.type,ut.textureFormatReadable(u)){t.next=12;break}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");case 12:if(ut.textureTypeReadable(d)){t.next=14;break}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");case 14:return f=Ot.createBuffer(),Ot.bindBuffer(Ot.PIXEL_PACK_BUFFER,f),Ot.bufferData(Ot.PIXEL_PACK_BUFFER,o.byteLength,Ot.STREAM_READ),Ot.readPixels(n,i,r,a,Pt.convert(u),Pt.convert(d),0),p=null!==D?ft.get(D).__webglFramebuffer:null,ct.bindFramebuffer(Ot.FRAMEBUFFER,p),m=Ot.fenceSync(Ot.SYNC_GPU_COMMANDS_COMPLETE,0),Ot.flush(),t.next=24,ia(Ot,m,4);case 24:return Ot.bindBuffer(Ot.PIXEL_PACK_BUFFER,f),Ot.getBufferSubData(Ot.PIXEL_PACK_BUFFER,0,o),Ot.deleteBuffer(f),Ot.deleteSync(m),t.abrupt("return",o);case 31:throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.");case 32:case"end":return t.stop()}}),t)})));return function(e,n,i,r,a,o,s){return t.apply(this,arguments)}}(),this.copyFramebufferToTexture=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=Math.pow(2,-n),r=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i),o=null!==e?e.x:0,s=null!==e?e.y:0;pt.setTexture2D(t,0),Ot.copyTexSubImage2D(Ot.TEXTURE_2D,n,0,0,o,s,r,a),ct.unbindTexture()};var pe=Ot.createFramebuffer(),me=Ot.createFramebuffer();this.copyTextureToTexture=function(t,e){var n,i,r,a,o,s,l,h,u,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,d=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;null===p&&(0!==f?(na("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),p=f,f=0):p=0);var m=t.isCompressedTexture?t.mipmaps[p]:t.image;if(null!==c)n=c.max.x-c.min.x,i=c.max.y-c.min.y,r=c.isBox3?c.max.z-c.min.z:1,a=c.min.x,o=c.min.y,s=c.isBox3?c.min.z:0;else{var v=Math.pow(2,-f);n=Math.floor(m.width*v),i=Math.floor(m.height*v),r=t.isDataArrayTexture?m.depth:t.isData3DTexture?Math.floor(m.depth*v):1,a=0,o=0,s=0}null!==d?(l=d.x,h=d.y,u=d.z):(l=0,h=0,u=0);var g,y=Pt.convert(e.format),_=Pt.convert(e.type);e.isData3DTexture?(pt.setTexture3D(e,0),g=Ot.TEXTURE_3D):e.isDataArrayTexture||e.isCompressedArrayTexture?(pt.setTexture2DArray(e,0),g=Ot.TEXTURE_2D_ARRAY):(pt.setTexture2D(e,0),g=Ot.TEXTURE_2D),Ot.pixelStorei(Ot.UNPACK_FLIP_Y_WEBGL,e.flipY),Ot.pixelStorei(Ot.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),Ot.pixelStorei(Ot.UNPACK_ALIGNMENT,e.unpackAlignment);var x=Ot.getParameter(Ot.UNPACK_ROW_LENGTH),b=Ot.getParameter(Ot.UNPACK_IMAGE_HEIGHT),w=Ot.getParameter(Ot.UNPACK_SKIP_PIXELS),S=Ot.getParameter(Ot.UNPACK_SKIP_ROWS),M=Ot.getParameter(Ot.UNPACK_SKIP_IMAGES);Ot.pixelStorei(Ot.UNPACK_ROW_LENGTH,m.width),Ot.pixelStorei(Ot.UNPACK_IMAGE_HEIGHT,m.height),Ot.pixelStorei(Ot.UNPACK_SKIP_PIXELS,a),Ot.pixelStorei(Ot.UNPACK_SKIP_ROWS,o),Ot.pixelStorei(Ot.UNPACK_SKIP_IMAGES,s);var A=t.isDataArrayTexture||t.isData3DTexture,E=e.isDataArrayTexture||e.isData3DTexture;if(t.isDepthTexture){var T=ft.get(t),C=ft.get(e),k=ft.get(T.__renderTarget),L=ft.get(C.__renderTarget);ct.bindFramebuffer(Ot.READ_FRAMEBUFFER,k.__webglFramebuffer),ct.bindFramebuffer(Ot.DRAW_FRAMEBUFFER,L.__webglFramebuffer);for(var P=0;P<r;P++)A&&(Ot.framebufferTextureLayer(Ot.READ_FRAMEBUFFER,Ot.COLOR_ATTACHMENT0,ft.get(t).__webglTexture,f,s+P),Ot.framebufferTextureLayer(Ot.DRAW_FRAMEBUFFER,Ot.COLOR_ATTACHMENT0,ft.get(e).__webglTexture,p,u+P)),Ot.blitFramebuffer(a,o,n,i,l,h,n,i,Ot.DEPTH_BUFFER_BIT,Ot.NEAREST);ct.bindFramebuffer(Ot.READ_FRAMEBUFFER,null),ct.bindFramebuffer(Ot.DRAW_FRAMEBUFFER,null)}else if(0!==f||t.isRenderTargetTexture||ft.has(t)){var R=ft.get(t),N=ft.get(e);ct.bindFramebuffer(Ot.READ_FRAMEBUFFER,pe),ct.bindFramebuffer(Ot.DRAW_FRAMEBUFFER,me);for(var I=0;I<r;I++)A?Ot.framebufferTextureLayer(Ot.READ_FRAMEBUFFER,Ot.COLOR_ATTACHMENT0,R.__webglTexture,f,s+I):Ot.framebufferTexture2D(Ot.READ_FRAMEBUFFER,Ot.COLOR_ATTACHMENT0,Ot.TEXTURE_2D,R.__webglTexture,f),E?Ot.framebufferTextureLayer(Ot.DRAW_FRAMEBUFFER,Ot.COLOR_ATTACHMENT0,N.__webglTexture,p,u+I):Ot.framebufferTexture2D(Ot.DRAW_FRAMEBUFFER,Ot.COLOR_ATTACHMENT0,Ot.TEXTURE_2D,N.__webglTexture,p),0!==f?Ot.blitFramebuffer(a,o,n,i,l,h,n,i,Ot.COLOR_BUFFER_BIT,Ot.NEAREST):E?Ot.copyTexSubImage3D(g,p,l,h,u+I,a,o,n,i):Ot.copyTexSubImage2D(g,p,l,h,a,o,n,i);ct.bindFramebuffer(Ot.READ_FRAMEBUFFER,null),ct.bindFramebuffer(Ot.DRAW_FRAMEBUFFER,null)}else E?t.isDataTexture||t.isData3DTexture?Ot.texSubImage3D(g,p,l,h,u,n,i,r,y,_,m.data):e.isCompressedArrayTexture?Ot.compressedTexSubImage3D(g,p,l,h,u,n,i,r,y,m.data):Ot.texSubImage3D(g,p,l,h,u,n,i,r,y,_,m):t.isDataTexture?Ot.texSubImage2D(Ot.TEXTURE_2D,p,l,h,n,i,y,_,m.data):t.isCompressedTexture?Ot.compressedTexSubImage2D(Ot.TEXTURE_2D,p,l,h,m.width,m.height,y,m.data):Ot.texSubImage2D(Ot.TEXTURE_2D,p,l,h,n,i,y,_,m);Ot.pixelStorei(Ot.UNPACK_ROW_LENGTH,x),Ot.pixelStorei(Ot.UNPACK_IMAGE_HEIGHT,b),Ot.pixelStorei(Ot.UNPACK_SKIP_PIXELS,w),Ot.pixelStorei(Ot.UNPACK_SKIP_ROWS,S),Ot.pixelStorei(Ot.UNPACK_SKIP_IMAGES,M),0===p&&e.generateMipmaps&&Ot.generateMipmap(g),ct.unbindTexture()},this.copyTextureToTexture3D=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return na('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(t,e,n,i,r)},this.initRenderTarget=function(t){void 0===ft.get(t).__webglFramebuffer&&pt.setupRenderTarget(t)},this.initTexture=function(t){t.isCubeTexture?pt.setTextureCube(t,0):t.isData3DTexture?pt.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?pt.setTexture2DArray(t,0):pt.setTexture2D(t,0),ct.unbindTexture()},this.resetState=function(){I=0,O=0,D=null,ct.reset(),Rt.reset()},"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}return ht()(t,[{key:"coordinateSystem",get:function(){return pr}},{key:"outputColorSpace",get:function(){return this._outputColorSpace},set:function(t){this._outputColorSpace=t;var e=this.getContext();e.drawingBufferColorSpace=ua._getDrawingBufferColorSpace(t),e.unpackColorSpace=ua._getUnpackColorSpace()}}])}();Object.defineProperty;var tw={geom_3d:53248,geom_3d_text:53249,geom_3d_mtext:53250,geom_3d_obj:53251,geom_2d:57344,geom_2d_text:57345,geom_2d_mtext:57346,geom_2d_circle:57347,geom_2d_arc:57348,geom_2d_ellipse:57349,geom_2d_ellipseArc:57350,geom_2d_others:57351},ew={};function nw(t,e,n,i,r){for(var a=new sl,o=0;o<t.length;o++)iw(t[o],e);for(var s=function(e){var n,o,s=ew[t[e].drawObject];if(s.MapInstance.forEach((function(n,i){n.instanceId==t[e].instanceId&&(i,o=t[e].drawObject)})),o&&(n=i.getObjectByName(o)),!n){var l,h=ew[t[e].drawObject],u=new sl;u.name=t[e].drawObject,u.userData.isInstancedMeshGroup=!0;var c=h.MapInstance.length;null===(l=h.MapMesh)||void 0===l||l.forEach((function(n){var i=rw(n,u.name,c,r);i&&(h.MapInstance.forEach((function(a,o){if(a.instanceId==t[e].instanceId){var s;i.userData.instanceIndex=o,i.name=t[e].instanceId;var l=null===(s=a.matrix)||void 0===s?void 0:s.val;if(l){var h=new io;h.elements=a.matrix.val,i.setMatrixAt(o,h)}var u=n.prop.color,c=new Zo(r||"rgb(".concat(u[0],", ").concat(u[1],", ").concat(u[2],")"));i.setColorAt(o,c)}})),u.add(i))})),a.add(u)}},l=0;l<t.length;l++)s(l);return a}function iw(t,e){var n=t.drawObject;if(ew[n]){var i=ew[n]["MapInstance"].find((function(e){return e.instanceId==t.instanceId}));i||ew[n]["MapInstance"].push(t)}else ew[n]={MapInstance:[t]},e.forEach((function(t){t.drawObjId==n&&(ew[n].MapMesh=t.geoms)}))}function rw(t,e,n,i){var r;return t.type==tw.geom_2d||t.type==tw.geom_2d_others||(t.type==tw.geom_2d_text||t.type==tw.geom_2d_mtext||t.type==tw.geom_3d_text||t.type==tw.geom_3d_mtext?r=ow(t,e,n):t.type==tw.geom_2d_circle||t.type==tw.geom_2d_arc||t.type==tw.geom_2d_ellipse||t.type==tw.geom_2d_ellipseArc||t.type!=tw.geom_3d&&t.type!=tw.geom_3d_obj||(r=aw(t,e,n,i))),r}function aw(t,e,n,i){var r=t.geometry,a=t.material,o=t.triangles,s=t.points,l=t.normals,h=r||new Es;if(o&&o.length&&h.setIndex(o),s&&s.length){var u=new Float32Array(s);h.setAttribute("position",new hs(u,3))}if(l&&l.length){var c=new Float32Array(l);h.setAttribute("normal",new hs(c,3))}var d,f,p,m=t.prop.color;return p=Array.isArray(m)&&m.length?m:m?m.split(","):[255,255,255,255],d=a||new $c({roughness:.8,envMapIntensity:.5,side:Xt,userData:{nColor:new Zo(i||"rgb(".concat(p[0],", ").concat(p[1],", ").concat(p[2],")"))}}),f=new ih(h,d,n),f.userData.drawObjectId=e,f}function ow(t,e,n){var i=t.prop,r=t.text,a=t.points,o=t.normals,s=(i.color,i.linewidth,i.fontsize),l=(i.fontname,i.rotate,i.italic,i.widthscale,new nv),h=l.parse(cv),u={font:h,size:s||20,height:1,curveSegments:11,bevelEnabled:!0,bevelThickness:.1,bevelSize:1,depth:1,bevelSegments:1},c=new uv("".concat(r),u),d=aw({prop:i,geometry:c,normals:o},e,n),f=new io;return f.identity().makeTranslation(a[0],a[1],a[2]),d.applyMatrix4(f),d.translateX(-s/2.5),d.translateY(-s/2.5),d.userData.instanceName=e,d}var sw=c.a.mark((function t(e){return c.a.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=3,e;case 3:t.next=0;break;case 5:case"end":return t.stop()}}),t)}))(null),lw=h()(sw,17),hw=lw[0],uw=lw[1],cw=lw[2],dw=lw[3],fw=lw[4],pw=lw[5],mw=lw[6],vw=lw[7],gw=lw[8],yw=lw[9],_w=lw[10],xw=lw[11],bw=lw[12],ww=lw[13],Sw=lw[14],Mw=lw[15],Aw=lw[16],Ew=c.a.mark((function t(e){return c.a.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=3,e;case 3:t.next=0;break;case 5:case"end":return t.stop()}}),t)}))(0),Tw=h()(Ew,5),Cw=Tw[0],kw=Tw[1],Lw=Tw[2],Pw=Tw[3],Rw=Tw[4],Nw=c.a.mark((function t(e){return c.a.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=3,e;case 3:t.next=0;break;case 5:case"end":return t.stop()}}),t)}))(!1),Iw=h()(Nw,8),Ow=Iw[0],Dw=Iw[1],Fw=Iw[2],Uw=Iw[3],qw=Iw[4],Bw=Iw[5],zw=Iw[6],Hw=Iw[7],Gw=c.a.mark((function t(e){return c.a.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=3,e;case 3:t.next=0;break;case 5:case"end":return t.stop()}}),t)}))(!0),Vw=h()(Gw,1),jw=Vw[0],Ww=[],Xw=200,Yw=200,Kw={name:"FlModel",props:{data:{type:Object,default:function(){return{}}}},data:function(){return{roamConfig:{loop:!1,speed:0}}},created:function(){at.install({THREE:this.THREE}),Lw=new this.THREE.Clock,pw=new this.THREE.Raycaster,mw=new this.THREE.Vector2},mounted:function(){fw=document.getElementById("instructions"),this.initRender(),this.initScene(),this.initCamera(),this.initControl(),this.initLight(),this.initLabelRender(),hw.domElement.addEventListener("mouseup",this.mouseClick,!1),hw.domElement.addEventListener("mousedown",this.mouseDown,!1),this.animate()},methods:{initRender:function(){hw=new this.THREE.WebGLRenderer({antialias:!0,alpha:!0,logarithmicDepthBuffer:!0}),hw.setPixelRatio(2*window.devicePixelRatio),hw.setSize(window.innerWidth,window.innerHeight),hw.domElement.id="three-model",hw.shadowMap.enabled=!0,hw.outputEncoding=this.THREE.sRGBEncoding,fw.appendChild(hw.domElement),hw.autoClear=!1,hw.autoClearColor=!1,hw.autoClearDepth=!1,hw.autoClearStencil=!1},initScene:function(){Aw=new this.THREE.Group,uw=new this.THREE.Scene;var t=new this.THREE.Matrix4;t.makeRotationX(-Math.PI/2),uw.applyMatrix4(t)},initCamera:function(){cw=new this.THREE.PerspectiveCamera(45,window.innerWidth/window.innerHeight,.1,1e4),cw.position.set(0,100,150)},initControl:function(){dw=new at(cw,hw.domElement),dw.dollyToCursor=!0,dw.smoothTime=.1,dw.draggingSmoothTime=.05,dw.truckSpeed=2,dw.infinityDolly=!0,dw.minDistance=4},initLight:function(){var t=new this.THREE.PMREMGenerator(hw);uw.environment=t.fromScene(new mm,.04).texture},initLabelRender:function(){vw=new Em,vw.setSize(fw.offsetWidth,fw.offsetHeight),vw.domElement.style.position="absolute",vw.domElement.style.top="0px",vw.domElement.style.pointerEvents="none",fw.appendChild(vw.domElement)},drawModel:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(0!==Object.keys(t).length){var n=$m(t),i=n.instances,r=n.drawObjs;i.length>0&&(Aw=nw(i,r,"",uw,e),uw.add(Aw),dw.fitToSphere(Aw,!0),dw.saveState())}},compileShader:function(){uw.traverse((function(t){t.isMesh&&(t.material.onBeforeCompile=function(e){var n="\n precision lowp float;\n attribute float visible;\n varying float vVisible;\n void main() {\n vVisible = visible;\n ",i="\n precision lowp float;\n varying float vVisible;\n void main() {\n ",r="\n #include <dithering_fragment>\n if (vVisible > 0.0) {\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n } else {\n discard;\n }\n ";e.vertexShader=e.vertexShader.replace("void main() {",n),e.fragmentShader=e.fragmentShader.replace("void main() {",i),e.fragmentShader=e.fragmentShader.replace("#include <dithering_fragment>",r),t.material.transparent=!0})}))},mouseDown:function(){kw=(new Date).getTime()},mouseClick:function(t){if(!Hw&&(Cw=(new Date).getTime(),Cw-kw<300)){mw.x=t.clientX/fw.offsetWidth*2-1,mw.y=-t.clientY/fw.offsetHeight*2+1,pw.setFromCamera(mw,cw);var e=pw.intersectObjects(uw.children,!0),n={},i={position:{x:dw.camera.position.x,y:dw.camera.position.y,z:dw.camera.position.z},lookAt:{heading:dw._target.x,pitch:dw._target.y,roll:dw._target.z}};n=e.length>0?{objects:[e[0].object],mousePosition:{x:t.clientX,y:t.clientY},camera:i,v3Position:{x:e[0].point.x,y:e[0].point.y,z:e[0].point.z}}:{objects:[],mousePosition:{x:t.clientX,y:t.clientY},camera:i,v3Position:{x:-1,y:-1,z:-1}},0===t.button?this.$emit("leftClick",n):2===t.button&&this.$emit("rightClick",n)}},resize:function(t,e){cw&&(cw.aspect=t/e,cw.updateProjectionMatrix(),hw.setSize(t,e,!0),vw.setSize(t,e),Mw&&Mw.updateParams(t,e))},setModelCenter:function(){},updateProperty:function(t){for(var e=this,n=function(){var n=t[i],r=e.getObjectByName(n.name),a=function(t){switch(t){case"color":r.forEach((function(i){i.isMesh&&(i.setColorAt(i.userData.instanceIndex,new e.THREE.Color(n.attr[t])),i.instanceColor.needsUpdate=!0)}));break;case"visible":r.forEach((function(e){var i=e.userData.instanceIndex;e.geometry.attributes.visible.array[i]=n.attr[t]?1:0,e.geometry.attributes.visible.needsUpdate=!0}));break;case"opacity":obj.material.opacity=n.attr[t],obj.material.transparent=!0;break}};for(var o in n.attr)a(o)},i=0;i<t.length;i++)n()},updateWholeProperty:function(t){var e=this;uw&&uw.traverse((function(n){if(n instanceof e.THREE.Mesh){switch(t.attr){case"color":n.material.color=new e.THREE.Color(t.value);break;case"visible":n.material.visible=t.value;break;case"opacity":n.material.opacity=t.value,n.material.transparent=!0;break}n.material.needsUpdate=!0}}))},resetProperty:function(t){for(var e=0;e<t.length;e++){var n=t[e],i=this.getObjectByName(n.name);if(i)for(var r in n.attr)switch(r){case"color":i.forEach((function(t){t.isMesh&&(t.setColorAt(t.userData.instanceIndex,t.material.userData.nColor),t.instanceColor.needsUpdate=!0)}));break}}},locateModel:function(t){var e=uw.getObjectByName(t);e&&dw.fitToSphere(e.parent,!0)},cameraLocation:function(t){dw.setLookAt(t.x,t.y,t.z,t.heading,t.pitch,t.roll,!0),dw.update(0)},billboard:function(t){var e=new xm(t.billboard);return e.name=t.labelClass,e.position.set(t.x,t.y,t.z),uw.add(e),e},getObjectByName:function(t){var e=[];return uw.traverse((function(n){n.name===t&&e.push(n)})),e},getObjectById:function(t){return uw.getObjectById(t)},removeObjectById:function(t){var e=this.getObjectByName(t);e.forEach((function(e){e.name===t&&(e.material&&e.material.dispose(),e.geometry&&e.geometry.dispose(),e.isMesh&&e.clear(),uw.remove(e))}))},removeObjectByName:function(t){var e=this.getObjectByName(t);e.forEach((function(e){e.name===t&&(e.material&&e.material.dispose(),e.geometry&&e.geometry.dispose(),e.isMesh&&e.clear(),uw.remove(e))}))},drawCurve:function(t){var e=this;this.removeObjectByName(t.name);var n=[];if(t.path.forEach((function(t){n.push(new e.THREE.Vector3(t.x,t.y,t.z))})),n.length>1){yw=new this.THREE.CatmullRomCurve3(n);var i=(new this.THREE.BufferGeometry).setFromPoints(yw.getPoints(5e3)),r=new this.THREE.LineBasicMaterial({color:t.color,depthTest:!1,transparent:!0}),a=new this.THREE.Line(i,r);a.name=t.name,uw.add(a)}},drawTextureCurve:function(t){var e=this;this.removeObjectByName(t.name);var n=[];if(t.path.forEach((function(t){n.push(new e.THREE.Vector3(t.x,t.y,t.z))})),n.length>1){yw=new this.THREE.CatmullRomCurve3(n,!1,"catmullrom",0);var i=new this.THREE.TubeGeometry(yw,5e3,.5,4);gw=(new this.THREE.TextureLoader).load("/static/arrow/arrow-right.png"),gw.wrapS=this.THREE.RepeatWrapping,gw.wrapT=this.THREE.RepeatWrapping,gw.repeat.set(20,1),gw.needsUpdate=!0,gw.offset.y=.5;var r=new this.THREE.MeshBasicMaterial({map:gw,side:this.THREE.BackSide,transparent:!0}),a=new this.THREE.Line(i,r);a.name=t.name,uw.add(a)}},startRoam:function(t){Rw=0,this.roamConfig=Object.assign({},{loop:t.loop,speed:t.speed,roamName:t.name}),this.drawTextureCurve({name:t.name,path:t.path}),ww=new this.THREE.Clock},pauseRoaming:function(){this.$set(this.roamConfig,"speed",0)},endRoam:function(){Ow=!1,Rw=0,this.removeObjectByName(this.roamConfig.roamName),this.roamConfig=Object.assign({},{loop:!1,speed:0,roamName:""})},cameraTrack:function(){if(Ow){gw.offset.x-=.05;var t=10/yw.getLength();if(Rw<=1-t){var e=yw.getPointAt(Rw),n=yw.getPointAt(Rw+t);cw.position.set(e.x,e.y+5,e.z),cw.lookAt(n.x,n.y+5,n.z),dw.setPosition(e.x,e.y+5,e.z,!1),dw.setTarget(n.x,n.y+5,n.z,!1),Rw+=this.roamConfig.speed/300}else this.roamConfig.loop&&(Rw=0)}else gw=null,this.roamConfig.progress=0},globalBomb:function(t){var e=this;if(0!==uw.children.length){for(var n=0;n<uw.children.length;n++)uw.children[n].traverse((function(n){n.isMesh&&n.worldDir&&e.computedBomb(n,t)}));this.timeRender()}},localBomb:function(t,e){var n=uw.getObjectById(t);n&&this.computedBomb(n,e)},computedBomb:function(t,e){var n=(new this.THREE.Vector3).copy(t.userData.oldPs).add((new this.THREE.Vector3).copy(t.worldDir).multiplyScalar(e)).add((new this.THREE.Vector3).copy(t.userData.position));t.position.copy(n)},setGlobalClipping:function(){var t=(new this.THREE.Box3).setFromObject(uw.children[0]),e=t.max,n=t.min,i=[new this.THREE.Plane(new this.THREE.Vector3(-1,0,0),e.x),new this.THREE.Plane(new this.THREE.Vector3(0,-1,0),e.y),new this.THREE.Plane(new this.THREE.Vector3(0,0,-1),e.z)];return hw.clippingPlanes=i,{min:n,max:e}},updateGlobalCliValue:function(t){var e={x:0,y:1,z:2};for(var n in t)hw.clippingPlanes[e[n]].constant=t[n]},cancelGlobalClipping:function(){hw.clippingPlanes=Object.freeze([])},setLocalClipping:function(t){hw.localClippingEnabled=!0;var e=(new this.THREE.Box3).copy(t.geometry.boundingBox);e.applyMatrix4(t.matrixWorld),Ww=[new this.THREE.Plane(new this.THREE.Vector3(-1,0,0),Math.ceil(e.max.x)),new this.THREE.Plane(new this.THREE.Vector3(0,-1,0),Math.ceil(e.max.y)),new this.THREE.Plane(new this.THREE.Vector3(0,0,-1),Math.ceil(e.max.z))],t.material.clippingPlanes=Ww,t.material.needsUpdate=!0},updateLocalCliValue:function(t){var e={x:0,y:1,z:2};for(var n in t)Ww[e[n]].constant=t[n]},cancelLocalClipping:function(){Ww=Object.freeze([])},startFirstPer:function(){ww=new this.THREE.Clock,_w=new this.THREE.Raycaster(new this.THREE.Vector3,new this.THREE.Vector3(0,-1,0),0,10),xw=new this.THREE.Vector3,bw=new this.THREE.Vector3,Dw=!0,this.initPointerLock()},initPointerLock:function(){var t=this;this.home(),setTimeout((function(){Sw=new Fm(cw,hw.domElement),Sw.lock(),Sw.addEventListener("lock",(function(){dw.enabled=!1,window.addEventListener("keydown",t.onKeyDown,!1),window.addEventListener("keyup",t.onKeyUp,!1),hw.domElement.removeEventListener("mouseup",t.mouseClick,!1),hw.domElement.removeEventListener("mousedown",t.mouseDown,!1)})),Sw.addEventListener("unlock",(function(){Dw=!1,dw.enabled=!0,dw.reset(!0),dw.update(0),setTimeout((function(){window.removeEventListener("keydown",t.onKeyDown),window.removeEventListener("keyup",t.onKeyUp),hw.domElement.addEventListener("mouseup",t.mouseClick,!1),hw.domElement.addEventListener("mousedown",t.mouseDown,!1)}),0)})),uw.add(Sw.object)}),10)},firstPerspective:function(){if(!dw.enabled&&Dw){var t=Sw.object,e=ww.getDelta();xw.x-=10*xw.x*e,xw.z-=10*xw.z*e,xw.y-=9.8*100*e,bw.z=Number(Uw)-Number(qw),bw.x=Number(zw)-Number(Bw),bw.normalize(),(Uw||qw)&&(xw.z-=bw.z*Xw*e),(Bw||zw)&&(xw.x-=bw.x*Xw*e),_w.ray.origin.copy(t.position),_w.ray.origin.y+=5;var n=_w.intersectObjects(uw.children,!0),i=n.length>0;!0===i&&(xw.y=Math.max(0,xw.y),Fw=!0),Sw.moveRight(-xw.x*e),Sw.moveForward(-xw.z*e),t.position.y+=xw.y*e,t.position.y<3&&(xw.y=-0,t.position.y=3,Fw=!0)}},onKeyDown:function(t){if(t.keyCode)switch(t.keyCode){case 38:case 87:Uw=!0;break;case 37:case 65:Bw=!0;break;case 40:case 83:qw=!0;break;case 39:case 68:zw=!0;break;case 32:Fw&&jw&&(xw.y+=Yw),Fw=!1,jw=!1;break}},onKeyUp:function(t){if(t.keyCode)switch(t.keyCode){case 38:case 87:Uw=!1;break;case 37:case 65:Bw=!1;break;case 40:case 83:qw=!1;break;case 39:case 68:zw=!1;break;case 32:jw=!0;break}},home:function(){dw.reset(!0),dw.update(0)},openMeasure:function(t){switch(Mw&&(Mw.close(),Mw=null),Hw=!0,t){case"distance":Mw=new Gm.MeasureDistance(hw,uw,cw,fw.offsetWidth,fw.offsetHeight),Mw.start();break;case"area":Mw=new Wm.MeasureArea(hw,uw,cw,fw.offsetWidth,fw.offsetHeight),Mw.start();break;case"angle":Mw=new Km.MeasureAngle(hw,uw,cw,fw.offsetWidth,fw.offsetHeight),Mw.start();break}},closeMeasure:function(){Hw=!1,Mw&&(Mw.close(),Mw=null)},translateMesh:function(t,e){var n=(new this.THREE.Matrix4).makeTranslation(e.x,e.y,e.z),i=(new this.THREE.Matrix4).copy(n).invert();t.userData.translateMatrixInvert&&t.applyMatrix4(t.userData.translateMatrixInvert),t.userData.translateMatrixInvert=i,t.applyMatrix4(n),t.userData.position=(new this.THREE.Vector3).copy(t.position),t.userData.translate=e},rotateMesh:function(t,e){var n=t.userData.center,i=new this.THREE.Vector3(n.x,n.y,n.z).negate(),r=(new this.THREE.Matrix4).makeTranslation(i.x,i.y,i.z),a=(new this.THREE.Matrix4).makeRotationX(e.x*(Math.PI/180)),o=(new this.THREE.Matrix4).makeRotationY(e.y*(Math.PI/180)),s=(new this.THREE.Matrix4).makeRotationZ(e.z*(Math.PI/180)),l=(new this.THREE.Matrix4).multiply(a).multiply(o).multiply(s);t.applyMatrix4(r);var h=(new this.THREE.Matrix4).copy(l).invert();t.userData.combineMatrixInvert&&t.applyMatrix4(t.userData.combineMatrixInvert),t.userData.combineMatrixInvert=h,t.applyMatrix4(l);var u=(new this.THREE.Matrix4).makeTranslation(n.x,n.y,n.z);t.applyMatrix4(u),t.userData.position=(new this.THREE.Vector3).copy(t.position),t.userData.rotate=e},isolate:function(t,e){uw.traverse((function(n){if(n.isMesh&&n.name!==t.name){switch(e.attr){case"visible":t.material.visible=e.value;break;case"opacity":t.material.opacity=e.value,t.material.transparent=!0;break}n.material.needsUpdate=!0}}))},restore:function(){var t=this;uw.traverse((function(e){e.isMesh&&(e.material.opacity=1,e.material.visible=!0,e.material.transparent=!0,e.material.color=e.material.userData.nColor,e.material.needsUpdate=!0,e.userData.translate={x:0,y:0,z:0},e.userData.rotate={x:0,y:0,z:0},e.userData.translateMatrixInvert&&(e.applyMatrix4(e.userData.translateMatrixInvert),e.userData.translateMatrixInvert=null),e.userData.combineMatrixInvert&&(t.rotateMesh(e,{x:0,y:0,z:0}),e.userData.combineMatrixInvert=null))}))},animate:function(){var t=Lw.getDelta();Pw+=t,requestAnimationFrame(this.animate),dw.enabled&&dw.update(Pw),this.cameraTrack(),this.firstPerspective(),vw.render(uw,cw),hw.render(uw,cw)}}},Zw=Kw;n("0cd6");function Jw(t,e,n,i,r,a,o,s){var l,h="function"===typeof t?t.options:t;if(e&&(h.render=e,h.staticRenderFns=n,h._compiled=!0),i&&(h.functional=!0),a&&(h._scopeId="data-v-"+a),o?(l=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(o)},h._ssrRegister=l):r&&(l=s?function(){r.call(this,(h.functional?this.parent:this).$root.$options.shadowRoot)}:r),l)if(h.functional){h._injectStyles=l;var u=h.render;h.render=function(t,e){return l.call(e),u(t,e)}}else{var c=h.beforeCreate;h.beforeCreate=c?[].concat(c,l):[l]}return{exports:t,options:h}}var Qw=Jw(Zw,o,s,!1,null,"9e291ea2",null),$w=Qw.exports,tS=function(){var t=this,e=t._self._c;return e("div",{ref:"svgDraw",staticStyle:{height:"100%"},attrs:{id:"konva-container"}})},eS=[],nS=n("362d"),iS=n.n(nS);class rS{constructor(t){this._pointer=0,this._eof=!1,this._data=t}next(){if(!this.hasNext())throw this._eof?new Error("Cannot call 'next' after EOF group has been read"):new Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);const t={code:parseInt(this._data[this._pointer])};return this._pointer++,t.value=aS(t.code,this._data[this._pointer].trim()),this._pointer++,0===t.code&&"EOF"===t.value&&(this._eof=!0),this.lastReadGroup=t,t}peek(){if(!this.hasNext())throw this._eof?new Error("Cannot call 'next' after EOF group has been read"):new Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);const t={code:parseInt(this._data[this._pointer])};return t.value=aS(t.code,this._data[this._pointer+1].trim()),t}rewind(t=1){this._pointer=this._pointer-2*t}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}}function aS(t,e){return t<=9?e:t>=10&&t<=59?parseFloat(e):t>=60&&t<=99?parseInt(e):t>=100&&t<=109?e:t>=110&&t<=149?parseFloat(e):t>=160&&t<=179?parseInt(e):t>=210&&t<=239?parseFloat(e):t>=270&&t<=289?parseInt(e):t>=290&&t<=299?oS(e):t>=300&&t<=369?e:t>=370&&t<=389?parseInt(e):t>=390&&t<=399?e:t>=400&&t<=409?parseInt(e):t>=410&&t<=419?e:t>=420&&t<=429?parseInt(e):t>=430&&t<=439?e:t>=440&&t<=459?parseInt(e):t>=460&&t<=469?parseFloat(e):t>=470&&t<=481||999===t||t>=1e3&&t<=1009?e:t>=1010&&t<=1059?parseFloat(e):t>=1060&&t<=1071?parseInt(e):(console.log("WARNING: Group code does not have a defined type: %j",{code:t,value:e}),e)}function oS(t){if("0"===t)return!1;if("1"===t)return!0;throw TypeError("String '"+t+"' cannot be cast to Boolean type")}var sS=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215];function lS(t){return sS[t]}function hS(t){const e={};t.rewind();let n=t.next(),i=n.code;if(e.x=n.value,i+=10,n=t.next(),n.code!=i)throw new Error("Expected code for point value to be "+i+" but got "+n.code+".");return e.y=n.value,i+=10,n=t.next(),n.code!=i?(t.rewind(),e):(e.z=n.value,e)}function uS(t,e,n){switch(e.code){case 0:t.type=e.value;break;case 5:t.handle=e.value;break;case 6:t.lineType=e.value;break;case 8:t.layer=e.value;break;case 48:t.lineTypeScale=e.value;break;case 60:t.visible=0===e.value;break;case 62:t.colorIndex=e.value,t.color=lS(Math.abs(e.value));break;case 67:t.inPaperSpace=0!==e.value;break;case 100:break;case 101:while(0!=e.code)e=n.next();n.rewind();break;case 330:t.ownerHandle=e.value;break;case 347:t.materialObjectHandle=e.value;break;case 370:t.lineweight=e.value;break;case 420:t.color=e.value;break;case 1e3:t.extendedData=t.extendedData||{},t.extendedData.customStrings=t.extendedData.customStrings||[],t.extendedData.customStrings.push(e.value);break;case 1001:t.extendedData=t.extendedData||{},t.extendedData.applicationName=e.value;break;default:return!1}return!0}class cS{constructor(){this.ForEntityName="3DFACE"}parseEntity(t,e){const n={type:e.value,vertices:[]};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 70:n.shape=1===(1&e.value),n.hasContinuousLinetypePattern=128===(128&e.value);break;case 10:n.vertices=dS(t,e),e=t.lastReadGroup;break;default:uS(n,e,t);break}e=t.next()}return n}}function dS(t,e){var n=[],i=!1,r=!1,a=4;for(let s=0;s<=a;s++){var o={};while(!t.isEOF()){if(0===e.code||r)break;switch(e.code){case 10:case 11:case 12:case 13:if(i){r=!0;continue}o.x=e.value,i=!0;break;case 20:case 21:case 22:case 23:o.y=e.value;break;case 30:case 31:case 32:case 33:o.z=e.value;break;default:return n}e=t.next()}n.push(o),i=!1,r=!1}return t.rewind(),n}class fS{constructor(){this.ForEntityName="ARC"}parseEntity(t,e){const n={type:e.value};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:n.center=hS(t);break;case 40:n.radius=e.value;break;case 50:n.startAngle=Math.PI/180*e.value;break;case 51:n.endAngle=Math.PI/180*e.value,n.angleLength=n.endAngle-n.startAngle;break;case 210:n.extrusionDirectionX=e.value;break;case 220:n.extrusionDirectionY=e.value;break;case 230:n.extrusionDirectionZ=e.value;break;default:uS(n,e,t);break}e=t.next()}return n}}class pS{constructor(){this.ForEntityName="ATTDEF"}parseEntity(t,e){var n={type:e.value,scale:1,textStyle:"STANDARD"};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 1:n.text=e.value;break;case 2:n.tag=e.value;break;case 3:n.prompt=e.value;break;case 7:n.textStyle=e.value;break;case 10:n.startPoint=hS(t);break;case 11:n.endPoint=hS(t);break;case 39:n.thickness=e.value;break;case 40:n.textHeight=e.value;break;case 41:n.scale=e.value;break;case 50:n.rotation=e.value;break;case 51:n.obliqueAngle=e.value;break;case 70:n.invisible=!!(1&e.value),n.constant=!!(2&e.value),n.verificationRequired=!!(4&e.value),n.preset=!!(8&e.value);break;case 71:n.backwards=!!(2&e.value),n.mirrored=!!(4&e.value);break;case 72:n.horizontalJustification=e.value;break;case 73:n.fieldLength=e.value;break;case 74:n.verticalJustification=e.value;break;case 100:break;case 210:n.extrusionDirectionX=e.value;break;case 220:n.extrusionDirectionY=e.value;break;case 230:n.extrusionDirectionZ=e.value;break;default:uS(n,e,t);break}e=t.next()}return n}}class mS{constructor(){this.ForEntityName="CIRCLE"}parseEntity(t,e){const n={type:e.value};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:n.center=hS(t);break;case 40:n.radius=e.value;break;case 50:n.startAngle=Math.PI/180*e.value;break;case 51:const i=Math.PI/180*e.value;i<n.startAngle?n.angleLength=i+2*Math.PI-n.startAngle:n.angleLength=i-n.startAngle,n.endAngle=i;break;default:uS(n,e,t);break}e=t.next()}return n}}class vS{constructor(){this.ForEntityName="DIMENSION"}parseEntity(t,e){const n={type:e.value};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 2:n.block=e.value;break;case 10:n.anchorPoint=hS(t);break;case 11:n.middleOfText=hS(t);break;case 12:n.insertionPoint=hS(t);break;case 13:n.linearOrAngularPoint1=hS(t);break;case 14:n.linearOrAngularPoint2=hS(t);break;case 15:n.diameterOrRadiusPoint=hS(t);break;case 16:n.arcPoint=hS(t);break;case 70:n.dimensionType=e.value;break;case 71:n.attachmentPoint=e.value;break;case 42:n.actualMeasurement=e.value;break;case 1:n.text=e.value;break;case 50:n.angle=e.value;break;default:uS(n,e,t);break}e=t.next()}return n}}class gS{constructor(){this.ForEntityName="ELLIPSE"}parseEntity(t,e){const n={type:e.value};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:n.center=hS(t);break;case 11:n.majorAxisEndPoint=hS(t);break;case 40:n.axisRatio=e.value;break;case 41:n.startAngle=e.value;break;case 42:n.endAngle=e.value;break;case 2:n.name=e.value;break;default:uS(n,e,t);break}e=t.next()}return n}}class yS{constructor(){this.ForEntityName="INSERT"}parseEntity(t,e){const n={type:e.value};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 2:n.name=e.value;break;case 41:n.xScale=e.value;break;case 42:n.yScale=e.value;break;case 43:n.zScale=e.value;break;case 10:n.position=hS(t);break;case 50:n.rotation=e.value;break;case 70:n.columnCount=e.value;break;case 71:n.rowCount=e.value;break;case 44:n.columnSpacing=e.value;break;case 45:n.rowSpacing=e.value;break;case 210:n.extrusionDirection=hS(t);break;default:uS(n,e,t);break}e=t.next()}return n}}class _S{constructor(){this.ForEntityName="LINE"}parseEntity(t,e){const n={type:e.value,vertices:[]};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:n.vertices.unshift(hS(t));break;case 11:n.vertices.push(hS(t));break;case 210:n.extrusionDirection=hS(t);break;case 100:break;default:uS(n,e,t);break}e=t.next()}return n}}class xS{constructor(){this.ForEntityName="LWPOLYLINE"}parseEntity(t,e){const n={type:e.value,vertices:[]};let i=0;e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 38:n.elevation=e.value;break;case 39:n.depth=e.value;break;case 70:n.shape=1===(1&e.value),n.hasContinuousLinetypePattern=128===(128&e.value);break;case 90:i=e.value;break;case 10:n.vertices=bS(i,t);break;case 43:0!==e.value&&(n.width=e.value);break;case 210:n.extrusionDirectionX=e.value;break;case 220:n.extrusionDirectionY=e.value;break;case 230:n.extrusionDirectionZ=e.value;break;default:uS(n,e,t);break}e=t.next()}return n}}function bS(t,e){if(!t||t<=0)throw Error("n must be greater than 0 verticies");const n=[];let i=!1,r=!1,a=e.lastReadGroup;for(let o=0;o<t;o++){const t={};while(!e.isEOF()){if(0===a.code||r)break;switch(a.code){case 10:if(i){r=!0;continue}t.x=a.value,i=!0;break;case 20:t.y=a.value;break;case 30:t.z=a.value;break;case 40:t.startWidth=a.value;break;case 41:t.endWidth=a.value;break;case 42:0!=a.value&&(t.bulge=a.value);break;default:return e.rewind(),i&&n.push(t),e.rewind(),n}a=e.next()}n.push(t),i=!1,r=!1}return e.rewind(),n}class wS{constructor(){this.ForEntityName="MTEXT"}parseEntity(t,e){const n={type:e.value};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 3:n.text?n.text+=e.value:n.text=e.value;break;case 1:n.text?n.text+=e.value:n.text=e.value;break;case 10:n.position=hS(t);break;case 11:n.directionVector=hS(t);break;case 40:n.height=e.value;break;case 41:n.width=e.value;break;case 50:n.rotation=e.value;break;case 71:n.attachmentPoint=e.value;break;case 72:n.drawingDirection=e.value;break;default:uS(n,e,t);break}e=t.next()}return n}}class SS{constructor(){this.ForEntityName="POINT"}parseEntity(t,e){const n=e.value,i={type:n};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:i.position=hS(t);break;case 39:i.thickness=e.value;break;case 210:i.extrusionDirection=hS(t);break;case 100:break;default:uS(i,e,t);break}e=t.next()}return i}}class MS{constructor(){this.ForEntityName="VERTEX"}parseEntity(t,e){var n={type:e.value};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:n.x=e.value;break;case 20:n.y=e.value;break;case 30:n.z=e.value;break;case 40:break;case 41:break;case 42:0!=e.value&&(n.bulge=e.value);break;case 70:n.curveFittingVertex=0!==(1&e.value),n.curveFitTangent=0!==(2&e.value),n.splineVertex=0!==(8&e.value),n.splineControlPoint=0!==(16&e.value),n.threeDPolylineVertex=0!==(32&e.value),n.threeDPolylineMesh=0!==(64&e.value),n.polyfaceMeshVertex=0!==(128&e.value);break;case 50:break;case 71:n.faceA=e.value;break;case 72:n.faceB=e.value;break;case 73:n.faceC=e.value;break;case 74:n.faceD=e.value;break;default:uS(n,e,t);break}e=t.next()}return n}}class AS{constructor(){this.ForEntityName="POLYLINE"}parseEntity(t,e){var n={type:e.value,vertices:[]};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:break;case 20:break;case 30:break;case 39:n.thickness=e.value;break;case 40:break;case 41:break;case 70:n.shape=0!==(1&e.value),n.includesCurveFitVertices=0!==(2&e.value),n.includesSplineFitVertices=0!==(4&e.value),n.is3dPolyline=0!==(8&e.value),n.is3dPolygonMesh=0!==(16&e.value),n.is3dPolygonMeshClosed=0!==(32&e.value),n.isPolyfaceMesh=0!==(64&e.value),n.hasContinuousLinetypePattern=0!==(128&e.value);break;case 71:break;case 72:break;case 73:break;case 74:break;case 75:break;case 210:n.extrusionDirection=hS(t);break;default:uS(n,e,t);break}e=t.next()}return n.vertices=ES(t,e),n}}function ES(t,e){const n=new MS,i=[];while(!t.isEOF())if(0===e.code)if("VERTEX"===e.value)i.push(n.parseEntity(t,e)),e=t.lastReadGroup;else if("SEQEND"===e.value){TS(t,e);break}return i}function TS(t,e){const n={type:e.value};e=t.next();while(!t.isEOF()){if(0==e.code)break;uS(n,e,t),e=t.next()}return n}class CS{constructor(){this.ForEntityName="SOLID"}parseEntity(t,e){const n={type:e.value,points:[]};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:n.points[0]=hS(t);break;case 11:n.points[1]=hS(t);break;case 12:n.points[2]=hS(t);break;case 13:n.points[3]=hS(t);break;case 210:n.extrusionDirection=hS(t);break;default:uS(n,e,t);break}e=t.next()}return n}}class kS{constructor(){this.ForEntityName="SPLINE"}parseEntity(t,e){const n={type:e.value};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:n.controlPoints||(n.controlPoints=[]),n.controlPoints.push(hS(t));break;case 11:n.fitPoints||(n.fitPoints=[]),n.fitPoints.push(hS(t));break;case 12:n.startTangent=hS(t);break;case 13:n.endTangent=hS(t);break;case 40:n.knotValues||(n.knotValues=[]),n.knotValues.push(e.value);break;case 70:0!=(1&e.value)&&(n.closed=!0),0!=(2&e.value)&&(n.periodic=!0),0!=(4&e.value)&&(n.rational=!0),0!=(8&e.value)&&(n.planar=!0),0!=(16&e.value)&&(n.planar=!0,n.linear=!0);break;case 71:n.degreeOfSplineCurve=e.value;break;case 72:n.numberOfKnots=e.value;break;case 73:n.numberOfControlPoints=e.value;break;case 74:n.numberOfFitPoints=e.value;break;case 210:n.normalVector=hS(t);break;default:uS(n,e,t);break}e=t.next()}return n}}class LS{constructor(){this.ForEntityName="TEXT"}parseEntity(t,e){const n={type:e.value};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:n.startPoint=hS(t);break;case 11:n.endPoint=hS(t);break;case 40:n.textHeight=e.value;break;case 41:n.xScale=e.value;break;case 50:n.rotation=e.value;break;case 1:n.text=e.value;break;case 72:n.halign=e.value;break;case 73:n.valign=e.value;break;default:uS(n,e,t);break}e=t.next()}return n}}var PS=n("5c7d"),RS=n.n(PS);function NS(t){t.registerEntityHandler(cS),t.registerEntityHandler(fS),t.registerEntityHandler(pS),t.registerEntityHandler(mS),t.registerEntityHandler(vS),t.registerEntityHandler(gS),t.registerEntityHandler(yS),t.registerEntityHandler(_S),t.registerEntityHandler(xS),t.registerEntityHandler(wS),t.registerEntityHandler(SS),t.registerEntityHandler(AS),t.registerEntityHandler(CS),t.registerEntityHandler(kS),t.registerEntityHandler(LS)}RS.a.setLevel("error");class IS{constructor(){this._entityHandlers={},NS(this)}parse(t){return"string"===typeof t?this._parse(t):(console.error("Cannot read dxf source of type `"+typeof t),null)}registerEntityHandler(t){const e=new t;this._entityHandlers[e.ForEntityName]=e}parseSync(t){return this.parse(t)}parseStream(t){let e="";const n=this;return new Promise((i,r)=>{t.on("data",t=>{e+=t}),t.on("end",()=>{try{i(n._parse(e))}catch(t){r(t)}}),t.on("error",t=>{r(t)})})}_parse(t){const e={};let n=0;const i=t.split(/\r\n|\r|\n/g),r=new rS(i);if(!r.hasNext())throw Error("Empty file");const a=this;let o;function s(){o=r.next();while(!r.isEOF())if(0===o.code&&"SECTION"===o.value){if(o=r.next(),2!==o.code){console.error("Unexpected code %s after 0:SECTION",FS(o)),o=r.next();continue}"HEADER"===o.value?(RS.a.debug("> HEADER"),e.header=l(),RS.a.debug("<")):"BLOCKS"===o.value?(RS.a.debug("> BLOCKS"),e.blocks=h(),RS.a.debug("<")):"ENTITIES"===o.value?(RS.a.debug("> ENTITIES"),e.entities=y(!1),RS.a.debug("<")):"TABLES"===o.value?(RS.a.debug("> TABLES"),e.tables=c(),RS.a.debug("<")):"EOF"===o.value?RS.a.debug("EOF"):RS.a.warn("Skipping section '%s'",o.value)}else o=r.next()}function l(){let t=null,e=null;const n={};o=r.next();while(1){if(OS(o,0,"ENDSEC")){t&&(n[t]=e);break}9===o.code?(t&&(n[t]=e),t=o.value):10===o.code?e={x:o.value}:20===o.code?e.y=o.value:30===o.code?e.z=o.value:e=o.value,o=r.next()}return o=r.next(),n}function h(){const t={};o=r.next();while("EOF"!==o.value){if(OS(o,0,"ENDSEC"))break;if(OS(o,0,"BLOCK")){RS.a.debug("block {");const e=u();RS.a.debug("}"),x(e),e.name?t[e.name]=e:RS.a.error('block with handle "'+e.handle+'" is missing a name.')}else DS(o),o=r.next()}return t}function u(){const t={};o=r.next();while("EOF"!==o.value){switch(o.code){case 1:t.xrefPath=o.value,o=r.next();break;case 2:t.name=o.value,o=r.next();break;case 3:t.name2=o.value,o=r.next();break;case 5:t.handle=o.value,o=r.next();break;case 8:t.layer=o.value,o=r.next();break;case 10:t.position=_(o),o=r.next();break;case 67:t.paperSpace=!(!o.value||1!=o.value),o=r.next();break;case 70:0!=o.value&&(t.type=o.value),o=r.next();break;case 100:o=r.next();break;case 330:t.ownerHandle=o.value,o=r.next();break;case 0:if("ENDBLK"==o.value)break;t.entities=y(!0);break;default:DS(o),o=r.next()}if(OS(o,0,"ENDBLK")){o=r.next();break}}return t}function c(){const t={};o=r.next();while("EOF"!==o.value){if(OS(o,0,"ENDSEC"))break;if(OS(o,0,"TABLE")){o=r.next();const e=g[o.value];e?(RS.a.debug(o.value+" Table {"),t[g[o.value].tableName]=f(o),RS.a.debug("}")):RS.a.debug("Unhandled Table "+o.value)}else o=r.next()}return o=r.next(),t}const d="ENDTAB";function f(t){const e=g[t.value],n={};let i=0;o=r.next();while(!OS(o,0,d))switch(o.code){case 5:n.handle=o.value,o=r.next();break;case 330:n.ownerHandle=o.value,o=r.next();break;case 100:"AcDbSymbolTable"===o.value||DS(o),o=r.next();break;case 70:i=o.value,o=r.next();break;case 0:o.value===e.dxfSymbolName?n[e.tableRecordsProperty]=e.parseTableRecords():(DS(o),o=r.next());break;default:DS(o),o=r.next()}const a=n[e.tableRecordsProperty];if(a){let t=(()=>a.constructor===Array?a.length:"object"===typeof a?Object.keys(a).length:void 0)();i!==t&&RS.a.warn("Parsed "+t+" "+e.dxfSymbolName+"'s but expected "+i)}return o=r.next(),n}function p(){const t=[];let e={};RS.a.debug("ViewPort {"),o=r.next();while(!OS(o,0,d))switch(o.code){case 2:e.name=o.value,o=r.next();break;case 10:e.lowerLeftCorner=_(o),o=r.next();break;case 11:e.upperRightCorner=_(o),o=r.next();break;case 12:e.center=_(o),o=r.next();break;case 13:e.snapBasePoint=_(o),o=r.next();break;case 14:e.snapSpacing=_(o),o=r.next();break;case 15:e.gridSpacing=_(o),o=r.next();break;case 16:e.viewDirectionFromTarget=_(o),o=r.next();break;case 17:e.viewTarget=_(o),o=r.next();break;case 42:e.lensLength=o.value,o=r.next();break;case 43:e.frontClippingPlane=o.value,o=r.next();break;case 44:e.backClippingPlane=o.value,o=r.next();break;case 45:e.viewHeight=o.value,o=r.next();break;case 50:e.snapRotationAngle=o.value,o=r.next();break;case 51:e.viewTwistAngle=o.value,o=r.next();break;case 79:e.orthographicType=o.value,o=r.next();break;case 110:e.ucsOrigin=_(o),o=r.next();break;case 111:e.ucsXAxis=_(o),o=r.next();break;case 112:e.ucsYAxis=_(o),o=r.next();break;case 110:e.ucsOrigin=_(o),o=r.next();break;case 281:e.renderMode=o.value,o=r.next();break;case 281:e.defaultLightingType=o.value,o=r.next();break;case 292:e.defaultLightingOn=o.value,o=r.next();break;case 330:e.ownerHandle=o.value,o=r.next();break;case 63:case 421:case 431:e.ambientColor=o.value,o=r.next();break;case 0:"VPORT"===o.value&&(RS.a.debug("}"),t.push(e),RS.a.debug("ViewPort {"),e={},o=r.next());break;default:DS(o),o=r.next();break}return RS.a.debug("}"),t.push(e),t}function m(){const t={};let e,n={},i=0;RS.a.debug("LType {"),o=r.next();while(!OS(o,0,"ENDTAB"))switch(o.code){case 2:n.name=o.value,e=o.value,o=r.next();break;case 3:n.description=o.value,o=r.next();break;case 73:i=o.value,i>0&&(n.pattern=[]),o=r.next();break;case 40:n.patternLength=o.value,o=r.next();break;case 49:n.pattern.push(o.value),o=r.next();break;case 0:RS.a.debug("}"),i>0&&i!==n.pattern.length&&RS.a.warn("lengths do not match on LTYPE pattern"),t[e]=n,n={},RS.a.debug("LType {"),o=r.next();break;default:o=r.next()}return RS.a.debug("}"),t[e]=n,t}function v(){const t={};let e,n={};RS.a.debug("Layer {"),o=r.next();while(!OS(o,0,"ENDTAB"))switch(o.code){case 2:n.name=o.value,e=o.value,o=r.next();break;case 62:n.visible=o.value>=0,n.colorIndex=Math.abs(o.value),n.color=US(n.colorIndex),o=r.next();break;case 70:n.frozen=0!=(1&o.value)||0!=(2&o.value),o=r.next();break;case 0:"LAYER"===o.value&&(RS.a.debug("}"),t[e]=n,RS.a.debug("Layer {"),n={},e=void 0,o=r.next());break;default:DS(o),o=r.next();break}return RS.a.debug("}"),t[e]=n,t}const g={VPORT:{tableRecordsProperty:"viewPorts",tableName:"viewPort",dxfSymbolName:"VPORT",parseTableRecords:p},LTYPE:{tableRecordsProperty:"lineTypes",tableName:"lineType",dxfSymbolName:"LTYPE",parseTableRecords:m},LAYER:{tableRecordsProperty:"layers",tableName:"layer",dxfSymbolName:"LAYER",parseTableRecords:v}};function y(t){const e=[],n=t?"ENDBLK":"ENDSEC";t||(o=r.next());while(1)if(0===o.code){if(o.value===n)break;const t=a._entityHandlers[o.value];if(null==t){RS.a.warn("Unhandled entity "+o.value),o=r.next();continue}{RS.a.debug(o.value+" {");const n=t.parseEntity(r,o);o=r.lastReadGroup,RS.a.debug("}"),x(n),e.push(n)}}else o=r.next();return"ENDSEC"==n&&(o=r.next()),e}function _(t){const e={};let n=t.code;if(e.x=t.value,n+=10,t=r.next(),t.code!=n)throw new Error("Expected code for point value to be "+n+" but got "+t.code+".");return e.y=t.value,n+=10,t=r.next(),t.code!=n?(r.rewind(),e):(e.z=t.value,e)}function x(t){if(!t)throw new TypeError("entity cannot be undefined or null");t.handle||(t.handle=n++)}return s(),e}}function OS(t,e,n){return t.code===e&&t.value===n}function DS(t){RS.a.debug("unhandled group "+FS(t))}function FS(t){return t.code+":"+t.value}function US(t){return sS[t]}var qS=IS,BS=n("8baf"),zS=(n("7037"),function(t,e){return"undefined"===typeof e||0===+e?Math.round(t):(t=+t,e=+e,isNaN(t)||"number"!==typeof e||e%1!==0?NaN:(t=t.toString().split("e"),t=Math.round(+(t[0]+"e"+(t[1]?+t[1]-e:-e))),t=t.toString().split("e"),+(t[0]+"e"+(t[1]?+t[1]+e:e))))}),HS=function(t,e,n,i,r){var a=n.length,o=n[0].length;if(t<0||t>1)throw new Error("t out of bounds [0,1]: "+t);if(e<1)throw new Error("degree must be at least 1 (linear)");if(e>a-1)throw new Error("degree must be less than or equal to point count - 1");if(!r){r=[];for(var s=0;s<a;s++)r[s]=1}if(i){if(i.length!==a+e+1)throw new Error("bad knot vector length")}else{i=[];for(var l=0;l<a+e+1;l++)i[l]=l}var h,u=[e,i.length-1-e],c=i[u[0]],d=i[u[1]];for(t=t*(d-c)+c,t=Math.max(t,c),t=Math.min(t,d),h=u[0];h<u[1];h++)if(t>=i[h]&&t<=i[h+1])break;for(var f,p=[],m=0;m<a;m++){p[m]=[];for(var v=0;v<o;v++)p[m][v]=n[m][v]*r[m];p[m][o]=r[m]}for(var g=1;g<=e+1;g++)for(var y=h;y>h-e-1+g;y--){f=(t-i[y])/(i[y+e+1-g]-i[y]);for(var _=0;_<o+1;_++)p[y][_]=(1-f)*p[y-1][_]+f*p[y][_]}for(var x=[],b=0;b<o;b++)x[b]=zS(p[h][b]/p[h][o],-9);return x};function GS(t,e,n,i,r,a,o){switch(t){case"LINE":YS(e,n,i,r,a);break;case"TEXT":KS(e,n,i,r,a);break;case"LWPOLYLINE":ZS(e,n,i,r,a);break;case"ARC":WS(e,n,i,r,a);break;case"CIRCLE":WS(e,n,i,r,a);break;case"ELLIPSE":XS(e,n,i,r,a);break;case"SPLINE":JS(e,n,i,r,a);break}}function VS(t){for(var e={},n=0;n<t.length;n++)e.hasOwnProperty(t[n].layer)||(e[t[n].layer]=[]),e[t[n].layer].push(t[n]);return e}function jS(t,e,n,i,r){for(var a=[],o=t.map((function(t){return[t.x,t.y]})),s=[n[e]],l=[n[e],n[n.length-1-e]],h=e+1;h<n.length-e;++h)s[s.length-1]!==n[h]&&s.push(n[h]);i=i||25;for(var u=1;u<s.length;++u)for(var c=s[u-1],d=s[u],f=0;f<=i;++f){var p=f/i*(d-c)+c,m=(p-l[0])/(l[1]-l[0]);m=Math.max(m,0),m=Math.min(m,1);var v=HS(m,e,o,n,r);a.push(new Xr(v[0],v[1]))}return a}function WS(t,e,n,i,r){var a,o;"CIRCLE"===e.type?(a=e.startAngle||0,o=a+2*Math.PI):(a=e.startAngle,o=e.endAngle);for(var s=new wu(e.center.x,parseFloat(e.center.y),e.radius,a,o),l=s.getPoints(32),h=[],u=0;u<l.length;u++)h.push(l[u].x),h.push(-parseFloat(l[u].y));var c=.2;n.push({type:"polyline",points:h,name:i.replace(/\s*/g,""),entityId:i,stroke:r?r.color:"#000",customColor:r?r.color:"",strokeWidth:c,visible:!r||r.visible,oldstrokeLength:c})}function XS(t,e,n,i,r){for(var a=Math.sqrt(Math.pow(parseFloat(e.majorAxisEndPoint.x),2)+Math.pow(parseFloat(e.majorAxisEndPoint.y),2)),o=a*parseFloat(e.axisRatio),s=Math.atan2(parseFloat(e.majorAxisEndPoint.y),parseFloat(e.majorAxisEndPoint.x)),l=new bu(parseFloat(e.center.x),parseFloat(e.center.y),a,o,parseFloat(e.startAngle),parseFloat(e.endAngle),!1,s),h=l.getPoints(200),u=[],c=0;c<h.length;c++)u.push(h[c].x),u.push(-parseFloat(h[c].y));var d=.2;n.push({type:"polyline",points:u,name:i.replace(/\s*/g,""),entityId:i,stroke:r?r.color:"#000",customColor:r?r.color:"",strokeWidth:d,visible:!r||r.visible,oldstrokeLength:d})}function YS(t,e,n,i,r){var a=e.vertices[0].x,o=e.vertices[0].y,s=e.vertices[1].x,l=e.vertices[1].y,h=.2;n.push({type:"line",x1:a,x2:s,y1:o,y2:l,name:i.replace(/\s*/g,""),entityId:i,isGroup:!1,stroke:r?r.color:"#000",customColor:r?r.color:"",strokeWidth:h,visible:!r||r.visible,oldstrokeLength:h})}function KS(t,e,n,i,r){var a=e.text,o=0;o=e.textHeight+.35;var s=e.startPoint,l=s.x,h=s.y,u=new Konva.Text({x:parseFloat(l),y:-parseFloat(h),text:a,fontSize:o,fill:r?r.color:"#000",customColor:r?r.color:"",name:i.replace(/\s*/g,""),entityId:i,fontFamily:"SimSun",visible:!r||r.visible,stroke:r?r.color:"#000",strokeWidth:.1});e.rotation?(90!=e.rotation&&90!=parseInt(e.rotation)&&89!=parseInt(e.rotation)&&450!=parseInt(e.rotation)||(u.attrs.x=parseFloat(l)-o),270!=e.rotation&&270!=parseInt(e.rotation)||(u.attrs.x=parseFloat(l)+o),180!=e.rotation&&180!=parseInt(e.rotation)||(u.attrs.y=-parseFloat(h)-o),360!=e.rotation&&360!=parseFloat(e.rotation)||(u.attrs.y=-parseFloat(h)-o),u.attrs.rotation=360-e.rotation):u.attrs.y=-parseFloat(h)-o,e.xScale&&(u.attrs.fontSize=(o+.35)*e.xScale),n.push({type:"text",obj:u})}function ZS(t,e,n,i,r){for(var a=e.shape,o=[],s=0;s<e.vertices.length;s++)o.push(e.vertices[s].x),o.push(-parseFloat(e.vertices[s].y));var l=.2;e.width?l+=parseFloat(e.width):l=.2,n.push({type:"polyline",points:o,closed:a,name:i.replace(/\s*/g,""),entityId:i,stroke:r?r.color:"#000",customColor:r?r.color:"",strokeWidth:l,visible:!r||r.visible,oldstrokeLength:l})}function JS(t,e,n,i,r){for(var a=jS(e.controlPoints,e.degreeOfSplineCurve,e.knotValues,100),o=[],s=0;s<a.length;s++)o.push(a[s].x),o.push(-parseFloat(a[s].y));var l=.1;n.push({type:"polyline",points:o,name:i.replace(/\s*/g,""),entityId:i,isGroup:!1,stroke:r||"#000",customColor:r?r.color:"",strokeWidth:l,visible:!r||r.visible,oldstrokeLength:l})}var QS=null,$S=null,tM={},eM={name:"Fl2dcanvas",components:{},data:function(){return{}},created:function(){var t=this;window.addEventListener("resize",(function(){if(QS){var t=document.getElementById("konva-container");QS.setWidth(t.clientWidth),QS.setHeight(t.clientHeight),QS._resizeDOM()}})),this.$nextTick((function(){console.log(document.getElementById("konva-container")),console.log(t.$refs.svgDraw),QS=new iS.a.Stage({className:"stage",container:"konva-container",width:t.$refs.svgDraw.clientWidth,height:t.$refs.svgDraw.clientHeight,draggable:!0}),$S=new iS.a.Layer({name:"konva-layer",x:0,y:0}),$S.getCanvas().setPixelRatio(2),QS.add($S),$S.draw();var e=1.5;QS.on("wheel",(function(n){console.log(n),n.evt.preventDefault();var i=QS.scaleX(),r=QS.getPointerPosition(),a={x:(r.x-QS.x())/i,y:(r.y-QS.y())/i},o=n.evt.deltaY>0?-1:1;n.evt.ctrlKey&&(o=-o);var s=o>0?i*e:i/e;if(t.scaleRatio=Math.ceil(s),!(t.scaleRatio<=1||t.scaleRatio>=100)){QS.scale({x:s,y:s});var l={x:r.x-a.x*s,y:r.y-a.y*s};QS.position(l)}}))}))},methods:{loadDxf:function(t){var e,n=new qS,i=n.parse(t),r=VS(i.entities),a=i.tables.layer.layers,o=function(){if(r[s]){for(var t=[],e=r[s].length,n=tM[s],a=n&&Object.keys(n).length>0?n:null,o=0;o<e;o++){var l=r[s][o].type;GS(l,i,r[s][o],t,s,a,$S,tM)}if(!$S)return{v:void 0};for(var h=0;h<t.length;h++){var u=t[h];"text"===u.type&&$S&&$S.add(u.obj)}var c=new iS.a.Shape({x:0,y:0,strokeWidth:.2,name:s.replace(/\s*/g,""),entityId:s,stroke:a?a.color:"#000",customColor:a?a.color:"",visible:!a||a.visible,sceneFunc:function(e,n){e.beginPath();for(var i=0;i<t.length;i++){var r=t[i];if("line"===r.type){var a=r.x1,o=r.y1,s=r.x2,l=r.y2;e.moveTo(a,-parseFloat(o)),e.lineTo(s,-parseFloat(l))}if("polyline"===r.type)for(var h=r.points,u=r.closed,c=0;c<h.length;c++){var d=c%2;if(0===d){var f=h[c],p=h[c+1];0===c?e.moveTo(f,p):e.lineTo(f,p)}u&&c===h.length-1&&e.lineTo(h[0],h[1])}}e.fillStrokeShape(n)}});$S&&$S.add(c)}};for(var s in a)if(e=o(),e)return e.v;var l=1,h=$S.getClientRect(),u=Number((this.$refs.svgDraw.clientWidth/h.width).toFixed(1));u>2&&(l=Number((h.width/h.height).toFixed(1)),l=l<2?2:l),QS.scale({x:l,y:l});var c=$S.getClientRect(),d=this.$refs.svgDraw.clientWidth/2-(Math.ceil(c.width)/2+c.x/2),f=this.$refs.svgDraw.clientHeight/2-(Math.ceil(c.height)/2+c.y);QS.setX(d),QS.setY(f)},toPdf:function(){$S.getCanvas().setPixelRatio(1);var t=QS.toDataURL({mimeType:"image/jpeg",quality:1}),e=$S.canvas.toDataURL("image/jpeg",1);console.log(e);var n=new Image;n.src=t;var i=new BS["a"]("l","px",[QS.width(),QS.height()]);i.addImage(QS.toDataURL({pixelRatio:2}),0,0,QS.width(),QS.height()),i.save("canvas.pdf")},clearCache:function(){$S&&$S.destroyChildren(),$S&&$S.destroy(),$S&&$S.clear(),QS&&QS.destroy(),QS&&QS.clearCache(),$S=null,QS=null},beforeDestroy:function(){this.clearCache()}}},nM=eM,iM=(n("d698"),Jw(nM,tS,eS,!1,null,"83d38700",null)),rM=iM.exports,aM=[$w,rM],oM=function(t){t.prototype.THREE=i,aM.forEach((function(e){t.component(e.name,e)}))};"undefined"!==typeof window&&window.Vue&&oM(window.Vue);var sM={install:oM,FlModel:$w,Fl2dcanvas:rM};e["default"]=sM},fce6:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.shapes=void 0;const i=n("d777"),r=n("9cb8"),a=n("f0b4"),o=n("4971"),s=n("4546"),l=n("d777"),h=n("7d2a"),u="hasShadow",c="shadowRGBA",d="patternImage",f="linearGradient",p="radialGradient";let m;function v(){return m||(m=r.Util.createCanvasElement().getContext("2d"),m)}function g(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()}function y(t){t.stroke()}function _(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()}function x(t){t.stroke()}function b(){this._clearCache(u)}function w(){this._clearCache(c)}function S(){this._clearCache(d)}function M(){this._clearCache(f)}function A(){this._clearCache(p)}e.shapes={};class E extends o.Node{constructor(t){let n;super(t);while(1)if(n=r.Util.getRandomColor(),n&&!(n in e.shapes))break;this.colorKey=n,e.shapes[n]=this}getContext(){return r.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return r.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this["_sceneFunc"]}getHitFunc(){return this.attrs.hitFunc||this["_hitFunc"]}hasShadow(){return this._getCache(u,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(d,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const t=v(),e=t.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new r.Transform;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(i.Konva.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const n=t.getMatrix(),a="undefined"===typeof DOMMatrix?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(a)}return e}}_getLinearGradient(){return this._getCache(f,this.__getLinearGradient)}__getLinearGradient(){const t=this.fillLinearGradientColorStops();if(t){const e=v(),n=this.fillLinearGradientStartPoint(),i=this.fillLinearGradientEndPoint(),r=e.createLinearGradient(n.x,n.y,i.x,i.y);for(let a=0;a<t.length;a+=2)r.addColorStop(t[a],t[a+1]);return r}}_getRadialGradient(){return this._getCache(p,this.__getRadialGradient)}__getRadialGradient(){const t=this.fillRadialGradientColorStops();if(t){const e=v(),n=this.fillRadialGradientStartPoint(),i=this.fillRadialGradientEndPoint(),r=e.createRadialGradient(n.x,n.y,this.fillRadialGradientStartRadius(),i.x,i.y,this.fillRadialGradientEndRadius());for(let a=0;a<t.length;a+=2)r.addColorStop(t[a],t[a+1]);return r}}getShadowRGBA(){return this._getCache(c,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const t=r.Util.colorToRGBA(this.shadowColor());return t?"rgba("+t.r+","+t.g+","+t.b+","+t.a*(this.shadowOpacity()||1)+")":void 0}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!(!this.stroke()&&!this.strokeLinearGradientColorStops()))}hasHitStroke(){const t=this.hitStrokeWidth();return"auto"===t?this.hasStroke():this.strokeEnabled()&&!!t}intersects(t){const e=this.getStage();if(!e)return!1;const n=e.bufferHitCanvas;n.getContext().clear(),this.drawHit(n,void 0,!0);const i=n.context.getImageData(Math.round(t.x),Math.round(t.y),1,1).data;return i[3]>0}destroy(){return o.Node.prototype.destroy.call(this),delete e.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(t){var e;const n=null===(e=this.attrs.perfectDrawEnabled)||void 0===e||e;if(!n)return!1;const i=t||this.hasFill(),r=this.hasStroke(),a=1!==this.getAbsoluteOpacity();if(i&&r&&a)return!0;const o=this.hasShadow(),s=this.shadowForStrokeEnabled();return!!(i&&r&&o&&s)}setStrokeHitEnabled(t){r.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),t?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){const t=this.size();return{x:this._centroid?-t.width/2:0,y:this._centroid?-t.height/2:0,width:t.width,height:t.height}}getClientRect(t={}){let e=!1,n=this.getParent();while(n){if(n.isCached()){e=!0;break}n=n.getParent()}const i=t.skipTransform,r=t.relativeTo||e&&this.getStage()||void 0,a=this.getSelfRect(),o=!t.skipStroke&&this.hasStroke(),s=o&&this.strokeWidth()||0,l=a.width+s,h=a.height+s,u=!t.skipShadow&&this.hasShadow(),c=u?this.shadowOffsetX():0,d=u?this.shadowOffsetY():0,f=l+Math.abs(c),p=h+Math.abs(d),m=u&&this.shadowBlur()||0,v=f+2*m,g=p+2*m,y={width:v,height:g,x:-(s/2+m)+Math.min(c,0)+a.x,y:-(s/2+m)+Math.min(d,0)+a.y};return i?y:this._transformedRect(y,r)}drawScene(t,e,n){const i=this.getLayer();let r,a,o=t||i.getCanvas(),s=o.getContext(),l=this._getCanvasCache(),h=this.getSceneFunc(),u=this.hasShadow();const c=o.isCache,d=e===this;if(!this.isVisible()&&!d)return this;if(l){s.save();const t=this.getAbsoluteTransform(e).getMatrix();return s.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedSceneCanvas(s),s.restore(),this}if(!h)return this;if(s.save(),this._useBufferCanvas()&&!c){r=this.getStage();const t=n||r.bufferCanvas;a=t.getContext(),a.clear(),a.save(),a._applyLineJoin(this);var f=this.getAbsoluteTransform(e).getMatrix();a.transform(f[0],f[1],f[2],f[3],f[4],f[5]),h.call(this,a,this),a.restore();const i=t.pixelRatio;u&&s._applyShadow(this),s._applyOpacity(this),s._applyGlobalCompositeOperation(this),s.drawImage(t._canvas,0,0,t.width/i,t.height/i)}else{if(s._applyLineJoin(this),!d){f=this.getAbsoluteTransform(e).getMatrix();s.transform(f[0],f[1],f[2],f[3],f[4],f[5]),s._applyOpacity(this),s._applyGlobalCompositeOperation(this)}u&&s._applyShadow(this),h.call(this,s,this)}return s.restore(),this}drawHit(t,e,n=!1){if(!this.shouldDrawHit(e,n))return this;const i=this.getLayer(),a=t||i.hitCanvas,o=a&&a.getContext(),s=this.hitFunc()||this.sceneFunc(),l=this._getCanvasCache(),h=l&&l.hit;if(this.colorKey||r.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),h){o.save();const t=this.getAbsoluteTransform(e).getMatrix();return o.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedHitCanvas(o),o.restore(),this}if(!s)return this;o.save(),o._applyLineJoin(this);const u=this===e;if(!u){const t=this.getAbsoluteTransform(e).getMatrix();o.transform(t[0],t[1],t[2],t[3],t[4],t[5])}return s.call(this,o,this),o.restore(),this}drawHitFromCache(t=0){const e=this._getCanvasCache(),n=this._getCachedSceneCanvas(),i=e.hit,a=i.getContext(),o=i.getWidth(),s=i.getHeight();a.clear(),a.drawImage(n._canvas,0,0,o,s);try{const e=a.getImageData(0,0,o,s),n=e.data,i=n.length,l=r.Util._hexToRgb(this.colorKey);for(let r=0;r<i;r+=4){const e=n[r+3];e>t?(n[r]=l.r,n[r+1]=l.g,n[r+2]=l.b,n[r+3]=255):n[r+3]=0}a.putImageData(e,0,0)}catch(l){r.Util.error("Unable to draw hit graph from cached scene canvas. "+l.message)}return this}hasPointerCapture(t){return h.hasPointerCapture(t,this)}setPointerCapture(t){h.setPointerCapture(t,this)}releaseCapture(t){h.releaseCapture(t,this)}}e.Shape=E,E.prototype._fillFunc=g,E.prototype._strokeFunc=y,E.prototype._fillFuncHit=_,E.prototype._strokeFuncHit=x,E.prototype._centroid=!1,E.prototype.nodeType="Shape",(0,l._registerNode)(E),E.prototype.eventListeners={},E.prototype.on.call(E.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",b),E.prototype.on.call(E.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",w),E.prototype.on.call(E.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",S),E.prototype.on.call(E.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",M),E.prototype.on.call(E.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",A),a.Factory.addGetterSetter(E,"stroke",void 0,(0,s.getStringOrGradientValidator)()),a.Factory.addGetterSetter(E,"strokeWidth",2,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(E,"fillAfterStrokeEnabled",!1),a.Factory.addGetterSetter(E,"hitStrokeWidth","auto",(0,s.getNumberOrAutoValidator)()),a.Factory.addGetterSetter(E,"strokeHitEnabled",!0,(0,s.getBooleanValidator)()),a.Factory.addGetterSetter(E,"perfectDrawEnabled",!0,(0,s.getBooleanValidator)()),a.Factory.addGetterSetter(E,"shadowForStrokeEnabled",!0,(0,s.getBooleanValidator)()),a.Factory.addGetterSetter(E,"lineJoin"),a.Factory.addGetterSetter(E,"lineCap"),a.Factory.addGetterSetter(E,"sceneFunc"),a.Factory.addGetterSetter(E,"hitFunc"),a.Factory.addGetterSetter(E,"dash"),a.Factory.addGetterSetter(E,"dashOffset",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(E,"shadowColor",void 0,(0,s.getStringValidator)()),a.Factory.addGetterSetter(E,"shadowBlur",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(E,"shadowOpacity",1,(0,s.getNumberValidator)()),a.Factory.addComponentsGetterSetter(E,"shadowOffset",["x","y"]),a.Factory.addGetterSetter(E,"shadowOffsetX",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(E,"shadowOffsetY",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(E,"fillPatternImage"),a.Factory.addGetterSetter(E,"fill",void 0,(0,s.getStringOrGradientValidator)()),a.Factory.addGetterSetter(E,"fillPatternX",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(E,"fillPatternY",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(E,"fillLinearGradientColorStops"),a.Factory.addGetterSetter(E,"strokeLinearGradientColorStops"),a.Factory.addGetterSetter(E,"fillRadialGradientStartRadius",0),a.Factory.addGetterSetter(E,"fillRadialGradientEndRadius",0),a.Factory.addGetterSetter(E,"fillRadialGradientColorStops"),a.Factory.addGetterSetter(E,"fillPatternRepeat","repeat"),a.Factory.addGetterSetter(E,"fillEnabled",!0),a.Factory.addGetterSetter(E,"strokeEnabled",!0),a.Factory.addGetterSetter(E,"shadowEnabled",!0),a.Factory.addGetterSetter(E,"dashEnabled",!0),a.Factory.addGetterSetter(E,"strokeScaleEnabled",!0),a.Factory.addGetterSetter(E,"fillPriority","color"),a.Factory.addComponentsGetterSetter(E,"fillPatternOffset",["x","y"]),a.Factory.addGetterSetter(E,"fillPatternOffsetX",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(E,"fillPatternOffsetY",0,(0,s.getNumberValidator)()),a.Factory.addComponentsGetterSetter(E,"fillPatternScale",["x","y"]),a.Factory.addGetterSetter(E,"fillPatternScaleX",1,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(E,"fillPatternScaleY",1,(0,s.getNumberValidator)()),a.Factory.addComponentsGetterSetter(E,"fillLinearGradientStartPoint",["x","y"]),a.Factory.addComponentsGetterSetter(E,"strokeLinearGradientStartPoint",["x","y"]),a.Factory.addGetterSetter(E,"fillLinearGradientStartPointX",0),a.Factory.addGetterSetter(E,"strokeLinearGradientStartPointX",0),a.Factory.addGetterSetter(E,"fillLinearGradientStartPointY",0),a.Factory.addGetterSetter(E,"strokeLinearGradientStartPointY",0),a.Factory.addComponentsGetterSetter(E,"fillLinearGradientEndPoint",["x","y"]),a.Factory.addComponentsGetterSetter(E,"strokeLinearGradientEndPoint",["x","y"]),a.Factory.addGetterSetter(E,"fillLinearGradientEndPointX",0),a.Factory.addGetterSetter(E,"strokeLinearGradientEndPointX",0),a.Factory.addGetterSetter(E,"fillLinearGradientEndPointY",0),a.Factory.addGetterSetter(E,"strokeLinearGradientEndPointY",0),a.Factory.addComponentsGetterSetter(E,"fillRadialGradientStartPoint",["x","y"]),a.Factory.addGetterSetter(E,"fillRadialGradientStartPointX",0),a.Factory.addGetterSetter(E,"fillRadialGradientStartPointY",0),a.Factory.addComponentsGetterSetter(E,"fillRadialGradientEndPoint",["x","y"]),a.Factory.addGetterSetter(E,"fillRadialGradientEndPointX",0),a.Factory.addGetterSetter(E,"fillRadialGradientEndPointY",0),a.Factory.addGetterSetter(E,"fillPatternRotation",0),a.Factory.addGetterSetter(E,"fillRule",void 0,(0,s.getStringValidator)()),a.Factory.backCompat(E,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})},fd15:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Konva=void 0;const i=n("36da"),r=n("8603"),a=n("1bd8"),o=n("1f21"),s=n("383f"),l=n("229a"),h=n("da04"),u=n("f709"),c=n("8c18"),d=n("5d5a"),f=n("26c8"),p=n("bf11"),m=n("a34e"),v=n("e3af"),g=n("5414"),y=n("2a01"),_=n("d488"),x=n("96ee"),b=n("bdee"),w=n("6b7e"),S=n("c742"),M=n("e4b0"),A=n("bcb1"),E=n("cf29"),T=n("926b"),C=n("461e"),k=n("89c1"),L=n("1c49"),P=n("9470"),R=n("bbce"),N=n("405a"),I=n("2013"),O=n("8e84"),D=n("b33b"),F=n("769d"),U=n("7cc1"),q=n("122f");e.Konva=i.Konva.Util._assign(i.Konva,{Arc:r.Arc,Arrow:a.Arrow,Circle:o.Circle,Ellipse:s.Ellipse,Image:l.Image,Label:h.Label,Tag:h.Tag,Line:u.Line,Path:c.Path,Rect:d.Rect,RegularPolygon:f.RegularPolygon,Ring:p.Ring,Sprite:m.Sprite,Star:v.Star,Text:g.Text,TextPath:y.TextPath,Transformer:_.Transformer,Wedge:x.Wedge,Filters:{Blur:b.Blur,Brighten:w.Brighten,Contrast:S.Contrast,Emboss:M.Emboss,Enhance:A.Enhance,Grayscale:E.Grayscale,HSL:T.HSL,HSV:C.HSV,Invert:k.Invert,Kaleidoscope:L.Kaleidoscope,Mask:P.Mask,Noise:R.Noise,Pixelate:N.Pixelate,Posterize:I.Posterize,RGB:O.RGB,RGBA:D.RGBA,Sepia:F.Sepia,Solarize:U.Solarize,Threshold:q.Threshold}})}})}));
|
|
295
|
-
//# sourceMappingURL=fl-web-component.umd.min.js.map
|
|
294
|
+
*/function gv(){var t=null,e=!1,n=null,i=null;function r(e,a){n(e,a),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function yv(t){var e=new WeakMap;function n(e,n){var i,r=e.array,a=e.usage,o=r.byteLength,s=t.createBuffer();if(t.bindBuffer(n,s),t.bufferData(n,r,a),e.onUploadCallback(),r instanceof Float32Array)i=t.FLOAT;else if(r instanceof Uint16Array)i=e.isFloat16BufferAttribute?t.HALF_FLOAT:t.UNSIGNED_SHORT;else if(r instanceof Int16Array)i=t.SHORT;else if(r instanceof Uint32Array)i=t.UNSIGNED_INT;else if(r instanceof Int32Array)i=t.INT;else if(r instanceof Int8Array)i=t.BYTE;else if(r instanceof Uint8Array)i=t.UNSIGNED_BYTE;else{if(!(r instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);i=t.UNSIGNED_BYTE}return{buffer:s,type:i,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version,size:o}}function i(e,n,i){var r=n.array,a=n.updateRanges;if(t.bindBuffer(i,e),0===a.length)t.bufferSubData(i,0,r);else{a.sort((function(t,e){return t.start-e.start}));for(var o=0,s=1;s<a.length;s++){var l=a[o],h=a[s];h.start<=l.start+l.count+1?l.count=Math.max(l.count,h.start+h.count-l.start):(++o,a[o]=h)}a.length=o+1;for(var u=0,c=a.length;u<c;u++){var d=a[u];t.bufferSubData(i,d.start*r.BYTES_PER_ELEMENT,r,d.start,d.count)}n.clearUpdateRanges()}n.onUploadCallback()}function r(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)}function a(n){n.isInterleavedBufferAttribute&&(n=n.data);var i=e.get(n);i&&(t.deleteBuffer(i.buffer),e.delete(n))}function o(t,r){if(t.isInterleavedBufferAttribute&&(t=t.data),t.isGLBufferAttribute){var a=e.get(t);(!a||a.version<t.version)&&e.set(t,{buffer:t.buffer,type:t.type,bytesPerElement:t.elementSize,version:t.version})}else{var o=e.get(t);if(void 0===o)e.set(t,n(t,r));else if(o.version<t.version){if(o.size!==t.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(o.buffer,t,r),o.version=t.version}}}return{get:r,remove:a,update:o}}var _v="#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",xv="#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",bv="#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",wv="#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",Sv="#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",Mv="#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",Av="#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",Ev="#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",Tv="#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",Cv="#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",kv="vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",Lv="vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",Pv="float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",Rv="#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",Nv="#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",Iv="#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",Ov="#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",Dv="#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",Fv="#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",Uv="#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",qv="#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",Bv="#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",zv="#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",Hv="#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",Gv="#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",Vv="vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",jv="#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",Wv="#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",Xv="#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",Yv="#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",Kv="gl_FragColor = linearToOutputTexel( gl_FragColor );",Zv="vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",Jv="#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",Qv="#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",$v="#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",tg="#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",eg="#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",ng="#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",ig="#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",rg="#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",ag="#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",og="#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",sg="#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lg="LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",hg="varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",ug="uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",cg="#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",dg="ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",fg="varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",pg="BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",mg="varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",vg="PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",gg="struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",yg="\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",_g="#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",xg="#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",bg="#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",wg="#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",Sg="#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",Mg="#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",Ag="#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",Eg="#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",Tg="#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",Cg="#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",kg="float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",Lg="#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",Pg="#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",Rg="#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",Ng="#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",Ig="#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",Og="#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",Dg="float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",Fg="#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",Ug="#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",qg="#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",Bg="#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",zg="#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",Hg="#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",Gg="#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",Vg="#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",jg="#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",Wg="#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",Xg="vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",Yg="#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",Kg="vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",Zg="#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",Jg="#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",Qg="float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",$g="#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",ty="#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",ey="#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",ny="#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",iy="float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",ry="#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",ay="#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",oy="#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",sy="#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",ly="float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",hy="#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",uy="#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",cy="#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",dy="#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",fy="#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",py="#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",my="#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",vy="#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",gy="#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",yy="varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",_y="uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",xy="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",by="#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",wy="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",Sy="uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",My="#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",Ay="#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",Ey="#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",Ty="#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",Cy="varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",ky="uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",Ly="uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",Py="uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",Ry="#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",Ny="uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Iy="#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",Oy="#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Dy="#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",Fy="#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Uy="#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",qy="#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",By="#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",zy="#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Hy="#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",Gy="#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Vy="#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",jy="#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",Wy="uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",Xy="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",Yy="#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",Ky="uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",Zy="uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",Jy="uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",Qy={alphahash_fragment:_v,alphahash_pars_fragment:xv,alphamap_fragment:bv,alphamap_pars_fragment:wv,alphatest_fragment:Sv,alphatest_pars_fragment:Mv,aomap_fragment:Av,aomap_pars_fragment:Ev,batching_pars_vertex:Tv,batching_vertex:Cv,begin_vertex:kv,beginnormal_vertex:Lv,bsdfs:Pv,iridescence_fragment:Rv,bumpmap_pars_fragment:Nv,clipping_planes_fragment:Iv,clipping_planes_pars_fragment:Ov,clipping_planes_pars_vertex:Dv,clipping_planes_vertex:Fv,color_fragment:Uv,color_pars_fragment:qv,color_pars_vertex:Bv,color_vertex:zv,common:Hv,cube_uv_reflection_fragment:Gv,defaultnormal_vertex:Vv,displacementmap_pars_vertex:jv,displacementmap_vertex:Wv,emissivemap_fragment:Xv,emissivemap_pars_fragment:Yv,colorspace_fragment:Kv,colorspace_pars_fragment:Zv,envmap_fragment:Jv,envmap_common_pars_fragment:Qv,envmap_pars_fragment:$v,envmap_pars_vertex:tg,envmap_physical_pars_fragment:cg,envmap_vertex:eg,fog_vertex:ng,fog_pars_vertex:ig,fog_fragment:rg,fog_pars_fragment:ag,gradientmap_pars_fragment:og,lightmap_pars_fragment:sg,lights_lambert_fragment:lg,lights_lambert_pars_fragment:hg,lights_pars_begin:ug,lights_toon_fragment:dg,lights_toon_pars_fragment:fg,lights_phong_fragment:pg,lights_phong_pars_fragment:mg,lights_physical_fragment:vg,lights_physical_pars_fragment:gg,lights_fragment_begin:yg,lights_fragment_maps:_g,lights_fragment_end:xg,logdepthbuf_fragment:bg,logdepthbuf_pars_fragment:wg,logdepthbuf_pars_vertex:Sg,logdepthbuf_vertex:Mg,map_fragment:Ag,map_pars_fragment:Eg,map_particle_fragment:Tg,map_particle_pars_fragment:Cg,metalnessmap_fragment:kg,metalnessmap_pars_fragment:Lg,morphinstance_vertex:Pg,morphcolor_vertex:Rg,morphnormal_vertex:Ng,morphtarget_pars_vertex:Ig,morphtarget_vertex:Og,normal_fragment_begin:Dg,normal_fragment_maps:Fg,normal_pars_fragment:Ug,normal_pars_vertex:qg,normal_vertex:Bg,normalmap_pars_fragment:zg,clearcoat_normal_fragment_begin:Hg,clearcoat_normal_fragment_maps:Gg,clearcoat_pars_fragment:Vg,iridescence_pars_fragment:jg,opaque_fragment:Wg,packing:Xg,premultiplied_alpha_fragment:Yg,project_vertex:Kg,dithering_fragment:Zg,dithering_pars_fragment:Jg,roughnessmap_fragment:Qg,roughnessmap_pars_fragment:$g,shadowmap_pars_fragment:ty,shadowmap_pars_vertex:ey,shadowmap_vertex:ny,shadowmask_pars_fragment:iy,skinbase_vertex:ry,skinning_pars_vertex:ay,skinning_vertex:oy,skinnormal_vertex:sy,specularmap_fragment:ly,specularmap_pars_fragment:hy,tonemapping_fragment:uy,tonemapping_pars_fragment:cy,transmission_fragment:dy,transmission_pars_fragment:fy,uv_pars_fragment:py,uv_pars_vertex:my,uv_vertex:vy,worldpos_vertex:gy,background_vert:yy,background_frag:_y,backgroundCube_vert:xy,backgroundCube_frag:by,cube_vert:wy,cube_frag:Sy,depth_vert:My,depth_frag:Ay,distanceRGBA_vert:Ey,distanceRGBA_frag:Ty,equirect_vert:Cy,equirect_frag:ky,linedashed_vert:Ly,linedashed_frag:Py,meshbasic_vert:Ry,meshbasic_frag:Ny,meshlambert_vert:Iy,meshlambert_frag:Oy,meshmatcap_vert:Dy,meshmatcap_frag:Fy,meshnormal_vert:Uy,meshnormal_frag:qy,meshphong_vert:By,meshphong_frag:zy,meshphysical_vert:Hy,meshphysical_frag:Gy,meshtoon_vert:Vy,meshtoon_frag:jy,points_vert:Wy,points_frag:Xy,shadow_vert:Yy,shadow_frag:Ky,sprite_vert:Zy,sprite_frag:Jy},$y={common:{diffuse:{value:new Zo(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Yr},alphaMap:{value:null},alphaMapTransform:{value:new Yr},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Yr}},envmap:{envMap:{value:null},envMapRotation:{value:new Yr},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Yr}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Yr}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Yr},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Yr},normalScale:{value:new Xr(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Yr},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Yr}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Yr}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Yr}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Zo(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Zo(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Yr},alphaTest:{value:0},uvTransform:{value:new Yr}},sprite:{diffuse:{value:new Zo(16777215)},opacity:{value:1},center:{value:new Xr(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Yr},alphaMap:{value:null},alphaMapTransform:{value:new Yr},alphaTest:{value:0}}},t_={basic:{uniforms:Gs([$y.common,$y.specularmap,$y.envmap,$y.aomap,$y.lightmap,$y.fog]),vertexShader:Qy.meshbasic_vert,fragmentShader:Qy.meshbasic_frag},lambert:{uniforms:Gs([$y.common,$y.specularmap,$y.envmap,$y.aomap,$y.lightmap,$y.emissivemap,$y.bumpmap,$y.normalmap,$y.displacementmap,$y.fog,$y.lights,{emissive:{value:new Zo(0)}}]),vertexShader:Qy.meshlambert_vert,fragmentShader:Qy.meshlambert_frag},phong:{uniforms:Gs([$y.common,$y.specularmap,$y.envmap,$y.aomap,$y.lightmap,$y.emissivemap,$y.bumpmap,$y.normalmap,$y.displacementmap,$y.fog,$y.lights,{emissive:{value:new Zo(0)},specular:{value:new Zo(1118481)},shininess:{value:30}}]),vertexShader:Qy.meshphong_vert,fragmentShader:Qy.meshphong_frag},standard:{uniforms:Gs([$y.common,$y.envmap,$y.aomap,$y.lightmap,$y.emissivemap,$y.bumpmap,$y.normalmap,$y.displacementmap,$y.roughnessmap,$y.metalnessmap,$y.fog,$y.lights,{emissive:{value:new Zo(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Qy.meshphysical_vert,fragmentShader:Qy.meshphysical_frag},toon:{uniforms:Gs([$y.common,$y.aomap,$y.lightmap,$y.emissivemap,$y.bumpmap,$y.normalmap,$y.displacementmap,$y.gradientmap,$y.fog,$y.lights,{emissive:{value:new Zo(0)}}]),vertexShader:Qy.meshtoon_vert,fragmentShader:Qy.meshtoon_frag},matcap:{uniforms:Gs([$y.common,$y.bumpmap,$y.normalmap,$y.displacementmap,$y.fog,{matcap:{value:null}}]),vertexShader:Qy.meshmatcap_vert,fragmentShader:Qy.meshmatcap_frag},points:{uniforms:Gs([$y.points,$y.fog]),vertexShader:Qy.points_vert,fragmentShader:Qy.points_frag},dashed:{uniforms:Gs([$y.common,$y.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Qy.linedashed_vert,fragmentShader:Qy.linedashed_frag},depth:{uniforms:Gs([$y.common,$y.displacementmap]),vertexShader:Qy.depth_vert,fragmentShader:Qy.depth_frag},normal:{uniforms:Gs([$y.common,$y.bumpmap,$y.normalmap,$y.displacementmap,{opacity:{value:1}}]),vertexShader:Qy.meshnormal_vert,fragmentShader:Qy.meshnormal_frag},sprite:{uniforms:Gs([$y.sprite,$y.fog]),vertexShader:Qy.sprite_vert,fragmentShader:Qy.sprite_frag},background:{uniforms:{uvTransform:{value:new Yr},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Qy.background_vert,fragmentShader:Qy.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Yr}},vertexShader:Qy.backgroundCube_vert,fragmentShader:Qy.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Qy.cube_vert,fragmentShader:Qy.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Qy.equirect_vert,fragmentShader:Qy.equirect_frag},distanceRGBA:{uniforms:Gs([$y.common,$y.displacementmap,{referencePosition:{value:new Ta},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Qy.distanceRGBA_vert,fragmentShader:Qy.distanceRGBA_frag},shadow:{uniforms:Gs([$y.lights,$y.fog,{color:{value:new Zo(0)},opacity:{value:1}}]),vertexShader:Qy.shadow_vert,fragmentShader:Qy.shadow_frag}};t_.physical={uniforms:Gs([t_.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Yr},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Yr},clearcoatNormalScale:{value:new Xr(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Yr},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Yr},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Yr},sheen:{value:0},sheenColor:{value:new Zo(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Yr},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Yr},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Yr},transmissionSamplerSize:{value:new Xr},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Yr},attenuationDistance:{value:0},attenuationColor:{value:new Zo(0)},specularColor:{value:new Zo(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Yr},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Yr},anisotropyVector:{value:new Xr},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Yr}}]),vertexShader:Qy.meshphysical_vert,fragmentShader:Qy.meshphysical_frag};var e_={r:0,b:0,g:0},n_=new po,i_=new io;function r_(t,e,n,i,r,a,o){var s,l,h=new Zo(0),u=!0===a?0:1,c=null,d=0,f=null;function p(t){var i=!0===t.isScene?t.background:null;if(i&&i.isTexture){var r=t.backgroundBlurriness>0;i=(r?n:e).get(i)}return i}function m(e){var n=!1,r=p(e);null===r?g(h,u):r&&r.isColor&&(g(r,1),n=!0);var a=t.xr.getEnvironmentBlendMode();"additive"===a?i.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===a&&i.buffers.color.setClear(0,0,0,0,o),(t.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function v(e,n){var i=p(n);i&&(i.isCubeTexture||i.mapping===We)?(void 0===l&&(l=new Us(new zs(1,1,1),new Zs({name:"BackgroundCubeMaterial",uniforms:Hs(t_.backgroundCube.uniforms),vertexShader:t_.backgroundCube.vertexShader,fragmentShader:t_.backgroundCube.fragmentShader,side:Wt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(l)),n_.copy(n.backgroundRotation),n_.x*=-1,n_.y*=-1,n_.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(n_.y*=-1,n_.z*=-1),l.material.uniforms.envMap.value=i,l.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(i_.makeRotationFromEuler(n_)),l.material.toneMapped=ua.getTransfer(i.colorSpace)!==Ri,c===i&&d===i.version&&f===t.toneMapping||(l.material.needsUpdate=!0,c=i,d=i.version,f=t.toneMapping),l.layers.enableAll(),e.unshift(l,l.geometry,l.material,0,0,null)):i&&i.isTexture&&(void 0===s&&(s=new Us(new qc(2,2),new Zs({name:"BackgroundMaterial",uniforms:Hs(t_.background.uniforms),vertexShader:t_.background.vertexShader,fragmentShader:t_.background.fragmentShader,side:jt,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),s.geometry.deleteAttribute("normal"),Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(s)),s.material.uniforms.t2D.value=i,s.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,s.material.toneMapped=ua.getTransfer(i.colorSpace)!==Ri,!0===i.matrixAutoUpdate&&i.updateMatrix(),s.material.uniforms.uvTransform.value.copy(i.matrix),c===i&&d===i.version&&f===t.toneMapping||(s.material.needsUpdate=!0,c=i,d=i.version,f=t.toneMapping),s.layers.enableAll(),e.unshift(s,s.geometry,s.material,0,0,null))}function g(e,n){e.getRGB(e_,js(t)),i.buffers.color.setClear(e_.r,e_.g,e_.b,n,o)}function y(){void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0),void 0!==s&&(s.geometry.dispose(),s.material.dispose(),s=void 0)}return{getClearColor:function(){return h},setClearColor:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;h.set(t),u=e,g(h,u)},getClearAlpha:function(){return u},setClearAlpha:function(t){u=t,g(h,u)},render:m,addToRenderList:v,dispose:y}}function a_(t,e){var n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},r=d(null),a=r,o=!1;function s(n,i,r,s,l){var u=!1,d=c(s,r,i);a!==d&&(a=d,h(a.object)),u=f(n,s,r,l),u&&p(n,s,r,l),null!==l&&e.update(l,t.ELEMENT_ARRAY_BUFFER),(u||o)&&(o=!1,x(n,i,r,s),null!==l&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(l).buffer))}function l(){return t.createVertexArray()}function h(e){return t.bindVertexArray(e)}function u(e){return t.deleteVertexArray(e)}function c(t,e,n){var r=!0===n.wireframe,a=i[t.id];void 0===a&&(a={},i[t.id]=a);var o=a[e.id];void 0===o&&(o={},a[e.id]=o);var s=o[r];return void 0===s&&(s=d(l()),o[r]=s),s}function d(t){for(var e=[],i=[],r=[],a=0;a<n;a++)e[a]=0,i[a]=0,r[a]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:r,object:t,attributes:{},index:null}}function f(t,e,n,i){var r=a.attributes,o=e.attributes,s=0,l=n.getAttributes();for(var h in l){var u=l[h];if(u.location>=0){var c=r[h],d=o[h];if(void 0===d&&("instanceMatrix"===h&&t.instanceMatrix&&(d=t.instanceMatrix),"instanceColor"===h&&t.instanceColor&&(d=t.instanceColor)),void 0===c)return!0;if(c.attribute!==d)return!0;if(d&&c.data!==d.data)return!0;s++}}return a.attributesNum!==s||a.index!==i}function p(t,e,n,i){var r={},o=e.attributes,s=0,l=n.getAttributes();for(var h in l){var u=l[h];if(u.location>=0){var c=o[h];void 0===c&&("instanceMatrix"===h&&t.instanceMatrix&&(c=t.instanceMatrix),"instanceColor"===h&&t.instanceColor&&(c=t.instanceColor));var d={};d.attribute=c,c&&c.data&&(d.data=c.data),r[h]=d,s++}}a.attributes=r,a.attributesNum=s,a.index=i}function m(){for(var t=a.newAttributes,e=0,n=t.length;e<n;e++)t[e]=0}function v(t){g(t,0)}function g(e,n){var i=a.newAttributes,r=a.enabledAttributes,o=a.attributeDivisors;i[e]=1,0===r[e]&&(t.enableVertexAttribArray(e),r[e]=1),o[e]!==n&&(t.vertexAttribDivisor(e,n),o[e]=n)}function y(){for(var e=a.newAttributes,n=a.enabledAttributes,i=0,r=n.length;i<r;i++)n[i]!==e[i]&&(t.disableVertexAttribArray(i),n[i]=0)}function _(e,n,i,r,a,o,s){!0===s?t.vertexAttribIPointer(e,n,i,a,o):t.vertexAttribPointer(e,n,i,r,a,o)}function x(n,i,r,a){m();var o=a.attributes,s=r.getAttributes(),l=i.defaultAttributeValues;for(var h in s){var u=s[h];if(u.location>=0){var c=o[h];if(void 0===c&&("instanceMatrix"===h&&n.instanceMatrix&&(c=n.instanceMatrix),"instanceColor"===h&&n.instanceColor&&(c=n.instanceColor)),void 0!==c){var d=c.normalized,f=c.itemSize,p=e.get(c);if(void 0===p)continue;var x=p.buffer,b=p.type,w=p.bytesPerElement,S=b===t.INT||b===t.UNSIGNED_INT||c.gpuType===cn;if(c.isInterleavedBufferAttribute){var M=c.data,A=M.stride,E=c.offset;if(M.isInstancedInterleavedBuffer){for(var T=0;T<u.locationSize;T++)g(u.location+T,M.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=M.meshPerAttribute*M.count)}else for(var C=0;C<u.locationSize;C++)v(u.location+C);t.bindBuffer(t.ARRAY_BUFFER,x);for(var k=0;k<u.locationSize;k++)_(u.location+k,f/u.locationSize,b,d,A*w,(E+f/u.locationSize*k)*w,S)}else{if(c.isInstancedBufferAttribute){for(var L=0;L<u.locationSize;L++)g(u.location+L,c.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=c.meshPerAttribute*c.count)}else for(var P=0;P<u.locationSize;P++)v(u.location+P);t.bindBuffer(t.ARRAY_BUFFER,x);for(var R=0;R<u.locationSize;R++)_(u.location+R,f/u.locationSize,b,d,f*w,f/u.locationSize*R*w,S)}}else if(void 0!==l){var N=l[h];if(void 0!==N)switch(N.length){case 2:t.vertexAttrib2fv(u.location,N);break;case 3:t.vertexAttrib3fv(u.location,N);break;case 4:t.vertexAttrib4fv(u.location,N);break;default:t.vertexAttrib1fv(u.location,N)}}}}y()}function b(){for(var t in M(),i){var e=i[t];for(var n in e){var r=e[n];for(var a in r)u(r[a].object),delete r[a];delete e[n]}delete i[t]}}function w(t){if(void 0!==i[t.id]){var e=i[t.id];for(var n in e){var r=e[n];for(var a in r)u(r[a].object),delete r[a];delete e[n]}delete i[t.id]}}function S(t){for(var e in i){var n=i[e];if(void 0!==n[t.id]){var r=n[t.id];for(var a in r)u(r[a].object),delete r[a];delete n[t.id]}}}function M(){A(),o=!0,a!==r&&(a=r,h(a.object))}function A(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:s,reset:M,resetDefaultState:A,dispose:b,releaseStatesOfGeometry:w,releaseStatesOfProgram:S,initAttributes:m,enableAttribute:v,disableUnusedAttributes:y}}function o_(t,e,n){var i;function r(t){i=t}function a(e,r){t.drawArrays(i,e,r),n.update(r,i,1)}function o(e,r,a){0!==a&&(t.drawArraysInstanced(i,e,r,a),n.update(r,i,a))}function s(t,r,a){if(0!==a){var o=e.get("WEBGL_multi_draw");o.multiDrawArraysWEBGL(i,t,0,r,0,a);for(var s=0,l=0;l<a;l++)s+=r[l];n.update(s,i,1)}}function l(t,r,a,s){if(0!==a){var l=e.get("WEBGL_multi_draw");if(null===l)for(var h=0;h<t.length;h++)o(t[h],r[h],s[h]);else{l.multiDrawArraysInstancedWEBGL(i,t,0,r,0,s,0,a);for(var u=0,c=0;c<a;c++)u+=r[c]*s[c];n.update(u,i,1)}}}this.setMode=r,this.render=a,this.renderInstances=o,this.renderMultiDraw=s,this.renderMultiDrawInstances=l}function s_(t,e,n,i){var r;function a(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){var n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r}function o(e){return e===bn||i.convert(e)===t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT)}function s(n){var r=n===pn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(n!==sn&&i.convert(n)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==fn&&!r)}function l(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}var h=void 0!==n.precision?n.precision:"highp",u=l(h);u!==h&&(console.warn("THREE.WebGLRenderer:",h,"not supported, using",u,"instead."),h=u);var c=!0===n.logarithmicDepthBuffer,d=!0===n.reverseDepthBuffer&&e.has("EXT_clip_control"),f=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),p=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=t.getParameter(t.MAX_TEXTURE_SIZE),v=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),g=t.getParameter(t.MAX_VERTEX_ATTRIBS),y=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),_=t.getParameter(t.MAX_VARYING_VECTORS),x=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),b=p>0,w=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:s,precision:h,logarithmicDepthBuffer:c,reverseDepthBuffer:d,maxTextures:f,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:v,maxAttributes:g,maxVertexUniforms:y,maxVaryings:_,maxFragmentUniforms:x,vertexTextures:b,maxSamples:w}}function l_(t){var e=this,n=null,i=0,r=!1,a=!1,o=new sh,s=new Yr,l={value:null,needsUpdate:!1};function h(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(t,n,i,r){var a=null!==t?t.length:0,h=null;if(0!==a){if(h=l.value,!0!==r||null===h){var u=i+4*a,c=n.matrixWorldInverse;s.getNormalMatrix(c),(null===h||h.length<u)&&(h=new Float32Array(u));for(var d=0,f=i;d!==a;++d,f+=4)o.copy(t[d]).applyMatrix4(c,s),o.normal.toArray(h,f),h[f+3]=o.constant}l.value=h,l.needsUpdate=!0}return e.numPlanes=a,e.numIntersection=0,h}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e){var n=0!==t.length||e||0!==i||r;return r=e,i=t.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(t,e){n=u(t,e,0)},this.setState=function(e,o,s){var c=e.clippingPlanes,d=e.clipIntersection,f=e.clipShadows,p=t.get(e);if(!r||null===c||0===c.length||a&&!f)a?u(null):h();else{var m=a?0:i,v=4*m,g=p.clippingState||null;l.value=g,g=u(c,o,v,s);for(var y=0;y!==v;++y)g[y]=n[y];p.clippingState=g,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=m}}}function h_(t){var e=new WeakMap;function n(t,e){return e===Ve?t.mapping=He:e===je&&(t.mapping=Ge),t}function i(i){if(i&&i.isTexture){var a=i.mapping;if(a===Ve||a===je){if(e.has(i)){var o=e.get(i).texture;return n(o,i.mapping)}var s=i.image;if(s&&s.height>0){var l=new ol(s.height);return l.fromEquirectangularTexture(t,i),e.set(i,l),i.addEventListener("dispose",r),n(l.texture,i.mapping)}return null}}return i}function r(t){var n=t.target;n.removeEventListener("dispose",r);var i=e.get(n);void 0!==i&&(e.delete(n),i.dispose())}function a(){e=new WeakMap}return{get:i,dispose:a}}var u_=4,c_=[.125,.215,.35,.446,.526,.582],d_=20,f_=new of,p_=new Zo,m_=null,v_=0,g_=0,y_=!1,__=(1+Math.sqrt(5))/2,x_=1/__,b_=[new Ta(-__,x_,0),new Ta(__,x_,0),new Ta(-x_,0,__),new Ta(x_,0,__),new Ta(0,__,-x_),new Ta(0,__,x_),new Ta(-1,1,-1),new Ta(1,1,-1),new Ta(-1,1,1),new Ta(1,1,1)],w_=new Ta,S_=function(){function t(e){st()(this,t),this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}return ht()(t,[{key:"fromScene",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=r.size,o=void 0===a?256:a,s=r.position,l=void 0===s?w_:s;m_=this._renderer.getRenderTarget(),v_=this._renderer.getActiveCubeFace(),g_=this._renderer.getActiveMipmapLevel(),y_=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(o);var h=this._allocateTargets();return h.depthBuffer=!0,this._sceneToCubeUV(t,n,i,h,l),e>0&&this._blur(h,0,0,e),this._applyPMREM(h),this._cleanup(h),h}},{key:"fromEquirectangular",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(t,e)}},{key:"fromCubemap",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(t,e)}},{key:"compileCubemapShader",value:function(){null===this._cubemapMaterial&&(this._cubemapMaterial=k_(),this._compileMaterial(this._cubemapMaterial))}},{key:"compileEquirectangularShader",value:function(){null===this._equirectMaterial&&(this._equirectMaterial=C_(),this._compileMaterial(this._equirectMaterial))}},{key:"dispose",value:function(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}},{key:"_setSize",value:function(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}},{key:"_dispose",value:function(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(var t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}},{key:"_cleanup",value:function(t){this._renderer.setRenderTarget(m_,v_,g_),this._renderer.xr.enabled=y_,t.scissorTest=!1,E_(t,0,0,t.width,t.height)}},{key:"_fromTexture",value:function(t,e){t.mapping===He||t.mapping===Ge?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),m_=this._renderer.getRenderTarget(),v_=this._renderer.getActiveCubeFace(),g_=this._renderer.getActiveMipmapLevel(),y_=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;var n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}},{key:"_allocateTargets",value:function(){var t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:en,minFilter:en,generateMipmaps:!1,type:pn,format:bn,colorSpace:Li,depthBuffer:!1},i=A_(t,e,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=A_(t,e,n);var r=this._lodMax,a=M_(r);this._sizeLods=a.sizeLods,this._lodPlanes=a.lodPlanes,this._sigmas=a.sigmas,this._blurMaterial=T_(r,t,e)}return i}},{key:"_compileMaterial",value:function(t){var e=new Us(this._lodPlanes[0],t);this._renderer.compile(e,f_)}},{key:"_sceneToCubeUV",value:function(t,e,n,i,r){var a=90,o=1,s=new el(a,o,e,n),l=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],u=this._renderer,c=u.autoClear,d=u.toneMapping;u.getClearColor(p_),u.toneMapping=Pe,u.autoClear=!1;var f=new ts({name:"PMREM.Background",side:Wt,depthWrite:!1,depthTest:!1}),p=new Us(new zs,f),m=!1,v=t.background;v?v.isColor&&(f.color.copy(v),t.background=null,m=!0):(f.color.copy(p_),m=!0);for(var g=0;g<6;g++){var y=g%3;0===y?(s.up.set(0,l[g],0),s.position.set(r.x,r.y,r.z),s.lookAt(r.x+h[g],r.y,r.z)):1===y?(s.up.set(0,0,l[g]),s.position.set(r.x,r.y,r.z),s.lookAt(r.x,r.y+h[g],r.z)):(s.up.set(0,l[g],0),s.position.set(r.x,r.y,r.z),s.lookAt(r.x,r.y,r.z+h[g]));var _=this._cubeSize;E_(i,y*_,g>2?_:0,_,_),u.setRenderTarget(i),m&&u.render(p,s),u.render(t,s)}p.geometry.dispose(),p.material.dispose(),u.toneMapping=d,u.autoClear=c,t.background=v}},{key:"_textureToCubeUV",value:function(t,e){var n=this._renderer,i=t.mapping===He||t.mapping===Ge;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=k_()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=C_());var r=i?this._cubemapMaterial:this._equirectMaterial,a=new Us(this._lodPlanes[0],r),o=r.uniforms;o["envMap"].value=t;var s=this._cubeSize;E_(e,0,0,3*s,2*s),n.setRenderTarget(e),n.render(a,f_)}},{key:"_applyPMREM",value:function(t){var e=this._renderer,n=e.autoClear;e.autoClear=!1;for(var i=this._lodPlanes.length,r=1;r<i;r++){var a=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),o=b_[(i-r-1)%b_.length];this._blur(t,r-1,r,a,o)}e.autoClear=n}},{key:"_blur",value:function(t,e,n,i,r){var a=this._pingPongRenderTarget;this._halfBlur(t,a,e,n,i,"latitudinal",r),this._halfBlur(a,t,n,n,i,"longitudinal",r)}},{key:"_halfBlur",value:function(t,e,n,i,r,a,o){var s=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");var h=3,u=new Us(this._lodPlanes[i],l),c=l.uniforms,d=this._sizeLods[n]-1,f=isFinite(r)?Math.PI/(2*d):2*Math.PI/(2*d_-1),p=r/f,m=isFinite(r)?1+Math.floor(h*p):d_;m>d_&&console.warn("sigmaRadians, ".concat(r,", is too large and will clip, as it requested ").concat(m," samples when the maximum is set to ").concat(d_));for(var v=[],g=0,y=0;y<d_;++y){var _=y/p,x=Math.exp(-_*_/2);v.push(x),0===y?g+=x:y<m&&(g+=2*x)}for(var b=0;b<v.length;b++)v[b]=v[b]/g;c["envMap"].value=t.texture,c["samples"].value=m,c["weights"].value=v,c["latitudinal"].value="latitudinal"===a,o&&(c["poleAxis"].value=o);var w=this._lodMax;c["dTheta"].value=f,c["mipInt"].value=w-n;var S=this._sizeLods[i],M=3*S*(i>w-u_?i-w+u_:0),A=4*(this._cubeSize-S);E_(e,M,A,3*S,2*S),s.setRenderTarget(e),s.render(u,f_)}}])}();function M_(t){for(var e=[],n=[],i=[],r=t,a=t-u_+1+c_.length,o=0;o<a;o++){var s=Math.pow(2,r);n.push(s);var l=1/s;o>t-u_?l=c_[o-t+u_-1]:0===o&&(l=0),i.push(l);for(var h=1/(s-2),u=-h,c=1+h,d=[u,u,c,u,c,c,u,u,c,c,u,c],f=6,p=6,m=3,v=2,g=1,y=new Float32Array(m*p*f),_=new Float32Array(v*p*f),x=new Float32Array(g*p*f),b=0;b<f;b++){var w=b%3*2/3-1,S=b>2?0:-1,M=[w,S,0,w+2/3,S,0,w+2/3,S+1,0,w,S,0,w+2/3,S+1,0,w,S+1,0];y.set(M,m*p*b),_.set(d,v*p*b);var A=[b,b,b,b,b,b];x.set(A,g*p*b)}var E=new Es;E.setAttribute("position",new hs(y,m)),E.setAttribute("uv",new hs(_,v)),E.setAttribute("faceIndex",new hs(x,g)),e.push(E),r>u_&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function A_(t,e,n){var i=new ba(t,e,n);return i.texture.mapping=We,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function E_(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function T_(t,e,n){var i=new Float32Array(d_),r=new Ta(0,1,0),a=new Zs({name:"SphericalGaussianBlur",defines:{n:d_,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:"".concat(t,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:L_(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:Yt,depthTest:!1,depthWrite:!1});return a}function C_(){return new Zs({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:L_(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:Yt,depthTest:!1,depthWrite:!1})}function k_(){return new Zs({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:L_(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:Yt,depthTest:!1,depthWrite:!1})}function L_(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function P_(t){var e=new WeakMap,n=null;function i(i){if(i&&i.isTexture){var o=i.mapping,s=o===Ve||o===je,l=o===He||o===Ge;if(s||l){var h=e.get(i),u=void 0!==h?h.texture.pmremVersion:0;if(i.isRenderTargetTexture&&i.pmremVersion!==u)return null===n&&(n=new S_(t)),h=s?n.fromEquirectangular(i,h):n.fromCubemap(i,h),h.texture.pmremVersion=i.pmremVersion,e.set(i,h),h.texture;if(void 0!==h)return h.texture;var c=i.image;return s&&c&&c.height>0||l&&c&&r(c)?(null===n&&(n=new S_(t)),h=s?n.fromEquirectangular(i):n.fromCubemap(i),h.texture.pmremVersion=i.pmremVersion,e.set(i,h),i.addEventListener("dispose",a),h.texture):null}}return i}function r(t){for(var e=0,n=6,i=0;i<n;i++)void 0!==t[i]&&e++;return e===n}function a(t){var n=t.target;n.removeEventListener("dispose",a);var i=e.get(n);void 0!==i&&(e.delete(n),i.dispose())}function o(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}return{get:i,dispose:o}}function R_(t){var e={};function n(n){if(void 0!==e[n])return e[n];var i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i}return{has:function(t){return null!==n(t)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(t){var e=n(t);return null===e&&na("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function N_(t,e,n,i){var r={},a=new WeakMap;function o(t){var s=t.target;for(var l in null!==s.index&&e.remove(s.index),s.attributes)e.remove(s.attributes[l]);s.removeEventListener("dispose",o),delete r[s.id];var h=a.get(s);h&&(e.remove(h),a.delete(s)),i.releaseStatesOfGeometry(s),!0===s.isInstancedBufferGeometry&&delete s._maxInstanceCount,n.memory.geometries--}function s(t,e){return!0===r[e.id]||(e.addEventListener("dispose",o),r[e.id]=!0,n.memory.geometries++),e}function l(n){var i=n.attributes;for(var r in i)e.update(i[r],t.ARRAY_BUFFER)}function h(t){var n=[],i=t.index,r=t.attributes.position,o=0;if(null!==i){var s=i.array;o=i.version;for(var l=0,h=s.length;l<h;l+=3){var u=s[l+0],c=s[l+1],d=s[l+2];n.push(u,c,c,d,d,u)}}else{if(void 0===r)return;var f=r.array;o=r.version;for(var p=0,m=f.length/3-1;p<m;p+=3){var v=p+0,g=p+1,y=p+2;n.push(v,g,g,y,y,v)}}var _=new(Zr(n)?vs:ps)(n,1);_.version=o;var x=a.get(t);x&&e.remove(x),a.set(t,_)}function u(t){var e=a.get(t);if(e){var n=t.index;null!==n&&e.version<n.version&&h(t)}else h(t);return a.get(t)}return{get:s,update:l,getWireframeAttribute:u}}function I_(t,e,n){var i,r,a;function o(t){i=t}function s(t){r=t.type,a=t.bytesPerElement}function l(e,o){t.drawElements(i,o,r,e*a),n.update(o,i,1)}function h(e,o,s){0!==s&&(t.drawElementsInstanced(i,o,r,e*a,s),n.update(o,i,s))}function u(t,a,o){if(0!==o){var s=e.get("WEBGL_multi_draw");s.multiDrawElementsWEBGL(i,a,0,r,t,0,o);for(var l=0,h=0;h<o;h++)l+=a[h];n.update(l,i,1)}}function c(t,o,s,l){if(0!==s){var u=e.get("WEBGL_multi_draw");if(null===u)for(var c=0;c<t.length;c++)h(t[c]/a,o[c],l[c]);else{u.multiDrawElementsInstancedWEBGL(i,o,0,r,t,0,l,0,s);for(var d=0,f=0;f<s;f++)d+=o[f]*l[f];n.update(d,i,1)}}}this.setMode=o,this.setIndex=s,this.render=l,this.renderInstances=h,this.renderMultiDraw=u,this.renderMultiDrawInstances=c}function O_(t){var e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(e,i,r){switch(n.calls++,i){case t.TRIANGLES:n.triangles+=r*(e/3);break;case t.LINES:n.lines+=r*(e/2);break;case t.LINE_STRIP:n.lines+=r*(e-1);break;case t.LINE_LOOP:n.lines+=r*e;break;case t.POINTS:n.points+=r*e;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i);break}}function r(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:r,update:i}}function D_(t,e,n){var i=new WeakMap,r=new _a;function a(a,o,s){var l=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=void 0!==h?h.length:0,c=i.get(o);if(void 0===c||c.count!==u){var d=function(){S.dispose(),i.delete(o),o.removeEventListener("dispose",d)};void 0!==c&&c.texture.dispose();var f=void 0!==o.morphAttributes.position,p=void 0!==o.morphAttributes.normal,m=void 0!==o.morphAttributes.color,v=o.morphAttributes.position||[],g=o.morphAttributes.normal||[],y=o.morphAttributes.color||[],_=0;!0===f&&(_=1),!0===p&&(_=2),!0===m&&(_=3);var x=o.attributes.position.count*_,b=1;x>e.maxTextureSize&&(b=Math.ceil(x/e.maxTextureSize),x=e.maxTextureSize);var w=new Float32Array(x*b*4*u),S=new wa(w,x,b,u);S.type=fn,S.needsUpdate=!0;for(var M=4*_,A=0;A<u;A++)for(var E=v[A],T=g[A],C=y[A],k=x*b*4*A,L=0;L<E.count;L++){var P=L*M;!0===f&&(r.fromBufferAttribute(E,L),w[k+P+0]=r.x,w[k+P+1]=r.y,w[k+P+2]=r.z,w[k+P+3]=0),!0===p&&(r.fromBufferAttribute(T,L),w[k+P+4]=r.x,w[k+P+5]=r.y,w[k+P+6]=r.z,w[k+P+7]=0),!0===m&&(r.fromBufferAttribute(C,L),w[k+P+8]=r.x,w[k+P+9]=r.y,w[k+P+10]=r.z,w[k+P+11]=4===C.itemSize?r.w:1)}c={count:u,texture:S,size:new Xr(x,b)},i.set(o,c),o.addEventListener("dispose",d)}if(!0===a.isInstancedMesh&&null!==a.morphTexture)s.getUniforms().setValue(t,"morphTexture",a.morphTexture,n);else{for(var R=0,N=0;N<l.length;N++)R+=l[N];var I=o.morphTargetsRelative?1:1-R;s.getUniforms().setValue(t,"morphTargetBaseInfluence",I),s.getUniforms().setValue(t,"morphTargetInfluences",l)}s.getUniforms().setValue(t,"morphTargetsTexture",c.texture,n),s.getUniforms().setValue(t,"morphTargetsTextureSize",c.size)}return{update:a}}function F_(t,e,n,i){var r=new WeakMap;function a(a){var o=i.render.frame,l=a.geometry,h=e.get(a,l);if(r.get(h)!==o&&(e.update(h),r.set(h,o)),a.isInstancedMesh&&(!1===a.hasEventListener("dispose",s)&&a.addEventListener("dispose",s),r.get(a)!==o&&(n.update(a.instanceMatrix,t.ARRAY_BUFFER),null!==a.instanceColor&&n.update(a.instanceColor,t.ARRAY_BUFFER),r.set(a,o))),a.isSkinnedMesh){var u=a.skeleton;r.get(u)!==o&&(u.update(),r.set(u,o))}return h}function o(){r=new WeakMap}function s(t){var e=t.target;e.removeEventListener("dispose",s),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:a,dispose:o}}var U_=new ya,q_=new su(1,1),B_=new wa,z_=new Ma,H_=new al,G_=[],V_=[],j_=new Float32Array(16),W_=new Float32Array(9),X_=new Float32Array(4);function Y_(t,e,n){var i=t[0];if(i<=0||i>0)return t;var r=e*n,a=G_[r];if(void 0===a&&(a=new Float32Array(r),G_[r]=a),0!==e){i.toArray(a,0);for(var o=1,s=0;o!==e;++o)s+=n,t[o].toArray(a,s)}return a}function K_(t,e){if(t.length!==e.length)return!1;for(var n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function Z_(t,e){for(var n=0,i=e.length;n<i;n++)t[n]=e[n]}function J_(t,e){var n=V_[e];void 0===n&&(n=new Int32Array(e),V_[e]=n);for(var i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function Q_(t,e){var n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function $_(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(K_(n,e))return;t.uniform2fv(this.addr,e),Z_(n,e)}}function tx(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(K_(n,e))return;t.uniform3fv(this.addr,e),Z_(n,e)}}function ex(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(K_(n,e))return;t.uniform4fv(this.addr,e),Z_(n,e)}}function nx(t,e){var n=this.cache,i=e.elements;if(void 0===i){if(K_(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Z_(n,e)}else{if(K_(n,i))return;X_.set(i),t.uniformMatrix2fv(this.addr,!1,X_),Z_(n,i)}}function ix(t,e){var n=this.cache,i=e.elements;if(void 0===i){if(K_(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Z_(n,e)}else{if(K_(n,i))return;W_.set(i),t.uniformMatrix3fv(this.addr,!1,W_),Z_(n,i)}}function rx(t,e){var n=this.cache,i=e.elements;if(void 0===i){if(K_(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Z_(n,e)}else{if(K_(n,i))return;j_.set(i),t.uniformMatrix4fv(this.addr,!1,j_),Z_(n,i)}}function ax(t,e){var n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function ox(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(K_(n,e))return;t.uniform2iv(this.addr,e),Z_(n,e)}}function sx(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(K_(n,e))return;t.uniform3iv(this.addr,e),Z_(n,e)}}function lx(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(K_(n,e))return;t.uniform4iv(this.addr,e),Z_(n,e)}}function hx(t,e){var n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function ux(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(K_(n,e))return;t.uniform2uiv(this.addr,e),Z_(n,e)}}function cx(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(K_(n,e))return;t.uniform3uiv(this.addr,e),Z_(n,e)}}function dx(t,e){var n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(K_(n,e))return;t.uniform4uiv(this.addr,e),Z_(n,e)}}function fx(t,e,n){var i,r=this.cache,a=n.allocateTextureUnit();r[0]!==a&&(t.uniform1i(this.addr,a),r[0]=a),this.type===t.SAMPLER_2D_SHADOW?(q_.compareFunction=Qi,i=q_):i=U_,n.setTexture2D(e||i,a)}function px(t,e,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||z_,r)}function mx(t,e,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||H_,r)}function vx(t,e,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||B_,r)}function gx(t){switch(t){case 5126:return Q_;case 35664:return $_;case 35665:return tx;case 35666:return ex;case 35674:return nx;case 35675:return ix;case 35676:return rx;case 5124:case 35670:return ax;case 35667:case 35671:return ox;case 35668:case 35672:return sx;case 35669:case 35673:return lx;case 5125:return hx;case 36294:return ux;case 36295:return cx;case 36296:return dx;case 35678:case 36198:case 36298:case 36306:case 35682:return fx;case 35679:case 36299:case 36307:return px;case 35680:case 36300:case 36308:case 36293:return mx;case 36289:case 36303:case 36311:case 36292:return vx}}function yx(t,e){t.uniform1fv(this.addr,e)}function _x(t,e){var n=Y_(e,this.size,2);t.uniform2fv(this.addr,n)}function xx(t,e){var n=Y_(e,this.size,3);t.uniform3fv(this.addr,n)}function bx(t,e){var n=Y_(e,this.size,4);t.uniform4fv(this.addr,n)}function wx(t,e){var n=Y_(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Sx(t,e){var n=Y_(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Mx(t,e){var n=Y_(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Ax(t,e){t.uniform1iv(this.addr,e)}function Ex(t,e){t.uniform2iv(this.addr,e)}function Tx(t,e){t.uniform3iv(this.addr,e)}function Cx(t,e){t.uniform4iv(this.addr,e)}function kx(t,e){t.uniform1uiv(this.addr,e)}function Lx(t,e){t.uniform2uiv(this.addr,e)}function Px(t,e){t.uniform3uiv(this.addr,e)}function Rx(t,e){t.uniform4uiv(this.addr,e)}function Nx(t,e,n){var i=this.cache,r=e.length,a=J_(n,r);K_(i,a)||(t.uniform1iv(this.addr,a),Z_(i,a));for(var o=0;o!==r;++o)n.setTexture2D(e[o]||U_,a[o])}function Ix(t,e,n){var i=this.cache,r=e.length,a=J_(n,r);K_(i,a)||(t.uniform1iv(this.addr,a),Z_(i,a));for(var o=0;o!==r;++o)n.setTexture3D(e[o]||z_,a[o])}function Ox(t,e,n){var i=this.cache,r=e.length,a=J_(n,r);K_(i,a)||(t.uniform1iv(this.addr,a),Z_(i,a));for(var o=0;o!==r;++o)n.setTextureCube(e[o]||H_,a[o])}function Dx(t,e,n){var i=this.cache,r=e.length,a=J_(n,r);K_(i,a)||(t.uniform1iv(this.addr,a),Z_(i,a));for(var o=0;o!==r;++o)n.setTexture2DArray(e[o]||B_,a[o])}function Fx(t){switch(t){case 5126:return yx;case 35664:return _x;case 35665:return xx;case 35666:return bx;case 35674:return wx;case 35675:return Sx;case 35676:return Mx;case 5124:case 35670:return Ax;case 35667:case 35671:return Ex;case 35668:case 35672:return Tx;case 35669:case 35673:return Cx;case 5125:return kx;case 36294:return Lx;case 36295:return Px;case 36296:return Rx;case 35678:case 36198:case 36298:case 36306:case 35682:return Nx;case 35679:case 36299:case 36307:return Ix;case 35680:case 36300:case 36308:case 36293:return Ox;case 36289:case 36303:case 36311:case 36292:return Dx}}var Ux=ht()((function t(e,n,i){st()(this,t),this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.setValue=gx(n.type)})),qx=ht()((function t(e,n,i){st()(this,t),this.id=e,this.addr=i,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=Fx(n.type)})),Bx=function(){function t(e){st()(this,t),this.id=e,this.seq=[],this.map={}}return ht()(t,[{key:"setValue",value:function(t,e,n){for(var i=this.seq,r=0,a=i.length;r!==a;++r){var o=i[r];o.setValue(t,e[o.id],n)}}}])}(),zx=/(\w+)(\])?(\[|\.)?/g;function Hx(t,e){t.seq.push(e),t.map[e.id]=e}function Gx(t,e,n){var i=t.name,r=i.length;zx.lastIndex=0;while(1){var a=zx.exec(i),o=zx.lastIndex,s=a[1],l="]"===a[2],h=a[3];if(l&&(s|=0),void 0===h||"["===h&&o+2===r){Hx(n,void 0===h?new Ux(s,t,e):new qx(s,t,e));break}var u=n.map,c=u[s];void 0===c&&(c=new Bx(s),Hx(n,c)),n=c}}var Vx=function(){function t(e,n){st()(this,t),this.seq=[],this.map={};for(var i=e.getProgramParameter(n,e.ACTIVE_UNIFORMS),r=0;r<i;++r){var a=e.getActiveUniform(n,r),o=e.getUniformLocation(n,a.name);Gx(a,o,this)}}return ht()(t,[{key:"setValue",value:function(t,e,n,i){var r=this.map[e];void 0!==r&&r.setValue(t,n,i)}},{key:"setOptional",value:function(t,e,n){var i=e[n];void 0!==i&&this.setValue(t,n,i)}}],[{key:"upload",value:function(t,e,n,i){for(var r=0,a=e.length;r!==a;++r){var o=e[r],s=n[o.id];!1!==s.needsUpdate&&o.setValue(t,s.value,i)}}},{key:"seqWithValue",value:function(t,e){for(var n=[],i=0,r=t.length;i!==r;++i){var a=t[i];a.id in e&&n.push(a)}return n}}])}();function jx(t,e,n){var i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}var Wx=37297,Xx=0;function Yx(t,e){for(var n=t.split("\n"),i=[],r=Math.max(e-6,0),a=Math.min(e+6,n.length),o=r;o<a;o++){var s=o+1;i.push("".concat(s===e?">":" "," ").concat(s,": ").concat(n[o]))}return i.join("\n")}var Kx=new Yr;function Zx(t){ua._getMatrix(Kx,ua.workingColorSpace,t);var e="mat3( ".concat(Kx.elements.map((function(t){return t.toFixed(4)}))," )");switch(ua.getTransfer(t)){case Pi:return[e,"LinearTransferOETF"];case Ri:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function Jx(t,e,n){var i=t.getShaderParameter(e,t.COMPILE_STATUS),r=t.getShaderInfoLog(e).trim();if(i&&""===r)return"";var a=/ERROR: 0:(\d+)/.exec(r);if(a){var o=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+Yx(t.getShaderSource(e),o)}return r}function Qx(t,e){var n=Zx(e);return["vec4 ".concat(t,"( vec4 value ) {"),"\treturn ".concat(n[1],"( vec4( value.rgb * ").concat(n[0],", value.a ) );"),"}"].join("\n")}function $x(t,e){var n;switch(e){case Re:n="Linear";break;case Ne:n="Reinhard";break;case Ie:n="Cineon";break;case Oe:n="ACESFilmic";break;case Fe:n="AgX";break;case Ue:n="Neutral";break;case De:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}var tb=new Ta;function eb(){ua.getLuminanceCoefficients(tb);var t=tb.x.toFixed(4),e=tb.y.toFixed(4),n=tb.z.toFixed(4);return["float luminance( const in vec3 rgb ) {","\tconst vec3 weights = vec3( ".concat(t,", ").concat(e,", ").concat(n," );"),"\treturn dot( weights, rgb );","}"].join("\n")}function nb(t){var e=[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""];return e.filter(ab).join("\n")}function ib(t){var e=[];for(var n in t){var i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}function rb(t,e){for(var n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),r=0;r<i;r++){var a=t.getActiveAttrib(e,r),o=a.name,s=1;a.type===t.FLOAT_MAT2&&(s=2),a.type===t.FLOAT_MAT3&&(s=3),a.type===t.FLOAT_MAT4&&(s=4),n[o]={type:a.type,location:t.getAttribLocation(e,o),locationSize:s}}return n}function ab(t){return""!==t}function ob(t,e){var n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function sb(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}var lb=/^[ \t]*#include +<([\w\d./]+)>/gm;function hb(t){return t.replace(lb,cb)}var ub=new Map;function cb(t,e){var n=Qy[e];if(void 0===n){var i=ub.get(e);if(void 0===i)throw new Error("Can not resolve #include <"+e+">");n=Qy[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i)}return hb(n)}var db=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function fb(t){return t.replace(db,pb)}function pb(t,e,n,i){for(var r="",a=parseInt(e);a<parseInt(n);a++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+a+" ]").replace(/UNROLLED_LOOP_INDEX/g,a);return r}function mb(t){var e="precision ".concat(t.precision," float;\n\tprecision ").concat(t.precision," int;\n\tprecision ").concat(t.precision," sampler2D;\n\tprecision ").concat(t.precision," samplerCube;\n\tprecision ").concat(t.precision," sampler3D;\n\tprecision ").concat(t.precision," sampler2DArray;\n\tprecision ").concat(t.precision," sampler2DShadow;\n\tprecision ").concat(t.precision," samplerCubeShadow;\n\tprecision ").concat(t.precision," sampler2DArrayShadow;\n\tprecision ").concat(t.precision," isampler2D;\n\tprecision ").concat(t.precision," isampler3D;\n\tprecision ").concat(t.precision," isamplerCube;\n\tprecision ").concat(t.precision," isampler2DArray;\n\tprecision ").concat(t.precision," usampler2D;\n\tprecision ").concat(t.precision," usampler3D;\n\tprecision ").concat(t.precision," usamplerCube;\n\tprecision ").concat(t.precision," usampler2DArray;\n\t");return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function vb(t){var e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===Ht?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===Gt?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===Vt&&(e="SHADOWMAP_TYPE_VSM"),e}function gb(t){var e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case He:case Ge:e="ENVMAP_TYPE_CUBE";break;case We:e="ENVMAP_TYPE_CUBE_UV";break}return e}function yb(t){var e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case Ge:e="ENVMAP_MODE_REFRACTION";break}return e}function _b(t){var e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case Ce:e="ENVMAP_BLENDING_MULTIPLY";break;case ke:e="ENVMAP_BLENDING_MIX";break;case Le:e="ENVMAP_BLENDING_ADD";break}return e}function xb(t){var e=t.envMapCubeUVHeight;if(null===e)return null;var n=Math.log2(e)-2,i=1/e,r=1/(3*Math.max(Math.pow(2,n),112));return{texelWidth:r,texelHeight:i,maxMip:n}}function bb(t,e,n,i){var r,a,o=t.getContext(),s=n.defines,l=n.vertexShader,h=n.fragmentShader,u=vb(n),c=gb(n),d=yb(n),f=_b(n),p=xb(n),m=nb(n),v=ib(s),g=o.createProgram(),y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(r=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v].filter(ab).join("\n"),r.length>0&&(r+="\n"),a=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v].filter(ab).join("\n"),a.length>0&&(a+="\n")):(r=[mb(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(ab).join("\n"),a=[mb(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,v,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+d:"",n.envMap?"#define "+f:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Pe?"#define TONE_MAPPING":"",n.toneMapping!==Pe?Qy["tonemapping_pars_fragment"]:"",n.toneMapping!==Pe?$x("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Qy["colorspace_pars_fragment"],Qx("linearToOutputTexel",n.outputColorSpace),eb(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(ab).join("\n")),l=hb(l),l=ob(l,n),l=sb(l,n),h=hb(h),h=ob(h,n),h=sb(h,n),l=fb(l),h=fb(h),!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",r=[m,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+r,a=["#define varying in",n.glslVersion===fr?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===fr?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+a);var _,x,b=y+r+l,w=y+a+h,S=jx(o,o.VERTEX_SHADER,b),M=jx(o,o.FRAGMENT_SHADER,w);function A(e){if(t.debug.checkShaderErrors){var n=o.getProgramInfoLog(g).trim(),i=o.getShaderInfoLog(S).trim(),s=o.getShaderInfoLog(M).trim(),l=!0,h=!0;if(!1===o.getProgramParameter(g,o.LINK_STATUS))if(l=!1,"function"===typeof t.debug.onShaderError)t.debug.onShaderError(o,g,S,M);else{var u=Jx(o,S,"vertex"),c=Jx(o,M,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(g,o.VALIDATE_STATUS)+"\n\nMaterial Name: "+e.name+"\nMaterial Type: "+e.type+"\n\nProgram Info Log: "+n+"\n"+u+"\n"+c)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==s||(h=!1);h&&(e.diagnostics={runnable:l,programLog:n,vertexShader:{log:i,prefix:r},fragmentShader:{log:s,prefix:a}})}o.deleteShader(S),o.deleteShader(M),_=new Vx(o,g),x=rb(o,g)}o.attachShader(g,S),o.attachShader(g,M),void 0!==n.index0AttributeName?o.bindAttribLocation(g,0,n.index0AttributeName):!0===n.morphTargets&&o.bindAttribLocation(g,0,"position"),o.linkProgram(g),this.getUniforms=function(){return void 0===_&&A(this),_},this.getAttributes=function(){return void 0===x&&A(this),x};var E=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===E&&(E=o.getProgramParameter(g,Wx)),E},this.destroy=function(){i.releaseStatesOfProgram(this),o.deleteProgram(g),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Xx++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=S,this.fragmentShader=M,this}var wb=0,Sb=function(){function t(){st()(this,t),this.shaderCache=new Map,this.materialCache=new Map}return ht()(t,[{key:"update",value:function(t){var e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(t);return!1===a.has(i)&&(a.add(i),i.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}},{key:"remove",value:function(t){var e,n=this.materialCache.get(t),i=pv(n);try{for(i.s();!(e=i.n()).done;){var r=e.value;r.usedTimes--,0===r.usedTimes&&this.shaderCache.delete(r.code)}}catch(a){i.e(a)}finally{i.f()}return this.materialCache.delete(t),this}},{key:"getVertexShaderID",value:function(t){return this._getShaderStage(t.vertexShader).id}},{key:"getFragmentShaderID",value:function(t){return this._getShaderStage(t.fragmentShader).id}},{key:"dispose",value:function(){this.shaderCache.clear(),this.materialCache.clear()}},{key:"_getShaderCacheForMaterial",value:function(t){var e=this.materialCache,n=e.get(t);return void 0===n&&(n=new Set,e.set(t,n)),n}},{key:"_getShaderStage",value:function(t){var e=this.shaderCache,n=e.get(t);return void 0===n&&(n=new Mb(t),e.set(t,n)),n}}])}(),Mb=ht()((function t(e){st()(this,t),this.id=wb++,this.code=e,this.usedTimes=0}));function Ab(t,e,n,i,r,a,o){var s=new mo,l=new Sb,h=new Set,u=[],c=r.logarithmicDepthBuffer,d=r.vertexTextures,f=r.precision,p={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 m(t){return h.add(t),0===t?"uv":"uv".concat(t)}function v(a,s,u,v,g){var y=v.fog,_=g.geometry,x=a.isMeshStandardMaterial?v.environment:null,b=(a.isMeshStandardMaterial?n:e).get(a.envMap||x),w=b&&b.mapping===We?b.image.height:null,S=p[a.type];null!==a.precision&&(f=r.getMaxPrecision(a.precision),f!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",f,"instead."));var M,A,E,T,C=_.morphAttributes.position||_.morphAttributes.normal||_.morphAttributes.color,k=void 0!==C?C.length:0,L=0;if(void 0!==_.morphAttributes.position&&(L=1),void 0!==_.morphAttributes.normal&&(L=2),void 0!==_.morphAttributes.color&&(L=3),S){var P=t_[S];M=P.vertexShader,A=P.fragmentShader}else M=a.vertexShader,A=a.fragmentShader,l.update(a),E=l.getVertexShaderID(a),T=l.getFragmentShaderID(a);var R=t.getRenderTarget(),N=t.state.buffers.depth.getReversed(),I=!0===g.isInstancedMesh,O=!0===g.isBatchedMesh,D=!!a.map,F=!!a.matcap,U=!!b,q=!!a.aoMap,B=!!a.lightMap,z=!!a.bumpMap,H=!!a.normalMap,G=!!a.displacementMap,V=!!a.emissiveMap,j=!!a.metalnessMap,W=!!a.roughnessMap,X=a.anisotropy>0,Y=a.clearcoat>0,K=a.dispersion>0,Z=a.iridescence>0,J=a.sheen>0,Q=a.transmission>0,$=X&&!!a.anisotropyMap,tt=Y&&!!a.clearcoatMap,et=Y&&!!a.clearcoatNormalMap,nt=Y&&!!a.clearcoatRoughnessMap,it=Z&&!!a.iridescenceMap,rt=Z&&!!a.iridescenceThicknessMap,at=J&&!!a.sheenColorMap,ot=J&&!!a.sheenRoughnessMap,st=!!a.specularMap,lt=!!a.specularColorMap,ht=!!a.specularIntensityMap,ut=Q&&!!a.transmissionMap,ct=Q&&!!a.thicknessMap,dt=!!a.gradientMap,ft=!!a.alphaMap,pt=a.alphaTest>0,mt=!!a.alphaHash,vt=!!a.extensions,gt=Pe;a.toneMapped&&(null!==R&&!0!==R.isXRRenderTarget||(gt=t.toneMapping));var yt={shaderID:S,shaderType:a.type,shaderName:a.name,vertexShader:M,fragmentShader:A,defines:a.defines,customVertexShaderID:E,customFragmentShaderID:T,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:f,batching:O,batchingColor:O&&null!==g._colorsTexture,instancing:I,instancingColor:I&&null!==g.instanceColor,instancingMorph:I&&null!==g.morphTexture,supportsVertexTextures:d,outputColorSpace:null===R?t.outputColorSpace:!0===R.isXRRenderTarget?R.texture.colorSpace:Li,alphaToCoverage:!!a.alphaToCoverage,map:D,matcap:F,envMap:U,envMapMode:U&&b.mapping,envMapCubeUVHeight:w,aoMap:q,lightMap:B,bumpMap:z,normalMap:H,displacementMap:d&&G,emissiveMap:V,normalMapObjectSpace:H&&a.normalMapType===Ti,normalMapTangentSpace:H&&a.normalMapType===Ei,metalnessMap:j,roughnessMap:W,anisotropy:X,anisotropyMap:$,clearcoat:Y,clearcoatMap:tt,clearcoatNormalMap:et,clearcoatRoughnessMap:nt,dispersion:K,iridescence:Z,iridescenceMap:it,iridescenceThicknessMap:rt,sheen:J,sheenColorMap:at,sheenRoughnessMap:ot,specularMap:st,specularColorMap:lt,specularIntensityMap:ht,transmission:Q,transmissionMap:ut,thicknessMap:ct,gradientMap:dt,opaque:!1===a.transparent&&a.blending===Kt&&!1===a.alphaToCoverage,alphaMap:ft,alphaTest:pt,alphaHash:mt,combine:a.combine,mapUv:D&&m(a.map.channel),aoMapUv:q&&m(a.aoMap.channel),lightMapUv:B&&m(a.lightMap.channel),bumpMapUv:z&&m(a.bumpMap.channel),normalMapUv:H&&m(a.normalMap.channel),displacementMapUv:G&&m(a.displacementMap.channel),emissiveMapUv:V&&m(a.emissiveMap.channel),metalnessMapUv:j&&m(a.metalnessMap.channel),roughnessMapUv:W&&m(a.roughnessMap.channel),anisotropyMapUv:$&&m(a.anisotropyMap.channel),clearcoatMapUv:tt&&m(a.clearcoatMap.channel),clearcoatNormalMapUv:et&&m(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:nt&&m(a.clearcoatRoughnessMap.channel),iridescenceMapUv:it&&m(a.iridescenceMap.channel),iridescenceThicknessMapUv:rt&&m(a.iridescenceThicknessMap.channel),sheenColorMapUv:at&&m(a.sheenColorMap.channel),sheenRoughnessMapUv:ot&&m(a.sheenRoughnessMap.channel),specularMapUv:st&&m(a.specularMap.channel),specularColorMapUv:lt&&m(a.specularColorMap.channel),specularIntensityMapUv:ht&&m(a.specularIntensityMap.channel),transmissionMapUv:ut&&m(a.transmissionMap.channel),thicknessMapUv:ct&&m(a.thicknessMap.channel),alphaMapUv:ft&&m(a.alphaMap.channel),vertexTangents:!!_.attributes.tangent&&(H||X),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!_.attributes.color&&4===_.attributes.color.itemSize,pointsUvs:!0===g.isPoints&&!!_.attributes.uv&&(D||ft),fog:!!y,useFog:!0===a.fog,fogExp2:!!y&&y.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:c,reverseDepthBuffer:N,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==_.morphAttributes.position,morphNormals:void 0!==_.morphAttributes.normal,morphColors:void 0!==_.morphAttributes.color,morphTargetsCount:k,morphTextureStride:L,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:t.shadowMap.enabled&&u.length>0,shadowMapType:t.shadowMap.type,toneMapping:gt,decodeVideoTexture:D&&!0===a.map.isVideoTexture&&ua.getTransfer(a.map.colorSpace)===Ri,decodeVideoTextureEmissive:V&&!0===a.emissiveMap.isVideoTexture&&ua.getTransfer(a.emissiveMap.colorSpace)===Ri,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===Xt,flipSided:a.side===Wt,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:vt&&!0===a.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(vt&&!0===a.extensions.multiDraw||O)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return yt.vertexUv1s=h.has(1),yt.vertexUv2s=h.has(2),yt.vertexUv3s=h.has(3),h.clear(),yt}function g(e){var n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(var i in e.defines)n.push(i),n.push(e.defines[i]);return!1===e.isRawShaderMaterial&&(y(n,e),_(n,e),n.push(t.outputColorSpace)),n.push(e.customProgramCacheKey),n.join()}function y(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.numLightProbes),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}function _(t,e){s.disableAll(),e.supportsVertexTextures&&s.enable(0),e.instancing&&s.enable(1),e.instancingColor&&s.enable(2),e.instancingMorph&&s.enable(3),e.matcap&&s.enable(4),e.envMap&&s.enable(5),e.normalMapObjectSpace&&s.enable(6),e.normalMapTangentSpace&&s.enable(7),e.clearcoat&&s.enable(8),e.iridescence&&s.enable(9),e.alphaTest&&s.enable(10),e.vertexColors&&s.enable(11),e.vertexAlphas&&s.enable(12),e.vertexUv1s&&s.enable(13),e.vertexUv2s&&s.enable(14),e.vertexUv3s&&s.enable(15),e.vertexTangents&&s.enable(16),e.anisotropy&&s.enable(17),e.alphaHash&&s.enable(18),e.batching&&s.enable(19),e.dispersion&&s.enable(20),e.batchingColor&&s.enable(21),t.push(s.mask),s.disableAll(),e.fog&&s.enable(0),e.useFog&&s.enable(1),e.flatShading&&s.enable(2),e.logarithmicDepthBuffer&&s.enable(3),e.reverseDepthBuffer&&s.enable(4),e.skinning&&s.enable(5),e.morphTargets&&s.enable(6),e.morphNormals&&s.enable(7),e.morphColors&&s.enable(8),e.premultipliedAlpha&&s.enable(9),e.shadowMapEnabled&&s.enable(10),e.doubleSided&&s.enable(11),e.flipSided&&s.enable(12),e.useDepthPacking&&s.enable(13),e.dithering&&s.enable(14),e.transmission&&s.enable(15),e.sheen&&s.enable(16),e.opaque&&s.enable(17),e.pointsUvs&&s.enable(18),e.decodeVideoTexture&&s.enable(19),e.decodeVideoTextureEmissive&&s.enable(20),e.alphaToCoverage&&s.enable(21),t.push(s.mask)}function x(t){var e,n=p[t.type];if(n){var i=t_[n];e=Xs.clone(i.uniforms)}else e=t.uniforms;return e}function b(e,n){for(var i,r=0,o=u.length;r<o;r++){var s=u[r];if(s.cacheKey===n){i=s,++i.usedTimes;break}}return void 0===i&&(i=new bb(t,n,e,a),u.push(i)),i}function w(t){if(0===--t.usedTimes){var e=u.indexOf(t);u[e]=u[u.length-1],u.pop(),t.destroy()}}function S(t){l.remove(t)}function M(){l.dispose()}return{getParameters:v,getProgramCacheKey:g,getUniforms:x,acquireProgram:b,releaseProgram:w,releaseShaderCache:S,programs:u,dispose:M}}function Eb(){var t=new WeakMap;function e(e){return t.has(e)}function n(e){var n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n}function i(e){t.delete(e)}function r(e,n,i){t.get(e)[n]=i}function a(){t=new WeakMap}return{has:e,get:n,remove:i,update:r,dispose:a}}function Tb(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Cb(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function kb(){var t=[],e=0,n=[],i=[],r=[];function a(){e=0,n.length=0,i.length=0,r.length=0}function o(n,i,r,a,o,s){var l=t[e];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:a,renderOrder:n.renderOrder,z:o,group:s},t[e]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=o,l.group=s),e++,l}function s(t,e,a,s,l,h){var u=o(t,e,a,s,l,h);a.transmission>0?i.push(u):!0===a.transparent?r.push(u):n.push(u)}function l(t,e,a,s,l,h){var u=o(t,e,a,s,l,h);a.transmission>0?i.unshift(u):!0===a.transparent?r.unshift(u):n.unshift(u)}function h(t,e){n.length>1&&n.sort(t||Tb),i.length>1&&i.sort(e||Cb),r.length>1&&r.sort(e||Cb)}function u(){for(var n=e,i=t.length;n<i;n++){var r=t[n];if(null===r.id)break;r.id=null,r.object=null,r.geometry=null,r.material=null,r.group=null}}return{opaque:n,transmissive:i,transparent:r,init:a,push:s,unshift:l,finish:u,sort:h}}function Lb(){var t=new WeakMap;function e(e,n){var i,r=t.get(e);return void 0===r?(i=new kb,t.set(e,[i])):n>=r.length?(i=new kb,r.push(i)):i=r[n],i}function n(){t=new WeakMap}return{get:e,dispose:n}}function Pb(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={direction:new Ta,color:new Zo};break;case"SpotLight":n={position:new Ta,direction:new Ta,color:new Zo,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Ta,color:new Zo,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Ta,skyColor:new Zo,groundColor:new Zo};break;case"RectAreaLight":n={color:new Zo,position:new Ta,halfWidth:new Ta,halfHeight:new Ta};break}return t[e.id]=n,n}}}function Rb(){var t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];var n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Xr};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Xr};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Xr,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}var Nb=0;function Ib(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Ob(t){for(var e=new Pb,n=Rb(),i={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},r=0;r<9;r++)i.probe.push(new Ta);var a=new Ta,o=new io,s=new io;function l(r){for(var a=0,o=0,s=0,l=0;l<9;l++)i.probe[l].set(0,0,0);var h=0,u=0,c=0,d=0,f=0,p=0,m=0,v=0,g=0,y=0,_=0;r.sort(Ib);for(var x=0,b=r.length;x<b;x++){var w=r[x],S=w.color,M=w.intensity,A=w.distance,E=w.shadow&&w.shadow.map?w.shadow.map.texture:null;if(w.isAmbientLight)a+=S.r*M,o+=S.g*M,s+=S.b*M;else if(w.isLightProbe){for(var T=0;T<9;T++)i.probe[T].addScaledVector(w.sh.coefficients[T],M);_++}else if(w.isDirectionalLight){var C=e.get(w);if(C.color.copy(w.color).multiplyScalar(w.intensity),w.castShadow){var k=w.shadow,L=n.get(w);L.shadowIntensity=k.intensity,L.shadowBias=k.bias,L.shadowNormalBias=k.normalBias,L.shadowRadius=k.radius,L.shadowMapSize=k.mapSize,i.directionalShadow[h]=L,i.directionalShadowMap[h]=E,i.directionalShadowMatrix[h]=w.shadow.matrix,p++}i.directional[h]=C,h++}else if(w.isSpotLight){var P=e.get(w);P.position.setFromMatrixPosition(w.matrixWorld),P.color.copy(S).multiplyScalar(M),P.distance=A,P.coneCos=Math.cos(w.angle),P.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),P.decay=w.decay,i.spot[c]=P;var R=w.shadow;if(w.map&&(i.spotLightMap[g]=w.map,g++,R.updateMatrices(w),w.castShadow&&y++),i.spotLightMatrix[c]=R.matrix,w.castShadow){var N=n.get(w);N.shadowIntensity=R.intensity,N.shadowBias=R.bias,N.shadowNormalBias=R.normalBias,N.shadowRadius=R.radius,N.shadowMapSize=R.mapSize,i.spotShadow[c]=N,i.spotShadowMap[c]=E,v++}c++}else if(w.isRectAreaLight){var I=e.get(w);I.color.copy(S).multiplyScalar(M),I.halfWidth.set(.5*w.width,0,0),I.halfHeight.set(0,.5*w.height,0),i.rectArea[d]=I,d++}else if(w.isPointLight){var O=e.get(w);if(O.color.copy(w.color).multiplyScalar(w.intensity),O.distance=w.distance,O.decay=w.decay,w.castShadow){var D=w.shadow,F=n.get(w);F.shadowIntensity=D.intensity,F.shadowBias=D.bias,F.shadowNormalBias=D.normalBias,F.shadowRadius=D.radius,F.shadowMapSize=D.mapSize,F.shadowCameraNear=D.camera.near,F.shadowCameraFar=D.camera.far,i.pointShadow[u]=F,i.pointShadowMap[u]=E,i.pointShadowMatrix[u]=w.shadow.matrix,m++}i.point[u]=O,u++}else if(w.isHemisphereLight){var U=e.get(w);U.skyColor.copy(w.color).multiplyScalar(M),U.groundColor.copy(w.groundColor).multiplyScalar(M),i.hemi[f]=U,f++}}d>0&&(!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=$y.LTC_FLOAT_1,i.rectAreaLTC2=$y.LTC_FLOAT_2):(i.rectAreaLTC1=$y.LTC_HALF_1,i.rectAreaLTC2=$y.LTC_HALF_2)),i.ambient[0]=a,i.ambient[1]=o,i.ambient[2]=s;var q=i.hash;q.directionalLength===h&&q.pointLength===u&&q.spotLength===c&&q.rectAreaLength===d&&q.hemiLength===f&&q.numDirectionalShadows===p&&q.numPointShadows===m&&q.numSpotShadows===v&&q.numSpotMaps===g&&q.numLightProbes===_||(i.directional.length=h,i.spot.length=c,i.rectArea.length=d,i.point.length=u,i.hemi.length=f,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=m,i.pointShadowMap.length=m,i.spotShadow.length=v,i.spotShadowMap.length=v,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=m,i.spotLightMatrix.length=v+g-y,i.spotLightMap.length=g,i.numSpotLightShadowsWithMaps=y,i.numLightProbes=_,q.directionalLength=h,q.pointLength=u,q.spotLength=c,q.rectAreaLength=d,q.hemiLength=f,q.numDirectionalShadows=p,q.numPointShadows=m,q.numSpotShadows=v,q.numSpotMaps=g,q.numLightProbes=_,i.version=Nb++)}function h(t,e){for(var n=0,r=0,l=0,h=0,u=0,c=e.matrixWorldInverse,d=0,f=t.length;d<f;d++){var p=t[d];if(p.isDirectionalLight){var m=i.directional[n];m.direction.setFromMatrixPosition(p.matrixWorld),a.setFromMatrixPosition(p.target.matrixWorld),m.direction.sub(a),m.direction.transformDirection(c),n++}else if(p.isSpotLight){var v=i.spot[l];v.position.setFromMatrixPosition(p.matrixWorld),v.position.applyMatrix4(c),v.direction.setFromMatrixPosition(p.matrixWorld),a.setFromMatrixPosition(p.target.matrixWorld),v.direction.sub(a),v.direction.transformDirection(c),l++}else if(p.isRectAreaLight){var g=i.rectArea[h];g.position.setFromMatrixPosition(p.matrixWorld),g.position.applyMatrix4(c),s.identity(),o.copy(p.matrixWorld),o.premultiply(c),s.extractRotation(o),g.halfWidth.set(.5*p.width,0,0),g.halfHeight.set(0,.5*p.height,0),g.halfWidth.applyMatrix4(s),g.halfHeight.applyMatrix4(s),h++}else if(p.isPointLight){var y=i.point[r];y.position.setFromMatrixPosition(p.matrixWorld),y.position.applyMatrix4(c),r++}else if(p.isHemisphereLight){var _=i.hemi[u];_.direction.setFromMatrixPosition(p.matrixWorld),_.direction.transformDirection(c),u++}}}return{setup:l,setupView:h,state:i}}function Db(t){var e=new Ob(t),n=[],i=[];function r(t){h.camera=t,n.length=0,i.length=0}function a(t){n.push(t)}function o(t){i.push(t)}function s(){e.setup(n)}function l(t){e.setupView(n,t)}var h={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:r,state:h,setupLights:s,setupLightsView:l,pushLight:a,pushShadow:o}}function Fb(t){var e=new WeakMap;function n(n){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=e.get(n);return void 0===a?(i=new Db(t),e.set(n,[i])):r>=a.length?(i=new Db(t),a.push(i)):i=a[r],i}function i(){e=new WeakMap}return{get:n,dispose:i}}var Ub="void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",qb="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}";function Bb(t,e,n){var i=new uh,r=new Xr,a=new Xr,o=new _a,s=new ad({depthPacking:Si}),l=new od,h={},u=n.maxTextureSize,c=At()(At()(At()({},jt,Wt),Wt,jt),Xt,Xt),d=new Zs({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Xr},radius:{value:4}},vertexShader:Ub,fragmentShader:qb}),f=d.clone();f.defines.HORIZONTAL_PASS=1;var p=new Es;p.setAttribute("position",new hs(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));var m=new Us(p,d),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ht;var g=this.type;function y(n,i){var a=e.update(m);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,f.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new ba(r.x,r.y)),d.uniforms.shadow_pass.value=n.map.texture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,a,d,m,null),f.uniforms.shadow_pass.value=n.mapPass.texture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,a,f,m,null)}function _(e,n,i,r){var a=null,o=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==o)a=o;else if(a=!0===i.isPointLight?l:s,t.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||!0===n.alphaToCoverage){var u=a.uuid,d=n.uuid,f=h[u];void 0===f&&(f={},h[u]=f);var p=f[d];void 0===p&&(p=a.clone(),f[d]=p,n.addEventListener("dispose",b)),a=p}if(a.visible=n.visible,a.wireframe=n.wireframe,a.side=r===Vt?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:c[n.side],a.alphaMap=n.alphaMap,a.alphaTest=!0===n.alphaToCoverage?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial){var m=t.properties.get(a);m.light=i}return a}function x(n,r,a,o,s){if(!1!==n.visible){var l=n.layers.test(r.layers);if(l&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===Vt)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var h=e.update(n),u=n.material;if(Array.isArray(u))for(var c=h.groups,d=0,f=c.length;d<f;d++){var p=c[d],m=u[p.materialIndex];if(m&&m.visible){var v=_(n,m,o,s);n.onBeforeShadow(t,n,r,a,h,v,p),t.renderBufferDirect(a,null,h,v,n,p),n.onAfterShadow(t,n,r,a,h,v,p)}}else if(u.visible){var g=_(n,u,o,s);n.onBeforeShadow(t,n,r,a,h,g,null),t.renderBufferDirect(a,null,h,g,n,null),n.onAfterShadow(t,n,r,a,h,g,null)}}for(var y=n.children,b=0,w=y.length;b<w;b++)x(y[b],r,a,o,s)}}function b(t){var e=t.target;for(var n in e.removeEventListener("dispose",b),h){var i=h[n],r=t.target.uuid;if(r in i){var a=i[r];a.dispose(),delete i[r]}}}this.render=function(e,n,s){if(!1!==v.enabled&&(!1!==v.autoUpdate||!1!==v.needsUpdate)&&0!==e.length){var l=t.getRenderTarget(),h=t.getActiveCubeFace(),c=t.getActiveMipmapLevel(),d=t.state;d.setBlending(Yt),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);for(var f=g!==Vt&&this.type===Vt,p=g===Vt&&this.type!==Vt,m=0,_=e.length;m<_;m++){var b=e[m],w=b.shadow;if(void 0!==w){if(!1!==w.autoUpdate||!1!==w.needsUpdate){r.copy(w.mapSize);var S=w.getFrameExtents();if(r.multiply(S),a.copy(w.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(a.x=Math.floor(u/S.x),r.x=a.x*S.x,w.mapSize.x=a.x),r.y>u&&(a.y=Math.floor(u/S.y),r.y=a.y*S.y,w.mapSize.y=a.y)),null===w.map||!0===f||!0===p){var M=this.type!==Vt?{minFilter:Ze,magFilter:Ze}:{};null!==w.map&&w.map.dispose(),w.map=new ba(r.x,r.y,M),w.map.texture.name=b.name+".shadowMap",w.camera.updateProjectionMatrix()}t.setRenderTarget(w.map),t.clear();for(var A=w.getViewportCount(),E=0;E<A;E++){var T=w.getViewport(E);o.set(a.x*T.x,a.y*T.y,a.x*T.z,a.y*T.w),d.viewport(o),w.updateMatrices(b,E),i=w.getFrustum(),x(n,s,w.camera,b,this.type)}!0!==w.isPointLightShadow&&this.type===Vt&&y(w,s),w.needsUpdate=!1}}else console.warn("THREE.WebGLShadowMap:",b,"has no shadow.")}g=this.type,v.needsUpdate=!1,t.setRenderTarget(l,h,c)}}}var zb=At()(At()(At()(At()(At()(At()(At()(At()({},xe,be),we,Ee),Me,Te),Se,Ae),be,xe),Ee,we),Te,Me),Ae,Se);function Hb(t,e){var n;function i(){var e=!1,n=new _a,i=null,r=new _a(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,a,o,s){!0===s&&(e*=o,i*=o,a*=o),n.set(e,i,a,o),!1===r.equals(n)&&(t.clearColor(e,i,a,o),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}}function r(){var n=!1,i=!1,r=null,a=null,o=null;return{setReversed:function(t){if(i!==t){var n=e.get("EXT_clip_control");t?n.clipControlEXT(n.LOWER_LEFT_EXT,n.ZERO_TO_ONE_EXT):n.clipControlEXT(n.LOWER_LEFT_EXT,n.NEGATIVE_ONE_TO_ONE_EXT),i=t;var r=o;o=null,this.setClear(r)}},getReversed:function(){return i},setTest:function(e){e?V(t.DEPTH_TEST):j(t.DEPTH_TEST)},setMask:function(e){r===e||n||(t.depthMask(e),r=e)},setFunc:function(e){if(i&&(e=zb[e]),a!==e){switch(e){case xe:t.depthFunc(t.NEVER);break;case be:t.depthFunc(t.ALWAYS);break;case we:t.depthFunc(t.LESS);break;case Se:t.depthFunc(t.LEQUAL);break;case Me:t.depthFunc(t.EQUAL);break;case Ae:t.depthFunc(t.GEQUAL);break;case Ee:t.depthFunc(t.GREATER);break;case Te:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}a=e}},setLocked:function(t){n=t},setClear:function(e){o!==e&&(i&&(e=1-e),t.clearDepth(e),o=e)},reset:function(){n=!1,r=null,a=null,o=null,i=!1}}}function a(){var e=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,h=null;return{setTest:function(n){e||(n?V(t.STENCIL_TEST):j(t.STENCIL_TEST))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,o){i===e&&r===n&&a===o||(t.stencilFunc(e,n,o),i=e,r=n,a=o)},setOp:function(e,n,i){o===e&&s===n&&l===i||(t.stencilOp(e,n,i),o=e,s=n,l=i)},setLocked:function(t){e=t},setClear:function(e){h!==e&&(t.clearStencil(e),h=e)},reset:function(){e=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,h=null}}}var o=new i,s=new r,l=new a,h=new WeakMap,u=new WeakMap,c={},d={},f=new WeakMap,p=[],m=null,v=!1,g=null,y=null,_=null,x=null,b=null,w=null,S=null,M=new Zo(0,0,0),A=0,E=!1,T=null,C=null,k=null,L=null,P=null,R=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),N=!1,I=0,O=t.getParameter(t.VERSION);-1!==O.indexOf("WebGL")?(I=parseFloat(/^WebGL (\d)/.exec(O)[1]),N=I>=1):-1!==O.indexOf("OpenGL ES")&&(I=parseFloat(/^OpenGL ES (\d)/.exec(O)[1]),N=I>=2);var D=null,F={},U=t.getParameter(t.SCISSOR_BOX),q=t.getParameter(t.VIEWPORT),B=(new _a).fromArray(U),z=(new _a).fromArray(q);function H(e,n,i,r){var a=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(var s=0;s<i;s++)e===t.TEXTURE_3D||e===t.TEXTURE_2D_ARRAY?t.texImage3D(n,0,t.RGBA,1,1,r,0,t.RGBA,t.UNSIGNED_BYTE,a):t.texImage2D(n+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,a);return o}var G={};function V(e){!0!==c[e]&&(t.enable(e),c[e]=!0)}function j(e){!1!==c[e]&&(t.disable(e),c[e]=!1)}function W(e,n){return d[e]!==n&&(t.bindFramebuffer(e,n),d[e]=n,e===t.DRAW_FRAMEBUFFER&&(d[t.FRAMEBUFFER]=n),e===t.FRAMEBUFFER&&(d[t.DRAW_FRAMEBUFFER]=n),!0)}function X(e,n){var i=p,r=!1;if(e){i=f.get(n),void 0===i&&(i=[],f.set(n,i));var a=e.textures;if(i.length!==a.length||i[0]!==t.COLOR_ATTACHMENT0){for(var o=0,s=a.length;o<s;o++)i[o]=t.COLOR_ATTACHMENT0+o;i.length=a.length,r=!0}}else i[0]!==t.BACK&&(i[0]=t.BACK,r=!0);r&&t.drawBuffers(i)}function Y(e){return m!==e&&(t.useProgram(e),m=e,!0)}G[t.TEXTURE_2D]=H(t.TEXTURE_2D,t.TEXTURE_2D,1),G[t.TEXTURE_CUBE_MAP]=H(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),G[t.TEXTURE_2D_ARRAY]=H(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),G[t.TEXTURE_3D]=H(t.TEXTURE_3D,t.TEXTURE_3D,1,1),o.setClear(0,0,0,1),s.setClear(1),l.setClear(0),V(t.DEPTH_TEST),s.setFunc(Se),$(!1),tt(Ut),V(t.CULL_FACE),J(Yt);var K=At()(At()(At()({},te,t.FUNC_ADD),ee,t.FUNC_SUBTRACT),ne,t.FUNC_REVERSE_SUBTRACT);K[ie]=t.MIN,K[re]=t.MAX;var Z=(n={},At()(At()(At()(At()(At()(At()(At()(At()(At()(At()(n,ae,t.ZERO),oe,t.ONE),se,t.SRC_COLOR),he,t.SRC_ALPHA),me,t.SRC_ALPHA_SATURATE),fe,t.DST_COLOR),ce,t.DST_ALPHA),le,t.ONE_MINUS_SRC_COLOR),ue,t.ONE_MINUS_SRC_ALPHA),pe,t.ONE_MINUS_DST_COLOR),At()(At()(At()(At()(At()(n,de,t.ONE_MINUS_DST_ALPHA),ve,t.CONSTANT_COLOR),ge,t.ONE_MINUS_CONSTANT_COLOR),ye,t.CONSTANT_ALPHA),_e,t.ONE_MINUS_CONSTANT_ALPHA));function J(e,n,i,r,a,o,s,l,h,u){if(e!==Yt){if(!1===v&&(V(t.BLEND),v=!0),e===$t)a=a||n,o=o||i,s=s||r,n===y&&a===b||(t.blendEquationSeparate(K[n],K[a]),y=n,b=a),i===_&&r===x&&o===w&&s===S||(t.blendFuncSeparate(Z[i],Z[r],Z[o],Z[s]),_=i,x=r,w=o,S=s),!1!==l.equals(M)&&h===A||(t.blendColor(l.r,l.g,l.b,h),M.copy(l),A=h),g=e,E=!1;else if(e!==g||u!==E){if(y===te&&b===te||(t.blendEquation(t.FUNC_ADD),y=te,b=te),u)switch(e){case Kt:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case Zt:t.blendFunc(t.ONE,t.ONE);break;case Jt:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case Qt:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",e);break}else switch(e){case Kt:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case Zt:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case Jt:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case Qt:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",e);break}_=null,x=null,w=null,S=null,M.set(0,0,0),A=0,g=e,E=u}}else!0===v&&(j(t.BLEND),v=!1)}function Q(e,n){e.side===Xt?j(t.CULL_FACE):V(t.CULL_FACE);var i=e.side===Wt;n&&(i=!i),$(i),e.blending===Kt&&!1===e.transparent?J(Yt):J(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.blendColor,e.blendAlpha,e.premultipliedAlpha),s.setFunc(e.depthFunc),s.setTest(e.depthTest),s.setMask(e.depthWrite),o.setMask(e.colorWrite);var r=e.stencilWrite;l.setTest(r),r&&(l.setMask(e.stencilWriteMask),l.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),l.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),nt(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?V(t.SAMPLE_ALPHA_TO_COVERAGE):j(t.SAMPLE_ALPHA_TO_COVERAGE)}function $(e){T!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),T=e)}function tt(e){e!==Ft?(V(t.CULL_FACE),e!==C&&(e===Ut?t.cullFace(t.BACK):e===qt?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):j(t.CULL_FACE),C=e}function et(e){e!==k&&(N&&t.lineWidth(e),k=e)}function nt(e,n,i){e?(V(t.POLYGON_OFFSET_FILL),L===n&&P===i||(t.polygonOffset(n,i),L=n,P=i)):j(t.POLYGON_OFFSET_FILL)}function it(e){e?V(t.SCISSOR_TEST):j(t.SCISSOR_TEST)}function rt(e){void 0===e&&(e=t.TEXTURE0+R-1),D!==e&&(t.activeTexture(e),D=e)}function at(e,n,i){void 0===i&&(i=null===D?t.TEXTURE0+R-1:D);var r=F[i];void 0===r&&(r={type:void 0,texture:void 0},F[i]=r),r.type===e&&r.texture===n||(D!==i&&(t.activeTexture(i),D=i),t.bindTexture(e,n||G[e]),r.type=e,r.texture=n)}function ot(){var e=F[D];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)}function st(){try{t.compressedTexImage2D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function lt(){try{t.compressedTexImage3D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function ht(){try{t.texSubImage2D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function ut(){try{t.texSubImage3D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function ct(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function dt(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function ft(){try{t.texStorage2D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function pt(){try{t.texStorage3D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function mt(){try{t.texImage2D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function vt(){try{t.texImage3D.apply(t,arguments)}catch(e){console.error("THREE.WebGLState:",e)}}function gt(e){!1===B.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),B.copy(e))}function yt(e){!1===z.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),z.copy(e))}function _t(e,n){var i=u.get(n);void 0===i&&(i=new WeakMap,u.set(n,i));var r=i.get(e);void 0===r&&(r=t.getUniformBlockIndex(n,e.name),i.set(e,r))}function xt(e,n){var i=u.get(n),r=i.get(e);h.get(n)!==r&&(t.uniformBlockBinding(n,r,e.__bindingPointIndex),h.set(n,r))}function bt(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),s.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),c={},D=null,F={},d={},f=new WeakMap,p=[],m=null,v=!1,g=null,y=null,_=null,x=null,b=null,w=null,S=null,M=new Zo(0,0,0),A=0,E=!1,T=null,C=null,k=null,L=null,P=null,B.set(0,0,t.canvas.width,t.canvas.height),z.set(0,0,t.canvas.width,t.canvas.height),o.reset(),s.reset(),l.reset()}return{buffers:{color:o,depth:s,stencil:l},enable:V,disable:j,bindFramebuffer:W,drawBuffers:X,useProgram:Y,setBlending:J,setMaterial:Q,setFlipSided:$,setCullFace:tt,setLineWidth:et,setPolygonOffset:nt,setScissorTest:it,activeTexture:rt,bindTexture:at,unbindTexture:ot,compressedTexImage2D:st,compressedTexImage3D:lt,texImage2D:mt,texImage3D:vt,updateUBOMapping:_t,uniformBlockBinding:xt,texStorage2D:ft,texStorage3D:pt,texSubImage2D:ht,texSubImage3D:ut,compressedTexSubImage2D:ct,compressedTexSubImage3D:dt,scissor:gt,viewport:yt,reset:bt}}function Gb(t,e,n,i,r,a,o){var s,l=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,h="undefined"!==typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),u=new Xr,c=new WeakMap,d=new WeakMap,f=!1;try{f="undefined"!==typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(it){}function p(t,e){return f?new OffscreenCanvas(t,e):$r("canvas")}function m(t,e,n){var i=1,r=nt(t);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!==typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!==typeof VideoFrame&&t instanceof VideoFrame){var a=Math.floor(i*r.width),o=Math.floor(i*r.height);void 0===s&&(s=p(a,o));var l=e?p(a,o):s;l.width=a,l.height=o;var h=l.getContext("2d");return h.drawImage(t,0,0,a,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+a+"x"+o+")."),l}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),t}return t}function v(t){return t.generateMipmaps}function g(e){t.generateMipmap(e)}function y(e){return e.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:e.isWebGL3DRenderTarget?t.TEXTURE_3D:e.isWebGLArrayRenderTarget||e.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function _(n,i,r,a){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}var s=i;if(i===t.RED&&(r===t.FLOAT&&(s=t.R32F),r===t.HALF_FLOAT&&(s=t.R16F),r===t.UNSIGNED_BYTE&&(s=t.R8)),i===t.RED_INTEGER&&(r===t.UNSIGNED_BYTE&&(s=t.R8UI),r===t.UNSIGNED_SHORT&&(s=t.R16UI),r===t.UNSIGNED_INT&&(s=t.R32UI),r===t.BYTE&&(s=t.R8I),r===t.SHORT&&(s=t.R16I),r===t.INT&&(s=t.R32I)),i===t.RG&&(r===t.FLOAT&&(s=t.RG32F),r===t.HALF_FLOAT&&(s=t.RG16F),r===t.UNSIGNED_BYTE&&(s=t.RG8)),i===t.RG_INTEGER&&(r===t.UNSIGNED_BYTE&&(s=t.RG8UI),r===t.UNSIGNED_SHORT&&(s=t.RG16UI),r===t.UNSIGNED_INT&&(s=t.RG32UI),r===t.BYTE&&(s=t.RG8I),r===t.SHORT&&(s=t.RG16I),r===t.INT&&(s=t.RG32I)),i===t.RGB_INTEGER&&(r===t.UNSIGNED_BYTE&&(s=t.RGB8UI),r===t.UNSIGNED_SHORT&&(s=t.RGB16UI),r===t.UNSIGNED_INT&&(s=t.RGB32UI),r===t.BYTE&&(s=t.RGB8I),r===t.SHORT&&(s=t.RGB16I),r===t.INT&&(s=t.RGB32I)),i===t.RGBA_INTEGER&&(r===t.UNSIGNED_BYTE&&(s=t.RGBA8UI),r===t.UNSIGNED_SHORT&&(s=t.RGBA16UI),r===t.UNSIGNED_INT&&(s=t.RGBA32UI),r===t.BYTE&&(s=t.RGBA8I),r===t.SHORT&&(s=t.RGBA16I),r===t.INT&&(s=t.RGBA32I)),i===t.RGB&&r===t.UNSIGNED_INT_5_9_9_9_REV&&(s=t.RGB9_E5),i===t.RGBA){var l=o?Pi:ua.getTransfer(a);r===t.FLOAT&&(s=t.RGBA32F),r===t.HALF_FLOAT&&(s=t.RGBA16F),r===t.UNSIGNED_BYTE&&(s=l===Ri?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(s=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(s=t.RGB5_A1)}return s!==t.R16F&&s!==t.R32F&&s!==t.RG16F&&s!==t.RG32F&&s!==t.RGBA16F&&s!==t.RGBA32F||e.get("EXT_color_buffer_float"),s}function x(e,n){var i;return e?null===n||n===dn||n===gn?i=t.DEPTH24_STENCIL8:n===fn?i=t.DEPTH32F_STENCIL8:n===un&&(i=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===dn||n===gn?i=t.DEPTH_COMPONENT24:n===fn?i=t.DEPTH_COMPONENT32F:n===un&&(i=t.DEPTH_COMPONENT16),i}function b(t,e){return!0===v(t)||t.isFramebufferTexture&&t.minFilter!==Ze&&t.minFilter!==en?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function w(t){var e=t.target;e.removeEventListener("dispose",w),M(e),e.isVideoTexture&&c.delete(e)}function S(t){var e=t.target;e.removeEventListener("dispose",S),E(e)}function M(t){var e=i.get(t);if(void 0!==e.__webglInit){var n=t.source,r=d.get(n);if(r){var a=r[e.__cacheKey];a.usedTimes--,0===a.usedTimes&&A(t),0===Object.keys(r).length&&d.delete(n)}i.remove(t)}}function A(e){var n=i.get(e);t.deleteTexture(n.__webglTexture);var r=e.source,a=d.get(r);delete a[n.__cacheKey],o.memory.textures--}function E(e){var n=i.get(e);if(e.depthTexture&&(e.depthTexture.dispose(),i.remove(e.depthTexture)),e.isWebGLCubeRenderTarget)for(var r=0;r<6;r++){if(Array.isArray(n.__webglFramebuffer[r]))for(var a=0;a<n.__webglFramebuffer[r].length;a++)t.deleteFramebuffer(n.__webglFramebuffer[r][a]);else t.deleteFramebuffer(n.__webglFramebuffer[r]);n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[r])}else{if(Array.isArray(n.__webglFramebuffer))for(var s=0;s<n.__webglFramebuffer.length;s++)t.deleteFramebuffer(n.__webglFramebuffer[s]);else t.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&t.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(var l=0;l<n.__webglColorRenderbuffer.length;l++)n.__webglColorRenderbuffer[l]&&t.deleteRenderbuffer(n.__webglColorRenderbuffer[l]);n.__webglDepthRenderbuffer&&t.deleteRenderbuffer(n.__webglDepthRenderbuffer)}for(var h=e.textures,u=0,c=h.length;u<c;u++){var d=i.get(h[u]);d.__webglTexture&&(t.deleteTexture(d.__webglTexture),o.memory.textures--),i.remove(h[u])}i.remove(e)}var T=0;function C(){T=0}function k(){var t=T;return t>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+r.maxTextures),T+=1,t}function L(t){var e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}function P(e,r){var a=i.get(e);if(e.isVideoTexture&&tt(e),!1===e.isRenderTargetTexture&&e.version>0&&a.__version!==e.version){var o=e.image;if(null===o)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==o.complete)return void B(a,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(t.TEXTURE_2D,a.__webglTexture,t.TEXTURE0+r)}function R(e,r){var a=i.get(e);e.version>0&&a.__version!==e.version?B(a,e,r):n.bindTexture(t.TEXTURE_2D_ARRAY,a.__webglTexture,t.TEXTURE0+r)}function N(e,r){var a=i.get(e);e.version>0&&a.__version!==e.version?B(a,e,r):n.bindTexture(t.TEXTURE_3D,a.__webglTexture,t.TEXTURE0+r)}function I(e,r){var a=i.get(e);e.version>0&&a.__version!==e.version?z(a,e,r):n.bindTexture(t.TEXTURE_CUBE_MAP,a.__webglTexture,t.TEXTURE0+r)}var O=At()(At()(At()({},Xe,t.REPEAT),Ye,t.CLAMP_TO_EDGE),Ke,t.MIRRORED_REPEAT),D=At()(At()(At()(At()(At()(At()({},Ze,t.NEAREST),Je,t.NEAREST_MIPMAP_NEAREST),$e,t.NEAREST_MIPMAP_LINEAR),en,t.LINEAR),nn,t.LINEAR_MIPMAP_NEAREST),an,t.LINEAR_MIPMAP_LINEAR),F=At()(At()(At()(At()(At()(At()(At()(At()({},Ki,t.NEVER),nr,t.ALWAYS),Zi,t.LESS),Qi,t.LEQUAL),Ji,t.EQUAL),er,t.GEQUAL),$i,t.GREATER),tr,t.NOTEQUAL);function U(n,a){if(a.type!==fn||!1!==e.has("OES_texture_float_linear")||a.magFilter!==en&&a.magFilter!==nn&&a.magFilter!==$e&&a.magFilter!==an&&a.minFilter!==en&&a.minFilter!==nn&&a.minFilter!==$e&&a.minFilter!==an||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(n,t.TEXTURE_WRAP_S,O[a.wrapS]),t.texParameteri(n,t.TEXTURE_WRAP_T,O[a.wrapT]),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,O[a.wrapR]),t.texParameteri(n,t.TEXTURE_MAG_FILTER,D[a.magFilter]),t.texParameteri(n,t.TEXTURE_MIN_FILTER,D[a.minFilter]),a.compareFunction&&(t.texParameteri(n,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(n,t.TEXTURE_COMPARE_FUNC,F[a.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){if(a.magFilter===Ze)return;if(a.minFilter!==$e&&a.minFilter!==an)return;if(a.type===fn&&!1===e.has("OES_texture_float_linear"))return;if(a.anisotropy>1||i.get(a).__currentAnisotropy){var o=e.get("EXT_texture_filter_anisotropic");t.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy}}}function q(e,n){var i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",w));var r=n.source,a=d.get(r);void 0===a&&(a={},d.set(r,a));var s=L(n);if(s!==e.__cacheKey){void 0===a[s]&&(a[s]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,i=!0),a[s].usedTimes++;var l=a[e.__cacheKey];void 0!==l&&(a[e.__cacheKey].usedTimes--,0===l.usedTimes&&A(n)),e.__cacheKey=s,e.__webglTexture=a[s].texture}return i}function B(e,o,s){var l=t.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(l=t.TEXTURE_2D_ARRAY),o.isData3DTexture&&(l=t.TEXTURE_3D);var h=q(e,o),u=o.source;n.bindTexture(l,e.__webglTexture,t.TEXTURE0+s);var c=i.get(u);if(u.version!==c.__version||!0===h){n.activeTexture(t.TEXTURE0+s);var d=ua.getPrimaries(ua.workingColorSpace),f=o.colorSpace===Ci?null:ua.getPrimaries(o.colorSpace),p=o.colorSpace===Ci||d===f?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,o.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,o.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);var y=m(o.image,!1,r.maxTextureSize);y=et(o,y);var w,S=a.convert(o.format,o.colorSpace),M=a.convert(o.type),A=_(o.internalFormat,S,M,o.colorSpace,o.isVideoTexture);U(l,o);var E=o.mipmaps,T=!0!==o.isVideoTexture,C=void 0===c.__version||!0===h,k=u.dataReady,L=b(o,y);if(o.isDepthTexture)A=x(o.format===Sn,o.type),C&&(T?n.texStorage2D(t.TEXTURE_2D,1,A,y.width,y.height):n.texImage2D(t.TEXTURE_2D,0,A,y.width,y.height,0,S,M,null));else if(o.isDataTexture)if(E.length>0){T&&C&&n.texStorage2D(t.TEXTURE_2D,L,A,E[0].width,E[0].height);for(var P=0,R=E.length;P<R;P++)w=E[P],T?k&&n.texSubImage2D(t.TEXTURE_2D,P,0,0,w.width,w.height,S,M,w.data):n.texImage2D(t.TEXTURE_2D,P,A,w.width,w.height,0,S,M,w.data);o.generateMipmaps=!1}else T?(C&&n.texStorage2D(t.TEXTURE_2D,L,A,y.width,y.height),k&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,y.width,y.height,S,M,y.data)):n.texImage2D(t.TEXTURE_2D,0,A,y.width,y.height,0,S,M,y.data);else if(o.isCompressedTexture)if(o.isCompressedArrayTexture){T&&C&&n.texStorage3D(t.TEXTURE_2D_ARRAY,L,A,E[0].width,E[0].height,y.depth);for(var N=0,I=E.length;N<I;N++)if(w=E[N],o.format!==bn)if(null!==S)if(T){if(k)if(o.layerUpdates.size>0){var O,D=sm(w.width,w.height,o.format,o.type),F=pv(o.layerUpdates);try{for(F.s();!(O=F.n()).done;){var B=O.value,z=w.data.subarray(B*D/w.data.BYTES_PER_ELEMENT,(B+1)*D/w.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,N,0,0,B,w.width,w.height,1,S,z)}}catch(it){F.e(it)}finally{F.f()}o.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,N,0,0,0,w.width,w.height,y.depth,S,w.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,N,A,w.width,w.height,y.depth,0,w.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else T?k&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,N,0,0,0,w.width,w.height,y.depth,S,M,w.data):n.texImage3D(t.TEXTURE_2D_ARRAY,N,A,w.width,w.height,y.depth,0,S,M,w.data)}else{T&&C&&n.texStorage2D(t.TEXTURE_2D,L,A,E[0].width,E[0].height);for(var H=0,G=E.length;H<G;H++)w=E[H],o.format!==bn?null!==S?T?k&&n.compressedTexSubImage2D(t.TEXTURE_2D,H,0,0,w.width,w.height,S,w.data):n.compressedTexImage2D(t.TEXTURE_2D,H,A,w.width,w.height,0,w.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):T?k&&n.texSubImage2D(t.TEXTURE_2D,H,0,0,w.width,w.height,S,M,w.data):n.texImage2D(t.TEXTURE_2D,H,A,w.width,w.height,0,S,M,w.data)}else if(o.isDataArrayTexture)if(T){if(C&&n.texStorage3D(t.TEXTURE_2D_ARRAY,L,A,y.width,y.height,y.depth),k)if(o.layerUpdates.size>0){var V,j=sm(y.width,y.height,o.format,o.type),W=pv(o.layerUpdates);try{for(W.s();!(V=W.n()).done;){var X=V.value,Y=y.data.subarray(X*j/y.data.BYTES_PER_ELEMENT,(X+1)*j/y.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,X,y.width,y.height,1,S,M,Y)}}catch(it){W.e(it)}finally{W.f()}o.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,y.width,y.height,y.depth,S,M,y.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,A,y.width,y.height,y.depth,0,S,M,y.data);else if(o.isData3DTexture)T?(C&&n.texStorage3D(t.TEXTURE_3D,L,A,y.width,y.height,y.depth),k&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,y.width,y.height,y.depth,S,M,y.data)):n.texImage3D(t.TEXTURE_3D,0,A,y.width,y.height,y.depth,0,S,M,y.data);else if(o.isFramebufferTexture){if(C)if(T)n.texStorage2D(t.TEXTURE_2D,L,A,y.width,y.height);else for(var K=y.width,Z=y.height,J=0;J<L;J++)n.texImage2D(t.TEXTURE_2D,J,A,K,Z,0,S,M,null),K>>=1,Z>>=1}else if(E.length>0){if(T&&C){var Q=nt(E[0]);n.texStorage2D(t.TEXTURE_2D,L,A,Q.width,Q.height)}for(var $=0,tt=E.length;$<tt;$++)w=E[$],T?k&&n.texSubImage2D(t.TEXTURE_2D,$,0,0,S,M,w):n.texImage2D(t.TEXTURE_2D,$,A,S,M,w);o.generateMipmaps=!1}else if(T){if(C){var rt=nt(y);n.texStorage2D(t.TEXTURE_2D,L,A,rt.width,rt.height)}k&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,S,M,y)}else n.texImage2D(t.TEXTURE_2D,0,A,S,M,y);v(o)&&g(l),c.__version=u.version,o.onUpdate&&o.onUpdate(o)}e.__version=o.version}function z(e,o,s){if(6===o.image.length){var l=q(e,o),h=o.source;n.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+s);var u=i.get(h);if(h.version!==u.__version||!0===l){n.activeTexture(t.TEXTURE0+s);var c=ua.getPrimaries(ua.workingColorSpace),d=o.colorSpace===Ci?null:ua.getPrimaries(o.colorSpace),f=o.colorSpace===Ci||c===d?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,o.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,o.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,f);for(var p=o.isCompressedTexture||o.image[0].isCompressedTexture,y=o.image[0]&&o.image[0].isDataTexture,x=[],w=0;w<6;w++)x[w]=p||y?y?o.image[w].image:o.image[w]:m(o.image[w],!0,r.maxCubemapSize),x[w]=et(o,x[w]);var S,M=x[0],A=a.convert(o.format,o.colorSpace),E=a.convert(o.type),T=_(o.internalFormat,A,E,o.colorSpace),C=!0!==o.isVideoTexture,k=void 0===u.__version||!0===l,L=h.dataReady,P=b(o,M);if(U(t.TEXTURE_CUBE_MAP,o),p){C&&k&&n.texStorage2D(t.TEXTURE_CUBE_MAP,P,T,M.width,M.height);for(var R=0;R<6;R++){S=x[R].mipmaps;for(var N=0;N<S.length;N++){var I=S[N];o.format!==bn?null!==A?C?L&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+R,N,0,0,I.width,I.height,A,I.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+R,N,T,I.width,I.height,0,I.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):C?L&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+R,N,0,0,I.width,I.height,A,E,I.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+R,N,T,I.width,I.height,0,A,E,I.data)}}}else{if(S=o.mipmaps,C&&k){S.length>0&&P++;var O=nt(x[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,P,T,O.width,O.height)}for(var D=0;D<6;D++)if(y){C?L&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,0,0,x[D].width,x[D].height,A,E,x[D].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,T,x[D].width,x[D].height,0,A,E,x[D].data);for(var F=0;F<S.length;F++){var B=S[F],z=B.image[D].image;C?L&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+D,F+1,0,0,z.width,z.height,A,E,z.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+D,F+1,T,z.width,z.height,0,A,E,z.data)}}else{C?L&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,0,0,A,E,x[D]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,T,A,E,x[D]);for(var H=0;H<S.length;H++){var G=S[H];C?L&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+D,H+1,0,0,A,E,G.image[D]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+D,H+1,T,A,E,G.image[D])}}}v(o)&&g(t.TEXTURE_CUBE_MAP),u.__version=h.version,o.onUpdate&&o.onUpdate(o)}e.__version=o.version}}function H(e,r,o,s,h,u){var c=a.convert(o.format,o.colorSpace),d=a.convert(o.type),f=_(o.internalFormat,c,d,o.colorSpace),p=i.get(r),m=i.get(o);if(m.__renderTarget=r,!p.__hasExternalTextures){var v=Math.max(1,r.width>>u),g=Math.max(1,r.height>>u);h===t.TEXTURE_3D||h===t.TEXTURE_2D_ARRAY?n.texImage3D(h,u,f,v,g,r.depth,0,c,d,null):n.texImage2D(h,u,f,v,g,0,c,d,null)}n.bindFramebuffer(t.FRAMEBUFFER,e),$(r)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,s,h,m.__webglTexture,0,Q(r)):(h===t.TEXTURE_2D||h>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&h<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,s,h,m.__webglTexture,u),n.bindFramebuffer(t.FRAMEBUFFER,null)}function G(e,n,i){if(t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer){var r=n.depthTexture,o=r&&r.isDepthTexture?r.type:null,s=x(n.stencilBuffer,o),h=n.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,u=Q(n),c=$(n);c?l.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,u,s,n.width,n.height):i?t.renderbufferStorageMultisample(t.RENDERBUFFER,u,s,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,s,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,h,t.RENDERBUFFER,e)}else for(var d=n.textures,f=0;f<d.length;f++){var p=d[f],m=a.convert(p.format,p.colorSpace),v=a.convert(p.type),g=_(p.internalFormat,m,v,p.colorSpace),y=Q(n);i&&!1===$(n)?t.renderbufferStorageMultisample(t.RENDERBUFFER,y,g,n.width,n.height):$(n)?l.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,y,g,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,g,n.width,n.height)}t.bindRenderbuffer(t.RENDERBUFFER,null)}function V(e,r){var a=r&&r.isWebGLCubeRenderTarget;if(a)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");var o=i.get(r.depthTexture);o.__renderTarget=r,o.__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),P(r.depthTexture,0);var s=o.__webglTexture,h=Q(r);if(r.depthTexture.format===wn)$(r)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,s,0,h):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,s,0);else{if(r.depthTexture.format!==Sn)throw new Error("Unknown depthTexture format");$(r)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,s,0,h):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,s,0)}}function j(e){var r=i.get(e),a=!0===e.isWebGLCubeRenderTarget;if(r.__boundDepthTexture!==e.depthTexture){var o=e.depthTexture;if(r.__depthDisposeCallback&&r.__depthDisposeCallback(),o){var s=function(){delete r.__boundDepthTexture,delete r.__depthDisposeCallback,o.removeEventListener("dispose",s)};o.addEventListener("dispose",s),r.__depthDisposeCallback=s}r.__boundDepthTexture=o}if(e.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");var l=e.texture.mipmaps;l&&l.length>0?V(r.__webglFramebuffer[0],e):V(r.__webglFramebuffer,e)}else if(a){r.__webglDepthbuffer=[];for(var h=0;h<6;h++)if(n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[h]),void 0===r.__webglDepthbuffer[h])r.__webglDepthbuffer[h]=t.createRenderbuffer(),G(r.__webglDepthbuffer[h],e,!1);else{var u=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,c=r.__webglDepthbuffer[h];t.bindRenderbuffer(t.RENDERBUFFER,c),t.framebufferRenderbuffer(t.FRAMEBUFFER,u,t.RENDERBUFFER,c)}}else{var d=e.texture.mipmaps;if(d&&d.length>0?n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),void 0===r.__webglDepthbuffer)r.__webglDepthbuffer=t.createRenderbuffer(),G(r.__webglDepthbuffer,e,!1);else{var f=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,p=r.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,p),t.framebufferRenderbuffer(t.FRAMEBUFFER,f,t.RENDERBUFFER,p)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function W(e,n,r){var a=i.get(e);void 0!==n&&H(a.__webglFramebuffer,e,e.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),void 0!==r&&j(e)}function X(e){var r=e.texture,s=i.get(e),l=i.get(r);e.addEventListener("dispose",S);var h=e.textures,u=!0===e.isWebGLCubeRenderTarget,c=h.length>1;if(c||(void 0===l.__webglTexture&&(l.__webglTexture=t.createTexture()),l.__version=r.version,o.memory.textures++),u){s.__webglFramebuffer=[];for(var d=0;d<6;d++)if(r.mipmaps&&r.mipmaps.length>0){s.__webglFramebuffer[d]=[];for(var f=0;f<r.mipmaps.length;f++)s.__webglFramebuffer[d][f]=t.createFramebuffer()}else s.__webglFramebuffer[d]=t.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){s.__webglFramebuffer=[];for(var p=0;p<r.mipmaps.length;p++)s.__webglFramebuffer[p]=t.createFramebuffer()}else s.__webglFramebuffer=t.createFramebuffer();if(c)for(var m=0,y=h.length;m<y;m++){var x=i.get(h[m]);void 0===x.__webglTexture&&(x.__webglTexture=t.createTexture(),o.memory.textures++)}if(e.samples>0&&!1===$(e)){s.__webglMultisampledFramebuffer=t.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(var b=0;b<h.length;b++){var w=h[b];s.__webglColorRenderbuffer[b]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,s.__webglColorRenderbuffer[b]);var M=a.convert(w.format,w.colorSpace),A=a.convert(w.type),E=_(w.internalFormat,M,A,w.colorSpace,!0===e.isXRRenderTarget),T=Q(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,T,E,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+b,t.RENDERBUFFER,s.__webglColorRenderbuffer[b])}t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(s.__webglDepthRenderbuffer=t.createRenderbuffer(),G(s.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(u){n.bindTexture(t.TEXTURE_CUBE_MAP,l.__webglTexture),U(t.TEXTURE_CUBE_MAP,r);for(var C=0;C<6;C++)if(r.mipmaps&&r.mipmaps.length>0)for(var k=0;k<r.mipmaps.length;k++)H(s.__webglFramebuffer[C][k],e,r,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+C,k);else H(s.__webglFramebuffer[C],e,r,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+C,0);v(r)&&g(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(c){for(var L=0,P=h.length;L<P;L++){var R=h[L],N=i.get(R);n.bindTexture(t.TEXTURE_2D,N.__webglTexture),U(t.TEXTURE_2D,R),H(s.__webglFramebuffer,e,R,t.COLOR_ATTACHMENT0+L,t.TEXTURE_2D,0),v(R)&&g(t.TEXTURE_2D)}n.unbindTexture()}else{var I=t.TEXTURE_2D;if((e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(I=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(I,l.__webglTexture),U(I,r),r.mipmaps&&r.mipmaps.length>0)for(var O=0;O<r.mipmaps.length;O++)H(s.__webglFramebuffer[O],e,r,t.COLOR_ATTACHMENT0,I,O);else H(s.__webglFramebuffer,e,r,t.COLOR_ATTACHMENT0,I,0);v(r)&&g(I),n.unbindTexture()}e.depthBuffer&&j(e)}function Y(t){for(var e=t.textures,r=0,a=e.length;r<a;r++){var o=e[r];if(v(o)){var s=y(t),l=i.get(o).__webglTexture;n.bindTexture(s,l),g(s),n.unbindTexture()}}}var K=[],Z=[];function J(e){if(e.samples>0)if(!1===$(e)){var r=e.textures,a=e.width,o=e.height,s=t.COLOR_BUFFER_BIT,l=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,u=i.get(e),c=r.length>1;if(c)for(var d=0;d<r.length;d++)n.bindFramebuffer(t.FRAMEBUFFER,u.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,u.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+d,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,u.__webglMultisampledFramebuffer);var f=e.texture.mipmaps;f&&f.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,u.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,u.__webglFramebuffer);for(var p=0;p<r.length;p++){if(e.resolveDepthBuffer&&(e.depthBuffer&&(s|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&e.resolveStencilBuffer&&(s|=t.STENCIL_BUFFER_BIT)),c){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,u.__webglColorRenderbuffer[p]);var m=i.get(r[p]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,m,0)}t.blitFramebuffer(0,0,a,o,0,0,a,o,s,t.NEAREST),!0===h&&(K.length=0,Z.length=0,K.push(t.COLOR_ATTACHMENT0+p),e.depthBuffer&&!1===e.resolveDepthBuffer&&(K.push(l),Z.push(l),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,Z)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,K))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),c)for(var v=0;v<r.length;v++){n.bindFramebuffer(t.FRAMEBUFFER,u.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+v,t.RENDERBUFFER,u.__webglColorRenderbuffer[v]);var g=i.get(r[v]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,u.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+v,t.TEXTURE_2D,g,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,u.__webglMultisampledFramebuffer)}else if(e.depthBuffer&&!1===e.resolveDepthBuffer&&h){var y=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[y])}}function Q(t){return Math.min(r.maxSamples,t.samples)}function $(t){var n=i.get(t);return t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function tt(t){var e=o.render.frame;c.get(t)!==e&&(c.set(t,e),t.update())}function et(t,e){var n=t.colorSpace,i=t.format,r=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||n!==Li&&n!==Ci&&(ua.getTransfer(n)===Ri?i===bn&&r===sn||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),e}function nt(t){return"undefined"!==typeof HTMLImageElement&&t instanceof HTMLImageElement?(u.width=t.naturalWidth||t.width,u.height=t.naturalHeight||t.height):"undefined"!==typeof VideoFrame&&t instanceof VideoFrame?(u.width=t.displayWidth,u.height=t.displayHeight):(u.width=t.width,u.height=t.height),u}this.allocateTextureUnit=k,this.resetTextureUnits=C,this.setTexture2D=P,this.setTexture2DArray=R,this.setTexture3D=N,this.setTextureCube=I,this.rebindTextures=W,this.setupRenderTarget=X,this.updateRenderTargetMipmap=Y,this.updateMultisampleRenderTarget=J,this.setupDepthRenderbuffer=j,this.setupFrameBufferTexture=H,this.useMultisampledRTT=$}function Vb(t,e){function n(n){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ci,a=ua.getTransfer(r);if(n===sn)return t.UNSIGNED_BYTE;if(n===mn)return t.UNSIGNED_SHORT_4_4_4_4;if(n===vn)return t.UNSIGNED_SHORT_5_5_5_1;if(n===yn)return t.UNSIGNED_INT_5_9_9_9_REV;if(n===ln)return t.BYTE;if(n===hn)return t.SHORT;if(n===un)return t.UNSIGNED_SHORT;if(n===cn)return t.INT;if(n===dn)return t.UNSIGNED_INT;if(n===fn)return t.FLOAT;if(n===pn)return t.HALF_FLOAT;if(n===_n)return t.ALPHA;if(n===xn)return t.RGB;if(n===bn)return t.RGBA;if(n===wn)return t.DEPTH_COMPONENT;if(n===Sn)return t.DEPTH_STENCIL;if(n===Mn)return t.RED;if(n===An)return t.RED_INTEGER;if(n===En)return t.RG;if(n===Tn)return t.RG_INTEGER;if(n===kn)return t.RGBA_INTEGER;if(n===Ln||n===Pn||n===Rn||n===Nn)if(a===Ri){if(i=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===i)return null;if(n===Ln)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Pn)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Rn)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Nn)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(i=e.get("WEBGL_compressed_texture_s3tc"),null===i)return null;if(n===Ln)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Pn)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Rn)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Nn)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===In||n===On||n===Dn||n===Fn){if(i=e.get("WEBGL_compressed_texture_pvrtc"),null===i)return null;if(n===In)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===On)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Dn)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Fn)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===Un||n===qn||n===Bn){if(i=e.get("WEBGL_compressed_texture_etc"),null===i)return null;if(n===Un||n===qn)return a===Ri?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===Bn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}if(n===zn||n===Hn||n===Gn||n===Vn||n===jn||n===Wn||n===Xn||n===Yn||n===Kn||n===Zn||n===Jn||n===Qn||n===$n||n===ti){if(i=e.get("WEBGL_compressed_texture_astc"),null===i)return null;if(n===zn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Hn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Gn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Vn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===jn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Wn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Xn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Yn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Kn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Zn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Jn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Qn)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===$n)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ti)return a===Ri?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===ei||n===ni||n===ii){if(i=e.get("EXT_texture_compression_bptc"),null===i)return null;if(n===ei)return a===Ri?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===ni)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===ii)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===ri||n===ai||n===oi||n===si){if(i=e.get("EXT_texture_compression_rgtc"),null===i)return null;if(n===ei)return i.COMPRESSED_RED_RGTC1_EXT;if(n===ai)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===oi)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===si)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===gn?t.UNSIGNED_INT_24_8:void 0!==t[n]?t[n]:null}return{convert:n}}var jb="\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",Wb="\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",Xb=function(){function t(){st()(this,t),this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}return ht()(t,[{key:"init",value:function(t,e,n){if(null===this.texture){var i=new ya,r=t.properties.get(i);r.__webglTexture=e.texture,e.depthNear===n.depthNear&&e.depthFar===n.depthFar||(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}},{key:"getMesh",value:function(t){if(null!==this.texture&&null===this.mesh){var e=t.cameras[0].viewport,n=new Zs({vertexShader:jb,fragmentShader:Wb,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new Us(new qc(20,20),n)}return this.mesh}},{key:"reset",value:function(){this.texture=null,this.mesh=null}},{key:"getDepthTexture",value:function(){return this.texture}}])}(),Yb=function(t){function e(t,n){var i;st()(this,e),i=dv(this,e);var r=i,a=null,o=1,s=null,l="local-floor",h=1,u=null,d=null,f=null,p=null,m=null,v=null,g=new Xb,y=n.getContextAttributes(),_=null,x=null,b=[],w=[],S=new Xr,M=null,A=new el;A.viewport=new _a;var E=new el;E.viewport=new _a;var T=[A,E],C=new Cf,k=null,L=null;function P(t){var e=w.indexOf(t.inputSource);if(-1!==e){var n=b[e];void 0!==n&&(n.update(t.inputSource,t.frame,u||s),n.dispatchEvent({type:t.type,data:t.inputSource}))}}function R(){a.removeEventListener("select",P),a.removeEventListener("selectstart",P),a.removeEventListener("selectend",P),a.removeEventListener("squeeze",P),a.removeEventListener("squeezestart",P),a.removeEventListener("squeezeend",P),a.removeEventListener("end",R),a.removeEventListener("inputsourceschange",N);for(var e=0;e<b.length;e++){var n=w[e];null!==n&&(w[e]=null,b[e].disconnect(n))}k=null,L=null,g.reset(),t.setRenderTarget(_),m=null,p=null,f=null,a=null,x=null,z.stop(),r.isPresenting=!1,t.setPixelRatio(M),t.setSize(S.width,S.height,!1),r.dispatchEvent({type:"sessionend"})}function N(t){for(var e=0;e<t.removed.length;e++){var n=t.removed[e],i=w.indexOf(n);i>=0&&(w[i]=null,b[i].disconnect(n))}for(var r=0;r<t.added.length;r++){var a=t.added[r],o=w.indexOf(a);if(-1===o){for(var s=0;s<b.length;s++){if(s>=w.length){w.push(a),o=s;break}if(null===w[s]){w[s]=a,o=s;break}}if(-1===o)break}var l=b[o];l&&l.connect(a)}}i.cameraAutoUpdate=!0,i.enabled=!1,i.isPresenting=!1,i.getController=function(t){var e=b[t];return void 0===e&&(e=new hl,b[t]=e),e.getTargetRaySpace()},i.getControllerGrip=function(t){var e=b[t];return void 0===e&&(e=new hl,b[t]=e),e.getGripSpace()},i.getHand=function(t){var e=b[t];return void 0===e&&(e=new hl,b[t]=e),e.getHandSpace()},i.setFramebufferScaleFactor=function(t){o=t,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},i.setReferenceSpaceType=function(t){l=t,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},i.getReferenceSpace=function(){return u||s},i.setReferenceSpace=function(t){u=t},i.getBaseLayer=function(){return null!==p?p:m},i.getBinding=function(){return f},i.getFrame=function(){return v},i.getSession=function(){return a},i.setSession=function(){var e=gt()(c.a.mark((function e(i){var d,v,g,b,w,A;return c.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(a=i,null===a){e.next=28;break}if(_=t.getRenderTarget(),a.addEventListener("select",P),a.addEventListener("selectstart",P),a.addEventListener("selectend",P),a.addEventListener("squeeze",P),a.addEventListener("squeezestart",P),a.addEventListener("squeezeend",P),a.addEventListener("end",R),a.addEventListener("inputsourceschange",N),!0===y.xrCompatible){e.next=14;break}return e.next=14,n.makeXRCompatible();case 14:return M=t.getPixelRatio(),t.getSize(S),d="undefined"!==typeof XRWebGLBinding&&"createProjectionLayer"in XRWebGLBinding.prototype,d?(g=null,b=null,w=null,y.depth&&(w=y.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,g=y.stencil?Sn:wn,b=y.stencil?gn:dn),A={colorFormat:n.RGBA8,depthFormat:w,scaleFactor:o},f=new XRWebGLBinding(a,n),p=f.createProjectionLayer(A),a.updateRenderState({layers:[p]}),t.setPixelRatio(1),t.setSize(p.textureWidth,p.textureHeight,!1),x=new ba(p.textureWidth,p.textureHeight,{format:bn,type:sn,depthTexture:new su(p.textureWidth,p.textureHeight,b,void 0,void 0,void 0,void 0,void 0,void 0,g),stencilBuffer:y.stencil,colorSpace:t.outputColorSpace,samples:y.antialias?4:0,resolveDepthBuffer:!1===p.ignoreDepthValues,resolveStencilBuffer:!1===p.ignoreDepthValues})):(v={antialias:y.antialias,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:o},m=new XRWebGLLayer(a,n,v),a.updateRenderState({baseLayer:m}),t.setPixelRatio(1),t.setSize(m.framebufferWidth,m.framebufferHeight,!1),x=new ba(m.framebufferWidth,m.framebufferHeight,{format:bn,type:sn,colorSpace:t.outputColorSpace,stencilBuffer:y.stencil,resolveDepthBuffer:!1===m.ignoreDepthValues,resolveStencilBuffer:!1===m.ignoreDepthValues})),x.isXRRenderTarget=!0,this.setFoveation(h),u=null,e.next=23,a.requestReferenceSpace(l);case 23:s=e.sent,z.setContext(a),z.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"});case 28:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),i.getEnvironmentBlendMode=function(){if(null!==a)return a.environmentBlendMode},i.getDepthTexture=function(){return g.getDepthTexture()};var I=new Ta,O=new Ta;function D(t,e,n){I.setFromMatrixPosition(e.matrixWorld),O.setFromMatrixPosition(n.matrixWorld);var i=I.distanceTo(O),r=e.projectionMatrix.elements,a=n.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),l=(r[9]+1)/r[5],h=(r[9]-1)/r[5],u=(r[8]-1)/r[0],c=(a[8]+1)/a[0],d=o*u,f=o*c,p=i/(-u+c),m=p*-u;if(e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(p),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert(),-1===r[10])t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{var v=o+p,g=s+p,y=d-m,_=f+(i-m),x=l*s/g*v,b=h*s/g*v;t.projectionMatrix.makePerspective(y,_,x,b,v,g),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}}function F(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}function U(t,e,n){null===n?t.matrix.copy(e.matrixWorld):(t.matrix.copy(n.matrixWorld),t.matrix.invert(),t.matrix.multiply(e.matrixWorld)),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*Sr*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}i.updateCamera=function(t){if(null!==a){var e=t.near,n=t.far;null!==g.texture&&(g.depthNear>0&&(e=g.depthNear),g.depthFar>0&&(n=g.depthFar)),C.near=E.near=A.near=e,C.far=E.far=A.far=n,k===C.near&&L===C.far||(a.updateRenderState({depthNear:C.near,depthFar:C.far}),k=C.near,L=C.far),A.layers.mask=2|t.layers.mask,E.layers.mask=4|t.layers.mask,C.layers.mask=A.layers.mask|E.layers.mask;var i=t.parent,r=C.cameras;F(C,i);for(var o=0;o<r.length;o++)F(r[o],i);2===r.length?D(C,A,E):C.projectionMatrix.copy(A.projectionMatrix),U(t,C,i)}},i.getCamera=function(){return C},i.getFoveation=function(){if(null!==p||null!==m)return h},i.setFoveation=function(t){h=t,null!==p&&(p.fixedFoveation=t),null!==m&&void 0!==m.fixedFoveation&&(m.fixedFoveation=t)},i.hasDepthSensing=function(){return null!==g.texture},i.getDepthSensingMesh=function(){return g.getMesh(C)};var q=null;function B(e,n){if(d=n.getViewerPose(u||s),v=n,null!==d){var i=d.views;null!==m&&(t.setRenderTargetFramebuffer(x,m.framebuffer),t.setRenderTarget(x));var o=!1;i.length!==C.cameras.length&&(C.cameras.length=0,o=!0);for(var l=0;l<i.length;l++){var h=i[l],c=null;if(null!==m)c=m.getViewport(h);else{var y=f.getViewSubImage(p,h);c=y.viewport,0===l&&(t.setRenderTargetTextures(x,y.colorTexture,y.depthStencilTexture),t.setRenderTarget(x))}var _=T[l];void 0===_&&(_=new el,_.layers.enable(l),_.viewport=new _a,T[l]=_),_.matrix.fromArray(h.transform.matrix),_.matrix.decompose(_.position,_.quaternion,_.scale),_.projectionMatrix.fromArray(h.projectionMatrix),_.projectionMatrixInverse.copy(_.projectionMatrix).invert(),_.viewport.set(c.x,c.y,c.width,c.height),0===l&&(C.matrix.copy(_.matrix),C.matrix.decompose(C.position,C.quaternion,C.scale)),!0===o&&C.cameras.push(_)}var S=a.enabledFeatures,M=S&&S.includes("depth-sensing")&&"gpu-optimized"==a.depthUsage;if(M&&f){var A=f.getDepthInformation(i[0]);A&&A.isValid&&A.texture&&g.init(t,A,a.renderState)}}for(var E=0;E<b.length;E++){var k=w[E],L=b[E];null!==k&&void 0!==L&&L.update(k,n,u||s)}q&&q(e,n),n.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:n}),v=null}var z=new gv;return z.setAnimationLoop(B),i.setAnimationLoop=function(t){q=t},i.dispose=function(){},i}return mt()(e,t),ht()(e)}(_r),Kb=new po,Zb=new io;function Jb(t,e){function n(t,e){!0===t.matrixAutoUpdate&&t.updateMatrix(),e.value.copy(t.matrix)}function i(e,n){n.color.getRGB(e.fogColor.value,js(t)),n.isFog?(e.fogNear.value=n.near,e.fogFar.value=n.far):n.isFogExp2&&(e.fogDensity.value=n.density)}function r(t,e,n,i,r){e.isMeshBasicMaterial||e.isMeshLambertMaterial?a(t,e):e.isMeshToonMaterial?(a(t,e),c(t,e)):e.isMeshPhongMaterial?(a(t,e),u(t,e)):e.isMeshStandardMaterial?(a(t,e),d(t,e),e.isMeshPhysicalMaterial&&f(t,e,r)):e.isMeshMatcapMaterial?(a(t,e),p(t,e)):e.isMeshDepthMaterial?a(t,e):e.isMeshDistanceMaterial?(a(t,e),m(t,e)):e.isMeshNormalMaterial?a(t,e):e.isLineBasicMaterial?(o(t,e),e.isLineDashedMaterial&&s(t,e)):e.isPointsMaterial?l(t,e,n,i):e.isSpriteMaterial?h(t,e):e.isShadowMaterial?(t.color.value.copy(e.color),t.opacity.value=e.opacity):e.isShaderMaterial&&(e.uniformsNeedUpdate=!1)}function a(t,i){t.opacity.value=i.opacity,i.color&&t.diffuse.value.copy(i.color),i.emissive&&t.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(t.map.value=i.map,n(i.map,t.mapTransform)),i.alphaMap&&(t.alphaMap.value=i.alphaMap,n(i.alphaMap,t.alphaMapTransform)),i.bumpMap&&(t.bumpMap.value=i.bumpMap,n(i.bumpMap,t.bumpMapTransform),t.bumpScale.value=i.bumpScale,i.side===Wt&&(t.bumpScale.value*=-1)),i.normalMap&&(t.normalMap.value=i.normalMap,n(i.normalMap,t.normalMapTransform),t.normalScale.value.copy(i.normalScale),i.side===Wt&&t.normalScale.value.negate()),i.displacementMap&&(t.displacementMap.value=i.displacementMap,n(i.displacementMap,t.displacementMapTransform),t.displacementScale.value=i.displacementScale,t.displacementBias.value=i.displacementBias),i.emissiveMap&&(t.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,t.emissiveMapTransform)),i.specularMap&&(t.specularMap.value=i.specularMap,n(i.specularMap,t.specularMapTransform)),i.alphaTest>0&&(t.alphaTest.value=i.alphaTest);var r=e.get(i),a=r.envMap,o=r.envMapRotation;a&&(t.envMap.value=a,Kb.copy(o),Kb.x*=-1,Kb.y*=-1,Kb.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(Kb.y*=-1,Kb.z*=-1),t.envMapRotation.value.setFromMatrix4(Zb.makeRotationFromEuler(Kb)),t.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,t.reflectivity.value=i.reflectivity,t.ior.value=i.ior,t.refractionRatio.value=i.refractionRatio),i.lightMap&&(t.lightMap.value=i.lightMap,t.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,t.lightMapTransform)),i.aoMap&&(t.aoMap.value=i.aoMap,t.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,t.aoMapTransform))}function o(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform))}function s(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}function l(t,e,i,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*r,e.map&&(t.map.value=e.map,n(e.map,t.uvTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}function h(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}function u(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}function c(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}function d(t,e){t.metalness.value=e.metalness,e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap,n(e.metalnessMap,t.metalnessMapTransform)),t.roughness.value=e.roughness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap,n(e.roughnessMap,t.roughnessMapTransform)),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}function f(t,e,i){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,n(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,n(e.sheenRoughnessMap,t.sheenRoughnessMapTransform))),e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,n(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,n(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,n(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),e.side===Wt&&t.clearcoatNormalScale.value.negate())),e.dispersion>0&&(t.dispersion.value=e.dispersion),e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,n(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,n(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform))),e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,n(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,n(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)),e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,n(e.anisotropyMap,t.anisotropyMapTransform))),t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,n(e.specularColorMap,t.specularColorMapTransform)),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,n(e.specularIntensityMap,t.specularIntensityMapTransform))}function p(t,e){e.matcap&&(t.matcap.value=e.matcap)}function m(t,n){var i=e.get(n).light;t.referencePosition.value.setFromMatrixPosition(i.matrixWorld),t.nearDistance.value=i.shadow.camera.near,t.farDistance.value=i.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function Qb(t,e,n,i){var r={},a={},o=[],s=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(t,e){var n=e.program;i.uniformBlockBinding(t,n)}function h(t,n){var o=r[t.id];void 0===o&&(p(t),o=u(t),r[t.id]=o,t.addEventListener("dispose",v));var s=n.program;i.updateUBOMapping(t,s);var l=e.render.frame;a[t.id]!==l&&(d(t),a[t.id]=l)}function u(e){var n=c();e.__bindingPointIndex=n;var i=t.createBuffer(),r=e.__size,a=e.usage;return t.bindBuffer(t.UNIFORM_BUFFER,i),t.bufferData(t.UNIFORM_BUFFER,r,a),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,n,i),i}function c(){for(var t=0;t<s;t++)if(-1===o.indexOf(t))return o.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(e){var n=r[e.id],i=e.uniforms,a=e.__cache;t.bindBuffer(t.UNIFORM_BUFFER,n);for(var o=0,s=i.length;o<s;o++)for(var l=Array.isArray(i[o])?i[o]:[i[o]],h=0,u=l.length;h<u;h++){var c=l[h];if(!0===f(c,o,h,a)){for(var d=c.__offset,p=Array.isArray(c.value)?c.value:[c.value],v=0,g=0;g<p.length;g++){var y=p[g],_=m(y);"number"===typeof y||"boolean"===typeof y?(c.__data[0]=y,t.bufferSubData(t.UNIFORM_BUFFER,d+v,c.__data)):y.isMatrix3?(c.__data[0]=y.elements[0],c.__data[1]=y.elements[1],c.__data[2]=y.elements[2],c.__data[3]=0,c.__data[4]=y.elements[3],c.__data[5]=y.elements[4],c.__data[6]=y.elements[5],c.__data[7]=0,c.__data[8]=y.elements[6],c.__data[9]=y.elements[7],c.__data[10]=y.elements[8],c.__data[11]=0):(y.toArray(c.__data,v),v+=_.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,d,c.__data)}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function f(t,e,n,i){var r=t.value,a=e+"_"+n;if(void 0===i[a])return i[a]="number"===typeof r||"boolean"===typeof r?r:r.clone(),!0;var o=i[a];if("number"===typeof r||"boolean"===typeof r){if(o!==r)return i[a]=r,!0}else if(!1===o.equals(r))return o.copy(r),!0;return!1}function p(t){for(var e=t.uniforms,n=0,i=16,r=0,a=e.length;r<a;r++)for(var o=Array.isArray(e[r])?e[r]:[e[r]],s=0,l=o.length;s<l;s++)for(var h=o[s],u=Array.isArray(h.value)?h.value:[h.value],c=0,d=u.length;c<d;c++){var f=u[c],p=m(f),v=n%i,g=v%p.boundary,y=v+g;n+=g,0!==y&&i-y<p.storage&&(n+=i-y),h.__data=new Float32Array(p.storage/Float32Array.BYTES_PER_ELEMENT),h.__offset=n,n+=p.storage}var _=n%i;return _>0&&(n+=i-_),t.__size=n,t.__cache={},this}function m(t){var e={boundary:0,storage:0};return"number"===typeof t||"boolean"===typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.storage=64):t.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",t),e}function v(e){var n=e.target;n.removeEventListener("dispose",v);var i=o.indexOf(n.__bindingPointIndex);o.splice(i,1),t.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}function g(){for(var e in r)t.deleteBuffer(r[e]);o=[],r={},a={}}return{bind:l,update:h,dispose:g}}var $b=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};st()(this,t);var n,i=e.canvas,r=void 0===i?ta():i,a=e.context,o=void 0===a?null:a,s=e.depth,l=void 0===s||s,h=e.stencil,u=void 0!==h&&h,d=e.alpha,f=void 0!==d&&d,p=e.antialias,m=void 0!==p&&p,v=e.premultipliedAlpha,g=void 0===v||v,y=e.preserveDrawingBuffer,_=void 0!==y&&y,x=e.powerPreference,b=void 0===x?"default":x,w=e.failIfMajorPerformanceCaveat,S=void 0!==w&&w,M=e.reverseDepthBuffer,A=void 0!==M&&M;if(this.isWebGLRenderer=!0,null!==o){if("undefined"!==typeof WebGLRenderingContext&&o instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");n=o.getContextAttributes().alpha}else n=f;var E=new Uint32Array(4),T=new Int32Array(4),C=null,k=null,L=[],P=[];this.domElement=r,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Pe,this.toneMappingExposure=1,this.transmissionResolutionScale=1;var R=this,N=!1;this._outputColorSpace=ki;var I=0,O=0,D=null,F=-1,U=null,q=new _a,B=new _a,z=null,H=new Zo(0),G=0,V=r.width,j=r.height,W=1,X=null,Y=null,K=new _a(0,0,V,j),Z=new _a(0,0,V,j),J=!1,Q=new uh,$=!1,tt=!1,et=new io,nt=new io,it=new Ta,rt=new _a,at={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},ot=!1;function lt(){return null===D?W:1}var ht,ut,ct,dt,ft,pt,mt,vt,yt,_t,xt,bt,wt,St,Mt,At,Et,Tt,Ct,kt,Lt,Pt,Rt,Nt,Ot=o;function Dt(t,e){return r.getContext(t,e)}try{var Ft={alpha:!0,depth:l,stencil:u,antialias:m,premultipliedAlpha:g,preserveDrawingBuffer:_,powerPreference:b,failIfMajorPerformanceCaveat:S};if("setAttribute"in r&&r.setAttribute("data-engine","three.js r".concat(It)),r.addEventListener("webglcontextlost",zt,!1),r.addEventListener("webglcontextrestored",Ht,!1),r.addEventListener("webglcontextcreationerror",Gt,!1),null===Ot){var Ut="webgl2";if(Ot=Dt(Ut,Ft),null===Ot)throw Dt(Ut)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(ve){throw console.error("THREE.WebGLRenderer: "+ve.message),ve}function qt(){ht=new R_(Ot),ht.init(),Pt=new Vb(Ot,ht),ut=new s_(Ot,ht,e,Pt),ct=new Hb(Ot,ht),ut.reverseDepthBuffer&&A&&ct.buffers.depth.setReversed(!0),dt=new O_(Ot),ft=new Eb,pt=new Gb(Ot,ht,ct,ft,ut,Pt,dt),mt=new h_(R),vt=new P_(R),yt=new yv(Ot),Rt=new a_(Ot,yt),_t=new N_(Ot,yt,dt,Rt),xt=new F_(Ot,_t,yt,dt),Ct=new D_(Ot,ut,pt),At=new l_(ft),bt=new Ab(R,mt,vt,ht,ut,Rt,At),wt=new Jb(R,ft),St=new Lb,Mt=new Fb(ht),Tt=new r_(R,mt,vt,ct,xt,n,g),Et=new Bb(R,xt,ut),Nt=new Qb(Ot,dt,ut,ct),kt=new o_(Ot,ht,dt),Lt=new I_(Ot,ht,dt),dt.programs=bt.programs,R.capabilities=ut,R.extensions=ht,R.properties=ft,R.renderLists=St,R.shadowMap=Et,R.state=ct,R.info=dt}qt();var Bt=new Yb(R,Ot);function zt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),N=!0}function Ht(){console.log("THREE.WebGLRenderer: Context Restored."),N=!1;var t=dt.autoReset,e=Et.enabled,n=Et.autoUpdate,i=Et.needsUpdate,r=Et.type;qt(),dt.autoReset=t,Et.enabled=e,Et.autoUpdate=n,Et.needsUpdate=i,Et.type=r}function Gt(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function Vt(t){var e=t.target;e.removeEventListener("dispose",Vt),Yt(e)}function Yt(t){Kt(t),ft.remove(t)}function Kt(t){var e=ft.get(t).programs;void 0!==e&&(e.forEach((function(t){bt.releaseProgram(t)})),t.isShaderMaterial&&bt.releaseShaderCache(t))}function Zt(t,e,n){!0===t.transparent&&t.side===Xt&&!1===t.forceSinglePass?(t.side=Wt,t.needsUpdate=!0,se(t,e,n),t.side=jt,t.needsUpdate=!0,se(t,e,n),t.side=Xt):se(t,e,n)}this.xr=Bt,this.getContext=function(){return Ot},this.getContextAttributes=function(){return Ot.getContextAttributes()},this.forceContextLoss=function(){var t=ht.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){var t=ht.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return W},this.setPixelRatio=function(t){void 0!==t&&(W=t,this.setSize(V,j,!1))},this.getSize=function(t){return t.set(V,j)},this.setSize=function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];Bt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(V=t,j=e,r.width=Math.floor(t*W),r.height=Math.floor(e*W),!0===n&&(r.style.width=t+"px",r.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(t){return t.set(V*W,j*W).floor()},this.setDrawingBufferSize=function(t,e,n){V=t,j=e,W=n,r.width=Math.floor(t*n),r.height=Math.floor(e*n),this.setViewport(0,0,t,e)},this.getCurrentViewport=function(t){return t.copy(q)},this.getViewport=function(t){return t.copy(K)},this.setViewport=function(t,e,n,i){t.isVector4?K.set(t.x,t.y,t.z,t.w):K.set(t,e,n,i),ct.viewport(q.copy(K).multiplyScalar(W).round())},this.getScissor=function(t){return t.copy(Z)},this.setScissor=function(t,e,n,i){t.isVector4?Z.set(t.x,t.y,t.z,t.w):Z.set(t,e,n,i),ct.scissor(B.copy(Z).multiplyScalar(W).round())},this.getScissorTest=function(){return J},this.setScissorTest=function(t){ct.setScissorTest(J=t)},this.setOpaqueSort=function(t){X=t},this.setTransparentSort=function(t){Y=t},this.getClearColor=function(t){return t.copy(Tt.getClearColor())},this.setClearColor=function(){var t;(t=Tt).setClearColor.apply(t,arguments)},this.getClearAlpha=function(){return Tt.getClearAlpha()},this.setClearAlpha=function(){var t;(t=Tt).setClearAlpha.apply(t,arguments)},this.clear=function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=0;if(t){var r=!1;if(null!==D){var a=D.texture.format;r=a===kn||a===Tn||a===An}if(r){var o=D.texture.type,s=o===sn||o===dn||o===un||o===gn||o===mn||o===vn,l=Tt.getClearColor(),h=Tt.getClearAlpha(),u=l.r,c=l.g,d=l.b;s?(E[0]=u,E[1]=c,E[2]=d,E[3]=h,Ot.clearBufferuiv(Ot.COLOR,0,E)):(T[0]=u,T[1]=c,T[2]=d,T[3]=h,Ot.clearBufferiv(Ot.COLOR,0,T))}else i|=Ot.COLOR_BUFFER_BIT}e&&(i|=Ot.DEPTH_BUFFER_BIT),n&&(i|=Ot.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Ot.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){r.removeEventListener("webglcontextlost",zt,!1),r.removeEventListener("webglcontextrestored",Ht,!1),r.removeEventListener("webglcontextcreationerror",Gt,!1),Tt.dispose(),St.dispose(),Mt.dispose(),ft.dispose(),mt.dispose(),vt.dispose(),xt.dispose(),Rt.dispose(),Nt.dispose(),bt.dispose(),Bt.dispose(),Bt.removeEventListener("sessionstart",$t),Bt.removeEventListener("sessionend",te),ee.stop()},this.renderBufferDirect=function(t,e,n,i,r,a){null===e&&(e=at);var o=r.isMesh&&r.matrixWorld.determinant()<0,s=ue(t,e,n,i,r);ct.setMaterial(i,o);var l=n.index,h=1;if(!0===i.wireframe){if(l=_t.getWireframeAttribute(n),void 0===l)return;h=2}var u=n.drawRange,c=n.attributes.position,d=u.start*h,f=(u.start+u.count)*h;null!==a&&(d=Math.max(d,a.start*h),f=Math.min(f,(a.start+a.count)*h)),null!==l?(d=Math.max(d,0),f=Math.min(f,l.count)):void 0!==c&&null!==c&&(d=Math.max(d,0),f=Math.min(f,c.count));var p=f-d;if(!(p<0||p===1/0)){var m;Rt.setup(r,i,s,n,l);var v=kt;if(null!==l&&(m=yt.get(l),v=Lt,v.setIndex(m)),r.isMesh)!0===i.wireframe?(ct.setLineWidth(i.wireframeLinewidth*lt()),v.setMode(Ot.LINES)):v.setMode(Ot.TRIANGLES);else if(r.isLine){var g=i.linewidth;void 0===g&&(g=1),ct.setLineWidth(g*lt()),r.isLineSegments?v.setMode(Ot.LINES):r.isLineLoop?v.setMode(Ot.LINE_LOOP):v.setMode(Ot.LINE_STRIP)}else r.isPoints?v.setMode(Ot.POINTS):r.isSprite&&v.setMode(Ot.TRIANGLES);if(r.isBatchedMesh)if(null!==r._multiDrawInstances)na("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),v.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances);else if(ht.get("WEBGL_multi_draw"))v.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else for(var y=r._multiDrawStarts,_=r._multiDrawCounts,x=r._multiDrawCount,b=l?yt.get(l).bytesPerElement:1,w=ft.get(i).currentProgram.getUniforms(),S=0;S<x;S++)w.setValue(Ot,"_gl_DrawID",S),v.render(y[S]/b,_[S]);else if(r.isInstancedMesh)v.renderInstances(d,p,r.count);else if(n.isInstancedBufferGeometry){var M=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,A=Math.min(n.instanceCount,M);v.renderInstances(d,p,A)}else v.render(d,p)}},this.compile=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;null===n&&(n=t),k=Mt.get(n),k.init(e),P.push(k),n.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(k.pushLight(t),t.castShadow&&k.pushShadow(t))})),t!==n&&t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(k.pushLight(t),t.castShadow&&k.pushShadow(t))})),k.setupLights();var i=new Set;return t.traverse((function(t){if(t.isMesh||t.isPoints||t.isLine||t.isSprite){var e=t.material;if(e)if(Array.isArray(e))for(var r=0;r<e.length;r++){var a=e[r];Zt(a,n,t),i.add(a)}else Zt(e,n,t),i.add(e)}})),k=P.pop(),i},this.compileAsync=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=this.compile(t,e,n);return new Promise((function(e){function n(){i.forEach((function(t){var e=ft.get(t),n=e.currentProgram;n.isReady()&&i.delete(t)})),0!==i.size?setTimeout(n,10):e(t)}null!==ht.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)}))};var Jt=null;function Qt(t){Jt&&Jt(t)}function $t(){ee.stop()}function te(){ee.start()}var ee=new gv;function ne(t,e,n,i){if(!1!==t.visible){var r=t.layers.test(e.layers);if(r)if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)k.pushLight(t),t.castShadow&&k.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||Q.intersectsSprite(t)){i&&rt.setFromMatrixPosition(t.matrixWorld).applyMatrix4(nt);var a=xt.update(t),o=t.material;o.visible&&C.push(t,a,o,n,rt.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||Q.intersectsObject(t))){var s=xt.update(t),l=t.material;if(i&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),rt.copy(t.boundingSphere.center)):(null===s.boundingSphere&&s.computeBoundingSphere(),rt.copy(s.boundingSphere.center)),rt.applyMatrix4(t.matrixWorld).applyMatrix4(nt)),Array.isArray(l))for(var h=s.groups,u=0,c=h.length;u<c;u++){var d=h[u],f=l[d.materialIndex];f&&f.visible&&C.push(t,s,f,n,rt.z,d)}else l.visible&&C.push(t,s,l,n,rt.z,null)}for(var p=t.children,m=0,v=p.length;m<v;m++)ne(p[m],e,n,i)}}function ie(t,e,n,i){var r=t.opaque,a=t.transmissive,o=t.transparent;k.setupLightsView(n),!0===$&&At.setGlobalState(R.clippingPlanes,n),i&&ct.viewport(q.copy(i)),r.length>0&&ae(r,e,n),a.length>0&&ae(a,e,n),o.length>0&&ae(o,e,n),ct.buffers.depth.setTest(!0),ct.buffers.depth.setMask(!0),ct.buffers.color.setMask(!0),ct.setPolygonOffset(!1)}function re(t,e,n,i){var r=!0===n.isScene?n.overrideMaterial:null;if(null===r){void 0===k.state.transmissionRenderTarget[i.id]&&(k.state.transmissionRenderTarget[i.id]=new ba(1,1,{generateMipmaps:!0,type:ht.has("EXT_color_buffer_half_float")||ht.has("EXT_color_buffer_float")?pn:sn,minFilter:an,samples:4,stencilBuffer:u,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ua.workingColorSpace}));var a=k.state.transmissionRenderTarget[i.id],o=i.viewport||q;a.setSize(o.z*R.transmissionResolutionScale,o.w*R.transmissionResolutionScale);var s=R.getRenderTarget();R.setRenderTarget(a),R.getClearColor(H),G=R.getClearAlpha(),G<1&&R.setClearColor(16777215,.5),R.clear(),ot&&Tt.render(n);var l=R.toneMapping;R.toneMapping=Pe;var h=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),k.setupLightsView(i),!0===$&&At.setGlobalState(R.clippingPlanes,i),ae(t,n,i),pt.updateMultisampleRenderTarget(a),pt.updateRenderTargetMipmap(a),!1===ht.has("WEBGL_multisampled_render_to_texture")){for(var c=!1,d=0,f=e.length;d<f;d++){var p=e[d],m=p.object,v=p.geometry,g=p.material,y=p.group;if(g.side===Xt&&m.layers.test(i.layers)){var _=g.side;g.side=Wt,g.needsUpdate=!0,oe(m,n,i,v,g,y),g.side=_,g.needsUpdate=!0,c=!0}}!0===c&&(pt.updateMultisampleRenderTarget(a),pt.updateRenderTargetMipmap(a))}R.setRenderTarget(s),R.setClearColor(H,G),void 0!==h&&(i.viewport=h),R.toneMapping=l}}function ae(t,e,n){for(var i=!0===e.isScene?e.overrideMaterial:null,r=0,a=t.length;r<a;r++){var o=t[r],s=o.object,l=o.geometry,h=o.group,u=o.material;!0===u.allowOverride&&null!==i&&(u=i),s.layers.test(n.layers)&&oe(s,e,n,l,u,h)}}function oe(t,e,n,i,r,a){t.onBeforeRender(R,e,n,i,r,a),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(R,e,n,i,t,a),!0===r.transparent&&r.side===Xt&&!1===r.forceSinglePass?(r.side=Wt,r.needsUpdate=!0,R.renderBufferDirect(n,e,i,r,t,a),r.side=jt,r.needsUpdate=!0,R.renderBufferDirect(n,e,i,r,t,a),r.side=Xt):R.renderBufferDirect(n,e,i,r,t,a),t.onAfterRender(R,e,n,i,r,a)}function se(t,e,n){!0!==e.isScene&&(e=at);var i=ft.get(t),r=k.state.lights,a=k.state.shadowsArray,o=r.state.version,s=bt.getParameters(t,r.state,a,e,n),l=bt.getProgramCacheKey(s),h=i.programs;i.environment=t.isMeshStandardMaterial?e.environment:null,i.fog=e.fog,i.envMap=(t.isMeshStandardMaterial?vt:mt).get(t.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===t.envMap?e.environmentRotation:t.envMapRotation,void 0===h&&(t.addEventListener("dispose",Vt),h=new Map,i.programs=h);var u=h.get(l);if(void 0!==u){if(i.currentProgram===u&&i.lightsStateVersion===o)return he(t,s),u}else s.uniforms=bt.getUniforms(t),t.onBeforeCompile(s,R),u=bt.acquireProgram(s,l),h.set(l,u),i.uniforms=s.uniforms;var c=i.uniforms;return(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(c.clippingPlanes=At.uniform),he(t,s),i.needsLights=de(t),i.lightsStateVersion=o,i.needsLights&&(c.ambientLightColor.value=r.state.ambient,c.lightProbe.value=r.state.probe,c.directionalLights.value=r.state.directional,c.directionalLightShadows.value=r.state.directionalShadow,c.spotLights.value=r.state.spot,c.spotLightShadows.value=r.state.spotShadow,c.rectAreaLights.value=r.state.rectArea,c.ltc_1.value=r.state.rectAreaLTC1,c.ltc_2.value=r.state.rectAreaLTC2,c.pointLights.value=r.state.point,c.pointLightShadows.value=r.state.pointShadow,c.hemisphereLights.value=r.state.hemi,c.directionalShadowMap.value=r.state.directionalShadowMap,c.directionalShadowMatrix.value=r.state.directionalShadowMatrix,c.spotShadowMap.value=r.state.spotShadowMap,c.spotLightMatrix.value=r.state.spotLightMatrix,c.spotLightMap.value=r.state.spotLightMap,c.pointShadowMap.value=r.state.pointShadowMap,c.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=u,i.uniformsList=null,u}function le(t){if(null===t.uniformsList){var e=t.currentProgram.getUniforms();t.uniformsList=Vx.seqWithValue(e.seq,t.uniforms)}return t.uniformsList}function he(t,e){var n=ft.get(t);n.outputColorSpace=e.outputColorSpace,n.batching=e.batching,n.batchingColor=e.batchingColor,n.instancing=e.instancing,n.instancingColor=e.instancingColor,n.instancingMorph=e.instancingMorph,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.morphColors=e.morphColors,n.morphTargetsCount=e.morphTargetsCount,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents,n.toneMapping=e.toneMapping}function ue(t,e,n,i,r){!0!==e.isScene&&(e=at),pt.resetTextureUnits();var a=e.fog,o=i.isMeshStandardMaterial?e.environment:null,s=null===D?R.outputColorSpace:!0===D.isXRRenderTarget?D.texture.colorSpace:Li,l=(i.isMeshStandardMaterial?vt:mt).get(i.envMap||o),h=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,u=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),c=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,f=!!n.morphAttributes.color,p=Pe;i.toneMapped&&(null!==D&&!0!==D.isXRRenderTarget||(p=R.toneMapping));var m=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==m?m.length:0,g=ft.get(i),y=k.state.lights;if(!0===$&&(!0===tt||t!==U)){var _=t===U&&i.id===F;At.setState(i,t,_)}var x=!1;i.version===g.__version?g.needsLights&&g.lightsStateVersion!==y.state.version||g.outputColorSpace!==s||r.isBatchedMesh&&!1===g.batching?x=!0:r.isBatchedMesh||!0!==g.batching?r.isBatchedMesh&&!0===g.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===g.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===g.instancing?x=!0:r.isInstancedMesh||!0!==g.instancing?r.isSkinnedMesh&&!1===g.skinning?x=!0:r.isSkinnedMesh||!0!==g.skinning?r.isInstancedMesh&&!0===g.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===g.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===g.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===g.instancingMorph&&null!==r.morphTexture||g.envMap!==l||!0===i.fog&&g.fog!==a?x=!0:void 0===g.numClippingPlanes||g.numClippingPlanes===At.numPlanes&&g.numIntersection===At.numIntersection?(g.vertexAlphas!==h||g.vertexTangents!==u||g.morphTargets!==c||g.morphNormals!==d||g.morphColors!==f||g.toneMapping!==p||g.morphTargetsCount!==v)&&(x=!0):x=!0:x=!0:x=!0:x=!0:(x=!0,g.__version=i.version);var b=g.currentProgram;!0===x&&(b=se(i,e,r));var w=!1,S=!1,M=!1,A=b.getUniforms(),E=g.uniforms;if(ct.useProgram(b.program)&&(w=!0,S=!0,M=!0),i.id!==F&&(F=i.id,S=!0),w||U!==t){var T=ct.buffers.depth.getReversed();T?(et.copy(t.projectionMatrix),ra(et),aa(et),A.setValue(Ot,"projectionMatrix",et)):A.setValue(Ot,"projectionMatrix",t.projectionMatrix),A.setValue(Ot,"viewMatrix",t.matrixWorldInverse);var C=A.map.cameraPosition;void 0!==C&&C.setValue(Ot,it.setFromMatrixPosition(t.matrixWorld)),ut.logarithmicDepthBuffer&&A.setValue(Ot,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&A.setValue(Ot,"isOrthographic",!0===t.isOrthographicCamera),U!==t&&(U=t,S=!0,M=!0)}if(r.isSkinnedMesh){A.setOptional(Ot,r,"bindMatrix"),A.setOptional(Ot,r,"bindMatrixInverse");var L=r.skeleton;L&&(null===L.boneTexture&&L.computeBoneTexture(),A.setValue(Ot,"boneTexture",L.boneTexture,pt))}r.isBatchedMesh&&(A.setOptional(Ot,r,"batchingTexture"),A.setValue(Ot,"batchingTexture",r._matricesTexture,pt),A.setOptional(Ot,r,"batchingIdTexture"),A.setValue(Ot,"batchingIdTexture",r._indirectTexture,pt),A.setOptional(Ot,r,"batchingColorTexture"),null!==r._colorsTexture&&A.setValue(Ot,"batchingColorTexture",r._colorsTexture,pt));var P=n.morphAttributes;if(void 0===P.position&&void 0===P.normal&&void 0===P.color||Ct.update(r,n,b),(S||g.receiveShadow!==r.receiveShadow)&&(g.receiveShadow=r.receiveShadow,A.setValue(Ot,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(E.envMap.value=l,E.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==e.environment&&(E.envMapIntensity.value=e.environmentIntensity),S&&(A.setValue(Ot,"toneMappingExposure",R.toneMappingExposure),g.needsLights&&ce(E,M),a&&!0===i.fog&&wt.refreshFogUniforms(E,a),wt.refreshMaterialUniforms(E,i,W,j,k.state.transmissionRenderTarget[t.id]),Vx.upload(Ot,le(g),E,pt)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Vx.upload(Ot,le(g),E,pt),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&A.setValue(Ot,"center",r.center),A.setValue(Ot,"modelViewMatrix",r.modelViewMatrix),A.setValue(Ot,"normalMatrix",r.normalMatrix),A.setValue(Ot,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial)for(var N=i.uniformsGroups,I=0,O=N.length;I<O;I++){var q=N[I];Nt.update(q,b),Nt.bind(q,b)}return b}function ce(t,e){t.ambientLightColor.needsUpdate=e,t.lightProbe.needsUpdate=e,t.directionalLights.needsUpdate=e,t.directionalLightShadows.needsUpdate=e,t.pointLights.needsUpdate=e,t.pointLightShadows.needsUpdate=e,t.spotLights.needsUpdate=e,t.spotLightShadows.needsUpdate=e,t.rectAreaLights.needsUpdate=e,t.hemisphereLights.needsUpdate=e}function de(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}ee.setAnimationLoop(Qt),"undefined"!==typeof self&&ee.setContext(self),this.setAnimationLoop=function(t){Jt=t,Bt.setAnimationLoop(t),null===t?ee.stop():ee.start()},Bt.addEventListener("sessionstart",$t),Bt.addEventListener("sessionend",te),this.render=function(t,e){if(void 0===e||!0===e.isCamera){if(!0!==N){if(!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===Bt.enabled&&!0===Bt.isPresenting&&(!0===Bt.cameraAutoUpdate&&Bt.updateCamera(e),e=Bt.getCamera()),!0===t.isScene&&t.onBeforeRender(R,t,e,D),k=Mt.get(t,P.length),k.init(e),P.push(k),nt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),Q.setFromProjectionMatrix(nt),tt=this.localClippingEnabled,$=At.init(this.clippingPlanes,tt),C=St.get(t,L.length),C.init(),L.push(C),!0===Bt.enabled&&!0===Bt.isPresenting){var n=R.xr.getDepthSensingMesh();null!==n&&ne(n,e,-1/0,R.sortObjects)}ne(t,e,0,R.sortObjects),C.finish(),!0===R.sortObjects&&C.sort(X,Y),ot=!1===Bt.enabled||!1===Bt.isPresenting||!1===Bt.hasDepthSensing(),ot&&Tt.addToRenderList(C,t),this.info.render.frame++,!0===$&&At.beginShadows();var i=k.state.shadowsArray;Et.render(i,t,e),!0===$&&At.endShadows(),!0===this.info.autoReset&&this.info.reset();var r=C.opaque,a=C.transmissive;if(k.setupLights(),e.isArrayCamera){var o=e.cameras;if(a.length>0)for(var s=0,l=o.length;s<l;s++){var h=o[s];re(r,a,t,h)}ot&&Tt.render(t);for(var u=0,c=o.length;u<c;u++){var d=o[u];ie(C,t,d,d.viewport)}}else a.length>0&&re(r,a,t,e),ot&&Tt.render(t),ie(C,t,e);null!==D&&0===O&&(pt.updateMultisampleRenderTarget(D),pt.updateRenderTargetMipmap(D)),!0===t.isScene&&t.onAfterRender(R,t,e),Rt.resetDefaultState(),F=-1,U=null,P.pop(),P.length>0?(k=P[P.length-1],!0===$&&At.setGlobalState(R.clippingPlanes,k.state.camera)):k=null,L.pop(),C=L.length>0?L[L.length-1]:null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.getActiveCubeFace=function(){return I},this.getActiveMipmapLevel=function(){return O},this.getRenderTarget=function(){return D},this.setRenderTargetTextures=function(t,e,n){var i=ft.get(t);i.__autoAllocateDepthBuffer=!1===t.resolveDepthBuffer,!1===i.__autoAllocateDepthBuffer&&(i.__useRenderToTexture=!1),ft.get(t.texture).__webglTexture=e,ft.get(t.depthTexture).__webglTexture=i.__autoAllocateDepthBuffer?void 0:n,i.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(t,e){var n=ft.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e};var fe=Ot.createFramebuffer();this.setRenderTarget=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;D=t,I=e,O=n;var i=!0,r=null,a=!1,o=!1;if(t){var s=ft.get(t);if(void 0!==s.__useDefaultFramebuffer)ct.bindFramebuffer(Ot.FRAMEBUFFER,null),i=!1;else if(void 0===s.__webglFramebuffer)pt.setupRenderTarget(t);else if(s.__hasExternalTextures)pt.rebindTextures(t,ft.get(t.texture).__webglTexture,ft.get(t.depthTexture).__webglTexture);else if(t.depthBuffer){var l=t.depthTexture;if(s.__boundDepthTexture!==l){if(null!==l&&ft.has(l)&&(t.width!==l.image.width||t.height!==l.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");pt.setupDepthRenderbuffer(t)}}var h=t.texture;(h.isData3DTexture||h.isDataArrayTexture||h.isCompressedArrayTexture)&&(o=!0);var u=ft.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=Array.isArray(u[e])?u[e][n]:u[e],a=!0):r=t.samples>0&&!1===pt.useMultisampledRTT(t)?ft.get(t).__webglMultisampledFramebuffer:Array.isArray(u)?u[n]:u,q.copy(t.viewport),B.copy(t.scissor),z=t.scissorTest}else q.copy(K).multiplyScalar(W).floor(),B.copy(Z).multiplyScalar(W).floor(),z=J;0!==n&&(r=fe);var c=ct.bindFramebuffer(Ot.FRAMEBUFFER,r);if(c&&i&&ct.drawBuffers(t,r),ct.viewport(q),ct.scissor(B),ct.setScissorTest(z),a){var d=ft.get(t.texture);Ot.framebufferTexture2D(Ot.FRAMEBUFFER,Ot.COLOR_ATTACHMENT0,Ot.TEXTURE_CUBE_MAP_POSITIVE_X+e,d.__webglTexture,n)}else if(o){var f=ft.get(t.texture),p=e;Ot.framebufferTextureLayer(Ot.FRAMEBUFFER,Ot.COLOR_ATTACHMENT0,f.__webglTexture,n,p)}else if(null!==t&&0!==n){var m=ft.get(t.texture);Ot.framebufferTexture2D(Ot.FRAMEBUFFER,Ot.COLOR_ATTACHMENT0,Ot.TEXTURE_2D,m.__webglTexture,n)}F=-1},this.readRenderTargetPixels=function(t,e,n,i,r,a,o){if(t&&t.isWebGLRenderTarget){var s=ft.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(s=s[o]),s){ct.bindFramebuffer(Ot.FRAMEBUFFER,s);try{var l=t.texture,h=l.format,u=l.type;if(!ut.textureFormatReadable(h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!ut.textureTypeReadable(u))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&Ot.readPixels(e,n,i,r,Pt.convert(h),Pt.convert(u),a)}finally{var c=null!==D?ft.get(D).__webglFramebuffer:null;ct.bindFramebuffer(Ot.FRAMEBUFFER,c)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.readRenderTargetPixelsAsync=function(){var t=gt()(c.a.mark((function t(e,n,i,r,a,o,s){var l,h,u,d,f,p,m;return c.a.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(e&&e.isWebGLRenderTarget){t.next=2;break}throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");case 2:if(l=ft.get(e).__webglFramebuffer,e.isWebGLCubeRenderTarget&&void 0!==s&&(l=l[s]),!l){t.next=32;break}if(!(n>=0&&n<=e.width-r&&i>=0&&i<=e.height-a)){t.next=31;break}if(ct.bindFramebuffer(Ot.FRAMEBUFFER,l),h=e.texture,u=h.format,d=h.type,ut.textureFormatReadable(u)){t.next=12;break}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");case 12:if(ut.textureTypeReadable(d)){t.next=14;break}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");case 14:return f=Ot.createBuffer(),Ot.bindBuffer(Ot.PIXEL_PACK_BUFFER,f),Ot.bufferData(Ot.PIXEL_PACK_BUFFER,o.byteLength,Ot.STREAM_READ),Ot.readPixels(n,i,r,a,Pt.convert(u),Pt.convert(d),0),p=null!==D?ft.get(D).__webglFramebuffer:null,ct.bindFramebuffer(Ot.FRAMEBUFFER,p),m=Ot.fenceSync(Ot.SYNC_GPU_COMMANDS_COMPLETE,0),Ot.flush(),t.next=24,ia(Ot,m,4);case 24:return Ot.bindBuffer(Ot.PIXEL_PACK_BUFFER,f),Ot.getBufferSubData(Ot.PIXEL_PACK_BUFFER,0,o),Ot.deleteBuffer(f),Ot.deleteSync(m),t.abrupt("return",o);case 31:throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.");case 32:case"end":return t.stop()}}),t)})));return function(e,n,i,r,a,o,s){return t.apply(this,arguments)}}(),this.copyFramebufferToTexture=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=Math.pow(2,-n),r=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i),o=null!==e?e.x:0,s=null!==e?e.y:0;pt.setTexture2D(t,0),Ot.copyTexSubImage2D(Ot.TEXTURE_2D,n,0,0,o,s,r,a),ct.unbindTexture()};var pe=Ot.createFramebuffer(),me=Ot.createFramebuffer();this.copyTextureToTexture=function(t,e){var n,i,r,a,o,s,l,h,u,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,d=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,f=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,p=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null;null===p&&(0!==f?(na("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),p=f,f=0):p=0);var m=t.isCompressedTexture?t.mipmaps[p]:t.image;if(null!==c)n=c.max.x-c.min.x,i=c.max.y-c.min.y,r=c.isBox3?c.max.z-c.min.z:1,a=c.min.x,o=c.min.y,s=c.isBox3?c.min.z:0;else{var v=Math.pow(2,-f);n=Math.floor(m.width*v),i=Math.floor(m.height*v),r=t.isDataArrayTexture?m.depth:t.isData3DTexture?Math.floor(m.depth*v):1,a=0,o=0,s=0}null!==d?(l=d.x,h=d.y,u=d.z):(l=0,h=0,u=0);var g,y=Pt.convert(e.format),_=Pt.convert(e.type);e.isData3DTexture?(pt.setTexture3D(e,0),g=Ot.TEXTURE_3D):e.isDataArrayTexture||e.isCompressedArrayTexture?(pt.setTexture2DArray(e,0),g=Ot.TEXTURE_2D_ARRAY):(pt.setTexture2D(e,0),g=Ot.TEXTURE_2D),Ot.pixelStorei(Ot.UNPACK_FLIP_Y_WEBGL,e.flipY),Ot.pixelStorei(Ot.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),Ot.pixelStorei(Ot.UNPACK_ALIGNMENT,e.unpackAlignment);var x=Ot.getParameter(Ot.UNPACK_ROW_LENGTH),b=Ot.getParameter(Ot.UNPACK_IMAGE_HEIGHT),w=Ot.getParameter(Ot.UNPACK_SKIP_PIXELS),S=Ot.getParameter(Ot.UNPACK_SKIP_ROWS),M=Ot.getParameter(Ot.UNPACK_SKIP_IMAGES);Ot.pixelStorei(Ot.UNPACK_ROW_LENGTH,m.width),Ot.pixelStorei(Ot.UNPACK_IMAGE_HEIGHT,m.height),Ot.pixelStorei(Ot.UNPACK_SKIP_PIXELS,a),Ot.pixelStorei(Ot.UNPACK_SKIP_ROWS,o),Ot.pixelStorei(Ot.UNPACK_SKIP_IMAGES,s);var A=t.isDataArrayTexture||t.isData3DTexture,E=e.isDataArrayTexture||e.isData3DTexture;if(t.isDepthTexture){var T=ft.get(t),C=ft.get(e),k=ft.get(T.__renderTarget),L=ft.get(C.__renderTarget);ct.bindFramebuffer(Ot.READ_FRAMEBUFFER,k.__webglFramebuffer),ct.bindFramebuffer(Ot.DRAW_FRAMEBUFFER,L.__webglFramebuffer);for(var P=0;P<r;P++)A&&(Ot.framebufferTextureLayer(Ot.READ_FRAMEBUFFER,Ot.COLOR_ATTACHMENT0,ft.get(t).__webglTexture,f,s+P),Ot.framebufferTextureLayer(Ot.DRAW_FRAMEBUFFER,Ot.COLOR_ATTACHMENT0,ft.get(e).__webglTexture,p,u+P)),Ot.blitFramebuffer(a,o,n,i,l,h,n,i,Ot.DEPTH_BUFFER_BIT,Ot.NEAREST);ct.bindFramebuffer(Ot.READ_FRAMEBUFFER,null),ct.bindFramebuffer(Ot.DRAW_FRAMEBUFFER,null)}else if(0!==f||t.isRenderTargetTexture||ft.has(t)){var R=ft.get(t),N=ft.get(e);ct.bindFramebuffer(Ot.READ_FRAMEBUFFER,pe),ct.bindFramebuffer(Ot.DRAW_FRAMEBUFFER,me);for(var I=0;I<r;I++)A?Ot.framebufferTextureLayer(Ot.READ_FRAMEBUFFER,Ot.COLOR_ATTACHMENT0,R.__webglTexture,f,s+I):Ot.framebufferTexture2D(Ot.READ_FRAMEBUFFER,Ot.COLOR_ATTACHMENT0,Ot.TEXTURE_2D,R.__webglTexture,f),E?Ot.framebufferTextureLayer(Ot.DRAW_FRAMEBUFFER,Ot.COLOR_ATTACHMENT0,N.__webglTexture,p,u+I):Ot.framebufferTexture2D(Ot.DRAW_FRAMEBUFFER,Ot.COLOR_ATTACHMENT0,Ot.TEXTURE_2D,N.__webglTexture,p),0!==f?Ot.blitFramebuffer(a,o,n,i,l,h,n,i,Ot.COLOR_BUFFER_BIT,Ot.NEAREST):E?Ot.copyTexSubImage3D(g,p,l,h,u+I,a,o,n,i):Ot.copyTexSubImage2D(g,p,l,h,a,o,n,i);ct.bindFramebuffer(Ot.READ_FRAMEBUFFER,null),ct.bindFramebuffer(Ot.DRAW_FRAMEBUFFER,null)}else E?t.isDataTexture||t.isData3DTexture?Ot.texSubImage3D(g,p,l,h,u,n,i,r,y,_,m.data):e.isCompressedArrayTexture?Ot.compressedTexSubImage3D(g,p,l,h,u,n,i,r,y,m.data):Ot.texSubImage3D(g,p,l,h,u,n,i,r,y,_,m):t.isDataTexture?Ot.texSubImage2D(Ot.TEXTURE_2D,p,l,h,n,i,y,_,m.data):t.isCompressedTexture?Ot.compressedTexSubImage2D(Ot.TEXTURE_2D,p,l,h,m.width,m.height,y,m.data):Ot.texSubImage2D(Ot.TEXTURE_2D,p,l,h,n,i,y,_,m);Ot.pixelStorei(Ot.UNPACK_ROW_LENGTH,x),Ot.pixelStorei(Ot.UNPACK_IMAGE_HEIGHT,b),Ot.pixelStorei(Ot.UNPACK_SKIP_PIXELS,w),Ot.pixelStorei(Ot.UNPACK_SKIP_ROWS,S),Ot.pixelStorei(Ot.UNPACK_SKIP_IMAGES,M),0===p&&e.generateMipmaps&&Ot.generateMipmap(g),ct.unbindTexture()},this.copyTextureToTexture3D=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return na('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(t,e,n,i,r)},this.initRenderTarget=function(t){void 0===ft.get(t).__webglFramebuffer&&pt.setupRenderTarget(t)},this.initTexture=function(t){t.isCubeTexture?pt.setTextureCube(t,0):t.isData3DTexture?pt.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?pt.setTexture2DArray(t,0):pt.setTexture2D(t,0),ct.unbindTexture()},this.resetState=function(){I=0,O=0,D=null,ct.reset(),Rt.reset()},"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}return ht()(t,[{key:"coordinateSystem",get:function(){return pr}},{key:"outputColorSpace",get:function(){return this._outputColorSpace},set:function(t){this._outputColorSpace=t;var e=this.getContext();e.drawingBufferColorSpace=ua._getDrawingBufferColorSpace(t),e.unpackColorSpace=ua._getUnpackColorSpace()}}])}(),tw=Object.defineProperty,ew=(t,e,n)=>e in t?tw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,nw=(t,e,n)=>(ew(t,"symbol"!==typeof e?e+"":e,n),n);function iw(t,e,n,i,r){let a;if(t=t.subarray||t.slice?t:t.buffer,n=n.subarray||n.slice?n:n.buffer,t=e?t.subarray?t.subarray(e,r&&e+r):t.slice(e,r&&e+r):t,n.set)n.set(t,i);else for(a=0;a<t.length;a++)n[a+i]=t[a];return n}function rw(t){return t instanceof Float32Array?t:t instanceof Es?t.getAttribute("position").array:t.map(t=>{const e=Array.isArray(t);return t instanceof Ta?[t.x,t.y,t.z]:t instanceof Xr?[t.x,t.y,0]:e&&3===t.length?[t[0],t[1],t[2]]:e&&2===t.length?[t[0],t[1],0]:t}).flat()}class aw extends Es{constructor(){super(),nw(this,"type","MeshLine"),nw(this,"isMeshLine",!0),nw(this,"positions",[]),nw(this,"previous",[]),nw(this,"next",[]),nw(this,"side",[]),nw(this,"width",[]),nw(this,"indices_array",[]),nw(this,"uvs",[]),nw(this,"counters",[]),nw(this,"widthCallback",null),nw(this,"_attributes"),nw(this,"_points",[]),nw(this,"points"),nw(this,"matrixWorld",new io),Object.defineProperties(this,{points:{enumerable:!0,get(){return this._points},set(t){this.setPoints(t,this.widthCallback)}}})}setMatrixWorld(t){this.matrixWorld=t}setPoints(t,e){if(t=rw(t),this._points=t,this.widthCallback=null!=e?e:null,this.positions=[],this.counters=[],t.length&&t[0]instanceof Ta)for(let n=0;n<t.length;n++){const e=t[n],i=n/(t.length-1);this.positions.push(e.x,e.y,e.z),this.positions.push(e.x,e.y,e.z),this.counters.push(i),this.counters.push(i)}else for(let n=0;n<t.length;n+=3){const e=n/(t.length-1);this.positions.push(t[n],t[n+1],t[n+2]),this.positions.push(t[n],t[n+1],t[n+2]),this.counters.push(e),this.counters.push(e)}this.process()}compareV3(t,e){const n=6*t,i=6*e;return this.positions[n]===this.positions[i]&&this.positions[n+1]===this.positions[i+1]&&this.positions[n+2]===this.positions[i+2]}copyV3(t){const e=6*t;return[this.positions[e],this.positions[e+1],this.positions[e+2]]}process(){const t=this.positions.length/6;let e,n;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],n=this.compareV3(0,t-1)?this.copyV3(t-2):this.copyV3(0),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);for(let i=0;i<t;i++){if(this.side.push(1),this.side.push(-1),e=this.widthCallback?this.widthCallback(i/(t-1)):1,this.width.push(e),this.width.push(e),this.uvs.push(i/(t-1),0),this.uvs.push(i/(t-1),1),i<t-1){n=this.copyV3(i),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);const t=2*i;this.indices_array.push(t,t+1,t+2),this.indices_array.push(t+2,t+1,t+3)}i>0&&(n=this.copyV3(i),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}n=this.compareV3(t-1,0)?this.copyV3(1):this.copyV3(t-1),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]),this._attributes&&this._attributes.position.count===this.counters.length?(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0):this._attributes={position:new hs(new Float32Array(this.positions),3),previous:new hs(new Float32Array(this.previous),3),next:new hs(new Float32Array(this.next),3),side:new hs(new Float32Array(this.side),1),width:new hs(new Float32Array(this.width),1),uv:new hs(new Float32Array(this.uvs),2),index:new hs(new Uint16Array(this.indices_array),1),counters:new hs(new Float32Array(this.counters),1)},this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()}advance({x:t,y:e,z:n}){const i=this._attributes.position.array,r=this._attributes.previous.array,a=this._attributes.next.array,o=i.length;iw(i,0,r,0,o),iw(i,6,i,0,o-6),i[o-6]=t,i[o-5]=e,i[o-4]=n,i[o-3]=t,i[o-2]=e,i[o-1]=n,iw(i,6,a,0,o-6),a[o-6]=t,a[o-5]=e,a[o-4]=n,a[o-3]=t,a[o-2]=e,a[o-1]=n,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0}}const ow="\n #include <common>\n #include <logdepthbuf_pars_vertex>\n #include <fog_pars_vertex>\n #include <clipping_planes_pars_vertex>\n\n attribute vec3 previous;\n attribute vec3 next;\n attribute float side;\n attribute float width;\n attribute float counters;\n \n uniform vec2 resolution;\n uniform float lineWidth;\n uniform vec3 color;\n uniform float opacity;\n uniform float sizeAttenuation;\n \n varying vec2 vUV;\n varying vec4 vColor;\n varying float vCounters;\n \n vec2 fix(vec4 i, float aspect) {\n vec2 res = i.xy / i.w;\n res.x *= aspect;\n return res;\n }\n \n void main() {\n float aspect = resolution.x / resolution.y;\n vColor = vec4(color, opacity);\n vUV = uv;\n vCounters = counters;\n \n mat4 m = projectionMatrix * modelViewMatrix;\n vec4 finalPosition = m * vec4(position, 1.0) * aspect;\n vec4 prevPos = m * vec4(previous, 1.0);\n vec4 nextPos = m * vec4(next, 1.0);\n \n vec2 currentP = fix(finalPosition, aspect);\n vec2 prevP = fix(prevPos, aspect);\n vec2 nextP = fix(nextPos, aspect);\n \n float w = lineWidth * width;\n \n vec2 dir;\n if (nextP == currentP) dir = normalize(currentP - prevP);\n else if (prevP == currentP) dir = normalize(nextP - currentP);\n else {\n vec2 dir1 = normalize(currentP - prevP);\n vec2 dir2 = normalize(nextP - currentP);\n dir = normalize(dir1 + dir2);\n \n vec2 perp = vec2(-dir1.y, dir1.x);\n vec2 miter = vec2(-dir.y, dir.x);\n //w = clamp(w / dot(miter, perp), 0., 4. * lineWidth * width);\n }\n \n //vec2 normal = (cross(vec3(dir, 0.), vec3(0., 0., 1.))).xy;\n vec4 normal = vec4(-dir.y, dir.x, 0., 1.);\n normal.xy *= .5 * w;\n //normal *= projectionMatrix;\n if (sizeAttenuation == 0.) {\n normal.xy *= finalPosition.w;\n normal.xy /= (vec4(resolution, 0., 1.) * projectionMatrix).xy * aspect;\n }\n \n finalPosition.xy += normal.xy * side;\n gl_Position = finalPosition;\n #include <logdepthbuf_vertex>\n #include <fog_vertex>\n vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n }\n",sw=(()=>parseInt(It.replace(/\D+/g,"")))(),lw=sw>=154?"colorspace_fragment":"encodings_fragment",hw=`\n #include <fog_pars_fragment>\n #include <logdepthbuf_pars_fragment>\n #include <clipping_planes_pars_fragment>\n \n uniform sampler2D map;\n uniform sampler2D alphaMap;\n uniform float useGradient;\n uniform float useMap;\n uniform float useAlphaMap;\n uniform float useDash;\n uniform float dashArray;\n uniform float dashOffset;\n uniform float dashRatio;\n uniform float visibility;\n uniform float alphaTest;\n uniform vec2 repeat;\n uniform vec3 gradient[2];\n \n varying vec2 vUV;\n varying vec4 vColor;\n varying float vCounters;\n \n void main() {\n #include <logdepthbuf_fragment>\n vec4 diffuseColor = vColor;\n if (useGradient == 1.) diffuseColor = vec4(mix(gradient[0], gradient[1], vCounters), 1.0);\n if (useMap == 1.) diffuseColor *= texture2D(map, vUV * repeat);\n if (useAlphaMap == 1.) diffuseColor.a *= texture2D(alphaMap, vUV * repeat).a;\n if (diffuseColor.a < alphaTest) discard;\n if (useDash == 1.) diffuseColor.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));\n diffuseColor.a *= step(vCounters, visibility);\n #include <clipping_planes_fragment>\n gl_FragColor = diffuseColor; \n #include <fog_fragment>\n #include <tonemapping_fragment>\n #include <${lw}>\n }\n`;class uw extends Zs{constructor(t){super({uniforms:{...$y.fog,lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new Zo(16777215)},gradient:{value:[new Zo(16711680),new Zo(65280)]},opacity:{value:1},resolution:{value:new Xr(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},useGradient:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new Xr(1,1)}},vertexShader:ow,fragmentShader:hw}),nw(this,"lineWidth"),nw(this,"map"),nw(this,"useMap"),nw(this,"alphaMap"),nw(this,"useAlphaMap"),nw(this,"color"),nw(this,"gradient"),nw(this,"resolution"),nw(this,"sizeAttenuation"),nw(this,"dashArray"),nw(this,"dashOffset"),nw(this,"dashRatio"),nw(this,"useDash"),nw(this,"useGradient"),nw(this,"visibility"),nw(this,"repeat"),this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get(){return this.uniforms.lineWidth.value},set(t){this.uniforms.lineWidth.value=t}},map:{enumerable:!0,get(){return this.uniforms.map.value},set(t){this.uniforms.map.value=t}},useMap:{enumerable:!0,get(){return this.uniforms.useMap.value},set(t){this.uniforms.useMap.value=t}},alphaMap:{enumerable:!0,get(){return this.uniforms.alphaMap.value},set(t){this.uniforms.alphaMap.value=t}},useAlphaMap:{enumerable:!0,get(){return this.uniforms.useAlphaMap.value},set(t){this.uniforms.useAlphaMap.value=t}},color:{enumerable:!0,get(){return this.uniforms.color.value},set(t){this.uniforms.color.value=t}},gradient:{enumerable:!0,get(){return this.uniforms.gradient.value},set(t){this.uniforms.gradient.value=t}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(t){this.uniforms.resolution.value.copy(t)}},sizeAttenuation:{enumerable:!0,get(){return this.uniforms.sizeAttenuation.value},set(t){this.uniforms.sizeAttenuation.value=t}},dashArray:{enumerable:!0,get(){return this.uniforms.dashArray.value},set(t){this.uniforms.dashArray.value=t,this.useDash=0!==t?1:0}},dashOffset:{enumerable:!0,get(){return this.uniforms.dashOffset.value},set(t){this.uniforms.dashOffset.value=t}},dashRatio:{enumerable:!0,get(){return this.uniforms.dashRatio.value},set(t){this.uniforms.dashRatio.value=t}},useDash:{enumerable:!0,get(){return this.uniforms.useDash.value},set(t){this.uniforms.useDash.value=t}},useGradient:{enumerable:!0,get(){return this.uniforms.useGradient.value},set(t){this.uniforms.useGradient.value=t}},visibility:{enumerable:!0,get(){return this.uniforms.visibility.value},set(t){this.uniforms.visibility.value=t}},alphaTest:{enumerable:!0,get(){return this.uniforms.alphaTest.value},set(t){this.uniforms.alphaTest.value=t}},repeat:{enumerable:!0,get(){return this.uniforms.repeat.value},set(t){this.uniforms.repeat.value.copy(t)}}}),this.setValues(t)}copy(t){return super.copy(t),this.lineWidth=t.lineWidth,this.map=t.map,this.useMap=t.useMap,this.alphaMap=t.alphaMap,this.useAlphaMap=t.useAlphaMap,this.color.copy(t.color),this.gradient=t.gradient,this.opacity=t.opacity,this.resolution.copy(t.resolution),this.sizeAttenuation=t.sizeAttenuation,this.dashArray=t.dashArray,this.dashOffset=t.dashOffset,this.dashRatio=t.dashRatio,this.useDash=t.useDash,this.useGradient=t.useGradient,this.visibility=t.visibility,this.alphaTest=t.alphaTest,this.repeat.copy(t.repeat),this}}function cw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function dw(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?cw(Object(n),!0).forEach((function(e){At()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):cw(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var fw={geom_3d:53248,geom_3d_text:53249,geom_3d_mtext:53250,geom_3d_obj:53251,geom_2d:57344,geom_2d_text:57345,geom_2d_mtext:57346,geom_2d_circle:57347,geom_2d_arc:57348,geom_2d_ellipse:57349,geom_2d_ellipseArc:57350,geom_2d_others:57351},pw={};function mw(t,e,n,i,r){for(var a=new sl,o=0;o<t.length;o++)vw(t[o],e);for(var s=function(e){var n,o,s=pw[t[e].drawObject];if(s.MapInstance.forEach((function(n,i){n.instanceId==t[e].instanceId&&(i,o=t[e].drawObject)})),o&&(n=i.getObjectByName(o)),!n){var l,h=pw[t[e].drawObject],u=new sl;u.name=t[e].drawObject,u.userData.isInstancedMeshGroup=!0;var c=h.MapInstance.length;null===(l=h.MapMesh)||void 0===l||l.forEach((function(n){var i=gw(n,u.name,c,r);i&&(h.MapInstance.forEach((function(a,o){if(a.instanceId==t[e].instanceId){var s;i.userData.instanceIndex=o,i.name=t[e].instanceId;var l=null===(s=a.matrix)||void 0===s?void 0:s.val;if(l){var h=new io;h.elements=a.matrix.val,i.setMatrixAt(o,h)}var u=n.prop.color,c=new Zo(r||"rgb(".concat(u[0],", ").concat(u[1],", ").concat(u[2],")"));i.setColorAt(o,c)}})),u.add(i))})),a.add(u)}},l=0;l<t.length;l++)s(l);return a}function vw(t,e){var n=t.drawObject;if(pw[n]){var i=pw[n]["MapInstance"].find((function(e){return e.instanceId==t.instanceId}));i||pw[n]["MapInstance"].push(t)}else pw[n]={MapInstance:[t]},e.forEach((function(t){t.drawObjId==n&&(pw[n].MapMesh=t.geoms)}))}function gw(t,e,n,i){var r;return t.type==fw.geom_2d||t.type==fw.geom_2d_others?r=xw(t,e,n):t.type==fw.geom_2d_text||t.type==fw.geom_2d_mtext||t.type==fw.geom_3d_text||t.type==fw.geom_3d_mtext?r=bw(t,e,n):t.type==fw.geom_2d_circle||t.type==fw.geom_2d_arc||t.type==fw.geom_2d_ellipse||t.type==fw.geom_2d_ellipseArc?r=yw(t,e,n):t.type!=fw.geom_3d&&t.type!=fw.geom_3d_obj||(r=_w(t,e,n,i)),r}function yw(t,e,n){for(var i=t.points,r=t.normals,a=i[0],o=i[1],s=i[2],l=i[3],h=i[4],u=i[5]?i[5]*Math.PI/180:0,c=i[6]?i[6]*Math.PI/180:0,d=new bu(0,0,l,h,u,c,!1),f=d.getPoints(50),p=[],m=0;m<f.length;m++){var v=f[m],g=v.x,y=v.y;p.push(g),p.push(parseFloat(y)),p.push(parseFloat(0))}var _=xw(dw(dw({},t),{},{points:p,normals:r}),e,n),x=new io;return x.identity().makeTranslation(a,o,s),_.applyMatrix4(x),_.userData.instanceName=e,_}function _w(t,e,n,i){var r=t.geometry,a=t.material,o=t.triangles,s=t.points,l=t.normals,h=r||new Es;if(o&&o.length&&h.setIndex(o),s&&s.length){var u=new Float32Array(s);h.setAttribute("position",new hs(u,3))}if(l&&l.length){var c=new Float32Array(l);h.setAttribute("normal",new hs(c,3))}var d,f,p,m=t.prop.color;return p=Array.isArray(m)&&m.length?m:m?m.split(","):[255,255,255,255],d=a||new $c({roughness:.8,envMapIntensity:.5,side:Xt,userData:{nColor:new Zo(i||"rgb(".concat(p[0],", ").concat(p[1],", ").concat(p[2],")"))}}),f=new ih(h,d,n),f.userData.drawObjectId=e,f}function xw(t,e,n){var i=t.points,r=t.normals,a=new Es;if(i&&i.length){var o=new Float32Array(i);a.setAttribute("position",new hs(o,3))}if(r&&r.length){var s=new Float32Array(r);a.setAttribute("normal",new hs(s,3))}var l=t.prop,h=l.color,u=l.linewidth,c=(u<1?50*u:u)||5,d=new uw({color:new Zo("rgb(".concat(h[0],", ").concat(h[1],", ").concat(h[2],")")),lineWidth:c}),f=new aw;f.setPoints(a);var p=_w({prop:t.prop,geometry:f,material:d},e,n);return p.userData.instanceName=e,p}function bw(t,e,n){var i=t.prop,r=t.text,a=t.points,o=t.normals,s=(i.color,i.linewidth,i.fontsize),l=(i.fontname,i.rotate,i.italic,i.widthscale,new nv),h=l.parse(cv),u={font:h,size:s||20,height:1,curveSegments:11,bevelEnabled:!0,bevelThickness:.1,bevelSize:1,depth:1,bevelSegments:1},c=new uv("".concat(r),u),d=_w({prop:i,geometry:c,normals:o},e,n),f=new io;return f.identity().makeTranslation(a[0],a[1],a[2]),d.applyMatrix4(f),d.translateX(-s/2.5),d.translateY(-s/2.5),d.userData.instanceName=e,d}var ww=c.a.mark((function t(e){return c.a.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=3,e;case 3:t.next=0;break;case 5:case"end":return t.stop()}}),t)}))(null),Sw=h()(ww,17),Mw=Sw[0],Aw=Sw[1],Ew=Sw[2],Tw=Sw[3],Cw=Sw[4],kw=Sw[5],Lw=Sw[6],Pw=Sw[7],Rw=Sw[8],Nw=Sw[9],Iw=Sw[10],Ow=Sw[11],Dw=Sw[12],Fw=Sw[13],Uw=Sw[14],qw=Sw[15],Bw=Sw[16],zw=c.a.mark((function t(e){return c.a.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=3,e;case 3:t.next=0;break;case 5:case"end":return t.stop()}}),t)}))(0),Hw=h()(zw,5),Gw=Hw[0],Vw=Hw[1],jw=Hw[2],Ww=Hw[3],Xw=Hw[4],Yw=c.a.mark((function t(e){return c.a.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=3,e;case 3:t.next=0;break;case 5:case"end":return t.stop()}}),t)}))(!1),Kw=h()(Yw,8),Zw=Kw[0],Jw=Kw[1],Qw=Kw[2],$w=Kw[3],tS=Kw[4],eS=Kw[5],nS=Kw[6],iS=Kw[7],rS=c.a.mark((function t(e){return c.a.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=3,e;case 3:t.next=0;break;case 5:case"end":return t.stop()}}),t)}))(!0),aS=h()(rS,1),oS=aS[0],sS=[],lS=200,hS=200,uS={name:"FlModel",props:{data:{type:Object,default:function(){return{}}}},data:function(){return{roamConfig:{loop:!1,speed:0}}},created:function(){at.install({THREE:this.THREE}),jw=new this.THREE.Clock,kw=new this.THREE.Raycaster,Lw=new this.THREE.Vector2},mounted:function(){Cw=document.getElementById("instructions"),this.initRender(),this.initScene(),this.initCamera(),this.initControl(),this.initLight(),this.initLabelRender(),Mw.domElement.addEventListener("mouseup",this.mouseClick,!1),Mw.domElement.addEventListener("mousedown",this.mouseDown,!1),this.animate()},methods:{initRender:function(){Mw=new this.THREE.WebGLRenderer({antialias:!0,alpha:!0,logarithmicDepthBuffer:!0}),Mw.setPixelRatio(2*window.devicePixelRatio),Mw.setSize(window.innerWidth,window.innerHeight),Mw.domElement.id="three-model",Mw.shadowMap.enabled=!0,Mw.outputEncoding=this.THREE.sRGBEncoding,Cw.appendChild(Mw.domElement),Mw.autoClear=!1,Mw.autoClearColor=!1,Mw.autoClearDepth=!1,Mw.autoClearStencil=!1},initScene:function(){Bw=new this.THREE.Group,Aw=new this.THREE.Scene;var t=new this.THREE.Matrix4;t.makeRotationX(-Math.PI/2),Aw.applyMatrix4(t)},initCamera:function(){Ew=new this.THREE.PerspectiveCamera(45,window.innerWidth/window.innerHeight,.1,1e4),Ew.position.set(0,100,150)},initControl:function(){Tw=new at(Ew,Mw.domElement),Tw.dollyToCursor=!0,Tw.smoothTime=.1,Tw.draggingSmoothTime=.05,Tw.truckSpeed=2,Tw.infinityDolly=!0,Tw.minDistance=4},initLight:function(){var t=new this.THREE.PMREMGenerator(Mw);Aw.environment=t.fromScene(new mm,.04).texture},initLabelRender:function(){Pw=new Em,Pw.setSize(Cw.offsetWidth,Cw.offsetHeight),Pw.domElement.style.position="absolute",Pw.domElement.style.top="0px",Pw.domElement.style.pointerEvents="none",Cw.appendChild(Pw.domElement)},drawModel:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(0!==Object.keys(t).length){var n=$m(t),i=n.instances,r=n.drawObjs;i.length>0&&(Bw=mw(i,r,"",Aw,e),Aw.add(Bw),Tw.fitToSphere(Bw,!0),Tw.saveState())}},compileShader:function(){Aw.traverse((function(t){t.isMesh&&(t.material.onBeforeCompile=function(e){var n="\n precision lowp float;\n attribute float visible;\n varying float vVisible;\n void main() {\n vVisible = visible;\n ",i="\n precision lowp float;\n varying float vVisible;\n void main() {\n ",r="\n #include <dithering_fragment>\n if (vVisible > 0.0) {\n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n } else {\n discard;\n }\n ";e.vertexShader=e.vertexShader.replace("void main() {",n),e.fragmentShader=e.fragmentShader.replace("void main() {",i),e.fragmentShader=e.fragmentShader.replace("#include <dithering_fragment>",r),t.material.transparent=!0})}))},mouseDown:function(){Vw=(new Date).getTime()},mouseClick:function(t){if(!iS&&(Gw=(new Date).getTime(),Gw-Vw<300)){Lw.x=t.clientX/Cw.offsetWidth*2-1,Lw.y=-t.clientY/Cw.offsetHeight*2+1,kw.setFromCamera(Lw,Ew);var e=kw.intersectObjects(Aw.children,!0),n={},i={position:{x:Tw.camera.position.x,y:Tw.camera.position.y,z:Tw.camera.position.z},lookAt:{heading:Tw._target.x,pitch:Tw._target.y,roll:Tw._target.z}};n=e.length>0?{objects:[e[0].object],mousePosition:{x:t.clientX,y:t.clientY},camera:i,v3Position:{x:e[0].point.x,y:e[0].point.y,z:e[0].point.z}}:{objects:[],mousePosition:{x:t.clientX,y:t.clientY},camera:i,v3Position:{x:-1,y:-1,z:-1}},0===t.button?this.$emit("leftClick",n):2===t.button&&this.$emit("rightClick",n)}},resize:function(t,e){Ew&&(Ew.aspect=t/e,Ew.updateProjectionMatrix(),Mw.setSize(t,e,!0),Pw.setSize(t,e),qw&&qw.updateParams(t,e))},setModelCenter:function(){},updateProperty:function(t){for(var e=this,n=function(){var n=t[i],r=e.getObjectByName(n.name),a=function(t){switch(t){case"color":r.forEach((function(i){i.isMesh&&(i.setColorAt(i.userData.instanceIndex,new e.THREE.Color(n.attr[t])),i.instanceColor.needsUpdate=!0)}));break;case"visible":r.forEach((function(e){var i=e.userData.instanceIndex;e.geometry.attributes.visible.array[i]=n.attr[t]?1:0,e.geometry.attributes.visible.needsUpdate=!0}));break;case"opacity":obj.material.opacity=n.attr[t],obj.material.transparent=!0;break}};for(var o in n.attr)a(o)},i=0;i<t.length;i++)n()},updateWholeProperty:function(t){var e=this;Aw&&Aw.traverse((function(n){if(n instanceof e.THREE.Mesh){switch(t.attr){case"color":n.material.color=new e.THREE.Color(t.value);break;case"visible":n.material.visible=t.value;break;case"opacity":n.material.opacity=t.value,n.material.transparent=!0;break}n.material.needsUpdate=!0}}))},resetProperty:function(t){for(var e=0;e<t.length;e++){var n=t[e],i=this.getObjectByName(n.name);if(i)for(var r in n.attr)switch(r){case"color":i.forEach((function(t){t.isMesh&&(t.setColorAt(t.userData.instanceIndex,t.material.userData.nColor),t.instanceColor.needsUpdate=!0)}));break}}},locateModel:function(t){var e=Aw.getObjectByName(t);e&&Tw.fitToSphere(e.parent,!0)},cameraLocation:function(t){Tw.setLookAt(t.x,t.y,t.z,t.heading,t.pitch,t.roll,!0),Tw.update(0)},billboard:function(t){var e=new xm(t.billboard);return e.name=t.labelClass,e.position.set(t.x,t.y,t.z),Aw.add(e),e},getObjectByName:function(t){var e=[];return Aw.traverse((function(n){n.name===t&&e.push(n)})),e},getObjectById:function(t){return Aw.getObjectById(t)},removeObjectById:function(t){var e=this.getObjectByName(t);e.forEach((function(e){e.name===t&&(e.material&&e.material.dispose(),e.geometry&&e.geometry.dispose(),e.isMesh&&e.clear(),Aw.remove(e))}))},removeObjectByName:function(t){var e=this.getObjectByName(t);e.forEach((function(e){e.name===t&&(e.material&&e.material.dispose(),e.geometry&&e.geometry.dispose(),e.isMesh&&e.clear(),Aw.remove(e))}))},drawCurve:function(t){var e=this;this.removeObjectByName(t.name);var n=[];if(t.path.forEach((function(t){n.push(new e.THREE.Vector3(t.x,t.y,t.z))})),n.length>1){Nw=new this.THREE.CatmullRomCurve3(n);var i=(new this.THREE.BufferGeometry).setFromPoints(Nw.getPoints(5e3)),r=new this.THREE.LineBasicMaterial({color:t.color,depthTest:!1,transparent:!0}),a=new this.THREE.Line(i,r);a.name=t.name,Aw.add(a)}},drawTextureCurve:function(t){var e=this;this.removeObjectByName(t.name);var n=[];if(t.path.forEach((function(t){n.push(new e.THREE.Vector3(t.x,t.y,t.z))})),n.length>1){Nw=new this.THREE.CatmullRomCurve3(n,!1,"catmullrom",0);var i=new this.THREE.TubeGeometry(Nw,5e3,.5,4);Rw=(new this.THREE.TextureLoader).load("/static/arrow/arrow-right.png"),Rw.wrapS=this.THREE.RepeatWrapping,Rw.wrapT=this.THREE.RepeatWrapping,Rw.repeat.set(20,1),Rw.needsUpdate=!0,Rw.offset.y=.5;var r=new this.THREE.MeshBasicMaterial({map:Rw,side:this.THREE.BackSide,transparent:!0}),a=new this.THREE.Line(i,r);a.name=t.name,Aw.add(a)}},startRoam:function(t){Xw=0,this.roamConfig=Object.assign({},{loop:t.loop,speed:t.speed,roamName:t.name}),this.drawTextureCurve({name:t.name,path:t.path}),Fw=new this.THREE.Clock},pauseRoaming:function(){this.$set(this.roamConfig,"speed",0)},endRoam:function(){Zw=!1,Xw=0,this.removeObjectByName(this.roamConfig.roamName),this.roamConfig=Object.assign({},{loop:!1,speed:0,roamName:""})},cameraTrack:function(){if(Zw){Rw.offset.x-=.05;var t=10/Nw.getLength();if(Xw<=1-t){var e=Nw.getPointAt(Xw),n=Nw.getPointAt(Xw+t);Ew.position.set(e.x,e.y+5,e.z),Ew.lookAt(n.x,n.y+5,n.z),Tw.setPosition(e.x,e.y+5,e.z,!1),Tw.setTarget(n.x,n.y+5,n.z,!1),Xw+=this.roamConfig.speed/300}else this.roamConfig.loop&&(Xw=0)}else Rw=null,this.roamConfig.progress=0},globalBomb:function(t){var e=this;if(0!==Aw.children.length){for(var n=0;n<Aw.children.length;n++)Aw.children[n].traverse((function(n){n.isMesh&&n.worldDir&&e.computedBomb(n,t)}));this.timeRender()}},localBomb:function(t,e){var n=Aw.getObjectById(t);n&&this.computedBomb(n,e)},computedBomb:function(t,e){var n=(new this.THREE.Vector3).copy(t.userData.oldPs).add((new this.THREE.Vector3).copy(t.worldDir).multiplyScalar(e)).add((new this.THREE.Vector3).copy(t.userData.position));t.position.copy(n)},setGlobalClipping:function(){var t=(new this.THREE.Box3).setFromObject(Aw.children[0]),e=t.max,n=t.min,i=[new this.THREE.Plane(new this.THREE.Vector3(-1,0,0),e.x),new this.THREE.Plane(new this.THREE.Vector3(0,-1,0),e.y),new this.THREE.Plane(new this.THREE.Vector3(0,0,-1),e.z)];return Mw.clippingPlanes=i,{min:n,max:e}},updateGlobalCliValue:function(t){var e={x:0,y:1,z:2};for(var n in t)Mw.clippingPlanes[e[n]].constant=t[n]},cancelGlobalClipping:function(){Mw.clippingPlanes=Object.freeze([])},setLocalClipping:function(t){Mw.localClippingEnabled=!0;var e=(new this.THREE.Box3).copy(t.geometry.boundingBox);e.applyMatrix4(t.matrixWorld),sS=[new this.THREE.Plane(new this.THREE.Vector3(-1,0,0),Math.ceil(e.max.x)),new this.THREE.Plane(new this.THREE.Vector3(0,-1,0),Math.ceil(e.max.y)),new this.THREE.Plane(new this.THREE.Vector3(0,0,-1),Math.ceil(e.max.z))],t.material.clippingPlanes=sS,t.material.needsUpdate=!0},updateLocalCliValue:function(t){var e={x:0,y:1,z:2};for(var n in t)sS[e[n]].constant=t[n]},cancelLocalClipping:function(){sS=Object.freeze([])},startFirstPer:function(){Fw=new this.THREE.Clock,Iw=new this.THREE.Raycaster(new this.THREE.Vector3,new this.THREE.Vector3(0,-1,0),0,10),Ow=new this.THREE.Vector3,Dw=new this.THREE.Vector3,Jw=!0,this.initPointerLock()},initPointerLock:function(){var t=this;this.home(),setTimeout((function(){Uw=new Fm(Ew,Mw.domElement),Uw.lock(),Uw.addEventListener("lock",(function(){Tw.enabled=!1,window.addEventListener("keydown",t.onKeyDown,!1),window.addEventListener("keyup",t.onKeyUp,!1),Mw.domElement.removeEventListener("mouseup",t.mouseClick,!1),Mw.domElement.removeEventListener("mousedown",t.mouseDown,!1)})),Uw.addEventListener("unlock",(function(){Jw=!1,Tw.enabled=!0,Tw.reset(!0),Tw.update(0),setTimeout((function(){window.removeEventListener("keydown",t.onKeyDown),window.removeEventListener("keyup",t.onKeyUp),Mw.domElement.addEventListener("mouseup",t.mouseClick,!1),Mw.domElement.addEventListener("mousedown",t.mouseDown,!1)}),0)})),Aw.add(Uw.object)}),10)},firstPerspective:function(){if(!Tw.enabled&&Jw){var t=Uw.object,e=Fw.getDelta();Ow.x-=10*Ow.x*e,Ow.z-=10*Ow.z*e,Ow.y-=9.8*100*e,Dw.z=Number($w)-Number(tS),Dw.x=Number(nS)-Number(eS),Dw.normalize(),($w||tS)&&(Ow.z-=Dw.z*lS*e),(eS||nS)&&(Ow.x-=Dw.x*lS*e),Iw.ray.origin.copy(t.position),Iw.ray.origin.y+=5;var n=Iw.intersectObjects(Aw.children,!0),i=n.length>0;!0===i&&(Ow.y=Math.max(0,Ow.y),Qw=!0),Uw.moveRight(-Ow.x*e),Uw.moveForward(-Ow.z*e),t.position.y+=Ow.y*e,t.position.y<3&&(Ow.y=-0,t.position.y=3,Qw=!0)}},onKeyDown:function(t){if(t.keyCode)switch(t.keyCode){case 38:case 87:$w=!0;break;case 37:case 65:eS=!0;break;case 40:case 83:tS=!0;break;case 39:case 68:nS=!0;break;case 32:Qw&&oS&&(Ow.y+=hS),Qw=!1,oS=!1;break}},onKeyUp:function(t){if(t.keyCode)switch(t.keyCode){case 38:case 87:$w=!1;break;case 37:case 65:eS=!1;break;case 40:case 83:tS=!1;break;case 39:case 68:nS=!1;break;case 32:oS=!0;break}},home:function(){Tw.reset(!0),Tw.update(0)},openMeasure:function(t){switch(qw&&(qw.close(),qw=null),iS=!0,t){case"distance":qw=new Gm.MeasureDistance(Mw,Aw,Ew,Cw.offsetWidth,Cw.offsetHeight),qw.start();break;case"area":qw=new Wm.MeasureArea(Mw,Aw,Ew,Cw.offsetWidth,Cw.offsetHeight),qw.start();break;case"angle":qw=new Km.MeasureAngle(Mw,Aw,Ew,Cw.offsetWidth,Cw.offsetHeight),qw.start();break}},closeMeasure:function(){iS=!1,qw&&(qw.close(),qw=null)},translateMesh:function(t,e){var n=(new this.THREE.Matrix4).makeTranslation(e.x,e.y,e.z),i=(new this.THREE.Matrix4).copy(n).invert();t.userData.translateMatrixInvert&&t.applyMatrix4(t.userData.translateMatrixInvert),t.userData.translateMatrixInvert=i,t.applyMatrix4(n),t.userData.position=(new this.THREE.Vector3).copy(t.position),t.userData.translate=e},rotateMesh:function(t,e){var n=t.userData.center,i=new this.THREE.Vector3(n.x,n.y,n.z).negate(),r=(new this.THREE.Matrix4).makeTranslation(i.x,i.y,i.z),a=(new this.THREE.Matrix4).makeRotationX(e.x*(Math.PI/180)),o=(new this.THREE.Matrix4).makeRotationY(e.y*(Math.PI/180)),s=(new this.THREE.Matrix4).makeRotationZ(e.z*(Math.PI/180)),l=(new this.THREE.Matrix4).multiply(a).multiply(o).multiply(s);t.applyMatrix4(r);var h=(new this.THREE.Matrix4).copy(l).invert();t.userData.combineMatrixInvert&&t.applyMatrix4(t.userData.combineMatrixInvert),t.userData.combineMatrixInvert=h,t.applyMatrix4(l);var u=(new this.THREE.Matrix4).makeTranslation(n.x,n.y,n.z);t.applyMatrix4(u),t.userData.position=(new this.THREE.Vector3).copy(t.position),t.userData.rotate=e},isolate:function(t,e){Aw.traverse((function(n){if(n.isMesh&&n.name!==t.name){switch(e.attr){case"visible":t.material.visible=e.value;break;case"opacity":t.material.opacity=e.value,t.material.transparent=!0;break}n.material.needsUpdate=!0}}))},restore:function(){var t=this;Aw.traverse((function(e){e.isMesh&&(e.material.opacity=1,e.material.visible=!0,e.material.transparent=!0,e.material.color=e.material.userData.nColor,e.material.needsUpdate=!0,e.userData.translate={x:0,y:0,z:0},e.userData.rotate={x:0,y:0,z:0},e.userData.translateMatrixInvert&&(e.applyMatrix4(e.userData.translateMatrixInvert),e.userData.translateMatrixInvert=null),e.userData.combineMatrixInvert&&(t.rotateMesh(e,{x:0,y:0,z:0}),e.userData.combineMatrixInvert=null))}))},animate:function(){var t=jw.getDelta();Ww+=t,requestAnimationFrame(this.animate),Tw.enabled&&Tw.update(Ww),this.cameraTrack(),this.firstPerspective(),Pw.render(Aw,Ew),Mw.render(Aw,Ew)}}},cS=uS;n("0cd6");function dS(t,e,n,i,r,a,o,s){var l,h="function"===typeof t?t.options:t;if(e&&(h.render=e,h.staticRenderFns=n,h._compiled=!0),i&&(h.functional=!0),a&&(h._scopeId="data-v-"+a),o?(l=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(o)},h._ssrRegister=l):r&&(l=s?function(){r.call(this,(h.functional?this.parent:this).$root.$options.shadowRoot)}:r),l)if(h.functional){h._injectStyles=l;var u=h.render;h.render=function(t,e){return l.call(e),u(t,e)}}else{var c=h.beforeCreate;h.beforeCreate=c?[].concat(c,l):[l]}return{exports:t,options:h}}var fS=dS(cS,o,s,!1,null,"9e291ea2",null),pS=fS.exports,mS=function(){var t=this,e=t._self._c;return e("div",{ref:"svgDraw",staticStyle:{height:"100%"},attrs:{id:"konva-container"}})},vS=[],gS=n("362d"),yS=n.n(gS);class _S{constructor(t){this._pointer=0,this._eof=!1,this._data=t}next(){if(!this.hasNext())throw this._eof?new Error("Cannot call 'next' after EOF group has been read"):new Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);const t={code:parseInt(this._data[this._pointer])};return this._pointer++,t.value=xS(t.code,this._data[this._pointer].trim()),this._pointer++,0===t.code&&"EOF"===t.value&&(this._eof=!0),this.lastReadGroup=t,t}peek(){if(!this.hasNext())throw this._eof?new Error("Cannot call 'next' after EOF group has been read"):new Error("Unexpected end of input: EOF group not read before end of file. Ended on code "+this._data[this._pointer]);const t={code:parseInt(this._data[this._pointer])};return t.value=xS(t.code,this._data[this._pointer+1].trim()),t}rewind(t=1){this._pointer=this._pointer-2*t}hasNext(){return!this._eof&&!(this._pointer>this._data.length-2)}isEOF(){return this._eof}}function xS(t,e){return t<=9?e:t>=10&&t<=59?parseFloat(e):t>=60&&t<=99?parseInt(e):t>=100&&t<=109?e:t>=110&&t<=149?parseFloat(e):t>=160&&t<=179?parseInt(e):t>=210&&t<=239?parseFloat(e):t>=270&&t<=289?parseInt(e):t>=290&&t<=299?bS(e):t>=300&&t<=369?e:t>=370&&t<=389?parseInt(e):t>=390&&t<=399?e:t>=400&&t<=409?parseInt(e):t>=410&&t<=419?e:t>=420&&t<=429?parseInt(e):t>=430&&t<=439?e:t>=440&&t<=459?parseInt(e):t>=460&&t<=469?parseFloat(e):t>=470&&t<=481||999===t||t>=1e3&&t<=1009?e:t>=1010&&t<=1059?parseFloat(e):t>=1060&&t<=1071?parseInt(e):(console.log("WARNING: Group code does not have a defined type: %j",{code:t,value:e}),e)}function bS(t){if("0"===t)return!1;if("1"===t)return!0;throw TypeError("String '"+t+"' cannot be cast to Boolean type")}var wS=[0,16711680,16776960,65280,65535,255,16711935,16777215,8421504,12632256,16711680,16744319,13369344,13395558,10027008,10046540,8323072,8339263,4980736,4990502,16727808,16752511,13382400,13401958,10036736,10051404,8331008,8343359,4985600,4992806,16744192,16760703,13395456,13408614,10046464,10056268,8339200,8347455,4990464,4995366,16760576,16768895,13408512,13415014,10056192,10061132,8347392,8351551,4995328,4997670,16776960,16777087,13421568,13421670,10000384,10000460,8355584,8355647,5000192,5000230,12582656,14679935,10079232,11717734,7510016,8755276,6258432,7307071,3755008,4344870,8388352,12582783,6736896,10079334,5019648,7510092,4161280,6258495,2509824,3755046,4194048,10485631,3394560,8375398,2529280,6264908,2064128,5209919,1264640,3099686,65280,8388479,52224,6736998,38912,5019724,32512,4161343,19456,2509862,65343,8388511,52275,6737023,38950,5019743,32543,4161359,19475,2509871,65407,8388543,52326,6737049,38988,5019762,32575,4161375,19494,2509881,65471,8388575,52377,6737074,39026,5019781,32607,4161391,19513,2509890,65535,8388607,52428,6737100,39064,5019800,32639,4161407,19532,2509900,49151,8380415,39372,6730444,29336,5014936,24447,4157311,14668,2507340,32767,8372223,26316,6724044,19608,5010072,16255,4153215,9804,2505036,16383,8364031,13260,6717388,9880,5005208,8063,4149119,4940,2502476,255,8355839,204,6710988,152,5000344,127,4145023,76,2500172,4129023,10452991,3342540,8349388,2490520,6245528,2031743,5193599,1245260,3089996,8323327,12550143,6684876,10053324,4980888,7490712,4128895,6242175,2490444,3745356,12517631,14647295,10027212,11691724,7471256,8735896,6226047,7290751,3735628,4335180,16711935,16744447,13369548,13395660,9961624,9981080,8323199,8339327,4980812,4990540,16711871,16744415,13369497,13395634,9961586,9981061,8323167,8339311,4980793,4990530,16711807,16744383,13369446,13395609,9961548,9981042,8323135,8339295,4980774,4990521,16711743,16744351,13369395,13395583,9961510,9981023,8323103,8339279,4980755,4990511,3355443,5987163,8684676,11382189,14079702,16777215];function SS(t){return wS[t]}function MS(t){const e={};t.rewind();let n=t.next(),i=n.code;if(e.x=n.value,i+=10,n=t.next(),n.code!=i)throw new Error("Expected code for point value to be "+i+" but got "+n.code+".");return e.y=n.value,i+=10,n=t.next(),n.code!=i?(t.rewind(),e):(e.z=n.value,e)}function AS(t,e,n){switch(e.code){case 0:t.type=e.value;break;case 5:t.handle=e.value;break;case 6:t.lineType=e.value;break;case 8:t.layer=e.value;break;case 48:t.lineTypeScale=e.value;break;case 60:t.visible=0===e.value;break;case 62:t.colorIndex=e.value,t.color=SS(Math.abs(e.value));break;case 67:t.inPaperSpace=0!==e.value;break;case 100:break;case 101:while(0!=e.code)e=n.next();n.rewind();break;case 330:t.ownerHandle=e.value;break;case 347:t.materialObjectHandle=e.value;break;case 370:t.lineweight=e.value;break;case 420:t.color=e.value;break;case 1e3:t.extendedData=t.extendedData||{},t.extendedData.customStrings=t.extendedData.customStrings||[],t.extendedData.customStrings.push(e.value);break;case 1001:t.extendedData=t.extendedData||{},t.extendedData.applicationName=e.value;break;default:return!1}return!0}class ES{constructor(){this.ForEntityName="3DFACE"}parseEntity(t,e){const n={type:e.value,vertices:[]};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 70:n.shape=1===(1&e.value),n.hasContinuousLinetypePattern=128===(128&e.value);break;case 10:n.vertices=TS(t,e),e=t.lastReadGroup;break;default:AS(n,e,t);break}e=t.next()}return n}}function TS(t,e){var n=[],i=!1,r=!1,a=4;for(let s=0;s<=a;s++){var o={};while(!t.isEOF()){if(0===e.code||r)break;switch(e.code){case 10:case 11:case 12:case 13:if(i){r=!0;continue}o.x=e.value,i=!0;break;case 20:case 21:case 22:case 23:o.y=e.value;break;case 30:case 31:case 32:case 33:o.z=e.value;break;default:return n}e=t.next()}n.push(o),i=!1,r=!1}return t.rewind(),n}class CS{constructor(){this.ForEntityName="ARC"}parseEntity(t,e){const n={type:e.value};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:n.center=MS(t);break;case 40:n.radius=e.value;break;case 50:n.startAngle=Math.PI/180*e.value;break;case 51:n.endAngle=Math.PI/180*e.value,n.angleLength=n.endAngle-n.startAngle;break;case 210:n.extrusionDirectionX=e.value;break;case 220:n.extrusionDirectionY=e.value;break;case 230:n.extrusionDirectionZ=e.value;break;default:AS(n,e,t);break}e=t.next()}return n}}class kS{constructor(){this.ForEntityName="ATTDEF"}parseEntity(t,e){var n={type:e.value,scale:1,textStyle:"STANDARD"};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 1:n.text=e.value;break;case 2:n.tag=e.value;break;case 3:n.prompt=e.value;break;case 7:n.textStyle=e.value;break;case 10:n.startPoint=MS(t);break;case 11:n.endPoint=MS(t);break;case 39:n.thickness=e.value;break;case 40:n.textHeight=e.value;break;case 41:n.scale=e.value;break;case 50:n.rotation=e.value;break;case 51:n.obliqueAngle=e.value;break;case 70:n.invisible=!!(1&e.value),n.constant=!!(2&e.value),n.verificationRequired=!!(4&e.value),n.preset=!!(8&e.value);break;case 71:n.backwards=!!(2&e.value),n.mirrored=!!(4&e.value);break;case 72:n.horizontalJustification=e.value;break;case 73:n.fieldLength=e.value;break;case 74:n.verticalJustification=e.value;break;case 100:break;case 210:n.extrusionDirectionX=e.value;break;case 220:n.extrusionDirectionY=e.value;break;case 230:n.extrusionDirectionZ=e.value;break;default:AS(n,e,t);break}e=t.next()}return n}}class LS{constructor(){this.ForEntityName="CIRCLE"}parseEntity(t,e){const n={type:e.value};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:n.center=MS(t);break;case 40:n.radius=e.value;break;case 50:n.startAngle=Math.PI/180*e.value;break;case 51:const i=Math.PI/180*e.value;i<n.startAngle?n.angleLength=i+2*Math.PI-n.startAngle:n.angleLength=i-n.startAngle,n.endAngle=i;break;default:AS(n,e,t);break}e=t.next()}return n}}class PS{constructor(){this.ForEntityName="DIMENSION"}parseEntity(t,e){const n={type:e.value};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 2:n.block=e.value;break;case 10:n.anchorPoint=MS(t);break;case 11:n.middleOfText=MS(t);break;case 12:n.insertionPoint=MS(t);break;case 13:n.linearOrAngularPoint1=MS(t);break;case 14:n.linearOrAngularPoint2=MS(t);break;case 15:n.diameterOrRadiusPoint=MS(t);break;case 16:n.arcPoint=MS(t);break;case 70:n.dimensionType=e.value;break;case 71:n.attachmentPoint=e.value;break;case 42:n.actualMeasurement=e.value;break;case 1:n.text=e.value;break;case 50:n.angle=e.value;break;default:AS(n,e,t);break}e=t.next()}return n}}class RS{constructor(){this.ForEntityName="ELLIPSE"}parseEntity(t,e){const n={type:e.value};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:n.center=MS(t);break;case 11:n.majorAxisEndPoint=MS(t);break;case 40:n.axisRatio=e.value;break;case 41:n.startAngle=e.value;break;case 42:n.endAngle=e.value;break;case 2:n.name=e.value;break;default:AS(n,e,t);break}e=t.next()}return n}}class NS{constructor(){this.ForEntityName="INSERT"}parseEntity(t,e){const n={type:e.value};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 2:n.name=e.value;break;case 41:n.xScale=e.value;break;case 42:n.yScale=e.value;break;case 43:n.zScale=e.value;break;case 10:n.position=MS(t);break;case 50:n.rotation=e.value;break;case 70:n.columnCount=e.value;break;case 71:n.rowCount=e.value;break;case 44:n.columnSpacing=e.value;break;case 45:n.rowSpacing=e.value;break;case 210:n.extrusionDirection=MS(t);break;default:AS(n,e,t);break}e=t.next()}return n}}class IS{constructor(){this.ForEntityName="LINE"}parseEntity(t,e){const n={type:e.value,vertices:[]};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:n.vertices.unshift(MS(t));break;case 11:n.vertices.push(MS(t));break;case 210:n.extrusionDirection=MS(t);break;case 100:break;default:AS(n,e,t);break}e=t.next()}return n}}class OS{constructor(){this.ForEntityName="LWPOLYLINE"}parseEntity(t,e){const n={type:e.value,vertices:[]};let i=0;e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 38:n.elevation=e.value;break;case 39:n.depth=e.value;break;case 70:n.shape=1===(1&e.value),n.hasContinuousLinetypePattern=128===(128&e.value);break;case 90:i=e.value;break;case 10:n.vertices=DS(i,t);break;case 43:0!==e.value&&(n.width=e.value);break;case 210:n.extrusionDirectionX=e.value;break;case 220:n.extrusionDirectionY=e.value;break;case 230:n.extrusionDirectionZ=e.value;break;default:AS(n,e,t);break}e=t.next()}return n}}function DS(t,e){if(!t||t<=0)throw Error("n must be greater than 0 verticies");const n=[];let i=!1,r=!1,a=e.lastReadGroup;for(let o=0;o<t;o++){const t={};while(!e.isEOF()){if(0===a.code||r)break;switch(a.code){case 10:if(i){r=!0;continue}t.x=a.value,i=!0;break;case 20:t.y=a.value;break;case 30:t.z=a.value;break;case 40:t.startWidth=a.value;break;case 41:t.endWidth=a.value;break;case 42:0!=a.value&&(t.bulge=a.value);break;default:return e.rewind(),i&&n.push(t),e.rewind(),n}a=e.next()}n.push(t),i=!1,r=!1}return e.rewind(),n}class FS{constructor(){this.ForEntityName="MTEXT"}parseEntity(t,e){const n={type:e.value};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 3:n.text?n.text+=e.value:n.text=e.value;break;case 1:n.text?n.text+=e.value:n.text=e.value;break;case 10:n.position=MS(t);break;case 11:n.directionVector=MS(t);break;case 40:n.height=e.value;break;case 41:n.width=e.value;break;case 50:n.rotation=e.value;break;case 71:n.attachmentPoint=e.value;break;case 72:n.drawingDirection=e.value;break;default:AS(n,e,t);break}e=t.next()}return n}}class US{constructor(){this.ForEntityName="POINT"}parseEntity(t,e){const n=e.value,i={type:n};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:i.position=MS(t);break;case 39:i.thickness=e.value;break;case 210:i.extrusionDirection=MS(t);break;case 100:break;default:AS(i,e,t);break}e=t.next()}return i}}class qS{constructor(){this.ForEntityName="VERTEX"}parseEntity(t,e){var n={type:e.value};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:n.x=e.value;break;case 20:n.y=e.value;break;case 30:n.z=e.value;break;case 40:break;case 41:break;case 42:0!=e.value&&(n.bulge=e.value);break;case 70:n.curveFittingVertex=0!==(1&e.value),n.curveFitTangent=0!==(2&e.value),n.splineVertex=0!==(8&e.value),n.splineControlPoint=0!==(16&e.value),n.threeDPolylineVertex=0!==(32&e.value),n.threeDPolylineMesh=0!==(64&e.value),n.polyfaceMeshVertex=0!==(128&e.value);break;case 50:break;case 71:n.faceA=e.value;break;case 72:n.faceB=e.value;break;case 73:n.faceC=e.value;break;case 74:n.faceD=e.value;break;default:AS(n,e,t);break}e=t.next()}return n}}class BS{constructor(){this.ForEntityName="POLYLINE"}parseEntity(t,e){var n={type:e.value,vertices:[]};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:break;case 20:break;case 30:break;case 39:n.thickness=e.value;break;case 40:break;case 41:break;case 70:n.shape=0!==(1&e.value),n.includesCurveFitVertices=0!==(2&e.value),n.includesSplineFitVertices=0!==(4&e.value),n.is3dPolyline=0!==(8&e.value),n.is3dPolygonMesh=0!==(16&e.value),n.is3dPolygonMeshClosed=0!==(32&e.value),n.isPolyfaceMesh=0!==(64&e.value),n.hasContinuousLinetypePattern=0!==(128&e.value);break;case 71:break;case 72:break;case 73:break;case 74:break;case 75:break;case 210:n.extrusionDirection=MS(t);break;default:AS(n,e,t);break}e=t.next()}return n.vertices=zS(t,e),n}}function zS(t,e){const n=new qS,i=[];while(!t.isEOF())if(0===e.code)if("VERTEX"===e.value)i.push(n.parseEntity(t,e)),e=t.lastReadGroup;else if("SEQEND"===e.value){HS(t,e);break}return i}function HS(t,e){const n={type:e.value};e=t.next();while(!t.isEOF()){if(0==e.code)break;AS(n,e,t),e=t.next()}return n}class GS{constructor(){this.ForEntityName="SOLID"}parseEntity(t,e){const n={type:e.value,points:[]};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:n.points[0]=MS(t);break;case 11:n.points[1]=MS(t);break;case 12:n.points[2]=MS(t);break;case 13:n.points[3]=MS(t);break;case 210:n.extrusionDirection=MS(t);break;default:AS(n,e,t);break}e=t.next()}return n}}class VS{constructor(){this.ForEntityName="SPLINE"}parseEntity(t,e){const n={type:e.value};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:n.controlPoints||(n.controlPoints=[]),n.controlPoints.push(MS(t));break;case 11:n.fitPoints||(n.fitPoints=[]),n.fitPoints.push(MS(t));break;case 12:n.startTangent=MS(t);break;case 13:n.endTangent=MS(t);break;case 40:n.knotValues||(n.knotValues=[]),n.knotValues.push(e.value);break;case 70:0!=(1&e.value)&&(n.closed=!0),0!=(2&e.value)&&(n.periodic=!0),0!=(4&e.value)&&(n.rational=!0),0!=(8&e.value)&&(n.planar=!0),0!=(16&e.value)&&(n.planar=!0,n.linear=!0);break;case 71:n.degreeOfSplineCurve=e.value;break;case 72:n.numberOfKnots=e.value;break;case 73:n.numberOfControlPoints=e.value;break;case 74:n.numberOfFitPoints=e.value;break;case 210:n.normalVector=MS(t);break;default:AS(n,e,t);break}e=t.next()}return n}}class jS{constructor(){this.ForEntityName="TEXT"}parseEntity(t,e){const n={type:e.value};e=t.next();while(!t.isEOF()){if(0===e.code)break;switch(e.code){case 10:n.startPoint=MS(t);break;case 11:n.endPoint=MS(t);break;case 40:n.textHeight=e.value;break;case 41:n.xScale=e.value;break;case 50:n.rotation=e.value;break;case 1:n.text=e.value;break;case 72:n.halign=e.value;break;case 73:n.valign=e.value;break;default:AS(n,e,t);break}e=t.next()}return n}}var WS=n("5c7d"),XS=n.n(WS);function YS(t){t.registerEntityHandler(ES),t.registerEntityHandler(CS),t.registerEntityHandler(kS),t.registerEntityHandler(LS),t.registerEntityHandler(PS),t.registerEntityHandler(RS),t.registerEntityHandler(NS),t.registerEntityHandler(IS),t.registerEntityHandler(OS),t.registerEntityHandler(FS),t.registerEntityHandler(US),t.registerEntityHandler(BS),t.registerEntityHandler(GS),t.registerEntityHandler(VS),t.registerEntityHandler(jS)}XS.a.setLevel("error");class KS{constructor(){this._entityHandlers={},YS(this)}parse(t){return"string"===typeof t?this._parse(t):(console.error("Cannot read dxf source of type `"+typeof t),null)}registerEntityHandler(t){const e=new t;this._entityHandlers[e.ForEntityName]=e}parseSync(t){return this.parse(t)}parseStream(t){let e="";const n=this;return new Promise((i,r)=>{t.on("data",t=>{e+=t}),t.on("end",()=>{try{i(n._parse(e))}catch(t){r(t)}}),t.on("error",t=>{r(t)})})}_parse(t){const e={};let n=0;const i=t.split(/\r\n|\r|\n/g),r=new _S(i);if(!r.hasNext())throw Error("Empty file");const a=this;let o;function s(){o=r.next();while(!r.isEOF())if(0===o.code&&"SECTION"===o.value){if(o=r.next(),2!==o.code){console.error("Unexpected code %s after 0:SECTION",QS(o)),o=r.next();continue}"HEADER"===o.value?(XS.a.debug("> HEADER"),e.header=l(),XS.a.debug("<")):"BLOCKS"===o.value?(XS.a.debug("> BLOCKS"),e.blocks=h(),XS.a.debug("<")):"ENTITIES"===o.value?(XS.a.debug("> ENTITIES"),e.entities=y(!1),XS.a.debug("<")):"TABLES"===o.value?(XS.a.debug("> TABLES"),e.tables=c(),XS.a.debug("<")):"EOF"===o.value?XS.a.debug("EOF"):XS.a.warn("Skipping section '%s'",o.value)}else o=r.next()}function l(){let t=null,e=null;const n={};o=r.next();while(1){if(ZS(o,0,"ENDSEC")){t&&(n[t]=e);break}9===o.code?(t&&(n[t]=e),t=o.value):10===o.code?e={x:o.value}:20===o.code?e.y=o.value:30===o.code?e.z=o.value:e=o.value,o=r.next()}return o=r.next(),n}function h(){const t={};o=r.next();while("EOF"!==o.value){if(ZS(o,0,"ENDSEC"))break;if(ZS(o,0,"BLOCK")){XS.a.debug("block {");const e=u();XS.a.debug("}"),x(e),e.name?t[e.name]=e:XS.a.error('block with handle "'+e.handle+'" is missing a name.')}else JS(o),o=r.next()}return t}function u(){const t={};o=r.next();while("EOF"!==o.value){switch(o.code){case 1:t.xrefPath=o.value,o=r.next();break;case 2:t.name=o.value,o=r.next();break;case 3:t.name2=o.value,o=r.next();break;case 5:t.handle=o.value,o=r.next();break;case 8:t.layer=o.value,o=r.next();break;case 10:t.position=_(o),o=r.next();break;case 67:t.paperSpace=!(!o.value||1!=o.value),o=r.next();break;case 70:0!=o.value&&(t.type=o.value),o=r.next();break;case 100:o=r.next();break;case 330:t.ownerHandle=o.value,o=r.next();break;case 0:if("ENDBLK"==o.value)break;t.entities=y(!0);break;default:JS(o),o=r.next()}if(ZS(o,0,"ENDBLK")){o=r.next();break}}return t}function c(){const t={};o=r.next();while("EOF"!==o.value){if(ZS(o,0,"ENDSEC"))break;if(ZS(o,0,"TABLE")){o=r.next();const e=g[o.value];e?(XS.a.debug(o.value+" Table {"),t[g[o.value].tableName]=f(o),XS.a.debug("}")):XS.a.debug("Unhandled Table "+o.value)}else o=r.next()}return o=r.next(),t}const d="ENDTAB";function f(t){const e=g[t.value],n={};let i=0;o=r.next();while(!ZS(o,0,d))switch(o.code){case 5:n.handle=o.value,o=r.next();break;case 330:n.ownerHandle=o.value,o=r.next();break;case 100:"AcDbSymbolTable"===o.value||JS(o),o=r.next();break;case 70:i=o.value,o=r.next();break;case 0:o.value===e.dxfSymbolName?n[e.tableRecordsProperty]=e.parseTableRecords():(JS(o),o=r.next());break;default:JS(o),o=r.next()}const a=n[e.tableRecordsProperty];if(a){let t=(()=>a.constructor===Array?a.length:"object"===typeof a?Object.keys(a).length:void 0)();i!==t&&XS.a.warn("Parsed "+t+" "+e.dxfSymbolName+"'s but expected "+i)}return o=r.next(),n}function p(){const t=[];let e={};XS.a.debug("ViewPort {"),o=r.next();while(!ZS(o,0,d))switch(o.code){case 2:e.name=o.value,o=r.next();break;case 10:e.lowerLeftCorner=_(o),o=r.next();break;case 11:e.upperRightCorner=_(o),o=r.next();break;case 12:e.center=_(o),o=r.next();break;case 13:e.snapBasePoint=_(o),o=r.next();break;case 14:e.snapSpacing=_(o),o=r.next();break;case 15:e.gridSpacing=_(o),o=r.next();break;case 16:e.viewDirectionFromTarget=_(o),o=r.next();break;case 17:e.viewTarget=_(o),o=r.next();break;case 42:e.lensLength=o.value,o=r.next();break;case 43:e.frontClippingPlane=o.value,o=r.next();break;case 44:e.backClippingPlane=o.value,o=r.next();break;case 45:e.viewHeight=o.value,o=r.next();break;case 50:e.snapRotationAngle=o.value,o=r.next();break;case 51:e.viewTwistAngle=o.value,o=r.next();break;case 79:e.orthographicType=o.value,o=r.next();break;case 110:e.ucsOrigin=_(o),o=r.next();break;case 111:e.ucsXAxis=_(o),o=r.next();break;case 112:e.ucsYAxis=_(o),o=r.next();break;case 110:e.ucsOrigin=_(o),o=r.next();break;case 281:e.renderMode=o.value,o=r.next();break;case 281:e.defaultLightingType=o.value,o=r.next();break;case 292:e.defaultLightingOn=o.value,o=r.next();break;case 330:e.ownerHandle=o.value,o=r.next();break;case 63:case 421:case 431:e.ambientColor=o.value,o=r.next();break;case 0:"VPORT"===o.value&&(XS.a.debug("}"),t.push(e),XS.a.debug("ViewPort {"),e={},o=r.next());break;default:JS(o),o=r.next();break}return XS.a.debug("}"),t.push(e),t}function m(){const t={};let e,n={},i=0;XS.a.debug("LType {"),o=r.next();while(!ZS(o,0,"ENDTAB"))switch(o.code){case 2:n.name=o.value,e=o.value,o=r.next();break;case 3:n.description=o.value,o=r.next();break;case 73:i=o.value,i>0&&(n.pattern=[]),o=r.next();break;case 40:n.patternLength=o.value,o=r.next();break;case 49:n.pattern.push(o.value),o=r.next();break;case 0:XS.a.debug("}"),i>0&&i!==n.pattern.length&&XS.a.warn("lengths do not match on LTYPE pattern"),t[e]=n,n={},XS.a.debug("LType {"),o=r.next();break;default:o=r.next()}return XS.a.debug("}"),t[e]=n,t}function v(){const t={};let e,n={};XS.a.debug("Layer {"),o=r.next();while(!ZS(o,0,"ENDTAB"))switch(o.code){case 2:n.name=o.value,e=o.value,o=r.next();break;case 62:n.visible=o.value>=0,n.colorIndex=Math.abs(o.value),n.color=$S(n.colorIndex),o=r.next();break;case 70:n.frozen=0!=(1&o.value)||0!=(2&o.value),o=r.next();break;case 0:"LAYER"===o.value&&(XS.a.debug("}"),t[e]=n,XS.a.debug("Layer {"),n={},e=void 0,o=r.next());break;default:JS(o),o=r.next();break}return XS.a.debug("}"),t[e]=n,t}const g={VPORT:{tableRecordsProperty:"viewPorts",tableName:"viewPort",dxfSymbolName:"VPORT",parseTableRecords:p},LTYPE:{tableRecordsProperty:"lineTypes",tableName:"lineType",dxfSymbolName:"LTYPE",parseTableRecords:m},LAYER:{tableRecordsProperty:"layers",tableName:"layer",dxfSymbolName:"LAYER",parseTableRecords:v}};function y(t){const e=[],n=t?"ENDBLK":"ENDSEC";t||(o=r.next());while(1)if(0===o.code){if(o.value===n)break;const t=a._entityHandlers[o.value];if(null==t){XS.a.warn("Unhandled entity "+o.value),o=r.next();continue}{XS.a.debug(o.value+" {");const n=t.parseEntity(r,o);o=r.lastReadGroup,XS.a.debug("}"),x(n),e.push(n)}}else o=r.next();return"ENDSEC"==n&&(o=r.next()),e}function _(t){const e={};let n=t.code;if(e.x=t.value,n+=10,t=r.next(),t.code!=n)throw new Error("Expected code for point value to be "+n+" but got "+t.code+".");return e.y=t.value,n+=10,t=r.next(),t.code!=n?(r.rewind(),e):(e.z=t.value,e)}function x(t){if(!t)throw new TypeError("entity cannot be undefined or null");t.handle||(t.handle=n++)}return s(),e}}function ZS(t,e,n){return t.code===e&&t.value===n}function JS(t){XS.a.debug("unhandled group "+QS(t))}function QS(t){return t.code+":"+t.value}function $S(t){return wS[t]}var tM=KS,eM=n("8baf"),nM=(n("7037"),function(t,e){return"undefined"===typeof e||0===+e?Math.round(t):(t=+t,e=+e,isNaN(t)||"number"!==typeof e||e%1!==0?NaN:(t=t.toString().split("e"),t=Math.round(+(t[0]+"e"+(t[1]?+t[1]-e:-e))),t=t.toString().split("e"),+(t[0]+"e"+(t[1]?+t[1]+e:e))))}),iM=function(t,e,n,i,r){var a=n.length,o=n[0].length;if(t<0||t>1)throw new Error("t out of bounds [0,1]: "+t);if(e<1)throw new Error("degree must be at least 1 (linear)");if(e>a-1)throw new Error("degree must be less than or equal to point count - 1");if(!r){r=[];for(var s=0;s<a;s++)r[s]=1}if(i){if(i.length!==a+e+1)throw new Error("bad knot vector length")}else{i=[];for(var l=0;l<a+e+1;l++)i[l]=l}var h,u=[e,i.length-1-e],c=i[u[0]],d=i[u[1]];for(t=t*(d-c)+c,t=Math.max(t,c),t=Math.min(t,d),h=u[0];h<u[1];h++)if(t>=i[h]&&t<=i[h+1])break;for(var f,p=[],m=0;m<a;m++){p[m]=[];for(var v=0;v<o;v++)p[m][v]=n[m][v]*r[m];p[m][o]=r[m]}for(var g=1;g<=e+1;g++)for(var y=h;y>h-e-1+g;y--){f=(t-i[y])/(i[y+e+1-g]-i[y]);for(var _=0;_<o+1;_++)p[y][_]=(1-f)*p[y-1][_]+f*p[y][_]}for(var x=[],b=0;b<o;b++)x[b]=nM(p[h][b]/p[h][o],-9);return x};function rM(t,e,n,i,r,a,o){switch(t){case"LINE":hM(e,n,i,r,a);break;case"TEXT":uM(e,n,i,r,a);break;case"LWPOLYLINE":cM(e,n,i,r,a);break;case"ARC":sM(e,n,i,r,a);break;case"CIRCLE":sM(e,n,i,r,a);break;case"ELLIPSE":lM(e,n,i,r,a);break;case"SPLINE":dM(e,n,i,r,a);break}}function aM(t){for(var e={},n=0;n<t.length;n++)e.hasOwnProperty(t[n].layer)||(e[t[n].layer]=[]),e[t[n].layer].push(t[n]);return e}function oM(t,e,n,i,r){for(var a=[],o=t.map((function(t){return[t.x,t.y]})),s=[n[e]],l=[n[e],n[n.length-1-e]],h=e+1;h<n.length-e;++h)s[s.length-1]!==n[h]&&s.push(n[h]);i=i||25;for(var u=1;u<s.length;++u)for(var c=s[u-1],d=s[u],f=0;f<=i;++f){var p=f/i*(d-c)+c,m=(p-l[0])/(l[1]-l[0]);m=Math.max(m,0),m=Math.min(m,1);var v=iM(m,e,o,n,r);a.push(new Xr(v[0],v[1]))}return a}function sM(t,e,n,i,r){var a,o;"CIRCLE"===e.type?(a=e.startAngle||0,o=a+2*Math.PI):(a=e.startAngle,o=e.endAngle);for(var s=new wu(e.center.x,parseFloat(e.center.y),e.radius,a,o),l=s.getPoints(32),h=[],u=0;u<l.length;u++)h.push(l[u].x),h.push(-parseFloat(l[u].y));var c=.2;n.push({type:"polyline",points:h,name:i.replace(/\s*/g,""),entityId:i,stroke:r?r.color:"#000",customColor:r?r.color:"",strokeWidth:c,visible:!r||r.visible,oldstrokeLength:c})}function lM(t,e,n,i,r){for(var a=Math.sqrt(Math.pow(parseFloat(e.majorAxisEndPoint.x),2)+Math.pow(parseFloat(e.majorAxisEndPoint.y),2)),o=a*parseFloat(e.axisRatio),s=Math.atan2(parseFloat(e.majorAxisEndPoint.y),parseFloat(e.majorAxisEndPoint.x)),l=new bu(parseFloat(e.center.x),parseFloat(e.center.y),a,o,parseFloat(e.startAngle),parseFloat(e.endAngle),!1,s),h=l.getPoints(200),u=[],c=0;c<h.length;c++)u.push(h[c].x),u.push(-parseFloat(h[c].y));var d=.2;n.push({type:"polyline",points:u,name:i.replace(/\s*/g,""),entityId:i,stroke:r?r.color:"#000",customColor:r?r.color:"",strokeWidth:d,visible:!r||r.visible,oldstrokeLength:d})}function hM(t,e,n,i,r){var a=e.vertices[0].x,o=e.vertices[0].y,s=e.vertices[1].x,l=e.vertices[1].y,h=.2;n.push({type:"line",x1:a,x2:s,y1:o,y2:l,name:i.replace(/\s*/g,""),entityId:i,isGroup:!1,stroke:r?r.color:"#000",customColor:r?r.color:"",strokeWidth:h,visible:!r||r.visible,oldstrokeLength:h})}function uM(t,e,n,i,r){var a=e.text,o=0;o=e.textHeight+.35;var s=e.startPoint,l=s.x,h=s.y,u=new Konva.Text({x:parseFloat(l),y:-parseFloat(h),text:a,fontSize:o,fill:r?r.color:"#000",customColor:r?r.color:"",name:i.replace(/\s*/g,""),entityId:i,fontFamily:"SimSun",visible:!r||r.visible,stroke:r?r.color:"#000",strokeWidth:.1});e.rotation?(90!=e.rotation&&90!=parseInt(e.rotation)&&89!=parseInt(e.rotation)&&450!=parseInt(e.rotation)||(u.attrs.x=parseFloat(l)-o),270!=e.rotation&&270!=parseInt(e.rotation)||(u.attrs.x=parseFloat(l)+o),180!=e.rotation&&180!=parseInt(e.rotation)||(u.attrs.y=-parseFloat(h)-o),360!=e.rotation&&360!=parseFloat(e.rotation)||(u.attrs.y=-parseFloat(h)-o),u.attrs.rotation=360-e.rotation):u.attrs.y=-parseFloat(h)-o,e.xScale&&(u.attrs.fontSize=(o+.35)*e.xScale),n.push({type:"text",obj:u})}function cM(t,e,n,i,r){for(var a=e.shape,o=[],s=0;s<e.vertices.length;s++)o.push(e.vertices[s].x),o.push(-parseFloat(e.vertices[s].y));var l=.2;e.width?l+=parseFloat(e.width):l=.2,n.push({type:"polyline",points:o,closed:a,name:i.replace(/\s*/g,""),entityId:i,stroke:r?r.color:"#000",customColor:r?r.color:"",strokeWidth:l,visible:!r||r.visible,oldstrokeLength:l})}function dM(t,e,n,i,r){for(var a=oM(e.controlPoints,e.degreeOfSplineCurve,e.knotValues,100),o=[],s=0;s<a.length;s++)o.push(a[s].x),o.push(-parseFloat(a[s].y));var l=.1;n.push({type:"polyline",points:o,name:i.replace(/\s*/g,""),entityId:i,isGroup:!1,stroke:r||"#000",customColor:r?r.color:"",strokeWidth:l,visible:!r||r.visible,oldstrokeLength:l})}var fM=null,pM=null,mM={},vM={name:"Fl2dcanvas",components:{},data:function(){return{}},created:function(){var t=this;window.addEventListener("resize",(function(){if(fM){var t=document.getElementById("konva-container");fM.setWidth(t.clientWidth),fM.setHeight(t.clientHeight),fM._resizeDOM()}})),this.$nextTick((function(){console.log(document.getElementById("konva-container")),console.log(t.$refs.svgDraw),fM=new yS.a.Stage({className:"stage",container:"konva-container",width:t.$refs.svgDraw.clientWidth,height:t.$refs.svgDraw.clientHeight,draggable:!0}),pM=new yS.a.Layer({name:"konva-layer",x:0,y:0}),pM.getCanvas().setPixelRatio(2),fM.add(pM),pM.draw();var e=1.5;fM.on("wheel",(function(n){console.log(n),n.evt.preventDefault();var i=fM.scaleX(),r=fM.getPointerPosition(),a={x:(r.x-fM.x())/i,y:(r.y-fM.y())/i},o=n.evt.deltaY>0?-1:1;n.evt.ctrlKey&&(o=-o);var s=o>0?i*e:i/e;if(t.scaleRatio=Math.ceil(s),!(t.scaleRatio<=1||t.scaleRatio>=100)){fM.scale({x:s,y:s});var l={x:r.x-a.x*s,y:r.y-a.y*s};fM.position(l)}}))}))},methods:{loadDxf:function(t){var e,n=new tM,i=n.parse(t),r=aM(i.entities),a=i.tables.layer.layers,o=function(){if(r[s]){for(var t=[],e=r[s].length,n=mM[s],a=n&&Object.keys(n).length>0?n:null,o=0;o<e;o++){var l=r[s][o].type;rM(l,i,r[s][o],t,s,a,pM,mM)}if(!pM)return{v:void 0};for(var h=0;h<t.length;h++){var u=t[h];"text"===u.type&&pM&&pM.add(u.obj)}var c=new yS.a.Shape({x:0,y:0,strokeWidth:.2,name:s.replace(/\s*/g,""),entityId:s,stroke:a?a.color:"#000",customColor:a?a.color:"",visible:!a||a.visible,sceneFunc:function(e,n){e.beginPath();for(var i=0;i<t.length;i++){var r=t[i];if("line"===r.type){var a=r.x1,o=r.y1,s=r.x2,l=r.y2;e.moveTo(a,-parseFloat(o)),e.lineTo(s,-parseFloat(l))}if("polyline"===r.type)for(var h=r.points,u=r.closed,c=0;c<h.length;c++){var d=c%2;if(0===d){var f=h[c],p=h[c+1];0===c?e.moveTo(f,p):e.lineTo(f,p)}u&&c===h.length-1&&e.lineTo(h[0],h[1])}}e.fillStrokeShape(n)}});pM&&pM.add(c)}};for(var s in a)if(e=o(),e)return e.v;var l=1,h=pM.getClientRect(),u=Number((this.$refs.svgDraw.clientWidth/h.width).toFixed(1));u>2&&(l=Number((h.width/h.height).toFixed(1)),l=l<2?2:l),fM.scale({x:l,y:l});var c=pM.getClientRect(),d=this.$refs.svgDraw.clientWidth/2-(Math.ceil(c.width)/2+c.x/2),f=this.$refs.svgDraw.clientHeight/2-(Math.ceil(c.height)/2+c.y);fM.setX(d),fM.setY(f)},toPdf:function(){pM.getCanvas().setPixelRatio(1);var t=fM.toDataURL({mimeType:"image/jpeg",quality:1}),e=pM.canvas.toDataURL("image/jpeg",1);console.log(e);var n=new Image;n.src=t;var i=new eM["a"]("l","px",[fM.width(),fM.height()]);i.addImage(fM.toDataURL({pixelRatio:2}),0,0,fM.width(),fM.height()),i.save("canvas.pdf")},clearCache:function(){pM&&pM.destroyChildren(),pM&&pM.destroy(),pM&&pM.clear(),fM&&fM.destroy(),fM&&fM.clearCache(),pM=null,fM=null},beforeDestroy:function(){this.clearCache()}}},gM=vM,yM=(n("d698"),dS(gM,mS,vS,!1,null,"83d38700",null)),_M=yM.exports,xM=[pS,_M],bM=function(t){t.prototype.THREE=i,xM.forEach((function(e){t.component(e.name,e)}))};"undefined"!==typeof window&&window.Vue&&bM(window.Vue);var wM={install:bM,FlModel:pS,Fl2dcanvas:_M};e["default"]=wM},fce6:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.shapes=void 0;const i=n("d777"),r=n("9cb8"),a=n("f0b4"),o=n("4971"),s=n("4546"),l=n("d777"),h=n("7d2a"),u="hasShadow",c="shadowRGBA",d="patternImage",f="linearGradient",p="radialGradient";let m;function v(){return m||(m=r.Util.createCanvasElement().getContext("2d"),m)}function g(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()}function y(t){t.stroke()}function _(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()}function x(t){t.stroke()}function b(){this._clearCache(u)}function w(){this._clearCache(c)}function S(){this._clearCache(d)}function M(){this._clearCache(f)}function A(){this._clearCache(p)}e.shapes={};class E extends o.Node{constructor(t){let n;super(t);while(1)if(n=r.Util.getRandomColor(),n&&!(n in e.shapes))break;this.colorKey=n,e.shapes[n]=this}getContext(){return r.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return r.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this["_sceneFunc"]}getHitFunc(){return this.attrs.hitFunc||this["_hitFunc"]}hasShadow(){return this._getCache(u,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&0!==this.shadowOpacity()&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(d,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const t=v(),e=t.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new r.Transform;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(i.Konva.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const n=t.getMatrix(),a="undefined"===typeof DOMMatrix?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(a)}return e}}_getLinearGradient(){return this._getCache(f,this.__getLinearGradient)}__getLinearGradient(){const t=this.fillLinearGradientColorStops();if(t){const e=v(),n=this.fillLinearGradientStartPoint(),i=this.fillLinearGradientEndPoint(),r=e.createLinearGradient(n.x,n.y,i.x,i.y);for(let a=0;a<t.length;a+=2)r.addColorStop(t[a],t[a+1]);return r}}_getRadialGradient(){return this._getCache(p,this.__getRadialGradient)}__getRadialGradient(){const t=this.fillRadialGradientColorStops();if(t){const e=v(),n=this.fillRadialGradientStartPoint(),i=this.fillRadialGradientEndPoint(),r=e.createRadialGradient(n.x,n.y,this.fillRadialGradientStartRadius(),i.x,i.y,this.fillRadialGradientEndRadius());for(let a=0;a<t.length;a+=2)r.addColorStop(t[a],t[a+1]);return r}}getShadowRGBA(){return this._getCache(c,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const t=r.Util.colorToRGBA(this.shadowColor());return t?"rgba("+t.r+","+t.g+","+t.b+","+t.a*(this.shadowOpacity()||1)+")":void 0}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!(!this.stroke()&&!this.strokeLinearGradientColorStops()))}hasHitStroke(){const t=this.hitStrokeWidth();return"auto"===t?this.hasStroke():this.strokeEnabled()&&!!t}intersects(t){const e=this.getStage();if(!e)return!1;const n=e.bufferHitCanvas;n.getContext().clear(),this.drawHit(n,void 0,!0);const i=n.context.getImageData(Math.round(t.x),Math.round(t.y),1,1).data;return i[3]>0}destroy(){return o.Node.prototype.destroy.call(this),delete e.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(t){var e;const n=null===(e=this.attrs.perfectDrawEnabled)||void 0===e||e;if(!n)return!1;const i=t||this.hasFill(),r=this.hasStroke(),a=1!==this.getAbsoluteOpacity();if(i&&r&&a)return!0;const o=this.hasShadow(),s=this.shadowForStrokeEnabled();return!!(i&&r&&o&&s)}setStrokeHitEnabled(t){r.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),t?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return 0!==this.hitStrokeWidth()}getSelfRect(){const t=this.size();return{x:this._centroid?-t.width/2:0,y:this._centroid?-t.height/2:0,width:t.width,height:t.height}}getClientRect(t={}){let e=!1,n=this.getParent();while(n){if(n.isCached()){e=!0;break}n=n.getParent()}const i=t.skipTransform,r=t.relativeTo||e&&this.getStage()||void 0,a=this.getSelfRect(),o=!t.skipStroke&&this.hasStroke(),s=o&&this.strokeWidth()||0,l=a.width+s,h=a.height+s,u=!t.skipShadow&&this.hasShadow(),c=u?this.shadowOffsetX():0,d=u?this.shadowOffsetY():0,f=l+Math.abs(c),p=h+Math.abs(d),m=u&&this.shadowBlur()||0,v=f+2*m,g=p+2*m,y={width:v,height:g,x:-(s/2+m)+Math.min(c,0)+a.x,y:-(s/2+m)+Math.min(d,0)+a.y};return i?y:this._transformedRect(y,r)}drawScene(t,e,n){const i=this.getLayer();let r,a,o=t||i.getCanvas(),s=o.getContext(),l=this._getCanvasCache(),h=this.getSceneFunc(),u=this.hasShadow();const c=o.isCache,d=e===this;if(!this.isVisible()&&!d)return this;if(l){s.save();const t=this.getAbsoluteTransform(e).getMatrix();return s.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedSceneCanvas(s),s.restore(),this}if(!h)return this;if(s.save(),this._useBufferCanvas()&&!c){r=this.getStage();const t=n||r.bufferCanvas;a=t.getContext(),a.clear(),a.save(),a._applyLineJoin(this);var f=this.getAbsoluteTransform(e).getMatrix();a.transform(f[0],f[1],f[2],f[3],f[4],f[5]),h.call(this,a,this),a.restore();const i=t.pixelRatio;u&&s._applyShadow(this),s._applyOpacity(this),s._applyGlobalCompositeOperation(this),s.drawImage(t._canvas,0,0,t.width/i,t.height/i)}else{if(s._applyLineJoin(this),!d){f=this.getAbsoluteTransform(e).getMatrix();s.transform(f[0],f[1],f[2],f[3],f[4],f[5]),s._applyOpacity(this),s._applyGlobalCompositeOperation(this)}u&&s._applyShadow(this),h.call(this,s,this)}return s.restore(),this}drawHit(t,e,n=!1){if(!this.shouldDrawHit(e,n))return this;const i=this.getLayer(),a=t||i.hitCanvas,o=a&&a.getContext(),s=this.hitFunc()||this.sceneFunc(),l=this._getCanvasCache(),h=l&&l.hit;if(this.colorKey||r.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),h){o.save();const t=this.getAbsoluteTransform(e).getMatrix();return o.transform(t[0],t[1],t[2],t[3],t[4],t[5]),this._drawCachedHitCanvas(o),o.restore(),this}if(!s)return this;o.save(),o._applyLineJoin(this);const u=this===e;if(!u){const t=this.getAbsoluteTransform(e).getMatrix();o.transform(t[0],t[1],t[2],t[3],t[4],t[5])}return s.call(this,o,this),o.restore(),this}drawHitFromCache(t=0){const e=this._getCanvasCache(),n=this._getCachedSceneCanvas(),i=e.hit,a=i.getContext(),o=i.getWidth(),s=i.getHeight();a.clear(),a.drawImage(n._canvas,0,0,o,s);try{const e=a.getImageData(0,0,o,s),n=e.data,i=n.length,l=r.Util._hexToRgb(this.colorKey);for(let r=0;r<i;r+=4){const e=n[r+3];e>t?(n[r]=l.r,n[r+1]=l.g,n[r+2]=l.b,n[r+3]=255):n[r+3]=0}a.putImageData(e,0,0)}catch(l){r.Util.error("Unable to draw hit graph from cached scene canvas. "+l.message)}return this}hasPointerCapture(t){return h.hasPointerCapture(t,this)}setPointerCapture(t){h.setPointerCapture(t,this)}releaseCapture(t){h.releaseCapture(t,this)}}e.Shape=E,E.prototype._fillFunc=g,E.prototype._strokeFunc=y,E.prototype._fillFuncHit=_,E.prototype._strokeFuncHit=x,E.prototype._centroid=!1,E.prototype.nodeType="Shape",(0,l._registerNode)(E),E.prototype.eventListeners={},E.prototype.on.call(E.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",b),E.prototype.on.call(E.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",w),E.prototype.on.call(E.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",S),E.prototype.on.call(E.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",M),E.prototype.on.call(E.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",A),a.Factory.addGetterSetter(E,"stroke",void 0,(0,s.getStringOrGradientValidator)()),a.Factory.addGetterSetter(E,"strokeWidth",2,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(E,"fillAfterStrokeEnabled",!1),a.Factory.addGetterSetter(E,"hitStrokeWidth","auto",(0,s.getNumberOrAutoValidator)()),a.Factory.addGetterSetter(E,"strokeHitEnabled",!0,(0,s.getBooleanValidator)()),a.Factory.addGetterSetter(E,"perfectDrawEnabled",!0,(0,s.getBooleanValidator)()),a.Factory.addGetterSetter(E,"shadowForStrokeEnabled",!0,(0,s.getBooleanValidator)()),a.Factory.addGetterSetter(E,"lineJoin"),a.Factory.addGetterSetter(E,"lineCap"),a.Factory.addGetterSetter(E,"sceneFunc"),a.Factory.addGetterSetter(E,"hitFunc"),a.Factory.addGetterSetter(E,"dash"),a.Factory.addGetterSetter(E,"dashOffset",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(E,"shadowColor",void 0,(0,s.getStringValidator)()),a.Factory.addGetterSetter(E,"shadowBlur",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(E,"shadowOpacity",1,(0,s.getNumberValidator)()),a.Factory.addComponentsGetterSetter(E,"shadowOffset",["x","y"]),a.Factory.addGetterSetter(E,"shadowOffsetX",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(E,"shadowOffsetY",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(E,"fillPatternImage"),a.Factory.addGetterSetter(E,"fill",void 0,(0,s.getStringOrGradientValidator)()),a.Factory.addGetterSetter(E,"fillPatternX",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(E,"fillPatternY",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(E,"fillLinearGradientColorStops"),a.Factory.addGetterSetter(E,"strokeLinearGradientColorStops"),a.Factory.addGetterSetter(E,"fillRadialGradientStartRadius",0),a.Factory.addGetterSetter(E,"fillRadialGradientEndRadius",0),a.Factory.addGetterSetter(E,"fillRadialGradientColorStops"),a.Factory.addGetterSetter(E,"fillPatternRepeat","repeat"),a.Factory.addGetterSetter(E,"fillEnabled",!0),a.Factory.addGetterSetter(E,"strokeEnabled",!0),a.Factory.addGetterSetter(E,"shadowEnabled",!0),a.Factory.addGetterSetter(E,"dashEnabled",!0),a.Factory.addGetterSetter(E,"strokeScaleEnabled",!0),a.Factory.addGetterSetter(E,"fillPriority","color"),a.Factory.addComponentsGetterSetter(E,"fillPatternOffset",["x","y"]),a.Factory.addGetterSetter(E,"fillPatternOffsetX",0,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(E,"fillPatternOffsetY",0,(0,s.getNumberValidator)()),a.Factory.addComponentsGetterSetter(E,"fillPatternScale",["x","y"]),a.Factory.addGetterSetter(E,"fillPatternScaleX",1,(0,s.getNumberValidator)()),a.Factory.addGetterSetter(E,"fillPatternScaleY",1,(0,s.getNumberValidator)()),a.Factory.addComponentsGetterSetter(E,"fillLinearGradientStartPoint",["x","y"]),a.Factory.addComponentsGetterSetter(E,"strokeLinearGradientStartPoint",["x","y"]),a.Factory.addGetterSetter(E,"fillLinearGradientStartPointX",0),a.Factory.addGetterSetter(E,"strokeLinearGradientStartPointX",0),a.Factory.addGetterSetter(E,"fillLinearGradientStartPointY",0),a.Factory.addGetterSetter(E,"strokeLinearGradientStartPointY",0),a.Factory.addComponentsGetterSetter(E,"fillLinearGradientEndPoint",["x","y"]),a.Factory.addComponentsGetterSetter(E,"strokeLinearGradientEndPoint",["x","y"]),a.Factory.addGetterSetter(E,"fillLinearGradientEndPointX",0),a.Factory.addGetterSetter(E,"strokeLinearGradientEndPointX",0),a.Factory.addGetterSetter(E,"fillLinearGradientEndPointY",0),a.Factory.addGetterSetter(E,"strokeLinearGradientEndPointY",0),a.Factory.addComponentsGetterSetter(E,"fillRadialGradientStartPoint",["x","y"]),a.Factory.addGetterSetter(E,"fillRadialGradientStartPointX",0),a.Factory.addGetterSetter(E,"fillRadialGradientStartPointY",0),a.Factory.addComponentsGetterSetter(E,"fillRadialGradientEndPoint",["x","y"]),a.Factory.addGetterSetter(E,"fillRadialGradientEndPointX",0),a.Factory.addGetterSetter(E,"fillRadialGradientEndPointY",0),a.Factory.addGetterSetter(E,"fillPatternRotation",0),a.Factory.addGetterSetter(E,"fillRule",void 0,(0,s.getStringValidator)()),a.Factory.backCompat(E,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})},fd15:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Konva=void 0;const i=n("36da"),r=n("8603"),a=n("1bd8"),o=n("1f21"),s=n("383f"),l=n("229a"),h=n("da04"),u=n("f709"),c=n("8c18"),d=n("5d5a"),f=n("26c8"),p=n("bf11"),m=n("a34e"),v=n("e3af"),g=n("5414"),y=n("2a01"),_=n("d488"),x=n("96ee"),b=n("bdee"),w=n("6b7e"),S=n("c742"),M=n("e4b0"),A=n("bcb1"),E=n("cf29"),T=n("926b"),C=n("461e"),k=n("89c1"),L=n("1c49"),P=n("9470"),R=n("bbce"),N=n("405a"),I=n("2013"),O=n("8e84"),D=n("b33b"),F=n("769d"),U=n("7cc1"),q=n("122f");e.Konva=i.Konva.Util._assign(i.Konva,{Arc:r.Arc,Arrow:a.Arrow,Circle:o.Circle,Ellipse:s.Ellipse,Image:l.Image,Label:h.Label,Tag:h.Tag,Line:u.Line,Path:c.Path,Rect:d.Rect,RegularPolygon:f.RegularPolygon,Ring:p.Ring,Sprite:m.Sprite,Star:v.Star,Text:g.Text,TextPath:y.TextPath,Transformer:_.Transformer,Wedge:x.Wedge,Filters:{Blur:b.Blur,Brighten:w.Brighten,Contrast:S.Contrast,Emboss:M.Emboss,Enhance:A.Enhance,Grayscale:E.Grayscale,HSL:T.HSL,HSV:C.HSV,Invert:k.Invert,Kaleidoscope:L.Kaleidoscope,Mask:P.Mask,Noise:R.Noise,Pixelate:N.Pixelate,Posterize:I.Posterize,RGB:O.RGB,RGBA:D.RGBA,Sepia:F.Sepia,Solarize:U.Solarize,Threshold:q.Threshold}})}})}));
|