three-cad-viewer 3.3.0 → 3.3.2
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/three-cad-viewer.esm.js +191 -78
- package/dist/three-cad-viewer.esm.min.js +1 -1
- package/dist/three-cad-viewer.js +191 -78
- package/dist/three-cad-viewer.min.js +1 -1
- package/package.json +1 -1
- package/src/_version.js +1 -1
- package/src/bbox.js +10 -1
- package/src/cad_tools/measure.js +34 -7
- package/src/display.js +2 -2
- package/src/treeview.js +36 -6
- package/src/viewer.js +108 -61
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
* Copyright 2010-2025 Three.js Authors
|
|
10
10
|
* SPDX-License-Identifier: MIT
|
|
11
11
|
*/
|
|
12
|
-
function Th(){let t=null,e=!1,i=null,n=null;function s(e,r){i(e,r),n=t.requestAnimationFrame(s)}return{start:function(){!0!==e&&null!==i&&(n=t.requestAnimationFrame(s),e=!0)},stop:function(){t.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function Eh(t){const e=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)},remove:function(i){i.isInterleavedBufferAttribute&&(i=i.data);const n=e.get(i);n&&(t.deleteBuffer(n.buffer),e.delete(i))},update:function(i,n){if(i.isInterleavedBufferAttribute&&(i=i.data),i.isGLBufferAttribute){const t=e.get(i);return void((!t||t.version<i.version)&&e.set(i,{buffer:i.buffer,type:i.type,bytesPerElement:i.elementSize,version:i.version}))}const s=e.get(i);if(void 0===s)e.set(i,function(e,i){const n=e.array,s=e.usage,r=n.byteLength,a=t.createBuffer();let o;if(t.bindBuffer(i,a),t.bufferData(i,n,s),e.onUploadCallback(),n instanceof Float32Array)o=t.FLOAT;else if(n instanceof Uint16Array)o=e.isFloat16BufferAttribute?t.HALF_FLOAT:t.UNSIGNED_SHORT;else if(n instanceof Int16Array)o=t.SHORT;else if(n instanceof Uint32Array)o=t.UNSIGNED_INT;else if(n instanceof Int32Array)o=t.INT;else if(n instanceof Int8Array)o=t.BYTE;else if(n instanceof Uint8Array)o=t.UNSIGNED_BYTE;else{if(!(n instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+n);o=t.UNSIGNED_BYTE}return{buffer:a,type:o,bytesPerElement:n.BYTES_PER_ELEMENT,version:e.version,size:r}}(i,n));else if(s.version<i.version){if(s.size!==i.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.");!function(e,i,n){const s=i.array,r=i.updateRanges;if(t.bindBuffer(n,e),0===r.length)t.bufferSubData(n,0,s);else{r.sort(((t,e)=>t.start-e.start));let e=0;for(let t=1;t<r.length;t++){const i=r[e],n=r[t];n.start<=i.start+i.count+1?i.count=Math.max(i.count,n.start+n.count-i.start):(++e,r[e]=n)}r.length=e+1;for(let e=0,i=r.length;e<i;e++){const i=r[e];t.bufferSubData(n,i.start*s.BYTES_PER_ELEMENT,s,i.start,i.count)}i.clearUpdateRanges()}i.onUploadCallback()}(s.buffer,i,n),s.version=i.version}}}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:e}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=e);const Ah={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#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",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#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",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#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",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#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",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"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",iridescence_fragment:"#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",bumpmap_pars_fragment:"#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",clipping_planes_fragment:"#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",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#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",color_vertex:"#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",common:"#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",cube_uv_reflection_fragment:"#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",defaultnormal_vertex:"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",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#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",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"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}",envmap_fragment:"#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",envmap_common_pars_fragment:"#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",envmap_pars_fragment:"#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",envmap_pars_vertex:"#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",envmap_physical_pars_fragment:"#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",envmap_vertex:"#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",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#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",fog_pars_fragment:"#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",gradientmap_pars_fragment:"#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}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"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",lights_pars_begin:"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",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"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",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"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",lights_physical_fragment:"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",lights_physical_pars_fragment:"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}",lights_fragment_begin:"\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",lights_fragment_maps:"#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",lights_fragment_end:"#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",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#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",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#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",map_particle_pars_fragment:"#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",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#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",morphcolor_vertex:"#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",morphnormal_vertex:"#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",morphtarget_pars_vertex:"#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",morphtarget_vertex:"#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",normal_fragment_begin:"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;",normal_fragment_maps:"#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",normal_pars_fragment:"#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",normal_pars_vertex:"#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",normal_vertex:"#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",normalmap_pars_fragment:"#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",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#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",clearcoat_pars_fragment:"#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",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"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}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"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;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#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",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#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",shadowmap_pars_vertex:"#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",shadowmap_vertex:"#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",shadowmask_pars_fragment:"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}",skinbase_vertex:"#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",skinning_pars_vertex:"#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",skinning_vertex:"#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",skinnormal_vertex:"#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",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#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; }",transmission_fragment:"#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",transmission_pars_fragment:"#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",uv_pars_fragment:"#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",uv_pars_vertex:"#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",uv_vertex:"#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",worldpos_vertex:"#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",background_vert:"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}",background_frag:"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}",backgroundCube_vert:"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}",backgroundCube_frag:"#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}",cube_vert:"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}",cube_frag:"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}",depth_vert:"#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}",depth_frag:"#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}",distanceRGBA_vert:"#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}",distanceRGBA_frag:"#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}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"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}",linedashed_vert:"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}",linedashed_frag:"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}",meshbasic_vert:"#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}",meshbasic_frag:"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}",meshlambert_vert:"#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}",meshlambert_frag:"#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}",meshmatcap_vert:"#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}",meshmatcap_frag:"#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}",meshnormal_vert:"#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}",meshnormal_frag:"#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}",meshphong_vert:"#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}",meshphong_frag:"#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}",meshphysical_vert:"#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}",meshphysical_frag:"#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}",meshtoon_vert:"#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}",meshtoon_frag:"#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}",points_vert:"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}",points_frag:"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}",shadow_vert:"#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}",shadow_frag:"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}",sprite_vert:"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}",sprite_frag:"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}"},Ch={common:{diffuse:{value:new zn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ge},alphaMap:{value:null},alphaMapTransform:{value:new Ge},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ge}},envmap:{envMap:{value:null},envMapRotation:{value:new Ge},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ge}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ge}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ge},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ge},normalScale:{value:new Ve(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ge},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ge}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ge}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ge}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new zn(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 zn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ge},alphaTest:{value:0},uvTransform:{value:new Ge}},sprite:{diffuse:{value:new zn(16777215)},opacity:{value:1},center:{value:new Ve(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ge},alphaMap:{value:null},alphaMapTransform:{value:new Ge},alphaTest:{value:0}}},Lh={basic:{uniforms:Es([Ch.common,Ch.specularmap,Ch.envmap,Ch.aomap,Ch.lightmap,Ch.fog]),vertexShader:Ah.meshbasic_vert,fragmentShader:Ah.meshbasic_frag},lambert:{uniforms:Es([Ch.common,Ch.specularmap,Ch.envmap,Ch.aomap,Ch.lightmap,Ch.emissivemap,Ch.bumpmap,Ch.normalmap,Ch.displacementmap,Ch.fog,Ch.lights,{emissive:{value:new zn(0)}}]),vertexShader:Ah.meshlambert_vert,fragmentShader:Ah.meshlambert_frag},phong:{uniforms:Es([Ch.common,Ch.specularmap,Ch.envmap,Ch.aomap,Ch.lightmap,Ch.emissivemap,Ch.bumpmap,Ch.normalmap,Ch.displacementmap,Ch.fog,Ch.lights,{emissive:{value:new zn(0)},specular:{value:new zn(1118481)},shininess:{value:30}}]),vertexShader:Ah.meshphong_vert,fragmentShader:Ah.meshphong_frag},standard:{uniforms:Es([Ch.common,Ch.envmap,Ch.aomap,Ch.lightmap,Ch.emissivemap,Ch.bumpmap,Ch.normalmap,Ch.displacementmap,Ch.roughnessmap,Ch.metalnessmap,Ch.fog,Ch.lights,{emissive:{value:new zn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ah.meshphysical_vert,fragmentShader:Ah.meshphysical_frag},toon:{uniforms:Es([Ch.common,Ch.aomap,Ch.lightmap,Ch.emissivemap,Ch.bumpmap,Ch.normalmap,Ch.displacementmap,Ch.gradientmap,Ch.fog,Ch.lights,{emissive:{value:new zn(0)}}]),vertexShader:Ah.meshtoon_vert,fragmentShader:Ah.meshtoon_frag},matcap:{uniforms:Es([Ch.common,Ch.bumpmap,Ch.normalmap,Ch.displacementmap,Ch.fog,{matcap:{value:null}}]),vertexShader:Ah.meshmatcap_vert,fragmentShader:Ah.meshmatcap_frag},points:{uniforms:Es([Ch.points,Ch.fog]),vertexShader:Ah.points_vert,fragmentShader:Ah.points_frag},dashed:{uniforms:Es([Ch.common,Ch.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ah.linedashed_vert,fragmentShader:Ah.linedashed_frag},depth:{uniforms:Es([Ch.common,Ch.displacementmap]),vertexShader:Ah.depth_vert,fragmentShader:Ah.depth_frag},normal:{uniforms:Es([Ch.common,Ch.bumpmap,Ch.normalmap,Ch.displacementmap,{opacity:{value:1}}]),vertexShader:Ah.meshnormal_vert,fragmentShader:Ah.meshnormal_frag},sprite:{uniforms:Es([Ch.sprite,Ch.fog]),vertexShader:Ah.sprite_vert,fragmentShader:Ah.sprite_frag},background:{uniforms:{uvTransform:{value:new Ge},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ah.background_vert,fragmentShader:Ah.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ge}},vertexShader:Ah.backgroundCube_vert,fragmentShader:Ah.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ah.cube_vert,fragmentShader:Ah.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ah.equirect_vert,fragmentShader:Ah.equirect_frag},distanceRGBA:{uniforms:Es([Ch.common,Ch.displacementmap,{referencePosition:{value:new vi},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ah.distanceRGBA_vert,fragmentShader:Ah.distanceRGBA_frag},shadow:{uniforms:Es([Ch.lights,Ch.fog,{color:{value:new zn(0)},opacity:{value:1}}]),vertexShader:Ah.shadow_vert,fragmentShader:Ah.shadow_frag}};Lh.physical={uniforms:Es([Lh.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ge},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ge},clearcoatNormalScale:{value:new Ve(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ge},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ge},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ge},sheen:{value:0},sheenColor:{value:new zn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ge},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ge},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ge},transmissionSamplerSize:{value:new Ve},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ge},attenuationDistance:{value:0},attenuationColor:{value:new zn(0)},specularColor:{value:new zn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ge},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ge},anisotropyVector:{value:new Ve},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ge}}]),vertexShader:Ah.meshphysical_vert,fragmentShader:Ah.meshphysical_frag};const kh={r:0,b:0,g:0},Rh=new sn,Ph=new Xi;function Ih(t,e,i,n,s,r,a){const o=new zn(0);let l,c,h=!0===r?0:1,d=null,u=0,p=null;function m(t){let n=!0===t.isScene?t.background:null;if(n&&n.isTexture){n=(t.backgroundBlurriness>0?i:e).get(n)}return n}function f(e,i){e.getRGB(kh,As(t)),n.buffers.color.setClear(kh.r,kh.g,kh.b,i,a)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),h=e,f(o,h)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,f(o,h)},render:function(e){let i=!1;const s=m(e);null===s?f(o,h):s&&s.isColor&&(f(s,1),i=!0);const r=t.xr.getEnvironmentBlendMode();"additive"===r?n.buffers.color.setClear(0,0,0,1,a):"alpha-blend"===r&&n.buffers.color.setClear(0,0,0,0,a),(t.autoClear||i)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))},addToRenderList:function(e,i){const n=m(i);n&&(n.isCubeTexture||n.mapping===z)?(void 0===c&&(c=new bs(new Ss(1,1,1),new Ls({name:"BackgroundCubeMaterial",uniforms:Ts(Lh.backgroundCube.uniforms),vertexShader:Lh.backgroundCube.vertexShader,fragmentShader:Lh.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(c)),Rh.copy(i.backgroundRotation),Rh.x*=-1,Rh.y*=-1,Rh.z*=-1,n.isCubeTexture&&!1===n.isRenderTargetTexture&&(Rh.y*=-1,Rh.z*=-1),c.material.uniforms.envMap.value=n,c.material.uniforms.flipEnvMap.value=n.isCubeTexture&&!1===n.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=i.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Ph.makeRotationFromEuler(Rh)),c.material.toneMapped=ei.getTransfer(n.colorSpace)!==ue,d===n&&u===n.version&&p===t.toneMapping||(c.material.needsUpdate=!0,d=n,u=n.version,p=t.toneMapping),c.layers.enableAll(),e.unshift(c,c.geometry,c.material,0,0,null)):n&&n.isTexture&&(void 0===l&&(l=new bs(new qo(2,2),new Ls({name:"BackgroundMaterial",uniforms:Ts(Lh.background.uniforms),vertexShader:Lh.background.vertexShader,fragmentShader:Lh.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(l)),l.material.uniforms.t2D.value=n,l.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,l.material.toneMapped=ei.getTransfer(n.colorSpace)!==ue,!0===n.matrixAutoUpdate&&n.updateMatrix(),l.material.uniforms.uvTransform.value.copy(n.matrix),d===n&&u===n.version&&p===t.toneMapping||(l.material.needsUpdate=!0,d=n,u=n.version,p=t.toneMapping),l.layers.enableAll(),e.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==c&&(c.geometry.dispose(),c.material.dispose(),c=void 0),void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}}}function Uh(t,e){const i=t.getParameter(t.MAX_VERTEX_ATTRIBS),n={},s=c(null);let r=s,a=!1;function o(e){return t.bindVertexArray(e)}function l(e){return t.deleteVertexArray(e)}function c(t){const e=[],n=[],s=[];for(let t=0;t<i;t++)e[t]=0,n[t]=0,s[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:s,object:t,attributes:{},index:null}}function h(){const t=r.newAttributes;for(let e=0,i=t.length;e<i;e++)t[e]=0}function d(t){u(t,0)}function u(e,i){const n=r.newAttributes,s=r.enabledAttributes,a=r.attributeDivisors;n[e]=1,0===s[e]&&(t.enableVertexAttribArray(e),s[e]=1),a[e]!==i&&(t.vertexAttribDivisor(e,i),a[e]=i)}function p(){const e=r.newAttributes,i=r.enabledAttributes;for(let n=0,s=i.length;n<s;n++)i[n]!==e[n]&&(t.disableVertexAttribArray(n),i[n]=0)}function m(e,i,n,s,r,a,o){!0===o?t.vertexAttribIPointer(e,i,n,r,a):t.vertexAttribPointer(e,i,n,s,r,a)}function f(){g(),a=!0,r!==s&&(r=s,o(r.object))}function g(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:function(i,s,l,f,g){let v=!1;const _=function(e,i,s){const r=!0===s.wireframe;let a=n[e.id];void 0===a&&(a={},n[e.id]=a);let o=a[i.id];void 0===o&&(o={},a[i.id]=o);let l=o[r];void 0===l&&(l=c(t.createVertexArray()),o[r]=l);return l}(f,l,s);r!==_&&(r=_,o(r.object)),v=function(t,e,i,n){const s=r.attributes,a=e.attributes;let o=0;const l=i.getAttributes();for(const e in l){if(l[e].location>=0){const i=s[e];let n=a[e];if(void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor)),void 0===i)return!0;if(i.attribute!==n)return!0;if(n&&i.data!==n.data)return!0;o++}}return r.attributesNum!==o||r.index!==n}(i,f,l,g),v&&function(t,e,i,n){const s={},a=e.attributes;let o=0;const l=i.getAttributes();for(const e in l){if(l[e].location>=0){let i=a[e];void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor));const n={};n.attribute=i,i&&i.data&&(n.data=i.data),s[e]=n,o++}}r.attributes=s,r.attributesNum=o,r.index=n}(i,f,l,g),null!==g&&e.update(g,t.ELEMENT_ARRAY_BUFFER),(v||a)&&(a=!1,function(i,n,s,r){h();const a=r.attributes,o=s.getAttributes(),l=n.defaultAttributeValues;for(const n in o){const s=o[n];if(s.location>=0){let o=a[n];if(void 0===o&&("instanceMatrix"===n&&i.instanceMatrix&&(o=i.instanceMatrix),"instanceColor"===n&&i.instanceColor&&(o=i.instanceColor)),void 0!==o){const n=o.normalized,a=o.itemSize,l=e.get(o);if(void 0===l)continue;const c=l.buffer,h=l.type,p=l.bytesPerElement,f=h===t.INT||h===t.UNSIGNED_INT||o.gpuType===tt;if(o.isInterleavedBufferAttribute){const e=o.data,l=e.stride,g=o.offset;if(e.isInstancedInterleavedBuffer){for(let t=0;t<s.locationSize;t++)u(s.location+t,e.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===r._maxInstanceCount&&(r._maxInstanceCount=e.meshPerAttribute*e.count)}else for(let t=0;t<s.locationSize;t++)d(s.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<s.locationSize;t++)m(s.location+t,a/s.locationSize,h,n,l*p,(g+a/s.locationSize*t)*p,f)}else{if(o.isInstancedBufferAttribute){for(let t=0;t<s.locationSize;t++)u(s.location+t,o.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===r._maxInstanceCount&&(r._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let t=0;t<s.locationSize;t++)d(s.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<s.locationSize;t++)m(s.location+t,a/s.locationSize,h,n,a*p,a/s.locationSize*t*p,f)}}else if(void 0!==l){const e=l[n];if(void 0!==e)switch(e.length){case 2:t.vertexAttrib2fv(s.location,e);break;case 3:t.vertexAttrib3fv(s.location,e);break;case 4:t.vertexAttrib4fv(s.location,e);break;default:t.vertexAttrib1fv(s.location,e)}}}}p()}(i,s,l,f),null!==g&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(g).buffer))},reset:f,resetDefaultState:g,dispose:function(){f();for(const t in n){const e=n[t];for(const t in e){const i=e[t];for(const t in i)l(i[t].object),delete i[t];delete e[t]}delete n[t]}},releaseStatesOfGeometry:function(t){if(void 0===n[t.id])return;const e=n[t.id];for(const t in e){const i=e[t];for(const t in i)l(i[t].object),delete i[t];delete e[t]}delete n[t.id]},releaseStatesOfProgram:function(t){for(const e in n){const i=n[e];if(void 0===i[t.id])continue;const s=i[t.id];for(const t in s)l(s[t].object),delete s[t];delete i[t.id]}},initAttributes:h,enableAttribute:d,disableUnusedAttributes:p}}function Dh(t,e,i){let n;function s(e,s,r){0!==r&&(t.drawArraysInstanced(n,e,s,r),i.update(s,n,r))}this.setMode=function(t){n=t},this.render=function(e,s){t.drawArrays(n,e,s),i.update(s,n,1)},this.renderInstances=s,this.renderMultiDraw=function(t,s,r){if(0===r)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,t,0,s,0,r);let a=0;for(let t=0;t<r;t++)a+=s[t];i.update(a,n,1)},this.renderMultiDrawInstances=function(t,r,a,o){if(0===a)return;const l=e.get("WEBGL_multi_draw");if(null===l)for(let e=0;e<t.length;e++)s(t[e],r[e],o[e]);else{l.multiDrawArraysInstancedWEBGL(n,t,0,r,0,o,0,a);let e=0;for(let t=0;t<a;t++)e+=r[t]*o[t];i.update(e,n,1)}}}function Nh(t,e,i,n){let s;function r(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"}let a=void 0!==i.precision?i.precision:"highp";const o=r(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=!0===i.logarithmicDepthBuffer,c=!0===i.reverseDepthBuffer&&e.has("EXT_clip_control"),h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),d=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==s)return s;if(!0===e.has("EXT_texture_filter_anisotropic")){const i=e.get("EXT_texture_filter_anisotropic");s=t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s},getMaxPrecision:r,textureFormatReadable:function(e){return e===ht||n.convert(e)===t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(i){const s=i===nt&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(i!==J&&n.convert(i)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&i!==it&&!s)},precision:a,logarithmicDepthBuffer:l,reverseDepthBuffer:c,maxTextures:h,maxVertexTextures:d,maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxCubemapSize:t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:t.getParameter(t.MAX_VERTEX_ATTRIBS),maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:t.getParameter(t.MAX_VARYING_VECTORS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:d>0,maxSamples:t.getParameter(t.MAX_SAMPLES)}}function Oh(t){const e=this;let i=null,n=0,s=!1,r=!1;const a=new zr,o=new Ge,l={value:null,needsUpdate:!1};function c(t,i,n,s){const r=null!==t?t.length:0;let c=null;if(0!==r){if(c=l.value,!0!==s||null===c){const e=n+4*r,s=i.matrixWorldInverse;o.getNormalMatrix(s),(null===c||c.length<e)&&(c=new Float32Array(e));for(let e=0,i=n;e!==r;++e,i+=4)a.copy(t[e]).applyMatrix4(s,o),a.normal.toArray(c,i),c[i+3]=a.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=r,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e){const i=0!==t.length||e||0!==n||s;return s=e,n=t.length,i},this.beginShadows=function(){r=!0,c(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(t,e){i=c(t,e,0)},this.setState=function(a,o,h){const d=a.clippingPlanes,u=a.clipIntersection,p=a.clipShadows,m=t.get(a);if(!s||null===d||0===d.length||r&&!p)r?c(null):function(){l.value!==i&&(l.value=i,l.needsUpdate=n>0);e.numPlanes=n,e.numIntersection=0}();else{const t=r?0:n,e=4*t;let s=m.clippingState||null;l.value=s,s=c(d,o,e,h);for(let t=0;t!==e;++t)s[t]=i[t];m.clippingState=s,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=t}}}function Bh(t){let e=new WeakMap;function i(t,e){return e===B?t.mapping=N:e===F&&(t.mapping=O),t}function n(t){const i=t.target;i.removeEventListener("dispose",n);const s=e.get(i);void 0!==s&&(e.delete(i),s.dispose())}return{get:function(s){if(s&&s.isTexture){const r=s.mapping;if(r===B||r===F){if(e.has(s)){return i(e.get(s).texture,s.mapping)}{const r=s.image;if(r&&r.height>0){const a=new Bs(r.height);return a.fromEquirectangularTexture(t,s),e.set(s,a),s.addEventListener("dispose",n),i(a.texture,s.mapping)}return null}}}return s},dispose:function(){e=new WeakMap}}}const Fh=[.125,.215,.35,.446,.526,.582],zh=20,Hh=new ic,Vh=new zn;let Gh=null,jh=0,Wh=0,qh=!1;const Xh=(1+Math.sqrt(5))/2,Zh=1/Xh,Yh=[new vi(-Xh,Zh,0),new vi(Xh,Zh,0),new vi(-Zh,0,Xh),new vi(Zh,0,Xh),new vi(0,Xh,-Zh),new vi(0,Xh,Zh),new vi(-1,1,-1),new vi(1,1,-1),new vi(-1,1,1),new vi(1,1,1)];class Jh{constructor(t){this._renderer=t,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)}fromScene(t,e=0,i=.1,n=100){Gh=this._renderer.getRenderTarget(),jh=this._renderer.getActiveCubeFace(),Wh=this._renderer.getActiveMipmapLevel(),qh=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(t,i,n,s),e>0&&this._blur(s,0,0,e),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=td(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Qh(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(Gh,jh,Wh),this._renderer.xr.enabled=qh,t.scissorTest=!1,Kh(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===N||t.mapping===O?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),Gh=this._renderer.getRenderTarget(),jh=this._renderer.getActiveCubeFace(),Wh=this._renderer.getActiveMipmapLevel(),qh=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=e||this._allocateTargets();return this._textureToCubeUV(t,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,i={magFilter:X,minFilter:X,generateMipmaps:!1,type:nt,format:ht,colorSpace:he,depthBuffer:!1},n=$h(t,e,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=$h(t,e,i);const{_lodMax:n}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){const e=[],i=[],n=[];let s=t;const r=t-4+1+Fh.length;for(let a=0;a<r;a++){const r=Math.pow(2,s);i.push(r);let o=1/r;a>t-4?o=Fh[a-t+4-1]:0===a&&(o=0),n.push(o);const l=1/(r-2),c=-l,h=1+l,d=[c,c,h,c,h,h,c,c,h,h,c,h],u=6,p=6,m=3,f=2,g=1,v=new Float32Array(m*p*u),_=new Float32Array(f*p*u),y=new Float32Array(g*p*u);for(let t=0;t<u;t++){const e=t%3*2/3-1,i=t>2?0:-1,n=[e,i,0,e+2/3,i,0,e+2/3,i+1,0,e,i,0,e+2/3,i+1,0,e,i+1,0];v.set(n,m*p*t),_.set(d,f*p*t);const s=[t,t,t,t,t,t];y.set(s,g*p*t)}const x=new hs;x.setAttribute("position",new Qn(v,m)),x.setAttribute("uv",new Qn(_,f)),x.setAttribute("faceIndex",new Qn(y,g)),e.push(x),s>4&&s--}return{lodPlanes:e,sizeLods:i,sigmas:n}}(n)),this._blurMaterial=function(t,e,i){const n=new Float32Array(zh),s=new vi(0,1,0),r=new Ls({name:"SphericalGaussianBlur",defines:{n:zh,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:ed(),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:0,depthTest:!1,depthWrite:!1});return r}(n,t,e)}return n}_compileMaterial(t){const e=new bs(this._lodPlanes[0],t);this._renderer.compile(e,Hh)}_sceneToCubeUV(t,e,i,n){const s=new Us(90,1,e,i),r=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,c=o.toneMapping;o.getClearColor(Vh),o.toneMapping=0,o.autoClear=!1;const h=new jn({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),d=new bs(new Ss,h);let u=!1;const p=t.background;p?p.isColor&&(h.color.copy(p),t.background=null,u=!0):(h.color.copy(Vh),u=!0);for(let e=0;e<6;e++){const i=e%3;0===i?(s.up.set(0,r[e],0),s.lookAt(a[e],0,0)):1===i?(s.up.set(0,0,r[e]),s.lookAt(0,a[e],0)):(s.up.set(0,r[e],0),s.lookAt(0,0,a[e]));const l=this._cubeSize;Kh(n,i*l,e>2?l:0,l,l),o.setRenderTarget(n),u&&o.render(d,s),o.render(t,s)}d.geometry.dispose(),d.material.dispose(),o.toneMapping=c,o.autoClear=l,t.background=p}_textureToCubeUV(t,e){const i=this._renderer,n=t.mapping===N||t.mapping===O;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=td()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Qh());const s=n?this._cubemapMaterial:this._equirectMaterial,r=new bs(this._lodPlanes[0],s);s.uniforms.envMap.value=t;const a=this._cubeSize;Kh(e,0,0,3*a,2*a),i.setRenderTarget(e),i.render(r,Hh)}_applyPMREM(t){const e=this._renderer,i=e.autoClear;e.autoClear=!1;const n=this._lodPlanes.length;for(let e=1;e<n;e++){const i=Math.sqrt(this._sigmas[e]*this._sigmas[e]-this._sigmas[e-1]*this._sigmas[e-1]),s=Yh[(n-e-1)%Yh.length];this._blur(t,e-1,e,i,s)}e.autoClear=i}_blur(t,e,i,n,s){const r=this._pingPongRenderTarget;this._halfBlur(t,r,e,i,n,"latitudinal",s),this._halfBlur(r,t,i,i,n,"longitudinal",s)}_halfBlur(t,e,i,n,s,r,a){const o=this._renderer,l=this._blurMaterial;"latitudinal"!==r&&"longitudinal"!==r&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new bs(this._lodPlanes[n],l),h=l.uniforms,d=this._sizeLods[i]-1,u=isFinite(s)?Math.PI/(2*d):2*Math.PI/39,p=s/u,m=isFinite(s)?1+Math.floor(3*p):zh;m>zh&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const f=[];let g=0;for(let t=0;t<zh;++t){const e=t/p,i=Math.exp(-e*e/2);f.push(i),0===t?g+=i:t<m&&(g+=2*i)}for(let t=0;t<f.length;t++)f[t]=f[t]/g;h.envMap.value=t.texture,h.samples.value=m,h.weights.value=f,h.latitudinal.value="latitudinal"===r,a&&(h.poleAxis.value=a);const{_lodMax:v}=this;h.dTheta.value=u,h.mipInt.value=v-i;const _=this._sizeLods[n];Kh(e,3*_*(n>v-4?n-v+4:0),4*(this._cubeSize-_),3*_,2*_),o.setRenderTarget(e),o.render(c,Hh)}}function $h(t,e,i){const n=new pi(t,e,i);return n.texture.mapping=z,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Kh(t,e,i,n,s){t.viewport.set(e,i,n,s),t.scissor.set(e,i,n,s)}function Qh(){return new Ls({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ed(),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:0,depthTest:!1,depthWrite:!1})}function td(){return new Ls({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ed(),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:0,depthTest:!1,depthWrite:!1})}function ed(){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 id(t){let e=new WeakMap,i=null;function n(t){const i=t.target;i.removeEventListener("dispose",n);const s=e.get(i);void 0!==s&&(e.delete(i),s.dispose())}return{get:function(s){if(s&&s.isTexture){const r=s.mapping,a=r===B||r===F,o=r===N||r===O;if(a||o){let r=e.get(s);const l=void 0!==r?r.texture.pmremVersion:0;if(s.isRenderTargetTexture&&s.pmremVersion!==l)return null===i&&(i=new Jh(t)),r=a?i.fromEquirectangular(s,r):i.fromCubemap(s,r),r.texture.pmremVersion=s.pmremVersion,e.set(s,r),r.texture;if(void 0!==r)return r.texture;{const l=s.image;return a&&l&&l.height>0||o&&l&&function(t){let e=0;const i=6;for(let n=0;n<i;n++)void 0!==t[n]&&e++;return e===i}(l)?(null===i&&(i=new Jh(t)),r=a?i.fromEquirectangular(s):i.fromCubemap(s),r.texture.pmremVersion=s.pmremVersion,e.set(s,r),s.addEventListener("dispose",n),r.texture):null}}}return s},dispose:function(){e=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function nd(t){const e={};function i(i){if(void 0!==e[i])return e[i];let n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=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":n=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":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return e[i]=n,n}return{has:function(t){return null!==i(t)},init:function(){i("EXT_color_buffer_float"),i("WEBGL_clip_cull_distance"),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture"),i("WEBGL_render_shared_exponent")},get:function(t){const e=i(t);return null===e&&$e("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function sd(t,e,i,n){const s={},r=new WeakMap;function a(t){const o=t.target;null!==o.index&&e.remove(o.index);for(const t in o.attributes)e.remove(o.attributes[t]);o.removeEventListener("dispose",a),delete s[o.id];const l=r.get(o);l&&(e.remove(l),r.delete(o)),n.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,i.memory.geometries--}function o(t){const i=[],n=t.index,s=t.attributes.position;let a=0;if(null!==n){const t=n.array;a=n.version;for(let e=0,n=t.length;e<n;e+=3){const n=t[e+0],s=t[e+1],r=t[e+2];i.push(n,s,s,r,r,n)}}else{if(void 0===s)return;{const t=s.array;a=s.version;for(let e=0,n=t.length/3-1;e<n;e+=3){const t=e+0,n=e+1,s=e+2;i.push(t,n,n,s,s,t)}}}const o=new(We(i)?es:ts)(i,1);o.version=a;const l=r.get(t);l&&e.remove(l),r.set(t,o)}return{get:function(t,e){return!0===s[e.id]||(e.addEventListener("dispose",a),s[e.id]=!0,i.memory.geometries++),e},update:function(i){const n=i.attributes;for(const i in n)e.update(n[i],t.ARRAY_BUFFER)},getWireframeAttribute:function(t){const e=r.get(t);if(e){const i=t.index;null!==i&&e.version<i.version&&o(t)}else o(t);return r.get(t)}}}function rd(t,e,i){let n,s,r;function a(e,a,o){0!==o&&(t.drawElementsInstanced(n,a,s,e*r,o),i.update(a,n,o))}this.setMode=function(t){n=t},this.setIndex=function(t){s=t.type,r=t.bytesPerElement},this.render=function(e,a){t.drawElements(n,a,s,e*r),i.update(a,n,1)},this.renderInstances=a,this.renderMultiDraw=function(t,r,a){if(0===a)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,r,0,s,t,0,a);let o=0;for(let t=0;t<a;t++)o+=r[t];i.update(o,n,1)},this.renderMultiDrawInstances=function(t,o,l,c){if(0===l)return;const h=e.get("WEBGL_multi_draw");if(null===h)for(let e=0;e<t.length;e++)a(t[e]/r,o[e],c[e]);else{h.multiDrawElementsInstancedWEBGL(n,o,0,s,t,0,c,0,l);let e=0;for(let t=0;t<l;t++)e+=o[t]*c[t];i.update(e,n,1)}}}function ad(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(i,n,s){switch(e.calls++,n){case t.TRIANGLES:e.triangles+=s*(i/3);break;case t.LINES:e.lines+=s*(i/2);break;case t.LINE_STRIP:e.lines+=s*(i-1);break;case t.LINE_LOOP:e.lines+=s*i;break;case t.POINTS:e.points+=s*i;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function od(t,e,i){const n=new WeakMap,s=new di;return{update:function(r,a,o){const l=r.morphTargetInfluences,c=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=void 0!==c?c.length:0;let d=n.get(a);if(void 0===d||d.count!==h){void 0!==d&&d.texture.dispose();const u=void 0!==a.morphAttributes.position,p=void 0!==a.morphAttributes.normal,m=void 0!==a.morphAttributes.color,f=a.morphAttributes.position||[],g=a.morphAttributes.normal||[],v=a.morphAttributes.color||[];let _=0;!0===u&&(_=1),!0===p&&(_=2),!0===m&&(_=3);let y=a.attributes.position.count*_,x=1;y>e.maxTextureSize&&(x=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const w=new Float32Array(y*x*4*h),b=new mi(w,y,x,h);b.type=it,b.needsUpdate=!0;const M=4*_;for(let T=0;T<h;T++){const E=f[T],A=g[T],C=v[T],L=y*x*4*T;for(let k=0;k<E.count;k++){const R=k*M;!0===u&&(s.fromBufferAttribute(E,k),w[L+R+0]=s.x,w[L+R+1]=s.y,w[L+R+2]=s.z,w[L+R+3]=0),!0===p&&(s.fromBufferAttribute(A,k),w[L+R+4]=s.x,w[L+R+5]=s.y,w[L+R+6]=s.z,w[L+R+7]=0),!0===m&&(s.fromBufferAttribute(C,k),w[L+R+8]=s.x,w[L+R+9]=s.y,w[L+R+10]=s.z,w[L+R+11]=4===C.itemSize?s.w:1)}}function S(){b.dispose(),n.delete(a),a.removeEventListener("dispose",S)}d={count:h,texture:b,size:new Ve(y,x)},n.set(a,d),a.addEventListener("dispose",S)}if(!0===r.isInstancedMesh&&null!==r.morphTexture)o.getUniforms().setValue(t,"morphTexture",r.morphTexture,i);else{let P=0;for(let U=0;U<l.length;U++)P+=l[U];const I=a.morphTargetsRelative?1:1-P;o.getUniforms().setValue(t,"morphTargetBaseInfluence",I),o.getUniforms().setValue(t,"morphTargetInfluences",l)}o.getUniforms().setValue(t,"morphTargetsTexture",d.texture,i),o.getUniforms().setValue(t,"morphTargetsTextureSize",d.size)}}}function ld(t,e,i,n){let s=new WeakMap;function r(t){const e=t.target;e.removeEventListener("dispose",r),i.remove(e.instanceMatrix),null!==e.instanceColor&&i.remove(e.instanceColor)}return{update:function(a){const o=n.render.frame,l=a.geometry,c=e.get(a,l);if(s.get(c)!==o&&(e.update(c),s.set(c,o)),a.isInstancedMesh&&(!1===a.hasEventListener("dispose",r)&&a.addEventListener("dispose",r),s.get(a)!==o&&(i.update(a.instanceMatrix,t.ARRAY_BUFFER),null!==a.instanceColor&&i.update(a.instanceColor,t.ARRAY_BUFFER),s.set(a,o))),a.isSkinnedMesh){const t=a.skeleton;s.get(t)!==o&&(t.update(),s.set(t,o))}return c},dispose:function(){s=new WeakMap}}}const cd=new hi,hd=new Ra(1,1),dd=new mi,ud=new fi,pd=new Os,md=[],fd=[],gd=new Float32Array(16),vd=new Float32Array(9),_d=new Float32Array(4);function yd(t,e,i){const n=t[0];if(n<=0||n>0)return t;const s=e*i;let r=md[s];if(void 0===r&&(r=new Float32Array(s),md[s]=r),0!==e){n.toArray(r,0);for(let n=1,s=0;n!==e;++n)s+=i,t[n].toArray(r,s)}return r}function xd(t,e){if(t.length!==e.length)return!1;for(let i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function wd(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function bd(t,e){let i=fd[e];void 0===i&&(i=new Int32Array(e),fd[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function Md(t,e){const i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function Sd(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(xd(i,e))return;t.uniform2fv(this.addr,e),wd(i,e)}}function Td(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(void 0!==e.r)i[0]===e.r&&i[1]===e.g&&i[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(xd(i,e))return;t.uniform3fv(this.addr,e),wd(i,e)}}function Ed(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(xd(i,e))return;t.uniform4fv(this.addr,e),wd(i,e)}}function Ad(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(xd(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),wd(i,e)}else{if(xd(i,n))return;_d.set(n),t.uniformMatrix2fv(this.addr,!1,_d),wd(i,n)}}function Cd(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(xd(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),wd(i,e)}else{if(xd(i,n))return;vd.set(n),t.uniformMatrix3fv(this.addr,!1,vd),wd(i,n)}}function Ld(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(xd(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),wd(i,e)}else{if(xd(i,n))return;gd.set(n),t.uniformMatrix4fv(this.addr,!1,gd),wd(i,n)}}function kd(t,e){const i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function Rd(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2i(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(xd(i,e))return;t.uniform2iv(this.addr,e),wd(i,e)}}function Pd(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3i(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else{if(xd(i,e))return;t.uniform3iv(this.addr,e),wd(i,e)}}function Id(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(xd(i,e))return;t.uniform4iv(this.addr,e),wd(i,e)}}function Ud(t,e){const i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function Dd(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2ui(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(xd(i,e))return;t.uniform2uiv(this.addr,e),wd(i,e)}}function Nd(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3ui(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else{if(xd(i,e))return;t.uniform3uiv(this.addr,e),wd(i,e)}}function Od(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(xd(i,e))return;t.uniform4uiv(this.addr,e),wd(i,e)}}function Bd(t,e,i){const n=this.cache,s=i.allocateTextureUnit();let r;n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),this.type===t.SAMPLER_2D_SHADOW?(hd.compareFunction=515,r=hd):r=cd,i.setTexture2D(e||r,s)}function Fd(t,e,i){const n=this.cache,s=i.allocateTextureUnit();n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),i.setTexture3D(e||ud,s)}function zd(t,e,i){const n=this.cache,s=i.allocateTextureUnit();n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),i.setTextureCube(e||pd,s)}function Hd(t,e,i){const n=this.cache,s=i.allocateTextureUnit();n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),i.setTexture2DArray(e||dd,s)}function Vd(t,e){t.uniform1fv(this.addr,e)}function Gd(t,e){const i=yd(e,this.size,2);t.uniform2fv(this.addr,i)}function jd(t,e){const i=yd(e,this.size,3);t.uniform3fv(this.addr,i)}function Wd(t,e){const i=yd(e,this.size,4);t.uniform4fv(this.addr,i)}function qd(t,e){const i=yd(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function Xd(t,e){const i=yd(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function Zd(t,e){const i=yd(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function Yd(t,e){t.uniform1iv(this.addr,e)}function Jd(t,e){t.uniform2iv(this.addr,e)}function $d(t,e){t.uniform3iv(this.addr,e)}function Kd(t,e){t.uniform4iv(this.addr,e)}function Qd(t,e){t.uniform1uiv(this.addr,e)}function tu(t,e){t.uniform2uiv(this.addr,e)}function eu(t,e){t.uniform3uiv(this.addr,e)}function iu(t,e){t.uniform4uiv(this.addr,e)}function nu(t,e,i){const n=this.cache,s=e.length,r=bd(i,s);xd(n,r)||(t.uniform1iv(this.addr,r),wd(n,r));for(let t=0;t!==s;++t)i.setTexture2D(e[t]||cd,r[t])}function su(t,e,i){const n=this.cache,s=e.length,r=bd(i,s);xd(n,r)||(t.uniform1iv(this.addr,r),wd(n,r));for(let t=0;t!==s;++t)i.setTexture3D(e[t]||ud,r[t])}function ru(t,e,i){const n=this.cache,s=e.length,r=bd(i,s);xd(n,r)||(t.uniform1iv(this.addr,r),wd(n,r));for(let t=0;t!==s;++t)i.setTextureCube(e[t]||pd,r[t])}function au(t,e,i){const n=this.cache,s=e.length,r=bd(i,s);xd(n,r)||(t.uniform1iv(this.addr,r),wd(n,r));for(let t=0;t!==s;++t)i.setTexture2DArray(e[t]||dd,r[t])}class ou{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.type=e.type,this.setValue=function(t){switch(t){case 5126:return Md;case 35664:return Sd;case 35665:return Td;case 35666:return Ed;case 35674:return Ad;case 35675:return Cd;case 35676:return Ld;case 5124:case 35670:return kd;case 35667:case 35671:return Rd;case 35668:case 35672:return Pd;case 35669:case 35673:return Id;case 5125:return Ud;case 36294:return Dd;case 36295:return Nd;case 36296:return Od;case 35678:case 36198:case 36298:case 36306:case 35682:return Bd;case 35679:case 36299:case 36307:return Fd;case 35680:case 36300:case 36308:case 36293:return zd;case 36289:case 36303:case 36311:case 36292:return Hd}}(e.type)}}class lu{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Vd;case 35664:return Gd;case 35665:return jd;case 35666:return Wd;case 35674:return qd;case 35675:return Xd;case 35676:return Zd;case 5124:case 35670:return Yd;case 35667:case 35671:return Jd;case 35668:case 35672:return $d;case 35669:case 35673:return Kd;case 5125:return Qd;case 36294:return tu;case 36295:return eu;case 36296:return iu;case 35678:case 36198:case 36298:case 36306:case 35682:return nu;case 35679:case 36299:case 36307:return su;case 35680:case 36300:case 36308:case 36293:return ru;case 36289:case 36303:case 36311:case 36292:return au}}(e.type)}}class cu{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,i){const n=this.seq;for(let s=0,r=n.length;s!==r;++s){const r=n[s];r.setValue(t,e[r.id],i)}}}const hu=/(\w+)(\])?(\[|\.)?/g;function du(t,e){t.seq.push(e),t.map[e.id]=e}function uu(t,e,i){const n=t.name,s=n.length;for(hu.lastIndex=0;;){const r=hu.exec(n),a=hu.lastIndex;let o=r[1];const l="]"===r[2],c=r[3];if(l&&(o|=0),void 0===c||"["===c&&a+2===s){du(i,void 0===c?new ou(o,t,e):new lu(o,t,e));break}{let t=i.map[o];void 0===t&&(t=new cu(o),du(i,t)),i=t}}}class pu{constructor(t,e){this.seq=[],this.map={};const i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let n=0;n<i;++n){const i=t.getActiveUniform(e,n);uu(i,t.getUniformLocation(e,i.name),this)}}setValue(t,e,i,n){const s=this.map[e];void 0!==s&&s.setValue(t,i,n)}setOptional(t,e,i){const n=e[i];void 0!==n&&this.setValue(t,i,n)}static upload(t,e,i,n){for(let s=0,r=e.length;s!==r;++s){const r=e[s],a=i[r.id];!1!==a.needsUpdate&&r.setValue(t,a.value,n)}}static seqWithValue(t,e){const i=[];for(let n=0,s=t.length;n!==s;++n){const s=t[n];s.id in e&&i.push(s)}return i}}function mu(t,e,i){const n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}let fu=0;const gu=new Ge;function vu(t,e,i){const n=t.getShaderParameter(e,t.COMPILE_STATUS),s=t.getShaderInfoLog(e).trim();if(n&&""===s)return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const n=parseInt(r[1]);return i.toUpperCase()+"\n\n"+s+"\n\n"+function(t,e){const i=t.split("\n"),n=[],s=Math.max(e-6,0),r=Math.min(e+6,i.length);for(let t=s;t<r;t++){const s=t+1;n.push(`${s===e?">":" "} ${s}: ${i[t]}`)}return n.join("\n")}(t.getShaderSource(e),n)}return s}function _u(t,e){const i=function(t){ei._getMatrix(gu,ei.workingColorSpace,t);const e=`mat3( ${gu.elements.map((t=>t.toFixed(4)))} )`;switch(ei.getTransfer(t)){case de:return[e,"LinearTransferOETF"];case ue:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}(e);return[`vec4 ${t}( vec4 value ) {`,`\treturn ${i[1]}( vec4( value.rgb * ${i[0]}, value.a ) );`,"}"].join("\n")}function yu(t,e){let i;switch(e){case 1:i="Linear";break;case 2:i="Reinhard";break;case 3:i="Cineon";break;case 4:i="ACESFilmic";break;case 6:i="AgX";break;case 7:i="Neutral";break;case 5:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),i="Linear"}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}const xu=new vi;function wu(){ei.getLuminanceCoefficients(xu);return["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${xu.x.toFixed(4)}, ${xu.y.toFixed(4)}, ${xu.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")}function bu(t){return""!==t}function Mu(t,e){const i=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,i).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 Su(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Tu=/^[ \t]*#include +<([\w\d./]+)>/gm;function Eu(t){return t.replace(Tu,Cu)}const Au=new Map;function Cu(t,e){let i=Ah[e];if(void 0===i){const t=Au.get(e);if(void 0===t)throw new Error("Can not resolve #include <"+e+">");i=Ah[t],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,t)}return Eu(i)}const Lu=/#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 ku(t){return t.replace(Lu,Ru)}function Ru(t,e,i,n){let s="";for(let t=parseInt(e);t<parseInt(i);t++)s+=n.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return s}function Pu(t){let e=`precision ${t.precision} float;\n\tprecision ${t.precision} int;\n\tprecision ${t.precision} sampler2D;\n\tprecision ${t.precision} samplerCube;\n\tprecision ${t.precision} sampler3D;\n\tprecision ${t.precision} sampler2DArray;\n\tprecision ${t.precision} sampler2DShadow;\n\tprecision ${t.precision} samplerCubeShadow;\n\tprecision ${t.precision} sampler2DArrayShadow;\n\tprecision ${t.precision} isampler2D;\n\tprecision ${t.precision} isampler3D;\n\tprecision ${t.precision} isamplerCube;\n\tprecision ${t.precision} isampler2DArray;\n\tprecision ${t.precision} usampler2D;\n\tprecision ${t.precision} usampler3D;\n\tprecision ${t.precision} usamplerCube;\n\tprecision ${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 Iu(t,e,i,n){const s=t.getContext(),r=i.defines;let a=i.vertexShader,o=i.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(i),c=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case N:case O:e="ENVMAP_TYPE_CUBE";break;case z:e="ENVMAP_TYPE_CUBE_UV"}return e}(i),h=function(t){let e="ENVMAP_MODE_REFLECTION";t.envMap&&t.envMapMode===O&&(e="ENVMAP_MODE_REFRACTION");return e}(i),d=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(i),u=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const i=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:n,maxMip:i}}(i),p=function(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(bu).join("\n")}(i),m=function(t){const e=[];for(const i in t){const n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(r),f=s.createProgram();let g,v,_=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?(g=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,m].filter(bu).join("\n"),g.length>0&&(g+="\n"),v=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,m].filter(bu).join("\n"),v.length>0&&(v+="\n")):(g=[Pu(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,m,i.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",i.batching?"#define USE_BATCHING":"",i.batchingColor?"#define USE_BATCHING_COLOR":"",i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.instancingMorph?"#define USE_INSTANCING_MORPH":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+h:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.displacementMap?"#define USE_DISPLACEMENTMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.mapUv?"#define MAP_UV "+i.mapUv:"",i.alphaMapUv?"#define ALPHAMAP_UV "+i.alphaMapUv:"",i.lightMapUv?"#define LIGHTMAP_UV "+i.lightMapUv:"",i.aoMapUv?"#define AOMAP_UV "+i.aoMapUv:"",i.emissiveMapUv?"#define EMISSIVEMAP_UV "+i.emissiveMapUv:"",i.bumpMapUv?"#define BUMPMAP_UV "+i.bumpMapUv:"",i.normalMapUv?"#define NORMALMAP_UV "+i.normalMapUv:"",i.displacementMapUv?"#define DISPLACEMENTMAP_UV "+i.displacementMapUv:"",i.metalnessMapUv?"#define METALNESSMAP_UV "+i.metalnessMapUv:"",i.roughnessMapUv?"#define ROUGHNESSMAP_UV "+i.roughnessMapUv:"",i.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+i.anisotropyMapUv:"",i.clearcoatMapUv?"#define CLEARCOATMAP_UV "+i.clearcoatMapUv:"",i.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+i.clearcoatNormalMapUv:"",i.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+i.clearcoatRoughnessMapUv:"",i.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+i.iridescenceMapUv:"",i.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+i.iridescenceThicknessMapUv:"",i.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+i.sheenColorMapUv:"",i.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+i.sheenRoughnessMapUv:"",i.specularMapUv?"#define SPECULARMAP_UV "+i.specularMapUv:"",i.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+i.specularColorMapUv:"",i.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+i.specularIntensityMapUv:"",i.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+i.transmissionMapUv:"",i.thicknessMapUv?"#define THICKNESSMAP_UV "+i.thicknessMapUv:"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.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(bu).join("\n"),v=[Pu(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,m,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+c:"",i.envMap?"#define "+h:"",i.envMap?"#define "+d:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.dispersion?"#define USE_DISPERSION":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor||i.batchingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?Ah.tonemapping_pars_fragment:"",0!==i.toneMapping?yu("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",Ah.colorspace_pars_fragment,_u("linearToOutputTexel",i.outputColorSpace),wu(),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(bu).join("\n")),a=Eu(a),a=Mu(a,i),a=Su(a,i),o=Eu(o),o=Mu(o,i),o=Su(o,i),a=ku(a),o=ku(o),!0!==i.isRawShaderMaterial&&(_="#version 300 es\n",g=[p,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in",i.glslVersion===Ae?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===Ae?"":"#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"+v);const y=_+g+a,x=_+v+o,w=mu(s,s.VERTEX_SHADER,y),b=mu(s,s.FRAGMENT_SHADER,x);function M(e){if(t.debug.checkShaderErrors){const i=s.getProgramInfoLog(f).trim(),n=s.getShaderInfoLog(w).trim(),r=s.getShaderInfoLog(b).trim();let a=!0,o=!0;if(!1===s.getProgramParameter(f,s.LINK_STATUS))if(a=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(s,f,w,b);else{const t=vu(s,w,"vertex"),n=vu(s,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(f,s.VALIDATE_STATUS)+"\n\nMaterial Name: "+e.name+"\nMaterial Type: "+e.type+"\n\nProgram Info Log: "+i+"\n"+t+"\n"+n)}else""!==i?console.warn("THREE.WebGLProgram: Program Info Log:",i):""!==n&&""!==r||(o=!1);o&&(e.diagnostics={runnable:a,programLog:i,vertexShader:{log:n,prefix:g},fragmentShader:{log:r,prefix:v}})}s.deleteShader(w),s.deleteShader(b),S=new pu(s,f),T=function(t,e){const i={},n=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){const n=t.getActiveAttrib(e,s),r=n.name;let a=1;n.type===t.FLOAT_MAT2&&(a=2),n.type===t.FLOAT_MAT3&&(a=3),n.type===t.FLOAT_MAT4&&(a=4),i[r]={type:n.type,location:t.getAttribLocation(e,r),locationSize:a}}return i}(s,f)}let S,T;s.attachShader(f,w),s.attachShader(f,b),void 0!==i.index0AttributeName?s.bindAttribLocation(f,0,i.index0AttributeName):!0===i.morphTargets&&s.bindAttribLocation(f,0,"position"),s.linkProgram(f),this.getUniforms=function(){return void 0===S&&M(this),S},this.getAttributes=function(){return void 0===T&&M(this),T};let E=!1===i.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===E&&(E=s.getProgramParameter(f,37297)),E},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(f),this.program=void 0},this.type=i.shaderType,this.name=i.shaderName,this.id=fu++,this.cacheKey=e,this.usedTimes=1,this.program=f,this.vertexShader=w,this.fragmentShader=b,this}let Uu=0;class Du{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,i=t.fragmentShader,n=this._getShaderStage(e),s=this._getShaderStage(i),r=this._getShaderCacheForMaterial(t);return!1===r.has(n)&&(r.add(n),n.usedTimes++),!1===r.has(s)&&(r.add(s),s.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const t of e)t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let i=e.get(t);return void 0===i&&(i=new Set,e.set(t,i)),i}_getShaderStage(t){const e=this.shaderCache;let i=e.get(t);return void 0===i&&(i=new Nu(t),e.set(t,i)),i}}class Nu{constructor(t){this.id=Uu++,this.code=t,this.usedTimes=0}}function Ou(t,e,i,n,s,r,a){const o=new rn,l=new Du,c=new Set,h=[],d=s.logarithmicDepthBuffer,u=s.vertexTextures;let p=s.precision;const m={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 f(t){return c.add(t),0===t?"uv":`uv${t}`}return{getParameters:function(r,o,h,g,v){const _=g.fog,y=v.geometry,x=r.isMeshStandardMaterial?g.environment:null,w=(r.isMeshStandardMaterial?i:e).get(r.envMap||x),b=w&&w.mapping===z?w.image.height:null,M=m[r.type];null!==r.precision&&(p=s.getMaxPrecision(r.precision),p!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",p,"instead."));const S=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,T=void 0!==S?S.length:0;let E,A,C,L,k=0;if(void 0!==y.morphAttributes.position&&(k=1),void 0!==y.morphAttributes.normal&&(k=2),void 0!==y.morphAttributes.color&&(k=3),M){const t=Lh[M];E=t.vertexShader,A=t.fragmentShader}else E=r.vertexShader,A=r.fragmentShader,l.update(r),C=l.getVertexShaderID(r),L=l.getFragmentShaderID(r);const R=t.getRenderTarget(),P=t.state.buffers.depth.getReversed(),I=!0===v.isInstancedMesh,U=!0===v.isBatchedMesh,D=!!r.map,N=!!r.matcap,O=!!w,B=!!r.aoMap,F=!!r.lightMap,H=!!r.bumpMap,V=!!r.normalMap,G=!!r.displacementMap,j=!!r.emissiveMap,W=!!r.metalnessMap,q=!!r.roughnessMap,X=r.anisotropy>0,Z=r.clearcoat>0,Y=r.dispersion>0,J=r.iridescence>0,$=r.sheen>0,K=r.transmission>0,Q=X&&!!r.anisotropyMap,tt=Z&&!!r.clearcoatMap,et=Z&&!!r.clearcoatNormalMap,it=Z&&!!r.clearcoatRoughnessMap,nt=J&&!!r.iridescenceMap,st=J&&!!r.iridescenceThicknessMap,rt=$&&!!r.sheenColorMap,at=$&&!!r.sheenRoughnessMap,ot=!!r.specularMap,lt=!!r.specularColorMap,ct=!!r.specularIntensityMap,ht=K&&!!r.transmissionMap,dt=K&&!!r.thicknessMap,ut=!!r.gradientMap,pt=!!r.alphaMap,mt=r.alphaTest>0,ft=!!r.alphaHash,gt=!!r.extensions;let vt=0;r.toneMapped&&(null!==R&&!0!==R.isXRRenderTarget||(vt=t.toneMapping));const _t={shaderID:M,shaderType:r.type,shaderName:r.name,vertexShader:E,fragmentShader:A,defines:r.defines,customVertexShaderID:C,customFragmentShaderID:L,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:p,batching:U,batchingColor:U&&null!==v._colorsTexture,instancing:I,instancingColor:I&&null!==v.instanceColor,instancingMorph:I&&null!==v.morphTexture,supportsVertexTextures:u,outputColorSpace:null===R?t.outputColorSpace:!0===R.isXRRenderTarget?R.texture.colorSpace:he,alphaToCoverage:!!r.alphaToCoverage,map:D,matcap:N,envMap:O,envMapMode:O&&w.mapping,envMapCubeUVHeight:b,aoMap:B,lightMap:F,bumpMap:H,normalMap:V,displacementMap:u&&G,emissiveMap:j,normalMapObjectSpace:V&&1===r.normalMapType,normalMapTangentSpace:V&&0===r.normalMapType,metalnessMap:W,roughnessMap:q,anisotropy:X,anisotropyMap:Q,clearcoat:Z,clearcoatMap:tt,clearcoatNormalMap:et,clearcoatRoughnessMap:it,dispersion:Y,iridescence:J,iridescenceMap:nt,iridescenceThicknessMap:st,sheen:$,sheenColorMap:rt,sheenRoughnessMap:at,specularMap:ot,specularColorMap:lt,specularIntensityMap:ct,transmission:K,transmissionMap:ht,thicknessMap:dt,gradientMap:ut,opaque:!1===r.transparent&&1===r.blending&&!1===r.alphaToCoverage,alphaMap:pt,alphaTest:mt,alphaHash:ft,combine:r.combine,mapUv:D&&f(r.map.channel),aoMapUv:B&&f(r.aoMap.channel),lightMapUv:F&&f(r.lightMap.channel),bumpMapUv:H&&f(r.bumpMap.channel),normalMapUv:V&&f(r.normalMap.channel),displacementMapUv:G&&f(r.displacementMap.channel),emissiveMapUv:j&&f(r.emissiveMap.channel),metalnessMapUv:W&&f(r.metalnessMap.channel),roughnessMapUv:q&&f(r.roughnessMap.channel),anisotropyMapUv:Q&&f(r.anisotropyMap.channel),clearcoatMapUv:tt&&f(r.clearcoatMap.channel),clearcoatNormalMapUv:et&&f(r.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:it&&f(r.clearcoatRoughnessMap.channel),iridescenceMapUv:nt&&f(r.iridescenceMap.channel),iridescenceThicknessMapUv:st&&f(r.iridescenceThicknessMap.channel),sheenColorMapUv:rt&&f(r.sheenColorMap.channel),sheenRoughnessMapUv:at&&f(r.sheenRoughnessMap.channel),specularMapUv:ot&&f(r.specularMap.channel),specularColorMapUv:lt&&f(r.specularColorMap.channel),specularIntensityMapUv:ct&&f(r.specularIntensityMap.channel),transmissionMapUv:ht&&f(r.transmissionMap.channel),thicknessMapUv:dt&&f(r.thicknessMap.channel),alphaMapUv:pt&&f(r.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(V||X),vertexColors:r.vertexColors,vertexAlphas:!0===r.vertexColors&&!!y.attributes.color&&4===y.attributes.color.itemSize,pointsUvs:!0===v.isPoints&&!!y.attributes.uv&&(D||pt),fog:!!_,useFog:!0===r.fog,fogExp2:!!_&&_.isFogExp2,flatShading:!0===r.flatShading,sizeAttenuation:!0===r.sizeAttenuation,logarithmicDepthBuffer:d,reverseDepthBuffer:P,skinning:!0===v.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:T,morphTextureStride:k,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.length>0,shadowMapType:t.shadowMap.type,toneMapping:vt,decodeVideoTexture:D&&!0===r.map.isVideoTexture&&ei.getTransfer(r.map.colorSpace)===ue,decodeVideoTextureEmissive:j&&!0===r.emissiveMap.isVideoTexture&&ei.getTransfer(r.emissiveMap.colorSpace)===ue,premultipliedAlpha:r.premultipliedAlpha,doubleSided:2===r.side,flipSided:1===r.side,useDepthPacking:r.depthPacking>=0,depthPacking:r.depthPacking||0,index0AttributeName:r.index0AttributeName,extensionClipCullDistance:gt&&!0===r.extensions.clipCullDistance&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(gt&&!0===r.extensions.multiDraw||U)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:r.customProgramCacheKey()};return _t.vertexUv1s=c.has(1),_t.vertexUv2s=c.has(2),_t.vertexUv3s=c.has(3),c.clear(),_t},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.customVertexShaderID),i.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(!function(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)}(i,e),function(t,e){o.disableAll(),e.supportsVertexTextures&&o.enable(0);e.instancing&&o.enable(1);e.instancingColor&&o.enable(2);e.instancingMorph&&o.enable(3);e.matcap&&o.enable(4);e.envMap&&o.enable(5);e.normalMapObjectSpace&&o.enable(6);e.normalMapTangentSpace&&o.enable(7);e.clearcoat&&o.enable(8);e.iridescence&&o.enable(9);e.alphaTest&&o.enable(10);e.vertexColors&&o.enable(11);e.vertexAlphas&&o.enable(12);e.vertexUv1s&&o.enable(13);e.vertexUv2s&&o.enable(14);e.vertexUv3s&&o.enable(15);e.vertexTangents&&o.enable(16);e.anisotropy&&o.enable(17);e.alphaHash&&o.enable(18);e.batching&&o.enable(19);e.dispersion&&o.enable(20);e.batchingColor&&o.enable(21);t.push(o.mask),o.disableAll(),e.fog&&o.enable(0);e.useFog&&o.enable(1);e.flatShading&&o.enable(2);e.logarithmicDepthBuffer&&o.enable(3);e.reverseDepthBuffer&&o.enable(4);e.skinning&&o.enable(5);e.morphTargets&&o.enable(6);e.morphNormals&&o.enable(7);e.morphColors&&o.enable(8);e.premultipliedAlpha&&o.enable(9);e.shadowMapEnabled&&o.enable(10);e.doubleSided&&o.enable(11);e.flipSided&&o.enable(12);e.useDepthPacking&&o.enable(13);e.dithering&&o.enable(14);e.transmission&&o.enable(15);e.sheen&&o.enable(16);e.opaque&&o.enable(17);e.pointsUvs&&o.enable(18);e.decodeVideoTexture&&o.enable(19);e.decodeVideoTextureEmissive&&o.enable(20);e.alphaToCoverage&&o.enable(21);t.push(o.mask)}(i,e),i.push(t.outputColorSpace)),i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=m[t.type];let i;if(e){const t=Lh[e];i=Cs.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n;for(let t=0,e=h.length;t<e;t++){const e=h[t];if(e.cacheKey===i){n=e,++n.usedTimes;break}}return void 0===n&&(n=new Iu(t,i,e,r),h.push(n)),n},releaseProgram:function(t){if(0==--t.usedTimes){const e=h.indexOf(t);h[e]=h[h.length-1],h.pop(),t.destroy()}},releaseShaderCache:function(t){l.remove(t)},programs:h,dispose:function(){l.dispose()}}}function Bu(){let t=new WeakMap;return{has:function(e){return t.has(e)},get:function(e){let i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i},remove:function(e){t.delete(e)},update:function(e,i,n){t.get(e)[i]=n},dispose:function(){t=new WeakMap}}}function Fu(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 zu(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 Hu(){const t=[];let e=0;const i=[],n=[],s=[];function r(i,n,s,r,a,o){let l=t[e];return void 0===l?(l={id:i.id,object:i,geometry:n,material:s,groupOrder:r,renderOrder:i.renderOrder,z:a,group:o},t[e]=l):(l.id=i.id,l.object=i,l.geometry=n,l.material=s,l.groupOrder=r,l.renderOrder=i.renderOrder,l.z=a,l.group=o),e++,l}return{opaque:i,transmissive:n,transparent:s,init:function(){e=0,i.length=0,n.length=0,s.length=0},push:function(t,e,a,o,l,c){const h=r(t,e,a,o,l,c);a.transmission>0?n.push(h):!0===a.transparent?s.push(h):i.push(h)},unshift:function(t,e,a,o,l,c){const h=r(t,e,a,o,l,c);a.transmission>0?n.unshift(h):!0===a.transparent?s.unshift(h):i.unshift(h)},finish:function(){for(let i=e,n=t.length;i<n;i++){const e=t[i];if(null===e.id)break;e.id=null,e.object=null,e.geometry=null,e.material=null,e.group=null}},sort:function(t,e){i.length>1&&i.sort(t||Fu),n.length>1&&n.sort(e||zu),s.length>1&&s.sort(e||zu)}}}function Vu(){let t=new WeakMap;return{get:function(e,i){const n=t.get(e);let s;return void 0===n?(s=new Hu,t.set(e,[s])):i>=n.length?(s=new Hu,n.push(s)):s=n[i],s},dispose:function(){t=new WeakMap}}}function Gu(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":i={direction:new vi,color:new zn};break;case"SpotLight":i={position:new vi,direction:new vi,color:new zn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new vi,color:new zn,distance:0,decay:0};break;case"HemisphereLight":i={direction:new vi,skyColor:new zn,groundColor:new zn};break;case"RectAreaLight":i={color:new zn,position:new vi,halfWidth:new vi,halfHeight:new vi}}return t[e.id]=i,i}}}let ju=0;function Wu(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function qu(t){const e=new Gu,i=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ve};break;case"PointLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ve,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}}(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let t=0;t<9;t++)n.probe.push(new vi);const s=new vi,r=new Xi,a=new Xi;return{setup:function(s){let r=0,a=0,o=0;for(let t=0;t<9;t++)n.probe[t].set(0,0,0);let l=0,c=0,h=0,d=0,u=0,p=0,m=0,f=0,g=0,v=0,_=0;s.sort(Wu);for(let t=0,y=s.length;t<y;t++){const y=s[t],x=y.color,w=y.intensity,b=y.distance,M=y.shadow&&y.shadow.map?y.shadow.map.texture:null;if(y.isAmbientLight)r+=x.r*w,a+=x.g*w,o+=x.b*w;else if(y.isLightProbe){for(let t=0;t<9;t++)n.probe[t].addScaledVector(y.sh.coefficients[t],w);_++}else if(y.isDirectionalLight){const t=e.get(y);if(t.color.copy(y.color).multiplyScalar(y.intensity),y.castShadow){const t=y.shadow,e=i.get(y);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,n.directionalShadow[l]=e,n.directionalShadowMap[l]=M,n.directionalShadowMatrix[l]=y.shadow.matrix,p++}n.directional[l]=t,l++}else if(y.isSpotLight){const t=e.get(y);t.position.setFromMatrixPosition(y.matrixWorld),t.color.copy(x).multiplyScalar(w),t.distance=b,t.coneCos=Math.cos(y.angle),t.penumbraCos=Math.cos(y.angle*(1-y.penumbra)),t.decay=y.decay,n.spot[h]=t;const s=y.shadow;if(y.map&&(n.spotLightMap[g]=y.map,g++,s.updateMatrices(y),y.castShadow&&v++),n.spotLightMatrix[h]=s.matrix,y.castShadow){const t=i.get(y);t.shadowIntensity=s.intensity,t.shadowBias=s.bias,t.shadowNormalBias=s.normalBias,t.shadowRadius=s.radius,t.shadowMapSize=s.mapSize,n.spotShadow[h]=t,n.spotShadowMap[h]=M,f++}h++}else if(y.isRectAreaLight){const t=e.get(y);t.color.copy(x).multiplyScalar(w),t.halfWidth.set(.5*y.width,0,0),t.halfHeight.set(0,.5*y.height,0),n.rectArea[d]=t,d++}else if(y.isPointLight){const t=e.get(y);if(t.color.copy(y.color).multiplyScalar(y.intensity),t.distance=y.distance,t.decay=y.decay,y.castShadow){const t=y.shadow,e=i.get(y);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,e.shadowCameraNear=t.camera.near,e.shadowCameraFar=t.camera.far,n.pointShadow[c]=e,n.pointShadowMap[c]=M,n.pointShadowMatrix[c]=y.shadow.matrix,m++}n.point[c]=t,c++}else if(y.isHemisphereLight){const t=e.get(y);t.skyColor.copy(y.color).multiplyScalar(w),t.groundColor.copy(y.groundColor).multiplyScalar(w),n.hemi[u]=t,u++}}d>0&&(!0===t.has("OES_texture_float_linear")?(n.rectAreaLTC1=Ch.LTC_FLOAT_1,n.rectAreaLTC2=Ch.LTC_FLOAT_2):(n.rectAreaLTC1=Ch.LTC_HALF_1,n.rectAreaLTC2=Ch.LTC_HALF_2)),n.ambient[0]=r,n.ambient[1]=a,n.ambient[2]=o;const y=n.hash;y.directionalLength===l&&y.pointLength===c&&y.spotLength===h&&y.rectAreaLength===d&&y.hemiLength===u&&y.numDirectionalShadows===p&&y.numPointShadows===m&&y.numSpotShadows===f&&y.numSpotMaps===g&&y.numLightProbes===_||(n.directional.length=l,n.spot.length=h,n.rectArea.length=d,n.point.length=c,n.hemi.length=u,n.directionalShadow.length=p,n.directionalShadowMap.length=p,n.pointShadow.length=m,n.pointShadowMap.length=m,n.spotShadow.length=f,n.spotShadowMap.length=f,n.directionalShadowMatrix.length=p,n.pointShadowMatrix.length=m,n.spotLightMatrix.length=f+g-v,n.spotLightMap.length=g,n.numSpotLightShadowsWithMaps=v,n.numLightProbes=_,y.directionalLength=l,y.pointLength=c,y.spotLength=h,y.rectAreaLength=d,y.hemiLength=u,y.numDirectionalShadows=p,y.numPointShadows=m,y.numSpotShadows=f,y.numSpotMaps=g,y.numLightProbes=_,n.version=ju++)},setupView:function(t,e){let i=0,o=0,l=0,c=0,h=0;const d=e.matrixWorldInverse;for(let e=0,u=t.length;e<u;e++){const u=t[e];if(u.isDirectionalLight){const t=n.directional[i];t.direction.setFromMatrixPosition(u.matrixWorld),s.setFromMatrixPosition(u.target.matrixWorld),t.direction.sub(s),t.direction.transformDirection(d),i++}else if(u.isSpotLight){const t=n.spot[l];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),t.direction.setFromMatrixPosition(u.matrixWorld),s.setFromMatrixPosition(u.target.matrixWorld),t.direction.sub(s),t.direction.transformDirection(d),l++}else if(u.isRectAreaLight){const t=n.rectArea[c];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),a.identity(),r.copy(u.matrixWorld),r.premultiply(d),a.extractRotation(r),t.halfWidth.set(.5*u.width,0,0),t.halfHeight.set(0,.5*u.height,0),t.halfWidth.applyMatrix4(a),t.halfHeight.applyMatrix4(a),c++}else if(u.isPointLight){const t=n.point[o];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),o++}else if(u.isHemisphereLight){const t=n.hemi[h];t.direction.setFromMatrixPosition(u.matrixWorld),t.direction.transformDirection(d),h++}}},state:n}}function Xu(t){const e=new qu(t),i=[],n=[];const s={lightsArray:i,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:function(t){s.camera=t,i.length=0,n.length=0},state:s,setupLights:function(){e.setup(i)},setupLightsView:function(t){e.setupView(i,t)},pushLight:function(t){i.push(t)},pushShadow:function(t){n.push(t)}}}function Zu(t){let e=new WeakMap;return{get:function(i,n=0){const s=e.get(i);let r;return void 0===s?(r=new Xu(t),e.set(i,[r])):n>=s.length?(r=new Xu(t),s.push(r)):r=s[n],r},dispose:function(){e=new WeakMap}}}function Yu(t,e,i){let n=new Gr;const o=new Ve,l=new Ve,c=new di,h=new dl({depthPacking:3201}),d=new ul,u={},p=i.maxTextureSize,m={[s]:1,[r]:0,[a]:2},f=new Ls({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ve},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"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}"}),g=f.clone();g.defines.HORIZONTAL_PASS=1;const v=new hs;v.setAttribute("position",new Qn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new bs(v,f),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let x=this.type;function w(i,n){const s=e.update(_);f.defines.VSM_SAMPLES!==i.blurSamples&&(f.defines.VSM_SAMPLES=i.blurSamples,g.defines.VSM_SAMPLES=i.blurSamples,f.needsUpdate=!0,g.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new pi(o.x,o.y)),f.uniforms.shadow_pass.value=i.map.texture,f.uniforms.resolution.value=i.mapSize,f.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,s,f,_,null),g.uniforms.shadow_pass.value=i.mapPass.texture,g.uniforms.resolution.value=i.mapSize,g.uniforms.radius.value=i.radius,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,s,g,_,null)}function b(e,i,n,s){let r=null;const a=!0===n.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==a)r=a;else if(r=!0===n.isPointLight?d:h,t.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0||i.map&&i.alphaTest>0){const t=r.uuid,e=i.uuid;let n=u[t];void 0===n&&(n={},u[t]=n);let s=n[e];void 0===s&&(s=r.clone(),n[e]=s,i.addEventListener("dispose",S)),r=s}if(r.visible=i.visible,r.wireframe=i.wireframe,r.side=3===s?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:m[i.side],r.alphaMap=i.alphaMap,r.alphaTest=i.alphaTest,r.map=i.map,r.clipShadows=i.clipShadows,r.clippingPlanes=i.clippingPlanes,r.clipIntersection=i.clipIntersection,r.displacementMap=i.displacementMap,r.displacementScale=i.displacementScale,r.displacementBias=i.displacementBias,r.wireframeLinewidth=i.wireframeLinewidth,r.linewidth=i.linewidth,!0===n.isPointLight&&!0===r.isMeshDistanceMaterial){t.properties.get(r).light=n}return r}function M(i,s,r,a,o){if(!1===i.visible)return;if(i.layers.test(s.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&3===o)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,i.matrixWorld);const n=e.update(i),l=i.material;if(Array.isArray(l)){const e=n.groups;for(let c=0,h=e.length;c<h;c++){const h=e[c],d=l[h.materialIndex];if(d&&d.visible){const e=b(i,d,a,o);i.onBeforeShadow(t,i,s,r,n,e,h),t.renderBufferDirect(r,null,n,e,i,h),i.onAfterShadow(t,i,s,r,n,e,h)}}}else if(l.visible){const e=b(i,l,a,o);i.onBeforeShadow(t,i,s,r,n,e,null),t.renderBufferDirect(r,null,n,e,i,null),i.onAfterShadow(t,i,s,r,n,e,null)}}const l=i.children;for(let t=0,e=l.length;t<e;t++)M(l[t],s,r,a,o)}function S(t){t.target.removeEventListener("dispose",S);for(const e in u){const i=u[e],n=t.target.uuid;if(n in i){i[n].dispose(),delete i[n]}}}this.render=function(e,i,s){if(!1===y.enabled)return;if(!1===y.autoUpdate&&!1===y.needsUpdate)return;if(0===e.length)return;const r=t.getRenderTarget(),a=t.getActiveCubeFace(),h=t.getActiveMipmapLevel(),d=t.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);const u=3!==x&&3===this.type,m=3===x&&3!==this.type;for(let r=0,a=e.length;r<a;r++){const a=e[r],h=a.shadow;if(void 0===h){console.warn("THREE.WebGLShadowMap:",a,"has no shadow.");continue}if(!1===h.autoUpdate&&!1===h.needsUpdate)continue;o.copy(h.mapSize);const f=h.getFrameExtents();if(o.multiply(f),l.copy(h.mapSize),(o.x>p||o.y>p)&&(o.x>p&&(l.x=Math.floor(p/f.x),o.x=l.x*f.x,h.mapSize.x=l.x),o.y>p&&(l.y=Math.floor(p/f.y),o.y=l.y*f.y,h.mapSize.y=l.y)),null===h.map||!0===u||!0===m){const t=3!==this.type?{minFilter:j,magFilter:j}:{};null!==h.map&&h.map.dispose(),h.map=new pi(o.x,o.y,t),h.map.texture.name=a.name+".shadowMap",h.camera.updateProjectionMatrix()}t.setRenderTarget(h.map),t.clear();const g=h.getViewportCount();for(let t=0;t<g;t++){const e=h.getViewport(t);c.set(l.x*e.x,l.y*e.y,l.x*e.z,l.y*e.w),d.viewport(c),h.updateMatrices(a,t),n=h.getFrustum(),M(i,s,h.camera,a,this.type)}!0!==h.isPointLightShadow&&3===this.type&&w(h,s),h.needsUpdate=!1}x=this.type,y.needsUpdate=!1,t.setRenderTarget(r,a,h)}}const Ju={[T]:1,[A]:6,[L]:7,[C]:5,[E]:0,[R]:2,[P]:4,[k]:3};function $u(t,e){const i=new function(){let e=!1;const i=new di;let n=null;const s=new di(0,0,0,0);return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,r,a,o){!0===o&&(e*=a,n*=a,r*=a),i.set(e,n,r,a),!1===s.equals(i)&&(t.clearColor(e,n,r,a),s.copy(i))},reset:function(){e=!1,n=null,s.set(-1,0,0,0)}}},n=new function(){let i=!1,n=!1,s=null,r=null,a=null;return{setReversed:function(t){if(n!==t){const t=e.get("EXT_clip_control");n?t.clipControlEXT(t.LOWER_LEFT_EXT,t.ZERO_TO_ONE_EXT):t.clipControlEXT(t.LOWER_LEFT_EXT,t.NEGATIVE_ONE_TO_ONE_EXT);const i=a;a=null,this.setClear(i)}n=t},getReversed:function(){return n},setTest:function(e){e?st(t.DEPTH_TEST):rt(t.DEPTH_TEST)},setMask:function(e){s===e||i||(t.depthMask(e),s=e)},setFunc:function(e){if(n&&(e=Ju[e]),r!==e){switch(e){case 0:t.depthFunc(t.NEVER);break;case 1:t.depthFunc(t.ALWAYS);break;case 2:t.depthFunc(t.LESS);break;case 3:default:t.depthFunc(t.LEQUAL);break;case 4:t.depthFunc(t.EQUAL);break;case 5:t.depthFunc(t.GEQUAL);break;case 6:t.depthFunc(t.GREATER);break;case 7:t.depthFunc(t.NOTEQUAL)}r=e}},setLocked:function(t){i=t},setClear:function(e){a!==e&&(n&&(e=1-e),t.clearDepth(e),a=e)},reset:function(){i=!1,s=null,r=null,a=null,n=!1}}},s=new function(){let e=!1,i=null,n=null,s=null,r=null,a=null,o=null,l=null,c=null;return{setTest:function(i){e||(i?st(t.STENCIL_TEST):rt(t.STENCIL_TEST))},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,a){n===e&&s===i&&r===a||(t.stencilFunc(e,i,a),n=e,s=i,r=a)},setOp:function(e,i,n){a===e&&o===i&&l===n||(t.stencilOp(e,i,n),a=e,o=i,l=n)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,i=null,n=null,s=null,r=null,a=null,o=null,l=null,c=null}}},r=new WeakMap,a=new WeakMap;let T={},E={},A=new WeakMap,C=[],L=null,k=!1,R=null,P=null,I=null,U=null,D=null,N=null,O=null,B=new zn(0,0,0),F=0,z=!1,H=null,V=null,G=null,j=null,W=null;const q=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let X=!1,Z=0;const Y=t.getParameter(t.VERSION);-1!==Y.indexOf("WebGL")?(Z=parseFloat(/^WebGL (\d)/.exec(Y)[1]),X=Z>=1):-1!==Y.indexOf("OpenGL ES")&&(Z=parseFloat(/^OpenGL ES (\d)/.exec(Y)[1]),X=Z>=2);let J=null,$={};const K=t.getParameter(t.SCISSOR_BOX),Q=t.getParameter(t.VIEWPORT),tt=(new di).fromArray(K),et=(new di).fromArray(Q);function it(e,i,n,s){const r=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let a=0;a<n;a++)e===t.TEXTURE_3D||e===t.TEXTURE_2D_ARRAY?t.texImage3D(i,0,t.RGBA,1,1,s,0,t.RGBA,t.UNSIGNED_BYTE,r):t.texImage2D(i+a,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,r);return a}const nt={};function st(e){!0!==T[e]&&(t.enable(e),T[e]=!0)}function rt(e){!1!==T[e]&&(t.disable(e),T[e]=!1)}nt[t.TEXTURE_2D]=it(t.TEXTURE_2D,t.TEXTURE_2D,1),nt[t.TEXTURE_CUBE_MAP]=it(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),nt[t.TEXTURE_2D_ARRAY]=it(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),nt[t.TEXTURE_3D]=it(t.TEXTURE_3D,t.TEXTURE_3D,1,1),i.setClear(0,0,0,1),n.setClear(1),s.setClear(0),st(t.DEPTH_TEST),n.setFunc(3),ct(!1),ht(1),st(t.CULL_FACE),lt(0);const at={[o]:t.FUNC_ADD,[l]:t.FUNC_SUBTRACT,[c]:t.FUNC_REVERSE_SUBTRACT};at[103]=t.MIN,at[104]=t.MAX;const ot={[h]:t.ZERO,[d]:t.ONE,[u]:t.SRC_COLOR,[m]:t.SRC_ALPHA,[x]:t.SRC_ALPHA_SATURATE,[_]:t.DST_COLOR,[g]:t.DST_ALPHA,[p]:t.ONE_MINUS_SRC_COLOR,[f]:t.ONE_MINUS_SRC_ALPHA,[y]:t.ONE_MINUS_DST_COLOR,[v]:t.ONE_MINUS_DST_ALPHA,[w]:t.CONSTANT_COLOR,[b]:t.ONE_MINUS_CONSTANT_COLOR,[M]:t.CONSTANT_ALPHA,[S]:t.ONE_MINUS_CONSTANT_ALPHA};function lt(e,i,n,s,r,a,l,c,h,d){if(0!==e){if(!1===k&&(st(t.BLEND),k=!0),5===e)r=r||i,a=a||n,l=l||s,i===P&&r===D||(t.blendEquationSeparate(at[i],at[r]),P=i,D=r),n===I&&s===U&&a===N&&l===O||(t.blendFuncSeparate(ot[n],ot[s],ot[a],ot[l]),I=n,U=s,N=a,O=l),!1!==c.equals(B)&&h===F||(t.blendColor(c.r,c.g,c.b,h),B.copy(c),F=h),R=e,z=!1;else if(e!==R||d!==z){if(P===o&&D===o||(t.blendEquation(t.FUNC_ADD),P=o,D=o),d)switch(e){case 1:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.ONE,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}I=null,U=null,N=null,O=null,B.set(0,0,0),F=0,R=e,z=d}}else!0===k&&(rt(t.BLEND),k=!1)}function ct(e){H!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),H=e)}function ht(e){st(t.CULL_FACE),e!==V&&t.cullFace(t.BACK),V=e}function dt(e,i,n){e?(st(t.POLYGON_OFFSET_FILL),j===i&&W===n||(t.polygonOffset(i,n),j=i,W=n)):rt(t.POLYGON_OFFSET_FILL)}return{buffers:{color:i,depth:n,stencil:s},enable:st,disable:rt,bindFramebuffer:function(e,i){return E[e]!==i&&(t.bindFramebuffer(e,i),E[e]=i,e===t.DRAW_FRAMEBUFFER&&(E[t.FRAMEBUFFER]=i),e===t.FRAMEBUFFER&&(E[t.DRAW_FRAMEBUFFER]=i),!0)},drawBuffers:function(e,i){let n=C,s=!1;if(e){n=A.get(i),void 0===n&&(n=[],A.set(i,n));const r=e.textures;if(n.length!==r.length||n[0]!==t.COLOR_ATTACHMENT0){for(let e=0,i=r.length;e<i;e++)n[e]=t.COLOR_ATTACHMENT0+e;n.length=r.length,s=!0}}else n[0]!==t.BACK&&(n[0]=t.BACK,s=!0);s&&t.drawBuffers(n)},useProgram:function(e){return L!==e&&(t.useProgram(e),L=e,!0)},setBlending:lt,setMaterial:function(e,r){2===e.side?rt(t.CULL_FACE):st(t.CULL_FACE);let a=1===e.side;r&&(a=!a),ct(a),1===e.blending&&!1===e.transparent?lt(0):lt(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.blendColor,e.blendAlpha,e.premultipliedAlpha),n.setFunc(e.depthFunc),n.setTest(e.depthTest),n.setMask(e.depthWrite),i.setMask(e.colorWrite);const o=e.stencilWrite;s.setTest(o),o&&(s.setMask(e.stencilWriteMask),s.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),s.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),dt(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?st(t.SAMPLE_ALPHA_TO_COVERAGE):rt(t.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:ct,setCullFace:ht,setLineWidth:function(e){e!==G&&(X&&t.lineWidth(e),G=e)},setPolygonOffset:dt,setScissorTest:function(e){e?st(t.SCISSOR_TEST):rt(t.SCISSOR_TEST)},activeTexture:function(e){void 0===e&&(e=t.TEXTURE0+q-1),J!==e&&(t.activeTexture(e),J=e)},bindTexture:function(e,i,n){void 0===n&&(n=null===J?t.TEXTURE0+q-1:J);let s=$[n];void 0===s&&(s={type:void 0,texture:void 0},$[n]=s),s.type===e&&s.texture===i||(J!==n&&(t.activeTexture(n),J=n),t.bindTexture(e,i||nt[e]),s.type=e,s.texture=i)},unbindTexture:function(){const e=$[J];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexImage3D:function(){try{t.compressedTexImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},updateUBOMapping:function(e,i){let n=a.get(i);void 0===n&&(n=new WeakMap,a.set(i,n));let s=n.get(e);void 0===s&&(s=t.getUniformBlockIndex(i,e.name),n.set(e,s))},uniformBlockBinding:function(e,i){const n=a.get(i).get(e);r.get(i)!==n&&(t.uniformBlockBinding(i,n,e.__bindingPointIndex),r.set(i,n))},texStorage2D:function(){try{t.texStorage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage3D:function(){try{t.texStorage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage2D:function(){try{t.texSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage3D:function(){try{t.texSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage3D:function(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===tt.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),tt.copy(e))},viewport:function(e){!1===et.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),et.copy(e))},reset:function(){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),n.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),T={},J=null,$={},E={},A=new WeakMap,C=[],L=null,k=!1,R=null,P=null,I=null,U=null,D=null,N=null,O=null,B=new zn(0,0,0),F=0,z=!1,H=null,V=null,G=null,j=null,W=null,tt.set(0,0,t.canvas.width,t.canvas.height),et.set(0,0,t.canvas.width,t.canvas.height),i.reset(),n.reset(),s.reset()}}}function Ku(t,e,i,n,s,r,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new Ve,h=new WeakMap;let d;const u=new WeakMap;let p=!1;try{p="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function m(t,e){return p?new OffscreenCanvas(t,e):Ze("canvas")}function f(t,e,i){let n=1;const s=$(t);if((s.width>i||s.height>i)&&(n=i/Math.max(s.width,s.height)),n<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){const i=Math.floor(n*s.width),r=Math.floor(n*s.height);void 0===d&&(d=m(i,r));const a=e?m(i,r):d;a.width=i,a.height=r;return a.getContext("2d").drawImage(t,0,0,i,r),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+s.width+"x"+s.height+") to ("+i+"x"+r+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+s.width+"x"+s.height+")."),t}return t}function g(t){return t.generateMipmaps}function v(e){t.generateMipmap(e)}function _(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 y(i,n,s,r,a=!1){if(null!==i){if(void 0!==t[i])return t[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let o=n;if(n===t.RED&&(s===t.FLOAT&&(o=t.R32F),s===t.HALF_FLOAT&&(o=t.R16F),s===t.UNSIGNED_BYTE&&(o=t.R8)),n===t.RED_INTEGER&&(s===t.UNSIGNED_BYTE&&(o=t.R8UI),s===t.UNSIGNED_SHORT&&(o=t.R16UI),s===t.UNSIGNED_INT&&(o=t.R32UI),s===t.BYTE&&(o=t.R8I),s===t.SHORT&&(o=t.R16I),s===t.INT&&(o=t.R32I)),n===t.RG&&(s===t.FLOAT&&(o=t.RG32F),s===t.HALF_FLOAT&&(o=t.RG16F),s===t.UNSIGNED_BYTE&&(o=t.RG8)),n===t.RG_INTEGER&&(s===t.UNSIGNED_BYTE&&(o=t.RG8UI),s===t.UNSIGNED_SHORT&&(o=t.RG16UI),s===t.UNSIGNED_INT&&(o=t.RG32UI),s===t.BYTE&&(o=t.RG8I),s===t.SHORT&&(o=t.RG16I),s===t.INT&&(o=t.RG32I)),n===t.RGB_INTEGER&&(s===t.UNSIGNED_BYTE&&(o=t.RGB8UI),s===t.UNSIGNED_SHORT&&(o=t.RGB16UI),s===t.UNSIGNED_INT&&(o=t.RGB32UI),s===t.BYTE&&(o=t.RGB8I),s===t.SHORT&&(o=t.RGB16I),s===t.INT&&(o=t.RGB32I)),n===t.RGBA_INTEGER&&(s===t.UNSIGNED_BYTE&&(o=t.RGBA8UI),s===t.UNSIGNED_SHORT&&(o=t.RGBA16UI),s===t.UNSIGNED_INT&&(o=t.RGBA32UI),s===t.BYTE&&(o=t.RGBA8I),s===t.SHORT&&(o=t.RGBA16I),s===t.INT&&(o=t.RGBA32I)),n===t.RGB&&s===t.UNSIGNED_INT_5_9_9_9_REV&&(o=t.RGB9_E5),n===t.RGBA){const e=a?de:ei.getTransfer(r);s===t.FLOAT&&(o=t.RGBA32F),s===t.HALF_FLOAT&&(o=t.RGBA16F),s===t.UNSIGNED_BYTE&&(o=e===ue?t.SRGB8_ALPHA8:t.RGBA8),s===t.UNSIGNED_SHORT_4_4_4_4&&(o=t.RGBA4),s===t.UNSIGNED_SHORT_5_5_5_1&&(o=t.RGB5_A1)}return o!==t.R16F&&o!==t.R32F&&o!==t.RG16F&&o!==t.RG32F&&o!==t.RGBA16F&&o!==t.RGBA32F||e.get("EXT_color_buffer_float"),o}function x(e,i){let n;return e?null===i||i===et||i===at?n=t.DEPTH24_STENCIL8:i===it?n=t.DEPTH32F_STENCIL8:i===Q&&(n=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===i||i===et||i===at?n=t.DEPTH_COMPONENT24:i===it?n=t.DEPTH_COMPONENT32F:i===Q&&(n=t.DEPTH_COMPONENT16),n}function w(t,e){return!0===g(t)||t.isFramebufferTexture&&t.minFilter!==j&&t.minFilter!==X?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 b(t){const e=t.target;e.removeEventListener("dispose",b),function(t){const e=n.get(t);if(void 0===e.__webglInit)return;const i=t.source,s=u.get(i);if(s){const n=s[e.__cacheKey];n.usedTimes--,0===n.usedTimes&&S(t),0===Object.keys(s).length&&u.delete(i)}n.remove(t)}(e),e.isVideoTexture&&h.delete(e)}function M(e){const i=e.target;i.removeEventListener("dispose",M),function(e){const i=n.get(e);e.depthTexture&&(e.depthTexture.dispose(),n.remove(e.depthTexture));if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++){if(Array.isArray(i.__webglFramebuffer[e]))for(let n=0;n<i.__webglFramebuffer[e].length;n++)t.deleteFramebuffer(i.__webglFramebuffer[e][n]);else t.deleteFramebuffer(i.__webglFramebuffer[e]);i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[e])}else{if(Array.isArray(i.__webglFramebuffer))for(let e=0;e<i.__webglFramebuffer.length;e++)t.deleteFramebuffer(i.__webglFramebuffer[e]);else t.deleteFramebuffer(i.__webglFramebuffer);if(i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(let e=0;e<i.__webglColorRenderbuffer.length;e++)i.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(i.__webglColorRenderbuffer[e]);i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer)}const s=e.textures;for(let e=0,i=s.length;e<i;e++){const i=n.get(s[e]);i.__webglTexture&&(t.deleteTexture(i.__webglTexture),a.memory.textures--),n.remove(s[e])}n.remove(e)}(i)}function S(e){const i=n.get(e);t.deleteTexture(i.__webglTexture);const s=e.source;delete u.get(s)[i.__cacheKey],a.memory.textures--}let T=0;function E(e,s){const r=n.get(e);if(e.isVideoTexture&&function(t){const e=a.render.frame;h.get(t)!==e&&(h.set(t,e),t.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&r.__version!==e.version){const t=e.image;if(null===t)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==t.complete)return void P(r,e,s);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.bindTexture(t.TEXTURE_2D,r.__webglTexture,t.TEXTURE0+s)}const A={[H]:t.REPEAT,[V]:t.CLAMP_TO_EDGE,[G]:t.MIRRORED_REPEAT},C={[j]:t.NEAREST,[W]:t.NEAREST_MIPMAP_NEAREST,[q]:t.NEAREST_MIPMAP_LINEAR,[X]:t.LINEAR,[Z]:t.LINEAR_MIPMAP_NEAREST,[Y]:t.LINEAR_MIPMAP_LINEAR},L={[_e]:t.NEVER,[Te]:t.ALWAYS,[ye]:t.LESS,[we]:t.LEQUAL,[xe]:t.EQUAL,[Se]:t.GEQUAL,[be]:t.GREATER,[Me]:t.NOTEQUAL};function k(i,r){if(r.type!==it||!1!==e.has("OES_texture_float_linear")||r.magFilter!==X&&r.magFilter!==Z&&r.magFilter!==q&&r.magFilter!==Y&&r.minFilter!==X&&r.minFilter!==Z&&r.minFilter!==q&&r.minFilter!==Y||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(i,t.TEXTURE_WRAP_S,A[r.wrapS]),t.texParameteri(i,t.TEXTURE_WRAP_T,A[r.wrapT]),i!==t.TEXTURE_3D&&i!==t.TEXTURE_2D_ARRAY||t.texParameteri(i,t.TEXTURE_WRAP_R,A[r.wrapR]),t.texParameteri(i,t.TEXTURE_MAG_FILTER,C[r.magFilter]),t.texParameteri(i,t.TEXTURE_MIN_FILTER,C[r.minFilter]),r.compareFunction&&(t.texParameteri(i,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(i,t.TEXTURE_COMPARE_FUNC,L[r.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){if(r.magFilter===j)return;if(r.minFilter!==q&&r.minFilter!==Y)return;if(r.type===it&&!1===e.has("OES_texture_float_linear"))return;if(r.anisotropy>1||n.get(r).__currentAnisotropy){const a=e.get("EXT_texture_filter_anisotropic");t.texParameterf(i,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(r.anisotropy,s.getMaxAnisotropy())),n.get(r).__currentAnisotropy=r.anisotropy}}}function R(e,i){let n=!1;void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",b));const s=i.source;let r=u.get(s);void 0===r&&(r={},u.set(s,r));const o=function(t){const 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()}(i);if(o!==e.__cacheKey){void 0===r[o]&&(r[o]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,n=!0),r[o].usedTimes++;const s=r[e.__cacheKey];void 0!==s&&(r[e.__cacheKey].usedTimes--,0===s.usedTimes&&S(i)),e.__cacheKey=o,e.__webglTexture=r[o].texture}return n}function P(e,a,o){let l=t.TEXTURE_2D;(a.isDataArrayTexture||a.isCompressedArrayTexture)&&(l=t.TEXTURE_2D_ARRAY),a.isData3DTexture&&(l=t.TEXTURE_3D);const c=R(e,a),h=a.source;i.bindTexture(l,e.__webglTexture,t.TEXTURE0+o);const d=n.get(h);if(h.version!==d.__version||!0===c){i.activeTexture(t.TEXTURE0+o);const e=ei.getPrimaries(ei.workingColorSpace),n=a.colorSpace===le?null:ei.getPrimaries(a.colorSpace),u=a.colorSpace===le||e===n?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,a.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,a.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);let p=f(a.image,!1,s.maxTextureSize);p=z(a,p);const m=r.convert(a.format,a.colorSpace),_=r.convert(a.type);let b,M=y(a.internalFormat,m,_,a.colorSpace,a.isVideoTexture);k(l,a);const S=a.mipmaps,T=!0!==a.isVideoTexture,E=void 0===d.__version||!0===c,A=h.dataReady,C=w(a,p);if(a.isDepthTexture)M=x(a.format===mt,a.type),E&&(T?i.texStorage2D(t.TEXTURE_2D,1,M,p.width,p.height):i.texImage2D(t.TEXTURE_2D,0,M,p.width,p.height,0,m,_,null));else if(a.isDataTexture)if(S.length>0){T&&E&&i.texStorage2D(t.TEXTURE_2D,C,M,S[0].width,S[0].height);for(let e=0,n=S.length;e<n;e++)b=S[e],T?A&&i.texSubImage2D(t.TEXTURE_2D,e,0,0,b.width,b.height,m,_,b.data):i.texImage2D(t.TEXTURE_2D,e,M,b.width,b.height,0,m,_,b.data);a.generateMipmaps=!1}else T?(E&&i.texStorage2D(t.TEXTURE_2D,C,M,p.width,p.height),A&&i.texSubImage2D(t.TEXTURE_2D,0,0,0,p.width,p.height,m,_,p.data)):i.texImage2D(t.TEXTURE_2D,0,M,p.width,p.height,0,m,_,p.data);else if(a.isCompressedTexture)if(a.isCompressedArrayTexture){T&&E&&i.texStorage3D(t.TEXTURE_2D_ARRAY,C,M,S[0].width,S[0].height,p.depth);for(let e=0,n=S.length;e<n;e++)if(b=S[e],a.format!==ht)if(null!==m)if(T){if(A)if(a.layerUpdates.size>0){const n=Mh(b.width,b.height,a.format,a.type);for(const s of a.layerUpdates){const r=b.data.subarray(s*n/b.data.BYTES_PER_ELEMENT,(s+1)*n/b.data.BYTES_PER_ELEMENT);i.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,s,b.width,b.height,1,m,r)}a.clearLayerUpdates()}else i.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,b.width,b.height,p.depth,m,b.data)}else i.compressedTexImage3D(t.TEXTURE_2D_ARRAY,e,M,b.width,b.height,p.depth,0,b.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else T?A&&i.texSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,b.width,b.height,p.depth,m,_,b.data):i.texImage3D(t.TEXTURE_2D_ARRAY,e,M,b.width,b.height,p.depth,0,m,_,b.data)}else{T&&E&&i.texStorage2D(t.TEXTURE_2D,C,M,S[0].width,S[0].height);for(let e=0,n=S.length;e<n;e++)b=S[e],a.format!==ht?null!==m?T?A&&i.compressedTexSubImage2D(t.TEXTURE_2D,e,0,0,b.width,b.height,m,b.data):i.compressedTexImage2D(t.TEXTURE_2D,e,M,b.width,b.height,0,b.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):T?A&&i.texSubImage2D(t.TEXTURE_2D,e,0,0,b.width,b.height,m,_,b.data):i.texImage2D(t.TEXTURE_2D,e,M,b.width,b.height,0,m,_,b.data)}else if(a.isDataArrayTexture)if(T){if(E&&i.texStorage3D(t.TEXTURE_2D_ARRAY,C,M,p.width,p.height,p.depth),A)if(a.layerUpdates.size>0){const e=Mh(p.width,p.height,a.format,a.type);for(const n of a.layerUpdates){const s=p.data.subarray(n*e/p.data.BYTES_PER_ELEMENT,(n+1)*e/p.data.BYTES_PER_ELEMENT);i.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,n,p.width,p.height,1,m,_,s)}a.clearLayerUpdates()}else i.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,m,_,p.data)}else i.texImage3D(t.TEXTURE_2D_ARRAY,0,M,p.width,p.height,p.depth,0,m,_,p.data);else if(a.isData3DTexture)T?(E&&i.texStorage3D(t.TEXTURE_3D,C,M,p.width,p.height,p.depth),A&&i.texSubImage3D(t.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,m,_,p.data)):i.texImage3D(t.TEXTURE_3D,0,M,p.width,p.height,p.depth,0,m,_,p.data);else if(a.isFramebufferTexture){if(E)if(T)i.texStorage2D(t.TEXTURE_2D,C,M,p.width,p.height);else{let e=p.width,n=p.height;for(let s=0;s<C;s++)i.texImage2D(t.TEXTURE_2D,s,M,e,n,0,m,_,null),e>>=1,n>>=1}}else if(S.length>0){if(T&&E){const e=$(S[0]);i.texStorage2D(t.TEXTURE_2D,C,M,e.width,e.height)}for(let e=0,n=S.length;e<n;e++)b=S[e],T?A&&i.texSubImage2D(t.TEXTURE_2D,e,0,0,m,_,b):i.texImage2D(t.TEXTURE_2D,e,M,m,_,b);a.generateMipmaps=!1}else if(T){if(E){const e=$(p);i.texStorage2D(t.TEXTURE_2D,C,M,e.width,e.height)}A&&i.texSubImage2D(t.TEXTURE_2D,0,0,0,m,_,p)}else i.texImage2D(t.TEXTURE_2D,0,M,m,_,p);g(a)&&v(l),d.__version=h.version,a.onUpdate&&a.onUpdate(a)}e.__version=a.version}function I(e,s,a,l,c,h){const d=r.convert(a.format,a.colorSpace),u=r.convert(a.type),p=y(a.internalFormat,d,u,a.colorSpace),m=n.get(s),f=n.get(a);if(f.__renderTarget=s,!m.__hasExternalTextures){const e=Math.max(1,s.width>>h),n=Math.max(1,s.height>>h);c===t.TEXTURE_3D||c===t.TEXTURE_2D_ARRAY?i.texImage3D(c,h,p,e,n,s.depth,0,d,u,null):i.texImage2D(c,h,p,e,n,0,d,u,null)}i.bindFramebuffer(t.FRAMEBUFFER,e),F(s)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,l,c,f.__webglTexture,0,B(s)):(c===t.TEXTURE_2D||c>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,l,c,f.__webglTexture,h),i.bindFramebuffer(t.FRAMEBUFFER,null)}function U(e,i,n){if(t.bindRenderbuffer(t.RENDERBUFFER,e),i.depthBuffer){const s=i.depthTexture,r=s&&s.isDepthTexture?s.type:null,a=x(i.stencilBuffer,r),l=i.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,c=B(i);F(i)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,c,a,i.width,i.height):n?t.renderbufferStorageMultisample(t.RENDERBUFFER,c,a,i.width,i.height):t.renderbufferStorage(t.RENDERBUFFER,a,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,l,t.RENDERBUFFER,e)}else{const e=i.textures;for(let s=0;s<e.length;s++){const a=e[s],l=r.convert(a.format,a.colorSpace),c=r.convert(a.type),h=y(a.internalFormat,l,c,a.colorSpace),d=B(i);n&&!1===F(i)?t.renderbufferStorageMultisample(t.RENDERBUFFER,d,h,i.width,i.height):F(i)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,d,h,i.width,i.height):t.renderbufferStorage(t.RENDERBUFFER,h,i.width,i.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function D(e){const s=n.get(e),r=!0===e.isWebGLCubeRenderTarget;if(s.__boundDepthTexture!==e.depthTexture){const t=e.depthTexture;if(s.__depthDisposeCallback&&s.__depthDisposeCallback(),t){const e=()=>{delete s.__boundDepthTexture,delete s.__depthDisposeCallback,t.removeEventListener("dispose",e)};t.addEventListener("dispose",e),s.__depthDisposeCallback=e}s.__boundDepthTexture=t}if(e.depthTexture&&!s.__autoAllocateDepthBuffer){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,s){if(s&&s.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(t.FRAMEBUFFER,e),!s.depthTexture||!s.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const r=n.get(s.depthTexture);r.__renderTarget=s,r.__webglTexture&&s.depthTexture.image.width===s.width&&s.depthTexture.image.height===s.height||(s.depthTexture.image.width=s.width,s.depthTexture.image.height=s.height,s.depthTexture.needsUpdate=!0),E(s.depthTexture,0);const a=r.__webglTexture,l=B(s);if(s.depthTexture.format===pt)F(s)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,a,0,l):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,a,0);else{if(s.depthTexture.format!==mt)throw new Error("Unknown depthTexture format");F(s)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,a,0,l):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,a,0)}}(s.__webglFramebuffer,e)}else if(r){s.__webglDepthbuffer=[];for(let n=0;n<6;n++)if(i.bindFramebuffer(t.FRAMEBUFFER,s.__webglFramebuffer[n]),void 0===s.__webglDepthbuffer[n])s.__webglDepthbuffer[n]=t.createRenderbuffer(),U(s.__webglDepthbuffer[n],e,!1);else{const i=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,r=s.__webglDepthbuffer[n];t.bindRenderbuffer(t.RENDERBUFFER,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,r)}}else if(i.bindFramebuffer(t.FRAMEBUFFER,s.__webglFramebuffer),void 0===s.__webglDepthbuffer)s.__webglDepthbuffer=t.createRenderbuffer(),U(s.__webglDepthbuffer,e,!1);else{const i=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,n=s.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,n),t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,n)}i.bindFramebuffer(t.FRAMEBUFFER,null)}const N=[],O=[];function B(t){return Math.min(s.maxSamples,t.samples)}function F(t){const i=n.get(t);return t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function z(t,e){const i=t.colorSpace,n=t.format,s=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||i!==he&&i!==le&&(ei.getTransfer(i)===ue?n===ht&&s===J||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",i)),e}function $(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?(c.width=t.naturalWidth||t.width,c.height=t.naturalHeight||t.height):"undefined"!=typeof VideoFrame&&t instanceof VideoFrame?(c.width=t.displayWidth,c.height=t.displayHeight):(c.width=t.width,c.height=t.height),c}this.allocateTextureUnit=function(){const t=T;return t>=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+s.maxTextures),T+=1,t},this.resetTextureUnits=function(){T=0},this.setTexture2D=E,this.setTexture2DArray=function(e,s){const r=n.get(e);e.version>0&&r.__version!==e.version?P(r,e,s):i.bindTexture(t.TEXTURE_2D_ARRAY,r.__webglTexture,t.TEXTURE0+s)},this.setTexture3D=function(e,s){const r=n.get(e);e.version>0&&r.__version!==e.version?P(r,e,s):i.bindTexture(t.TEXTURE_3D,r.__webglTexture,t.TEXTURE0+s)},this.setTextureCube=function(e,a){const o=n.get(e);e.version>0&&o.__version!==e.version?function(e,a,o){if(6!==a.image.length)return;const l=R(e,a),c=a.source;i.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+o);const h=n.get(c);if(c.version!==h.__version||!0===l){i.activeTexture(t.TEXTURE0+o);const e=ei.getPrimaries(ei.workingColorSpace),n=a.colorSpace===le?null:ei.getPrimaries(a.colorSpace),d=a.colorSpace===le||e===n?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,a.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,a.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);const u=a.isCompressedTexture||a.image[0].isCompressedTexture,p=a.image[0]&&a.image[0].isDataTexture,m=[];for(let t=0;t<6;t++)m[t]=u||p?p?a.image[t].image:a.image[t]:f(a.image[t],!0,s.maxCubemapSize),m[t]=z(a,m[t]);const _=m[0],x=r.convert(a.format,a.colorSpace),b=r.convert(a.type),M=y(a.internalFormat,x,b,a.colorSpace),S=!0!==a.isVideoTexture,T=void 0===h.__version||!0===l,E=c.dataReady;let A,C=w(a,_);if(k(t.TEXTURE_CUBE_MAP,a),u){S&&T&&i.texStorage2D(t.TEXTURE_CUBE_MAP,C,M,_.width,_.height);for(let e=0;e<6;e++){A=m[e].mipmaps;for(let n=0;n<A.length;n++){const s=A[n];a.format!==ht?null!==x?S?E&&i.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,s.width,s.height,x,s.data):i.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,M,s.width,s.height,0,s.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):S?E&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,s.width,s.height,x,b,s.data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,M,s.width,s.height,0,x,b,s.data)}}}else{if(A=a.mipmaps,S&&T){A.length>0&&C++;const e=$(m[0]);i.texStorage2D(t.TEXTURE_CUBE_MAP,C,M,e.width,e.height)}for(let e=0;e<6;e++)if(p){S?E&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,m[e].width,m[e].height,x,b,m[e].data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,M,m[e].width,m[e].height,0,x,b,m[e].data);for(let n=0;n<A.length;n++){const s=A[n].image[e].image;S?E&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,0,0,s.width,s.height,x,b,s.data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,M,s.width,s.height,0,x,b,s.data)}}else{S?E&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,x,b,m[e]):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,M,x,b,m[e]);for(let n=0;n<A.length;n++){const s=A[n];S?E&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,0,0,x,b,s.image[e]):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,M,x,b,s.image[e])}}}g(a)&&v(t.TEXTURE_CUBE_MAP),h.__version=c.version,a.onUpdate&&a.onUpdate(a)}e.__version=a.version}(o,e,a):i.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture,t.TEXTURE0+a)},this.rebindTextures=function(e,i,s){const r=n.get(e);void 0!==i&&I(r.__webglFramebuffer,e,e.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),void 0!==s&&D(e)},this.setupRenderTarget=function(e){const s=e.texture,o=n.get(e),l=n.get(s);e.addEventListener("dispose",M);const c=e.textures,h=!0===e.isWebGLCubeRenderTarget,d=c.length>1;if(d||(void 0===l.__webglTexture&&(l.__webglTexture=t.createTexture()),l.__version=s.version,a.memory.textures++),h){o.__webglFramebuffer=[];for(let e=0;e<6;e++)if(s.mipmaps&&s.mipmaps.length>0){o.__webglFramebuffer[e]=[];for(let i=0;i<s.mipmaps.length;i++)o.__webglFramebuffer[e][i]=t.createFramebuffer()}else o.__webglFramebuffer[e]=t.createFramebuffer()}else{if(s.mipmaps&&s.mipmaps.length>0){o.__webglFramebuffer=[];for(let e=0;e<s.mipmaps.length;e++)o.__webglFramebuffer[e]=t.createFramebuffer()}else o.__webglFramebuffer=t.createFramebuffer();if(d)for(let e=0,i=c.length;e<i;e++){const i=n.get(c[e]);void 0===i.__webglTexture&&(i.__webglTexture=t.createTexture(),a.memory.textures++)}if(e.samples>0&&!1===F(e)){o.__webglMultisampledFramebuffer=t.createFramebuffer(),o.__webglColorRenderbuffer=[],i.bindFramebuffer(t.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let i=0;i<c.length;i++){const n=c[i];o.__webglColorRenderbuffer[i]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,o.__webglColorRenderbuffer[i]);const s=r.convert(n.format,n.colorSpace),a=r.convert(n.type),l=y(n.internalFormat,s,a,n.colorSpace,!0===e.isXRRenderTarget),h=B(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,h,l,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+i,t.RENDERBUFFER,o.__webglColorRenderbuffer[i])}t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(o.__webglDepthRenderbuffer=t.createRenderbuffer(),U(o.__webglDepthRenderbuffer,e,!0)),i.bindFramebuffer(t.FRAMEBUFFER,null)}}if(h){i.bindTexture(t.TEXTURE_CUBE_MAP,l.__webglTexture),k(t.TEXTURE_CUBE_MAP,s);for(let i=0;i<6;i++)if(s.mipmaps&&s.mipmaps.length>0)for(let n=0;n<s.mipmaps.length;n++)I(o.__webglFramebuffer[i][n],e,s,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+i,n);else I(o.__webglFramebuffer[i],e,s,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+i,0);g(s)&&v(t.TEXTURE_CUBE_MAP),i.unbindTexture()}else if(d){for(let s=0,r=c.length;s<r;s++){const r=c[s],a=n.get(r);i.bindTexture(t.TEXTURE_2D,a.__webglTexture),k(t.TEXTURE_2D,r),I(o.__webglFramebuffer,e,r,t.COLOR_ATTACHMENT0+s,t.TEXTURE_2D,0),g(r)&&v(t.TEXTURE_2D)}i.unbindTexture()}else{let n=t.TEXTURE_2D;if((e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(n=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),i.bindTexture(n,l.__webglTexture),k(n,s),s.mipmaps&&s.mipmaps.length>0)for(let i=0;i<s.mipmaps.length;i++)I(o.__webglFramebuffer[i],e,s,t.COLOR_ATTACHMENT0,n,i);else I(o.__webglFramebuffer,e,s,t.COLOR_ATTACHMENT0,n,0);g(s)&&v(n),i.unbindTexture()}e.depthBuffer&&D(e)},this.updateRenderTargetMipmap=function(t){const e=t.textures;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(g(r)){const e=_(t),s=n.get(r).__webglTexture;i.bindTexture(e,s),v(e),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(e.samples>0)if(!1===F(e)){const s=e.textures,r=e.width,a=e.height;let o=t.COLOR_BUFFER_BIT;const c=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,h=n.get(e),d=s.length>1;if(d)for(let e=0;e<s.length;e++)i.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,null),i.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,null,0);i.bindFramebuffer(t.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),i.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let i=0;i<s.length;i++){if(e.resolveDepthBuffer&&(e.depthBuffer&&(o|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&e.resolveStencilBuffer&&(o|=t.STENCIL_BUFFER_BIT)),d){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,h.__webglColorRenderbuffer[i]);const e=n.get(s[i]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0)}t.blitFramebuffer(0,0,r,a,0,0,r,a,o,t.NEAREST),!0===l&&(N.length=0,O.length=0,N.push(t.COLOR_ATTACHMENT0+i),e.depthBuffer&&!1===e.resolveDepthBuffer&&(N.push(c),O.push(c),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,O)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,N))}if(i.bindFramebuffer(t.READ_FRAMEBUFFER,null),i.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),d)for(let e=0;e<s.length;e++){i.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,h.__webglColorRenderbuffer[e]);const r=n.get(s[e]).__webglTexture;i.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,r,0)}i.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(e.depthBuffer&&!1===e.resolveDepthBuffer&&l){const i=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[i])}},this.setupDepthRenderbuffer=D,this.setupFrameBufferTexture=I,this.useMultisampledRTT=F}function Qu(t,e){return{convert:function(i,n=""){let s;const r=ei.getTransfer(n);if(i===J)return t.UNSIGNED_BYTE;if(i===st)return t.UNSIGNED_SHORT_4_4_4_4;if(i===rt)return t.UNSIGNED_SHORT_5_5_5_1;if(i===ot)return t.UNSIGNED_INT_5_9_9_9_REV;if(i===$)return t.BYTE;if(i===K)return t.SHORT;if(i===Q)return t.UNSIGNED_SHORT;if(i===tt)return t.INT;if(i===et)return t.UNSIGNED_INT;if(i===it)return t.FLOAT;if(i===nt)return t.HALF_FLOAT;if(i===lt)return t.ALPHA;if(i===ct)return t.RGB;if(i===ht)return t.RGBA;if(i===dt)return t.LUMINANCE;if(i===ut)return t.LUMINANCE_ALPHA;if(i===pt)return t.DEPTH_COMPONENT;if(i===mt)return t.DEPTH_STENCIL;if(i===ft)return t.RED;if(i===gt)return t.RED_INTEGER;if(i===vt)return t.RG;if(i===_t)return t.RG_INTEGER;if(i===yt)return t.RGBA_INTEGER;if(i===xt||i===wt||i===bt||i===Mt)if(r===ue){if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===s)return null;if(i===xt)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===wt)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===bt)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Mt)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(s=e.get("WEBGL_compressed_texture_s3tc"),null===s)return null;if(i===xt)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===wt)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===bt)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Mt)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(i===St||i===Tt||i===Et||i===At){if(s=e.get("WEBGL_compressed_texture_pvrtc"),null===s)return null;if(i===St)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Tt)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Et)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===At)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(i===Ct||i===Lt||i===kt){if(s=e.get("WEBGL_compressed_texture_etc"),null===s)return null;if(i===Ct||i===Lt)return r===ue?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===kt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}if(i===Rt||i===Pt||i===It||i===Ut||i===Dt||i===Nt||i===Ot||i===Bt||i===Ft||i===zt||i===Ht||i===Vt||i===Gt||i===jt){if(s=e.get("WEBGL_compressed_texture_astc"),null===s)return null;if(i===Rt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Pt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===It)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Ut)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Dt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Nt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Ot)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===Bt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Ft)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===zt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Ht)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Vt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Gt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===jt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}if(i===Wt||i===qt||i===Xt){if(s=e.get("EXT_texture_compression_bptc"),null===s)return null;if(i===Wt)return r===ue?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===qt)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Xt)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(i===Zt||i===Yt||i===Jt||i===$t){if(s=e.get("EXT_texture_compression_rgtc"),null===s)return null;if(i===Wt)return s.COMPRESSED_RED_RGTC1_EXT;if(i===Yt)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Jt)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===$t)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return i===at?t.UNSIGNED_INT_24_8:void 0!==t[i]?t[i]:null}}}class tp{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,i){if(null===this.texture){const n=new hi;t.properties.get(n).__webglTexture=e.texture,e.depthNear===i.depthNear&&e.depthFar===i.depthFar||(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(t){if(null!==this.texture&&null===this.mesh){const e=t.cameras[0].viewport,i=new Ls({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\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}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new bs(new qo(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class ep extends ke{constructor(t,e){super();const i=this;let n=null,s=1,r=null,a="local-floor",o=1,l=null,c=null,h=null,d=null,u=null,p=null;const m=new tp,f=e.getContextAttributes();let g=null,v=null;const _=[],y=[],x=new Ve;let w=null;const b=new Us;b.viewport=new di;const M=new Us;M.viewport=new di;const S=[b,M],T=new wc;let E=null,A=null;function C(t){const e=y.indexOf(t.inputSource);if(-1===e)return;const i=_[e];void 0!==i&&(i.update(t.inputSource,t.frame,l||r),i.dispatchEvent({type:t.type,data:t.inputSource}))}function L(){n.removeEventListener("select",C),n.removeEventListener("selectstart",C),n.removeEventListener("selectend",C),n.removeEventListener("squeeze",C),n.removeEventListener("squeezestart",C),n.removeEventListener("squeezeend",C),n.removeEventListener("end",L),n.removeEventListener("inputsourceschange",k);for(let t=0;t<_.length;t++){const e=y[t];null!==e&&(y[t]=null,_[t].disconnect(e))}E=null,A=null,m.reset(),t.setRenderTarget(g),u=null,d=null,h=null,n=null,v=null,D.stop(),i.isPresenting=!1,t.setPixelRatio(w),t.setSize(x.width,x.height,!1),i.dispatchEvent({type:"sessionend"})}function k(t){for(let e=0;e<t.removed.length;e++){const i=t.removed[e],n=y.indexOf(i);n>=0&&(y[n]=null,_[n].disconnect(i))}for(let e=0;e<t.added.length;e++){const i=t.added[e];let n=y.indexOf(i);if(-1===n){for(let t=0;t<_.length;t++){if(t>=y.length){y.push(i),n=t;break}if(null===y[t]){y[t]=i,n=t;break}}if(-1===n)break}const s=_[n];s&&s.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=_[t];return void 0===e&&(e=new Hs,_[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=_[t];return void 0===e&&(e=new Hs,_[t]=e),e.getGripSpace()},this.getHand=function(t){let e=_[t];return void 0===e&&(e=new Hs,_[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){s=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){a=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||r},this.setReferenceSpace=function(t){l=t},this.getBaseLayer=function(){return null!==d?d:u},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return n},this.setSession=async function(c){if(n=c,null!==n){g=t.getRenderTarget(),n.addEventListener("select",C),n.addEventListener("selectstart",C),n.addEventListener("selectend",C),n.addEventListener("squeeze",C),n.addEventListener("squeezestart",C),n.addEventListener("squeezeend",C),n.addEventListener("end",L),n.addEventListener("inputsourceschange",k),!0!==f.xrCompatible&&await e.makeXRCompatible(),w=t.getPixelRatio(),t.getSize(x);if("undefined"!=typeof XRWebGLBinding&&"createProjectionLayer"in XRWebGLBinding.prototype){let i=null,r=null,a=null;f.depth&&(a=f.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,i=f.stencil?mt:pt,r=f.stencil?at:et);const o={colorFormat:e.RGBA8,depthFormat:a,scaleFactor:s};h=new XRWebGLBinding(n,e),d=h.createProjectionLayer(o),n.updateRenderState({layers:[d]}),t.setPixelRatio(1),t.setSize(d.textureWidth,d.textureHeight,!1),v=new pi(d.textureWidth,d.textureHeight,{format:ht,type:J,depthTexture:new Ra(d.textureWidth,d.textureHeight,r,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:f.stencil,colorSpace:t.outputColorSpace,samples:f.antialias?4:0,resolveDepthBuffer:!1===d.ignoreDepthValues})}else{const i={antialias:f.antialias,alpha:!0,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:s};u=new XRWebGLLayer(n,e,i),n.updateRenderState({baseLayer:u}),t.setPixelRatio(1),t.setSize(u.framebufferWidth,u.framebufferHeight,!1),v=new pi(u.framebufferWidth,u.framebufferHeight,{format:ht,type:J,colorSpace:t.outputColorSpace,stencilBuffer:f.stencil})}v.isXRRenderTarget=!0,this.setFoveation(o),l=null,r=await n.requestReferenceSpace(a),D.setContext(n),D.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==n)return n.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};const R=new vi,P=new vi;function I(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===n)return;let e=t.near,i=t.far;null!==m.texture&&(m.depthNear>0&&(e=m.depthNear),m.depthFar>0&&(i=m.depthFar)),T.near=M.near=b.near=e,T.far=M.far=b.far=i,E===T.near&&A===T.far||(n.updateRenderState({depthNear:T.near,depthFar:T.far}),E=T.near,A=T.far),b.layers.mask=2|t.layers.mask,M.layers.mask=4|t.layers.mask,T.layers.mask=b.layers.mask|M.layers.mask;const s=t.parent,r=T.cameras;I(T,s);for(let t=0;t<r.length;t++)I(r[t],s);2===r.length?function(t,e,i){R.setFromMatrixPosition(e.matrixWorld),P.setFromMatrixPosition(i.matrixWorld);const n=R.distanceTo(P),s=e.projectionMatrix.elements,r=i.projectionMatrix.elements,a=s[14]/(s[10]-1),o=s[14]/(s[10]+1),l=(s[9]+1)/s[5],c=(s[9]-1)/s[5],h=(s[8]-1)/s[0],d=(r[8]+1)/r[0],u=a*h,p=a*d,m=n/(-h+d),f=m*-h;if(e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(f),t.translateZ(m),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert(),-1===s[10])t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{const e=a+m,i=o+m,s=u-f,r=p+(n-f),h=l*o/i*e,d=c*o/i*e;t.projectionMatrix.makePerspective(s,r,h,d,e,i),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}}(T,b,M):T.projectionMatrix.copy(b.projectionMatrix),function(t,e,i){null===i?t.matrix.copy(e.matrixWorld):(t.matrix.copy(i.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*Ue*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}(t,T,s)},this.getCamera=function(){return T},this.getFoveation=function(){if(null!==d||null!==u)return o},this.setFoveation=function(t){o=t,null!==d&&(d.fixedFoveation=t),null!==u&&void 0!==u.fixedFoveation&&(u.fixedFoveation=t)},this.hasDepthSensing=function(){return null!==m.texture},this.getDepthSensingMesh=function(){return m.getMesh(T)};let U=null;const D=new Th;D.setAnimationLoop((function(e,s){if(c=s.getViewerPose(l||r),p=s,null!==c){const e=c.views;null!==u&&(t.setRenderTargetFramebuffer(v,u.framebuffer),t.setRenderTarget(v));let i=!1;e.length!==T.cameras.length&&(T.cameras.length=0,i=!0);for(let n=0;n<e.length;n++){const s=e[n];let r=null;if(null!==u)r=u.getViewport(s);else{const e=h.getViewSubImage(d,s);r=e.viewport,0===n&&(t.setRenderTargetTextures(v,e.colorTexture,d.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(v))}let a=S[n];void 0===a&&(a=new Us,a.layers.enable(n),a.viewport=new di,S[n]=a),a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale),a.projectionMatrix.fromArray(s.projectionMatrix),a.projectionMatrixInverse.copy(a.projectionMatrix).invert(),a.viewport.set(r.x,r.y,r.width,r.height),0===n&&(T.matrix.copy(a.matrix),T.matrix.decompose(T.position,T.quaternion,T.scale)),!0===i&&T.cameras.push(a)}const s=n.enabledFeatures;if(s&&s.includes("depth-sensing")&&"gpu-optimized"==n.depthUsage&&h){const i=h.getDepthInformation(e[0]);i&&i.isValid&&i.texture&&m.init(t,i,n.renderState)}}for(let t=0;t<_.length;t++){const e=y[t],i=_[t];null!==e&&void 0!==i&&i.update(e,s,l||r)}U&&U(e,s),s.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:s}),p=null})),this.setAnimationLoop=function(t){U=t},this.dispose=function(){}}}const ip=new sn,np=new Xi;function sp(t,e){function i(t,e){!0===t.matrixAutoUpdate&&t.updateMatrix(),e.value.copy(t.matrix)}function n(t,n){t.opacity.value=n.opacity,n.color&&t.diffuse.value.copy(n.color),n.emissive&&t.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(t.map.value=n.map,i(n.map,t.mapTransform)),n.alphaMap&&(t.alphaMap.value=n.alphaMap,i(n.alphaMap,t.alphaMapTransform)),n.bumpMap&&(t.bumpMap.value=n.bumpMap,i(n.bumpMap,t.bumpMapTransform),t.bumpScale.value=n.bumpScale,1===n.side&&(t.bumpScale.value*=-1)),n.normalMap&&(t.normalMap.value=n.normalMap,i(n.normalMap,t.normalMapTransform),t.normalScale.value.copy(n.normalScale),1===n.side&&t.normalScale.value.negate()),n.displacementMap&&(t.displacementMap.value=n.displacementMap,i(n.displacementMap,t.displacementMapTransform),t.displacementScale.value=n.displacementScale,t.displacementBias.value=n.displacementBias),n.emissiveMap&&(t.emissiveMap.value=n.emissiveMap,i(n.emissiveMap,t.emissiveMapTransform)),n.specularMap&&(t.specularMap.value=n.specularMap,i(n.specularMap,t.specularMapTransform)),n.alphaTest>0&&(t.alphaTest.value=n.alphaTest);const s=e.get(n),r=s.envMap,a=s.envMapRotation;r&&(t.envMap.value=r,ip.copy(a),ip.x*=-1,ip.y*=-1,ip.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(ip.y*=-1,ip.z*=-1),t.envMapRotation.value.setFromMatrix4(np.makeRotationFromEuler(ip)),t.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,t.reflectivity.value=n.reflectivity,t.ior.value=n.ior,t.refractionRatio.value=n.refractionRatio),n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity,i(n.lightMap,t.lightMapTransform)),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity,i(n.aoMap,t.aoMapTransform))}return{refreshFogUniforms:function(e,i){i.color.getRGB(e.fogColor.value,As(t)),i.isFog?(e.fogNear.value=i.near,e.fogFar.value=i.far):i.isFogExp2&&(e.fogDensity.value=i.density)},refreshMaterialUniforms:function(t,s,r,a,o){s.isMeshBasicMaterial||s.isMeshLambertMaterial?n(t,s):s.isMeshToonMaterial?(n(t,s),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,s)):s.isMeshPhongMaterial?(n(t,s),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,s)):s.isMeshStandardMaterial?(n(t,s),function(t,e){t.metalness.value=e.metalness,e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap,i(e.metalnessMap,t.metalnessMapTransform));t.roughness.value=e.roughness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap,i(e.roughnessMap,t.roughnessMapTransform));e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}(t,s),s.isMeshPhysicalMaterial&&function(t,e,n){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,i(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,i(e.sheenRoughnessMap,t.sheenRoughnessMapTransform)));e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,i(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,i(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,i(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),1===e.side&&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,i(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,i(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform)));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,i(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,i(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,i(e.anisotropyMap,t.anisotropyMapTransform)));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,i(e.specularColorMap,t.specularColorMapTransform));e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,i(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,s,o)):s.isMeshMatcapMaterial?(n(t,s),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,s)):s.isMeshDepthMaterial?n(t,s):s.isMeshDistanceMaterial?(n(t,s),function(t,i){const n=e.get(i).light;t.referencePosition.value.setFromMatrixPosition(n.matrixWorld),t.nearDistance.value=n.shadow.camera.near,t.farDistance.value=n.shadow.camera.far}(t,s)):s.isMeshNormalMaterial?n(t,s):s.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,i(e.map,t.mapTransform))}(t,s),s.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,s)):s.isPointsMaterial?function(t,e,n,s){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*s,e.map&&(t.map.value=e.map,i(e.map,t.uvTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap,i(e.alphaMap,t.alphaMapTransform));e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,s,r,a):s.isSpriteMaterial?function(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,i(e.map,t.mapTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap,i(e.alphaMap,t.alphaMapTransform));e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,s):s.isShadowMaterial?(t.color.value.copy(s.color),t.opacity.value=s.opacity):s.isShaderMaterial&&(s.uniformsNeedUpdate=!1)}}}function rp(t,e,i,n){let s={},r={},a=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(t,e,i,n){const s=t.value,r=e+"_"+i;if(void 0===n[r])return n[r]="number"==typeof s||"boolean"==typeof s?s:s.clone(),!0;{const t=n[r];if("number"==typeof s||"boolean"==typeof s){if(t!==s)return n[r]=s,!0}else if(!1===t.equals(s))return t.copy(s),!0}return!1}function c(t){const 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 h(e){const i=e.target;i.removeEventListener("dispose",h);const n=a.indexOf(i.__bindingPointIndex);a.splice(n,1),t.deleteBuffer(s[i.id]),delete s[i.id],delete r[i.id]}return{bind:function(t,e){const i=e.program;n.uniformBlockBinding(t,i)},update:function(i,d){let u=s[i.id];void 0===u&&(!function(t){const e=t.uniforms;let i=0;const n=16;for(let t=0,s=e.length;t<s;t++){const s=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0,e=s.length;t<e;t++){const e=s[t],r=Array.isArray(e.value)?e.value:[e.value];for(let t=0,s=r.length;t<s;t++){const s=c(r[t]),a=i%n,o=a%s.boundary,l=a+o;i+=o,0!==l&&n-l<s.storage&&(i+=n-l),e.__data=new Float32Array(s.storage/Float32Array.BYTES_PER_ELEMENT),e.__offset=i,i+=s.storage}}}const s=i%n;s>0&&(i+=n-s);t.__size=i,t.__cache={}}(i),u=function(e){const i=function(){for(let t=0;t<o;t++)if(-1===a.indexOf(t))return a.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();e.__bindingPointIndex=i;const n=t.createBuffer(),s=e.__size,r=e.usage;return t.bindBuffer(t.UNIFORM_BUFFER,n),t.bufferData(t.UNIFORM_BUFFER,s,r),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,i,n),n}(i),s[i.id]=u,i.addEventListener("dispose",h));const p=d.program;n.updateUBOMapping(i,p);const m=e.render.frame;r[i.id]!==m&&(!function(e){const i=s[e.id],n=e.uniforms,r=e.__cache;t.bindBuffer(t.UNIFORM_BUFFER,i);for(let e=0,i=n.length;e<i;e++){const i=Array.isArray(n[e])?n[e]:[n[e]];for(let n=0,s=i.length;n<s;n++){const s=i[n];if(!0===l(s,e,n,r)){const e=s.__offset,i=Array.isArray(s.value)?s.value:[s.value];let n=0;for(let r=0;r<i.length;r++){const a=i[r],o=c(a);"number"==typeof a||"boolean"==typeof a?(s.__data[0]=a,t.bufferSubData(t.UNIFORM_BUFFER,e+n,s.__data)):a.isMatrix3?(s.__data[0]=a.elements[0],s.__data[1]=a.elements[1],s.__data[2]=a.elements[2],s.__data[3]=0,s.__data[4]=a.elements[3],s.__data[5]=a.elements[4],s.__data[6]=a.elements[5],s.__data[7]=0,s.__data[8]=a.elements[6],s.__data[9]=a.elements[7],s.__data[10]=a.elements[8],s.__data[11]=0):(a.toArray(s.__data,n),n+=o.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,e,s.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}(i),r[i.id]=m)},dispose:function(){for(const e in s)t.deleteBuffer(s[e]);a=[],s={},r={}}}}class ap{constructor(t={}){const{canvas:i=Ye(),context:n=null,depth:s=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1,reverseDepthBuffer:u=!1}=t;let p;if(this.isWebGLRenderer=!0,null!==n){if("undefined"!=typeof WebGLRenderingContext&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=a;const m=new Uint32Array(4),f=new Int32Array(4);let g=null,v=null;const _=[],y=[];this.domElement=i,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._outputColorSpace=ce,this.toneMapping=0,this.toneMappingExposure=1;const x=this;let w=!1,b=0,M=0,S=null,T=-1,E=null;const A=new di,C=new di;let L=null;const k=new zn(0);let R=0,P=i.width,I=i.height,U=1,D=null,N=null;const O=new di(0,0,P,I),B=new di(0,0,P,I);let F=!1;const z=new Gr;let H=!1,V=!1;this.transmissionResolutionScale=1;const G=new Xi,j=new Xi,W=new vi,q=new di,X={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Z=!1;function $(){return null===S?U:1}let K,tt,it,ot,lt,ct,ht,dt,ut,pt,mt,ft,vt,xt,wt,bt,Mt,St,Tt,Et,At,Ct,Lt,kt,Rt=n;function Pt(t,e){return i.getContext(t,e)}try{const t={alpha:!0,depth:s,stencil:r,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in i&&i.setAttribute("data-engine",`three.js r${e}`),i.addEventListener("webglcontextlost",Dt,!1),i.addEventListener("webglcontextrestored",Nt,!1),i.addEventListener("webglcontextcreationerror",Ot,!1),null===Rt){const e="webgl2";if(Rt=Pt(e,t),null===Rt)throw Pt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function It(){K=new nd(Rt),K.init(),Ct=new Qu(Rt,K),tt=new Nh(Rt,K,t,Ct),it=new $u(Rt,K),tt.reverseDepthBuffer&&u&&it.buffers.depth.setReversed(!0),ot=new ad(Rt),lt=new Bu,ct=new Ku(Rt,K,it,lt,tt,Ct,ot),ht=new Bh(x),dt=new id(x),ut=new Eh(Rt),Lt=new Uh(Rt,ut),pt=new sd(Rt,ut,ot,Lt),mt=new ld(Rt,pt,ut,ot),Tt=new od(Rt,tt,ct),bt=new Oh(lt),ft=new Ou(x,ht,dt,K,tt,Lt,bt),vt=new sp(x,lt),xt=new Vu,wt=new Zu(K),St=new Ih(x,ht,dt,it,mt,p,l),Mt=new Yu(x,mt,tt),kt=new rp(Rt,ot,tt,it),Et=new Dh(Rt,K,ot),At=new rd(Rt,K,ot),ot.programs=ft.programs,x.capabilities=tt,x.extensions=K,x.properties=lt,x.renderLists=xt,x.shadowMap=Mt,x.state=it,x.info=ot}It();const Ut=new ep(x,Rt);function Dt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),w=!0}function Nt(){console.log("THREE.WebGLRenderer: Context Restored."),w=!1;const t=ot.autoReset,e=Mt.enabled,i=Mt.autoUpdate,n=Mt.needsUpdate,s=Mt.type;It(),ot.autoReset=t,Mt.enabled=e,Mt.autoUpdate=i,Mt.needsUpdate=n,Mt.type=s}function Ot(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function Bt(t){const e=t.target;e.removeEventListener("dispose",Bt),function(t){(function(t){const e=lt.get(t).programs;void 0!==e&&(e.forEach((function(t){ft.releaseProgram(t)})),t.isShaderMaterial&&ft.releaseShaderCache(t))})(t),lt.remove(t)}(e)}function Ft(t,e,i){!0===t.transparent&&2===t.side&&!1===t.forceSinglePass?(t.side=1,t.needsUpdate=!0,Yt(t,e,i),t.side=0,t.needsUpdate=!0,Yt(t,e,i),t.side=2):Yt(t,e,i)}this.xr=Ut,this.getContext=function(){return Rt},this.getContextAttributes=function(){return Rt.getContextAttributes()},this.forceContextLoss=function(){const t=K.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=K.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return U},this.setPixelRatio=function(t){void 0!==t&&(U=t,this.setSize(P,I,!1))},this.getSize=function(t){return t.set(P,I)},this.setSize=function(t,e,n=!0){Ut.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(P=t,I=e,i.width=Math.floor(t*U),i.height=Math.floor(e*U),!0===n&&(i.style.width=t+"px",i.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(t){return t.set(P*U,I*U).floor()},this.setDrawingBufferSize=function(t,e,n){P=t,I=e,U=n,i.width=Math.floor(t*n),i.height=Math.floor(e*n),this.setViewport(0,0,t,e)},this.getCurrentViewport=function(t){return t.copy(A)},this.getViewport=function(t){return t.copy(O)},this.setViewport=function(t,e,i,n){t.isVector4?O.set(t.x,t.y,t.z,t.w):O.set(t,e,i,n),it.viewport(A.copy(O).multiplyScalar(U).round())},this.getScissor=function(t){return t.copy(B)},this.setScissor=function(t,e,i,n){t.isVector4?B.set(t.x,t.y,t.z,t.w):B.set(t,e,i,n),it.scissor(C.copy(B).multiplyScalar(U).round())},this.getScissorTest=function(){return F},this.setScissorTest=function(t){it.setScissorTest(F=t)},this.setOpaqueSort=function(t){D=t},this.setTransparentSort=function(t){N=t},this.getClearColor=function(t){return t.copy(St.getClearColor())},this.setClearColor=function(){St.setClearColor.apply(St,arguments)},this.getClearAlpha=function(){return St.getClearAlpha()},this.setClearAlpha=function(){St.setClearAlpha.apply(St,arguments)},this.clear=function(t=!0,e=!0,i=!0){let n=0;if(t){let t=!1;if(null!==S){const e=S.texture.format;t=e===yt||e===_t||e===gt}if(t){const t=S.texture.type,e=t===J||t===et||t===Q||t===at||t===st||t===rt,i=St.getClearColor(),n=St.getClearAlpha(),s=i.r,r=i.g,a=i.b;e?(m[0]=s,m[1]=r,m[2]=a,m[3]=n,Rt.clearBufferuiv(Rt.COLOR,0,m)):(f[0]=s,f[1]=r,f[2]=a,f[3]=n,Rt.clearBufferiv(Rt.COLOR,0,f))}else n|=Rt.COLOR_BUFFER_BIT}e&&(n|=Rt.DEPTH_BUFFER_BIT),i&&(n|=Rt.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Rt.clear(n)},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(){i.removeEventListener("webglcontextlost",Dt,!1),i.removeEventListener("webglcontextrestored",Nt,!1),i.removeEventListener("webglcontextcreationerror",Ot,!1),St.dispose(),xt.dispose(),wt.dispose(),lt.dispose(),ht.dispose(),dt.dispose(),mt.dispose(),Lt.dispose(),kt.dispose(),ft.dispose(),Ut.dispose(),Ut.removeEventListener("sessionstart",Ht),Ut.removeEventListener("sessionend",Vt),Gt.stop()},this.renderBufferDirect=function(t,e,i,n,s,r){null===e&&(e=X);const a=s.isMesh&&s.matrixWorld.determinant()<0,o=function(t,e,i,n,s){!0!==e.isScene&&(e=X);ct.resetTextureUnits();const r=e.fog,a=n.isMeshStandardMaterial?e.environment:null,o=null===S?x.outputColorSpace:!0===S.isXRRenderTarget?S.texture.colorSpace:he,l=(n.isMeshStandardMaterial?dt:ht).get(n.envMap||a),c=!0===n.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,h=!!i.attributes.tangent&&(!!n.normalMap||n.anisotropy>0),d=!!i.morphAttributes.position,u=!!i.morphAttributes.normal,p=!!i.morphAttributes.color;let m=0;n.toneMapped&&(null!==S&&!0!==S.isXRRenderTarget||(m=x.toneMapping));const f=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,g=void 0!==f?f.length:0,_=lt.get(n),y=v.state.lights;if(!0===H&&(!0===V||t!==E)){const e=t===E&&n.id===T;bt.setState(n,t,e)}let w=!1;n.version===_.__version?_.needsLights&&_.lightsStateVersion!==y.state.version||_.outputColorSpace!==o||s.isBatchedMesh&&!1===_.batching?w=!0:s.isBatchedMesh||!0!==_.batching?s.isBatchedMesh&&!0===_.batchingColor&&null===s.colorTexture||s.isBatchedMesh&&!1===_.batchingColor&&null!==s.colorTexture||s.isInstancedMesh&&!1===_.instancing?w=!0:s.isInstancedMesh||!0!==_.instancing?s.isSkinnedMesh&&!1===_.skinning?w=!0:s.isSkinnedMesh||!0!==_.skinning?s.isInstancedMesh&&!0===_.instancingColor&&null===s.instanceColor||s.isInstancedMesh&&!1===_.instancingColor&&null!==s.instanceColor||s.isInstancedMesh&&!0===_.instancingMorph&&null===s.morphTexture||s.isInstancedMesh&&!1===_.instancingMorph&&null!==s.morphTexture||_.envMap!==l||!0===n.fog&&_.fog!==r?w=!0:void 0===_.numClippingPlanes||_.numClippingPlanes===bt.numPlanes&&_.numIntersection===bt.numIntersection?(_.vertexAlphas!==c||_.vertexTangents!==h||_.morphTargets!==d||_.morphNormals!==u||_.morphColors!==p||_.toneMapping!==m||_.morphTargetsCount!==g)&&(w=!0):w=!0:w=!0:w=!0:w=!0:(w=!0,_.__version=n.version);let b=_.currentProgram;!0===w&&(b=Yt(n,e,s));let M=!1,A=!1,C=!1;const L=b.getUniforms(),k=_.uniforms;it.useProgram(b.program)&&(M=!0,A=!0,C=!0);n.id!==T&&(T=n.id,A=!0);if(M||E!==t){it.buffers.depth.getReversed()?(G.copy(t.projectionMatrix),function(t){const e=t.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}(G),function(t){const e=t.elements;-1===e[11]?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=1-e[14])}(G),L.setValue(Rt,"projectionMatrix",G)):L.setValue(Rt,"projectionMatrix",t.projectionMatrix),L.setValue(Rt,"viewMatrix",t.matrixWorldInverse);const e=L.map.cameraPosition;void 0!==e&&e.setValue(Rt,W.setFromMatrixPosition(t.matrixWorld)),tt.logarithmicDepthBuffer&&L.setValue(Rt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&L.setValue(Rt,"isOrthographic",!0===t.isOrthographicCamera),E!==t&&(E=t,A=!0,C=!0)}if(s.isSkinnedMesh){L.setOptional(Rt,s,"bindMatrix"),L.setOptional(Rt,s,"bindMatrixInverse");const t=s.skeleton;t&&(null===t.boneTexture&&t.computeBoneTexture(),L.setValue(Rt,"boneTexture",t.boneTexture,ct))}s.isBatchedMesh&&(L.setOptional(Rt,s,"batchingTexture"),L.setValue(Rt,"batchingTexture",s._matricesTexture,ct),L.setOptional(Rt,s,"batchingIdTexture"),L.setValue(Rt,"batchingIdTexture",s._indirectTexture,ct),L.setOptional(Rt,s,"batchingColorTexture"),null!==s._colorsTexture&&L.setValue(Rt,"batchingColorTexture",s._colorsTexture,ct));const R=i.morphAttributes;void 0===R.position&&void 0===R.normal&&void 0===R.color||Tt.update(s,i,b);(A||_.receiveShadow!==s.receiveShadow)&&(_.receiveShadow=s.receiveShadow,L.setValue(Rt,"receiveShadow",s.receiveShadow));n.isMeshGouraudMaterial&&null!==n.envMap&&(k.envMap.value=l,k.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1);n.isMeshStandardMaterial&&null===n.envMap&&null!==e.environment&&(k.envMapIntensity.value=e.environmentIntensity);A&&(L.setValue(Rt,"toneMappingExposure",x.toneMappingExposure),_.needsLights&&(D=C,(P=k).ambientLightColor.needsUpdate=D,P.lightProbe.needsUpdate=D,P.directionalLights.needsUpdate=D,P.directionalLightShadows.needsUpdate=D,P.pointLights.needsUpdate=D,P.pointLightShadows.needsUpdate=D,P.spotLights.needsUpdate=D,P.spotLightShadows.needsUpdate=D,P.rectAreaLights.needsUpdate=D,P.hemisphereLights.needsUpdate=D),r&&!0===n.fog&&vt.refreshFogUniforms(k,r),vt.refreshMaterialUniforms(k,n,U,I,v.state.transmissionRenderTarget[t.id]),pu.upload(Rt,Jt(_),k,ct));var P,D;n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(pu.upload(Rt,Jt(_),k,ct),n.uniformsNeedUpdate=!1);n.isSpriteMaterial&&L.setValue(Rt,"center",s.center);if(L.setValue(Rt,"modelViewMatrix",s.modelViewMatrix),L.setValue(Rt,"normalMatrix",s.normalMatrix),L.setValue(Rt,"modelMatrix",s.matrixWorld),n.isShaderMaterial||n.isRawShaderMaterial){const t=n.uniformsGroups;for(let e=0,i=t.length;e<i;e++){const i=t[e];kt.update(i,b),kt.bind(i,b)}}return b}(t,e,i,n,s);it.setMaterial(n,a);let l=i.index,c=1;if(!0===n.wireframe){if(l=pt.getWireframeAttribute(i),void 0===l)return;c=2}const h=i.drawRange,d=i.attributes.position;let u=h.start*c,p=(h.start+h.count)*c;null!==r&&(u=Math.max(u,r.start*c),p=Math.min(p,(r.start+r.count)*c)),null!==l?(u=Math.max(u,0),p=Math.min(p,l.count)):null!=d&&(u=Math.max(u,0),p=Math.min(p,d.count));const m=p-u;if(m<0||m===1/0)return;let f;Lt.setup(s,n,o,i,l);let g=Et;if(null!==l&&(f=ut.get(l),g=At,g.setIndex(f)),s.isMesh)!0===n.wireframe?(it.setLineWidth(n.wireframeLinewidth*$()),g.setMode(Rt.LINES)):g.setMode(Rt.TRIANGLES);else if(s.isLine){let t=n.linewidth;void 0===t&&(t=1),it.setLineWidth(t*$()),s.isLineSegments?g.setMode(Rt.LINES):s.isLineLoop?g.setMode(Rt.LINE_LOOP):g.setMode(Rt.LINE_STRIP)}else s.isPoints?g.setMode(Rt.POINTS):s.isSprite&&g.setMode(Rt.TRIANGLES);if(s.isBatchedMesh)if(null!==s._multiDrawInstances)g.renderMultiDrawInstances(s._multiDrawStarts,s._multiDrawCounts,s._multiDrawCount,s._multiDrawInstances);else if(K.get("WEBGL_multi_draw"))g.renderMultiDraw(s._multiDrawStarts,s._multiDrawCounts,s._multiDrawCount);else{const t=s._multiDrawStarts,e=s._multiDrawCounts,i=s._multiDrawCount,r=l?ut.get(l).bytesPerElement:1,a=lt.get(n).currentProgram.getUniforms();for(let n=0;n<i;n++)a.setValue(Rt,"_gl_DrawID",n),g.render(t[n]/r,e[n])}else if(s.isInstancedMesh)g.renderInstances(u,m,s.count);else if(i.isInstancedBufferGeometry){const t=void 0!==i._maxInstanceCount?i._maxInstanceCount:1/0,e=Math.min(i.instanceCount,t);g.renderInstances(u,m,e)}else g.render(u,m)},this.compile=function(t,e,i=null){null===i&&(i=t),v=wt.get(i),v.init(e),y.push(v),i.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(v.pushLight(t),t.castShadow&&v.pushShadow(t))})),t!==i&&t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(v.pushLight(t),t.castShadow&&v.pushShadow(t))})),v.setupLights();const n=new Set;return t.traverse((function(t){if(!(t.isMesh||t.isPoints||t.isLine||t.isSprite))return;const e=t.material;if(e)if(Array.isArray(e))for(let s=0;s<e.length;s++){const r=e[s];Ft(r,i,t),n.add(r)}else Ft(e,i,t),n.add(e)})),y.pop(),v=null,n},this.compileAsync=function(t,e,i=null){const n=this.compile(t,e,i);return new Promise((e=>{function i(){n.forEach((function(t){lt.get(t).currentProgram.isReady()&&n.delete(t)})),0!==n.size?setTimeout(i,10):e(t)}null!==K.get("KHR_parallel_shader_compile")?i():setTimeout(i,10)}))};let zt=null;function Ht(){Gt.stop()}function Vt(){Gt.start()}const Gt=new Th;function jt(t,e,i,n){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)i=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)v.pushLight(t),t.castShadow&&v.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||z.intersectsSprite(t)){n&&q.setFromMatrixPosition(t.matrixWorld).applyMatrix4(j);const e=mt.update(t),s=t.material;s.visible&&g.push(t,e,s,i,q.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||z.intersectsObject(t))){const e=mt.update(t),s=t.material;if(n&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),q.copy(t.boundingSphere.center)):(null===e.boundingSphere&&e.computeBoundingSphere(),q.copy(e.boundingSphere.center)),q.applyMatrix4(t.matrixWorld).applyMatrix4(j)),Array.isArray(s)){const n=e.groups;for(let r=0,a=n.length;r<a;r++){const a=n[r],o=s[a.materialIndex];o&&o.visible&&g.push(t,e,o,i,q.z,a)}}else s.visible&&g.push(t,e,s,i,q.z,null)}const s=t.children;for(let t=0,r=s.length;t<r;t++)jt(s[t],e,i,n)}function Wt(t,e,i,n){const s=t.opaque,r=t.transmissive,a=t.transparent;v.setupLightsView(i),!0===H&&bt.setGlobalState(x.clippingPlanes,i),n&&it.viewport(A.copy(n)),s.length>0&&Xt(s,e,i),r.length>0&&Xt(r,e,i),a.length>0&&Xt(a,e,i),it.buffers.depth.setTest(!0),it.buffers.depth.setMask(!0),it.buffers.color.setMask(!0),it.setPolygonOffset(!1)}function qt(t,e,i,n){if(null!==(!0===i.isScene?i.overrideMaterial:null))return;void 0===v.state.transmissionRenderTarget[n.id]&&(v.state.transmissionRenderTarget[n.id]=new pi(1,1,{generateMipmaps:!0,type:K.has("EXT_color_buffer_half_float")||K.has("EXT_color_buffer_float")?nt:J,minFilter:Y,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ei.workingColorSpace}));const s=v.state.transmissionRenderTarget[n.id],a=n.viewport||A;s.setSize(a.z*x.transmissionResolutionScale,a.w*x.transmissionResolutionScale);const o=x.getRenderTarget();x.setRenderTarget(s),x.getClearColor(k),R=x.getClearAlpha(),R<1&&x.setClearColor(16777215,.5),x.clear(),Z&&St.render(i);const l=x.toneMapping;x.toneMapping=0;const c=n.viewport;if(void 0!==n.viewport&&(n.viewport=void 0),v.setupLightsView(n),!0===H&&bt.setGlobalState(x.clippingPlanes,n),Xt(t,i,n),ct.updateMultisampleRenderTarget(s),ct.updateRenderTargetMipmap(s),!1===K.has("WEBGL_multisampled_render_to_texture")){let t=!1;for(let s=0,r=e.length;s<r;s++){const r=e[s],a=r.object,o=r.geometry,l=r.material,c=r.group;if(2===l.side&&a.layers.test(n.layers)){const e=l.side;l.side=1,l.needsUpdate=!0,Zt(a,i,n,o,l,c),l.side=e,l.needsUpdate=!0,t=!0}}!0===t&&(ct.updateMultisampleRenderTarget(s),ct.updateRenderTargetMipmap(s))}x.setRenderTarget(o),x.setClearColor(k,R),void 0!==c&&(n.viewport=c),x.toneMapping=l}function Xt(t,e,i){const n=!0===e.isScene?e.overrideMaterial:null;for(let s=0,r=t.length;s<r;s++){const r=t[s],a=r.object,o=r.geometry,l=null===n?r.material:n,c=r.group;a.layers.test(i.layers)&&Zt(a,e,i,o,l,c)}}function Zt(t,e,i,n,s,r){t.onBeforeRender(x,e,i,n,s,r),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),s.onBeforeRender(x,e,i,n,t,r),!0===s.transparent&&2===s.side&&!1===s.forceSinglePass?(s.side=1,s.needsUpdate=!0,x.renderBufferDirect(i,e,n,s,t,r),s.side=0,s.needsUpdate=!0,x.renderBufferDirect(i,e,n,s,t,r),s.side=2):x.renderBufferDirect(i,e,n,s,t,r),t.onAfterRender(x,e,i,n,s,r)}function Yt(t,e,i){!0!==e.isScene&&(e=X);const n=lt.get(t),s=v.state.lights,r=v.state.shadowsArray,a=s.state.version,o=ft.getParameters(t,s.state,r,e,i),l=ft.getProgramCacheKey(o);let c=n.programs;n.environment=t.isMeshStandardMaterial?e.environment:null,n.fog=e.fog,n.envMap=(t.isMeshStandardMaterial?dt:ht).get(t.envMap||n.environment),n.envMapRotation=null!==n.environment&&null===t.envMap?e.environmentRotation:t.envMapRotation,void 0===c&&(t.addEventListener("dispose",Bt),c=new Map,n.programs=c);let h=c.get(l);if(void 0!==h){if(n.currentProgram===h&&n.lightsStateVersion===a)return $t(t,o),h}else o.uniforms=ft.getUniforms(t),t.onBeforeCompile(o,x),h=ft.acquireProgram(o,l),c.set(l,h),n.uniforms=o.uniforms;const d=n.uniforms;return(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(d.clippingPlanes=bt.uniform),$t(t,o),n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),n.lightsStateVersion=a,n.needsLights&&(d.ambientLightColor.value=s.state.ambient,d.lightProbe.value=s.state.probe,d.directionalLights.value=s.state.directional,d.directionalLightShadows.value=s.state.directionalShadow,d.spotLights.value=s.state.spot,d.spotLightShadows.value=s.state.spotShadow,d.rectAreaLights.value=s.state.rectArea,d.ltc_1.value=s.state.rectAreaLTC1,d.ltc_2.value=s.state.rectAreaLTC2,d.pointLights.value=s.state.point,d.pointLightShadows.value=s.state.pointShadow,d.hemisphereLights.value=s.state.hemi,d.directionalShadowMap.value=s.state.directionalShadowMap,d.directionalShadowMatrix.value=s.state.directionalShadowMatrix,d.spotShadowMap.value=s.state.spotShadowMap,d.spotLightMatrix.value=s.state.spotLightMatrix,d.spotLightMap.value=s.state.spotLightMap,d.pointShadowMap.value=s.state.pointShadowMap,d.pointShadowMatrix.value=s.state.pointShadowMatrix),n.currentProgram=h,n.uniformsList=null,h}function Jt(t){if(null===t.uniformsList){const e=t.currentProgram.getUniforms();t.uniformsList=pu.seqWithValue(e.seq,t.uniforms)}return t.uniformsList}function $t(t,e){const i=lt.get(t);i.outputColorSpace=e.outputColorSpace,i.batching=e.batching,i.batchingColor=e.batchingColor,i.instancing=e.instancing,i.instancingColor=e.instancingColor,i.instancingMorph=e.instancingMorph,i.skinning=e.skinning,i.morphTargets=e.morphTargets,i.morphNormals=e.morphNormals,i.morphColors=e.morphColors,i.morphTargetsCount=e.morphTargetsCount,i.numClippingPlanes=e.numClippingPlanes,i.numIntersection=e.numClipIntersection,i.vertexAlphas=e.vertexAlphas,i.vertexTangents=e.vertexTangents,i.toneMapping=e.toneMapping}Gt.setAnimationLoop((function(t){zt&&zt(t)})),"undefined"!=typeof self&&Gt.setContext(self),this.setAnimationLoop=function(t){zt=t,Ut.setAnimationLoop(t),null===t?Gt.stop():Gt.start()},Ut.addEventListener("sessionstart",Ht),Ut.addEventListener("sessionend",Vt),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===w)return;if(!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===Ut.enabled&&!0===Ut.isPresenting&&(!0===Ut.cameraAutoUpdate&&Ut.updateCamera(e),e=Ut.getCamera()),!0===t.isScene&&t.onBeforeRender(x,t,e,S),v=wt.get(t,y.length),v.init(e),y.push(v),j.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),z.setFromProjectionMatrix(j),V=this.localClippingEnabled,H=bt.init(this.clippingPlanes,V),g=xt.get(t,_.length),g.init(),_.push(g),!0===Ut.enabled&&!0===Ut.isPresenting){const t=x.xr.getDepthSensingMesh();null!==t&&jt(t,e,-1/0,x.sortObjects)}jt(t,e,0,x.sortObjects),g.finish(),!0===x.sortObjects&&g.sort(D,N),Z=!1===Ut.enabled||!1===Ut.isPresenting||!1===Ut.hasDepthSensing(),Z&&St.addToRenderList(g,t),this.info.render.frame++,!0===H&&bt.beginShadows();const i=v.state.shadowsArray;Mt.render(i,t,e),!0===H&&bt.endShadows(),!0===this.info.autoReset&&this.info.reset();const n=g.opaque,s=g.transmissive;if(v.setupLights(),e.isArrayCamera){const i=e.cameras;if(s.length>0)for(let e=0,r=i.length;e<r;e++){qt(n,s,t,i[e])}Z&&St.render(t);for(let e=0,n=i.length;e<n;e++){const n=i[e];Wt(g,t,n,n.viewport)}}else s.length>0&&qt(n,s,t,e),Z&&St.render(t),Wt(g,t,e);null!==S&&0===M&&(ct.updateMultisampleRenderTarget(S),ct.updateRenderTargetMipmap(S)),!0===t.isScene&&t.onAfterRender(x,t,e),Lt.resetDefaultState(),T=-1,E=null,y.pop(),y.length>0?(v=y[y.length-1],!0===H&&bt.setGlobalState(x.clippingPlanes,v.state.camera)):v=null,_.pop(),g=_.length>0?_[_.length-1]:null},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return M},this.getRenderTarget=function(){return S},this.setRenderTargetTextures=function(t,e,i){lt.get(t.texture).__webglTexture=e,lt.get(t.depthTexture).__webglTexture=i;const n=lt.get(t);n.__hasExternalTextures=!0,n.__autoAllocateDepthBuffer=void 0===i,n.__autoAllocateDepthBuffer||!0===K.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),n.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(t,e){const i=lt.get(t);i.__webglFramebuffer=e,i.__useDefaultFramebuffer=void 0===e};const Kt=Rt.createFramebuffer();this.setRenderTarget=function(t,e=0,i=0){S=t,b=e,M=i;let n=!0,s=null,r=!1,a=!1;if(t){const o=lt.get(t);if(void 0!==o.__useDefaultFramebuffer)it.bindFramebuffer(Rt.FRAMEBUFFER,null),n=!1;else if(void 0===o.__webglFramebuffer)ct.setupRenderTarget(t);else if(o.__hasExternalTextures)ct.rebindTextures(t,lt.get(t.texture).__webglTexture,lt.get(t.depthTexture).__webglTexture);else if(t.depthBuffer){const e=t.depthTexture;if(o.__boundDepthTexture!==e){if(null!==e&<.has(e)&&(t.width!==e.image.width||t.height!==e.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ct.setupDepthRenderbuffer(t)}}const l=t.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(a=!0);const c=lt.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(s=Array.isArray(c[e])?c[e][i]:c[e],r=!0):s=t.samples>0&&!1===ct.useMultisampledRTT(t)?lt.get(t).__webglMultisampledFramebuffer:Array.isArray(c)?c[i]:c,A.copy(t.viewport),C.copy(t.scissor),L=t.scissorTest}else A.copy(O).multiplyScalar(U).floor(),C.copy(B).multiplyScalar(U).floor(),L=F;0!==i&&(s=Kt);if(it.bindFramebuffer(Rt.FRAMEBUFFER,s)&&n&&it.drawBuffers(t,s),it.viewport(A),it.scissor(C),it.setScissorTest(L),r){const n=lt.get(t.texture);Rt.framebufferTexture2D(Rt.FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,Rt.TEXTURE_CUBE_MAP_POSITIVE_X+e,n.__webglTexture,i)}else if(a){const n=lt.get(t.texture),s=e;Rt.framebufferTextureLayer(Rt.FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,n.__webglTexture,i,s)}else if(null!==t&&0!==i){const e=lt.get(t.texture);Rt.framebufferTexture2D(Rt.FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,Rt.TEXTURE_2D,e.__webglTexture,i)}T=-1},this.readRenderTargetPixels=function(t,e,i,n,s,r,a){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=lt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){it.bindFramebuffer(Rt.FRAMEBUFFER,o);try{const a=t.texture,o=a.format,l=a.type;if(!tt.textureFormatReadable(o))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!tt.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-n&&i>=0&&i<=t.height-s&&Rt.readPixels(e,i,n,s,Ct.convert(o),Ct.convert(l),r)}finally{const t=null!==S?lt.get(S).__webglFramebuffer:null;it.bindFramebuffer(Rt.FRAMEBUFFER,t)}}},this.readRenderTargetPixelsAsync=async function(t,e,i,n,s,r,a){if(!t||!t.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=lt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){const a=t.texture,l=a.format,c=a.type;if(!tt.textureFormatReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!tt.textureTypeReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(e>=0&&e<=t.width-n&&i>=0&&i<=t.height-s){it.bindFramebuffer(Rt.FRAMEBUFFER,o);const t=Rt.createBuffer();Rt.bindBuffer(Rt.PIXEL_PACK_BUFFER,t),Rt.bufferData(Rt.PIXEL_PACK_BUFFER,r.byteLength,Rt.STREAM_READ),Rt.readPixels(e,i,n,s,Ct.convert(l),Ct.convert(c),0);const a=null!==S?lt.get(S).__webglFramebuffer:null;it.bindFramebuffer(Rt.FRAMEBUFFER,a);const h=Rt.fenceSync(Rt.SYNC_GPU_COMMANDS_COMPLETE,0);return Rt.flush(),await function(t,e,i){return new Promise((function(n,s){setTimeout((function r(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:s();break;case t.TIMEOUT_EXPIRED:setTimeout(r,i);break;default:n()}}),i)}))}(Rt,h,4),Rt.bindBuffer(Rt.PIXEL_PACK_BUFFER,t),Rt.getBufferSubData(Rt.PIXEL_PACK_BUFFER,0,r),Rt.deleteBuffer(t),Rt.deleteSync(h),r}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(t,e=null,i=0){!0!==t.isTexture&&($e("WebGLRenderer: copyFramebufferToTexture function signature has changed."),e=arguments[0]||null,t=arguments[1]);const n=Math.pow(2,-i),s=Math.floor(t.image.width*n),r=Math.floor(t.image.height*n),a=null!==e?e.x:0,o=null!==e?e.y:0;ct.setTexture2D(t,0),Rt.copyTexSubImage2D(Rt.TEXTURE_2D,i,0,0,a,o,s,r),it.unbindTexture()};const Qt=Rt.createFramebuffer(),te=Rt.createFramebuffer();this.copyTextureToTexture=function(t,e,i=null,n=null,s=0,r=null){let a,o,l,c,h,d,u,p,m;!0!==t.isTexture&&($e("WebGLRenderer: copyTextureToTexture function signature has changed."),n=arguments[0]||null,t=arguments[1],e=arguments[2],r=arguments[3]||0,i=null),null===r&&(0!==s?($e("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),r=s,s=0):r=0);const f=t.isCompressedTexture?t.mipmaps[r]:t.image;if(null!==i)a=i.max.x-i.min.x,o=i.max.y-i.min.y,l=i.isBox3?i.max.z-i.min.z:1,c=i.min.x,h=i.min.y,d=i.isBox3?i.min.z:0;else{const e=Math.pow(2,-s);a=Math.floor(f.width*e),o=Math.floor(f.height*e),l=t.isDataArrayTexture?f.depth:t.isData3DTexture?Math.floor(f.depth*e):1,c=0,h=0,d=0}null!==n?(u=n.x,p=n.y,m=n.z):(u=0,p=0,m=0);const g=Ct.convert(e.format),v=Ct.convert(e.type);let _;e.isData3DTexture?(ct.setTexture3D(e,0),_=Rt.TEXTURE_3D):e.isDataArrayTexture||e.isCompressedArrayTexture?(ct.setTexture2DArray(e,0),_=Rt.TEXTURE_2D_ARRAY):(ct.setTexture2D(e,0),_=Rt.TEXTURE_2D),Rt.pixelStorei(Rt.UNPACK_FLIP_Y_WEBGL,e.flipY),Rt.pixelStorei(Rt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),Rt.pixelStorei(Rt.UNPACK_ALIGNMENT,e.unpackAlignment);const y=Rt.getParameter(Rt.UNPACK_ROW_LENGTH),x=Rt.getParameter(Rt.UNPACK_IMAGE_HEIGHT),w=Rt.getParameter(Rt.UNPACK_SKIP_PIXELS),b=Rt.getParameter(Rt.UNPACK_SKIP_ROWS),M=Rt.getParameter(Rt.UNPACK_SKIP_IMAGES);Rt.pixelStorei(Rt.UNPACK_ROW_LENGTH,f.width),Rt.pixelStorei(Rt.UNPACK_IMAGE_HEIGHT,f.height),Rt.pixelStorei(Rt.UNPACK_SKIP_PIXELS,c),Rt.pixelStorei(Rt.UNPACK_SKIP_ROWS,h),Rt.pixelStorei(Rt.UNPACK_SKIP_IMAGES,d);const S=t.isDataArrayTexture||t.isData3DTexture,T=e.isDataArrayTexture||e.isData3DTexture;if(t.isDepthTexture){const i=lt.get(t),n=lt.get(e),f=lt.get(i.__renderTarget),g=lt.get(n.__renderTarget);it.bindFramebuffer(Rt.READ_FRAMEBUFFER,f.__webglFramebuffer),it.bindFramebuffer(Rt.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let i=0;i<l;i++)S&&(Rt.framebufferTextureLayer(Rt.READ_FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,lt.get(t).__webglTexture,s,d+i),Rt.framebufferTextureLayer(Rt.DRAW_FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,lt.get(e).__webglTexture,r,m+i)),Rt.blitFramebuffer(c,h,a,o,u,p,a,o,Rt.DEPTH_BUFFER_BIT,Rt.NEAREST);it.bindFramebuffer(Rt.READ_FRAMEBUFFER,null),it.bindFramebuffer(Rt.DRAW_FRAMEBUFFER,null)}else if(0!==s||t.isRenderTargetTexture||lt.has(t)){const i=lt.get(t),n=lt.get(e);it.bindFramebuffer(Rt.READ_FRAMEBUFFER,Qt),it.bindFramebuffer(Rt.DRAW_FRAMEBUFFER,te);for(let t=0;t<l;t++)S?Rt.framebufferTextureLayer(Rt.READ_FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,i.__webglTexture,s,d+t):Rt.framebufferTexture2D(Rt.READ_FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,Rt.TEXTURE_2D,i.__webglTexture,s),T?Rt.framebufferTextureLayer(Rt.DRAW_FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,n.__webglTexture,r,m+t):Rt.framebufferTexture2D(Rt.DRAW_FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,Rt.TEXTURE_2D,n.__webglTexture,r),0!==s?Rt.blitFramebuffer(c,h,a,o,u,p,a,o,Rt.COLOR_BUFFER_BIT,Rt.NEAREST):T?Rt.copyTexSubImage3D(_,r,u,p,m+t,c,h,a,o):Rt.copyTexSubImage2D(_,r,u,p,c,h,a,o);it.bindFramebuffer(Rt.READ_FRAMEBUFFER,null),it.bindFramebuffer(Rt.DRAW_FRAMEBUFFER,null)}else T?t.isDataTexture||t.isData3DTexture?Rt.texSubImage3D(_,r,u,p,m,a,o,l,g,v,f.data):e.isCompressedArrayTexture?Rt.compressedTexSubImage3D(_,r,u,p,m,a,o,l,g,f.data):Rt.texSubImage3D(_,r,u,p,m,a,o,l,g,v,f):t.isDataTexture?Rt.texSubImage2D(Rt.TEXTURE_2D,r,u,p,a,o,g,v,f.data):t.isCompressedTexture?Rt.compressedTexSubImage2D(Rt.TEXTURE_2D,r,u,p,f.width,f.height,g,f.data):Rt.texSubImage2D(Rt.TEXTURE_2D,r,u,p,a,o,g,v,f);Rt.pixelStorei(Rt.UNPACK_ROW_LENGTH,y),Rt.pixelStorei(Rt.UNPACK_IMAGE_HEIGHT,x),Rt.pixelStorei(Rt.UNPACK_SKIP_PIXELS,w),Rt.pixelStorei(Rt.UNPACK_SKIP_ROWS,b),Rt.pixelStorei(Rt.UNPACK_SKIP_IMAGES,M),0===r&&e.generateMipmaps&&Rt.generateMipmap(_),it.unbindTexture()},this.copyTextureToTexture3D=function(t,e,i=null,n=null,s=0){return!0!==t.isTexture&&($e("WebGLRenderer: copyTextureToTexture3D function signature has changed."),i=arguments[0]||null,n=arguments[1]||null,t=arguments[2],e=arguments[3],s=arguments[4]||0),$e('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(t,e,i,n,s)},this.initRenderTarget=function(t){void 0===lt.get(t).__webglFramebuffer&&ct.setupRenderTarget(t)},this.initTexture=function(t){t.isCubeTexture?ct.setTextureCube(t,0):t.isData3DTexture?ct.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?ct.setTexture2DArray(t,0):ct.setTexture2D(t,0),it.unbindTexture()},this.resetState=function(){b=0,M=0,S=null,it.reset(),Lt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ce}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorspace=ei._getDrawingBufferColorSpace(t),e.unpackColorSpace=ei._getUnpackColorSpace()}}var op=Object.freeze({__proto__:null,ACESFilmicToneMapping:4,AddEquation:o,AddOperation:2,AdditiveAnimationBlendMode:oe,AdditiveBlending:2,AgXToneMapping:6,AlphaFormat:lt,AlwaysCompare:519,AlwaysDepth:1,AlwaysStencilFunc:ve,AmbientLight:rc,AnimationAction:Hc,AnimationClip:Il,AnimationLoader:class extends Bl{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new Hl(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,(function(i){try{e(s.parse(JSON.parse(i)))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){const e=[];for(let i=0;i<t.length;i++){const n=Il.parse(t[i]);e.push(n)}return e}},AnimationMixer:Gc,AnimationObjectGroup:class{constructor(){this.isAnimationObjectGroup=!0,this.uuid=De(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let e=0,i=arguments.length;e!==i;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,i=this._paths,n=this._parsedPaths,s=this._bindings,r=s.length;let a,o=t.length,l=this.nCachedObjects_;for(let c=0,h=arguments.length;c!==h;++c){const h=arguments[c],d=h.uuid;let u=e[d];if(void 0===u){u=o++,e[d]=u,t.push(h);for(let t=0,e=r;t!==e;++t)s[t].push(new zc(h,i[t],n[t]))}else if(u<l){a=t[u];const o=--l,c=t[o];e[c.uuid]=u,t[u]=c,e[d]=o,t[o]=h;for(let t=0,e=r;t!==e;++t){const e=s[t],r=e[o];let a=e[u];e[u]=r,void 0===a&&(a=new zc(h,i[t],n[t])),e[o]=a}}else t[u]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,n=i.length;let s=this.nCachedObjects_;for(let r=0,a=arguments.length;r!==a;++r){const a=arguments[r],o=a.uuid,l=e[o];if(void 0!==l&&l>=s){const r=s++,c=t[r];e[c.uuid]=l,t[l]=c,e[o]=r,t[r]=a;for(let t=0,e=n;t!==e;++t){const e=i[t],n=e[r],s=e[l];e[l]=n,e[r]=s}}}this.nCachedObjects_=s}uncache(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,n=i.length;let s=this.nCachedObjects_,r=t.length;for(let a=0,o=arguments.length;a!==o;++a){const o=arguments[a].uuid,l=e[o];if(void 0!==l)if(delete e[o],l<s){const a=--s,o=t[a],c=--r,h=t[c];e[o.uuid]=l,t[l]=o,e[h.uuid]=a,t[a]=h,t.pop();for(let t=0,e=n;t!==e;++t){const e=i[t],n=e[a],s=e[c];e[l]=n,e[a]=s,e.pop()}}else{const s=--r,a=t[s];s>0&&(e[a.uuid]=l),t[l]=a,t.pop();for(let t=0,e=n;t!==e;++t){const e=i[t];e[l]=e[s],e.pop()}}}this.nCachedObjects_=s}subscribe_(t,e){const i=this._bindingsIndicesByPath;let n=i[t];const s=this._bindings;if(void 0!==n)return s[n];const r=this._paths,a=this._parsedPaths,o=this._objects,l=o.length,c=this.nCachedObjects_,h=new Array(l);n=s.length,i[t]=n,r.push(t),a.push(e),s.push(h);for(let i=c,n=o.length;i!==n;++i){const n=o[i];h[i]=new zc(n,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){const n=this._paths,s=this._parsedPaths,r=this._bindings,a=r.length-1,o=r[a];e[t[a]]=i,r[i]=o,r.pop(),s[i]=s[a],s.pop(),n[i]=n[a],n.pop()}}},AnimationUtils:xl,ArcCurve:Ua,ArrayCamera:wc,ArrowHelper:class extends wn{constructor(t=new vi(0,0,1),e=new vi(0,0,0),i=1,n=16776960,s=.2*i,r=.2*s){super(),this.type="ArrowHelper",void 0===xh&&(xh=new hs,xh.setAttribute("position",new is([0,0,0,0,1,0],3)),wh=new no(0,.5,1,5,1),wh.translate(0,-.5,0)),this.position.copy(e),this.line=new ga(xh,new la({color:n,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new bs(wh,new jn({color:n,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(i,s,r)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{yh.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(yh,e)}}setLength(t,e=.2*t,i=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}},AttachedBindMode:I,Audio:Cc,AudioAnalyser:class{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let i=0;i<e.length;i++)t+=e[i];return t/e.length}},AudioContext:vc,AudioListener:class extends wn{constructor(){super(),this.type="AudioListener",this.context=vc.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new bc}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Sc,Tc,Ec),Ac.set(0,0,-1).applyQuaternion(Tc),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Sc.x,t),e.positionY.linearRampToValueAtTime(Sc.y,t),e.positionZ.linearRampToValueAtTime(Sc.z,t),e.forwardX.linearRampToValueAtTime(Ac.x,t),e.forwardY.linearRampToValueAtTime(Ac.y,t),e.forwardZ.linearRampToValueAtTime(Ac.z,t),e.upX.linearRampToValueAtTime(i.x,t),e.upY.linearRampToValueAtTime(i.y,t),e.upZ.linearRampToValueAtTime(i.z,t)}else e.setPosition(Sc.x,Sc.y,Sc.z),e.setOrientation(Ac.x,Ac.y,Ac.z,i.x,i.y,i.z)}},AudioLoader:class extends Bl{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new Hl(this.manager);function a(e){n?n(e):console.error(e),s.manager.itemError(t)}r.setResponseType("arraybuffer"),r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,(function(t){try{const i=t.slice(0);vc.getContext().decodeAudioData(i,(function(t){e(t)})).catch(a)}catch(t){a(t)}}),i,n)}},AxesHelper:class extends xa{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],i=new hs;i.setAttribute("position",new is(e,3)),i.setAttribute("color",new is([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(i,new la({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,i){const n=new zn,s=this.geometry.attributes.color.array;return n.set(t),n.toArray(s,0),n.toArray(s,3),n.set(e),n.toArray(s,6),n.toArray(s,9),n.set(i),n.toArray(s,12),n.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},BackSide:1,BasicDepthPacking:3200,BasicShadowMap:0,BatchedMesh:oa,Bone:Mr,BooleanKeyframeTrack:El,Box2:class{constructor(t=new Ve(1/0,1/0),e=new Ve(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=Qc.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Qc).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},Box3:xi,Box3Helper:class extends xa{constructor(t,e=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new hs;n.setIndex(new Qn(i,1)),n.setAttribute("position",new is([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(n,new la({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}},BoxGeometry:Ss,BoxHelper:class extends xa{constructor(t,e=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),s=new hs;s.setIndex(new Qn(i,1)),s.setAttribute("position",new Qn(n,3)),super(s,new la({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&_h.setFromObject(this.object),_h.isEmpty())return;const e=_h.min,i=_h.max,n=this.geometry.attributes.position,s=n.array;s[0]=i.x,s[1]=i.y,s[2]=i.z,s[3]=e.x,s[4]=i.y,s[5]=i.z,s[6]=e.x,s[7]=e.y,s[8]=i.z,s[9]=i.x,s[10]=e.y,s[11]=i.z,s[12]=i.x,s[13]=i.y,s[14]=e.z,s[15]=e.x,s[16]=i.y,s[17]=e.z,s[18]=e.x,s[19]=e.y,s[20]=e.z,s[21]=i.x,s[22]=e.y,s[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t,e){return super.copy(t,e),this.object=t.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}},BufferAttribute:Qn,BufferGeometry:hs,BufferGeometryLoader:uc,ByteType:$,Cache:Dl,Camera:ks,CameraHelper:class extends xa{constructor(t){const e=new hs,i=new la({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],s=[],r={};function a(t,e){o(t),o(e)}function o(t){n.push(0,0,0),s.push(0,0,0),void 0===r[t]&&(r[t]=[]),r[t].push(n.length/3-1)}a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4"),e.setAttribute("position",new is(n,3)),e.setAttribute("color",new is(s,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=r,this.update();const l=new zn(16755200),c=new zn(16711680),h=new zn(43775),d=new zn(16777215),u=new zn(3355443);this.setColors(l,c,h,d,u)}setColors(t,e,i,n,s){const r=this.geometry.getAttribute("color");r.setXYZ(0,t.r,t.g,t.b),r.setXYZ(1,t.r,t.g,t.b),r.setXYZ(2,t.r,t.g,t.b),r.setXYZ(3,t.r,t.g,t.b),r.setXYZ(4,t.r,t.g,t.b),r.setXYZ(5,t.r,t.g,t.b),r.setXYZ(6,t.r,t.g,t.b),r.setXYZ(7,t.r,t.g,t.b),r.setXYZ(8,t.r,t.g,t.b),r.setXYZ(9,t.r,t.g,t.b),r.setXYZ(10,t.r,t.g,t.b),r.setXYZ(11,t.r,t.g,t.b),r.setXYZ(12,t.r,t.g,t.b),r.setXYZ(13,t.r,t.g,t.b),r.setXYZ(14,t.r,t.g,t.b),r.setXYZ(15,t.r,t.g,t.b),r.setXYZ(16,t.r,t.g,t.b),r.setXYZ(17,t.r,t.g,t.b),r.setXYZ(18,t.r,t.g,t.b),r.setXYZ(19,t.r,t.g,t.b),r.setXYZ(20,t.r,t.g,t.b),r.setXYZ(21,t.r,t.g,t.b),r.setXYZ(22,t.r,t.g,t.b),r.setXYZ(23,t.r,t.g,t.b),r.setXYZ(24,e.r,e.g,e.b),r.setXYZ(25,e.r,e.g,e.b),r.setXYZ(26,e.r,e.g,e.b),r.setXYZ(27,e.r,e.g,e.b),r.setXYZ(28,e.r,e.g,e.b),r.setXYZ(29,e.r,e.g,e.b),r.setXYZ(30,e.r,e.g,e.b),r.setXYZ(31,e.r,e.g,e.b),r.setXYZ(32,i.r,i.g,i.b),r.setXYZ(33,i.r,i.g,i.b),r.setXYZ(34,i.r,i.g,i.b),r.setXYZ(35,i.r,i.g,i.b),r.setXYZ(36,i.r,i.g,i.b),r.setXYZ(37,i.r,i.g,i.b),r.setXYZ(38,n.r,n.g,n.b),r.setXYZ(39,n.r,n.g,n.b),r.setXYZ(40,s.r,s.g,s.b),r.setXYZ(41,s.r,s.g,s.b),r.setXYZ(42,s.r,s.g,s.b),r.setXYZ(43,s.r,s.g,s.b),r.setXYZ(44,s.r,s.g,s.b),r.setXYZ(45,s.r,s.g,s.b),r.setXYZ(46,s.r,s.g,s.b),r.setXYZ(47,s.r,s.g,s.b),r.setXYZ(48,s.r,s.g,s.b),r.setXYZ(49,s.r,s.g,s.b),r.needsUpdate=!0}update(){const t=this.geometry,e=this.pointMap;gh.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse);const i=this.camera.coordinateSystem===Ce?-1:0;vh("c",e,t,gh,0,0,i),vh("t",e,t,gh,0,0,1),vh("n1",e,t,gh,-1,-1,i),vh("n2",e,t,gh,1,-1,i),vh("n3",e,t,gh,-1,1,i),vh("n4",e,t,gh,1,1,i),vh("f1",e,t,gh,-1,-1,1),vh("f2",e,t,gh,1,-1,1),vh("f3",e,t,gh,-1,1,1),vh("f4",e,t,gh,1,1,1),vh("u1",e,t,gh,.7,1.1,i),vh("u2",e,t,gh,-.7,1.1,i),vh("u3",e,t,gh,0,2,i),vh("cf1",e,t,gh,-1,0,1),vh("cf2",e,t,gh,1,0,1),vh("cf3",e,t,gh,0,-1,1),vh("cf4",e,t,gh,0,1,1),vh("cn1",e,t,gh,-1,0,i),vh("cn2",e,t,gh,1,0,i),vh("cn3",e,t,gh,0,-1,i),vh("cn4",e,t,gh,0,1,i),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},CanvasTexture:class extends hi{constructor(t,e,i,n,s,r,a,o,l){super(t,e,i,n,s,r,a,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}},CapsuleGeometry:eo,CatmullRomCurve3:za,CineonToneMapping:3,CircleGeometry:io,ClampToEdgeWrapping:V,Clock:bc,Color:zn,ColorKeyframeTrack:Al,ColorManagement:ei,CompressedArrayTexture:class extends ka{constructor(t,e,i,n,s,r){super(t,e,i,s,r),this.isCompressedArrayTexture=!0,this.image.depth=n,this.wrapR=V,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}},CompressedCubeTexture:class extends ka{constructor(t,e,i){super(void 0,t[0].width,t[0].height,e,i,N),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}},CompressedTexture:ka,CompressedTextureLoader:class extends Bl{constructor(t){super(t)}load(t,e,i,n){const s=this,r=[],a=new ka,o=new Hl(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(s.withCredentials);let l=0;function c(c){o.load(t[c],(function(t){const i=s.parse(t,!0);r[c]={width:i.width,height:i.height,format:i.format,mipmaps:i.mipmaps},l+=1,6===l&&(1===i.mipmapCount&&(a.minFilter=X),a.image=r,a.format=i.format,a.needsUpdate=!0,e&&e(a))}),i,n)}if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)c(e);else o.load(t,(function(t){const i=s.parse(t,!0);if(i.isCubemap){const t=i.mipmaps.length/i.mipmapCount;for(let e=0;e<t;e++){r[e]={mipmaps:[]};for(let t=0;t<i.mipmapCount;t++)r[e].mipmaps.push(i.mipmaps[e*i.mipmapCount+t]),r[e].format=i.format,r[e].width=i.width,r[e].height=i.height}a.image=r}else a.image.width=i.width,a.image.height=i.height,a.mipmaps=i.mipmaps;1===i.mipmapCount&&(a.minFilter=X),a.format=i.format,a.needsUpdate=!0,e&&e(a)}),i,n);return a}},ConeGeometry:so,ConstantAlphaFactor:213,ConstantColorFactor:211,Controls:class extends ke{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}},CubeCamera:Ns,CubeReflectionMapping:N,CubeRefractionMapping:O,CubeTexture:Os,CubeTextureLoader:class extends Bl{constructor(t){super(t)}load(t,e,i,n){const s=new Os;s.colorSpace=ce;const r=new Vl(this.manager);r.setCrossOrigin(this.crossOrigin),r.setPath(this.path);let a=0;function o(i){r.load(t[i],(function(t){s.images[i]=t,a++,6===a&&(s.needsUpdate=!0,e&&e(s))}),void 0,n)}for(let e=0;e<t.length;++e)o(e);return s}},CubeUVReflectionMapping:z,CubicBezierCurve:ja,CubicBezierCurve3:Wa,CubicInterpolant:bl,CullFaceBack:1,CullFaceFront:2,CullFaceFrontBack:3,CullFaceNone:0,Curve:Pa,CurvePath:Ka,CustomBlending:5,CustomToneMapping:5,CylinderGeometry:no,Cylindrical:class{constructor(t=1,e=0,i=0){return this.radius=t,this.theta=e,this.y=i,this}set(t,e,i){return this.radius=t,this.theta=e,this.y=i,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,i){return this.radius=Math.sqrt(t*t+i*i),this.theta=Math.atan2(t,i),this.y=e,this}clone(){return(new this.constructor).copy(this)}},Data3DTexture:fi,DataArrayTexture:mi,DataTexture:Sr,DataTextureLoader:class extends Bl{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new Sr,a=new Hl(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(t,(function(t){let i;try{i=s.parse(t)}catch(t){if(void 0===n)return void console.error(t);n(t)}void 0!==i.image?r.image=i.image:void 0!==i.data&&(r.image.width=i.width,r.image.height=i.height,r.image.data=i.data),r.wrapS=void 0!==i.wrapS?i.wrapS:V,r.wrapT=void 0!==i.wrapT?i.wrapT:V,r.magFilter=void 0!==i.magFilter?i.magFilter:X,r.minFilter=void 0!==i.minFilter?i.minFilter:X,r.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.colorSpace&&(r.colorSpace=i.colorSpace),void 0!==i.flipY&&(r.flipY=i.flipY),void 0!==i.format&&(r.format=i.format),void 0!==i.type&&(r.type=i.type),void 0!==i.mipmaps&&(r.mipmaps=i.mipmaps,r.minFilter=Y),1===i.mipmapCount&&(r.minFilter=X),void 0!==i.generateMipmaps&&(r.generateMipmaps=i.generateMipmaps),r.needsUpdate=!0,e&&e(r,i)}),i,n),r}},DataUtils:Yn,DecrementStencilOp:7683,DecrementWrapStencilOp:ge,DefaultLoadingManager:Ol,DepthFormat:pt,DepthStencilFormat:mt,DepthTexture:Ra,DetachedBindMode:U,DirectionalLight:sc,DirectionalLightHelper:class extends wn{constructor(t,e,i){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",void 0===e&&(e=1);let n=new hs;n.setAttribute("position",new is([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const s=new la({fog:!1,toneMapped:!1});this.lightPlane=new ga(n,s),this.add(this.lightPlane),n=new hs,n.setAttribute("position",new is([0,0,0,0,0,1],3)),this.targetLine=new ga(n,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),uh.setFromMatrixPosition(this.light.matrixWorld),ph.setFromMatrixPosition(this.light.target.matrixWorld),mh.subVectors(ph,uh),this.lightPlane.lookAt(ph),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(ph),this.targetLine.scale.z=mh.length()}},DiscreteInterpolant:Sl,DodecahedronGeometry:ao,DoubleSide:2,DstAlphaFactor:206,DstColorFactor:208,DynamicCopyUsage:35050,DynamicDrawUsage:35048,DynamicReadUsage:35049,EdgesGeometry:uo,EllipseCurve:Ia,EqualCompare:514,EqualDepth:4,EqualStencilFunc:514,EquirectangularReflectionMapping:B,EquirectangularRefractionMapping:F,Euler:sn,EventDispatcher:ke,ExtrudeGeometry:Vo,FileLoader:Hl,Float16BufferAttribute:class extends Qn{constructor(t,e,i){super(new Uint16Array(t),e,i),this.isFloat16BufferAttribute=!0}getX(t){let e=Zn(this.array[t*this.itemSize]);return this.normalized&&(e=Fe(e,this.array)),e}setX(t,e){return this.normalized&&(e=ze(e,this.array)),this.array[t*this.itemSize]=Xn(e),this}getY(t){let e=Zn(this.array[t*this.itemSize+1]);return this.normalized&&(e=Fe(e,this.array)),e}setY(t,e){return this.normalized&&(e=ze(e,this.array)),this.array[t*this.itemSize+1]=Xn(e),this}getZ(t){let e=Zn(this.array[t*this.itemSize+2]);return this.normalized&&(e=Fe(e,this.array)),e}setZ(t,e){return this.normalized&&(e=ze(e,this.array)),this.array[t*this.itemSize+2]=Xn(e),this}getW(t){let e=Zn(this.array[t*this.itemSize+3]);return this.normalized&&(e=Fe(e,this.array)),e}setW(t,e){return this.normalized&&(e=ze(e,this.array)),this.array[t*this.itemSize+3]=Xn(e),this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=ze(e,this.array),i=ze(i,this.array)),this.array[t+0]=Xn(e),this.array[t+1]=Xn(i),this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=ze(e,this.array),i=ze(i,this.array),n=ze(n,this.array)),this.array[t+0]=Xn(e),this.array[t+1]=Xn(i),this.array[t+2]=Xn(n),this}setXYZW(t,e,i,n,s){return t*=this.itemSize,this.normalized&&(e=ze(e,this.array),i=ze(i,this.array),n=ze(n,this.array),s=ze(s,this.array)),this.array[t+0]=Xn(e),this.array[t+1]=Xn(i),this.array[t+2]=Xn(n),this.array[t+3]=Xn(s),this}},Float32BufferAttribute:is,FloatType:it,Fog:Gs,FogExp2:Vs,FramebufferTexture:class extends hi{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=j,this.minFilter=j,this.generateMipmaps=!1,this.needsUpdate=!0}},FrontSide:0,Frustum:Gr,GLBufferAttribute:class{constructor(t,e,i,n,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=e,this.itemSize=i,this.elementSize=n,this.count=s,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}},GLSL1:"100",GLSL3:Ae,GreaterCompare:516,GreaterDepth:6,GreaterEqualCompare:518,GreaterEqualDepth:5,GreaterEqualStencilFunc:518,GreaterStencilFunc:516,GridHelper:dh,Group:Fs,HalfFloatType:nt,HemisphereLight:jl,HemisphereLightHelper:class extends wn{constructor(t,e,i){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const n=new Wo(e);n.rotateY(.5*Math.PI),this.material=new jn({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const s=n.getAttribute("position"),r=new Float32Array(3*s.count);n.setAttribute("color",new Qn(r,3)),this.add(new bs(n,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");ch.copy(this.light.color),hh.copy(this.light.groundColor);for(let t=0,i=e.count;t<i;t++){const n=t<i/2?ch:hh;e.setXYZ(t,n.r,n.g,n.b)}e.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),t.lookAt(lh.setFromMatrixPosition(this.light.matrixWorld).negate())}},IcosahedronGeometry:jo,ImageBitmapLoader:class extends Bl{constructor(t){super(t),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const s=this,r=Dl.get(t);if(void 0!==r)return s.manager.itemStart(t),r.then?void r.then((i=>{e&&e(i),s.manager.itemEnd(t)})).catch((t=>{n&&n(t)})):(setTimeout((function(){e&&e(r),s.manager.itemEnd(t)}),0),r);const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader;const o=fetch(t,a).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(s.options,{colorSpaceConversion:"none"}))})).then((function(i){return Dl.add(t,i),e&&e(i),s.manager.itemEnd(t),i})).catch((function(e){n&&n(e),Dl.remove(t),s.manager.itemError(t),s.manager.itemEnd(t)}));Dl.add(t,o),s.manager.itemStart(t)}},ImageLoader:Vl,ImageUtils:ri,IncrementStencilOp:7682,IncrementWrapStencilOp:fe,InstancedBufferAttribute:Cr,InstancedBufferGeometry:dc,InstancedInterleavedBuffer:qc,InstancedMesh:Nr,Int16BufferAttribute:class extends Qn{constructor(t,e,i){super(new Int16Array(t),e,i)}},Int32BufferAttribute:class extends Qn{constructor(t,e,i){super(new Int32Array(t),e,i)}},Int8BufferAttribute:class extends Qn{constructor(t,e,i){super(new Int8Array(t),e,i)}},IntType:tt,InterleavedBuffer:Ws,InterleavedBufferAttribute:Xs,Interpolant:wl,InterpolateDiscrete:te,InterpolateLinear:ee,InterpolateSmooth:ie,InvertStencilOp:5386,KeepStencilOp:pe,KeyframeTrack:Tl,LOD:ur,LatheGeometry:to,Layers:rn,LessCompare:513,LessDepth:2,LessEqualCompare:515,LessEqualDepth:3,LessEqualStencilFunc:515,LessStencilFunc:513,Light:Gl,LightProbe:lc,Line:ga,Line3:ih,LineBasicMaterial:la,LineCurve:qa,LineCurve3:Xa,LineDashedMaterial:ml,LineLoop:wa,LineSegments:xa,LinearFilter:X,LinearInterpolant:Ml,LinearMipMapLinearFilter:1008,LinearMipMapNearestFilter:1007,LinearMipmapLinearFilter:Y,LinearMipmapNearestFilter:Z,LinearSRGBColorSpace:he,LinearToneMapping:1,LinearTransfer:de,Loader:Bl,LoaderUtils:hc,LoadingManager:Nl,LoopOnce:2200,LoopPingPong:Qt,LoopRepeat:Kt,LuminanceAlphaFormat:ut,LuminanceFormat:dt,MOUSE:i,Material:Gn,MaterialLoader:cc,MathUtils:He,Matrix2:Kc,Matrix3:Ge,Matrix4:Xi,MaxEquation:104,Mesh:bs,MeshBasicMaterial:jn,MeshDepthMaterial:dl,MeshDistanceMaterial:ul,MeshLambertMaterial:hl,MeshMatcapMaterial:pl,MeshNormalMaterial:cl,MeshPhongMaterial:ol,MeshPhysicalMaterial:al,MeshStandardMaterial:rl,MeshToonMaterial:ll,MinEquation:103,MirroredRepeatWrapping:G,MixOperation:1,MultiplyBlending:4,MultiplyOperation:0,NearestFilter:j,NearestMipMapLinearFilter:1005,NearestMipMapNearestFilter:1004,NearestMipmapLinearFilter:q,NearestMipmapNearestFilter:W,NeutralToneMapping:7,NeverCompare:512,NeverDepth:0,NeverStencilFunc:512,NoBlending:0,NoColorSpace:le,NoToneMapping:0,NormalAnimationBlendMode:ae,NormalBlending:1,NotEqualCompare:517,NotEqualDepth:7,NotEqualStencilFunc:517,NumberKeyframeTrack:Cl,Object3D:wn,ObjectLoader:class extends Bl{constructor(t){super(t)}load(t,e,i,n){const s=this,r=""===this.path?hc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||r;const a=new Hl(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(i){let r=null;try{r=JSON.parse(i)}catch(e){return void 0!==n&&n(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}const a=r.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())return void 0!==n&&n(new Error("THREE.ObjectLoader: Can't load "+t)),void console.error("THREE.ObjectLoader: Can't load "+t);s.parse(r,e)}),i,n)}async loadAsync(t,e){const i=""===this.path?hc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||i;const n=new Hl(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials);const s=await n.loadAsync(t,e),r=JSON.parse(s),a=r.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+t);return await this.parseAsync(r)}parse(t,e){const i=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),s=this.parseGeometries(t.geometries,n),r=this.parseImages(t.images,(function(){void 0!==e&&e(l)})),a=this.parseTextures(t.textures,r),o=this.parseMaterials(t.materials,a),l=this.parseObject(t.object,s,o,a,i),c=this.parseSkeletons(t.skeletons,l);if(this.bindSkeletons(l,c),this.bindLightTargets(l),void 0!==e){let t=!1;for(const e in r)if(r[e].data instanceof HTMLImageElement){t=!0;break}!1===t&&e(l)}return l}async parseAsync(t){const e=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),n=this.parseGeometries(t.geometries,i),s=await this.parseImagesAsync(t.images),r=this.parseTextures(t.textures,s),a=this.parseMaterials(t.materials,r),o=this.parseObject(t.object,n,a,r,e),l=this.parseSkeletons(t.skeletons,o);return this.bindSkeletons(o,l),this.bindLightTargets(o),o}parseShapes(t){const e={};if(void 0!==t)for(let i=0,n=t.length;i<n;i++){const n=(new po).fromJSON(t[i]);e[n.uuid]=n}return e}parseSkeletons(t,e){const i={},n={};if(e.traverse((function(t){t.isBone&&(n[t.uuid]=t)})),void 0!==t)for(let e=0,s=t.length;e<s;e++){const s=(new Ar).fromJSON(t[e],n);i[s.uuid]=s}return i}parseGeometries(t,e){const i={};if(void 0!==t){const n=new uc;for(let s=0,r=t.length;s<r;s++){let r;const a=t[s];switch(a.type){case"BufferGeometry":case"InstancedBufferGeometry":r=n.parse(a);break;default:a.type in il?r=il[a.type].fromJSON(a,e):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${a.type}"`)}r.uuid=a.uuid,void 0!==a.name&&(r.name=a.name),void 0!==a.userData&&(r.userData=a.userData),i[a.uuid]=r}}return i}parseMaterials(t,e){const i={},n={};if(void 0!==t){const s=new cc;s.setTextures(e);for(let e=0,r=t.length;e<r;e++){const r=t[e];void 0===i[r.uuid]&&(i[r.uuid]=s.parse(r)),n[r.uuid]=i[r.uuid]}}return n}parseAnimations(t){const e={};if(void 0!==t)for(let i=0;i<t.length;i++){const n=t[i],s=Il.parse(n);e[s.uuid]=s}return e}parseImages(t,e){const i=this,n={};let s;function r(t){if("string"==typeof t){const e=t;return function(t){return i.manager.itemStart(t),s.load(t,(function(){i.manager.itemEnd(t)}),void 0,(function(){i.manager.itemError(t),i.manager.itemEnd(t)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:i.resourcePath+e)}return t.data?{data:Xe(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){const i=new Nl(e);s=new Vl(i),s.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.url;if(Array.isArray(s)){const t=[];for(let e=0,i=s.length;e<i;e++){const i=r(s[e]);null!==i&&(i instanceof HTMLImageElement?t.push(i):t.push(new Sr(i.data,i.width,i.height)))}n[i.uuid]=new oi(t)}else{const t=r(i.url);n[i.uuid]=new oi(t)}}}return n}async parseImagesAsync(t){const e=this,i={};let n;async function s(t){if("string"==typeof t){const i=t,s=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(i)?i:e.resourcePath+i;return await n.loadAsync(s)}return t.data?{data:Xe(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){n=new Vl(this.manager),n.setCrossOrigin(this.crossOrigin);for(let e=0,n=t.length;e<n;e++){const n=t[e],r=n.url;if(Array.isArray(r)){const t=[];for(let e=0,i=r.length;e<i;e++){const i=r[e],n=await s(i);null!==n&&(n instanceof HTMLImageElement?t.push(n):t.push(new Sr(n.data,n.width,n.height)))}i[n.uuid]=new oi(t)}else{const t=await s(n.url);i[n.uuid]=new oi(t)}}}return i}parseTextures(t,e){function i(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}const n={};if(void 0!==t)for(let s=0,r=t.length;s<r;s++){const r=t[s];void 0===r.image&&console.warn('THREE.ObjectLoader: No "image" specified for',r.uuid),void 0===e[r.image]&&console.warn("THREE.ObjectLoader: Undefined image",r.image);const a=e[r.image],o=a.data;let l;Array.isArray(o)?(l=new Os,6===o.length&&(l.needsUpdate=!0)):(l=o&&o.data?new Sr:new hi,o&&(l.needsUpdate=!0)),l.source=a,l.uuid=r.uuid,void 0!==r.name&&(l.name=r.name),void 0!==r.mapping&&(l.mapping=i(r.mapping,pc)),void 0!==r.channel&&(l.channel=r.channel),void 0!==r.offset&&l.offset.fromArray(r.offset),void 0!==r.repeat&&l.repeat.fromArray(r.repeat),void 0!==r.center&&l.center.fromArray(r.center),void 0!==r.rotation&&(l.rotation=r.rotation),void 0!==r.wrap&&(l.wrapS=i(r.wrap[0],mc),l.wrapT=i(r.wrap[1],mc)),void 0!==r.format&&(l.format=r.format),void 0!==r.internalFormat&&(l.internalFormat=r.internalFormat),void 0!==r.type&&(l.type=r.type),void 0!==r.colorSpace&&(l.colorSpace=r.colorSpace),void 0!==r.minFilter&&(l.minFilter=i(r.minFilter,fc)),void 0!==r.magFilter&&(l.magFilter=i(r.magFilter,fc)),void 0!==r.anisotropy&&(l.anisotropy=r.anisotropy),void 0!==r.flipY&&(l.flipY=r.flipY),void 0!==r.generateMipmaps&&(l.generateMipmaps=r.generateMipmaps),void 0!==r.premultiplyAlpha&&(l.premultiplyAlpha=r.premultiplyAlpha),void 0!==r.unpackAlignment&&(l.unpackAlignment=r.unpackAlignment),void 0!==r.compareFunction&&(l.compareFunction=r.compareFunction),void 0!==r.userData&&(l.userData=r.userData),n[r.uuid]=l}return n}parseObject(t,e,i,n,s){let r,a,o;function l(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function c(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let n=0,s=t.length;n<s;n++){const s=t[n];void 0===i[s]&&console.warn("THREE.ObjectLoader: Undefined material",s),e.push(i[s])}return e}return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),i[t]}}function h(t){return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined texture",t),n[t]}switch(t.type){case"Scene":r=new js,void 0!==t.background&&(Number.isInteger(t.background)?r.background=new zn(t.background):r.background=h(t.background)),void 0!==t.environment&&(r.environment=h(t.environment)),void 0!==t.fog&&("Fog"===t.fog.type?r.fog=new Gs(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(r.fog=new Vs(t.fog.color,t.fog.density)),""!==t.fog.name&&(r.fog.name=t.fog.name)),void 0!==t.backgroundBlurriness&&(r.backgroundBlurriness=t.backgroundBlurriness),void 0!==t.backgroundIntensity&&(r.backgroundIntensity=t.backgroundIntensity),void 0!==t.backgroundRotation&&r.backgroundRotation.fromArray(t.backgroundRotation),void 0!==t.environmentIntensity&&(r.environmentIntensity=t.environmentIntensity),void 0!==t.environmentRotation&&r.environmentRotation.fromArray(t.environmentRotation);break;case"PerspectiveCamera":r=new Us(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(r.focus=t.focus),void 0!==t.zoom&&(r.zoom=t.zoom),void 0!==t.filmGauge&&(r.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(r.filmOffset=t.filmOffset),void 0!==t.view&&(r.view=Object.assign({},t.view));break;case"OrthographicCamera":r=new ic(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(r.zoom=t.zoom),void 0!==t.view&&(r.view=Object.assign({},t.view));break;case"AmbientLight":r=new rc(t.color,t.intensity);break;case"DirectionalLight":r=new sc(t.color,t.intensity),r.target=t.target||"";break;case"PointLight":r=new ec(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":r=new ac(t.color,t.intensity,t.width,t.height);break;case"SpotLight":r=new Jl(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay),r.target=t.target||"";break;case"HemisphereLight":r=new jl(t.color,t.groundColor,t.intensity);break;case"LightProbe":r=(new lc).fromJSON(t);break;case"SkinnedMesh":a=l(t.geometry),o=c(t.material),r=new br(a,o),void 0!==t.bindMode&&(r.bindMode=t.bindMode),void 0!==t.bindMatrix&&r.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(r.skeleton=t.skeleton);break;case"Mesh":a=l(t.geometry),o=c(t.material),r=new bs(a,o);break;case"InstancedMesh":a=l(t.geometry),o=c(t.material);const e=t.count,i=t.instanceMatrix,n=t.instanceColor;r=new Nr(a,o,e),r.instanceMatrix=new Cr(new Float32Array(i.array),16),void 0!==n&&(r.instanceColor=new Cr(new Float32Array(n.array),n.itemSize));break;case"BatchedMesh":a=l(t.geometry),o=c(t.material),r=new oa(t.maxInstanceCount,t.maxVertexCount,t.maxIndexCount,o),r.geometry=a,r.perObjectFrustumCulled=t.perObjectFrustumCulled,r.sortObjects=t.sortObjects,r._drawRanges=t.drawRanges,r._reservedRanges=t.reservedRanges,r._visibility=t.visibility,r._active=t.active,r._bounds=t.bounds.map((t=>{const e=new xi;e.min.fromArray(t.boxMin),e.max.fromArray(t.boxMax);const i=new Bi;return i.radius=t.sphereRadius,i.center.fromArray(t.sphereCenter),{boxInitialized:t.boxInitialized,box:e,sphereInitialized:t.sphereInitialized,sphere:i}})),r._maxInstanceCount=t.maxInstanceCount,r._maxVertexCount=t.maxVertexCount,r._maxIndexCount=t.maxIndexCount,r._geometryInitialized=t.geometryInitialized,r._geometryCount=t.geometryCount,r._matricesTexture=h(t.matricesTexture.uuid),void 0!==t.colorsTexture&&(r._colorsTexture=h(t.colorsTexture.uuid));break;case"LOD":r=new ur;break;case"Line":r=new ga(l(t.geometry),c(t.material));break;case"LineLoop":r=new wa(l(t.geometry),c(t.material));break;case"LineSegments":r=new xa(l(t.geometry),c(t.material));break;case"PointCloud":case"Points":r=new Aa(l(t.geometry),c(t.material));break;case"Sprite":r=new lr(c(t.material));break;case"Group":r=new Fs;break;case"Bone":r=new Mr;break;default:r=new wn}if(r.uuid=t.uuid,void 0!==t.name&&(r.name=t.name),void 0!==t.matrix?(r.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(r.matrixAutoUpdate=t.matrixAutoUpdate),r.matrixAutoUpdate&&r.matrix.decompose(r.position,r.quaternion,r.scale)):(void 0!==t.position&&r.position.fromArray(t.position),void 0!==t.rotation&&r.rotation.fromArray(t.rotation),void 0!==t.quaternion&&r.quaternion.fromArray(t.quaternion),void 0!==t.scale&&r.scale.fromArray(t.scale)),void 0!==t.up&&r.up.fromArray(t.up),void 0!==t.castShadow&&(r.castShadow=t.castShadow),void 0!==t.receiveShadow&&(r.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.intensity&&(r.shadow.intensity=t.shadow.intensity),void 0!==t.shadow.bias&&(r.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(r.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(r.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&r.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(r.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.frustumCulled&&(r.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(r.renderOrder=t.renderOrder),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.layers&&(r.layers.mask=t.layers),void 0!==t.children){const a=t.children;for(let t=0;t<a.length;t++)r.add(this.parseObject(a[t],e,i,n,s))}if(void 0!==t.animations){const e=t.animations;for(let t=0;t<e.length;t++){const i=e[t];r.animations.push(s[i])}}if("LOD"===t.type){void 0!==t.autoUpdate&&(r.autoUpdate=t.autoUpdate);const e=t.levels;for(let t=0;t<e.length;t++){const i=e[t],n=r.getObjectByProperty("uuid",i.object);void 0!==n&&r.addLevel(n,i.distance,i.hysteresis)}}return r}bindSkeletons(t,e){0!==Object.keys(e).length&&t.traverse((function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){const i=e[t.skeleton];void 0===i?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(i,t.bindMatrix)}}))}bindLightTargets(t){t.traverse((function(e){if(e.isDirectionalLight||e.isSpotLight){const i=e.target,n=t.getObjectByProperty("uuid",i);e.target=void 0!==n?n:new wn}}))}},ObjectSpaceNormalMap:1,OctahedronGeometry:Wo,OneFactor:201,OneMinusConstantAlphaFactor:214,OneMinusConstantColorFactor:212,OneMinusDstAlphaFactor:207,OneMinusDstColorFactor:209,OneMinusSrcAlphaFactor:f,OneMinusSrcColorFactor:203,OrthographicCamera:ic,PCFShadowMap:1,PCFSoftShadowMap:2,PMREMGenerator:Jh,Path:Qa,PerspectiveCamera:Us,Plane:zr,PlaneGeometry:qo,PlaneHelper:class extends ga{constructor(t,e=1,i=16776960){const n=i,s=new hs;s.setAttribute("position",new is([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),s.computeBoundingSphere(),super(s,new la({color:n,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const r=new hs;r.setAttribute("position",new is([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),r.computeBoundingSphere(),this.add(new bs(r,new jn({color:n,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}},PointLight:ec,PointLightHelper:class extends bs{constructor(t,e,i){super(new Yo(e,4,2),new jn({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}},Points:Aa,PointsMaterial:ba,PolarGridHelper:class extends xa{constructor(t=10,e=16,i=8,n=64,s=4473924,r=8947848){s=new zn(s),r=new zn(r);const a=[],o=[];if(e>1)for(let i=0;i<e;i++){const n=i/e*(2*Math.PI),l=Math.sin(n)*t,c=Math.cos(n)*t;a.push(0,0,0),a.push(l,0,c);const h=1&i?s:r;o.push(h.r,h.g,h.b),o.push(h.r,h.g,h.b)}for(let e=0;e<i;e++){const l=1&e?s:r,c=t-t/i*e;for(let t=0;t<n;t++){let e=t/n*(2*Math.PI),i=Math.sin(e)*c,s=Math.cos(e)*c;a.push(i,0,s),o.push(l.r,l.g,l.b),e=(t+1)/n*(2*Math.PI),i=Math.sin(e)*c,s=Math.cos(e)*c,a.push(i,0,s),o.push(l.r,l.g,l.b)}}const l=new hs;l.setAttribute("position",new is(a,3)),l.setAttribute("color",new is(o,3));super(l,new la({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}},PolyhedronGeometry:ro,PositionalAudio:class extends Cc{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,i){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=i,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(Lc,kc,Rc),Pc.set(0,0,1).applyQuaternion(kc);const e=this.panner;if(e.positionX){const t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(Lc.x,t),e.positionY.linearRampToValueAtTime(Lc.y,t),e.positionZ.linearRampToValueAtTime(Lc.z,t),e.orientationX.linearRampToValueAtTime(Pc.x,t),e.orientationY.linearRampToValueAtTime(Pc.y,t),e.orientationZ.linearRampToValueAtTime(Pc.z,t)}else e.setPosition(Lc.x,Lc.y,Lc.z),e.setOrientation(Pc.x,Pc.y,Pc.z)}},PropertyBinding:zc,PropertyMixer:Ic,QuadraticBezierCurve:Za,QuadraticBezierCurve3:Ya,Quaternion:gi,QuaternionKeyframeTrack:kl,QuaternionLinearInterpolant:Ll,RED_GREEN_RGTC2_Format:Jt,RED_RGTC1_Format:Zt,REVISION:e,RGBADepthPacking:3201,RGBAFormat:ht,RGBAIntegerFormat:yt,RGBA_ASTC_10x10_Format:Vt,RGBA_ASTC_10x5_Format:Ft,RGBA_ASTC_10x6_Format:zt,RGBA_ASTC_10x8_Format:Ht,RGBA_ASTC_12x10_Format:Gt,RGBA_ASTC_12x12_Format:jt,RGBA_ASTC_4x4_Format:Rt,RGBA_ASTC_5x4_Format:Pt,RGBA_ASTC_5x5_Format:It,RGBA_ASTC_6x5_Format:Ut,RGBA_ASTC_6x6_Format:Dt,RGBA_ASTC_8x5_Format:Nt,RGBA_ASTC_8x6_Format:Ot,RGBA_ASTC_8x8_Format:Bt,RGBA_BPTC_Format:Wt,RGBA_ETC2_EAC_Format:kt,RGBA_PVRTC_2BPPV1_Format:At,RGBA_PVRTC_4BPPV1_Format:Et,RGBA_S3TC_DXT1_Format:wt,RGBA_S3TC_DXT3_Format:bt,RGBA_S3TC_DXT5_Format:Mt,RGBDepthPacking:3202,RGBFormat:ct,RGBIntegerFormat:1032,RGB_BPTC_SIGNED_Format:qt,RGB_BPTC_UNSIGNED_Format:Xt,RGB_ETC1_Format:Ct,RGB_ETC2_Format:Lt,RGB_PVRTC_2BPPV1_Format:Tt,RGB_PVRTC_4BPPV1_Format:St,RGB_S3TC_DXT1_Format:xt,RGDepthPacking:3203,RGFormat:vt,RGIntegerFormat:_t,RawShaderMaterial:sl,Ray:qi,Raycaster:Zc,RectAreaLight:ac,RedFormat:ft,RedIntegerFormat:gt,ReinhardToneMapping:2,RenderTarget:ui,RenderTarget3D:class extends ui{constructor(t=1,e=1,i=1,n={}){super(t,e,n),this.isRenderTarget3D=!0,this.depth=i,this.texture=new fi(null,t,e,i),this.texture.isRenderTargetTexture=!0}},RenderTargetArray:class extends ui{constructor(t=1,e=1,i=1,n={}){super(t,e,n),this.isRenderTargetArray=!0,this.depth=i,this.texture=new mi(null,t,e,i),this.texture.isRenderTargetTexture=!0}},RepeatWrapping:H,ReplaceStencilOp:me,ReverseSubtractEquation:102,RingGeometry:Xo,SIGNED_RED_GREEN_RGTC2_Format:$t,SIGNED_RED_RGTC1_Format:Yt,SRGBColorSpace:ce,SRGBTransfer:ue,Scene:js,ShaderChunk:Ah,ShaderLib:Lh,ShaderMaterial:Ls,ShadowMaterial:nl,Shape:po,ShapeGeometry:Zo,ShapePath:bh,ShapeUtils:Fo,ShortType:K,Skeleton:Ar,SkeletonHelper:class extends xa{constructor(t){const e=oh(t),i=new hs,n=[],s=[],r=new zn(0,0,1),a=new zn(0,1,0);for(let t=0;t<e.length;t++){const i=e[t];i.parent&&i.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),s.push(r.r,r.g,r.b),s.push(a.r,a.g,a.b))}i.setAttribute("position",new is(n,3)),i.setAttribute("color",new is(s,3));super(i,new la({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,i=this.geometry,n=i.getAttribute("position");ah.copy(this.root.matrixWorld).invert();for(let t=0,i=0;t<e.length;t++){const s=e[t];s.parent&&s.parent.isBone&&(rh.multiplyMatrices(ah,s.matrixWorld),sh.setFromMatrixPosition(rh),n.setXYZ(i,sh.x,sh.y,sh.z),rh.multiplyMatrices(ah,s.parent.matrixWorld),sh.setFromMatrixPosition(rh),n.setXYZ(i+1,sh.x,sh.y,sh.z),i+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose()}},SkinnedMesh:br,Source:oi,Sphere:Bi,SphereGeometry:Yo,Spherical:$c,SphericalHarmonics3:oc,SplineCurve:Ja,SpotLight:Jl,SpotLightHelper:class extends wn{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const i=new hs,n=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let t=0,e=1,i=32;t<i;t++,e++){const s=t/i*Math.PI*2,r=e/i*Math.PI*2;n.push(Math.cos(s),Math.sin(s),1,Math.cos(r),Math.sin(r),1)}i.setAttribute("position",new is(n,3));const s=new la({fog:!1,toneMapped:!1});this.cone=new xa(i,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),nh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(nh),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},Sprite:lr,SpriteMaterial:Zs,SrcAlphaFactor:m,SrcAlphaSaturateFactor:210,SrcColorFactor:202,StaticCopyUsage:35046,StaticDrawUsage:Ee,StaticReadUsage:35045,StereoCamera:class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Us,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Us,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,xc.copy(t.projectionMatrix);const i=e.eyeSep/2,n=i*e.near/e.focus,s=e.near*Math.tan(Ie*e.fov*.5)/e.zoom;let r,a;yc.elements[12]=-i,_c.elements[12]=i,r=-s*e.aspect+n,a=s*e.aspect+n,xc.elements[0]=2*e.near/(a-r),xc.elements[8]=(a+r)/(a-r),this.cameraL.projectionMatrix.copy(xc),r=-s*e.aspect-n,a=s*e.aspect-n,xc.elements[0]=2*e.near/(a-r),xc.elements[8]=(a+r)/(a-r),this.cameraR.projectionMatrix.copy(xc)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(yc),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(_c)}},StreamCopyUsage:35042,StreamDrawUsage:35040,StreamReadUsage:35041,StringKeyframeTrack:Rl,SubtractEquation:101,SubtractiveBlending:3,TOUCH:n,TangentSpaceNormalMap:0,TetrahedronGeometry:Jo,Texture:hi,TextureLoader:class extends Bl{constructor(t){super(t)}load(t,e,i,n){const s=new hi,r=new Vl(this.manager);return r.setCrossOrigin(this.crossOrigin),r.setPath(this.path),r.load(t,(function(t){s.image=t,s.needsUpdate=!0,void 0!==e&&e(s)}),i,n),s}},TextureUtils:Sh,TimestampQuery:{COMPUTE:"compute",RENDER:"render"},TorusGeometry:$o,TorusKnotGeometry:Ko,Triangle:Dn,TriangleFanDrawMode:2,TriangleStripDrawMode:1,TrianglesDrawMode:0,TubeGeometry:Qo,UVMapping:D,Uint16BufferAttribute:ts,Uint32BufferAttribute:es,Uint8BufferAttribute:class extends Qn{constructor(t,e,i){super(new Uint8Array(t),e,i)}},Uint8ClampedBufferAttribute:class extends Qn{constructor(t,e,i){super(new Uint8ClampedArray(t),e,i)}},Uniform:jc,UniformsGroup:class extends ke{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:Wc++}),this.name="",this.usage=Ee,this.uniforms=[]}add(t){return this.uniforms.push(t),this}remove(t){const e=this.uniforms.indexOf(t);return-1!==e&&this.uniforms.splice(e,1),this}setName(t){return this.name=t,this}setUsage(t){return this.usage=t,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(t){this.name=t.name,this.usage=t.usage;const e=t.uniforms;this.uniforms.length=0;for(let t=0,i=e.length;t<i;t++){const i=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0;t<i.length;t++)this.uniforms.push(i[t].clone())}return this}clone(){return(new this.constructor).copy(this)}},UniformsLib:Ch,UniformsUtils:Cs,UnsignedByteType:J,UnsignedInt248Type:at,UnsignedInt5999Type:ot,UnsignedIntType:et,UnsignedShort4444Type:st,UnsignedShort5551Type:rt,UnsignedShortType:Q,VSMShadowMap:3,Vector2:Ve,Vector3:vi,Vector4:di,VectorKeyframeTrack:Pl,VideoFrameTexture:class extends La{constructor(t,e,i,n,s,r,a,o){super({},t,e,i,n,s,r,a,o),this.isVideoFrameTexture=!0}update(){}clone(){return(new this.constructor).copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}},VideoTexture:La,WebGL3DRenderTarget:class extends pi{constructor(t=1,e=1,i=1,n={}){super(t,e,n),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new fi(null,t,e,i),this.texture.isRenderTargetTexture=!0}},WebGLArrayRenderTarget:class extends pi{constructor(t=1,e=1,i=1,n={}){super(t,e,n),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new mi(null,t,e,i),this.texture.isRenderTargetTexture=!0}},WebGLCoordinateSystem:Ce,WebGLCubeRenderTarget:Bs,WebGLRenderTarget:pi,WebGLRenderer:ap,WebGLUtils:Qu,WebGPUCoordinateSystem:Le,WebXRController:Hs,WireframeGeometry:tl,WrapAroundEnding:re,ZeroCurvatureEnding:ne,ZeroFactor:200,ZeroSlopeEnding:se,ZeroStencilOp:0,createCanvasElement:Ye});const lp={bottom:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},front:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},help:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M23.0%2c-13.0 A10.0%2c10.0%2c0%2c1%2c0%2c22.998476951563912%2c-12.825475935627155' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3ctext x='7.0' y='-6.0' font-size='20.0' fill='rgb(83%2c160%2c227)' font-family='sans-serif' font-weight='bold' dy='0em'%3e%3f%3c/text%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M23.0%2c-13.0 A10.0%2c10.0%2c0%2c1%2c0%2c22.998476951563912%2c-12.825475935627155' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3ctext x='7.0' y='-6.0' font-size='20.0' fill='rgb(48%2c 142%2c 225)' font-family='sans-serif' font-weight='bold' dy='0em'%3e%3f%3c/text%3e%3c/svg%3e"},iso:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M22.0%2c-7.5 L22.0%2c-18.5 L13.0%2c-13.0 L13.0%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-13.0 L13.0%2c-2.0 L4.0%2c-7.5 L4.0%2c-18.5 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-18.5 L13.0%2c-24.0 L4.0%2c-18.5 L13.0%2c-13.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M22.0%2c-7.5 L22.0%2c-18.5 L13.0%2c-13.0 L13.0%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-13.0 L13.0%2c-2.0 L4.0%2c-7.5 L4.0%2c-18.5 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-18.5 L13.0%2c-24.0 L4.0%2c-18.5 L13.0%2c-13.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},left:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},mesh:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e"},mesh_empty:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='%23ddd' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='%23ddd' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='%23666' stroke='%23666' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='%23666' stroke='%23666' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23666' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e"},mesh_mix:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-14.2 L12.6%2c-14.2 L8.6%2c-10.133333333333333 L8.6%2c-6.066666666666666 L12.6%2c-2.0 L6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='square' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M16.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 L16.6%2c-2.0 L12.6%2c-6.066666666666666 L12.6%2c-10.133333333333333 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M10.6%2c-10.133333333333333 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L10.6%2c-6.066666666666666' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-14.2 L6.0%2c-14.2 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L6.0%2c-2.0 L14.6%2c-2.0' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-14.2 L12.6%2c-14.2 L8.6%2c-10.133333333333333 L8.6%2c-6.066666666666666 L12.6%2c-2.0 L6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='square' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M16.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 L16.6%2c-2.0 L12.6%2c-6.066666666666666 L12.6%2c-10.133333333333333 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M10.6%2c-10.133333333333333 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L10.6%2c-6.066666666666666' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-14.2 L6.0%2c-14.2 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L6.0%2c-2.0 L14.6%2c-2.0' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},mesh_no:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e"},pause:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='5.2' y='-22.0' width='5.6' height='18.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3crect x='15.2' y='-22.0' width='5.6' height='18.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='5.2' y='-22.0' width='5.6' height='18.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3crect x='15.2' y='-22.0' width='5.6' height='18.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},pin:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='10.0' y='-23.0' width='6.0' height='11.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-3.0 L13.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M17.330127018922195%2c-21.5 A5.0%2c5.0%2c0%2c0%2c0%2c8.669872981077805%2c-21.5' stroke='%23444' stroke-width='1.25' fill='rgb(83%2c160%2c227)' stroke-linecap='round' /%3e%3cpath d='M21.66025403784439%2c-10.2 A10.0%2c10.0%2c0%2c0%2c0%2c4.339745962155613%2c-10.2' stroke='%23444' stroke-width='1.25' fill='rgb(83%2c160%2c227)' stroke-linecap='round' /%3e%3cpath d='M4.5%2c-10.2 L21.5%2c-10.2 Z' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M8.8%2c-21.4 L17.2%2c-21.4 Z' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='10.0' y='-23.0' width='6.0' height='11.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-3.0 L13.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M17.330127018922195%2c-21.5 A5.0%2c5.0%2c0%2c0%2c0%2c8.669872981077805%2c-21.5' stroke='%23ddd' stroke-width='1.25' fill='rgb(48%2c 142%2c 225)' stroke-linecap='round' /%3e%3cpath d='M21.66025403784439%2c-10.2 A10.0%2c10.0%2c0%2c0%2c0%2c4.339745962155613%2c-10.2' stroke='%23ddd' stroke-width='1.25' fill='rgb(48%2c 142%2c 225)' stroke-linecap='round' /%3e%3cpath d='M4.5%2c-10.2 L21.5%2c-10.2 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M8.8%2c-21.4 L17.2%2c-21.4 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},plane:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.0%2c-5.0 L4.4%2c-13.0 L24.0%2c-13.0 L21.0%2c-5.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-9.5 L13.0%2c-19.5 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M11.0%2c-17.5 L13.0%2c-19.5 L15.0%2c-17.5 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.0%2c-5.0 L4.4%2c-13.0 L24.0%2c-13.0 L21.0%2c-5.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-9.5 L13.0%2c-19.5 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M11.0%2c-17.5 L13.0%2c-19.5 L15.0%2c-17.5 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},play:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M5.0%2c-4.0 L5.0%2c-22.0 L21.0%2c-13.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M5.0%2c-4.0 L5.0%2c-22.0 L21.0%2c-13.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},rear:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},reset:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M18.0%2c-21.660254037844386 A10.0%2c10.0%2c0%2c1%2c0%2c23.0%2c-12.999999999999998' stroke='%23444' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M16.0%2c-18.196152422706632 A6.0%2c6.0%2c0%2c1%2c0%2c19.0%2c-12.999999999999998' stroke='%23444' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M17.0%2c-13.0 L21.0%2c-17.0 L25.0%2c-13.0' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M18.0%2c-21.660254037844386 A10.0%2c10.0%2c0%2c1%2c0%2c23.0%2c-12.999999999999998' stroke='%23ddd' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M16.0%2c-18.196152422706632 A6.0%2c6.0%2c0%2c1%2c0%2c19.0%2c-12.999999999999998' stroke='%23ddd' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M17.0%2c-13.0 L21.0%2c-17.0 L25.0%2c-13.0' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},resize:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='2.0' y='-24.0' width='22.0' height='22.0' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L6.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-6.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L20.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-20.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L6.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-20.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L20.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-6.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='2.0' y='-24.0' width='22.0' height='22.0' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L6.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-6.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L20.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-20.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L6.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-20.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L20.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-6.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},right:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},shape:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='rgb(83%2c160%2c227)' stroke='none' stroke-width='1.25' /%3e%3cellipse cx='12.6' cy='-8.1' rx='2.1' ry='2.1' fill='%23444' stroke='%23444' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='rgb(48%2c 142%2c 225)' stroke='none' stroke-width='1.25' /%3e%3cellipse cx='12.6' cy='-8.1' rx='2.1' ry='2.1' fill='%23ddd' stroke='%23ddd' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},shape_empty:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='%23ddd' stroke='none' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='%23666' stroke='none' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23666' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23666' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},shape_mix:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M12.6%2c-13.14 A5.04%2c5.04%2c0%2c0%2c0%2c12.599999999999998%2c-3.0599999999999996' stroke='none' stroke-width='1.25' fill='rgb(83%2c160%2c227)' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-10.2 A2.1%2c2.1%2c0%2c0%2c0%2c12.6%2c-6.0' stroke='%23444' stroke-width='1.25' fill='%23444' stroke-linecap='round' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c15.69914007006101%2c-13.236830413208175' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M15.69914007006101%2c-2.9631695867918246 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-13.7 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c12.6%2c-2.5' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M12.6%2c-13.14 A5.04%2c5.04%2c0%2c0%2c0%2c12.599999999999998%2c-3.0599999999999996' stroke='none' stroke-width='1.25' fill='rgb(48%2c 142%2c 225)' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-10.2 A2.1%2c2.1%2c0%2c0%2c0%2c12.6%2c-6.0' stroke='%23ddd' stroke-width='1.25' fill='%23ddd' stroke-linecap='round' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c15.69914007006101%2c-13.236830413208175' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M15.69914007006101%2c-2.9631695867918246 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-13.7 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c12.6%2c-2.5' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},shape_no:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},stop:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='4.0' y='-22.0' width='18.0' height='18.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='4.0' y='-22.0' width='18.0' height='18.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},top:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},axes:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-3.0 Z' fill='none' stroke='red' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-17.0 Z' fill='none' stroke='rgb(0%2c128%2c0)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L6.6%2c-24.0 Z' fill='none' stroke='blue' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-3.0 Z' fill='none' stroke='rgb(255%2c 69%2c 0)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-17.0 Z' fill='none' stroke='rgb(50%2c 205%2c 50)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L6.6%2c-24.0 Z' fill='none' stroke='rgb(59%2c 158%2c 255)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},axes0:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-3.0 Z' fill='none' stroke='red' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-17.0 Z' fill='none' stroke='rgb(0%2c128%2c0)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L6.6%2c-24.0 Z' fill='none' stroke='blue' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.6' cy='-10.0' rx='3.0' ry='3.8' fill='none' stroke='white' stroke-width='2.4' /%3e%3cellipse cx='6.6' cy='-10.0' rx='2.0' ry='3.0' fill='white' stroke='%23444' stroke-width='1.4' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-3.0 Z' fill='none' stroke='rgb(255%2c 69%2c 0)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-17.0 Z' fill='none' stroke='rgb(50%2c 205%2c 50)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L6.6%2c-24.0 Z' fill='none' stroke='rgb(59%2c 158%2c 255)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.6' cy='-10.0' rx='3.0' ry='3.8' fill='none' stroke='%23444' stroke-width='2.4' /%3e%3cellipse cx='6.6' cy='-10.0' rx='2.0' ry='3.0' fill='%23444' stroke='%23ddd' stroke-width='1.4' /%3e%3c/svg%3e"},grid:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.4%2c-2.0 L23.6%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-9.333333333333332 L23.6%2c-9.333333333333332 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-16.666666666666664 L23.6%2c-16.666666666666664 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-24.0 L23.6%2c-24.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.4 L2.0%2c-23.6 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M9.333333333333332%2c-2.4 L9.333333333333332%2c-23.6 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M16.666666666666664%2c-2.4 L16.666666666666664%2c-23.6 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M24.0%2c-2.4 L24.0%2c-23.6 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.4%2c-2.0 L23.6%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-9.333333333333332 L23.6%2c-9.333333333333332 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-16.666666666666664 L23.6%2c-16.666666666666664 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-24.0 L23.6%2c-24.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.4 L2.0%2c-23.6 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M9.333333333333332%2c-2.4 L9.333333333333332%2c-23.6 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M16.666666666666664%2c-2.4 L16.666666666666664%2c-23.6 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M24.0%2c-2.4 L24.0%2c-23.6 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},perspective:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='14.0' y='-24.0' width='10.0' height='10.0' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L14.0%2c-14.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-18.0 L24.0%2c-24.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L24.0%2c-14.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L14.0%2c-24.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.875' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='14.0' y='-24.0' width='10.0' height='10.0' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L14.0%2c-14.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-18.0 L24.0%2c-24.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L24.0%2c-14.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L14.0%2c-24.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.875' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},explode:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cellipse cx='22.5' cy='-13.0' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L20.5%2c-13.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='15.935661446562001' cy='-22.03503690480396' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L15.317627457812106%2c-20.132923872213652 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='5.3143385534380005' cy='-18.583959896778495' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L6.932372542187895%2c-17.40838939219355 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='5.314338553437999' cy='-7.416040103221507' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L6.932372542187894%2c-8.591610607806452 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='15.935661446561998' cy='-3.9649630951960404' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L15.317627457812105%2c-5.867076127786348 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='13.0' cy='-13.0' rx='2.0' ry='2.0' fill='%23444' stroke='%23444' stroke-width='1.75' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cellipse cx='22.5' cy='-13.0' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L20.5%2c-13.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='15.935661446562001' cy='-22.03503690480396' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L15.317627457812106%2c-20.132923872213652 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='5.3143385534380005' cy='-18.583959896778495' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L6.932372542187895%2c-17.40838939219355 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='5.314338553437999' cy='-7.416040103221507' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L6.932372542187894%2c-8.591610607806452 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='15.935661446561998' cy='-3.9649630951960404' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L15.317627457812105%2c-5.867076127786348 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='13.0' cy='-13.0' rx='2.0' ry='2.0' fill='%23ddd' stroke='%23ddd' stroke-width='1.75' /%3e%3c/svg%3e"},distance:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.0%2c-5.0 L2.0%2c-21.0 Z' fill='none' stroke='%23444' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M24.0%2c-5.0 L24.0%2c-21.0 Z' fill='none' stroke='%23444' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L22.0%2c-13.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L6.8%2c-16.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L6.8%2c-10.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-13.0 L19.2%2c-16.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-13.0 L19.2%2c-10.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.0%2c-5.0 L2.0%2c-21.0 Z' fill='none' stroke='%23ddd' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M24.0%2c-5.0 L24.0%2c-21.0 Z' fill='none' stroke='%23ddd' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L22.0%2c-13.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L6.8%2c-16.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L6.8%2c-10.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-13.0 L19.2%2c-16.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-13.0 L19.2%2c-10.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},properties:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M4.0%2c-21.6 L22.0%2c-21.6 Z' fill='none' stroke='%23444' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M9.2%2c-16.8 L20.8%2c-16.8 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-16.8' rx='0.8' ry='0.8' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-12.8 L20.8%2c-12.8 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-12.8' rx='0.8' ry='0.8' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-8.8 L20.8%2c-8.8 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-8.8' rx='0.8' ry='0.8' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-4.8 L20.8%2c-4.8 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-4.8' rx='0.8' ry='0.8' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M4.0%2c-21.6 L22.0%2c-21.6 Z' fill='none' stroke='%23ddd' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M9.2%2c-16.8 L20.8%2c-16.8 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-16.8' rx='0.8' ry='0.8' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-12.8 L20.8%2c-12.8 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-12.8' rx='0.8' ry='0.8' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-8.8 L20.8%2c-8.8 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-8.8' rx='0.8' ry='0.8' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-4.8 L20.8%2c-4.8 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-4.8' rx='0.8' ry='0.8' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3c/svg%3e"},angle:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.4%2c-3.84 L23.6%2c-3.84 Z' fill='none' stroke='%23444' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-3.84 L14.0%2c-22.88 Z' fill='none' stroke='%23444' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M17.80793811328415%2c-6.280377654627602 A15.6%2c15.6%2c0%2c0%2c0%2c12.217398100377466%2c-15.963476998728744' stroke='rgb(83%2c160%2c227)' stroke-width='2.0' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.4%2c-3.84 L23.6%2c-3.84 Z' fill='none' stroke='%23ddd' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-3.84 L14.0%2c-22.88 Z' fill='none' stroke='%23ddd' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M17.80793811328415%2c-6.280377654627602 A15.6%2c15.6%2c0%2c0%2c0%2c12.217398100377466%2c-15.963476998728744' stroke='rgb(48%2c 142%2c 225)' stroke-width='2.0' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},transparent:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='0.75' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='0.75' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' fill-opacity='0.75' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='0.75' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='0.75' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' fill-opacity='0.75' /%3e%3c/svg%3e"},blackedges:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='7.833333333333333' y='-23.5' width='15.666666666666666' height='15.666666666666666' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-2.5 L2.5%2c-18.166666666666664 L7.833333333333333%2c-23.5 L7.833333333333333%2c-7.833333333333333 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-2.5 L7.833333333333333%2c-7.833333333333333 L23.5%2c-7.833333333333333 L18.166666666666664%2c-2.5 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-18.166666666666664 L7.833333333333333%2c-23.5 L23.5%2c-23.5 L18.166666666666664%2c-18.166666666666664 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.166666666666664%2c-2.5 L18.166666666666664%2c-18.166666666666664 L23.5%2c-23.5 L23.5%2c-7.833333333333333 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.5' y='-18.166666666666664' width='15.666666666666666' height='15.666666666666666' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='7.833333333333333' y='-23.5' width='15.666666666666666' height='15.666666666666666' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-2.5 L2.5%2c-18.166666666666664 L7.833333333333333%2c-23.5 L7.833333333333333%2c-7.833333333333333 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-2.5 L7.833333333333333%2c-7.833333333333333 L23.5%2c-7.833333333333333 L18.166666666666664%2c-2.5 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-18.166666666666664 L7.833333333333333%2c-23.5 L23.5%2c-23.5 L18.166666666666664%2c-18.166666666666664 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.166666666666664%2c-2.5 L18.166666666666664%2c-18.166666666666664 L23.5%2c-23.5 L23.5%2c-7.833333333333333 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.5' y='-18.166666666666664' width='15.666666666666666' height='15.666666666666666' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},nav_open:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e %3cpath d='M3.204 6h9.592L8 11.481 3.204 6z' fill='%23333'/%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e %3cpath d='M3.204 6h9.592L8 11.481 3.204 6z' fill='%23ddd'/%3e%3c/svg%3e"},nav_closed:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e %3cpath d='M6 12.796V3.204L11.481 8 6 12.796z' fill='%23333'/%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e %3cpath d='M6 12.796V3.204L11.481 8 6 12.796z' fill='%23ddd'/%3e%3c/svg%3e"}};function cp(t,e){return`url("${lp[e][t]}")`}function hp(t,e){return decodeURIComponent(lp[e][t]).substring(19)}function dp(t){if(Array.isArray(t))return t.map((t=>dp(t)));if("object"==typeof t){var e={};for(var[i,n]of Object.entries(t))e[i]=dp(n);return e}return t}function up(t,e=1){return Array.isArray(t)?t.flat(e):t}function pp(t,e,i=1e-9){if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&t.every(((t,i)=>pp(t,e[i])));if("object"==typeof t&&"object"==typeof e){var n=Object.keys(t),s=Object.keys(e);return!(n.length!=s.length||!n.every((t=>Object.prototype.hasOwnProperty.call(e,t))))&&n.every((i=>pp(t[i],e[i])))}return Number(t)===t&&Number(e)===e?Math.abs(t-e)<i:t===e}function mp(t,e){t&&(e(t),t.children&&t.children.length>0&&t.children.forEach((t=>{mp(t,e)})))}function fp(t){t&&t.attributes&&(t.attributes.normal&&(t.attributes.normal.array=null),t.attributes.position&&(t.attributes.position.array=null),t.attributes.uv&&(t.attributes.uv.array=null),t.attributes.color&&(t.attributes.color.array=null),t.index&&(t.index.array=null),t.attributes.instanceStart&&(t.attributes.instanceStart.data.array=null),t.attributes.instanceEnd&&(t.attributes.instanceEnd.data.array=null),t.attributes=null)}function gp(t){if(t.shape){var e="";for(e of["edge_types","face_types","segments_per_edge","triangles","triangles_per_face"])t.shape[e]&&(t.shape[e]=null);for(e of["edges","normals","obj_vertices","vertices"])t.shape[e]&&(t.shape[e]=null)}else if(t.parts){for(var i in t.parts)gp(t.parts[i]);t.parts=null}}function vp(t){return Math.round(Math.PI*t)}const _p=new class{constructor(){this.keyMapping={shift:"shiftKey",ctrl:"ctrlKey",meta:"metaKey",alt:"altKey"}}getshortcuts=t=>this.keyMapping[t].replace("Key","");get_config(){return Object.assign({},this.keyMapping)}get=(t,e)=>t[this.keyMapping[e]];set=t=>{for(var e in t)this.keyMapping[e]=t[e]}};class yp{constructor(t,e,i,n){t.startsWith("plane")?(this.index=parseInt(t.substring(5)),this.type="plane"):(this.index=void 0,this.type=t),this.display=n,this.slider=n.container.getElementsByClassName(`tcv_sld_value_${t}`)[0],this.slider.min=e,this.slider.max=i,this.input=n.container.getElementsByClassName(`tcv_inp_value_${t}`)[0],this.input.value=i,this.slider.oninput=this.sliderChange,this.input.addEventListener("change",this.inputChange)}_notify=(t,e=!0)=>{if("plane"==this.type){const i={};i["clip_slider_"+(this.index-1)]=parseFloat(t),this.display.viewer.checkChanges(i,e)}};_handle(t,e,i){"plane"==t?this.display.refreshPlane(e,i):"ambientlight"===t?this.display.viewer.ready&&this.display.viewer.setAmbientLight(i/100):"pointlight"===t?this.display.viewer.ready&&this.display.viewer.setDirectLight(i/100):"metalness"===t?this.display.viewer.ready&&this.display.viewer.setMetalness(i/100):"roughness"===t&&this.display.viewer.ready&&this.display.viewer.setRoughness(i/100)}sliderChange=t=>{const e=t.target.value;this.input.value=Math.round(1e3*e)/1e3,this._handle(this.type,this.index,this.input.value),this._notify(e)};inputChange=t=>{const e=Math.max(Math.min(t.target.value,this.slider.max),this.slider.min);this.slider.value=e,this._handle(this.type,this.index,this.input.value),this._notify(e)};setSlider(t){const e=Math.abs(Math.round(Math.log10(2*t)));this.slider.min=-t,this.slider.max=t,this.slider.step=Math.pow(10,-(3-e)),this.slider.value=t,this.input.value=Math.round(1e3*this.slider.max)/1e3,this.display.refreshPlane(this.index,this.input.value)}getValue(){return parseFloat(this.input.value)}setValue(t,e=!0){const i=Math.max(Math.min(t,this.slider.max),this.slider.min);this.input.value=Math.round(1e3*i)/1e3,this.slider.value=t,this._handle(this.type,this.index,this.input.value),this._notify(t,e)}}class xp{constructor(t,e){this.id=e,this.container=t,this.buttons={}}addButton(t){t.setId(this.id),this.buttons[t.name]=t,this.container.appendChild(t.html)}addSeparator(){var t=document.createElement("span");t.className="tcv_separator",this.container.appendChild(t)}defineGroup(t){for(var e of t)for(var i of t)i!=e&&e.addGroupMember(i)}}class wp{constructor(t,e,i){this.svg=cp(t,e),this.name=e;var n=document.createElement("span");n.className="tcv_tooltip",n.setAttribute("data-tooltip",i);var s=n.appendChild(document.createElement("span"));s.className="tcv_button_frame",s.appendChild(document.createElement("input")),s.children[0].className="tcv_reset tcv_btn",s.children[0].type="button",s.children[0].style.backgroundImage=this.svg,this.html=n,this.html.addEventListener("click",(t=>{this.handler(t)}))}dispose(){this.html="",this.container.removeEventListener("click",this.handler)}setId(t){this.containerId=t}handler=t=>{console.log("not implemented yet")};alignRight(){this.html.classList.add("tcv_align_right")}show(t){this.html.style.display=t?"inline-block":"none"}}class bp extends wp{constructor(t,e,i,n){super(t,e,i),this.action=n}handler=t=>{this.action(this.name)};highlight=t=>{t?this.html.firstChild.classList.add("tcv_btn_highlight"):this.html.firstChild.classList.remove("tcv_btn_highlight")}}class Mp extends wp{constructor(t,e,i,n,s=!1,r=null){if(super(t,e,i),this.action=n,this.state=s,this.dropdown=r,this.sameGroup=[],this.checkElems={},null!=r){const t=document.createElement("span");for(var a of(t.classList.add("tcv_grid-content"),t.classList.add("tcv_dropdown-content"),t.classList.add("tcv_round"),r)){const e=document.createElement("div");e.className="tcv_tooltip",e.setAttribute("data-tooltip",`${i} ${a}`),e.innerHTML=`<input class='tcv_grid-${a} tcv_check tcv_dropdown-entry' id='tcv_grid-${a}_${this.containerId}' type="checkbox"><label for='tcv_grid-${a}_${this.containerId}' class="tcv_label tcv_dropdown-entry">${a}</label>`,t.appendChild(e),this.checkElems[a]=e.children[0]}this.html.children[0].appendChild(t),this.html.children[0].classList.add("tcv_grid-dropdown")}}get=()=>this.state;set=t=>{this.state=t,this.html.children[0].classList.toggle("tcv_btn_click2",this.state)};clearGroup=()=>{for(var t of this.sameGroup)t.state&&(t.state=!1,t.html.children[0].classList.remove("tcv_btn_click2"),t.action(this.name,!1))};extractIdFromName=t=>{const e="grid-",i=t.indexOf(e)+5,n=t.indexOf("_",i);return t.slice(i,n)};handler=t=>{const e=this.extractIdFromName(t.target.id);if(null!=this.dropdown&&e&&this.dropdown.includes(e)){const i=t.target.checked;this.action(`grid-${e}`,i),this.checkElems[e].checked=i}else"button"===t.target.type&&(this.state||this.clearGroup(),this.set(!this.state),this.action(this.name,this.state))};addGroupMember(t){this.sameGroup.push(t)}}const Sp=new xi,Tp=new vi;let Ep=class extends dc{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new is([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new is([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(t){const e=this.attributes.instanceStart,i=this.attributes.instanceEnd;return void 0!==e&&(e.applyMatrix4(t),i.applyMatrix4(t),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const i=new qc(e,6,1);return this.setAttribute("instanceStart",new Xs(i,3,0)),this.setAttribute("instanceEnd",new Xs(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const i=new qc(e,6,1);return this.setAttribute("instanceColorStart",new Xs(i,3,0)),this.setAttribute("instanceColorEnd",new Xs(i,3,3)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new tl(t.geometry)),this}fromLineSegments(t){const e=t.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new xi);const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;void 0!==t&&void 0!==e&&(this.boundingBox.setFromBufferAttribute(t),Sp.setFromBufferAttribute(e),this.boundingBox.union(Sp))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Bi),null===this.boundingBox&&this.computeBoundingBox();const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let n=0;for(let s=0,r=t.count;s<r;s++)Tp.fromBufferAttribute(t,s),n=Math.max(n,i.distanceToSquared(Tp)),Tp.fromBufferAttribute(e,s),n=Math.max(n,i.distanceToSquared(Tp));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}};Ch.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Ve(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},Lh.line={uniforms:Cs.merge([Ch.common,Ch.fog,Ch.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );\n\t\t\t\tvec3 worldUp = normalize( cross( worldDir, tmpFwd ) );\n\t\t\t\tvec3 worldFwd = cross( worldDir, worldUp );\n\t\t\t\tworldPos = position.y < 0.5 ? start: end;\n\n\t\t\t\t// height offset\n\t\t\t\tfloat hw = linewidth * 0.5;\n\t\t\t\tworldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// cap extension\n\t\t\t\t\tworldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;\n\n\t\t\t\t\t// add width to the box\n\t\t\t\t\tworldPos.xyz += worldFwd * hw;\n\n\t\t\t\t\t// endcaps\n\t\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\t\tworldPos.xyz -= worldFwd * 2.0 * hw;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <colorspace_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};class Ap extends Ls{constructor(t){super({type:"LineMaterial",uniforms:Cs.clone(Lh.line.uniforms),vertexShader:Lh.line.vertexShader,fragmentShader:Lh.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(t)}get color(){return this.uniforms.diffuse.value}set color(t){this.uniforms.diffuse.value=t}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(t){!0===t?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(t){this.uniforms.linewidth&&(this.uniforms.linewidth.value=t)}get dashed(){return"USE_DASH"in this.defines}set dashed(t){!0===t!==this.dashed&&(this.needsUpdate=!0),!0===t?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(t){this.uniforms.dashScale.value=t}get dashSize(){return this.uniforms.dashSize.value}set dashSize(t){this.uniforms.dashSize.value=t}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(t){this.uniforms.dashOffset.value=t}get gapSize(){return this.uniforms.gapSize.value}set gapSize(t){this.uniforms.gapSize.value=t}get opacity(){return this.uniforms.opacity.value}set opacity(t){this.uniforms&&(this.uniforms.opacity.value=t)}get resolution(){return this.uniforms.resolution.value}set resolution(t){this.uniforms.resolution.value.copy(t)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(t){this.defines&&(!0===t!==this.alphaToCoverage&&(this.needsUpdate=!0),!0===t?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const Cp=new di,Lp=new vi,kp=new vi,Rp=new di,Pp=new di,Ip=new di,Up=new vi,Dp=new Xi,Np=new ih,Op=new vi,Bp=new xi,Fp=new Bi,zp=new di;let Hp,Vp;function Gp(t,e,i){return zp.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),zp.multiplyScalar(1/zp.w),zp.x=Vp/i.width,zp.y=Vp/i.height,zp.applyMatrix4(t.projectionMatrixInverse),zp.multiplyScalar(1/zp.w),Math.abs(Math.max(zp.x,zp.y))}class jp extends bs{constructor(t=new Ep,e=new Ap({color:16777215*Math.random()})){super(t,e),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const t=this.geometry,e=t.attributes.instanceStart,i=t.attributes.instanceEnd,n=new Float32Array(2*e.count);for(let t=0,s=0,r=e.count;t<r;t++,s+=2)Lp.fromBufferAttribute(e,t),kp.fromBufferAttribute(i,t),n[s]=0===s?0:n[s-1],n[s+1]=n[s]+Lp.distanceTo(kp);const s=new qc(n,2,1);return t.setAttribute("instanceDistanceStart",new Xs(s,1,0)),t.setAttribute("instanceDistanceEnd",new Xs(s,1,1)),this}raycast(t,e){const i=this.material.worldUnits,n=t.camera;null!==n||i||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=void 0!==t.params.Line2&&t.params.Line2.threshold||0;Hp=t.ray;const r=this.matrixWorld,a=this.geometry,o=this.material;let l,c;if(Vp=o.linewidth+s,null===a.boundingSphere&&a.computeBoundingSphere(),Fp.copy(a.boundingSphere).applyMatrix4(r),i)l=.5*Vp;else{l=Gp(n,Math.max(n.near,Fp.distanceToPoint(Hp.origin)),o.resolution)}if(Fp.radius+=l,!1!==Hp.intersectsSphere(Fp)){if(null===a.boundingBox&&a.computeBoundingBox(),Bp.copy(a.boundingBox).applyMatrix4(r),i)c=.5*Vp;else{c=Gp(n,Math.max(n.near,Bp.distanceToPoint(Hp.origin)),o.resolution)}Bp.expandByScalar(c),!1!==Hp.intersectsBox(Bp)&&(i?function(t,e){const i=t.matrixWorld,n=t.geometry,s=n.attributes.instanceStart,r=n.attributes.instanceEnd;for(let a=0,o=Math.min(n.instanceCount,s.count);a<o;a++){Np.start.fromBufferAttribute(s,a),Np.end.fromBufferAttribute(r,a),Np.applyMatrix4(i);const n=new vi,o=new vi;Hp.distanceSqToSegment(Np.start,Np.end,o,n),o.distanceTo(n)<.5*Vp&&e.push({point:o,pointOnLine:n,distance:Hp.origin.distanceTo(o),object:t,face:null,faceIndex:a,uv:null,uv1:null})}}(this,e):function(t,e,i){const n=e.projectionMatrix,s=t.material.resolution,r=t.matrixWorld,a=t.geometry,o=a.attributes.instanceStart,l=a.attributes.instanceEnd,c=Math.min(a.instanceCount,o.count),h=-e.near;Hp.at(1,Ip),Ip.w=1,Ip.applyMatrix4(e.matrixWorldInverse),Ip.applyMatrix4(n),Ip.multiplyScalar(1/Ip.w),Ip.x*=s.x/2,Ip.y*=s.y/2,Ip.z=0,Up.copy(Ip),Dp.multiplyMatrices(e.matrixWorldInverse,r);for(let e=0,a=c;e<a;e++){if(Rp.fromBufferAttribute(o,e),Pp.fromBufferAttribute(l,e),Rp.w=1,Pp.w=1,Rp.applyMatrix4(Dp),Pp.applyMatrix4(Dp),Rp.z>h&&Pp.z>h)continue;if(Rp.z>h){const t=Rp.z-Pp.z,e=(Rp.z-h)/t;Rp.lerp(Pp,e)}else if(Pp.z>h){const t=Pp.z-Rp.z,e=(Pp.z-h)/t;Pp.lerp(Rp,e)}Rp.applyMatrix4(n),Pp.applyMatrix4(n),Rp.multiplyScalar(1/Rp.w),Pp.multiplyScalar(1/Pp.w),Rp.x*=s.x/2,Rp.y*=s.y/2,Pp.x*=s.x/2,Pp.y*=s.y/2,Np.start.copy(Rp),Np.start.z=0,Np.end.copy(Pp),Np.end.z=0;const a=Np.closestPointToPointParameter(Up,!0);Np.at(a,Op);const c=He.lerp(Rp.z,Pp.z,a),d=c>=-1&&c<=1,u=Up.distanceTo(Op)<.5*Vp;if(d&&u){Np.start.fromBufferAttribute(o,e),Np.end.fromBufferAttribute(l,e),Np.start.applyMatrix4(r),Np.end.applyMatrix4(r);const n=new vi,s=new vi;Hp.distanceSqToSegment(Np.start,Np.end,s,n),i.push({point:s,pointOnLine:n,distance:Hp.origin.distanceTo(s),object:t,face:null,faceIndex:e,uv:null,uv1:null})}}}(this,n,e))}}onBeforeRender(t){const e=this.material.uniforms;e&&e.resolution&&(t.getViewport(Cp),this.material.uniforms.resolution.value.set(Cp.z,Cp.w))}}const Wp={none:null,vertex:"vertex",edge:"edge",face:"face",solid:"solid"},qp=null,Xp="plane",Zp="line",Yp="circle",Jp={face:["plane","cylinder","cone","sphere","torus","bezier","bspline","revolution","extrusion","offset","other"],edge:["line","circle","ellipse","hyperbola","parabola","bezier","bspline","offset","other"]};class $p{constructor(t,e){this.obj=t,this.fromSolid=e}_getSolidObjectGroups(t){const e=t.parent.parent;let i;for(let t=0;t<e.children.length;t++){const n=e.children[t];if(n.name===e.name+"|faces"){i=n;break}}return i.children}objs(){return this.fromSolid?this._getSolidObjectGroups(this.obj):[this.obj]}}class Kp{constructor(t,e,i,n,s,r,a){this.camera=t,this.group=r,this.domElement=e,this.width=i,this.height=n,this.threshold=s,this.callback=a,this.raycaster=new Zc,this.raycastMode=!1,this.lastPosition=null,this.mouse=new Ve,this.mouseMoved=!1,this.filters={topoFilter:[Wp.none],geomFilter:[qp]}}dispose(){this.domElement.removeEventListener("mousemove",this.onPointerMove),this.domElement.removeEventListener("mouseup",this.mouseKetUp),this.domElement.removeEventListener("mousedown",this.onMouseKeyDown),this.domElement.removeEventListener("keydown",this.onKeyDown),this.raycastMode=!1,this.groups=null,this.domElement=null,this.camera=null}init(){this.domElement.addEventListener("mousemove",this.onPointerMove),this.domElement.addEventListener("mouseup",this.onMouseKeyUp,!1),this.domElement.addEventListener("mousedown",this.onMouseKeyDown,!1),this.domElement.addEventListener("keydown",this.onKeyDown,!1),this.raycastMode=!0}getIntersectedObjs(){this.raycaster.setFromCamera(this.mouse,this.camera.getCamera()),this.raycaster.params.Points.threshold=this.threshold/this.camera.getZoom(),this.raycaster.params.Line2={threshold:4};var t=this.raycaster.intersectObjects(this.group,!0),e=[];for(var i in t)t[i].object.material.visible&&e.push(t[i]);return e}getValidIntersectedObjs(){var t=[];if(this.mouseMoved){const i=this.getIntersectedObjs();for(var e of i)if(e.object.material.visible){const i=e.object.parent;if(null==i)continue;if(!i.shapeInfo)continue;const n=i.shapeInfo.topo;let s;"vertex"!==n&&(s=Jp[n][i.shapeInfo.geomtype]);const r="solid"===i.subtype;let a=this.filters.topoFilter.includes(Wp.solid)&&r||this.filters.topoFilter.includes(Wp.none)||this.filters.topoFilter.includes(n);if(!a)continue;a=this.filters.geomFilter.includes(qp)||this.filters.geomFilter.includes(s)&&!this.filters.topoFilter.includes(Wp.solid),a&&t.push(e)}}return t}onMouseKeyDown=t=>{this.raycastMode&&(t.button!=i.LEFT&&t.button!=i.RIGHT||(this.lastPosition=this.camera.getPosition().clone()))};onMouseKeyUp=t=>{this.raycastMode&&(t.button==i.LEFT?this.lastPosition.distanceTo(this.camera.getPosition())<1e-6&&this.callback({mouse:"left",shift:_p.get(t,"shift")}):t.button==i.RIGHT&&this.lastPosition.distanceTo(this.camera.getPosition())<1e-6&&this.callback({mouse:"right"}))};onKeyDown=t=>{this.raycastMode&&("Backspace"==t.key?this.callback({key:"Backspace"}):"Escape"==t.key&&this.callback({key:"Escape"}))};onPointerMove=t=>{const e=this.domElement.getBoundingClientRect(),i=e.x+window.scrollX,n=e.y+window.scrollY;this.mouse.x=(t.pageX-i)/this.width*2-1,this.mouse.y=-(t.pageY-n)/this.height*2+1,this.mouseMoved=!0}}class Qp{constructor(t){this.display=t,this.html=this._getHtml(),this.callbacks=[],this.html.addEventListener("contextmenu",(t=>{t.preventDefault()}))}_getHtml(){throw new Error("Not implemented")}_getCellValue(t){const e=this.display._getElement(t);return e?e.textContent:null}_setCellValue(t,e){const i=this.display._getElement(t);i&&(i.textContent=e)}show=t=>{this.html.style.display=t?"inline-block":"none"};isVisible=()=>"inline-block"==this.html.style.display;relocate=(t,e)=>{this.html.style.left=`${t}px`,this.html.style.top=`${e}px`};registerCallback(t,e){this.callbacks.push({callback:e,type:t}),this.html.addEventListener(t,e)}dispose(){for(var t of this.callbacks)this.html.removeEventListener(t.type,t.callback)}}class tm extends Qp{constructor(t){super(t)}_getHtml(){return this.display._getElement("tcv_distance_measurement_panel")}get total(){return this._getCellValue("tcv_total")}set total(t){this._setCellValue("tcv_total",t)}get x_distance(){return this._getCellValue("tcv_x")}set x_distance(t){this._setCellValue("tcv_x",t)}get y_distance(){return this._getCellValue("tcv_y")}set y_distance(t){this._setCellValue("tcv_y",t)}get z_distance(){return this._getCellValue("tcv_z")}set z_distance(t){this._setCellValue("tcv_z",t)}}class em extends Qp{constructor(t){super(t),this._hideAllRows()}_getHtml(){return this.display._getElement("tcv_properties_measurement_panel")}_hideAllRows(){const t=this.html.getElementsByTagName("tr");for(var e=0;e<t.length;e++){if(t[e].style.display="none",t[e].classList.contains("tcv_vertex_coords_title_row"))continue;const n=t[e].getElementsByTagName("td");for(var i=0;i<n.length;i++)n[i].textContent=""}}set subheader(t){this._setCellValue("tcv_measure_subheader",t)}get subheader(){return this._getCellValue("tcv_measure_subheader")}setProperties(t){this._hideAllRows();const e={vertex_coords:["x_value","y_value","z_value"],volume:"volume",area:"area",length:"length",width:"width",radius:"radius",radius2:"radius2",geom_type:"geom_type"};for(const i in e){const n=e[i],s=t[i];if(null!=s){if(Array.isArray(n)){this.display._getElement("tcv_vertex_coords_title_row").style.display="table-row";for(let t=0;t<n.length;t++){this.display._getElement("tcv_"+n[t]).closest("tr").style.display="table-row",this._setCellValue("tcv_"+n[t],s[t])}}else{this.display._getElement("tcv_"+n).closest("tr").style.display="table-row"}this._setCellValue("tcv_"+n,s)}}}}class im extends Qp{constructor(t){super(t)}_getHtml(){return this.display._getElement("tcv_angle_measurement_panel")}get angle(){return this._getCellValue("tcv_angle")}set angle(t){this._setCellValue("tcv_angle",t)}}class nm{constructor(t){this.display=t,this.selectElement=t._getElement("tcv_shape_filter"),this.dropdownElement=t._getElement("tcv_filter_dropdown"),this.arrowElement=t._getElement("tcv_filter_icon"),this.options=["none","vertex","edge","face","solid"],this.selectElement.style.display="none",this.raycaster=null}setRaycaster(t){this.raycaster=t}_setValue=t=>{null!=this.raycaster&&(this.display._getElement("tcv_filter_value").innerText=t,this.raycaster.filters.topoFilter="none"==t?[Wp.none]:[Wp[t.toLowerCase()]])};_toggleDropdown=t=>{null!=t&&t.stopPropagation(),this.dropdownElement.classList.contains("tcv_filter_dropdown_active")?(this.dropdownElement.classList.remove("tcv_filter_dropdown_active"),this.arrowElement.innerText="⏶"):(this.dropdownElement.classList.add("tcv_filter_dropdown_active"),this.arrowElement.innerText="⏷")};_closeDropdown=t=>{this.dropdownElement.classList.contains("tcv_filter_dropdown_active")&&this._toggleDropdown(t)};handleSelection=t=>{const e=t.target.innerText;this._setValue(e),this._toggleDropdown(t)};reset=()=>{this._setValue("None")};_keybindSelect=t=>{-1!==["n","v","e","f","s","Escape"].indexOf(t.key)&&("n"==t.key?this._setValue("None"):"v"==t.key?this._setValue("Vertex"):"e"==t.key?this._setValue("Edge"):"f"==t.key?this._setValue("Face"):"s"==t.key?this._setValue("Solid"):"Escape"==t.key&&this._closeDropdown())};show(t){if(t){this.display.container.addEventListener("keydown",this._keybindSelect),this.display.container.addEventListener("click",this._closeDropdown);let t=this.display._getElement("tcv_filter_content");t.addEventListener("click",this._toggleDropdown);for(const e of this.options)t=this.display._getElement(`tvc_filter_${e}`),t.addEventListener("click",this.handleSelection)}else{this.display.container.removeEventListener("keydown",this._keybindSelect),this.display.container.removeEventListener("click",this._closeDropdown);let t=this.display._getElement("tcv_filter_content");t.removeEventListener("click",this._toggleDropdown);for(const e of this.options)t=this.display._getElement(`tvc_filter_${e}`),t.removeEventListener("click",this.handleSelection)}this.selectElement.style.display=t?"block":"none"}}class sm extends Fs{constructor(t,e,i,n,s,r=!0,a=!0){super(),this.coneLength=t,this.point1=e,this.point2=i,this.linewidth=n,this.color=s,this.arrowStart=r,this.arrowEnd=a,this.type="DistanceLineArrow",this.lineVec=void 0,this.initialize()}initialize(){const t=this.coneLength;let e,i;this.lineVec=this.point1.clone().sub(this.point2.clone()).normalize(),e=this.arrowStart?this.point1.clone().sub(this.lineVec.clone().multiplyScalar(t/2)):this.point1.clone(),i=this.arrowEnd?this.point2.clone().sub(this.lineVec.clone().multiplyScalar(-t/2)):this.point2.clone();const n=new Ap({linewidth:this.linewidth,color:this.color}),s=new Ep;s.setPositions([...e.toArray(),...i.toArray()]);const r=new jp(s,n),a=new so(t/4,t,10),o=new jn({color:this.color}),l=new bs(a,o),c=new bs(a,o);l.name="startCone",c.name="endCone";const h=new Xi,d=new gi;h.lookAt(this.point1,this.point2,l.up),d.setFromRotationMatrix(h),l.setRotationFromQuaternion(d),h.lookAt(this.point2,this.point1,c.up),d.setFromRotationMatrix(h),c.setRotationFromQuaternion(d),l.rotateX(90*Math.PI/180),c.rotateX(90*Math.PI/180),l.position.copy(e),c.position.copy(i),this.arrowStart&&this.add(l),this.arrowEnd&&this.add(c),this.add(r)}dispose(){this.children.forEach((t=>{t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()}))}update(t){const e=this.point1.clone().sub(this.lineVec.clone().multiplyScalar(t*this.coneLength/2)),i=this.point2.clone().sub(this.lineVec.clone().multiplyScalar(-t*this.coneLength/2));if(this.children.find((t=>"LineSegments2"==t.type)).geometry.setPositions([...this.arrowStart?e.toArray():this.point1,...this.arrowEnd?i.toArray():this.point2]),this.arrowStart){const i=this.children.find((t=>"Mesh"==t.type&&"startCone"==t.name));i.position.copy(e),i.scale.set(t,t,t)}if(this.arrowEnd){const e=this.children.find((t=>"Mesh"==t.type&&"endCone"==t.name));e.position.copy(i),e.scale.set(t,t,t)}}}class rm{constructor(t,e){this.selectedShapes=[],this.point1=null,this.point2=null,this.contextEnabled=!1,this.viewer=t,this.scene=new js,this.panel=e,this.panelCenter=null,this.panelX=null,this.panelY=null,this.panelShown=!1,this.responseData=null,this.measurementLineColor=0,this.connectingLineColor=8388736,this.coneLength=void 0,this.panelDragData={x:null,y:null,clicked:!1},this.panel.registerCallback("mousedown",(t=>{this.panelDragData.clicked=!0,this.panelDragData.x=t.clientX,this.panelDragData.y=t.clientY,t.stopPropagation()})),document.addEventListener("mouseup",this._mouseup),document.addEventListener("mousemove",this._dragPanel)}enableContext(){this.contextEnabled=!0,this.panelCenter=new vi(1,0,0)}disableContext(){this.contextEnabled=!1,this.selectedShapes=[],this._hideMeasurement(),this.viewer.checkChanges({selectedShapeIDs:[]})}_hideMeasurement(){this.responseData=null,this.panel.show(!1),this.scene.clear()}handleResponse(t){this.viewer.info.addHtml(t.center_info)}_setMeasurementVals(){throw new Error("Subclass needs to override this method")}_makeLines(){throw new Error("Subclass needs to override this method")}_getMaxObjSelected(){throw new Error("Subclass needs to override this method")}_waitResponse(t,e){this.responseData?t(this.responseData):setTimeout((()=>{this._waitResponse(t,e)}),100)}_updateMeasurement(){const t=this.selectedShapes.map((t=>{if(t.fromSolid){return t.obj.name.replace(/\|faces.*$/,"").replace(/\|edges.*$/,"").replace(/\|vertices.*$/,"").replaceAll("|","/")}return t.obj.name.replaceAll("|","/")}));if(this.viewer.checkChanges({selectedShapeIDs:[...t]}),this.selectedShapes.length==this._getMaxObjSelected()){new Promise(((t,e)=>{this._waitResponse(t,e)})).then((t=>{this._setMeasurementVals(),this._makeLines(),this.panel.show(!0),this._movePanel()}))}else this._hideMeasurement()}handleSelection=t=>{this._hideMeasurement(),void 0!==this.selectedShapes.find((e=>e.obj.name===t.obj.name))?this.selectedShapes.splice(this.selectedShapes.indexOf(t),1):this.selectedShapes.push(t),this._updateMeasurement()};_mouseup=t=>{this.panelDragData.clicked=!1,t.stopPropagation()};_movePanel=()=>{if(!this.panel.isVisible())return;const t=this.viewer.renderer.domElement.getBoundingClientRect(),e=this.panel.html.getBoundingClientRect();null==this.panelX&&(this.panelX=t.width-e.width-2,this.panelY=t.height-e.height-2),this.panel.relocate(this.panelX,this.panelY);const i=this.panelX+e.width/2,n=this.panelY+e.height/2,s=i/(t.width/2)-1,r=1-n/(t.height/2),a=this.viewer.ortho?-.9:1;var o=new vi(s,r,a);const l=this.viewer.camera.getCamera();l.updateProjectionMatrix(),l.updateMatrixWorld(),this.panelCenter=o.unproject(l),this.scene.clear(),this._makeLines()};_dragPanel=t=>{if(!this.panelDragData.clicked)return;const e=this.panel.html.getBoundingClientRect(),i=this.viewer.renderer.domElement.getBoundingClientRect();let n=t.clientX-this.panelDragData.x,s=t.clientY-this.panelDragData.y;e.x+n<i.x&&t.movementX<=0||e.x+n>i.x+i.width-e.width&&t.movementX>=0||(this.panelX+=n),e.y+s<i.y&&t.movementY<=0||e.y+s>i.y+i.height-e.height&&t.movementY>=0||(this.panelY+=s),this.scene.clear(),this._updateMeasurement(),this.panelDragData.x=t.clientX,this.panelDragData.y=t.clientY};removeLastSelectedObj(t=!1){if(t||this.selectedShapes.length==this._getMaxObjSelected()){const t=this.selectedShapes.pop();if(t){let e=t.objs();for(let t of e)t.clearHighlights()}this._updateMeasurement()}}_adjustArrowsScaleFactor(t){const e=1/t;for(let t of this.scene.children)t.update(e)}update(){const t=this.viewer.camera.getCamera(),e=this.viewer.camera.getZoom();this.coneLength=this.viewer.bb_radius/(Math.max(this.viewer.cadWidth,this.viewer.height)/60),this._adjustArrowsScaleFactor(e),this.viewer.renderer.clearDepth(),this.viewer.renderer.render(this.scene,t),this._movePanel()}dispose(){for(var t in document.removeEventListener("mouseup",this._mouseup),document.removeEventListener("mousemove",this._dragPanel),this.scene.children)this.scene.children[t].dispose(),this.scene.children[t]=null;this.panel.dispose(),this.panel=null,this.viewer=null,this.scene=null}}class am extends rm{constructor(t){super(t,new tm(t.display)),this.point1=null,this.point2=null}_setMeasurementVals(){this._getPoints();const t=this.responseData.distance,e=this.point2.clone().sub(this.point1),i=Math.abs(e.x),n=Math.abs(e.y),s=Math.abs(e.z);this.panel.total=t.toFixed(3),this.panel.x_distance=i.toFixed(3),this.panel.y_distance=n.toFixed(3),this.panel.z_distance=s.toFixed(3)}_getMaxObjSelected(){return 2}_getPoints(){this.point1=new vi(...this.responseData.point1),this.point2=new vi(...this.responseData.point2)}_makeLines(){const t=new sm(this.coneLength,this.point1,this.point2,3,this.measurementLineColor);this.scene.add(t);const e=(new vi).addVectors(this.point1,this.point2).multiplyScalar(.5),i=new sm(this.coneLength,this.panelCenter,e,1.5,this.connectingLineColor,!1,!1);this.scene.add(i)}handleResponse(t){super.handleResponse(t);const e={distance:t.distance,point1:new vi(...t.point1),point2:new vi(...t.point2)};this.responseData=e}}class om extends rm{constructor(t){super(t,new em(t.display))}_setMeasurementVals(){const t=this.selectedShapes[0].obj,e=t.name.match(/.*\|.*vertices/),i=t.name.match(/.*\|.*edges/),n=t.name.match(/.*\|.*faces/),s=this.selectedShapes[0].fromSolid?"Solid":e?"Vertex":i?"Edge":n?"Face":"Unknown";this.panel.subheader=s;const r=this.responseData;this.panel.setProperties(r)}_getMaxObjSelected(){return 1}_makeLines(){const t=this.responseData.center,e=new sm(this.coneLength,this.panelCenter,t,1.5,this.connectingLineColor,!1,!1);this.scene.add(e)}handleResponse(t){super.handleResponse(t);let e={...t};e.center=new vi(...t.center),this.responseData=e}}class lm extends rm{constructor(t){super(t,new im(t.display))}_setMeasurementVals(){let t;t=this.responseData.angle.toFixed(2)+" °",this.panel.angle=t}enableContext(){super.enableContext(),this.viewer.raycaster.filters.geomFilter=[Zp,Xp,Yp],this.viewer.info.addHtml("When in angle measurement<br>context you cannot pick :<br>- Non planar faces<br>- Curved edges<br>- Solids")}disableContext(){super.disableContext(),this.viewer.raycaster.filters.geomFilter=[qp]}_getMaxObjSelected(){return 2}_getPoints(){this.point1=new vi(...this.responseData.point1),this.point2=new vi(...this.responseData.point2)}_makeLines(){this._getPoints();const t=new sm(this.coneLength,this.point1,this.panelCenter,1.5,this.connectingLineColor,!1,!1),e=new sm(this.coneLength,this.point2,this.panelCenter,1.5,this.connectingLineColor,!1,!1);this.scene.add(t),this.scene.add(e)}handleResponse(t){super.handleResponse(t);const e={angle:t.angle,point1:new vi(...t.point1),point2:new vi(...t.point2)};this.responseData=e}}const cm="None",hm="DistanceMeasurement",dm="PropertiesMeasurement",um="AngleMeasurement";class pm{constructor(t){this.viewer=t,this.distanceMeasurement=new am(t),this.propertiesMeasurement=new om(t),this.angleMeasurement=new lm(t),this.enabledTool=null}enable(t){switch(this.disable(),t){case hm:this.distanceMeasurement.enableContext();break;case dm:this.propertiesMeasurement.enableContext();break;case um:this.angleMeasurement.enableContext();break;default:throw new Error(`Unknown tool type: ${t}`)}this.enabledTool=t}disable(){this.enabledTool&&(this.viewer.display.shapeFilterDropDownMenu.reset(),this._disable())}_disable(){if(this.enabledTool){switch(this.enabledTool){case hm:this.distanceMeasurement.disableContext();break;case dm:this.propertiesMeasurement.disableContext();break;case um:this.angleMeasurement.disableContext();break;default:throw new Error(`Unknown tool type: ${this.enabledTool}`)}this.enabledTool=null}}handleRemoveLastSelection(t=!1){this.distanceMeasurement.contextEnabled?this.distanceMeasurement.removeLastSelectedObj(t):this.propertiesMeasurement.contextEnabled?this.propertiesMeasurement.removeLastSelectedObj(t):this.angleMeasurement.contextEnabled&&this.angleMeasurement.removeLastSelectedObj(t)}handleSelectedObj(t){this.distanceMeasurement.contextEnabled?this.distanceMeasurement.handleSelection(t):this.propertiesMeasurement.contextEnabled?this.propertiesMeasurement.handleSelection(t):this.angleMeasurement.contextEnabled&&this.angleMeasurement.handleSelection(t)}handleRemoveLastSelected(){this.distanceMeasurement.contextEnabled?this.distanceMeasurement.removeLastSelectedObj():this.propertiesMeasurement.contextEnabled?this.propertiesMeasurement.removeLastSelectedObj():this.angleMeasurement.contextEnabled&&this.angleMeasurement.removeLastSelectedObj()}handleResetSelection(){this.distanceMeasurement.contextEnabled?(this.distanceMeasurement.removeLastSelectedObj(!0),this.distanceMeasurement.removeLastSelectedObj(!0)):this.propertiesMeasurement.contextEnabled?this.propertiesMeasurement.removeLastSelectedObj(!0):this.angleMeasurement.contextEnabled&&(this.angleMeasurement.removeLastSelectedObj(!0),this.angleMeasurement.removeLastSelectedObj(!0))}handleResponse(t){console.log(t);switch(t.tool_type){case hm:this.distanceMeasurement.handleResponse(t);break;case dm:this.propertiesMeasurement.handleResponse(t);break;case um:this.angleMeasurement.handleResponse(t)}}update(){this.distanceMeasurement.contextEnabled?this.distanceMeasurement.update():this.propertiesMeasurement.contextEnabled?this.propertiesMeasurement.update():this.angleMeasurement.contextEnabled&&this.angleMeasurement.update()}dispose(){this.distanceMeasurement.dispose(),this.angleMeasurement.dispose(),this.propertiesMeasurement.dispose()}}function mm(t){return`${t}px`}const fm=["plane","play","pause","stop"];class gm extends Ep{toJSON(){return dc.prototype.toJSON.call(this)}}const vm=new vi,_m=new vi,ym=new Ge;class xm extends xa{constructor(t,e=1,i=16711680){const n=new hs,s=t.geometry.attributes.normal.count,r=new is(2*s*3,3);n.setAttribute("position",r),super(n,new la({color:i,toneMapped:!1})),this.object=t,this.size=e,this.type="VertexNormalsHelper",this.matrixAutoUpdate=!1,this.isVertexNormalsHelper=!0,this.update()}update(){this.object.updateMatrixWorld(!0),ym.getNormalMatrix(this.object.matrixWorld);const t=this.object.matrixWorld,e=this.geometry.attributes.position,i=this.object.geometry;if(i){const n=i.attributes.position,s=i.attributes.normal;let r=0;for(let i=0,a=n.count;i<a;i++)vm.fromBufferAttribute(n,i).applyMatrix4(t),_m.fromBufferAttribute(s,i),_m.applyMatrix3(ym).normalize().multiplyScalar(this.size).add(vm),e.setXYZ(r,vm.x,vm.y,vm.z),r+=1,e.setXYZ(r,_m.x,_m.y,_m.z),r+=1}e.needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}class wm extends xi{expandByObject(t,e=!1){if(t.updateWorldMatrix(!1,!1),"ObjectGroup"==t.constructor.name)return this.expandByObject(t.children[0],e),this;const i=t.geometry;if(void 0!==i)if(e&&null!=i.attributes&&void 0!==i.attributes.position)if(t.type.startsWith("LineSegment")){var n=i.clone();n.applyMatrix4(t.matrixWorld),n.boundingBox=null,n.computeBoundingBox(),Sm.copy(n.boundingBox),this.union(Sm)}else{const e=i.attributes.position;for(let i=0,n=e.count;i<n;i++)Mm.fromBufferAttribute(e,i).applyMatrix4(t.matrixWorld),this.expandByPoint(Mm)}else null===i.boundingBox&&i.computeBoundingBox(),Sm.copy(i.boundingBox),Sm.applyMatrix4(t.matrixWorld),this.union(Sm);const s=t.children;for(let t=0,i=s.length;t<i;t++)this.expandByObject(s[t],e);return this}max_dist_from_center(){return Math.max(...this.min.toArray().concat(this.max.toArray()).map((t=>Math.abs(t))))}boundingSphere(){return this.getBoundingSphere(Em),Em}center(){return this.getCenter(Mm),Mm.toArray()}}class bm extends xa{constructor(t,e=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),s=new hs;s.setIndex(new Qn(i,1)),s.setAttribute("position",new Qn(n,3)),super(s,new la({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(void 0!==this.object&&Tm.setFromObject(this.object,!0),Tm.isEmpty())return;const t=Tm.min,e=Tm.max,i=this.geometry.attributes.position,n=i.array;n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=t.x,n[4]=e.y,n[5]=e.z,n[6]=t.x,n[7]=t.y,n[8]=e.z,n[9]=e.x,n[10]=t.y,n[11]=e.z,n[12]=e.x,n[13]=e.y,n[14]=t.z,n[15]=t.x,n[16]=e.y,n[17]=t.z,n[18]=t.x,n[19]=t.y,n[20]=t.z,n[21]=e.x,n[22]=t.y,n[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}dispose(){fp(this.geometry),this.geometry=null}}const Mm=new vi,Sm=new wm,Tm=new wm,Em=new Bi;class Am extends Fs{constructor(t,e,i,n,s,r){super(),this.opacity=t,this.alpha=null==e?1:e,this.edge_color=i,this.shapeInfo=n,this.subtype=s,this.renderback=r,this.types={front:null,back:null,edges:null,vertices:null},this.isSelected=!1,this.originalColor=null,this.originalBackColor=null,this.originalWidth=null,this.vertexFocusSize=8,this.edgeFocusWidth=5}dispose(){for(var t in this.types.front||this.types.back?this.types.front.dispose():this.types.edges?this.types.edges.dispose():this.type.vertices&&this.types.vertices.dispose(),this.shapeGeometry&&(fp(this.shapeGeometry),this.shapeGeometry=null),[0,1,2]){var e=this.types[`clipping-${t}`];if(e)for(var i in e.children)e.children[i].dispose()}if(this.children)for(var t in this.children)this.children[t]instanceof Aa?fp(this.children[t]):this.children[t].dispose();this.parent=null}addType(t,e){this.add(t),this.types[e]=t,this.types.vertices?(this.originalColor=this.types.vertices.material.color.clone(),this.originalWidth=this.types.vertices.material.size):this.types.edges&&!this.types.front?(this.originalColor=this.types.edges.material.color.clone(),this.originalWidth=this.types.edges.material.linewidth):this.types.front?this.originalColor=this.types.front.material.color.clone():this.types.back&&(this.originalBackColor=this.types.back.material.color.clone())}widen(t){this.types.vertices?this.types.vertices.material.size=t?this.vertexFocusSize:this.isSelected?this.vertexFocusSize-2:this.originalWidth:this.types.edges&&(this.types.edges.material.linewidth=t?this.edgeFocusWidth:this.isSelected?this.edgeFocusWidth-2:this.originalWidth)}toggleSelection(){const t=!this.isSelected;this.isSelected=t,this.highlight(t),this.widen(!1)}unhighlight(t){t&&this.isSelected||(this.isSelected=!1,this.highlight(!1)),this.widen(!1)}highlight(t){var e=null,i=null,n=null;this.types.front?(e=this.types.front,i=this.isSelected?new zn(5480675):new zn(9026019),n=this.originalColor):this.types.vertices?(e=this.types.vertices,i=this.isSelected?new zn(5480675):new zn(9026019),n=this.originalColor):this.types.edges&&(e=this.types.edges,i=this.isSelected?new zn(5480675):new zn(9026019),n=this.originalColor),null!=e&&(this.widen(t),e.material.color=t?i:n,e.material.needsUpdate=!0),this.types.back&&(e=this.types.back,i=this.isSelected?new zn(5480675):new zn(9026019),n=this.originalBackColor),null!=e&&(e.material.color=t?i:n,e.material.needsUpdate=!0)}clearHighlights(){this.highlight(!1),this.isSelected=!1,this.widen(!1)}metrics(){return this.types.front?{name:"face",value:0}:this.types.vertices?{name:"vertex",value:0}:this.types.edges?{name:"edge",value:0}:void 0}setMetalness(t){for(var e of this.children)e.name.startsWith("clipping")||(e.material.metalness=t,e.material.needsUpdate=!0)}setRoughness(t){for(var e of this.children)e.name.startsWith("clipping")||(e.material.roughness=t,e.material.needsUpdate=!0)}setTransparent(t){for(var e of(this.types.back&&(this.types.back.material.opacity=t?this.opacity*this.alpha:this.alpha,this.types.front.material.opacity=t?this.opacity*this.alpha:this.alpha),this.children))e.name.startsWith("clipping")||(e.material.depthWrite=!(this.alpha<1)&&!t,e.material.depthTest=!0,e.material.needsUpdate=!0)}setBlackEdges(t){if(this.types.edges){const e=t?0:this.edge_color;this.originalColor=new zn(e),this.types.edges.material.color=new zn(e),this.types.edges.material.needsUpdate=!0}}setEdgeColor(t){this.types.edges&&(this.edge_color=t,this.types.edges.material.color=new zn(t),this.types.edges.material.needsUpdate=!0)}setOpacity(t){(this.types.front||this.types.back)&&(this.opacity=t,this.types.back.material.opacity=this.opacity,this.types.front.material.opacity=this.opacity,this.types.back.material.needsUpdate=!0,this.types.front.material.needsUpdate=!0)}setShapeVisible(t){for(var e of(this.types.front&&(this.types.front.material.visible=t),["clipping-0","clipping-1","clipping-2"]))this.types[e]&&(this.types[e].children[0].material.visible=t,this.types[e].children[1].material.visible=t);this.types.back&&this.renderback&&(this.types.back.material.visible=t)}setEdgesVisible(t){this.types.edges&&(this.types.edges.material.visible=t),this.types.vertices&&(this.types.vertices.material.visible=t)}setBackVisible(t){this.types.back&&this.types.front.material.visible&&(this.types.back.material.visible=this.renderback||t)}setClipIntersection(t){for(var e of this.children)e.name.startsWith("clipping")||(e.material.clipIntersection=t,e.material.clipIntersection=t,e.material.clipIntersection=t)}setClipPlanes(t){this.types.back&&(this.types.back.material.clippingPlanes=t),this.types.front&&(this.types.front.material.clippingPlanes=t),this.types.edges&&(this.types.edges.material.clippingPlanes=t),this.types.vertices&&(this.types.vertices.material.clippingPlanes=t),this.updateMaterials(!0)}setPolygonOffset(t){this.types.back&&(this.types.back.material.polygonOffsetUnits=t)}updateMaterials(t){this.types.back&&(this.types.back.material.needsUpdate=t),this.types.front&&(this.types.front.material.needsUpdate=t),this.types.edges&&(this.types.edges.material.needsUpdate=t),this.types.vertices&&(this.types.vertices.material.needsUpdate=t)}}class Cm extends Fs{constructor(){super()}dispose(){for(var t in this.children)this.children[t]&&this.children[t].dispose(),this.children[t]instanceof dh&&(fp(this.children[t].geometry),this.children[t].dispose(),this.children[t]=null);this.parent=null}}class Lm{constructor(t,e,i,n,s,r,a,o,l,c){this.shapes=t,this.width=e,this.height=i,this.edgeColor=n,this.transparent=s,this.metalness=a,this.roughness=o,this.defaultOpacity=r,this.normalLen=l,this.blackEdges=!1,this.backVisible=!1,this.bb_max=c,this.delim="|",this.rootGroup=null,this.bbox=null,this.bsphere=null,this.groups={},this.clipPlanes=null}dispose(){if(this.groups){for(var t in this.groups)this.groups[t].dispose();this.groups=null}this.rootGroup&&(this.rootGroup.dispose(),this.rootGroup=null),this.shapes&&(gp(this.shapes),this.shapes=null)}_dump(t){if(null==t&&(t=""),this.parts)for(var e of this.parts)this._dump(e,t+" ")}_renderEdges(t,e,i,n){var s=t instanceof Float32Array?t:new Float32Array(up(t,3));const r=new gm;r.setPositions(s);const a=new Ap({linewidth:e,transparent:!0,depthWrite:!this.transparent,depthTest:!this.transparent,clipIntersection:!1});if(Array.isArray(i)){var o=i.map((t=>[new zn(t).toArray(),new zn(t).toArray()])).flat(2);r.setColors(o),a.vertexColors="VertexColors"}else a.color=new zn(null==i?this.edgeColor:i);a.visible=1==n,a.resolution.set(this.width,this.height);var l=new jp(r,a);return l.renderOrder=999,l}renderEdges(t,e,i,n,s,r,a=null){var o=new Am(this.defaultOpacity,1,null==i?this.edgeColor:i,a,"edges"),l=this._renderEdges(t.edges?t.edges:up(t),e,i,r);return s&&(l.name=s),o.addType(l,"edges"),this.groups[n]=o,o.name=n.replaceAll("/",this.delim),o}renderVertices(t,e,i,n,s,r,a=null){var o=new Am(this.defaultOpacity,1,null==i?this.edgeColor:i,a,"vertices");const l=null==i?this.edgeColor:i;let c;c=t.obj_vertices?t.obj_vertices instanceof Float32Array?t.obj_vertices:new Float32Array(t.obj_vertices):t instanceof Float32Array?t:new Float32Array(up(t));const h=new hs;h.setAttribute("position",new is(c,3));const d=new ba({color:l,sizeAttenuation:!1,size:e,transparent:!0,clipIntersection:!1,visible:1==r});var u=new Aa(h,d);return s&&(u.name=s),o.addType(u,"vertices"),this.groups[n]=o,o.name=n.replaceAll("/",this.delim),o}renderShape(t,e,i,n,s,r,a,o,l=null,c=null,h=null,d=null,u=null){const p=t.vertices instanceof Float32Array?t.vertices:new Float32Array(up(t.vertices)),m=t.normals instanceof Float32Array?t.normals:new Float32Array(up(t.normals)),f=t.triangles instanceof Uint32Array?t.triangles:new Uint32Array(up(t.triangles));var g,v=new Am(this.defaultOpacity,i,this.edgeColor,l,c,n);this.groups[r]=v,v.name=r.replaceAll("/",this.delim),null==i?i=1:i<1&&(this.transparent=!0);var _=null,y=null;if(null!=h){const t=`data:image/${h.format};base64,${h.data}`;var x=new Image;x.setAttribute("src",t),g=new qo(d,u),(_=new hi(x)).needsUpdate=!0,_.colorSpace=ce,y=new jn({color:"#ffffff",map:_,side:2}),n=!1}else(g=new hs).setAttribute("position",new Qn(p,3)),g.setAttribute("normal",new Qn(m,3)),g.setIndex(new Qn(f,1)),v.shapeGeometry=g,y=new rl({color:e,metalness:this.metalness,roughness:this.roughness,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,transparent:!0,opacity:this.transparent?this.defaultOpacity*i:i,depthWrite:!this.transparent,depthTest:!0,clipIntersection:!1,side:0,visible:1==o[0],map:_,name:"frontMaterial"});const w="solid"!==v.subtype||s?new zn(this.edgeColor).lerp(new zn(1,1,1),.15):e,b=new jn({color:w,side:1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,transparent:!0,opacity:this.transparent?this.defaultOpacity*i:i,depthWrite:!this.transparent,depthTest:!0,clipIntersection:!1,visible:1==o[0]&&(n||this.backVisible),name:"backMaterial"}),M=new bs(g,b);M.name=a;const S=new bs(g,y);if(S.name=a,i<1&&(M.renderOrder=999,S.renderOrder=999),v.addType(M,"back"),v.addType(S,"front"),this.normalLen>0){const t=new xm(S,this.normalLen,16711935);v.add(t)}const T=t.edges;if(T.length>0){var E=this._renderEdges(T,1,null,o[1]);E.name=a,v.addType(E,"edges")}return v}renderLoop(t){const e=(t,e,i,n)=>{var s;switch(t.type){case"edges":s=this.renderEdges(t.shape,t.width,t.color,t.id,t.name,t.state[1],{topo:"edge",geomtype:t.geomtype});break;case"vertices":s=this.renderVertices(t.shape,t.size,t.color,t.id,t.name,t.state[1],{topo:"vertex",geomtype:null});break;default:s=this.renderShape(t.shape,t.color,t.alpha,null!=t.renderback&&t.renderback,t.exploded,t.id,t.name,t.state,{topo:"face",geomtype:t.geomtype},t.subtype,e,i,n)}return null!=t.loc&&(s.position.set(...t.loc[0]),s.quaternion.set(...t.loc[1])),s};var i=new Cm;for(var n of(null==t.loc&&(t.loc=[[0,0,0],[0,0,0,1]]),i.position.set(...t.loc[0]),i.quaternion.set(...t.loc[1]),this.groups[t.id]=i,i.name=t.id.replaceAll("/","|"),t.parts))if(n.parts)i.add(this.renderLoop(n));else{const t=null!=n.texture;const s=e(n,t?n.texture.image:null,t?n.texture.width:null,t?n.texture.height:null);this.groups[n.id]=s,i.add(s)}return i}render(){return this.rootGroup=this.renderLoop(this.shapes),this.rootGroup}boundingBox(){return null==this.bbox&&(this.bbox=new wm,this.bbox.setFromObject(this.rootGroup,!0)),this.bbox}_traverse(t,e){for(var i in this.groups){var n=this.groups[i];n instanceof Am&&n[t](e)}}selection(){var t=[];for(var e in this.groups)for(var i of this.groups[e].children)i instanceof Am&&i.isSelected&&t.push(i);return t}clearSelection(){for(var t of this.selection())t.clearHighlights()}setMetalness(t){this.metalness=t,this._traverse("setMetalness",t)}setRoughness(t){this.roughness=t,this._traverse("setRoughness",t)}setTransparent(t){this.transparent=t,this._traverse("setTransparent",t)}setBlackEdges(t){this.blackEdges=t,this._traverse("setBlackEdges",t)}setBackVisible(t){this.backVisible=t,this._traverse("setBackVisible",t)}setEdgeColor(t){this.edge_color=t,this._traverse("setEdgeColor",t)}setOpacity(t){this.opacity=t,this._traverse("setOpacity",t)}setClipIntersection(t){this._traverse("setClipIntersection",t)}setClipPlanes(t){this.clipPlanes=t,this._traverse("setClipPlanes",t)}setPolygonOffset(t){this._traverse("setPolygonOffset",t)}updateMaterials(){this._traverse("updateMaterials",!0)}}class km{constructor(t){this.isFont=!0,this.type="Font",this.data=t}generateShapes(t,e=100){const i=[],n=function(t,e,i){const n=Array.from(t),s=e/i.resolution,r=(i.boundingBox.yMax-i.boundingBox.yMin+i.underlineThickness)*s,a=[];let o=0,l=0;for(let t=0;t<n.length;t++){const e=n[t];if("\n"===e)o=0,l-=r;else{const t=Rm(e,s,o,l,i);o+=t.offsetX,a.push(t.path)}}return a}(t,e,this.data);for(let t=0,e=n.length;t<e;t++)i.push(...n[t].toShapes());return i}}function Rm(t,e,i,n,s){const r=s.glyphs[t]||s.glyphs["?"];if(!r)return void console.error(`THREE.Font: character "${t}" does not exists in font family ${s.familyName}`);const a=new bh;let o,l,c,h,d,u,p,m;if(r.o){const t=r._cachedOutline||(r._cachedOutline=r.o.split(" "));for(let s=0,r=t.length;s<r;){switch(t[s++]){case"m":o=t[s++]*e+i,l=t[s++]*e+n,a.moveTo(o,l);break;case"l":o=t[s++]*e+i,l=t[s++]*e+n,a.lineTo(o,l);break;case"q":c=t[s++]*e+i,h=t[s++]*e+n,d=t[s++]*e+i,u=t[s++]*e+n,a.quadraticCurveTo(d,u,c,h);break;case"b":c=t[s++]*e+i,h=t[s++]*e+n,d=t[s++]*e+i,u=t[s++]*e+n,p=t[s++]*e+i,m=t[s++]*e+n,a.bezierCurveTo(d,u,p,m,c,h)}}}return{offsetX:r.ha*e,path:a}}const Pm={glyphs:{X:{x_min:-.015625,x_max:854.15625,ha:940,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},Y:{x_min:0,x_max:820,ha:886,o:"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},Z:{x_min:0,x_max:779,ha:849,o:"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},0:{x_min:73,x_max:715,ha:792,o:"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},1:{x_min:215.671875,x_max:574,ha:792,o:"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},2:{x_min:59,x_max:731,ha:792,o:"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},3:{x_min:54,x_max:737,ha:792,o:"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},4:{x_min:48,x_max:742.453125,ha:792,o:"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},5:{x_min:54.171875,x_max:738,ha:792,o:"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},6:{x_min:53,x_max:739,ha:792,o:"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},7:{x_min:58.71875,x_max:730.953125,ha:792,o:"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},8:{x_min:55,x_max:736,ha:792,o:"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},9:{x_min:53,x_max:739,ha:792,o:"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},"-":{x_min:8.71875,x_max:350.390625,ha:478,o:"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "}},cssFontWeight:"normal",ascender:1189,underlinePosition:-100,cssFontStyle:"normal",boundingBox:{yMin:-334,xMin:-111,yMax:1189,xMax:1672},resolution:1e3,original_font_information:"see https://github.com/mrdoob/three.js/blob/dev/examples/fonts/helvetiker_regular.typeface.json",descender:-334,familyName:"Helvetiker",lineHeight:1522,underlineThickness:50};class Im{constructor(t,e,i,n,s,r,a,o){void 0===i&&(i=10),this.display=t,this.bbox=e,this.centerGrid=n,this.grid=r,this.allGrid=r[0]|r[1]|r[2];const l=new vi;e.getSize(l);const c=Math.max(l.x,l.y,l.z);this.gridHelper=[];var[h,d,u]=this.niceBounds(1.05*-c,1.05*c,2*i);this.size=d-h;const p=new km(Pm);this.ticks=u;for(var m=0;m<3;m++){var f=new Cm;f.name=`GridHelper-${m}`,f.add(new dh(this.size,this.size/this.ticks,"dark"===o?13421772:7829367,"dark"==o?10066329:12303291));const t=new la({color:"dark"===o?new zn(.5,.5,.5):new zn(.4,.4,.4),side:2});for(var g,v,_=-this.size/2;_<=this.size/2;_+=this.ticks){v=this.createNumber(_,p),0==m?(v.rotateX(-Math.PI/2),v.rotateY(Math.PI/2)):(v.rotateX(Math.PI/2),v.rotateY(-Math.PI/2));const e=new bs(v,t);if(g=1==m?-1:1,e.position.set(g*_,0,0),f.add(e),Math.abs(_)<1e-6)continue;v=this.createNumber(_,p),0==m?v.rotateX(-Math.PI/2):1==m?(v.rotateX(-Math.PI/2),v.rotateZ(Math.PI)):v.rotateX(Math.PI/2);const i=new bs(v,t);g=0==m?-1:1,i.position.set(0,0,g*_),f.add(i)}this.gridHelper.push(f)}this.gridHelper[0].rotateX(Math.PI/2),this.gridHelper[1].rotateY(Math.PI/2),this.gridHelper[2].rotateZ(Math.PI/2),this.setCenter(s,a),this.setVisible()}createNumber(t,e){const i=(.035-7.1)/-637.8*(this.size-640)+7.1,n=e.generateShapes(t.toFixed(1),i);var s=new Zo(n);s.computeBoundingBox();var r=-.5*(s.boundingBox.max.x-s.boundingBox.min.x),a=-.5*(s.boundingBox.max.y-s.boundingBox.min.y);return s.translate(r,a,0),s}niceNumber(t,e){var i=Math.floor(Math.log10(t)),n=t/10**i;return(e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10)*10**i}niceBounds(t,e,i){var n,s;i||(i=10);var r=e-t;return 0==r?n=0:(s=this.niceNumber(r),n=this.niceNumber(s/(i-1),!0),t=Math.floor(t/n)*n,e=Math.ceil(e/n)*n),[t,e,n]}computeGrid(){this.allGrid=this.grid[0]|this.grid[1]|this.grid[2],this.display.toolbarButtons.grid.set(this.allGrid),this.display.checkElement("tcv_grid-xy",this.grid[0]),this.display.checkElement("tcv_grid-xz",this.grid[1]),this.display.checkElement("tcv_grid-yz",this.grid[2]),this.setVisible()}setGrid(t,e=null){switch(t){case"grid":this.allGrid=null==e?!this.allGrid:e,this.grid[0]=this.allGrid,this.grid[1]=this.allGrid,this.grid[2]=this.allGrid;break;case"grid-xy":this.grid[0]=!this.grid[0];break;case"grid-xz":this.grid[1]=!this.grid[1];break;case"grid-yz":this.grid[2]=!this.grid[2]}this.computeGrid()}setGrids(t,e,i){this.grid[0]=t,this.grid[1]=e,this.grid[2]=i,this.computeGrid()}setCenter(t,e){if(t){for(var i=0;i<3;i++)this.gridHelper[i].position.set(0,0,0);this.gridHelper[0].position.z=this.centerGrid?0:-this.size/2,this.gridHelper[1].position.y=this.centerGrid?0:(e?1:-1)*this.size/2,this.gridHelper[2].position.x=this.centerGrid?0:-this.size/2}else{const t=this.bbox.center();for(i=0;i<3;i++)this.gridHelper[i].position.set(...t);this.gridHelper[0].position.z=this.centerGrid?t[2]:-this.size/2+t[2],this.gridHelper[1].position.y=this.centerGrid?t[1]:(e?1:-1)*this.size/2+t[1],this.gridHelper[2].position.x=this.centerGrid?t[0]:-this.size/2+t[0]}}setVisible(){for(var t=0;t<3;t++)this.gridHelper[t].visible=this.grid[t]}dispose(){for(var t=0;t<3;t++)this.gridHelper[t].dispose(),this.gridHelper[t]=null}}class Um extends jp{constructor(t,e,i,n,s,r,a,o){const l=new Float32Array([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e]),c="dark"===o?[1,69/255,0,1,69/255,0,50/255,205/255,50/255,50/255,205/255,50/255,59/255,158/255,1,59/255,158/255,1]:[1,0,0,1,0,0,0,.7,0,0,.7,0,0,0,1,0,0,1],h=new gm;h.setPositions(l),h.setColors(new Float32Array(c));const d=new Ap({vertexColors:!0,toneMapped:!1,linewidth:i,transparent:!0});d.resolution.set(n,s),super(h,d),this.center=t,this.type="AxesHelper",this.name="AxesHelper",this.visible=a,this.setCenter(r)}dispose(){this.geometry.dispose(),this.material.dispose()}setCenter(t){t?this.position.set(0,0,0):this.position.set(...this.center)}setVisible(t){this.visible=t}}class Dm{constructor(t,e,i,n){this.width=t,this.height=e,this.cad_camera=i,this.theme=n,this.camera=null,this.scene=null,this.renderer=null,this.labels=[],this.ready=!1}create(){const t=new km(Pm),e=2.5;this.scene=new js,this.camera=new ic(-this.width,this.width,this.height,-this.height,1,1e3),this.camera.up=this.cad_camera.up,this.camera.lookAt(new vi(0,0,0));const i=new Um([0,0,0],54,e,this.width,this.height,!0,!0,this.theme);this.scene.add(i);const n="dark"===this.theme?[[1,69/255,0],[50/255,205/255,50/255],[59/255,158/255,1]]:[[1,0,0],[0,.5,0],[0,0,1]];this.cones=[];for(var s=0;s<3;s++){var r=new no(0,6.25,12.5,20,1);const t=new jn({color:new zn(...n[s]),toneMapped:!1}),e=new bs(r,t);e.matrixAutoUpdate=!1,this.cones.push(e)}this.cones[0].geometry.rotateZ(-Math.PI/2),this.cones[0].geometry.translate(54,0,0),this.cones[1].geometry.translate(0,54,0),this.cones[2].geometry.rotateX(Math.PI/2),this.cones[2].geometry.translate(0,0,54),this.scene.add(...this.cones);const a=["X","Y","Z"];for(s=0;s<3;s++){const e=new la({color:"dark"===this.theme?new zn(.9,.9,.9):new zn(0,0,0),side:2}),i=t.generateShapes(a[s],16),n=new Zo(i);n.computeBoundingBox();const r=-.5*(n.boundingBox.max.x-n.boundingBox.min.x),o=-.5*(n.boundingBox.max.y-n.boundingBox.min.y);n.translate(r,o,0);const l=new bs(n,e);this.scene.add(l),this.labels.push(l)}const o=new Yo(7.5,20,20),l=new jn({color:10526880}),c=new bs(o,l);this.scene.add(c),this.scene.background=null,this.ready=!0}setVisible(t){for(var e of this.scene.children)e.visible=t}dispose(){mp(this.scene,(t=>{t.geometry?.dispose(),t.material?.dispose()})),this.scene=null,this.camera=null,this.cad_camera=null,this.cones=null,this.labels=null}render(t){this.ready&&(t.setViewport(0,0,this.width,this.height),t.render(this.scene,this.camera))}update(t,e){if(this.ready){let n=(new gi).setFromUnitVectors(new vi(0,0,1),t.normalize());this.camera.position.set(0,0,1).applyQuaternion(n).multiplyScalar(300),this.camera.quaternion.copy(e);for(var i=0;i<3;i++)this.labels[i].position.set(0==i?72:0,1==i?72:0,2==i?72:0),this.labels[i].quaternion.copy(e)}}}class Nm{constructor(t,e){this.prefix=t,this.timeit=e,this.start=performance.now(),this.last=this.start,e&&console.info(`three-cad-viewer: ${t}:timer start`)}split(t){if(this.timeit){const e=performance.now();console.info(`three-cad-viewer: ${this.prefix}:${t}:timer split ${(e-this.last).toFixed(1)} ms`),this.last=e}}stop(){if(this.timeit){const t=performance.now();console.info(`three-cad-viewer: ${this.prefix}:timer stop ${(t-this.start).toFixed(1)} ms:`)}}}const Om=0,Bm=1,Fm=2,zm=3;var Hm=0;class Vm{constructor(t,e,i,n,s,r,a,o,l=!1){this.viewIcons=[[hp(a,"shape_no"),hp(a,"shape"),hp(a,"shape_mix"),hp(a,"shape_empty")],[hp(a,"mesh_no"),hp(a,"mesh"),hp(a,"mesh_mix"),hp(a,"mesh_empty")]],this.navIcons={right:hp(a,"nav_closed"),down:hp(a,"nav_open")},this.tree=t,this.offset=12,this.scrollContainer=e,this.objectHandler=i,this.pickHandler=n,this.updateHandler=s,this.notificationHandler=r,this.theme=a,this.linkIcons=o,this.debug=l}create(){return this.maxLevel=0,this.root=this.buildTreeStructure(this.tree),this.container=document.createElement("ul"),this.container.classList.add("tcv_toplevel"),this.scrollContainer.addEventListener("scroll",this.handleScroll),this.lastLabel=null,this.container}buildTreeStructure(t){const e=(t,i,n)=>{var s=[-1,-1];const r={};this.maxLevel<n&&(this.maxLevel=n);var a=[[!1,!1],[!1,!1],[!1,!1],[!1,!1]];for(const s in t){var o="";let l;o=null==i?s:`${i}/${s}`;const c=t[s];if(Array.isArray(c))l=c,a[c[0]][0]=!0,a[c[1]][1]=!0,r[s]={name:s,state:l,path:o,rendered:!1,level:n};else{let t;[t,l]=e(c,o,n+1),a[l[0]][0]=!0,a[l[1]][1]=!0,r[s]={name:s,state:l,path:o,rendered:!1,level:n,children:t,expanded:!1}}}return[r,(t=>{for(let e of[0,1])t[Fm][e]||t[Bm][e]&&t[Om][e]?s[e]=Fm:t[Bm][e]?s[e]=Bm:t[Om][e]?s[e]=Om:t[zm][e]&&(s[e]=zm);return s})(a)]},i=e(t,null,0)[0];return i[Object.keys(i)[0]]}getVisibleElements(){const t=(t,e)=>{const i=t.getBoundingClientRect();return i.height>0&&i.top>=-this.offset&&i.top<=e.bottom+this.offset},e=this.container.querySelectorAll(".tv-tree-node"),i=this.scrollContainer.getBoundingClientRect(),n=Array.from(e).filter((e=>t(e,i)));if(this.debug){Hm++,console.log(`\n${Hm}> visible elements (${n.length}):`);for(let t in n){const e=n[t],i=this.findNodeByPath(e.dataset.path);console.log(i.path,i.state[0],i.state[1]," => ",e.dataset.state0,e.dataset.state1)}}return n}handleScroll=()=>{this.ticking||(window.requestAnimationFrame((()=>{const t=this.scrollContainer.scrollTop;this.lastScrollTop=t,this.debug&&console.log("update => scroll"),this.update(),this.ticking=!1})),this.ticking=!0)};handleNavigationClick=t=>e=>{e.stopPropagation(),t.expanded=!t.expanded,this.showChildContainer(t),this.debug&&console.log("update => navClick"),this.update()};handleIconClick=(t,e)=>i=>{i.stopPropagation(),this.toggleIcon(t,e)};handleLabelClick(t,e){this.pickHandler(this.getNodePath(this.getParent(t)),t.name,_p.get(e,"meta"),_p.get(e,"shift"),this.isLeaf(t)?"leaf":"node",!0),console.log(`Label clicked: ${this.getNodePath(t)}`)}update=(t=null)=>{const e=this.getVisibleElements().filter((e=>null==t||e.dataset.path.startsWith(t)));for(var i of e){const t=i.dataset.path,e=this.findNodeByPath(t);if(null!=e){if(e.rendered||(this.renderNode(e,i),e.rendered=!0),e.expanded){const s=i.querySelector(".tv-children");if(null!=s&&null!=s.children&&0===s.children.length){for(var n in e.children){const t=e.children[n];this.renderPlaceholder(t,s)}this.showChildContainer(e),this.update(t)}}for(let t in[0,1]){i.dataset[`state${t}`]!=e.state[t]&&this.updateIconInDOM(e,t)}this.showChildContainer(e)}else console.error(`Node not found: ${t}`)}};render(){this.container.innerHTML="",this.renderPlaceholder(this.root,this.container),this.debug&&console.log("update => render"),this.update()}renderPlaceholder(t,e,i=null){this.debug&&console.log("renderPlaceholder",t.path,t.level);const n=document.createElement("div");n.className="tv-tree-node",n.dataset.path=this.getNodePath(t),n.dataset.openPath=i,n.dataset.state0=t.state[0],n.dataset.state1=t.state[1];const s=document.createElement("div");s.className="tv-node-content",this.debug&&(s.innerText=t.path),n.appendChild(s),e.appendChild(n)}renderNode(t,e){this.debug&&console.log("renderNode",t.path,t.level);const i=document.createElement("div");i.className="tv-node-content",e.removeChild(e.firstChild),e.appendChild(i);const n=document.createElement("span");for(var s of(n.className="tv-nav-marker",n.innerHTML=t.children?t.expanded?this.navIcons.down:this.navIcons.right:"",n.onclick=this.handleNavigationClick(t),i.dataset.state0=t.state[0],i.dataset.state1=t.state[1],i.appendChild(n),[0,1])){const e=document.createElement("span"),n=t.state[s];var r=`tv-icon tv-icon${s}`;n!==zm&&(r+=" tv-pointer"),e.className=r,e.innerHTML=this.viewIcons[s][n],n!==zm&&(e.onmousedown=t=>{t.preventDefault()},e.onclick=this.handleIconClick(t,s)),i.appendChild(e)}const a=document.createElement("span");a.className="tv-node-label",a.textContent=t.name,a.onmousedown=t=>{t.preventDefault()},a.onclick=e=>{e.stopPropagation(),this.handleLabelClick(t,e)},i.appendChild(a);let o=null;return t.children&&(o=document.createElement("div"),o.className="tv-children",o.style.display="none",e.appendChild(o)),o}getDomNode=t=>this.container.querySelector(`[data-path="${t}"]`);showChildContainer(t){if(null==t.expanded)return;const e=this.getNodePath(t),i=this.getDomNode(e);if(i){const e=i.querySelector(".tv-children");if(e){"none"!==e.style.display!==t.expanded&&(e.style.display=t.expanded?"block":"none",i.querySelector(".tv-nav-marker").innerHTML=t.expanded?this.navIcons.down:this.navIcons.right,t.expanded||(this.debug&&console.log("update => showChildContainer"),this.update()))}}else console.error(`Element not found: ${e}`)}updateIconInDOM(t,e){const i=this.getNodePath(t),n=this.container.querySelector(`[data-path="${i}"]`);if(n){const i=n.querySelector(`.tv-icon${e}`);i&&(i.innerHTML=this.viewIcons[e][t.state[e]]),n.dataset[`state${e}`]=t.state[e]}}toggleLabelColor(t,e=null){const i=null==e?this.getNodePath(t):e,n=this.container.querySelector(`[data-path="${i}"]`);if(this.lastLabel&&this.lastLabel.classList.remove("tv-node-label-highlight"),n){const t=n.querySelector(".tv-node-label");t&&(this.lastLabel===t?this.lastLabel=null:(t.classList.toggle("tv-node-label-highlight"),this.lastLabel=t))}}traverse(t,e){if(e(t),t.children)for(let i of Object.keys(t.children))this.traverse(t.children[i],e)}isLeaf(t){return null==t.children}getNodePath(t){return null==t?"":"/"+t.path}findNodeByPath(t){var e=Array.isArray(t)?t:t.split("/").filter(Boolean);let i=this.root;for(let t=1;t<e.length;t++){const n=e[t];if(!i.children[n])return null;i=i.children[n]}return i}getParent(t){const e=t.path.substring(0,t.path.lastIndexOf("/"));return 0===e.length?null:this.findNodeByPath(e)}updateObject=(t,e)=>{var i=0==e&&this.linkIcons?[0,1]:[e];for(var n of i)this.objectHandler(this.getNodePath(t),t.state[n],n,!0,!1)};toggleIcon(t,e,i=null){const n=t.state[e];if(n!==zm){var s=0==e?this.linkIcons?[0,1]:[0]:[1];for(var r of s)3!=t.state[r]&&(t.state[r]=null!=i?i?1:0:n===Bm?Om:Bm),this.updateObject(t,e),this.updateParentStates(t,r),this.updateChildrenStates(t,r),this.update(null,r);this.updateHandler(!0),this.notificationHandler()}}hideAll(){this.toggleIcon(this.root,0,!1),this.linkIcons||this.toggleIcon(this.root,1,!1)}showAll(){this.toggleIcon(this.root,0,!0),this.linkIcons||this.toggleIcon(this.root,1,!0)}show(t){const e=this.findNodeByPath(t);e&&this.toggleIcon(e,0,!0)}getState(t){const e=this.findNodeByPath(t);return e?e.state:null}getStates(){const t={};return this.traverse(this.root,(e=>{this.isLeaf(e)&&(t[this.getNodePath(e)]=e.state)})),t}setState(t,e){const i=this.findNodeByPath(t);i&&(this.toggleIcon(i,0,e[0]),this.toggleIcon(i,1,e[1]))}setStates(t){for(var e in t)this.setState(e,t[e]);this.update()}hide(t){const e=this.findNodeByPath(t);e&&this.toggleIcon(e,0,!1)}updateParentStates(t,e){let i=this.getParent(t);for(;i;){const t=Object.values(i.children),n=t.every((t=>t.state[e]===Bm||t.state[e]===zm)),s=t.every((t=>t.state[e]===Om||t.state[e]===zm)),r=n?Bm:s?Om:Fm;i.state[e]!==r&&i.state[e]!==zm&&(i.state[e]=r,this.updateObject(i,e)),i=this.getParent(i)}}updateChildrenStates(t,e){const i=t.state[e],n=t=>{if(t.state[e]!==i&&t.state[e]!==zm&&(t.state[e]=i,this.updateObject(t,e)),t.children)for(var s in t.children)n(t.children[s])};n(t)}openPath(t){const e=t.split("/").filter(Boolean);var i,n="";for(var s of e){n+="/"+s,i=this.findNodeByPath(n);const t=this.getDomNode(n);if(null!=t&&t.children[0].scrollIntoView({behaviour:"smooth",block:"center"}),!i){console.error(`Path not found: ${n}`);break}i.expanded=!0,this.showChildContainer(i),this.debug&&console.log("update => openPath"),this.update()}this.toggleLabelColor(i)}closePath(t){const e=this.findNodeByPath(t);if(e){e.expanded=!1,this.showChildContainer(e);const i=this.getDomNode(t);null!=i&&i.scrollIntoView({behaviour:"smooth",block:"start"}),this.debug&&console.log("update => collapsePath"),this.update()}else console.error(`Path not found: ${t}`)}openLevel(t){this.traverse(this.root,(e=>{this.isLeaf(e)||(e.expanded=-1==t?null!=e.children&&!(1==Object.keys(e.children).length&&this.isLeaf(Object.values(e.children)[0])):e.level<t)}));this.getDomNode(this.getNodePath(this.root)).scrollIntoView({behaviour:"smooth",block:"start"});for(var e=0;e<=(-1==t?this.maxLevel:t);e++)this.debug&&console.log("update => openLevel"),this.update()}collapseAll(){this.openLevel(0)}expandAll(){this.openLevel(this.maxLevel)}dispose(){this.viewIcons=null,this.root=null,this.tree=null,this.navIcons=null,this.scrollContainer.removeEventListener("scroll",this.handleScroll)}}const Gm=[new vi(-1,0,0),new vi(0,-1,0),new vi(0,0,-1)],jm={light:[16711680,65280,255],dark:[16729344,3329330,3907327]},Wm=new jn({opacity:.1,transparent:!0,depthWrite:!1,toneMapped:!1,side:2}),qm=new jn({depthWrite:!1,depthTest:!1,colorWrite:!1,side:1,stencilWrite:!0,stencilFunc:ve,stencilFail:fe,stencilZFail:fe,stencilZPass:fe}),Xm=new jn({depthWrite:!1,depthTest:!1,colorWrite:!1,side:0,stencilWrite:!0,stencilFunc:ve,stencilFail:ge,stencilZFail:ge,stencilZPass:ge}),Zm=new rl({metalness:.3,roughness:.65,opacity:1,transparent:!1,side:2,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,stencilWrite:!0,stencilRef:0,stencilFunc:517,stencilFail:me,stencilZFail:me,stencilZPass:me});class Ym extends zr{constructor(t,e,i){super(t,e),this.center=i,this.setConstant(e)}setConstant(t){this.centeredConstant=t;const e=this.distanceToPoint(new vi(...this.center)),i=this.distanceToPoint(new vi(0,0,0));this.constant=i-e+t}}class Jm extends bs{static matrix=new Xi;constructor(t,e,i,n,s,r,a){const o=new qo(2,2);o.computeBoundingSphere(),s.color.set(new zn(r)),super(o,s),this.type=a,this.index=t,this.plane=e,this.size=n,this.center=i}onAfterRender=t=>{this.type.startsWith("StencilPlane")&&t.clearStencil()};updateMatrixWorld(t){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),Jm.matrix.lookAt(this.position,this.plane.normal,this.up),this.quaternion.setFromRotationMatrix(Jm.matrix),this.translateZ(this.plane.constant),super.updateMatrixWorld(this,t)}}function $m(t,e,i,n){e.clippingPlanes=[n];var s=new bs(i,e);return s.name=t,s}class Km{constructor(t,e,i,n,s){var r;for(this.center=t,this.distance=e/2,this.display=n,this.theme=s,this.nestedGroup=i,this.clipPlanes=[],this.reverseClipPlanes=[],this.planeHelpers=new Cm,this.planeHelpers.name="PlaneHelpers",this.planeHelperMaterials=[],this.objectColors=[],this.objectColorCaps=!1,r=0;r<3;r++){const i=new Ym(Gm[r],this.distance,t);this.clipPlanes.push(i);const n=new Ym(Gm[r].clone().negate(),-this.distance,t);this.reverseClipPlanes.push(n),this.display.setNormalLabel(r,Gm[r].toArray());const a=Wm.clone();a.opacity="dark"===s?.2:.1,this.planeHelperMaterials.push(a),this.planeHelpers.add(new Jm(r,i,t,e,a,jm[s][r],"PlaneHelper"))}for(this.planeHelpers.visible=!1,r=0;r<3;r++){const t=this.clipPlanes.filter(((t,e)=>e!==r));this.planeHelpers.children[r].material.clippingPlanes=t}var a=new Cm;for(a.name="PlaneMeshes",r=0;r<3;r++){const n=this.clipPlanes[r],u=this.clipPlanes.filter(((t,e)=>e!==r));var o=0;for(var l in i.groups){var c=new Cm;c.name=`clipping-${r}`;var h=i.groups[l];if(h instanceof Am&&"solid"===h.subtype){this.objectColors.push(h.children[0].material.color.getHex()),c.add($m(`frontStencil-${r}-${o}`,Xm.clone(),h.shapeGeometry,n)),c.add($m(`backStencil-${r}-${o}`,qm.clone(),h.shapeGeometry,n)),h.addType(c,`clipping-${r}`);var d=Zm.clone();d.color.set(new zn(jm[s][r])),d.clippingPlanes=u,a.add(new Jm(r,n,t,e,d,jm[s][r],`StencilPlane-${r}-${o}`)),o++}}}i.rootGroup.add(a)}setConstant(t,e){this.clipPlanes[t].setConstant(e),this.reverseClipPlanes[t].setConstant(-e)}setNormal=(t,e)=>{var i=e.clone();this.clipPlanes[t].normal=i,this.reverseClipPlanes[t].normal=i.clone().negate(),this.setConstant(t,this.distance),this.display.setNormalLabel(t,i.toArray())};getObjectColorCaps=()=>this.objectColorCaps;setObjectColorCaps=t=>{var e;for(e of this.nestedGroup.rootGroup.children)if("PlaneMeshes"===e.name)break;var i=0,n=-1;const s=Object.keys(e.children).length/3;for(var r of e.children)i%s==0&&n++,t?r.material.color.set(new zn(this.objectColors[i])):r.material.color.set(new zn(jm[this.theme][n])),i++;this.objectColorCaps=t};setVisible=t=>{var e;for(e of this.nestedGroup.rootGroup.children)if("PlaneMeshes"===e.name)break;for(var i of e.children)i.material.visible=t};dispose(){for(var t in this.planeHelpers.dispose(),this.planeHelpers=null,this.planeHelperMaterials)this.planeHelperMaterials[t].dispose(),this.planeHelperMaterials[t]=null;this.planeHelperMaterials=null,this.nestedGroup=null,this.clipPlanes=null,this.reverseClipPlanes=null,this.objectColors=null,this.display=null,this.center=null}}const Qm=["t","tx","ty","tz","q","rx","ry","rz"];class tf{constructor(t){this.delim=t,this.tracks=[],this.mixer=null,this.clip=null,this.clipAction=null,this.clock=new bc,this.duration=0,this._backup=[],this.root=null,this.duration=null,this.speed=null,this.repeat=null}addTrack(t,e,i,n,s){var r;if(t=t.replaceAll("/",this.delim),-1!==Qm.indexOf(i))if(n.length==s.length)if(i.startsWith("t")){const a=e.position;switch(i){case"t":r=s.map((t=>a.clone().add(new vi(...t)).toArray()));break;case"tx":r=s.map((t=>a.add(new vi(t,0,0)).toArray()));break;case"ty":r=s.map((t=>a.add(new vi(0,t,0)).toArray()));break;case"tz":r=s.map((t=>a.add(new vi(0,0,t)).toArray()));break;default:return void console.error(`action ${i} is not supported`)}this.tracks.push(new Pl(t+".position",n,r.flat()))}else{const a=e.quaternion;if(i.startsWith("r")){r=s.map((t=>function(t,e){switch(t){case"x":t=new vi(1,0,0);break;case"y":t=new vi(0,1,0);break;case"z":t=new vi(0,0,1)}var i=new gi;return i.setFromAxisAngle(t,e/180*Math.PI),i}(i.slice(1),t))).map((t=>a.clone().multiply(t).toArray()))}else{if("q"!=i)return void console.error(`action ${i} is not supported`);r=s.map((t=>a.clone().multiply(t).toArray()))}this.tracks.push(new kl(t+".quaternion",n,r.flat()))}else console.error("times and values arrays need have the same lenght");else console.error(`Unknown action: "${i}" not in ${Qm}`)}backup(){this._backup={tracks:this.tracks,root:this.root,duration:this.duration,speed:this.speed,repeat:this.repeat}}restore(){return this.tracks=this._backup.tracks,{duration:this._backup.duration,speed:this._backup.speed,repeat:this._backup.repeat}}cleanBackup(){this._backup=[]}hasTracks(){return null!=this.tracks&&this.tracks.length>0}hasBackup(){return null!=this._backup&&Object.keys(this._backup).length>0}animate(t,e,i,n=!0){return this.root=t,this.duration=e,this.speed=i,this.repeat=n,this.clip=new Il("track",e,this.tracks),this.mixer=new Gc(t),this.mixer.timeScale=i,this.clipAction=this.mixer.clipAction(this.clip),this.clipAction.setLoop(n?Kt:Qt),this.clipAction}setRelativeTime(t){this.clipAction.play(),this.clipAction.paused=!0;var e=this.duration*t;this.clipAction.time=e}getRelativeTime(){return this.clipAction.time/this.duration}dispose(){this.mixer=null,this.clipAction=null,this.clip=null,this.tracks=[],this.root=null}update(){this.mixer&&this.mixer.update(this.clock.getDelta())}}class ef{constructor(t,e){this.html=t,this.clear()}clear(){this.html.value="",this.number=0,this.chunks=[]}dispose(){this.clear(),this.html.innerHTML=""}addText(t){this.addHtml(`<pre style="white-space: nowrap;">${t}</pre>`)}addHtml(t){this.chunks.unshift([this.number,t]),this.number+=1,this.render()}render(){var t="<table class='tcv_info_table'>";for(var e of this.chunks)t+="<tr class='tcv_info_row'>",t+=`<td><pre class="tcv_info_num">[${e[0]}]</pre></td>`,t+=`<td>${e[1]}</td>`,t+="</tr>";t+="</table>",this.html.innerHTML=t}versionMsg(t,e){this.addHtml(`<b>Versions</b>\n <table>\n <tr class="tcv_small_table"><td>CadQuery:</td> <td>${t}</td> </tr>\n <tr class="tcv_small_table"><td>Jupyter CadQuery:</td><td>${e}</td> </tr>\n </table>`)}readyMsg(t,e){var i=`<div class="tcv_info_header">Ready</div>\n <table class="small_table">\n <tr class="tcv_small_table_row" ><td>Tick size</td> <td>${t} mm</td> </tr>\n <tr class="tcv_small_table_row" ><td>Control</td><td>${e}</td></tr>\n <tr class="tcv_small_table_row" ><td>Axes</td>\n <td>\n <span class="tcv_info_red"><b>X</b></span>,\n <span class="tcv_info_green"><b>Y</b></span>,\n <span class="tcv_info_blue"><b>Z</b></span>\n </td> \n </tr>\n </table>`;this.addHtml(i)}bbInfo(t,e,i){var n=`\n <table class="tcv_small_table">\n <tr class="tcv_small_table_row">\n <td><b>Path:</b></td>\n <td>${t}</td>\n </tr>\n <tr class="tcv_small_table_row">\n <td><b>Name:</b></td>\n <td>${e}</td>\n </tr>\n </table>\n `;n+='\n <div class="tcv_info_header">Bounding box:</div>\n <table class="tcv_small_table">\n <tr class="tcv_small_table_row">\n <th></th>\n <th>min</th>\n <th>max</th>\n <th>center</th>\n </tr>\n ';var s=new vi;i.getCenter(s),["x","y","z"].forEach((t=>{n+=`\n <tr class="tcv_small_table_row">\n <th>${t}</th>\n <td align='right'>${i.min[t].toFixed(3)}</td>\n <td align='right'>${i.max[t].toFixed(3)}</td>\n <td align='right'>${s[t].toFixed(3)}</td>\n </tr>\n `})),n+="</table>",this.addHtml(n)}centerInfo(t){var e=`<div>Camera target set to AABB center:</div><div class='tcv_info_line'>{ x: ${t[0].toFixed(2)}, y: ${t[1].toFixed(2)}, z: ${t[2].toFixed(2)} }</div>`;this.addHtml(e)}}var nf=function(t,e){void 0===e&&console.warn('THREE.CameraControls: The second parameter "domElement" is now mandatory.'),e===document&&console.error('THREE.CameraControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=t,this.domElement=e,this.enabled=!0,this.target=new vi,this.trackball=!1,this.holroyd=!0,this.radius=.9,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:i.ROTATE,MIDDLE:i.DOLLY,RIGHT:i.PAN},this.touches={ONE:n.ROTATE,TWO:n.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.quaternion0=this.object.quaternion.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return p.phi},this.getAzimuthalAngle=function(){return p.theta},this.saveState=function(){a.target0.copy(a.target),a.position0.copy(a.object.position),a.quaternion0.copy(a.object.quaternion),a.zoom0=a.object.zoom},this.reset=function(){a.target.copy(a.target0),a.object.position.copy(a.position0),a.object.quaternion.copy(a.quaternion0),a.object.zoom=a.zoom0,a.object.updateProjectionMatrix(),a.dispatchEvent(o),a.update(),d=h.NONE},this.update=function(){var e=new vi,i=(new gi).setFromUnitVectors(t.up,new vi(0,1,0)),n=i.clone().invert(),s=new vi,r=new gi,l=new gi,c=new vi;const _=new vi;return function(){var t,y=a.object.position;if(e.copy(y).sub(a.target),a.trackball&&!a.holroyd)m.theta&&(c.set(0,1,0).applyQuaternion(a.object.quaternion),t=a.enableDamping?a.dampingFactor:1,l.setFromAxisAngle(c,m.theta*t),a.object.quaternion.premultiply(l),e.applyQuaternion(l)),m.phi&&(c.set(1,0,0).applyQuaternion(a.object.quaternion),t=a.enableDamping?a.dampingFactor:1,l.setFromAxisAngle(c,m.phi*t),a.object.quaternion.premultiply(l),e.applyQuaternion(l)),e.multiplyScalar(f),e.clampLength(a.minDistance,a.maxDistance);else if(a.trackball&&a.holroyd){_.crossVectors(w,b);var x=Math.atan(_.length()/w.dot(b));x&&(_.normalize(),_.applyQuaternion(a.object.quaternion),x*=-2*(t=a.enableDamping?a.dampingFactor:1),l.setFromAxisAngle(_,x),a.object.quaternion.premultiply(l),e.applyQuaternion(l)),e.multiplyScalar(f),e.clampLength(a.minDistance,a.maxDistance),w.set(0,0,0),b.set(0,0,0)}else e.applyQuaternion(i),a.autoRotate&&d===h.NONE&&P(2*Math.PI/60/60*a.autoRotateSpeed),p.setFromVector3(e),a.enableDamping?(p.theta+=m.theta*a.dampingFactor,p.phi+=m.phi*a.dampingFactor):(p.theta+=m.theta,p.phi+=m.phi),p.theta=Math.max(a.minAzimuthAngle,Math.min(a.maxAzimuthAngle,p.theta)),p.phi=Math.max(a.minPolarAngle,Math.min(a.maxPolarAngle,p.phi)),p.makeSafe(),p.radius*=f,p.radius=Math.max(a.minDistance,Math.min(a.maxDistance,p.radius)),e.setFromSpherical(p),e.applyQuaternion(n);return!0===a.enableDamping?a.target.addScaledVector(g,a.dampingFactor):a.target.add(g),y.copy(a.target).add(e),!1===a.trackball&&a.object.lookAt(a.target),!0===a.enableDamping?(m.theta*=1-a.dampingFactor,m.phi*=1-a.dampingFactor,g.multiplyScalar(1-a.dampingFactor)):(m.set(0,0,0),g.set(0,0,0)),f=1,!!(v||s.distanceToSquared(a.object.position)>u||8*(1-r.dot(a.object.quaternion))>u)&&(a.dispatchEvent(o),s.copy(a.object.position),r.copy(a.object.quaternion),v=!1,!0)}}();const s={x:new vi(1,0,0),y:new vi(0,1,0),z:new vi(0,0,1)};function r(t,e){if(a.trackball){const i=s[t],n=(new gi).setFromAxisAngle(i,e);a.object.quaternion.premultiply(n),a.object.position.sub(a.target).applyQuaternion(n).add(a.target)}else console.log("not supported for orbit controls")}this.rotateX=function(t){r("x",t)},this.rotateY=function(t){r("y",t)},this.rotateZ=function(t){r("z",t)},this.rotateLeft=function(t){this.trackball?console.log("not supported for trackball controls"):P(t)},this.rotateUp=function(t){this.trackball?console.log("not supported for trackball controls"):I(t)},this.dispose=function(){a.domElement.removeEventListener("contextmenu",st,!1),a.domElement.removeEventListener("mousedown",J,!1),a.domElement.removeEventListener("wheel",Q,!1),a.domElement.removeEventListener("touchstart",et,!1),a.domElement.removeEventListener("touchend",nt,!1),a.domElement.removeEventListener("touchmove",it,!1),document.removeEventListener("mousemove",$,!1),document.removeEventListener("mouseup",K,!1),a.domElement.removeEventListener("keydown",tt,!1)};var a=this,o={type:"change"},l={type:"start"},c={type:"end"},h={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},d=h.NONE,u=1e-6,p=new $c,m=new $c,f=1,g=new vi,v=!1,_=new Ve,y=new Ve,x=new Ve,w=new vi,b=new vi,M=new Ve,S=new Ve,T=new Ve,E=new Ve,A=new Ve,C=new Ve,L=!0,k=!0;function R(){return Math.pow(.95,a.zoomSpeed)}function P(t){L&&(m.theta-=t)}function I(t){k&&(m.phi-=t)}var U,D,N=(U=new vi,function(t,e){U.setFromMatrixColumn(e,0),U.multiplyScalar(-t),g.add(U)}),O=function(){var t=new vi;return function(e,i){!0===a.screenSpacePanning?t.setFromMatrixColumn(i,1):(t.setFromMatrixColumn(i,0),t.crossVectors(a.object.up,t)),t.multiplyScalar(e),g.add(t)}}(),B=(D=new vi,function(t,e){var i=a.domElement;if(a.object.isPerspectiveCamera){var n=a.object.position;D.copy(n).sub(a.target);var s=D.length();s*=Math.tan(a.object.fov/2*Math.PI/180),N(2*t*s/i.clientHeight,a.object.matrix),O(2*e*s/i.clientHeight,a.object.matrix)}else a.object.isOrthographicCamera?(N(t*(a.object.right-a.object.left)/a.object.zoom/i.clientWidth,a.object.matrix),O(e*(a.object.top-a.object.bottom)/a.object.zoom/i.clientHeight,a.object.matrix)):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - pan disabled."),a.enablePan=!1)});function F(t){a.object.isPerspectiveCamera?f/=t:a.object.isOrthographicCamera?(a.object.zoom=Math.max(a.minZoom,Math.min(a.maxZoom,a.object.zoom*t)),a.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - dolly/zoom disabled."),a.enableZoom=!1)}function z(t){a.object.isPerspectiveCamera?f*=t:a.object.isOrthographicCamera?(a.object.zoom=Math.max(a.minZoom,Math.min(a.maxZoom,a.object.zoom/t)),a.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - dolly/zoom disabled."),a.enableZoom=!1)}const H=function(){const t=new vi,e=a.radius*a.radius;return function(i){const n=a.domElement.getBoundingClientRect(),s=(i.x-n.x)/(n.width/2)-1,r=1-(i.y-n.y)/(n.height/2);return function(i,n){var s=(i*=a.rotateSpeed)*i+(n*=a.rotateSpeed)*n;s<=e/2?t.set(i,n,Math.sqrt(e-s)):t.set(i,n,e/(2*Math.sqrt(s)))}(L?s:0,k?r:0),t}}();function V(t){_.set(t.clientX,t.clientY)}function G(t){M.set(t.clientX,t.clientY)}function j(t){if(1==t.touches.length)_.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);_.set(e,i)}}function W(t){if(1==t.touches.length)M.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);M.set(e,i)}}function q(t){var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY,n=Math.sqrt(e*e+i*i);E.set(0,n)}function X(t){if(1==t.touches.length)y.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);y.set(e,i)}if(a.trackball&&a.holroyd)w=H(_).clone(),b=H(y).clone();else{x.subVectors(y,_).multiplyScalar(a.rotateSpeed);var n=a.domElement;P(2*Math.PI*x.x/n.clientHeight),I(2*Math.PI*x.y/n.clientHeight)}_.copy(y)}function Z(t){if(1==t.touches.length)S.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);S.set(e,i)}T.subVectors(S,M).multiplyScalar(a.panSpeed),B(T.x,T.y),M.copy(S)}function Y(t){var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY,n=Math.sqrt(e*e+i*i);A.set(0,n),C.set(0,Math.pow(A.y/E.y,a.zoomSpeed)),F(C.y),E.copy(A)}function J(t){if(!1!==a.enabled){var e;switch(t.preventDefault(),t.stopPropagation(),a.domElement.focus?a.domElement.focus():window.focus(),t.button){case 0:e=a.mouseButtons.LEFT;break;case 1:e=a.mouseButtons.MIDDLE;break;case 2:e=a.mouseButtons.RIGHT;break;default:e=-1}switch(e){case i.DOLLY:if(!1===a.enableZoom)return;!function(t){E.set(t.clientX,t.clientY)}(t),d=h.DOLLY;break;case i.ROTATE:if(_p.get(t,"shift")){if(!1===a.enablePan)return;G(t),d=h.PAN}else{if(!1===a.enableRotate)return;_p.get(t,"ctrl")&&(L=!1),_p.get(t,"meta")&&(k=!1),V(t),d=h.ROTATE}break;case i.PAN:if(_p.get(t,"ctrl")||_p.get(t,"meta")||_p.get(t,"shift")){if(!1===a.enableRotate)return;V(t),d=h.ROTATE}else{if(!1===a.enablePan)return;G(t),d=h.PAN}break;default:d=h.NONE}d!==h.NONE&&(document.addEventListener("mousemove",$,!1),document.addEventListener("mouseup",K,!1),a.dispatchEvent(l))}}function $(t){if(!1!==a.enabled)switch(t.preventDefault(),t.stopPropagation(),d){case h.ROTATE:if(!1===a.enableRotate)return;!function(t){if(y.set(t.clientX,t.clientY),a.trackball&&a.holroyd)w=H(_).clone(),b=H(y).clone();else{var e=a.domElement;x.subVectors(y,_).multiplyScalar(a.rotateSpeed),P(2*Math.PI*x.x/e.clientHeight),I(2*Math.PI*x.y/e.clientHeight)}_.copy(y),a.update()}(t);break;case h.DOLLY:if(!1===a.enableZoom)return;!function(t){A.set(t.clientX,t.clientY),C.subVectors(A,E),C.y>0?F(R()):C.y<0&&z(R()),E.copy(A),a.update()}(t);break;case h.PAN:if(!1===a.enablePan)return;!function(t){S.set(t.clientX,t.clientY),T.subVectors(S,M).multiplyScalar(a.panSpeed),B(T.x,T.y),M.copy(S),a.update()}(t)}}function K(t){!1!==a.enabled&&(document.removeEventListener("mousemove",$,!1),document.removeEventListener("mouseup",K,!1),L=!0,k=!0,a.dispatchEvent(c),d=h.NONE)}function Q(t){!1===a.enabled||!1===a.enableZoom||d!==h.NONE&&d!==h.ROTATE||(t.preventDefault(),t.stopPropagation(),a.dispatchEvent(l),function(t){t.deltaY<0?z(R()):t.deltaY>0&&F(R()),a.update()}(t),a.dispatchEvent(c))}function tt(t){!1!==a.enabled&&!1!==a.enableKeys&&!1!==a.enablePan&&function(t){var e=!1;switch(t.keyCode){case a.keys.UP:B(0,a.keyPanSpeed),e=!0;break;case a.keys.BOTTOM:B(0,-a.keyPanSpeed),e=!0;break;case a.keys.LEFT:B(a.keyPanSpeed,0),e=!0;break;case a.keys.RIGHT:B(-a.keyPanSpeed,0),e=!0}e&&(t.preventDefault(),a.update())}(t)}function et(t){if(!1!==a.enabled){switch(t.preventDefault(),t.touches.length){case 1:switch(a.touches.ONE){case n.ROTATE:if(!1===a.enableRotate)return;j(t),d=h.TOUCH_ROTATE;break;case n.PAN:if(!1===a.enablePan)return;W(t),d=h.TOUCH_PAN;break;default:d=h.NONE}break;case 2:switch(a.touches.TWO){case n.DOLLY_PAN:if(!1===a.enableZoom&&!1===a.enablePan)return;!function(t){a.enableZoom&&q(t),a.enablePan&&W(t)}(t),d=h.TOUCH_DOLLY_PAN;break;case n.DOLLY_ROTATE:if(!1===a.enableZoom&&!1===a.enableRotate)return;!function(t){a.enableZoom&&q(t),a.enableRotate&&j(t)}(t),d=h.TOUCH_DOLLY_ROTATE;break;default:d=h.NONE}break;default:d=h.NONE}d!==h.NONE&&a.dispatchEvent(l)}}function it(t){if(!1!==a.enabled)switch(t.preventDefault(),t.stopPropagation(),d){case h.TOUCH_ROTATE:if(!1===a.enableRotate)return;X(t),a.update();break;case h.TOUCH_PAN:if(!1===a.enablePan)return;Z(t),a.update();break;case h.TOUCH_DOLLY_PAN:if(!1===a.enableZoom&&!1===a.enablePan)return;!function(t){a.enableZoom&&Y(t),a.enablePan&&Z(t)}(t),a.update();break;case h.TOUCH_DOLLY_ROTATE:if(!1===a.enableZoom&&!1===a.enableRotate)return;!function(t){a.enableZoom&&Y(t),a.enableRotate&&X(t)}(t),a.update();break;default:d=h.NONE}}function nt(t){!1!==a.enabled&&(a.dispatchEvent(c),d=h.NONE)}function st(t){!1!==a.enabled&&t.preventDefault()}a.domElement.addEventListener("contextmenu",st,!1),a.domElement.addEventListener("mousedown",J,!1),a.domElement.addEventListener("wheel",Q,!1),a.domElement.addEventListener("touchstart",et,!1),a.domElement.addEventListener("touchend",nt,!1),a.domElement.addEventListener("touchmove",it,!1),a.domElement.addEventListener("keydown",tt,!1),-1===a.domElement.tabIndex&&(a.domElement.tabIndex=0),this.object.lookAt(a.target),this.update(),this.saveState()};(nf.prototype=Object.create(ke.prototype)).constructor=nf;var sf=function(t,e){nf.call(this,t,e),this.mouseButtons.LEFT=i.ROTATE,this.mouseButtons.RIGHT=i.PAN,this.touches.ONE=n.ROTATE,this.touches.TWO=n.DOLLY_PAN};(sf.prototype=Object.create(ke.prototype)).constructor=sf;var rf=function(t,e){nf.call(this,t,e),this.mouseButtons.LEFT=i.PAN,this.mouseButtons.RIGHT=i.ROTATE,this.touches.ONE=n.PAN,this.touches.TWO=n.DOLLY_ROTATE};(rf.prototype=Object.create(ke.prototype)).constructor=rf;var af=function(t,e){nf.call(this,t,e),this.trackball=!0,this.screenSpacePanning=!0,this.autoRotate=!1,this.mouseButtons.LEFT=i.ROTATE,this.mouseButtons.RIGHT=i.PAN,this.touches.ONE=n.ROTATE,this.touches.TWO=n.DOLLY_PAN};(af.prototype=Object.create(ke.prototype)).constructor=af;class of{constructor(t,e,i,n,s=1,r=1,a=1){switch(this.type=t,this.camera=e,this.target=i,this.target0=i.slice(),this.domElement=n,this.rotateSpeed=s,this.zoomSpeed=r,this.panSpeed=a,t){case"orbit":this.initOrbitControls();break;case"trackball":this.initTrackballControls()}this.controls.target=new vi(...this.target),this.controls.rotateSpeed=this.rotateSpeed,this.controls.zoomSpeed=this.zoomSpeed,this.controls.panSpeed=this.panSpeed,this.currentUpdateCallback=null,this.saveState(),this.update()}dispose(){this.controls.dispose(),this.controls=null}saveState(){this.controls.saveState()}initTrackballControls(t=!0){this.controls=new nf(this.camera,this.domElement),this.controls.trackball=!0,this.setHolroydTrackball(t)}initOrbitControls(){this.controls=new nf(this.camera,this.domElement)}addChangeListener(t){null==this.currentUpdateCallback&&(this.currentUpdateCallback=t,this.controls.addEventListener("change",t))}removeChangeListener(){null!=this.currentUpdateCallback&&(this.controls.removeEventListener("change",this.currentUpdateCallback),this.currentUpdateCallback=null)}update(){this.controls.update()}reset(){this.controls.reset()}setCamera(t){this.controls.object=t}setHolroydTrackball(t){this.controls.holroyd=t}getTarget(){return this.controls.target}getZoom0(){return this.controls.zoom0}setTarget(t){this.controls.target.copy(t)}setZoomSpeed(t){this.controls.zoomSpeed=t}setPanSpeed(t){this.controls.panSpeed=t}setRotateSpeed(t){this.controls.rotateSpeed=t}getResetLocation=()=>({target0:this.controls.target0.clone(),position0:this.controls.position0.clone(),quaternion0:this.controls.quaternion0.clone(),zoom0:this.controls.zoom0});setResetLocation=(t,e,i,n)=>{this.controls.target0.copy(t),this.controls.position0.copy(e),this.controls.quaternion0.copy(i),this.controls.zoom0=n};rotateUp(t){this.controls.rotateUp(-t/180*Math.PI),this.update()}rotateLeft(t){this.controls.rotateLeft(t/180*Math.PI),this.update()}rotateX(t){this.controls.rotateX(t/180*Math.PI),this.update()}rotateY(t){this.controls.rotateY(t/180*Math.PI),this.update()}rotateZ(t){this.controls.rotateZ(t/180*Math.PI),this.update()}}const lf={y_up:{iso:{pos:new vi(1,1,1),quat:null},front:{pos:new vi(0,0,1),quat:null},rear:{pos:new vi(0,0,-1),quat:null},left:{pos:new vi(-1,0,0),quat:null},right:{pos:new vi(1,0,0),quat:null},top:{pos:new vi(0,1,0),quat:null},bottom:{pos:new vi(0,-1,0),quat:null}},z_up:{iso:{pos:new vi(1,-1,1),quat:null},front:{pos:new vi(0,-1,0),quat:null},rear:{pos:new vi(0,1,0),quat:null},left:{pos:new vi(-1,0,0),quat:null},right:{pos:new vi(1,0,0),quat:null},top:{pos:new vi(0,0,1),quat:[0,0,0,1]},bottom:{pos:new vi(0,0,-1),quat:[1,0,0,0]}},legacy:{iso:{pos:new vi(1,1,1),quat:null},front:{pos:new vi(1,0,0),quat:null},rear:{pos:new vi(-1,0,0),quat:null},left:{pos:new vi(0,1,0),quat:null},right:{pos:new vi(0,-1,0),quat:null},top:{pos:new vi(0,0,1),quat:null},bottom:{pos:new vi(0,0,-1),quat:null}}},cf={y_up:[0,1,0],z_up:[0,0,1],legacy:[0,0,1]};class hf{constructor(t,e,i,n,s,r){this.target=new vi(...n),this.ortho=s,this.up={Y:"y_up",Z:"z_up",L:"legacy"}[r],this.yaxis=new vi(0,1,0),this.zaxis=new vi(0,0,1);const a=t/e;this.camera_distance=5*i;var o=2*Math.atan(.2)/Math.PI*180;this.pCamera=new Us(o,a,.1,100*i),this.pCamera.up.set(...cf[this.up]),this.pCamera.lookAt(this.target);const l=this.projectSize(i,a);this.oCamera=new ic(-l[0],l[0],l[1],-l[1],.1,100*i),this.oCamera.up.set(...cf[this.up]),this.oCamera.lookAt(this.target),this.camera=s?this.oCamera:this.pCamera,this.camera.up.set(...cf[this.up])}dispose(){this.oCamera=null,this.pCamera=null}getCamera(){return this.camera}lookAtTarget(){this.camera.lookAt(this.target)}updateProjectionMatrix(){this.camera.updateProjectionMatrix()}switchCamera(t){var e=this.getPosition().clone();const i=this.getZoom(),n=this.getQuaternion().clone();t?(this.camera=this.oCamera,this.ortho=!0):(this.camera=this.pCamera,this.ortho=!1),this.setPosition(e,!1),this.setZoom(i),this.setQuaternion(n),this.updateProjectionMatrix()}projectSize(t,e){var i,n;return e<1?n=(i=t)/e:i=(n=t)*e,[i,n]}setupCamera(t,e=null,i=null,n=null){if(null!=e){var s=t?e.clone().normalize().multiplyScalar(this.camera_distance).add(this.target):e;this.camera.position.set(...s.toArray())}null!=i&&this.camera.quaternion.set(...i.toArray()),null!=n&&this.setZoom(n),this.updateProjectionMatrix()}presetCamera(t,e=null){if(null==e&&(e=this.camera.zoom),this.setupCamera(!0,lf[this.up][t].pos,null,e),this.lookAtTarget(),null!=lf[this.up][t].quat){var i=lf[this.up][t].quat;this.setQuaternion(i)}}getZoom(){if(this.ortho)return this.camera.zoom;var t=this.camera.position.clone().sub(this.target);return this.camera_distance/t.length()}setZoom(t){this.ortho?this.camera.zoom=t:this.camera.position.sub(this.target).setLength(this.camera_distance/t).add(this.target),this.updateProjectionMatrix()}getPosition(){return this.camera.position}setPosition(t,e){const i=this;Array.isArray(t)&&3===t.length?i.setupCamera(e,new vi(...t)):t instanceof vi?i.setupCamera(e,t):console.error("wrong type for position",t)}getQuaternion(){return this.camera.quaternion}setQuaternion(t){const e=this;Array.isArray(t)&&4===t.length?e.setupCamera(null,null,new gi(...t)):t instanceof gi?e.setupCamera(null,null,t):console.error("wrong type for quaternion",t),this.updateProjectionMatrix()}getRotation(){return this.camera.rotation}changeDimensions(t,e,i){const n=e/i,s=this.projectSize(t,n);this.oCamera&&(this.oCamera.left=-s[0],this.oCamera.right=s[0],this.oCamera.top=s[1],this.oCamera.bottom=-s[1]),this.pCamera&&(this.pCamera.aspect=n),this.camera&&this.camera.updateProjectionMatrix()}}bs.prototype.dispose=function(){this.geometry&&(this.geometry.dispose(),fp(this.geometry)),this.material&&(Array.isArray(this.material)?this.material.forEach((t=>t.dispose())):this.material.dispose())};t.Display=class{constructor(t,e){this.container=t,this.container.innerHTML=function(t){const e=_p.getshortcuts("shift"),i=_p.getshortcuts("ctrl"),n=_p.getshortcuts("meta");return'<div class="tcv_cad_viewer">\n <div class="tcv_cad_toolbar tcv_round"></div>\n\n <div class="tcv_cad_body">\n <div class="tcv_cad_navigation">\n <div class="tcv_cad_tree tcv_round">\n <div class="tcv_tabnav">\n <input class=\'tcv_tab_tree tcv_tab tcv_tab-left tcv_tab-selected\' value="Tree" type="button" />\n <input class=\'tcv_tab_clip tcv_tab tcv_tab-right tcv_tab-unselected\' value="Clipping"\n type="button" />\n <input class=\'tcv_tab_material tcv_tab tcv_tab-right tcv_tab-unselected\' value="Material"\n type="button" />\n </div>\n <div class="tcv_cad_tree_toggles">\n <span class="tcv_tooltip" data-tooltip="Collpase nodes with a single leaf">\n <input class=\'tcv_collapse_singles tcv_btn tcv_small_btn\' value="1" type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Expand root node only">\n <input class=\'tcv_expand_root tcv_btn tcv_small_btn\' value="R" type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Collpase tree">\n <input class=\'tcv_collapse_all tcv_btn tcv_small_btn\' value="C" type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Expand tree">\n <input class=\'tcv_expand tcv_btn tcv_small_btn\' value="E" type="button" />\n </span>\n </div>\n <div class="tcv_box_content tcv_mac-scrollbar tcv_scroller">\n <div class="tcv_cad_tree_container"></div>\n <div class="tcv_cad_clip_container">\n <div class="tcv_slider_group">\n <div>\n <span class="tcv_tooltip" data-tooltip="Set red clipping plane to view direction">\n <input class=\'tcv_btn_norm_plane1 tcv_btn tcv_plane\' type="button" />\n </span>\n <span class="tcv_lbl_norm_plane1 tcv_label">N1 = (n/a, n/a, n/a)</span>\n </div>\n <div>\n <input type="range" min="1" max="100" value="50"\n class="tcv_sld_value_plane1 tcv_clip_slider">\n <input value=50 class="tcv_inp_value_plane1 tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_slider_group">\n <div>\n <span class="tooltip" data-tooltip="Set green clipping plane to view direction">\n <input class=\'tcv_btn_norm_plane2 tcv_btn tcv_plane\' type="button" />\n </span>\n <span class="tcv_lbl_norm_plane2 tcv_label">N2 = (n/a, n/a, n/a)</span>\n </div>\n <div>\n <input type="range" min="1" max="100" value="50"\n class="tcv_sld_value_plane2 tcv_clip_slider">\n <input value=50 class="tcv_inp_value_plane2 tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_slider_group">\n <div>\n <span class="tooltip" data-tooltip="Set blue clipping plane to view direction">\n <input class=\'tcv_btn_norm_plane3 tcv_btn tcv_plane\' type="button" />\n </span>\n <span class="tcv_lbl_norm_plane3 tcv_label">N3 = (n/a, n/a, n/a)</span>\n </div>\n <div>\n <input type="range" min="1" max="100" value="50"\n class="tcv_sld_value_plane3 tcv_clip_slider">\n <input value=50 class="tcv_inp_value_plane3 tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_clip_checks">\n <div>\n <span class="tcv_tooltip" data-tooltip="Use intersection clipping">\n <input class=\'tcv_clip_intersection tcv_check\' type="checkbox" />\n <span class="tcv_label">Intersection</span>\n </span>\n <span class="tcv_tooltip" data-tooltip="Show clipping planes">\n <input class=\'tcv_clip_plane_helpers tcv_axes0 tcv_check\' type="checkbox" />\n <span class="tcv_label">Planes</span>\n </span>\n </div>\n <span class="tcv_tooltip" data-tooltip="Use object color caps instead of RGB">\n <input class=\'tcv_clip_caps tcv_axes0 tcv_check\' type="checkbox" />\n <span class="tcv_label">Use object color caps</span>\n </span>\n </div>\n </div>\n <div class="tcv_cad_material_container">\n <div class="tcv_cad_tree_toggles">\n <span class="tcv_tooltip" data-tooltip="Reset to original values">\n <input class=\'tcv_material_reset tcv_btn tcv_small_btn\' value="R" type="button" />\n </span>\n </div>\n <div class="tcv_material_ambientlight tcv_label">\n Ambient light intensity (%)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="20" value="1"\n class="tcv_sld_value_ambientlight tcv_clip_slider">\n <input value=1 class="tcv_inp_value_ambientlight tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_pointlight tcv_label">\n Directional light intensity (%)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="40" value="1"\n class="tcv_sld_value_pointlight tcv_clip_slider">\n <input value=1 class="tcv_inp_value_pointlight tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_metalness tcv_label">\n Metalness (%)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="100" value="40"\n class="tcv_sld_value_metalness tcv_clip_slider">\n <input value=40 class="tcv_inp_value_metalness tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_roughness tcv_label">\n Roughness (%)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="100" value="40"\n class="tcv_sld_value_roughness tcv_clip_slider">\n <input value=40 class="tcv_inp_value_roughness tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_info">\n This is not a full material renderer (e.g. the environment is black), so\n not every combination creates expected or good results.\n </div>\n </div>\n </div>\n </div>\n <div class="tcv_cad_info_wrapper">\n <div class="tcv_toggle_info_wrapper">\n \x3c!-- <span class="tooltip" data-tooltip="Open/close info box"> --\x3e\n \x3c!-- <input class=\'tcv_toggle_info tcv_btn tcv_small_info_btn\' value="<" type="button" /> --\x3e\n <span class=\'tcv_toggle_info\'></span><span class="tcv_info_label">Info</span>\n \x3c!-- </span> --\x3e\n </div>\n <div class="tcv_cad_info tcv_round">\n <div class="tcv_box_content tcv_mac-scrollbar tcv_scroller">\n <div class="tcv_cad_info_container"></div>\n </div>\n </div>\n </div>\n </div>\n\n <div class="tcv_cad_view">\n <div class="tcv_distance_measurement_panel tcv_panel tcv_round">\n <div class="tcv_measure_header">Distance</div>\n <table class="tcv_properties_table">\n <tr class="tcv_measure_row_line">\n <td class="tcv_measure_cell tcv_measure_cell_header">Total</td>\n <td class="tcv_measure_cell tcv_measure_val tcv_total">total</td>\n </tr>\n <tr class="tcv_measure_row_line">\n <td class="tcv_measure_cell tcv_measure_cell_header tcv_xtitle">X</td>\n <td class="tcv_measure_cell tcv_measure_val tcv_x">x</td>\n </tr>\n <tr class="tcv_measure_row_line">\n <td class="tcv_measure_cell tcv_measure_cell_header tcv_ytitle">Y</td>\n <td class="tcv_measure_cell tcv_measure_val tcv_y">y</td>\n </tr>\n <tr>\n <td class="tcv_measure_cell tcv_measure_cell_header tcv_bottom_cell_left tcv_ztitle">Z</td>\n <td class="tcv_measure_cell tcv_measure_val bottom_cell_right tcv_z">z</td>\n </tr>\n </table>\n </div>\n\n <div class="tcv_properties_measurement_panel tcv_panel tcv_round">\n <div class="tcv_measure_header">Properties</div>\n <div class="tcv_measure_subheader">Shape</div>\n <table class="tcv_properties_table">\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Volume</th>\n <td class="tcv_props_cell tcv_measure_val tcv_volume" colspan="3">volume</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Area</th>\n <td class="tcv_props_cell tcv_measure_val tcv_area" colspan="3">area</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Length</th>\n <td class="tcv_props_cell tcv_measure_val tcv_length" colspan="3">length</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Width</th>\n <td class="tcv_props_cell tcv_measure_val tcv_width" colspan="3">w</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Geom</th>\n <td class="tcv_props_cell tcv_measure_val tcv_geom_type" colspan="3">g</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Radius</th>\n <td class="tcv_props_cell tcv_measure_val tcv_radius" colspan="3">r</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Radius2</th>\n <td class="tcv_props_cell tcv_measure_val tcv_radius2" colspan="3">r</td>\n </tr>\n <tr class="tcv_properties_row_line vertex_row tcv_vertex_coords_title_row">\n <td class="tcv_vertex_cell tcv_xtitle" colspan="2">X</td>\n <td class="tcv_vertex_cell tcv_ytitle" colspan="2">Y</td>\n <td class="tcv_vertex_cell tcv_ztitle" colspan="2">Z</td>\n </tr>\n <tr class="tcv_properties_row_line vertex_row tcv_vertex_coords_row">\n <td class="tcv_vertex_cell tcv_x_value" colspan="2">X</td>\n <td class="tcv_vertex_cell tcv_y_value" colspan="2">Y</td>\n <td class="tcv_vertex_cell tcv_z_value" colspan="2">Z</td>\n </tr>\n </table>\n </div>\n\n <div class="tcv_angle_measurement_panel tcv_panel tcv_round">\n <div class="tcv_measure_header">Angle</div>\n <table class="tcv_properties_table">\n <tr class="tcv_properties_row_line">\n <td class="tcv_angle tcv_measure_val">angle</td>\n </tr>\n </table>\n </div>\n\n <div class="tcv_cad_animation tcv_round">\n <span class="tcv_animation_label">E</span>\n <span><input type="range" min="0" max="1000" value="0"\n class="tcv_animation_slider tcv_clip_slider"></span>\n <span class="tcv_tooltip" data-tooltip="Play animation"><input class=\'tcv_play tcv_btn\'\n type="button" /></span>\n <span class="tcv_tooltip" data-tooltip="Pause animation"><input class=\'tcv_pause tcv_btn\'\n type="button" /></span>\n <span class="tcv_tooltip" data-tooltip="Stop and reset animation"><input class=\'tcv_stop tcv_btn\'\n type="button" /></span>\n </div>\n\n <div class="tcv_cad_help tcv_round">\n <table class="tcv_cad_help_layout">\n <tr>\n <td></td>\n <td><b>Mouse Navigation</b></td>\n </tr>\n <tr>\n <td>Rotate</td>\n <td><left mouse button></td>\n </tr>\n <tr>\n <td>Rotate up / down</td>\n <td><{{ctrl}}> + <left mouse button></td>\n </tr>\n <tr>\n <td>Rotate left / right</td>\n <td><{{meta}}> + <left mouse button></td>\n </tr>\n <tr>\n <td>Pan</td>\n <td><{{shift}}> + <left mouse button> or <right mouse button></td>\n </tr>\n <tr>\n <td>Zoom</td>\n <td><mouse wheel> or <middle mouse button></td>\n </tr>\n\n <tr>\n <td></td>\n <td><b>Mouse Selection</b></td>\n </tr>\n <tr>\n <td>Pick element</td>\n <td><left mouse button> double click</td>\n </tr>\n <tr>\n <td></td>\n <td>Click on navigation tree label</td>\n </tr>\n <tr>\n <td></td>\n <td>(Shows axis-aligned bounding box, AABB)</td>\n </tr>\n <tr>\n <td>Hide element</td>\n <td><{{meta}}> + <left mouse button> double click</td>\n </tr>\n <tr>\n <td></td>\n <td><{{meta}}> + click on navigation tree label</td>\n </tr>\n <tr>\n <td>Isolate element</td>\n <td><{{shift}}> + <left mouse button> double click</td>\n </tr>\n <tr>\n <td></td>\n <td><{{shift}}> + click on navigation tree label</td>\n </tr>\n <tr>\n <td>Set camera target</td>\n <td><{{shift}}> + <{{meta}}> + <left mouse button> double click</td>\n </tr> \n <tr>\n <td></td>\n <td><b>CAD Object Tree</b></td>\n </tr>\n <tr>\n <td>Collapse single leafs</td>\n <td>Button \'1\' (all nodes with one leaf only)</td>\n </tr>\n <tr>\n <td>Expand root only</td>\n <td>Button \'R\'</td>\n </tr>\n <tr>\n <td>Collapse all nodes</td>\n <td>Button \'C\'</td>\n </tr>\n <tr>\n <td>Expand all nodes</td>\n <td>Button \'E\'</td>\n </tr>\n <tr>\n <td></td>\n <td><b>Measure Mode</b></td>\n </tr>\n <tr>\n <td>Select 1. (and 2.) object</td>\n <td><left mouse button></td>\n </tr>\n <tr>\n <td>Select object & show tree node</td>\n <td><{{shift}}> + <left mouse button></td>\n </tr>\n <tr>\n <td>Filter object types</td>\n <td>Type menu or <n>one, <s>olid, <f>ace, <e>dge , <v>ertices</td>\n </tr>\n <tr>\n <td>Unselect last object</td>\n <td><right mouse button></td>\n </tr>\n <tr>\n <td>Unselect all objects</td>\n <td><ESC></td>\n </tr>\n </table>\n </div>\n <div class="tcv_filter_menu">\n <div class="tcv_drop_down tcv_shape_filter">\n <span class="tcv_round tcv_filter_content"><span class="tcv_filter_value">None</span>\n <span class="tcv_filter_icon">⏶\n </span></span>\n <div class="tcv_filter_dropdown tcv_round">\n <div class="tcv_filter_dropdown_value tvc_filter_none">None</div>\n <div class="tcv_filter_dropdown_value tvc_filter_vertex">Vertex</div>\n <div class="tcv_filter_dropdown_value tvc_filter_edge">Edge</div>\n <div class="tcv_filter_dropdown_value tvc_filter_face">Face</div>\n <div class="tcv_filter_dropdown_value tvc_filter_solid">Solid</div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>'.replaceAll("{{id}}",t).replaceAll("{{shift}}",e).replaceAll("{{ctrl}}",i).replaceAll("{{meta}}",n)}(this.container.id),this.cadBody=this._getElement("tcv_cad_body"),this.cadTool=new xp(this._getElement("tcv_cad_toolbar"),t.id),this.cadView=this._getElement("tcv_cad_view"),this.distanceMeasurementPanel=this._getElement("tcv_distance_measurement_panel"),this.propertiesMeasurementPanel=this._getElement("tcv_properties_measurement_panel"),this.angleMeasurementPanel=this._getElement("tcv_angle_measurement_panel"),this.cadTree=this._getElement("tcv_cad_tree_container"),this.cadTreeScrollContainer=this._getElement("tcv_box_content"),this.cadTreeToggles=this._getElement("tcv_cad_tree_toggles"),this.cadClip=this._getElement("tcv_cad_clip_container"),this.cadMaterial=this._getElement("tcv_cad_material_container"),this.tabTree=this._getElement("tcv_tab_tree"),this.tabClip=this._getElement("tcv_tab_clip"),this.tabMaterial=this._getElement("tcv_tab_material"),this.cadInfo=this._getElement("tcv_cad_info_container"),this.cadAnim=this._getElement("tcv_cad_animation"),this.cadTools=this._getElement("tcv_cad_tools"),this.cadHelp=this._getElement("tcv_cad_help"),this.planeLabels=[];for(var i=1;i<4;i++)this.planeLabels.push(this._getElement(`tcv_lbl_norm_plane${i}`));var n;for(var s of(this.viewer=null,this.glass=e.glass,this.tools=e.tools,this.cadWidth=e.cadWidth,this.height=e.height,this.treeWidth=e.treeWidth,this._events=[],this.setSizes(e),this.activeTab="tree",this.cadTree.style.display="block",this.cadClip.style.display="none",this.cadMaterial.style.display="none",this.clipSliders=null,this.explodeFlag=!1,this.currentButton=null,this.lastPlaneState=!1,"dark"===e.theme||"browser"==e.theme&&window.matchMedia("(prefers-color-scheme: dark)").matches?(document.documentElement.setAttribute("data-theme","dark"),n="dark"):(document.documentElement.setAttribute("data-theme","light"),n="light"),fm)){var r=this.container.getElementsByClassName(`tcv_${s}`);for(i=0;i<r.length;i++){r[i].setAttribute("style",`background-image: ${cp(n,s)}`)}}this.toolbarButtons={},this.toolbarButtons.axes=new Mp(n,"axes","Show axes",this.setAxes),this.cadTool.addButton(this.toolbarButtons.axes),this.toolbarButtons.axes0=new Mp(n,"axes0","Show axes at origin (0,0,0)",this.setAxes0),this.cadTool.addButton(this.toolbarButtons.axes0),this.toolbarButtons.grid=new Mp(n,"grid","Show grid",this.setGrid,null,["xy","xz","yz"]),this.cadTool.addButton(this.toolbarButtons.grid),this.cadTool.addSeparator(),this.toolbarButtons.perspective=new Mp(n,"perspective","Use perspective camera",this.setOrtho),this.cadTool.addButton(this.toolbarButtons.perspective),this.toolbarButtons.transparent=new Mp(n,"transparent","Show transparent faces",this.setTransparent),this.cadTool.addButton(this.toolbarButtons.transparent),this.toolbarButtons.blackedges=new Mp(n,"blackedges","Show black edges",this.setBlackEdges),this.cadTool.addButton(this.toolbarButtons.blackedges),this.cadTool.addSeparator(),this.toolbarButtons.reset=new bp(n,"reset","Reset view",this.reset),this.cadTool.addButton(this.toolbarButtons.reset),this.toolbarButtons.resize=new bp(n,"resize","Resize object",this.resize),this.cadTool.addButton(this.toolbarButtons.resize),this.cadTool.addSeparator(),this.toolbarButtons.iso=new bp(n,"iso","Switch to iso view",this.setView),this.cadTool.addButton(this.toolbarButtons.iso),this.toolbarButtons.front=new bp(n,"front","Switch to front view",this.setView),this.cadTool.addButton(this.toolbarButtons.front),this.toolbarButtons.rear=new bp(n,"rear","Switch to back view",this.setView),this.cadTool.addButton(this.toolbarButtons.rear),this.toolbarButtons.top=new bp(n,"top","Switch to top view",this.setView),this.cadTool.addButton(this.toolbarButtons.top),this.toolbarButtons.bottom=new bp(n,"bottom","Switch to bottom view",this.setView),this.cadTool.addButton(this.toolbarButtons.bottom),this.toolbarButtons.left=new bp(n,"left","Switch to left view",this.setView),this.cadTool.addButton(this.toolbarButtons.left),this.toolbarButtons.right=new bp(n,"right","Switch to right view",this.setView),this.cadTool.addButton(this.toolbarButtons.right),this.cadTool.addSeparator(),this.toolbarButtons.explode=new Mp(n,"explode","Explode tool",this.setExplode),this.cadTool.addButton(this.toolbarButtons.explode),this.toolbarButtons.distance=new Mp(n,"distance","Measure distance between shapes",this.setTool),this.cadTool.addButton(this.toolbarButtons.distance),this.toolbarButtons.properties=new Mp(n,"properties","Show shape properties",this.setTool),this.cadTool.addButton(this.toolbarButtons.properties),this.toolbarButtons.angle=new Mp(n,"angle","Measure angle between shapes",this.setTool),this.cadTool.addButton(this.toolbarButtons.angle),this.cadTool.defineGroup([this.toolbarButtons.explode,this.toolbarButtons.distance,this.toolbarButtons.properties,this.toolbarButtons.angle]),this.toolbarButtons.help=new bp(n,"help","Help",this.toggleHelp),this.toolbarButtons.help.alignRight(),this.cadTool.addButton(this.toolbarButtons.help),document.addEventListener("keydown",(t=>{"Escape"===t.key&&this.help_shown&&(t.preventDefault(),this.showHelp(!1))})),this.toolbarButtons.pin=new bp(n,"pin","Pin viewer as png",this.pinAsPng),this.toolbarButtons.pin.alignRight(),this.cadTool.addButton(this.toolbarButtons.pin),this.shapeFilterDropDownMenu=new nm(this),this.showPinning(e.pinning),this.infoIcons={right:hp(n,"nav_closed"),down:hp(n,"nav_open")}}_setupCheckEvent(t,e,i){const n=this._getElement(t);n.addEventListener("change",e),null!=i&&(n.checked=i),this._events.push(["change",t,e])}_setupClickEvent(t,e,i){this._getElement(t).addEventListener("click",e),this._events.push(["click",t,e])}_getElement(t){return this.container.getElementsByClassName(t)[0]}dispose(){var t,e,i;for(var n of this._events){[t,e,i]=n;this._getElement(e).removeEventListener(t,i)}this.cadTree.innerHTML="",this.cadView.removeChild(this.cadView.children[2]),this.container.innerHTML=""}handleMoreButton(t){}setSizes(t,e=2/3){if(t.cadWidth&&(this.cadWidth=t.cadWidth,this.cadView.style.width=mm(t.cadWidth)),t.height&&(this.height=t.height,this.cadView.style.height=mm(t.height)),t.treeWidth&&(this.treeWidth=t.treeWidth,this.cadTree.parentElement.parentElement.style.width=mm(t.treeWidth),this.cadInfo.parentElement.parentElement.style.width=mm(t.treeWidth)),!t.glass){const i=Math.round(t.height*e);this.cadTree.parentElement.parentElement.style.height=mm(i),this.cadInfo.parentElement.parentElement.style.height=mm(t.height-i-4)}t.tools&&!t.glass?(this.cadTool.container.style.width=mm(t.treeWidth+t.cadWidth+4),this.cadBody.style.width=mm(t.treeWidth+t.cadWidth+4)):(this.cadTool.container.style.width=mm(t.cadWidth+2),this.cadBody.style.width=mm(t.cadWidth+2)),this.cadBody.style.height=mm(t.height+4)}setupUI(t){this.viewer=t,this._setupClickEvent("tcv_expand_root",this.handleCollapseNodes),this._setupClickEvent("tcv_collapse_singles",this.handleCollapseNodes),this._setupClickEvent("tcv_collapse_all",this.handleCollapseNodes),this._setupClickEvent("tcv_expand",this.handleCollapseNodes),this._setupClickEvent("tcv_material_reset",this.handleMaterialReset),this._setupClickEvent("tcv_toggle_info",this.toggleInfo),this.help_shown=!0,this.info_shown=!this.glass;["tcv_tab_tree","tcv_tab_clip","tcv_tab_material"].forEach((t=>{this._setupClickEvent(t,this.selectTab)})),this.clipSliders=[];for(var e=1;e<4;e++)this.clipSliders.push(new yp(`plane${e}`,0,100,this));for(this.ambientlightSlider=new yp("ambientlight",0,400,this),this.directionallightSlider=new yp("pointlight",0,400,this),this.metalnessSlider=new yp("metalness",0,100,this),this.roughnessSlider=new yp("roughness",0,100,this),this._setupCheckEvent("tcv_clip_plane_helpers",this.setClipPlaneHelpers,!1),this._setupCheckEvent("tcv_clip_intersection",this.setClipIntersection,!1),this._setupCheckEvent("tcv_clip_caps",this.setObjectColorCaps,!1),e=1;e<4;e++)this._setupClickEvent(`tcv_btn_norm_plane${e}`,this.setClipNormalFromPosition,!1);this._setupClickEvent("tcv_play",this.controlAnimation,!1),this._setupClickEvent("tcv_pause",this.controlAnimation,!1),this._setupClickEvent("tcv_stop",this.controlAnimation,!1),this.animationSlider=this.container.getElementsByClassName("tcv_animation_slider")[0],this.animationSlider.value=0,this.animationSlider.addEventListener("input",this.animationChange),this.showAnimationControl(!1),this.showHelp(!1),this.showDistancePanel(!1),this.showPropertiesPanel(!1),this.showAnglePanel(!1)}updateUI(t,e,i,n,s,r,a){this.toolbarButtons.axes.set(t),this.toolbarButtons.axes0.set(e),this.toolbarButtons.perspective.set(!i),this.toolbarButtons.transparent.set(n),this.toolbarButtons.blackedges.set(s),this.showTools(r),this.glassMode(a)}checkElement(t,e){this._getElement(t).checked=e}addCadView(t){var e=this.cadView.querySelector("canvas");e?this.cadView.replaceChild(t,e):this.cadView.appendChild(t)}getCanvas(){return this.cadView.children[this.cadView.children.length-1]}clearCadTree(){this.cadTree.innerHTML=""}addCadTree(t){this.cadTree.appendChild(t)}setAxes=(t,e)=>{this.viewer.setAxes(e)};setAxesCheck=t=>{this.toolbarButtons.axes.set(t)};setGrid=(t,e)=>{this.viewer.setGrid(t,e)};setGridCheck=t=>{this.checkElement("tcv_grid",t)};setAxes0=(t,e)=>{this.viewer.setAxes0(e)};setAxes0Check=t=>{this.toolbarButtons.axes0.set(t)};setOrtho=(t,e)=>{this.viewer.switchCamera(!e)};setOrthoCheck=t=>{this.toolbarButtons.perspective.set(!t)};setTransparent=(t,e)=>{this.viewer.setTransparent(e)};setTransparentCheck=t=>{this.toolbarButtons.transparent.set(t)};setBlackEdges=(t,e)=>{this.viewer.setBlackEdges(e)};setBlackEdgesCheck=t=>{this.toolbarButtons.blackedges.set(t)};setExplode=(t,e)=>{e&&this.explodeFlag||(e||this.explodeFlag)&&(e?(this.viewer.hasAnimation()&&this.viewer.backupAnimation(),this.viewer.explode(),this.explodeFlag=!0):(this.viewer.hasAnimation()&&(this.controlAnimationByName("stop"),this.viewer.clearAnimation(),this.viewer.restoreAnimation()),this.explodeFlag=!1))};setExplodeCheck=t=>{this.toolbarButtons.explode.set(t)};showExplode=t=>{this._getElement("tcv_explode_widget").style.display=t?"inline-block":"none"};setTool=(t,e)=>{this.viewer.toggleAnimationLoop(e),e?(this.showAnimationControl(!1),this.viewer.hasAnimation()&&this.viewer.backupAnimation(),["distance","properties","angle"].includes(t)&&!["distance","properties","angle"].includes(this.currentButton)&&(this.viewer.toggleGroup(!0),this.viewer.toggleTab(!0)),this.viewer.setRaycastMode(e),this.shapeFilterDropDownMenu.setRaycaster(this.viewer.raycaster),"distance"==t?(this.viewer.cadTools.enable(hm),this.viewer.checkChanges({activeTool:hm})):"properties"==t?(this.viewer.cadTools.enable(dm),this.viewer.checkChanges({activeTool:dm})):"angle"==t&&(this.viewer.cadTools.enable(um),this.viewer.checkChanges({activeTool:um})),this.currentButton=t):(this.currentButton!=t&&"explode"!=t||(this.viewer.toggleGroup(!1),this.viewer.toggleTab(!1),this.currentButton=null),this.viewer.checkChanges({activeTool:cm}),this.viewer.clearSelection(),this.viewer.hasAnimation()&&(this.controlAnimationByName("stop"),this.viewer.clearAnimation(),this.viewer.restoreAnimation(),this.showAnimationControl(!0)),this.viewer.setRaycastMode(e)),this.viewer.setPickHandler(!e),this.shapeFilterDropDownMenu.show(e)};setClipPlaneHelpers=t=>{const e=!!t.target.checked;this.setClipPlaneHelpersCheck(e),this.viewer.setClipPlaneHelpers(e)};setClipPlaneHelpersCheck=t=>{this.checkElement("tcv_clip_plane_helpers",t),this.lastPlaneState=t};showTools=t=>{this.tools=t,this.viewer&&(this.viewer.tools=t);var e=this._getElement("tcv_cad_toolbar"),i=this._getElement("tcv_cad_navigation");for(var n of[i,e])t?(n.style.height="38px",n.style.display="block"):(n.style.height="0px",n.style.display="none")};showMeasureTools=t=>{this.toolbarButtons.distance.show(t),this.toolbarButtons.properties.show(t),this.toolbarButtons.angle.show(t)};setClipIntersection=t=>{const e=!!t.target.checked;this.viewer.setClipIntersection(e)};setClipIntersectionCheck=t=>{this._getElement("tcv_clip_intersection").checked=t};setObjectColorCaps=t=>{const e=!!t.target.checked;this.viewer.setClipObjectColorCaps(e)};setClipObjectColorsCheck=t=>{this._getElement("tcv_clip_caps").checked=t};reset=()=>{this.viewer.reset(),this.clearHighlights()};resize=()=>{this.viewer.resize()};clearHighlights(){["front","rear","top","bottom","left","right","iso"].forEach((t=>{this.toolbarButtons[t].highlight(!1)}))}highlightButton(t){this.clearHighlights(),this.toolbarButtons[t].highlight(!0),this.viewer.keepHighlight=!0}setView=t=>{this.viewer.presetCamera(t),this.highlightButton(t),this.viewer.update(!0,!1)};showPinning(t){this.toolbarButtons.pin.show(t)}pinAsPng=t=>{this.viewer.pinAsPng()};setNormalLabel=(t,e)=>{this.planeLabels[t].innerHTML=`N=(${e[0].toFixed(2)}, ${e[1].toFixed(2)}, ${e[2].toFixed(2)})`};setClipNormalFromPosition=t=>{const e=parseInt(t.target.classList[0].slice(-1));this.viewer.setClipNormalFromPosition(e-1)};selectTab=t=>{const e=t.target.className.split(" ")[0];this.selectTabByName(e.slice(8))};setAmbientLight=t=>{this.ambientlightSlider.setValue(100*t)};setDirectLight=t=>{this.directionallightSlider.setValue(100*t)};setMetalness=t=>{this.metalnessSlider.setValue(100*t)};setRoughness=t=>{this.roughnessSlider.setValue(100*t)};handleMaterialReset=t=>{this.viewer.resetMaterial()};selectTabByName(t){if(["clip","tree","material"].includes(t)){if("tree"===t&&"tree"!==this.activeTab){this.cadTree.style.display="block",this.cadTreeToggles.style.display="block",this.cadClip.style.display="none",this.cadMaterial.style.display="none",this.viewer.nestedGroup.setBackVisible(!1),this.viewer.setLocalClipping(!1),this.viewer.clipping.setVisible(!1);var e=this.viewer.getClipPlaneHelpers();this.viewer.setClipPlaneHelpers(!1),this.lastPlaneState=e}else"clip"===t&&"clip"!==this.activeTab?(this.cadTree.style.display="none",this.cadTreeToggles.style.display="none",this.cadClip.style.display="block",this.cadMaterial.style.display="none",this.viewer.nestedGroup.setBackVisible(!0),this.viewer.setLocalClipping(!0),this.viewer.setClipIntersection(this.viewer.clipIntersection),this.viewer.setClipPlaneHelpers(this.lastPlaneState),this.viewer.clipping.setVisible(!0),this.viewer.update(!0,!1)):"material"===t&&"material"!==this.activeTab&&(this.cadTree.style.display="none",this.cadTreeToggles.style.display="none",this.cadClip.style.display="none",this.cadMaterial.style.display="block",this.viewer.nestedGroup.setBackVisible(!1),this.viewer.setLocalClipping(!1),this.viewer.setClipPlaneHelpers(!1),this.viewer.clipping.setVisible(!1));this.activeTab=t,this.viewer.checkChanges({tab:t}),"tree"==t?(this.tabTree.classList.add("tcv_tab-selected"),this.tabTree.classList.remove("tcv_tab-unselected"),this.tabClip.classList.remove("tcv_tab-selected"),this.tabClip.classList.add("tcv_tab-unselected"),this.tabMaterial.classList.remove("tcv_tab-selected"),this.tabMaterial.classList.add("tcv_tab-unselected")):"clip"==t?(this.tabTree.classList.remove("tcv_tab-selected"),this.tabTree.classList.add("tcv_tab-unselected"),this.tabClip.classList.add("tcv_tab-selected"),this.tabClip.classList.remove("tcv_tab-unselected"),this.tabMaterial.classList.remove("tcv_tab-selected"),this.tabMaterial.classList.add("tcv_tab-unselected")):(this.tabTree.classList.add("tcv_tab-unselected"),this.tabTree.classList.remove("tcv_tab-selected"),this.tabClip.classList.add("tcv_tab-unselected"),this.tabClip.classList.remove("tcv_tab-selected"),this.tabMaterial.classList.add("tcv_tab-selected"),this.tabMaterial.classList.remove("tcv_tab-unselected"))}}toggleClippingTab=t=>{t?this.tabClip.removeAttribute("disabled"):this.tabClip.setAttribute("disabled","true"),this.tabClip.classList.toggle("tcv_tab-disabled",!t)};handleCollapseNodes=t=>{this.collapseNodes(t.target.value)};collapseNodes(t){"1"===t?this.viewer.treeview.openLevel(-1):"R"===t?this.viewer.treeview.openLevel(1):"C"===t?this.viewer.treeview.collapseAll():"E"===t&&this.viewer.treeview.expandAll()}setSliderLimits(t){for(var e=0;e<3;e++)this.clipSliders[e].setSlider(t)}refreshPlane(t,e){this.viewer.refreshPlane(t-1,parseFloat(e))}showAnimationControl=t=>{this.cadAnim.style.display=t?"block":"none"};controlAnimationByName(t){this.viewer.controlAnimation(t);var e=this.viewer.animation.getRelativeTime();this.animationSlider.value=1e3*e,"play"==t?this.viewer.bboxNeedsUpdate=!0:"stop"==t?(this.viewer.bboxNeedsUpdate=!1,null!=this.viewer.lastBbox&&(this.viewer.lastBbox.needsUpdate=!0)):this.viewer.bboxNeedsUpdate=!this.viewer.bboxNeedsUpdate}controlAnimation=t=>{const e=t.target.className.split(" ")[0].slice(4);this.controlAnimationByName(e)};animationChange=t=>{this.viewer.animation.setRelativeTime(t.target.valueAsNumber/1e3),null!=this.viewer.lastBbox&&(this.viewer.lastBbox.needsUpdate=!0)};setAnimationLabel(t){this._getElement("tcv_animation_label").innerHTML=t}resetAnimationSlider(){this.animationSlider.value=0}showHelp=t=>{this.cadHelp.style.display=t?"block":"none",this.help_shown=t};showDistancePanel=t=>{this.distanceMeasurementPanel.style.display=t?"block":"none"};showPropertiesPanel=t=>{this.propertiesMeasurementPanel.style.display=t?"block":"none"};showAnglePanel=t=>{this.angleMeasurementPanel.style.display=t?"block":"none"};toggleHelp=()=>{this.showHelp(!this.help_shown)};showInfo=t=>{this.cadInfo.parentNode.parentNode.style.display=t?"block":"none",this._getElement("tcv_toggle_info").innerHTML=t?`${this.infoIcons.down}`:`${this.infoIcons.right}`,this.info_shown=t};toggleInfo=()=>{this.showInfo(!this.info_shown)};autoCollapse(){this.cadWidth<600&&this.glass&&(console.info("Small view, collapsing tree"),this.collapseNodes("C"))}glassMode(t){t?(this._getElement("tcv_cad_tree").classList.add("tcv_cad_tree_glass"),this._getElement("tcv_cad_tree").style.height=null,this._getElement("tcv_cad_tree").style["max-height"]=mm(Math.round(2*this.height/3)-18),this._getElement("tcv_cad_info").classList.add("tcv_cad_info_glass"),this._getElement("tcv_cad_view").classList.add("tcv_cad_view_glass"),this._getElement("tcv_toggle_info_wrapper").style.display="block",this.showInfo(!1),this.glass=!0,this.autoCollapse()):(this._getElement("tcv_cad_tree").classList.remove("tcv_cad_tree_glass"),this._getElement("tcv_cad_tree").style["max-height"]=null,this._getElement("tcv_cad_tree").style.height=mm(Math.round(2*this.height/3)),this._getElement("tcv_cad_info").classList.remove("tcv_cad_info_glass"),this._getElement("tcv_cad_view").classList.remove("tcv_cad_view_glass"),this._getElement("tcv_toggle_info_wrapper").style.display="none",this.showInfo(!0),this.glass=!1),this.viewer&&(this.viewer.glass=!1);const e={cadWidth:this.cadWidth,glass:this.glass,height:this.height,tools:this.tools,treeWidth:t?0:this.treeWidth};this.setSizes(e)}updateHelp(t,e){const i=this._getElement("tcv_cad_help_layout");for(var n in t)i.innerHTML=i.innerHTML.replaceAll("<"+t[n].slice(0,-3)+">","<_"+e[n].slice(0,-3)+">");i.innerHTML=i.innerHTML.replaceAll("_shift","shift"),i.innerHTML=i.innerHTML.replaceAll("_ctrl","ctrl"),i.innerHTML=i.innerHTML.replaceAll("_alt","alt"),i.innerHTML=i.innerHTML.replaceAll("_meta","meta")}},t.Timer=Nm,t.Viewer=class{constructor(t,e,i,n=null,s=!0){this.notifyCallback=i,this.pinAsPngCallback=n,this.updateMarker=s,this.hasAnimationLoop=!1,this.setDisplayDefaults(e),e.keymap&&_p.set(e.keymap),this.display=t,window.THREE=op,this.nestedGroup=null,this.mapping=null,this.tree=null,this.bbox=null,this.bb_max=0,this.scene=null,this.camera=null,this.orthographicCamera=null,this.gridHelper=null,this.axesHelper=null,this.controls=null,this.orientationMarker=null,this.treeview=null,this.cadTools=new pm(this),this.newTreeBehavior=e.newTreeBehavior,this.ready=!1,this.mixer=null,this.animation=new tf("|"),this.continueAnimation=!0,this.clipNormals=[[-1,0,0],[0,-1,0],[0,0,-1]],this.camera_distance=0,this.mouse=new Ve,this.renderer=new ap({alpha:!this.dark,antialias:!0,stencil:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(this.cadWidth,this.height),this.renderer.setClearColor(16777215,0),this.renderer.autoClear=!1,this.lastNotification={},this.lastBbox=null,this.expandedTree=null,this.compactTree=null,this.expandedNestedGroup=null,this.compactNestedGroup=null,this.lastObject=null,this.lastSelection=null,this.lastPosition=null,this.bboxNeedsUpdate=!1,this.keepHighlight=!1,this.setPickHandler(!0),this.renderer.domElement.addEventListener("contextmenu",(t=>t.stopPropagation())),this.display.setupUI(this),this.display.addCadView(this.renderer.domElement),console.debug("three-cad-viewer: WebGL Renderer created"),window.viewer=this}version(){return"3.3.0"}setDisplayDefaults(t){for(var e in this.theme="light",this.cadWidth=800,this.treeWidth=250,this.height=600,this.pinning=!1,this.glass=!1,this.tools=!0,this.keymap={shift:"shiftKey",ctrl:"ctrlKey",meta:"metaKey"},this.newTreeBehavior=!0,t)null==this[e]?console.warn(`Unknown option "${e}" to create a viewer - ignored`):this[e]=t[e];"dark"===t.theme||"browser"==t.theme&&window.matchMedia("(prefers-color-scheme: dark)").matches?this.theme="dark":this.theme="light"}setRenderDefaults(t){for(var e in this.ambientIntensity=.5,this.directIntensity=.6,this.metalness=.7,this.roughness=.7,this.defaultOpacity=.5,this.edgeColor=7368816,this.normalLen=0,this.measureTools=!1,t)void 0===this[e]?console.warn(`Unknown option "${e}" to create a viewer - ignored`):this[e]=t[e];this.materialSettings={ambientIntensity:this.ambientIntensity,directIntensity:this.directIntensity,metalness:this.metalness,roughness:this.roughness}}setViewerDefaults(t){for(var e in this.axes=!1,this.axes0=!1,this.grid=[!1,!1,!1],this.ortho=!0,this.transparent=!1,this.blackEdges=!1,this.collapse=0,this.clipIntersection=!1,this.clipPlaneHelpers=!1,this.clipObjectColors=!1,this.clipNormal0=[-1,0,0],this.clipNormal1=[0,-1,0],this.clipNormal2=[0,0,-1],this.clipSlider0=-1,this.clipSlider1=-1,this.clipSlider2=-1,this.control="orbit",this.up="Z",this.ticks=10,this.centerGrid=!1,this.position=null,this.quaternion=null,this.target=null,this.measureTools=!0,this.zoom=1,this.panSpeed=.5,this.rotateSpeed=1,this.zoomSpeed=.5,this.timeit=!1,t)void 0===this[e]?console.warn(`Unknown option ${e} to add shapes - ignored`):this[e]=t[e]}dumpOptions(){console.log("Display:"),console.log("- cadWidth",this.cadWidth),console.log("- control",this.control),console.log("- height",this.height),console.log("- pinning",this.pinning),console.log("- theme",this.theme),console.log("- treeHeight",this.treeHeight),console.log("- treeWidth",this.treeWidth),console.log("Render:"),console.log("- ambientIntensity",this.ambientIntensity),console.log("- defaultOpacity",this.defaultOpacity),console.log("- directIntensity",this.directIntensity),console.log("- edgeColor",this.edgeColor),console.log("- normalLen",this.normalLen),console.log("View:"),console.log("- axes",this.axes),console.log("- axes0",this.axes0),console.log("- blackEdges",this.blackEdges),console.log("- clipIntersection",this.clipIntersection),console.log("- clipPlaneHelpers",this.clipPlaneHelpers),console.log("- clipObjectColors",this.clipObjectColors),console.log("- clipNormal0",this.clipNormal0),console.log("- clipNormal1",this.clipNormal1),console.log("- clipNormal2",this.clipNormal2),console.log("- clipSlider0",this.clipSlider0),console.log("- clipSlider1",this.clipSlider1),console.log("- clipSlider2",this.clipSlider2),console.log("- grid",this.grid),console.log("- ortho",this.ortho),console.log("- panSpeed",this.panSpeed),console.log("- position",this.position),console.log("- quaternion",this.quaternion),console.log("- rotateSpeed",this.rotateSpeed),console.log("- ticks",this.ticks),console.log("- timeit",this.timeit),console.log("- tools",this.tools),console.log("- glass",this.glass),console.log("- transparent",this.transparent),console.log("- zoom",this.zoom),console.log("- zoom0",this.controls.getZoom0()),console.log("- zoomSpeed",this.zoomSpeed)}_renderTessellatedShapes(t){const e=new Lm(t,this.cadWidth,this.height,this.edgeColor,this.transparent,this.defaultOpacity,this.metalness,this.roughness,this.normalLen);return t.bb&&(this.bbox=new wm(new vi(t.bb.xmin,t.bb.ymin,t.bb.zmin),new vi(t.bb.xmax,t.bb.ymax,t.bb.zmax))),e.render(),e}_getTree(t){const e=t=>{var i={};for(var n of t)null!=n.parts?i[n.name]=e(n.parts):i[n.name]=n.state;return i};var i={};return i[t.name]=e(t.parts),i}_decompose(t){const e=t.shape;var i;if(t.parts=[],"shapes"==t.type){var n,s={parts:[],loc:[[0,0,0],[0,0,0,1]],name:"faces",id:`${t.id}/faces`};const d=e.vertices,u=e.normals,p=e.triangles_per_face?e.triangles_per_face.length:e.triangles.length;var r=0;for(i=0;i<p;i++){e.triangles_per_face?(n=e.triangles.subarray(r,r+3*e.triangles_per_face[i]),r+=3*e.triangles_per_face[i]):n=e.triangles[i];for(var a=new Float32Array(3*n.length),o=new Float32Array(3*n.length),l=0;l<n.length;l++){var c=n[l];a[3*l]=d[3*c],a[3*l+1]=d[3*c+1],a[3*l+2]=d[3*c+2],o[3*l]=u[3*c],o[3*l+1]=u[3*c+1],o[3*l+2]=u[3*c+2]}var h={loc:[[0,0,0],[0,0,0,1]],name:`faces_${i}`,id:`${t.id}/faces/faces_${i}`,type:"shapes",color:t.color,alpha:t.alpha,renderback:!0,state:[1,3],accuracy:t.accuracy,bb:{},geomtype:e.face_types[i],subtype:t.subtype,exploded:!0,shape:{triangles:[...Array(n.length).keys()],vertices:a,normals:o,edges:[]}};t.texture&&(h.texture=t.texture),s.parts.push(h)}t.parts.push(s)}if("shapes"==t.type||"edges"==t.type){s={parts:[],loc:[[0,0,0],[0,0,0,1]],name:"edges",id:`${t.id}/edges`};const n=Array.isArray(t.color)&&t.color.length==e.edges.length;var d;const a=e.segments_per_edge?e.segments_per_edge.length:e.edges.length;var u;for(r=0,i=0;i<a;i++)e.segments_per_edge?(u=e.edges.subarray(r,r+6*e.segments_per_edge[i]),r+=6*e.segments_per_edge[i]):u=e.edges[i],d=n?t.color[i]:t.color,h={loc:[[0,0,0],[0,0,0,1]],name:`edges_${i}`,id:`${t.id}/edges/edges_${i}`,type:"edges",color:"shapes"==t.type?this.edgeColor:d,state:[3,1],width:"shapes"==t.type?1:t.width,bb:{},geomtype:e.edge_types[i],shape:{edges:u}},s.parts.push(h);s.parts.length>0&&t.parts.push(s)}s={parts:[],loc:[[0,0,0],[0,0,0,1]],name:"vertices",id:`${t.id}/vertices`};var p=e.obj_vertices;for(i=0;i<p.length/3;i++)h={loc:[[0,0,0],[0,0,0,1]],name:`vertices${i}`,id:`${t.id}/vertices/vertices${i}`,type:"vertices",color:"shapes"==t.type||"edges"==t.type?this.edgeColor:t.color,state:[3,1],size:"shapes"==t.type||"edges"==t.type?4:t.size,bb:{},shape:{obj_vertices:[p[3*i],p[3*i+1],p[3*i+2]]}},s.parts.push(h);return s.parts.length>0&&t.parts.push(s),delete t.shape,delete t.color,delete t.alpha,delete t.accuracy,delete t.renderBack,t}renderTessellatedShapes(t,e){const i=t=>{var e,n;if(2==t.version||3==t.version){var s,r;let a=[];for(s=0;s<t.parts.length;s++)null!=(e=t.parts[s]).shape&&(null==(n=e.shape).triangles||n.triangles instanceof Uint32Array||(n.triangles=new Uint32Array(n.triangles)),null==n.edges||n.edges instanceof Float32Array||(n.edges=new Float32Array(up(n.edges,3))),null==n.vertices||n.vertices instanceof Float32Array||(n.vertices=new Float32Array(n.vertices)),null==n.normals||n.normals instanceof Float32Array||(n.normals=new Float32Array(up(n.normals,2))),null==n.obj_vertices||n.obj_vertices instanceof Float32Array||(n.obj_vertices=new Float32Array(n.obj_vertices)),null==n.face_types||n.face_types instanceof Uint32Array||(n.face_types=new Uint32Array(n.face_types)),null==n.edge_types||n.edge_types instanceof Uint32Array||(n.edge_types=new Uint32Array(n.edge_types)),null==n.triangles_per_face||n.triangles_per_face instanceof Uint32Array||(n.triangles_per_face=new Uint32Array(n.triangles_per_face)),null==n.segments_per_edge||n.segments_per_edge instanceof Uint32Array||(n.segments_per_edge=new Uint32Array(n.segments_per_edge))),null!=e.parts?(r=i(e),a.push(r)):a.push(this._decompose(e));t.parts=a}return t};var n;return n=t?i(structuredClone(e)):structuredClone(e),{group:this._renderTessellatedShapes(n),tree:this._getTree(n)}}addAnimationTrack(t,e,i,n){this.animation.addTrack(t,this.nestedGroup.groups[t],e,i,n)}initAnimation(t,e,i="A",n=!0){null!=this.animation&&0!=this.animation.tracks.lenght?(console.debug("three-cad-viewer: Animation initialized"),this.hasAnimationLoop||this.toggleAnimationLoop(!0),this.display.showAnimationControl(!0),this.clipAction=this.animation.animate(this.nestedGroup.rootGroup,t,e,n),this.display.setAnimationLabel(i),this.display.resetAnimationSlider()):console.error("Animation does not have tracks")}hasAnimation(){return!!this.animation.clipAction}clearAnimation(){this.animation&&this.animation.dispose(),this.display.showAnimationControl(!1),this.toggleAnimationLoop(!1)}checkChanges=(t,e=!0)=>{var i={};Object.keys(t).forEach((e=>{if(!pp(this.lastNotification[e],t[e])){var n=dp(t[e]);i[e]={new:n,old:null==this.lastNotification[e]?null:dp(this.lastNotification[e])},this.lastNotification[e]=n}})),Object.keys(i).includes("position")&&(this.keepHighlight?this.keepHighlight=!1:this.display.clearHighlights()),e&&this.notifyCallback&&Object.keys(i).length&&this.notifyCallback(i)};notifyStates=()=>{this.checkChanges({states:this.getStates()},!0)};update=(t,e=!0)=>{this.ready&&(this.renderer.clear(),this.raycaster&&this.raycaster.raycastMode&&this.handleRaycast(),this.renderer.setViewport(0,0,this.cadWidth,this.height),this.renderer.render(this.scene,this.camera.getCamera()),this.cadTools.update(),this.directLight.position.copy(this.camera.getCamera().position),null!=this.lastBbox&&(this.lastBbox.needsUpdate||this.bboxNeedsUpdate)&&(console.log("updated bbox"),this.lastBbox.bbox.update(),this.lastBbox.needsUpdate=!1),t&&(this.renderer.clearDepth(),this.orientationMarker.update(this.camera.getPosition().clone().sub(this.controls.getTarget()),this.camera.getQuaternion()),this.orientationMarker.render(this.renderer)),this.animation&&this.animation.update(),this.checkChanges({zoom:this.camera.getZoom(),position:this.camera.getPosition().toArray(),quaternion:this.camera.getQuaternion().toArray(),target:this.controls.getTarget().toArray()},e))};animate=()=>{this.continueAnimation?(requestAnimationFrame(this.animate),this.controls.update(),this.update(!0,!0)):console.debug("three-cad-viewer: Animation loop stopped")};toggleAnimationLoop(t){t?(this.continueAnimation=!0,this.hasAnimationLoop=!0,this.controls.removeChangeListener(),console.debug("three-cad-viewer: Change listener removed"),this.animate(),console.debug("three-cad-viewer: Animation loop started")):(this.hasAnimationLoop&&console.debug("three-cad-viewer: Turning animation loop off"),this.continueAnimation=!1,this.hasAnimationLoop=!1,this.controls.addChangeListener((()=>this.update(!0,!0))),console.debug("three-cad-viewer: Change listener registered"),setTimeout((()=>this.update(!0,!0)),50))}dispose(){if(this.clear(),gp(this.shapes),this.shapes=null,null!=this.expandedNestedGroup&&(this.expandedNestedGroup.dispose(),this.expandedNestedGroup=null),null!=this.compactNestedGroup&&(this.compactNestedGroup.dispose(),this.compactNestedGroup=null),null!=this.nestedGroup&&(this.nestedGroup.dispose(),this.nestedGroup=null),this.gridHelper)for(var t in this.gridHelper.gridHelper)this.gridHelper.gridHelper[t].dispose(),this.gridHelper.gridHelper[t]=null;null!=this.orientationMarker&&this.orientationMarker.dispose(),null!=this.renderer&&(this.renderer.renderLists.dispose(),this.renderer.getContext("webgl2").getExtension("WEBGL_lose_context").loseContext(),console.debug("three-cad-viewer: WebGL context disposed"),this.renderer=null),this.ambientLight.dispose(),this.ambientLight=null,this.directLight.dispose(),this.directLight=null,this.materialSettings=null,this.clipping=null,this.camera=null,this.gridHelper=null,this.axesHelper=null,this.controls=null,this.orientationMarker=null,this.compactTree=null,this.cadTools.dispose(),this.cadTools=null,this.clipAction=null,this.treeview.dispose(),this.treeview=null,this.animation=null,this.clipNormals=null,this.lastNotification=null,this.orthographicCamera=null,this.clipNormal0=null,this.clipNormal1=null,this.clipNormal2=null,this.display=null,this.renderOptions=null,this.mouse=null,this.tree=null,this.info=null,this.bbox=null,this.keymap=null,this.raycaster&&(this.raycaster.dispose(),this.raycaster=null)}clear(){if(null!=this.scene){for(var t in this.hasAnimationLoop=!1,this.continueAnimation=!1,this.hasAnimationLoop||(this.controls.removeChangeListener(),console.debug("three-cad-viewer: Change listener removed")),this.hasAnimationLoop=!1,this.display.showAnimationControl(!1),null!=this.animation&&this.animation.dispose(),this.display.setExplodeCheck(!1),this.display.setExplode("",!1),this.renderer.clear(),this.cadTools&&(this.cadTools.disable(),null!=this.display.currentButton&&(this.display.toolbarButtons[this.display.currentButton].set(!1),this.display.setTool(this.display.currentButton,!1))),this.scene.children)null!=this.scene.children[t]&&(this.scene.children[t].dispose(),this.scene.children[t]=null);this.clipping.dispose(),this.clipping=null,this.display.clearCadTree(),this.info.dispose(),this.camera.dispose(),this.controls.dispose(),this.scene=null,this.ready=!1}}syncTreeStates=(t,e,i,n)=>{if(Array.isArray(t))if(i)for(var s in e)for(var r in e[s]){const i=`${n}/${s}/${r}`,o=this.expandedNestedGroup.groups[i];for(var a of[0,1])0==a?o.setShapeVisible(1==t[0]):o.setEdgesVisible(1==t[1]),3!=e[s][r][a]&&(e[s][r][a]=t[a])}else{const i=this.compactNestedGroup.groups[n];for(var a of[0,1]){var o=!1;for(var s in e)for(var r in e[s])1==e[s][r][a]&&(o=!0);0==a?i.setShapeVisible(o):i.setEdgesVisible(o),3!=t[a]&&(t[a]=o?1:0)}}else for(var l in t){var c=`${n}/${l}`;this.syncTreeStates(t[l],e[l],i,c)}};toggleGroup(t){var e,i=new Nm("toggleGroup",this.timeit),n=()=>{this.nestedGroup.setTransparent(this.transparent),this.nestedGroup.setBlackEdges(this.blackEdges),this.nestedGroup.setMetalness(this.metalness),this.nestedGroup.setRoughness(this.roughness),this.nestedGroup.setPolygonOffset(2)};null==this.compactNestedGroup&&!t||null==this.expandedNestedGroup&&t?(this.setRenderDefaults(this.renderOptions),t?null==this.expandedNestedGroup&&(e=this.renderTessellatedShapes(t,this.shapes),this.nestedGroup=e.group,this.expandedNestedGroup=e.group,n(),this.expandedTree=e.tree):null==this.compactNestedGroup&&(e=this.renderTessellatedShapes(t,this.shapes),this.nestedGroup=e.group,this.compactNestedGroup=e.group,n(),this.compactTree=e.tree),i.split(`rendered${t?" exploded":" compact"} shapes`)):(this.nestedGroup=t?this.expandedNestedGroup:this.compactNestedGroup,n());this.expandedTree&&this.syncTreeStates(this.compactTree,this.expandedTree,t,""),i.split("synched tree states"),this.tree=t?this.expandedTree:this.compactTree,this.scene.children[0]=this.nestedGroup.rootGroup,i.split("added shapes to scene"),this.treeview=new Vm(this.tree,this.display.cadTreeScrollContainer,this.setObject,this.handlePick,this.update,this.notifyStates,this.theme,this.newTreeBehavior,!1),this.display.clearCadTree();const s=this.treeview.create();i.split("created tree"),this.display.addCadTree(s),this.treeview.render(),i.split("rendered tree"),i.stop()}toggleTab(t){var e=new Nm("toggleTab",this.timeit);switch(this.display.selectTabByName("tree"),e.split("collapse tree"),this.collapse){case 0:this.treeview.expandAll();break;case 1:this.treeview.openLevel(-1);break;case 2:this.treeview.collapseAll();break;case 3:this.treeview.openLevel(1)}this.checkChanges({states:this.getStates()},!0),e.split("notify state changes"),e.stop(),this.display.toggleClippingTab(!t)}render(t,e,i){this.shapes=t,this.renderOptions=e,this.setViewerDefaults(i),this.animation.cleanBackup();const n=new Nm("viewer",this.timeit);this.scene=new js,this.toggleGroup(!1),n.split("scene and tree done"),this.bbox||(this.bbox=this.nestedGroup.boundingBox());const s=new vi;this.bbox.getCenter(s),this.bb_max=this.bbox.max_dist_from_center(),this.bb_radius=Math.max(this.bbox.boundingSphere().radius,s.length()),n.split("bounding box"),this.info=new ef(this.display.cadInfo,this.theme),this.camera=new hf(this.cadWidth,this.height,this.bb_radius,null==i.target?this.bbox.center():i.target,this.ortho,i.up),this.orthographicCamera=new ic(-10,10,-10,10,0,100),this.orthographicCamera.position.z=50,this.orthographicCamera.up=this.camera.up,this.controls=new of(this.control,this.camera.getCamera(),null==i.target?this.bbox.center():i.target,this.renderer.domElement,this.rotateSpeed,this.zoomSpeed,this.panSpeed),this.controls.enableKeys=!1,this.controls.controls.screenSpacePanning=!0,null==i.position&&null==i.quaternion?(this.presetCamera("iso",this.zoom),this.display.highlightButton("iso")):null!=i.position?(this.setCamera(!1,i.position,i.quaternion,this.zoom),null==i.quaternion&&this.camera.lookAtTarget()):(this.info.addHtml("<b>quaternion needs position to be provided, falling back to ISO view</b>"),this.presetCamera("iso",this.zoom)),this.controls.update(),this.controls.saveState(),this.ambientLight=new rc(16777215,vp(this.ambientIntensity)),this.scene.add(this.ambientLight),this.directLight=new sc(16777215,vp(this.directIntensity)),this.scene.add(this.directLight),this.setAmbientLight(this.ambientIntensity),this.setDirectLight(this.directIntensity),this.gridHelper=new Im(this.display,this.bbox,this.ticks,this.centerGrid,this.axes0,this.grid,"Z"==i.up,this.theme),this.gridHelper.computeGrid();for(var r=0;r<3;r++)this.scene.add(this.gridHelper.gridHelper[r]);this.gridSize=this.gridHelper.size,this.axesHelper=new Um(this.bbox.center(),this.gridSize/2,2,this.cadWidth,this.height,this.axes0,this.axes,this.theme),this.scene.add(this.axesHelper);const a=1.1*Math.max(Math.abs(this.bbox.min.length()),Math.abs(this.bbox.max.length()));this.clipping=new Km(this.bbox.center(),2*a,this.nestedGroup,this.display,this.theme),this.display.setSliderLimits(this.gridSize/2,this.bbox.center()),this.setClipNormal(0,i.clipNormal0,!0),this.setClipNormal(1,i.clipNormal1,!0),this.setClipNormal(2,i.clipNormal2,!0),this.clipSlider0=null!=i.clipSlider0?i.clipSlider0:this.gridSize/2,this.clipSlider1=null!=i.clipSlider1?i.clipSlider1:this.gridSize/2,this.clipSlider2=null!=i.clipSlider2?i.clipSlider2:this.gridSize/2,this.setClipSlider(0,this.clipSlider0,!0),this.setClipSlider(1,this.clipSlider1,!0),this.setClipSlider(2,this.clipSlider2,!0),this.setClipIntersection(i.clipIntersection,!0),this.setClipObjectColorCaps(i.clipObjectColors,!0),this.setClipPlaneHelpersCheck(i.clipPlaneHelpers,!0),this.scene.add(this.clipping.planeHelpers),this.nestedGroup.setClipPlanes(this.clipping.clipPlanes),this.setLocalClipping(!1),this.clipping.setVisible(!1),this.toggleTab(!1),this.display.metalnessSlider.setValue(100*this.metalness),this.display.roughnessSlider.setValue(100*this.roughness),this.display.ambientlightSlider.setValue(100*this.ambientIntensity),this.display.directionallightSlider.setValue(100*this.directIntensity);const o="dark"===this.theme||"browser"===this.theme&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";this.orientationMarker=new Dm(80,80,this.camera.getCamera(),o),this.orientationMarker.create(),this.display.updateUI(this.axes,this.axes0,this.ortho,this.transparent,this.blackEdges,this.tools,this.glass),n.split("ui updated"),this.display.autoCollapse(),n.split("stencil done"),this.toggleAnimationLoop(this.hasAnimationLoop),this.display.showMeasureTools(i.measureTools),this.ready=!0,this.info.readyMsg(this.gridHelper.ticks,this.control),n.split("show done"),this.notifyCallback&&this.notifyCallback({tab:{old:null,new:this.display.activeTab},target:{old:null,new:this.controls.target},target0:{old:null,new:this.controls.target0},clip_normal_0:{old:null,new:this.clipNormal0},clip_normal_1:{old:null,new:this.clipNormal1},clip_normal_2:{old:null,new:this.clipNormal2}}),n.split("notification done"),this.update(!0,!1),this.treeview.update(),n.split("update done"),n.stop()}setCamera=(t,e,i=null,n=null,s=!0)=>{this.camera.setupCamera(t,new vi(...e),null!=i?new gi(...i):null,n,s),this.update(!0,s)};presetCamera=(t,e=null,i=!0)=>{this.camera.target=new vi(...this.bbox.center()),this.camera.presetCamera(t,e,i),this.controls.setTarget(this.camera.target),this.update(!0,i)};getCameraType(){return this.camera.ortho?"ortho":"perspective"}switchCamera(t,e=!0){this.ortho=t,this.camera.switchCamera(t,e),this.controls.setCamera(this.camera.getCamera()),this.display.setOrthoCheck(t),this.checkChanges({ortho:t},e),this.update(!0,e)}recenterCamera(t=!0){const e=this.camera.getCamera(),i=new vi,n=this.bbox.center();i.fromArray(n);const s=new vi,r=this.controls.target;s.fromArray(r),this.camera.camera_distance=5*this.bb_radius,e.position.sub(s).add(i),this.controls.controls.target=i;let a=new vi;e.getWorldDirection(a);let o=i.clone().add(a.normalize().multiplyScalar(-this.camera.camera_distance));e.position.set(o.x,o.y,o.z),this.update(!0,t)}resize=()=>{this.camera.setZoom(1),this.camera.updateProjectionMatrix(),this.update(!0)};reset=()=>{this.controls.reset(),this.update(!0)};setLocalClipping(t){this.renderer.localClippingEnabled=t,this.update(this.updateMarker)}setObject=(t,e,i,n=!0,s=!0)=>{var r=this.nestedGroup.groups[t];null!=r&&r instanceof Am&&(0==i?r.setShapeVisible(1===e):r.setEdgesVisible(1===e),n&&this.getState(t),s&&this.update(this.updateMarker))};setBoundingBox=t=>{var e=this.nestedGroup.groups[t];null!=e&&(null!=this.lastBbox&&this.scene.remove(this.lastBbox.bbox),null==this.lastBbox||null!=this.lastBbox&&t!=this.lastBbox.id?(this.lastBbox={id:t,bbox:new bm(e,16711935),needsUpdate:!1},this.scene.add(this.lastBbox.bbox)):this.lastBbox=null,this.update(!1,!1,!1))};refreshPlane=(t,e)=>{this.clipping.setConstant(t,e),this.update(this.updateMarker)};backupAnimation(){this.animation.hasTracks()&&(this.backupTracks=this.animation.backup())}restoreAnimation(){if(this.animation.hasBackup()){var t=this.animation.restore();this.initAnimation(t.duration,t.speed,"A",t.repeat)}}controlAnimation=t=>{switch(t){case"play":this.clipAction.paused&&(this.clipAction.paused=!1),this.clipAction.play();break;case"pause":this.clipAction.paused=!this.clipAction.paused;break;case"stop":this.clipAction.stop()}};setState=(t,e,i="leaf",n=!0)=>{this.treeview.setState(t,e),this.update(this.updateMarker,n)};removeLastBbox(){null!=this.lastBbox&&(this.scene.remove(this.lastBbox.bbox),this.lastBbox=null)}handlePick=(t,e,i,n,s,r,a="leaf")=>{const o=`${t}/${e}`,l=this.nestedGroup.groups[o];if(null!=l){var c;if(null!=l.parent)c=(new wm).setFromObject(l,!0);else{c=new wm;for(var h=0;h<l.children.length-1;h++)c=c.expandByObject(l.children[h])}if(null==this.lastBbox||this.lastBbox.id!==o||i||n)if(this.checkChanges({lastPick:{path:t,name:e,boundingBox:c,boundingSphere:c.boundingSphere()}}),this.animation.clipAction?.isRunning()&&(this.bboxNeedsUpdate=!0),n&&i)this.removeLastBbox(),this.treeview.openPath(o),this.setCameraTarget(r),this.info.centerInfo(center);else if(n){this.removeLastBbox(),this.treeview.hideAll(),this.setState(o,[1,1],a);const t=c.center();this.treeview.openPath(o),this.setCameraTarget(new vi(...t)),this.info.centerInfo(t)}else i?this.setState(o,[0,0],a):(this.info.bbInfo(t,e,c),this.setBoundingBox(o),this.treeview.openPath(o));else this.removeLastBbox(),this.treeview.toggleLabelColor(null,o);this.update(!0)}};setPickHandler(t){t?this.renderer.domElement.addEventListener("dblclick",this.pick,!1):this.renderer.domElement.removeEventListener("dblclick",this.pick,!1)}pick=t=>{const e=new Kp(this.camera,this.renderer.domElement,this.cadWidth,this.height,this.bb_max/30,this.scene.children.slice(0,1),(t=>{}));e.init(),e.onPointerMove(t);const i=e.getIntersectedObjs(t);if(0==i.length)return;var n=i[0];const s={path:n.object.parent.parent.name.replaceAll("|","/"),name:n.object.name,boundingBox:n.object.geometry.boundingBox,boundingSphere:n.object.geometry.boundingSphere,objectGroup:n.object.parent};null!=s&&this.handlePick(s.path,s.name,_p.get(t,"meta"),_p.get(t,"shift"),_p.get(t,"alt"),n.point),e.dispose()};clearSelection=()=>{this.nestedGroup.clearSelection(),this.cadTools.handleResetSelection()};_releaseLastSelected=t=>{if(null!=this.lastObject){let e=this.lastObject.objs();for(let t of e)t.unhighlight(!0);t&&(this.lastObject=null)}};_removeLastSelected=()=>{if(null!=this.lastSelection){let t=this.lastSelection.objs();for(let e of t)e.unhighlight(!1),this.treeview.toggleLabelColor(null,e.name.replaceAll(this.nestedGroup.delim,"/"));this.lastSelection=null,this.cadTools.handleRemoveLastSelection(),this.lastObject=null}else this.cadTools.handleRemoveLastSelection(!0)};setRaycastMode(t){t?(this.raycaster=new Kp(this.camera,this.renderer.domElement,this.cadWidth,this.height,this.bb_max/30,this.scene.children.slice(0,1),this.handleRaycastEvent),this.raycaster.init()):(this.raycaster&&this.raycaster.dispose(),this.raycaster=null)}handleRaycast=()=>{const t=this.raycaster.getValidIntersectedObjs();if(t.length>0)for(var e of t){const t=e.object.parent;var i=t?t.name:null,n=this.lastObject?this.lastObject.obj.name:null;if(null!=i&&i!==n){this._releaseLastSelected(!1);const e=this.raycaster.filters.topoFilter.includes(Wp.solid),i=new $p(t,e);for(let t of i.objs())t.highlight(!0);this.lastObject=i}break}else null!=this.lastObject&&this._releaseLastSelected(!0)};handleRaycastEvent=t=>{if(t.key)switch(t.key){case"Escape":this.clearSelection();break;case"Backspace":this._removeLastSelected()}else switch(t.mouse){case"left":if(null!=this.lastObject){const e=this.lastObject.objs();for(let t of e)t.toggleSelection();this.lastSelection?.obj.name!=this.lastObject.obj.name&&this.cadTools.handleRemoveLastSelected(),this.cadTools.handleSelectedObj(this.lastObject),t.shift&&this.treeview.openPath(this.lastObject.obj.name.replaceAll(this.nestedGroup.delim,"/")),this.lastSelection=this.lastObject}break;case"right":this._removeLastSelected()}};handleBackendResponse=t=>{"tool_response"===t.subtype&&this.cadTools.handleResponse(t)};getAxes(){return this.axes}setAxes=(t,e=!0)=>{this.axes=t,this.axesHelper.setVisible(t),this.display.setAxesCheck(t),this.checkChanges({axes:t},e),this.update(this.updateMarker)};setGrid=(t,e,i=!0)=>{this.gridHelper.setGrid(t,e),this.checkChanges({grid:this.gridHelper.grid},i),this.update(this.updateMarker)};getGrids(){return this.grid}setGrids=(t,e=!0)=>{this.gridHelper.setGrids(...t),this.grid=this.gridHelper.grid,this.checkChanges({grid:this.gridHelper.grid},e),this.update(this.updateMarker)};setGridCenter=(t,e=!0)=>{this.gridHelper.centerGrid=t,this.gridHelper.setCenter(this.axes0,"Z"==this.up),this.checkChanges({gridCenter:this.gridHelper.centerGrid},e),this.update(this.updateMarker)};getAxes0(){return this.axes0}setAxes0=(t,e=!0)=>{this.axes0=t,this.gridHelper.setCenter(t,"Z"==this.up),this.display.setAxes0Check(t),this.axesHelper.setCenter(t),this.checkChanges({axes0:t},e),this.update(this.updateMarker)};getMetalness=()=>this.metalness;setMetalness=(t,e=!0)=>{this.metalness=t,this.nestedGroup.setMetalness(t),this.checkChanges({metalness:t},e),this.update(this.updateMarker)};getRoughness=()=>this.roughness;setRoughness=(t,e=!0)=>{this.roughness=t,this.nestedGroup.setRoughness(t),this.checkChanges({roughness:t},e),this.update(this.updateMarker)};resetMaterial=()=>{this.setMetalness(this.materialSettings.metalness,!0),this.display.setMetalness(this.materialSettings.metalness),this.setRoughness(this.materialSettings.roughness,!0),this.display.setRoughness(this.materialSettings.roughness),this.setAmbientLight(this.materialSettings.ambientIntensity,!0),this.display.setAmbientLight(this.materialSettings.ambientIntensity),this.setDirectLight(this.materialSettings.directIntensity,!0),this.display.setDirectLight(this.materialSettings.directIntensity)};getTransparent(){return this.transparent}setTransparent=(t,e=!0)=>{this.transparent=t,this.nestedGroup.setTransparent(t),this.display.setTransparentCheck(t),this.checkChanges({transparent:t},e),this.update(this.updateMarker)};getBlackEdges(){return this.blackEdges}setBlackEdges=(t,e=!0)=>{this.blackEdges=t,this.nestedGroup.setBlackEdges(t),this.display.setBlackEdgesCheck(t),this.checkChanges({black_edges:t},e),this.update(this.updateMarker)};getOrtho(){return this.camera.ortho}setOrtho(t,e=!0){this.switchCamera(t,e)}getCameraZoom(){return this.camera.getZoom()}setCameraZoom(t,e=!0){this.camera.setZoom(t),this.controls.update(),this.update(!0,e)}getCameraPosition(){return this.camera.getPosition().toArray()}setCameraPosition(t,e=!1,i=!0){this.camera.setPosition(t,e),this.controls.update(),this.update(!0,i)}getCameraQuaternion(){return this.camera.getQuaternion().toArray()}setCameraQuaternion(t,e=!0){this.camera.setQuaternion(t),this.controls.update(),this.update(!0,e)}getCameraTarget(){return this.controls.getTarget().toArray()}setCameraTarget(t,e=!0){this.camera.getCamera().lookAt(new vi(...t)),this.controls.setTarget(new vi(...t)),this.controls.update(),this.update(!0,e)}getCameraLocationSettings(){return{position:this.getCameraPosition(),quaternion:this.getCameraQuaternion(),target:this.getCameraTarget(),zoom:this.getCameraZoom()}}setCameraLocationSettings(t=null,e=null,i=null,n=null,s=!0){null!=t&&this.camera.setPosition(t,!1),null!=e&&"trackball"===this.control&&this.camera.setQuaternion(e),null!=i&&this.controls.setTarget(new vi(...i)),null!=n&&this.camera.setZoom(n),this.controls.update(),this.update(!0,s)}getEdgeColor(){return this.edgeColor}setEdgeColor=(t,e=!0)=>{this.edgeColor=t,this.nestedGroup.setEdgeColor(t),this.update(this.updateMarker,e)};getOpacity(){return this.defaultOpacity}setOpacity=(t,e=!0)=>{this.defaultOpacity=t,this.nestedGroup.setOpacity(t),this.update(this.updateMarker,e)};getTools(){return this.tools}showTools=(t,e=!0)=>{this.tools=t,this.display.showTools(t),this.update(this.updateMarker,e)};getAmbientLight(){return this.ambientIntensity}setAmbientLight=(t,e=!0)=>{this.ambientIntensity=t,this.ambientLight.intensity=vp(t),this.checkChanges({ambient_intensity:t},e),this.update(this.updateMarker,e)};getDirectLight(){return this.directIntensity}setDirectLight=(t,e=!0)=>{this.directIntensity=t,this.directLight.intensity=vp(t),this.checkChanges({direct_intensity:t},e),this.update(this.updateMarker,e)};getStates(){return this.treeview.getStates()}getState(t){var e=t.replaceAll("|","/");return this.treeview.getState(e)}setStates=t=>{this.treeview.setStates(t)};getZoomSpeed(){return this.zoomSpeed}setZoomSpeed=(t,e=!0)=>{this.zoomSpeed=t,this.controls.setZoomSpeed(t),this.checkChanges({grid:this.gridHelper.grid},e)};getPanSpeed(){return this.panSpeed}setPanSpeed=(t,e=!0)=>{this.panSpeed=t,this.controls.setPanSpeed(t),this.checkChanges({grid:this.gridHelper.grid},e)};getRotateSpeed(){return this.rotateSpeed}setRotateSpeed=(t,e=!0)=>{this.rotateSpeed=t,this.controls.setRotateSpeed(t),this.checkChanges({grid:this.gridHelper.grid},e)};getClipIntersection(){return this.clipIntersection}setClipIntersection=(t,e=!0)=>{if(null!=t){for(var i of(this.clipIntersection=t,this.nestedGroup.setClipIntersection(t),this.display.setClipIntersectionCheck(t),this.nestedGroup.rootGroup.children))if("PlaneMeshes"==i.name)for(var n of i.children)n.material.clippingPlanes=t?this.clipping.reverseClipPlanes.filter(((t,e)=>e!==n.index)):this.clipping.clipPlanes.filter(((t,e)=>e!==n.index));for(i of this.scene.children)if("PlaneHelpers"==i.name)for(var s of i.children)s.material.clippingPlanes=t?this.clipping.reverseClipPlanes.filter(((t,e)=>e!==s.index)):this.clipping.clipPlanes.filter(((t,e)=>e!==s.index));this.checkChanges({clip_intersection:t},e),this.update(this.updateMarker)}};getObjectColorCaps=()=>this.clipping.getObjectColorCaps();setClipObjectColorCaps=(t,e=!0)=>{null!=t&&(this.clipping.setObjectColorCaps(t),this.display.setClipObjectColorsCheck(t),this.checkChanges({clip_object_colors:t},e),this.update(this.updateMarker))};getClipPlaneHelpers(){return this.clipPlaneHelpers}setClipPlaneHelpersCheck(t){null!=t&&this.display.setClipPlaneHelpersCheck(t)}setClipPlaneHelpers=(t,e=!0)=>{null!=t&&(this.clipPlaneHelpers=t,this.clipping.planeHelpers.visible=t,this.display.setClipPlaneHelpersCheck(t),this.checkChanges({clip_planes:t},e),this.update(this.updateMarker))};getClipNormal(t){return this.clipNormals[t]}setClipNormal(t,e,i=!0){if(null==e)return;const n=new vi(...e).normalize().toArray();this.clipNormals[t]=n,this.clipping.setNormal(t,new vi(...n)),this.clipping.setConstant(t,this.gridSize/2),this.setClipSlider(t,this.gridSize/2);var s={};s[`clip_normal_${t}`]=n,this.checkChanges(s,i),this.nestedGroup.setClipPlanes(this.clipping.clipPlanes),this.update(this.updateMarker)}setClipNormalFromPosition=(t,e=!0)=>{const i=this.camera.getPosition().clone().sub(this.controls.getTarget()).normalize().negate().toArray();this.setClipNormal(t,i,e)};getClipSlider=t=>this.display.clipSliders[t].getValue();setClipSlider=(t,e,i=!0)=>{-1!=e&&null!=e&&this.display.clipSliders[t].setValue(e,i)};getResetLocation=()=>{const t=this.controls.getResetLocation();return{target0:t.target0.toArray(),position0:t.position0.toArray(),quaternion0:t.quaternion0.toArray(),zoom0:t.zoom0}};setResetLocation=(t,e,i,n,s=!0)=>{var r=this.getResetLocation();this.controls.setResetLocation(new vi(...t),new vi(...e),new di(...i),n),s&&this.notifyCallback&&this.notifyCallback({target0:{old:r.target0,new:t},position0:{old:r.position0,new:e},quaternion0:{old:r.quaternion0,new:i},zoom0:{old:r.zoom0,new:n}})};pinAsPng=()=>{this.getImage("screenshot").then((t=>{var e=document.createElement("img");if(e.width=this.cadWidth,e.height=this.height,e.src=t.dataUrl,null==this.pinAsPngCallback){for(var i of this.display.container.children)this.display.container.removeChild(i);this.display.container.appendChild(e)}}))};getImage=t=>{const e=this.hasAnimationLoop;return e||this.toggleAnimationLoop(!0),this.orientationMarker.setVisible(!1),this.update(!0),new Promise(((i,n)=>{const s=this.display.getCanvas();this.renderer.setViewport(0,0,this.cadWidth,this.height),this.renderer.render(this.scene,this.camera.getCamera()),s.toBlob((n=>{let s=new FileReader;s.addEventListener("load",(()=>{i({task:t,dataUrl:s.result}),e||this.toggleAnimationLoop(!1),this.orientationMarker.setVisible(!0),this.update(!0)}),{once:!0}),s.readAsDataURL(n)}))}))};explode(t=2,e=1,i=2.5){this.clearAnimation();const n=this.getAxes0();var s=new vi,r=new vi,a=null,o=null,l=null;n||(new xi).setFromObject(this.nestedGroup.rootGroup).getCenter(s);for(var c in this.nestedGroup.groups){var h=this.nestedGroup.groups[c],d=new xi;h instanceof Am&&d.expandByObject(h),d.isEmpty()||(d.getCenter(r),a=r.sub(s),o=h.parent.worldToLocal(a.clone()),(l=h.parent.worldToLocal(a.clone().multiplyScalar(i))).sub(o),this.addAnimationTrack(c,"t",[0,t],[[0,0,0],l.toArray()]))}this.initAnimation(t,e,"E",!1)}trimUI(t,e){var i=e?"inline-block":"none";for(var n of t){var s;["axes","axes0","grid","ortho","more","help"].includes(n)&&("more"!=n?((s=this.display._getElement(`tcv_${n}`)).style.display=i,"help"!==n&&(s.nextElementSibling.style.display=i)):(s=this.display._getElement(`tcv_${n}-dropdown`)).style.display=i)}}setKeyMap(t){const e=_p.get_config();_p.set(t),this.display.updateHelp(e,t)}resizeCadView(t,e,i,n=!1){this.cadWidth=t,this.height=i,this.renderer.setSize(t,i),this.display.setSizes({treeWidth:e,cadWidth:t,height:i}),this.display.glassMode(n);const s=t+(n?0:e);this.display.handleMoreButton(s),this.camera.changeDimensions(this.bb_radius,t,i),this.update(!0),this.raycaster&&(this.raycaster.width=t,this.raycaster.height=i)}vector3(t=0,e=0,i=0){return new vi(t,e,i)}quaternion(t=0,e=0,i=0,n=1){return new gi(t,e,i,n)}}}));
|
|
12
|
+
function Th(){let t=null,e=!1,i=null,n=null;function s(e,r){i(e,r),n=t.requestAnimationFrame(s)}return{start:function(){!0!==e&&null!==i&&(n=t.requestAnimationFrame(s),e=!0)},stop:function(){t.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function Eh(t){const e=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)},remove:function(i){i.isInterleavedBufferAttribute&&(i=i.data);const n=e.get(i);n&&(t.deleteBuffer(n.buffer),e.delete(i))},update:function(i,n){if(i.isInterleavedBufferAttribute&&(i=i.data),i.isGLBufferAttribute){const t=e.get(i);return void((!t||t.version<i.version)&&e.set(i,{buffer:i.buffer,type:i.type,bytesPerElement:i.elementSize,version:i.version}))}const s=e.get(i);if(void 0===s)e.set(i,function(e,i){const n=e.array,s=e.usage,r=n.byteLength,a=t.createBuffer();let o;if(t.bindBuffer(i,a),t.bufferData(i,n,s),e.onUploadCallback(),n instanceof Float32Array)o=t.FLOAT;else if(n instanceof Uint16Array)o=e.isFloat16BufferAttribute?t.HALF_FLOAT:t.UNSIGNED_SHORT;else if(n instanceof Int16Array)o=t.SHORT;else if(n instanceof Uint32Array)o=t.UNSIGNED_INT;else if(n instanceof Int32Array)o=t.INT;else if(n instanceof Int8Array)o=t.BYTE;else if(n instanceof Uint8Array)o=t.UNSIGNED_BYTE;else{if(!(n instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+n);o=t.UNSIGNED_BYTE}return{buffer:a,type:o,bytesPerElement:n.BYTES_PER_ELEMENT,version:e.version,size:r}}(i,n));else if(s.version<i.version){if(s.size!==i.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.");!function(e,i,n){const s=i.array,r=i.updateRanges;if(t.bindBuffer(n,e),0===r.length)t.bufferSubData(n,0,s);else{r.sort(((t,e)=>t.start-e.start));let e=0;for(let t=1;t<r.length;t++){const i=r[e],n=r[t];n.start<=i.start+i.count+1?i.count=Math.max(i.count,n.start+n.count-i.start):(++e,r[e]=n)}r.length=e+1;for(let e=0,i=r.length;e<i;e++){const i=r[e];t.bufferSubData(n,i.start*s.BYTES_PER_ELEMENT,s,i.start,i.count)}i.clearUpdateRanges()}i.onUploadCallback()}(s.buffer,i,n),s.version=i.version}}}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:e}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=e);const Ah={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#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",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#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",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#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",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#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",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"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",iridescence_fragment:"#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",bumpmap_pars_fragment:"#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",clipping_planes_fragment:"#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",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#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",color_vertex:"#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",common:"#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",cube_uv_reflection_fragment:"#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",defaultnormal_vertex:"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",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#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",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"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}",envmap_fragment:"#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",envmap_common_pars_fragment:"#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",envmap_pars_fragment:"#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",envmap_pars_vertex:"#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",envmap_physical_pars_fragment:"#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",envmap_vertex:"#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",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#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",fog_pars_fragment:"#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",gradientmap_pars_fragment:"#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}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"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",lights_pars_begin:"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",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"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",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"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",lights_physical_fragment:"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",lights_physical_pars_fragment:"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}",lights_fragment_begin:"\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",lights_fragment_maps:"#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",lights_fragment_end:"#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",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#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",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#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",map_particle_pars_fragment:"#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",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#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",morphcolor_vertex:"#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",morphnormal_vertex:"#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",morphtarget_pars_vertex:"#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",morphtarget_vertex:"#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",normal_fragment_begin:"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;",normal_fragment_maps:"#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",normal_pars_fragment:"#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",normal_pars_vertex:"#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",normal_vertex:"#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",normalmap_pars_fragment:"#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",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#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",clearcoat_pars_fragment:"#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",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"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}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"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;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#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",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#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",shadowmap_pars_vertex:"#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",shadowmap_vertex:"#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",shadowmask_pars_fragment:"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}",skinbase_vertex:"#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",skinning_pars_vertex:"#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",skinning_vertex:"#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",skinnormal_vertex:"#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",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#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; }",transmission_fragment:"#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",transmission_pars_fragment:"#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",uv_pars_fragment:"#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",uv_pars_vertex:"#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",uv_vertex:"#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",worldpos_vertex:"#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",background_vert:"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}",background_frag:"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}",backgroundCube_vert:"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}",backgroundCube_frag:"#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}",cube_vert:"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}",cube_frag:"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}",depth_vert:"#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}",depth_frag:"#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}",distanceRGBA_vert:"#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}",distanceRGBA_frag:"#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}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"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}",linedashed_vert:"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}",linedashed_frag:"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}",meshbasic_vert:"#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}",meshbasic_frag:"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}",meshlambert_vert:"#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}",meshlambert_frag:"#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}",meshmatcap_vert:"#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}",meshmatcap_frag:"#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}",meshnormal_vert:"#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}",meshnormal_frag:"#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}",meshphong_vert:"#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}",meshphong_frag:"#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}",meshphysical_vert:"#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}",meshphysical_frag:"#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}",meshtoon_vert:"#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}",meshtoon_frag:"#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}",points_vert:"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}",points_frag:"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}",shadow_vert:"#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}",shadow_frag:"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}",sprite_vert:"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}",sprite_frag:"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}"},Ch={common:{diffuse:{value:new zn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ge},alphaMap:{value:null},alphaMapTransform:{value:new Ge},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ge}},envmap:{envMap:{value:null},envMapRotation:{value:new Ge},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ge}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ge}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ge},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ge},normalScale:{value:new Ve(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ge},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ge}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ge}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ge}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new zn(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 zn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ge},alphaTest:{value:0},uvTransform:{value:new Ge}},sprite:{diffuse:{value:new zn(16777215)},opacity:{value:1},center:{value:new Ve(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ge},alphaMap:{value:null},alphaMapTransform:{value:new Ge},alphaTest:{value:0}}},Lh={basic:{uniforms:Es([Ch.common,Ch.specularmap,Ch.envmap,Ch.aomap,Ch.lightmap,Ch.fog]),vertexShader:Ah.meshbasic_vert,fragmentShader:Ah.meshbasic_frag},lambert:{uniforms:Es([Ch.common,Ch.specularmap,Ch.envmap,Ch.aomap,Ch.lightmap,Ch.emissivemap,Ch.bumpmap,Ch.normalmap,Ch.displacementmap,Ch.fog,Ch.lights,{emissive:{value:new zn(0)}}]),vertexShader:Ah.meshlambert_vert,fragmentShader:Ah.meshlambert_frag},phong:{uniforms:Es([Ch.common,Ch.specularmap,Ch.envmap,Ch.aomap,Ch.lightmap,Ch.emissivemap,Ch.bumpmap,Ch.normalmap,Ch.displacementmap,Ch.fog,Ch.lights,{emissive:{value:new zn(0)},specular:{value:new zn(1118481)},shininess:{value:30}}]),vertexShader:Ah.meshphong_vert,fragmentShader:Ah.meshphong_frag},standard:{uniforms:Es([Ch.common,Ch.envmap,Ch.aomap,Ch.lightmap,Ch.emissivemap,Ch.bumpmap,Ch.normalmap,Ch.displacementmap,Ch.roughnessmap,Ch.metalnessmap,Ch.fog,Ch.lights,{emissive:{value:new zn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ah.meshphysical_vert,fragmentShader:Ah.meshphysical_frag},toon:{uniforms:Es([Ch.common,Ch.aomap,Ch.lightmap,Ch.emissivemap,Ch.bumpmap,Ch.normalmap,Ch.displacementmap,Ch.gradientmap,Ch.fog,Ch.lights,{emissive:{value:new zn(0)}}]),vertexShader:Ah.meshtoon_vert,fragmentShader:Ah.meshtoon_frag},matcap:{uniforms:Es([Ch.common,Ch.bumpmap,Ch.normalmap,Ch.displacementmap,Ch.fog,{matcap:{value:null}}]),vertexShader:Ah.meshmatcap_vert,fragmentShader:Ah.meshmatcap_frag},points:{uniforms:Es([Ch.points,Ch.fog]),vertexShader:Ah.points_vert,fragmentShader:Ah.points_frag},dashed:{uniforms:Es([Ch.common,Ch.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ah.linedashed_vert,fragmentShader:Ah.linedashed_frag},depth:{uniforms:Es([Ch.common,Ch.displacementmap]),vertexShader:Ah.depth_vert,fragmentShader:Ah.depth_frag},normal:{uniforms:Es([Ch.common,Ch.bumpmap,Ch.normalmap,Ch.displacementmap,{opacity:{value:1}}]),vertexShader:Ah.meshnormal_vert,fragmentShader:Ah.meshnormal_frag},sprite:{uniforms:Es([Ch.sprite,Ch.fog]),vertexShader:Ah.sprite_vert,fragmentShader:Ah.sprite_frag},background:{uniforms:{uvTransform:{value:new Ge},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ah.background_vert,fragmentShader:Ah.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ge}},vertexShader:Ah.backgroundCube_vert,fragmentShader:Ah.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ah.cube_vert,fragmentShader:Ah.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ah.equirect_vert,fragmentShader:Ah.equirect_frag},distanceRGBA:{uniforms:Es([Ch.common,Ch.displacementmap,{referencePosition:{value:new vi},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ah.distanceRGBA_vert,fragmentShader:Ah.distanceRGBA_frag},shadow:{uniforms:Es([Ch.lights,Ch.fog,{color:{value:new zn(0)},opacity:{value:1}}]),vertexShader:Ah.shadow_vert,fragmentShader:Ah.shadow_frag}};Lh.physical={uniforms:Es([Lh.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ge},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ge},clearcoatNormalScale:{value:new Ve(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ge},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ge},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ge},sheen:{value:0},sheenColor:{value:new zn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ge},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ge},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ge},transmissionSamplerSize:{value:new Ve},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ge},attenuationDistance:{value:0},attenuationColor:{value:new zn(0)},specularColor:{value:new zn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ge},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ge},anisotropyVector:{value:new Ve},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ge}}]),vertexShader:Ah.meshphysical_vert,fragmentShader:Ah.meshphysical_frag};const kh={r:0,b:0,g:0},Rh=new sn,Ph=new Xi;function Ih(t,e,i,n,s,r,a){const o=new zn(0);let l,c,h=!0===r?0:1,d=null,u=0,p=null;function m(t){let n=!0===t.isScene?t.background:null;if(n&&n.isTexture){n=(t.backgroundBlurriness>0?i:e).get(n)}return n}function f(e,i){e.getRGB(kh,As(t)),n.buffers.color.setClear(kh.r,kh.g,kh.b,i,a)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),h=e,f(o,h)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,f(o,h)},render:function(e){let i=!1;const s=m(e);null===s?f(o,h):s&&s.isColor&&(f(s,1),i=!0);const r=t.xr.getEnvironmentBlendMode();"additive"===r?n.buffers.color.setClear(0,0,0,1,a):"alpha-blend"===r&&n.buffers.color.setClear(0,0,0,0,a),(t.autoClear||i)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))},addToRenderList:function(e,i){const n=m(i);n&&(n.isCubeTexture||n.mapping===z)?(void 0===c&&(c=new bs(new Ss(1,1,1),new Ls({name:"BackgroundCubeMaterial",uniforms:Ts(Lh.backgroundCube.uniforms),vertexShader:Lh.backgroundCube.vertexShader,fragmentShader:Lh.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(c)),Rh.copy(i.backgroundRotation),Rh.x*=-1,Rh.y*=-1,Rh.z*=-1,n.isCubeTexture&&!1===n.isRenderTargetTexture&&(Rh.y*=-1,Rh.z*=-1),c.material.uniforms.envMap.value=n,c.material.uniforms.flipEnvMap.value=n.isCubeTexture&&!1===n.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=i.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Ph.makeRotationFromEuler(Rh)),c.material.toneMapped=ei.getTransfer(n.colorSpace)!==ue,d===n&&u===n.version&&p===t.toneMapping||(c.material.needsUpdate=!0,d=n,u=n.version,p=t.toneMapping),c.layers.enableAll(),e.unshift(c,c.geometry,c.material,0,0,null)):n&&n.isTexture&&(void 0===l&&(l=new bs(new qo(2,2),new Ls({name:"BackgroundMaterial",uniforms:Ts(Lh.background.uniforms),vertexShader:Lh.background.vertexShader,fragmentShader:Lh.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(l)),l.material.uniforms.t2D.value=n,l.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,l.material.toneMapped=ei.getTransfer(n.colorSpace)!==ue,!0===n.matrixAutoUpdate&&n.updateMatrix(),l.material.uniforms.uvTransform.value.copy(n.matrix),d===n&&u===n.version&&p===t.toneMapping||(l.material.needsUpdate=!0,d=n,u=n.version,p=t.toneMapping),l.layers.enableAll(),e.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==c&&(c.geometry.dispose(),c.material.dispose(),c=void 0),void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}}}function Uh(t,e){const i=t.getParameter(t.MAX_VERTEX_ATTRIBS),n={},s=c(null);let r=s,a=!1;function o(e){return t.bindVertexArray(e)}function l(e){return t.deleteVertexArray(e)}function c(t){const e=[],n=[],s=[];for(let t=0;t<i;t++)e[t]=0,n[t]=0,s[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:s,object:t,attributes:{},index:null}}function h(){const t=r.newAttributes;for(let e=0,i=t.length;e<i;e++)t[e]=0}function d(t){u(t,0)}function u(e,i){const n=r.newAttributes,s=r.enabledAttributes,a=r.attributeDivisors;n[e]=1,0===s[e]&&(t.enableVertexAttribArray(e),s[e]=1),a[e]!==i&&(t.vertexAttribDivisor(e,i),a[e]=i)}function p(){const e=r.newAttributes,i=r.enabledAttributes;for(let n=0,s=i.length;n<s;n++)i[n]!==e[n]&&(t.disableVertexAttribArray(n),i[n]=0)}function m(e,i,n,s,r,a,o){!0===o?t.vertexAttribIPointer(e,i,n,r,a):t.vertexAttribPointer(e,i,n,s,r,a)}function f(){g(),a=!0,r!==s&&(r=s,o(r.object))}function g(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:function(i,s,l,f,g){let v=!1;const _=function(e,i,s){const r=!0===s.wireframe;let a=n[e.id];void 0===a&&(a={},n[e.id]=a);let o=a[i.id];void 0===o&&(o={},a[i.id]=o);let l=o[r];void 0===l&&(l=c(t.createVertexArray()),o[r]=l);return l}(f,l,s);r!==_&&(r=_,o(r.object)),v=function(t,e,i,n){const s=r.attributes,a=e.attributes;let o=0;const l=i.getAttributes();for(const e in l){if(l[e].location>=0){const i=s[e];let n=a[e];if(void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor)),void 0===i)return!0;if(i.attribute!==n)return!0;if(n&&i.data!==n.data)return!0;o++}}return r.attributesNum!==o||r.index!==n}(i,f,l,g),v&&function(t,e,i,n){const s={},a=e.attributes;let o=0;const l=i.getAttributes();for(const e in l){if(l[e].location>=0){let i=a[e];void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor));const n={};n.attribute=i,i&&i.data&&(n.data=i.data),s[e]=n,o++}}r.attributes=s,r.attributesNum=o,r.index=n}(i,f,l,g),null!==g&&e.update(g,t.ELEMENT_ARRAY_BUFFER),(v||a)&&(a=!1,function(i,n,s,r){h();const a=r.attributes,o=s.getAttributes(),l=n.defaultAttributeValues;for(const n in o){const s=o[n];if(s.location>=0){let o=a[n];if(void 0===o&&("instanceMatrix"===n&&i.instanceMatrix&&(o=i.instanceMatrix),"instanceColor"===n&&i.instanceColor&&(o=i.instanceColor)),void 0!==o){const n=o.normalized,a=o.itemSize,l=e.get(o);if(void 0===l)continue;const c=l.buffer,h=l.type,p=l.bytesPerElement,f=h===t.INT||h===t.UNSIGNED_INT||o.gpuType===tt;if(o.isInterleavedBufferAttribute){const e=o.data,l=e.stride,g=o.offset;if(e.isInstancedInterleavedBuffer){for(let t=0;t<s.locationSize;t++)u(s.location+t,e.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===r._maxInstanceCount&&(r._maxInstanceCount=e.meshPerAttribute*e.count)}else for(let t=0;t<s.locationSize;t++)d(s.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<s.locationSize;t++)m(s.location+t,a/s.locationSize,h,n,l*p,(g+a/s.locationSize*t)*p,f)}else{if(o.isInstancedBufferAttribute){for(let t=0;t<s.locationSize;t++)u(s.location+t,o.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===r._maxInstanceCount&&(r._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let t=0;t<s.locationSize;t++)d(s.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<s.locationSize;t++)m(s.location+t,a/s.locationSize,h,n,a*p,a/s.locationSize*t*p,f)}}else if(void 0!==l){const e=l[n];if(void 0!==e)switch(e.length){case 2:t.vertexAttrib2fv(s.location,e);break;case 3:t.vertexAttrib3fv(s.location,e);break;case 4:t.vertexAttrib4fv(s.location,e);break;default:t.vertexAttrib1fv(s.location,e)}}}}p()}(i,s,l,f),null!==g&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(g).buffer))},reset:f,resetDefaultState:g,dispose:function(){f();for(const t in n){const e=n[t];for(const t in e){const i=e[t];for(const t in i)l(i[t].object),delete i[t];delete e[t]}delete n[t]}},releaseStatesOfGeometry:function(t){if(void 0===n[t.id])return;const e=n[t.id];for(const t in e){const i=e[t];for(const t in i)l(i[t].object),delete i[t];delete e[t]}delete n[t.id]},releaseStatesOfProgram:function(t){for(const e in n){const i=n[e];if(void 0===i[t.id])continue;const s=i[t.id];for(const t in s)l(s[t].object),delete s[t];delete i[t.id]}},initAttributes:h,enableAttribute:d,disableUnusedAttributes:p}}function Dh(t,e,i){let n;function s(e,s,r){0!==r&&(t.drawArraysInstanced(n,e,s,r),i.update(s,n,r))}this.setMode=function(t){n=t},this.render=function(e,s){t.drawArrays(n,e,s),i.update(s,n,1)},this.renderInstances=s,this.renderMultiDraw=function(t,s,r){if(0===r)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,t,0,s,0,r);let a=0;for(let t=0;t<r;t++)a+=s[t];i.update(a,n,1)},this.renderMultiDrawInstances=function(t,r,a,o){if(0===a)return;const l=e.get("WEBGL_multi_draw");if(null===l)for(let e=0;e<t.length;e++)s(t[e],r[e],o[e]);else{l.multiDrawArraysInstancedWEBGL(n,t,0,r,0,o,0,a);let e=0;for(let t=0;t<a;t++)e+=r[t]*o[t];i.update(e,n,1)}}}function Nh(t,e,i,n){let s;function r(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"}let a=void 0!==i.precision?i.precision:"highp";const o=r(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=!0===i.logarithmicDepthBuffer,c=!0===i.reverseDepthBuffer&&e.has("EXT_clip_control"),h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),d=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==s)return s;if(!0===e.has("EXT_texture_filter_anisotropic")){const i=e.get("EXT_texture_filter_anisotropic");s=t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s},getMaxPrecision:r,textureFormatReadable:function(e){return e===ht||n.convert(e)===t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(i){const s=i===nt&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(i!==J&&n.convert(i)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&i!==it&&!s)},precision:a,logarithmicDepthBuffer:l,reverseDepthBuffer:c,maxTextures:h,maxVertexTextures:d,maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxCubemapSize:t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:t.getParameter(t.MAX_VERTEX_ATTRIBS),maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:t.getParameter(t.MAX_VARYING_VECTORS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:d>0,maxSamples:t.getParameter(t.MAX_SAMPLES)}}function Oh(t){const e=this;let i=null,n=0,s=!1,r=!1;const a=new zr,o=new Ge,l={value:null,needsUpdate:!1};function c(t,i,n,s){const r=null!==t?t.length:0;let c=null;if(0!==r){if(c=l.value,!0!==s||null===c){const e=n+4*r,s=i.matrixWorldInverse;o.getNormalMatrix(s),(null===c||c.length<e)&&(c=new Float32Array(e));for(let e=0,i=n;e!==r;++e,i+=4)a.copy(t[e]).applyMatrix4(s,o),a.normal.toArray(c,i),c[i+3]=a.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=r,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e){const i=0!==t.length||e||0!==n||s;return s=e,n=t.length,i},this.beginShadows=function(){r=!0,c(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(t,e){i=c(t,e,0)},this.setState=function(a,o,h){const d=a.clippingPlanes,u=a.clipIntersection,p=a.clipShadows,m=t.get(a);if(!s||null===d||0===d.length||r&&!p)r?c(null):function(){l.value!==i&&(l.value=i,l.needsUpdate=n>0);e.numPlanes=n,e.numIntersection=0}();else{const t=r?0:n,e=4*t;let s=m.clippingState||null;l.value=s,s=c(d,o,e,h);for(let t=0;t!==e;++t)s[t]=i[t];m.clippingState=s,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=t}}}function Bh(t){let e=new WeakMap;function i(t,e){return e===B?t.mapping=N:e===F&&(t.mapping=O),t}function n(t){const i=t.target;i.removeEventListener("dispose",n);const s=e.get(i);void 0!==s&&(e.delete(i),s.dispose())}return{get:function(s){if(s&&s.isTexture){const r=s.mapping;if(r===B||r===F){if(e.has(s)){return i(e.get(s).texture,s.mapping)}{const r=s.image;if(r&&r.height>0){const a=new Bs(r.height);return a.fromEquirectangularTexture(t,s),e.set(s,a),s.addEventListener("dispose",n),i(a.texture,s.mapping)}return null}}}return s},dispose:function(){e=new WeakMap}}}const Fh=[.125,.215,.35,.446,.526,.582],zh=20,Hh=new ic,Vh=new zn;let Gh=null,jh=0,Wh=0,qh=!1;const Xh=(1+Math.sqrt(5))/2,Zh=1/Xh,Yh=[new vi(-Xh,Zh,0),new vi(Xh,Zh,0),new vi(-Zh,0,Xh),new vi(Zh,0,Xh),new vi(0,Xh,-Zh),new vi(0,Xh,Zh),new vi(-1,1,-1),new vi(1,1,-1),new vi(-1,1,1),new vi(1,1,1)];class Jh{constructor(t){this._renderer=t,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)}fromScene(t,e=0,i=.1,n=100){Gh=this._renderer.getRenderTarget(),jh=this._renderer.getActiveCubeFace(),Wh=this._renderer.getActiveMipmapLevel(),qh=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(t,i,n,s),e>0&&this._blur(s,0,0,e),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=td(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Qh(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(Gh,jh,Wh),this._renderer.xr.enabled=qh,t.scissorTest=!1,Kh(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===N||t.mapping===O?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),Gh=this._renderer.getRenderTarget(),jh=this._renderer.getActiveCubeFace(),Wh=this._renderer.getActiveMipmapLevel(),qh=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=e||this._allocateTargets();return this._textureToCubeUV(t,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,i={magFilter:X,minFilter:X,generateMipmaps:!1,type:nt,format:ht,colorSpace:he,depthBuffer:!1},n=$h(t,e,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=$h(t,e,i);const{_lodMax:n}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){const e=[],i=[],n=[];let s=t;const r=t-4+1+Fh.length;for(let a=0;a<r;a++){const r=Math.pow(2,s);i.push(r);let o=1/r;a>t-4?o=Fh[a-t+4-1]:0===a&&(o=0),n.push(o);const l=1/(r-2),c=-l,h=1+l,d=[c,c,h,c,h,h,c,c,h,h,c,h],u=6,p=6,m=3,f=2,g=1,v=new Float32Array(m*p*u),_=new Float32Array(f*p*u),y=new Float32Array(g*p*u);for(let t=0;t<u;t++){const e=t%3*2/3-1,i=t>2?0:-1,n=[e,i,0,e+2/3,i,0,e+2/3,i+1,0,e,i,0,e+2/3,i+1,0,e,i+1,0];v.set(n,m*p*t),_.set(d,f*p*t);const s=[t,t,t,t,t,t];y.set(s,g*p*t)}const x=new hs;x.setAttribute("position",new Qn(v,m)),x.setAttribute("uv",new Qn(_,f)),x.setAttribute("faceIndex",new Qn(y,g)),e.push(x),s>4&&s--}return{lodPlanes:e,sizeLods:i,sigmas:n}}(n)),this._blurMaterial=function(t,e,i){const n=new Float32Array(zh),s=new vi(0,1,0),r=new Ls({name:"SphericalGaussianBlur",defines:{n:zh,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:ed(),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:0,depthTest:!1,depthWrite:!1});return r}(n,t,e)}return n}_compileMaterial(t){const e=new bs(this._lodPlanes[0],t);this._renderer.compile(e,Hh)}_sceneToCubeUV(t,e,i,n){const s=new Us(90,1,e,i),r=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,c=o.toneMapping;o.getClearColor(Vh),o.toneMapping=0,o.autoClear=!1;const h=new jn({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),d=new bs(new Ss,h);let u=!1;const p=t.background;p?p.isColor&&(h.color.copy(p),t.background=null,u=!0):(h.color.copy(Vh),u=!0);for(let e=0;e<6;e++){const i=e%3;0===i?(s.up.set(0,r[e],0),s.lookAt(a[e],0,0)):1===i?(s.up.set(0,0,r[e]),s.lookAt(0,a[e],0)):(s.up.set(0,r[e],0),s.lookAt(0,0,a[e]));const l=this._cubeSize;Kh(n,i*l,e>2?l:0,l,l),o.setRenderTarget(n),u&&o.render(d,s),o.render(t,s)}d.geometry.dispose(),d.material.dispose(),o.toneMapping=c,o.autoClear=l,t.background=p}_textureToCubeUV(t,e){const i=this._renderer,n=t.mapping===N||t.mapping===O;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=td()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Qh());const s=n?this._cubemapMaterial:this._equirectMaterial,r=new bs(this._lodPlanes[0],s);s.uniforms.envMap.value=t;const a=this._cubeSize;Kh(e,0,0,3*a,2*a),i.setRenderTarget(e),i.render(r,Hh)}_applyPMREM(t){const e=this._renderer,i=e.autoClear;e.autoClear=!1;const n=this._lodPlanes.length;for(let e=1;e<n;e++){const i=Math.sqrt(this._sigmas[e]*this._sigmas[e]-this._sigmas[e-1]*this._sigmas[e-1]),s=Yh[(n-e-1)%Yh.length];this._blur(t,e-1,e,i,s)}e.autoClear=i}_blur(t,e,i,n,s){const r=this._pingPongRenderTarget;this._halfBlur(t,r,e,i,n,"latitudinal",s),this._halfBlur(r,t,i,i,n,"longitudinal",s)}_halfBlur(t,e,i,n,s,r,a){const o=this._renderer,l=this._blurMaterial;"latitudinal"!==r&&"longitudinal"!==r&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new bs(this._lodPlanes[n],l),h=l.uniforms,d=this._sizeLods[i]-1,u=isFinite(s)?Math.PI/(2*d):2*Math.PI/39,p=s/u,m=isFinite(s)?1+Math.floor(3*p):zh;m>zh&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const f=[];let g=0;for(let t=0;t<zh;++t){const e=t/p,i=Math.exp(-e*e/2);f.push(i),0===t?g+=i:t<m&&(g+=2*i)}for(let t=0;t<f.length;t++)f[t]=f[t]/g;h.envMap.value=t.texture,h.samples.value=m,h.weights.value=f,h.latitudinal.value="latitudinal"===r,a&&(h.poleAxis.value=a);const{_lodMax:v}=this;h.dTheta.value=u,h.mipInt.value=v-i;const _=this._sizeLods[n];Kh(e,3*_*(n>v-4?n-v+4:0),4*(this._cubeSize-_),3*_,2*_),o.setRenderTarget(e),o.render(c,Hh)}}function $h(t,e,i){const n=new pi(t,e,i);return n.texture.mapping=z,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Kh(t,e,i,n,s){t.viewport.set(e,i,n,s),t.scissor.set(e,i,n,s)}function Qh(){return new Ls({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ed(),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:0,depthTest:!1,depthWrite:!1})}function td(){return new Ls({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ed(),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:0,depthTest:!1,depthWrite:!1})}function ed(){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 id(t){let e=new WeakMap,i=null;function n(t){const i=t.target;i.removeEventListener("dispose",n);const s=e.get(i);void 0!==s&&(e.delete(i),s.dispose())}return{get:function(s){if(s&&s.isTexture){const r=s.mapping,a=r===B||r===F,o=r===N||r===O;if(a||o){let r=e.get(s);const l=void 0!==r?r.texture.pmremVersion:0;if(s.isRenderTargetTexture&&s.pmremVersion!==l)return null===i&&(i=new Jh(t)),r=a?i.fromEquirectangular(s,r):i.fromCubemap(s,r),r.texture.pmremVersion=s.pmremVersion,e.set(s,r),r.texture;if(void 0!==r)return r.texture;{const l=s.image;return a&&l&&l.height>0||o&&l&&function(t){let e=0;const i=6;for(let n=0;n<i;n++)void 0!==t[n]&&e++;return e===i}(l)?(null===i&&(i=new Jh(t)),r=a?i.fromEquirectangular(s):i.fromCubemap(s),r.texture.pmremVersion=s.pmremVersion,e.set(s,r),s.addEventListener("dispose",n),r.texture):null}}}return s},dispose:function(){e=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function nd(t){const e={};function i(i){if(void 0!==e[i])return e[i];let n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=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":n=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":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return e[i]=n,n}return{has:function(t){return null!==i(t)},init:function(){i("EXT_color_buffer_float"),i("WEBGL_clip_cull_distance"),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture"),i("WEBGL_render_shared_exponent")},get:function(t){const e=i(t);return null===e&&$e("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function sd(t,e,i,n){const s={},r=new WeakMap;function a(t){const o=t.target;null!==o.index&&e.remove(o.index);for(const t in o.attributes)e.remove(o.attributes[t]);o.removeEventListener("dispose",a),delete s[o.id];const l=r.get(o);l&&(e.remove(l),r.delete(o)),n.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,i.memory.geometries--}function o(t){const i=[],n=t.index,s=t.attributes.position;let a=0;if(null!==n){const t=n.array;a=n.version;for(let e=0,n=t.length;e<n;e+=3){const n=t[e+0],s=t[e+1],r=t[e+2];i.push(n,s,s,r,r,n)}}else{if(void 0===s)return;{const t=s.array;a=s.version;for(let e=0,n=t.length/3-1;e<n;e+=3){const t=e+0,n=e+1,s=e+2;i.push(t,n,n,s,s,t)}}}const o=new(We(i)?es:ts)(i,1);o.version=a;const l=r.get(t);l&&e.remove(l),r.set(t,o)}return{get:function(t,e){return!0===s[e.id]||(e.addEventListener("dispose",a),s[e.id]=!0,i.memory.geometries++),e},update:function(i){const n=i.attributes;for(const i in n)e.update(n[i],t.ARRAY_BUFFER)},getWireframeAttribute:function(t){const e=r.get(t);if(e){const i=t.index;null!==i&&e.version<i.version&&o(t)}else o(t);return r.get(t)}}}function rd(t,e,i){let n,s,r;function a(e,a,o){0!==o&&(t.drawElementsInstanced(n,a,s,e*r,o),i.update(a,n,o))}this.setMode=function(t){n=t},this.setIndex=function(t){s=t.type,r=t.bytesPerElement},this.render=function(e,a){t.drawElements(n,a,s,e*r),i.update(a,n,1)},this.renderInstances=a,this.renderMultiDraw=function(t,r,a){if(0===a)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,r,0,s,t,0,a);let o=0;for(let t=0;t<a;t++)o+=r[t];i.update(o,n,1)},this.renderMultiDrawInstances=function(t,o,l,c){if(0===l)return;const h=e.get("WEBGL_multi_draw");if(null===h)for(let e=0;e<t.length;e++)a(t[e]/r,o[e],c[e]);else{h.multiDrawElementsInstancedWEBGL(n,o,0,s,t,0,c,0,l);let e=0;for(let t=0;t<l;t++)e+=o[t]*c[t];i.update(e,n,1)}}}function ad(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(i,n,s){switch(e.calls++,n){case t.TRIANGLES:e.triangles+=s*(i/3);break;case t.LINES:e.lines+=s*(i/2);break;case t.LINE_STRIP:e.lines+=s*(i-1);break;case t.LINE_LOOP:e.lines+=s*i;break;case t.POINTS:e.points+=s*i;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function od(t,e,i){const n=new WeakMap,s=new di;return{update:function(r,a,o){const l=r.morphTargetInfluences,c=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=void 0!==c?c.length:0;let d=n.get(a);if(void 0===d||d.count!==h){void 0!==d&&d.texture.dispose();const u=void 0!==a.morphAttributes.position,p=void 0!==a.morphAttributes.normal,m=void 0!==a.morphAttributes.color,f=a.morphAttributes.position||[],g=a.morphAttributes.normal||[],v=a.morphAttributes.color||[];let _=0;!0===u&&(_=1),!0===p&&(_=2),!0===m&&(_=3);let y=a.attributes.position.count*_,x=1;y>e.maxTextureSize&&(x=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const w=new Float32Array(y*x*4*h),b=new mi(w,y,x,h);b.type=it,b.needsUpdate=!0;const M=4*_;for(let T=0;T<h;T++){const E=f[T],A=g[T],C=v[T],L=y*x*4*T;for(let k=0;k<E.count;k++){const R=k*M;!0===u&&(s.fromBufferAttribute(E,k),w[L+R+0]=s.x,w[L+R+1]=s.y,w[L+R+2]=s.z,w[L+R+3]=0),!0===p&&(s.fromBufferAttribute(A,k),w[L+R+4]=s.x,w[L+R+5]=s.y,w[L+R+6]=s.z,w[L+R+7]=0),!0===m&&(s.fromBufferAttribute(C,k),w[L+R+8]=s.x,w[L+R+9]=s.y,w[L+R+10]=s.z,w[L+R+11]=4===C.itemSize?s.w:1)}}function S(){b.dispose(),n.delete(a),a.removeEventListener("dispose",S)}d={count:h,texture:b,size:new Ve(y,x)},n.set(a,d),a.addEventListener("dispose",S)}if(!0===r.isInstancedMesh&&null!==r.morphTexture)o.getUniforms().setValue(t,"morphTexture",r.morphTexture,i);else{let P=0;for(let U=0;U<l.length;U++)P+=l[U];const I=a.morphTargetsRelative?1:1-P;o.getUniforms().setValue(t,"morphTargetBaseInfluence",I),o.getUniforms().setValue(t,"morphTargetInfluences",l)}o.getUniforms().setValue(t,"morphTargetsTexture",d.texture,i),o.getUniforms().setValue(t,"morphTargetsTextureSize",d.size)}}}function ld(t,e,i,n){let s=new WeakMap;function r(t){const e=t.target;e.removeEventListener("dispose",r),i.remove(e.instanceMatrix),null!==e.instanceColor&&i.remove(e.instanceColor)}return{update:function(a){const o=n.render.frame,l=a.geometry,c=e.get(a,l);if(s.get(c)!==o&&(e.update(c),s.set(c,o)),a.isInstancedMesh&&(!1===a.hasEventListener("dispose",r)&&a.addEventListener("dispose",r),s.get(a)!==o&&(i.update(a.instanceMatrix,t.ARRAY_BUFFER),null!==a.instanceColor&&i.update(a.instanceColor,t.ARRAY_BUFFER),s.set(a,o))),a.isSkinnedMesh){const t=a.skeleton;s.get(t)!==o&&(t.update(),s.set(t,o))}return c},dispose:function(){s=new WeakMap}}}const cd=new hi,hd=new Ra(1,1),dd=new mi,ud=new fi,pd=new Os,md=[],fd=[],gd=new Float32Array(16),vd=new Float32Array(9),_d=new Float32Array(4);function yd(t,e,i){const n=t[0];if(n<=0||n>0)return t;const s=e*i;let r=md[s];if(void 0===r&&(r=new Float32Array(s),md[s]=r),0!==e){n.toArray(r,0);for(let n=1,s=0;n!==e;++n)s+=i,t[n].toArray(r,s)}return r}function xd(t,e){if(t.length!==e.length)return!1;for(let i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function wd(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function bd(t,e){let i=fd[e];void 0===i&&(i=new Int32Array(e),fd[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function Md(t,e){const i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function Sd(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(xd(i,e))return;t.uniform2fv(this.addr,e),wd(i,e)}}function Td(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(void 0!==e.r)i[0]===e.r&&i[1]===e.g&&i[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(xd(i,e))return;t.uniform3fv(this.addr,e),wd(i,e)}}function Ed(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(xd(i,e))return;t.uniform4fv(this.addr,e),wd(i,e)}}function Ad(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(xd(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),wd(i,e)}else{if(xd(i,n))return;_d.set(n),t.uniformMatrix2fv(this.addr,!1,_d),wd(i,n)}}function Cd(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(xd(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),wd(i,e)}else{if(xd(i,n))return;vd.set(n),t.uniformMatrix3fv(this.addr,!1,vd),wd(i,n)}}function Ld(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(xd(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),wd(i,e)}else{if(xd(i,n))return;gd.set(n),t.uniformMatrix4fv(this.addr,!1,gd),wd(i,n)}}function kd(t,e){const i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function Rd(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2i(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(xd(i,e))return;t.uniform2iv(this.addr,e),wd(i,e)}}function Pd(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3i(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else{if(xd(i,e))return;t.uniform3iv(this.addr,e),wd(i,e)}}function Id(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(xd(i,e))return;t.uniform4iv(this.addr,e),wd(i,e)}}function Ud(t,e){const i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function Dd(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2ui(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(xd(i,e))return;t.uniform2uiv(this.addr,e),wd(i,e)}}function Nd(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3ui(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else{if(xd(i,e))return;t.uniform3uiv(this.addr,e),wd(i,e)}}function Od(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(xd(i,e))return;t.uniform4uiv(this.addr,e),wd(i,e)}}function Bd(t,e,i){const n=this.cache,s=i.allocateTextureUnit();let r;n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),this.type===t.SAMPLER_2D_SHADOW?(hd.compareFunction=515,r=hd):r=cd,i.setTexture2D(e||r,s)}function Fd(t,e,i){const n=this.cache,s=i.allocateTextureUnit();n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),i.setTexture3D(e||ud,s)}function zd(t,e,i){const n=this.cache,s=i.allocateTextureUnit();n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),i.setTextureCube(e||pd,s)}function Hd(t,e,i){const n=this.cache,s=i.allocateTextureUnit();n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),i.setTexture2DArray(e||dd,s)}function Vd(t,e){t.uniform1fv(this.addr,e)}function Gd(t,e){const i=yd(e,this.size,2);t.uniform2fv(this.addr,i)}function jd(t,e){const i=yd(e,this.size,3);t.uniform3fv(this.addr,i)}function Wd(t,e){const i=yd(e,this.size,4);t.uniform4fv(this.addr,i)}function qd(t,e){const i=yd(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function Xd(t,e){const i=yd(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function Zd(t,e){const i=yd(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function Yd(t,e){t.uniform1iv(this.addr,e)}function Jd(t,e){t.uniform2iv(this.addr,e)}function $d(t,e){t.uniform3iv(this.addr,e)}function Kd(t,e){t.uniform4iv(this.addr,e)}function Qd(t,e){t.uniform1uiv(this.addr,e)}function tu(t,e){t.uniform2uiv(this.addr,e)}function eu(t,e){t.uniform3uiv(this.addr,e)}function iu(t,e){t.uniform4uiv(this.addr,e)}function nu(t,e,i){const n=this.cache,s=e.length,r=bd(i,s);xd(n,r)||(t.uniform1iv(this.addr,r),wd(n,r));for(let t=0;t!==s;++t)i.setTexture2D(e[t]||cd,r[t])}function su(t,e,i){const n=this.cache,s=e.length,r=bd(i,s);xd(n,r)||(t.uniform1iv(this.addr,r),wd(n,r));for(let t=0;t!==s;++t)i.setTexture3D(e[t]||ud,r[t])}function ru(t,e,i){const n=this.cache,s=e.length,r=bd(i,s);xd(n,r)||(t.uniform1iv(this.addr,r),wd(n,r));for(let t=0;t!==s;++t)i.setTextureCube(e[t]||pd,r[t])}function au(t,e,i){const n=this.cache,s=e.length,r=bd(i,s);xd(n,r)||(t.uniform1iv(this.addr,r),wd(n,r));for(let t=0;t!==s;++t)i.setTexture2DArray(e[t]||dd,r[t])}class ou{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.type=e.type,this.setValue=function(t){switch(t){case 5126:return Md;case 35664:return Sd;case 35665:return Td;case 35666:return Ed;case 35674:return Ad;case 35675:return Cd;case 35676:return Ld;case 5124:case 35670:return kd;case 35667:case 35671:return Rd;case 35668:case 35672:return Pd;case 35669:case 35673:return Id;case 5125:return Ud;case 36294:return Dd;case 36295:return Nd;case 36296:return Od;case 35678:case 36198:case 36298:case 36306:case 35682:return Bd;case 35679:case 36299:case 36307:return Fd;case 35680:case 36300:case 36308:case 36293:return zd;case 36289:case 36303:case 36311:case 36292:return Hd}}(e.type)}}class lu{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Vd;case 35664:return Gd;case 35665:return jd;case 35666:return Wd;case 35674:return qd;case 35675:return Xd;case 35676:return Zd;case 5124:case 35670:return Yd;case 35667:case 35671:return Jd;case 35668:case 35672:return $d;case 35669:case 35673:return Kd;case 5125:return Qd;case 36294:return tu;case 36295:return eu;case 36296:return iu;case 35678:case 36198:case 36298:case 36306:case 35682:return nu;case 35679:case 36299:case 36307:return su;case 35680:case 36300:case 36308:case 36293:return ru;case 36289:case 36303:case 36311:case 36292:return au}}(e.type)}}class cu{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,i){const n=this.seq;for(let s=0,r=n.length;s!==r;++s){const r=n[s];r.setValue(t,e[r.id],i)}}}const hu=/(\w+)(\])?(\[|\.)?/g;function du(t,e){t.seq.push(e),t.map[e.id]=e}function uu(t,e,i){const n=t.name,s=n.length;for(hu.lastIndex=0;;){const r=hu.exec(n),a=hu.lastIndex;let o=r[1];const l="]"===r[2],c=r[3];if(l&&(o|=0),void 0===c||"["===c&&a+2===s){du(i,void 0===c?new ou(o,t,e):new lu(o,t,e));break}{let t=i.map[o];void 0===t&&(t=new cu(o),du(i,t)),i=t}}}class pu{constructor(t,e){this.seq=[],this.map={};const i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let n=0;n<i;++n){const i=t.getActiveUniform(e,n);uu(i,t.getUniformLocation(e,i.name),this)}}setValue(t,e,i,n){const s=this.map[e];void 0!==s&&s.setValue(t,i,n)}setOptional(t,e,i){const n=e[i];void 0!==n&&this.setValue(t,i,n)}static upload(t,e,i,n){for(let s=0,r=e.length;s!==r;++s){const r=e[s],a=i[r.id];!1!==a.needsUpdate&&r.setValue(t,a.value,n)}}static seqWithValue(t,e){const i=[];for(let n=0,s=t.length;n!==s;++n){const s=t[n];s.id in e&&i.push(s)}return i}}function mu(t,e,i){const n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}let fu=0;const gu=new Ge;function vu(t,e,i){const n=t.getShaderParameter(e,t.COMPILE_STATUS),s=t.getShaderInfoLog(e).trim();if(n&&""===s)return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const n=parseInt(r[1]);return i.toUpperCase()+"\n\n"+s+"\n\n"+function(t,e){const i=t.split("\n"),n=[],s=Math.max(e-6,0),r=Math.min(e+6,i.length);for(let t=s;t<r;t++){const s=t+1;n.push(`${s===e?">":" "} ${s}: ${i[t]}`)}return n.join("\n")}(t.getShaderSource(e),n)}return s}function _u(t,e){const i=function(t){ei._getMatrix(gu,ei.workingColorSpace,t);const e=`mat3( ${gu.elements.map((t=>t.toFixed(4)))} )`;switch(ei.getTransfer(t)){case de:return[e,"LinearTransferOETF"];case ue:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}(e);return[`vec4 ${t}( vec4 value ) {`,`\treturn ${i[1]}( vec4( value.rgb * ${i[0]}, value.a ) );`,"}"].join("\n")}function yu(t,e){let i;switch(e){case 1:i="Linear";break;case 2:i="Reinhard";break;case 3:i="Cineon";break;case 4:i="ACESFilmic";break;case 6:i="AgX";break;case 7:i="Neutral";break;case 5:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),i="Linear"}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}const xu=new vi;function wu(){ei.getLuminanceCoefficients(xu);return["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${xu.x.toFixed(4)}, ${xu.y.toFixed(4)}, ${xu.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")}function bu(t){return""!==t}function Mu(t,e){const i=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,i).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 Su(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Tu=/^[ \t]*#include +<([\w\d./]+)>/gm;function Eu(t){return t.replace(Tu,Cu)}const Au=new Map;function Cu(t,e){let i=Ah[e];if(void 0===i){const t=Au.get(e);if(void 0===t)throw new Error("Can not resolve #include <"+e+">");i=Ah[t],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,t)}return Eu(i)}const Lu=/#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 ku(t){return t.replace(Lu,Ru)}function Ru(t,e,i,n){let s="";for(let t=parseInt(e);t<parseInt(i);t++)s+=n.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return s}function Pu(t){let e=`precision ${t.precision} float;\n\tprecision ${t.precision} int;\n\tprecision ${t.precision} sampler2D;\n\tprecision ${t.precision} samplerCube;\n\tprecision ${t.precision} sampler3D;\n\tprecision ${t.precision} sampler2DArray;\n\tprecision ${t.precision} sampler2DShadow;\n\tprecision ${t.precision} samplerCubeShadow;\n\tprecision ${t.precision} sampler2DArrayShadow;\n\tprecision ${t.precision} isampler2D;\n\tprecision ${t.precision} isampler3D;\n\tprecision ${t.precision} isamplerCube;\n\tprecision ${t.precision} isampler2DArray;\n\tprecision ${t.precision} usampler2D;\n\tprecision ${t.precision} usampler3D;\n\tprecision ${t.precision} usamplerCube;\n\tprecision ${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 Iu(t,e,i,n){const s=t.getContext(),r=i.defines;let a=i.vertexShader,o=i.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(i),c=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case N:case O:e="ENVMAP_TYPE_CUBE";break;case z:e="ENVMAP_TYPE_CUBE_UV"}return e}(i),h=function(t){let e="ENVMAP_MODE_REFLECTION";t.envMap&&t.envMapMode===O&&(e="ENVMAP_MODE_REFRACTION");return e}(i),d=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(i),u=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const i=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:n,maxMip:i}}(i),p=function(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(bu).join("\n")}(i),m=function(t){const e=[];for(const i in t){const n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(r),f=s.createProgram();let g,v,_=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?(g=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,m].filter(bu).join("\n"),g.length>0&&(g+="\n"),v=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,m].filter(bu).join("\n"),v.length>0&&(v+="\n")):(g=[Pu(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,m,i.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",i.batching?"#define USE_BATCHING":"",i.batchingColor?"#define USE_BATCHING_COLOR":"",i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.instancingMorph?"#define USE_INSTANCING_MORPH":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+h:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.displacementMap?"#define USE_DISPLACEMENTMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.mapUv?"#define MAP_UV "+i.mapUv:"",i.alphaMapUv?"#define ALPHAMAP_UV "+i.alphaMapUv:"",i.lightMapUv?"#define LIGHTMAP_UV "+i.lightMapUv:"",i.aoMapUv?"#define AOMAP_UV "+i.aoMapUv:"",i.emissiveMapUv?"#define EMISSIVEMAP_UV "+i.emissiveMapUv:"",i.bumpMapUv?"#define BUMPMAP_UV "+i.bumpMapUv:"",i.normalMapUv?"#define NORMALMAP_UV "+i.normalMapUv:"",i.displacementMapUv?"#define DISPLACEMENTMAP_UV "+i.displacementMapUv:"",i.metalnessMapUv?"#define METALNESSMAP_UV "+i.metalnessMapUv:"",i.roughnessMapUv?"#define ROUGHNESSMAP_UV "+i.roughnessMapUv:"",i.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+i.anisotropyMapUv:"",i.clearcoatMapUv?"#define CLEARCOATMAP_UV "+i.clearcoatMapUv:"",i.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+i.clearcoatNormalMapUv:"",i.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+i.clearcoatRoughnessMapUv:"",i.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+i.iridescenceMapUv:"",i.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+i.iridescenceThicknessMapUv:"",i.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+i.sheenColorMapUv:"",i.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+i.sheenRoughnessMapUv:"",i.specularMapUv?"#define SPECULARMAP_UV "+i.specularMapUv:"",i.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+i.specularColorMapUv:"",i.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+i.specularIntensityMapUv:"",i.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+i.transmissionMapUv:"",i.thicknessMapUv?"#define THICKNESSMAP_UV "+i.thicknessMapUv:"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.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(bu).join("\n"),v=[Pu(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,m,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+c:"",i.envMap?"#define "+h:"",i.envMap?"#define "+d:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.dispersion?"#define USE_DISPERSION":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor||i.batchingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?Ah.tonemapping_pars_fragment:"",0!==i.toneMapping?yu("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",Ah.colorspace_pars_fragment,_u("linearToOutputTexel",i.outputColorSpace),wu(),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(bu).join("\n")),a=Eu(a),a=Mu(a,i),a=Su(a,i),o=Eu(o),o=Mu(o,i),o=Su(o,i),a=ku(a),o=ku(o),!0!==i.isRawShaderMaterial&&(_="#version 300 es\n",g=[p,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in",i.glslVersion===Ae?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===Ae?"":"#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"+v);const y=_+g+a,x=_+v+o,w=mu(s,s.VERTEX_SHADER,y),b=mu(s,s.FRAGMENT_SHADER,x);function M(e){if(t.debug.checkShaderErrors){const i=s.getProgramInfoLog(f).trim(),n=s.getShaderInfoLog(w).trim(),r=s.getShaderInfoLog(b).trim();let a=!0,o=!0;if(!1===s.getProgramParameter(f,s.LINK_STATUS))if(a=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(s,f,w,b);else{const t=vu(s,w,"vertex"),n=vu(s,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(f,s.VALIDATE_STATUS)+"\n\nMaterial Name: "+e.name+"\nMaterial Type: "+e.type+"\n\nProgram Info Log: "+i+"\n"+t+"\n"+n)}else""!==i?console.warn("THREE.WebGLProgram: Program Info Log:",i):""!==n&&""!==r||(o=!1);o&&(e.diagnostics={runnable:a,programLog:i,vertexShader:{log:n,prefix:g},fragmentShader:{log:r,prefix:v}})}s.deleteShader(w),s.deleteShader(b),S=new pu(s,f),T=function(t,e){const i={},n=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){const n=t.getActiveAttrib(e,s),r=n.name;let a=1;n.type===t.FLOAT_MAT2&&(a=2),n.type===t.FLOAT_MAT3&&(a=3),n.type===t.FLOAT_MAT4&&(a=4),i[r]={type:n.type,location:t.getAttribLocation(e,r),locationSize:a}}return i}(s,f)}let S,T;s.attachShader(f,w),s.attachShader(f,b),void 0!==i.index0AttributeName?s.bindAttribLocation(f,0,i.index0AttributeName):!0===i.morphTargets&&s.bindAttribLocation(f,0,"position"),s.linkProgram(f),this.getUniforms=function(){return void 0===S&&M(this),S},this.getAttributes=function(){return void 0===T&&M(this),T};let E=!1===i.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===E&&(E=s.getProgramParameter(f,37297)),E},this.destroy=function(){n.releaseStatesOfProgram(this),s.deleteProgram(f),this.program=void 0},this.type=i.shaderType,this.name=i.shaderName,this.id=fu++,this.cacheKey=e,this.usedTimes=1,this.program=f,this.vertexShader=w,this.fragmentShader=b,this}let Uu=0;class Du{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,i=t.fragmentShader,n=this._getShaderStage(e),s=this._getShaderStage(i),r=this._getShaderCacheForMaterial(t);return!1===r.has(n)&&(r.add(n),n.usedTimes++),!1===r.has(s)&&(r.add(s),s.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const t of e)t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let i=e.get(t);return void 0===i&&(i=new Set,e.set(t,i)),i}_getShaderStage(t){const e=this.shaderCache;let i=e.get(t);return void 0===i&&(i=new Nu(t),e.set(t,i)),i}}class Nu{constructor(t){this.id=Uu++,this.code=t,this.usedTimes=0}}function Ou(t,e,i,n,s,r,a){const o=new rn,l=new Du,c=new Set,h=[],d=s.logarithmicDepthBuffer,u=s.vertexTextures;let p=s.precision;const m={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 f(t){return c.add(t),0===t?"uv":`uv${t}`}return{getParameters:function(r,o,h,g,v){const _=g.fog,y=v.geometry,x=r.isMeshStandardMaterial?g.environment:null,w=(r.isMeshStandardMaterial?i:e).get(r.envMap||x),b=w&&w.mapping===z?w.image.height:null,M=m[r.type];null!==r.precision&&(p=s.getMaxPrecision(r.precision),p!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",p,"instead."));const S=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,T=void 0!==S?S.length:0;let E,A,C,L,k=0;if(void 0!==y.morphAttributes.position&&(k=1),void 0!==y.morphAttributes.normal&&(k=2),void 0!==y.morphAttributes.color&&(k=3),M){const t=Lh[M];E=t.vertexShader,A=t.fragmentShader}else E=r.vertexShader,A=r.fragmentShader,l.update(r),C=l.getVertexShaderID(r),L=l.getFragmentShaderID(r);const R=t.getRenderTarget(),P=t.state.buffers.depth.getReversed(),I=!0===v.isInstancedMesh,U=!0===v.isBatchedMesh,D=!!r.map,N=!!r.matcap,O=!!w,B=!!r.aoMap,F=!!r.lightMap,H=!!r.bumpMap,V=!!r.normalMap,G=!!r.displacementMap,j=!!r.emissiveMap,W=!!r.metalnessMap,q=!!r.roughnessMap,X=r.anisotropy>0,Z=r.clearcoat>0,Y=r.dispersion>0,J=r.iridescence>0,$=r.sheen>0,K=r.transmission>0,Q=X&&!!r.anisotropyMap,tt=Z&&!!r.clearcoatMap,et=Z&&!!r.clearcoatNormalMap,it=Z&&!!r.clearcoatRoughnessMap,nt=J&&!!r.iridescenceMap,st=J&&!!r.iridescenceThicknessMap,rt=$&&!!r.sheenColorMap,at=$&&!!r.sheenRoughnessMap,ot=!!r.specularMap,lt=!!r.specularColorMap,ct=!!r.specularIntensityMap,ht=K&&!!r.transmissionMap,dt=K&&!!r.thicknessMap,ut=!!r.gradientMap,pt=!!r.alphaMap,mt=r.alphaTest>0,ft=!!r.alphaHash,gt=!!r.extensions;let vt=0;r.toneMapped&&(null!==R&&!0!==R.isXRRenderTarget||(vt=t.toneMapping));const _t={shaderID:M,shaderType:r.type,shaderName:r.name,vertexShader:E,fragmentShader:A,defines:r.defines,customVertexShaderID:C,customFragmentShaderID:L,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:p,batching:U,batchingColor:U&&null!==v._colorsTexture,instancing:I,instancingColor:I&&null!==v.instanceColor,instancingMorph:I&&null!==v.morphTexture,supportsVertexTextures:u,outputColorSpace:null===R?t.outputColorSpace:!0===R.isXRRenderTarget?R.texture.colorSpace:he,alphaToCoverage:!!r.alphaToCoverage,map:D,matcap:N,envMap:O,envMapMode:O&&w.mapping,envMapCubeUVHeight:b,aoMap:B,lightMap:F,bumpMap:H,normalMap:V,displacementMap:u&&G,emissiveMap:j,normalMapObjectSpace:V&&1===r.normalMapType,normalMapTangentSpace:V&&0===r.normalMapType,metalnessMap:W,roughnessMap:q,anisotropy:X,anisotropyMap:Q,clearcoat:Z,clearcoatMap:tt,clearcoatNormalMap:et,clearcoatRoughnessMap:it,dispersion:Y,iridescence:J,iridescenceMap:nt,iridescenceThicknessMap:st,sheen:$,sheenColorMap:rt,sheenRoughnessMap:at,specularMap:ot,specularColorMap:lt,specularIntensityMap:ct,transmission:K,transmissionMap:ht,thicknessMap:dt,gradientMap:ut,opaque:!1===r.transparent&&1===r.blending&&!1===r.alphaToCoverage,alphaMap:pt,alphaTest:mt,alphaHash:ft,combine:r.combine,mapUv:D&&f(r.map.channel),aoMapUv:B&&f(r.aoMap.channel),lightMapUv:F&&f(r.lightMap.channel),bumpMapUv:H&&f(r.bumpMap.channel),normalMapUv:V&&f(r.normalMap.channel),displacementMapUv:G&&f(r.displacementMap.channel),emissiveMapUv:j&&f(r.emissiveMap.channel),metalnessMapUv:W&&f(r.metalnessMap.channel),roughnessMapUv:q&&f(r.roughnessMap.channel),anisotropyMapUv:Q&&f(r.anisotropyMap.channel),clearcoatMapUv:tt&&f(r.clearcoatMap.channel),clearcoatNormalMapUv:et&&f(r.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:it&&f(r.clearcoatRoughnessMap.channel),iridescenceMapUv:nt&&f(r.iridescenceMap.channel),iridescenceThicknessMapUv:st&&f(r.iridescenceThicknessMap.channel),sheenColorMapUv:rt&&f(r.sheenColorMap.channel),sheenRoughnessMapUv:at&&f(r.sheenRoughnessMap.channel),specularMapUv:ot&&f(r.specularMap.channel),specularColorMapUv:lt&&f(r.specularColorMap.channel),specularIntensityMapUv:ct&&f(r.specularIntensityMap.channel),transmissionMapUv:ht&&f(r.transmissionMap.channel),thicknessMapUv:dt&&f(r.thicknessMap.channel),alphaMapUv:pt&&f(r.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(V||X),vertexColors:r.vertexColors,vertexAlphas:!0===r.vertexColors&&!!y.attributes.color&&4===y.attributes.color.itemSize,pointsUvs:!0===v.isPoints&&!!y.attributes.uv&&(D||pt),fog:!!_,useFog:!0===r.fog,fogExp2:!!_&&_.isFogExp2,flatShading:!0===r.flatShading,sizeAttenuation:!0===r.sizeAttenuation,logarithmicDepthBuffer:d,reverseDepthBuffer:P,skinning:!0===v.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:T,morphTextureStride:k,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.length>0,shadowMapType:t.shadowMap.type,toneMapping:vt,decodeVideoTexture:D&&!0===r.map.isVideoTexture&&ei.getTransfer(r.map.colorSpace)===ue,decodeVideoTextureEmissive:j&&!0===r.emissiveMap.isVideoTexture&&ei.getTransfer(r.emissiveMap.colorSpace)===ue,premultipliedAlpha:r.premultipliedAlpha,doubleSided:2===r.side,flipSided:1===r.side,useDepthPacking:r.depthPacking>=0,depthPacking:r.depthPacking||0,index0AttributeName:r.index0AttributeName,extensionClipCullDistance:gt&&!0===r.extensions.clipCullDistance&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(gt&&!0===r.extensions.multiDraw||U)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:r.customProgramCacheKey()};return _t.vertexUv1s=c.has(1),_t.vertexUv2s=c.has(2),_t.vertexUv3s=c.has(3),c.clear(),_t},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.customVertexShaderID),i.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(!function(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)}(i,e),function(t,e){o.disableAll(),e.supportsVertexTextures&&o.enable(0);e.instancing&&o.enable(1);e.instancingColor&&o.enable(2);e.instancingMorph&&o.enable(3);e.matcap&&o.enable(4);e.envMap&&o.enable(5);e.normalMapObjectSpace&&o.enable(6);e.normalMapTangentSpace&&o.enable(7);e.clearcoat&&o.enable(8);e.iridescence&&o.enable(9);e.alphaTest&&o.enable(10);e.vertexColors&&o.enable(11);e.vertexAlphas&&o.enable(12);e.vertexUv1s&&o.enable(13);e.vertexUv2s&&o.enable(14);e.vertexUv3s&&o.enable(15);e.vertexTangents&&o.enable(16);e.anisotropy&&o.enable(17);e.alphaHash&&o.enable(18);e.batching&&o.enable(19);e.dispersion&&o.enable(20);e.batchingColor&&o.enable(21);t.push(o.mask),o.disableAll(),e.fog&&o.enable(0);e.useFog&&o.enable(1);e.flatShading&&o.enable(2);e.logarithmicDepthBuffer&&o.enable(3);e.reverseDepthBuffer&&o.enable(4);e.skinning&&o.enable(5);e.morphTargets&&o.enable(6);e.morphNormals&&o.enable(7);e.morphColors&&o.enable(8);e.premultipliedAlpha&&o.enable(9);e.shadowMapEnabled&&o.enable(10);e.doubleSided&&o.enable(11);e.flipSided&&o.enable(12);e.useDepthPacking&&o.enable(13);e.dithering&&o.enable(14);e.transmission&&o.enable(15);e.sheen&&o.enable(16);e.opaque&&o.enable(17);e.pointsUvs&&o.enable(18);e.decodeVideoTexture&&o.enable(19);e.decodeVideoTextureEmissive&&o.enable(20);e.alphaToCoverage&&o.enable(21);t.push(o.mask)}(i,e),i.push(t.outputColorSpace)),i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=m[t.type];let i;if(e){const t=Lh[e];i=Cs.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n;for(let t=0,e=h.length;t<e;t++){const e=h[t];if(e.cacheKey===i){n=e,++n.usedTimes;break}}return void 0===n&&(n=new Iu(t,i,e,r),h.push(n)),n},releaseProgram:function(t){if(0==--t.usedTimes){const e=h.indexOf(t);h[e]=h[h.length-1],h.pop(),t.destroy()}},releaseShaderCache:function(t){l.remove(t)},programs:h,dispose:function(){l.dispose()}}}function Bu(){let t=new WeakMap;return{has:function(e){return t.has(e)},get:function(e){let i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i},remove:function(e){t.delete(e)},update:function(e,i,n){t.get(e)[i]=n},dispose:function(){t=new WeakMap}}}function Fu(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 zu(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 Hu(){const t=[];let e=0;const i=[],n=[],s=[];function r(i,n,s,r,a,o){let l=t[e];return void 0===l?(l={id:i.id,object:i,geometry:n,material:s,groupOrder:r,renderOrder:i.renderOrder,z:a,group:o},t[e]=l):(l.id=i.id,l.object=i,l.geometry=n,l.material=s,l.groupOrder=r,l.renderOrder=i.renderOrder,l.z=a,l.group=o),e++,l}return{opaque:i,transmissive:n,transparent:s,init:function(){e=0,i.length=0,n.length=0,s.length=0},push:function(t,e,a,o,l,c){const h=r(t,e,a,o,l,c);a.transmission>0?n.push(h):!0===a.transparent?s.push(h):i.push(h)},unshift:function(t,e,a,o,l,c){const h=r(t,e,a,o,l,c);a.transmission>0?n.unshift(h):!0===a.transparent?s.unshift(h):i.unshift(h)},finish:function(){for(let i=e,n=t.length;i<n;i++){const e=t[i];if(null===e.id)break;e.id=null,e.object=null,e.geometry=null,e.material=null,e.group=null}},sort:function(t,e){i.length>1&&i.sort(t||Fu),n.length>1&&n.sort(e||zu),s.length>1&&s.sort(e||zu)}}}function Vu(){let t=new WeakMap;return{get:function(e,i){const n=t.get(e);let s;return void 0===n?(s=new Hu,t.set(e,[s])):i>=n.length?(s=new Hu,n.push(s)):s=n[i],s},dispose:function(){t=new WeakMap}}}function Gu(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":i={direction:new vi,color:new zn};break;case"SpotLight":i={position:new vi,direction:new vi,color:new zn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new vi,color:new zn,distance:0,decay:0};break;case"HemisphereLight":i={direction:new vi,skyColor:new zn,groundColor:new zn};break;case"RectAreaLight":i={color:new zn,position:new vi,halfWidth:new vi,halfHeight:new vi}}return t[e.id]=i,i}}}let ju=0;function Wu(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function qu(t){const e=new Gu,i=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ve};break;case"PointLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ve,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}}(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let t=0;t<9;t++)n.probe.push(new vi);const s=new vi,r=new Xi,a=new Xi;return{setup:function(s){let r=0,a=0,o=0;for(let t=0;t<9;t++)n.probe[t].set(0,0,0);let l=0,c=0,h=0,d=0,u=0,p=0,m=0,f=0,g=0,v=0,_=0;s.sort(Wu);for(let t=0,y=s.length;t<y;t++){const y=s[t],x=y.color,w=y.intensity,b=y.distance,M=y.shadow&&y.shadow.map?y.shadow.map.texture:null;if(y.isAmbientLight)r+=x.r*w,a+=x.g*w,o+=x.b*w;else if(y.isLightProbe){for(let t=0;t<9;t++)n.probe[t].addScaledVector(y.sh.coefficients[t],w);_++}else if(y.isDirectionalLight){const t=e.get(y);if(t.color.copy(y.color).multiplyScalar(y.intensity),y.castShadow){const t=y.shadow,e=i.get(y);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,n.directionalShadow[l]=e,n.directionalShadowMap[l]=M,n.directionalShadowMatrix[l]=y.shadow.matrix,p++}n.directional[l]=t,l++}else if(y.isSpotLight){const t=e.get(y);t.position.setFromMatrixPosition(y.matrixWorld),t.color.copy(x).multiplyScalar(w),t.distance=b,t.coneCos=Math.cos(y.angle),t.penumbraCos=Math.cos(y.angle*(1-y.penumbra)),t.decay=y.decay,n.spot[h]=t;const s=y.shadow;if(y.map&&(n.spotLightMap[g]=y.map,g++,s.updateMatrices(y),y.castShadow&&v++),n.spotLightMatrix[h]=s.matrix,y.castShadow){const t=i.get(y);t.shadowIntensity=s.intensity,t.shadowBias=s.bias,t.shadowNormalBias=s.normalBias,t.shadowRadius=s.radius,t.shadowMapSize=s.mapSize,n.spotShadow[h]=t,n.spotShadowMap[h]=M,f++}h++}else if(y.isRectAreaLight){const t=e.get(y);t.color.copy(x).multiplyScalar(w),t.halfWidth.set(.5*y.width,0,0),t.halfHeight.set(0,.5*y.height,0),n.rectArea[d]=t,d++}else if(y.isPointLight){const t=e.get(y);if(t.color.copy(y.color).multiplyScalar(y.intensity),t.distance=y.distance,t.decay=y.decay,y.castShadow){const t=y.shadow,e=i.get(y);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,e.shadowCameraNear=t.camera.near,e.shadowCameraFar=t.camera.far,n.pointShadow[c]=e,n.pointShadowMap[c]=M,n.pointShadowMatrix[c]=y.shadow.matrix,m++}n.point[c]=t,c++}else if(y.isHemisphereLight){const t=e.get(y);t.skyColor.copy(y.color).multiplyScalar(w),t.groundColor.copy(y.groundColor).multiplyScalar(w),n.hemi[u]=t,u++}}d>0&&(!0===t.has("OES_texture_float_linear")?(n.rectAreaLTC1=Ch.LTC_FLOAT_1,n.rectAreaLTC2=Ch.LTC_FLOAT_2):(n.rectAreaLTC1=Ch.LTC_HALF_1,n.rectAreaLTC2=Ch.LTC_HALF_2)),n.ambient[0]=r,n.ambient[1]=a,n.ambient[2]=o;const y=n.hash;y.directionalLength===l&&y.pointLength===c&&y.spotLength===h&&y.rectAreaLength===d&&y.hemiLength===u&&y.numDirectionalShadows===p&&y.numPointShadows===m&&y.numSpotShadows===f&&y.numSpotMaps===g&&y.numLightProbes===_||(n.directional.length=l,n.spot.length=h,n.rectArea.length=d,n.point.length=c,n.hemi.length=u,n.directionalShadow.length=p,n.directionalShadowMap.length=p,n.pointShadow.length=m,n.pointShadowMap.length=m,n.spotShadow.length=f,n.spotShadowMap.length=f,n.directionalShadowMatrix.length=p,n.pointShadowMatrix.length=m,n.spotLightMatrix.length=f+g-v,n.spotLightMap.length=g,n.numSpotLightShadowsWithMaps=v,n.numLightProbes=_,y.directionalLength=l,y.pointLength=c,y.spotLength=h,y.rectAreaLength=d,y.hemiLength=u,y.numDirectionalShadows=p,y.numPointShadows=m,y.numSpotShadows=f,y.numSpotMaps=g,y.numLightProbes=_,n.version=ju++)},setupView:function(t,e){let i=0,o=0,l=0,c=0,h=0;const d=e.matrixWorldInverse;for(let e=0,u=t.length;e<u;e++){const u=t[e];if(u.isDirectionalLight){const t=n.directional[i];t.direction.setFromMatrixPosition(u.matrixWorld),s.setFromMatrixPosition(u.target.matrixWorld),t.direction.sub(s),t.direction.transformDirection(d),i++}else if(u.isSpotLight){const t=n.spot[l];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),t.direction.setFromMatrixPosition(u.matrixWorld),s.setFromMatrixPosition(u.target.matrixWorld),t.direction.sub(s),t.direction.transformDirection(d),l++}else if(u.isRectAreaLight){const t=n.rectArea[c];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),a.identity(),r.copy(u.matrixWorld),r.premultiply(d),a.extractRotation(r),t.halfWidth.set(.5*u.width,0,0),t.halfHeight.set(0,.5*u.height,0),t.halfWidth.applyMatrix4(a),t.halfHeight.applyMatrix4(a),c++}else if(u.isPointLight){const t=n.point[o];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),o++}else if(u.isHemisphereLight){const t=n.hemi[h];t.direction.setFromMatrixPosition(u.matrixWorld),t.direction.transformDirection(d),h++}}},state:n}}function Xu(t){const e=new qu(t),i=[],n=[];const s={lightsArray:i,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:function(t){s.camera=t,i.length=0,n.length=0},state:s,setupLights:function(){e.setup(i)},setupLightsView:function(t){e.setupView(i,t)},pushLight:function(t){i.push(t)},pushShadow:function(t){n.push(t)}}}function Zu(t){let e=new WeakMap;return{get:function(i,n=0){const s=e.get(i);let r;return void 0===s?(r=new Xu(t),e.set(i,[r])):n>=s.length?(r=new Xu(t),s.push(r)):r=s[n],r},dispose:function(){e=new WeakMap}}}function Yu(t,e,i){let n=new Gr;const o=new Ve,l=new Ve,c=new di,h=new dl({depthPacking:3201}),d=new ul,u={},p=i.maxTextureSize,m={[s]:1,[r]:0,[a]:2},f=new Ls({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ve},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"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}"}),g=f.clone();g.defines.HORIZONTAL_PASS=1;const v=new hs;v.setAttribute("position",new Qn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new bs(v,f),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let x=this.type;function w(i,n){const s=e.update(_);f.defines.VSM_SAMPLES!==i.blurSamples&&(f.defines.VSM_SAMPLES=i.blurSamples,g.defines.VSM_SAMPLES=i.blurSamples,f.needsUpdate=!0,g.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new pi(o.x,o.y)),f.uniforms.shadow_pass.value=i.map.texture,f.uniforms.resolution.value=i.mapSize,f.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,s,f,_,null),g.uniforms.shadow_pass.value=i.mapPass.texture,g.uniforms.resolution.value=i.mapSize,g.uniforms.radius.value=i.radius,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,s,g,_,null)}function b(e,i,n,s){let r=null;const a=!0===n.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==a)r=a;else if(r=!0===n.isPointLight?d:h,t.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0||i.map&&i.alphaTest>0){const t=r.uuid,e=i.uuid;let n=u[t];void 0===n&&(n={},u[t]=n);let s=n[e];void 0===s&&(s=r.clone(),n[e]=s,i.addEventListener("dispose",S)),r=s}if(r.visible=i.visible,r.wireframe=i.wireframe,r.side=3===s?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:m[i.side],r.alphaMap=i.alphaMap,r.alphaTest=i.alphaTest,r.map=i.map,r.clipShadows=i.clipShadows,r.clippingPlanes=i.clippingPlanes,r.clipIntersection=i.clipIntersection,r.displacementMap=i.displacementMap,r.displacementScale=i.displacementScale,r.displacementBias=i.displacementBias,r.wireframeLinewidth=i.wireframeLinewidth,r.linewidth=i.linewidth,!0===n.isPointLight&&!0===r.isMeshDistanceMaterial){t.properties.get(r).light=n}return r}function M(i,s,r,a,o){if(!1===i.visible)return;if(i.layers.test(s.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&3===o)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,i.matrixWorld);const n=e.update(i),l=i.material;if(Array.isArray(l)){const e=n.groups;for(let c=0,h=e.length;c<h;c++){const h=e[c],d=l[h.materialIndex];if(d&&d.visible){const e=b(i,d,a,o);i.onBeforeShadow(t,i,s,r,n,e,h),t.renderBufferDirect(r,null,n,e,i,h),i.onAfterShadow(t,i,s,r,n,e,h)}}}else if(l.visible){const e=b(i,l,a,o);i.onBeforeShadow(t,i,s,r,n,e,null),t.renderBufferDirect(r,null,n,e,i,null),i.onAfterShadow(t,i,s,r,n,e,null)}}const l=i.children;for(let t=0,e=l.length;t<e;t++)M(l[t],s,r,a,o)}function S(t){t.target.removeEventListener("dispose",S);for(const e in u){const i=u[e],n=t.target.uuid;if(n in i){i[n].dispose(),delete i[n]}}}this.render=function(e,i,s){if(!1===y.enabled)return;if(!1===y.autoUpdate&&!1===y.needsUpdate)return;if(0===e.length)return;const r=t.getRenderTarget(),a=t.getActiveCubeFace(),h=t.getActiveMipmapLevel(),d=t.state;d.setBlending(0),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);const u=3!==x&&3===this.type,m=3===x&&3!==this.type;for(let r=0,a=e.length;r<a;r++){const a=e[r],h=a.shadow;if(void 0===h){console.warn("THREE.WebGLShadowMap:",a,"has no shadow.");continue}if(!1===h.autoUpdate&&!1===h.needsUpdate)continue;o.copy(h.mapSize);const f=h.getFrameExtents();if(o.multiply(f),l.copy(h.mapSize),(o.x>p||o.y>p)&&(o.x>p&&(l.x=Math.floor(p/f.x),o.x=l.x*f.x,h.mapSize.x=l.x),o.y>p&&(l.y=Math.floor(p/f.y),o.y=l.y*f.y,h.mapSize.y=l.y)),null===h.map||!0===u||!0===m){const t=3!==this.type?{minFilter:j,magFilter:j}:{};null!==h.map&&h.map.dispose(),h.map=new pi(o.x,o.y,t),h.map.texture.name=a.name+".shadowMap",h.camera.updateProjectionMatrix()}t.setRenderTarget(h.map),t.clear();const g=h.getViewportCount();for(let t=0;t<g;t++){const e=h.getViewport(t);c.set(l.x*e.x,l.y*e.y,l.x*e.z,l.y*e.w),d.viewport(c),h.updateMatrices(a,t),n=h.getFrustum(),M(i,s,h.camera,a,this.type)}!0!==h.isPointLightShadow&&3===this.type&&w(h,s),h.needsUpdate=!1}x=this.type,y.needsUpdate=!1,t.setRenderTarget(r,a,h)}}const Ju={[T]:1,[A]:6,[L]:7,[C]:5,[E]:0,[R]:2,[P]:4,[k]:3};function $u(t,e){const i=new function(){let e=!1;const i=new di;let n=null;const s=new di(0,0,0,0);return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,r,a,o){!0===o&&(e*=a,n*=a,r*=a),i.set(e,n,r,a),!1===s.equals(i)&&(t.clearColor(e,n,r,a),s.copy(i))},reset:function(){e=!1,n=null,s.set(-1,0,0,0)}}},n=new function(){let i=!1,n=!1,s=null,r=null,a=null;return{setReversed:function(t){if(n!==t){const t=e.get("EXT_clip_control");n?t.clipControlEXT(t.LOWER_LEFT_EXT,t.ZERO_TO_ONE_EXT):t.clipControlEXT(t.LOWER_LEFT_EXT,t.NEGATIVE_ONE_TO_ONE_EXT);const i=a;a=null,this.setClear(i)}n=t},getReversed:function(){return n},setTest:function(e){e?st(t.DEPTH_TEST):rt(t.DEPTH_TEST)},setMask:function(e){s===e||i||(t.depthMask(e),s=e)},setFunc:function(e){if(n&&(e=Ju[e]),r!==e){switch(e){case 0:t.depthFunc(t.NEVER);break;case 1:t.depthFunc(t.ALWAYS);break;case 2:t.depthFunc(t.LESS);break;case 3:default:t.depthFunc(t.LEQUAL);break;case 4:t.depthFunc(t.EQUAL);break;case 5:t.depthFunc(t.GEQUAL);break;case 6:t.depthFunc(t.GREATER);break;case 7:t.depthFunc(t.NOTEQUAL)}r=e}},setLocked:function(t){i=t},setClear:function(e){a!==e&&(n&&(e=1-e),t.clearDepth(e),a=e)},reset:function(){i=!1,s=null,r=null,a=null,n=!1}}},s=new function(){let e=!1,i=null,n=null,s=null,r=null,a=null,o=null,l=null,c=null;return{setTest:function(i){e||(i?st(t.STENCIL_TEST):rt(t.STENCIL_TEST))},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,a){n===e&&s===i&&r===a||(t.stencilFunc(e,i,a),n=e,s=i,r=a)},setOp:function(e,i,n){a===e&&o===i&&l===n||(t.stencilOp(e,i,n),a=e,o=i,l=n)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,i=null,n=null,s=null,r=null,a=null,o=null,l=null,c=null}}},r=new WeakMap,a=new WeakMap;let T={},E={},A=new WeakMap,C=[],L=null,k=!1,R=null,P=null,I=null,U=null,D=null,N=null,O=null,B=new zn(0,0,0),F=0,z=!1,H=null,V=null,G=null,j=null,W=null;const q=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let X=!1,Z=0;const Y=t.getParameter(t.VERSION);-1!==Y.indexOf("WebGL")?(Z=parseFloat(/^WebGL (\d)/.exec(Y)[1]),X=Z>=1):-1!==Y.indexOf("OpenGL ES")&&(Z=parseFloat(/^OpenGL ES (\d)/.exec(Y)[1]),X=Z>=2);let J=null,$={};const K=t.getParameter(t.SCISSOR_BOX),Q=t.getParameter(t.VIEWPORT),tt=(new di).fromArray(K),et=(new di).fromArray(Q);function it(e,i,n,s){const r=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let a=0;a<n;a++)e===t.TEXTURE_3D||e===t.TEXTURE_2D_ARRAY?t.texImage3D(i,0,t.RGBA,1,1,s,0,t.RGBA,t.UNSIGNED_BYTE,r):t.texImage2D(i+a,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,r);return a}const nt={};function st(e){!0!==T[e]&&(t.enable(e),T[e]=!0)}function rt(e){!1!==T[e]&&(t.disable(e),T[e]=!1)}nt[t.TEXTURE_2D]=it(t.TEXTURE_2D,t.TEXTURE_2D,1),nt[t.TEXTURE_CUBE_MAP]=it(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),nt[t.TEXTURE_2D_ARRAY]=it(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),nt[t.TEXTURE_3D]=it(t.TEXTURE_3D,t.TEXTURE_3D,1,1),i.setClear(0,0,0,1),n.setClear(1),s.setClear(0),st(t.DEPTH_TEST),n.setFunc(3),ct(!1),ht(1),st(t.CULL_FACE),lt(0);const at={[o]:t.FUNC_ADD,[l]:t.FUNC_SUBTRACT,[c]:t.FUNC_REVERSE_SUBTRACT};at[103]=t.MIN,at[104]=t.MAX;const ot={[h]:t.ZERO,[d]:t.ONE,[u]:t.SRC_COLOR,[m]:t.SRC_ALPHA,[x]:t.SRC_ALPHA_SATURATE,[_]:t.DST_COLOR,[g]:t.DST_ALPHA,[p]:t.ONE_MINUS_SRC_COLOR,[f]:t.ONE_MINUS_SRC_ALPHA,[y]:t.ONE_MINUS_DST_COLOR,[v]:t.ONE_MINUS_DST_ALPHA,[w]:t.CONSTANT_COLOR,[b]:t.ONE_MINUS_CONSTANT_COLOR,[M]:t.CONSTANT_ALPHA,[S]:t.ONE_MINUS_CONSTANT_ALPHA};function lt(e,i,n,s,r,a,l,c,h,d){if(0!==e){if(!1===k&&(st(t.BLEND),k=!0),5===e)r=r||i,a=a||n,l=l||s,i===P&&r===D||(t.blendEquationSeparate(at[i],at[r]),P=i,D=r),n===I&&s===U&&a===N&&l===O||(t.blendFuncSeparate(ot[n],ot[s],ot[a],ot[l]),I=n,U=s,N=a,O=l),!1!==c.equals(B)&&h===F||(t.blendColor(c.r,c.g,c.b,h),B.copy(c),F=h),R=e,z=!1;else if(e!==R||d!==z){if(P===o&&D===o||(t.blendEquation(t.FUNC_ADD),P=o,D=o),d)switch(e){case 1:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.ONE,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}I=null,U=null,N=null,O=null,B.set(0,0,0),F=0,R=e,z=d}}else!0===k&&(rt(t.BLEND),k=!1)}function ct(e){H!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),H=e)}function ht(e){st(t.CULL_FACE),e!==V&&t.cullFace(t.BACK),V=e}function dt(e,i,n){e?(st(t.POLYGON_OFFSET_FILL),j===i&&W===n||(t.polygonOffset(i,n),j=i,W=n)):rt(t.POLYGON_OFFSET_FILL)}return{buffers:{color:i,depth:n,stencil:s},enable:st,disable:rt,bindFramebuffer:function(e,i){return E[e]!==i&&(t.bindFramebuffer(e,i),E[e]=i,e===t.DRAW_FRAMEBUFFER&&(E[t.FRAMEBUFFER]=i),e===t.FRAMEBUFFER&&(E[t.DRAW_FRAMEBUFFER]=i),!0)},drawBuffers:function(e,i){let n=C,s=!1;if(e){n=A.get(i),void 0===n&&(n=[],A.set(i,n));const r=e.textures;if(n.length!==r.length||n[0]!==t.COLOR_ATTACHMENT0){for(let e=0,i=r.length;e<i;e++)n[e]=t.COLOR_ATTACHMENT0+e;n.length=r.length,s=!0}}else n[0]!==t.BACK&&(n[0]=t.BACK,s=!0);s&&t.drawBuffers(n)},useProgram:function(e){return L!==e&&(t.useProgram(e),L=e,!0)},setBlending:lt,setMaterial:function(e,r){2===e.side?rt(t.CULL_FACE):st(t.CULL_FACE);let a=1===e.side;r&&(a=!a),ct(a),1===e.blending&&!1===e.transparent?lt(0):lt(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.blendColor,e.blendAlpha,e.premultipliedAlpha),n.setFunc(e.depthFunc),n.setTest(e.depthTest),n.setMask(e.depthWrite),i.setMask(e.colorWrite);const o=e.stencilWrite;s.setTest(o),o&&(s.setMask(e.stencilWriteMask),s.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),s.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),dt(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?st(t.SAMPLE_ALPHA_TO_COVERAGE):rt(t.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:ct,setCullFace:ht,setLineWidth:function(e){e!==G&&(X&&t.lineWidth(e),G=e)},setPolygonOffset:dt,setScissorTest:function(e){e?st(t.SCISSOR_TEST):rt(t.SCISSOR_TEST)},activeTexture:function(e){void 0===e&&(e=t.TEXTURE0+q-1),J!==e&&(t.activeTexture(e),J=e)},bindTexture:function(e,i,n){void 0===n&&(n=null===J?t.TEXTURE0+q-1:J);let s=$[n];void 0===s&&(s={type:void 0,texture:void 0},$[n]=s),s.type===e&&s.texture===i||(J!==n&&(t.activeTexture(n),J=n),t.bindTexture(e,i||nt[e]),s.type=e,s.texture=i)},unbindTexture:function(){const e=$[J];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexImage3D:function(){try{t.compressedTexImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},updateUBOMapping:function(e,i){let n=a.get(i);void 0===n&&(n=new WeakMap,a.set(i,n));let s=n.get(e);void 0===s&&(s=t.getUniformBlockIndex(i,e.name),n.set(e,s))},uniformBlockBinding:function(e,i){const n=a.get(i).get(e);r.get(i)!==n&&(t.uniformBlockBinding(i,n,e.__bindingPointIndex),r.set(i,n))},texStorage2D:function(){try{t.texStorage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage3D:function(){try{t.texStorage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage2D:function(){try{t.texSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage3D:function(){try{t.texSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage3D:function(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===tt.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),tt.copy(e))},viewport:function(e){!1===et.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),et.copy(e))},reset:function(){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),n.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),T={},J=null,$={},E={},A=new WeakMap,C=[],L=null,k=!1,R=null,P=null,I=null,U=null,D=null,N=null,O=null,B=new zn(0,0,0),F=0,z=!1,H=null,V=null,G=null,j=null,W=null,tt.set(0,0,t.canvas.width,t.canvas.height),et.set(0,0,t.canvas.width,t.canvas.height),i.reset(),n.reset(),s.reset()}}}function Ku(t,e,i,n,s,r,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new Ve,h=new WeakMap;let d;const u=new WeakMap;let p=!1;try{p="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function m(t,e){return p?new OffscreenCanvas(t,e):Ze("canvas")}function f(t,e,i){let n=1;const s=$(t);if((s.width>i||s.height>i)&&(n=i/Math.max(s.width,s.height)),n<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){const i=Math.floor(n*s.width),r=Math.floor(n*s.height);void 0===d&&(d=m(i,r));const a=e?m(i,r):d;a.width=i,a.height=r;return a.getContext("2d").drawImage(t,0,0,i,r),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+s.width+"x"+s.height+") to ("+i+"x"+r+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+s.width+"x"+s.height+")."),t}return t}function g(t){return t.generateMipmaps}function v(e){t.generateMipmap(e)}function _(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 y(i,n,s,r,a=!1){if(null!==i){if(void 0!==t[i])return t[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let o=n;if(n===t.RED&&(s===t.FLOAT&&(o=t.R32F),s===t.HALF_FLOAT&&(o=t.R16F),s===t.UNSIGNED_BYTE&&(o=t.R8)),n===t.RED_INTEGER&&(s===t.UNSIGNED_BYTE&&(o=t.R8UI),s===t.UNSIGNED_SHORT&&(o=t.R16UI),s===t.UNSIGNED_INT&&(o=t.R32UI),s===t.BYTE&&(o=t.R8I),s===t.SHORT&&(o=t.R16I),s===t.INT&&(o=t.R32I)),n===t.RG&&(s===t.FLOAT&&(o=t.RG32F),s===t.HALF_FLOAT&&(o=t.RG16F),s===t.UNSIGNED_BYTE&&(o=t.RG8)),n===t.RG_INTEGER&&(s===t.UNSIGNED_BYTE&&(o=t.RG8UI),s===t.UNSIGNED_SHORT&&(o=t.RG16UI),s===t.UNSIGNED_INT&&(o=t.RG32UI),s===t.BYTE&&(o=t.RG8I),s===t.SHORT&&(o=t.RG16I),s===t.INT&&(o=t.RG32I)),n===t.RGB_INTEGER&&(s===t.UNSIGNED_BYTE&&(o=t.RGB8UI),s===t.UNSIGNED_SHORT&&(o=t.RGB16UI),s===t.UNSIGNED_INT&&(o=t.RGB32UI),s===t.BYTE&&(o=t.RGB8I),s===t.SHORT&&(o=t.RGB16I),s===t.INT&&(o=t.RGB32I)),n===t.RGBA_INTEGER&&(s===t.UNSIGNED_BYTE&&(o=t.RGBA8UI),s===t.UNSIGNED_SHORT&&(o=t.RGBA16UI),s===t.UNSIGNED_INT&&(o=t.RGBA32UI),s===t.BYTE&&(o=t.RGBA8I),s===t.SHORT&&(o=t.RGBA16I),s===t.INT&&(o=t.RGBA32I)),n===t.RGB&&s===t.UNSIGNED_INT_5_9_9_9_REV&&(o=t.RGB9_E5),n===t.RGBA){const e=a?de:ei.getTransfer(r);s===t.FLOAT&&(o=t.RGBA32F),s===t.HALF_FLOAT&&(o=t.RGBA16F),s===t.UNSIGNED_BYTE&&(o=e===ue?t.SRGB8_ALPHA8:t.RGBA8),s===t.UNSIGNED_SHORT_4_4_4_4&&(o=t.RGBA4),s===t.UNSIGNED_SHORT_5_5_5_1&&(o=t.RGB5_A1)}return o!==t.R16F&&o!==t.R32F&&o!==t.RG16F&&o!==t.RG32F&&o!==t.RGBA16F&&o!==t.RGBA32F||e.get("EXT_color_buffer_float"),o}function x(e,i){let n;return e?null===i||i===et||i===at?n=t.DEPTH24_STENCIL8:i===it?n=t.DEPTH32F_STENCIL8:i===Q&&(n=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===i||i===et||i===at?n=t.DEPTH_COMPONENT24:i===it?n=t.DEPTH_COMPONENT32F:i===Q&&(n=t.DEPTH_COMPONENT16),n}function w(t,e){return!0===g(t)||t.isFramebufferTexture&&t.minFilter!==j&&t.minFilter!==X?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 b(t){const e=t.target;e.removeEventListener("dispose",b),function(t){const e=n.get(t);if(void 0===e.__webglInit)return;const i=t.source,s=u.get(i);if(s){const n=s[e.__cacheKey];n.usedTimes--,0===n.usedTimes&&S(t),0===Object.keys(s).length&&u.delete(i)}n.remove(t)}(e),e.isVideoTexture&&h.delete(e)}function M(e){const i=e.target;i.removeEventListener("dispose",M),function(e){const i=n.get(e);e.depthTexture&&(e.depthTexture.dispose(),n.remove(e.depthTexture));if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++){if(Array.isArray(i.__webglFramebuffer[e]))for(let n=0;n<i.__webglFramebuffer[e].length;n++)t.deleteFramebuffer(i.__webglFramebuffer[e][n]);else t.deleteFramebuffer(i.__webglFramebuffer[e]);i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[e])}else{if(Array.isArray(i.__webglFramebuffer))for(let e=0;e<i.__webglFramebuffer.length;e++)t.deleteFramebuffer(i.__webglFramebuffer[e]);else t.deleteFramebuffer(i.__webglFramebuffer);if(i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(let e=0;e<i.__webglColorRenderbuffer.length;e++)i.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(i.__webglColorRenderbuffer[e]);i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer)}const s=e.textures;for(let e=0,i=s.length;e<i;e++){const i=n.get(s[e]);i.__webglTexture&&(t.deleteTexture(i.__webglTexture),a.memory.textures--),n.remove(s[e])}n.remove(e)}(i)}function S(e){const i=n.get(e);t.deleteTexture(i.__webglTexture);const s=e.source;delete u.get(s)[i.__cacheKey],a.memory.textures--}let T=0;function E(e,s){const r=n.get(e);if(e.isVideoTexture&&function(t){const e=a.render.frame;h.get(t)!==e&&(h.set(t,e),t.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&r.__version!==e.version){const t=e.image;if(null===t)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==t.complete)return void P(r,e,s);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.bindTexture(t.TEXTURE_2D,r.__webglTexture,t.TEXTURE0+s)}const A={[H]:t.REPEAT,[V]:t.CLAMP_TO_EDGE,[G]:t.MIRRORED_REPEAT},C={[j]:t.NEAREST,[W]:t.NEAREST_MIPMAP_NEAREST,[q]:t.NEAREST_MIPMAP_LINEAR,[X]:t.LINEAR,[Z]:t.LINEAR_MIPMAP_NEAREST,[Y]:t.LINEAR_MIPMAP_LINEAR},L={[_e]:t.NEVER,[Te]:t.ALWAYS,[ye]:t.LESS,[we]:t.LEQUAL,[xe]:t.EQUAL,[Se]:t.GEQUAL,[be]:t.GREATER,[Me]:t.NOTEQUAL};function k(i,r){if(r.type!==it||!1!==e.has("OES_texture_float_linear")||r.magFilter!==X&&r.magFilter!==Z&&r.magFilter!==q&&r.magFilter!==Y&&r.minFilter!==X&&r.minFilter!==Z&&r.minFilter!==q&&r.minFilter!==Y||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(i,t.TEXTURE_WRAP_S,A[r.wrapS]),t.texParameteri(i,t.TEXTURE_WRAP_T,A[r.wrapT]),i!==t.TEXTURE_3D&&i!==t.TEXTURE_2D_ARRAY||t.texParameteri(i,t.TEXTURE_WRAP_R,A[r.wrapR]),t.texParameteri(i,t.TEXTURE_MAG_FILTER,C[r.magFilter]),t.texParameteri(i,t.TEXTURE_MIN_FILTER,C[r.minFilter]),r.compareFunction&&(t.texParameteri(i,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(i,t.TEXTURE_COMPARE_FUNC,L[r.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){if(r.magFilter===j)return;if(r.minFilter!==q&&r.minFilter!==Y)return;if(r.type===it&&!1===e.has("OES_texture_float_linear"))return;if(r.anisotropy>1||n.get(r).__currentAnisotropy){const a=e.get("EXT_texture_filter_anisotropic");t.texParameterf(i,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(r.anisotropy,s.getMaxAnisotropy())),n.get(r).__currentAnisotropy=r.anisotropy}}}function R(e,i){let n=!1;void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",b));const s=i.source;let r=u.get(s);void 0===r&&(r={},u.set(s,r));const o=function(t){const 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()}(i);if(o!==e.__cacheKey){void 0===r[o]&&(r[o]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,n=!0),r[o].usedTimes++;const s=r[e.__cacheKey];void 0!==s&&(r[e.__cacheKey].usedTimes--,0===s.usedTimes&&S(i)),e.__cacheKey=o,e.__webglTexture=r[o].texture}return n}function P(e,a,o){let l=t.TEXTURE_2D;(a.isDataArrayTexture||a.isCompressedArrayTexture)&&(l=t.TEXTURE_2D_ARRAY),a.isData3DTexture&&(l=t.TEXTURE_3D);const c=R(e,a),h=a.source;i.bindTexture(l,e.__webglTexture,t.TEXTURE0+o);const d=n.get(h);if(h.version!==d.__version||!0===c){i.activeTexture(t.TEXTURE0+o);const e=ei.getPrimaries(ei.workingColorSpace),n=a.colorSpace===le?null:ei.getPrimaries(a.colorSpace),u=a.colorSpace===le||e===n?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,a.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,a.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);let p=f(a.image,!1,s.maxTextureSize);p=z(a,p);const m=r.convert(a.format,a.colorSpace),_=r.convert(a.type);let b,M=y(a.internalFormat,m,_,a.colorSpace,a.isVideoTexture);k(l,a);const S=a.mipmaps,T=!0!==a.isVideoTexture,E=void 0===d.__version||!0===c,A=h.dataReady,C=w(a,p);if(a.isDepthTexture)M=x(a.format===mt,a.type),E&&(T?i.texStorage2D(t.TEXTURE_2D,1,M,p.width,p.height):i.texImage2D(t.TEXTURE_2D,0,M,p.width,p.height,0,m,_,null));else if(a.isDataTexture)if(S.length>0){T&&E&&i.texStorage2D(t.TEXTURE_2D,C,M,S[0].width,S[0].height);for(let e=0,n=S.length;e<n;e++)b=S[e],T?A&&i.texSubImage2D(t.TEXTURE_2D,e,0,0,b.width,b.height,m,_,b.data):i.texImage2D(t.TEXTURE_2D,e,M,b.width,b.height,0,m,_,b.data);a.generateMipmaps=!1}else T?(E&&i.texStorage2D(t.TEXTURE_2D,C,M,p.width,p.height),A&&i.texSubImage2D(t.TEXTURE_2D,0,0,0,p.width,p.height,m,_,p.data)):i.texImage2D(t.TEXTURE_2D,0,M,p.width,p.height,0,m,_,p.data);else if(a.isCompressedTexture)if(a.isCompressedArrayTexture){T&&E&&i.texStorage3D(t.TEXTURE_2D_ARRAY,C,M,S[0].width,S[0].height,p.depth);for(let e=0,n=S.length;e<n;e++)if(b=S[e],a.format!==ht)if(null!==m)if(T){if(A)if(a.layerUpdates.size>0){const n=Mh(b.width,b.height,a.format,a.type);for(const s of a.layerUpdates){const r=b.data.subarray(s*n/b.data.BYTES_PER_ELEMENT,(s+1)*n/b.data.BYTES_PER_ELEMENT);i.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,s,b.width,b.height,1,m,r)}a.clearLayerUpdates()}else i.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,b.width,b.height,p.depth,m,b.data)}else i.compressedTexImage3D(t.TEXTURE_2D_ARRAY,e,M,b.width,b.height,p.depth,0,b.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else T?A&&i.texSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,b.width,b.height,p.depth,m,_,b.data):i.texImage3D(t.TEXTURE_2D_ARRAY,e,M,b.width,b.height,p.depth,0,m,_,b.data)}else{T&&E&&i.texStorage2D(t.TEXTURE_2D,C,M,S[0].width,S[0].height);for(let e=0,n=S.length;e<n;e++)b=S[e],a.format!==ht?null!==m?T?A&&i.compressedTexSubImage2D(t.TEXTURE_2D,e,0,0,b.width,b.height,m,b.data):i.compressedTexImage2D(t.TEXTURE_2D,e,M,b.width,b.height,0,b.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):T?A&&i.texSubImage2D(t.TEXTURE_2D,e,0,0,b.width,b.height,m,_,b.data):i.texImage2D(t.TEXTURE_2D,e,M,b.width,b.height,0,m,_,b.data)}else if(a.isDataArrayTexture)if(T){if(E&&i.texStorage3D(t.TEXTURE_2D_ARRAY,C,M,p.width,p.height,p.depth),A)if(a.layerUpdates.size>0){const e=Mh(p.width,p.height,a.format,a.type);for(const n of a.layerUpdates){const s=p.data.subarray(n*e/p.data.BYTES_PER_ELEMENT,(n+1)*e/p.data.BYTES_PER_ELEMENT);i.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,n,p.width,p.height,1,m,_,s)}a.clearLayerUpdates()}else i.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,m,_,p.data)}else i.texImage3D(t.TEXTURE_2D_ARRAY,0,M,p.width,p.height,p.depth,0,m,_,p.data);else if(a.isData3DTexture)T?(E&&i.texStorage3D(t.TEXTURE_3D,C,M,p.width,p.height,p.depth),A&&i.texSubImage3D(t.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,m,_,p.data)):i.texImage3D(t.TEXTURE_3D,0,M,p.width,p.height,p.depth,0,m,_,p.data);else if(a.isFramebufferTexture){if(E)if(T)i.texStorage2D(t.TEXTURE_2D,C,M,p.width,p.height);else{let e=p.width,n=p.height;for(let s=0;s<C;s++)i.texImage2D(t.TEXTURE_2D,s,M,e,n,0,m,_,null),e>>=1,n>>=1}}else if(S.length>0){if(T&&E){const e=$(S[0]);i.texStorage2D(t.TEXTURE_2D,C,M,e.width,e.height)}for(let e=0,n=S.length;e<n;e++)b=S[e],T?A&&i.texSubImage2D(t.TEXTURE_2D,e,0,0,m,_,b):i.texImage2D(t.TEXTURE_2D,e,M,m,_,b);a.generateMipmaps=!1}else if(T){if(E){const e=$(p);i.texStorage2D(t.TEXTURE_2D,C,M,e.width,e.height)}A&&i.texSubImage2D(t.TEXTURE_2D,0,0,0,m,_,p)}else i.texImage2D(t.TEXTURE_2D,0,M,m,_,p);g(a)&&v(l),d.__version=h.version,a.onUpdate&&a.onUpdate(a)}e.__version=a.version}function I(e,s,a,l,c,h){const d=r.convert(a.format,a.colorSpace),u=r.convert(a.type),p=y(a.internalFormat,d,u,a.colorSpace),m=n.get(s),f=n.get(a);if(f.__renderTarget=s,!m.__hasExternalTextures){const e=Math.max(1,s.width>>h),n=Math.max(1,s.height>>h);c===t.TEXTURE_3D||c===t.TEXTURE_2D_ARRAY?i.texImage3D(c,h,p,e,n,s.depth,0,d,u,null):i.texImage2D(c,h,p,e,n,0,d,u,null)}i.bindFramebuffer(t.FRAMEBUFFER,e),F(s)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,l,c,f.__webglTexture,0,B(s)):(c===t.TEXTURE_2D||c>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,l,c,f.__webglTexture,h),i.bindFramebuffer(t.FRAMEBUFFER,null)}function U(e,i,n){if(t.bindRenderbuffer(t.RENDERBUFFER,e),i.depthBuffer){const s=i.depthTexture,r=s&&s.isDepthTexture?s.type:null,a=x(i.stencilBuffer,r),l=i.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,c=B(i);F(i)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,c,a,i.width,i.height):n?t.renderbufferStorageMultisample(t.RENDERBUFFER,c,a,i.width,i.height):t.renderbufferStorage(t.RENDERBUFFER,a,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,l,t.RENDERBUFFER,e)}else{const e=i.textures;for(let s=0;s<e.length;s++){const a=e[s],l=r.convert(a.format,a.colorSpace),c=r.convert(a.type),h=y(a.internalFormat,l,c,a.colorSpace),d=B(i);n&&!1===F(i)?t.renderbufferStorageMultisample(t.RENDERBUFFER,d,h,i.width,i.height):F(i)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,d,h,i.width,i.height):t.renderbufferStorage(t.RENDERBUFFER,h,i.width,i.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function D(e){const s=n.get(e),r=!0===e.isWebGLCubeRenderTarget;if(s.__boundDepthTexture!==e.depthTexture){const t=e.depthTexture;if(s.__depthDisposeCallback&&s.__depthDisposeCallback(),t){const e=()=>{delete s.__boundDepthTexture,delete s.__depthDisposeCallback,t.removeEventListener("dispose",e)};t.addEventListener("dispose",e),s.__depthDisposeCallback=e}s.__boundDepthTexture=t}if(e.depthTexture&&!s.__autoAllocateDepthBuffer){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,s){if(s&&s.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(t.FRAMEBUFFER,e),!s.depthTexture||!s.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const r=n.get(s.depthTexture);r.__renderTarget=s,r.__webglTexture&&s.depthTexture.image.width===s.width&&s.depthTexture.image.height===s.height||(s.depthTexture.image.width=s.width,s.depthTexture.image.height=s.height,s.depthTexture.needsUpdate=!0),E(s.depthTexture,0);const a=r.__webglTexture,l=B(s);if(s.depthTexture.format===pt)F(s)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,a,0,l):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,a,0);else{if(s.depthTexture.format!==mt)throw new Error("Unknown depthTexture format");F(s)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,a,0,l):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,a,0)}}(s.__webglFramebuffer,e)}else if(r){s.__webglDepthbuffer=[];for(let n=0;n<6;n++)if(i.bindFramebuffer(t.FRAMEBUFFER,s.__webglFramebuffer[n]),void 0===s.__webglDepthbuffer[n])s.__webglDepthbuffer[n]=t.createRenderbuffer(),U(s.__webglDepthbuffer[n],e,!1);else{const i=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,r=s.__webglDepthbuffer[n];t.bindRenderbuffer(t.RENDERBUFFER,r),t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,r)}}else if(i.bindFramebuffer(t.FRAMEBUFFER,s.__webglFramebuffer),void 0===s.__webglDepthbuffer)s.__webglDepthbuffer=t.createRenderbuffer(),U(s.__webglDepthbuffer,e,!1);else{const i=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,n=s.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,n),t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,n)}i.bindFramebuffer(t.FRAMEBUFFER,null)}const N=[],O=[];function B(t){return Math.min(s.maxSamples,t.samples)}function F(t){const i=n.get(t);return t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function z(t,e){const i=t.colorSpace,n=t.format,s=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||i!==he&&i!==le&&(ei.getTransfer(i)===ue?n===ht&&s===J||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",i)),e}function $(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?(c.width=t.naturalWidth||t.width,c.height=t.naturalHeight||t.height):"undefined"!=typeof VideoFrame&&t instanceof VideoFrame?(c.width=t.displayWidth,c.height=t.displayHeight):(c.width=t.width,c.height=t.height),c}this.allocateTextureUnit=function(){const t=T;return t>=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+s.maxTextures),T+=1,t},this.resetTextureUnits=function(){T=0},this.setTexture2D=E,this.setTexture2DArray=function(e,s){const r=n.get(e);e.version>0&&r.__version!==e.version?P(r,e,s):i.bindTexture(t.TEXTURE_2D_ARRAY,r.__webglTexture,t.TEXTURE0+s)},this.setTexture3D=function(e,s){const r=n.get(e);e.version>0&&r.__version!==e.version?P(r,e,s):i.bindTexture(t.TEXTURE_3D,r.__webglTexture,t.TEXTURE0+s)},this.setTextureCube=function(e,a){const o=n.get(e);e.version>0&&o.__version!==e.version?function(e,a,o){if(6!==a.image.length)return;const l=R(e,a),c=a.source;i.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+o);const h=n.get(c);if(c.version!==h.__version||!0===l){i.activeTexture(t.TEXTURE0+o);const e=ei.getPrimaries(ei.workingColorSpace),n=a.colorSpace===le?null:ei.getPrimaries(a.colorSpace),d=a.colorSpace===le||e===n?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,a.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,a.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);const u=a.isCompressedTexture||a.image[0].isCompressedTexture,p=a.image[0]&&a.image[0].isDataTexture,m=[];for(let t=0;t<6;t++)m[t]=u||p?p?a.image[t].image:a.image[t]:f(a.image[t],!0,s.maxCubemapSize),m[t]=z(a,m[t]);const _=m[0],x=r.convert(a.format,a.colorSpace),b=r.convert(a.type),M=y(a.internalFormat,x,b,a.colorSpace),S=!0!==a.isVideoTexture,T=void 0===h.__version||!0===l,E=c.dataReady;let A,C=w(a,_);if(k(t.TEXTURE_CUBE_MAP,a),u){S&&T&&i.texStorage2D(t.TEXTURE_CUBE_MAP,C,M,_.width,_.height);for(let e=0;e<6;e++){A=m[e].mipmaps;for(let n=0;n<A.length;n++){const s=A[n];a.format!==ht?null!==x?S?E&&i.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,s.width,s.height,x,s.data):i.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,M,s.width,s.height,0,s.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):S?E&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,s.width,s.height,x,b,s.data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,M,s.width,s.height,0,x,b,s.data)}}}else{if(A=a.mipmaps,S&&T){A.length>0&&C++;const e=$(m[0]);i.texStorage2D(t.TEXTURE_CUBE_MAP,C,M,e.width,e.height)}for(let e=0;e<6;e++)if(p){S?E&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,m[e].width,m[e].height,x,b,m[e].data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,M,m[e].width,m[e].height,0,x,b,m[e].data);for(let n=0;n<A.length;n++){const s=A[n].image[e].image;S?E&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,0,0,s.width,s.height,x,b,s.data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,M,s.width,s.height,0,x,b,s.data)}}else{S?E&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,x,b,m[e]):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,M,x,b,m[e]);for(let n=0;n<A.length;n++){const s=A[n];S?E&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,0,0,x,b,s.image[e]):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,M,x,b,s.image[e])}}}g(a)&&v(t.TEXTURE_CUBE_MAP),h.__version=c.version,a.onUpdate&&a.onUpdate(a)}e.__version=a.version}(o,e,a):i.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture,t.TEXTURE0+a)},this.rebindTextures=function(e,i,s){const r=n.get(e);void 0!==i&&I(r.__webglFramebuffer,e,e.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),void 0!==s&&D(e)},this.setupRenderTarget=function(e){const s=e.texture,o=n.get(e),l=n.get(s);e.addEventListener("dispose",M);const c=e.textures,h=!0===e.isWebGLCubeRenderTarget,d=c.length>1;if(d||(void 0===l.__webglTexture&&(l.__webglTexture=t.createTexture()),l.__version=s.version,a.memory.textures++),h){o.__webglFramebuffer=[];for(let e=0;e<6;e++)if(s.mipmaps&&s.mipmaps.length>0){o.__webglFramebuffer[e]=[];for(let i=0;i<s.mipmaps.length;i++)o.__webglFramebuffer[e][i]=t.createFramebuffer()}else o.__webglFramebuffer[e]=t.createFramebuffer()}else{if(s.mipmaps&&s.mipmaps.length>0){o.__webglFramebuffer=[];for(let e=0;e<s.mipmaps.length;e++)o.__webglFramebuffer[e]=t.createFramebuffer()}else o.__webglFramebuffer=t.createFramebuffer();if(d)for(let e=0,i=c.length;e<i;e++){const i=n.get(c[e]);void 0===i.__webglTexture&&(i.__webglTexture=t.createTexture(),a.memory.textures++)}if(e.samples>0&&!1===F(e)){o.__webglMultisampledFramebuffer=t.createFramebuffer(),o.__webglColorRenderbuffer=[],i.bindFramebuffer(t.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let i=0;i<c.length;i++){const n=c[i];o.__webglColorRenderbuffer[i]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,o.__webglColorRenderbuffer[i]);const s=r.convert(n.format,n.colorSpace),a=r.convert(n.type),l=y(n.internalFormat,s,a,n.colorSpace,!0===e.isXRRenderTarget),h=B(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,h,l,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+i,t.RENDERBUFFER,o.__webglColorRenderbuffer[i])}t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(o.__webglDepthRenderbuffer=t.createRenderbuffer(),U(o.__webglDepthRenderbuffer,e,!0)),i.bindFramebuffer(t.FRAMEBUFFER,null)}}if(h){i.bindTexture(t.TEXTURE_CUBE_MAP,l.__webglTexture),k(t.TEXTURE_CUBE_MAP,s);for(let i=0;i<6;i++)if(s.mipmaps&&s.mipmaps.length>0)for(let n=0;n<s.mipmaps.length;n++)I(o.__webglFramebuffer[i][n],e,s,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+i,n);else I(o.__webglFramebuffer[i],e,s,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+i,0);g(s)&&v(t.TEXTURE_CUBE_MAP),i.unbindTexture()}else if(d){for(let s=0,r=c.length;s<r;s++){const r=c[s],a=n.get(r);i.bindTexture(t.TEXTURE_2D,a.__webglTexture),k(t.TEXTURE_2D,r),I(o.__webglFramebuffer,e,r,t.COLOR_ATTACHMENT0+s,t.TEXTURE_2D,0),g(r)&&v(t.TEXTURE_2D)}i.unbindTexture()}else{let n=t.TEXTURE_2D;if((e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(n=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),i.bindTexture(n,l.__webglTexture),k(n,s),s.mipmaps&&s.mipmaps.length>0)for(let i=0;i<s.mipmaps.length;i++)I(o.__webglFramebuffer[i],e,s,t.COLOR_ATTACHMENT0,n,i);else I(o.__webglFramebuffer,e,s,t.COLOR_ATTACHMENT0,n,0);g(s)&&v(n),i.unbindTexture()}e.depthBuffer&&D(e)},this.updateRenderTargetMipmap=function(t){const e=t.textures;for(let s=0,r=e.length;s<r;s++){const r=e[s];if(g(r)){const e=_(t),s=n.get(r).__webglTexture;i.bindTexture(e,s),v(e),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(e.samples>0)if(!1===F(e)){const s=e.textures,r=e.width,a=e.height;let o=t.COLOR_BUFFER_BIT;const c=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,h=n.get(e),d=s.length>1;if(d)for(let e=0;e<s.length;e++)i.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,null),i.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,null,0);i.bindFramebuffer(t.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),i.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let i=0;i<s.length;i++){if(e.resolveDepthBuffer&&(e.depthBuffer&&(o|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&e.resolveStencilBuffer&&(o|=t.STENCIL_BUFFER_BIT)),d){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,h.__webglColorRenderbuffer[i]);const e=n.get(s[i]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0)}t.blitFramebuffer(0,0,r,a,0,0,r,a,o,t.NEAREST),!0===l&&(N.length=0,O.length=0,N.push(t.COLOR_ATTACHMENT0+i),e.depthBuffer&&!1===e.resolveDepthBuffer&&(N.push(c),O.push(c),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,O)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,N))}if(i.bindFramebuffer(t.READ_FRAMEBUFFER,null),i.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),d)for(let e=0;e<s.length;e++){i.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,h.__webglColorRenderbuffer[e]);const r=n.get(s[e]).__webglTexture;i.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,r,0)}i.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(e.depthBuffer&&!1===e.resolveDepthBuffer&&l){const i=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[i])}},this.setupDepthRenderbuffer=D,this.setupFrameBufferTexture=I,this.useMultisampledRTT=F}function Qu(t,e){return{convert:function(i,n=""){let s;const r=ei.getTransfer(n);if(i===J)return t.UNSIGNED_BYTE;if(i===st)return t.UNSIGNED_SHORT_4_4_4_4;if(i===rt)return t.UNSIGNED_SHORT_5_5_5_1;if(i===ot)return t.UNSIGNED_INT_5_9_9_9_REV;if(i===$)return t.BYTE;if(i===K)return t.SHORT;if(i===Q)return t.UNSIGNED_SHORT;if(i===tt)return t.INT;if(i===et)return t.UNSIGNED_INT;if(i===it)return t.FLOAT;if(i===nt)return t.HALF_FLOAT;if(i===lt)return t.ALPHA;if(i===ct)return t.RGB;if(i===ht)return t.RGBA;if(i===dt)return t.LUMINANCE;if(i===ut)return t.LUMINANCE_ALPHA;if(i===pt)return t.DEPTH_COMPONENT;if(i===mt)return t.DEPTH_STENCIL;if(i===ft)return t.RED;if(i===gt)return t.RED_INTEGER;if(i===vt)return t.RG;if(i===_t)return t.RG_INTEGER;if(i===yt)return t.RGBA_INTEGER;if(i===xt||i===wt||i===bt||i===Mt)if(r===ue){if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===s)return null;if(i===xt)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===wt)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===bt)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Mt)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(s=e.get("WEBGL_compressed_texture_s3tc"),null===s)return null;if(i===xt)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===wt)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===bt)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Mt)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(i===St||i===Tt||i===Et||i===At){if(s=e.get("WEBGL_compressed_texture_pvrtc"),null===s)return null;if(i===St)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Tt)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Et)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===At)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(i===Ct||i===Lt||i===kt){if(s=e.get("WEBGL_compressed_texture_etc"),null===s)return null;if(i===Ct||i===Lt)return r===ue?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===kt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}if(i===Rt||i===Pt||i===It||i===Ut||i===Dt||i===Nt||i===Ot||i===Bt||i===Ft||i===zt||i===Ht||i===Vt||i===Gt||i===jt){if(s=e.get("WEBGL_compressed_texture_astc"),null===s)return null;if(i===Rt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Pt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===It)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Ut)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Dt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Nt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Ot)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===Bt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Ft)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===zt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Ht)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Vt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Gt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===jt)return r===ue?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}if(i===Wt||i===qt||i===Xt){if(s=e.get("EXT_texture_compression_bptc"),null===s)return null;if(i===Wt)return r===ue?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===qt)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Xt)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(i===Zt||i===Yt||i===Jt||i===$t){if(s=e.get("EXT_texture_compression_rgtc"),null===s)return null;if(i===Wt)return s.COMPRESSED_RED_RGTC1_EXT;if(i===Yt)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Jt)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===$t)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return i===at?t.UNSIGNED_INT_24_8:void 0!==t[i]?t[i]:null}}}class tp{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,i){if(null===this.texture){const n=new hi;t.properties.get(n).__webglTexture=e.texture,e.depthNear===i.depthNear&&e.depthFar===i.depthFar||(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(t){if(null!==this.texture&&null===this.mesh){const e=t.cameras[0].viewport,i=new Ls({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\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}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new bs(new qo(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class ep extends ke{constructor(t,e){super();const i=this;let n=null,s=1,r=null,a="local-floor",o=1,l=null,c=null,h=null,d=null,u=null,p=null;const m=new tp,f=e.getContextAttributes();let g=null,v=null;const _=[],y=[],x=new Ve;let w=null;const b=new Us;b.viewport=new di;const M=new Us;M.viewport=new di;const S=[b,M],T=new wc;let E=null,A=null;function C(t){const e=y.indexOf(t.inputSource);if(-1===e)return;const i=_[e];void 0!==i&&(i.update(t.inputSource,t.frame,l||r),i.dispatchEvent({type:t.type,data:t.inputSource}))}function L(){n.removeEventListener("select",C),n.removeEventListener("selectstart",C),n.removeEventListener("selectend",C),n.removeEventListener("squeeze",C),n.removeEventListener("squeezestart",C),n.removeEventListener("squeezeend",C),n.removeEventListener("end",L),n.removeEventListener("inputsourceschange",k);for(let t=0;t<_.length;t++){const e=y[t];null!==e&&(y[t]=null,_[t].disconnect(e))}E=null,A=null,m.reset(),t.setRenderTarget(g),u=null,d=null,h=null,n=null,v=null,D.stop(),i.isPresenting=!1,t.setPixelRatio(w),t.setSize(x.width,x.height,!1),i.dispatchEvent({type:"sessionend"})}function k(t){for(let e=0;e<t.removed.length;e++){const i=t.removed[e],n=y.indexOf(i);n>=0&&(y[n]=null,_[n].disconnect(i))}for(let e=0;e<t.added.length;e++){const i=t.added[e];let n=y.indexOf(i);if(-1===n){for(let t=0;t<_.length;t++){if(t>=y.length){y.push(i),n=t;break}if(null===y[t]){y[t]=i,n=t;break}}if(-1===n)break}const s=_[n];s&&s.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=_[t];return void 0===e&&(e=new Hs,_[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=_[t];return void 0===e&&(e=new Hs,_[t]=e),e.getGripSpace()},this.getHand=function(t){let e=_[t];return void 0===e&&(e=new Hs,_[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){s=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){a=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||r},this.setReferenceSpace=function(t){l=t},this.getBaseLayer=function(){return null!==d?d:u},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return n},this.setSession=async function(c){if(n=c,null!==n){g=t.getRenderTarget(),n.addEventListener("select",C),n.addEventListener("selectstart",C),n.addEventListener("selectend",C),n.addEventListener("squeeze",C),n.addEventListener("squeezestart",C),n.addEventListener("squeezeend",C),n.addEventListener("end",L),n.addEventListener("inputsourceschange",k),!0!==f.xrCompatible&&await e.makeXRCompatible(),w=t.getPixelRatio(),t.getSize(x);if("undefined"!=typeof XRWebGLBinding&&"createProjectionLayer"in XRWebGLBinding.prototype){let i=null,r=null,a=null;f.depth&&(a=f.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,i=f.stencil?mt:pt,r=f.stencil?at:et);const o={colorFormat:e.RGBA8,depthFormat:a,scaleFactor:s};h=new XRWebGLBinding(n,e),d=h.createProjectionLayer(o),n.updateRenderState({layers:[d]}),t.setPixelRatio(1),t.setSize(d.textureWidth,d.textureHeight,!1),v=new pi(d.textureWidth,d.textureHeight,{format:ht,type:J,depthTexture:new Ra(d.textureWidth,d.textureHeight,r,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:f.stencil,colorSpace:t.outputColorSpace,samples:f.antialias?4:0,resolveDepthBuffer:!1===d.ignoreDepthValues})}else{const i={antialias:f.antialias,alpha:!0,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:s};u=new XRWebGLLayer(n,e,i),n.updateRenderState({baseLayer:u}),t.setPixelRatio(1),t.setSize(u.framebufferWidth,u.framebufferHeight,!1),v=new pi(u.framebufferWidth,u.framebufferHeight,{format:ht,type:J,colorSpace:t.outputColorSpace,stencilBuffer:f.stencil})}v.isXRRenderTarget=!0,this.setFoveation(o),l=null,r=await n.requestReferenceSpace(a),D.setContext(n),D.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==n)return n.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};const R=new vi,P=new vi;function I(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===n)return;let e=t.near,i=t.far;null!==m.texture&&(m.depthNear>0&&(e=m.depthNear),m.depthFar>0&&(i=m.depthFar)),T.near=M.near=b.near=e,T.far=M.far=b.far=i,E===T.near&&A===T.far||(n.updateRenderState({depthNear:T.near,depthFar:T.far}),E=T.near,A=T.far),b.layers.mask=2|t.layers.mask,M.layers.mask=4|t.layers.mask,T.layers.mask=b.layers.mask|M.layers.mask;const s=t.parent,r=T.cameras;I(T,s);for(let t=0;t<r.length;t++)I(r[t],s);2===r.length?function(t,e,i){R.setFromMatrixPosition(e.matrixWorld),P.setFromMatrixPosition(i.matrixWorld);const n=R.distanceTo(P),s=e.projectionMatrix.elements,r=i.projectionMatrix.elements,a=s[14]/(s[10]-1),o=s[14]/(s[10]+1),l=(s[9]+1)/s[5],c=(s[9]-1)/s[5],h=(s[8]-1)/s[0],d=(r[8]+1)/r[0],u=a*h,p=a*d,m=n/(-h+d),f=m*-h;if(e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(f),t.translateZ(m),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert(),-1===s[10])t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{const e=a+m,i=o+m,s=u-f,r=p+(n-f),h=l*o/i*e,d=c*o/i*e;t.projectionMatrix.makePerspective(s,r,h,d,e,i),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}}(T,b,M):T.projectionMatrix.copy(b.projectionMatrix),function(t,e,i){null===i?t.matrix.copy(e.matrixWorld):(t.matrix.copy(i.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*Ue*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}(t,T,s)},this.getCamera=function(){return T},this.getFoveation=function(){if(null!==d||null!==u)return o},this.setFoveation=function(t){o=t,null!==d&&(d.fixedFoveation=t),null!==u&&void 0!==u.fixedFoveation&&(u.fixedFoveation=t)},this.hasDepthSensing=function(){return null!==m.texture},this.getDepthSensingMesh=function(){return m.getMesh(T)};let U=null;const D=new Th;D.setAnimationLoop((function(e,s){if(c=s.getViewerPose(l||r),p=s,null!==c){const e=c.views;null!==u&&(t.setRenderTargetFramebuffer(v,u.framebuffer),t.setRenderTarget(v));let i=!1;e.length!==T.cameras.length&&(T.cameras.length=0,i=!0);for(let n=0;n<e.length;n++){const s=e[n];let r=null;if(null!==u)r=u.getViewport(s);else{const e=h.getViewSubImage(d,s);r=e.viewport,0===n&&(t.setRenderTargetTextures(v,e.colorTexture,d.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(v))}let a=S[n];void 0===a&&(a=new Us,a.layers.enable(n),a.viewport=new di,S[n]=a),a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale),a.projectionMatrix.fromArray(s.projectionMatrix),a.projectionMatrixInverse.copy(a.projectionMatrix).invert(),a.viewport.set(r.x,r.y,r.width,r.height),0===n&&(T.matrix.copy(a.matrix),T.matrix.decompose(T.position,T.quaternion,T.scale)),!0===i&&T.cameras.push(a)}const s=n.enabledFeatures;if(s&&s.includes("depth-sensing")&&"gpu-optimized"==n.depthUsage&&h){const i=h.getDepthInformation(e[0]);i&&i.isValid&&i.texture&&m.init(t,i,n.renderState)}}for(let t=0;t<_.length;t++){const e=y[t],i=_[t];null!==e&&void 0!==i&&i.update(e,s,l||r)}U&&U(e,s),s.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:s}),p=null})),this.setAnimationLoop=function(t){U=t},this.dispose=function(){}}}const ip=new sn,np=new Xi;function sp(t,e){function i(t,e){!0===t.matrixAutoUpdate&&t.updateMatrix(),e.value.copy(t.matrix)}function n(t,n){t.opacity.value=n.opacity,n.color&&t.diffuse.value.copy(n.color),n.emissive&&t.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(t.map.value=n.map,i(n.map,t.mapTransform)),n.alphaMap&&(t.alphaMap.value=n.alphaMap,i(n.alphaMap,t.alphaMapTransform)),n.bumpMap&&(t.bumpMap.value=n.bumpMap,i(n.bumpMap,t.bumpMapTransform),t.bumpScale.value=n.bumpScale,1===n.side&&(t.bumpScale.value*=-1)),n.normalMap&&(t.normalMap.value=n.normalMap,i(n.normalMap,t.normalMapTransform),t.normalScale.value.copy(n.normalScale),1===n.side&&t.normalScale.value.negate()),n.displacementMap&&(t.displacementMap.value=n.displacementMap,i(n.displacementMap,t.displacementMapTransform),t.displacementScale.value=n.displacementScale,t.displacementBias.value=n.displacementBias),n.emissiveMap&&(t.emissiveMap.value=n.emissiveMap,i(n.emissiveMap,t.emissiveMapTransform)),n.specularMap&&(t.specularMap.value=n.specularMap,i(n.specularMap,t.specularMapTransform)),n.alphaTest>0&&(t.alphaTest.value=n.alphaTest);const s=e.get(n),r=s.envMap,a=s.envMapRotation;r&&(t.envMap.value=r,ip.copy(a),ip.x*=-1,ip.y*=-1,ip.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(ip.y*=-1,ip.z*=-1),t.envMapRotation.value.setFromMatrix4(np.makeRotationFromEuler(ip)),t.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,t.reflectivity.value=n.reflectivity,t.ior.value=n.ior,t.refractionRatio.value=n.refractionRatio),n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity,i(n.lightMap,t.lightMapTransform)),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity,i(n.aoMap,t.aoMapTransform))}return{refreshFogUniforms:function(e,i){i.color.getRGB(e.fogColor.value,As(t)),i.isFog?(e.fogNear.value=i.near,e.fogFar.value=i.far):i.isFogExp2&&(e.fogDensity.value=i.density)},refreshMaterialUniforms:function(t,s,r,a,o){s.isMeshBasicMaterial||s.isMeshLambertMaterial?n(t,s):s.isMeshToonMaterial?(n(t,s),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,s)):s.isMeshPhongMaterial?(n(t,s),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,s)):s.isMeshStandardMaterial?(n(t,s),function(t,e){t.metalness.value=e.metalness,e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap,i(e.metalnessMap,t.metalnessMapTransform));t.roughness.value=e.roughness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap,i(e.roughnessMap,t.roughnessMapTransform));e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}(t,s),s.isMeshPhysicalMaterial&&function(t,e,n){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,i(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,i(e.sheenRoughnessMap,t.sheenRoughnessMapTransform)));e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,i(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,i(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,i(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),1===e.side&&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,i(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,i(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform)));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,i(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,i(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,i(e.anisotropyMap,t.anisotropyMapTransform)));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,i(e.specularColorMap,t.specularColorMapTransform));e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,i(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,s,o)):s.isMeshMatcapMaterial?(n(t,s),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,s)):s.isMeshDepthMaterial?n(t,s):s.isMeshDistanceMaterial?(n(t,s),function(t,i){const n=e.get(i).light;t.referencePosition.value.setFromMatrixPosition(n.matrixWorld),t.nearDistance.value=n.shadow.camera.near,t.farDistance.value=n.shadow.camera.far}(t,s)):s.isMeshNormalMaterial?n(t,s):s.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,i(e.map,t.mapTransform))}(t,s),s.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,s)):s.isPointsMaterial?function(t,e,n,s){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*s,e.map&&(t.map.value=e.map,i(e.map,t.uvTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap,i(e.alphaMap,t.alphaMapTransform));e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,s,r,a):s.isSpriteMaterial?function(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,i(e.map,t.mapTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap,i(e.alphaMap,t.alphaMapTransform));e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,s):s.isShadowMaterial?(t.color.value.copy(s.color),t.opacity.value=s.opacity):s.isShaderMaterial&&(s.uniformsNeedUpdate=!1)}}}function rp(t,e,i,n){let s={},r={},a=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(t,e,i,n){const s=t.value,r=e+"_"+i;if(void 0===n[r])return n[r]="number"==typeof s||"boolean"==typeof s?s:s.clone(),!0;{const t=n[r];if("number"==typeof s||"boolean"==typeof s){if(t!==s)return n[r]=s,!0}else if(!1===t.equals(s))return t.copy(s),!0}return!1}function c(t){const 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 h(e){const i=e.target;i.removeEventListener("dispose",h);const n=a.indexOf(i.__bindingPointIndex);a.splice(n,1),t.deleteBuffer(s[i.id]),delete s[i.id],delete r[i.id]}return{bind:function(t,e){const i=e.program;n.uniformBlockBinding(t,i)},update:function(i,d){let u=s[i.id];void 0===u&&(!function(t){const e=t.uniforms;let i=0;const n=16;for(let t=0,s=e.length;t<s;t++){const s=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0,e=s.length;t<e;t++){const e=s[t],r=Array.isArray(e.value)?e.value:[e.value];for(let t=0,s=r.length;t<s;t++){const s=c(r[t]),a=i%n,o=a%s.boundary,l=a+o;i+=o,0!==l&&n-l<s.storage&&(i+=n-l),e.__data=new Float32Array(s.storage/Float32Array.BYTES_PER_ELEMENT),e.__offset=i,i+=s.storage}}}const s=i%n;s>0&&(i+=n-s);t.__size=i,t.__cache={}}(i),u=function(e){const i=function(){for(let t=0;t<o;t++)if(-1===a.indexOf(t))return a.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();e.__bindingPointIndex=i;const n=t.createBuffer(),s=e.__size,r=e.usage;return t.bindBuffer(t.UNIFORM_BUFFER,n),t.bufferData(t.UNIFORM_BUFFER,s,r),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,i,n),n}(i),s[i.id]=u,i.addEventListener("dispose",h));const p=d.program;n.updateUBOMapping(i,p);const m=e.render.frame;r[i.id]!==m&&(!function(e){const i=s[e.id],n=e.uniforms,r=e.__cache;t.bindBuffer(t.UNIFORM_BUFFER,i);for(let e=0,i=n.length;e<i;e++){const i=Array.isArray(n[e])?n[e]:[n[e]];for(let n=0,s=i.length;n<s;n++){const s=i[n];if(!0===l(s,e,n,r)){const e=s.__offset,i=Array.isArray(s.value)?s.value:[s.value];let n=0;for(let r=0;r<i.length;r++){const a=i[r],o=c(a);"number"==typeof a||"boolean"==typeof a?(s.__data[0]=a,t.bufferSubData(t.UNIFORM_BUFFER,e+n,s.__data)):a.isMatrix3?(s.__data[0]=a.elements[0],s.__data[1]=a.elements[1],s.__data[2]=a.elements[2],s.__data[3]=0,s.__data[4]=a.elements[3],s.__data[5]=a.elements[4],s.__data[6]=a.elements[5],s.__data[7]=0,s.__data[8]=a.elements[6],s.__data[9]=a.elements[7],s.__data[10]=a.elements[8],s.__data[11]=0):(a.toArray(s.__data,n),n+=o.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,e,s.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}(i),r[i.id]=m)},dispose:function(){for(const e in s)t.deleteBuffer(s[e]);a=[],s={},r={}}}}class ap{constructor(t={}){const{canvas:i=Ye(),context:n=null,depth:s=!0,stencil:r=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1,reverseDepthBuffer:u=!1}=t;let p;if(this.isWebGLRenderer=!0,null!==n){if("undefined"!=typeof WebGLRenderingContext&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=a;const m=new Uint32Array(4),f=new Int32Array(4);let g=null,v=null;const _=[],y=[];this.domElement=i,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._outputColorSpace=ce,this.toneMapping=0,this.toneMappingExposure=1;const x=this;let w=!1,b=0,M=0,S=null,T=-1,E=null;const A=new di,C=new di;let L=null;const k=new zn(0);let R=0,P=i.width,I=i.height,U=1,D=null,N=null;const O=new di(0,0,P,I),B=new di(0,0,P,I);let F=!1;const z=new Gr;let H=!1,V=!1;this.transmissionResolutionScale=1;const G=new Xi,j=new Xi,W=new vi,q=new di,X={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Z=!1;function $(){return null===S?U:1}let K,tt,it,ot,lt,ct,ht,dt,ut,pt,mt,ft,vt,xt,wt,bt,Mt,St,Tt,Et,At,Ct,Lt,kt,Rt=n;function Pt(t,e){return i.getContext(t,e)}try{const t={alpha:!0,depth:s,stencil:r,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in i&&i.setAttribute("data-engine",`three.js r${e}`),i.addEventListener("webglcontextlost",Dt,!1),i.addEventListener("webglcontextrestored",Nt,!1),i.addEventListener("webglcontextcreationerror",Ot,!1),null===Rt){const e="webgl2";if(Rt=Pt(e,t),null===Rt)throw Pt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function It(){K=new nd(Rt),K.init(),Ct=new Qu(Rt,K),tt=new Nh(Rt,K,t,Ct),it=new $u(Rt,K),tt.reverseDepthBuffer&&u&&it.buffers.depth.setReversed(!0),ot=new ad(Rt),lt=new Bu,ct=new Ku(Rt,K,it,lt,tt,Ct,ot),ht=new Bh(x),dt=new id(x),ut=new Eh(Rt),Lt=new Uh(Rt,ut),pt=new sd(Rt,ut,ot,Lt),mt=new ld(Rt,pt,ut,ot),Tt=new od(Rt,tt,ct),bt=new Oh(lt),ft=new Ou(x,ht,dt,K,tt,Lt,bt),vt=new sp(x,lt),xt=new Vu,wt=new Zu(K),St=new Ih(x,ht,dt,it,mt,p,l),Mt=new Yu(x,mt,tt),kt=new rp(Rt,ot,tt,it),Et=new Dh(Rt,K,ot),At=new rd(Rt,K,ot),ot.programs=ft.programs,x.capabilities=tt,x.extensions=K,x.properties=lt,x.renderLists=xt,x.shadowMap=Mt,x.state=it,x.info=ot}It();const Ut=new ep(x,Rt);function Dt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),w=!0}function Nt(){console.log("THREE.WebGLRenderer: Context Restored."),w=!1;const t=ot.autoReset,e=Mt.enabled,i=Mt.autoUpdate,n=Mt.needsUpdate,s=Mt.type;It(),ot.autoReset=t,Mt.enabled=e,Mt.autoUpdate=i,Mt.needsUpdate=n,Mt.type=s}function Ot(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function Bt(t){const e=t.target;e.removeEventListener("dispose",Bt),function(t){(function(t){const e=lt.get(t).programs;void 0!==e&&(e.forEach((function(t){ft.releaseProgram(t)})),t.isShaderMaterial&&ft.releaseShaderCache(t))})(t),lt.remove(t)}(e)}function Ft(t,e,i){!0===t.transparent&&2===t.side&&!1===t.forceSinglePass?(t.side=1,t.needsUpdate=!0,Yt(t,e,i),t.side=0,t.needsUpdate=!0,Yt(t,e,i),t.side=2):Yt(t,e,i)}this.xr=Ut,this.getContext=function(){return Rt},this.getContextAttributes=function(){return Rt.getContextAttributes()},this.forceContextLoss=function(){const t=K.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=K.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return U},this.setPixelRatio=function(t){void 0!==t&&(U=t,this.setSize(P,I,!1))},this.getSize=function(t){return t.set(P,I)},this.setSize=function(t,e,n=!0){Ut.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(P=t,I=e,i.width=Math.floor(t*U),i.height=Math.floor(e*U),!0===n&&(i.style.width=t+"px",i.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(t){return t.set(P*U,I*U).floor()},this.setDrawingBufferSize=function(t,e,n){P=t,I=e,U=n,i.width=Math.floor(t*n),i.height=Math.floor(e*n),this.setViewport(0,0,t,e)},this.getCurrentViewport=function(t){return t.copy(A)},this.getViewport=function(t){return t.copy(O)},this.setViewport=function(t,e,i,n){t.isVector4?O.set(t.x,t.y,t.z,t.w):O.set(t,e,i,n),it.viewport(A.copy(O).multiplyScalar(U).round())},this.getScissor=function(t){return t.copy(B)},this.setScissor=function(t,e,i,n){t.isVector4?B.set(t.x,t.y,t.z,t.w):B.set(t,e,i,n),it.scissor(C.copy(B).multiplyScalar(U).round())},this.getScissorTest=function(){return F},this.setScissorTest=function(t){it.setScissorTest(F=t)},this.setOpaqueSort=function(t){D=t},this.setTransparentSort=function(t){N=t},this.getClearColor=function(t){return t.copy(St.getClearColor())},this.setClearColor=function(){St.setClearColor.apply(St,arguments)},this.getClearAlpha=function(){return St.getClearAlpha()},this.setClearAlpha=function(){St.setClearAlpha.apply(St,arguments)},this.clear=function(t=!0,e=!0,i=!0){let n=0;if(t){let t=!1;if(null!==S){const e=S.texture.format;t=e===yt||e===_t||e===gt}if(t){const t=S.texture.type,e=t===J||t===et||t===Q||t===at||t===st||t===rt,i=St.getClearColor(),n=St.getClearAlpha(),s=i.r,r=i.g,a=i.b;e?(m[0]=s,m[1]=r,m[2]=a,m[3]=n,Rt.clearBufferuiv(Rt.COLOR,0,m)):(f[0]=s,f[1]=r,f[2]=a,f[3]=n,Rt.clearBufferiv(Rt.COLOR,0,f))}else n|=Rt.COLOR_BUFFER_BIT}e&&(n|=Rt.DEPTH_BUFFER_BIT),i&&(n|=Rt.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Rt.clear(n)},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(){i.removeEventListener("webglcontextlost",Dt,!1),i.removeEventListener("webglcontextrestored",Nt,!1),i.removeEventListener("webglcontextcreationerror",Ot,!1),St.dispose(),xt.dispose(),wt.dispose(),lt.dispose(),ht.dispose(),dt.dispose(),mt.dispose(),Lt.dispose(),kt.dispose(),ft.dispose(),Ut.dispose(),Ut.removeEventListener("sessionstart",Ht),Ut.removeEventListener("sessionend",Vt),Gt.stop()},this.renderBufferDirect=function(t,e,i,n,s,r){null===e&&(e=X);const a=s.isMesh&&s.matrixWorld.determinant()<0,o=function(t,e,i,n,s){!0!==e.isScene&&(e=X);ct.resetTextureUnits();const r=e.fog,a=n.isMeshStandardMaterial?e.environment:null,o=null===S?x.outputColorSpace:!0===S.isXRRenderTarget?S.texture.colorSpace:he,l=(n.isMeshStandardMaterial?dt:ht).get(n.envMap||a),c=!0===n.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,h=!!i.attributes.tangent&&(!!n.normalMap||n.anisotropy>0),d=!!i.morphAttributes.position,u=!!i.morphAttributes.normal,p=!!i.morphAttributes.color;let m=0;n.toneMapped&&(null!==S&&!0!==S.isXRRenderTarget||(m=x.toneMapping));const f=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,g=void 0!==f?f.length:0,_=lt.get(n),y=v.state.lights;if(!0===H&&(!0===V||t!==E)){const e=t===E&&n.id===T;bt.setState(n,t,e)}let w=!1;n.version===_.__version?_.needsLights&&_.lightsStateVersion!==y.state.version||_.outputColorSpace!==o||s.isBatchedMesh&&!1===_.batching?w=!0:s.isBatchedMesh||!0!==_.batching?s.isBatchedMesh&&!0===_.batchingColor&&null===s.colorTexture||s.isBatchedMesh&&!1===_.batchingColor&&null!==s.colorTexture||s.isInstancedMesh&&!1===_.instancing?w=!0:s.isInstancedMesh||!0!==_.instancing?s.isSkinnedMesh&&!1===_.skinning?w=!0:s.isSkinnedMesh||!0!==_.skinning?s.isInstancedMesh&&!0===_.instancingColor&&null===s.instanceColor||s.isInstancedMesh&&!1===_.instancingColor&&null!==s.instanceColor||s.isInstancedMesh&&!0===_.instancingMorph&&null===s.morphTexture||s.isInstancedMesh&&!1===_.instancingMorph&&null!==s.morphTexture||_.envMap!==l||!0===n.fog&&_.fog!==r?w=!0:void 0===_.numClippingPlanes||_.numClippingPlanes===bt.numPlanes&&_.numIntersection===bt.numIntersection?(_.vertexAlphas!==c||_.vertexTangents!==h||_.morphTargets!==d||_.morphNormals!==u||_.morphColors!==p||_.toneMapping!==m||_.morphTargetsCount!==g)&&(w=!0):w=!0:w=!0:w=!0:w=!0:(w=!0,_.__version=n.version);let b=_.currentProgram;!0===w&&(b=Yt(n,e,s));let M=!1,A=!1,C=!1;const L=b.getUniforms(),k=_.uniforms;it.useProgram(b.program)&&(M=!0,A=!0,C=!0);n.id!==T&&(T=n.id,A=!0);if(M||E!==t){it.buffers.depth.getReversed()?(G.copy(t.projectionMatrix),function(t){const e=t.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}(G),function(t){const e=t.elements;-1===e[11]?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=1-e[14])}(G),L.setValue(Rt,"projectionMatrix",G)):L.setValue(Rt,"projectionMatrix",t.projectionMatrix),L.setValue(Rt,"viewMatrix",t.matrixWorldInverse);const e=L.map.cameraPosition;void 0!==e&&e.setValue(Rt,W.setFromMatrixPosition(t.matrixWorld)),tt.logarithmicDepthBuffer&&L.setValue(Rt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&L.setValue(Rt,"isOrthographic",!0===t.isOrthographicCamera),E!==t&&(E=t,A=!0,C=!0)}if(s.isSkinnedMesh){L.setOptional(Rt,s,"bindMatrix"),L.setOptional(Rt,s,"bindMatrixInverse");const t=s.skeleton;t&&(null===t.boneTexture&&t.computeBoneTexture(),L.setValue(Rt,"boneTexture",t.boneTexture,ct))}s.isBatchedMesh&&(L.setOptional(Rt,s,"batchingTexture"),L.setValue(Rt,"batchingTexture",s._matricesTexture,ct),L.setOptional(Rt,s,"batchingIdTexture"),L.setValue(Rt,"batchingIdTexture",s._indirectTexture,ct),L.setOptional(Rt,s,"batchingColorTexture"),null!==s._colorsTexture&&L.setValue(Rt,"batchingColorTexture",s._colorsTexture,ct));const R=i.morphAttributes;void 0===R.position&&void 0===R.normal&&void 0===R.color||Tt.update(s,i,b);(A||_.receiveShadow!==s.receiveShadow)&&(_.receiveShadow=s.receiveShadow,L.setValue(Rt,"receiveShadow",s.receiveShadow));n.isMeshGouraudMaterial&&null!==n.envMap&&(k.envMap.value=l,k.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1);n.isMeshStandardMaterial&&null===n.envMap&&null!==e.environment&&(k.envMapIntensity.value=e.environmentIntensity);A&&(L.setValue(Rt,"toneMappingExposure",x.toneMappingExposure),_.needsLights&&(D=C,(P=k).ambientLightColor.needsUpdate=D,P.lightProbe.needsUpdate=D,P.directionalLights.needsUpdate=D,P.directionalLightShadows.needsUpdate=D,P.pointLights.needsUpdate=D,P.pointLightShadows.needsUpdate=D,P.spotLights.needsUpdate=D,P.spotLightShadows.needsUpdate=D,P.rectAreaLights.needsUpdate=D,P.hemisphereLights.needsUpdate=D),r&&!0===n.fog&&vt.refreshFogUniforms(k,r),vt.refreshMaterialUniforms(k,n,U,I,v.state.transmissionRenderTarget[t.id]),pu.upload(Rt,Jt(_),k,ct));var P,D;n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(pu.upload(Rt,Jt(_),k,ct),n.uniformsNeedUpdate=!1);n.isSpriteMaterial&&L.setValue(Rt,"center",s.center);if(L.setValue(Rt,"modelViewMatrix",s.modelViewMatrix),L.setValue(Rt,"normalMatrix",s.normalMatrix),L.setValue(Rt,"modelMatrix",s.matrixWorld),n.isShaderMaterial||n.isRawShaderMaterial){const t=n.uniformsGroups;for(let e=0,i=t.length;e<i;e++){const i=t[e];kt.update(i,b),kt.bind(i,b)}}return b}(t,e,i,n,s);it.setMaterial(n,a);let l=i.index,c=1;if(!0===n.wireframe){if(l=pt.getWireframeAttribute(i),void 0===l)return;c=2}const h=i.drawRange,d=i.attributes.position;let u=h.start*c,p=(h.start+h.count)*c;null!==r&&(u=Math.max(u,r.start*c),p=Math.min(p,(r.start+r.count)*c)),null!==l?(u=Math.max(u,0),p=Math.min(p,l.count)):null!=d&&(u=Math.max(u,0),p=Math.min(p,d.count));const m=p-u;if(m<0||m===1/0)return;let f;Lt.setup(s,n,o,i,l);let g=Et;if(null!==l&&(f=ut.get(l),g=At,g.setIndex(f)),s.isMesh)!0===n.wireframe?(it.setLineWidth(n.wireframeLinewidth*$()),g.setMode(Rt.LINES)):g.setMode(Rt.TRIANGLES);else if(s.isLine){let t=n.linewidth;void 0===t&&(t=1),it.setLineWidth(t*$()),s.isLineSegments?g.setMode(Rt.LINES):s.isLineLoop?g.setMode(Rt.LINE_LOOP):g.setMode(Rt.LINE_STRIP)}else s.isPoints?g.setMode(Rt.POINTS):s.isSprite&&g.setMode(Rt.TRIANGLES);if(s.isBatchedMesh)if(null!==s._multiDrawInstances)g.renderMultiDrawInstances(s._multiDrawStarts,s._multiDrawCounts,s._multiDrawCount,s._multiDrawInstances);else if(K.get("WEBGL_multi_draw"))g.renderMultiDraw(s._multiDrawStarts,s._multiDrawCounts,s._multiDrawCount);else{const t=s._multiDrawStarts,e=s._multiDrawCounts,i=s._multiDrawCount,r=l?ut.get(l).bytesPerElement:1,a=lt.get(n).currentProgram.getUniforms();for(let n=0;n<i;n++)a.setValue(Rt,"_gl_DrawID",n),g.render(t[n]/r,e[n])}else if(s.isInstancedMesh)g.renderInstances(u,m,s.count);else if(i.isInstancedBufferGeometry){const t=void 0!==i._maxInstanceCount?i._maxInstanceCount:1/0,e=Math.min(i.instanceCount,t);g.renderInstances(u,m,e)}else g.render(u,m)},this.compile=function(t,e,i=null){null===i&&(i=t),v=wt.get(i),v.init(e),y.push(v),i.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(v.pushLight(t),t.castShadow&&v.pushShadow(t))})),t!==i&&t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(v.pushLight(t),t.castShadow&&v.pushShadow(t))})),v.setupLights();const n=new Set;return t.traverse((function(t){if(!(t.isMesh||t.isPoints||t.isLine||t.isSprite))return;const e=t.material;if(e)if(Array.isArray(e))for(let s=0;s<e.length;s++){const r=e[s];Ft(r,i,t),n.add(r)}else Ft(e,i,t),n.add(e)})),y.pop(),v=null,n},this.compileAsync=function(t,e,i=null){const n=this.compile(t,e,i);return new Promise((e=>{function i(){n.forEach((function(t){lt.get(t).currentProgram.isReady()&&n.delete(t)})),0!==n.size?setTimeout(i,10):e(t)}null!==K.get("KHR_parallel_shader_compile")?i():setTimeout(i,10)}))};let zt=null;function Ht(){Gt.stop()}function Vt(){Gt.start()}const Gt=new Th;function jt(t,e,i,n){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)i=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)v.pushLight(t),t.castShadow&&v.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||z.intersectsSprite(t)){n&&q.setFromMatrixPosition(t.matrixWorld).applyMatrix4(j);const e=mt.update(t),s=t.material;s.visible&&g.push(t,e,s,i,q.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||z.intersectsObject(t))){const e=mt.update(t),s=t.material;if(n&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),q.copy(t.boundingSphere.center)):(null===e.boundingSphere&&e.computeBoundingSphere(),q.copy(e.boundingSphere.center)),q.applyMatrix4(t.matrixWorld).applyMatrix4(j)),Array.isArray(s)){const n=e.groups;for(let r=0,a=n.length;r<a;r++){const a=n[r],o=s[a.materialIndex];o&&o.visible&&g.push(t,e,o,i,q.z,a)}}else s.visible&&g.push(t,e,s,i,q.z,null)}const s=t.children;for(let t=0,r=s.length;t<r;t++)jt(s[t],e,i,n)}function Wt(t,e,i,n){const s=t.opaque,r=t.transmissive,a=t.transparent;v.setupLightsView(i),!0===H&&bt.setGlobalState(x.clippingPlanes,i),n&&it.viewport(A.copy(n)),s.length>0&&Xt(s,e,i),r.length>0&&Xt(r,e,i),a.length>0&&Xt(a,e,i),it.buffers.depth.setTest(!0),it.buffers.depth.setMask(!0),it.buffers.color.setMask(!0),it.setPolygonOffset(!1)}function qt(t,e,i,n){if(null!==(!0===i.isScene?i.overrideMaterial:null))return;void 0===v.state.transmissionRenderTarget[n.id]&&(v.state.transmissionRenderTarget[n.id]=new pi(1,1,{generateMipmaps:!0,type:K.has("EXT_color_buffer_half_float")||K.has("EXT_color_buffer_float")?nt:J,minFilter:Y,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ei.workingColorSpace}));const s=v.state.transmissionRenderTarget[n.id],a=n.viewport||A;s.setSize(a.z*x.transmissionResolutionScale,a.w*x.transmissionResolutionScale);const o=x.getRenderTarget();x.setRenderTarget(s),x.getClearColor(k),R=x.getClearAlpha(),R<1&&x.setClearColor(16777215,.5),x.clear(),Z&&St.render(i);const l=x.toneMapping;x.toneMapping=0;const c=n.viewport;if(void 0!==n.viewport&&(n.viewport=void 0),v.setupLightsView(n),!0===H&&bt.setGlobalState(x.clippingPlanes,n),Xt(t,i,n),ct.updateMultisampleRenderTarget(s),ct.updateRenderTargetMipmap(s),!1===K.has("WEBGL_multisampled_render_to_texture")){let t=!1;for(let s=0,r=e.length;s<r;s++){const r=e[s],a=r.object,o=r.geometry,l=r.material,c=r.group;if(2===l.side&&a.layers.test(n.layers)){const e=l.side;l.side=1,l.needsUpdate=!0,Zt(a,i,n,o,l,c),l.side=e,l.needsUpdate=!0,t=!0}}!0===t&&(ct.updateMultisampleRenderTarget(s),ct.updateRenderTargetMipmap(s))}x.setRenderTarget(o),x.setClearColor(k,R),void 0!==c&&(n.viewport=c),x.toneMapping=l}function Xt(t,e,i){const n=!0===e.isScene?e.overrideMaterial:null;for(let s=0,r=t.length;s<r;s++){const r=t[s],a=r.object,o=r.geometry,l=null===n?r.material:n,c=r.group;a.layers.test(i.layers)&&Zt(a,e,i,o,l,c)}}function Zt(t,e,i,n,s,r){t.onBeforeRender(x,e,i,n,s,r),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),s.onBeforeRender(x,e,i,n,t,r),!0===s.transparent&&2===s.side&&!1===s.forceSinglePass?(s.side=1,s.needsUpdate=!0,x.renderBufferDirect(i,e,n,s,t,r),s.side=0,s.needsUpdate=!0,x.renderBufferDirect(i,e,n,s,t,r),s.side=2):x.renderBufferDirect(i,e,n,s,t,r),t.onAfterRender(x,e,i,n,s,r)}function Yt(t,e,i){!0!==e.isScene&&(e=X);const n=lt.get(t),s=v.state.lights,r=v.state.shadowsArray,a=s.state.version,o=ft.getParameters(t,s.state,r,e,i),l=ft.getProgramCacheKey(o);let c=n.programs;n.environment=t.isMeshStandardMaterial?e.environment:null,n.fog=e.fog,n.envMap=(t.isMeshStandardMaterial?dt:ht).get(t.envMap||n.environment),n.envMapRotation=null!==n.environment&&null===t.envMap?e.environmentRotation:t.envMapRotation,void 0===c&&(t.addEventListener("dispose",Bt),c=new Map,n.programs=c);let h=c.get(l);if(void 0!==h){if(n.currentProgram===h&&n.lightsStateVersion===a)return $t(t,o),h}else o.uniforms=ft.getUniforms(t),t.onBeforeCompile(o,x),h=ft.acquireProgram(o,l),c.set(l,h),n.uniforms=o.uniforms;const d=n.uniforms;return(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(d.clippingPlanes=bt.uniform),$t(t,o),n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),n.lightsStateVersion=a,n.needsLights&&(d.ambientLightColor.value=s.state.ambient,d.lightProbe.value=s.state.probe,d.directionalLights.value=s.state.directional,d.directionalLightShadows.value=s.state.directionalShadow,d.spotLights.value=s.state.spot,d.spotLightShadows.value=s.state.spotShadow,d.rectAreaLights.value=s.state.rectArea,d.ltc_1.value=s.state.rectAreaLTC1,d.ltc_2.value=s.state.rectAreaLTC2,d.pointLights.value=s.state.point,d.pointLightShadows.value=s.state.pointShadow,d.hemisphereLights.value=s.state.hemi,d.directionalShadowMap.value=s.state.directionalShadowMap,d.directionalShadowMatrix.value=s.state.directionalShadowMatrix,d.spotShadowMap.value=s.state.spotShadowMap,d.spotLightMatrix.value=s.state.spotLightMatrix,d.spotLightMap.value=s.state.spotLightMap,d.pointShadowMap.value=s.state.pointShadowMap,d.pointShadowMatrix.value=s.state.pointShadowMatrix),n.currentProgram=h,n.uniformsList=null,h}function Jt(t){if(null===t.uniformsList){const e=t.currentProgram.getUniforms();t.uniformsList=pu.seqWithValue(e.seq,t.uniforms)}return t.uniformsList}function $t(t,e){const i=lt.get(t);i.outputColorSpace=e.outputColorSpace,i.batching=e.batching,i.batchingColor=e.batchingColor,i.instancing=e.instancing,i.instancingColor=e.instancingColor,i.instancingMorph=e.instancingMorph,i.skinning=e.skinning,i.morphTargets=e.morphTargets,i.morphNormals=e.morphNormals,i.morphColors=e.morphColors,i.morphTargetsCount=e.morphTargetsCount,i.numClippingPlanes=e.numClippingPlanes,i.numIntersection=e.numClipIntersection,i.vertexAlphas=e.vertexAlphas,i.vertexTangents=e.vertexTangents,i.toneMapping=e.toneMapping}Gt.setAnimationLoop((function(t){zt&&zt(t)})),"undefined"!=typeof self&&Gt.setContext(self),this.setAnimationLoop=function(t){zt=t,Ut.setAnimationLoop(t),null===t?Gt.stop():Gt.start()},Ut.addEventListener("sessionstart",Ht),Ut.addEventListener("sessionend",Vt),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===w)return;if(!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===Ut.enabled&&!0===Ut.isPresenting&&(!0===Ut.cameraAutoUpdate&&Ut.updateCamera(e),e=Ut.getCamera()),!0===t.isScene&&t.onBeforeRender(x,t,e,S),v=wt.get(t,y.length),v.init(e),y.push(v),j.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),z.setFromProjectionMatrix(j),V=this.localClippingEnabled,H=bt.init(this.clippingPlanes,V),g=xt.get(t,_.length),g.init(),_.push(g),!0===Ut.enabled&&!0===Ut.isPresenting){const t=x.xr.getDepthSensingMesh();null!==t&&jt(t,e,-1/0,x.sortObjects)}jt(t,e,0,x.sortObjects),g.finish(),!0===x.sortObjects&&g.sort(D,N),Z=!1===Ut.enabled||!1===Ut.isPresenting||!1===Ut.hasDepthSensing(),Z&&St.addToRenderList(g,t),this.info.render.frame++,!0===H&&bt.beginShadows();const i=v.state.shadowsArray;Mt.render(i,t,e),!0===H&&bt.endShadows(),!0===this.info.autoReset&&this.info.reset();const n=g.opaque,s=g.transmissive;if(v.setupLights(),e.isArrayCamera){const i=e.cameras;if(s.length>0)for(let e=0,r=i.length;e<r;e++){qt(n,s,t,i[e])}Z&&St.render(t);for(let e=0,n=i.length;e<n;e++){const n=i[e];Wt(g,t,n,n.viewport)}}else s.length>0&&qt(n,s,t,e),Z&&St.render(t),Wt(g,t,e);null!==S&&0===M&&(ct.updateMultisampleRenderTarget(S),ct.updateRenderTargetMipmap(S)),!0===t.isScene&&t.onAfterRender(x,t,e),Lt.resetDefaultState(),T=-1,E=null,y.pop(),y.length>0?(v=y[y.length-1],!0===H&&bt.setGlobalState(x.clippingPlanes,v.state.camera)):v=null,_.pop(),g=_.length>0?_[_.length-1]:null},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return M},this.getRenderTarget=function(){return S},this.setRenderTargetTextures=function(t,e,i){lt.get(t.texture).__webglTexture=e,lt.get(t.depthTexture).__webglTexture=i;const n=lt.get(t);n.__hasExternalTextures=!0,n.__autoAllocateDepthBuffer=void 0===i,n.__autoAllocateDepthBuffer||!0===K.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),n.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(t,e){const i=lt.get(t);i.__webglFramebuffer=e,i.__useDefaultFramebuffer=void 0===e};const Kt=Rt.createFramebuffer();this.setRenderTarget=function(t,e=0,i=0){S=t,b=e,M=i;let n=!0,s=null,r=!1,a=!1;if(t){const o=lt.get(t);if(void 0!==o.__useDefaultFramebuffer)it.bindFramebuffer(Rt.FRAMEBUFFER,null),n=!1;else if(void 0===o.__webglFramebuffer)ct.setupRenderTarget(t);else if(o.__hasExternalTextures)ct.rebindTextures(t,lt.get(t.texture).__webglTexture,lt.get(t.depthTexture).__webglTexture);else if(t.depthBuffer){const e=t.depthTexture;if(o.__boundDepthTexture!==e){if(null!==e&<.has(e)&&(t.width!==e.image.width||t.height!==e.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ct.setupDepthRenderbuffer(t)}}const l=t.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(a=!0);const c=lt.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(s=Array.isArray(c[e])?c[e][i]:c[e],r=!0):s=t.samples>0&&!1===ct.useMultisampledRTT(t)?lt.get(t).__webglMultisampledFramebuffer:Array.isArray(c)?c[i]:c,A.copy(t.viewport),C.copy(t.scissor),L=t.scissorTest}else A.copy(O).multiplyScalar(U).floor(),C.copy(B).multiplyScalar(U).floor(),L=F;0!==i&&(s=Kt);if(it.bindFramebuffer(Rt.FRAMEBUFFER,s)&&n&&it.drawBuffers(t,s),it.viewport(A),it.scissor(C),it.setScissorTest(L),r){const n=lt.get(t.texture);Rt.framebufferTexture2D(Rt.FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,Rt.TEXTURE_CUBE_MAP_POSITIVE_X+e,n.__webglTexture,i)}else if(a){const n=lt.get(t.texture),s=e;Rt.framebufferTextureLayer(Rt.FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,n.__webglTexture,i,s)}else if(null!==t&&0!==i){const e=lt.get(t.texture);Rt.framebufferTexture2D(Rt.FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,Rt.TEXTURE_2D,e.__webglTexture,i)}T=-1},this.readRenderTargetPixels=function(t,e,i,n,s,r,a){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=lt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){it.bindFramebuffer(Rt.FRAMEBUFFER,o);try{const a=t.texture,o=a.format,l=a.type;if(!tt.textureFormatReadable(o))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!tt.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-n&&i>=0&&i<=t.height-s&&Rt.readPixels(e,i,n,s,Ct.convert(o),Ct.convert(l),r)}finally{const t=null!==S?lt.get(S).__webglFramebuffer:null;it.bindFramebuffer(Rt.FRAMEBUFFER,t)}}},this.readRenderTargetPixelsAsync=async function(t,e,i,n,s,r,a){if(!t||!t.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=lt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){const a=t.texture,l=a.format,c=a.type;if(!tt.textureFormatReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!tt.textureTypeReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(e>=0&&e<=t.width-n&&i>=0&&i<=t.height-s){it.bindFramebuffer(Rt.FRAMEBUFFER,o);const t=Rt.createBuffer();Rt.bindBuffer(Rt.PIXEL_PACK_BUFFER,t),Rt.bufferData(Rt.PIXEL_PACK_BUFFER,r.byteLength,Rt.STREAM_READ),Rt.readPixels(e,i,n,s,Ct.convert(l),Ct.convert(c),0);const a=null!==S?lt.get(S).__webglFramebuffer:null;it.bindFramebuffer(Rt.FRAMEBUFFER,a);const h=Rt.fenceSync(Rt.SYNC_GPU_COMMANDS_COMPLETE,0);return Rt.flush(),await function(t,e,i){return new Promise((function(n,s){setTimeout((function r(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:s();break;case t.TIMEOUT_EXPIRED:setTimeout(r,i);break;default:n()}}),i)}))}(Rt,h,4),Rt.bindBuffer(Rt.PIXEL_PACK_BUFFER,t),Rt.getBufferSubData(Rt.PIXEL_PACK_BUFFER,0,r),Rt.deleteBuffer(t),Rt.deleteSync(h),r}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(t,e=null,i=0){!0!==t.isTexture&&($e("WebGLRenderer: copyFramebufferToTexture function signature has changed."),e=arguments[0]||null,t=arguments[1]);const n=Math.pow(2,-i),s=Math.floor(t.image.width*n),r=Math.floor(t.image.height*n),a=null!==e?e.x:0,o=null!==e?e.y:0;ct.setTexture2D(t,0),Rt.copyTexSubImage2D(Rt.TEXTURE_2D,i,0,0,a,o,s,r),it.unbindTexture()};const Qt=Rt.createFramebuffer(),te=Rt.createFramebuffer();this.copyTextureToTexture=function(t,e,i=null,n=null,s=0,r=null){let a,o,l,c,h,d,u,p,m;!0!==t.isTexture&&($e("WebGLRenderer: copyTextureToTexture function signature has changed."),n=arguments[0]||null,t=arguments[1],e=arguments[2],r=arguments[3]||0,i=null),null===r&&(0!==s?($e("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),r=s,s=0):r=0);const f=t.isCompressedTexture?t.mipmaps[r]:t.image;if(null!==i)a=i.max.x-i.min.x,o=i.max.y-i.min.y,l=i.isBox3?i.max.z-i.min.z:1,c=i.min.x,h=i.min.y,d=i.isBox3?i.min.z:0;else{const e=Math.pow(2,-s);a=Math.floor(f.width*e),o=Math.floor(f.height*e),l=t.isDataArrayTexture?f.depth:t.isData3DTexture?Math.floor(f.depth*e):1,c=0,h=0,d=0}null!==n?(u=n.x,p=n.y,m=n.z):(u=0,p=0,m=0);const g=Ct.convert(e.format),v=Ct.convert(e.type);let _;e.isData3DTexture?(ct.setTexture3D(e,0),_=Rt.TEXTURE_3D):e.isDataArrayTexture||e.isCompressedArrayTexture?(ct.setTexture2DArray(e,0),_=Rt.TEXTURE_2D_ARRAY):(ct.setTexture2D(e,0),_=Rt.TEXTURE_2D),Rt.pixelStorei(Rt.UNPACK_FLIP_Y_WEBGL,e.flipY),Rt.pixelStorei(Rt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),Rt.pixelStorei(Rt.UNPACK_ALIGNMENT,e.unpackAlignment);const y=Rt.getParameter(Rt.UNPACK_ROW_LENGTH),x=Rt.getParameter(Rt.UNPACK_IMAGE_HEIGHT),w=Rt.getParameter(Rt.UNPACK_SKIP_PIXELS),b=Rt.getParameter(Rt.UNPACK_SKIP_ROWS),M=Rt.getParameter(Rt.UNPACK_SKIP_IMAGES);Rt.pixelStorei(Rt.UNPACK_ROW_LENGTH,f.width),Rt.pixelStorei(Rt.UNPACK_IMAGE_HEIGHT,f.height),Rt.pixelStorei(Rt.UNPACK_SKIP_PIXELS,c),Rt.pixelStorei(Rt.UNPACK_SKIP_ROWS,h),Rt.pixelStorei(Rt.UNPACK_SKIP_IMAGES,d);const S=t.isDataArrayTexture||t.isData3DTexture,T=e.isDataArrayTexture||e.isData3DTexture;if(t.isDepthTexture){const i=lt.get(t),n=lt.get(e),f=lt.get(i.__renderTarget),g=lt.get(n.__renderTarget);it.bindFramebuffer(Rt.READ_FRAMEBUFFER,f.__webglFramebuffer),it.bindFramebuffer(Rt.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let i=0;i<l;i++)S&&(Rt.framebufferTextureLayer(Rt.READ_FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,lt.get(t).__webglTexture,s,d+i),Rt.framebufferTextureLayer(Rt.DRAW_FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,lt.get(e).__webglTexture,r,m+i)),Rt.blitFramebuffer(c,h,a,o,u,p,a,o,Rt.DEPTH_BUFFER_BIT,Rt.NEAREST);it.bindFramebuffer(Rt.READ_FRAMEBUFFER,null),it.bindFramebuffer(Rt.DRAW_FRAMEBUFFER,null)}else if(0!==s||t.isRenderTargetTexture||lt.has(t)){const i=lt.get(t),n=lt.get(e);it.bindFramebuffer(Rt.READ_FRAMEBUFFER,Qt),it.bindFramebuffer(Rt.DRAW_FRAMEBUFFER,te);for(let t=0;t<l;t++)S?Rt.framebufferTextureLayer(Rt.READ_FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,i.__webglTexture,s,d+t):Rt.framebufferTexture2D(Rt.READ_FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,Rt.TEXTURE_2D,i.__webglTexture,s),T?Rt.framebufferTextureLayer(Rt.DRAW_FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,n.__webglTexture,r,m+t):Rt.framebufferTexture2D(Rt.DRAW_FRAMEBUFFER,Rt.COLOR_ATTACHMENT0,Rt.TEXTURE_2D,n.__webglTexture,r),0!==s?Rt.blitFramebuffer(c,h,a,o,u,p,a,o,Rt.COLOR_BUFFER_BIT,Rt.NEAREST):T?Rt.copyTexSubImage3D(_,r,u,p,m+t,c,h,a,o):Rt.copyTexSubImage2D(_,r,u,p,c,h,a,o);it.bindFramebuffer(Rt.READ_FRAMEBUFFER,null),it.bindFramebuffer(Rt.DRAW_FRAMEBUFFER,null)}else T?t.isDataTexture||t.isData3DTexture?Rt.texSubImage3D(_,r,u,p,m,a,o,l,g,v,f.data):e.isCompressedArrayTexture?Rt.compressedTexSubImage3D(_,r,u,p,m,a,o,l,g,f.data):Rt.texSubImage3D(_,r,u,p,m,a,o,l,g,v,f):t.isDataTexture?Rt.texSubImage2D(Rt.TEXTURE_2D,r,u,p,a,o,g,v,f.data):t.isCompressedTexture?Rt.compressedTexSubImage2D(Rt.TEXTURE_2D,r,u,p,f.width,f.height,g,f.data):Rt.texSubImage2D(Rt.TEXTURE_2D,r,u,p,a,o,g,v,f);Rt.pixelStorei(Rt.UNPACK_ROW_LENGTH,y),Rt.pixelStorei(Rt.UNPACK_IMAGE_HEIGHT,x),Rt.pixelStorei(Rt.UNPACK_SKIP_PIXELS,w),Rt.pixelStorei(Rt.UNPACK_SKIP_ROWS,b),Rt.pixelStorei(Rt.UNPACK_SKIP_IMAGES,M),0===r&&e.generateMipmaps&&Rt.generateMipmap(_),it.unbindTexture()},this.copyTextureToTexture3D=function(t,e,i=null,n=null,s=0){return!0!==t.isTexture&&($e("WebGLRenderer: copyTextureToTexture3D function signature has changed."),i=arguments[0]||null,n=arguments[1]||null,t=arguments[2],e=arguments[3],s=arguments[4]||0),$e('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(t,e,i,n,s)},this.initRenderTarget=function(t){void 0===lt.get(t).__webglFramebuffer&&ct.setupRenderTarget(t)},this.initTexture=function(t){t.isCubeTexture?ct.setTextureCube(t,0):t.isData3DTexture?ct.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?ct.setTexture2DArray(t,0):ct.setTexture2D(t,0),it.unbindTexture()},this.resetState=function(){b=0,M=0,S=null,it.reset(),Lt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ce}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorspace=ei._getDrawingBufferColorSpace(t),e.unpackColorSpace=ei._getUnpackColorSpace()}}var op=Object.freeze({__proto__:null,ACESFilmicToneMapping:4,AddEquation:o,AddOperation:2,AdditiveAnimationBlendMode:oe,AdditiveBlending:2,AgXToneMapping:6,AlphaFormat:lt,AlwaysCompare:519,AlwaysDepth:1,AlwaysStencilFunc:ve,AmbientLight:rc,AnimationAction:Hc,AnimationClip:Il,AnimationLoader:class extends Bl{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new Hl(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,(function(i){try{e(s.parse(JSON.parse(i)))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){const e=[];for(let i=0;i<t.length;i++){const n=Il.parse(t[i]);e.push(n)}return e}},AnimationMixer:Gc,AnimationObjectGroup:class{constructor(){this.isAnimationObjectGroup=!0,this.uuid=De(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let e=0,i=arguments.length;e!==i;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,i=this._paths,n=this._parsedPaths,s=this._bindings,r=s.length;let a,o=t.length,l=this.nCachedObjects_;for(let c=0,h=arguments.length;c!==h;++c){const h=arguments[c],d=h.uuid;let u=e[d];if(void 0===u){u=o++,e[d]=u,t.push(h);for(let t=0,e=r;t!==e;++t)s[t].push(new zc(h,i[t],n[t]))}else if(u<l){a=t[u];const o=--l,c=t[o];e[c.uuid]=u,t[u]=c,e[d]=o,t[o]=h;for(let t=0,e=r;t!==e;++t){const e=s[t],r=e[o];let a=e[u];e[u]=r,void 0===a&&(a=new zc(h,i[t],n[t])),e[o]=a}}else t[u]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,n=i.length;let s=this.nCachedObjects_;for(let r=0,a=arguments.length;r!==a;++r){const a=arguments[r],o=a.uuid,l=e[o];if(void 0!==l&&l>=s){const r=s++,c=t[r];e[c.uuid]=l,t[l]=c,e[o]=r,t[r]=a;for(let t=0,e=n;t!==e;++t){const e=i[t],n=e[r],s=e[l];e[l]=n,e[r]=s}}}this.nCachedObjects_=s}uncache(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,n=i.length;let s=this.nCachedObjects_,r=t.length;for(let a=0,o=arguments.length;a!==o;++a){const o=arguments[a].uuid,l=e[o];if(void 0!==l)if(delete e[o],l<s){const a=--s,o=t[a],c=--r,h=t[c];e[o.uuid]=l,t[l]=o,e[h.uuid]=a,t[a]=h,t.pop();for(let t=0,e=n;t!==e;++t){const e=i[t],n=e[a],s=e[c];e[l]=n,e[a]=s,e.pop()}}else{const s=--r,a=t[s];s>0&&(e[a.uuid]=l),t[l]=a,t.pop();for(let t=0,e=n;t!==e;++t){const e=i[t];e[l]=e[s],e.pop()}}}this.nCachedObjects_=s}subscribe_(t,e){const i=this._bindingsIndicesByPath;let n=i[t];const s=this._bindings;if(void 0!==n)return s[n];const r=this._paths,a=this._parsedPaths,o=this._objects,l=o.length,c=this.nCachedObjects_,h=new Array(l);n=s.length,i[t]=n,r.push(t),a.push(e),s.push(h);for(let i=c,n=o.length;i!==n;++i){const n=o[i];h[i]=new zc(n,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){const n=this._paths,s=this._parsedPaths,r=this._bindings,a=r.length-1,o=r[a];e[t[a]]=i,r[i]=o,r.pop(),s[i]=s[a],s.pop(),n[i]=n[a],n.pop()}}},AnimationUtils:xl,ArcCurve:Ua,ArrayCamera:wc,ArrowHelper:class extends wn{constructor(t=new vi(0,0,1),e=new vi(0,0,0),i=1,n=16776960,s=.2*i,r=.2*s){super(),this.type="ArrowHelper",void 0===xh&&(xh=new hs,xh.setAttribute("position",new is([0,0,0,0,1,0],3)),wh=new no(0,.5,1,5,1),wh.translate(0,-.5,0)),this.position.copy(e),this.line=new ga(xh,new la({color:n,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new bs(wh,new jn({color:n,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(i,s,r)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{yh.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(yh,e)}}setLength(t,e=.2*t,i=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}},AttachedBindMode:I,Audio:Cc,AudioAnalyser:class{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let i=0;i<e.length;i++)t+=e[i];return t/e.length}},AudioContext:vc,AudioListener:class extends wn{constructor(){super(),this.type="AudioListener",this.context=vc.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new bc}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Sc,Tc,Ec),Ac.set(0,0,-1).applyQuaternion(Tc),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Sc.x,t),e.positionY.linearRampToValueAtTime(Sc.y,t),e.positionZ.linearRampToValueAtTime(Sc.z,t),e.forwardX.linearRampToValueAtTime(Ac.x,t),e.forwardY.linearRampToValueAtTime(Ac.y,t),e.forwardZ.linearRampToValueAtTime(Ac.z,t),e.upX.linearRampToValueAtTime(i.x,t),e.upY.linearRampToValueAtTime(i.y,t),e.upZ.linearRampToValueAtTime(i.z,t)}else e.setPosition(Sc.x,Sc.y,Sc.z),e.setOrientation(Ac.x,Ac.y,Ac.z,i.x,i.y,i.z)}},AudioLoader:class extends Bl{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new Hl(this.manager);function a(e){n?n(e):console.error(e),s.manager.itemError(t)}r.setResponseType("arraybuffer"),r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,(function(t){try{const i=t.slice(0);vc.getContext().decodeAudioData(i,(function(t){e(t)})).catch(a)}catch(t){a(t)}}),i,n)}},AxesHelper:class extends xa{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],i=new hs;i.setAttribute("position",new is(e,3)),i.setAttribute("color",new is([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(i,new la({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,i){const n=new zn,s=this.geometry.attributes.color.array;return n.set(t),n.toArray(s,0),n.toArray(s,3),n.set(e),n.toArray(s,6),n.toArray(s,9),n.set(i),n.toArray(s,12),n.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},BackSide:1,BasicDepthPacking:3200,BasicShadowMap:0,BatchedMesh:oa,Bone:Mr,BooleanKeyframeTrack:El,Box2:class{constructor(t=new Ve(1/0,1/0),e=new Ve(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=Qc.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Qc).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},Box3:xi,Box3Helper:class extends xa{constructor(t,e=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new hs;n.setIndex(new Qn(i,1)),n.setAttribute("position",new is([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(n,new la({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}},BoxGeometry:Ss,BoxHelper:class extends xa{constructor(t,e=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),s=new hs;s.setIndex(new Qn(i,1)),s.setAttribute("position",new Qn(n,3)),super(s,new la({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&_h.setFromObject(this.object),_h.isEmpty())return;const e=_h.min,i=_h.max,n=this.geometry.attributes.position,s=n.array;s[0]=i.x,s[1]=i.y,s[2]=i.z,s[3]=e.x,s[4]=i.y,s[5]=i.z,s[6]=e.x,s[7]=e.y,s[8]=i.z,s[9]=i.x,s[10]=e.y,s[11]=i.z,s[12]=i.x,s[13]=i.y,s[14]=e.z,s[15]=e.x,s[16]=i.y,s[17]=e.z,s[18]=e.x,s[19]=e.y,s[20]=e.z,s[21]=i.x,s[22]=e.y,s[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t,e){return super.copy(t,e),this.object=t.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}},BufferAttribute:Qn,BufferGeometry:hs,BufferGeometryLoader:uc,ByteType:$,Cache:Dl,Camera:ks,CameraHelper:class extends xa{constructor(t){const e=new hs,i=new la({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],s=[],r={};function a(t,e){o(t),o(e)}function o(t){n.push(0,0,0),s.push(0,0,0),void 0===r[t]&&(r[t]=[]),r[t].push(n.length/3-1)}a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4"),e.setAttribute("position",new is(n,3)),e.setAttribute("color",new is(s,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=r,this.update();const l=new zn(16755200),c=new zn(16711680),h=new zn(43775),d=new zn(16777215),u=new zn(3355443);this.setColors(l,c,h,d,u)}setColors(t,e,i,n,s){const r=this.geometry.getAttribute("color");r.setXYZ(0,t.r,t.g,t.b),r.setXYZ(1,t.r,t.g,t.b),r.setXYZ(2,t.r,t.g,t.b),r.setXYZ(3,t.r,t.g,t.b),r.setXYZ(4,t.r,t.g,t.b),r.setXYZ(5,t.r,t.g,t.b),r.setXYZ(6,t.r,t.g,t.b),r.setXYZ(7,t.r,t.g,t.b),r.setXYZ(8,t.r,t.g,t.b),r.setXYZ(9,t.r,t.g,t.b),r.setXYZ(10,t.r,t.g,t.b),r.setXYZ(11,t.r,t.g,t.b),r.setXYZ(12,t.r,t.g,t.b),r.setXYZ(13,t.r,t.g,t.b),r.setXYZ(14,t.r,t.g,t.b),r.setXYZ(15,t.r,t.g,t.b),r.setXYZ(16,t.r,t.g,t.b),r.setXYZ(17,t.r,t.g,t.b),r.setXYZ(18,t.r,t.g,t.b),r.setXYZ(19,t.r,t.g,t.b),r.setXYZ(20,t.r,t.g,t.b),r.setXYZ(21,t.r,t.g,t.b),r.setXYZ(22,t.r,t.g,t.b),r.setXYZ(23,t.r,t.g,t.b),r.setXYZ(24,e.r,e.g,e.b),r.setXYZ(25,e.r,e.g,e.b),r.setXYZ(26,e.r,e.g,e.b),r.setXYZ(27,e.r,e.g,e.b),r.setXYZ(28,e.r,e.g,e.b),r.setXYZ(29,e.r,e.g,e.b),r.setXYZ(30,e.r,e.g,e.b),r.setXYZ(31,e.r,e.g,e.b),r.setXYZ(32,i.r,i.g,i.b),r.setXYZ(33,i.r,i.g,i.b),r.setXYZ(34,i.r,i.g,i.b),r.setXYZ(35,i.r,i.g,i.b),r.setXYZ(36,i.r,i.g,i.b),r.setXYZ(37,i.r,i.g,i.b),r.setXYZ(38,n.r,n.g,n.b),r.setXYZ(39,n.r,n.g,n.b),r.setXYZ(40,s.r,s.g,s.b),r.setXYZ(41,s.r,s.g,s.b),r.setXYZ(42,s.r,s.g,s.b),r.setXYZ(43,s.r,s.g,s.b),r.setXYZ(44,s.r,s.g,s.b),r.setXYZ(45,s.r,s.g,s.b),r.setXYZ(46,s.r,s.g,s.b),r.setXYZ(47,s.r,s.g,s.b),r.setXYZ(48,s.r,s.g,s.b),r.setXYZ(49,s.r,s.g,s.b),r.needsUpdate=!0}update(){const t=this.geometry,e=this.pointMap;gh.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse);const i=this.camera.coordinateSystem===Ce?-1:0;vh("c",e,t,gh,0,0,i),vh("t",e,t,gh,0,0,1),vh("n1",e,t,gh,-1,-1,i),vh("n2",e,t,gh,1,-1,i),vh("n3",e,t,gh,-1,1,i),vh("n4",e,t,gh,1,1,i),vh("f1",e,t,gh,-1,-1,1),vh("f2",e,t,gh,1,-1,1),vh("f3",e,t,gh,-1,1,1),vh("f4",e,t,gh,1,1,1),vh("u1",e,t,gh,.7,1.1,i),vh("u2",e,t,gh,-.7,1.1,i),vh("u3",e,t,gh,0,2,i),vh("cf1",e,t,gh,-1,0,1),vh("cf2",e,t,gh,1,0,1),vh("cf3",e,t,gh,0,-1,1),vh("cf4",e,t,gh,0,1,1),vh("cn1",e,t,gh,-1,0,i),vh("cn2",e,t,gh,1,0,i),vh("cn3",e,t,gh,0,-1,i),vh("cn4",e,t,gh,0,1,i),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},CanvasTexture:class extends hi{constructor(t,e,i,n,s,r,a,o,l){super(t,e,i,n,s,r,a,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}},CapsuleGeometry:eo,CatmullRomCurve3:za,CineonToneMapping:3,CircleGeometry:io,ClampToEdgeWrapping:V,Clock:bc,Color:zn,ColorKeyframeTrack:Al,ColorManagement:ei,CompressedArrayTexture:class extends ka{constructor(t,e,i,n,s,r){super(t,e,i,s,r),this.isCompressedArrayTexture=!0,this.image.depth=n,this.wrapR=V,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}},CompressedCubeTexture:class extends ka{constructor(t,e,i){super(void 0,t[0].width,t[0].height,e,i,N),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}},CompressedTexture:ka,CompressedTextureLoader:class extends Bl{constructor(t){super(t)}load(t,e,i,n){const s=this,r=[],a=new ka,o=new Hl(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(s.withCredentials);let l=0;function c(c){o.load(t[c],(function(t){const i=s.parse(t,!0);r[c]={width:i.width,height:i.height,format:i.format,mipmaps:i.mipmaps},l+=1,6===l&&(1===i.mipmapCount&&(a.minFilter=X),a.image=r,a.format=i.format,a.needsUpdate=!0,e&&e(a))}),i,n)}if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)c(e);else o.load(t,(function(t){const i=s.parse(t,!0);if(i.isCubemap){const t=i.mipmaps.length/i.mipmapCount;for(let e=0;e<t;e++){r[e]={mipmaps:[]};for(let t=0;t<i.mipmapCount;t++)r[e].mipmaps.push(i.mipmaps[e*i.mipmapCount+t]),r[e].format=i.format,r[e].width=i.width,r[e].height=i.height}a.image=r}else a.image.width=i.width,a.image.height=i.height,a.mipmaps=i.mipmaps;1===i.mipmapCount&&(a.minFilter=X),a.format=i.format,a.needsUpdate=!0,e&&e(a)}),i,n);return a}},ConeGeometry:so,ConstantAlphaFactor:213,ConstantColorFactor:211,Controls:class extends ke{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}},CubeCamera:Ns,CubeReflectionMapping:N,CubeRefractionMapping:O,CubeTexture:Os,CubeTextureLoader:class extends Bl{constructor(t){super(t)}load(t,e,i,n){const s=new Os;s.colorSpace=ce;const r=new Vl(this.manager);r.setCrossOrigin(this.crossOrigin),r.setPath(this.path);let a=0;function o(i){r.load(t[i],(function(t){s.images[i]=t,a++,6===a&&(s.needsUpdate=!0,e&&e(s))}),void 0,n)}for(let e=0;e<t.length;++e)o(e);return s}},CubeUVReflectionMapping:z,CubicBezierCurve:ja,CubicBezierCurve3:Wa,CubicInterpolant:bl,CullFaceBack:1,CullFaceFront:2,CullFaceFrontBack:3,CullFaceNone:0,Curve:Pa,CurvePath:Ka,CustomBlending:5,CustomToneMapping:5,CylinderGeometry:no,Cylindrical:class{constructor(t=1,e=0,i=0){return this.radius=t,this.theta=e,this.y=i,this}set(t,e,i){return this.radius=t,this.theta=e,this.y=i,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,i){return this.radius=Math.sqrt(t*t+i*i),this.theta=Math.atan2(t,i),this.y=e,this}clone(){return(new this.constructor).copy(this)}},Data3DTexture:fi,DataArrayTexture:mi,DataTexture:Sr,DataTextureLoader:class extends Bl{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new Sr,a=new Hl(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(t,(function(t){let i;try{i=s.parse(t)}catch(t){if(void 0===n)return void console.error(t);n(t)}void 0!==i.image?r.image=i.image:void 0!==i.data&&(r.image.width=i.width,r.image.height=i.height,r.image.data=i.data),r.wrapS=void 0!==i.wrapS?i.wrapS:V,r.wrapT=void 0!==i.wrapT?i.wrapT:V,r.magFilter=void 0!==i.magFilter?i.magFilter:X,r.minFilter=void 0!==i.minFilter?i.minFilter:X,r.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.colorSpace&&(r.colorSpace=i.colorSpace),void 0!==i.flipY&&(r.flipY=i.flipY),void 0!==i.format&&(r.format=i.format),void 0!==i.type&&(r.type=i.type),void 0!==i.mipmaps&&(r.mipmaps=i.mipmaps,r.minFilter=Y),1===i.mipmapCount&&(r.minFilter=X),void 0!==i.generateMipmaps&&(r.generateMipmaps=i.generateMipmaps),r.needsUpdate=!0,e&&e(r,i)}),i,n),r}},DataUtils:Yn,DecrementStencilOp:7683,DecrementWrapStencilOp:ge,DefaultLoadingManager:Ol,DepthFormat:pt,DepthStencilFormat:mt,DepthTexture:Ra,DetachedBindMode:U,DirectionalLight:sc,DirectionalLightHelper:class extends wn{constructor(t,e,i){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",void 0===e&&(e=1);let n=new hs;n.setAttribute("position",new is([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const s=new la({fog:!1,toneMapped:!1});this.lightPlane=new ga(n,s),this.add(this.lightPlane),n=new hs,n.setAttribute("position",new is([0,0,0,0,0,1],3)),this.targetLine=new ga(n,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),uh.setFromMatrixPosition(this.light.matrixWorld),ph.setFromMatrixPosition(this.light.target.matrixWorld),mh.subVectors(ph,uh),this.lightPlane.lookAt(ph),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(ph),this.targetLine.scale.z=mh.length()}},DiscreteInterpolant:Sl,DodecahedronGeometry:ao,DoubleSide:2,DstAlphaFactor:206,DstColorFactor:208,DynamicCopyUsage:35050,DynamicDrawUsage:35048,DynamicReadUsage:35049,EdgesGeometry:uo,EllipseCurve:Ia,EqualCompare:514,EqualDepth:4,EqualStencilFunc:514,EquirectangularReflectionMapping:B,EquirectangularRefractionMapping:F,Euler:sn,EventDispatcher:ke,ExtrudeGeometry:Vo,FileLoader:Hl,Float16BufferAttribute:class extends Qn{constructor(t,e,i){super(new Uint16Array(t),e,i),this.isFloat16BufferAttribute=!0}getX(t){let e=Zn(this.array[t*this.itemSize]);return this.normalized&&(e=Fe(e,this.array)),e}setX(t,e){return this.normalized&&(e=ze(e,this.array)),this.array[t*this.itemSize]=Xn(e),this}getY(t){let e=Zn(this.array[t*this.itemSize+1]);return this.normalized&&(e=Fe(e,this.array)),e}setY(t,e){return this.normalized&&(e=ze(e,this.array)),this.array[t*this.itemSize+1]=Xn(e),this}getZ(t){let e=Zn(this.array[t*this.itemSize+2]);return this.normalized&&(e=Fe(e,this.array)),e}setZ(t,e){return this.normalized&&(e=ze(e,this.array)),this.array[t*this.itemSize+2]=Xn(e),this}getW(t){let e=Zn(this.array[t*this.itemSize+3]);return this.normalized&&(e=Fe(e,this.array)),e}setW(t,e){return this.normalized&&(e=ze(e,this.array)),this.array[t*this.itemSize+3]=Xn(e),this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=ze(e,this.array),i=ze(i,this.array)),this.array[t+0]=Xn(e),this.array[t+1]=Xn(i),this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=ze(e,this.array),i=ze(i,this.array),n=ze(n,this.array)),this.array[t+0]=Xn(e),this.array[t+1]=Xn(i),this.array[t+2]=Xn(n),this}setXYZW(t,e,i,n,s){return t*=this.itemSize,this.normalized&&(e=ze(e,this.array),i=ze(i,this.array),n=ze(n,this.array),s=ze(s,this.array)),this.array[t+0]=Xn(e),this.array[t+1]=Xn(i),this.array[t+2]=Xn(n),this.array[t+3]=Xn(s),this}},Float32BufferAttribute:is,FloatType:it,Fog:Gs,FogExp2:Vs,FramebufferTexture:class extends hi{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=j,this.minFilter=j,this.generateMipmaps=!1,this.needsUpdate=!0}},FrontSide:0,Frustum:Gr,GLBufferAttribute:class{constructor(t,e,i,n,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=e,this.itemSize=i,this.elementSize=n,this.count=s,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}},GLSL1:"100",GLSL3:Ae,GreaterCompare:516,GreaterDepth:6,GreaterEqualCompare:518,GreaterEqualDepth:5,GreaterEqualStencilFunc:518,GreaterStencilFunc:516,GridHelper:dh,Group:Fs,HalfFloatType:nt,HemisphereLight:jl,HemisphereLightHelper:class extends wn{constructor(t,e,i){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const n=new Wo(e);n.rotateY(.5*Math.PI),this.material=new jn({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const s=n.getAttribute("position"),r=new Float32Array(3*s.count);n.setAttribute("color",new Qn(r,3)),this.add(new bs(n,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");ch.copy(this.light.color),hh.copy(this.light.groundColor);for(let t=0,i=e.count;t<i;t++){const n=t<i/2?ch:hh;e.setXYZ(t,n.r,n.g,n.b)}e.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),t.lookAt(lh.setFromMatrixPosition(this.light.matrixWorld).negate())}},IcosahedronGeometry:jo,ImageBitmapLoader:class extends Bl{constructor(t){super(t),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const s=this,r=Dl.get(t);if(void 0!==r)return s.manager.itemStart(t),r.then?void r.then((i=>{e&&e(i),s.manager.itemEnd(t)})).catch((t=>{n&&n(t)})):(setTimeout((function(){e&&e(r),s.manager.itemEnd(t)}),0),r);const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader;const o=fetch(t,a).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(s.options,{colorSpaceConversion:"none"}))})).then((function(i){return Dl.add(t,i),e&&e(i),s.manager.itemEnd(t),i})).catch((function(e){n&&n(e),Dl.remove(t),s.manager.itemError(t),s.manager.itemEnd(t)}));Dl.add(t,o),s.manager.itemStart(t)}},ImageLoader:Vl,ImageUtils:ri,IncrementStencilOp:7682,IncrementWrapStencilOp:fe,InstancedBufferAttribute:Cr,InstancedBufferGeometry:dc,InstancedInterleavedBuffer:qc,InstancedMesh:Nr,Int16BufferAttribute:class extends Qn{constructor(t,e,i){super(new Int16Array(t),e,i)}},Int32BufferAttribute:class extends Qn{constructor(t,e,i){super(new Int32Array(t),e,i)}},Int8BufferAttribute:class extends Qn{constructor(t,e,i){super(new Int8Array(t),e,i)}},IntType:tt,InterleavedBuffer:Ws,InterleavedBufferAttribute:Xs,Interpolant:wl,InterpolateDiscrete:te,InterpolateLinear:ee,InterpolateSmooth:ie,InvertStencilOp:5386,KeepStencilOp:pe,KeyframeTrack:Tl,LOD:ur,LatheGeometry:to,Layers:rn,LessCompare:513,LessDepth:2,LessEqualCompare:515,LessEqualDepth:3,LessEqualStencilFunc:515,LessStencilFunc:513,Light:Gl,LightProbe:lc,Line:ga,Line3:ih,LineBasicMaterial:la,LineCurve:qa,LineCurve3:Xa,LineDashedMaterial:ml,LineLoop:wa,LineSegments:xa,LinearFilter:X,LinearInterpolant:Ml,LinearMipMapLinearFilter:1008,LinearMipMapNearestFilter:1007,LinearMipmapLinearFilter:Y,LinearMipmapNearestFilter:Z,LinearSRGBColorSpace:he,LinearToneMapping:1,LinearTransfer:de,Loader:Bl,LoaderUtils:hc,LoadingManager:Nl,LoopOnce:2200,LoopPingPong:Qt,LoopRepeat:Kt,LuminanceAlphaFormat:ut,LuminanceFormat:dt,MOUSE:i,Material:Gn,MaterialLoader:cc,MathUtils:He,Matrix2:Kc,Matrix3:Ge,Matrix4:Xi,MaxEquation:104,Mesh:bs,MeshBasicMaterial:jn,MeshDepthMaterial:dl,MeshDistanceMaterial:ul,MeshLambertMaterial:hl,MeshMatcapMaterial:pl,MeshNormalMaterial:cl,MeshPhongMaterial:ol,MeshPhysicalMaterial:al,MeshStandardMaterial:rl,MeshToonMaterial:ll,MinEquation:103,MirroredRepeatWrapping:G,MixOperation:1,MultiplyBlending:4,MultiplyOperation:0,NearestFilter:j,NearestMipMapLinearFilter:1005,NearestMipMapNearestFilter:1004,NearestMipmapLinearFilter:q,NearestMipmapNearestFilter:W,NeutralToneMapping:7,NeverCompare:512,NeverDepth:0,NeverStencilFunc:512,NoBlending:0,NoColorSpace:le,NoToneMapping:0,NormalAnimationBlendMode:ae,NormalBlending:1,NotEqualCompare:517,NotEqualDepth:7,NotEqualStencilFunc:517,NumberKeyframeTrack:Cl,Object3D:wn,ObjectLoader:class extends Bl{constructor(t){super(t)}load(t,e,i,n){const s=this,r=""===this.path?hc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||r;const a=new Hl(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(i){let r=null;try{r=JSON.parse(i)}catch(e){return void 0!==n&&n(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}const a=r.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())return void 0!==n&&n(new Error("THREE.ObjectLoader: Can't load "+t)),void console.error("THREE.ObjectLoader: Can't load "+t);s.parse(r,e)}),i,n)}async loadAsync(t,e){const i=""===this.path?hc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||i;const n=new Hl(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials);const s=await n.loadAsync(t,e),r=JSON.parse(s),a=r.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+t);return await this.parseAsync(r)}parse(t,e){const i=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),s=this.parseGeometries(t.geometries,n),r=this.parseImages(t.images,(function(){void 0!==e&&e(l)})),a=this.parseTextures(t.textures,r),o=this.parseMaterials(t.materials,a),l=this.parseObject(t.object,s,o,a,i),c=this.parseSkeletons(t.skeletons,l);if(this.bindSkeletons(l,c),this.bindLightTargets(l),void 0!==e){let t=!1;for(const e in r)if(r[e].data instanceof HTMLImageElement){t=!0;break}!1===t&&e(l)}return l}async parseAsync(t){const e=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),n=this.parseGeometries(t.geometries,i),s=await this.parseImagesAsync(t.images),r=this.parseTextures(t.textures,s),a=this.parseMaterials(t.materials,r),o=this.parseObject(t.object,n,a,r,e),l=this.parseSkeletons(t.skeletons,o);return this.bindSkeletons(o,l),this.bindLightTargets(o),o}parseShapes(t){const e={};if(void 0!==t)for(let i=0,n=t.length;i<n;i++){const n=(new po).fromJSON(t[i]);e[n.uuid]=n}return e}parseSkeletons(t,e){const i={},n={};if(e.traverse((function(t){t.isBone&&(n[t.uuid]=t)})),void 0!==t)for(let e=0,s=t.length;e<s;e++){const s=(new Ar).fromJSON(t[e],n);i[s.uuid]=s}return i}parseGeometries(t,e){const i={};if(void 0!==t){const n=new uc;for(let s=0,r=t.length;s<r;s++){let r;const a=t[s];switch(a.type){case"BufferGeometry":case"InstancedBufferGeometry":r=n.parse(a);break;default:a.type in il?r=il[a.type].fromJSON(a,e):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${a.type}"`)}r.uuid=a.uuid,void 0!==a.name&&(r.name=a.name),void 0!==a.userData&&(r.userData=a.userData),i[a.uuid]=r}}return i}parseMaterials(t,e){const i={},n={};if(void 0!==t){const s=new cc;s.setTextures(e);for(let e=0,r=t.length;e<r;e++){const r=t[e];void 0===i[r.uuid]&&(i[r.uuid]=s.parse(r)),n[r.uuid]=i[r.uuid]}}return n}parseAnimations(t){const e={};if(void 0!==t)for(let i=0;i<t.length;i++){const n=t[i],s=Il.parse(n);e[s.uuid]=s}return e}parseImages(t,e){const i=this,n={};let s;function r(t){if("string"==typeof t){const e=t;return function(t){return i.manager.itemStart(t),s.load(t,(function(){i.manager.itemEnd(t)}),void 0,(function(){i.manager.itemError(t),i.manager.itemEnd(t)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:i.resourcePath+e)}return t.data?{data:Xe(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){const i=new Nl(e);s=new Vl(i),s.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.url;if(Array.isArray(s)){const t=[];for(let e=0,i=s.length;e<i;e++){const i=r(s[e]);null!==i&&(i instanceof HTMLImageElement?t.push(i):t.push(new Sr(i.data,i.width,i.height)))}n[i.uuid]=new oi(t)}else{const t=r(i.url);n[i.uuid]=new oi(t)}}}return n}async parseImagesAsync(t){const e=this,i={};let n;async function s(t){if("string"==typeof t){const i=t,s=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(i)?i:e.resourcePath+i;return await n.loadAsync(s)}return t.data?{data:Xe(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){n=new Vl(this.manager),n.setCrossOrigin(this.crossOrigin);for(let e=0,n=t.length;e<n;e++){const n=t[e],r=n.url;if(Array.isArray(r)){const t=[];for(let e=0,i=r.length;e<i;e++){const i=r[e],n=await s(i);null!==n&&(n instanceof HTMLImageElement?t.push(n):t.push(new Sr(n.data,n.width,n.height)))}i[n.uuid]=new oi(t)}else{const t=await s(n.url);i[n.uuid]=new oi(t)}}}return i}parseTextures(t,e){function i(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}const n={};if(void 0!==t)for(let s=0,r=t.length;s<r;s++){const r=t[s];void 0===r.image&&console.warn('THREE.ObjectLoader: No "image" specified for',r.uuid),void 0===e[r.image]&&console.warn("THREE.ObjectLoader: Undefined image",r.image);const a=e[r.image],o=a.data;let l;Array.isArray(o)?(l=new Os,6===o.length&&(l.needsUpdate=!0)):(l=o&&o.data?new Sr:new hi,o&&(l.needsUpdate=!0)),l.source=a,l.uuid=r.uuid,void 0!==r.name&&(l.name=r.name),void 0!==r.mapping&&(l.mapping=i(r.mapping,pc)),void 0!==r.channel&&(l.channel=r.channel),void 0!==r.offset&&l.offset.fromArray(r.offset),void 0!==r.repeat&&l.repeat.fromArray(r.repeat),void 0!==r.center&&l.center.fromArray(r.center),void 0!==r.rotation&&(l.rotation=r.rotation),void 0!==r.wrap&&(l.wrapS=i(r.wrap[0],mc),l.wrapT=i(r.wrap[1],mc)),void 0!==r.format&&(l.format=r.format),void 0!==r.internalFormat&&(l.internalFormat=r.internalFormat),void 0!==r.type&&(l.type=r.type),void 0!==r.colorSpace&&(l.colorSpace=r.colorSpace),void 0!==r.minFilter&&(l.minFilter=i(r.minFilter,fc)),void 0!==r.magFilter&&(l.magFilter=i(r.magFilter,fc)),void 0!==r.anisotropy&&(l.anisotropy=r.anisotropy),void 0!==r.flipY&&(l.flipY=r.flipY),void 0!==r.generateMipmaps&&(l.generateMipmaps=r.generateMipmaps),void 0!==r.premultiplyAlpha&&(l.premultiplyAlpha=r.premultiplyAlpha),void 0!==r.unpackAlignment&&(l.unpackAlignment=r.unpackAlignment),void 0!==r.compareFunction&&(l.compareFunction=r.compareFunction),void 0!==r.userData&&(l.userData=r.userData),n[r.uuid]=l}return n}parseObject(t,e,i,n,s){let r,a,o;function l(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function c(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let n=0,s=t.length;n<s;n++){const s=t[n];void 0===i[s]&&console.warn("THREE.ObjectLoader: Undefined material",s),e.push(i[s])}return e}return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),i[t]}}function h(t){return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined texture",t),n[t]}switch(t.type){case"Scene":r=new js,void 0!==t.background&&(Number.isInteger(t.background)?r.background=new zn(t.background):r.background=h(t.background)),void 0!==t.environment&&(r.environment=h(t.environment)),void 0!==t.fog&&("Fog"===t.fog.type?r.fog=new Gs(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(r.fog=new Vs(t.fog.color,t.fog.density)),""!==t.fog.name&&(r.fog.name=t.fog.name)),void 0!==t.backgroundBlurriness&&(r.backgroundBlurriness=t.backgroundBlurriness),void 0!==t.backgroundIntensity&&(r.backgroundIntensity=t.backgroundIntensity),void 0!==t.backgroundRotation&&r.backgroundRotation.fromArray(t.backgroundRotation),void 0!==t.environmentIntensity&&(r.environmentIntensity=t.environmentIntensity),void 0!==t.environmentRotation&&r.environmentRotation.fromArray(t.environmentRotation);break;case"PerspectiveCamera":r=new Us(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(r.focus=t.focus),void 0!==t.zoom&&(r.zoom=t.zoom),void 0!==t.filmGauge&&(r.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(r.filmOffset=t.filmOffset),void 0!==t.view&&(r.view=Object.assign({},t.view));break;case"OrthographicCamera":r=new ic(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(r.zoom=t.zoom),void 0!==t.view&&(r.view=Object.assign({},t.view));break;case"AmbientLight":r=new rc(t.color,t.intensity);break;case"DirectionalLight":r=new sc(t.color,t.intensity),r.target=t.target||"";break;case"PointLight":r=new ec(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":r=new ac(t.color,t.intensity,t.width,t.height);break;case"SpotLight":r=new Jl(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay),r.target=t.target||"";break;case"HemisphereLight":r=new jl(t.color,t.groundColor,t.intensity);break;case"LightProbe":r=(new lc).fromJSON(t);break;case"SkinnedMesh":a=l(t.geometry),o=c(t.material),r=new br(a,o),void 0!==t.bindMode&&(r.bindMode=t.bindMode),void 0!==t.bindMatrix&&r.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(r.skeleton=t.skeleton);break;case"Mesh":a=l(t.geometry),o=c(t.material),r=new bs(a,o);break;case"InstancedMesh":a=l(t.geometry),o=c(t.material);const e=t.count,i=t.instanceMatrix,n=t.instanceColor;r=new Nr(a,o,e),r.instanceMatrix=new Cr(new Float32Array(i.array),16),void 0!==n&&(r.instanceColor=new Cr(new Float32Array(n.array),n.itemSize));break;case"BatchedMesh":a=l(t.geometry),o=c(t.material),r=new oa(t.maxInstanceCount,t.maxVertexCount,t.maxIndexCount,o),r.geometry=a,r.perObjectFrustumCulled=t.perObjectFrustumCulled,r.sortObjects=t.sortObjects,r._drawRanges=t.drawRanges,r._reservedRanges=t.reservedRanges,r._visibility=t.visibility,r._active=t.active,r._bounds=t.bounds.map((t=>{const e=new xi;e.min.fromArray(t.boxMin),e.max.fromArray(t.boxMax);const i=new Bi;return i.radius=t.sphereRadius,i.center.fromArray(t.sphereCenter),{boxInitialized:t.boxInitialized,box:e,sphereInitialized:t.sphereInitialized,sphere:i}})),r._maxInstanceCount=t.maxInstanceCount,r._maxVertexCount=t.maxVertexCount,r._maxIndexCount=t.maxIndexCount,r._geometryInitialized=t.geometryInitialized,r._geometryCount=t.geometryCount,r._matricesTexture=h(t.matricesTexture.uuid),void 0!==t.colorsTexture&&(r._colorsTexture=h(t.colorsTexture.uuid));break;case"LOD":r=new ur;break;case"Line":r=new ga(l(t.geometry),c(t.material));break;case"LineLoop":r=new wa(l(t.geometry),c(t.material));break;case"LineSegments":r=new xa(l(t.geometry),c(t.material));break;case"PointCloud":case"Points":r=new Aa(l(t.geometry),c(t.material));break;case"Sprite":r=new lr(c(t.material));break;case"Group":r=new Fs;break;case"Bone":r=new Mr;break;default:r=new wn}if(r.uuid=t.uuid,void 0!==t.name&&(r.name=t.name),void 0!==t.matrix?(r.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(r.matrixAutoUpdate=t.matrixAutoUpdate),r.matrixAutoUpdate&&r.matrix.decompose(r.position,r.quaternion,r.scale)):(void 0!==t.position&&r.position.fromArray(t.position),void 0!==t.rotation&&r.rotation.fromArray(t.rotation),void 0!==t.quaternion&&r.quaternion.fromArray(t.quaternion),void 0!==t.scale&&r.scale.fromArray(t.scale)),void 0!==t.up&&r.up.fromArray(t.up),void 0!==t.castShadow&&(r.castShadow=t.castShadow),void 0!==t.receiveShadow&&(r.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.intensity&&(r.shadow.intensity=t.shadow.intensity),void 0!==t.shadow.bias&&(r.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(r.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(r.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&r.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(r.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.frustumCulled&&(r.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(r.renderOrder=t.renderOrder),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.layers&&(r.layers.mask=t.layers),void 0!==t.children){const a=t.children;for(let t=0;t<a.length;t++)r.add(this.parseObject(a[t],e,i,n,s))}if(void 0!==t.animations){const e=t.animations;for(let t=0;t<e.length;t++){const i=e[t];r.animations.push(s[i])}}if("LOD"===t.type){void 0!==t.autoUpdate&&(r.autoUpdate=t.autoUpdate);const e=t.levels;for(let t=0;t<e.length;t++){const i=e[t],n=r.getObjectByProperty("uuid",i.object);void 0!==n&&r.addLevel(n,i.distance,i.hysteresis)}}return r}bindSkeletons(t,e){0!==Object.keys(e).length&&t.traverse((function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){const i=e[t.skeleton];void 0===i?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(i,t.bindMatrix)}}))}bindLightTargets(t){t.traverse((function(e){if(e.isDirectionalLight||e.isSpotLight){const i=e.target,n=t.getObjectByProperty("uuid",i);e.target=void 0!==n?n:new wn}}))}},ObjectSpaceNormalMap:1,OctahedronGeometry:Wo,OneFactor:201,OneMinusConstantAlphaFactor:214,OneMinusConstantColorFactor:212,OneMinusDstAlphaFactor:207,OneMinusDstColorFactor:209,OneMinusSrcAlphaFactor:f,OneMinusSrcColorFactor:203,OrthographicCamera:ic,PCFShadowMap:1,PCFSoftShadowMap:2,PMREMGenerator:Jh,Path:Qa,PerspectiveCamera:Us,Plane:zr,PlaneGeometry:qo,PlaneHelper:class extends ga{constructor(t,e=1,i=16776960){const n=i,s=new hs;s.setAttribute("position",new is([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),s.computeBoundingSphere(),super(s,new la({color:n,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const r=new hs;r.setAttribute("position",new is([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),r.computeBoundingSphere(),this.add(new bs(r,new jn({color:n,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}},PointLight:ec,PointLightHelper:class extends bs{constructor(t,e,i){super(new Yo(e,4,2),new jn({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}},Points:Aa,PointsMaterial:ba,PolarGridHelper:class extends xa{constructor(t=10,e=16,i=8,n=64,s=4473924,r=8947848){s=new zn(s),r=new zn(r);const a=[],o=[];if(e>1)for(let i=0;i<e;i++){const n=i/e*(2*Math.PI),l=Math.sin(n)*t,c=Math.cos(n)*t;a.push(0,0,0),a.push(l,0,c);const h=1&i?s:r;o.push(h.r,h.g,h.b),o.push(h.r,h.g,h.b)}for(let e=0;e<i;e++){const l=1&e?s:r,c=t-t/i*e;for(let t=0;t<n;t++){let e=t/n*(2*Math.PI),i=Math.sin(e)*c,s=Math.cos(e)*c;a.push(i,0,s),o.push(l.r,l.g,l.b),e=(t+1)/n*(2*Math.PI),i=Math.sin(e)*c,s=Math.cos(e)*c,a.push(i,0,s),o.push(l.r,l.g,l.b)}}const l=new hs;l.setAttribute("position",new is(a,3)),l.setAttribute("color",new is(o,3));super(l,new la({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}},PolyhedronGeometry:ro,PositionalAudio:class extends Cc{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,i){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=i,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(Lc,kc,Rc),Pc.set(0,0,1).applyQuaternion(kc);const e=this.panner;if(e.positionX){const t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(Lc.x,t),e.positionY.linearRampToValueAtTime(Lc.y,t),e.positionZ.linearRampToValueAtTime(Lc.z,t),e.orientationX.linearRampToValueAtTime(Pc.x,t),e.orientationY.linearRampToValueAtTime(Pc.y,t),e.orientationZ.linearRampToValueAtTime(Pc.z,t)}else e.setPosition(Lc.x,Lc.y,Lc.z),e.setOrientation(Pc.x,Pc.y,Pc.z)}},PropertyBinding:zc,PropertyMixer:Ic,QuadraticBezierCurve:Za,QuadraticBezierCurve3:Ya,Quaternion:gi,QuaternionKeyframeTrack:kl,QuaternionLinearInterpolant:Ll,RED_GREEN_RGTC2_Format:Jt,RED_RGTC1_Format:Zt,REVISION:e,RGBADepthPacking:3201,RGBAFormat:ht,RGBAIntegerFormat:yt,RGBA_ASTC_10x10_Format:Vt,RGBA_ASTC_10x5_Format:Ft,RGBA_ASTC_10x6_Format:zt,RGBA_ASTC_10x8_Format:Ht,RGBA_ASTC_12x10_Format:Gt,RGBA_ASTC_12x12_Format:jt,RGBA_ASTC_4x4_Format:Rt,RGBA_ASTC_5x4_Format:Pt,RGBA_ASTC_5x5_Format:It,RGBA_ASTC_6x5_Format:Ut,RGBA_ASTC_6x6_Format:Dt,RGBA_ASTC_8x5_Format:Nt,RGBA_ASTC_8x6_Format:Ot,RGBA_ASTC_8x8_Format:Bt,RGBA_BPTC_Format:Wt,RGBA_ETC2_EAC_Format:kt,RGBA_PVRTC_2BPPV1_Format:At,RGBA_PVRTC_4BPPV1_Format:Et,RGBA_S3TC_DXT1_Format:wt,RGBA_S3TC_DXT3_Format:bt,RGBA_S3TC_DXT5_Format:Mt,RGBDepthPacking:3202,RGBFormat:ct,RGBIntegerFormat:1032,RGB_BPTC_SIGNED_Format:qt,RGB_BPTC_UNSIGNED_Format:Xt,RGB_ETC1_Format:Ct,RGB_ETC2_Format:Lt,RGB_PVRTC_2BPPV1_Format:Tt,RGB_PVRTC_4BPPV1_Format:St,RGB_S3TC_DXT1_Format:xt,RGDepthPacking:3203,RGFormat:vt,RGIntegerFormat:_t,RawShaderMaterial:sl,Ray:qi,Raycaster:Zc,RectAreaLight:ac,RedFormat:ft,RedIntegerFormat:gt,ReinhardToneMapping:2,RenderTarget:ui,RenderTarget3D:class extends ui{constructor(t=1,e=1,i=1,n={}){super(t,e,n),this.isRenderTarget3D=!0,this.depth=i,this.texture=new fi(null,t,e,i),this.texture.isRenderTargetTexture=!0}},RenderTargetArray:class extends ui{constructor(t=1,e=1,i=1,n={}){super(t,e,n),this.isRenderTargetArray=!0,this.depth=i,this.texture=new mi(null,t,e,i),this.texture.isRenderTargetTexture=!0}},RepeatWrapping:H,ReplaceStencilOp:me,ReverseSubtractEquation:102,RingGeometry:Xo,SIGNED_RED_GREEN_RGTC2_Format:$t,SIGNED_RED_RGTC1_Format:Yt,SRGBColorSpace:ce,SRGBTransfer:ue,Scene:js,ShaderChunk:Ah,ShaderLib:Lh,ShaderMaterial:Ls,ShadowMaterial:nl,Shape:po,ShapeGeometry:Zo,ShapePath:bh,ShapeUtils:Fo,ShortType:K,Skeleton:Ar,SkeletonHelper:class extends xa{constructor(t){const e=oh(t),i=new hs,n=[],s=[],r=new zn(0,0,1),a=new zn(0,1,0);for(let t=0;t<e.length;t++){const i=e[t];i.parent&&i.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),s.push(r.r,r.g,r.b),s.push(a.r,a.g,a.b))}i.setAttribute("position",new is(n,3)),i.setAttribute("color",new is(s,3));super(i,new la({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,i=this.geometry,n=i.getAttribute("position");ah.copy(this.root.matrixWorld).invert();for(let t=0,i=0;t<e.length;t++){const s=e[t];s.parent&&s.parent.isBone&&(rh.multiplyMatrices(ah,s.matrixWorld),sh.setFromMatrixPosition(rh),n.setXYZ(i,sh.x,sh.y,sh.z),rh.multiplyMatrices(ah,s.parent.matrixWorld),sh.setFromMatrixPosition(rh),n.setXYZ(i+1,sh.x,sh.y,sh.z),i+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose()}},SkinnedMesh:br,Source:oi,Sphere:Bi,SphereGeometry:Yo,Spherical:$c,SphericalHarmonics3:oc,SplineCurve:Ja,SpotLight:Jl,SpotLightHelper:class extends wn{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const i=new hs,n=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let t=0,e=1,i=32;t<i;t++,e++){const s=t/i*Math.PI*2,r=e/i*Math.PI*2;n.push(Math.cos(s),Math.sin(s),1,Math.cos(r),Math.sin(r),1)}i.setAttribute("position",new is(n,3));const s=new la({fog:!1,toneMapped:!1});this.cone=new xa(i,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),nh.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(nh),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},Sprite:lr,SpriteMaterial:Zs,SrcAlphaFactor:m,SrcAlphaSaturateFactor:210,SrcColorFactor:202,StaticCopyUsage:35046,StaticDrawUsage:Ee,StaticReadUsage:35045,StereoCamera:class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Us,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Us,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,xc.copy(t.projectionMatrix);const i=e.eyeSep/2,n=i*e.near/e.focus,s=e.near*Math.tan(Ie*e.fov*.5)/e.zoom;let r,a;yc.elements[12]=-i,_c.elements[12]=i,r=-s*e.aspect+n,a=s*e.aspect+n,xc.elements[0]=2*e.near/(a-r),xc.elements[8]=(a+r)/(a-r),this.cameraL.projectionMatrix.copy(xc),r=-s*e.aspect-n,a=s*e.aspect-n,xc.elements[0]=2*e.near/(a-r),xc.elements[8]=(a+r)/(a-r),this.cameraR.projectionMatrix.copy(xc)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(yc),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(_c)}},StreamCopyUsage:35042,StreamDrawUsage:35040,StreamReadUsage:35041,StringKeyframeTrack:Rl,SubtractEquation:101,SubtractiveBlending:3,TOUCH:n,TangentSpaceNormalMap:0,TetrahedronGeometry:Jo,Texture:hi,TextureLoader:class extends Bl{constructor(t){super(t)}load(t,e,i,n){const s=new hi,r=new Vl(this.manager);return r.setCrossOrigin(this.crossOrigin),r.setPath(this.path),r.load(t,(function(t){s.image=t,s.needsUpdate=!0,void 0!==e&&e(s)}),i,n),s}},TextureUtils:Sh,TimestampQuery:{COMPUTE:"compute",RENDER:"render"},TorusGeometry:$o,TorusKnotGeometry:Ko,Triangle:Dn,TriangleFanDrawMode:2,TriangleStripDrawMode:1,TrianglesDrawMode:0,TubeGeometry:Qo,UVMapping:D,Uint16BufferAttribute:ts,Uint32BufferAttribute:es,Uint8BufferAttribute:class extends Qn{constructor(t,e,i){super(new Uint8Array(t),e,i)}},Uint8ClampedBufferAttribute:class extends Qn{constructor(t,e,i){super(new Uint8ClampedArray(t),e,i)}},Uniform:jc,UniformsGroup:class extends ke{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:Wc++}),this.name="",this.usage=Ee,this.uniforms=[]}add(t){return this.uniforms.push(t),this}remove(t){const e=this.uniforms.indexOf(t);return-1!==e&&this.uniforms.splice(e,1),this}setName(t){return this.name=t,this}setUsage(t){return this.usage=t,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(t){this.name=t.name,this.usage=t.usage;const e=t.uniforms;this.uniforms.length=0;for(let t=0,i=e.length;t<i;t++){const i=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0;t<i.length;t++)this.uniforms.push(i[t].clone())}return this}clone(){return(new this.constructor).copy(this)}},UniformsLib:Ch,UniformsUtils:Cs,UnsignedByteType:J,UnsignedInt248Type:at,UnsignedInt5999Type:ot,UnsignedIntType:et,UnsignedShort4444Type:st,UnsignedShort5551Type:rt,UnsignedShortType:Q,VSMShadowMap:3,Vector2:Ve,Vector3:vi,Vector4:di,VectorKeyframeTrack:Pl,VideoFrameTexture:class extends La{constructor(t,e,i,n,s,r,a,o){super({},t,e,i,n,s,r,a,o),this.isVideoFrameTexture=!0}update(){}clone(){return(new this.constructor).copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}},VideoTexture:La,WebGL3DRenderTarget:class extends pi{constructor(t=1,e=1,i=1,n={}){super(t,e,n),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new fi(null,t,e,i),this.texture.isRenderTargetTexture=!0}},WebGLArrayRenderTarget:class extends pi{constructor(t=1,e=1,i=1,n={}){super(t,e,n),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new mi(null,t,e,i),this.texture.isRenderTargetTexture=!0}},WebGLCoordinateSystem:Ce,WebGLCubeRenderTarget:Bs,WebGLRenderTarget:pi,WebGLRenderer:ap,WebGLUtils:Qu,WebGPUCoordinateSystem:Le,WebXRController:Hs,WireframeGeometry:tl,WrapAroundEnding:re,ZeroCurvatureEnding:ne,ZeroFactor:200,ZeroSlopeEnding:se,ZeroStencilOp:0,createCanvasElement:Ye});const lp={bottom:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},front:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},help:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M23.0%2c-13.0 A10.0%2c10.0%2c0%2c1%2c0%2c22.998476951563912%2c-12.825475935627155' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3ctext x='7.0' y='-6.0' font-size='20.0' fill='rgb(83%2c160%2c227)' font-family='sans-serif' font-weight='bold' dy='0em'%3e%3f%3c/text%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M23.0%2c-13.0 A10.0%2c10.0%2c0%2c1%2c0%2c22.998476951563912%2c-12.825475935627155' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3ctext x='7.0' y='-6.0' font-size='20.0' fill='rgb(48%2c 142%2c 225)' font-family='sans-serif' font-weight='bold' dy='0em'%3e%3f%3c/text%3e%3c/svg%3e"},iso:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M22.0%2c-7.5 L22.0%2c-18.5 L13.0%2c-13.0 L13.0%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-13.0 L13.0%2c-2.0 L4.0%2c-7.5 L4.0%2c-18.5 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-18.5 L13.0%2c-24.0 L4.0%2c-18.5 L13.0%2c-13.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M22.0%2c-7.5 L22.0%2c-18.5 L13.0%2c-13.0 L13.0%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-13.0 L13.0%2c-2.0 L4.0%2c-7.5 L4.0%2c-18.5 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-18.5 L13.0%2c-24.0 L4.0%2c-18.5 L13.0%2c-13.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},left:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},mesh:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e"},mesh_empty:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='%23ddd' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='%23ddd' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='%23666' stroke='%23666' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='%23666' stroke='%23666' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23666' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e"},mesh_mix:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-14.2 L12.6%2c-14.2 L8.6%2c-10.133333333333333 L8.6%2c-6.066666666666666 L12.6%2c-2.0 L6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='square' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M16.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 L16.6%2c-2.0 L12.6%2c-6.066666666666666 L12.6%2c-10.133333333333333 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M10.6%2c-10.133333333333333 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L10.6%2c-6.066666666666666' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-14.2 L6.0%2c-14.2 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L6.0%2c-2.0 L14.6%2c-2.0' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-14.2 L12.6%2c-14.2 L8.6%2c-10.133333333333333 L8.6%2c-6.066666666666666 L12.6%2c-2.0 L6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='square' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M16.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 L16.6%2c-2.0 L12.6%2c-6.066666666666666 L12.6%2c-10.133333333333333 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M10.6%2c-10.133333333333333 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L10.6%2c-6.066666666666666' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-14.2 L6.0%2c-14.2 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L6.0%2c-2.0 L14.6%2c-2.0' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},mesh_no:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e"},pause:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='5.2' y='-22.0' width='5.6' height='18.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3crect x='15.2' y='-22.0' width='5.6' height='18.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='5.2' y='-22.0' width='5.6' height='18.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3crect x='15.2' y='-22.0' width='5.6' height='18.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},pin:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='10.0' y='-23.0' width='6.0' height='11.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-3.0 L13.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M17.330127018922195%2c-21.5 A5.0%2c5.0%2c0%2c0%2c0%2c8.669872981077805%2c-21.5' stroke='%23444' stroke-width='1.25' fill='rgb(83%2c160%2c227)' stroke-linecap='round' /%3e%3cpath d='M21.66025403784439%2c-10.2 A10.0%2c10.0%2c0%2c0%2c0%2c4.339745962155613%2c-10.2' stroke='%23444' stroke-width='1.25' fill='rgb(83%2c160%2c227)' stroke-linecap='round' /%3e%3cpath d='M4.5%2c-10.2 L21.5%2c-10.2 Z' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M8.8%2c-21.4 L17.2%2c-21.4 Z' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='10.0' y='-23.0' width='6.0' height='11.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-3.0 L13.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M17.330127018922195%2c-21.5 A5.0%2c5.0%2c0%2c0%2c0%2c8.669872981077805%2c-21.5' stroke='%23ddd' stroke-width='1.25' fill='rgb(48%2c 142%2c 225)' stroke-linecap='round' /%3e%3cpath d='M21.66025403784439%2c-10.2 A10.0%2c10.0%2c0%2c0%2c0%2c4.339745962155613%2c-10.2' stroke='%23ddd' stroke-width='1.25' fill='rgb(48%2c 142%2c 225)' stroke-linecap='round' /%3e%3cpath d='M4.5%2c-10.2 L21.5%2c-10.2 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M8.8%2c-21.4 L17.2%2c-21.4 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},plane:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.0%2c-5.0 L4.4%2c-13.0 L24.0%2c-13.0 L21.0%2c-5.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-9.5 L13.0%2c-19.5 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M11.0%2c-17.5 L13.0%2c-19.5 L15.0%2c-17.5 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.0%2c-5.0 L4.4%2c-13.0 L24.0%2c-13.0 L21.0%2c-5.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-9.5 L13.0%2c-19.5 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M11.0%2c-17.5 L13.0%2c-19.5 L15.0%2c-17.5 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},play:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M5.0%2c-4.0 L5.0%2c-22.0 L21.0%2c-13.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M5.0%2c-4.0 L5.0%2c-22.0 L21.0%2c-13.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},rear:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},reset:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M18.0%2c-21.660254037844386 A10.0%2c10.0%2c0%2c1%2c0%2c23.0%2c-12.999999999999998' stroke='%23444' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M16.0%2c-18.196152422706632 A6.0%2c6.0%2c0%2c1%2c0%2c19.0%2c-12.999999999999998' stroke='%23444' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M17.0%2c-13.0 L21.0%2c-17.0 L25.0%2c-13.0' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M18.0%2c-21.660254037844386 A10.0%2c10.0%2c0%2c1%2c0%2c23.0%2c-12.999999999999998' stroke='%23ddd' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M16.0%2c-18.196152422706632 A6.0%2c6.0%2c0%2c1%2c0%2c19.0%2c-12.999999999999998' stroke='%23ddd' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M17.0%2c-13.0 L21.0%2c-17.0 L25.0%2c-13.0' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},resize:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='2.0' y='-24.0' width='22.0' height='22.0' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L6.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-6.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L20.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-20.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L6.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-20.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L20.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-6.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='2.0' y='-24.0' width='22.0' height='22.0' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L6.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-6.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L20.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-20.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L6.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-20.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L20.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-6.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},right:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},shape:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='rgb(83%2c160%2c227)' stroke='none' stroke-width='1.25' /%3e%3cellipse cx='12.6' cy='-8.1' rx='2.1' ry='2.1' fill='%23444' stroke='%23444' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='rgb(48%2c 142%2c 225)' stroke='none' stroke-width='1.25' /%3e%3cellipse cx='12.6' cy='-8.1' rx='2.1' ry='2.1' fill='%23ddd' stroke='%23ddd' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},shape_empty:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='%23ddd' stroke='none' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='%23666' stroke='none' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23666' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23666' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},shape_mix:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M12.6%2c-13.14 A5.04%2c5.04%2c0%2c0%2c0%2c12.599999999999998%2c-3.0599999999999996' stroke='none' stroke-width='1.25' fill='rgb(83%2c160%2c227)' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-10.2 A2.1%2c2.1%2c0%2c0%2c0%2c12.6%2c-6.0' stroke='%23444' stroke-width='1.25' fill='%23444' stroke-linecap='round' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c15.69914007006101%2c-13.236830413208175' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M15.69914007006101%2c-2.9631695867918246 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-13.7 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c12.6%2c-2.5' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M12.6%2c-13.14 A5.04%2c5.04%2c0%2c0%2c0%2c12.599999999999998%2c-3.0599999999999996' stroke='none' stroke-width='1.25' fill='rgb(48%2c 142%2c 225)' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-10.2 A2.1%2c2.1%2c0%2c0%2c0%2c12.6%2c-6.0' stroke='%23ddd' stroke-width='1.25' fill='%23ddd' stroke-linecap='round' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c15.69914007006101%2c-13.236830413208175' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M15.69914007006101%2c-2.9631695867918246 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-13.7 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c12.6%2c-2.5' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},shape_no:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},stop:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='4.0' y='-22.0' width='18.0' height='18.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='4.0' y='-22.0' width='18.0' height='18.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},top:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},axes:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-3.0 Z' fill='none' stroke='red' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-17.0 Z' fill='none' stroke='rgb(0%2c128%2c0)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L6.6%2c-24.0 Z' fill='none' stroke='blue' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-3.0 Z' fill='none' stroke='rgb(255%2c 69%2c 0)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-17.0 Z' fill='none' stroke='rgb(50%2c 205%2c 50)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L6.6%2c-24.0 Z' fill='none' stroke='rgb(59%2c 158%2c 255)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},axes0:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-3.0 Z' fill='none' stroke='red' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-17.0 Z' fill='none' stroke='rgb(0%2c128%2c0)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L6.6%2c-24.0 Z' fill='none' stroke='blue' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.6' cy='-10.0' rx='3.0' ry='3.8' fill='none' stroke='white' stroke-width='2.4' /%3e%3cellipse cx='6.6' cy='-10.0' rx='2.0' ry='3.0' fill='white' stroke='%23444' stroke-width='1.4' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-3.0 Z' fill='none' stroke='rgb(255%2c 69%2c 0)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-17.0 Z' fill='none' stroke='rgb(50%2c 205%2c 50)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L6.6%2c-24.0 Z' fill='none' stroke='rgb(59%2c 158%2c 255)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.6' cy='-10.0' rx='3.0' ry='3.8' fill='none' stroke='%23444' stroke-width='2.4' /%3e%3cellipse cx='6.6' cy='-10.0' rx='2.0' ry='3.0' fill='%23444' stroke='%23ddd' stroke-width='1.4' /%3e%3c/svg%3e"},grid:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.4%2c-2.0 L23.6%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-9.333333333333332 L23.6%2c-9.333333333333332 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-16.666666666666664 L23.6%2c-16.666666666666664 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-24.0 L23.6%2c-24.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.4 L2.0%2c-23.6 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M9.333333333333332%2c-2.4 L9.333333333333332%2c-23.6 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M16.666666666666664%2c-2.4 L16.666666666666664%2c-23.6 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M24.0%2c-2.4 L24.0%2c-23.6 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.4%2c-2.0 L23.6%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-9.333333333333332 L23.6%2c-9.333333333333332 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-16.666666666666664 L23.6%2c-16.666666666666664 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-24.0 L23.6%2c-24.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.4 L2.0%2c-23.6 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M9.333333333333332%2c-2.4 L9.333333333333332%2c-23.6 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M16.666666666666664%2c-2.4 L16.666666666666664%2c-23.6 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M24.0%2c-2.4 L24.0%2c-23.6 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},perspective:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='14.0' y='-24.0' width='10.0' height='10.0' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L14.0%2c-14.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-18.0 L24.0%2c-24.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L24.0%2c-14.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L14.0%2c-24.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.875' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='14.0' y='-24.0' width='10.0' height='10.0' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L14.0%2c-14.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-18.0 L24.0%2c-24.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L24.0%2c-14.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L14.0%2c-24.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.875' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},explode:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cellipse cx='22.5' cy='-13.0' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L20.5%2c-13.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='15.935661446562001' cy='-22.03503690480396' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L15.317627457812106%2c-20.132923872213652 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='5.3143385534380005' cy='-18.583959896778495' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L6.932372542187895%2c-17.40838939219355 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='5.314338553437999' cy='-7.416040103221507' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L6.932372542187894%2c-8.591610607806452 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='15.935661446561998' cy='-3.9649630951960404' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L15.317627457812105%2c-5.867076127786348 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='13.0' cy='-13.0' rx='2.0' ry='2.0' fill='%23444' stroke='%23444' stroke-width='1.75' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cellipse cx='22.5' cy='-13.0' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L20.5%2c-13.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='15.935661446562001' cy='-22.03503690480396' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L15.317627457812106%2c-20.132923872213652 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='5.3143385534380005' cy='-18.583959896778495' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L6.932372542187895%2c-17.40838939219355 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='5.314338553437999' cy='-7.416040103221507' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L6.932372542187894%2c-8.591610607806452 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='15.935661446561998' cy='-3.9649630951960404' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L15.317627457812105%2c-5.867076127786348 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='13.0' cy='-13.0' rx='2.0' ry='2.0' fill='%23ddd' stroke='%23ddd' stroke-width='1.75' /%3e%3c/svg%3e"},distance:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.0%2c-5.0 L2.0%2c-21.0 Z' fill='none' stroke='%23444' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M24.0%2c-5.0 L24.0%2c-21.0 Z' fill='none' stroke='%23444' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L22.0%2c-13.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L6.8%2c-16.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L6.8%2c-10.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-13.0 L19.2%2c-16.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-13.0 L19.2%2c-10.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.0%2c-5.0 L2.0%2c-21.0 Z' fill='none' stroke='%23ddd' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M24.0%2c-5.0 L24.0%2c-21.0 Z' fill='none' stroke='%23ddd' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L22.0%2c-13.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L6.8%2c-16.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L6.8%2c-10.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-13.0 L19.2%2c-16.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-13.0 L19.2%2c-10.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},properties:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M4.0%2c-21.6 L22.0%2c-21.6 Z' fill='none' stroke='%23444' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M9.2%2c-16.8 L20.8%2c-16.8 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-16.8' rx='0.8' ry='0.8' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-12.8 L20.8%2c-12.8 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-12.8' rx='0.8' ry='0.8' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-8.8 L20.8%2c-8.8 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-8.8' rx='0.8' ry='0.8' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-4.8 L20.8%2c-4.8 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-4.8' rx='0.8' ry='0.8' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M4.0%2c-21.6 L22.0%2c-21.6 Z' fill='none' stroke='%23ddd' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M9.2%2c-16.8 L20.8%2c-16.8 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-16.8' rx='0.8' ry='0.8' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-12.8 L20.8%2c-12.8 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-12.8' rx='0.8' ry='0.8' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-8.8 L20.8%2c-8.8 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-8.8' rx='0.8' ry='0.8' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-4.8 L20.8%2c-4.8 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-4.8' rx='0.8' ry='0.8' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3c/svg%3e"},angle:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.4%2c-3.84 L23.6%2c-3.84 Z' fill='none' stroke='%23444' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-3.84 L14.0%2c-22.88 Z' fill='none' stroke='%23444' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M17.80793811328415%2c-6.280377654627602 A15.6%2c15.6%2c0%2c0%2c0%2c12.217398100377466%2c-15.963476998728744' stroke='rgb(83%2c160%2c227)' stroke-width='2.0' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.4%2c-3.84 L23.6%2c-3.84 Z' fill='none' stroke='%23ddd' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-3.84 L14.0%2c-22.88 Z' fill='none' stroke='%23ddd' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M17.80793811328415%2c-6.280377654627602 A15.6%2c15.6%2c0%2c0%2c0%2c12.217398100377466%2c-15.963476998728744' stroke='rgb(48%2c 142%2c 225)' stroke-width='2.0' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},transparent:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='0.75' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='0.75' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' fill-opacity='0.75' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='0.75' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='0.75' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' fill-opacity='0.75' /%3e%3c/svg%3e"},blackedges:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='7.833333333333333' y='-23.5' width='15.666666666666666' height='15.666666666666666' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-2.5 L2.5%2c-18.166666666666664 L7.833333333333333%2c-23.5 L7.833333333333333%2c-7.833333333333333 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-2.5 L7.833333333333333%2c-7.833333333333333 L23.5%2c-7.833333333333333 L18.166666666666664%2c-2.5 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-18.166666666666664 L7.833333333333333%2c-23.5 L23.5%2c-23.5 L18.166666666666664%2c-18.166666666666664 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.166666666666664%2c-2.5 L18.166666666666664%2c-18.166666666666664 L23.5%2c-23.5 L23.5%2c-7.833333333333333 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.5' y='-18.166666666666664' width='15.666666666666666' height='15.666666666666666' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='7.833333333333333' y='-23.5' width='15.666666666666666' height='15.666666666666666' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-2.5 L2.5%2c-18.166666666666664 L7.833333333333333%2c-23.5 L7.833333333333333%2c-7.833333333333333 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-2.5 L7.833333333333333%2c-7.833333333333333 L23.5%2c-7.833333333333333 L18.166666666666664%2c-2.5 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-18.166666666666664 L7.833333333333333%2c-23.5 L23.5%2c-23.5 L18.166666666666664%2c-18.166666666666664 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.166666666666664%2c-2.5 L18.166666666666664%2c-18.166666666666664 L23.5%2c-23.5 L23.5%2c-7.833333333333333 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.5' y='-18.166666666666664' width='15.666666666666666' height='15.666666666666666' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},nav_open:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e %3cpath d='M3.204 6h9.592L8 11.481 3.204 6z' fill='%23333'/%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e %3cpath d='M3.204 6h9.592L8 11.481 3.204 6z' fill='%23ddd'/%3e%3c/svg%3e"},nav_closed:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e %3cpath d='M6 12.796V3.204L11.481 8 6 12.796z' fill='%23333'/%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e %3cpath d='M6 12.796V3.204L11.481 8 6 12.796z' fill='%23ddd'/%3e%3c/svg%3e"}};function cp(t,e){return`url("${lp[e][t]}")`}function hp(t,e){return decodeURIComponent(lp[e][t]).substring(19)}function dp(t){if(Array.isArray(t))return t.map((t=>dp(t)));if("object"==typeof t){var e={};for(var[i,n]of Object.entries(t))e[i]=dp(n);return e}return t}function up(t,e=1){return Array.isArray(t)?t.flat(e):t}function pp(t,e,i=1e-9){if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&t.every(((t,i)=>pp(t,e[i])));if("object"==typeof t&&"object"==typeof e){var n=Object.keys(t),s=Object.keys(e);return!(n.length!=s.length||!n.every((t=>Object.prototype.hasOwnProperty.call(e,t))))&&n.every((i=>pp(t[i],e[i])))}return Number(t)===t&&Number(e)===e?Math.abs(t-e)<i:t===e}function mp(t,e){t&&(e(t),t.children&&t.children.length>0&&t.children.forEach((t=>{mp(t,e)})))}function fp(t){t&&t.attributes&&(t.attributes.normal&&(t.attributes.normal.array=null),t.attributes.position&&(t.attributes.position.array=null),t.attributes.uv&&(t.attributes.uv.array=null),t.attributes.color&&(t.attributes.color.array=null),t.index&&(t.index.array=null),t.attributes.instanceStart&&(t.attributes.instanceStart.data.array=null),t.attributes.instanceEnd&&(t.attributes.instanceEnd.data.array=null),t.attributes=null)}function gp(t){if(t.shape){var e="";for(e of["edge_types","face_types","segments_per_edge","triangles","triangles_per_face"])t.shape[e]&&(t.shape[e]=null);for(e of["edges","normals","obj_vertices","vertices"])t.shape[e]&&(t.shape[e]=null)}else if(t.parts){for(var i in t.parts)gp(t.parts[i]);t.parts=null}}function vp(t){return Math.round(Math.PI*t)}const _p=new class{constructor(){this.keyMapping={shift:"shiftKey",ctrl:"ctrlKey",meta:"metaKey",alt:"altKey"}}getshortcuts=t=>this.keyMapping[t].replace("Key","");get_config(){return Object.assign({},this.keyMapping)}get=(t,e)=>t[this.keyMapping[e]];set=t=>{for(var e in t)this.keyMapping[e]=t[e]}};class yp{constructor(t,e,i,n){t.startsWith("plane")?(this.index=parseInt(t.substring(5)),this.type="plane"):(this.index=void 0,this.type=t),this.display=n,this.slider=n.container.getElementsByClassName(`tcv_sld_value_${t}`)[0],this.slider.min=e,this.slider.max=i,this.input=n.container.getElementsByClassName(`tcv_inp_value_${t}`)[0],this.input.value=i,this.slider.oninput=this.sliderChange,this.input.addEventListener("change",this.inputChange)}_notify=(t,e=!0)=>{if("plane"==this.type){const i={};i["clip_slider_"+(this.index-1)]=parseFloat(t),this.display.viewer.checkChanges(i,e)}};_handle(t,e,i){"plane"==t?this.display.refreshPlane(e,i):"ambientlight"===t?this.display.viewer.ready&&this.display.viewer.setAmbientLight(i/100):"pointlight"===t?this.display.viewer.ready&&this.display.viewer.setDirectLight(i/100):"metalness"===t?this.display.viewer.ready&&this.display.viewer.setMetalness(i/100):"roughness"===t&&this.display.viewer.ready&&this.display.viewer.setRoughness(i/100)}sliderChange=t=>{const e=t.target.value;this.input.value=Math.round(1e3*e)/1e3,this._handle(this.type,this.index,this.input.value),this._notify(e)};inputChange=t=>{const e=Math.max(Math.min(t.target.value,this.slider.max),this.slider.min);this.slider.value=e,this._handle(this.type,this.index,this.input.value),this._notify(e)};setSlider(t){const e=Math.abs(Math.round(Math.log10(2*t)));this.slider.min=-t,this.slider.max=t,this.slider.step=Math.pow(10,-(3-e)),this.slider.value=t,this.input.value=Math.round(1e3*this.slider.max)/1e3,this.display.refreshPlane(this.index,this.input.value)}getValue(){return parseFloat(this.input.value)}setValue(t,e=!0){const i=Math.max(Math.min(t,this.slider.max),this.slider.min);this.input.value=Math.round(1e3*i)/1e3,this.slider.value=t,this._handle(this.type,this.index,this.input.value),this._notify(t,e)}}class xp{constructor(t,e){this.id=e,this.container=t,this.buttons={}}addButton(t){t.setId(this.id),this.buttons[t.name]=t,this.container.appendChild(t.html)}addSeparator(){var t=document.createElement("span");t.className="tcv_separator",this.container.appendChild(t)}defineGroup(t){for(var e of t)for(var i of t)i!=e&&e.addGroupMember(i)}}class wp{constructor(t,e,i){this.svg=cp(t,e),this.name=e;var n=document.createElement("span");n.className="tcv_tooltip",n.setAttribute("data-tooltip",i);var s=n.appendChild(document.createElement("span"));s.className="tcv_button_frame",s.appendChild(document.createElement("input")),s.children[0].className="tcv_reset tcv_btn",s.children[0].type="button",s.children[0].style.backgroundImage=this.svg,this.html=n,this.html.addEventListener("click",(t=>{this.handler(t)}))}dispose(){this.html="",this.container.removeEventListener("click",this.handler)}setId(t){this.containerId=t}handler=t=>{console.log("not implemented yet")};alignRight(){this.html.classList.add("tcv_align_right")}show(t){this.html.style.display=t?"inline-block":"none"}}class bp extends wp{constructor(t,e,i,n){super(t,e,i),this.action=n}handler=t=>{this.action(this.name)};highlight=t=>{t?this.html.firstChild.classList.add("tcv_btn_highlight"):this.html.firstChild.classList.remove("tcv_btn_highlight")}}class Mp extends wp{constructor(t,e,i,n,s=!1,r=null){if(super(t,e,i),this.action=n,this.state=s,this.dropdown=r,this.sameGroup=[],this.checkElems={},null!=r){const t=document.createElement("span");for(var a of(t.classList.add("tcv_grid-content"),t.classList.add("tcv_dropdown-content"),t.classList.add("tcv_round"),r)){const e=document.createElement("div");e.className="tcv_tooltip",e.setAttribute("data-tooltip",`${i} ${a}`),e.innerHTML=`<input class='tcv_grid-${a} tcv_check tcv_dropdown-entry' id='tcv_grid-${a}_${this.containerId}' type="checkbox"><label for='tcv_grid-${a}_${this.containerId}' class="tcv_label tcv_dropdown-entry">${a}</label>`,t.appendChild(e),this.checkElems[a]=e.children[0]}this.html.children[0].appendChild(t),this.html.children[0].classList.add("tcv_grid-dropdown")}}get=()=>this.state;set=t=>{this.state=t,this.html.children[0].classList.toggle("tcv_btn_click2",this.state)};clearGroup=()=>{for(var t of this.sameGroup)t.state&&(t.state=!1,t.html.children[0].classList.remove("tcv_btn_click2"),t.action(this.name,!1))};extractIdFromName=t=>{const e="grid-",i=t.indexOf(e)+5,n=t.indexOf("_",i);return t.slice(i,n)};handler=t=>{const e=this.extractIdFromName(t.target.id);if(null!=this.dropdown&&e&&this.dropdown.includes(e)){const i=t.target.checked;this.action(`grid-${e}`,i),this.checkElems[e].checked=i}else"button"===t.target.type&&(this.state||this.clearGroup(),this.set(!this.state),this.action(this.name,this.state))};addGroupMember(t){this.sameGroup.push(t)}}const Sp=new xi,Tp=new vi;let Ep=class extends dc{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new is([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new is([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(t){const e=this.attributes.instanceStart,i=this.attributes.instanceEnd;return void 0!==e&&(e.applyMatrix4(t),i.applyMatrix4(t),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const i=new qc(e,6,1);return this.setAttribute("instanceStart",new Xs(i,3,0)),this.setAttribute("instanceEnd",new Xs(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const i=new qc(e,6,1);return this.setAttribute("instanceColorStart",new Xs(i,3,0)),this.setAttribute("instanceColorEnd",new Xs(i,3,3)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new tl(t.geometry)),this}fromLineSegments(t){const e=t.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new xi);const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;void 0!==t&&void 0!==e&&(this.boundingBox.setFromBufferAttribute(t),Sp.setFromBufferAttribute(e),this.boundingBox.union(Sp))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Bi),null===this.boundingBox&&this.computeBoundingBox();const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let n=0;for(let s=0,r=t.count;s<r;s++)Tp.fromBufferAttribute(t,s),n=Math.max(n,i.distanceToSquared(Tp)),Tp.fromBufferAttribute(e,s),n=Math.max(n,i.distanceToSquared(Tp));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}};Ch.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Ve(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},Lh.line={uniforms:Cs.merge([Ch.common,Ch.fog,Ch.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );\n\t\t\t\tvec3 worldUp = normalize( cross( worldDir, tmpFwd ) );\n\t\t\t\tvec3 worldFwd = cross( worldDir, worldUp );\n\t\t\t\tworldPos = position.y < 0.5 ? start: end;\n\n\t\t\t\t// height offset\n\t\t\t\tfloat hw = linewidth * 0.5;\n\t\t\t\tworldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// cap extension\n\t\t\t\t\tworldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;\n\n\t\t\t\t\t// add width to the box\n\t\t\t\t\tworldPos.xyz += worldFwd * hw;\n\n\t\t\t\t\t// endcaps\n\t\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\t\tworldPos.xyz -= worldFwd * 2.0 * hw;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <colorspace_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};class Ap extends Ls{constructor(t){super({type:"LineMaterial",uniforms:Cs.clone(Lh.line.uniforms),vertexShader:Lh.line.vertexShader,fragmentShader:Lh.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(t)}get color(){return this.uniforms.diffuse.value}set color(t){this.uniforms.diffuse.value=t}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(t){!0===t?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(t){this.uniforms.linewidth&&(this.uniforms.linewidth.value=t)}get dashed(){return"USE_DASH"in this.defines}set dashed(t){!0===t!==this.dashed&&(this.needsUpdate=!0),!0===t?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(t){this.uniforms.dashScale.value=t}get dashSize(){return this.uniforms.dashSize.value}set dashSize(t){this.uniforms.dashSize.value=t}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(t){this.uniforms.dashOffset.value=t}get gapSize(){return this.uniforms.gapSize.value}set gapSize(t){this.uniforms.gapSize.value=t}get opacity(){return this.uniforms.opacity.value}set opacity(t){this.uniforms&&(this.uniforms.opacity.value=t)}get resolution(){return this.uniforms.resolution.value}set resolution(t){this.uniforms.resolution.value.copy(t)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(t){this.defines&&(!0===t!==this.alphaToCoverage&&(this.needsUpdate=!0),!0===t?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const Cp=new di,Lp=new vi,kp=new vi,Rp=new di,Pp=new di,Ip=new di,Up=new vi,Dp=new Xi,Np=new ih,Op=new vi,Bp=new xi,Fp=new Bi,zp=new di;let Hp,Vp;function Gp(t,e,i){return zp.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),zp.multiplyScalar(1/zp.w),zp.x=Vp/i.width,zp.y=Vp/i.height,zp.applyMatrix4(t.projectionMatrixInverse),zp.multiplyScalar(1/zp.w),Math.abs(Math.max(zp.x,zp.y))}class jp extends bs{constructor(t=new Ep,e=new Ap({color:16777215*Math.random()})){super(t,e),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const t=this.geometry,e=t.attributes.instanceStart,i=t.attributes.instanceEnd,n=new Float32Array(2*e.count);for(let t=0,s=0,r=e.count;t<r;t++,s+=2)Lp.fromBufferAttribute(e,t),kp.fromBufferAttribute(i,t),n[s]=0===s?0:n[s-1],n[s+1]=n[s]+Lp.distanceTo(kp);const s=new qc(n,2,1);return t.setAttribute("instanceDistanceStart",new Xs(s,1,0)),t.setAttribute("instanceDistanceEnd",new Xs(s,1,1)),this}raycast(t,e){const i=this.material.worldUnits,n=t.camera;null!==n||i||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=void 0!==t.params.Line2&&t.params.Line2.threshold||0;Hp=t.ray;const r=this.matrixWorld,a=this.geometry,o=this.material;let l,c;if(Vp=o.linewidth+s,null===a.boundingSphere&&a.computeBoundingSphere(),Fp.copy(a.boundingSphere).applyMatrix4(r),i)l=.5*Vp;else{l=Gp(n,Math.max(n.near,Fp.distanceToPoint(Hp.origin)),o.resolution)}if(Fp.radius+=l,!1!==Hp.intersectsSphere(Fp)){if(null===a.boundingBox&&a.computeBoundingBox(),Bp.copy(a.boundingBox).applyMatrix4(r),i)c=.5*Vp;else{c=Gp(n,Math.max(n.near,Bp.distanceToPoint(Hp.origin)),o.resolution)}Bp.expandByScalar(c),!1!==Hp.intersectsBox(Bp)&&(i?function(t,e){const i=t.matrixWorld,n=t.geometry,s=n.attributes.instanceStart,r=n.attributes.instanceEnd;for(let a=0,o=Math.min(n.instanceCount,s.count);a<o;a++){Np.start.fromBufferAttribute(s,a),Np.end.fromBufferAttribute(r,a),Np.applyMatrix4(i);const n=new vi,o=new vi;Hp.distanceSqToSegment(Np.start,Np.end,o,n),o.distanceTo(n)<.5*Vp&&e.push({point:o,pointOnLine:n,distance:Hp.origin.distanceTo(o),object:t,face:null,faceIndex:a,uv:null,uv1:null})}}(this,e):function(t,e,i){const n=e.projectionMatrix,s=t.material.resolution,r=t.matrixWorld,a=t.geometry,o=a.attributes.instanceStart,l=a.attributes.instanceEnd,c=Math.min(a.instanceCount,o.count),h=-e.near;Hp.at(1,Ip),Ip.w=1,Ip.applyMatrix4(e.matrixWorldInverse),Ip.applyMatrix4(n),Ip.multiplyScalar(1/Ip.w),Ip.x*=s.x/2,Ip.y*=s.y/2,Ip.z=0,Up.copy(Ip),Dp.multiplyMatrices(e.matrixWorldInverse,r);for(let e=0,a=c;e<a;e++){if(Rp.fromBufferAttribute(o,e),Pp.fromBufferAttribute(l,e),Rp.w=1,Pp.w=1,Rp.applyMatrix4(Dp),Pp.applyMatrix4(Dp),Rp.z>h&&Pp.z>h)continue;if(Rp.z>h){const t=Rp.z-Pp.z,e=(Rp.z-h)/t;Rp.lerp(Pp,e)}else if(Pp.z>h){const t=Pp.z-Rp.z,e=(Pp.z-h)/t;Pp.lerp(Rp,e)}Rp.applyMatrix4(n),Pp.applyMatrix4(n),Rp.multiplyScalar(1/Rp.w),Pp.multiplyScalar(1/Pp.w),Rp.x*=s.x/2,Rp.y*=s.y/2,Pp.x*=s.x/2,Pp.y*=s.y/2,Np.start.copy(Rp),Np.start.z=0,Np.end.copy(Pp),Np.end.z=0;const a=Np.closestPointToPointParameter(Up,!0);Np.at(a,Op);const c=He.lerp(Rp.z,Pp.z,a),d=c>=-1&&c<=1,u=Up.distanceTo(Op)<.5*Vp;if(d&&u){Np.start.fromBufferAttribute(o,e),Np.end.fromBufferAttribute(l,e),Np.start.applyMatrix4(r),Np.end.applyMatrix4(r);const n=new vi,s=new vi;Hp.distanceSqToSegment(Np.start,Np.end,s,n),i.push({point:s,pointOnLine:n,distance:Hp.origin.distanceTo(s),object:t,face:null,faceIndex:e,uv:null,uv1:null})}}}(this,n,e))}}onBeforeRender(t){const e=this.material.uniforms;e&&e.resolution&&(t.getViewport(Cp),this.material.uniforms.resolution.value.set(Cp.z,Cp.w))}}const Wp={none:null,vertex:"vertex",edge:"edge",face:"face",solid:"solid"},qp=null,Xp="plane",Zp="line",Yp="circle",Jp={face:["plane","cylinder","cone","sphere","torus","bezier","bspline","revolution","extrusion","offset","other"],edge:["line","circle","ellipse","hyperbola","parabola","bezier","bspline","offset","other"]};class $p{constructor(t,e){this.obj=t,this.fromSolid=e}_getSolidObjectGroups(t){const e=t.parent.parent;let i;for(let t=0;t<e.children.length;t++){const n=e.children[t];if(n.name===e.name+"|faces"){i=n;break}}return i.children}objs(){return this.fromSolid?this._getSolidObjectGroups(this.obj):[this.obj]}}class Kp{constructor(t,e,i,n,s,r,a){this.camera=t,this.group=r,this.domElement=e,this.width=i,this.height=n,this.threshold=s,this.callback=a,this.raycaster=new Zc,this.raycastMode=!1,this.lastPosition=null,this.mouse=new Ve,this.mouseMoved=!1,this.filters={topoFilter:[Wp.none],geomFilter:[qp]}}dispose(){this.domElement.removeEventListener("mousemove",this.onPointerMove),this.domElement.removeEventListener("mouseup",this.mouseKetUp),this.domElement.removeEventListener("mousedown",this.onMouseKeyDown),this.domElement.removeEventListener("keydown",this.onKeyDown),this.raycastMode=!1,this.groups=null,this.domElement=null,this.camera=null}init(){this.domElement.addEventListener("mousemove",this.onPointerMove),this.domElement.addEventListener("mouseup",this.onMouseKeyUp,!1),this.domElement.addEventListener("mousedown",this.onMouseKeyDown,!1),this.domElement.addEventListener("keydown",this.onKeyDown,!1),this.raycastMode=!0}getIntersectedObjs(){this.raycaster.setFromCamera(this.mouse,this.camera.getCamera()),this.raycaster.params.Points.threshold=this.threshold/this.camera.getZoom(),this.raycaster.params.Line2={threshold:4};var t=this.raycaster.intersectObjects(this.group,!0),e=[];for(var i in t)t[i].object.material.visible&&e.push(t[i]);return e}getValidIntersectedObjs(){var t=[];if(this.mouseMoved){const i=this.getIntersectedObjs();for(var e of i)if(e.object.material.visible){const i=e.object.parent;if(null==i)continue;if(!i.shapeInfo)continue;const n=i.shapeInfo.topo;let s;"vertex"!==n&&(s=Jp[n][i.shapeInfo.geomtype]);const r="solid"===i.subtype;let a=this.filters.topoFilter.includes(Wp.solid)&&r||this.filters.topoFilter.includes(Wp.none)||this.filters.topoFilter.includes(n);if(!a)continue;a=this.filters.geomFilter.includes(qp)||this.filters.geomFilter.includes(s)&&!this.filters.topoFilter.includes(Wp.solid),a&&t.push(e)}}return t}onMouseKeyDown=t=>{this.raycastMode&&(t.button!=i.LEFT&&t.button!=i.RIGHT||(this.lastPosition=this.camera.getPosition().clone()))};onMouseKeyUp=t=>{this.raycastMode&&(t.button==i.LEFT?this.lastPosition.distanceTo(this.camera.getPosition())<1e-6&&this.callback({mouse:"left",shift:_p.get(t,"shift")}):t.button==i.RIGHT&&this.lastPosition.distanceTo(this.camera.getPosition())<1e-6&&this.callback({mouse:"right"}))};onKeyDown=t=>{this.raycastMode&&("Backspace"==t.key?this.callback({key:"Backspace"}):"Escape"==t.key&&this.callback({key:"Escape"}))};onPointerMove=t=>{const e=this.domElement.getBoundingClientRect(),i=e.x+window.scrollX,n=e.y+window.scrollY;this.mouse.x=(t.pageX-i)/this.width*2-1,this.mouse.y=-(t.pageY-n)/this.height*2+1,this.mouseMoved=!0}}class Qp{constructor(t){this.display=t,this.html=this._getHtml(),this.callbacks=[],this.html.addEventListener("contextmenu",(t=>{t.preventDefault()}))}_getHtml(){throw new Error("Not implemented")}_getCellValue(t){const e=this.display._getElement(t);return e?e.textContent:null}_setCellValue(t,e){const i=this.display._getElement(t);i&&(i.textContent=e)}show=t=>{this.html.style.display=t?"inline-block":"none"};isVisible=()=>"inline-block"==this.html.style.display;relocate=(t,e)=>{this.html.style.left=`${t}px`,this.html.style.top=`${e}px`};registerCallback(t,e){this.callbacks.push({callback:e,type:t}),this.html.addEventListener(t,e)}dispose(){for(var t of this.callbacks)this.html.removeEventListener(t.type,t.callback)}}class tm extends Qp{constructor(t){super(t)}_getHtml(){return this.display._getElement("tcv_distance_measurement_panel")}get total(){return this._getCellValue("tcv_total")}set total(t){this._setCellValue("tcv_total",t)}get x_distance(){return this._getCellValue("tcv_x")}set x_distance(t){this._setCellValue("tcv_x",t)}get y_distance(){return this._getCellValue("tcv_y")}set y_distance(t){this._setCellValue("tcv_y",t)}get z_distance(){return this._getCellValue("tcv_z")}set z_distance(t){this._setCellValue("tcv_z",t)}}class em extends Qp{constructor(t){super(t),this._hideAllRows()}_getHtml(){return this.display._getElement("tcv_properties_measurement_panel")}_hideAllRows(){const t=this.html.getElementsByTagName("tr");for(var e=0;e<t.length;e++){if(t[e].style.display="none",t[e].classList.contains("tcv_vertex_coords_title_row"))continue;const n=t[e].getElementsByTagName("td");for(var i=0;i<n.length;i++)n[i].textContent=""}}set subheader(t){this._setCellValue("tcv_measure_subheader",t)}get subheader(){return this._getCellValue("tcv_measure_subheader")}setProperties(t){this._hideAllRows();const e={vertex_coords:["x_value","y_value","z_value"],volume:"volume",area:"area",length:"length",width:"width",radius:"radius",radius2:"radius2",geom_type:"geom_type"};for(const i in e){const n=e[i],s=t[i];if(null!=s){if(Array.isArray(n)){this.display._getElement("tcv_vertex_coords_title_row").style.display="table-row";for(let t=0;t<n.length;t++){this.display._getElement("tcv_"+n[t]).closest("tr").style.display="table-row",this._setCellValue("tcv_"+n[t],s[t])}}else{this.display._getElement("tcv_"+n).closest("tr").style.display="table-row"}this._setCellValue("tcv_"+n,s)}}}}class im extends Qp{constructor(t){super(t)}_getHtml(){return this.display._getElement("tcv_angle_measurement_panel")}get angle(){return this._getCellValue("tcv_angle")}set angle(t){this._setCellValue("tcv_angle",t)}}class nm{constructor(t){this.display=t,this.selectElement=t._getElement("tcv_shape_filter"),this.dropdownElement=t._getElement("tcv_filter_dropdown"),this.arrowElement=t._getElement("tcv_filter_icon"),this.options=["none","vertex","edge","face","solid"],this.selectElement.style.display="none",this.raycaster=null}setRaycaster(t){this.raycaster=t}_setValue=t=>{null!=this.raycaster&&(this.display._getElement("tcv_filter_value").innerText=t,this.raycaster.filters.topoFilter="none"==t?[Wp.none]:[Wp[t.toLowerCase()]])};_toggleDropdown=t=>{null!=t&&t.stopPropagation(),this.dropdownElement.classList.contains("tcv_filter_dropdown_active")?(this.dropdownElement.classList.remove("tcv_filter_dropdown_active"),this.arrowElement.innerText="⏶"):(this.dropdownElement.classList.add("tcv_filter_dropdown_active"),this.arrowElement.innerText="⏷")};_closeDropdown=t=>{this.dropdownElement.classList.contains("tcv_filter_dropdown_active")&&this._toggleDropdown(t)};handleSelection=t=>{const e=t.target.innerText;this._setValue(e),this._toggleDropdown(t)};reset=()=>{this._setValue("None")};_keybindSelect=t=>{-1!==["n","v","e","f","s","Escape"].indexOf(t.key)&&("n"==t.key?this._setValue("None"):"v"==t.key?this._setValue("Vertex"):"e"==t.key?this._setValue("Edge"):"f"==t.key?this._setValue("Face"):"s"==t.key?this._setValue("Solid"):"Escape"==t.key&&this._closeDropdown())};show(t){if(t){this.display.container.addEventListener("keydown",this._keybindSelect),this.display.container.addEventListener("click",this._closeDropdown);let t=this.display._getElement("tcv_filter_content");t.addEventListener("click",this._toggleDropdown);for(const e of this.options)t=this.display._getElement(`tvc_filter_${e}`),t.addEventListener("click",this.handleSelection)}else{this.display.container.removeEventListener("keydown",this._keybindSelect),this.display.container.removeEventListener("click",this._closeDropdown);let t=this.display._getElement("tcv_filter_content");t.removeEventListener("click",this._toggleDropdown);for(const e of this.options)t=this.display._getElement(`tvc_filter_${e}`),t.removeEventListener("click",this.handleSelection)}this.selectElement.style.display=t?"block":"none"}}class sm extends Fs{constructor(t,e,i,n,s,r=!0,a=!0){super(),this.coneLength=t,this.point1=e,this.point2=i,this.linewidth=n,this.color=s,this.arrowStart=r,this.arrowEnd=a,this.type="DistanceLineArrow",this.lineVec=void 0,this.initialize()}initialize(){const t=this.coneLength;let e,i;this.lineVec=this.point1.clone().sub(this.point2.clone()).normalize(),e=this.arrowStart?this.point1.clone().sub(this.lineVec.clone().multiplyScalar(t/2)):this.point1.clone(),i=this.arrowEnd?this.point2.clone().sub(this.lineVec.clone().multiplyScalar(-t/2)):this.point2.clone();const n=new Ap({linewidth:this.linewidth,color:this.color}),s=new Ep;s.setPositions([...e.toArray(),...i.toArray()]);const r=new jp(s,n),a=new so(t/4,t,10),o=new jn({color:this.color}),l=new bs(a,o),c=new bs(a,o);l.name="startCone",c.name="endCone";const h=new Xi,d=new gi;h.lookAt(this.point1,this.point2,l.up),d.setFromRotationMatrix(h),l.setRotationFromQuaternion(d),h.lookAt(this.point2,this.point1,c.up),d.setFromRotationMatrix(h),c.setRotationFromQuaternion(d),l.rotateX(90*Math.PI/180),c.rotateX(90*Math.PI/180),l.position.copy(e),c.position.copy(i),this.arrowStart&&this.add(l),this.arrowEnd&&this.add(c),this.add(r)}dispose(){this.children.forEach((t=>{t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()}))}update(t){const e=this.point1.clone().sub(this.lineVec.clone().multiplyScalar(t*this.coneLength/2)),i=this.point2.clone().sub(this.lineVec.clone().multiplyScalar(-t*this.coneLength/2));if(this.children.find((t=>"LineSegments2"==t.type)).geometry.setPositions([...this.arrowStart?e.toArray():this.point1,...this.arrowEnd?i.toArray():this.point2]),this.arrowStart){const i=this.children.find((t=>"Mesh"==t.type&&"startCone"==t.name));i.position.copy(e),i.scale.set(t,t,t)}if(this.arrowEnd){const e=this.children.find((t=>"Mesh"==t.type&&"endCone"==t.name));e.position.copy(i),e.scale.set(t,t,t)}}}class rm{constructor(t,e){this.selectedShapes=[],this.point1=null,this.point2=null,this.middlePoint=null,this.contextEnabled=!1,this.viewer=t,this.scene=new js,this.panel=e,this.panelCenter=null,this.panelX=null,this.panelY=null,this.panelShown=!1,this.responseData=null,this.measurementLineColor=0,this.connectingLineColor=8388736,this.coneLength=void 0,this.panelDragData={x:null,y:null,clicked:!1},this.panel.registerCallback("mousedown",(t=>{this.panelDragData.clicked=!0,this.panelDragData.x=t.clientX,this.panelDragData.y=t.clientY,t.stopPropagation()})),document.addEventListener("mouseup",this._mouseup),document.addEventListener("mousemove",this._dragPanel)}enableContext(){this.contextEnabled=!0,this.panelCenter=new vi(1,0,0)}disableContext(){this.contextEnabled=!1,this.selectedShapes=[],this._hideMeasurement(),this.viewer.checkChanges({selectedShapeIDs:[]})}_hideMeasurement(){this.responseData=null,this.panel.show(!1),this.scene.clear()}handleResponse(t){this.viewer.info.addHtml(t.center_info)}_setMeasurementVals(){throw new Error("Subclass needs to override this method")}_makeLines(){throw new Error("Subclass needs to override this method")}_getMaxObjSelected(){throw new Error("Subclass needs to override this method")}_waitResponse(t,e){this.responseData?t(this.responseData):setTimeout((()=>{this._waitResponse(t,e)}),100)}_updateMeasurement(){const t=this.selectedShapes.map((t=>{if(t.fromSolid){return t.obj.name.replace(/\|faces.*$/,"").replace(/\|edges.*$/,"").replace(/\|vertices.*$/,"").replaceAll("|","/")}return t.obj.name.replaceAll("|","/")}));if(this.viewer.checkChanges({selectedShapeIDs:[...t]}),this.selectedShapes.length==this._getMaxObjSelected()){new Promise(((t,e)=>{this._waitResponse(t,e)})).then((t=>{this._setMeasurementVals(),this._makeLines(),this.panel.show(!0),this._movePanel()}))}else this._hideMeasurement()}handleSelection=t=>{this._hideMeasurement(),void 0!==this.selectedShapes.find((e=>e.obj.name===t.obj.name))?this.selectedShapes.splice(this.selectedShapes.indexOf(t),1):this.selectedShapes.push(t),this._updateMeasurement()};_mouseup=t=>{this.panelDragData.clicked=!1,t.stopPropagation()};_movePanel=()=>{if(!this.panel.isVisible())return;const t=this.viewer.renderer.domElement.getBoundingClientRect(),e=this.panel.html.getBoundingClientRect();if(null==this.panelX&&null!=this.middlePoint){let i=this.middlePoint.clone().project(this.viewer.camera.getCamera()),n=(i.x+1)*(t.width/2),s=(1-i.y)*(t.height/2);n<t.width/2?this.panelX=n+e.width/2:this.panelX=n-e.width-e.width/2,this.panelX=Math.max(0,Math.min(t.width-e.width,this.panelX)),this.panelY=s,this.panelY=Math.max(0,Math.min(t.height-e.height,this.panelY))}this.panel.relocate(this.panelX,this.panelY);const i=this.panelX+e.width/2,n=this.panelY+e.height/2,s=i/(t.width/2)-1,r=1-n/(t.height/2),a=this.viewer.ortho?-.9:1;var o=new vi(s,r,a);const l=this.viewer.camera.getCamera();l.updateProjectionMatrix(),l.updateMatrixWorld(),this.panelCenter=o.unproject(l),this.scene.clear(),this._makeLines()};_dragPanel=t=>{if(!this.panelDragData.clicked)return;const e=this.panel.html.getBoundingClientRect(),i=this.viewer.renderer.domElement.getBoundingClientRect();let n=t.clientX-this.panelDragData.x,s=t.clientY-this.panelDragData.y;e.x+n<i.x&&t.movementX<=0||e.x+n>i.x+i.width-e.width&&t.movementX>=0||(this.panelX+=n),e.y+s<i.y&&t.movementY<=0||e.y+s>i.y+i.height-e.height&&t.movementY>=0||(this.panelY+=s),this.scene.clear(),this._updateMeasurement(),this.panelDragData.x=t.clientX,this.panelDragData.y=t.clientY};removeLastSelectedObj(t=!1){if(t||this.selectedShapes.length==this._getMaxObjSelected()){const t=this.selectedShapes.pop();if(t){let e=t.objs();for(let t of e)t.clearHighlights()}this._updateMeasurement()}}_adjustArrowsScaleFactor(t){const e=1/t;for(let t of this.scene.children)t.update(e)}update(){const t=this.viewer.camera.getCamera(),e=this.viewer.camera.getZoom();this.coneLength=this.viewer.bb_radius/(Math.max(this.viewer.cadWidth,this.viewer.height)/60),this._adjustArrowsScaleFactor(e),this.viewer.renderer.clearDepth(),this.viewer.renderer.render(this.scene,t),this._movePanel()}dispose(){for(var t in document.removeEventListener("mouseup",this._mouseup),document.removeEventListener("mousemove",this._dragPanel),this.scene.children)this.scene.children[t].dispose(),this.scene.children[t]=null;this.panel.dispose(),this.panel=null,this.viewer=null,this.scene=null}}class am extends rm{constructor(t){super(t,new tm(t.display)),this.point1=null,this.point2=null,this.middlePoint=null}_setMeasurementVals(){this._getPoints();const t=this.responseData.distance,e=this.point2.clone().sub(this.point1),i=Math.abs(e.x),n=Math.abs(e.y),s=Math.abs(e.z);this.panel.total=t.toFixed(3),this.panel.x_distance=i.toFixed(3),this.panel.y_distance=n.toFixed(3),this.panel.z_distance=s.toFixed(3)}_getMaxObjSelected(){return 2}_getPoints(){this.point1=new vi(...this.responseData.point1),this.point2=new vi(...this.responseData.point2)}_makeLines(){const t=new sm(this.coneLength,this.point1,this.point2,3,this.measurementLineColor);this.scene.add(t),this.middlePoint=(new vi).addVectors(this.point1,this.point2).multiplyScalar(.5);const e=new sm(this.coneLength,this.panelCenter,this.middlePoint,1.5,this.connectingLineColor,!1,!1);this.scene.add(e)}handleResponse(t){super.handleResponse(t);const e={distance:t.distance,point1:new vi(...t.point1),point2:new vi(...t.point2)};this.responseData=e}}class om extends rm{constructor(t){super(t,new em(t.display)),this.middlePoint=null}_setMeasurementVals(){const t=this.selectedShapes[0].obj,e=t.name.match(/.*\|.*vertices/),i=t.name.match(/.*\|.*edges/),n=t.name.match(/.*\|.*faces/),s=this.selectedShapes[0].fromSolid?"Solid":e?"Vertex":i?"Edge":n?"Face":"Unknown";this.panel.subheader=s;const r=this.responseData;this.panel.setProperties(r)}_getMaxObjSelected(){return 1}_makeLines(){this.middlePoint=this.responseData.center;const t=new sm(this.coneLength,this.panelCenter,this.middlePoint,1.5,this.connectingLineColor,!1,!1);this.scene.add(t)}handleResponse(t){super.handleResponse(t);let e={...t};e.center=new vi(...t.center),this.responseData=e}}class lm extends rm{constructor(t){super(t,new im(t.display)),this.middlePoint=null}_setMeasurementVals(){let t;t=this.responseData.angle.toFixed(2)+" °",this.panel.angle=t}enableContext(){super.enableContext(),this.viewer.raycaster.filters.geomFilter=[Zp,Xp,Yp],this.viewer.info.addHtml("When in angle measurement<br>context you cannot pick :<br>- Non planar faces<br>- Curved edges<br>- Solids")}disableContext(){super.disableContext(),this.viewer.raycaster.filters.geomFilter=[qp]}_getMaxObjSelected(){return 2}_getPoints(){this.point1=new vi(...this.responseData.point1),this.point2=new vi(...this.responseData.point2)}_makeLines(){this._getPoints();const t=new sm(this.coneLength,this.point1,this.panelCenter,1.5,this.connectingLineColor,!1,!1),e=new sm(this.coneLength,this.point2,this.panelCenter,1.5,this.connectingLineColor,!1,!1);this.scene.add(t),this.scene.add(e),this.middlePoint=(new vi).addVectors(this.point1,this.point2).multiplyScalar(.5)}handleResponse(t){super.handleResponse(t);const e={angle:t.angle,point1:new vi(...t.point1),point2:new vi(...t.point2)};this.responseData=e}}const cm="None",hm="DistanceMeasurement",dm="PropertiesMeasurement",um="AngleMeasurement";class pm{constructor(t){this.viewer=t,this.distanceMeasurement=new am(t),this.propertiesMeasurement=new om(t),this.angleMeasurement=new lm(t),this.enabledTool=null}enable(t){switch(this.disable(),t){case hm:this.distanceMeasurement.enableContext();break;case dm:this.propertiesMeasurement.enableContext();break;case um:this.angleMeasurement.enableContext();break;default:throw new Error(`Unknown tool type: ${t}`)}this.enabledTool=t}disable(){this.enabledTool&&(this.viewer.display.shapeFilterDropDownMenu.reset(),this._disable())}_disable(){if(this.enabledTool){switch(this.enabledTool){case hm:this.distanceMeasurement.disableContext();break;case dm:this.propertiesMeasurement.disableContext();break;case um:this.angleMeasurement.disableContext();break;default:throw new Error(`Unknown tool type: ${this.enabledTool}`)}this.enabledTool=null}}handleRemoveLastSelection(t=!1){this.distanceMeasurement.contextEnabled?this.distanceMeasurement.removeLastSelectedObj(t):this.propertiesMeasurement.contextEnabled?this.propertiesMeasurement.removeLastSelectedObj(t):this.angleMeasurement.contextEnabled&&this.angleMeasurement.removeLastSelectedObj(t)}handleSelectedObj(t){this.distanceMeasurement.contextEnabled?this.distanceMeasurement.handleSelection(t):this.propertiesMeasurement.contextEnabled?this.propertiesMeasurement.handleSelection(t):this.angleMeasurement.contextEnabled&&this.angleMeasurement.handleSelection(t)}handleRemoveLastSelected(){this.distanceMeasurement.contextEnabled?this.distanceMeasurement.removeLastSelectedObj():this.propertiesMeasurement.contextEnabled?this.propertiesMeasurement.removeLastSelectedObj():this.angleMeasurement.contextEnabled&&this.angleMeasurement.removeLastSelectedObj()}handleResetSelection(){this.distanceMeasurement.contextEnabled?(this.distanceMeasurement.removeLastSelectedObj(!0),this.distanceMeasurement.removeLastSelectedObj(!0)):this.propertiesMeasurement.contextEnabled?this.propertiesMeasurement.removeLastSelectedObj(!0):this.angleMeasurement.contextEnabled&&(this.angleMeasurement.removeLastSelectedObj(!0),this.angleMeasurement.removeLastSelectedObj(!0))}handleResponse(t){console.log(t);switch(t.tool_type){case hm:this.distanceMeasurement.handleResponse(t);break;case dm:this.propertiesMeasurement.handleResponse(t);break;case um:this.angleMeasurement.handleResponse(t)}}update(){this.distanceMeasurement.contextEnabled?this.distanceMeasurement.update():this.propertiesMeasurement.contextEnabled?this.propertiesMeasurement.update():this.angleMeasurement.contextEnabled&&this.angleMeasurement.update()}dispose(){this.distanceMeasurement.dispose(),this.angleMeasurement.dispose(),this.propertiesMeasurement.dispose()}}function mm(t){return`${t}px`}const fm=["plane","play","pause","stop"];class gm extends Ep{toJSON(){return dc.prototype.toJSON.call(this)}}const vm=new vi,_m=new vi,ym=new Ge;class xm extends xa{constructor(t,e=1,i=16711680){const n=new hs,s=t.geometry.attributes.normal.count,r=new is(2*s*3,3);n.setAttribute("position",r),super(n,new la({color:i,toneMapped:!1})),this.object=t,this.size=e,this.type="VertexNormalsHelper",this.matrixAutoUpdate=!1,this.isVertexNormalsHelper=!0,this.update()}update(){this.object.updateMatrixWorld(!0),ym.getNormalMatrix(this.object.matrixWorld);const t=this.object.matrixWorld,e=this.geometry.attributes.position,i=this.object.geometry;if(i){const n=i.attributes.position,s=i.attributes.normal;let r=0;for(let i=0,a=n.count;i<a;i++)vm.fromBufferAttribute(n,i).applyMatrix4(t),_m.fromBufferAttribute(s,i),_m.applyMatrix3(ym).normalize().multiplyScalar(this.size).add(vm),e.setXYZ(r,vm.x,vm.y,vm.z),r+=1,e.setXYZ(r,_m.x,_m.y,_m.z),r+=1}e.needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}class wm extends xi{expandByObject(t,e=!1){if(t.updateWorldMatrix(!1,!1),"ObjectGroup"==t.constructor.name)return this.expandByObject(t.children[0],e),this;const i=t.geometry;if(void 0!==i)if(e&&null!=i.attributes&&void 0!==i.attributes.position)if(t.type.startsWith("LineSegment")){var n=i.clone();n.applyMatrix4(t.matrixWorld),n.boundingBox=null,n.computeBoundingBox(),Sm.copy(n.boundingBox),this.union(Sm)}else{const e=i.attributes.position;for(let i=0,n=e.count;i<n;i++)Mm.fromBufferAttribute(e,i).applyMatrix4(t.matrixWorld),this.expandByPoint(Mm)}else null===i.boundingBox&&i.computeBoundingBox(),Sm.copy(i.boundingBox),Sm.applyMatrix4(t.matrixWorld),this.union(Sm);const s=t.children;for(let t=0,i=s.length;t<i;t++)"PlaneMeshes"==s[t].name&&s[t].children&&s[t].children.length>0&&s[t].children[0].type.startsWith("StencilPlane")||this.expandByObject(s[t],e);return this}max_dist_from_center(){return Math.max(...this.min.toArray().concat(this.max.toArray()).map((t=>Math.abs(t))))}boundingSphere(){return this.getBoundingSphere(Em),Em}center(){return this.getCenter(Mm),Mm.toArray()}}class bm extends xa{constructor(t,e=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),s=new hs;s.setIndex(new Qn(i,1)),s.setAttribute("position",new Qn(n,3)),super(s,new la({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(void 0!==this.object&&Tm.setFromObject(this.object,!0),Tm.isEmpty())return;const t=Tm.min,e=Tm.max,i=this.geometry.attributes.position,n=i.array;n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=t.x,n[4]=e.y,n[5]=e.z,n[6]=t.x,n[7]=t.y,n[8]=e.z,n[9]=e.x,n[10]=t.y,n[11]=e.z,n[12]=e.x,n[13]=e.y,n[14]=t.z,n[15]=t.x,n[16]=e.y,n[17]=t.z,n[18]=t.x,n[19]=t.y,n[20]=t.z,n[21]=e.x,n[22]=t.y,n[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}dispose(){fp(this.geometry),this.geometry=null}}const Mm=new vi,Sm=new wm,Tm=new wm,Em=new Bi;class Am extends Fs{constructor(t,e,i,n,s,r){super(),this.opacity=t,this.alpha=null==e?1:e,this.edge_color=i,this.shapeInfo=n,this.subtype=s,this.renderback=r,this.types={front:null,back:null,edges:null,vertices:null},this.isSelected=!1,this.originalColor=null,this.originalBackColor=null,this.originalWidth=null,this.vertexFocusSize=8,this.edgeFocusWidth=5}dispose(){for(var t in this.types.front||this.types.back?this.types.front.dispose():this.types.edges?this.types.edges.dispose():this.type.vertices&&this.types.vertices.dispose(),this.shapeGeometry&&(fp(this.shapeGeometry),this.shapeGeometry=null),[0,1,2]){var e=this.types[`clipping-${t}`];if(e)for(var i in e.children)e.children[i].dispose()}if(this.children)for(var t in this.children)this.children[t]instanceof Aa?fp(this.children[t]):this.children[t].dispose();this.parent=null}addType(t,e){this.add(t),this.types[e]=t,this.types.vertices?(this.originalColor=this.types.vertices.material.color.clone(),this.originalWidth=this.types.vertices.material.size):this.types.edges&&!this.types.front?(this.originalColor=this.types.edges.material.color.clone(),this.originalWidth=this.types.edges.material.linewidth):this.types.front?this.originalColor=this.types.front.material.color.clone():this.types.back&&(this.originalBackColor=this.types.back.material.color.clone())}widen(t){this.types.vertices?this.types.vertices.material.size=t?this.vertexFocusSize:this.isSelected?this.vertexFocusSize-2:this.originalWidth:this.types.edges&&(this.types.edges.material.linewidth=t?this.edgeFocusWidth:this.isSelected?this.edgeFocusWidth-2:this.originalWidth)}toggleSelection(){const t=!this.isSelected;this.isSelected=t,this.highlight(t),this.widen(!1)}unhighlight(t){t&&this.isSelected||(this.isSelected=!1,this.highlight(!1)),this.widen(!1)}highlight(t){var e=null,i=null,n=null;this.types.front?(e=this.types.front,i=this.isSelected?new zn(5480675):new zn(9026019),n=this.originalColor):this.types.vertices?(e=this.types.vertices,i=this.isSelected?new zn(5480675):new zn(9026019),n=this.originalColor):this.types.edges&&(e=this.types.edges,i=this.isSelected?new zn(5480675):new zn(9026019),n=this.originalColor),null!=e&&(this.widen(t),e.material.color=t?i:n,e.material.needsUpdate=!0),this.types.back&&(e=this.types.back,i=this.isSelected?new zn(5480675):new zn(9026019),n=this.originalBackColor),null!=e&&(e.material.color=t?i:n,e.material.needsUpdate=!0)}clearHighlights(){this.highlight(!1),this.isSelected=!1,this.widen(!1)}metrics(){return this.types.front?{name:"face",value:0}:this.types.vertices?{name:"vertex",value:0}:this.types.edges?{name:"edge",value:0}:void 0}setMetalness(t){for(var e of this.children)e.name.startsWith("clipping")||(e.material.metalness=t,e.material.needsUpdate=!0)}setRoughness(t){for(var e of this.children)e.name.startsWith("clipping")||(e.material.roughness=t,e.material.needsUpdate=!0)}setTransparent(t){for(var e of(this.types.back&&(this.types.back.material.opacity=t?this.opacity*this.alpha:this.alpha,this.types.front.material.opacity=t?this.opacity*this.alpha:this.alpha),this.children))e.name.startsWith("clipping")||(e.material.depthWrite=!(this.alpha<1)&&!t,e.material.depthTest=!0,e.material.needsUpdate=!0)}setBlackEdges(t){if(this.types.edges){const e=t?0:this.edge_color;this.originalColor=new zn(e),this.types.edges.material.color=new zn(e),this.types.edges.material.needsUpdate=!0}}setEdgeColor(t){this.types.edges&&(this.edge_color=t,this.types.edges.material.color=new zn(t),this.types.edges.material.needsUpdate=!0)}setOpacity(t){(this.types.front||this.types.back)&&(this.opacity=t,this.types.back.material.opacity=this.opacity,this.types.front.material.opacity=this.opacity,this.types.back.material.needsUpdate=!0,this.types.front.material.needsUpdate=!0)}setShapeVisible(t){for(var e of(this.types.front&&(this.types.front.material.visible=t),["clipping-0","clipping-1","clipping-2"]))this.types[e]&&(this.types[e].children[0].material.visible=t,this.types[e].children[1].material.visible=t);this.types.back&&this.renderback&&(this.types.back.material.visible=t)}setEdgesVisible(t){this.types.edges&&(this.types.edges.material.visible=t),this.types.vertices&&(this.types.vertices.material.visible=t)}setBackVisible(t){this.types.back&&this.types.front.material.visible&&(this.types.back.material.visible=this.renderback||t)}setClipIntersection(t){for(var e of this.children)e.name.startsWith("clipping")||(e.material.clipIntersection=t,e.material.clipIntersection=t,e.material.clipIntersection=t)}setClipPlanes(t){this.types.back&&(this.types.back.material.clippingPlanes=t),this.types.front&&(this.types.front.material.clippingPlanes=t),this.types.edges&&(this.types.edges.material.clippingPlanes=t),this.types.vertices&&(this.types.vertices.material.clippingPlanes=t),this.updateMaterials(!0)}setPolygonOffset(t){this.types.back&&(this.types.back.material.polygonOffsetUnits=t)}updateMaterials(t){this.types.back&&(this.types.back.material.needsUpdate=t),this.types.front&&(this.types.front.material.needsUpdate=t),this.types.edges&&(this.types.edges.material.needsUpdate=t),this.types.vertices&&(this.types.vertices.material.needsUpdate=t)}}class Cm extends Fs{constructor(){super()}dispose(){for(var t in this.children)this.children[t]&&this.children[t].dispose(),this.children[t]instanceof dh&&(fp(this.children[t].geometry),this.children[t].dispose(),this.children[t]=null);this.parent=null}}class Lm{constructor(t,e,i,n,s,r,a,o,l,c){this.shapes=t,this.width=e,this.height=i,this.edgeColor=n,this.transparent=s,this.metalness=a,this.roughness=o,this.defaultOpacity=r,this.normalLen=l,this.blackEdges=!1,this.backVisible=!1,this.bb_max=c,this.delim="|",this.rootGroup=null,this.bbox=null,this.bsphere=null,this.groups={},this.clipPlanes=null}dispose(){if(this.groups){for(var t in this.groups)this.groups[t].dispose();this.groups=null}this.rootGroup&&(this.rootGroup.dispose(),this.rootGroup=null),this.shapes&&(gp(this.shapes),this.shapes=null)}_dump(t){if(null==t&&(t=""),this.parts)for(var e of this.parts)this._dump(e,t+" ")}_renderEdges(t,e,i,n){var s=t instanceof Float32Array?t:new Float32Array(up(t,3));const r=new gm;r.setPositions(s);const a=new Ap({linewidth:e,transparent:!0,depthWrite:!this.transparent,depthTest:!this.transparent,clipIntersection:!1});if(Array.isArray(i)){var o=i.map((t=>[new zn(t).toArray(),new zn(t).toArray()])).flat(2);r.setColors(o),a.vertexColors="VertexColors"}else a.color=new zn(null==i?this.edgeColor:i);a.visible=1==n,a.resolution.set(this.width,this.height);var l=new jp(r,a);return l.renderOrder=999,l}renderEdges(t,e,i,n,s,r,a=null){var o=new Am(this.defaultOpacity,1,null==i?this.edgeColor:i,a,"edges"),l=this._renderEdges(t.edges?t.edges:up(t),e,i,r);return s&&(l.name=s),o.addType(l,"edges"),this.groups[n]=o,o.name=n.replaceAll("/",this.delim),o}renderVertices(t,e,i,n,s,r,a=null){var o=new Am(this.defaultOpacity,1,null==i?this.edgeColor:i,a,"vertices");const l=null==i?this.edgeColor:i;let c;c=t.obj_vertices?t.obj_vertices instanceof Float32Array?t.obj_vertices:new Float32Array(t.obj_vertices):t instanceof Float32Array?t:new Float32Array(up(t));const h=new hs;h.setAttribute("position",new is(c,3));const d=new ba({color:l,sizeAttenuation:!1,size:e,transparent:!0,clipIntersection:!1,visible:1==r});var u=new Aa(h,d);return s&&(u.name=s),o.addType(u,"vertices"),this.groups[n]=o,o.name=n.replaceAll("/",this.delim),o}renderShape(t,e,i,n,s,r,a,o,l=null,c=null,h=null,d=null,u=null){const p=t.vertices instanceof Float32Array?t.vertices:new Float32Array(up(t.vertices)),m=t.normals instanceof Float32Array?t.normals:new Float32Array(up(t.normals)),f=t.triangles instanceof Uint32Array?t.triangles:new Uint32Array(up(t.triangles));var g,v=new Am(this.defaultOpacity,i,this.edgeColor,l,c,n);this.groups[r]=v,v.name=r.replaceAll("/",this.delim),null==i?i=1:i<1&&(this.transparent=!0);var _=null,y=null;if(null!=h){const t=`data:image/${h.format};base64,${h.data}`;var x=new Image;x.setAttribute("src",t),g=new qo(d,u),(_=new hi(x)).needsUpdate=!0,_.colorSpace=ce,y=new jn({color:"#ffffff",map:_,side:2}),n=!1}else(g=new hs).setAttribute("position",new Qn(p,3)),g.setAttribute("normal",new Qn(m,3)),g.setIndex(new Qn(f,1)),v.shapeGeometry=g,y=new rl({color:e,metalness:this.metalness,roughness:this.roughness,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,transparent:!0,opacity:this.transparent?this.defaultOpacity*i:i,depthWrite:!this.transparent,depthTest:!0,clipIntersection:!1,side:0,visible:1==o[0],map:_,name:"frontMaterial"});const w="solid"!==v.subtype||s?new zn(this.edgeColor).lerp(new zn(1,1,1),.15):e,b=new jn({color:w,side:1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,transparent:!0,opacity:this.transparent?this.defaultOpacity*i:i,depthWrite:!this.transparent,depthTest:!0,clipIntersection:!1,visible:1==o[0]&&(n||this.backVisible),name:"backMaterial"}),M=new bs(g,b);M.name=a;const S=new bs(g,y);if(S.name=a,i<1&&(M.renderOrder=999,S.renderOrder=999),v.addType(M,"back"),v.addType(S,"front"),this.normalLen>0){const t=new xm(S,this.normalLen,16711935);v.add(t)}const T=t.edges;if(T.length>0){var E=this._renderEdges(T,1,null,o[1]);E.name=a,v.addType(E,"edges")}return v}renderLoop(t){const e=(t,e,i,n)=>{var s;switch(t.type){case"edges":s=this.renderEdges(t.shape,t.width,t.color,t.id,t.name,t.state[1],{topo:"edge",geomtype:t.geomtype});break;case"vertices":s=this.renderVertices(t.shape,t.size,t.color,t.id,t.name,t.state[1],{topo:"vertex",geomtype:null});break;default:s=this.renderShape(t.shape,t.color,t.alpha,null!=t.renderback&&t.renderback,t.exploded,t.id,t.name,t.state,{topo:"face",geomtype:t.geomtype},t.subtype,e,i,n)}return null!=t.loc&&(s.position.set(...t.loc[0]),s.quaternion.set(...t.loc[1])),s};var i=new Cm;for(var n of(null==t.loc&&(t.loc=[[0,0,0],[0,0,0,1]]),i.position.set(...t.loc[0]),i.quaternion.set(...t.loc[1]),this.groups[t.id]=i,i.name=t.id.replaceAll("/","|"),t.parts))if(n.parts)i.add(this.renderLoop(n));else{const t=null!=n.texture;const s=e(n,t?n.texture.image:null,t?n.texture.width:null,t?n.texture.height:null);this.groups[n.id]=s,i.add(s)}return i}render(){return this.rootGroup=this.renderLoop(this.shapes),this.rootGroup}boundingBox(){return null==this.bbox&&(this.bbox=new wm,this.bbox.setFromObject(this.rootGroup,!0)),this.bbox}_traverse(t,e){for(var i in this.groups){var n=this.groups[i];n instanceof Am&&n[t](e)}}selection(){var t=[];for(var e in this.groups)for(var i of this.groups[e].children)i instanceof Am&&i.isSelected&&t.push(i);return t}clearSelection(){for(var t of this.selection())t.clearHighlights()}setMetalness(t){this.metalness=t,this._traverse("setMetalness",t)}setRoughness(t){this.roughness=t,this._traverse("setRoughness",t)}setTransparent(t){this.transparent=t,this._traverse("setTransparent",t)}setBlackEdges(t){this.blackEdges=t,this._traverse("setBlackEdges",t)}setBackVisible(t){this.backVisible=t,this._traverse("setBackVisible",t)}setEdgeColor(t){this.edge_color=t,this._traverse("setEdgeColor",t)}setOpacity(t){this.opacity=t,this._traverse("setOpacity",t)}setClipIntersection(t){this._traverse("setClipIntersection",t)}setClipPlanes(t){this.clipPlanes=t,this._traverse("setClipPlanes",t)}setPolygonOffset(t){this._traverse("setPolygonOffset",t)}updateMaterials(){this._traverse("updateMaterials",!0)}}class km{constructor(t){this.isFont=!0,this.type="Font",this.data=t}generateShapes(t,e=100){const i=[],n=function(t,e,i){const n=Array.from(t),s=e/i.resolution,r=(i.boundingBox.yMax-i.boundingBox.yMin+i.underlineThickness)*s,a=[];let o=0,l=0;for(let t=0;t<n.length;t++){const e=n[t];if("\n"===e)o=0,l-=r;else{const t=Rm(e,s,o,l,i);o+=t.offsetX,a.push(t.path)}}return a}(t,e,this.data);for(let t=0,e=n.length;t<e;t++)i.push(...n[t].toShapes());return i}}function Rm(t,e,i,n,s){const r=s.glyphs[t]||s.glyphs["?"];if(!r)return void console.error(`THREE.Font: character "${t}" does not exists in font family ${s.familyName}`);const a=new bh;let o,l,c,h,d,u,p,m;if(r.o){const t=r._cachedOutline||(r._cachedOutline=r.o.split(" "));for(let s=0,r=t.length;s<r;){switch(t[s++]){case"m":o=t[s++]*e+i,l=t[s++]*e+n,a.moveTo(o,l);break;case"l":o=t[s++]*e+i,l=t[s++]*e+n,a.lineTo(o,l);break;case"q":c=t[s++]*e+i,h=t[s++]*e+n,d=t[s++]*e+i,u=t[s++]*e+n,a.quadraticCurveTo(d,u,c,h);break;case"b":c=t[s++]*e+i,h=t[s++]*e+n,d=t[s++]*e+i,u=t[s++]*e+n,p=t[s++]*e+i,m=t[s++]*e+n,a.bezierCurveTo(d,u,p,m,c,h)}}}return{offsetX:r.ha*e,path:a}}const Pm={glyphs:{X:{x_min:-.015625,x_max:854.15625,ha:940,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},Y:{x_min:0,x_max:820,ha:886,o:"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},Z:{x_min:0,x_max:779,ha:849,o:"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},0:{x_min:73,x_max:715,ha:792,o:"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},1:{x_min:215.671875,x_max:574,ha:792,o:"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},2:{x_min:59,x_max:731,ha:792,o:"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},3:{x_min:54,x_max:737,ha:792,o:"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},4:{x_min:48,x_max:742.453125,ha:792,o:"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},5:{x_min:54.171875,x_max:738,ha:792,o:"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},6:{x_min:53,x_max:739,ha:792,o:"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},7:{x_min:58.71875,x_max:730.953125,ha:792,o:"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},8:{x_min:55,x_max:736,ha:792,o:"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},9:{x_min:53,x_max:739,ha:792,o:"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},"-":{x_min:8.71875,x_max:350.390625,ha:478,o:"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "}},cssFontWeight:"normal",ascender:1189,underlinePosition:-100,cssFontStyle:"normal",boundingBox:{yMin:-334,xMin:-111,yMax:1189,xMax:1672},resolution:1e3,original_font_information:"see https://github.com/mrdoob/three.js/blob/dev/examples/fonts/helvetiker_regular.typeface.json",descender:-334,familyName:"Helvetiker",lineHeight:1522,underlineThickness:50};class Im{constructor(t,e,i,n,s,r,a,o){void 0===i&&(i=10),this.display=t,this.bbox=e,this.centerGrid=n,this.grid=r,this.allGrid=r[0]|r[1]|r[2];const l=new vi;e.getSize(l);const c=Math.max(l.x,l.y,l.z);this.gridHelper=[];var[h,d,u]=this.niceBounds(1.05*-c,1.05*c,2*i);this.size=d-h;const p=new km(Pm);this.ticks=u;for(var m=0;m<3;m++){var f=new Cm;f.name=`GridHelper-${m}`,f.add(new dh(this.size,this.size/this.ticks,"dark"===o?13421772:7829367,"dark"==o?10066329:12303291));const t=new la({color:"dark"===o?new zn(.5,.5,.5):new zn(.4,.4,.4),side:2});for(var g,v,_=-this.size/2;_<=this.size/2;_+=this.ticks){v=this.createNumber(_,p),0==m?(v.rotateX(-Math.PI/2),v.rotateY(Math.PI/2)):(v.rotateX(Math.PI/2),v.rotateY(-Math.PI/2));const e=new bs(v,t);if(g=1==m?-1:1,e.position.set(g*_,0,0),f.add(e),Math.abs(_)<1e-6)continue;v=this.createNumber(_,p),0==m?v.rotateX(-Math.PI/2):1==m?(v.rotateX(-Math.PI/2),v.rotateZ(Math.PI)):v.rotateX(Math.PI/2);const i=new bs(v,t);g=0==m?-1:1,i.position.set(0,0,g*_),f.add(i)}this.gridHelper.push(f)}this.gridHelper[0].rotateX(Math.PI/2),this.gridHelper[1].rotateY(Math.PI/2),this.gridHelper[2].rotateZ(Math.PI/2),this.setCenter(s,a),this.setVisible()}createNumber(t,e){const i=(.035-7.1)/-637.8*(this.size-640)+7.1,n=e.generateShapes(t.toFixed(1),i);var s=new Zo(n);s.computeBoundingBox();var r=-.5*(s.boundingBox.max.x-s.boundingBox.min.x),a=-.5*(s.boundingBox.max.y-s.boundingBox.min.y);return s.translate(r,a,0),s}niceNumber(t,e){var i=Math.floor(Math.log10(t)),n=t/10**i;return(e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10)*10**i}niceBounds(t,e,i){var n,s;i||(i=10);var r=e-t;return 0==r?n=0:(s=this.niceNumber(r),n=this.niceNumber(s/(i-1),!0),t=Math.floor(t/n)*n,e=Math.ceil(e/n)*n),[t,e,n]}computeGrid(){this.allGrid=this.grid[0]|this.grid[1]|this.grid[2],this.display.toolbarButtons.grid.set(this.allGrid),this.display.checkElement("tcv_grid-xy",this.grid[0]),this.display.checkElement("tcv_grid-xz",this.grid[1]),this.display.checkElement("tcv_grid-yz",this.grid[2]),this.setVisible()}setGrid(t,e=null){switch(t){case"grid":this.allGrid=null==e?!this.allGrid:e,this.grid[0]=this.allGrid,this.grid[1]=this.allGrid,this.grid[2]=this.allGrid;break;case"grid-xy":this.grid[0]=!this.grid[0];break;case"grid-xz":this.grid[1]=!this.grid[1];break;case"grid-yz":this.grid[2]=!this.grid[2]}this.computeGrid()}setGrids(t,e,i){this.grid[0]=t,this.grid[1]=e,this.grid[2]=i,this.computeGrid()}setCenter(t,e){if(t){for(var i=0;i<3;i++)this.gridHelper[i].position.set(0,0,0);this.gridHelper[0].position.z=this.centerGrid?0:-this.size/2,this.gridHelper[1].position.y=this.centerGrid?0:(e?1:-1)*this.size/2,this.gridHelper[2].position.x=this.centerGrid?0:-this.size/2}else{const t=this.bbox.center();for(i=0;i<3;i++)this.gridHelper[i].position.set(...t);this.gridHelper[0].position.z=this.centerGrid?t[2]:-this.size/2+t[2],this.gridHelper[1].position.y=this.centerGrid?t[1]:(e?1:-1)*this.size/2+t[1],this.gridHelper[2].position.x=this.centerGrid?t[0]:-this.size/2+t[0]}}setVisible(){for(var t=0;t<3;t++)this.gridHelper[t].visible=this.grid[t]}dispose(){for(var t=0;t<3;t++)this.gridHelper[t].dispose(),this.gridHelper[t]=null}}class Um extends jp{constructor(t,e,i,n,s,r,a,o){const l=new Float32Array([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e]),c="dark"===o?[1,69/255,0,1,69/255,0,50/255,205/255,50/255,50/255,205/255,50/255,59/255,158/255,1,59/255,158/255,1]:[1,0,0,1,0,0,0,.7,0,0,.7,0,0,0,1,0,0,1],h=new gm;h.setPositions(l),h.setColors(new Float32Array(c));const d=new Ap({vertexColors:!0,toneMapped:!1,linewidth:i,transparent:!0});d.resolution.set(n,s),super(h,d),this.center=t,this.type="AxesHelper",this.name="AxesHelper",this.visible=a,this.setCenter(r)}dispose(){this.geometry.dispose(),this.material.dispose()}setCenter(t){t?this.position.set(0,0,0):this.position.set(...this.center)}setVisible(t){this.visible=t}}class Dm{constructor(t,e,i,n){this.width=t,this.height=e,this.cad_camera=i,this.theme=n,this.camera=null,this.scene=null,this.renderer=null,this.labels=[],this.ready=!1}create(){const t=new km(Pm),e=2.5;this.scene=new js,this.camera=new ic(-this.width,this.width,this.height,-this.height,1,1e3),this.camera.up=this.cad_camera.up,this.camera.lookAt(new vi(0,0,0));const i=new Um([0,0,0],54,e,this.width,this.height,!0,!0,this.theme);this.scene.add(i);const n="dark"===this.theme?[[1,69/255,0],[50/255,205/255,50/255],[59/255,158/255,1]]:[[1,0,0],[0,.5,0],[0,0,1]];this.cones=[];for(var s=0;s<3;s++){var r=new no(0,6.25,12.5,20,1);const t=new jn({color:new zn(...n[s]),toneMapped:!1}),e=new bs(r,t);e.matrixAutoUpdate=!1,this.cones.push(e)}this.cones[0].geometry.rotateZ(-Math.PI/2),this.cones[0].geometry.translate(54,0,0),this.cones[1].geometry.translate(0,54,0),this.cones[2].geometry.rotateX(Math.PI/2),this.cones[2].geometry.translate(0,0,54),this.scene.add(...this.cones);const a=["X","Y","Z"];for(s=0;s<3;s++){const e=new la({color:"dark"===this.theme?new zn(.9,.9,.9):new zn(0,0,0),side:2}),i=t.generateShapes(a[s],16),n=new Zo(i);n.computeBoundingBox();const r=-.5*(n.boundingBox.max.x-n.boundingBox.min.x),o=-.5*(n.boundingBox.max.y-n.boundingBox.min.y);n.translate(r,o,0);const l=new bs(n,e);this.scene.add(l),this.labels.push(l)}const o=new Yo(7.5,20,20),l=new jn({color:10526880}),c=new bs(o,l);this.scene.add(c),this.scene.background=null,this.ready=!0}setVisible(t){for(var e of this.scene.children)e.visible=t}dispose(){mp(this.scene,(t=>{t.geometry?.dispose(),t.material?.dispose()})),this.scene=null,this.camera=null,this.cad_camera=null,this.cones=null,this.labels=null}render(t){this.ready&&(t.setViewport(0,0,this.width,this.height),t.render(this.scene,this.camera))}update(t,e){if(this.ready){let n=(new gi).setFromUnitVectors(new vi(0,0,1),t.normalize());this.camera.position.set(0,0,1).applyQuaternion(n).multiplyScalar(300),this.camera.quaternion.copy(e);for(var i=0;i<3;i++)this.labels[i].position.set(0==i?72:0,1==i?72:0,2==i?72:0),this.labels[i].quaternion.copy(e)}}}class Nm{constructor(t,e){this.prefix=t,this.timeit=e,this.start=performance.now(),this.last=this.start,e&&console.info(`three-cad-viewer: ${t}:timer start`)}split(t){if(this.timeit){const e=performance.now();console.info(`three-cad-viewer: ${this.prefix}:${t}:timer split ${(e-this.last).toFixed(1)} ms`),this.last=e}}stop(){if(this.timeit){const t=performance.now();console.info(`three-cad-viewer: ${this.prefix}:timer stop ${(t-this.start).toFixed(1)} ms:`)}}}const Om=0,Bm=1,Fm=2,zm=3;var Hm=0;class Vm{constructor(t,e,i,n,s,r,a,o,l=!1){this.viewIcons=[[hp(a,"shape_no"),hp(a,"shape"),hp(a,"shape_mix"),hp(a,"shape_empty")],[hp(a,"mesh_no"),hp(a,"mesh"),hp(a,"mesh_mix"),hp(a,"mesh_empty")]],this.navIcons={right:hp(a,"nav_closed"),down:hp(a,"nav_open")},this.tree=t,this.offset=12,this.scrollContainer=e,this.objectHandler=i,this.pickHandler=n,this.updateHandler=s,this.notificationHandler=r,this.theme=a,this.linkIcons=o,this.debug=l}create(){return this.maxLevel=0,this.root=this.buildTreeStructure(this.tree),this.container=document.createElement("ul"),this.container.classList.add("tcv_toplevel"),this.scrollContainer.addEventListener("scroll",this.handleScroll),this.lastLabel=null,this.container}buildTreeStructure(t){const e=(t,i,n)=>{var s=[-1,-1];const r={};this.maxLevel<n&&(this.maxLevel=n);var a=[[!1,!1],[!1,!1],[!1,!1],[!1,!1]];for(const s in t){var o="";let l;o=null==i?s:`${i}/${s}`;const c=t[s];if(Array.isArray(c))l=c,a[c[0]][0]=!0,a[c[1]][1]=!0,r[s]={name:s,state:l,path:o,rendered:!1,level:n};else{let t;[t,l]=e(c,o,n+1),a[l[0]][0]=!0,a[l[1]][1]=!0,r[s]={name:s,state:l,path:o,rendered:!1,level:n,children:t,expanded:!1}}}return[r,(t=>{for(let e of[0,1])t[Fm][e]||t[Bm][e]&&t[Om][e]?s[e]=Fm:t[Bm][e]?s[e]=Bm:t[Om][e]?s[e]=Om:t[zm][e]&&(s[e]=zm);return s})(a)]},i=e(t,null,0)[0];return i[Object.keys(i)[0]]}getVisibleElements(){const t=(t,e)=>{const i=t.getBoundingClientRect();return i.height>0&&i.top>=-this.offset&&i.top<=e.bottom+this.offset},e=this.container.querySelectorAll(".tv-tree-node"),i=this.scrollContainer.getBoundingClientRect(),n=Array.from(e).filter((e=>t(e,i)));if(this.debug){Hm++,console.log(`\n${Hm}> visible elements (${n.length}):`);for(let t in n){const e=n[t],i=this.findNodeByPath(e.dataset.path);console.log(i.path,i.state[0],i.state[1]," => ",e.dataset.state0,e.dataset.state1)}}return n}handleScroll=()=>{this.ticking||(window.requestAnimationFrame((()=>{const t=this.scrollContainer.scrollTop;this.lastScrollTop=t,this.debug&&console.log("update => scroll"),this.update(),this.ticking=!1})),this.ticking=!0)};handleNavigationClick=t=>e=>{e.stopPropagation(),t.expanded=!t.expanded,this.showChildContainer(t),this.debug&&console.log("update => navClick"),this.update()};handleIconClick=(t,e)=>i=>{i.stopPropagation(),this.toggleIcon(t,e)};handleLabelClick(t,e){this.pickHandler(this.getNodePath(this.getParent(t)),t.name,_p.get(e,"meta"),_p.get(e,"shift"),this.isLeaf(t)?"leaf":"node",!0),console.log(`Label clicked: ${this.getNodePath(t)}`)}update=(t=null)=>{const e=this.getVisibleElements().filter((e=>null==t||e.dataset.path.startsWith(t)));for(var i of e){const t=i.dataset.path,e=this.findNodeByPath(t);if(null!=e){if(e.rendered||(this.renderNode(e,i),e.rendered=!0),e.expanded){const s=i.querySelector(".tv-children");if(null!=s&&null!=s.children&&0===s.children.length){for(var n in e.children){const t=e.children[n];this.renderPlaceholder(t,s)}this.showChildContainer(e),this.update(t)}}for(let t in[0,1]){i.dataset[`state${t}`]!=e.state[t]&&this.updateIconInDOM(e,t)}this.showChildContainer(e)}else console.error(`Node not found: ${t}`)}};render(){this.container.innerHTML="",this.renderPlaceholder(this.root,this.container),this.debug&&console.log("update => render"),this.update()}renderPlaceholder(t,e,i=null){this.debug&&console.log("renderPlaceholder",t.path,t.level);const n=document.createElement("div");n.className="tv-tree-node",n.dataset.path=this.getNodePath(t),n.dataset.openPath=i,n.dataset.state0=t.state[0],n.dataset.state1=t.state[1];const s=document.createElement("div");s.className="tv-node-content",this.debug&&(s.innerText=t.path),n.appendChild(s),e.appendChild(n)}renderNode(t,e){this.debug&&console.log("renderNode",t.path,t.level);const i=document.createElement("div");i.className="tv-node-content",e.removeChild(e.firstChild),e.appendChild(i);const n=document.createElement("span");for(var s of(n.className="tv-nav-marker",n.innerHTML=t.children?t.expanded?this.navIcons.down:this.navIcons.right:"",n.onclick=this.handleNavigationClick(t),i.dataset.state0=t.state[0],i.dataset.state1=t.state[1],i.appendChild(n),[0,1])){const e=document.createElement("span"),n=t.state[s];var r=`tv-icon tv-icon${s}`;n!==zm&&(r+=" tv-pointer"),e.className=r,e.innerHTML=this.viewIcons[s][n],n!==zm&&(e.onmousedown=t=>{t.preventDefault()},e.onclick=this.handleIconClick(t,s)),i.appendChild(e)}const a=document.createElement("span");a.className="tv-node-label",a.textContent=t.name,a.onmousedown=t=>{t.preventDefault()},a.onclick=e=>{e.stopPropagation(),this.handleLabelClick(t,e)},i.appendChild(a);let o=null;return t.children&&(o=document.createElement("div"),o.className="tv-children",o.style.display="none",e.appendChild(o)),o}getDomNode=t=>this.container.querySelector(`[data-path="${t}"]`);showChildContainer(t){if(null==t.expanded)return;const e=this.getNodePath(t),i=this.getDomNode(e);if(i){const e=i.querySelector(".tv-children");if(e){"none"!==e.style.display!==t.expanded&&(e.style.display=t.expanded?"block":"none",i.querySelector(".tv-nav-marker").innerHTML=t.expanded?this.navIcons.down:this.navIcons.right,t.expanded||(this.debug&&console.log("update => showChildContainer"),this.update()))}}else console.error(`Element not found: ${e}`)}updateIconInDOM(t,e){const i=this.getNodePath(t),n=this.container.querySelector(`[data-path="${i}"]`);if(n){const i=n.querySelector(`.tv-icon${e}`);i&&(i.innerHTML=this.viewIcons[e][t.state[e]]),n.dataset[`state${e}`]=t.state[e]}}toggleLabelColor(t,e=null){const i=null==e?this.getNodePath(t):e,n=this.container.querySelector(`[data-path="${i}"]`);if(this.lastLabel&&this.lastLabel.classList.remove("tv-node-label-highlight"),n){const t=n.querySelector(".tv-node-label");t&&(this.lastLabel===t?this.lastLabel=null:(t.classList.toggle("tv-node-label-highlight"),this.lastLabel=t))}}traverse(t,e){if(e(t),t.children)for(let i of Object.keys(t.children))this.traverse(t.children[i],e)}isLeaf(t){return null==t.children}getNodePath(t){return null==t?"":"/"+t.path}findNodeByPath(t){var e=Array.isArray(t)?t:t.split("/").filter(Boolean);let i=this.root;for(let t=1;t<e.length;t++){const n=e[t];if(!i.children[n])return null;i=i.children[n]}return i}getParent(t){const e=t.path.substring(0,t.path.lastIndexOf("/"));return 0===e.length?null:this.findNodeByPath(e)}updateObject=(t,e)=>{var i=0==e&&this.linkIcons?[0,1]:[e];for(var n of i)this.objectHandler(this.getNodePath(t),t.state[n],n,!0,!1)};toggleIcon(t,e,i=null){const n=t.state[e];if(n!==zm){var s=0==e?this.linkIcons?[0,1]:[0]:[1];for(var r of s)3!=t.state[r]&&(t.state[r]=null!=i?i?1:0:n===Bm?Om:Bm),this.updateObject(t,e),this.updateParentStates(t,r),this.updateChildrenStates(t,r),this.update(null,r);this.updateHandler(!0),this.notificationHandler()}}hideAll(){this.toggleIcon(this.root,0,!1),this.linkIcons||this.toggleIcon(this.root,1,!1)}showAll(){this.toggleIcon(this.root,0,!0),this.linkIcons||this.toggleIcon(this.root,1,!0)}show(t){const e=this.findNodeByPath(t);e&&this.toggleIcon(e,0,!0)}getState(t){const e=this.findNodeByPath(t);return e?e.state:null}getStates(){const t={};return this.traverse(this.root,(e=>{this.isLeaf(e)&&(t[this.getNodePath(e)]=e.state)})),t}setState(t,e){const i=this.findNodeByPath(t);i&&(this.toggleIcon(i,0,e[0]),this.toggleIcon(i,1,e[1]))}setStates(t){for(var e in t)this.setState(e,t[e]);this.update()}hide(t){const e=this.findNodeByPath(t);e&&this.toggleIcon(e,0,!1)}updateParentStates(t,e){let i=this.getParent(t);for(;i;){const t=Object.values(i.children),n=t.every((t=>t.state[e]===Bm||t.state[e]===zm)),s=t.every((t=>t.state[e]===Om||t.state[e]===zm)),r=n?Bm:s?Om:Fm;i.state[e]!==r&&i.state[e]!==zm&&(i.state[e]=r,this.updateObject(i,e)),i=this.getParent(i)}}updateChildrenStates(t,e){const i=t.state[e],n=t=>{if(t.state[e]!==i&&t.state[e]!==zm&&(t.state[e]=i,this.updateObject(t,e)),t.children)for(var s in t.children)n(t.children[s])};n(t)}scrollCentered(t){if(null!=t){let e=this.scrollContainer;const i=t.offsetHeight,n=e.clientHeight,s=t.offsetTop-e.offsetTop-n/2+i/2,r=e.scrollHeight-n,a=Math.max(0,Math.min(s,r));e.scrollTo({top:a,behavior:"smooth"})}}openPath(t){const e=t.split("/").filter(Boolean);var i,n="";let s;for(var r of e){if(n+="/"+r,i=this.findNodeByPath(n),s=this.getDomNode(n),!i){console.error(`Path not found: ${n}`);break}i.expanded=!0,this.showChildContainer(i),this.debug&&console.log("update => openPath"),this.update()}this.scrollCentered(s),this.toggleLabelColor(i)}closePath(t){const e=this.findNodeByPath(t);if(e){e.expanded=!1,this.showChildContainer(e);const i=this.getDomNode(t);if(null!=i){const t=this.scrollContainer;t.scrollTop=i.offsetTop-t.offsetTop}this.debug&&console.log("update => collapsePath"),this.update()}else console.error(`Path not found: ${t}`)}openLevel(t){this.traverse(this.root,(e=>{this.isLeaf(e)||(e.expanded=-1==t?null!=e.children&&!(1==Object.keys(e.children).length&&this.isLeaf(Object.values(e.children)[0])):e.level<t)}));const e=this.getDomNode(this.getNodePath(this.root));if(null!=e){const t=this.scrollContainer;t.scrollTop=e.offsetTop-t.offsetTop}for(var i=0;i<=(-1==t?this.maxLevel:t);i++)this.debug&&console.log("update => openLevel"),this.update()}collapseAll(){this.openLevel(0)}expandAll(){this.openLevel(this.maxLevel)}dispose(){this.viewIcons=null,this.root=null,this.tree=null,this.navIcons=null,this.scrollContainer.removeEventListener("scroll",this.handleScroll)}}const Gm=[new vi(-1,0,0),new vi(0,-1,0),new vi(0,0,-1)],jm={light:[16711680,65280,255],dark:[16729344,3329330,3907327]},Wm=new jn({opacity:.1,transparent:!0,depthWrite:!1,toneMapped:!1,side:2}),qm=new jn({depthWrite:!1,depthTest:!1,colorWrite:!1,side:1,stencilWrite:!0,stencilFunc:ve,stencilFail:fe,stencilZFail:fe,stencilZPass:fe}),Xm=new jn({depthWrite:!1,depthTest:!1,colorWrite:!1,side:0,stencilWrite:!0,stencilFunc:ve,stencilFail:ge,stencilZFail:ge,stencilZPass:ge}),Zm=new rl({metalness:.3,roughness:.65,opacity:1,transparent:!1,side:2,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,stencilWrite:!0,stencilRef:0,stencilFunc:517,stencilFail:me,stencilZFail:me,stencilZPass:me});class Ym extends zr{constructor(t,e,i){super(t,e),this.center=i,this.setConstant(e)}setConstant(t){this.centeredConstant=t;const e=this.distanceToPoint(new vi(...this.center)),i=this.distanceToPoint(new vi(0,0,0));this.constant=i-e+t}}class Jm extends bs{static matrix=new Xi;constructor(t,e,i,n,s,r,a){const o=new qo(2,2);o.computeBoundingSphere(),s.color.set(new zn(r)),super(o,s),this.type=a,this.index=t,this.plane=e,this.size=n,this.center=i}onAfterRender=t=>{this.type.startsWith("StencilPlane")&&t.clearStencil()};updateMatrixWorld(t){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),Jm.matrix.lookAt(this.position,this.plane.normal,this.up),this.quaternion.setFromRotationMatrix(Jm.matrix),this.translateZ(this.plane.constant),super.updateMatrixWorld(this,t)}}function $m(t,e,i,n){e.clippingPlanes=[n];var s=new bs(i,e);return s.name=t,s}class Km{constructor(t,e,i,n,s){var r;for(this.center=t,this.distance=e/2,this.display=n,this.theme=s,this.nestedGroup=i,this.clipPlanes=[],this.reverseClipPlanes=[],this.planeHelpers=new Cm,this.planeHelpers.name="PlaneHelpers",this.planeHelperMaterials=[],this.objectColors=[],this.objectColorCaps=!1,r=0;r<3;r++){const i=new Ym(Gm[r],this.distance,t);this.clipPlanes.push(i);const n=new Ym(Gm[r].clone().negate(),-this.distance,t);this.reverseClipPlanes.push(n),this.display.setNormalLabel(r,Gm[r].toArray());const a=Wm.clone();a.opacity="dark"===s?.2:.1,this.planeHelperMaterials.push(a),this.planeHelpers.add(new Jm(r,i,t,e,a,jm[s][r],"PlaneHelper"))}for(this.planeHelpers.visible=!1,r=0;r<3;r++){const t=this.clipPlanes.filter(((t,e)=>e!==r));this.planeHelpers.children[r].material.clippingPlanes=t}var a=new Cm;for(a.name="PlaneMeshes",r=0;r<3;r++){const n=this.clipPlanes[r],u=this.clipPlanes.filter(((t,e)=>e!==r));var o=0;for(var l in i.groups){var c=new Cm;c.name=`clipping-${r}`;var h=i.groups[l];if(h instanceof Am&&"solid"===h.subtype){this.objectColors.push(h.children[0].material.color.getHex()),c.add($m(`frontStencil-${r}-${o}`,Xm.clone(),h.shapeGeometry,n)),c.add($m(`backStencil-${r}-${o}`,qm.clone(),h.shapeGeometry,n)),h.addType(c,`clipping-${r}`);var d=Zm.clone();d.color.set(new zn(jm[s][r])),d.clippingPlanes=u,a.add(new Jm(r,n,t,e,d,jm[s][r],`StencilPlane-${r}-${o}`)),o++}}}i.rootGroup.add(a)}setConstant(t,e){this.clipPlanes[t].setConstant(e),this.reverseClipPlanes[t].setConstant(-e)}setNormal=(t,e)=>{var i=e.clone();this.clipPlanes[t].normal=i,this.reverseClipPlanes[t].normal=i.clone().negate(),this.setConstant(t,this.distance),this.display.setNormalLabel(t,i.toArray())};getObjectColorCaps=()=>this.objectColorCaps;setObjectColorCaps=t=>{var e;for(e of this.nestedGroup.rootGroup.children)if("PlaneMeshes"===e.name)break;var i=0,n=-1;const s=Object.keys(e.children).length/3;for(var r of e.children)i%s==0&&n++,t?r.material.color.set(new zn(this.objectColors[i])):r.material.color.set(new zn(jm[this.theme][n])),i++;this.objectColorCaps=t};setVisible=t=>{var e;for(e of this.nestedGroup.rootGroup.children)if("PlaneMeshes"===e.name)break;for(var i of e.children)i.material.visible=t};dispose(){for(var t in this.planeHelpers.dispose(),this.planeHelpers=null,this.planeHelperMaterials)this.planeHelperMaterials[t].dispose(),this.planeHelperMaterials[t]=null;this.planeHelperMaterials=null,this.nestedGroup=null,this.clipPlanes=null,this.reverseClipPlanes=null,this.objectColors=null,this.display=null,this.center=null}}const Qm=["t","tx","ty","tz","q","rx","ry","rz"];class tf{constructor(t){this.delim=t,this.tracks=[],this.mixer=null,this.clip=null,this.clipAction=null,this.clock=new bc,this.duration=0,this._backup=[],this.root=null,this.duration=null,this.speed=null,this.repeat=null}addTrack(t,e,i,n,s){var r;if(t=t.replaceAll("/",this.delim),-1!==Qm.indexOf(i))if(n.length==s.length)if(i.startsWith("t")){const a=e.position;switch(i){case"t":r=s.map((t=>a.clone().add(new vi(...t)).toArray()));break;case"tx":r=s.map((t=>a.add(new vi(t,0,0)).toArray()));break;case"ty":r=s.map((t=>a.add(new vi(0,t,0)).toArray()));break;case"tz":r=s.map((t=>a.add(new vi(0,0,t)).toArray()));break;default:return void console.error(`action ${i} is not supported`)}this.tracks.push(new Pl(t+".position",n,r.flat()))}else{const a=e.quaternion;if(i.startsWith("r")){r=s.map((t=>function(t,e){switch(t){case"x":t=new vi(1,0,0);break;case"y":t=new vi(0,1,0);break;case"z":t=new vi(0,0,1)}var i=new gi;return i.setFromAxisAngle(t,e/180*Math.PI),i}(i.slice(1),t))).map((t=>a.clone().multiply(t).toArray()))}else{if("q"!=i)return void console.error(`action ${i} is not supported`);r=s.map((t=>a.clone().multiply(t).toArray()))}this.tracks.push(new kl(t+".quaternion",n,r.flat()))}else console.error("times and values arrays need have the same lenght");else console.error(`Unknown action: "${i}" not in ${Qm}`)}backup(){this._backup={tracks:this.tracks,root:this.root,duration:this.duration,speed:this.speed,repeat:this.repeat}}restore(){return this.tracks=this._backup.tracks,{duration:this._backup.duration,speed:this._backup.speed,repeat:this._backup.repeat}}cleanBackup(){this._backup=[]}hasTracks(){return null!=this.tracks&&this.tracks.length>0}hasBackup(){return null!=this._backup&&Object.keys(this._backup).length>0}animate(t,e,i,n=!0){return this.root=t,this.duration=e,this.speed=i,this.repeat=n,this.clip=new Il("track",e,this.tracks),this.mixer=new Gc(t),this.mixer.timeScale=i,this.clipAction=this.mixer.clipAction(this.clip),this.clipAction.setLoop(n?Kt:Qt),this.clipAction}setRelativeTime(t){this.clipAction.play(),this.clipAction.paused=!0;var e=this.duration*t;this.clipAction.time=e}getRelativeTime(){return this.clipAction.time/this.duration}dispose(){this.mixer=null,this.clipAction=null,this.clip=null,this.tracks=[],this.root=null}update(){this.mixer&&this.mixer.update(this.clock.getDelta())}}class ef{constructor(t,e){this.html=t,this.clear()}clear(){this.html.value="",this.number=0,this.chunks=[]}dispose(){this.clear(),this.html.innerHTML=""}addText(t){this.addHtml(`<pre style="white-space: nowrap;">${t}</pre>`)}addHtml(t){this.chunks.unshift([this.number,t]),this.number+=1,this.render()}render(){var t="<table class='tcv_info_table'>";for(var e of this.chunks)t+="<tr class='tcv_info_row'>",t+=`<td><pre class="tcv_info_num">[${e[0]}]</pre></td>`,t+=`<td>${e[1]}</td>`,t+="</tr>";t+="</table>",this.html.innerHTML=t}versionMsg(t,e){this.addHtml(`<b>Versions</b>\n <table>\n <tr class="tcv_small_table"><td>CadQuery:</td> <td>${t}</td> </tr>\n <tr class="tcv_small_table"><td>Jupyter CadQuery:</td><td>${e}</td> </tr>\n </table>`)}readyMsg(t,e){var i=`<div class="tcv_info_header">Ready</div>\n <table class="small_table">\n <tr class="tcv_small_table_row" ><td>Tick size</td> <td>${t} mm</td> </tr>\n <tr class="tcv_small_table_row" ><td>Control</td><td>${e}</td></tr>\n <tr class="tcv_small_table_row" ><td>Axes</td>\n <td>\n <span class="tcv_info_red"><b>X</b></span>,\n <span class="tcv_info_green"><b>Y</b></span>,\n <span class="tcv_info_blue"><b>Z</b></span>\n </td> \n </tr>\n </table>`;this.addHtml(i)}bbInfo(t,e,i){var n=`\n <table class="tcv_small_table">\n <tr class="tcv_small_table_row">\n <td><b>Path:</b></td>\n <td>${t}</td>\n </tr>\n <tr class="tcv_small_table_row">\n <td><b>Name:</b></td>\n <td>${e}</td>\n </tr>\n </table>\n `;n+='\n <div class="tcv_info_header">Bounding box:</div>\n <table class="tcv_small_table">\n <tr class="tcv_small_table_row">\n <th></th>\n <th>min</th>\n <th>max</th>\n <th>center</th>\n </tr>\n ';var s=new vi;i.getCenter(s),["x","y","z"].forEach((t=>{n+=`\n <tr class="tcv_small_table_row">\n <th>${t}</th>\n <td align='right'>${i.min[t].toFixed(3)}</td>\n <td align='right'>${i.max[t].toFixed(3)}</td>\n <td align='right'>${s[t].toFixed(3)}</td>\n </tr>\n `})),n+="</table>",this.addHtml(n)}centerInfo(t){var e=`<div>Camera target set to AABB center:</div><div class='tcv_info_line'>{ x: ${t[0].toFixed(2)}, y: ${t[1].toFixed(2)}, z: ${t[2].toFixed(2)} }</div>`;this.addHtml(e)}}var nf=function(t,e){void 0===e&&console.warn('THREE.CameraControls: The second parameter "domElement" is now mandatory.'),e===document&&console.error('THREE.CameraControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=t,this.domElement=e,this.enabled=!0,this.target=new vi,this.trackball=!1,this.holroyd=!0,this.radius=.9,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:i.ROTATE,MIDDLE:i.DOLLY,RIGHT:i.PAN},this.touches={ONE:n.ROTATE,TWO:n.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.quaternion0=this.object.quaternion.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return p.phi},this.getAzimuthalAngle=function(){return p.theta},this.saveState=function(){a.target0.copy(a.target),a.position0.copy(a.object.position),a.quaternion0.copy(a.object.quaternion),a.zoom0=a.object.zoom},this.reset=function(){a.target.copy(a.target0),a.object.position.copy(a.position0),a.object.quaternion.copy(a.quaternion0),a.object.zoom=a.zoom0,a.object.updateProjectionMatrix(),a.dispatchEvent(o),a.update(),d=h.NONE},this.update=function(){var e=new vi,i=(new gi).setFromUnitVectors(t.up,new vi(0,1,0)),n=i.clone().invert(),s=new vi,r=new gi,l=new gi,c=new vi;const _=new vi;return function(){var t,y=a.object.position;if(e.copy(y).sub(a.target),a.trackball&&!a.holroyd)m.theta&&(c.set(0,1,0).applyQuaternion(a.object.quaternion),t=a.enableDamping?a.dampingFactor:1,l.setFromAxisAngle(c,m.theta*t),a.object.quaternion.premultiply(l),e.applyQuaternion(l)),m.phi&&(c.set(1,0,0).applyQuaternion(a.object.quaternion),t=a.enableDamping?a.dampingFactor:1,l.setFromAxisAngle(c,m.phi*t),a.object.quaternion.premultiply(l),e.applyQuaternion(l)),e.multiplyScalar(f),e.clampLength(a.minDistance,a.maxDistance);else if(a.trackball&&a.holroyd){_.crossVectors(w,b);var x=Math.atan(_.length()/w.dot(b));x&&(_.normalize(),_.applyQuaternion(a.object.quaternion),x*=-2*(t=a.enableDamping?a.dampingFactor:1),l.setFromAxisAngle(_,x),a.object.quaternion.premultiply(l),e.applyQuaternion(l)),e.multiplyScalar(f),e.clampLength(a.minDistance,a.maxDistance),w.set(0,0,0),b.set(0,0,0)}else e.applyQuaternion(i),a.autoRotate&&d===h.NONE&&P(2*Math.PI/60/60*a.autoRotateSpeed),p.setFromVector3(e),a.enableDamping?(p.theta+=m.theta*a.dampingFactor,p.phi+=m.phi*a.dampingFactor):(p.theta+=m.theta,p.phi+=m.phi),p.theta=Math.max(a.minAzimuthAngle,Math.min(a.maxAzimuthAngle,p.theta)),p.phi=Math.max(a.minPolarAngle,Math.min(a.maxPolarAngle,p.phi)),p.makeSafe(),p.radius*=f,p.radius=Math.max(a.minDistance,Math.min(a.maxDistance,p.radius)),e.setFromSpherical(p),e.applyQuaternion(n);return!0===a.enableDamping?a.target.addScaledVector(g,a.dampingFactor):a.target.add(g),y.copy(a.target).add(e),!1===a.trackball&&a.object.lookAt(a.target),!0===a.enableDamping?(m.theta*=1-a.dampingFactor,m.phi*=1-a.dampingFactor,g.multiplyScalar(1-a.dampingFactor)):(m.set(0,0,0),g.set(0,0,0)),f=1,!!(v||s.distanceToSquared(a.object.position)>u||8*(1-r.dot(a.object.quaternion))>u)&&(a.dispatchEvent(o),s.copy(a.object.position),r.copy(a.object.quaternion),v=!1,!0)}}();const s={x:new vi(1,0,0),y:new vi(0,1,0),z:new vi(0,0,1)};function r(t,e){if(a.trackball){const i=s[t],n=(new gi).setFromAxisAngle(i,e);a.object.quaternion.premultiply(n),a.object.position.sub(a.target).applyQuaternion(n).add(a.target)}else console.log("not supported for orbit controls")}this.rotateX=function(t){r("x",t)},this.rotateY=function(t){r("y",t)},this.rotateZ=function(t){r("z",t)},this.rotateLeft=function(t){this.trackball?console.log("not supported for trackball controls"):P(t)},this.rotateUp=function(t){this.trackball?console.log("not supported for trackball controls"):I(t)},this.dispose=function(){a.domElement.removeEventListener("contextmenu",st,!1),a.domElement.removeEventListener("mousedown",J,!1),a.domElement.removeEventListener("wheel",Q,!1),a.domElement.removeEventListener("touchstart",et,!1),a.domElement.removeEventListener("touchend",nt,!1),a.domElement.removeEventListener("touchmove",it,!1),document.removeEventListener("mousemove",$,!1),document.removeEventListener("mouseup",K,!1),a.domElement.removeEventListener("keydown",tt,!1)};var a=this,o={type:"change"},l={type:"start"},c={type:"end"},h={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},d=h.NONE,u=1e-6,p=new $c,m=new $c,f=1,g=new vi,v=!1,_=new Ve,y=new Ve,x=new Ve,w=new vi,b=new vi,M=new Ve,S=new Ve,T=new Ve,E=new Ve,A=new Ve,C=new Ve,L=!0,k=!0;function R(){return Math.pow(.95,a.zoomSpeed)}function P(t){L&&(m.theta-=t)}function I(t){k&&(m.phi-=t)}var U,D,N=(U=new vi,function(t,e){U.setFromMatrixColumn(e,0),U.multiplyScalar(-t),g.add(U)}),O=function(){var t=new vi;return function(e,i){!0===a.screenSpacePanning?t.setFromMatrixColumn(i,1):(t.setFromMatrixColumn(i,0),t.crossVectors(a.object.up,t)),t.multiplyScalar(e),g.add(t)}}(),B=(D=new vi,function(t,e){var i=a.domElement;if(a.object.isPerspectiveCamera){var n=a.object.position;D.copy(n).sub(a.target);var s=D.length();s*=Math.tan(a.object.fov/2*Math.PI/180),N(2*t*s/i.clientHeight,a.object.matrix),O(2*e*s/i.clientHeight,a.object.matrix)}else a.object.isOrthographicCamera?(N(t*(a.object.right-a.object.left)/a.object.zoom/i.clientWidth,a.object.matrix),O(e*(a.object.top-a.object.bottom)/a.object.zoom/i.clientHeight,a.object.matrix)):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - pan disabled."),a.enablePan=!1)});function F(t){a.object.isPerspectiveCamera?f/=t:a.object.isOrthographicCamera?(a.object.zoom=Math.max(a.minZoom,Math.min(a.maxZoom,a.object.zoom*t)),a.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - dolly/zoom disabled."),a.enableZoom=!1)}function z(t){a.object.isPerspectiveCamera?f*=t:a.object.isOrthographicCamera?(a.object.zoom=Math.max(a.minZoom,Math.min(a.maxZoom,a.object.zoom/t)),a.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - dolly/zoom disabled."),a.enableZoom=!1)}const H=function(){const t=new vi,e=a.radius*a.radius;return function(i){const n=a.domElement.getBoundingClientRect(),s=(i.x-n.x)/(n.width/2)-1,r=1-(i.y-n.y)/(n.height/2);return function(i,n){var s=(i*=a.rotateSpeed)*i+(n*=a.rotateSpeed)*n;s<=e/2?t.set(i,n,Math.sqrt(e-s)):t.set(i,n,e/(2*Math.sqrt(s)))}(L?s:0,k?r:0),t}}();function V(t){_.set(t.clientX,t.clientY)}function G(t){M.set(t.clientX,t.clientY)}function j(t){if(1==t.touches.length)_.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);_.set(e,i)}}function W(t){if(1==t.touches.length)M.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);M.set(e,i)}}function q(t){var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY,n=Math.sqrt(e*e+i*i);E.set(0,n)}function X(t){if(1==t.touches.length)y.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);y.set(e,i)}if(a.trackball&&a.holroyd)w=H(_).clone(),b=H(y).clone();else{x.subVectors(y,_).multiplyScalar(a.rotateSpeed);var n=a.domElement;P(2*Math.PI*x.x/n.clientHeight),I(2*Math.PI*x.y/n.clientHeight)}_.copy(y)}function Z(t){if(1==t.touches.length)S.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);S.set(e,i)}T.subVectors(S,M).multiplyScalar(a.panSpeed),B(T.x,T.y),M.copy(S)}function Y(t){var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY,n=Math.sqrt(e*e+i*i);A.set(0,n),C.set(0,Math.pow(A.y/E.y,a.zoomSpeed)),F(C.y),E.copy(A)}function J(t){if(!1!==a.enabled){var e;switch(t.preventDefault(),t.stopPropagation(),a.domElement.focus?a.domElement.focus():window.focus(),t.button){case 0:e=a.mouseButtons.LEFT;break;case 1:e=a.mouseButtons.MIDDLE;break;case 2:e=a.mouseButtons.RIGHT;break;default:e=-1}switch(e){case i.DOLLY:if(!1===a.enableZoom)return;!function(t){E.set(t.clientX,t.clientY)}(t),d=h.DOLLY;break;case i.ROTATE:if(_p.get(t,"shift")){if(!1===a.enablePan)return;G(t),d=h.PAN}else{if(!1===a.enableRotate)return;_p.get(t,"ctrl")&&(L=!1),_p.get(t,"meta")&&(k=!1),V(t),d=h.ROTATE}break;case i.PAN:if(_p.get(t,"ctrl")||_p.get(t,"meta")||_p.get(t,"shift")){if(!1===a.enableRotate)return;V(t),d=h.ROTATE}else{if(!1===a.enablePan)return;G(t),d=h.PAN}break;default:d=h.NONE}d!==h.NONE&&(document.addEventListener("mousemove",$,!1),document.addEventListener("mouseup",K,!1),a.dispatchEvent(l))}}function $(t){if(!1!==a.enabled)switch(t.preventDefault(),t.stopPropagation(),d){case h.ROTATE:if(!1===a.enableRotate)return;!function(t){if(y.set(t.clientX,t.clientY),a.trackball&&a.holroyd)w=H(_).clone(),b=H(y).clone();else{var e=a.domElement;x.subVectors(y,_).multiplyScalar(a.rotateSpeed),P(2*Math.PI*x.x/e.clientHeight),I(2*Math.PI*x.y/e.clientHeight)}_.copy(y),a.update()}(t);break;case h.DOLLY:if(!1===a.enableZoom)return;!function(t){A.set(t.clientX,t.clientY),C.subVectors(A,E),C.y>0?F(R()):C.y<0&&z(R()),E.copy(A),a.update()}(t);break;case h.PAN:if(!1===a.enablePan)return;!function(t){S.set(t.clientX,t.clientY),T.subVectors(S,M).multiplyScalar(a.panSpeed),B(T.x,T.y),M.copy(S),a.update()}(t)}}function K(t){!1!==a.enabled&&(document.removeEventListener("mousemove",$,!1),document.removeEventListener("mouseup",K,!1),L=!0,k=!0,a.dispatchEvent(c),d=h.NONE)}function Q(t){!1===a.enabled||!1===a.enableZoom||d!==h.NONE&&d!==h.ROTATE||(t.preventDefault(),t.stopPropagation(),a.dispatchEvent(l),function(t){t.deltaY<0?z(R()):t.deltaY>0&&F(R()),a.update()}(t),a.dispatchEvent(c))}function tt(t){!1!==a.enabled&&!1!==a.enableKeys&&!1!==a.enablePan&&function(t){var e=!1;switch(t.keyCode){case a.keys.UP:B(0,a.keyPanSpeed),e=!0;break;case a.keys.BOTTOM:B(0,-a.keyPanSpeed),e=!0;break;case a.keys.LEFT:B(a.keyPanSpeed,0),e=!0;break;case a.keys.RIGHT:B(-a.keyPanSpeed,0),e=!0}e&&(t.preventDefault(),a.update())}(t)}function et(t){if(!1!==a.enabled){switch(t.preventDefault(),t.touches.length){case 1:switch(a.touches.ONE){case n.ROTATE:if(!1===a.enableRotate)return;j(t),d=h.TOUCH_ROTATE;break;case n.PAN:if(!1===a.enablePan)return;W(t),d=h.TOUCH_PAN;break;default:d=h.NONE}break;case 2:switch(a.touches.TWO){case n.DOLLY_PAN:if(!1===a.enableZoom&&!1===a.enablePan)return;!function(t){a.enableZoom&&q(t),a.enablePan&&W(t)}(t),d=h.TOUCH_DOLLY_PAN;break;case n.DOLLY_ROTATE:if(!1===a.enableZoom&&!1===a.enableRotate)return;!function(t){a.enableZoom&&q(t),a.enableRotate&&j(t)}(t),d=h.TOUCH_DOLLY_ROTATE;break;default:d=h.NONE}break;default:d=h.NONE}d!==h.NONE&&a.dispatchEvent(l)}}function it(t){if(!1!==a.enabled)switch(t.preventDefault(),t.stopPropagation(),d){case h.TOUCH_ROTATE:if(!1===a.enableRotate)return;X(t),a.update();break;case h.TOUCH_PAN:if(!1===a.enablePan)return;Z(t),a.update();break;case h.TOUCH_DOLLY_PAN:if(!1===a.enableZoom&&!1===a.enablePan)return;!function(t){a.enableZoom&&Y(t),a.enablePan&&Z(t)}(t),a.update();break;case h.TOUCH_DOLLY_ROTATE:if(!1===a.enableZoom&&!1===a.enableRotate)return;!function(t){a.enableZoom&&Y(t),a.enableRotate&&X(t)}(t),a.update();break;default:d=h.NONE}}function nt(t){!1!==a.enabled&&(a.dispatchEvent(c),d=h.NONE)}function st(t){!1!==a.enabled&&t.preventDefault()}a.domElement.addEventListener("contextmenu",st,!1),a.domElement.addEventListener("mousedown",J,!1),a.domElement.addEventListener("wheel",Q,!1),a.domElement.addEventListener("touchstart",et,!1),a.domElement.addEventListener("touchend",nt,!1),a.domElement.addEventListener("touchmove",it,!1),a.domElement.addEventListener("keydown",tt,!1),-1===a.domElement.tabIndex&&(a.domElement.tabIndex=0),this.object.lookAt(a.target),this.update(),this.saveState()};(nf.prototype=Object.create(ke.prototype)).constructor=nf;var sf=function(t,e){nf.call(this,t,e),this.mouseButtons.LEFT=i.ROTATE,this.mouseButtons.RIGHT=i.PAN,this.touches.ONE=n.ROTATE,this.touches.TWO=n.DOLLY_PAN};(sf.prototype=Object.create(ke.prototype)).constructor=sf;var rf=function(t,e){nf.call(this,t,e),this.mouseButtons.LEFT=i.PAN,this.mouseButtons.RIGHT=i.ROTATE,this.touches.ONE=n.PAN,this.touches.TWO=n.DOLLY_ROTATE};(rf.prototype=Object.create(ke.prototype)).constructor=rf;var af=function(t,e){nf.call(this,t,e),this.trackball=!0,this.screenSpacePanning=!0,this.autoRotate=!1,this.mouseButtons.LEFT=i.ROTATE,this.mouseButtons.RIGHT=i.PAN,this.touches.ONE=n.ROTATE,this.touches.TWO=n.DOLLY_PAN};(af.prototype=Object.create(ke.prototype)).constructor=af;class of{constructor(t,e,i,n,s=1,r=1,a=1){switch(this.type=t,this.camera=e,this.target=i,this.target0=i.slice(),this.domElement=n,this.rotateSpeed=s,this.zoomSpeed=r,this.panSpeed=a,t){case"orbit":this.initOrbitControls();break;case"trackball":this.initTrackballControls()}this.controls.target=new vi(...this.target),this.controls.rotateSpeed=this.rotateSpeed,this.controls.zoomSpeed=this.zoomSpeed,this.controls.panSpeed=this.panSpeed,this.currentUpdateCallback=null,this.saveState(),this.update()}dispose(){this.controls.dispose(),this.controls=null}saveState(){this.controls.saveState()}initTrackballControls(t=!0){this.controls=new nf(this.camera,this.domElement),this.controls.trackball=!0,this.setHolroydTrackball(t)}initOrbitControls(){this.controls=new nf(this.camera,this.domElement)}addChangeListener(t){null==this.currentUpdateCallback&&(this.currentUpdateCallback=t,this.controls.addEventListener("change",t))}removeChangeListener(){null!=this.currentUpdateCallback&&(this.controls.removeEventListener("change",this.currentUpdateCallback),this.currentUpdateCallback=null)}update(){this.controls.update()}reset(){this.controls.reset()}setCamera(t){this.controls.object=t}setHolroydTrackball(t){this.controls.holroyd=t}getTarget(){return this.controls.target}getZoom0(){return this.controls.zoom0}setTarget(t){this.controls.target.copy(t)}setZoomSpeed(t){this.controls.zoomSpeed=t}setPanSpeed(t){this.controls.panSpeed=t}setRotateSpeed(t){this.controls.rotateSpeed=t}getResetLocation=()=>({target0:this.controls.target0.clone(),position0:this.controls.position0.clone(),quaternion0:this.controls.quaternion0.clone(),zoom0:this.controls.zoom0});setResetLocation=(t,e,i,n)=>{this.controls.target0.copy(t),this.controls.position0.copy(e),this.controls.quaternion0.copy(i),this.controls.zoom0=n};rotateUp(t){this.controls.rotateUp(-t/180*Math.PI),this.update()}rotateLeft(t){this.controls.rotateLeft(t/180*Math.PI),this.update()}rotateX(t){this.controls.rotateX(t/180*Math.PI),this.update()}rotateY(t){this.controls.rotateY(t/180*Math.PI),this.update()}rotateZ(t){this.controls.rotateZ(t/180*Math.PI),this.update()}}const lf={y_up:{iso:{pos:new vi(1,1,1),quat:null},front:{pos:new vi(0,0,1),quat:null},rear:{pos:new vi(0,0,-1),quat:null},left:{pos:new vi(-1,0,0),quat:null},right:{pos:new vi(1,0,0),quat:null},top:{pos:new vi(0,1,0),quat:null},bottom:{pos:new vi(0,-1,0),quat:null}},z_up:{iso:{pos:new vi(1,-1,1),quat:null},front:{pos:new vi(0,-1,0),quat:null},rear:{pos:new vi(0,1,0),quat:null},left:{pos:new vi(-1,0,0),quat:null},right:{pos:new vi(1,0,0),quat:null},top:{pos:new vi(0,0,1),quat:[0,0,0,1]},bottom:{pos:new vi(0,0,-1),quat:[1,0,0,0]}},legacy:{iso:{pos:new vi(1,1,1),quat:null},front:{pos:new vi(1,0,0),quat:null},rear:{pos:new vi(-1,0,0),quat:null},left:{pos:new vi(0,1,0),quat:null},right:{pos:new vi(0,-1,0),quat:null},top:{pos:new vi(0,0,1),quat:null},bottom:{pos:new vi(0,0,-1),quat:null}}},cf={y_up:[0,1,0],z_up:[0,0,1],legacy:[0,0,1]};class hf{constructor(t,e,i,n,s,r){this.target=new vi(...n),this.ortho=s,this.up={Y:"y_up",Z:"z_up",L:"legacy"}[r],this.yaxis=new vi(0,1,0),this.zaxis=new vi(0,0,1);const a=t/e;this.camera_distance=5*i;var o=2*Math.atan(.2)/Math.PI*180;this.pCamera=new Us(o,a,.1,100*i),this.pCamera.up.set(...cf[this.up]),this.pCamera.lookAt(this.target);const l=this.projectSize(i,a);this.oCamera=new ic(-l[0],l[0],l[1],-l[1],.1,100*i),this.oCamera.up.set(...cf[this.up]),this.oCamera.lookAt(this.target),this.camera=s?this.oCamera:this.pCamera,this.camera.up.set(...cf[this.up])}dispose(){this.oCamera=null,this.pCamera=null}getCamera(){return this.camera}lookAtTarget(){this.camera.lookAt(this.target)}updateProjectionMatrix(){this.camera.updateProjectionMatrix()}switchCamera(t){var e=this.getPosition().clone();const i=this.getZoom(),n=this.getQuaternion().clone();t?(this.camera=this.oCamera,this.ortho=!0):(this.camera=this.pCamera,this.ortho=!1),this.setPosition(e,!1),this.setZoom(i),this.setQuaternion(n),this.updateProjectionMatrix()}projectSize(t,e){var i,n;return e<1?n=(i=t)/e:i=(n=t)*e,[i,n]}setupCamera(t,e=null,i=null,n=null){if(null!=e){var s=t?e.clone().normalize().multiplyScalar(this.camera_distance).add(this.target):e;this.camera.position.set(...s.toArray())}null!=i&&this.camera.quaternion.set(...i.toArray()),null!=n&&this.setZoom(n),this.updateProjectionMatrix()}presetCamera(t,e=null){if(null==e&&(e=this.camera.zoom),this.setupCamera(!0,lf[this.up][t].pos,null,e),this.lookAtTarget(),null!=lf[this.up][t].quat){var i=lf[this.up][t].quat;this.setQuaternion(i)}}getZoom(){if(this.ortho)return this.camera.zoom;var t=this.camera.position.clone().sub(this.target);return this.camera_distance/t.length()}setZoom(t){this.ortho?this.camera.zoom=t:this.camera.position.sub(this.target).setLength(this.camera_distance/t).add(this.target),this.updateProjectionMatrix()}getPosition(){return this.camera.position}setPosition(t,e){const i=this;Array.isArray(t)&&3===t.length?i.setupCamera(e,new vi(...t)):t instanceof vi?i.setupCamera(e,t):console.error("wrong type for position",t)}getQuaternion(){return this.camera.quaternion}setQuaternion(t){const e=this;Array.isArray(t)&&4===t.length?e.setupCamera(null,null,new gi(...t)):t instanceof gi?e.setupCamera(null,null,t):console.error("wrong type for quaternion",t),this.updateProjectionMatrix()}getRotation(){return this.camera.rotation}changeDimensions(t,e,i){const n=e/i,s=this.projectSize(t,n);this.oCamera&&(this.oCamera.left=-s[0],this.oCamera.right=s[0],this.oCamera.top=s[1],this.oCamera.bottom=-s[1]),this.pCamera&&(this.pCamera.aspect=n),this.camera&&this.camera.updateProjectionMatrix()}}bs.prototype.dispose=function(){this.geometry&&(this.geometry.dispose(),fp(this.geometry)),this.material&&(Array.isArray(this.material)?this.material.forEach((t=>t.dispose())):this.material.dispose())};t.Display=class{constructor(t,e){this.container=t,this.container.innerHTML=function(t){const e=_p.getshortcuts("shift"),i=_p.getshortcuts("ctrl"),n=_p.getshortcuts("meta");return'<div class="tcv_cad_viewer">\n <div class="tcv_cad_toolbar tcv_round"></div>\n\n <div class="tcv_cad_body">\n <div class="tcv_cad_navigation">\n <div class="tcv_cad_tree tcv_round">\n <div class="tcv_tabnav">\n <input class=\'tcv_tab_tree tcv_tab tcv_tab-left tcv_tab-selected\' value="Tree" type="button" />\n <input class=\'tcv_tab_clip tcv_tab tcv_tab-right tcv_tab-unselected\' value="Clipping"\n type="button" />\n <input class=\'tcv_tab_material tcv_tab tcv_tab-right tcv_tab-unselected\' value="Material"\n type="button" />\n </div>\n <div class="tcv_cad_tree_toggles">\n <span class="tcv_tooltip" data-tooltip="Collpase nodes with a single leaf">\n <input class=\'tcv_collapse_singles tcv_btn tcv_small_btn\' value="1" type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Expand root node only">\n <input class=\'tcv_expand_root tcv_btn tcv_small_btn\' value="R" type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Collpase tree">\n <input class=\'tcv_collapse_all tcv_btn tcv_small_btn\' value="C" type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Expand tree">\n <input class=\'tcv_expand tcv_btn tcv_small_btn\' value="E" type="button" />\n </span>\n </div>\n <div class="tcv_box_content tcv_mac-scrollbar tcv_scroller">\n <div class="tcv_cad_tree_container"></div>\n <div class="tcv_cad_clip_container">\n <div class="tcv_slider_group">\n <div>\n <span class="tcv_tooltip" data-tooltip="Set red clipping plane to view direction">\n <input class=\'tcv_btn_norm_plane1 tcv_btn tcv_plane\' type="button" />\n </span>\n <span class="tcv_lbl_norm_plane1 tcv_label">N1 = (n/a, n/a, n/a)</span>\n </div>\n <div>\n <input type="range" min="1" max="100" value="50"\n class="tcv_sld_value_plane1 tcv_clip_slider">\n <input value=50 class="tcv_inp_value_plane1 tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_slider_group">\n <div>\n <span class="tooltip" data-tooltip="Set green clipping plane to view direction">\n <input class=\'tcv_btn_norm_plane2 tcv_btn tcv_plane\' type="button" />\n </span>\n <span class="tcv_lbl_norm_plane2 tcv_label">N2 = (n/a, n/a, n/a)</span>\n </div>\n <div>\n <input type="range" min="1" max="100" value="50"\n class="tcv_sld_value_plane2 tcv_clip_slider">\n <input value=50 class="tcv_inp_value_plane2 tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_slider_group">\n <div>\n <span class="tooltip" data-tooltip="Set blue clipping plane to view direction">\n <input class=\'tcv_btn_norm_plane3 tcv_btn tcv_plane\' type="button" />\n </span>\n <span class="tcv_lbl_norm_plane3 tcv_label">N3 = (n/a, n/a, n/a)</span>\n </div>\n <div>\n <input type="range" min="1" max="100" value="50"\n class="tcv_sld_value_plane3 tcv_clip_slider">\n <input value=50 class="tcv_inp_value_plane3 tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_clip_checks">\n <div>\n <span class="tcv_tooltip" data-tooltip="Use intersection clipping">\n <input class=\'tcv_clip_intersection tcv_check\' type="checkbox" />\n <span class="tcv_label">Intersection</span>\n </span>\n <span class="tcv_tooltip" data-tooltip="Show clipping planes">\n <input class=\'tcv_clip_plane_helpers tcv_axes0 tcv_check\' type="checkbox" />\n <span class="tcv_label">Planes</span>\n </span>\n </div>\n <span class="tcv_tooltip" data-tooltip="Use object color caps instead of RGB">\n <input class=\'tcv_clip_caps tcv_axes0 tcv_check\' type="checkbox" />\n <span class="tcv_label">Use object color caps</span>\n </span>\n </div>\n </div>\n <div class="tcv_cad_material_container">\n <div class="tcv_cad_tree_toggles">\n <span class="tcv_tooltip" data-tooltip="Reset to original values">\n <input class=\'tcv_material_reset tcv_btn tcv_small_btn\' value="R" type="button" />\n </span>\n </div>\n <div class="tcv_material_ambientlight tcv_label">\n Ambient light intensity (%)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="20" value="1"\n class="tcv_sld_value_ambientlight tcv_clip_slider">\n <input value=1 class="tcv_inp_value_ambientlight tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_pointlight tcv_label">\n Directional light intensity (%)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="40" value="1"\n class="tcv_sld_value_pointlight tcv_clip_slider">\n <input value=1 class="tcv_inp_value_pointlight tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_metalness tcv_label">\n Metalness (%)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="100" value="40"\n class="tcv_sld_value_metalness tcv_clip_slider">\n <input value=40 class="tcv_inp_value_metalness tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_roughness tcv_label">\n Roughness (%)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="100" value="40"\n class="tcv_sld_value_roughness tcv_clip_slider">\n <input value=40 class="tcv_inp_value_roughness tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_info">\n This is not a full material renderer (e.g. the environment is black), so\n not every combination creates expected or good results.\n </div>\n </div>\n </div>\n </div>\n <div class="tcv_cad_info_wrapper">\n <div class="tcv_toggle_info_wrapper">\n \x3c!-- <span class="tooltip" data-tooltip="Open/close info box"> --\x3e\n \x3c!-- <input class=\'tcv_toggle_info tcv_btn tcv_small_info_btn\' value="<" type="button" /> --\x3e\n <span class=\'tcv_toggle_info\'></span><span class="tcv_info_label">Info</span>\n \x3c!-- </span> --\x3e\n </div>\n <div class="tcv_cad_info tcv_round">\n <div class="tcv_box_content tcv_mac-scrollbar tcv_scroller">\n <div class="tcv_cad_info_container"></div>\n </div>\n </div>\n </div>\n </div>\n\n <div class="tcv_cad_view">\n <div class="tcv_distance_measurement_panel tcv_panel tcv_round">\n <div class="tcv_measure_header">Distance</div>\n <table class="tcv_properties_table">\n <tr class="tcv_measure_row_line">\n <td class="tcv_measure_cell tcv_measure_cell_header">Total</td>\n <td class="tcv_measure_cell tcv_measure_val tcv_total">total</td>\n </tr>\n <tr class="tcv_measure_row_line">\n <td class="tcv_measure_cell tcv_measure_cell_header tcv_xtitle">X</td>\n <td class="tcv_measure_cell tcv_measure_val tcv_x">x</td>\n </tr>\n <tr class="tcv_measure_row_line">\n <td class="tcv_measure_cell tcv_measure_cell_header tcv_ytitle">Y</td>\n <td class="tcv_measure_cell tcv_measure_val tcv_y">y</td>\n </tr>\n <tr>\n <td class="tcv_measure_cell tcv_measure_cell_header tcv_bottom_cell_left tcv_ztitle">Z</td>\n <td class="tcv_measure_cell tcv_measure_val bottom_cell_right tcv_z">z</td>\n </tr>\n </table>\n </div>\n\n <div class="tcv_properties_measurement_panel tcv_panel tcv_round">\n <div class="tcv_measure_header">Properties</div>\n <div class="tcv_measure_subheader">Shape</div>\n <table class="tcv_properties_table">\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Volume</th>\n <td class="tcv_props_cell tcv_measure_val tcv_volume" colspan="3">volume</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Area</th>\n <td class="tcv_props_cell tcv_measure_val tcv_area" colspan="3">area</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Length</th>\n <td class="tcv_props_cell tcv_measure_val tcv_length" colspan="3">length</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Width</th>\n <td class="tcv_props_cell tcv_measure_val tcv_width" colspan="3">w</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Geom</th>\n <td class="tcv_props_cell tcv_measure_val tcv_geom_type" colspan="3">g</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Radius</th>\n <td class="tcv_props_cell tcv_measure_val tcv_radius" colspan="3">r</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Radius2</th>\n <td class="tcv_props_cell tcv_measure_val tcv_radius2" colspan="3">r</td>\n </tr>\n <tr class="tcv_properties_row_line vertex_row tcv_vertex_coords_title_row">\n <td class="tcv_vertex_cell tcv_xtitle" colspan="2">X</td>\n <td class="tcv_vertex_cell tcv_ytitle" colspan="2">Y</td>\n <td class="tcv_vertex_cell tcv_ztitle" colspan="2">Z</td>\n </tr>\n <tr class="tcv_properties_row_line vertex_row tcv_vertex_coords_row">\n <td class="tcv_vertex_cell tcv_x_value" colspan="2">X</td>\n <td class="tcv_vertex_cell tcv_y_value" colspan="2">Y</td>\n <td class="tcv_vertex_cell tcv_z_value" colspan="2">Z</td>\n </tr>\n </table>\n </div>\n\n <div class="tcv_angle_measurement_panel tcv_panel tcv_round">\n <div class="tcv_measure_header">Angle</div>\n <table class="tcv_properties_table">\n <tr class="tcv_properties_row_line">\n <td class="tcv_angle tcv_measure_val">angle</td>\n </tr>\n </table>\n </div>\n\n <div class="tcv_cad_animation tcv_round">\n <span class="tcv_animation_label">E</span>\n <span><input type="range" min="0" max="1000" value="0"\n class="tcv_animation_slider tcv_clip_slider"></span>\n <span class="tcv_tooltip" data-tooltip="Play animation"><input class=\'tcv_play tcv_btn\'\n type="button" /></span>\n <span class="tcv_tooltip" data-tooltip="Pause animation"><input class=\'tcv_pause tcv_btn\'\n type="button" /></span>\n <span class="tcv_tooltip" data-tooltip="Stop and reset animation"><input class=\'tcv_stop tcv_btn\'\n type="button" /></span>\n </div>\n\n <div class="tcv_cad_help tcv_round">\n <table class="tcv_cad_help_layout">\n <tr>\n <td></td>\n <td><b>Mouse Navigation</b></td>\n </tr>\n <tr>\n <td>Rotate</td>\n <td><left mouse button></td>\n </tr>\n <tr>\n <td>Rotate up / down</td>\n <td><{{ctrl}}> + <left mouse button></td>\n </tr>\n <tr>\n <td>Rotate left / right</td>\n <td><{{meta}}> + <left mouse button></td>\n </tr>\n <tr>\n <td>Pan</td>\n <td><{{shift}}> + <left mouse button> or <right mouse button></td>\n </tr>\n <tr>\n <td>Zoom</td>\n <td><mouse wheel> or <middle mouse button></td>\n </tr>\n\n <tr>\n <td></td>\n <td><b>Mouse Selection</b></td>\n </tr>\n <tr>\n <td>Pick element</td>\n <td><left mouse button> double click</td>\n </tr>\n <tr>\n <td></td>\n <td>Click on navigation tree label</td>\n </tr>\n <tr>\n <td></td>\n <td>(Shows axis-aligned bounding box, AABB)</td>\n </tr>\n <tr>\n <td>Hide element</td>\n <td><{{meta}}> + <left mouse button> double click</td>\n </tr>\n <tr>\n <td></td>\n <td><{{meta}}> + click on navigation tree label</td>\n </tr>\n <tr>\n <td>Isolate element</td>\n <td><{{shift}}> + <left mouse button> double click</td>\n </tr>\n <tr>\n <td></td>\n <td><{{shift}}> + click on navigation tree label</td>\n </tr>\n <tr>\n <td>Set camera target</td>\n <td><{{shift}}> + <{{meta}}> + <left mouse button> double click</td>\n </tr> \n <tr>\n <td></td>\n <td><b>CAD Object Tree</b></td>\n </tr>\n <tr>\n <td>Collapse single leafs</td>\n <td>Button \'1\' (all nodes with one leaf only)</td>\n </tr>\n <tr>\n <td>Expand root only</td>\n <td>Button \'R\'</td>\n </tr>\n <tr>\n <td>Collapse all nodes</td>\n <td>Button \'C\'</td>\n </tr>\n <tr>\n <td>Expand all nodes</td>\n <td>Button \'E\'</td>\n </tr>\n <tr>\n <td></td>\n <td><b>Measure Mode</b></td>\n </tr>\n <tr>\n <td>Select 1. (and 2.) object</td>\n <td><left mouse button></td>\n </tr>\n <tr>\n <td>Select object & show tree node</td>\n <td><{{shift}}> + <left mouse button></td>\n </tr>\n <tr>\n <td>Filter object types</td>\n <td>Type menu or <n>one, <s>olid, <f>ace, <e>dge , <v>ertices</td>\n </tr>\n <tr>\n <td>Unselect last object</td>\n <td><right mouse button></td>\n </tr>\n <tr>\n <td>Unselect all objects</td>\n <td><ESC></td>\n </tr>\n </table>\n </div>\n <div class="tcv_filter_menu">\n <div class="tcv_drop_down tcv_shape_filter">\n <span class="tcv_round tcv_filter_content"><span class="tcv_filter_value">None</span>\n <span class="tcv_filter_icon">⏶\n </span></span>\n <div class="tcv_filter_dropdown tcv_round">\n <div class="tcv_filter_dropdown_value tvc_filter_none">None</div>\n <div class="tcv_filter_dropdown_value tvc_filter_vertex">Vertex</div>\n <div class="tcv_filter_dropdown_value tvc_filter_edge">Edge</div>\n <div class="tcv_filter_dropdown_value tvc_filter_face">Face</div>\n <div class="tcv_filter_dropdown_value tvc_filter_solid">Solid</div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>'.replaceAll("{{id}}",t).replaceAll("{{shift}}",e).replaceAll("{{ctrl}}",i).replaceAll("{{meta}}",n)}(this.container.id),this.cadBody=this._getElement("tcv_cad_body"),this.cadTool=new xp(this._getElement("tcv_cad_toolbar"),t.id),this.cadView=this._getElement("tcv_cad_view"),this.distanceMeasurementPanel=this._getElement("tcv_distance_measurement_panel"),this.propertiesMeasurementPanel=this._getElement("tcv_properties_measurement_panel"),this.angleMeasurementPanel=this._getElement("tcv_angle_measurement_panel"),this.cadTree=this._getElement("tcv_cad_tree_container"),this.cadTreeScrollContainer=this._getElement("tcv_box_content"),this.cadTreeToggles=this._getElement("tcv_cad_tree_toggles"),this.cadClip=this._getElement("tcv_cad_clip_container"),this.cadMaterial=this._getElement("tcv_cad_material_container"),this.tabTree=this._getElement("tcv_tab_tree"),this.tabClip=this._getElement("tcv_tab_clip"),this.tabMaterial=this._getElement("tcv_tab_material"),this.cadInfo=this._getElement("tcv_cad_info_container"),this.cadAnim=this._getElement("tcv_cad_animation"),this.cadTools=this._getElement("tcv_cad_tools"),this.cadHelp=this._getElement("tcv_cad_help"),this.planeLabels=[];for(var i=1;i<4;i++)this.planeLabels.push(this._getElement(`tcv_lbl_norm_plane${i}`));var n;for(var s of(this.viewer=null,this.glass=e.glass,this.tools=e.tools,this.cadWidth=e.cadWidth,this.height=e.height,this.treeWidth=e.treeWidth,this._events=[],this.setSizes(e),this.activeTab="tree",this.cadTree.style.display="block",this.cadClip.style.display="none",this.cadMaterial.style.display="none",this.clipSliders=null,this.explodeFlag=!1,this.currentButton=null,this.lastPlaneState=!1,"dark"===e.theme||"browser"==e.theme&&window.matchMedia("(prefers-color-scheme: dark)").matches?(this.container.setAttribute("data-theme","dark"),n="dark"):(this.container.setAttribute("data-theme","light"),n="light"),fm)){var r=this.container.getElementsByClassName(`tcv_${s}`);for(i=0;i<r.length;i++){r[i].setAttribute("style",`background-image: ${cp(n,s)}`)}}this.toolbarButtons={},this.toolbarButtons.axes=new Mp(n,"axes","Show axes",this.setAxes),this.cadTool.addButton(this.toolbarButtons.axes),this.toolbarButtons.axes0=new Mp(n,"axes0","Show axes at origin (0,0,0)",this.setAxes0),this.cadTool.addButton(this.toolbarButtons.axes0),this.toolbarButtons.grid=new Mp(n,"grid","Show grid",this.setGrid,null,["xy","xz","yz"]),this.cadTool.addButton(this.toolbarButtons.grid),this.cadTool.addSeparator(),this.toolbarButtons.perspective=new Mp(n,"perspective","Use perspective camera",this.setOrtho),this.cadTool.addButton(this.toolbarButtons.perspective),this.toolbarButtons.transparent=new Mp(n,"transparent","Show transparent faces",this.setTransparent),this.cadTool.addButton(this.toolbarButtons.transparent),this.toolbarButtons.blackedges=new Mp(n,"blackedges","Show black edges",this.setBlackEdges),this.cadTool.addButton(this.toolbarButtons.blackedges),this.cadTool.addSeparator(),this.toolbarButtons.reset=new bp(n,"reset","Reset view",this.reset),this.cadTool.addButton(this.toolbarButtons.reset),this.toolbarButtons.resize=new bp(n,"resize","Resize object",this.resize),this.cadTool.addButton(this.toolbarButtons.resize),this.cadTool.addSeparator(),this.toolbarButtons.iso=new bp(n,"iso","Switch to iso view",this.setView),this.cadTool.addButton(this.toolbarButtons.iso),this.toolbarButtons.front=new bp(n,"front","Switch to front view",this.setView),this.cadTool.addButton(this.toolbarButtons.front),this.toolbarButtons.rear=new bp(n,"rear","Switch to back view",this.setView),this.cadTool.addButton(this.toolbarButtons.rear),this.toolbarButtons.top=new bp(n,"top","Switch to top view",this.setView),this.cadTool.addButton(this.toolbarButtons.top),this.toolbarButtons.bottom=new bp(n,"bottom","Switch to bottom view",this.setView),this.cadTool.addButton(this.toolbarButtons.bottom),this.toolbarButtons.left=new bp(n,"left","Switch to left view",this.setView),this.cadTool.addButton(this.toolbarButtons.left),this.toolbarButtons.right=new bp(n,"right","Switch to right view",this.setView),this.cadTool.addButton(this.toolbarButtons.right),this.cadTool.addSeparator(),this.toolbarButtons.explode=new Mp(n,"explode","Explode tool",this.setExplode),this.cadTool.addButton(this.toolbarButtons.explode),this.toolbarButtons.distance=new Mp(n,"distance","Measure distance between shapes",this.setTool),this.cadTool.addButton(this.toolbarButtons.distance),this.toolbarButtons.properties=new Mp(n,"properties","Show shape properties",this.setTool),this.cadTool.addButton(this.toolbarButtons.properties),this.toolbarButtons.angle=new Mp(n,"angle","Measure angle between shapes",this.setTool),this.cadTool.addButton(this.toolbarButtons.angle),this.cadTool.defineGroup([this.toolbarButtons.explode,this.toolbarButtons.distance,this.toolbarButtons.properties,this.toolbarButtons.angle]),this.toolbarButtons.help=new bp(n,"help","Help",this.toggleHelp),this.toolbarButtons.help.alignRight(),this.cadTool.addButton(this.toolbarButtons.help),document.addEventListener("keydown",(t=>{"Escape"===t.key&&this.help_shown&&(t.preventDefault(),this.showHelp(!1))})),this.toolbarButtons.pin=new bp(n,"pin","Pin viewer as png",this.pinAsPng),this.toolbarButtons.pin.alignRight(),this.cadTool.addButton(this.toolbarButtons.pin),this.shapeFilterDropDownMenu=new nm(this),this.showPinning(e.pinning),this.infoIcons={right:hp(n,"nav_closed"),down:hp(n,"nav_open")}}_setupCheckEvent(t,e,i){const n=this._getElement(t);n.addEventListener("change",e),null!=i&&(n.checked=i),this._events.push(["change",t,e])}_setupClickEvent(t,e,i){this._getElement(t).addEventListener("click",e),this._events.push(["click",t,e])}_getElement(t){return this.container.getElementsByClassName(t)[0]}dispose(){var t,e,i;for(var n of this._events){[t,e,i]=n;this._getElement(e).removeEventListener(t,i)}this.cadTree.innerHTML="",this.cadView.removeChild(this.cadView.children[2]),this.container.innerHTML=""}handleMoreButton(t){}setSizes(t,e=2/3){if(t.cadWidth&&(this.cadWidth=t.cadWidth,this.cadView.style.width=mm(t.cadWidth)),t.height&&(this.height=t.height,this.cadView.style.height=mm(t.height)),t.treeWidth&&(this.treeWidth=t.treeWidth,this.cadTree.parentElement.parentElement.style.width=mm(t.treeWidth),this.cadInfo.parentElement.parentElement.style.width=mm(t.treeWidth)),!t.glass){const i=Math.round(t.height*e);this.cadTree.parentElement.parentElement.style.height=mm(i),this.cadInfo.parentElement.parentElement.style.height=mm(t.height-i-4)}t.tools&&!t.glass?(this.cadTool.container.style.width=mm(t.treeWidth+t.cadWidth+4),this.cadBody.style.width=mm(t.treeWidth+t.cadWidth+4)):(this.cadTool.container.style.width=mm(t.cadWidth+2),this.cadBody.style.width=mm(t.cadWidth+2)),this.cadBody.style.height=mm(t.height+4)}setupUI(t){this.viewer=t,this._setupClickEvent("tcv_expand_root",this.handleCollapseNodes),this._setupClickEvent("tcv_collapse_singles",this.handleCollapseNodes),this._setupClickEvent("tcv_collapse_all",this.handleCollapseNodes),this._setupClickEvent("tcv_expand",this.handleCollapseNodes),this._setupClickEvent("tcv_material_reset",this.handleMaterialReset),this._setupClickEvent("tcv_toggle_info",this.toggleInfo),this.help_shown=!0,this.info_shown=!this.glass;["tcv_tab_tree","tcv_tab_clip","tcv_tab_material"].forEach((t=>{this._setupClickEvent(t,this.selectTab)})),this.clipSliders=[];for(var e=1;e<4;e++)this.clipSliders.push(new yp(`plane${e}`,0,100,this));for(this.ambientlightSlider=new yp("ambientlight",0,400,this),this.directionallightSlider=new yp("pointlight",0,400,this),this.metalnessSlider=new yp("metalness",0,100,this),this.roughnessSlider=new yp("roughness",0,100,this),this._setupCheckEvent("tcv_clip_plane_helpers",this.setClipPlaneHelpers,!1),this._setupCheckEvent("tcv_clip_intersection",this.setClipIntersection,!1),this._setupCheckEvent("tcv_clip_caps",this.setObjectColorCaps,!1),e=1;e<4;e++)this._setupClickEvent(`tcv_btn_norm_plane${e}`,this.setClipNormalFromPosition,!1);this._setupClickEvent("tcv_play",this.controlAnimation,!1),this._setupClickEvent("tcv_pause",this.controlAnimation,!1),this._setupClickEvent("tcv_stop",this.controlAnimation,!1),this.animationSlider=this.container.getElementsByClassName("tcv_animation_slider")[0],this.animationSlider.value=0,this.animationSlider.addEventListener("input",this.animationChange),this.showAnimationControl(!1),this.showHelp(!1),this.showDistancePanel(!1),this.showPropertiesPanel(!1),this.showAnglePanel(!1)}updateUI(t,e,i,n,s,r,a){this.toolbarButtons.axes.set(t),this.toolbarButtons.axes0.set(e),this.toolbarButtons.perspective.set(!i),this.toolbarButtons.transparent.set(n),this.toolbarButtons.blackedges.set(s),this.showTools(r),this.glassMode(a)}checkElement(t,e){this._getElement(t).checked=e}addCadView(t){var e=this.cadView.querySelector("canvas");e?this.cadView.replaceChild(t,e):this.cadView.appendChild(t)}getCanvas(){return this.cadView.children[this.cadView.children.length-1]}clearCadTree(){this.cadTree.innerHTML=""}addCadTree(t){this.cadTree.appendChild(t)}setAxes=(t,e)=>{this.viewer.setAxes(e)};setAxesCheck=t=>{this.toolbarButtons.axes.set(t)};setGrid=(t,e)=>{this.viewer.setGrid(t,e)};setGridCheck=t=>{this.checkElement("tcv_grid",t)};setAxes0=(t,e)=>{this.viewer.setAxes0(e)};setAxes0Check=t=>{this.toolbarButtons.axes0.set(t)};setOrtho=(t,e)=>{this.viewer.switchCamera(!e)};setOrthoCheck=t=>{this.toolbarButtons.perspective.set(!t)};setTransparent=(t,e)=>{this.viewer.setTransparent(e)};setTransparentCheck=t=>{this.toolbarButtons.transparent.set(t)};setBlackEdges=(t,e)=>{this.viewer.setBlackEdges(e)};setBlackEdgesCheck=t=>{this.toolbarButtons.blackedges.set(t)};setExplode=(t,e)=>{e&&this.explodeFlag||(e||this.explodeFlag)&&(e?(this.viewer.hasAnimation()&&this.viewer.backupAnimation(),this.viewer.explode(),this.explodeFlag=!0):(this.viewer.hasAnimation()&&(this.controlAnimationByName("stop"),this.viewer.clearAnimation(),this.viewer.restoreAnimation()),this.explodeFlag=!1))};setExplodeCheck=t=>{this.toolbarButtons.explode.set(t)};showExplode=t=>{this._getElement("tcv_explode_widget").style.display=t?"inline-block":"none"};setTool=(t,e)=>{this.viewer.toggleAnimationLoop(e),e?(this.showAnimationControl(!1),this.viewer.hasAnimation()&&this.viewer.backupAnimation(),["distance","properties","angle"].includes(t)&&!["distance","properties","angle"].includes(this.currentButton)&&(this.viewer.toggleGroup(!0),this.viewer.toggleTab(!0)),this.viewer.setRaycastMode(e),this.shapeFilterDropDownMenu.setRaycaster(this.viewer.raycaster),"distance"==t?(this.viewer.cadTools.enable(hm),this.viewer.checkChanges({activeTool:hm})):"properties"==t?(this.viewer.cadTools.enable(dm),this.viewer.checkChanges({activeTool:dm})):"angle"==t&&(this.viewer.cadTools.enable(um),this.viewer.checkChanges({activeTool:um})),this.currentButton=t):(this.currentButton!=t&&"explode"!=t||(this.viewer.toggleGroup(!1),this.viewer.toggleTab(!1),this.currentButton=null),this.viewer.checkChanges({activeTool:cm}),this.viewer.clearSelection(),this.viewer.hasAnimation()&&(this.controlAnimationByName("stop"),this.viewer.clearAnimation(),this.viewer.restoreAnimation(),this.showAnimationControl(!0)),this.viewer.setRaycastMode(e)),this.viewer.setPickHandler(!e),this.shapeFilterDropDownMenu.show(e)};setClipPlaneHelpers=t=>{const e=!!t.target.checked;this.setClipPlaneHelpersCheck(e),this.viewer.setClipPlaneHelpers(e)};setClipPlaneHelpersCheck=t=>{this.checkElement("tcv_clip_plane_helpers",t),this.lastPlaneState=t};showTools=t=>{this.tools=t,this.viewer&&(this.viewer.tools=t);var e=this._getElement("tcv_cad_toolbar"),i=this._getElement("tcv_cad_navigation");for(var n of[i,e])t?(n.style.height="38px",n.style.display="block"):(n.style.height="0px",n.style.display="none")};showMeasureTools=t=>{this.toolbarButtons.distance.show(t),this.toolbarButtons.properties.show(t),this.toolbarButtons.angle.show(t)};setClipIntersection=t=>{const e=!!t.target.checked;this.viewer.setClipIntersection(e)};setClipIntersectionCheck=t=>{this._getElement("tcv_clip_intersection").checked=t};setObjectColorCaps=t=>{const e=!!t.target.checked;this.viewer.setClipObjectColorCaps(e)};setClipObjectColorsCheck=t=>{this._getElement("tcv_clip_caps").checked=t};reset=()=>{this.viewer.reset(),this.clearHighlights()};resize=()=>{this.viewer.resize()};clearHighlights(){["front","rear","top","bottom","left","right","iso"].forEach((t=>{this.toolbarButtons[t].highlight(!1)}))}highlightButton(t){this.clearHighlights(),this.toolbarButtons[t].highlight(!0),this.viewer.keepHighlight=!0}setView=t=>{this.viewer.presetCamera(t),this.highlightButton(t),this.viewer.update(!0,!1)};showPinning(t){this.toolbarButtons.pin.show(t)}pinAsPng=t=>{this.viewer.pinAsPng()};setNormalLabel=(t,e)=>{this.planeLabels[t].innerHTML=`N=(${e[0].toFixed(2)}, ${e[1].toFixed(2)}, ${e[2].toFixed(2)})`};setClipNormalFromPosition=t=>{const e=parseInt(t.target.classList[0].slice(-1));this.viewer.setClipNormalFromPosition(e-1)};selectTab=t=>{const e=t.target.className.split(" ")[0];this.selectTabByName(e.slice(8))};setAmbientLight=t=>{this.ambientlightSlider.setValue(100*t)};setDirectLight=t=>{this.directionallightSlider.setValue(100*t)};setMetalness=t=>{this.metalnessSlider.setValue(100*t)};setRoughness=t=>{this.roughnessSlider.setValue(100*t)};handleMaterialReset=t=>{this.viewer.resetMaterial()};selectTabByName(t){if(["clip","tree","material"].includes(t)){if("tree"===t&&"tree"!==this.activeTab){this.cadTree.style.display="block",this.cadTreeToggles.style.display="block",this.cadClip.style.display="none",this.cadMaterial.style.display="none",this.viewer.nestedGroup.setBackVisible(!1),this.viewer.setLocalClipping(!1),this.viewer.clipping.setVisible(!1);var e=this.viewer.getClipPlaneHelpers();this.viewer.setClipPlaneHelpers(!1),this.lastPlaneState=e}else"clip"===t&&"clip"!==this.activeTab?(this.cadTree.style.display="none",this.cadTreeToggles.style.display="none",this.cadClip.style.display="block",this.cadMaterial.style.display="none",this.viewer.nestedGroup.setBackVisible(!0),this.viewer.setLocalClipping(!0),this.viewer.setClipIntersection(this.viewer.clipIntersection),this.viewer.setClipPlaneHelpers(this.lastPlaneState),this.viewer.clipping.setVisible(!0),this.viewer.update(!0,!1)):"material"===t&&"material"!==this.activeTab&&(this.cadTree.style.display="none",this.cadTreeToggles.style.display="none",this.cadClip.style.display="none",this.cadMaterial.style.display="block",this.viewer.nestedGroup.setBackVisible(!1),this.viewer.setLocalClipping(!1),this.viewer.setClipPlaneHelpers(!1),this.viewer.clipping.setVisible(!1));this.activeTab=t,this.viewer.checkChanges({tab:t}),"tree"==t?(this.tabTree.classList.add("tcv_tab-selected"),this.tabTree.classList.remove("tcv_tab-unselected"),this.tabClip.classList.remove("tcv_tab-selected"),this.tabClip.classList.add("tcv_tab-unselected"),this.tabMaterial.classList.remove("tcv_tab-selected"),this.tabMaterial.classList.add("tcv_tab-unselected")):"clip"==t?(this.tabTree.classList.remove("tcv_tab-selected"),this.tabTree.classList.add("tcv_tab-unselected"),this.tabClip.classList.add("tcv_tab-selected"),this.tabClip.classList.remove("tcv_tab-unselected"),this.tabMaterial.classList.remove("tcv_tab-selected"),this.tabMaterial.classList.add("tcv_tab-unselected")):(this.tabTree.classList.add("tcv_tab-unselected"),this.tabTree.classList.remove("tcv_tab-selected"),this.tabClip.classList.add("tcv_tab-unselected"),this.tabClip.classList.remove("tcv_tab-selected"),this.tabMaterial.classList.add("tcv_tab-selected"),this.tabMaterial.classList.remove("tcv_tab-unselected"))}}toggleClippingTab=t=>{t?this.tabClip.removeAttribute("disabled"):this.tabClip.setAttribute("disabled","true"),this.tabClip.classList.toggle("tcv_tab-disabled",!t)};handleCollapseNodes=t=>{this.collapseNodes(t.target.value)};collapseNodes(t){"1"===t?this.viewer.treeview.openLevel(-1):"R"===t?this.viewer.treeview.openLevel(1):"C"===t?this.viewer.treeview.collapseAll():"E"===t&&this.viewer.treeview.expandAll()}setSliderLimits(t){for(var e=0;e<3;e++)this.clipSliders[e].setSlider(t)}refreshPlane(t,e){this.viewer.refreshPlane(t-1,parseFloat(e))}showAnimationControl=t=>{this.cadAnim.style.display=t?"block":"none"};controlAnimationByName(t){this.viewer.controlAnimation(t);var e=this.viewer.animation.getRelativeTime();this.animationSlider.value=1e3*e,"play"==t?this.viewer.bboxNeedsUpdate=!0:"stop"==t?(this.viewer.bboxNeedsUpdate=!1,null!=this.viewer.lastBbox&&(this.viewer.lastBbox.needsUpdate=!0)):this.viewer.bboxNeedsUpdate=!this.viewer.bboxNeedsUpdate}controlAnimation=t=>{const e=t.target.className.split(" ")[0].slice(4);this.controlAnimationByName(e)};animationChange=t=>{this.viewer.animation.setRelativeTime(t.target.valueAsNumber/1e3),null!=this.viewer.lastBbox&&(this.viewer.lastBbox.needsUpdate=!0)};setAnimationLabel(t){this._getElement("tcv_animation_label").innerHTML=t}resetAnimationSlider(){this.animationSlider.value=0}showHelp=t=>{this.cadHelp.style.display=t?"block":"none",this.help_shown=t};showDistancePanel=t=>{this.distanceMeasurementPanel.style.display=t?"block":"none"};showPropertiesPanel=t=>{this.propertiesMeasurementPanel.style.display=t?"block":"none"};showAnglePanel=t=>{this.angleMeasurementPanel.style.display=t?"block":"none"};toggleHelp=()=>{this.showHelp(!this.help_shown)};showInfo=t=>{this.cadInfo.parentNode.parentNode.style.display=t?"block":"none",this._getElement("tcv_toggle_info").innerHTML=t?`${this.infoIcons.down}`:`${this.infoIcons.right}`,this.info_shown=t};toggleInfo=()=>{this.showInfo(!this.info_shown)};autoCollapse(){this.cadWidth<600&&this.glass&&(console.info("Small view, collapsing tree"),this.collapseNodes("C"))}glassMode(t){t?(this._getElement("tcv_cad_tree").classList.add("tcv_cad_tree_glass"),this._getElement("tcv_cad_tree").style.height=null,this._getElement("tcv_cad_tree").style["max-height"]=mm(Math.round(2*this.height/3)-18),this._getElement("tcv_cad_info").classList.add("tcv_cad_info_glass"),this._getElement("tcv_cad_view").classList.add("tcv_cad_view_glass"),this._getElement("tcv_toggle_info_wrapper").style.display="block",this.showInfo(!1),this.glass=!0,this.autoCollapse()):(this._getElement("tcv_cad_tree").classList.remove("tcv_cad_tree_glass"),this._getElement("tcv_cad_tree").style["max-height"]=null,this._getElement("tcv_cad_tree").style.height=mm(Math.round(2*this.height/3)),this._getElement("tcv_cad_info").classList.remove("tcv_cad_info_glass"),this._getElement("tcv_cad_view").classList.remove("tcv_cad_view_glass"),this._getElement("tcv_toggle_info_wrapper").style.display="none",this.showInfo(!0),this.glass=!1),this.viewer&&(this.viewer.glass=!1);const e={cadWidth:this.cadWidth,glass:this.glass,height:this.height,tools:this.tools,treeWidth:t?0:this.treeWidth};this.setSizes(e)}updateHelp(t,e){const i=this._getElement("tcv_cad_help_layout");for(var n in t)i.innerHTML=i.innerHTML.replaceAll("<"+t[n].slice(0,-3)+">","<_"+e[n].slice(0,-3)+">");i.innerHTML=i.innerHTML.replaceAll("_shift","shift"),i.innerHTML=i.innerHTML.replaceAll("_ctrl","ctrl"),i.innerHTML=i.innerHTML.replaceAll("_alt","alt"),i.innerHTML=i.innerHTML.replaceAll("_meta","meta")}},t.Timer=Nm,t.Viewer=class{constructor(t,e,i,n=null,s=!0){this.notifyCallback=i,this.pinAsPngCallback=n,this.updateMarker=s,this.hasAnimationLoop=!1,this.setDisplayDefaults(e),e.keymap&&_p.set(e.keymap),this.display=t,window.THREE=op,this.nestedGroup=null,this.mapping=null,this.tree=null,this.bbox=null,this.bb_max=0,this.scene=null,this.camera=null,this.orthographicCamera=null,this.gridHelper=null,this.axesHelper=null,this.controls=null,this.orientationMarker=null,this.treeview=null,this.cadTools=new pm(this),this.newTreeBehavior=e.newTreeBehavior,this.ready=!1,this.mixer=null,this.animation=new tf("|"),this.continueAnimation=!0,this.clipNormals=[[-1,0,0],[0,-1,0],[0,0,-1]],this.camera_distance=0,this.mouse=new Ve,this.renderer=new ap({alpha:!this.dark,antialias:!0,stencil:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(this.cadWidth,this.height),this.renderer.setClearColor(16777215,0),this.renderer.autoClear=!1,this.lastNotification={},this.lastBbox=null,this.expandedTree=null,this.compactTree=null,this.expandedNestedGroup=null,this.compactNestedGroup=null,this.lastObject=null,this.lastSelection=null,this.lastPosition=null,this.bboxNeedsUpdate=!1,this.keepHighlight=!1,this.setPickHandler(!0),this.renderer.domElement.addEventListener("contextmenu",(t=>t.stopPropagation())),this.display.setupUI(this),this.display.addCadView(this.renderer.domElement),console.debug("three-cad-viewer: WebGL Renderer created"),window.viewer=this}version(){return"3.3.2"}setDisplayDefaults(t){for(var e in this.theme="light",this.cadWidth=800,this.treeWidth=250,this.height=600,this.pinning=!1,this.glass=!1,this.tools=!0,this.keymap={shift:"shiftKey",ctrl:"ctrlKey",meta:"metaKey"},this.newTreeBehavior=!0,t)null==this[e]?console.warn(`Unknown option "${e}" to create a viewer - ignored`):this[e]=t[e];"dark"===t.theme||"browser"==t.theme&&window.matchMedia("(prefers-color-scheme: dark)").matches?this.theme="dark":this.theme="light"}setRenderDefaults(t){for(var e in this.ambientIntensity=.5,this.directIntensity=.6,this.metalness=.7,this.roughness=.7,this.defaultOpacity=.5,this.edgeColor=7368816,this.normalLen=0,this.measureTools=!1,t)void 0===this[e]?console.warn(`Unknown option "${e}" to create a viewer - ignored`):this[e]=t[e];this.materialSettings={ambientIntensity:this.ambientIntensity,directIntensity:this.directIntensity,metalness:this.metalness,roughness:this.roughness}}setViewerDefaults(t){for(var e in this.axes=!1,this.axes0=!1,this.grid=[!1,!1,!1],this.ortho=!0,this.transparent=!1,this.blackEdges=!1,this.collapse=0,this.clipIntersection=!1,this.clipPlaneHelpers=!1,this.clipObjectColors=!1,this.clipNormal0=[-1,0,0],this.clipNormal1=[0,-1,0],this.clipNormal2=[0,0,-1],this.clipSlider0=-1,this.clipSlider1=-1,this.clipSlider2=-1,this.control="orbit",this.up="Z",this.ticks=10,this.centerGrid=!1,this.position=null,this.quaternion=null,this.target=null,this.measureTools=!0,this.zoom=1,this.panSpeed=.5,this.rotateSpeed=1,this.zoomSpeed=.5,this.timeit=!1,t)void 0===this[e]?console.warn(`Unknown option ${e} to add shapes - ignored`):this[e]=t[e]}dumpOptions(){console.log("Display:"),console.log("- cadWidth",this.cadWidth),console.log("- control",this.control),console.log("- height",this.height),console.log("- pinning",this.pinning),console.log("- theme",this.theme),console.log("- treeHeight",this.treeHeight),console.log("- treeWidth",this.treeWidth),console.log("Render:"),console.log("- ambientIntensity",this.ambientIntensity),console.log("- defaultOpacity",this.defaultOpacity),console.log("- directIntensity",this.directIntensity),console.log("- edgeColor",this.edgeColor),console.log("- normalLen",this.normalLen),console.log("View:"),console.log("- axes",this.axes),console.log("- axes0",this.axes0),console.log("- blackEdges",this.blackEdges),console.log("- clipIntersection",this.clipIntersection),console.log("- clipPlaneHelpers",this.clipPlaneHelpers),console.log("- clipObjectColors",this.clipObjectColors),console.log("- clipNormal0",this.clipNormal0),console.log("- clipNormal1",this.clipNormal1),console.log("- clipNormal2",this.clipNormal2),console.log("- clipSlider0",this.clipSlider0),console.log("- clipSlider1",this.clipSlider1),console.log("- clipSlider2",this.clipSlider2),console.log("- grid",this.grid),console.log("- ortho",this.ortho),console.log("- panSpeed",this.panSpeed),console.log("- position",this.position),console.log("- quaternion",this.quaternion),console.log("- rotateSpeed",this.rotateSpeed),console.log("- ticks",this.ticks),console.log("- timeit",this.timeit),console.log("- tools",this.tools),console.log("- glass",this.glass),console.log("- transparent",this.transparent),console.log("- zoom",this.zoom),console.log("- zoom0",this.controls.getZoom0()),console.log("- zoomSpeed",this.zoomSpeed)}_renderTessellatedShapes(t){const e=new Lm(t,this.cadWidth,this.height,this.edgeColor,this.transparent,this.defaultOpacity,this.metalness,this.roughness,this.normalLen);return t.bb&&(this.bbox=new wm(new vi(t.bb.xmin,t.bb.ymin,t.bb.zmin),new vi(t.bb.xmax,t.bb.ymax,t.bb.zmax))),e.render(),e}_getTree(t){const e=t=>{var i={};for(var n of t)null!=n.parts?i[n.name]=e(n.parts):i[n.name]=n.state;return i};var i={};return i[t.name]=e(t.parts),i}_decompose(t){const e=t.shape;var i;if(t.parts=[],"shapes"==t.type){var n,s={parts:[],loc:[[0,0,0],[0,0,0,1]],name:"faces",id:`${t.id}/faces`};const d=e.vertices,u=e.normals,p=e.triangles_per_face?e.triangles_per_face.length:e.triangles.length;var r=0;for(i=0;i<p;i++){e.triangles_per_face?(n=e.triangles.subarray(r,r+3*e.triangles_per_face[i]),r+=3*e.triangles_per_face[i]):n=e.triangles[i];for(var a=new Float32Array(3*n.length),o=new Float32Array(3*n.length),l=0;l<n.length;l++){var c=n[l];a[3*l]=d[3*c],a[3*l+1]=d[3*c+1],a[3*l+2]=d[3*c+2],o[3*l]=u[3*c],o[3*l+1]=u[3*c+1],o[3*l+2]=u[3*c+2]}var h={loc:[[0,0,0],[0,0,0,1]],name:`faces_${i}`,id:`${t.id}/faces/faces_${i}`,type:"shapes",color:t.color,alpha:t.alpha,renderback:!0,state:[1,3],accuracy:t.accuracy,bb:{},geomtype:e.face_types[i],subtype:t.subtype,exploded:!0,shape:{triangles:[...Array(n.length).keys()],vertices:a,normals:o,edges:[]}};t.texture&&(h.texture=t.texture),s.parts.push(h)}t.parts.push(s)}if("shapes"==t.type||"edges"==t.type){s={parts:[],loc:[[0,0,0],[0,0,0,1]],name:"edges",id:`${t.id}/edges`};const n=Array.isArray(t.color)&&t.color.length==e.edges.length;var d;const a=e.segments_per_edge?e.segments_per_edge.length:e.edges.length;var u;for(r=0,i=0;i<a;i++)e.segments_per_edge?(u=e.edges.subarray(r,r+6*e.segments_per_edge[i]),r+=6*e.segments_per_edge[i]):u=e.edges[i],d=n?t.color[i]:t.color,h={loc:[[0,0,0],[0,0,0,1]],name:`edges_${i}`,id:`${t.id}/edges/edges_${i}`,type:"edges",color:"shapes"==t.type?this.edgeColor:d,state:[3,1],width:"shapes"==t.type?1:t.width,bb:{},geomtype:e.edge_types[i],shape:{edges:u}},s.parts.push(h);s.parts.length>0&&t.parts.push(s)}s={parts:[],loc:[[0,0,0],[0,0,0,1]],name:"vertices",id:`${t.id}/vertices`};var p=e.obj_vertices;for(i=0;i<p.length/3;i++)h={loc:[[0,0,0],[0,0,0,1]],name:`vertices${i}`,id:`${t.id}/vertices/vertices${i}`,type:"vertices",color:"shapes"==t.type||"edges"==t.type?this.edgeColor:t.color,state:[3,1],size:"shapes"==t.type||"edges"==t.type?4:t.size,bb:{},shape:{obj_vertices:[p[3*i],p[3*i+1],p[3*i+2]]}},s.parts.push(h);return s.parts.length>0&&t.parts.push(s),delete t.shape,delete t.color,delete t.alpha,delete t.accuracy,delete t.renderBack,t}renderTessellatedShapes(t,e){const i=t=>{var e,n;if(2==t.version||3==t.version){var s,r;let a=[];for(s=0;s<t.parts.length;s++)null!=(e=t.parts[s]).shape&&(null==(n=e.shape).triangles||n.triangles instanceof Uint32Array||(n.triangles=new Uint32Array(n.triangles)),null==n.edges||n.edges instanceof Float32Array||(n.edges=new Float32Array(up(n.edges,3))),null==n.vertices||n.vertices instanceof Float32Array||(n.vertices=new Float32Array(n.vertices)),null==n.normals||n.normals instanceof Float32Array||(n.normals=new Float32Array(up(n.normals,2))),null==n.obj_vertices||n.obj_vertices instanceof Float32Array||(n.obj_vertices=new Float32Array(n.obj_vertices)),null==n.face_types||n.face_types instanceof Uint32Array||(n.face_types=new Uint32Array(n.face_types)),null==n.edge_types||n.edge_types instanceof Uint32Array||(n.edge_types=new Uint32Array(n.edge_types)),null==n.triangles_per_face||n.triangles_per_face instanceof Uint32Array||(n.triangles_per_face=new Uint32Array(n.triangles_per_face)),null==n.segments_per_edge||n.segments_per_edge instanceof Uint32Array||(n.segments_per_edge=new Uint32Array(n.segments_per_edge))),null!=e.parts?(r=i(e),a.push(r)):a.push(this._decompose(e));t.parts=a}return t};var n;return n=t?i(structuredClone(e)):structuredClone(e),{group:this._renderTessellatedShapes(n),tree:this._getTree(n)}}addAnimationTrack(t,e,i,n){this.animation.addTrack(t,this.nestedGroup.groups[t],e,i,n)}initAnimation(t,e,i="A",n=!0){null!=this.animation&&0!=this.animation.tracks.lenght?(console.debug("three-cad-viewer: Animation initialized"),this.hasAnimationLoop||this.toggleAnimationLoop(!0),this.display.showAnimationControl(!0),this.clipAction=this.animation.animate(this.nestedGroup.rootGroup,t,e,n),this.display.setAnimationLabel(i),this.display.resetAnimationSlider()):console.error("Animation does not have tracks")}hasAnimation(){return!!this.animation.clipAction}clearAnimation(){this.animation&&this.animation.dispose(),this.display.showAnimationControl(!1),this.toggleAnimationLoop(!1)}checkChanges=(t,e=!0)=>{var i={};Object.keys(t).forEach((e=>{if(!pp(this.lastNotification[e],t[e])){var n=dp(t[e]);i[e]={new:n,old:null==this.lastNotification[e]?null:dp(this.lastNotification[e])},this.lastNotification[e]=n}})),Object.keys(i).includes("position")&&(this.keepHighlight?this.keepHighlight=!1:this.display.clearHighlights()),e&&this.notifyCallback&&Object.keys(i).length&&this.notifyCallback(i)};notifyStates=()=>{this.checkChanges({states:this.getStates()},!0)};update=(t,e=!0)=>{this.ready&&(this.renderer.clear(),this.raycaster&&this.raycaster.raycastMode&&this.handleRaycast(),this.renderer.setViewport(0,0,this.cadWidth,this.height),this.renderer.render(this.scene,this.camera.getCamera()),this.cadTools.update(),this.directLight.position.copy(this.camera.getCamera().position),null!=this.lastBbox&&(this.lastBbox.needsUpdate||this.bboxNeedsUpdate)&&(console.log("updated bbox"),this.lastBbox.bbox.update(),this.lastBbox.needsUpdate=!1),t&&(this.renderer.clearDepth(),this.orientationMarker.update(this.camera.getPosition().clone().sub(this.controls.getTarget()),this.camera.getQuaternion()),this.orientationMarker.render(this.renderer)),this.animation&&this.animation.update(),this.checkChanges({zoom:this.camera.getZoom(),position:this.camera.getPosition().toArray(),quaternion:this.camera.getQuaternion().toArray(),target:this.controls.getTarget().toArray()},e))};animate=()=>{this.continueAnimation?(requestAnimationFrame(this.animate),this.controls.update(),this.update(!0,!0)):console.debug("three-cad-viewer: Animation loop stopped")};toggleAnimationLoop(t){t?(this.continueAnimation=!0,this.hasAnimationLoop=!0,this.controls.removeChangeListener(),console.debug("three-cad-viewer: Change listener removed"),this.animate(),console.debug("three-cad-viewer: Animation loop started")):(this.hasAnimationLoop&&console.debug("three-cad-viewer: Turning animation loop off"),this.continueAnimation=!1,this.hasAnimationLoop=!1,this.controls.addChangeListener((()=>this.update(!0,!0))),console.debug("three-cad-viewer: Change listener registered"),setTimeout((()=>this.update(!0,!0)),50))}dispose(){if(this.clear(),gp(this.shapes),this.shapes=null,null!=this.expandedNestedGroup&&(this.expandedNestedGroup.dispose(),this.expandedNestedGroup=null),null!=this.compactNestedGroup&&(this.compactNestedGroup.dispose(),this.compactNestedGroup=null),null!=this.nestedGroup&&(this.nestedGroup.dispose(),this.nestedGroup=null),this.gridHelper)for(var t in this.gridHelper.gridHelper)this.gridHelper.gridHelper[t].dispose(),this.gridHelper.gridHelper[t]=null;null!=this.orientationMarker&&this.orientationMarker.dispose(),null!=this.renderer&&(this.renderer.renderLists.dispose(),this.renderer.getContext("webgl2").getExtension("WEBGL_lose_context").loseContext(),console.debug("three-cad-viewer: WebGL context disposed"),this.renderer=null),this.ambientLight.dispose(),this.ambientLight=null,this.directLight.dispose(),this.directLight=null,this.materialSettings=null,this.clipping=null,this.camera=null,this.gridHelper=null,this.axesHelper=null,this.controls=null,this.orientationMarker=null,this.compactTree=null,this.cadTools.dispose(),this.cadTools=null,this.clipAction=null,this.treeview.dispose(),this.treeview=null,this.animation=null,this.clipNormals=null,this.lastNotification=null,this.orthographicCamera=null,this.clipNormal0=null,this.clipNormal1=null,this.clipNormal2=null,this.display=null,this.renderOptions=null,this.mouse=null,this.tree=null,this.info=null,this.bbox=null,this.keymap=null,this.raycaster&&(this.raycaster.dispose(),this.raycaster=null)}clear(){if(null!=this.scene){for(var t in this.hasAnimationLoop=!1,this.continueAnimation=!1,this.hasAnimationLoop||(this.controls.removeChangeListener(),console.debug("three-cad-viewer: Change listener removed")),this.hasAnimationLoop=!1,this.display.showAnimationControl(!1),null!=this.animation&&this.animation.dispose(),this.display.setExplodeCheck(!1),this.display.setExplode("",!1),this.renderer.clear(),this.cadTools&&(this.cadTools.disable(),null!=this.display.currentButton&&(this.display.toolbarButtons[this.display.currentButton].set(!1),this.display.setTool(this.display.currentButton,!1))),this.scene.children)null!=this.scene.children[t]&&(this.scene.children[t].dispose(),this.scene.children[t]=null);this.clipping.dispose(),this.clipping=null,this.display.clearCadTree(),this.info.dispose(),this.camera.dispose(),this.controls.dispose(),this.scene=null,this.ready=!1}}syncTreeStates=(t,e,i,n)=>{if(Array.isArray(t))if(i)for(var s in e)for(var r in e[s]){const i=`${n}/${s}/${r}`,o=this.expandedNestedGroup.groups[i];for(var a of[0,1])0==a?o.setShapeVisible(1==t[0]):o.setEdgesVisible(1==t[1]),3!=e[s][r][a]&&(e[s][r][a]=t[a])}else{const i=this.compactNestedGroup.groups[n];for(var a of[0,1]){var o=!1;for(var s in e)for(var r in e[s])1==e[s][r][a]&&(o=!0);0==a?i.setShapeVisible(o):i.setEdgesVisible(o),3!=t[a]&&(t[a]=o?1:0)}}else for(var l in t){var c=`${n}/${l}`;this.syncTreeStates(t[l],e[l],i,c)}};toggleGroup(t){var e,i=new Nm("toggleGroup",this.timeit),n=()=>{this.nestedGroup.setTransparent(this.transparent),this.nestedGroup.setBlackEdges(this.blackEdges),this.nestedGroup.setMetalness(this.metalness),this.nestedGroup.setRoughness(this.roughness),this.nestedGroup.setPolygonOffset(2)};null==this.compactNestedGroup&&!t||null==this.expandedNestedGroup&&t?(this.setRenderDefaults(this.renderOptions),t?null==this.expandedNestedGroup&&(e=this.renderTessellatedShapes(t,this.shapes),this.nestedGroup=e.group,this.expandedNestedGroup=e.group,n(),this.expandedTree=e.tree):null==this.compactNestedGroup&&(e=this.renderTessellatedShapes(t,this.shapes),this.nestedGroup=e.group,this.compactNestedGroup=e.group,n(),this.compactTree=e.tree),i.split(`rendered${t?" exploded":" compact"} shapes`)):(this.nestedGroup=t?this.expandedNestedGroup:this.compactNestedGroup,n());this.expandedTree&&this.syncTreeStates(this.compactTree,this.expandedTree,t,""),i.split("synched tree states"),this.tree=t?this.expandedTree:this.compactTree,this.scene.children[0]=this.nestedGroup.rootGroup,i.split("added shapes to scene"),this.treeview=new Vm(this.tree,this.display.cadTreeScrollContainer,this.setObject,this.handlePick,this.update,this.notifyStates,this.theme,this.newTreeBehavior,!1),this.display.clearCadTree();const s=this.treeview.create();i.split("created tree"),this.display.addCadTree(s),this.treeview.render(),i.split("rendered tree"),i.stop()}toggleTab(t){var e=new Nm("toggleTab",this.timeit);switch(this.display.selectTabByName("tree"),e.split("collapse tree"),this.collapse){case 0:this.treeview.expandAll();break;case 1:this.treeview.openLevel(-1);break;case 2:this.treeview.collapseAll();break;case 3:this.treeview.openLevel(1)}this.checkChanges({states:this.getStates()},!0),e.split("notify state changes"),e.stop(),this.display.toggleClippingTab(!t)}render(t,e,i){this.shapes=t,this.renderOptions=e,this.setViewerDefaults(i),this.animation.cleanBackup();const n=new Nm("viewer",this.timeit);this.scene=new js,this.toggleGroup(!1),n.split("scene and tree done"),this.bbox||(this.bbox=this.nestedGroup.boundingBox());const s=new vi;this.bbox.getCenter(s),this.bb_max=this.bbox.max_dist_from_center(),this.bb_radius=Math.max(this.bbox.boundingSphere().radius,s.length()),n.split("bounding box"),this.info=new ef(this.display.cadInfo,this.theme),this.camera=new hf(this.cadWidth,this.height,this.bb_radius,null==i.target?this.bbox.center():i.target,this.ortho,i.up),this.orthographicCamera=new ic(-10,10,-10,10,0,100),this.orthographicCamera.position.z=50,this.orthographicCamera.up=this.camera.up,this.controls=new of(this.control,this.camera.getCamera(),null==i.target?this.bbox.center():i.target,this.renderer.domElement,this.rotateSpeed,this.zoomSpeed,this.panSpeed),this.controls.enableKeys=!1,this.controls.controls.screenSpacePanning=!0,null==i.position&&null==i.quaternion?(this.presetCamera("iso",this.zoom),this.display.highlightButton("iso")):null!=i.position?(this.setCamera(!1,i.position,i.quaternion,this.zoom),null==i.quaternion&&this.camera.lookAtTarget()):(this.info.addHtml("<b>quaternion needs position to be provided, falling back to ISO view</b>"),this.presetCamera("iso",this.zoom)),this.controls.update(),this.controls.saveState(),this.ambientLight=new rc(16777215,vp(this.ambientIntensity)),this.scene.add(this.ambientLight),this.directLight=new sc(16777215,vp(this.directIntensity)),this.scene.add(this.directLight),this.setAmbientLight(this.ambientIntensity),this.setDirectLight(this.directIntensity),this.gridHelper=new Im(this.display,this.bbox,this.ticks,this.centerGrid,this.axes0,this.grid,"Z"==i.up,this.theme),this.gridHelper.computeGrid();for(var r=0;r<3;r++)this.scene.add(this.gridHelper.gridHelper[r]);this.gridSize=this.gridHelper.size,this.axesHelper=new Um(this.bbox.center(),this.gridSize/2,2,this.cadWidth,this.height,this.axes0,this.axes,this.theme),this.scene.add(this.axesHelper);const a=1.1*Math.max(Math.abs(this.bbox.min.length()),Math.abs(this.bbox.max.length()));this.clipping=new Km(this.bbox.center(),2*a,this.nestedGroup,this.display,this.theme),this.display.setSliderLimits(this.gridSize/2,this.bbox.center()),this.setClipNormal(0,i.clipNormal0,null,!0),this.setClipNormal(1,i.clipNormal1,null,!0),this.setClipNormal(2,i.clipNormal2,null,!0),this.clipSlider0=null!=i.clipSlider0?i.clipSlider0:this.gridSize/2,this.clipSlider1=null!=i.clipSlider1?i.clipSlider1:this.gridSize/2,this.clipSlider2=null!=i.clipSlider2?i.clipSlider2:this.gridSize/2,this.setClipSlider(0,this.clipSlider0,!0),this.setClipSlider(1,this.clipSlider1,!0),this.setClipSlider(2,this.clipSlider2,!0),this.setClipIntersection(i.clipIntersection,!0),this.setClipObjectColorCaps(i.clipObjectColors,!0),this.setClipPlaneHelpersCheck(i.clipPlaneHelpers,!0),this.scene.add(this.clipping.planeHelpers),this.nestedGroup.setClipPlanes(this.clipping.clipPlanes),this.setLocalClipping(!1),this.clipping.setVisible(!1),this.toggleTab(!1),this.display.metalnessSlider.setValue(100*this.metalness),this.display.roughnessSlider.setValue(100*this.roughness),this.display.ambientlightSlider.setValue(100*this.ambientIntensity),this.display.directionallightSlider.setValue(100*this.directIntensity);const o="dark"===this.theme||"browser"===this.theme&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";this.orientationMarker=new Dm(80,80,this.camera.getCamera(),o),this.orientationMarker.create(),this.display.updateUI(this.axes,this.axes0,this.ortho,this.transparent,this.blackEdges,this.tools,this.glass),n.split("ui updated"),this.display.autoCollapse(),n.split("stencil done"),this.toggleAnimationLoop(this.hasAnimationLoop),this.display.showMeasureTools(i.measureTools),this.ready=!0,this.info.readyMsg(this.gridHelper.ticks,this.control),n.split("show done"),this.notifyCallback&&this.notifyCallback({tab:{old:null,new:this.display.activeTab},target:{old:null,new:this.controls.target},target0:{old:null,new:this.controls.target0},clip_normal_0:{old:null,new:this.clipNormal0},clip_normal_1:{old:null,new:this.clipNormal1},clip_normal_2:{old:null,new:this.clipNormal2}}),n.split("notification done"),this.update(!0,!1),this.treeview.update(),n.split("update done"),n.stop()}setCamera=(t,e,i=null,n=null,s=!0)=>{this.camera.setupCamera(t,new vi(...e),null!=i?new gi(...i):null,n,s),this.update(!0,s)};presetCamera=(t,e=null,i=!0)=>{this.camera.target=new vi(...this.bbox.center()),this.camera.presetCamera(t,e,i),this.controls.setTarget(this.camera.target),this.update(!0,i)};getCameraType(){return this.camera.ortho?"ortho":"perspective"}switchCamera(t,e=!0){this.ortho=t,this.camera.switchCamera(t,e),this.controls.setCamera(this.camera.getCamera()),this.display.setOrthoCheck(t),this.checkChanges({ortho:t},e),this.update(!0,e)}recenterCamera(t=!0){const e=this.camera.getCamera(),i=new vi,n=this.bbox.center();i.fromArray(n);const s=new vi,r=this.controls.target;s.fromArray(r),this.camera.camera_distance=5*this.bb_radius,e.position.sub(s).add(i),this.controls.controls.target=i;let a=new vi;e.getWorldDirection(a);let o=i.clone().add(a.normalize().multiplyScalar(-this.camera.camera_distance));e.position.set(o.x,o.y,o.z),this.update(!0,t)}resize=()=>{this.camera.setZoom(1),this.camera.updateProjectionMatrix(),this.update(!0)};reset=()=>{this.controls.reset(),this.update(!0)};setLocalClipping(t){this.renderer.localClippingEnabled=t,this.update(this.updateMarker)}setObject=(t,e,i,n=!0,s=!0)=>{var r=this.nestedGroup.groups[t];null!=r&&r instanceof Am&&(0==i?r.setShapeVisible(1===e):r.setEdgesVisible(1===e),n&&this.getState(t),s&&this.update(this.updateMarker))};setBoundingBox=t=>{var e=this.nestedGroup.groups[t];null!=e&&(null!=this.lastBbox&&this.scene.remove(this.lastBbox.bbox),null==this.lastBbox||null!=this.lastBbox&&t!=this.lastBbox.id?(this.lastBbox={id:t,bbox:new bm(e,16711935),needsUpdate:!1},this.scene.add(this.lastBbox.bbox)):this.lastBbox=null,this.update(!1,!1,!1))};refreshPlane=(t,e)=>{this.clipping.setConstant(t,e),this.update(this.updateMarker)};backupAnimation(){this.animation.hasTracks()&&(this.backupTracks=this.animation.backup())}restoreAnimation(){if(this.animation.hasBackup()){var t=this.animation.restore();this.initAnimation(t.duration,t.speed,"A",t.repeat)}}controlAnimation=t=>{switch(t){case"play":this.clipAction.paused&&(this.clipAction.paused=!1),this.clipAction.play();break;case"pause":this.clipAction.paused=!this.clipAction.paused;break;case"stop":this.clipAction.stop()}};setState=(t,e,i="leaf",n=!0)=>{this.treeview.setState(t,e),this.update(this.updateMarker,n)};removeLastBbox(){null!=this.lastBbox&&(this.scene.remove(this.lastBbox.bbox),this.lastBbox=null)}handlePick=(t,e,i,n,s,r,a="leaf")=>{const o=`${t}/${e}`,l=this.nestedGroup.groups[o];if(null!=l){var c;if(null!=l.parent)c=(new wm).setFromObject(l,!0);else{c=new wm;for(var h=0;h<l.children.length-1;h++)c=c.expandByObject(l.children[h])}if(null==this.lastBbox||this.lastBbox.id!==o||i||n)if(this.checkChanges({lastPick:{path:t,name:e,boundingBox:c,boundingSphere:c.boundingSphere()}}),this.animation.clipAction?.isRunning()&&(this.bboxNeedsUpdate=!0),n&&i)this.removeLastBbox(),this.treeview.openPath(o),this.setCameraTarget(r),this.info.centerInfo(center);else if(n){this.removeLastBbox(),this.treeview.hideAll(),this.setState(o,[1,1],a);const t=c.center();this.treeview.openPath(o),this.setCameraTarget(new vi(...t)),this.info.centerInfo(t)}else i?this.setState(o,[0,0],a):(this.info.bbInfo(t,e,c),this.setBoundingBox(o),this.treeview.openPath(o));else this.removeLastBbox(),this.treeview.toggleLabelColor(null,o);this.update(!0)}};setPickHandler(t){t?this.renderer.domElement.addEventListener("dblclick",this.pick,!1):this.renderer.domElement.removeEventListener("dblclick",this.pick,!1)}pick=t=>{const e=new Kp(this.camera,this.renderer.domElement,this.cadWidth,this.height,this.bb_max/30,this.scene.children.slice(0,1),(t=>{}));e.init(),e.onPointerMove(t);const i=e.getIntersectedObjs(t);if(0==i.length)return;var n=i[0];const s={path:n.object.parent.parent.name.replaceAll("|","/"),name:n.object.name,boundingBox:n.object.geometry.boundingBox,boundingSphere:n.object.geometry.boundingSphere,objectGroup:n.object.parent};null!=s&&this.handlePick(s.path,s.name,_p.get(t,"meta"),_p.get(t,"shift"),_p.get(t,"alt"),n.point),e.dispose()};clearSelection=()=>{this.nestedGroup.clearSelection(),this.cadTools.handleResetSelection()};_releaseLastSelected=t=>{if(null!=this.lastObject){let e=this.lastObject.objs();for(let t of e)t.unhighlight(!0);t&&(this.lastObject=null)}};_removeLastSelected=()=>{if(null!=this.lastSelection){let t=this.lastSelection.objs();for(let e of t)e.unhighlight(!1),this.treeview.toggleLabelColor(null,e.name.replaceAll(this.nestedGroup.delim,"/"));this.lastSelection=null,this.cadTools.handleRemoveLastSelection(),this.lastObject=null}else this.cadTools.handleRemoveLastSelection(!0)};setRaycastMode(t){t?(this.raycaster=new Kp(this.camera,this.renderer.domElement,this.cadWidth,this.height,this.bb_max/30,this.scene.children.slice(0,1),this.handleRaycastEvent),this.raycaster.init()):(this.raycaster&&this.raycaster.dispose(),this.raycaster=null)}handleRaycast=()=>{const t=this.raycaster.getValidIntersectedObjs();if(t.length>0)for(var e of t){const t=e.object.parent;var i=t?t.name:null,n=this.lastObject?this.lastObject.obj.name:null;if(null!=i&&i!==n){this._releaseLastSelected(!1);const e=this.raycaster.filters.topoFilter.includes(Wp.solid),i=new $p(t,e);for(let t of i.objs())t.highlight(!0);this.lastObject=i}break}else null!=this.lastObject&&this._releaseLastSelected(!0)};handleRaycastEvent=t=>{if(t.key)switch(t.key){case"Escape":this.clearSelection();break;case"Backspace":this._removeLastSelected()}else switch(t.mouse){case"left":if(null!=this.lastObject){const e=this.lastObject.objs();for(let t of e)t.toggleSelection();this.lastSelection?.obj.name!=this.lastObject.obj.name&&this.cadTools.handleRemoveLastSelected(),this.cadTools.handleSelectedObj(this.lastObject),t.shift&&this.treeview.openPath(this.lastObject.obj.name.replaceAll(this.nestedGroup.delim,"/")),this.lastSelection=this.lastObject}break;case"right":this._removeLastSelected()}};handleBackendResponse=t=>{"tool_response"===t.subtype&&this.cadTools.handleResponse(t)};getAxes(){return this.axes}setAxes=(t,e=!0)=>{this.axes=t,this.axesHelper.setVisible(t),this.display.setAxesCheck(t),this.checkChanges({axes:t},e),this.update(this.updateMarker)};setGrid=(t,e,i=!0)=>{this.gridHelper.setGrid(t,e),this.checkChanges({grid:this.gridHelper.grid},i),this.update(this.updateMarker)};getGrids(){return this.grid}setGrids=(t,e=!0)=>{this.gridHelper.setGrids(...t),this.grid=this.gridHelper.grid,this.checkChanges({grid:this.gridHelper.grid},e),this.update(this.updateMarker)};setGridCenter=(t,e=!0)=>{this.gridHelper.centerGrid=t,this.gridHelper.setCenter(this.axes0,"Z"==this.up),this.checkChanges({gridCenter:this.gridHelper.centerGrid},e),this.update(this.updateMarker)};getAxes0(){return this.axes0}setAxes0=(t,e=!0)=>{this.axes0=t,this.gridHelper.setCenter(t,"Z"==this.up),this.display.setAxes0Check(t),this.axesHelper.setCenter(t),this.checkChanges({axes0:t},e),this.update(this.updateMarker)};getAmbientLight(){return this.ambientIntensity}setAmbientLight=(t,e=!1,i=!0)=>{this.ambientIntensity=t,this.ambientLight.intensity=vp(t),this.checkChanges({ambient_intensity:t},i),this.update(this.updateMarker,i),e&&this.display.setAmbientLight(t)};getDirectLight(){return this.directIntensity}setDirectLight=(t,e=!1,i=!0)=>{this.directIntensity=t,this.directLight.intensity=vp(t),this.checkChanges({direct_intensity:t},i),this.update(this.updateMarker,i),e&&this.display.setDirectLight(t)};getMetalness=()=>this.metalness;setMetalness=(t,e=!1,i=!0)=>{this.metalness=t,this.nestedGroup.setMetalness(t),this.checkChanges({metalness:t},i),this.update(this.updateMarker),e&&this.display.setMetalness(t)};getRoughness=()=>this.roughness;setRoughness=(t,e=!1,i=!0)=>{this.roughness=t,this.nestedGroup.setRoughness(t),this.checkChanges({roughness:t},i),this.update(this.updateMarker),e&&this.display.setRoughness(t)};resetMaterial=()=>{this.setMetalness(this.materialSettings.metalness,!0,!0),this.setRoughness(this.materialSettings.roughness,!0,!0),this.setAmbientLight(this.materialSettings.ambientIntensity,!0,!0),this.setDirectLight(this.materialSettings.directIntensity,!0,!0)};getTransparent(){return this.transparent}setTransparent=(t,e=!0)=>{this.transparent=t,this.nestedGroup.setTransparent(t),this.display.setTransparentCheck(t),this.checkChanges({transparent:t},e),this.update(this.updateMarker)};getBlackEdges(){return this.blackEdges}setBlackEdges=(t,e=!0)=>{this.blackEdges=t,this.nestedGroup.setBlackEdges(t),this.display.setBlackEdgesCheck(t),this.checkChanges({black_edges:t},e),this.update(this.updateMarker)};getOrtho(){return this.camera.ortho}setOrtho(t,e=!0){this.switchCamera(t,e)}getCameraZoom(){return this.camera.getZoom()}setCameraZoom(t,e=!0){this.camera.setZoom(t),this.controls.update(),this.update(!0,e)}getCameraPosition(){return this.camera.getPosition().toArray()}setCameraPosition(t,e=!1,i=!0){this.camera.setPosition(t,e),this.controls.update(),this.update(!0,i)}getCameraQuaternion(){return this.camera.getQuaternion().toArray()}setCameraQuaternion(t,e=!0){this.camera.setQuaternion(t),this.controls.update(),this.update(!0,e)}getCameraTarget(){return this.controls.getTarget().toArray()}setCameraTarget(t,e=!0){this.camera.getCamera().lookAt(new vi(...t)),this.controls.setTarget(new vi(...t)),this.controls.update(),this.update(!0,e)}getCameraLocationSettings(){return{position:this.getCameraPosition(),quaternion:this.getCameraQuaternion(),target:this.getCameraTarget(),zoom:this.getCameraZoom()}}setCameraLocationSettings(t=null,e=null,i=null,n=null,s=!0){null!=t&&this.camera.setPosition(t,!1),null!=e&&"trackball"===this.control&&this.camera.setQuaternion(e),null!=i&&this.controls.setTarget(new vi(...i)),null!=n&&this.camera.setZoom(n),this.controls.update(),this.update(!0,s)}getEdgeColor(){return this.edgeColor}setEdgeColor=(t,e=!0)=>{this.edgeColor=t,this.nestedGroup.setEdgeColor(t),this.update(this.updateMarker,e)};getOpacity(){return this.defaultOpacity}setOpacity=(t,e=!0)=>{this.defaultOpacity=t,this.nestedGroup.setOpacity(t),this.update(this.updateMarker,e)};getTools(){return this.tools}showTools=(t,e=!0)=>{this.tools=t,this.display.showTools(t),this.update(this.updateMarker,e)};getStates(){return this.treeview.getStates()}getState(t){var e=t.replaceAll("|","/");return this.treeview.getState(e)}setStates=t=>{this.treeview.setStates(t)};getZoomSpeed(){return this.zoomSpeed}setZoomSpeed=(t,e=!0)=>{this.zoomSpeed=t,this.controls.setZoomSpeed(t),this.checkChanges({grid:this.gridHelper.grid},e)};getPanSpeed(){return this.panSpeed}setPanSpeed=(t,e=!0)=>{this.panSpeed=t,this.controls.setPanSpeed(t),this.checkChanges({grid:this.gridHelper.grid},e)};getRotateSpeed(){return this.rotateSpeed}setRotateSpeed=(t,e=!0)=>{this.rotateSpeed=t,this.controls.setRotateSpeed(t),this.checkChanges({grid:this.gridHelper.grid},e)};getClipIntersection(){return this.clipIntersection}setClipIntersection=(t,e=!0)=>{if(null!=t){for(var i of(this.clipIntersection=t,this.nestedGroup.setClipIntersection(t),this.display.setClipIntersectionCheck(t),this.nestedGroup.rootGroup.children))if("PlaneMeshes"==i.name)for(var n of i.children)n.material.clippingPlanes=t?this.clipping.reverseClipPlanes.filter(((t,e)=>e!==n.index)):this.clipping.clipPlanes.filter(((t,e)=>e!==n.index));for(i of this.scene.children)if("PlaneHelpers"==i.name)for(var s of i.children)s.material.clippingPlanes=t?this.clipping.reverseClipPlanes.filter(((t,e)=>e!==s.index)):this.clipping.clipPlanes.filter(((t,e)=>e!==s.index));this.checkChanges({clip_intersection:t},e),this.update(this.updateMarker)}};getObjectColorCaps=()=>this.clipping.getObjectColorCaps();setClipObjectColorCaps=(t,e=!0)=>{null!=t&&(this.clipping.setObjectColorCaps(t),this.display.setClipObjectColorsCheck(t),this.checkChanges({clip_object_colors:t},e),this.update(this.updateMarker))};getClipPlaneHelpers(){return this.clipPlaneHelpers}setClipPlaneHelpersCheck(t){null!=t&&this.display.setClipPlaneHelpersCheck(t)}setClipPlaneHelpers=(t,e=!0)=>{null!=t&&(this.clipPlaneHelpers=t,this.clipping.planeHelpers.visible=t,this.display.setClipPlaneHelpersCheck(t),this.checkChanges({clip_planes:t},e),this.update(this.updateMarker))};getClipNormal(t){return this.clipNormals[t]}setClipNormal(t,e,i=null,n=!0){if(null==e)return;const s=new vi(...e).normalize().toArray();this.clipNormals[t]=s,this.clipping.setNormal(t,new vi(...s)),this.clipping.setConstant(t,this.gridSize/2),null==i&&(i=this.gridSize/2),this.setClipSlider(t,i);var r={};r[`clip_normal_${t}`]=s,r[`clip_slider_${t}`]=i,this.checkChanges(r,n),this.nestedGroup.setClipPlanes(this.clipping.clipPlanes),this.update(this.updateMarker)}setClipNormalFromPosition=(t,e=!0)=>{const i=this.camera.getPosition().clone().sub(this.controls.getTarget()).normalize().negate().toArray();this.setClipNormal(t,i,null,e);var n={};n[`clip_normal_${t}`]=i,this.checkChanges(n,e)};getClipSlider=t=>this.display.clipSliders[t].getValue();setClipSlider=(t,e,i=!0)=>{-1!=e&&null!=e&&this.display.clipSliders[t].setValue(e,i)};getResetLocation=()=>{const t=this.controls.getResetLocation();return{target0:t.target0.toArray(),position0:t.position0.toArray(),quaternion0:t.quaternion0.toArray(),zoom0:t.zoom0}};setResetLocation=(t,e,i,n,s=!0)=>{var r=this.getResetLocation();this.controls.setResetLocation(new vi(...t),new vi(...e),new di(...i),n),s&&this.notifyCallback&&this.notifyCallback({target0:{old:r.target0,new:t},position0:{old:r.position0,new:e},quaternion0:{old:r.quaternion0,new:i},zoom0:{old:r.zoom0,new:n}})};pinAsPng=()=>{this.getImage("screenshot").then((t=>{var e=document.createElement("img");if(e.width=this.cadWidth,e.height=this.height,e.src=t.dataUrl,null==this.pinAsPngCallback){for(var i of this.display.container.children)this.display.container.removeChild(i);this.display.container.appendChild(e)}}))};getImage=t=>{const e=this.hasAnimationLoop;return e||this.toggleAnimationLoop(!0),this.orientationMarker.setVisible(!1),this.update(!0),new Promise(((i,n)=>{const s=this.display.getCanvas();this.renderer.setViewport(0,0,this.cadWidth,this.height),this.renderer.render(this.scene,this.camera.getCamera()),s.toBlob((n=>{let s=new FileReader;s.addEventListener("load",(()=>{i({task:t,dataUrl:s.result}),e||this.toggleAnimationLoop(!1),this.orientationMarker.setVisible(!0),this.update(!0)}),{once:!0}),s.readAsDataURL(n)}))}))};explode(t=2,e=1,i=2.5){this.clearAnimation();const n=this.getAxes0();var s=new vi,r=new vi,a=null,o=null,l=null;n||(new xi).setFromObject(this.nestedGroup.rootGroup).getCenter(s);for(var c in this.nestedGroup.groups){var h=this.nestedGroup.groups[c],d=new xi;h instanceof Am&&d.expandByObject(h),d.isEmpty()||(d.getCenter(r),a=r.sub(s),o=h.parent.worldToLocal(a.clone()),(l=h.parent.worldToLocal(a.clone().multiplyScalar(i))).sub(o),this.addAnimationTrack(c,"t",[0,t],[[0,0,0],l.toArray()]))}this.initAnimation(t,e,"E",!1)}trimUI(t,e){var i=e?"inline-block":"none";for(var n of t){var s;["axes","axes0","grid","ortho","more","help"].includes(n)&&("more"!=n?((s=this.display._getElement(`tcv_${n}`)).style.display=i,"help"!==n&&(s.nextElementSibling.style.display=i)):(s=this.display._getElement(`tcv_${n}-dropdown`)).style.display=i)}}setKeyMap(t){const e=_p.get_config();_p.set(t),this.display.updateHelp(e,t)}resizeCadView(t,e,i,n=!1){this.cadWidth=t,this.height=i,this.renderer.setSize(t,i),this.display.setSizes({treeWidth:e,cadWidth:t,height:i}),this.display.glassMode(n);const s=t+(n?0:e);this.display.handleMoreButton(s),this.camera.changeDimensions(this.bb_radius,t,i),this.update(!0),this.raycaster&&(this.raycaster.width=t,this.raycaster.height=i)}vector3(t=0,e=0,i=0){return new vi(t,e,i)}quaternion(t=0,e=0,i=0,n=1){return new gi(t,e,i,n)}}}));
|