1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,55838,(e,t,n)=>{"use strict";var r=e.r(71645),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=r.useState,o=r.useEffect,l=r.useLayoutEffect,s=r.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!a(e,n)}catch(e){return!0}}var c="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),a=r[0].inst,c=r[1];return l(function(){a.value=n,a.getSnapshot=t,u(a)&&c({inst:a})},[e,n,t]),o(function(){return u(a)&&c({inst:a}),e(function(){u(a)&&c({inst:a})})},[e]),s(n),n};n.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:c},2239,(e,t,n)=>{"use strict";e.i(47167),t.exports=e.r(55838)},52822,(e,t,n)=>{"use strict";var r=e.r(71645),a=e.r(2239),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=a.useSyncExternalStore,l=r.useRef,s=r.useEffect,u=r.useMemo,c=r.useDebugValue;n.useSyncExternalStoreWithSelector=function(e,t,n,r,a){var d=l(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;var p=o(e,(d=u(function(){function e(e){if(!s){if(s=!0,o=e,e=r(e),void 0!==a&&f.hasValue){var t=f.value;if(a(t,e))return l=t}return l=e}if(t=l,i(o,e))return t;var n=r(e);return void 0!==a&&a(t,n)?(o=e,t):(o=e,l=n)}var o,l,s=!1,u=void 0===n?null:n;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,n,r,a]))[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),c(p),p}},30224,(e,t,n)=>{"use strict";e.i(47167),t.exports=e.r(52822)},66936,(e,t,n)=>{"use strict";function r(e,t){var n=e.length;for(e.push(t);0<n;){var r=n-1>>>1,a=e[r];if(0<o(a,t))e[r]=t,e[n]=a,n=r;else break}}function a(e){return 0===e.length?null:e[0]}function i(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;for(var r=0,a=e.length,i=a>>>1;r<i;){var l=2*(r+1)-1,s=e[l],u=l+1,c=e[u];if(0>o(s,n))u<a&&0>o(c,s)?(e[r]=c,e[u]=n,r=u):(e[r]=s,e[l]=n,r=l);else if(u<a&&0>o(c,n))e[r]=c,e[u]=n,r=u;else break}}return t}function o(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(n.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var l,s=performance;n.unstable_now=function(){return s.now()}}else{var u=Date,c=u.now();n.unstable_now=function(){return u.now()-c}}var d=[],f=[],p=1,m=null,h=3,g=!1,v=!1,_=!1,S=!1,x="function"==typeof setTimeout?setTimeout:null,E="function"==typeof clearTimeout?clearTimeout:null,b="u">typeof setImmediate?setImmediate:null;function T(e){for(var t=a(f);null!==t;){if(null===t.callback)i(f);else if(t.startTime<=e)i(f),t.sortIndex=t.expirationTime,r(d,t);else break;t=a(f)}}function M(e){if(_=!1,T(e),!v)if(null!==a(d))v=!0,y||(y=!0,l());else{var t=a(f);null!==t&&D(M,t.startTime-e)}}var y=!1,R=-1,C=5,A=-1;function w(){return!!S||!(n.unstable_now()-A<C)}function P(){if(S=!1,y){var e=n.unstable_now();A=e;var t=!0;try{e:{v=!1,_&&(_=!1,E(R),R=-1),g=!0;var r=h;try{t:{for(T(e),m=a(d);null!==m&&!(m.expirationTime>e&&w());){var o=m.callback;if("function"==typeof o){m.callback=null,h=m.priorityLevel;var s=o(m.expirationTime<=e);if(e=n.unstable_now(),"function"==typeof s){m.callback=s,T(e),t=!0;break t}m===a(d)&&i(d),T(e)}else i(d);m=a(d)}if(null!==m)t=!0;else{var u=a(f);null!==u&&D(M,u.startTime-e),t=!1}}break e}finally{m=null,h=r,g=!1}}}finally{t?l():y=!1}}}if("function"==typeof b)l=function(){b(P)};else if("u">typeof MessageChannel){var U=new MessageChannel,L=U.port2;U.port1.onmessage=P,l=function(){L.postMessage(null)}}else l=function(){x(P,0)};function D(e,t){R=x(function(){e(n.unstable_now())},t)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(e){e.callback=null},n.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):C=0<e?Math.floor(1e3/e):5},n.unstable_getCurrentPriorityLevel=function(){return h},n.unstable_next=function(e){switch(h){case 1:case 2:case 3:var t=3;break;default:t=h}var n=h;h=t;try{return e()}finally{h=n}},n.unstable_requestPaint=function(){S=!0},n.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=h;h=e;try{return t()}finally{h=n}},n.unstable_scheduleCallback=function(e,t,i){var o=n.unstable_now();switch(i="object"==typeof i&&null!==i&&"number"==typeof(i=i.delay)&&0<i?o+i:o,e){case 1:var s=-1;break;case 2:s=250;break;case 5:s=0x3fffffff;break;case 4:s=1e4;break;default:s=5e3}return s=i+s,e={id:p++,callback:t,priorityLevel:e,startTime:i,expirationTime:s,sortIndex:-1},i>o?(e.sortIndex=i,r(f,e),null===a(d)&&e===a(f)&&(_?(E(R),R=-1):_=!0,D(M,i-o))):(e.sortIndex=s,r(d,e),v||g||(v=!0,y||(y=!0,l()))),e},n.unstable_shouldYield=w,n.unstable_wrapCallback=function(e){var t=h;return function(){var n=h;h=t;try{return e.apply(this,arguments)}finally{h=n}}}},89499,(e,t,n)=>{"use strict";e.i(47167),t.exports=e.r(66936)},88727,e=>{"use strict";let t,n,r,a,i,o,l,s,u,c,d,f;var p,m,h,g,v,_=e.i(43476),S=e.i(47167),x=e.i(71645),E=e.i(90072),b=E;function T(){let e=null,t=!1,n=null,r=null;function a(t,i){n(t,i),r=e.requestAnimationFrame(a)}return{start:function(){!0===t||null===n||null!==e&&(r=e.requestAnimationFrame(a),t=!0)},stop:function(){null!==e&&e.cancelAnimationFrame(r),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function M(e){let t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);let r=t.get(n);r&&(e.deleteBuffer(r.buffer),t.delete(n))},update:function(n,r){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){let e=t.get(n);
1(!e||e.version<n.version)&&t.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version});return}let a=t.get(n);if(void 0===a)t.set(n,function(t,n){let r,a=t.array,i=t.usage,o=a.byteLength,l=e.createBuffer();if(e.bindBuffer(n,l),e.bufferData(n,a,i),t.onUploadCallback(),a instanceof Float32Array)r=e.FLOAT;else if("u">typeof Float16Array&&a instanceof Float16Array)r=e.HALF_FLOAT;else if(a instanceof Uint16Array)r=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(a instanceof Int16Array)r=e.SHORT;else if(a instanceof Uint32Array)r=e.UNSIGNED_INT;else if(a instanceof Int32Array)r=e.INT;else if(a instanceof Int8Array)r=e.BYTE;else if(a instanceof Uint8Array)r=e.UNSIGNED_BYTE;else if(a instanceof Uint8ClampedArray)r=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+a);return{buffer:l,type:r,bytesPerElement:a.BYTES_PER_ELEMENT,version:t.version,size:o}}(n,r));else if(a.version<n.version){if(a.size!==n.array.byteLength)throw 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(t,n,r){let a=n.array,i=n.updateRanges;if(e.bindBuffer(r,t),0===i.length)e.bufferSubData(r,0,a);else{i.sort((e,t)=>e.start-t.start);let t=0;for(let e=1;e<i.length;e++){let n=i[t],r=i[e];r.start<=n.start+n.count+1?n.count=Math.max(n.count,r.start+r.count-n.start):i[++t]=r}i.length=t+1;for(let t=0,n=i.length;t<n;t++){let n=i[t];e.bufferSubData(r,n.start*a.BYTES_PER_ELEMENT,a,n.start,n.count)}n.clearUpdateRanges()}n.onUploadCallback()}(a.buffer,n,r),a.version=n.version}}}}let y={alphahash_fragment:"#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n #ifdef ALPHA_TO_COVERAGE\n diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n if ( diffuseColor.a < alphaTest ) discard;\n #endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n #if ! defined( GL_ANGLE_multi_draw )\n #define gl_DrawID _gl_DrawID\n uniform int _gl_DrawID;\n #endif\n uniform highp sampler2D batchingTexture;\n uniform highp usampler2D batchingIdTexture;\n mat4 getBatchingMatrix( const in float i ) {\n int size = textureSize( batchingTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n float getIndirectIndex( const in int i ) {\n int size = textureSize( batchingIdTexture, 0 ).x;\n int x = i % size;\n int y = i / size;\n return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n }\n#endif\n#ifdef USE_BATCHING_COLOR\n uniform sampler2D batchingColorTexture;\n vec4 getBatchingColor( const in float i ) {\n int size = textureSize( batchingColorTexture, 0 ).x;\n int j = int( i );\n int x = j % size;\n int y = j / size;\n return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );\n }\n#endif",batching_vertex:"#ifdef USE_BATCHING\n mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return 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 vec3 halfDir = normalize( lightDir + viewDir );
1\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n xyz.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 xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );
1\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec4 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n vColor = vec4( 1.0 );\n#endif\n#ifdef USE_COLOR_ALPHA\n vColor *= color;\n#elif defined( USE_COLOR )\n vColor.rgb *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.rgb *= instanceColor.rgb;\n#endif\n#ifdef USE_BATCHING_COLOR\n vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );\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 const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\n#define inverseTransformDirection transformDirectionByInverseViewMatrix\nvec3 transformNormalByInverseViewMatrix( in vec3 normal, in mat4 viewMatrix ) {\n return normalize( ( vec4( normal, 0.0 ) * viewMatrix ).xyz );\n}\nvec3 transformDirectionByInverseViewMatrix( in vec3 dir, in mat4 viewMatrix ) {\n return normalize( ( vec4( dir, 0.0 ) * viewMatrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );
1\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n emissiveColor = sRGBTransferEOTF( emissiveColor );\n #endif\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n return 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 return 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 #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * reflectVec );\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );
1\n reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n reflectVec = transformDirectionByInverseViewMatrix( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n }
1 else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform 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 vec3 diffuseColor;\n float 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 float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.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 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = transformNormalByInverseViewMatrix( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }
1\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif\n#include <lightprobes_pars_fragment>",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 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 vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.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 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_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 vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float 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 float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.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 reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = 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 material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = vec3( 0.04 );\n material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;
1\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n vec3 diffuseContribution;\n vec3 specularColor;\n vec3 specularColorBlended;\n float roughness;\n float metalness;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n vec3 iridescenceFresnelDielectric;\n vec3 iridescenceFresnelMetallic;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #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 float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float 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 float gv = dotNL * length( vec3( alphaT * dotTV, alph
1aB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColorBlended;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x >
1 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return 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 vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return 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 vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float rInv = 1.0 / ( roughness + 0.1 );\n float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n float DG = exp( a * dotNV + b );\n return saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n return 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 float dotNV = saturate( dot( normal, viewDir ) );\n vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
1\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n float Ess_V = dfgV.x + dfgV.y;\n float Ess_L = dfgL.x + dfgL.y;\n float Ems_V = 1.0 - Ess_V;\n float Ems_L = 1.0 - Ess_L;\n vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n float compensationFactor = Ems_V * Ems_L;\n vec3 multiScatter = Fms * compensationFactor;\n return singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void 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 vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n #ifdef USE_CLEARCOAT\n vec3 Ncc = geometryClearcoatNormal;\n vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n mat3 mInvClearcoat = mat3(\n vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n vec3( 0, 1, 0 ),\n vec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n );\n vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n #endif\n }\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 float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n \n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n irradiance *= sheenEnergyComp;\n \n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\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 vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n diffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectDiffuse += diffuse;\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 #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n #endif\n vec3 singleScatteringDielectric = vec3( 0.0 );\n vec3 multiScatteringDielectric = vec3( 0.0 );\n vec3 singleScatteringMetallic = vec3( 0.0 );\n vec3 multiScatteringMetallic = vec3( 0.0 );
1\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n #endif\n vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n vec3 indirectSpecular = radiance * singleScattering;\n indirectSpecular += multiScattering * cosineWeightedIrradiance;\n vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n #ifdef USE_SHEEN\n float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n indirectSpecular *= sheenEnergyComp;\n indirectDiffuse *= sheenEnergyComp;\n #endif\n reflectedLight.indirectSpecular += indirectSpecular;\n reflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return 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 geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }
1\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n #ifdef USE_LIGHT_PROBES_GRID\n vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;\n vec3 probeWorldNormal = transformNormalByInverseViewMatrix( geometryNormal, viewMatrix );\n irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )\n #if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n #if defined( LAMBERT ) || defined( PHONG )\n irradiance += iblIrradiance;\n #endif\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",lightprobes_pars_fragment:"#ifdef USE_LIGHT_PROBES_GRID\nuniform highp sampler3D probesSH;\nuniform vec3 probesMin;\nuniform vec3 probesMax;\nuniform vec3 probesResolution;\nvec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {\n vec3 res = probesResolution;\n vec3 gridRange = probesMax - probesMin;\n vec3 resMinusOne = res - 1.0;\n vec3 probeSpacing = gridRange / resMinusOne;\n vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;\n vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );\n uvw = uvw * resMinusOne / res + 0.5 / res;\n float nz = res.z;\n float paddedSlices = nz + 2.0;\n float atlasDepth = 7.0 * paddedSlices;\n float uvZBase = uvw.z * nz + 1.0;\n vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );\n vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );\n vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );\n vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );\n vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );\n vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );\n vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );\n vec3 c0 = s0.xyz;\n vec3 c1 = vec3( s0.w, s1.xy );\n vec3 c2 = vec3( s1.zw, s2.x );\n vec3 c3 = s2.yzw;\n vec3 c4 = s3.xyz;\n vec3 c5 = vec3( s3.w, s4.xy );\n vec3 c6 = vec3( s4.zw, s5.x );\n vec3 c7 = s5.yzw;\n vec3 c8 = s6.xyz;\n float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;\n vec3 result = c0 * 0.886227;\n result += c1 * 2.0 * 0.511664 * y;\n result += c2 * 2.0 * 0.511664 * z;\n result += c3 * 2.0 * 0.511664 * x;\n result += c4 * 2.0 * 0.429043 * x * y;\n result += c5 * 2.0 * 0.429043 * y * z;\n result += c6 * ( 0.743125 * z * z - 0.247708 );\n result += c7 * 2.0 * 0.429043 * x * z;\n result += c8 * 0.429043 * ( x * x - y * y );\n return max( result, vec3( 0.0 ) );\n}\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #ifdef DOUBLE_SIDED\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #ifdef DOUBLE_SIDED\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #if defined( USE_PACKED_NORMALMAP )\n mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );\n #endif\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );
1\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #ifdef FLIP_SIDED\n vBitangent = - vBitangent;\n #endif\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform 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 return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 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 if( v <= 0.0 )\n return vec4( 0., 0., 0., 0. );\n if( v >= 1.0 )\n return vec4( 1., 1., 1., 1. );\n float vuf;\n float af = modf( v * PackFactors.a, vuf );\n float bf = modf( vuf * ShiftRight8, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n if( v <= 0.0 )\n return vec3( 0., 0., 0. );\n if( v >= 1.0 )\n return vec3( 1., 1., 1. );\n float vuf;\n float bf = modf( v * PackFactors.b, vuf );\n float gf = modf( vuf * ShiftRight8, vuf );\n return vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n if( v <= 0.0 )\n return vec2( 0., 0. );\n if( v >= 1.0 )\n return vec2( 1., 1. );\n float vuf;\n float gf = modf( v * 256., vuf );\n return vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n return dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 25
15.0 ), v.y, fract( v.y * 255.0 ) );\n return 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 return 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 return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n #ifdef USE_REVERSED_DEPTH_BUFFER\n \n return depth * ( far - near ) - far;\n #else\n return depth * ( near - far ) - near;\n #endif\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n \n #ifdef USE_REVERSED_DEPTH_BUFFER\n return ( near * far ) / ( ( near - far ) * depth - near );\n #else\n return ( near * far ) / ( ( far - near ) * depth - far );\n #endif\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #else\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #else\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #elif defined( SHADOWMAP_TYPE_BASIC )\n uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float interleavedGradientNoise( vec2 position ) {\n return fract( 52.9829189 * fract( dot
1( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n }\n vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n const float goldenAngle = 2.399963229728653;\n float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n float theta = float( sampleIndex ) * goldenAngle + phi;\n return vec2( cos( theta ), sin( theta ) ) * r;\n }\n #endif\n #if defined( SHADOWMAP_TYPE_PCF )\n float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float radius = shadowRadius * texelSize.x;\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n shadow = (\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_VSM )\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadowCoord.z -= shadowBias;\n #else\n shadowCoord.z += shadowBias;\n #endif\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n float mean = distribution.x;\n float variance = distribution.y * distribution.y;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float hard_shadow = step( mean, shadowCoord.z );\n #else\n float hard_shadow = step( shadowCoord.z, mean );\n #endif\n \n if ( hard_shadow == 1.0 ) {\n shadow = 1.0;\n } else {\n variance = max( variance, 0.0000001 );\n float d = shadowCoord.z - mean;\n float p_max = variance / ( variance + d * d );\n p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n shadow = max( hard_shadow, p_max );\n }\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #else\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadowCoord.z -= shadowBias;\n #else\n shadowCoord.z += shadowBias;\n #endif\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n float depth = texture2D( shadowMap, shadowCoord.xy ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n shadow = step( depth, shadowCoord.z );\n #else\n shadow = step( shadowCoord.z, depth );\n #endif\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #if defined( SHADOWMAP_TYPE_PCF )\n float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 bd3D = normalize( lightToPosition );\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1\n dp -= shadowBias;\n #else\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n #endif\n float texelSize = shadowRadius / shadowMapSize.x;\n vec3 absDir = abs( bd3D );\n vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n tangent = normalize( cross( bd3D, tangent ) );\n vec3 bitangent = cross( bd3D, tangent );\n float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n vec2 sample0 = vogelDiskSample( 0, 5, phi );\n vec2 sample1 = vogelDiskSample( 1, 5, phi );\n vec2 sample2 = vogelDiskSample( 2, 5, phi );\n vec2 sample3 = vogelDiskSample( 3, 5, phi );\n vec2 sample4 = vogelDiskSample( 4, 5, phi );\n shadow = (\n texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +\n texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )\n ) * 0.2;\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #elif defined( SHADOWMAP_TYPE_BASIC )\n float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n vec3 absVec = abs( lightToPosition );\n float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n float depth = textureCube( shadowMap, bd3D ).r;\n #ifdef USE_REVERSED_DEPTH_BUFFER\n depth = 1.0 - depth;\n #endif\n shadow = step( dp, depth );\n }\n return mix( 1.0, shadow, shadowIntensity );\n }\n #endif\n #endif\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowIntensity;\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #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 #ifdef HAS_NORMAL\n vec3 shadowWorldNormal = transformNormalByInverseViewMatrix( transformedNormal, viewMatrix );\n #else\n vec3 shadowWorldNormal = vec3( 0.0 );\n #endif\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }
1\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_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;
1\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );
1\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n const float StartCompression = 0.8 - 0.04;\n const float Desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min( color.r, min( color.g, color.b ) );\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max( color.r, max( color.g, color.b ) );\n if ( peak < StartCompression ) return color;\n float d = 1. - StartCompression;\n float newPeak = 1. - d * d / ( peak + d - StartCompression );\n color *= newPeak / peak;\n float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = transformNormalByInverseViewMatrix( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec4 transmittedLight;\n vec3 transmittance;\n #ifdef USE_DISPERSION\n float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n for ( int i = 0; i < 3; i ++ ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n transmittedLight[ i ] = transmissionSample[ i ];\n transmittedLight.a += transmissionSample.a;\n transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n }\n transmittedLight.a /= 3.0;\n #else\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n #endif\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;
1\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
1\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( 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 vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = 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 #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #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 #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform 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 vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <logdepthbuf_fragment>\n #ifdef USE_REVERSED_DEPTH_BUFFER\n float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n #else\n float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n #endif\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #elif DEPTH_PACKING == 3202\n gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n #elif DEPTH_PACKING == 3203\n gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n #endif\n}",distance_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 #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}",distance_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\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 <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <tonemapping_fragment>\n #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 vLineDistance = scale * lineDistance;\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #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 #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying 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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #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 #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\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 <emissivemap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #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 #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <mor
1phtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - 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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying 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 #include <uv_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - 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 varying vec3 vViewPosition;\n#endif\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 vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #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 #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #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 <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 <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying 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 #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;
1\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\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 <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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n \n outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
1\n #endif\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #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 #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\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 <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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #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 varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #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 #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\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 #include <logdepthbuf_fragment>\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_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 #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix[ 3 ];\n vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #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 vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}"},R={common:{diffuse:{value:new b.Color(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new b.Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new b.Matrix3},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new b.Matrix3}},envmap:{envMap:{value:null},envMapRotation:{value:new b.Matrix3},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new b.Matrix3}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new b.Matrix3}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new b.Matrix3},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new b.Matrix3},normalScale:{value:new b.Vector2(1,1)}}
vendor: 7,408 bytes, line 1
1,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new b.Matrix3},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new b.Matrix3}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new b.Matrix3}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new b.Matrix3}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new b.Color(0xffffff)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new b.Vector3},probesMax:{value:new b.Vector3},probesResolution:{value:new b.Vector3}},points:{diffuse:{value:new b.Color(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new b.Matrix3},alphaTest:{value:0},uvTransform:{value:new b.Matrix3}},sprite:{diffuse:{value:new b.Color(0xffffff)},opacity:{value:1},center:{value:new b.Vector2(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new b.Matrix3},alphaMap:{value:null},alphaMapTransform:{value:new b.Matrix3},alphaTest:{value:0}}},C={basic:{uniforms:(0,b.mergeUniforms)([R.common,R.specularmap,R.envmap,R.aomap,R.lightmap,R.fog]),vertexShader:y.meshbasic_vert,fragmentShader:y.meshbasic_frag},lambert:{uniforms:(0,b.mergeUniforms)([R.common,R.specularmap,R.envmap,R.aomap,R.lightmap,R.emissivemap,R.bumpmap,R.normalmap,R.displacementmap,R.fog,R.lights,{emissive:{value:new b.Color(0)},envMapIntensity:{value:1}}]),vertexShader:y.meshlambert_vert,fragmentShader:y.meshlambert_frag},phong:{uniforms:(0,b.mergeUniforms)([R.common,R.specularmap,R.envmap,R.aomap,R.lightmap,R.emissivemap,R.bumpmap,R.normalmap,R.displacementmap,R.fog,R.lights,{emissive:{value:new b.Color(0)},specular:{value:new b.Color(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:y.meshphong_vert,fragmentShader:y.meshphong_frag},standard:{uniforms:(0,b.mergeUniforms)([R.common,R.envmap,R.aomap,R.lightmap,R.emissivemap,R.bumpmap,R.normalmap,R.displacementmap,R.roughnessmap,R.metalnessmap,R.fog,R.lights,{emissive:{value:new b.Color(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:y.meshphysical_vert,fragmentShader:y.meshphysical_frag},toon:{uniforms:(0,b.mergeUniforms)([R.common,R.aomap,R.lightmap,R.emissivemap,R.bumpmap,R.normalmap,R.displacementmap,R.gradientmap,R.fog,R.lights,{emissive:{value:new b.Color(0)}}]),vertexShader:y.meshtoon_vert,fragmentShader:y.meshtoon_frag},matcap:{uniforms:(0,b.mergeUniforms)([R.common,R.bumpmap,R.normalmap,R.displacementmap,R.fog,{matcap:{value:null}}]),vertexShader:y.meshmatcap_vert,fragmentShader:y.meshmatcap_frag},points:{uniforms:(0,b.mergeUniforms)([R.points,R.fog]),vertexShader:y.points_vert,fragmentShader:y.points_frag},dashed:{uniforms:(0,b.mergeUniforms)([R.common,R.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:y.linedashed_vert,fragmentShader:y.linedashed_frag},depth:{uniforms:(0,b.mergeUniforms)([R.common,R.displacementmap]),vertexShader:y.depth_vert,fragmentShader:y.depth_frag},normal:{uniforms:(0,b.mergeUniforms)([R.common,R.bumpmap,R.normalmap,R.displacementmap,{opacity:{value:1}}]),vertexShader:y.meshnormal_vert,fragmentShader:y.meshnormal_frag},sprite:{uniforms:(0,b.mergeUniforms)([R.sprite,R.fog]),vertexShader:y.sprite_vert,fragmentShader:y.sprite_frag},background:{uniforms:{uvTransform:{value:new b.Matrix3},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:y.background_vert,fragmentShader:y.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new b.Matrix3}},vertexShader:y.backgroundCube_vert,fragmentShader:y.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:y.cube_vert,fragmentShader:y.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:y.equirect_vert,fragmentShader:y.equirect_frag},distance:{uniforms:(0,b.mergeUniforms)([R.common,R.displacementmap,{referencePosition:{value:new b.Vector3},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:y.distance_vert,fragmentShader:y.distance_frag},shadow:{uniforms:(0,b.mergeUniforms)([R.lights,R.fog,{color:{value:new b.Color(0)},opacity:{value:1}}]),vertexShader:y.shadow_vert,fragmentShader:y.shadow_frag}};C.physical={uniforms:(0,b.mergeUniforms)([C.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new b.Matrix3},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new b.Matrix3},clearcoatNormalScale:{value:new b.Vector2(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new b.Matrix3},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new b.Matrix3},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new b.Matrix3},sheen:{value:0},sheenColor:{value:new b.Color(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new b.Matrix3},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new b.Matrix3},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new b.Matrix3},transmissionSamplerSize:{value:new b.Vector2},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new b.Matrix3},attenuationDistance:{value:0},attenuationColor:{value:new b.Color(0)},specularColor:{value:new b.Color(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new b.Matrix3},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new b.Matrix3},anisotropyVector:{value:new b.Vector2},anisotropyMap:{value:null},anisotropyMapTransform:{value:new b.Matrix3}}]),vertexShader:y.meshphysical_vert,fragmentShader:y.meshphysical_frag};let A={r:0,b:0,g:0},w=new b.Matrix4,P=new b.Matrix3;function U(e,t,n,r,a,i){let o,l,s=new b.Color(0),u=+(!0!==a),c=null,d=0,f=null;function p(e){let n=!0===e.isScene?e.background:null;if(n&&n.isTexture){let r=e.backgroundBlurriness>0;
1n=t.get(n,r)}return n}function m(t,r){t.getRGB(A,(0,b.getUnlitUniformColorSpace)(e)),n.buffers.color.setClear(A.r,A.g,A.b,r,i)}return{getClearColor:function(){return s},setClearColor:function(e,t=1){s.set(e),m(s,u=t)},getClearAlpha:function(){return u},setClearAlpha:function(e){m(s,u=e)},render:function(t){let r=!1,a=p(t);null===a?m(s,u):a&&a.isColor&&(m(a,1),r=!0);let o=e.xr.getEnvironmentBlendMode();"additive"===o?n.buffers.color.setClear(0,0,0,1,i):"alpha-blend"===o&&n.buffers.color.setClear(0,0,0,0,i),(e.autoClear||r)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){let a=p(n);a&&(a.isCubeTexture||a.mapping===b.CubeUVReflectionMapping)?(void 0===l&&((l=new b.Mesh(new b.BoxGeometry(1,1,1),new b.ShaderMaterial({name:"BackgroundCubeMaterial",uniforms:(0,b.cloneUniforms)(C.backgroundCube.uniforms),vertexShader:C.backgroundCube.vertexShader,fragmentShader:C.backgroundCube.fragmentShader,side:b.BackSide,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(l)),l.material.uniforms.envMap.value=a,l.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(w.makeRotationFromEuler(n.backgroundRotation)).transpose(),a.isCubeTexture&&!1===a.isRenderTargetTexture&&l.material.uniforms.backgroundRotation.value.premultiply(P),l.material.toneMapped=b.ColorManagement.getTransfer(a.colorSpace)!==b.SRGBTransfer,(c!==a||d!==a.version||f!==e.toneMapping)&&(l.material.needsUpdate=!0,c=a,d=a.version,f=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null)):a&&a.isTexture&&(void 0===o&&((o=new b.Mesh(new b.PlaneGeometry(2,2),new b.ShaderMaterial({name:"BackgroundMaterial",uniforms:(0,b.cloneUniforms)(C.background.uniforms),vertexShader:C.background.vertexShader,fragmentShader:C.background.fragmentShader,side:b.FrontSide,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(o)),o.material.uniforms.t2D.value=a,o.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,o.material.toneMapped=b.ColorManagement.getTransfer(a.colorSpace)!==b.SRGBTransfer,!0===a.matrixAutoUpdate&&a.updateMatrix(),o.material.uniforms.uvTransform.value.copy(a.matrix),(c!==a||d!==a.version||f!==e.toneMapping)&&(o.material.needsUpdate=!0,c=a,d=a.version,f=e.toneMapping),o.layers.enableAll(),t.unshift(o,o.geometry,o.material,0,0,null))},dispose:function(){void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0),void 0!==o&&(o.geometry.dispose(),o.material.dispose(),o=void 0)}}}function L(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},a=u(null),i=a,o=!1;function l(t){return e.bindVertexArray(t)}function s(t){return e.deleteVertexArray(t)}function u(e){let t=[],r=[],a=[];for(let e=0;e<n;e++)t[e]=0,r[e]=0,a[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:r,attributeDivisors:a,object:e,attributes:{},index:null}}function c(){let e=i.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function d(e){f(e,0)}function f(t,n){let r=i.newAttributes,a=i.enabledAttributes,o=i.attributeDivisors;r[t]=1,0===a[t]&&(e.enableVertexAttribArray(t),a[t]=1),o[t]!==n&&(e.vertexAttribDivisor(t,n),o[t]=n)}function p(){let t=i.newAttributes,n=i.enabledAttributes;for(let r=0,a=n.length;r<a;r++)n[r]!==t[r]&&(e.disableVertexAttribArray(r),n[r]=0)}function m(t,n,r,a,i,o,l){!0===l?e.vertexAttribIPointer(t,n,r,i,o):e.vertexAttribPointer(t,n,r,a,i,o)}function h(){g(),o=!0,i!==a&&l((i=a).object)}function g(){a.geometry=null,a.program=null,a.wireframe=!1}return{setup:function(n,a,s,h,g){var v,_,S;let x,E,T,M,y,R,C=!1,A=(v=n,_=h,S=s,x=!0===a.wireframe,void 0===(E=r[_.id])&&(E={},r[_.id]=E),void 0===(M=E[T=!0===v.isInstancedMesh?v.id:0])&&(M={},E[T]=M),void 0===(y=M[S.id])&&(y={},M[S.id]=y),void 0===(R=y[x])&&(R=u(e.createVertexArray()),y[x]=R),R);i!==A&&l((i=A).object),(C=function(e,t,n,r){let a=i.attributes,o=t.attributes,l=0,s=n.getAttributes();for(let t in s)if(s[t].location>=0){let n=a[t],r=o[t];if(void 0===r&&("instanceMatrix"===t&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(r=e.instanceColor)),void 0===n||n.attribute!==r||r&&n.data!==r.data)return!0;l++}return i.attributesNum!==l||i.index!==r}(n,h,s,g))&&function(e,t,n,r){let a={},o=t.attributes,l=0,s=n.getAttributes();for(let t in s)if(s[t].location>=0){let n=o[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));let r={};r.attribute=n,n&&n.data&&(r.data=n.data),a[t]=r,l++}i.attributes=a,i.attributesNum=l,i.index=r}(n,h,s,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(C||o)&&(o=!1,function(n,r,a,i){c();let o=i.attributes,l=a.getAttributes(),s=r.defaultAttributeValues;for(let r in l){let a=l[r];if(a.location>=0){let l=o[r];if(void 0===l&&("instanceMatrix"===r&&n.instanceMatrix&&(l=n.instanceMatrix),"instanceColor"===r&&n.instanceColor&&(l=n.instanceColor)),void 0!==l){let r=l.normalized,o=l.itemSize,s=t.get(l);if(void 0===s)continue;let u=s.buffer,c=s.type,p=s.bytesPerElement,h=c===e.INT||c===e.UNSIGNED_INT||l.gpuType===b.IntType;if(l.isInterleavedBufferAttribute){let t=l.data,s=t.stride,g=l.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<a.locationSize;e++)f(a.location+e,t.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===i._maxInstanceCount&&(i._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<a.locationSize;e++)d(a.location+e);e.bindBuffer(e.ARRAY_BUFFER,u);for(let e=0;e<a.locationSize;e++)m(a.location+e,o/a.locationSize,c,r,s*p,(g+o/a.locationSize*e)*p,h)}else{if(l.isInstancedBufferAttribute){for(let e=0;e<a.locationSize;e++)f(a.location+e,l.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===i._maxInstanceCount&&(i._maxInstanceCount=l.meshPerAttribute*l.count)}else for(let e=0;e<a.locationSize;e++)d(a.location+e);e.bindBuffer(e.ARRAY_BUFFER,u);for(let e=0;e<a.locationSize;e++)m(a.location+e,o/a.locationSize,c,r,o*p,o/a.locationSize*e*p,h)}}else if(void 0!==s){let t=s[r];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(a.location,t);break;case 3:e.vertexAttrib3fv(a.location,t);break;case 4:e.vertexAttrib4fv(a.location,t);break;default:e.vertexAttrib1fv(a.location,t)}}}}p()}(n,a,s,h),null!==g&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(g).buffer))},reset:h,resetDefaultState:g,dispose:function(){for(let e in h(),r){let t=r[e];for(let e in t){let n=t[e];for(let e in n){let t=n[e];for(let e in t)s(t[e].object),delete t[e];delete n[e]}}delete r[e]}},releaseStatesOfGeometry:function(e){if(void 0===r[e.id])return;let t=r[e.id];for(let e in t){let n=t[e];for(let e in n){let t=n[e];for(let e in t)s(t[e].object),delete t[e];delete n[e]}}delete r[e.id]},releaseStatesOfObject:function(e){for(let t in r){let n=r[t],a=!0===e.isInstancedMesh?e.id:0,i=n[a];if(void 0!==i){for(let e in i){let t=i[e];for(let e in t)s(t[e].object),delete t[e];delete i[e]}delete n[a],0===Object.keys(n).length&&delete r[t]}}},releaseStatesOfProgram:function(e){for(let t in r){let n=r[t];for(let t in n){let r=n[t];if(void 0===r[e.id])continue;let a=r[e.id];for(let e in a)s(a[e].object),delete a[e];delete r[e.id]}}},initAttributes:c,enableAttribute:d,disableUnusedAttributes:p}}function D(e,t,n){let r;this.setMode=function(e){r=e},this.render=function(t,a){e.drawArrays(r,t,a),n.update(a,r,1)},this.renderInstances=function(t,a,i){0!==i&&(e.drawArraysInstanced(r,t,a,i),n.update(a,r,i))}
1,this.renderMultiDraw=function(e,a,i){if(0===i)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,e,0,a,0,i);let o=0;for(let e=0;e<i;e++)o+=a[e];n.update(o,r,1)}}function N(e,t,n,r){let a;function i(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=void 0!==n.precision?n.precision:"highp",l=i(o);l!==o&&((0,b.warn)("WebGLRenderer:",o,"not supported, using",l,"instead."),o=l);let s=!0===n.logarithmicDepthBuffer,u=!0===n.reversedDepthBuffer&&t.has("EXT_clip_control");return!0===n.reversedDepthBuffer&&!1===u&&(0,b.warn)("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer."),{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==a)return a;if(!0===t.has("EXT_texture_filter_anisotropic")){let n=t.get("EXT_texture_filter_anisotropic");a=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else a=0;return a},getMaxPrecision:i,textureFormatReadable:function(t){return t===b.RGBAFormat||r.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){let a=n===b.HalfFloatType&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return n===b.UnsignedByteType||r.convert(n)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)||n===b.FloatType||!!a},precision:o,logarithmicDepthBuffer:s,reversedDepthBuffer:u,maxTextures:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:e.getParameter(e.MAX_SAMPLES),samples:e.getParameter(e.SAMPLES)}}function I(e){let t=this,n=null,r=0,a=!1,i=!1,o=new b.Plane,l=new b.Matrix3,s={value:null,needsUpdate:!1};function u(e,n,r,a){let i=null!==e?e.length:0,u=null;if(0!==i){if(u=s.value,!0!==a||null===u){let t=r+4*i,a=n.matrixWorldInverse;l.getNormalMatrix(a),(null===u||u.length<t)&&(u=new Float32Array(t));for(let t=0,n=r;t!==i;++t,n+=4)o.copy(e[t]).applyMatrix4(a,l),o.normal.toArray(u,n),u[n+3]=o.constant}s.value=u,s.needsUpdate=!0}return t.numPlanes=i,t.numIntersection=0,u}this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let n=0!==e.length||t||0!==r||a;return a=t,r=e.length,n},this.beginShadows=function(){i=!0,u(null)},this.endShadows=function(){i=!1},this.setGlobalState=function(e,t){n=u(e,t,0)},this.setState=function(o,l,c){let d=o.clippingPlanes,f=o.clipIntersection,p=o.clipShadows,m=e.get(o);if(a&&null!==d&&0!==d.length&&(!i||p)){let e=i?0:r,t=4*e,a=m.clippingState||null;s.value=a,a=u(d,l,t,c);for(let e=0;e!==t;++e)a[e]=n[e];m.clippingState=a,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=e}else i?u(null):(s.value!==n&&(s.value=n,s.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0)}}P.set(-1,0,0,0,1,0,0,0,1);let F=[.125,.215,.35,.446,.526,.582],B=new b.OrthographicCamera,O=new b.Color,G=null,k=0,z=0,H=!1,V=new b.Vector3;class W{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,r=100,a={}){let{size:i=256,position:o=V}=a;G=this._renderer.getRenderTarget(),k=this._renderer.getActiveCubeFace(),z=this._renderer.getActiveMipmapLevel(),H=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(i);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,n,r,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=K(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=q(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(G,k,z),this._renderer.xr.enabled=H,e.scissorTest=!1,X(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===b.CubeReflectionMapping||e.mapping===b.CubeRefractionMapping?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),G=this._renderer.getRenderTarget(),k=this._renderer.getActiveCubeFace(),z=this._renderer.getActiveMipmapLevel(),H=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:b.LinearFilter,minFilter:b.LinearFilter,generateMipmaps:!1,type:b.HalfFloatType,format:b.RGBAFormat,colorSpace:b.LinearSRGBColorSpace,depthBuffer:!1},r=j(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){var a,i,o,l,s,u;let r,c;null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=j(e,t,n);let{_lodMax:d}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=function(e){let t=[],n=[],r=[],a=e,i=e-4+1+F.length;for(let o=0;o<i;o++){let i=Math.pow(2,a);t.push(i);let l=1/i;o>e-4?l=F[o-e+4-1]:0===o&&(l=0),n.push(l);let s=1/(i-2),u=-s,c=1+s,d=[u,u,c,u,c,c,u,u,c,c,u,c],f=new Float32Array(108),p=new Float32Array(72),m=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];f.set(r,18*e),p.set(d,12*e);let a=[e,e,e,e,e,e];m.set(a,6*e)}let h=new b.BufferGeometry;h.setAttribute("position",new b.BufferAttribute(f,3)),h.setAttribute("uv",new b.BufferAttribute(p,2)),h.setAttribute("faceIndex",new b.BufferAttribute(m,1)),r.push(new b.Mesh(h,null)),a>4&&a--}return{lodMeshes:r,sizeLods:t,sigmas:n}}(d)),this._blurMaterial=(a=d,i=e,o=t,r=new Float32Array(20),c=new b.Vector3(0,1,0),new b.ShaderMaterial({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/i,CUBEUV_TEXEL_HEIGHT:1/o,CUBEUV_MAX_MIP:`${a}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:c}},vertexShader:Y(),fragmentShader:` 2 3 precision mediump float; 4 precision mediump int; 5 6 varying vec3 vOutputDirection; 7 8 uniform sampler2D envMap; 9 uniform int samples; 10 uniform float weights[ n ]; 11 uniform bool latitudinal; 12 uniform float dTheta; 13 uniform float mipInt; 14 uniform vec3 poleAxis; 15 16 #define ENVMAP_TYPE_CUBE_UV 17 #include <cube_uv_reflection_fragment> 18 19 vec3 getSample( float theta, vec3 axis ) { 20 21 float cosTheta = cos( theta ); 22 // Rodrigues' axis-angle rotation 23 vec3 sampleDirection = vOutputDirection * cosTheta 24 + cross( axis, vOutputDirection ) * sin( theta ) 25 + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); 26 27 return bilinearCubeUV( envMap, sampleDirection, mipInt ); 28 29 } 30 31 void main() { 32 33 vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); 34 35 if ( all( equal( axis, vec3( 0.0 ) ) ) ) { 36 37 axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); 38 39 } 40 41 axis = normalize( axis ); 42 43 gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); 44 gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); 45 46 for ( int i = 1; i < n; i++ ) { 47 48 if ( i >= samples ) { 49 50 break; 51 52 } 53 54 float theta = dTheta * float( i ); 55 gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); 56 gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); 57 58 } 59 60 } 61 `,blending:b.NoBlending,depthTest:!1,depthWrite:!1})),this._ggxMaterial=(l=d,s=e,u=t,new b.ShaderMaterial({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:256,CUBEUV_TEXEL_WIDTH:1/s,CUBEUV_TEXEL_HEIGHT:1/u,CUBEUV_MAX_MIP:`${l}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Y(),fragmentShader:` 62 63 precision highp float; 64 precision highp int; 65 66 varying vec3 vOutputDirection; 67 68 uniform sampler2D envMap; 69 uniform float roughness; 70 uniform float mipInt; 71 72 #define ENVMAP_TYPE_CUBE_UV 73 #include <cube_uv_reflection_fragment> 74 75 #define PI 3.14159265359 76 77 // Van der Corput radical inverse 78 float radicalInverse_VdC(uint bits) { 79 bits = (bits << 16u) | (bits >> 16u); 80 bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); 81 bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); 82 bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); 83 bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); 84 return float(bits) * 2.3283064365386963e-10; // / 0x100000000 85 } 86 87 // Hammersley sequence 88 vec2 hammersley(uint i, uint N) { 89 return vec2(float(i) / float(N), radicalInverse_VdC(i)); 90 } 91 92 // GGX VNDF importance sampling (Eric Heitz 2018) 93 // "Sampling the GGX Distribution of Visible Normals" 94 // https://jcgt.org/published/0007/04/01/ 95 vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) { 96 float alpha = roughness * roughness; 97 98 // Section 4.1: Orthonormal basis 99 vec3 T1 = vec3(1.0, 0.0, 0.0); 100 vec3 T2 = cross(V, T1); 101 102 // Section 4.2: Parameterization of projected area 103 float r = sqrt(Xi.x); 104 float phi = 2.0 * PI * Xi.y; 105 float t1 = r * cos(phi); 106 float t2 = r * sin(phi); 107 float s = 0.5 * (1.0 + V.z); 108 t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2; 109 110 // Section 4.3: Reprojection onto hemisphere 111 vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V; 112 113 // Section 3.4: Transform back to ellipsoid configuration 114 return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z))); 115 } 116 117 void main() { 118 vec3 N = normalize(vOutputDirection); 119 vec3 V = N; // Assume view direction equals normal for pre-filtering 120 121 vec3 prefilteredColor = vec3(0.0); 122 float totalWeight = 0.0; 123 124 // For very low roughness, just sample the environment directly 125 if (roughness < 0.001) { 126 gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0); 127 return; 128 } 129 130 // Tangent space basis for VNDF sampling 131 vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); 132 vec3 tangent = normalize(cross(up, N)); 133 vec3 bitangent = cross(N, tangent); 134
135 for(uint i = 0u; i < uint(GGX_SAMPLES); i++) { 136 vec2 Xi = hammersley(i, uint(GGX_SAMPLES)); 137 138 // For PMREM, V = N, so in tangent space V is always (0, 0, 1) 139 vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness); 140 141 // Transform H back to world space 142 vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z); 143 vec3 L = normalize(2.0 * dot(V, H) * H - V); 144 145 float NdotL = max(dot(N, L), 0.0); 146 147 if(NdotL > 0.0) { 148 // Sample environment at fixed mip level 149 // VNDF importance sampling handles the distribution filtering 150 vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt); 151 152 // Weight by NdotL for the split-sum approximation 153 // VNDF PDF naturally accounts for the visible microfacet distribution 154 prefilteredColor += sampleColor * NdotL; 155 totalWeight += NdotL; 156 } 157 } 158 159 if (totalWeight > 0.0) { 160 prefilteredColor = prefilteredColor / totalWeight; 161 } 162 163 gl_FragColor = vec4(prefilteredColor, 1.0); 164 } 165 `,blending:b.NoBlending,depthTest:!1,depthWrite:!1}))}return r}_compileMaterial(e){let t=new b.Mesh(new b.BufferGeometry,e);this._renderer.compile(t,B)}_sceneToCubeUV(e,t,n,r,a){let i=new b.PerspectiveCamera(90,1,t,n),o=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],s=this._renderer,u=s.autoClear,c=s.toneMapping;s.getClearColor(O),s.toneMapping=b.NoToneMapping,s.autoClear=!1,s.state.buffers.depth.getReversed()&&(s.setRenderTarget(r),s.clearDepth(),s.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new b.Mesh(new b.BoxGeometry,new b.MeshBasicMaterial({name:"PMREM.Backgroun
165d",side:b.BackSide,depthWrite:!1,depthTest:!1})));let d=this._backgroundBox,f=d.material,p=!1,m=e.background;m?m.isColor&&(f.color.copy(m),e.background=null,p=!0):(f.color.copy(O),p=!0);for(let t=0;t<6;t++){let n=t%3;0===n?(i.up.set(0,o[t],0),i.position.set(a.x,a.y,a.z),i.lookAt(a.x+l[t],a.y,a.z)):1===n?(i.up.set(0,0,o[t]),i.position.set(a.x,a.y,a.z),i.lookAt(a.x,a.y+l[t],a.z)):(i.up.set(0,o[t],0),i.position.set(a.x,a.y,a.z),i.lookAt(a.x,a.y,a.z+l[t]));let u=this._cubeSize;X(r,n*u,t>2?u:0,u,u),s.setRenderTarget(r),p&&s.render(d,i),s.render(e,i)}s.toneMapping=c,s.autoClear=u,e.background=m}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===b.CubeReflectionMapping||e.mapping===b.CubeRefractionMapping;r?(null===this._cubemapMaterial&&(this._cubemapMaterial=K()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=q());let a=r?this._cubemapMaterial:this._equirectMaterial,i=this._lodMeshes[0];i.material=a,a.uniforms.envMap.value=e;let o=this._cubeSize;X(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(i,B)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodMeshes.length;for(let t=1;t<r;t++)this._applyGGXFilter(e,t-1,t);t.autoClear=n}_applyGGXFilter(e,t,n){let r=this._renderer,a=this._pingPongRenderTarget,i=this._ggxMaterial,o=this._lodMeshes[n];o.material=i;let l=i.uniforms,s=n/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),c=Math.sqrt(s*s-u*u),{_lodMax:d}=this,f=this._sizeLods[n],p=3*f*(n>d-4?n-d+4:0),m=4*(this._cubeSize-f);l.envMap.value=e.texture,l.roughness.value=c*(0+1.25*s),l.mipInt.value=d-t,X(a,p,m,3*f,2*f),r.setRenderTarget(a),r.render(o,B),l.envMap.value=a.texture,l.roughness.value=0,l.mipInt.value=d-n,X(e,p,m,3*f,2*f),r.setRenderTarget(e),r.render(o,B)}_blur(e,t,n,r,a){let i=this._pingPongRenderTarget;this._halfBlur(e,i,t,n,r,"latitudinal",a),this._halfBlur(i,e,n,n,r,"longitudinal",a)}_halfBlur(e,t,n,r,a,i,o){let l=this._renderer,s=this._blurMaterial;"latitudinal"!==i&&"longitudinal"!==i&&(0,b.error)("blur direction must be either latitudinal or longitudinal!");let u=this._lodMeshes[r];u.material=s;let c=s.uniforms,d=this._sizeLods[n]-1,f=isFinite(a)?Math.PI/(2*d):2*Math.PI/39,p=a/f,m=isFinite(a)?1+Math.floor(3*p):20;m>20&&(0,b.warn)(`sigmaRadians, ${a}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);let h=[],g=0;for(let e=0;e<20;++e){let t=e/p,n=Math.exp(-t*t/2);h.push(n),0===e?g+=n:e<m&&(g+=2*n)}for(let e=0;e<h.length;e++)h[e]=h[e]/g;c.envMap.value=e.texture,c.samples.value=m,c.weights.value=h,c.latitudinal.value="latitudinal"===i,o&&(c.poleAxis.value=o);let{_lodMax:v}=this;c.dTheta.value=f,c.mipInt.value=v-n;let _=this._sizeLods[r],S=4*(this._cubeSize-_);X(t,3*_*(r>v-4?r-v+4:0),S,3*_,2*_),l.setRenderTarget(t),l.render(u,B)}}function j(e,t,n){let r=new b.WebGLRenderTarget(e,t,n);return r.texture.mapping=b.CubeUVReflectionMapping,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function X(e,t,n,r,a){e.viewport.set(t,n,r,a),e.scissor.set(t,n,r,a)}function q(){return new b.ShaderMaterial({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Y(),fragmentShader:` 166 167 precision mediump float; 168 precision mediump int; 169 170 varying vec3 vOutputDirection; 171 172 uniform sampler2D envMap; 173 174 #include <common> 175 176 void main() { 177 178 vec3 outputDirection = normalize( vOutputDirection ); 179 vec2 uv = equirectUv( outputDirection ); 180 181 gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); 182 183 } 184 `,blending:b.NoBlending,depthTest:!1,depthWrite:!1})}function K(){return new b.ShaderMaterial({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Y(),fragmentShader:` 185 186 precision mediump float; 187 precision mediump int; 188 189 uniform float flipEnvMap; 190 191 varying vec3 vOutputDirection; 192 193 uniform samplerCube envMap; 194 195 void main() { 196 197 gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); 198 199 } 200 `,blending:b.NoBlending,depthTest:!1,depthWrite:!1})}function Y(){return` 201 202 precision mediump float; 203 precision mediump int; 204 205 attribute float faceIndex; 206 207 varying vec3 vOutputDirection; 208 209 // RH coordinate system; PMREM face-indexing convention 210 vec3 getDirection( vec2 uv, float face ) { 211 212 uv = 2.0 * uv - 1.0; 213 214 vec3 direction = vec3( uv, 1.0 ); 215 216 if ( face == 0.0 ) { 217 218 direction = direction.zyx; // ( 1, v, u ) pos x 219 220 } else if ( face == 1.0 ) { 221 222 direction = direction.xzy; 223 direction.xz *= -1.0; // ( -u, 1, -v ) pos y 224 225 } else if ( face == 2.0 ) { 226 227 direction.x *= -1.0; // ( -u, v, 1 ) pos z 228 229 } else if ( face == 3.0 ) { 230 231 direction = direction.zyx; 232 direction.xz *= -1.0; // ( -1, v, -u ) neg x 233 234 } else if ( face == 4.0 ) { 235 236 direction = direction.xzy; 237 direction.xy *= -1.0; // ( -u, -1, v ) neg y 238 239 } else if ( face == 5.0 ) { 240 241 direction.z *= -1.0; // ( u, v, -1 ) neg z 242 243 } 244 245 return direction; 246 247 } 248 249 void main() { 250 251 vOutputDirection = getDirection( uv, faceIndex ); 252 gl_Position = vec4( position, 1.0 ); 253 254 } 255 `}class $ extends b.WebGLRenderTarget{constructor(e=1,t={}
255){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1};this.texture=new b.CubeTexture([n,n,n,n,n,n]),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` 256 257 varying vec3 vWorldDirection; 258 259 vec3 transformDirection( in vec3 dir, in mat4 matrix ) { 260 261 return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); 262 263 } 264 265 void main() { 266 267 vWorldDirection = transformDirection( position, modelMatrix ); 268 269 #include <begin_vertex> 270 #include <project_vertex> 271 272 } 273 `,fragmentShader:` 274 275 uniform sampler2D tEquirect; 276 277 varying vec3 vWorldDirection; 278 279 #include <common> 280 281 void main() { 282 283 vec3 direction = normalize( vWorldDirection ); 284 285 vec2 sampleUV = equirectUv( direction ); 286 287 gl_FragColor = texture2D( tEquirect, sampleUV ); 288 289 } 290 `},r=new b.BoxGeometry(5,5,5),a=new b.ShaderMaterial({name:"CubemapFromEquirect",uniforms:(0,b.cloneUniforms)(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:b.BackSide,blending:b.NoBlending});a.uniforms.tEquirect.value=t;let i=new b.Mesh(r,a),o=t.minFilter;return t.minFilter===b.LinearMipmapLinearFilter&&(t.minFilter=b.LinearFilter),new b.CubeCamera(1,10,this).update(e,i),t.minFilter=o,i.geometry.dispose(),i.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let a=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,r);e.setRenderTarget(a)}}function Q(e){let t=new WeakMap,n=new WeakMap,r=null;function a(e,t){return t===b.EquirectangularReflectionMapping?e.mapping=b.CubeReflectionMapping:t===b.EquirectangularRefractionMapping&&(e.mapping=b.CubeRefractionMapping),e}function i(e){let n=e.target;n.removeEventListener("dispose",i);let r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}function o(e){let t=e.target;t.removeEventListener("dispose",o);let r=n.get(t);void 0!==r&&(n.delete(t),r.dispose())}return{get:function(l,s=!1){return null==l?null:s?function(t){if(t&&t.isTexture){let a=t.mapping,i=a===b.EquirectangularReflectionMapping||a===b.EquirectangularRefractionMapping,l=a===b.CubeReflectionMapping||a===b.CubeRefractionMapping;if(i||l){let a=n.get(t),s=void 0!==a?a.texture.pmremVersion:0;if(t.isRenderTargetTexture&&t.pmremVersion!==s)return null===r&&(r=new W(e)),(a=i?r.fromEquirectangular(t,a):r.fromCubemap(t,a)).texture.pmremVersion=t.pmremVersion,n.set(t,a),a.texture;{if(void 0!==a)return a.texture;let s=t.image;return i&&s&&s.height>0||l&&s&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(s)?(null===r&&(r=new W(e)),(a=i?r.fromEquirectangular(t):r.fromCubemap(t)).texture.pmremVersion=t.pmremVersion,n.set(t,a),t.addEventListener("dispose",o),a.texture):null}}}return t}(l):function(n){if(n&&n.isTexture){let r=n.mapping;if(r===b.EquirectangularReflectionMapping||r===b.EquirectangularRefractionMapping)if(t.has(n))return a(t.get(n).texture,n.mapping);else{let r=n.image;if(!r||!(r.height>0))return null;{let o=new $(r.height);return o.fromEquirectangularTexture(e,n),t.set(n,o),n.addEventListener("dispose",i),a(o.texture,n.mapping)}}}return n}(l)},dispose:function(){t=new WeakMap,n=new WeakMap,null!==r&&(r.dispose(),r=null)}}}function Z(e){let t={};
290function n(n){if(void 0!==t[n])return t[n];let r=e.getExtension(n);return t[n]=r,r}return{has:function(e){return null!==n(e)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){let t=n(e);return null===t&&(0,b.warnOnce)("WebGLRenderer: "+e+" extension not supported."),t}}}function J(e,t,n,r){let a={},i=new WeakMap;function o(e){let l=e.target;for(let e in null!==l.index&&t.remove(l.index),l.attributes)t.remove(l.attributes[e]);l.removeEventListener("dispose",o),delete a[l.id];let s=i.get(l);s&&(t.remove(s),i.delete(l)),r.releaseStatesOfGeometry(l),!0===l.isInstancedBufferGeometry&&delete l._maxInstanceCount,n.memory.geometries--}function l(e){let n=[],r=e.index,a=e.attributes.position,o=0;if(void 0===a)return;if(null!==r){let e=r.array;o=r.version;for(let t=0,r=e.length;t<r;t+=3){let r=e[t+0],a=e[t+1],i=e[t+2];n.push(r,a,a,i,i,r)}}else{let e=a.array;o=a.version;for(let t=0,r=e.length/3-1;t<r;t+=3){let e=t+0,r=t+1,a=t+2;n.push(e,r,r,a,a,e)}}let l=new(a.count>=65535?b.Uint32BufferAttribute:b.Uint16BufferAttribute)(n,1);l.version=o;let s=i.get(e);s&&t.remove(s),i.set(e,l)}return{get:function(e,t){return!0===a[t.id]||(t.addEventListener("dispose",o),a[t.id]=!0,n.memory.geometries++),t},update:function(n){let r=n.attributes;for(let n in r)t.update(r[n],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){let t=i.get(e);if(t){let n=e.index;null!==n&&t.version<n.version&&l(e)}else l(e);return i.get(e)}}}function ee(e,t,n){let r,a,i;this.setMode=function(e){r=e},this.setIndex=function(e){a=e.type,i=e.bytesPerElement},this.render=function(t,o){e.drawElements(r,o,a,t*i),n.update(o,r,1)},this.renderInstances=function(t,o,l){0!==l&&(e.drawElementsInstanced(r,o,a,t*i,l),n.update(o,r,l))},this.renderMultiDraw=function(e,i,o){if(0===o)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,i,0,a,e,0,o);let l=0;for(let e=0;e<o;e++)l+=i[e];n.update(l,r,1)}}function et(e){let t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(n,r,a){switch(t.calls++,r){case e.TRIANGLES:t.triangles+=n/3*a;break;case e.LINES:t.lines+=n/2*a;break;case e.LINE_STRIP:t.lines+=a*(n-1);break;case e.LINE_LOOP:t.lines+=a*n;break;case e.POINTS:t.points+=a*n;break;default:(0,b.error)("WebGLInfo: Unknown draw mode:",r)}}}}function en(e,t,n){let r=new WeakMap,a=new b.Vector4;return{update:function(i,o,l){let s=i.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,c=void 0!==u?u.length:0,d=r.get(o);if(void 0===d||d.count!==c){void 0!==d&&d.texture.dispose();let e=void 0!==o.morphAttributes.position,n=void 0!==o.morphAttributes.normal,i=void 0!==o.morphAttributes.color,l=o.morphAttributes.position||[],s=o.morphAttributes.normal||[],u=o.morphAttributes.color||[],f=0;!0===e&&(f=1),!0===n&&(f=2),!0===i&&(f=3);let p=o.attributes.position.count*f,m=1;p>t.maxTextureSize&&(m=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let h=new Float32Array(p*m*4*c),g=new b.DataArrayTexture(h,p,m,c);g.type=b.FloatType,g.needsUpdate=!0;let v=4*f;for(let t=0;t<c;t++){let r=l[t],o=s[t],c=u[t],d=p*m*4*t;for(let t=0;t<r.count;t++){let l=t*v;!0===e&&(a.fromBufferAttribute(r,t),h[d+l+0]=a.x,h[d+l+1]=a.y,h[d+l+2]=a.z,h[d+l+3]=0),!0===n&&(a.fromBufferAttribute(o,t),h[d+l+4]=a.x,h[d+l+5]=a.y,h[d+l+6]=a.z,h[d+l+7]=0),!0===i&&(a.fromBufferAttribute(c,t),h[d+l+8]=a.x,h[d+l+9]=a.y,h[d+l+10]=a.z,h[d+l+11]=4===c.itemSize?a.w:1)}}d={count:c,texture:g,size:new b.Vector2(p,m)},r.set(o,d),o.addEventListener("dispose",function e(){g.dispose(),r.delete(o),o.removeEventListener("dispose",e)})}if(!0===i.isInstancedMesh&&null!==i.morphTexture)l.getUniforms().setValue(e,"morphTexture",i.morphTexture,n);else{let t=0;for(let e=0;e<s.length;e++)t+=s[e];let n=o.morphTargetsRelative?1:1-t;l.getUniforms().setValue(e,"morphTargetBaseInfluence",n),l.getUniforms().setValue(e,"morphTargetInfluences",s)}l.getUniforms().setValue(e,"morphTargetsTexture",d.texture,n),l.getUniforms().setValue(e,"morphTargetsTextureSize",d.size)}}}function er(e,t,n,r,a){let i=new WeakMap;function o(e){let t=e.target;t.removeEventListener("dispose",o),r.releaseStatesOfObject(t),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(r){let l=a.render.frame,s=r.geometry,u=t.get(r,s);if(i.get(u)!==l&&(t.update(u),i.set(u,l)),r.isInstancedMesh&&(!1===r.hasEventListener("dispose",o)&&r.addEventListener("dispose",o),i.get(r)!==l&&(n.update(r.instanceMatrix,e.ARRAY_BUFFER),null!==r.instanceColor&&n.update(r.instanceColor,e.ARRAY_BUFFER),i.set(r,l))),r.isSkinnedMesh){let e=r.skeleton;
290i.get(e)!==l&&(e.update(),i.set(e,l))}return u},dispose:function(){i=new WeakMap}}}let ea={[b.LinearToneMapping]:"LINEAR_TONE_MAPPING",[b.ReinhardToneMapping]:"REINHARD_TONE_MAPPING",[b.CineonToneMapping]:"CINEON_TONE_MAPPING",[b.ACESFilmicToneMapping]:"ACES_FILMIC_TONE_MAPPING",[b.AgXToneMapping]:"AGX_TONE_MAPPING",[b.NeutralToneMapping]:"NEUTRAL_TONE_MAPPING",[b.CustomToneMapping]:"CUSTOM_TONE_MAPPING"};function ei(e,t,n,r,a,i){let o,l=new b.WebGLRenderTarget(t,n,{type:e,depthBuffer:a,stencilBuffer:i,samples:4*!!r,depthTexture:a?new b.DepthTexture(t,n):void 0}),s=new b.WebGLRenderTarget(t,n,{type:b.HalfFloatType,depthBuffer:!1,stencilBuffer:!1}),u=new b.BufferGeometry;u.setAttribute("position",new b.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),u.setAttribute("uv",new b.Float32BufferAttribute([0,2,0,0,2,0],2));let c=new b.RawShaderMaterial({uniforms:{tDiffuse:{value:null}},vertexShader:` 291 precision highp float; 292 293 uniform mat4 modelViewMatrix; 294 uniform mat4 projectionMatrix; 295 296 attribute vec3 position; 297 attribute vec2 uv; 298 299 varying vec2 vUv; 300 301 void main() { 302 vUv = uv; 303 gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); 304 }`,fragmentShader:` 305 precision highp float; 306 307 uniform sampler2D tDiffuse; 308 309 varying vec2 vUv; 310 311 #include <tonemapping_pars_fragment> 312 #include <colorspace_pars_fragment> 313 314 void main() { 315 gl_FragColor = texture2D( tDiffuse, vUv ); 316 317 #ifdef LINEAR_TONE_MAPPING 318 gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb ); 319 #elif defined( REINHARD_TONE_MAPPING ) 320 gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb ); 321 #elif defined( CINEON_TONE_MAPPING ) 322 gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb ); 323 #elif defined( ACES_FILMIC_TONE_MAPPING ) 324 gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb ); 325 #elif defined( AGX_TONE_MAPPING ) 326 gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb ); 327 #elif defined( NEUTRAL_TONE_MAPPING ) 328 gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb ); 329 #elif defined( CUSTOM_TONE_MAPPING ) 330 gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb ); 331 #endif 332 333 #ifdef SRGB_TRANSFER 334 gl_FragColor = sRGBTransferOETF( gl_FragColor ); 335 #endif 336 }`,depthTest:!1,depthWrite:!1}),d=new b.Mesh(u,c),f=new b.OrthographicCamera(-1,1,1,-1,0,1),p=null,m=null,h=!1,g=null,v=[],_=!1;this.setSize=function(e,t){l.setSize(e,t),s.setSize(e,t);for(let n=0;n<v.length;n++){let r=v[n];r.setSize&&r.setSize(e,t)}},this.setEffects=function(e){_=(v=e).length>0&&!0===v[0].isRenderPass;let t=l.width,n=l.height;for(let e=0;e<v.length;e++){let r=v[e];r.setSize&&r.setSize(t,n)}},this.begin=function(e,t){if(h||e.toneMapping===b.NoToneMapping&&0===v.length)return!1;if(g=t,null!==t){let e=t.width,n=t.height;(l.width!==e||l.height!==n)&&this.setSize(e,n)}return!1===_&&e.setRenderTarget(l),o=e.toneMapping,e.toneMapping=b.NoToneMapping,!0},this.hasRenderPass=function(){return _},this.end=function(e,t){e.toneMapping=o,h=!0;let n=l,r=s;for(let a=0;a<v.length;a++){let i=v[a];if(!1!==i.enabled&&(i.render(e,r,n,t),!1!==i.needsSwap)){let e=n;n=r,r=e}}if(p!==e.outputColorSpace||m!==e.toneMapping){p=e.outputColorSpace,m=e.toneMapping,c.defines={},b.ColorManagement.getTransfer(p)===b.SRGBTransfer&&(c.defines.SRGB_TRANSFER="");let t=ea[m];t&&(c.defines[t]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=n.texture,e.setRenderTarget(g),e.render(d,f),g=null,h=!1},this.isCompositing=function(){return h},this.dispose=function(){l.depthTexture&&l.depthTexture.dispose(),l.dispose(),s.dispose(),u.dispose(),c.dispose()}}let eo=new b.Texture,el=new b.DepthTexture(1,1),es=new b.DataArrayTexture,eu=new b.Data3DTexture,ec=new b.CubeTexture,ed=[],ef=[],ep=new Float32Array(16),em=new Float32Array(9),eh=new Float32Array(4);function eg(e,t,n){let r=e[0];if(r<=0||r>0)return e;let a=t*n,i=ed[a];if(void 0===i&&(i=new Float32Array(a),ed[a]=i),0!==t){r.toArray(i,0);for(let r=1,a=0;r!==t;++r)a+=n,e[r].toArray(i,a)}return i}function ev(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function e_(e,t){for(let n=0,r=t.length;n<r;n++)e[n]=t[n]}function eS(e,t){let n=ef[t];void 0===n&&(n=new Int32Array(t),ef[t]=n);for(let r=0;r!==t;++r)n[r]=e.allocateTextureUnit();return n}function ex(e,t){let n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function eE(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(ev(n,t))return;e.uniform2fv(this.addr,t),e_(n,t)}}function eb(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(ev(n,t))return;e.uniform3fv(this.addr,t),e_(n,t)}}function eT(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(ev(n,t))return;e.uniform4fv(this.addr,t),e_(n,t)}}function eM(e,t){let n=this.cache,r=t.elements;if(void 0===r){if(ev(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),e_(n,t)}else{if(ev(n,r))return;eh.set(r),e.uniformMatrix2fv(this.addr,!1,eh),e_(n,r)}}function ey(e,t){let n=this.cache,r=t.elements;if(void 0===r){if(ev(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),e_(n,t)}else{if(ev(n,r))return;em.set(r),e.uniformMatrix3fv(this.addr,!1,em),e_(n,r)}}function eR(e,t){let n=this.cache,r=t.elements;if(void 0===r){if(ev(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),e_(n,t)}else{if(ev(n,r))return;ep.set(r),e.uniformMatrix4fv(this.addr,!1,ep),e_(n,r)}}function eC(e,t){let n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function eA(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(ev(n,t))return;e.uniform2iv(this.addr,t),e_(n,t)}}function ew(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(ev(n,t))return;e.uniform3iv(this.addr,t),e_(n,t)}}function eP(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(ev(n,t))return;e.uniform4iv(this.addr,t),e_(n,t)}}function eU(e,t){let n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function eL(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(ev(n,t))return;e.uniform2uiv(this.addr,t),e_(n,t)}}function eD(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(ev(n,t))return;e.uniform3uiv(this.addr,t),e_(n,t)}}function eN(e,t){let n=this.cache;if(void 0!==t.x)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(ev(n,t))return;e.uniform4uiv(this.addr,t),e_(n,t)}}function eI(e,t,n){let r,a=this.cache,i=n.allocateTextureUnit();a[0]!==i&&(e.uniform1i(this.addr,i),a[0]=i),this.type===e.SAMPLER_2D_SHADOW?(el.compareFunction=n.isReversedDepthBuffer()?b.GreaterEqualCompare:b.LessEqualCompare,r=el):r=eo,n.setTexture2D(t||r,i)}function eF(e,t,n){let r=this.cache,a=n.allocateTextureUnit();r[0]!==a&&(e.uniform1i(this.addr,a),r[0]=a),n.setTexture3D(t||eu,a)}function eB(e,t,n){let r=this.cache,a=n.allocateTextureUnit();r[0]!==a&&(e.uniform1i(this.addr,a),r[0]=a),n.setTextureCube(t||ec,a)}function eO(e,t,n){let r=this.cache,a=n.allocateTextureUnit();r[0]!==a&&(e.uniform1i(this.addr,a),r[0]=a),n.setTexture2DArray(t||es,a)}function eG(e,t){e.uniform1fv(this.addr,t)}function ek(e,t){let n=eg(t,this.size,2);e.uniform2fv(this.addr,n)}function ez(e,t){let n=eg(t,this.size,3);e.uniform3fv(this.addr,n)}function eH(e,t){let n=eg(t,this.size,4);e.uniform4fv(this.addr,n)}function eV(e,t){let n=eg(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function eW(e,t){let n=eg(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function ej(e,t){let n=eg(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function eX(e,t){e.uniform1iv(this.addr,t)}function eq(e,t){e.uniform2iv(this.addr,t)}function eK(e,t){e.uniform3iv(this.addr,t)}function eY(e,t){e.uniform4iv(this.addr,t)}function e$(e,t){e.uniform1uiv(this.addr,t)}function eQ(e,t){e.uniform2uiv(this.addr,t)}function eZ(e,t){e.uniform3uiv(this.addr,t)}function eJ(e,t){e.uniform4uiv(this.addr,t)}function e0(e,t,n){let r,a=this.cache,i=t.length,o=eS(n,i);
336ev(a,o)||(e.uniform1iv(this.addr,o),e_(a,o)),r=this.type===e.SAMPLER_2D_SHADOW?el:eo;for(let e=0;e!==i;++e)n.setTexture2D(t[e]||r,o[e])}function e1(e,t,n){let r=this.cache,a=t.length,i=eS(n,a);ev(r,i)||(e.uniform1iv(this.addr,i),e_(r,i));for(let e=0;e!==a;++e)n.setTexture3D(t[e]||eu,i[e])}function e2(e,t,n){let r=this.cache,a=t.length,i=eS(n,a);ev(r,i)||(e.uniform1iv(this.addr,i),e_(r,i));for(let e=0;e!==a;++e)n.setTextureCube(t[e]||ec,i[e])}function e3(e,t,n){let r=this.cache,a=t.length,i=eS(n,a);ev(r,i)||(e.uniform1iv(this.addr,i),e_(r,i));for(let e=0;e!==a;++e)n.setTexture2DArray(t[e]||es,i[e])}class e4{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return ex;case 35664:return eE;case 35665:return eb;case 35666:return eT;case 35674:return eM;case 35675:return ey;case 35676:return eR;case 5124:case 35670:return eC;case 35667:case 35671:return eA;case 35668:case 35672:return ew;case 35669:case 35673:return eP;case 5125:return eU;case 36294:return eL;case 36295:return eD;case 36296:return eN;case 35678:case 36198:case 36298:case 36306:case 35682:return eI;case 35679:case 36299:case 36307:return eF;case 35680:case 36300:case 36308:case 36293:return eB;case 36289:case 36303:case 36311:case 36292:return eO}}(t.type)}}class e5{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return eG;case 35664:return ek;case 35665:return ez;case 35666:return eH;case 35674:return eV;case 35675:return eW;case 35676:return ej;case 5124:case 35670:return eX;case 35667:case 35671:return eq;case 35668:case 35672:return eK;case 35669:case 35673:return eY;case 5125:return e$;case 36294:return eQ;case 36295:return eZ;case 36296:return eJ;case 35678:case 36198:case 36298:case 36306:case 35682:return e0;case 35679:case 36299:case 36307:return e1;case 35680:case 36300:case 36308:case 36293:return e2;case 36289:case 36303:case 36311:case 36292:return e3}}(t.type)}}class e6{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){let r=this.seq;for(let a=0,i=r.length;a!==i;++a){let i=r[a];i.setValue(e,t[i.id],n)}}}let e8=/(\w+)(\])?(\[|\.)?/g;function e9(e,t){e.seq.push(t),e.map[t.id]=t}class e7{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<n;++r){const n=e.getActiveUniform(t,r),a=e.getUniformLocation(t,n.name);!function(e,t,n){let r=e.name,a=r.length;for(e8.lastIndex=0;;){let i=e8.exec(r),o=e8.lastIndex,l=i[1],s="]"===i[2],u=i[3];if(s&&(l|=0),void 0===u||"["===u&&o+2===a){e9(n,void 0===u?new e4(l,e,t):new e5(l,e,t));break}{let e=n.map[l];void 0===e&&e9(n,e=new e6(l)),n=e}}}(n,a,this)}const r=[],a=[];for(const t of this.seq)t.type===e.SAMPLER_2D_SHADOW||t.type===e.SAMPLER_CUBE_SHADOW||t.type===e.SAMPLER_2D_ARRAY_SHADOW?r.push(t):a.push(t);r.length>0&&(this.seq=r.concat(a))}setValue(e,t,n,r){let a=this.map[t];void 0!==a&&a.setValue(e,n,r)}setOptional(e,t,n){let r=t[n];void 0!==r&&this.setValue(e,n,r)}static upload(e,t,n,r){for(let a=0,i=t.length;a!==i;++a){let i=t[a],o=n[i.id];!1!==o.needsUpdate&&i.setValue(e,o.value,r)}}static seqWithValue(e,t){let n=[];for(let r=0,a=e.length;r!==a;++r){let a=e[r];a.id in t&&n.push(a)}return n}}function te(e,t,n){let r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}let tt=0,tn=new b.Matrix3;function tr(e,t,n){let r=e.getShaderParameter(t,e.COMPILE_STATUS),a=(e.getShaderInfoLog(t)||"").trim();if(r&&""===a)return"";let i=/ERROR: 0:(\d+)/.exec(a);if(!i)return a;{let r=parseInt(i[1]);return n.toUpperCase()+"\n\n"+a+"\n\n"+function(e,t){let n=e.split("\n"),r=[],a=Math.max(t-6,0),i=Math.min(t+6,n.length);for(let e=a;e<i;e++){let a=e+1;r.push(`${a===t?">":" "} ${a}: ${n[e]}`)}return r.join("\n")}(e.getShaderSource(t),r)}}let ta={[b.LinearToneMapping]:"Linear",[b.ReinhardToneMapping]:"Reinhard",[b.CineonToneMapping]:"Cineon",[b.ACESFilmicToneMapping]:"ACESFilmic",[b.AgXToneMapping]:"AgX",[b.NeutralToneMapping]:"Neutral",[b.CustomToneMapping]:"Custom"},ti=new b.Vector3;function to(e){return""!==e}function tl(e,t){let n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_L
336IGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function ts(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let tu=/^[ \t]*#include +<([\w\d./]+)>/gm;function tc(e){return e.replace(tu,tf)}let td=new Map;function tf(e,t){let n=y[t];if(void 0===n){let e=td.get(t);if(void 0!==e)n=y[e],(0,b.warn)('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e);else throw Error("THREE.WebGLProgram: Can not resolve #include <"+t+">")}return tc(n)}let tp=/#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 tm(e){return e.replace(tp,th)}function th(e,t,n,r){let a="";for(let e=parseInt(t);e<parseInt(n);e++)a+=r.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return a}function tg(e){let t=`precision ${e.precision} float; 337 precision ${e.precision} int; 338 precision ${e.precision} sampler2D; 339 precision ${e.precision} samplerCube; 340 precision ${e.precision} sampler3D; 341 precision ${e.precision} sampler2DArray; 342 precision ${e.precision} sampler2DShadow; 343 precision ${e.precision} samplerCubeShadow; 344 precision ${e.precision} sampler2DArrayShadow; 345 precision ${e.precision} isampler2D; 346 precision ${e.precision} isampler3D; 347 precision ${e.precision} isamplerCube; 348 precision ${e.precision} isampler2DArray; 349 precision ${e.precision} usampler2D; 350 precision ${e.precision} usampler3D; 351 precision ${e.precision} usamplerCube; 352 precision ${e.precision} usampler2DArray; 353 `;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}let tv={[b.PCFShadowMap]:"SHADOWMAP_TYPE_PCF",[b.VSMShadowMap]:"SHADOWMAP_TYPE_VSM"},t_={[b.CubeReflectionMapping]:"ENVMAP_TYPE_CUBE",[b.CubeRefractionMapping]:"ENVMAP_TYPE_CUBE",[b.CubeUVReflectionMapping]:"ENVMAP_TYPE_CUBE_UV"},tS={[b.CubeRefractionMapping]:"ENVMAP_MODE_REFRACTION"},tx={[b.MultiplyOperation]:"ENVMAP_BLENDING_MULTIPLY",[b.MixOperation]:"ENVMAP_BLENDING_MIX",[b.AddOperation]:"ENVMAP_BLENDING_ADD"};function tE(e,t,n,r){var a,i;let o,l,s,u,c=e.getContext(),d=n.defines,f=n.vertexShader,p=n.fragmentShader,m=tv[n.shadowMapType]||"SHADOWMAP_TYPE_BASIC",h=!1===n.envMap?"ENVMAP_TYPE_CUBE":t_[n.envMapMode]||"ENVMAP_TYPE_CUBE",g=!1===n.envMap?"ENVMAP_MODE_REFLECTION":tS[n.envMapMode]||"ENVMAP_MODE_REFLECTION",v=!1===n.envMap?"ENVMAP_BLENDING_NONE":tx[n.combine]||"ENVMAP_BLENDING_NONE",_=function(e){let t=e.envMapCubeUVHeight;if(null===t)return null;let n=Math.log2(t)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:1/t,maxMip:n}}(n),S=[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(to).join("\n"),x=function(e){let t=[];for(let n in e){let r=e[n];!1!==r&&t.push("#define "+n+" "+r)}return t.join("\n")}(d),E=c.createProgram(),T=n.glslVersion?"#version "+n.glslVersion+"\n":"";if(n.isRawShaderMaterial)(o=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(to).join("\n")).length>0&&(o+="\n"),(l=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(to).join("\n")).length>0&&(l+="\n");else{let e,t,r,s,u;o=[tg(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+g:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IR
353IDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexNormals?"#define HAS_NORMAL":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+m:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(to).join("\n"),l=[tg(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alph
353aToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.envMap?"#define "+g:"",n.envMap?"#define "+v:"",_?"#define CUBEUV_TEXEL_WIDTH "+_.texelWidth:"",_?"#define CUBEUV_TEXEL_HEIGHT "+_.texelHeight:"",_?"#define CUBEUV_MAX_MIP "+_.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas||n.batchingColor?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+m:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==b.NoToneMapping?"#define TONE_MAPPING":"",n.toneMapping!==b.NoToneMapping?y.tonemapping_pars_fragment:"",n.toneMapping!==b.NoToneMapping?(a="toneMapping",void 0===(e=ta[i=n.toneMapping])?((0,b.warn)("WebGLProgram: Unsupported toneMapping:",i),"vec3 "+a+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+a+"( vec3 color ) { return "+e+"ToneMapping( color ); }"):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",y.colorspace_pars_fragment,(t=function(e){b.ColorManagement._getMatrix(tn,b.ColorManagement.workingColorSpace,e);let t=`mat3( ${tn.elements.map(e=>e.toFixed(4))} )`;switch(b.ColorManagement.getTransfer(e)){case b.LinearTransfer:return[t,"LinearTransferOETF"];case b.SRGBTransfer:return[t,"sRGBTransferOETF"];default:return(0,b.warn)("WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(n.outputColorSpace),`vec4 linearToOutputTexel( vec4 value ) { 354 return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) ); 355}`),(b.ColorManagement.getLuminanceCoefficients(ti),r=ti.x.toFixed(4),s=ti.y.toFixed(4),u=ti.z.toFixed(4),`float luminance( const in vec3 rgb ) { 356 const vec3 weights = vec3( ${r}, ${s}, ${u} ); 357 return dot( weights, rgb ); 358}`),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(to).join("\n")}f=ts(f=tl(f=tc(f),n),n),p=ts(p=tl(p=tc(p),n),n),f=tm(f),p=tm(p),!0!==n.isRawShaderMaterial&&(T="#version 300 es\n",o=[S,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+o,l=["#define varying in",
358n.glslVersion===b.GLSL3?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===b.GLSL3?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+l);let M=T+o+f,R=T+l+p,C=te(c,c.VERTEX_SHADER,M),A=te(c,c.FRAGMENT_SHADER,R);function w(t){if(e.debug.checkShaderErrors){let n=c.getProgramInfoLog(E)||"",r=c.getShaderInfoLog(C)||"",a=c.getShaderInfoLog(A)||"",i=n.trim(),s=r.trim(),u=a.trim(),d=!0,f=!0;if(!1===c.getProgramParameter(E,c.LINK_STATUS))if(d=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(c,E,C,A);else{let e=tr(c,C,"vertex"),n=tr(c,A,"fragment");(0,b.error)("WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(E,c.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+i+"\n"+e+"\n"+n)}else""!==i?(0,b.warn)("WebGLProgram: Program Info Log:",i):(""===s||""===u)&&(f=!1);f&&(t.diagnostics={runnable:d,programLog:i,vertexShader:{log:s,prefix:o},fragmentShader:{log:u,prefix:l}})}c.deleteShader(C),c.deleteShader(A),s=new e7(c,E),u=function(e,t){let n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let a=0;a<r;a++){let r=e.getActiveAttrib(t,a),i=r.name,o=1;r.type===e.FLOAT_MAT2&&(o=2),r.type===e.FLOAT_MAT3&&(o=3),r.type===e.FLOAT_MAT4&&(o=4),n[i]={type:r.type,location:e.getAttribLocation(t,i),locationSize:o}}return n}(c,E)}c.attachShader(E,C),c.attachShader(E,A),void 0!==n.index0AttributeName?c.bindAttribLocation(E,0,n.index0AttributeName):!0===n.hasPositionAttribute&&c.bindAttribLocation(E,0,"position"),c.linkProgram(E),this.getUniforms=function(){return void 0===s&&w(this),s},this.getAttributes=function(){return void 0===u&&w(this),u};let P=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===P&&(P=c.getProgramParameter(E,37297)),P},this.destroy=function(){r.releaseStatesOfProgram(this),c.deleteProgram(E),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=tt++,this.cacheKey=t,this.usedTimes=1,this.program=E,this.vertexShader=C,this.fragmentShader=A,this}let tb=0;class tT{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e,t,n){let r=this._getShaderCacheForMaterial(e);return!1===r.has(t)&&(r.add(t),t.usedTimes++),!1===r.has(n)&&(r.add(n),n.usedTimes++),this}remove(e){for(let t of this.materialCache.get(e))t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(e),this}getVertexShaderStage(e){return this._getShaderStage(e.vertexShader)}getFragmentShaderStage(e){return this._getShaderStage(e.fragmentShader)}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return void 0===n&&(n=new tM(e),t.set(e,n)),n}}class tM{constructor(e){this.id=tb++,this.code=e,this.usedTimes=0}}function ty(e,t,n,r,a,i){let o=new b.Layers,l=new tT,s=new Set,u=[],c=new Map,d=r.logarithmicDepthBuffer,f=r.precision,p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(e){return(s.add(e),0===e)?"uv":`uv${e}`}return{getParameters:function(a,o,u,c,h,g){var v;let _,S,x,E,T=c.fog,M=h.geometry,y=a.isMeshStandardMaterial||a.isMeshLambertMaterial||a.isMeshPhongMaterial?c.environment:null,R=a.isMeshStandardMaterial||a.isMeshLambertMaterial&&!a.envMap||a.isMeshPhongMaterial&&!a.envMap,A=t.get(a.envMap||y,R),w=A&&A.mapping===b.CubeUVReflectionMapping?A.image.height:null,P=p[a.type];null!==a.precision&&(f=r.getMaxPrecision(a.precision))!==a.precision&&(0,b.warn)("WebGLProgram.getParameters:",a.precision,"not supported, using",f,"instead.");let U=M.morphAttributes.position||M.morphAttributes.normal||M.morphAttributes.color,L=void 0!==U?U.length:0,D=0;if(void 0!==M.morphAttributes.position&&(D=1),void 0!==M.morphAttributes.normal&&(D=2),void 0!==M.morphAttributes.color&&(D=3),P){let e=C[P];_=e.vertexShader,S=e.fragmentShader}else{_=a.vertexShader,S=a.fragmentShader;let e=l.getVertexShaderStage(a),t=l.getFragmentShaderStage(a);l.update(a,e,t),x=e.id,E=t.id}let N=e.getRenderTarget(),I=e.state.buffers.depth.getReversed(),F=!0===h.isInstancedMesh,B=!0===h.isBatchedMesh,O=!!a.map,G=!!a.matcap,k=!!A,z=!!a.aoMap,H=!!a.lightMap,V=!!a.bumpMap&&
vendor: 5,235 bytes, line 358
358!1===a.wireframe,W=!!a.normalMap,j=!!a.displacementMap,X=!!a.emissiveMap,q=!!a.metalnessMap,K=!!a.roughnessMap,Y=a.anisotropy>0,$=a.clearcoat>0,Q=a.dispersion>0,Z=a.iridescence>0,J=a.sheen>0,ee=a.transmission>0,et=Y&&!!a.anisotropyMap,en=$&&!!a.clearcoatMap,er=$&&!!a.clearcoatNormalMap,ea=$&&!!a.clearcoatRoughnessMap,ei=Z&&!!a.iridescenceMap,eo=Z&&!!a.iridescenceThicknessMap,el=J&&!!a.sheenColorMap,es=J&&!!a.sheenRoughnessMap,eu=!!a.specularMap,ec=!!a.specularColorMap,ed=!!a.specularIntensityMap,ef=ee&&!!a.transmissionMap,ep=ee&&!!a.thicknessMap,em=!!a.gradientMap,eh=!!a.alphaMap,eg=a.alphaTest>0,ev=!!a.alphaHash,e_=!!a.extensions,eS=b.NoToneMapping;a.toneMapped&&(null===N||!0===N.isXRRenderTarget)&&(eS=e.toneMapping);let ex={shaderID:P,shaderType:a.type,shaderName:a.name,vertexShader:_,fragmentShader:S,defines:a.defines,customVertexShaderID:x,customFragmentShaderID:E,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:f,batching:B,batchingColor:B&&null!==h._colorsTexture,instancing:F,instancingColor:F&&null!==h.instanceColor,instancingMorph:F&&null!==h.morphTexture,outputColorSpace:null===N?e.outputColorSpace:!0===N.isXRRenderTarget?N.texture.colorSpace:b.ColorManagement.workingColorSpace,alphaToCoverage:!!a.alphaToCoverage,map:O,matcap:G,envMap:k,envMapMode:k&&A.mapping,envMapCubeUVHeight:w,aoMap:z,lightMap:H,bumpMap:V,normalMap:W,displacementMap:j,emissiveMap:X,normalMapObjectSpace:W&&a.normalMapType===b.ObjectSpaceNormalMap,normalMapTangentSpace:W&&a.normalMapType===b.TangentSpaceNormalMap,packedNormalMap:W&&a.normalMapType===b.TangentSpaceNormalMap&&((v=a.normalMap.format)===b.RGFormat||v===b.RG11_EAC_Format||v===b.RED_GREEN_RGTC2_Format),metalnessMap:q,roughnessMap:K,anisotropy:Y,anisotropyMap:et,clearcoat:$,clearcoatMap:en,clearcoatNormalMap:er,clearcoatRoughnessMap:ea,dispersion:Q,iridescence:Z,iridescenceMap:ei,iridescenceThicknessMap:eo,sheen:J,sheenColorMap:el,sheenRoughnessMap:es,specularMap:eu,specularColorMap:ec,specularIntensityMap:ed,transmission:ee,transmissionMap:ef,thicknessMap:ep,gradientMap:em,opaque:!1===a.transparent&&a.blending===b.NormalBlending&&!1===a.alphaToCoverage,alphaMap:eh,alphaTest:eg,alphaHash:ev,combine:a.combine,mapUv:O&&m(a.map.channel),aoMapUv:z&&m(a.aoMap.channel),lightMapUv:H&&m(a.lightMap.channel),bumpMapUv:V&&m(a.bumpMap.channel),normalMapUv:W&&m(a.normalMap.channel),displacementMapUv:j&&m(a.displacementMap.channel),emissiveMapUv:X&&m(a.emissiveMap.channel),metalnessMapUv:q&&m(a.metalnessMap.channel),roughnessMapUv:K&&m(a.roughnessMap.channel),anisotropyMapUv:et&&m(a.anisotropyMap.channel),clearcoatMapUv:en&&m(a.clearcoatMap.channel),clearcoatNormalMapUv:er&&m(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ea&&m(a.clearcoatRoughnessMap.channel),iridescenceMapUv:ei&&m(a.iridescenceMap.channel),iridescenceThicknessMapUv:eo&&m(a.iridescenceThicknessMap.channel),sheenColorMapUv:el&&m(a.sheenColorMap.channel),sheenRoughnessMapUv:es&&m(a.sheenRoughnessMap.channel),specularMapUv:eu&&m(a.specularMap.channel),specularColorMapUv:ec&&m(a.specularColorMap.channel),specularIntensityMapUv:ed&&m(a.specularIntensityMap.channel),transmissionMapUv:ef&&m(a.transmissionMap.channel),thicknessMapUv:ep&&m(a.thicknessMap.channel),alphaMapUv:eh&&m(a.alphaMap.channel),vertexTangents:!!M.attributes.tangent&&(W||Y),vertexNormals:!!M.attributes.normal,vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!M.attributes.color&&4===M.attributes.color.itemSize,pointsUvs:!0===h.isPoints&&!!M.attributes.uv&&(O||eh),fog:!!T,useFog:!0===a.fog,fogExp2:!!T&&T.isFogExp2,flatShading:!1===a.wireframe&&(!0===a.flatShading||void 0===M.attributes.normal&&!1===W&&(a.isMeshLambertMaterial||a.isMeshPhongMaterial||a.isMeshStandardMaterial||a.isMeshPhysicalMaterial)),sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:d,reversedDepthBuffer:I,skinning:!0===h.isSkinnedMesh,hasPositionAttribute:void 0!==M.attributes.position,morphTargets:void 0!==M.morphAttributes.position,morphNormals:void 0!==M.morphAttributes.normal,morphColors:void 0!==M.morphAttributes.color,morphTargetsCount:L,morphTextureStride:D,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,numLightProbeGrids:g.length,numClippingPlanes:i.numPlanes,numClipIntersection:i.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:eS,decodeVideoTexture:O&&!0===a.map.isVideoTexture&&b.ColorManagement.getTransfer(a.map.colorSpace)===b.SRGBTransfer,decodeVideoTextureEmissive:X&&!0===a.emissiveMap.isVideoTexture&&b.ColorManagement.getTransfer(a.emissiveMap.colorSpace)===b.SRGBTransfer,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===b.DoubleSide,flipSided:a.side===b.BackSide,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionCl
358ipCullDistance:e_&&!0===a.extensions.clipCullDistance&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(e_&&!0===a.extensions.multiDraw||B)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return ex.vertexUv1s=s.has(1),ex.vertexUv2s=s.has(2),ex.vertexUv3s=s.has(3),s.clear(),ex},getProgramCacheKey:function(t){var n,r,a,i;let l=[];if(t.shaderID?l.push(t.shaderID):(l.push(t.customVertexShaderID),l.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)l.push(e),l.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(n=l,r=t,n.push(r.precision),n.push(r.outputColorSpace),n.push(r.envMapMode),n.push(r.envMapCubeUVHeight),n.push(r.mapUv),n.push(r.alphaMapUv),n.push(r.lightMapUv),n.push(r.aoMapUv),n.push(r.bumpMapUv),n.push(r.normalMapUv),n.push(r.displacementMapUv),n.push(r.emissiveMapUv),n.push(r.metalnessMapUv),n.push(r.roughnessMapUv),n.push(r.anisotropyMapUv),n.push(r.clearcoatMapUv),n.push(r.clearcoatNormalMapUv),n.push(r.clearcoatRoughnessMapUv),n.push(r.iridescenceMapUv),n.push(r.iridescenceThicknessMapUv),n.push(r.sheenColorMapUv),n.push(r.sheenRoughnessMapUv),n.push(r.specularMapUv),n.push(r.specularColorMapUv),n.push(r.specularIntensityMapUv),n.push(r.transmissionMapUv),n.push(r.thicknessMapUv),n.push(r.combine),n.push(r.fogExp2),n.push(r.sizeAttenuation),n.push(r.morphTargetsCount),n.push(r.morphAttributeCount),n.push(r.numDirLights),n.push(r.numPointLights),n.push(r.numSpotLights),n.push(r.numSpotLightMaps),n.push(r.numHemiLights),n.push(r.numRectAreaLights),n.push(r.numDirLightShadows),n.push(r.numPointLightShadows),n.push(r.numSpotLightShadows),n.push(r.numSpotLightShadowsWithMaps),n.push(r.numLightProbes),n.push(r.shadowMapType),n.push(r.toneMapping),n.push(r.numClippingPlanes),n.push(r.numClipIntersection),n.push(r.depthPacking),a=l,i=t,o.disableAll(),i.instancing&&o.enable(0),i.instancingColor&&o.enable(1),i.instancingMorph&&o.enable(2),i.matcap&&o.enable(3),i.envMap&&o.enable(4),i.normalMapObjectSpace&&o.enable(5),i.normalMapTangentSpace&&o.enable(6),i.clearcoat&&o.enable(7),i.iridescence&&o.enable(8),i.alphaTest&&o.enable(9),i.vertexColors&&o.enable(10),i.vertexAlphas&&o.enable(11),i.vertexUv1s&&o.enable(12),i.vertexUv2s&&o.enable(13),i.vertexUv3s&&o.enable(14),i.vertexTangents&&o.enable(15),i.anisotropy&&o.enable(16),i.alphaHash&&o.enable(17),i.batching&&o.enable(18),i.dispersion&&o.enable(19),i.batchingColor&&o.enable(20),i.gradientMap&&o.enable(21),i.packedNormalMap&&o.enable(22),i.vertexNormals&&o.enable(23),a.push(o.mask),o.disableAll(),i.fog&&o.enable(0),i.useFog&&o.enable(1),i.flatShading&&o.enable(2),i.logarithmicDepthBuffer&&o.enable(3),i.reversedDepthBuffer&&o.enable(4),i.skinning&&o.enable(5),i.morphTargets&&o.enable(6),i.morphNormals&&o.enable(7),i.morphColors&&o.enable(8),i.premultipliedAlpha&&o.enable(9),i.shadowMapEnabled&&o.enable(10),i.doubleSided&&o.enable(11),i.flipSided&&o.enable(12),i.useDepthPacking&&o.enable(13),i.dithering&&o.enable(14),i.transmission&&o.enable(15),i.sheen&&o.enable(16),i.opaque&&o.enable(17),i.pointsUvs&&o.enable(18),i.decodeVideoTexture&&o.enable(19),i.decodeVideoTextureEmissive&&o.enable(20),i.alphaToCoverage&&o.enable(21),i.numLightProbeGrids>0&&o.enable(22),i.hasPositionAttribute&&o.enable(23),a.push(o.mask),l.push(e.outputColorSpace)),l.push(t.customProgramCacheKey),l.join()},getUniforms:function(e){let t,n=p[e.type];if(n){let e=C[n];t=b.UniformsUtils.clone(e.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,n){let r=c.get(n);return void 0!==r?++r.usedTimes:(r=new tE(e,n,t,a),u.push(r),c.set(n,r)),r},releaseProgram:function(e){if(0==--e.usedTimes){let t=u.indexOf(e);u[t]=u[u.length-1],u.pop(),c.delete(e.cacheKey),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:u,dispose:function(){l.dispose()}}}function tR(){let e=new WeakMap;return{has:function(t){return e.has(t)},get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,r){e.get(t)[n]=r},dispose:function(){e=new WeakMap}}}function tC(e,t){if(e.groupOrder!==t.groupOrder)return e.groupOrder-t.groupOrder;if(e.renderOrder!==t.renderOrder)return e.renderOrder-t.renderOrder;if(e.material.id!==t.material.id)return e.material.id-t.material.id;if(e.materialVariant!==t.materialVariant)return e.materialVariant-t.materialVariant;if(e.z!==t.z)return e.z-t.z;else return e.id-t.id}function tA(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function tw(){let e=[],t=0,n=[],r=[],a=[];function i(e){let t=0;return e.isInstancedMesh&&(t+=2),e.isSkinnedMesh&&(t+=1),t}function o(n,r,a,o,l,s){let u=e[t];return void 0===u?(u={id:n.id,object:n,geometry:r,material:a,materialVariant:i(n),groupOrder:o,renderOrder:n.renderOrder,z:l,group:s},e[t]=u):(u.id=n.id,u.object=n,u.geometry=r,u.material=a,u.materialVariant=i(n),u.groupOrder=o,u.renderOrder=n.renderOrder,u.z=l,u.group=s),t++,u}return{opaque:n,transmissive:r,transparent:a,init:function(){t=0,n.length=0,r.length=0,a.length=0},push:function(e,t,i,l,s,u){let c=o(e,t,i,l,s,u);i.transmission>0?r.push(c):!0===i.transparent?a.push(c):n.push(c)},unshift:function(e,t,i,l,s,u){let c=o(e,t,i,l,s,u);i.transmission>0?r.unshift(c):!0===i.transparent?a.unshift(c):n.unshift(c)},finish:function(){for(let n=t,r=e.length;n<r;n++){let t=e[n];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t,i){n.length>1&&n.sort(e||tC),r.length>1&&r.sort(t||tA),a.length>1&&a.sort(t||tA),i&&(n.reverse(),r.reverse(),a.reverse())}}}function tP(){let e=new WeakMap;return{get:function(t,n){let r,a=e.get(t);return void 0===a?(r=new tw,e.set(t,[r])):n>=a.length?(r=new tw,a.push(r)):r=a[n],r},dispose:function(){e=new WeakMap}}}function tU(){let e={};return{get:function(t){let n;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":n={direction:new b.Vector3,color:new b.Color};break;case"SpotLight":n={position:new b.Vector3,direction:new b.Vector3,color:new b.Color,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new b.Vector3,color:new b.Color,distance:0,decay:0};break;case"HemisphereLight":n={direction:new b.Vector3,skyColor:new b.Color,groundColor:new b.Color};break;case"RectAreaLight":n={color:new b.Color,position:new b.Vector3,halfWidth:new b.Vector3,halfHeight:new b.Vector3}}return e[t.id]=n,n}}}let tL=0;function tD(e,t){return 2*!!t.castShadow-2*!!e.castShadow+ +!!t.map-!!e.map}
358function tN(e){let t,n=new tU,r=(t={},{get:function(e){let n;if(void 0!==t[e.id])return t[e.id];switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new b.Vector2};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new b.Vector2,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}),a={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 e=0;e<9;e++)a.probe.push(new b.Vector3);let i=new b.Vector3,o=new b.Matrix4,l=new b.Matrix4;return{setup:function(t){let i=0,o=0,l=0;for(let e=0;e<9;e++)a.probe[e].set(0,0,0);let s=0,u=0,c=0,d=0,f=0,p=0,m=0,h=0,g=0,v=0,_=0;t.sort(tD);for(let e=0,S=t.length;e<S;e++){let S=t[e],x=S.color,E=S.intensity,T=S.distance,M=null;if(S.shadow&&S.shadow.map&&(M=S.shadow.map.texture.format===b.RGFormat?S.shadow.map.texture:S.shadow.map.depthTexture||S.shadow.map.texture),S.isAmbientLight)i+=x.r*E,o+=x.g*E,l+=x.b*E;else if(S.isLightProbe){for(let e=0;e<9;e++)a.probe[e].addScaledVector(S.sh.coefficients[e],E);_++}else if(S.isDirectionalLight){let e=n.get(S);if(e.color.copy(S.color).multiplyScalar(S.intensity),S.castShadow){let e=S.shadow,t=r.get(S);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,a.directionalShadow[s]=t,a.directionalShadowMap[s]=M,a.directionalShadowMatrix[s]=S.shadow.matrix,p++}a.directional[s]=e,s++}else if(S.isSpotLight){let e=n.get(S);e.position.setFromMatrixPosition(S.matrixWorld),e.color.copy(x).multiplyScalar(E),e.distance=T,e.coneCos=Math.cos(S.angle),e.penumbraCos=Math.cos(S.angle*(1-S.penumbra)),e.decay=S.decay,a.spot[c]=e;let t=S.shadow;if(S.map&&(a.spotLightMap[g]=S.map,g++,t.updateMatrices(S),S.castShadow&&v++),a.spotLightMatrix[c]=t.matrix,S.castShadow){let e=r.get(S);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,a.spotShadow[c]=e,a.spotShadowMap[c]=M,h++}c++}else if(S.isRectAreaLight){let e=n.get(S);e.color.copy(x).multiplyScalar(E),e.halfWidth.set(.5*S.width,0,0),e.halfHeight.set(0,.5*S.height,0),a.rectArea[d]=e,d++}else if(S.isPointLight){let e=n.get(S);if(e.color.copy(S.color).multiplyScalar(S.intensity),e.distance=S.distance,e.decay=S.decay,S.castShadow){let e=S.shadow,t=r.get(S);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,a.pointShadow[u]=t,a.pointShadowMap[u]=M,a.pointShadowMatrix[u]=S.shadow.matrix,m++}a.point[u]=e,u++}else if(S.isHemisphereLight){let e=n.get(S);e.skyColor.copy(S.color).multiplyScalar(E),e.groundColor.copy(S.groundColor).multiplyScalar(E),a.hemi[f]=e,f++}}d>0&&(!0===e.has("OES_texture_float_linear")?(a.rectAreaLTC1=R.LTC_FLOAT_1,a.rectAreaLTC2=R.LTC_FLOAT_2):(a.rectAreaLTC1=R.LTC_HALF_1,a.rectAreaLTC2=R.LTC_HALF_2)),a.ambient[0]=i,a.ambient[1]=o,a.ambient[2]=l;let S=a.hash;(S.directionalLength!==s||S.pointLength!==u||S.spotLength!==c||S.rectAreaLength!==d||S.hemiLength!==f||S.numDirectionalShadows!==p||S.numPointShadows!==m||S.numSpotShadows!==h||S.numSpotMaps!==g||S.numLightProbes!==_)&&(a.directional.length=s,a.spot.length=c,a.rectArea.length=d,a.point.length=u,a.hemi.length=f,a.directionalShadow.length=p,a.directionalShadowMap.length=p,a.pointShadow.length=m,a.pointShadowMap.length=m,a.spotShadow.length=h,a.spotShadowMap.length=h,a.directionalShadowMatrix.length=p,a.pointShadowMatrix.length=m,a.spotLightMatrix.length=h+g-v,a.spotLightMap.length=g,a.numSpotLightShadowsWithMaps=v,a.numLightProbes=_,S.directionalLength=s,S.pointLength=u,S.spotLength=c,S.rectAreaLength=d,S.hemiLength=f,S.numDirectionalShadows=p,S.numPointShadows=m,S.numSpotShadows=h,S.numSpotMaps=g,S.numLightProbes=_,a.version=tL++)},setupView:function(e,t){let n=0,r=0,s=0,u=0,c=0,d=t.matrixWorldInverse;for(let t=0,f=e.length;t<f;t++){let f=e[t];if(f.isDirectionalLight){let e=a.directional[n];e.direction.setFromMatrixPosition(f.matrixWorld),i.setFromMatrixPosition(f.target.matrixWorld),e.direction.sub(i),e.direction.transformDirection(d),n++}else if(f.isSpotLight){let e=a.spot[s];e.position.setFromMatrixPosition(f.matrixWorld),e.position.applyMatrix4(d),e.direction.setFromMatrixPosition(f.matrixWorld),i.setFromMatrixPosition(f.target.matrixWorld),e.direction.sub(i),e.direction.transformDirection(d),s++}else if(f.isRectAreaLight){let e=a.rectArea[u];e.position.setFromMatrixPosition(f.matrixWorld),e.position.applyMatrix4(d),l.identity(),o.copy(f.matrixWorld),o.premultiply(d),l.extractRotation(o),e.halfWidth.set(.5*f.width,0,0),e.halfHeight.set(0,.5*f.height,0),e.halfWidth.applyMatrix4(l),e.halfHeight.applyMatrix4(l),u++}else if(f.isPointLight){let e=a.point[r];e.position.setFromMatrixPosition(f.matrixWorld),e.position.applyMatrix4(d),r++}else if(f.isHemisphereLight){let e=a.hemi[c];e.direction.setFromMatrixPosition(f.matrixWorld),e.direction.transformDirection(d),c++}}},state:a}}function tI(e){let t=new tN(e),n=[],r=[],a=[],i={lightsArray:n,shadowsArray:r,lightProbeGridArray:a,camera:null,lights:t,transmissionRenderTarget:{},textureUnits:0};return{init:function(e){i.camera=e,n.length=0,r.length=0,a.length=0},state:i,setupLights:function(){t.setup(n)},setupLightsView:function(e){t.setupView(n,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){r.push(e)},pushLightProbeGrid:function(e){a.push(e)}}}function tF(e){let t=new WeakMap;return{get:function(n,r=0){let a,i=t.get(n);return void 0===i?(a=new tI(e),t.set(n,[a])):r>=i.length?(a=new tI(e),i.push(a)):a=i[r],a},dispose:function(){t=new WeakMap}}}let tB=[new b.Vector3(1,0,0),new b.Vector3(-1,0,0),new b.Vector3(0,1,0),new b.Vector3(0,-1,0),new b.Vector3(0,0,1),new b.Vector3(0,0,-1)],tO=[new b.Vector3(0,-1,0),new b.Vector3(0,-1,0),new b.Vector3(0,0,1),new b.Vector3(0,0,-1),new b.Vector3(0,-1,0),new b.Vector3(0,-1,0)],tG=new b.Matrix4,tk=new b.Vector3,tz=new b.Vector3;function tH(e,t,n){let r=new b.Frustum,a=new b.Vector2,i=new b.Vector2,o=new b.Vector4,l=new b.MeshDepthMaterial,s=new b.MeshDistanceMaterial,u={},c=n.maxTextureSize,d={[b.FrontSide]:b.BackSide,[b.BackSide]:b.FrontSide,[b.DoubleSide]:b.DoubleSide}
358,f=new b.ShaderMaterial({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new b.Vector2},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}"}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let m=new b.BufferGeometry;m.setAttribute("position",new b.BufferAttribute(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let h=new b.Mesh(m,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=b.PCFShadowMap;let v=this.type;function _(t,n,r,a){let i=null,o=!0===r.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==o)i=o;else if(i=!0===r.isPointLight?s:l,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||!0===n.alphaToCoverage){let e=i.uuid,t=n.uuid,r=u[e];void 0===r&&(r={},u[e]=r);let a=r[t];void 0===a&&(a=i.clone(),r[t]=a,n.addEventListener("dispose",S)),i=a}return i.visible=n.visible,i.wireframe=n.wireframe,a===b.VSMShadowMap?i.side=null!==n.shadowSide?n.shadowSide:n.side:i.side=null!==n.shadowSide?n.shadowSide:d[n.side],i.alphaMap=n.alphaMap,i.alphaTest=!0===n.alphaToCoverage?.5:n.alphaTest,i.map=n.map,i.clipShadows=n.clipShadows,i.clippingPlanes=n.clippingPlanes,i.clipIntersection=n.clipIntersection,i.displacementMap=n.displacementMap,i.displacementScale=n.displacementScale,i.displacementBias=n.displacementBias,i.wireframeLinewidth=n.wireframeLinewidth,i.linewidth=n.linewidth,!0===r.isPointLight&&!0===i.isMeshDistanceMaterial&&(e.properties.get(i).light=r),i}function S(e){for(let t in e.target.removeEventListener("dispose",S),u){let n=u[t],r=e.target.uuid;r in n&&(n[r].dispose(),delete n[r])}}this.render=function(n,l,s){if(!1===g.enabled||!1===g.autoUpdate&&!1===g.needsUpdate||0===n.length)return;this.type===b.PCFSoftShadowMap&&((0,b.warn)("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=b.PCFShadowMap);let u=e.getRenderTarget(),d=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),S=e.state;S.setBlending(b.NoBlending),!0===S.buffers.depth.getReversed()?S.buffers.color.setClear(0,0,0,0):S.buffers.color.setClear(1,1,1,1),S.buffers.depth.setTest(!0),S.setScissorTest(!1);let x=v!==this.type;x&&l.traverse(function(e){e.material&&(Array.isArray(e.material)?e.material.forEach(e=>e.needsUpdate=!0):e.material.needsUpdate=!0)});for(let u=0,d=n.length;u<d;u++){let d=n[u],m=d.shadow;if(void 0===m){(0,b.warn)("WebGLShadowMap:",d,"has no shadow.");continue}if(!1===m.autoUpdate&&!1===m.needsUpdate)continue;a.copy(m.mapSize);let g=m.getFrameExtents();a.multiply(g),i.copy(m.mapSize),(a.x>c||a.y>c)&&(a.x>c&&(i.x=Math.floor(c/g.x),a.x=i.x*g.x,m.mapSize.x=i.x),a.y>c&&(i.y=Math.floor(c/g.y),a.y=i.y*g.y,m.mapSize.y=i.y));let v=e.state.buffers.depth.getReversed();if(m.camera._reversedDepth=v,null===m.map||!0===x){if(null!==m.map&&(null!==m.map.depthTexture&&(m.map.depthTexture.dispose(),m.map.depthTexture=null),m.map.dispose()),this.type===b.VSMShadowMap){if
358(d.isPointLight){(0,b.warn)("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}m.map=new b.WebGLRenderTarget(a.x,a.y,{format:b.RGFormat,type:b.HalfFloatType,minFilter:b.LinearFilter,magFilter:b.LinearFilter,generateMipmaps:!1}),m.map.texture.name=d.name+".shadowMap",m.map.depthTexture=new b.DepthTexture(a.x,a.y,b.FloatType),m.map.depthTexture.name=d.name+".shadowMapDepth",m.map.depthTexture.format=b.DepthFormat,m.map.depthTexture.compareFunction=null,m.map.depthTexture.minFilter=b.NearestFilter,m.map.depthTexture.magFilter=b.NearestFilter}else d.isPointLight?(m.map=new $(a.x),m.map.depthTexture=new b.CubeDepthTexture(a.x,b.UnsignedIntType)):(m.map=new b.WebGLRenderTarget(a.x,a.y),m.map.depthTexture=new b.DepthTexture(a.x,a.y,b.UnsignedIntType)),m.map.depthTexture.name=d.name+".shadowMap",m.map.depthTexture.format=b.DepthFormat,this.type===b.PCFShadowMap?(m.map.depthTexture.compareFunction=v?b.GreaterEqualCompare:b.LessEqualCompare,m.map.depthTexture.minFilter=b.LinearFilter,m.map.depthTexture.magFilter=b.LinearFilter):(m.map.depthTexture.compareFunction=null,m.map.depthTexture.minFilter=b.NearestFilter,m.map.depthTexture.magFilter=b.NearestFilter);m.camera.updateProjectionMatrix()}let E=m.map.isWebGLCubeRenderTarget?6:1;for(let n=0;n<E;n++){if(m.map.isWebGLCubeRenderTarget)e.setRenderTarget(m.map,n),e.clear();else{0===n&&(e.setRenderTarget(m.map),e.clear());let t=m.getViewport(n);o.set(i.x*t.x,i.y*t.y,i.x*t.z,i.y*t.w),S.viewport(o)}if(d.isPointLight){let e=m.camera,t=m.matrix,r=d.distance||e.far;r!==e.far&&(e.far=r,e.updateProjectionMatrix()),tk.setFromMatrixPosition(d.matrixWorld),e.position.copy(tk),tz.copy(e.position),tz.add(tB[n]),e.up.copy(tO[n]),e.lookAt(tz),e.updateMatrixWorld(),t.makeTranslation(-tk.x,-tk.y,-tk.z),tG.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),m._frustum.setFromProjectionMatrix(tG,e.coordinateSystem,e.reversedDepth)}else m.updateMatrices(d);r=m.getFrustum(),function n(a,i,o,l,s){if(!1===a.visible)return;if(a.layers.test(i.layers)&&(a.isMesh||a.isLine||a.isPoints)&&(a.castShadow||a.receiveShadow&&s===b.VSMShadowMap)&&(!a.frustumCulled||r.intersectsObject(a))){a.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,a.matrixWorld);let n=t.update(a),r=a.material;if(Array.isArray(r)){let t=n.groups;for(let u=0,c=t.length;u<c;u++){let c=t[u],d=r[c.materialIndex];if(d&&d.visible){let t=_(a,d,l,s);a.onBeforeShadow(e,a,i,o,n,t,c),e.renderBufferDirect(o,null,n,t,a,c),a.onAfterShadow(e,a,i,o,n,t,c)}}}else if(r.visible){let t=_(a,r,l,s);a.onBeforeShadow(e,a,i,o,n,t,null),e.renderBufferDirect(o,null,n,t,a,null),a.onAfterShadow(e,a,i,o,n,t,null)}}let u=a.children;for(let e=0,t=u.length;e<t;e++)n(u[e],i,o,l,s)}(l,s,m.camera,d,this.type)}!0!==m.isPointLightShadow&&this.type===b.VSMShadowMap&&function(n,r){let i=t.update(h);f.defines.VSM_SAMPLES!==n.blurSamples&&(f.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,f.needsUpdate=!0,p.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new b.WebGLRenderTarget(a.x,a.y,{format:b.RGFormat,type:b.HalfFloatType})),f.uniforms.shadow_pass.value=n.map.depthTexture,f.uniforms.resolution.value=n.mapSize,f.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(r,null,i,f,h,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(r,null,i,p,h,null)}(m,s),m.needsUpdate=!1}v=this.type,g.needsUpdate=!1,e.setRenderTarget(u,d,m)}}function tV(e,t){let n=new function(){let t=!1,n=new b.Vector4,r=null,a=new b.Vector4(0,0,0,0);return{setMask:function(n){r===n||t||(e.colorMask(n,n,n,n),r=n)},setLocked:function(e){t=e},setClear:function(t,r,i,o,l){!0===l&&(t*=o,r*=o,i*=o),n.set(t,r,i,o),!1===a.equals(n)&&(e.clearColor(t,r,i,o),a.copy(n))},reset:function(){t=!1,r=null,a.set(-1,0,0,0)}}},r=new function(){let n=!1,r=!1,a=null,i=null,o=null;return{setReversed:function(e){if(r!==e){let n=t.get("EXT_clip_control");e?n.clipControlEXT(n.LOWER_LEFT_EXT,n.ZERO_TO_ONE_EXT):n.clipControlEXT(n.LOWER_LEFT_EXT,n.NEGATIVE_ONE_TO_ONE_EXT),r=e;let a=o;o=null,this.setClear(a)}},getReversed:function(){return r},setTest:function(t){t?z(e.DEPTH_TEST):H(e.DEPTH_TEST)},setMask:function(t){a===t||n||(e.depthMask(t),a=t)},setFunc:function(t){if(r&&(t=b.ReversedDepthFuncs[t]),i!==t){switch(t){case b.NeverDepth:e.depthFunc(e.NEVER);break;case b.AlwaysDepth:e.depthFunc(e.ALWAYS);break;case b.LessDepth:e.depthFunc(e.LESS);break;case b.LessEqualDepth:e.depthFunc(e.LEQUAL);break;case b.EqualDepth:e.depthFunc(e.EQUAL);break;case b.GreaterEqualDepth:e.depthFunc(e.GEQUAL);break;case b.GreaterDepth:e.depthFunc(e.GREATER);break;case b.NotEqualDepth:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}i=t}},setLocked:function(e){n=e},setClear:function(t){o!==t&&(o=t,r&&(t=1-t),e.clearDepth(t))},reset:function(){n=!1,a=null,i=null,o=null,r=!1}}},a=new function(){let t=!1,n=null,r=null,a=null,i=null,o=null,l=null,s=null,u=null;return{setTest:function(n){t||(n?z(e.STENCIL_TEST):H(e.STENCIL_TEST))},setMask:function(r){n===r||t||(e.stencilMask(r),n=r)},setFunc:function(t,n,o){(r!==t||a!==n||i!==o)&&(e.stencilFunc(t,n,o),r=t,a=n,i=o)},setOp:function(t,n,r){(o!==t||l!==n||s!==r)&&(e.stencilOp(t,n,r),o=t,l=n,s=r)},setLocked:function(e){t=e},setClear:function(t){u!==t&&(e.clearStencil(t),u=t)},reset:function(){t=!1,n=null,r=null,a=null,i=null,o=null,l=null,s=null,u=null}}},i=new WeakMap,o=new WeakMap,l={},s={},u={},c=new WeakMap,d=[],f=null,p=!1,m=null,h=null,g=null,v=null,_=null,S=null,x=null,E=new b.Color(0,0,0),T=0,M=!1,y=null,R=null,C=null,A=null,w=null,P=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),U=!1,L=e.getParameter(e.VERSION);-1!==L.indexOf("WebGL")?U=parseFloat(/^WebGL (\d)/.exec(L)[1])>=1:-1!==L.indexOf("OpenGL ES")&&(U=parseFloat(/^OpenGL ES (\d)/.exec(L)[1])>=2);let D=null,N={},I=e.getParameter(e.SCISSOR_BOX),F=e.getParameter(e.VIEWPORT),B=new b.Vector4().fromArray(I),O=new b.Vector4().fromArray(F);function G(t,n,r,a){let i=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o<r;o++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,a,0,e.RGBA,e.UNSIGNED_BYTE,i):e.texImage2D(n+o,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,i);return o}let k={};function z(t){!0!==l[t]&&(e.enable(t),l[t]=!0)}function H(t){!1!==l[t]&&(e.disable(t),l[t]=!1)}k[e.TEXTURE_2D]=G(e.TEXTURE_2D,e.TEXTURE_2D,1),k[e.TEXTURE_CUBE_MAP]=G(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),k[e.TEXTURE_2D_ARRAY]=G(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),k[e.TEXTURE_3D]=G(e.TEXTURE_3D,e.TEXTURE_3D,1,1),n.setClear(0,0,0,1),r.setClear(1),a.setClear(0),z(e.DEPTH_TEST),r.setFunc(b.LessEqualDepth),X(!1),q(b.CullFaceBack),z(e.CULL_FACE),j(b.NoBlending);let V={[b.AddEquation]:e.FUNC_ADD,[b.SubtractEquation]:e.FUNC_SUBTRACT,[b.ReverseSubtractEquation]:e.FUNC_REVERSE_SUBTRACT};V[b.MinEquation]=e.MIN,V[b.MaxEquation]=e.MAX;let W={[b.ZeroFactor]:e.ZERO,[b.OneFactor]:e.ONE,[b.SrcColorFactor]:e.SRC_COLOR,[b.SrcAlphaFactor]:e.SRC_ALPHA,[b.
358SrcAlphaSaturateFactor]:e.SRC_ALPHA_SATURATE,[b.DstColorFactor]:e.DST_COLOR,[b.DstAlphaFactor]:e.DST_ALPHA,[b.OneMinusSrcColorFactor]:e.ONE_MINUS_SRC_COLOR,[b.OneMinusSrcAlphaFactor]:e.ONE_MINUS_SRC_ALPHA,[b.OneMinusDstColorFactor]:e.ONE_MINUS_DST_COLOR,[b.OneMinusDstAlphaFactor]:e.ONE_MINUS_DST_ALPHA,[b.ConstantColorFactor]:e.CONSTANT_COLOR,[b.OneMinusConstantColorFactor]:e.ONE_MINUS_CONSTANT_COLOR,[b.ConstantAlphaFactor]:e.CONSTANT_ALPHA,[b.OneMinusConstantAlphaFactor]:e.ONE_MINUS_CONSTANT_ALPHA};function j(t,n,r,a,i,o,l,s,u,c){if(t===b.NoBlending){!0===p&&(H(e.BLEND),p=!1);return}if(!1===p&&(z(e.BLEND),p=!0),t!==b.CustomBlending){if(t!==m||c!==M){if((h!==b.AddEquation||_!==b.AddEquation)&&(e.blendEquation(e.FUNC_ADD),h=b.AddEquation,_=b.AddEquation),c)switch(t){case b.NormalBlending:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case b.AdditiveBlending:e.blendFunc(e.ONE,e.ONE);break;case b.SubtractiveBlending:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case b.MultiplyBlending:e.blendFuncSeparate(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ZERO,e.ONE);break;default:(0,b.error)("WebGLState: Invalid blending: ",t)}else switch(t){case b.NormalBlending:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case b.AdditiveBlending:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case b.SubtractiveBlending:(0,b.error)("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case b.MultiplyBlending:(0,b.error)("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:(0,b.error)("WebGLState: Invalid blending: ",t)}g=null,v=null,S=null,x=null,E.set(0,0,0),T=0,m=t,M=c}return}i=i||n,o=o||r,l=l||a,(n!==h||i!==_)&&(e.blendEquationSeparate(V[n],V[i]),h=n,_=i),(r!==g||a!==v||o!==S||l!==x)&&(e.blendFuncSeparate(W[r],W[a],W[o],W[l]),g=r,v=a,S=o,x=l),(!1===s.equals(E)||u!==T)&&(e.blendColor(s.r,s.g,s.b,u),E.copy(s),T=u),m=t,M=!1}function X(t){y!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),y=t)}function q(t){t!==b.CullFaceNone?(z(e.CULL_FACE),t!==R&&(t===b.CullFaceBack?e.cullFace(e.BACK):t===b.CullFaceFront?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):H(e.CULL_FACE),R=t}function K(t,n,a){t?(z(e.POLYGON_OFFSET_FILL),(A!==n||w!==a)&&(A=n,w=a,r.getReversed()&&(n=-n),e.polygonOffset(n,a))):H(e.POLYGON_OFFSET_FILL)}return{buffers:{color:n,depth:r,stencil:a},enable:z,disable:H,bindFramebuffer:function(t,n){return u[t]!==n&&(e.bindFramebuffer(t,n),u[t]=n,t===e.DRAW_FRAMEBUFFER&&(u[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(u[e.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(t,n){let r=d,a=!1;if(t){void 0===(r=c.get(n))&&(r=[],c.set(n,r));let i=t.textures;if(r.length!==i.length||r[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=i.length;t<n;t++)r[t]=e.COLOR_ATTACHMENT0+t;r.length=i.length,a=!0}}else r[0]!==e.BACK&&(r[0]=e.BACK,a=!0);a&&e.drawBuffers(r)},useProgram:function(t){return f!==t&&(e.useProgram(t),f=t,!0)},setBlending:j,setMaterial:function(t,i){t.side===b.DoubleSide?H(e.CULL_FACE):z(e.CULL_FACE);let o=t.side===b.BackSide;i&&(o=!o),X(o),t.blending===b.NormalBlending&&!1===t.transparent?j(b.NoBlending):j(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.blendColor,t.blendAlpha,t.premultipliedAlpha),r.setFunc(t.depthFunc),r.setTest(t.depthTest),r.setMask(t.depthWrite),n.setMask(t.colorWrite);let l=t.stencilWrite;a.setTest(l),l&&(a.setMask(t.stencilWriteMask),a.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),a.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),K(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?z(e.SAMPLE_ALPHA_TO_COVERAGE):H(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:X,setCullFace:q,setLineWidth:function(t){t!==C&&(U&&e.lineWidth(t),C=t)},setPolygonOffset:K,setScissorTest:function(t){t?z(e.SCISSOR_TEST):H(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+P-1),D!==t&&(e.activeTexture(t),D=t)},bindTexture:function(t,n,r){void 0===r&&(r=null===D?e.TEXTURE0+P-1:D);let a=N[r];void 0===a&&(a={type:void 0,texture:void 0},N[r]=a),(a.type!==t||a.texture!==n)&&(D!==r&&(e.activeTexture(r),D=r),e.bindTexture(t,n||k[t]),a.type=t,a.texture=n)},unbindTexture:function(){let t=N[D];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D(...arguments)}catch(e){(0,b.error)("WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D(...arguments)}catch(e){(0,b.error)("WebGLState:",e)}},texImage2D:function(){try{e.texImage2D(...arguments)}catch(e){(0,b.error)("WebGLState:",e)}},texImage3D:function(){try{e.texImage3D(...arguments)}catch(e){(0,b.error)("WebGLState:",e)}},pixelStorei:function(t,n){s[t]!==n&&(e.pixelStorei(t,n),s[t]=n)},getParameter:function(t){return void 0!==s[t]?s[t]:e.getParameter(t)},updateUBOMapping:function(t,n){let r=o.get(n);void 0===r&&(r=new WeakMap,o.set(n,r));let a=r.get(t);void 0===a&&(a=e.getUniformBlockIndex(n,t.name),r.set(t,a))},uniformBlockBinding:function(t,n){let r=o.get(n).get(t);i.get(n)!==r&&(e.uniformBlockBinding(n,r,t.__bindingPointIndex),i.set(n,r))},texStorage2D:function(){try{e.texStorage2D(...arguments)}catch(e){(0,b.error)("WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D(...arguments)}catch(e){(0,b.error)("WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D(...arguments)}catch(e){(0,b.error)("WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D(...arguments)}catch(e){(0,b.error)("WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D(...arguments)}catch(e){(0,b.error)("WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D(...arguments)}catch(e){(0,b.error)("WebGLState:",e)}},scissor:function(t){!1===B.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),B.copy(t))},viewport:function(t){!1===O.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),O.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor
358(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),r.setReversed(!1),e.clearDepth(1),e.stencilMask(0xffffffff),e.stencilFunc(e.ALWAYS,0,0xffffffff),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),e.pixelStorei(e.PACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_ALIGNMENT,4),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),e.pixelStorei(e.PACK_ROW_LENGTH,0),e.pixelStorei(e.PACK_SKIP_PIXELS,0),e.pixelStorei(e.PACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_ROW_LENGTH,0),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,0),e.pixelStorei(e.UNPACK_SKIP_PIXELS,0),e.pixelStorei(e.UNPACK_SKIP_ROWS,0),e.pixelStorei(e.UNPACK_SKIP_IMAGES,0),l={},s={},D=null,N={},u={},c=new WeakMap,d=[],f=null,p=!1,m=null,h=null,g=null,v=null,_=null,S=null,x=null,E=new b.Color(0,0,0),T=0,M=!1,y=null,R=null,C=null,A=null,w=null,B.set(0,0,e.canvas.width,e.canvas.height),O.set(0,0,e.canvas.width,e.canvas.height),n.reset(),r.reset(),a.reset()}}}function tW(e,t,n,r,a,i,o){let l,s=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,u="u">typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new b.Vector2,d=new WeakMap,f=new Set,p=new WeakMap,m=!1;try{m="u">typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function h(e,t){return m?new OffscreenCanvas(e,t):(0,b.createElementNS)("canvas")}function g(e,t,n){let r=1,a=W(e);if((a.width>n||a.height>n)&&(r=n/Math.max(a.width,a.height)),r<1)if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof VideoFrame&&e instanceof VideoFrame){let n=Math.floor(r*a.width),i=Math.floor(r*a.height);void 0===l&&(l=h(n,i));let o=t?h(n,i):l;return o.width=n,o.height=i,o.getContext("2d").drawImage(e,0,0,n,i),(0,b.warn)("WebGLRenderer: Texture has been resized from ("+a.width+"x"+a.height+") to ("+n+"x"+i+")."),o}else"data"in e&&(0,b.warn)("WebGLRenderer: Image in DataTexture is too big ("+a.width+"x"+a.height+").");return e}function v(e){return e.generateMipmaps}function _(t){e.generateMipmap(t)}function S(n,r,a,i,o,l=!1){let s;if(null!==n){if(void 0!==e[n])return e[n];(0,b.warn)("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}i&&((s=t.get("EXT_texture_norm16"))||(0,b.warn)("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let u=r;if(r===e.RED&&(a===e.FLOAT&&(u=e.R32F),a===e.HALF_FLOAT&&(u=e.R16F),a===e.UNSIGNED_BYTE&&(u=e.R8),a===e.UNSIGNED_SHORT&&s&&(u=s.R16_EXT),a===e.SHORT&&s&&(u=s.R16_SNORM_EXT)),r===e.RED_INTEGER&&(a===e.UNSIGNED_BYTE&&(u=e.R8UI),a===e.UNSIGNED_SHORT&&(u=e.R16UI),a===e.UNSIGNED_INT&&(u=e.R32UI),a===e.BYTE&&(u=e.R8I),a===e.SHORT&&(u=e.R16I),a===e.INT&&(u=e.R32I)),r===e.RG&&(a===e.FLOAT&&(u=e.RG32F),a===e.HALF_FLOAT&&(u=e.RG16F),a===e.UNSIGNED_BYTE&&(u=e.RG8),a===e.UNSIGNED_SHORT&&s&&(u=s.RG16_EXT),a===e.SHORT&&s&&(u=s.RG16_SNORM_EXT)),r===e.RG_INTEGER&&(a===e.UNSIGNED_BYTE&&(u=e.RG8UI),a===e.UNSIGNED_SHORT&&(u=e.RG16UI),a===e.UNSIGNED_INT&&(u=e.RG32UI),a===e.BYTE&&(u=e.RG8I),a===e.SHORT&&(u=e.RG16I),a===e.INT&&(u=e.RG32I)),r===e.RGB_INTEGER&&(a===e.UNSIGNED_BYTE&&(u=e.RGB8UI),a===e.UNSIGNED_SHORT&&(u=e.RGB16UI),a===e.UNSIGNED_INT&&(u=e.RGB32UI),a===e.BYTE&&(u=e.RGB8I),a===e.SHORT&&(u=e.RGB16I),a===e.INT&&(u=e.RGB32I)),r===e.RGBA_INTEGER&&(a===e.UNSIGNED_BYTE&&(u=e.RGBA8UI),a===e.UNSIGNED_SHORT&&(u=e.RGBA16UI),a===e.UNSIGNED_INT&&(u=e.RGBA32UI),a===e.BYTE&&(u=e.RGBA8I),a===e.SHORT&&(u=e.RGBA16I),a===e.INT&&(u=e.RGBA32I)),r===e.RGB&&(a===e.UNSIGNED_SHORT&&s&&(u=s.RGB16_EXT),a===e.SHORT&&s&&(u=s.RGB16_SNORM_EXT),a===e.UNSIGNED_INT_5_9_9_9_REV&&(u=e.RGB9_E5),a===e.UNSIGNED_INT_10F_11F_11F_REV&&(u=e.R11F_G11F_B10F)),r===e.RGBA){let t=l?b.LinearTransfer:b.ColorManagement.getTransfer(o);a===e.FLOAT&&(u=e.RGBA32F),a===e.HALF_FLOAT&&(u=e.RGBA16F),a===e.UNSIGNED_BYTE&&(u=t===b.SRGBTransfer?e.SRGB8_ALPHA8:e.RGBA8),a===e.UNSIGNED_SHORT&&s&&(u=s.RGBA16_EXT),a===e.SHORT&&s&&(u=s.RGBA16_SNORM_EXT),a===e.UNSIGNED_SHORT_4_4_4_4&&(u=e.RGBA4),a===e.UNSIGNED_SHORT_5_5_5_1&&(u=e.RGB5_A1)}return(u===e.R16F||u===e.R32F||u===e.RG16F||u===e.RG32F||u===e.RGBA16F||u===e.RGBA32F)&&t.get("EXT_color_buffer_float"),u}function x(t,n){let r;return t?null===n||n===b.UnsignedIntType||n===b.UnsignedInt248Type?r=e.DEPTH24_STENCIL8:n===b.FloatType?r=e.DEPTH32F_STENCIL8:n===b.UnsignedShortType&&(r=e.DEPTH24_STENCIL8,(0,b.warn)("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===b.UnsignedIntType||n===b.UnsignedInt248Type?r=e.DEPTH_COMPONENT24:n===b.FloatType?r=e.DEPTH_COMPONENT32F:n===b.UnsignedShortType&&(r=e.DEPTH_COMPONENT16),r}function E(e,t){return!0===v(e)||e.isFramebufferTexture&&e.minFilter!==b.NearestFilter&&e.minFilter!==b.LinearFilter?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function T(e){let t=e.target;t.removeEventListener("dispose",T),function(e){let t=r.get(e);if(void 0===t.__webglInit)return;let n=e.source,a=p.get(n);if(a){let r=a[t.__cacheKey];r.usedTimes--,0===r.usedTimes&&y(e),0===Object.keys(a).length&&p.delete(n)}r.remove(e)}(t),t.isVideoTexture&&d.delete(t),t.isHTMLTexture&&f.delete(t)}function M(t){let n=t.target;n.removeEventListener("dispose",M),function(t){let n=r.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture)),t.isWebGLCubeRen
358derTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r<n.__webglFramebuffer[t].length;r++)e.deleteFramebuffer(n.__webglFramebuffer[t][r]);else e.deleteFramebuffer(n.__webglFramebuffer[t]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}let a=t.textures;for(let t=0,n=a.length;t<n;t++){let n=r.get(a[t]);n.__webglTexture&&(e.deleteTexture(n.__webglTexture),o.memory.textures--),r.remove(a[t])}r.remove(t)}(n)}function y(t){let n=r.get(t);e.deleteTexture(n.__webglTexture);let a=t.source,i=p.get(a);delete i[n.__cacheKey],o.memory.textures--}let R=0;function C(t,a){var i;let l,s=r.get(t);if(t.isVideoTexture&&(i=t,l=o.render.frame,d.get(i)!==l&&(d.set(i,l),i.update())),!1===t.isRenderTargetTexture&&!0!==t.isExternalTexture&&t.version>0&&s.__version!==t.version){let e=t.image;if(null===e)(0,b.warn)("WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void N(s,t,a);(0,b.warn)("WebGLRenderer: Texture marked for update but image is incomplete")}}else t.isExternalTexture&&(s.__webglTexture=t.sourceTexture?t.sourceTexture:null);n.bindTexture(e.TEXTURE_2D,s.__webglTexture,e.TEXTURE0+a)}let A={[b.RepeatWrapping]:e.REPEAT,[b.ClampToEdgeWrapping]:e.CLAMP_TO_EDGE,[b.MirroredRepeatWrapping]:e.MIRRORED_REPEAT},w={[b.NearestFilter]:e.NEAREST,[b.NearestMipmapNearestFilter]:e.NEAREST_MIPMAP_NEAREST,[b.NearestMipmapLinearFilter]:e.NEAREST_MIPMAP_LINEAR,[b.LinearFilter]:e.LINEAR,[b.LinearMipmapNearestFilter]:e.LINEAR_MIPMAP_NEAREST,[b.LinearMipmapLinearFilter]:e.LINEAR_MIPMAP_LINEAR},P={[b.NeverCompare]:e.NEVER,[b.AlwaysCompare]:e.ALWAYS,[b.LessCompare]:e.LESS,[b.LessEqualCompare]:e.LEQUAL,[b.EqualCompare]:e.EQUAL,[b.GreaterEqualCompare]:e.GEQUAL,[b.GreaterCompare]:e.GREATER,[b.NotEqualCompare]:e.NOTEQUAL};
358function U(n,i){if((i.type===b.FloatType&&!1===t.has("OES_texture_float_linear")&&(i.magFilter===b.LinearFilter||i.magFilter===b.LinearMipmapNearestFilter||i.magFilter===b.NearestMipmapLinearFilter||i.magFilter===b.LinearMipmapLinearFilter||i.minFilter===b.LinearFilter||i.minFilter===b.LinearMipmapNearestFilter||i.minFilter===b.NearestMipmapLinearFilter||i.minFilter===b.LinearMipmapLinearFilter)&&(0,b.warn)("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,A[i.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,A[i.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,A[i.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,w[i.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,w[i.minFilter]),i.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,P[i.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic"))&&i.magFilter!==b.NearestFilter&&(i.minFilter===b.NearestMipmapLinearFilter||i.minFilter===b.LinearMipmapLinearFilter)&&(i.type!==b.FloatType||!1!==t.has("OES_texture_float_linear"))&&(i.anisotropy>1||r.get(i).__currentAnisotropy)){let o=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(i.anisotropy,a.getMaxAnisotropy())),r.get(i).__currentAnisotropy=i.anisotropy}}function L(t,n){let r,a=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",T));let i=n.source,l=p.get(i);void 0===l&&(l={},p.set(i,l));let s=((r=[]).push(n.wrapS),r.push(n.wrapT),r.push(n.wrapR||0),r.push(n.magFilter),r.push(n.minFilter),r.push(n.anisotropy),r.push(n.internalFormat),r.push(n.format),r.push(n.type),r.push(n.generateMipmaps),r.push(n.premultiplyAlpha),r.push(n.flipY),r.push(n.unpackAlignment),r.push(n.colorSpace),r.join());if(s!==t.__cacheKey){void 0===l[s]&&(l[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,a=!0),l[s].usedTimes++;let r=l[t.__cacheKey];void 0!==r&&(l[t.__cacheKey].usedTimes--,0===r.usedTimes&&y(n)),t.__cacheKey=s,t.__webglTexture=l[s].texture}return a}function D(e,t,n){return Math.floor(Math.floor(e/n)/t)}function N(t,o,l){let s=e.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(s=e.TEXTURE_2D_ARRAY),o.isData3DTexture&&(s=e.TEXTURE_3D);let u=L(t,o),c=o.source;n.bindTexture(s,t.__webglTexture,e.TEXTURE0+l);let d=r.get(c);if(c.version!==d.__version||!0===u){let t;if(n.activeTexture(e.TEXTURE0+l),!1==("u">typeof ImageBitmap&&o.image instanceof ImageBitmap)){let t=b.ColorManagement.getPrimaries(b.ColorManagement.workingColorSpace),r=o.colorSpace
358===b.NoColorSpace?null:b.ColorManagement.getPrimaries(o.colorSpace),a=o.colorSpace===b.NoColorSpace||t===r?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,a)}n.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment);let r=g(o.image,!1,a.maxTextureSize);r=V(o,r);let p=i.convert(o.format,o.colorSpace),m=i.convert(o.type),h=S(o.internalFormat,p,m,o.normalized,o.colorSpace,o.isVideoTexture);U(s,o);let T=o.mipmaps,M=!0!==o.isVideoTexture,y=void 0===d.__version||!0===u,R=c.dataReady,C=E(o,r);if(o.isDepthTexture)h=x(o.format===b.DepthStencilFormat,o.type),y&&(M?n.texStorage2D(e.TEXTURE_2D,1,h,r.width,r.height):n.texImage2D(e.TEXTURE_2D,0,h,r.width,r.height,0,p,m,null));else if(o.isDataTexture)if(T.length>0){M&&y&&n.texStorage2D(e.TEXTURE_2D,C,h,T[0].width,T[0].height);for(let r=0,a=T.length;r<a;r++)t=T[r],M?R&&n.texSubImage2D(e.TEXTURE_2D,r,0,0,t.width,t.height,p,m,t.data):n.texImage2D(e.TEXTURE_2D,r,h,t.width,t.height,0,p,m,t.data);o.generateMipmaps=!1}else M?(y&&n.texStorage2D(e.TEXTURE_2D,C,h,r.width,r.height),R&&function(t,r,a,i){let o=t.updateRanges;if(0===o.length)n.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,a,i,r.data);else{o.sort((e,t)=>e.start-t.start);let l=0;for(let e=1;e<o.length;e++){let t=o[l],n=o[e],a=t.start+t.count,i=D(n.start,r.width,4),s=D(t.start,r.width,4);n.start<=a+1&&i===s&&D(n.start+n.count-1,r.width,4)===i?t.count=Math.max(t.count,n.start+n.count-t.start):o[++l]=n}o.length=l+1;let s=n.getParameter(e.UNPACK_ROW_LENGTH),u=n.getParameter(e.UNPACK_SKIP_PIXELS),c=n.getParameter(e.UNPACK_SKIP_ROWS);n.pixelStorei(e.UNPACK_ROW_LENGTH,r.width);for(let t=0,l=o.length;t<l;t++){let l=o[t],s=Math.floor(l.start/4),u=Math.ceil(l.count/4),c=s%r.width,d=Math.floor(s/r.width);n.pixelStorei(e.UNPACK_SKIP_PIXELS,c),n.pixelStorei(e.UNPACK_SKIP_ROWS,d),n.texSubImage2D(e.TEXTURE_2D,0,c,d,u,1,a,i,r.data)}t.clearUpdateRanges(),n.pixelStorei(e.UNPACK_ROW_LENGTH,s),n.pixelStorei(e.UNPACK_SKIP_PIXELS,u),n.pixelStorei(e.UNPACK_SKIP_ROWS,c)}}(o,r,p,m)):n.texImage2D(e.TEXTURE_2D,0,h,r.width,r.height,0,p,m,r.data);else if(o.isCompressedTexture)if(o.isCompressedArrayTexture){M&&y&&n.texStorage3D(e.TEXTURE_2D_ARRAY,C,h,T[0].width,T[0].height,r.depth);for(let a=0,i=T.length;a<i;a++)if(t=T[a],o.format!==b.RGBAFormat)if(null!==p)if(M){if(R)if(o.layerUpdates.size>0){let r=(0,b.getByteLength)(t.width,t.height,o.format,o.type);for(let i of o.layerUpdates){let o=t.data.subarray(i*r/t.data.BYTES_PER_ELEMENT,(i+1)
vendor: 4,836 bytes, line 358
358*r/t.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,a,0,0,i,t.width,t.height,1,p,o)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,a,0,0,0,t.width,t.height,r.depth,p,t.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,a,h,t.width,t.height,r.depth,0,t.data,0,0);else(0,b.warn)("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else M?R&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,a,0,0,0,t.width,t.height,r.depth,p,m,t.data):n.texImage3D(e.TEXTURE_2D_ARRAY,a,h,t.width,t.height,r.depth,0,p,m,t.data)}else{M&&y&&n.texStorage2D(e.TEXTURE_2D,C,h,T[0].width,T[0].height);for(let r=0,a=T.length;r<a;r++)t=T[r],o.format!==b.RGBAFormat?null!==p?M?R&&n.compressedTexSubImage2D(e.TEXTURE_2D,r,0,0,t.width,t.height,p,t.data):n.compressedTexImage2D(e.TEXTURE_2D,r,h,t.width,t.height,0,t.data):(0,b.warn)("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):M?R&&n.texSubImage2D(e.TEXTURE_2D,r,0,0,t.width,t.height,p,m,t.data):n.texImage2D(e.TEXTURE_2D,r,h,t.width,t.height,0,p,m,t.data)}else if(o.isDataArrayTexture)if(M){if(y&&n.texStorage3D(e.TEXTURE_2D_ARRAY,C,h,r.width,r.height,r.depth),R)if(o.layerUpdates.size>0){let t=(0,b.getByteLength)(r.width,r.height,o.format,o.type);for(let a of o.layerUpdates){let i=r.data.subarray(a*t/r.data.BYTES_PER_ELEMENT,(a+1)*t/r.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,a,r.width,r.height,1,p,m,i)}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,r.width,r.height,r.depth,p,m,r.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,h,r.width,r.height,r.depth,0,p,m,r.data);else if(o.isData3DTexture)M?(y&&n.texStorage3D(e.TEXTURE_3D,C,h,r.width,r.height,r.depth),R&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,r.width,r.height,r.depth,p,m,r.data)):n.texImage3D(e.TEXTURE_3D,0,h,r.width,r.height,r.depth,0,p,m,r.data);else if(o.isFramebufferTexture){if(y)if(M)n.texStorage2D(e.TEXTURE_2D,C,h,r.width,r.height);else{let t=r.width,a=r.height;for(let r=0;r<C;r++)n.texImage2D(e.TEXTURE_2D,r,h,t,a,0,p,m,null),t>>=1,a>>=1}}else if(o.isHTMLTexture){if("texElementImage2D"in e){let t=e.canvas;if(t.hasAttribute("layoutsubtree")||t.setAttribute("layoutsubtree","true"),r.parentNode!==t){t.appendChild(r),f.add(o),t.onpaint=e=>{let t=e.changedElements;for(let e of f)t.includes(e.image)&&(e.needsUpdate=!0)},t.requestPaint();return}if(3===e.texElementImage2D.length)e.texElementImage2D(e.TEXTURE_2D,e.RGBA8,r);else{let t=e.RGBA,n=e.RGBA,a=e.UNSIGNED_BYTE;e.texElementImage2D(e.TEXTURE_2D,0,t,n,a,r)}e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}else if(T.length>0){if(M&&y){let t=W(T[0]);n.texStorage2D(e.TEXTURE_2D,C,h,t.width,t.height)}for(let r=0,a=T.length;r<a;r++)t=T[r],M?R&&n.texSubImage2D(e.TEXTURE_2D,r,0,0,p,m,t):n.texImage2D(e.TEXTURE_2D,r,h,p,m,t);o.generateMipmaps=!1}else if(M){if(y){let t=W(r);n.texStorage2D(e.TEXTURE_2D,C,h,t.width,t.height)}R&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,p,m,r)}else n.texImage2D(e.TEXTURE_2D,0,h,p,m,r);v(o)&&_(s),d.__version=c.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}function I(t,a,o,l,u,c){let d=i.convert(o.format,o.colorSpace),f=i.convert(o.type),p=S(o.internalFormat,d,f,o.normalized,o.colorSpace),m=r.get(a),h=r.get(o);if(h.__renderTarget=a,!m.__hasExternalTextures){let t=Math.max(1,a.width>>c),r=Math.max(1,a.height>>c);u===e.TEXTURE_3D||u===e.TEXTURE_2D_ARRAY?n.texImage3D(u,c,p,t,r,a.depth,0,d,f,null):n.texImage2D(u,c,p,t,r,0,d,f,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),H(a)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,u,h.__webglTexture,0,z(a)):(u===e.TEXTURE_2D||u>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&u<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,l,u,h.__webglTexture,c),n.bindFramebuffer(e.FRAMEBUFFER,null)}function F(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let a=n.depthTexture,i=a&&a.isDepthTexture?a.type:null,o=x(n.stencilBuffer,i),l=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;H(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,z(n),o,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,z(n),o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,t)}else{let t=n.textures;for(let a=0;a<t.length;a++){let o=t[a],l=i.convert(o.format,o.colorSpace),u=i.convert(o.type),c=S(o.internalFormat,l,u,o.normalized,o.colorSpace);H(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,z(n),c,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,z(n),c,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,c,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}
358function B(t,a,o){let l=!0===a.isWebGLCubeRenderTarget;if(n.bindFramebuffer(e.FRAMEBUFFER,t),!(a.depthTexture&&a.depthTexture.isDepthTexture))throw Error("THREE.WebGLTextures: renderTarget.depthTexture must be an instance of THREE.DepthTexture.");let u=r.get(a.depthTexture);if(u.__renderTarget=a,u.__webglTexture&&a.depthTexture.image.width===a.width&&a.depthTexture.image.height===a.height||(a.depthTexture.image.width=a.width,a.depthTexture.image.height=a.height,a.depthTexture.needsUpdate=!0),l){if(void 0===u.__webglInit&&(u.__webglInit=!0,a.depthTexture.addEventListener("dispose",T)),void 0===u.__webglTexture){let t;u.__webglTexture=e.createTexture(),n.bindTexture(e.TEXTURE_CUBE_MAP,u.__webglTexture),U(e.TEXTURE_CUBE_MAP,a.depthTexture);let r=i.convert(a.depthTexture.format),o=i.convert(a.depthTexture.type);a.depthTexture.format===b.DepthFormat?t=e.DEPTH_COMPONENT24:a.depthTexture.format===b.DepthStencilFormat&&(t=e.DEPTH24_STENCIL8);for(let n=0;n<6;n++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,t,a.width,a.height,0,r,o,null)}}else C(a.depthTexture,0);let c=u.__webglTexture,d=z(a),f=l?e.TEXTURE_CUBE_MAP_POSITIVE_X+o:e.TEXTURE_2D,p=a.depthTexture.format===b.DepthStencilFormat?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;if(a.depthTexture.format===b.DepthFormat)H(a)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,f,c,0,d):e.framebufferTexture2D(e.FRAMEBUFFER,p,f,c,0);else if(a.depthTexture.format===b.DepthStencilFormat)H(a)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,p,f,c,0,d):e.framebufferTexture2D(e.FRAMEBUFFER,p,f,c,0);else throw Error("THREE.WebGLTextures: Unknown depthTexture format.")}function O(t){let a=r.get(t),i=!0===t.isWebGLCubeRenderTarget;if(a.__boundDepthTexture!==t.depthTexture){let e=t.depthTexture;if(a.__depthDisposeCallback&&a.__depthDisposeCallback(),e){let t=()=>{delete a.__boundDepthTexture,delete a.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),a.__depthDisposeCallback=t}a.__boundDepthTexture=e}if(t.depthTexture&&!a.__autoAllocateDepthBuffer)if(i)for(let e=0;e<6;e++)B(a.__webglFramebuffer[e],t,e);else{let e=t.texture.mipmaps;e&&e.length>0?B(a.__webglFramebuffer[0],t,0):B(a.__webglFramebuffer,t,0)}else if(i){a.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(n.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer[r]),void 0===a.__webglDepthbuffer[r])a.__webglDepthbuffer[r]=e.createRenderbuffer(),F(a.__webglDepthbuffer[r],t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,i=a.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,i)}}else{let r=t.texture.mipmaps;if(r&&r.length>0?n.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer),void 0===a.__webglDepthbuffer)a.__webglDepthbuffer=e.createRenderbuffer(),F(a.__webglDepthbuffer,t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=a.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,r)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}let G=[],k=[];function z(e){return Math.min(a.maxSamples,e.samples)}function H(e){let n=r.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function V(e,t){let n=e.colorSpace,r=e.format,a=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==b.LinearSRGBColorSpace&&n!==b.NoColorSpace&&(b.ColorManagement.getTransfer(n)===b.SRGBTransfer?(r!==b.RGBAFormat||a!==b.UnsignedByteType)&&(0,b.warn)("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):(0,b.error)("WebGLTextures: Unsupported texture color space:",n)),t}function W(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"u">typeof VideoFrame&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){let e=R;return e>=a.maxTextures&&(0,b.warn)("WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+a.maxTextures),R+=1,e},this.resetTextureUnits=function(){R=0},this.getTextureUnits=function(){return R},this.setTextureUnits=function(e){R=e},this.setTexture2D=C,this.setTexture2DArray=function(t,a){let i=r.get(t);!1===t.isRenderTargetTexture&&t.version>0&&i.__version!==t.version?N(i,t,a):(t.isExternalTexture&&(i.__webglTexture=t.sourceTexture?t.sourceTexture:null),n.bindTexture(e.TEXTURE_2D_ARRAY,i.__webglTexture,e.TEXTURE0+a))},this.setTexture3D=function(t,a){let i=r.get(t);!1===t.isRenderTargetTexture&&t.version>0&&i.__version!==t.version?N(i,t,a):n.bindTexture(e.TEXTURE_3D,i.__webglTexture,e.TEXTURE0+a)},this.setTextureCube=function(t,o){let l=r.get(t);!0!==t.isCubeDepthTexture&&t.version>0&&l.__version!==t.version?function(t,o,l){if(6!==o.image.length)return;let s=L(t,o),u=o.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+l);let c=r.get(u);if(u.version!==c.__version||!0===s){let t;n.activeTexture(e.TEXTURE0+l);let r=b.ColorManagement.getPrimaries(b.ColorManagement.workingColorSpace),d=o.colorSpace
358===b.NoColorSpace?null:b.ColorManagement.getPrimaries(o.colorSpace),f=o.colorSpace===b.NoColorSpace||r===d?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),n.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,f);let p=o.isCompressedTexture||o.image[0].isCompressedTexture,m=o.image[0]&&o.image[0].isDataTexture,h=[];for(let e=0;e<6;e++)p||m?h[e]=m?o.image[e].image:o.image[e]:h[e]=g(o.image[e],!0,a.maxCubemapSize),h[e]=V(o,h[e]);let x=h[0],T=i.convert(o.format,o.colorSpace),M=i.convert(o.type),y=S(o.internalFormat,T,M,o.normalized,o.colorSpace),R=!0!==o.isVideoTexture,C=void 0===c.__version||!0===s,A=u.dataReady,w=E(o,x);if(U(e.TEXTURE_CUBE_MAP,o),p){R&&C&&n.texStorage2D(e.TEXTURE_CUBE_MAP,w,y,x.width,x.height);for(let r=0;r<6;r++){t=h[r].mipmaps;for(let a=0;a<t.length;a++){let i=t[a];o.format!==b.RGBAFormat?null!==T?R?A&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,a,0,0,i.width,i.height,T,i.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,a,y,i.width,i.height,0,i.data):(0,b.warn)("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):R?A&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,a,0,0,i.width,i.height,T,M,i.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,a,y,i.width,i.height,0,T,M,i.data)}}}else{if(t=o.mipmaps,R&&C){t.length>0&&w++;let r=W(h[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,w,y,r.width,r.height)}for(let r=0;r<6;r++)if(m){R?A&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,0,0,h[r].width,h[r].height,T,M,h[r].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,y,h[r].width,h[r].height,0,T,M,h[r].data);for(let a=0;a<t.length;a++){let i=t[a].image[r].image;R?A&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,a+1,0,0,i.width,i.height,T,M,i.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,a+1,y,i.width,i.height,0,T,M,i.data)}}else{R?A&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,0,0,T,M,h[r]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,y,T,M,h[r]);for(let a=0;a<t.length;a++){let i=t[a];R?A&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,a+1,0,0,T,M,i.image[r]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+r,a+1,y,T,M,i.image[r])}}}v(o)&&_(e.TEXTURE_CUBE_MAP),c.__version=u.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}(l,t,o):n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture,e.TEXTURE0+o)},this.rebindTextures=function(t,n,a){let i=r.get(t);void 0!==n&&I(i.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==a&&O(t)},this.setupRenderTarget=function(t){let a=t.texture,l=r.get(t),s=r.get(a);t.addEventListener("dispose",M);let u=t.textures,c=!0===t.isWebGLCubeRenderTarget,d=u.length>1;if(!d&&(void 0===s.__webglTexture&&(s.__webglTexture=e.createTexture()),s.__version=a.version,o.memory.textures++),c){l.__webglFramebuffer=[];for(let t=0;t<6;t++)if(a.mipmaps&&a.mipmaps.length>0){l.__webglFramebuffer[t]=[];for(let n=0;n<a.mipmaps.length;n++)l.__webglFramebuffer[t][n]=e.createFramebuffer()}else l.__webglFramebuffer[t]=e.createFramebuffer()}else{if(a.mipmaps&&a.mipmaps.length>0){l.__webglFramebuffer=[];for(let t=0;t<a.mipmaps.length;t++)l.__webglFramebuffer[t]=e.createFramebuffer()}else l.__webglFramebuffer=e.createFramebuffer();if(d)for(let t=0,n=u.length;t<n;t++){let n=r.get(u[t]);void 0===n.__webglTexture&&(n.__webglTexture=e.createTexture(),o.memory.textures++)}if(t.samples>0&&!1===H(t)){l.__webglMultisampledFramebuffer=e.createFramebuffer(),l.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,l.__webglMultisampledFramebuffer);for(let n=0;n<u.length;n++){let r=u[n];l.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,l.__webglColorRenderbuffer[n]);let a=i.convert(r.format,r.colorSpace),o=i.convert(r.type),s=S(r.internalFormat,a,o,r.normalized,r.colorSpace,!0===t.isXRRenderTarget),c=z(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,c,s,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,l.__webglColorRen
358derbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(l.__webglDepthRenderbuffer=e.createRenderbuffer(),F(l.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(c){n.bindTexture(e.TEXTURE_CUBE_MAP,s.__webglTexture),U(e.TEXTURE_CUBE_MAP,a);for(let n=0;n<6;n++)if(a.mipmaps&&a.mipmaps.length>0)for(let r=0;r<a.mipmaps.length;r++)I(l.__webglFramebuffer[n][r],t,a,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r);else I(l.__webglFramebuffer[n],t,a,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);v(a)&&_(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(d){for(let a=0,i=u.length;a<i;a++){let i=u[a],o=r.get(i),s=e.TEXTURE_2D;(t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(s=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(s,o.__webglTexture),U(s,i),I(l.__webglFramebuffer,t,i,e.COLOR_ATTACHMENT0+a,s,0),v(i)&&_(s)}n.unbindTexture()}else{let r=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(r=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),n.bindTexture(r,s.__webglTexture),U(r,a),a.mipmaps&&a.mipmaps.length>0)for(let n=0;n<a.mipmaps.length;n++)I(l.__webglFramebuffer[n],t,a,e.COLOR_ATTACHMENT0,r,n);else I(l.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0,r,0);v(a)&&_(r),n.unbindTexture()}t.depthBuffer&&O(t)},this.updateRenderTargetMipmap=function(t){let a=t.textures;for(let i=0,o=a.length;i<o;i++){let o=a[i];if(v(o)){let a=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D,i=r.get(o).__webglTexture;n.bindTexture(a,i),_(a),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0){if(!1===H(t)){let a=t.textures,i=t.width,o=t.height,l=e.COLOR_BUFFER_BIT,s=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=r.get(t),d=a.length>1;if(d)for(let t=0;t<a.length;t++)n.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,c.__webglMultisampledFramebuffer);let f=t.texture.mipmaps;f&&f.length>0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(let n=0;n<a.length;n++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(l|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(l|=e.STENCIL_BUFFER_BIT)),d){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,c.__webglColorRenderbuffer[n]);let t=r.get(a[n]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,i,o,0,0,i,o,l,e.NEAREST),!0===u&&(G.length=0,k.length=0,G.push(e.COLOR_ATTACHMENT0+n),t.depthBuffer&&!1===t.resolveDepthBuffer&&(G.push(s),k.push(s),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,k)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,G))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),d)for(let t=0;t<a.length;t++){n.bindFramebuffer(e.FRAMEBUFFER,c.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,c.__webglColorRenderbuffer[t]);let i=r.get(a[t]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,c.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,i,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&u){let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}}},this.setupDepthRenderbuffer=O,this.setupFrameBufferTexture=I,this.useMultisampledRTT=H,this.isReversedDepthBuffer=function(){return n.buffers.depth.getReversed()}}function tj(e,t){return{convert:function(n,r=b.NoColorSpace){let a,i=b.ColorManagement.getTransfer(r);if(n===b.UnsignedByteType)return e.UNSIGNED_BYTE;if(n===b.UnsignedShort4444Type)return e.UNSIGNED_SHORT_4_4_4_4;if(n===b.UnsignedShort5551Type)return e.UNSIGNED_SHORT_5_5_5_1;if(n===b.UnsignedInt5999Type)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===b.UnsignedInt101111Type)return e.UNSIGNED_INT_10F_11F_11F_REV;if(n===b.ByteType)return e.BYTE;if(n===b.ShortType)return e.SHORT;if(n===b.UnsignedShortType)return e.UNSIGNED_SHORT;if(n===b.IntType)return e.INT;if(n===b.UnsignedIntType)return e.UNSIGNED_INT;if(n===b.FloatType)return e.FLOAT;if(n===b.HalfFloatType)return e.HALF_FLOAT;if(n===b.AlphaFormat)return e.ALPHA;if(n===b.RGBFormat)return e.RGB;if(n===b.RGBAFormat)return e.RGBA;if(n===b.DepthFormat)return e.DEPTH_COMPONENT;if(n===b.DepthStencilFormat)return e.DEPTH_STENCIL;if(n===b.RedFormat)return e.RED;if(n===b.RedIntegerFormat)return e.RED_INTEGER;if(n===b.RGFormat)return e.RG;if(n===b.RGIntegerFormat)return e.RG_INTEGER;if(n===b.RGBAIntegerFormat)return e.RGBA_INTEGER;if(n===b.RGB_S3TC_DXT1_Format||n===b.RGBA_S3TC_DXT1_Format||n===b.RGBA_S3TC_DXT3_Format||n===b.RGBA_S3TC_DXT5_Format)if(i===b.SRGBTransfer){if(null===(a=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(n===b.RGB_S3TC_DXT1_Format)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===b.RGBA_S3TC_DXT1_Format)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===b.RGBA_S3TC_DXT3_Format)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===b.RGBA_S3TC_DXT5_Format)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(a=t.get("WEBGL_compressed_texture_s3tc")))return null;if(n===b.RGB_S3TC_DXT1_Format)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===b.RGBA_S3TC_DXT1_Format)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===b.RGBA_S3TC_DXT3_Format)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===b.RGBA_S3TC_DXT5_Format)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===b.RGB_PVRTC_4BPPV1_Format||n===b.RGB_PVRTC_2BPPV1_Format||n===b.RGBA_PVRTC_4BPPV1_Format||n===b.RGBA_PVRTC_2BPPV1_Format){if(null===(a=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(n===b.RGB_PVRTC_4BPPV1_Format)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===b.RGB_PVRTC_2BPPV1_Format)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===b.RGBA_PVRTC_4BPPV1_Format)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===b.RGBA_PVRTC_2BPPV1_Format)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===b.RGB_ETC1_Format||n===b.RGB_ETC2_Format||n===b.RGBA_ETC2_EAC_Format||n===b.R11_EAC_Format||n===b.SIGNED_R11_EAC_Format||n===b.RG11_EAC_Format||n===b.SIGNED_RG11_EAC_Format){if(null===(a=t.get("WEBGL_compressed_texture_etc")))return null;if(n===b.RGB_ETC1_Format||n===b.RGB_ETC2_Format)return i===b.SRGBTransfer?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(n===b.RGBA_ETC2_EAC_Format)return i===b.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC;
358if(n===b.R11_EAC_Format)return a.COMPRESSED_R11_EAC;if(n===b.SIGNED_R11_EAC_Format)return a.COMPRESSED_SIGNED_R11_EAC;if(n===b.RG11_EAC_Format)return a.COMPRESSED_RG11_EAC;if(n===b.SIGNED_RG11_EAC_Format)return a.COMPRESSED_SIGNED_RG11_EAC}if(n===b.RGBA_ASTC_4x4_Format||n===b.RGBA_ASTC_5x4_Format||n===b.RGBA_ASTC_5x5_Format||n===b.RGBA_ASTC_6x5_Format||n===b.RGBA_ASTC_6x6_Format||n===b.RGBA_ASTC_8x5_Format||n===b.RGBA_ASTC_8x6_Format||n===b.RGBA_ASTC_8x8_Format||n===b.RGBA_ASTC_10x5_Format||n===b.RGBA_ASTC_10x6_Format||n===b.RGBA_ASTC_10x8_Format||n===b.RGBA_ASTC_10x10_Format||n===b.RGBA_ASTC_12x10_Format||n===b.RGBA_ASTC_12x12_Format){if(null===(a=t.get("WEBGL_compressed_texture_astc")))return null;if(n===b.RGBA_ASTC_4x4_Format)return i===b.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===b.RGBA_ASTC_5x4_Format)return i===b.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===b.RGBA_ASTC_5x5_Format)return i===b.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===b.RGBA_ASTC_6x5_Format)return i===b.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===b.RGBA_ASTC_6x6_Format)return i===b.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===b.RGBA_ASTC_8x5_Format)return i===b.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===b.RGBA_ASTC_8x6_Format)return i===b.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===b.RGBA_ASTC_8x8_Format)return i===b.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===b.RGBA_ASTC_10x5_Format)return i===b.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===b.RGBA_ASTC_10x6_Format)return i===b.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===b.RGBA_ASTC_10x8_Format)return i===b.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===b.RGBA_ASTC_10x10_Format)return i===b.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===b.RGBA_ASTC_12x10_Format)return i===b.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===b.RGBA_ASTC_12x12_Format)return i===b.SRGBTransfer?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===b.RGBA_BPTC_Format||n===b.RGB_BPTC_SIGNED_Format||n===b.RGB_BPTC_UNSIGNED_Format){if(null===(a=t.get("EXT_texture_compression_bptc")))return null;if(n===b.RGBA_BPTC_Format)return i===b.SRGBTransfer?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===b.RGB_BPTC_SIGNED_Format)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===b.RGB_BPTC_UNSIGNED_Format)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===b.RED_RGTC1_Format||n===b.SIGNED_RED_RGTC1_Format||n===b.RED_GREEN_RGTC2_Format||n===b.SIGNED_RED_GREEN_RGTC2_Format){if(null===(a=t.get("EXT_texture_compression_rgtc")))return null;if(n===b.RED_RGTC1_Format)return a.COMPRESSED_RED_RGTC1_EXT;if(n===b.SIGNED_RED_RGTC1_Format)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===b.RED_GREEN_RGTC2_Format)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===b.SIGNED_RED_GREEN_RGTC2_Format)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===b.UnsignedInt248Type?e.UNSIGNED_INT_24_8:void 0!==e[n]?e[n]:null}}}let tX=` 359void main() { 360 361 gl_Position = vec4( position, 1.0 ); 362 363}`,tq=` 364uniform sampler2DArray depthColor; 365uniform float depthWidth; 366uniform float depthHeight; 367 368void main() { 369 370 vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); 371 372 if ( coord.x >= 1.0 ) { 373 374 gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; 375 376 } else { 377 378 gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; 379 380 } 381 382}`;class tK{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(null===this.texture){let n=new b.ExternalTexture(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(null!==this.texture&&null===this.mesh){let t=e.cameras[0].viewport,n=new b.ShaderMaterial({vertexShader:tX,fragmentShader:tq,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new b.Mesh(new b.PlaneGeometry(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class tY extends b.EventDispatcher{constructor(e,t){super();const n=this;let r=null,a=1,i=null,o="local-floor",l=1,s=null,u=null,c=null,d=null,f=null,p=null;const m="u">typeof XRWebGLBinding,h=new tK,g={},v=t.getContextAttributes();let _=null,S=null;const x=[],E=[],M=new b.Vector2;let y=null;const R=new b.PerspectiveCamera;R.viewport=new b.Vector4;const C=new b.PerspectiveCamera;C.viewport=new b.Vector4;const A=[R,C],w=new b.ArrayCamera;let P=null,U=null;function L(e){let t=E.indexOf(e.inputSource);if(-1===t)return;let n=x[t];void 0!==n&&(n.update(e.inputSource,e.frame,s||i),n.dispatchEvent({type:e.type,data:e.inputSource}))}function D(){r.removeEventListener("select",L),r.removeEventListener("selectstart",L),r.removeEventListener("selectend",L),r.removeEventListener("squeeze",L),r.removeEventListener("squeezestart",L),r.removeEventListener("squeezeend",L),r.removeEventListener("end",D),r.removeEventListener("inputsourceschange",N);for(let e=0;e<x.length;e++){let t=E[e];null!==t&&(E[e]=null,x[e].disconnect(t))}for(let e in P=null,U=null,h.reset(),g)delete g[e];e.setRenderTarget(_),f=null,d=null,c=null,r=null,S=null,G.stop(),n.isPresenting=!1,e.setPixelRatio(y),e.setSize(M.width,M.height,!1),n.dispatchEvent({type:"sessionend"})}function N(e){for(let t=0;t<e.removed.length;t++){let n=e.removed[t],r=E.indexOf(n);r>=0&&(E[r]=null,x[r].disconnect(n))}for(let t=0;t<e.added.length;t++){let n=e.added[t],r=E.indexOf(n);if(-1===r){for(let e=0;e<x.length;e++)if(e>=E.length){E.push(n),r=e;break}else if(null===E[e]){E[e]=n,r=e;break}if(-1===r)break}let a=x[r];a&&a.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=x[e];return void 0===t&&(t=new b.WebXRController,x[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=x[e];return void 0===t&&(t=new b.WebXRController,x[e]=t),t.getGripSpace()},this.getHand=function(e){let t=x[e];return void 0===t&&(t=new b.WebXRController,x[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){a=e,!0===n.isPresenting&&(0,b.warn)("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){o=e,!0===n.isPresenting&&(0,b.warn)("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s||i},this.setReferenceSpace=function(e){s=e},this.getBaseLayer=function(){return null!==d?d:f},this.getBinding=function(){return null===c&&m&&(c=new XRWebGLBinding(r,t)),c},this.getFrame=function(){return p}
382,this.getSession=function(){return r},this.setSession=async function(u){if(null!==(r=u)){if(_=e.getRenderTarget(),r.addEventListener("select",L),r.addEventListener("selectstart",L),r.addEventListener("selectend",L),r.addEventListener("squeeze",L),r.addEventListener("squeezestart",L),r.addEventListener("squeezeend",L),r.addEventListener("end",D),r.addEventListener("inputsourceschange",N),!0!==v.xrCompatible&&await t.makeXRCompatible(),y=e.getPixelRatio(),e.getSize(M),m&&"createProjectionLayer"in XRWebGLBinding.prototype){let n=null,i=null,o=null;v.depth&&(o=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=v.stencil?b.DepthStencilFormat:b.DepthFormat,i=v.stencil?b.UnsignedInt248Type:b.UnsignedIntType);let l={colorFormat:t.RGBA8,depthFormat:o,scaleFactor:a};d=(c=this.getBinding()).createProjectionLayer(l),r.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),S=new b.WebGLRenderTarget(d.textureWidth,d.textureHeight,{format:b.RGBAFormat,type:b.UnsignedByteType,depthTexture:new b.DepthTexture(d.textureWidth,d.textureHeight,i,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:4*!!v.antialias,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}else{let n={antialias:v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:a};f=new XRWebGLLayer(r,t,n),r.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),S=new b.WebGLRenderTarget(f.framebufferWidth,f.framebufferHeight,{format:b.RGBAFormat,type:b.UnsignedByteType,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil,resolveDepthBuffer:!1===f.ignoreDepthValues,resolveStencilBuffer:!1===f.ignoreDepthValues})}S.isXRRenderTarget=!0,this.setFoveation(l),s=null,i=await r.requestReferenceSpace(o),G.setContext(r),G.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==r)return r.environmentBlendMode},this.getDepthTexture=function(){return h.getDepthTexture()};const I=new b.Vector3,F=new b.Vector3;function B(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var t,n,a;if(null===r)return;let i=e.near,o=e.far;null!==h.texture&&(h.depthNear>0&&(i=h.depthNear),h.depthFar>0&&(o=h.depthFar)),w.near=C.near=R.near=i,w.far=C.far=R.far=o,(P!==w.near||U!==w.far)&&(r.updateRenderState({depthNear:w.near,depthFar:w.far}),P=w.near,U=w.far),w.layers.mask=6|e.layers.mask,R.layers.mask=-5&w.layers.mask,C.layers.mask=-3&w.layers.mask;let l=e.parent,s=w.cameras;B(w,l);for(let e=0;e<s.length;e++)B(s[e],l);2===s.length?function(e,t,n){I.setFromMatrixPosition(t.matrixWorld),F.setFromMatrixPosition(n.matrixWorld);let r=I.distanceTo(F),a=t.projectionMatrix.elements,i=n.projectionMatrix.elements,o=a[14]/(a[10]-1),l=a[14]/(a[10]+1),s=(a[9]+1)/a[5],u=(a[9]-1)/a[5],c=(a[8]-1)/a[0],d=(i[8]+1)/i[0],f=r/(-c+d),p=-(f*c);if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(p),e.translateZ(f),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),-1===a[10])e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+f,n=l+f;e.projectionMatrix.makePerspective(o*c-p,o*d+(r-p),s*l/n*t,u*l/n*t,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}(w,R,C):w.projectionMatrix.copy(R.projectionMatrix),t=e,n=w,null===(a=l)?t.matrix.copy(n.matrixWorld):(t.matrix.copy(a.matrixWorld),t.matrix.invert(),t.matrix.multiply(n.matrixWorld)),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(n.projectionMatrix),t.projectionMatrixInverse.copy(n.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*b.RAD2DEG*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)},this.getCamera=function(){return w},this.getFoveation=function(){if(null!==d||null!==f)return l},this.setFoveation=function(e){l=e,null!==d&&(d.fixedFoveation=e),null!==f&&void 0!==f.fixedFoveation&&(f.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==h.texture},this.getDepthSensingMesh=function(){return h.getMesh(w)},this.getCameraTexture=function(e){return g[e]};let O=null;const G=new T;G.setAnimationLoop(function(t,a){if(u=a.getViewerPose(s||i),p=a,null!==u){let t=u.views;null!==f&&(e.setRenderTargetFramebuffer(S,f.framebuffer),e.setRenderTarget(S));let a=!1;t.length!==w.cameras.length&&(w.cameras.length=0,a=!0);for(let n=0;n<t.length;n++){let r=t[n],i=null;if(null!==f)i=f.getViewport(r);else{let t=c.getViewSubImage(d,r);i=t.viewport,0===n&&(e.setRenderTargetTextures(S,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(S))}let o=A[n];void 0===o&&((o=new b.PerspectiveCamera).layers.enable(n),o.viewport=new b.Vector4,A[n]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(i.x,i.y,i.width,i.height),0===n&&(w.matrix.copy(o.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale)),!0===a&&w.cameras.push(o)}let i=r.enabledFeatures;if(i&&i.includes("depth-sensing")&&"gpu-optimized"==r.depthUsage&&m){let e=(c=n.getBinding()).getDepthInformation(t[0]);e&&e.isValid&&e.texture&&h.init(e,r.renderState)}if(i&&i.includes("camera-access")&&m){e.state.unbindTexture(),c=n.getBinding();for(let e=0;e<t.length;e++){let n=t[e].camera;if(n){let e=g[n];e||(e=new b.ExternalTexture,g[n]=e);let t=c.getCameraImage(n);e.sourceTexture=t}}}}for(let e=0;e<x.length;e++){let t=E[e],n=x[e];
382null!==t&&void 0!==n&&n.update(t,a,s||i)}O&&O(t,a),a.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:a}),p=null}),this.setAnimationLoop=function(e){O=e},this.dispose=function(){}}}let t$=new b.Matrix4,tQ=new b.Matrix3;function tZ(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function r(e,r){e.opacity.value=r.opacity,r.color&&e.diffuse.value.copy(r.color),r.emissive&&e.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(e.map.value=r.map,n(r.map,e.mapTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap,n(r.alphaMap,e.alphaMapTransform)),r.bumpMap&&(e.bumpMap.value=r.bumpMap,n(r.bumpMap,e.bumpMapTransform),e.bumpScale.value=r.bumpScale,r.side===b.BackSide&&(e.bumpScale.value*=-1)),r.normalMap&&(e.normalMap.value=r.normalMap,n(r.normalMap,e.normalMapTransform),e.normalScale.value.copy(r.normalScale),r.side===b.BackSide&&e.normalScale.value.negate()),r.displacementMap&&(e.displacementMap.value=r.displacementMap,n(r.displacementMap,e.displacementMapTransform),e.displacementScale.value=r.displacementScale,e.displacementBias.value=r.displacementBias),r.emissiveMap&&(e.emissiveMap.value=r.emissiveMap,n(r.emissiveMap,e.emissiveMapTransform)),r.specularMap&&(e.specularMap.value=r.specularMap,n(r.specularMap,e.specularMapTransform)),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest);let a=t.get(r),i=a.envMap,o=a.envMapRotation;i&&(e.envMap.value=i,e.envMapRotation.value.setFromMatrix4(t$.makeRotationFromEuler(o)).transpose(),i.isCubeTexture&&!1===i.isRenderTargetTexture&&e.envMapRotation.value.premultiply(tQ),e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,(0,b.getUnlitUniformColorSpace)(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,a,i,o,l){var s,u,c,d,f,p,m,h,g,v,_,S,x,E,T,M,y,R,C,A,w,P,U;let L;a.isNodeMaterial?a.uniformsNeedUpdate=!1:a.isMeshBasicMaterial?r(e,a):a.isMeshLambertMaterial?(r(e,a),a.envMap&&(e.envMapIntensity.value=a.envMapIntensity)):a.isMeshToonMaterial?(r(e,a),s=e,(u=a).gradientMap&&(s.gradientMap.value=u.gradientMap)):a.isMeshPhongMaterial?(r(e,a),c=e,d=a,c.specular.value.copy(d.specular),c.shininess.value=Math.max(d.shininess,1e-4),a.envMap&&(e.envMapIntensity.value=a.envMapIntensity)):a.isMeshStandardMaterial?(r(e,a),f=e,p=a,f.metalness.value=p.metalness,p.metalnessMap&&(f.metalnessMap.value=p.metalnessMap,n(p.metalnessMap,f.metalnessMapTransform)),f.roughness.value=p.roughness,p.roughnessMap&&(f.roughnessMap.value=p.roughnessMap,n(p.roughnessMap,f.roughnessMapTransform)),p.envMap&&(f.envMapIntensity.value=p.envMapIntensity),a.isMeshPhysicalMaterial&&(m=e,h=a,g=l,m.ior.value=h.ior,h.sheen>0&&(m.sheenColor.value.copy(h.sheenColor).multiplyScalar(h.sheen),m.sheenRoughness.value=h.sheenRoughness,h.sheenColorMap&&(m.sheenColorMap.value=h.sheenColorMap,n(h.sheenColorMap,m.sheenColorMapTransform)),h.sheenRoughnessMap&&(m.sheenRoughnessMap.value=h.sheenRoughnessMap,n(h.sheenRoughnessMap,m.sheenRoughnessMapTransform))),h.clearcoat>0&&(m.clearcoat.value=h.clearcoat,m.clearcoatRoughness.value=h.clearcoatRoughness,h.clearcoatMap&&(m.clearcoatMap.value=h.clearcoatMap,n(h.clearcoatMap,m.clearcoatMapTransform)),h.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=h.clearcoatRoughnessMap,n(h.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),h.clearcoatNormalMap&&(m.clearcoatNormalMap.value=h.clearcoatNormalMap,n(h.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(h.clearcoatNormalScale),h.side===b.BackSide&&m.clearcoatNormalScale.value.negate())),h.dispersion>0&&(m.dispersion.value=h.dispersion),h.iridescence>0&&(m.iridescence.value=h.iridescence,m.iridescenceIOR.value=h.iridescenceIOR,m.
382iridescenceThicknessMinimum.value=h.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=h.iridescenceThicknessRange[1],h.iridescenceMap&&(m.iridescenceMap.value=h.iridescenceMap,n(h.iridescenceMap,m.iridescenceMapTransform)),h.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=h.iridescenceThicknessMap,n(h.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),h.transmission>0&&(m.transmission.value=h.transmission,m.transmissionSamplerMap.value=g.texture,m.transmissionSamplerSize.value.set(g.width,g.height),h.transmissionMap&&(m.transmissionMap.value=h.transmissionMap,n(h.transmissionMap,m.transmissionMapTransform)),m.thickness.value=h.thickness,h.thicknessMap&&(m.thicknessMap.value=h.thicknessMap,n(h.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=h.attenuationDistance,m.attenuationColor.value.copy(h.attenuationColor)),h.anisotropy>0&&(m.anisotropyVector.value.set(h.anisotropy*Math.cos(h.anisotropyRotation),h.anisotropy*Math.sin(h.anisotropyRotation)),h.anisotropyMap&&(m.anisotropyMap.value=h.anisotropyMap,n(h.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=h.specularIntensity,m.specularColor.value.copy(h.specularColor),h.specularColorMap&&(m.specularColorMap.value=h.specularColorMap,n(h.specularColorMap,m.specularColorMapTransform)),h.specularIntensityMap&&(m.specularIntensityMap.value=h.specularIntensityMap,n(h.specularIntensityMap,m.specularIntensityMapTransform)))):a.isMeshMatcapMaterial?(r(e,a),v=e,(_=a).matcap&&(v.matcap.value=_.matcap)):a.isMeshDepthMaterial?r(e,a):a.isMeshDistanceMaterial?(r(e,a),S=e,x=a,L=t.get(x).light,S.referencePosition.value.setFromMatrixPosition(L.matrixWorld),S.nearDistance.value=L.shadow.camera.near,S.farDistance.value=L.shadow.camera.far):a.isMeshNormalMaterial?r(e,a):a.isLineBasicMaterial?(E=e,T=a,E.diffuse.value.copy(T.color),E.opacity.value=T.opacity,T.map&&(E.map.value=T.map,n(T.map,E.mapTransform)),a.isLineDashedMaterial&&(M=e,y=a,M.dashSize.value=y.dashSize,M.totalSize.value=y.dashSize+y.gapSize,M.scale.value=y.scale)):a.isPointsMaterial?(R=e,C=a,A=i,w=o,R.diffuse.value.copy(C.color),R.opacity.value=C.opacity,R.size.value=C.size*A,R.scale.value=.5*w,C.map&&(R.map.value=C.map,n(C.map,R.uvTransform)),C.alphaMap&&(R.alphaMap.value=C.alphaMap,n(C.alphaMap,R.alphaMapTransform)),C.alphaTest>0&&(R.alphaTest.value=C.alphaTest)):a.isSpriteMaterial?(P=e,U=a,P.diffuse.value.copy(U.color),P.opacity.value=U.opacity,P.rotation.value=U.rotation,U.map&&(P.map.value=U.map,n(U.map,P.mapTransform)),U.alphaMap&&(P.alphaMap.value=U.alphaMap,n(U.alphaMap,P.alphaMapTransform)),U.alphaTest>0&&(P.alphaTest.value=U.alphaTest)):a.isShadowMaterial?(e.color.value.copy(a.color),e.opacity.value=a.opacity):a.isShaderMaterial&&(a.uniformsNeedUpdate=!1)}}}function tJ(e,t,n,r){let a={},i={},o=[],l=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function s(t,n,r,a){if(!0===function(e,t,n,r){let a=e.value,i=t+"_"+n;if(void 0===r[i])return"number"==typeof a||"boolean"==typeof a?r[i]=a:ArrayBuffer.isView(a)?r[i]=a.slice():r[i]=a.clone(),!0;{let e=r[i];if("number"==typeof a||"boolean"==typeof a){if(e!==a)return r[i]=a,!0}else if(ArrayBuffer.isView(a))return!0;else if(!1===e.equals(a))return e.copy(a),!0}return!1}(t,n,r,a)){let n=t.__offset,r=t.value;if(Array.isArray(r)){let e=0;for(let n=0;n<r.length;n++){let a=r[n],i=c(a);u(a,t.__data,e),"number"==typeof a||"boolean"==typeof a||a.isMatrix3||ArrayBuffer.isView(a)||(e+=i.storage/Float32Array.BYTES_PER_ELEMENT)}}else u(r,t.__data,0);e.bufferSubData(e.UNIFORM_BUFFER,n,t.__data)}}function u(e,t,n){"number"==typeof e||"boolean"==typeof e?t[0]=e:e.isMatrix3?(t[0]=e.elements[0],t[1]=e.elements[1],t[2]=e.elements[2],t[3]=0,t[4]=e.elements[3],t[5]=e.elements[4],t[6]=e.elements[5],t[7]=0,t[8]=e.elements[6],t[9]=e.elements[7],t[10]=e.elements[8],t[11]=0):ArrayBuffer.isView(e)?t.set(new e.constructor(e.buffer,e.byteOffset,t.length)):e.toArray(t,n)}function c(e){let t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boun
382dary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?(0,b.warn)("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(e)?(t.boundary=16,t.storage=e.byteLength):(0,b.warn)("WebGLRenderer: Unsupported uniform value type.",e),t}function d(t){let n=t.target;n.removeEventListener("dispose",d);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(a[n.id]),delete a[n.id],delete i[n.id]}return{bind:function(e,t){let n=t.program;r.uniformBlockBinding(e,n)},update:function(n,u){var f;let p,m,h,g,v=a[n.id];void 0===v&&(function(e){let t=e.uniforms,n=0;for(let e=0,r=t.length;e<r;e++){let r=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=r.length;e<t;e++){let t=r[e],a=Array.isArray(t.value)?t.value:[t.value];for(let e=0,r=a.length;e<r;e++){let r=c(a[e]),i=n%16,o=i%r.boundary,l=i+o;n+=o,0!==l&&16-l<r.storage&&(n+=16-l),t.__data=new Float32Array(r.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=r.storage}}}let r=n%16;r>0&&(n+=16-r),e.__size=n,e.__cache={}}(n),(f=n).__bindingPointIndex=p=function(){for(let e=0;e<l;e++)if(-1===o.indexOf(e))return o.push(e),e;return(0,b.error)("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}(),m=e.createBuffer(),h=f.__size,g=f.usage,e.bindBuffer(e.UNIFORM_BUFFER,m),e.bufferData(e.UNIFORM_BUFFER,h,g),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,p,m),v=m,a[n.id]=v,n.addEventListener("dispose",d));let _=u.program;r.updateUBOMapping(n,_);let S=t.render.frame;i[n.id]!==S&&(function(t){let n=a[t.id],r=t.uniforms,i=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let e=0,t=r.length;e<t;e++){let t=r[e];if(Array.isArray(t))for(let n=0,r=t.length;n<r;n++)s(t[n],e,n,i);else s(t,e,0,i)}e.bindBuffer(e.UNIFORM_BUFFER,null)}(n),i[n.id]=S)},dispose:function(){for(let t in a)e.deleteBuffer(a[t]);o=[],a={},i={}}}}tQ.set(-1,0,0,0,1,0,0,0,1);let t0=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,
38214942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]),t1=null;class t2{constructor(e={}){let t,n,r,a,i,o,l,s,u,c,d,f,p,m,h,g,v,_,S,x,E,y,R,C;const{canvas:A=(0,b.createCanvasElement)(),context:w=null,depth:P=!0,stencil:F=!1,alpha:B=!1,antialias:O=!1,premultipliedAlpha:G=!0,preserveDrawingBuffer:k=!1,powerPreference:z="default",failIfMajorPerformanceCaveat:H=!1,reversedDepthBuffer:V=!1,outputBufferType:W=b.UnsignedByteType}=e;if(this.isWebGLRenderer=!0,null!==w){if("u">typeof WebGLRenderingContext&&w instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");t=w.getContextAttributes().alpha}else t=B;const j=new Set([b.RGBAIntegerFormat,b.RGIntegerFormat,b.RedIntegerFormat]),X=new Set([b.UnsignedByteType,b.UnsignedIntType,b.UnsignedShortType,b.UnsignedInt248Type,b.UnsignedShort4444Type,b.UnsignedShort5551Type]),q=new Uint32Array(4),K=new Int32Array(4),Y=new b.Vector3;let $=null,ea=null;const eo=[],el=[];let es=null;this.domElement=A,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=b.NoToneMapping,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const eu=this;let ec=!1,ed=null,ef=null,ep=null,em=null;this._outputColorSpace=b.SRGBColorSpace;let eh=0,eg=0,ev=null,e_=-1,eS=null;const ex=new b.Vector4,eE=new b.Vector4;let eb=null;const eT=new b.Color(0);let eM=0,ey=A.width,eR=A.height,eC=1,eA=null,ew=null;const eP=new b.Vector4(0,0,ey,eR),eU=new b.Vector4(0,0,ey,eR);let eL=!1;const eD=new b.Frustum;let eN=!1,eI=!1;const eF=new b.Matrix4,eB=new b.Vector3,eO=new b.Vector4,eG={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ek=!1;function ez(){return null===ev?eC:1}let eH=w;function eV(e,t){return A.getContext(e,t)}try{if("setAttribute"in A&&A.setAttribute("data-engine",`three.js r${b.REVISION}`),A.addEventListener("webglcontextlost",eX,!1),A.addEventListener("webglcontextrestored",eq,!1),A.addEventListener("webglcontextcreationerror",eK,!1),null===eH){const e="webgl2";if(eH=eV(e,{alpha:!0,depth:P,stencil:F,antialias:O,premultipliedAlpha:G,preserveDrawingBuffer:k,powerPreference:z,failIfMajorPerformanceCaveat:H}),null===eH)if(eV(e))throw Error("THREE.WebGLRenderer: Error creating WebGL context with your selected attributes.");else throw Error("THREE.WebGLRenderer: Error creating WebGL context.")}}catch(e){throw(0,b.error)("WebGLRenderer: "+e.message),e}function eW(){(n=new Z(eH)).init(),y=new tj(eH,n),r=new N(eH,n,e,y),a=new tV(eH,n),r.reversedDepthBuffer&&V&&a.buffers.depth.setReversed(!0),ef=eH.createFramebuffer(),ep=eH.createFramebuffer(),em=eH.createFramebuffer(),i=new et(eH),o=new tR,l=new tW(eH,n,a,o,r,y,i),s=new Q(eu),u=new M(eH),R=new L(eH,u),c=new J(eH,u,i,R),d=new er(eH,c,u,R,i),S=new en(eH,r,l),g=new I(o),f=new ty(eu,s,n,r,R,g),p=new tZ(eu,o),m=new tP,h=new tF(n),_=new U(eu,s,a,d,t,G),v=new tH(eu,d,r),C=new tJ(eH,i,r,a),x=new D(eH,n,i),E=new ee(eH,n,i),i.programs=f.programs,eu.capabilities=r,eu.extensions=n,eu.properties=o,eu.renderLists=m,eu.shadowMap=v,eu.state=a,eu.info=i}eW(),W!==b.UnsignedByteType&&(es=new ei(W,A.width,A.height,O,P,F));const ej=new tY(eu,eH);function eX(e){e.preventDefault(),(0,b.log)("WebGLRenderer: Context Lost."),ec=!0}function eq(){(0,b.log)("WebGLRenderer: Context Restored."),ec=!1;let e=i.autoReset,t=v.enabled,n=v.autoUpdate,r=v.needsUpdate,a=v.type;eW(),i.autoReset=e,v.enabled=t,v.autoUpdate=n,v.needsUpdate=r,v.type=a}function eK(e){(0,b.error)("WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function eY(e){var t,n;let r,a=e.target;a.removeEventListener("dispose",eY),n=t=a,void 0!==(r=o.get(n).programs)&&(r.forEach(function(e){f.releaseProgram(e)}),n.isShaderMaterial&&f.releaseShaderCache(n)),o.remove(t)}function e$(e,t,n){!0===e.transparent&&e.side===b.DoubleSide&&!1===e.forceSinglePass?(e.side=b.BackSide,e.needsUpdate=!0,e6(e,t,n),e.side=b.FrontSide,e.needsUpdate=!0,e6(e,t,n),e.side=b.DoubleSide):e6(e,t,n
382)}this.xr=ej,this.getContext=function(){return eH},this.getContextAttributes=function(){return eH.getContextAttributes()},this.forceContextLoss=function(){let e=n.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=n.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return eC},this.setPixelRatio=function(e){void 0!==e&&(eC=e,this.setSize(ey,eR,!1))},this.getSize=function(e){return e.set(ey,eR)},this.setSize=function(e,t,n=!0){ej.isPresenting?(0,b.warn)("WebGLRenderer: Can't change size while VR device is presenting."):(ey=e,eR=t,A.width=Math.floor(e*eC),A.height=Math.floor(t*eC),!0===n&&(A.style.width=e+"px",A.style.height=t+"px"),null!==es&&es.setSize(A.width,A.height),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(ey*eC,eR*eC).floor()},this.setDrawingBufferSize=function(e,t,n){ey=e,eR=t,eC=n,A.width=Math.floor(e*n),A.height=Math.floor(t*n),this.setViewport(0,0,e,t)},this.setEffects=function(e){if(W===b.UnsignedByteType)return void(0,b.error)("WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");if(e){for(let t=0;t<e.length;t++)if(!0===e[t].isOutputPass){(0,b.warn)("WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}es.setEffects(e||[])},this.getCurrentViewport=function(e){return e.copy(ex)},this.getViewport=function(e){return e.copy(eP)},this.setViewport=function(e,t,n,r){e.isVector4?eP.set(e.x,e.y,e.z,e.w):eP.set(e,t,n,r),a.viewport(ex.copy(eP).multiplyScalar(eC).round())},this.getScissor=function(e){return e.copy(eU)},this.setScissor=function(e,t,n,r){e.isVector4?eU.set(e.x,e.y,e.z,e.w):eU.set(e,t,n,r),a.scissor(eE.copy(eU).multiplyScalar(eC).round())},this.getScissorTest=function(){return eL},this.setScissorTest=function(e){a.setScissorTest(eL=e)},this.setOpaqueSort=function(e){eA=e},this.setTransparentSort=function(e){ew=e},this.getClearColor=function(e){return e.copy(_.getClearColor())},this.setClearColor=function(){_.setClearColor(...arguments)},this.getClearAlpha=function(){return _.getClearAlpha()},this.setClearAlpha=function(){_.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;if(e){let e=!1;if(null!==ev){let t=ev.texture.format;e=j.has(t)}if(e){let e=ev.texture.type,t=X.has(e),n=_.getClearColor(),r=_.getClearAlpha(),a=n.r,i=n.g,o=n.b;t?(q[0]=a,q[1]=i,q[2]=o,q[3]=r,eH.clearBufferuiv(eH.COLOR,0,q)):(K[0]=a,K[1]=i,K[2]=o,K[3]=r,eH.clearBufferiv(eH.COLOR,0,K))}else r|=eH.COLOR_BUFFER_BIT}t&&(r|=eH.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),n&&(r|=eH.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(0xffffffff)),0!==r&&eH.clear(r)},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.setNodesHandler=function(e){e.setRenderer(this),ed=e},this.dispose=function(){A.removeEventListener("webglcontextlost",eX,!1),A.removeEventListener("webglcontextrestored",eq,!1),A.removeEventListener("webglcontextcreationerror",eK,!1),_.dispose(),m.dispose(),h.dispose(),o.dispose(),s.dispose(),d.dispose(),R.dispose(),C.dispose(),f.dispose(),ej.dispose(),ej.removeEventListener("sessionstart",eZ),ej.removeEventListener("sessionend",eJ),e0.stop()},this.renderBufferDirect=function(e,t,i,d,f,m){let h;null===t&&(t=eG);let v=f.isMesh&&0>f.matrixWorld.determinantAffine(),_=function(e,t,n,i,u){!0!==t.isScene&&(t=eG),l.resetTextureUnits();let c=t.fog,d=i.isMeshStandardMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial?t.environment:null,f=null===ev?eu.outputColorSpace:!0===ev.isXRRenderTarget?ev.texture.colorSpace:b.ColorManagement.workingColorSpace,m=i.isMeshStandardMaterial||i.isMeshLambertMaterial&&!i.envMap||i.isMeshPhongMaterial&&!i.envMap,h=s.get(i.envMap||d,m),v=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,_=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),x=!!n.morphAttributes.position,E=!!n.morphAttributes.normal,T=!!n.morphAttributes.color,M=b.NoToneMapping;i.toneMapped&&(null===ev||!0===ev.isXRRenderTarget)&&(M=eu.toneMapping);let y=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,R=void 0!==y?y.length:0,A=o.get(i),w=ea.state.lights;if(!0===eN&&(!0===eI||e!==eS)){let t=e===eS&&i.id===e_;g.setState(i,e,t)}let P=!1;i.version===A.__version?A.needsLights&&A.lightsStateVersion!==w.state.ver
vendor: 7,013 bytes, line 382
382sion||A.outputColorSpace!==f||u.isBatchedMesh&&!1===A.batching?P=!0:u.isBatchedMesh||!0!==A.batching?u.isBatchedMesh&&!0===A.batchingColor&&null===u.colorTexture||u.isBatchedMesh&&!1===A.batchingColor&&null!==u.colorTexture||u.isInstancedMesh&&!1===A.instancing?P=!0:u.isInstancedMesh||!0!==A.instancing?u.isSkinnedMesh&&!1===A.skinning?P=!0:u.isSkinnedMesh||!0!==A.skinning?u.isInstancedMesh&&!0===A.instancingColor&&null===u.instanceColor||u.isInstancedMesh&&!1===A.instancingColor&&null!==u.instanceColor||u.isInstancedMesh&&!0===A.instancingMorph&&null===u.morphTexture||u.isInstancedMesh&&!1===A.instancingMorph&&null!==u.morphTexture||A.envMap!==h||!0===i.fog&&A.fog!==c||void 0!==A.numClippingPlanes&&(A.numClippingPlanes!==g.numPlanes||A.numIntersection!==g.numIntersection)||A.vertexAlphas!==v||A.vertexTangents!==_||A.morphTargets!==x||A.morphNormals!==E||A.morphColors!==T||A.toneMapping!==M||A.morphTargetsCount!==R?P=!0:!!A.lightProbeGrid!=ea.state.lightProbeGridArray.length>0&&(P=!0):P=!0:P=!0:P=!0:(P=!0,A.__version=i.version);let U=A.currentProgram;!0===P&&(U=e6(i,t,u),ed&&i.isNodeMaterial&&ed.onUpdateProgram(i,U,A));let L=!1,D=!1,N=!1,I=U.getUniforms(),F=A.uniforms;if(a.useProgram(U.program)&&(L=!0,D=!0,N=!0),i.id!==e_&&(e_=i.id,D=!0),A.needsLights){let e=function(e,t){if(0===e.length)return null;if(1===e.length)return null!==e[0].texture?e[0]:null;Y.setFromMatrixPosition(t.matrixWorld);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(null!==n.texture&&n.boundingBox.containsPoint(Y))return n}return null}(ea.state.lightProbeGridArray,u);A.lightProbeGrid!==e&&(A.lightProbeGrid=e,D=!0)}if(L||eS!==e){a.buffers.depth.getReversed()&&!0!==e.reversedDepth&&(e._reversedDepth=!0,e.updateProjectionMatrix()),I.setValue(eH,"projectionMatrix",e.projectionMatrix),I.setValue(eH,"viewMatrix",e.matrixWorldInverse);let t=I.map.cameraPosition;void 0!==t&&t.setValue(eH,eB.setFromMatrixPosition(e.matrixWorld)),r.logarithmicDepthBuffer&&I.setValue(eH,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&I.setValue(eH,"isOrthographic",!0===e.isOrthographicCamera),eS!==e&&(eS=e,D=!0,N=!0)}if(A.needsLights&&(w.state.directionalShadowMap.length>0&&I.setValue(eH,"directionalShadowMap",w.state.directionalShadowMap,l),w.state.spotShadowMap.length>0&&I.setValue(eH,"spotShadowMap",w.state.spotShadowMap,l),w.state.pointShadowMap.length>0&&I.setValue(eH,"pointShadowMap",w.state.pointShadowMap,l)),u.isSkinnedMesh){I.setOptional(eH,u,"bindMatrix"),I.setOptional(eH,u,"bindMatrixInverse");let e=u.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),I.setValue(eH,"boneTexture",e.boneTexture,l))}u.isBatchedMesh&&(I.setOptional(eH,u,"batchingTexture"),I.setValue(eH,"batchingTexture",u._matricesTexture,l),I.setOptional(eH,u,"batchingIdTexture"),I.setValue(eH,"batchingIdTexture",u._indirectTexture,l),I.setOptional(eH,u,"batchingColorTexture"),null!==u._colorsTexture&&I.setValue(eH,"batchingColorTexture",u._colorsTexture,l));let B=n.morphAttributes;if((void 0!==B.position||void 0!==B.normal||void 0!==B.color)&&S.update(u,n,U),(D||A.receiveShadow!==u.receiveShadow)&&(A.receiveShadow=u.receiveShadow,I.setValue(eH,"receiveShadow",u.receiveShadow)),(i.isMeshStandardMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial)&&null===i.envMap&&null!==t.environment&&(F.envMapIntensity.value=t.environmentIntensity),void 0!==F.dfgLUT&&(F.dfgLUT.value=(null===t1&&((t1=new b.DataTexture(t0,16,16,b.RGFormat,b.HalfFloatType)).name="DFG_LUT",t1.minFilter=b.LinearFilter,t1.magFilter=b.LinearFilter,t1.wrapS=b.ClampToEdgeWrapping,t1.wrapT=b.ClampToEdgeWrapping,t1.generateMipmaps=!1,t1.needsUpdate=!0),t1)),D){var O,G;if(I.setValue(eH,"toneMappingExposure",eu.toneMappingExposure),A.needsLights&&(O=F,G=N,O.ambientLightColor.needsUpdate=G,O.lightProbe.needsUpdate=G,O.directionalLights.needsUpdate=G,O.directionalLightShadows.needsUpdate=G,O.pointLights.needsUpdate=G,O.pointLightShadows.needsUpdate=G,O.spotLights.needsUpdate=G,O.spotLightShadows.needsUpdate=G,O.rectAreaLights.needsUpdate=G,O.hemisphereLights.needsUpdate=G),c&&!0===i.fog&&p.refreshFogUniforms(F,c),p.refreshMaterialUniforms(F,i,eC,eR,ea.state.transmissionRenderTarget[e.id]),A.needsLights&&A.lightProbeGrid){let e=A.lightProbeGrid;F.probesSH.value=e.texture,F.probesMin.value.copy(e.boundingBox.min),F.probesMax.value.copy(e.boundingBox.max),F.probesResolution.value.copy(e.resolution)}e7.upload(eH,e8(A),F,l)}if(i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(e7.upload(eH,e8(A),F,l),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&I.setValue(eH,"center",u.center),I.setValue(eH,"modelViewMatrix",u.modelViewMatrix),I.setValue(eH,"normalMatrix",u.normalMatrix),I.setValue(eH,"modelMatrix",u.matrixWorld),void 0!==i.uniformsGroups){let e=i.uniformsGroups;for(let t=0,n=e.length;t<n;t++){let n=e[t];C.update(n,U),C.bind(n,U)}}return U}(e,t,i,d,f);a.setMaterial(d,v);let T=i.index,M=1;if(!0===d.wireframe){if(void 0===(T=c.getWireframeAttribute(i)))return;M=2}let y=i.drawRange,A=i.attributes.position,w=y.start*M,P=(y.start+y.count)*M;null!==m&&(w=Math.max(w,m.start*M),P=Math.min(P,(m.start+m.count)*M)),null!==T?(w=Math.max(w,0),P=Math.min(P,T.count)):null!=A&&(w=Math.max(w,0),P=Math.min(P,A.count));let U=P-w;if(U<0||U===1/0)return;R.setup(f,d,_,i,T);let L=x;if(null!==T&&(h=u.get(T),(L=E).setIndex(h)),f.isMesh)!0===d.wireframe?(a.setLineWidth(d.wireframeLinewidth*ez()),L.setMode(eH.LINES)):L.setMode(eH.TRIANGLES);else if(f.isLine){let e=d.linewidth;void 0===e&&(e=1),a.setLineWidth(e*ez()),f.isLineSegments?L.setMode(eH.LINES):f.isLineLoop?L.setMode(eH.LINE_LOOP):L.setMode(eH.LINE_STRIP)}else f.isPoints?L.setMode(eH.POINTS):f.isSprite&&L.setMode(eH.TRIANGLES);if(f.isBatchedMesh)if(n.get("WEBGL_multi_draw"))L.renderMultiDraw(f._multiDrawStarts,f._multiDrawCounts,f._multiDrawCount);else{let e=f._multiDrawStarts,t=f._multiDrawCounts,n=f._multiDrawCount,r=T?u.get(T).bytesPerElement:1,a=o.get(d).currentProgram.getUniforms();for(let i=0;i<n;i++)a.setValue(eH,"_gl_DrawID",i),L.render(e[i]/r,t[i])}else if(f.isInstancedMesh)L.renderInstances(w,U,f.count);else if(i.isInstancedBufferGeometry){let e=void 0!==i._maxInstanceCount?i._maxInstanceCount:1/0,t=Math.min(i.instanceCount,e);L.renderInstances(w,U,t)}else L.render(w,U)},this.compile=function(e,t,n=null){null===n&&(n=e),(ea=h.get(n)).init(t),el.push(ea),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(ea.pushLight(e),e.castShadow&&ea.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(ea.pushLight(e),e.castShadow&&ea.pushShadow(e))}),ea.setupLights();let r=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;let t=e.material;if(t)if(Array.isArray(t))for(let a=0;a<t.length;a++){let i=t[a];e$(i,n,e),r.add(i)}else e$(t,n,e),r.add(t)}),ea=el.pop(),r},this.compileAsync=function(e,t,r=null){let a=this.compile(e,t,r);return new Promise(t=>
382{function r(){(a.forEach(function(e){o.get(e).currentProgram.isReady()&&a.delete(e)}),0===a.size)?t(e):setTimeout(r,10)}null!==n.get("KHR_parallel_shader_compile")?r():setTimeout(r,10)})};let eQ=null;function eZ(){e0.stop()}function eJ(){e0.start()}const e0=new T;function e1(e,t,n,r){if(!1===e.visible)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLightProbeGrid)ea.pushLightProbeGrid(e);else if(e.isLight)ea.pushLight(e),e.castShadow&&ea.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||eD.intersectsSprite(e)){r&&eO.setFromMatrixPosition(e.matrixWorld).applyMatrix4(eF);let t=d.update(e),a=e.material;a.visible&&$.push(e,t,a,n,eO.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||eD.intersectsObject(e))){let t=d.update(e),a=e.material;if(r&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),eO.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),eO.copy(t.boundingSphere.center)),eO.applyMatrix4(e.matrixWorld).applyMatrix4(eF)),Array.isArray(a)){let r=t.groups;for(let i=0,o=r.length;i<o;i++){let o=r[i],l=a[o.materialIndex];l&&l.visible&&$.push(e,t,l,n,eO.z,o)}}else a.visible&&$.push(e,t,a,n,eO.z,null)}}let a=e.children;for(let e=0,i=a.length;e<i;e++)e1(a[e],t,n,r)}function e2(e,t,n,r){let{opaque:i,transmissive:o,transparent:l}=e;ea.setupLightsView(n),!0===eN&&g.setGlobalState(eu.clippingPlanes,n),r&&a.viewport(ex.copy(r)),i.length>0&&e4(i,t,n),o.length>0&&e4(o,t,n),l.length>0&&e4(l,t,n),a.buffers.depth.setTest(!0),a.buffers.depth.setMask(!0),a.buffers.color.setMask(!0),a.setPolygonOffset(!1)}function e3(e,t,a,i){if(null!==(!0===a.isScene?a.overrideMaterial:null))return;if(void 0===ea.state.transmissionRenderTarget[i.id]){let e=n.has("EXT_color_buffer_half_float")||n.has("EXT_color_buffer_float");ea.state.transmissionRenderTarget[i.id]=new b.WebGLRenderTarget(1,1,{generateMipmaps:!0,type:e?b.HalfFloatType:b.UnsignedByteType,minFilter:b.LinearMipmapLinearFilter,samples:Math.max(4,r.samples),stencilBuffer:F,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:b.ColorManagement.workingColorSpace})}let o=ea.state.transmissionRenderTarget[i.id],s=i.viewport||ex;o.setSize(s.z*eu.transmissionResolutionScale,s.w*eu.transmissionResolutionScale);let u=eu.getRenderTarget(),c=eu.getActiveCubeFace(),d=eu.getActiveMipmapLevel();eu.setRenderTarget(o),eu.getClearColor(eT),(eM=eu.getClearAlpha())<1&&eu.setClearColor(0xffffff,.5),eu.clear(),ek&&_.render(a);let f=eu.toneMapping;eu.toneMapping=b.NoToneMapping;let p=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),ea.setupLightsView(i),!0===eN&&g.setGlobalState(eu.clippingPlanes,i),e4(e,a,i),l.updateMultisampleRenderTarget(o),l.updateRenderTargetMipmap(o),!1===n.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let n=0,r=t.length;n<r;n++){let{object:r,geometry:o,material:l,group:s}=t[n];if(l.side===b.DoubleSide&&r.layers.test(i.layers)){let t=l.side;l.side=b.BackSide,l.needsUpdate=!0,e5(r,a,i,o,l,s),l.side=t,l.needsUpdate=!0,e=!0}}!0===e&&(l.updateMultisampleRenderTarget(o),l.updateRenderTargetMipmap(o))}eu.setRenderTarget(u,c,d),eu.setClearColor(eT,eM),void 0!==p&&(i.viewport=p),eu.toneMapping=f}function e4(e,t,n){let r=!0===t.isScene?t.overrideMaterial:null;for(let a=0,i=e.length;a<i;a++){let i=e[a],{object:o,geometry:l,group:s}=i,u=i.material;!0===u.allowOverride&&null!==r&&(u=r),o.layers.test(n.layers)&&e5(o,t,n,l,u,s)}}function e5(e,t,n,r,a,i){e.onBeforeRender(eu,t,n,r,a,i),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),a.onBeforeRender(eu,t,n,r,e,i),!0===a.transparent&&a.side===b.DoubleSide&&!1===a.forceSinglePass?(a.side=b.BackSide,a.needsUpdate=!0,eu.renderBufferDirect(n,t,r,a,e,i),a.side=b.FrontSide,a.needsUpdate=!0,eu.renderBufferDirect(n,t,r,a,e,i),a.side=b.DoubleSide):eu.renderBufferDirect(n,t,r,a,e,i),e.onAfterRender(eu,t,n,r,a,i)}function e6(e,t,n){var r;!0!==t.isScene&&(t=eG);let a=o.get(e),i=ea.state.lights,l=ea.state.shadowsArray,u=i.state.ver
382sion,c=f.getParameters(e,i.state,l,t,n,ea.state.lightProbeGridArray),d=f.getProgramCacheKey(c),p=a.programs;a.environment=e.isMeshStandardMaterial||e.isMeshLambertMaterial||e.isMeshPhongMaterial?t.environment:null,a.fog=t.fog;let m=e.isMeshStandardMaterial||e.isMeshLambertMaterial&&!e.envMap||e.isMeshPhongMaterial&&!e.envMap;a.envMap=s.get(e.envMap||a.environment,m),a.envMapRotation=null!==a.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===p&&(e.addEventListener("dispose",eY),a.programs=p=new Map);let h=p.get(d);if(void 0!==h){if(a.currentProgram===h&&a.lightsStateVersion===u)return e9(e,c),h}else c.uniforms=f.getUniforms(e),null!==ed&&e.isNodeMaterial&&ed.build(e,n,c),e.onBeforeCompile(c,eu),h=f.acquireProgram(c,d),p.set(d,h),a.uniforms=c.uniforms;let v=a.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(v.clippingPlanes=g.uniform),e9(e,c),a.needsLights=(r=e).isMeshLambertMaterial||r.isMeshToonMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.isShadowMaterial||r.isShaderMaterial&&!0===r.lights,a.lightsStateVersion=u,a.needsLights&&(v.ambientLightColor.value=i.state.ambient,v.lightProbe.value=i.state.probe,v.directionalLights.value=i.state.directional,v.directionalLightShadows.value=i.state.directionalShadow,v.spotLights.value=i.state.spot,v.spotLightShadows.value=i.state.spotShadow,v.rectAreaLights.value=i.state.rectArea,v.ltc_1.value=i.state.rectAreaLTC1,v.ltc_2.value=i.state.rectAreaLTC2,v.pointLights.value=i.state.point,v.pointLightShadows.value=i.state.pointShadow,v.hemisphereLights.value=i.state.hemi,v.directionalShadowMatrix.value=i.state.directionalShadowMatrix,v.spotLightMatrix.value=i.state.spotLightMatrix,v.spotLightMap.value=i.state.spotLightMap,v.pointShadowMatrix.value=i.state.pointShadowMatrix),a.lightProbeGrid=ea.state.lightProbeGridArray.length>0,a.currentProgram=h,a.uniformsList=null,h}function e8(e){if(null===e.uniformsList){let t=e.currentProgram.getUniforms();e.uniformsList=e7.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function e9(e,t){let n=o.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}e0.setAnimationLoop(function(e){eQ&&eQ(e)}),"u">typeof self&&e0.setContext(self),this.setAnimationLoop=function(e){eQ=e,ej.setAnimationLoop(e),null===e?e0.stop():e0.start()},ej.addEventListener("sessionstart",eZ),ej.addEventListener("sessionend",eJ),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void(0,b.error)("WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===ec)return;null!==ed&&ed.renderStart(e,t);let n=!0===ej.enabled&&!0===ej.isPresenting,r=null!==es&&(null===ev||n)&&es.begin(eu,ev);if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===ej.enabled&&!0===ej.isPresenting&&(null===es||!1===es.isCompositing())&&(!0===ej.cameraAutoUpdate&&ej.updateCamera(t),t=ej.getCamera()),!0===e.isScene&&e.onBeforeRender(eu,e,t,ev),(ea=h.get(e,el.length)).init(t),ea.state.textureUnits=l.getTextureUnits(),el.push(ea),eF.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),eD.setFromProjectionMatrix(eF,b.WebGLCoordinateSystem,t.reversedDepth),eI=this.localClippingEnabled,eN=g.init(this.clippingPlanes,eI),($=m.get(e,eo.length)).init(),eo.push($),!0===ej.enabled&&!0===ej.isPresenting){let e=eu.xr.getDepthSensingMesh();null!==e&&e1(e,t,-1/0,eu.sortObjects)}e1(e,t,0,eu.sortObjects),$.finish(),!0===eu.sortObjects&&$.sort(eA,ew,t.reversedDepth),(ek=!1===ej.enabled||!1===ej.isPresenting||!1===ej.hasDepthSensing())&&_.addToRenderList($,e),this.info.render.frame++,!0===this.info.autoReset&&this.info.reset(),!0===eN&&g.beginShadows();let a=ea.state.shadowsArray;if(v.render(a,e,t),!0===eN&&g.endShadows(),!1===(r&&es.hasRenderPass())){let n=$.opaque,r=$.transmissive;if(ea.setupLights(),t.isArrayCamera){let a=t.cameras;if(r.length>0)for(let t=0,i=a.length;t<i;t++)e3(n,r,e,a[t]);ek&&_.render(e);for(let t=0,n=a.length;t<n;t++){let n=a[t];e2($,e,n,n.viewport)}}else r.length>0&&e3(n,r,e,t),ek&&_.render(e),e2($,e,t)}null!==ev&&0===eg&&(l.updateMultisampleRenderTarget(ev),l.updateRenderTargetMipmap(ev)),r&&es.end(eu),!0===e.isScene&&e.onAfterRender(eu,e,t),R.resetDefaultState(),e_=-1,eS=null,el.pop(),el.length>0?(ea=el[el.length-1],l.setTextureUnits(ea.state.textureUnits),!0===eN&&g.setGlobalState(eu.clippingPlanes,ea.state.camera)):ea=null,eo.pop(),$=eo.length>0?eo[eo.length-1]:null,null!==ed&&ed.renderEnd()},this.getActiveCubeFace=function(){return eh},this.getActiveMipmapLevel=function(){return eg},this.getRenderTarget=function(){return ev},this.setRenderTargetTextures=function(e,t,n){let r=o.get(e);r.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===r.__autoAllocateDepthBuffer&&(r.__useRenderToTexture=!1),o.get(e.texture).__webglTexture=t,o.get(e.depthTexture).__webglTexture=r.__autoAllocateDepthBuffer?void 0:n,r.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){let n=o.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){ev=e,eh=t,eg=n;let r=null,i=!1,s=!1;if(e){let u=o.get(e);if(void 0!==u.__useDefaultFramebuffer){a.bindFramebuffer(eH.FRAMEBUFFER,u.__webglFramebuffer),ex.copy(e.viewport),eE.copy(e.scissor),eb=e.scissorTest,a.viewport(ex),a.scissor(eE),a.setScissorTest(eb),e_=-1;return}if(void 0===u.__webglFramebuffer)l.setupRenderTarget(e);else if(u.__hasExternalTextures)l.rebindTextures(e,o.get(e.texture).__webglTexture,o.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){let t=e.depthTexture;if(u.__boundDepthTexture!==t){if(null!==t&&o.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw Error("THREE.WebGLRenderer: Attached DepthTexture is initialized to the incorrect size.");l.setupDepthRenderbuffer(e)}}let c=e.texture;(c.isData3DTexture||c.isDataArrayTexture||c.isCompressedArrayTexture)&&(s=!0);let d=o.get(e).__webglFramebuffer;
382e.isWebGLCubeRenderTarget?(r=Array.isArray(d[t])?d[t][n]:d[t],i=!0):r=e.samples>0&&!1===l.useMultisampledRTT(e)?o.get(e).__webglMultisampledFramebuffer:Array.isArray(d)?d[n]:d,ex.copy(e.viewport),eE.copy(e.scissor),eb=e.scissorTest}else ex.copy(eP).multiplyScalar(eC).floor(),eE.copy(eU).multiplyScalar(eC).floor(),eb=eL;if(0!==n&&(r=ef),a.bindFramebuffer(eH.FRAMEBUFFER,r)&&a.drawBuffers(e,r),a.viewport(ex),a.scissor(eE),a.setScissorTest(eb),i){let r=o.get(e.texture);eH.framebufferTexture2D(eH.FRAMEBUFFER,eH.COLOR_ATTACHMENT0,eH.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(s)for(let r=0;r<e.textures.length;r++){let a=o.get(e.textures[r]);eH.framebufferTextureLayer(eH.FRAMEBUFFER,eH.COLOR_ATTACHMENT0+r,a.__webglTexture,n,t)}else if(null!==e&&0!==n){let t=o.get(e.texture);eH.framebufferTexture2D(eH.FRAMEBUFFER,eH.COLOR_ATTACHMENT0,eH.TEXTURE_2D,t.__webglTexture,n)}e_=-1},this.readRenderTargetPixels=function(e,t,n,i,l,s,u,c=0){if(!(e&&e.isWebGLRenderTarget))return void(0,b.error)("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let d=o.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==u&&(d=d[u]),d){a.bindFramebuffer(eH.FRAMEBUFFER,d);try{let a=e.textures[c],o=a.format,u=a.type;if(e.textures.length>1&&eH.readBuffer(eH.COLOR_ATTACHMENT0+c),!r.textureFormatReadable(o))return void(0,b.error)("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!r.textureTypeReadable(u))return void(0,b.error)("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-l&&eH.readPixels(t,n,i,l,y.convert(o),y.convert(u),s)}finally{let e=null!==ev?o.get(ev).__webglFramebuffer:null;a.bindFramebuffer(eH.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,i,l,s,u,c=0){if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let d=o.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==u&&(d=d[u]),d)if(t>=0&&t<=e.width-i&&n>=0&&n<=e.height-l){a.bindFramebuffer(eH.FRAMEBUFFER,d);let u=e.textures[c],f=u.format,p=u.type;if(e.textures.length>1&&eH.readBuffer(eH.COLOR_ATTACHMENT0+c),!r.textureFormatReadable(f))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!r.textureTypeReadable(p))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let m=eH.createBuffer();eH.bindBuffer(eH.PIXEL_PACK_BUFFER,m),eH.bufferData(eH.PIXEL_PACK_BUFFER,s.byteLength,eH.STREAM_READ),eH.readPixels(t,n,i,l,y.convert(f),y.convert(p),0);let h=null!==ev?o.get(ev).__webglFramebuffer:null;a.bindFramebuffer(eH.FRAMEBUFFER,h);let g=eH.fenceSync(eH.SYNC_GPU_COMMANDS_COMPLETE,0);return eH.flush(),await (0,b.probeAsync)(eH,g,4),eH.bindBuffer(eH.PIXEL_PACK_BUFFER,m),eH.getBufferSubData(eH.PIXEL_PACK_BUFFER,0,s),eH.deleteBuffer(m),eH.deleteSync(g),s}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=Math.pow(2,-n),i=Math.floor(e.image.width*r),o=Math.floor(e.image.height*r),s=null!==t?t.x:0,u=null!==t?t.y:0;l.setTexture2D(e,0),eH.copyTexSubImage2D(eH.TEXTURE_2D,n,0,0,s,u,i,o),a.unbindTexture()},this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,s=0){let u,c,d,f,p,m,h,g,v,_,S=e.isCompressedTexture?e.mipmaps[s]:e.image;if(null!==n)u=n.max.x-n.min.x,c=n.max.y-n.min.y,d=n.isBox3?n.max.z-n.min.z:1,f=n.min.x,p=n.min.y,m=n.isBox3?n.min.z:0;else{let t=Math.pow(2,-i);u=Math.floor(S.width*t),c=Math.floor(S.height*t),d=e.isDataArrayTexture?S.depth:e.isData3DTexture?Math.floor(S.depth*t):1,f=0,p=0,m=0}null!==r?(h=r.x,g=r.y,v=r.z):(h=0,g=0,v=0);let x=y.convert(t.format),E=y.convert(t.type);t.isData3DTexture?(l.setTexture3D(t,0),_=eH.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(l.setTexture2DArray(t,0),_=eH.TEXTURE_2D_ARRAY):(l.setTexture2D(t,0),_=eH.TEXTURE_2D),a.activeTexture(eH.TEXTURE0),a.pixelStorei(eH.UNPACK_FLIP_Y_WEBGL,t.flipY),a.pixelStorei(eH.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),a.pixelStorei(eH.UNPACK_ALIGNMENT,t.unpackAlignment);let b=a.getParameter(eH.UNPACK_ROW_LENGTH),T=a.getParameter(eH.UNPACK_IMAGE_HEIGHT),M=a.getParameter(eH.UNPACK_SKIP_PIXELS),R=a.getParameter(eH.UNPACK_SKIP_ROWS),
382C=a.getParameter(eH.UNPACK_SKIP_IMAGES);a.pixelStorei(eH.UNPACK_ROW_LENGTH,S.width),a.pixelStorei(eH.UNPACK_IMAGE_HEIGHT,S.height),a.pixelStorei(eH.UNPACK_SKIP_PIXELS,f),a.pixelStorei(eH.UNPACK_SKIP_ROWS,p),a.pixelStorei(eH.UNPACK_SKIP_IMAGES,m);let A=e.isDataArrayTexture||e.isData3DTexture,w=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=o.get(e),r=o.get(t),l=o.get(n.__renderTarget),_=o.get(r.__renderTarget);a.bindFramebuffer(eH.READ_FRAMEBUFFER,l.__webglFramebuffer),a.bindFramebuffer(eH.DRAW_FRAMEBUFFER,_.__webglFramebuffer);for(let n=0;n<d;n++)A&&(eH.framebufferTextureLayer(eH.READ_FRAMEBUFFER,eH.COLOR_ATTACHMENT0,o.get(e).__webglTexture,i,m+n),eH.framebufferTextureLayer(eH.DRAW_FRAMEBUFFER,eH.COLOR_ATTACHMENT0,o.get(t).__webglTexture,s,v+n)),eH.blitFramebuffer(f,p,u,c,h,g,u,c,eH.DEPTH_BUFFER_BIT,eH.NEAREST);a.bindFramebuffer(eH.READ_FRAMEBUFFER,null),a.bindFramebuffer(eH.DRAW_FRAMEBUFFER,null)}else if(0!==i||e.isRenderTargetTexture||o.has(e)){let n=o.get(e),r=o.get(t);a.bindFramebuffer(eH.READ_FRAMEBUFFER,ep),a.bindFramebuffer(eH.DRAW_FRAMEBUFFER,em);for(let e=0;e<d;e++)A?eH.framebufferTextureLayer(eH.READ_FRAMEBUFFER,eH.COLOR_ATTACHMENT0,n.__webglTexture,i,m+e):eH.framebufferTexture2D(eH.READ_FRAMEBUFFER,eH.COLOR_ATTACHMENT0,eH.TEXTURE_2D,n.__webglTexture,i),w?eH.framebufferTextureLayer(eH.DRAW_FRAMEBUFFER,eH.COLOR_ATTACHMENT0,r.__webglTexture,s,v+e):eH.framebufferTexture2D(eH.DRAW_FRAMEBUFFER,eH.COLOR_ATTACHMENT0,eH.TEXTURE_2D,r.__webglTexture,s),0!==i?eH.blitFramebuffer(f,p,u,c,h,g,u,c,eH.COLOR_BUFFER_BIT,eH.NEAREST):w?eH.copyTexSubImage3D(_,s,h,g,v+e,f,p,u,c):eH.copyTexSubImage2D(_,s,h,g,f,p,u,c);a.bindFramebuffer(eH.READ_FRAMEBUFFER,null),a.bindFramebuffer(eH.DRAW_FRAMEBUFFER,null)}else w?e.isDataTexture||e.isData3DTexture?eH.texSubImage3D(_,s,h,g,v,u,c,d,x,E,S.data):t.isCompressedArrayTexture?eH.compressedTexSubImage3D(_,s,h,g,v,u,c,d,x,S.data):eH.texSubImage3D(_,s,h,g,v,u,c,d,x,E,S):e.isDataTexture?eH.texSubImage2D(eH.TEXTURE_2D,s,h,g,u,c,x,E,S.data):e.isCompressedTexture?eH.compressedTexSubImage2D(eH.TEXTURE_2D,s,h,g,S.width,S.height,x,S.data):eH.texSubImage2D(eH.TEXTURE_2D,s,h,g,u,c,x,E,S);a.pixelStorei(eH.UNPACK_ROW_LENGTH,b),a.pixelStorei(eH.UNPACK_IMAGE_HEIGHT,T),a.pixelStorei(eH.UNPACK_SKIP_PIXELS,M),a.pixelStorei(eH.UNPACK_SKIP_ROWS,R),a.pixelStorei(eH.UNPACK_SKIP_IMAGES,C),0===s&&t.generateMipmaps&&eH.generateMipmap(_),a.unbindTexture()},this.initRenderTarget=function(e){void 0===o.get(e).__webglFramebuffer&&l.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?l.setTextureCube(e,0):e.isData3DTexture?l.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?l.setTexture2DArray(e,0):l.setTexture2D(e,0),a.unbindTexture()},this.resetState=function(){eh=0,eg=0,ev=null,a.reset(),R.reset()},"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return b.WebGLCoordinateSystem}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=b.ColorManagement._getDrawingBufferColorSpace(e),t.unpackColorSpace=b.ColorManagement._getUnpackColorSpace()}}e.s(["PMREMGenerator",0,W,"ShaderChunk",0,y,"ShaderLib",0,C,"UniformsLib",0,R,"WebGLCubeRenderTarget",0,$,"WebGLRenderer",0,t2,"WebGLUtils",0,tj],8560);var t3=e.i(30224);let t4=e=>{let t,n=new Set,r=(e,r)=>{let a="function"==typeof e?e(t):e;if(!Object.is(a,t)){let e=t;t=(null!=r?r:"object"!=typeof a||null===a)?a:Object.assign({}
382,t,a),n.forEach(n=>n(t,e))}},a=()=>t,i={setState:r,getState:a,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,a,i);return i},{useSyncExternalStoreWithSelector:t5}=t3.default,t6=(e,t)=>{let n=e?t4(e):t4,r=(e,r=t)=>(function(e,t=e=>e,n){let r=t5(e.subscribe,e.getState,e.getInitialState,t,n);return x.default.useDebugValue(r),r})(n,e,r);return Object.assign(r,n),r},t8=[];function t9(e,t,n=(e,t)=>e===t){if(e===t)return!0;if(!e||!t)return!1;let r=e.length;if(t.length!==r)return!1;for(let a=0;a<r;a++)if(!n(e[a],t[a]))return!1;return!0}function t7(e,t=null,n=!1,r={}){for(let a of(null===t&&(t=[e]),t8))if(t9(t,a.keys,a.equal)){if(n)return;if(Object.prototype.hasOwnProperty.call(a,"error"))throw a.error;if(Object.prototype.hasOwnProperty.call(a,"response"))return r.lifespan&&r.lifespan>0&&(a.timeout&&clearTimeout(a.timeout),a.timeout=setTimeout(a.remove,r.lifespan)),a.response;if(!n)throw a.promise}let a={keys:t,equal:r.equal,remove:()=>{let e=t8.indexOf(a);-1!==e&&t8.splice(e,1)},promise:("object"==typeof e&&"function"==typeof e.then?e:e(...t)).then(e=>{a.response=e,r.lifespan&&r.lifespan>0&&(a.timeout=setTimeout(a.remove,r.lifespan))}).catch(e=>a.error=e)};if(t8.push(a),!n)throw a.promise}var ne=e.i(89499),nt=x;function nn(e,t,n){if(!e)return;if(!0===n(e))return e;let r=t?e.return:e.child;for(;r;){let e=nn(r,t,n);if(e)return e;r=t?null:r.sibling}}function nr(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(t){return e}}"u">typeof window&&((null==(p=window.document)?void 0:p.createElement)||(null==(m=window.navigator)?void 0:m.product)==="ReactNative")?nt.default.useLayoutEffect:nt.default.useEffect;let na=nr(nt.default.createContext(null));class ni extends nt.default.Component{render(){return nt.default.createElement(na.Provider,{value:this._reactInternals},this.props.children)}}function no(){let e=nt.default.useContext(na);if(null===e)throw Error("its-fine: useFiber must be called within a <FiberProvider />!");let t=nt.default.useId();return nt.default.useMemo(()=>{for(let n of[e,null==e?void 0:e.alternate]){if(!n)continue;let e=nn(n,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}});if(e)return e}},[e,t])}let nl=Symbol.for("react.context"),ns=e=>null!==e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===nl;function nu(e){let t=e.root;for(;t.getState().previousRoot;)t=t.getState().previousRoot;return t}x.act;let nc=e=>null!=e&&("string"==typeof e||"number"==typeof e||e.isColor),nd="u">typeof window&&((null==(o=window.document)?void 0:o.createElement)||(null==(l=window.navigator)?void 0:l.product)==="ReactNative")?x.useLayoutEffect:x.useEffect;function nf(e){let t=x.useRef(e);return nd(()=>void(t.current=e),[e]),t}let np=()=>{};function nm({promise:e,onSettled:t}){return x.use(e),nd(t,[t]),null}let nh=x.Activity?function(){if(!nt.default.Activity)throw Error("its-fine: useActivityBridge requires React 19.2 or later!");let e=no(),[t]=nt.default.useState(()=>{let t,n=[],r=!1;nn(e,!0,e=>{var t,a;if(e.elementType===nt.default.Activity){let r=(null==(t=e.child)?void 0:t.tag)===22?e.child.stateNode:null;if("number"!=typeof(null==r?void 0:r._visibility))throw Error("its-fine: unsupported React Activity internals!");n.push(r)}else 22===e.tag&&(null==(a=e.return)?void 0:a.elementType)!==nt.default.Activity&&(r=!0)});let a="hidden",i=new Set,o={mounted:!1,connected:!1,subscribe:e=>(i.add(e),()=>{i.delete(e)}),sync(e){o.mounted&&!o.connected&&r&&n.length>0?t||(t=function(e){if("function"==typeof requestAnimationFrame){let t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)}let t=setTimeout(e,16);return()=>clearTimeout(t)}(()=>{t=void 0,o.sync(!0)})):(null==t||t(),t=void 0);let l=a;if(o.mounted?o.connected?l="visible":e&&(l=n.every(e=>(1&e._visibility)!=0)?"visible":"hidden"):l="hidden",a!==l)for(let e of(a=l,i))e()},Bridge:({children:e})=>nt.default.createElement(nt.default.Activity,{mode:nt.default.useSyncExternalStore(o.subscribe,()=>a,()=>"hidden")},e)};return o});return nt.default.useInsertionEffect(()=>(t.mounted=!0,queueMicrotask(()=>t.sync(!1)),()=>{t.mounted=!1,queueMicrotask(()=>t.sync(!1))}),[t]),nt.default.useLayoutEffect(()=>(t.connected=!0,t.sync(!1),()=>{t.connected=!1,t.sync(!0)}),[t]),t.Bridge}:()=>x.Fragment;function ng({set:e}){return nd(()=>(e(new Promise(()=>null)),()=>e(!1)),[e]),null}let nv=((s=class extends x.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}).getDerivedStateFromError=()=>({error:!0}),s);function n_(e){var t;let n="u">typeof window?null!=(t=window.devicePixelRatio)?t:2:1;return Array.isArray(e)?Math.min(Math.max(e[0],n),e[1]):e}function nS(e){var t;return null==(t=e.__r3f)?void 0:t.root.getState()}let nx={obj:e=>e===Object(e)&&!nx.arr(e)&&"function"!=typeof e,fun:e=>"function"==typeof e,str:e=>"string"==typeof e,num:e=>"number"==typeof e,boo:e=>"boolean"==typeof e,und:e=>void 0===e,nul:e=>null===e,arr:e=>Array.isArray(e),equ(e,t,{arrays:n="shallow",objects:r="reference",strict:a=!0}={}){let i;if(typeof e!=typeof t||!!e!=!!t)return!1;if(nx.str(e)||nx.num(e)||nx.boo(e))return e===t;let o=nx.obj(e);if(o&&"reference"===r)return e===t;let l=nx.arr(e);if(l&&"reference"===n)return e===t;if((l||o)&&e===t)return!0;for(i in e)if(!(i in t))return!1;if(o&&"shallow"===n&&"shallow"===r){for(i in a?t:e)if(!nx.equ(e[i],t[i],{strict:a,objects:"reference"}))return!1}else for(i in a?t:e)if(e[i]!==t[i])return!1;if(nx.und(i)){if(l&&0===e.length&&0===t.length||o&&0===Object.keys(e).length&&0===Object.keys(t).length)return!0;
382if(e!==t)return!1}return!0}},nE=["children","key","ref"];function nb(e){let t={};for(let n in e)nE.includes(n)||(t[n]=e[n]);return t}function nT(e,t,n,r){let a=null==e?void 0:e.__r3f;return!a&&(a={root:t,type:n,parent:null,children:[],props:nb(r),object:e,eventCount:0,handlers:{},previousVisible:void 0,isHidden:!1},e&&(e.__r3f=a)),a}function nM(e,t){if(!t.includes("-")||t in e)return{root:e,key:t,target:e[t]};let n=e,r=t.split("-");for(let a of r){if("object"!=typeof n||null===n){if(void 0!==n)return{root:n,key:r.slice(r.indexOf(a)).join("-"),target:void 0};return{root:e,key:t,target:void 0}}t=a,e=n,n=n[t]}return{root:e,key:t,target:n}}let ny=/-\d+$/;function nR(e,t){if(nx.str(t.props.attach)){if(ny.test(t.props.attach)){let n=t.props.attach.replace(ny,""),{root:r,key:a}=nM(e.object,n);Array.isArray(r[a])||(r[a]=[])}let{root:n,key:r}=nM(e.object,t.props.attach);t.previousAttach=n[r],n[r]=t.object}else nx.fun(t.props.attach)&&(t.previousAttach=t.props.attach(e.object,t.object))}function nC(e,t){if(nx.str(t.props.attach)){let{root:n,key:r}=nM(e.object,t.props.attach),a=t.previousAttach;void 0===a?delete n[r]:n[r]=a}else null==t.previousAttach||t.previousAttach(e.object,t.object);delete t.previousAttach}let nA=[...nE,"args","dispose","attach","object","onUpdate","dispose"],nw=new Map,nP=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],nU=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function nL(e,t){var n,r;let a=e.__r3f,i=a&&nu(a).getState(),o=null==a?void 0:a.eventCount;for(let n in t){let o=t[n];if(nA.includes(n))continue;if(a&&nU.test(n)){"function"==typeof o?a.handlers[n]=o:delete a.handlers[n],a.eventCount=Object.keys(a.handlers).length;continue}if(void 0===o)continue;if("visible"===n&&null!=a&&a.isHidden&&void 0!==a.previousVisible){a.previousVisible=o;continue}let{root:l,key:s,target:u}=nM(e,n);if(void 0===u&&("object"!=typeof l||null===l))throw Error(`R3F: Cannot set "${n}". Ensure it is an object before setting "${s}".`);if(u instanceof E.Layers&&o instanceof E.Layers)u.mask=o.mask;else if(u instanceof E.Color&&nc(o))u.set(o);else if(null!==u&&"object"==typeof u&&"function"==typeof u.set&&"function"==typeof u.copy&&null!=o&&o.constructor&&u.constructor===o.constructor)u.copy(o);else if(null!==u&&"object"==typeof u&&"function"==typeof u.set&&Array.isArray(o))"function"==typeof u.fromArray?u.fromArray(o):u.set(...o);else if(null!==u&&"object"==typeof u&&"function"==typeof u.set&&"number"==typeof o)"function"==typeof u.setScalar?u.setScalar(o):u.set(o);else if(l instanceof E.ShaderMaterial&&"uniforms"===s&&nx.obj(o)){nx.obj(l.uniforms)||(l.uniforms={});let e=l.uniforms;for(let t in o){let n=o[t],r=e[t];r?Object.assign(r,n):e[t]={...n}}}else l[s]=o,i&&!i.linear&&nP.includes(s)&&null!=(r=l[s])&&r.isTexture&&l[s].format===E.RGBAFormat&&l[s].type===E.UnsignedByteType&&(l[s].colorSpace
382=E.SRGBColorSpace)}if(null!=a&&a.parent&&null!=i&&i.internal&&null!=(n=a.object)&&n.isObject3D&&o!==a.eventCount){let e=a.object,t=i.internal.interaction.indexOf(e);t>-1&&i.internal.interaction.splice(t,1),a.eventCount&&null!==e.raycast&&i.internal.interaction.push(e)}return a&&void 0===a.props.attach&&(a.object.isBufferGeometry?a.props.attach="geometry":a.object.isMaterial&&(a.props.attach="material")),a&&nD(a),e}function nD(e){var t;if(!e.parent)return;null==e.props.onUpdate||e.props.onUpdate(e.object);let n=null==(t=e.root)||null==t.getState?void 0:t.getState();n&&0===n.internal.frames&&n.invalidate()}let nN=e=>null==e?void 0:e.isObject3D;function nI(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function nF(e,t,n,r){let a=n.get(t);a&&(n.delete(t),0===n.size&&(e.delete(r),a.target.releasePointerCapture(r)))}let nB=e=>!!(null!=e&&e.render),nO=x.createContext(null);function nG(){let e=x.useContext(nO);if(!e)throw Error("R3F: Hooks can only be used within the Canvas component!");return e}function nk(e=e=>e,t){return nG()(e,t)}function nz(e,t=0){let n=nG(),r=n.getState().internal.subscribe,a=nf(e);return nd(()=>r(a,t,n),[t,r,n]),null}let nH=new WeakMap;function nV(e,t){return function(n,...r){var a;let i;return"function"==typeof n&&(null==n||null==(a=n.prototype)?void 0:a.constructor)===n?(i=nH.get(n))||(i=new n,nH.set(n,i)):i=n,e&&e(i),Promise.all(r.map(e=>new Promise((n,r)=>i.load(e,e=>{var t;let r;nN(null==e?void 0:e.scene)&&Object.assign(e,(t=e.scene,r={nodes:{},materials:{},meshes:{}},t&&t.traverse(e=>{e.name&&(r.nodes[e.name]=e),e.material&&!r.materials[e.material.name]&&(r.materials[e.material.name]=e.material),e.isMesh&&!r.meshes[e.name]&&(r.meshes[e.name]=e)}),r)),n(e)},t,t=>r(Error(`Could not load ${e}: ${null==t?void 0:t.message}`))))))}}function nW(e,t,n,r){let a=Array.isArray(t)?t:[t],i=t7(nV(n,r),[e,...a],!1,{equal:nx.equ});return Array.isArray(t)?i:i[0]}nW.preload=function(e,t,n){let r=Array.isArray(t)?t:[t];t7(nV(n),[e,...r],!0,void 0)},nW.clear=function(e,t){var n=[e,...Array.isArray(t)?t:[t]];if(void 0===n||0===n.length)t8.splice(0,t8.length);else{let e=t8.find(e=>t9(n,e.keys,e.equal));e&&e.remove()}};let nj={objects:"shallow"},nX=e=>"function"==typeof(null==e?void 0:e.then);var nq={exports:{}},nK={exports:{}};nK.exports;let nY=(v||(v=1,g||(g=1,nK.exports=function(e){function t(e,t,n,r){return new aS(e,t,n,r)}function n(){}function r(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(e){for(var t=e,n=t;n&&!n.alternate;)(4098&(t=n).flags)!=0&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return 3===t.tag?e:null}function i(e){if(a(e)!==e)throw Error(r(188))}function o(e){var t=e.alternate;if(!t){if(null===(t=a(e)))throw Error(r(188));return t!==e?null:e}for(var n=e,o=t;;){var l=n.return;if(null===l)break;var s=l.alternate;if(null===s){if(null!==(o=l.return)){n=o;continue}break}if(l.child===s.child){for(s=l.child;s;){if(s===n)return i(l),e;if(s===o)return i(l),t;s=s.sibling}throw Error(r(188))}if(n.return!==o.return)n=l,o=s;else{for(var u=!1,c=l.child;c;){if(c===n){u=!0,n=l,o=s;break}if(c===o){u=!0,o=l,n=s;break}c=c.sibling}if(!u){for(c=s.child;c;){if(c===n){u=!0,n=s,o=l;break}if(c===o){u=!0,o=s,n=l;break}c=c.sibling}if(!u)throw Error(r(189))}}if(n.alternate!==o)throw Error(r(190))}if(3!==n.tag)throw Error(r(188));return n.stateNode.current===n?e:t}function l(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=a2&&e[a2]||e["@@iterator"])?e:null}function s(e){if(null==e)return null;if("function"==typeof e)return e.$$typeof===a4?null:e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case az:return"Fragment";case aV:return"Profiler";case aH:return"StrictMode";case aq:return"Suspense";case aK:return"SuspenseList";case aQ:return"Activity";case a0:return"ViewTransition"}if("object"==typeof e)switch(e.$$typeof){case ak:return"Portal";case aj:return e.displayName||"Context";case aW:return(e._context.displayName||"Context")+".Consumer";case aX:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case aY:return null!==(t=e.displayName||null)?t:s(e.type)||"Memo";case a$:t=e._payload,e=e._init;try{return s(e(t))}catch{}}return null}function u(e){return{current:e}}function c(e){0>l_||(e.current=lv[l_],lv[l_]=null,l_--)}function d(e,t){lv[++l_]=e.current,e.current=t}function f(e){var t=42&e;if(0!==t)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return 3932160&e;case 4194304:case 8388608:case 0x1000000:case 0x2000000:return 0x3c00000&e;case 0x4000000:return 0x4000000;case 0x8000000:return 0x8000000;case 0x10000000:return 0x10000000;case 0x20000000:return 0x20000000;case 0x40000000:return 0;default:return e}}function p(e,t,n){var r=e.pendingLanes;if(0===r)return 0;var a=0,i=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var l=0x7ffffff&r;return 0!==l?0!=(r=l&~i)?a=f(r):0!=(o&=l)?a=f(o):n||0!=(n=l&~e)&&(a=f(n)):0!=(l=r&~i)?a=f(l):0!==o?a=f(o):n||0!=(n=r&~e)&&(a=f(n)),0===a?0:0!==t&&t!==a&&(t&i)==0&&((i=a&-a)>=(n=t&-t)||32===i&&(4194048&n)!=0)?t:a}function m(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)==0}function h(e,t){(8&t)!=0&&(t|=32&t);var n=e.entangledLanes;if(0!==n)for(e=e.entanglements,n&=t;0<n;){var r=31-lx(n),a=1<<r;t|=e[r],n&=~a}return t}function g(){var e=ly;return(0x3c00000&(ly<<=1))==0&&(ly=4194304),e}function v(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}
382function _(e,t){e.pendingLanes|=t,0x10000000!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function E(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-lx(t);e.entangledLanes|=t,e.entanglements[r]=0x40000000|e.entanglements[r]|261930&n}function b(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-lx(n),a=1<<r;a&t|e[r]&t&&(e[r]|=t),n&=~a}}function T(e,t){var n=t&-t;return((n=(42&n)!=0?1:M(n))&(e.suspendedLanes|t))!=0?0:n}function M(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 0x1000000:case 0x2000000:e=128;break;case 0x10000000:e=0x8000000;break;default:e=0}return e}function y(e){return 2<(e&=-e)?8<e?(0x7ffffff&e)!=0?32:0x10000000:8:2}function R(e){if("function"==typeof lI&&lF(e),lO&&"function"==typeof lO.setStrictMode)try{lO.setStrictMode(lB,e)}catch{}}function C(e,t){return null!=e.name&&"auto"!==e.name?e.name:null!==t.autoName?t.autoName:t.autoName="_"+(e=uX.identifierPrefix)+"t_"+(lG++).toString(32)+"_"}function A(e){if(null==e||"string"==typeof e)return e;var t,n=null,r=u0;if(null!==r)for(var a=0;a<r.length;a++){var i=e[r[a]];if(null!=i){if("none"===i)return"none";n=null==n?i:n+" "+i}}return null!=(t=n)?t:e.default}function w(e,t){return e=A(e),null==(t=A(t))?"auto"===e?null:e:"auto"===t?null:t}function P(e){if(void 0===o3)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);o3=t&&t[1]||"",o4=-1<e.stack.indexOf(` 383 at`)?" (<anonymous>)":-1<e.stack.indexOf("@")?"@unknown:0:0":""}return` 384`+o3+e+o4}function U(e,t){if(!e||lV)return"";lV=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}
384else{try{n.call()}catch(e){r=e}n=!1;try{var a=Object.getOwnPropertyDescriptor(e.prototype,"props");Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(void 0!==a?Object.defineProperty(e.prototype,"props",a):delete e.prototype.props)}}}else{try{throw Error()}catch(e){r=e}(n=e())&&"function"==typeof n.catch&&n.catch(function(){})}}catch(e){if(e&&r&&"string"==typeof e.stack)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=r.DetermineComponentFrameRoot(),o=i[0],l=i[1];if(o&&l){var s=o.split(` 385`),u=l.split(` 386`);for(a=r=0;r<s.length&&!s[r].includes("DetermineComponentFrameRoot");)r++;for(;a<u.length&&!u[a].includes("DetermineComponentFrameRoot");)a++;if(r===s.length||a===u.length)for(r=s.length-1,a=u.length-1;1<=r&&0<=a&&s[r]!==u[a];)a--;for(;1<=r&&0<=a;r--,a--)if(s[r]!==u[a]){if(1!==r||1!==a)do if(r--,a--,0>a||s[r]!==u[a]){var c=` 387`+s[r].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=r&&0<=a)break}}}finally{lV=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?P(n):""}function L(e){try{var t="",n=null;do t+=function(e,t){switch(e.tag){case 26:case 27:case 5:return P(e.type);case 16:return P("Lazy");case 13:return e.child!==t&&null!==t?P("Suspense Fallback"):P("Suspense");case 19:return P("SuspenseList");case 0:case 15:return U(e.type,!1);case 11:return U(e.type.render,!1);case 1:return U(e.type,!0);case 31:return P("Activity");case 30:return P("ViewTransition");default:return""}}(e,n),n=e,e=e.return;while(e)return t}catch(e){return` 388Error generating stack: `+e.message+` 389`+e.stack}}function D(e,t){if("object"==typeof e&&null!==e){var n=lW.get(e);return void 0!==n?n:(t={value:e,source:t,stack:L(t)},lW.set(e,t),t)}return{value:e,source:t,stack:L(t)}}function N(e,t){lj[lX++]=lK,lj[lX++]=lq,lq=e,lK=t}function I(e,t,n){lY[l$++]=lZ,lY[l$++]=lJ,lY[l$++]=lQ,lQ=e;var r=lZ;e=lJ;var a=32-lx(r)-1;r&=~(1<<a),n+=1;var i=32-lx(t)+a;if(30<i){var o=a-a%5;i=(r&(1<<o)-1).toString(32),r>>=o,a-=o,lZ=1<<32-lx(t)+a|n<<a|r,lJ=i+e}else lZ=1<<i|n<<a|r,lJ=e}function F(e){null!==e.return&&(N(e,1),I(e,1,0))}function B(e){for(;e===lq;)lq=lj[--lX],lj[lX]=null,lK=lj[--lX],lj[lX]=null;for(;e===lQ;)lQ=lY[--l$],lY[l$]=null,lJ=lY[--l$],lY[l$]=null,lZ=lY[--l$],lY[l$]=null}function O(e,t){lY[l$++]=lZ,lY[l$++]=lJ,lY[l$++]=lQ,lZ=t.id,lJ=t.overflow,lQ=e}function G(e,t){d(l2,t),d(l1,e),d(l0,null),e=it(t),c(l0),d(l0,e)}function k(){c(l0),c(l1),c(l2)}function z(e){var t=e.memoizedState;null!==t&&(t=t.memoizedState,ih?iI._currentValue=t:iI._currentValue2=t,d(l3,e));
389var n=ir(t=l0.current,e.type);t!==n&&(d(l1,e),d(l0,n))}function H(e){l1.current===e&&(c(l0),c(l1)),l3.current===e&&(c(l3),ih?iI._currentValue=iN:iI._currentValue2=iN)}function V(e){var t=Error(r(418,1<arguments.length&&void 0!==arguments[1]&&arguments[1]?"text":"HTML",""));throw Y(D(t,e)),l7}function W(e,t){if(!i_)throw Error(r(175));ok(e.stateNode,e.type,e.memoizedProps,t,e)||V(e,!0)}function j(e){for(l4=e.return;l4;)switch(l4.tag){case 5:case 31:case 13:l9=!1;return;case 27:case 3:l9=!0;return;default:l4=l4.return}}function X(e){if(!i_||e!==l4)return!1;if(!l6)return j(e),l6=!0,!1;var t=e.tag;if(ld?3!==t&&27!==t&&(5!==t||o2(e.type)&&!iu(e.type,e.memoizedProps))&&l5&&V(e):3!==t&&(5!==t||o2(e.type)&&!iu(e.type,e.memoizedProps))&&l5&&V(e),j(e),13===t){if(!i_)throw Error(r(316));if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(r(317));l5=oj(e)}else if(31===t){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(r(317));l5=oW(e)}else l5=ld&&27===t?oP(e.type,l5):l4?ow(e.stateNode):null;return!0}function q(){i_&&(l5=l4=null,l6=!1)}function K(){var e=l8;return null!==e&&(null===uO?uO=e:uO.push.apply(uO,e),l8=null),e}function Y(e){null===l8?l8=[e]:l8.push(e)}function $(e,t,n){ih?(d(se,t._currentValue),t._currentValue=n):(d(se,t._currentValue2),t._currentValue2=n)}function Q(e){var t=se.current;ih?e._currentValue=t:e._currentValue2=t,c(se)}function Z(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function J(e,t,n,a){var i=e.child;for(null!==i&&(i.return=e);null!==i;){var o=i.dependencies;if(null!==o){var l=i.child;o=o.firstContext;n:for(;null!==o;){var s=o;o=i;for(var u=0;u<t.length;u++)if(s.context===t[u]){o.lanes|=n,null!==(s=o.alternate)&&(s.lanes|=n),Z(o.return,n,e),a||(l=null);break n}o=s.next}}else if(18===i.tag){if(null===(l=i.return))throw Error(r(341));l.lanes|=n,null!==(o=l.alternate)&&(o.lanes|=n),Z(l,n,e),l=null}else 13===i.tag&&null!==i.memoizedState&&null===i.memoizedState.dehydrated?(i.lanes|=n,null!==(l=i.alternate)&&(l.lanes|=n),Z(i.return,n,e),l=null!==(l=i.child)?l.sibling:null):l=i.child;if(null!==l)l.return=i;else for(l=i;null!==l;){if(l===e){l=null;break}if(null!==(i=l.sibling)){i.return=l.return,l=i;break}l=l.return}i=l}}function ee(e,t,n,a){e=null;for(var i=t,o=!1;null!==i;){if(!o){if((524288&i.flags)!=0)o=!0;else if((262144&i.flags)!=0)break}if(10===i.tag){var l=i.alternate;if(null===l)throw Error(r(387));if(null!==(l=l.memoizedProps)){var s=i.type;lk(i.pendingProps.value,l.value)||(null!==e?e.push(s):e=[s])}}else if(i===l3.current){if(null===(l=i.alternate))throw Error(r(387));l.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(null!==e?e.push(iI):e=[iI])}i=i.return}return null!==e&&J(t,e,n,a),t.flags|=262144,null!==e}function et(e){for(e=e.firstContext;null!==e;){var t=e.context;if(!lk(ih?t._currentValue:t._currentValue2,e.memoizedValue))return!0;e=e.next}return!1}
389function en(e){st=e,sn=null,null!==(e=e.dependencies)&&(e.firstContext=null)}function er(e){return ei(st,e)}function ea(e,t){return null===st&&en(e),ei(e,t)}function ei(e,t){var n=ih?t._currentValue:t._currentValue2;if(t={context:t,memoizedValue:n,next:null},null===sn){if(null===e)throw Error(r(308));sn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else sn=sn.next=t;return n}function eo(){return{controller:new sr,data:new Map,refCount:0}}function el(e){e.refCount--,0===e.refCount&&sa(si,function(){e.controller.abort()})}function es(e,t){if((4194048&e.pendingLanes)!=0){var n=e.transitionTypes;for(null===n&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];-1===n.indexOf(r)&&n.push(r)}}}function eu(){}function ec(e){e!==su&&null===e.next&&(null===su?ss=su=e:su=su.next=e),sd=!0,sc||(sc=!0,iB?iO(function(){(6&uE)!=0?lR(lU,ef):ep()}):lR(lU,ef))}function ed(e,t){if(!sf&&sd){sf=!0;do for(var n=!1,r=ss;null!==r;){if(!t)if(0!==e){var a=r.pendingLanes;if(0===a)var i=0;else{var o=r.suspendedLanes,l=r.pingedLanes;i=0xc000095&(i=(1<<31-lx(42|e)+1)-1&(a&~(o&~l)))?0xc000095&i|1:i?2|i:0}0!==i&&(n=!0,eg(r,i))}else i=uM,(3&(i=p(r,r===ub?i:0,null!==r.cancelPendingCommit||r.timeoutHandle!==im)))==0||m(r,i)||(n=!0,eg(r,i));r=r.next}while(n)sf=!1}}function ef(){ep()}function ep(){sd=sc=!1;var e=0;0!==sp&&iM()&&(e=sp);for(var t=lP(),n=null,r=ss;null!==r;){var a=r.next,i=em(r,t);0===i?(r.next=null,null===n?ss=a:n.next=a,null===a&&(su=n)):(n=r,(0!==e||(3&i)!=0)&&(sd=!0)),r=a}0!==uj&&5!==uj||ed(e,!1),0!==sp&&(sp=0)}function em(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,a=e.expirationTimes,i=-0x3c00001&e.pendingLanes;0<i;){var o=31-lx(i),l=1<<o,s=a[o];-1===s?((l&n)==0||(l&r)!=0)&&(a[o]=function(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return -1}}(l,t)):s<=t&&(e.expiredLanes|=l),i&=~l}if(t=ub,n=uM,n=p(e,e===t?n:0,null!==e.cancelPendingCommit||e.timeoutHandle!==im),r=e.callbackNode,0===n||e===t&&(2===uy||9===uy)||null!==e.cancelPendingCommit)return null!==r&&null!==r&&lC(r),e.callbackNode=null,e.callbackPriority=0;if((3&n)==0||m(e,n)){if((t=n&-n)===e.callbackPriority)return t;switch(null!==r&&lC(r),y(n)){case 2:case 8:n=lL;break;case 32:default:n=lD;break;case 0x10000000:n=lN}return n=lR(n,r=eh.bind(null,e)),e.callbackPriority=t,e.callbackNode=n,t}return null!==r&&null!==r&&lC(r),e.callbackPriority=2,e.callbackNode=null,2}function eh(e,t){if(0!==uj&&5!==uj)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(ac()&&e.callbackNode!==n)return null;var r=uM;return 0===(r=p(e,e===ub?r:0,null!==e.cancelPendingCommit||e.timeoutHandle!==im))?null:(r$(e,r,t),em(e,lP()),null!=e.callbackNode&&e.callbackNode===n?eh.bind(null,e):null)}function eg(e,t){if(ac())return null;r$(e,t,!0)}function ev(){if(0===sp){var e=sg;0===e&&(e=lT,(261888&(lT<<=1))==0&&(lT=256)),sp=e}return sp}function e_(){if(0==--sh&&(sl=null,null!==sm)){null!==sv&&(sv.status="fulfilled");var e=sm;sm=null,sg=0,sv=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function eS(){var e=sS.current;return null!==e?e:ub.pooledCache}function ex(e,t){null===t?d(sS,sS.current):d(sS,t.pool)}function eE(){var e=eS();return null===e?null:{parent:ih?so._currentValue:so._currentValue2,pool:e}}function eb(e,t){if(lk(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var a=n[r];if(!lH.call(t,a)||!lk(e[a],t[a]))return!1}return!0}function eT(e){return"fulfilled"===(e=e.status)||"rejected"===e}function eM(e,t,n){switch(void 0===(n=e[n])?e.push(t):n!==t&&(t.then(eu,eu),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw eC(e=t.reason),void 0!==e||"reason"in t?e:Error(r(600));default:if("string"==typeof t.status)t.then(eu,eu);else{if(null!==(e=ub)&&100<e.shellSuspendCounter)throw Error(r(482));(e=t).status="pending",e.then(function(e){if("pending"===t.status){var n=t;n.status="fulfilled",n.value=e}},function(e){if("pending"===t.status){var n=t;n.status="rejected",n.reason=e}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw eC(e=t.reason),e}throw sM=t,sx}}function ey(e){try{return(0,e._init)(e._payload)}catch(e){throw null!==e&&"object"==typeof e&&"function"==typeof e.then?(sM=e,sx):e}}function eR(){if(null===sM)throw Error(r(459));var e=sM;return sM=null,e}function eC(e){if(e===sx||e===sb)throw Error(r(483))}function eA(e){var t=sR;return sR+=1,null===sy&&(sy=[]),eM(sy,e,t)}function ew(e,t){e.ref=void 0!==(t=t.props.ref)?t:null}function eP(e,t){throw t.$$typeof===aO?Error(r(525)):Error(r(31,"[object Object]"===(e=Object.prototype.toString.call(t))?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function eU(e){function n(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function a(t,r){if(!e)return null;for(;null!==r;)n(t,r),r=r.sibling;return null}function i(e){for(var t=new Map;null!==e;)null===e.key?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function o(e,t){return(e=aE(e,t)).index=0,e.sibling=null,e}function s(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=2,n):r:(t.flags|=0x8000002,n):(t.flags|=1048576,n)}function u(t){return e&&null===t.alternate&&(t.flags|=0x8000002),t}function c(e,t,n,r){return null===t||6!==t.tag?(t=ay(n,e.mode,r)).return=e:(t=o(t,n)).return=e,t}function d(e,t,n,r){var a=n.type;return a===az?(ew(e=p(e,t,n.props.children,r,n.key),n),e):(null!==t&&(t.elementType===a||"object"==typeof a&&null!==a&&a.$$typeof===a$&&ey(a)===t.type)?ew(t=o(t,n.props),n):ew(t=aT(n.type,n.key,n.props,null,e.mode,r),n),t.return=e,t)}function f(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=aC(n,e.mode,r)).return=e:(t=o(t,n.children||[])).return=e,t}function p(e,t,n,r,a){return null===t||7!==t.tag?(t=aM(n,e.mode,r,a)).return=e:(t=o(t,n)).return=e,t}function m(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t||"bigint"==typeof t)return(t=ay(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case aG:return ew(n=aT(t.type,t.key,t.props,null,e.mode,n),t),n.return=e,n;case ak:return(t=aC(t,e.mode,n)).return=e,t;
vendor: 4,616 bytes, line 389
389case a$:return m(e,t=ey(t),n)}if(a5(t)||l(t))return(t=aM(t,e.mode,n,null)).return=e,t;if("function"==typeof t.then)return m(e,eA(t),n);if(t.$$typeof===aj)return m(e,ea(e,t),n);eP(e,t)}return null}function h(e,t,n,r){var a=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n||"bigint"==typeof n)return null!==a?null:c(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case aG:return n.key===a?d(e,t,n,r):null;case ak:return n.key===a?f(e,t,n,r):null;case a$:return h(e,t,n=ey(n),r)}if(a5(n)||l(n))return null!==a?null:p(e,t,n,r,null);if("function"==typeof n.then)return h(e,t,eA(n),r);if(n.$$typeof===aj)return h(e,t,ea(e,n),r);eP(e,n)}return null}function g(e,t,n,r,a){if("string"==typeof r&&""!==r||"number"==typeof r||"bigint"==typeof r)return c(t,e=e.get(n)||null,""+r,a);if("object"==typeof r&&null!==r){switch(r.$$typeof){case aG:return d(t,e=e.get(null===r.key?n:r.key)||null,r,a);case ak:return f(t,e=e.get(null===r.key?n:r.key)||null,r,a);case a$:return g(e,t,n,r=ey(r),a)}if(a5(r)||l(r))return p(t,e=e.get(n)||null,r,a,null);if("function"==typeof r.then)return g(e,t,n,eA(r),a);if(r.$$typeof===aj)return g(e,t,n,ea(t,r),a);eP(t,r)}return null}return function(c,d,f,p){try{sR=0;var v=function t(c,d,f,p){if("object"==typeof f&&null!==f&&f.type===az&&null===f.key&&void 0===f.props.ref&&(f=f.props.children),"object"==typeof f&&null!==f){switch(f.$$typeof){case aG:n:{for(var v=f.key;null!==d;){if(d.key===v){if((v=f.type)===az){if(7===d.tag){a(c,d.sibling),ew(p=o(d,f.props.children),f),p.return=c,c=p;break n}}else if(d.elementType===v||"object"==typeof v&&null!==v&&v.$$typeof===a$&&ey(v)===d.type){a(c,d.sibling),ew(p=o(d,f.props),f),p.return=c,c=p;break n}a(c,d);break}n(c,d),d=d.sibling}f.type===az?ew(p=aM(f.props.children,c.mode,p,f.key),f):ew(p=aT(f.type,f.key,f.props,null,c.mode,p),f),p.return=c,c=p}return u(c);case ak:n:{for(v=f.key;null!==d;){if(d.key===v)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){a(c,d.sibling),(p=o(d,f.children||[])).return=c,c=p;break n}else{a(c,d);break}n(c,d),d=d.sibling}(p=aC(f,c.mode,p)).return=c,c=p}return u(c);case a$:return t(c,d,f=ey(f),p)}if(a5(f))return function(t,r,o,l){for(var u=null,c=null,d=r,f=r=0,p=null;null!==d&&f<o.length;f++){d.index>f?(p=d,d=null):p=d.sibling;var v=h(t,d,o[f],l);if(null===v){null===d&&(d=p);break}e&&d&&null===v.alternate&&n(t,d),r=s(v,r,f),null===c?u=v:c.sibling=v,c=v,d=p}if(f===o.length)return a(t,d),l6&&N(t,f),u;if(null===d){for(;f<o.length;f++)null!==(d=m(t,o[f],l))&&(r=s(d,r,f),null===c?u=d:c.sibling=d,c=d);return l6&&N(t,f),u}for(d=i(d);f<o.length;f++)null!==(p=g(d,t,f,o[f],l))&&(e&&null!==(v=p.alternate)&&d.delete(null===v.key?f:v.key),r=s(p,r,f),null===c?u=p:c.sibling=p,c=p);return e&&d.forEach(function(e){return n(t,e)}),l6&&N(t,f),u}(c,d,f,p);if(l(f)){if("function"!=typeof(v=l(f)))throw Error(r(150));return function(t,o,l,u){if(null==l)throw Error(r(151));for(var c=null,d=null,f=o,p=o=0,v=null,_=l.next();null!==f&&!_.done;p++,_=l.next()){f.index>p?(v=f,f=null):v=f.sibling;var S=h(t,f,_.value,u);if(null===S){null===f&&(f=v);break}e&&f&&null===S.alternate&&n(t,f),o=s(S,o,p),null===d?c=S:d.sibling=S,d=S,f=v}if(_.done)return a(t,f),l6&&N(t,p),c;if(null===f){for(;!_.done;p++,_=l.next())null!==(_=m(t,_.value,u))&&(o=s(_,o,p),null===d?c=_:d.sibling=_,d=_);return l6&&N(t,p),c}for(f=i(f);!_.done;p++,_=l.next())null!==(_=g(f,t,p,_.value,u))&&(e&&null!==(v=_.alternate)&&f.delete(null===v.key?p:v.key),o=s(_,o,p),null===d?c=_:d.sibling=_,d=_);return e&&f.forEach(function(e){return n(t,e)}),l6&&N(t,p),c}(c,d,f=v.call(f),p)}if("function"==typeof f.then)return t(c,d,eA(f),p);if(f.$$typeof===aj)return t(c,d,ea(c,f),p);eP(c,f)}return"string"==typeof f&&""!==f||"number"==typeof f||"bigint"==typeof f?(f=""+f,null!==d&&6===d.tag?(a(c,d.sibling),(p=o(d,f)).return=c):(a(c,d),(p=ay(f,c.mode,p)).return=c),u(c=p)):a(c,d)}(c,d,f,p);return sy=null,v}catch(e){if(e===sx||e===sb)throw e;var _=t(29,e,null,c.mode);return _.lanes=p,_.return=c,_}finally{}}}function eL(){for(var e=sP,t=sU=sP=0;t<e;){var n=sw[t];sw[t++]=null;var r=sw[t];sw[t++]=null;var a=sw[t];sw[t++]=null;var i=sw[t];if(sw[t++]=null,null!==r&&null!==a){var o=r.pending;null===o?a.next=a:(a.next=o.next,o.next=a),r.pending=a}0!==i&&eF(n,a,i)}}function eD(e,t,n,r){sw[sP++]=e,sw[sP++]=t,sw[sP++]=n,sw[sP++]=r,sU|=r,e.lanes|=r,null!==(e=e.alternate)&&(e.lanes|=r)}function eN(e,t,n,r){return eD(e,t,n,r),eB(e)}function eI(e,t){return eD(e,null,null,t),eB(e)}function eF(e,t,n){e.lanes|=n;var r=e.alternate;null!==r&&(r.lanes|=n);for(var a=!1,i=e.return;null!==i;
389)i.childLanes|=n,null!==(r=i.alternate)&&(r.childLanes|=n),22===i.tag&&(null===(e=i.stateNode)||1&e._visibility||(a=!0)),e=i,i=i.return;return 3===e.tag?(i=e.stateNode,a&&null!==t&&(a=31-lx(n),null===(r=(e=i.hiddenUpdates)[a])?e[a]=[t]:r.push(t),t.lane=0x20000000|n),i):null}function eB(e){if(50<u1)throw u1=0,u2=null,Error(r(185));for(var t=e.return;null!==t;)t=(e=t).return;return 3===e.tag?e.stateNode:null}function eO(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function eG(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ek(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ez(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,(2&uE)!=0){var a=r.pending;return null===a?t.next=t:(t.next=a.next,a.next=t),r.pending=t,t=eB(e),eF(e,null,n),t}return eD(e,r,t,n),eB(e)}function eH(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,(4194048&n)!=0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,b(e,n)}}function eV(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var a=null,i=null;if(null!==(n=n.firstBaseUpdate)){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};null===i?a=i=o:i=i.next=o,n=n.next}while(null!==n)null===i?a=i=t:i=i.next=t}else a=i=t;n={baseState:r.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function eW(){if(sD){var e=sv;if(null!==e)throw e}}function ej(e,t,n,r){sD=!1;var a=e.updateQueue;sL=!1;var i=a.firstBaseUpdate,o=a.lastBaseUpdate,l=a.shared.pending;if(null!==l){a.shared.pending=null;var s=l,u=s.next;s.next=null,null===o?i=u:o.next=u,o=s;var c=e.alternate;null!==c&&(l=(c=c.updateQueue).lastBaseUpdate)!==o&&(null===l?c.firstBaseUpdate=u:l.next=u,c.lastBaseUpdate=s)}if(null!==i){var d=a.baseState;for(o=0,c=u=s=null,l=i;;){var f=-0x20000001&l.lane,p=f!==l.lane;if(p?(uM&f)===f:(r&f)===f){0!==f&&f===sg&&(sD=!0),null!==c&&(c=c.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});n:{var m=e,h=l;switch(f=t,h.tag){case 1:if("function"==typeof(m=h.payload)){d=m.call(n,d,f);break n}d=m;break n;case 3:m.flags=-65537&m.flags|128;case 0:if(null==(f="function"==typeof(m=h.payload)?m.call(n,d,f):m))break n;d=aB({},d,f);break n;case 2:sL=!0}}null!==(f=l.callback)&&(e.flags|=64,p&&(e.flags|=8192),null===(p=a.callbacks)?a.callbacks=[f]:p.push(f))}else p={lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},null===c?(u=c=p,s=d):c=c.next=p,o|=f;if(null===(l=l.next)){if(null===(l=a.shared.pending))break;l=(p=l).next,p.next=null,a.lastBaseUpdate=p,a.shared.pending=null}}null===c&&(s=d),a.baseState=s,a.firstBaseUpdate=u,a.lastBaseUpdate=c,null===i&&(a.shared.lanes=0),uL|=o,e.lanes=o,e.memoizedState=d}}function eX(e,t){if("function"!=typeof e)throw Error(r(191,e));e.call(t)}function eq(e,t){var n=e.callbacks;if(null!==n)for(e.callbacks=null,e=0;e<n.length;e++)eX(n[e],t)}function eK(e,t){d(sI,e=uP),d(sN,t),uP=e|t.baseLanes}function eY(){d(sI,uP),d(sN,sN.current)}function e$(){uP=sI.current,c(sN),c(sI)}function eQ(e){var t=e.alternate;d(sO,1&sO.current),d(sF,e),null===sB&&(null===t||null!==sN.current||null!==t.memoizedState)&&(sB=e)}function eZ(e){d(sO,sO.current),d(sF,e),null===sB&&(sB=e)}function eJ(e){22===e.tag?(d(sO,sO.current),d(sF,e),null===sB&&(sB=e)):e0()}function e0(){d(sO,sO.current),d(sF,sF.current)}function e1(e){c(sF),sB===e&&(sB=null),c(sO)}function e2(e,t){d(sF,sF.current),d(sO,t)}function e3(e){c(sO),c(sF),sB===e&&(sB=null)}function e4(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||oT(n)||oM(n)))return t}else if(19===t.tag&&"independent"!==t.memoizedProps.revealOrder){if((128&t.flags)!=0)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function e5(){throw Error(r(321))}function e6(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!lk(e[n],t[n]))return!1;return!0}function e8(e,t,n,r,a,i){return sG=i,sk=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,a6.H=null===e||null===e.memoizedState?sQ:sZ,sj=!1,i=n(r,a),sj=!1,sW&&(i=e7(t,n,r,a)),e9(e),i}function e9(e){a6.H=s$;var t=null!==sz&&null!==sz.next;if(sG=0,sH=sz=sk=null,sV=!1,sq=0,sK=null,t)throw Error(r(300));
389null===e||s2||null!==(e=e.dependencies)&&et(e)&&(s2=!0)}function e7(e,t,n,a){sk=e;var i=0;do{if(sW&&(sK=null),sq=0,sW=!1,25<=i)throw Error(r(301));if(i+=1,sH=sz=null,null!=e.updateQueue){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,null!=o.memoCache&&(o.memoCache.index=0)}a6.H=sJ,o=t(n,a)}while(sW)return o}function te(){var e=a6.H,t=e.useState()[0];return t="function"==typeof t.then?tl(t):t,e=e.useState()[0],(null!==sz?sz.memoizedState:null)!==e&&(sk.flags|=1024),t}function tt(){var e=0!==sX;return sX=0,e}function tn(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function tr(e){if(sV){for(e=e.memoizedState;null!==e;){var t=e.queue;null!==t&&(t.pending=null),e=e.next}sV=!1}sG=0,sH=sz=sk=null,sW=!1,sq=sX=0,sK=null}function ta(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===sH?sk.memoizedState=sH=e:sH=sH.next=e,sH}function ti(){if(null===sz){var e=sk.alternate;e=null!==e?e.memoizedState:null}else e=sz.next;var t=null===sH?sk.memoizedState:sH.next;if(null!==t)sH=t,sz=e;else{if(null===e)throw null===sk.alternate?Error(r(467)):Error(r(310));e={memoizedState:(sz=e).memoizedState,baseState:sz.baseState,baseQueue:sz.baseQueue,queue:sz.queue,next:null},null===sH?sk.memoizedState=sH=e:sH=sH.next=e}return sH}function to(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function tl(e){var t=sq;return sq+=1,null===sK&&(sK=[]),e=eM(sK,e,t),t=sk,(null===sH?t.memoizedState:sH.next)===null&&(a6.H=null===(t=t.alternate)||null===t.memoizedState?sQ:sZ),e}function ts(e){if(null!==e&&"object"==typeof e){if("function"==typeof e.then)return tl(e);if(e.$$typeof===a1)return;if(e.$$typeof===aj)return er(e)}throw Error(r(438,String(e)))}function tu(e){var t=null,n=sk.updateQueue;if(null!==n&&(t=n.memoCache),null==t){var r=sk.alternate;null!==r&&null!==(r=r.updateQueue)&&null!=(r=r.memoCache)&&(t={data:r.data.map(function(e){return e.slice()}),index:0})}if(null==t&&(t={data:[],index:0}),null===n&&(n=to(),sk.updateQueue=n),n.memoCache=t,void 0===(n=t.data[t.index]))for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=aJ;return t.index++,n}function tc(e,t){return"function"==typeof t?t(e):t}function td(e){return tf(ti(),sz,e)}function tf(e,t,n){var a=e.queue;if(null===a)throw Error(r(311));a.lastRenderedReducer=n;var i=e.baseQueue,o=a.pending;if(null!==o){if(null!==i){var l=i.next;i.next=o.next,o.next=l}t.baseQueue=i=o,a.pending=null}if(o=e.baseState,null===i)e.memoizedState=o;else{t=i.next;var s=l=null,u=null,c=t,d=!1;do{var f=-0x20000001&c.lane;if(f!==c.lane?(uM&f)===f:(sG&f)===f){var p=c.revertLane;if(0===p)null!==u&&(u=u.next={lane:0,revertLane:0,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),f===sg&&(d=!0);else if((sG&p)===p){c=c.next,p===sg&&(d=!0);continue}else f={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},null===u?(s=u=f,l=o):u=u.next=f,sk.lanes|=p,uL|=p;f=c.action,sj&&n(o,f),o=c.hasEagerState?c.eagerState:n(o,f)}else p={lane:f,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},null===u?(s=u=p,l=o):u=u.next=p,sk.lanes|=f,uL|=f;c=c.next}while(null!==c&&c!==t)if(null===u?l=o:u.next=s,!lk(o,e.memoizedState)&&(s2=!0,d&&null!==(n=sv)))throw n;e.memoizedState=o,e.baseState=l,e.baseQueue=u,a.lastRenderedState=o}return null===i&&(a.lanes=0),[e.memoizedState,a.dispatch]}function tp(e){var t=ti(),n=t.queue;if(null===n)throw Error(r(311));n.lastRenderedReducer=e;var a=n.dispatch,i=n.pending,o=t.memoizedState;if(null!==i){n.pending=null;var l=i=i.next;do o=e(o,l.action),l=l.next;while(l!==i)lk(o,t.memoizedState)||(s2=!0),t.memoizedState=o,null===t.baseQueue&&(t.baseState=o),n.lastRenderedState=o}return[o,a]}function tm(e,t,n){var a=sk,i=ti(),o=l6;if(o){if(void 0===n)throw Error(r(407));n=n()}else n=t();var l=!lk((sz||i).memoizedState,n);if(l&&(i.memoizedState=n,s2=!0),i=i.queue,tG(tv.bind(null,a,i,e),[e]),tN((e=i.getSnapshot!==t||l||null!==sH&&(1&sH.memoizedState.tag)!=0)?9:8,{destroy:void 0},tg.bind(null,a,i,n,t),null),e){if(a.flags|=2048,null===ub)throw Error(r(349));o||(127&sG)!=0||th(a,t,n)}return n}function th(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=sk.updateQueue)?(t=to(),sk.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function tg(e,t,n,r){t.value=n,t.getSnapshot=r,t_(t)&&tS(e)}function tv(e,t,n){return n(function(){t_(t)&&tS(e)})}function t_(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!lk(e,n)}catch{return!0}}function tS(e){var t=eI(e,2);null!==t&&rY(t,e,2)}function tx(e){var t=ta();if("function"==typeof e){var n=e;if(e=n(),sj){R(!0);try{n()}finally{R(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tc,lastRenderedState:e},t}function tE(e,t,n,r){return e.baseState=n,tf(e,sz,"function"==typeof r?r:tc)}function tb(e,t,n,a,i){if(t6(e))throw Error(r(485));if(null!==(e=t.action)){var o={payload:i,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};null!==a6.T?n(!0):o.isTransition=!1,a(o),null===(n=t.pending)?(o.next=t.pending=o,tT(t,o)):(o.next=n.next,t.pending=n.next=o)}}function tT(e,t){var n=t.action,r=t.payload,a=e.state;if(t.isTransition){var i=a6.T,o={};o.types=null!==i?i.types:null,a6.T=o;try{var l=n(a,r),s=a6.S;null!==s&&s(o,l),tM(e,t,l)}catch(n){tR(e,t,n)}finally{null!==i&&null!==o.types&&(i.types=o.types),a6.T=i}}else try{i=n(a,r),tM(e,t,i)}catch(n){tR(e,t,n)}}function tM(e,t,n){null!==n&&"object"==typeof n&&"function"==typeof n.then?n.then(function(n){ty(e,t,n)},function(n){return tR(e,t,n)}
389):ty(e,t,n)}function ty(e,t,n){t.status="fulfilled",t.value=n,tC(t),e.state=n,null!==(t=e.pending)&&((n=t.next)===t?e.pending=null:(n=n.next,t.next=n,tT(e,n)))}function tR(e,t,n){var r=e.pending;if(e.pending=null,null!==r){r=r.next;do t.status="rejected",t.reason=n,tC(t),t=t.next;while(t!==r)}e.action=null}function tC(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function tA(e,t){return t}function tw(e,t){if(l6){var n=ub.formState;if(null!==n){n:{var r=sk;if(l6){if(l5){var a=oC(l5,l9);if(a){l5=ow(a),r=oA(a);break n}}V(r)}r=!1}r&&(t=n[0])}}(n=ta()).memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tA,lastRenderedState:t},n.queue=r,n=t3.bind(null,sk,r),r.dispatch=n,r=tx(!1);var i=t5.bind(null,sk,!1,r.queue);return r=ta(),a={state:t,dispatch:null,action:e,pending:null},r.queue=a,n=tb.bind(null,sk,a,i,n),a.dispatch=n,r.memoizedState=e,[t,n,!1]}function tP(e){return tU(ti(),sz,e)}function tU(e,t,n){if(t=tf(e,t,tA)[0],e=td(tc)[0],"object"==typeof t&&null!==t&&"function"==typeof t.then)try{var r=tl(t)}catch(e){throw e===sx?sb:e}else r=t;var a=(t=ti()).queue,i=a.dispatch;return n!==t.memoizedState&&(sk.flags|=2048,tN(9,{destroy:void 0},tL.bind(null,a,n),null)),[r,i,e]}function tL(e,t){e.action=t}function tD(e){var t=ti(),n=sz;if(null!==n)return tU(t,n,e);ti(),t=t.memoizedState;var r=(n=ti()).queue.dispatch;return n.memoizedState=e,[t,r,!1]}function tN(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},null===(t=sk.updateQueue)&&(t=to(),sk.updateQueue=t),null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function tI(){return ti().memoizedState}function tF(e,t,n,r){var a=ta();sk.flags|=e,a.memoizedState=tN(1|t,{destroy:void 0},n,void 0===r?null:r)}function tB(e,t,n,r){var a=ti();r=void 0===r?null:r;var i=a.memoizedState.inst;null!==sz&&null!==r&&e6(r,sz.memoizedState.deps)?a.memoizedState=tN(t,i,n,r):(sk.flags|=e,a.memoizedState=tN(1|t,i,n,r))}function tO(e,t){tF(8390656,8,e,t)}function tG(e,t){tB(2048,8,e,t)}function tk(e){var t=ti().memoizedState;return function(e){sk.flags|=4;var t=sk.updateQueue;if(null===t)t=to(),sk.updateQueue=t,t.events=[e];else{var n=t.events;null===n?t.events=[e]:n.push(e)}}({ref:t,nextImpl:e}),function(){if((2&uE)!=0)throw Error(r(440));return t.impl.apply(void 0,arguments)}}function tz(e,t){return tB(4,2,e,t)}function tH(e,t){return tB(4,4,e,t)}function tV(e,t){if("function"==typeof t){var n=t(e=e());return function(){"function"==typeof n?n():t(null)}}if(null!=t)return t.current=e=e(),function(){t.current=null}}function tW(e,t,n){n=null!=n?n.concat([e]):null,tB(4,4,tV.bind(null,t,e),n)}function tj(){}function tX(e,t){var n=ti();t=void 0===t?null:t;var r=n.memoizedState;return null!==t&&e6(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function tq(e,t){var n=ti();t=void 0===t?null:t;var r=n.memoizedState;if(null!==t&&e6(t,r[1]))return r[0];if(r=e(),sj){R(!0);try{e()}finally{R(!1)}}return n.memoizedState=[r,t],r}function tK(e,t,n){return void 0===n||(0x40000000&sG)!=0&&(261930&uM)==0?e.memoizedState=t:(e.memoizedState=n,e=rq(),sk.lanes|=e,uL|=e,n)}function tY(e,t,n,r){return lk(n,t)?n:null!==sN.current?(lk(e=tK(e,n,r),t)||(s2=!0),e):(106&sG)==0||(0x40000000&sG)!=0&&(261930&uM)==0?(s2=!0,e.memoizedState=n):(e=rq(),sk.lanes|=e,uL|=e,t)}function t$(e,t,n,r,a){var i=ib();iE(0!==i&&8>i?i:8);var o=a6.T,l={};l.types=null!==o?o.types:null,a6.T=l,t5(e,!1,t,n);try{var s=a(),u=a6.S;if(null!==u&&u(l,s),null!==s&&"object"==typeof s&&"function"==typeof s.then){var c,d,f=(c=[],d={status:"pending",value:null,reason:null,then:function(e){c.push(e)}},s.then(function(){d.status="fulfilled",d.value=r;
vendor: 4,442 bytes, line 389
389for(var e=0;e<c.length;e++)(0,c[e])(r)},function(e){for(d.status="rejected",d.reason=e,e=0;e<c.length;e++)(0,c[e])(void 0)}),d);t4(e,t,f,rX())}else t4(e,t,r,rX())}catch(n){t4(e,t,{then:function(){},status:"rejected",reason:n},rX())}finally{iE(i),null!==o&&null!==l.types&&(o.types=l.types),a6.T=o}}function tQ(e){var t=e.memoizedState;if(null!==t)return t;var n={};return(t={memoizedState:iN,baseState:iN,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tc,lastRenderedState:iN},next:null}).next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tc,lastRenderedState:n},next:null},e.memoizedState=t,null!==(e=e.alternate)&&(e.memoizedState=t),t}function tZ(){return er(iI)}function tJ(){return ti().memoizedState}function t0(){return ti().memoizedState}function t1(e){for(var t=e.return;null!==t;){switch(t.tag){case 24:case 3:var n=rX(),r=ez(t,e=ek(n),n);null!==r&&(rY(r,t,n),eH(r,t,n)),t={cache:eo()},e.payload=t;return}t=t.return}}function t2(e,t,n){var r=rX();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},t6(e)?t8(t,n):null!==(n=eN(e,t,n,r))&&(rY(n,e,r),t9(n,t,r))}function t3(e,t,n){t4(e,t,n,rX())}function t4(e,t,n,r){var a={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(t6(e))t8(t,a);else{var i=e.alternate;if(0===e.lanes&&(null===i||0===i.lanes)&&null!==(i=t.lastRenderedReducer))try{var o=t.lastRenderedState,l=i(o,n);if(a.hasEagerState=!0,a.eagerState=l,lk(l,o))return eD(e,t,a,0),null===ub&&eL(),!1}catch{}finally{}if(null!==(n=eN(e,t,a,r)))return rY(n,e,r),t9(n,t,r),!0}return!1}function t5(e,t,n,a){if(a={lane:2,revertLane:ev(),gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},t6(e)){if(t)throw Error(r(479))}else null!==(t=eN(e,n,a,2))&&rY(t,e,2)}function t6(e){var t=e.alternate;return e===sk||null!==t&&t===sk}function t8(e,t){sW=sV=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function t9(e,t,n){if((4194048&n)!=0){var r=t.lanes;r&=e.pendingLanes,t.lanes=n|=r,b(e,n)}}function t7(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:aB({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}function nt(e,t,n,r,a,i,o){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,i,o):!t.prototype||!t.prototype.isPureReactComponent||!eb(n,r)||!eb(a,i)}function nn(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&s0.enqueueReplaceState(t,t.state,null)}function nr(e,t){var n=t;if("ref"in t)for(var r in n={},t)"ref"!==r&&(n[r]=t[r]);if(e=e.defaultProps)for(var a in n===t&&(n=aB({},n)),e)void 0===n[a]&&(n[a]=e[a]);return n}function na(e,t){try{(0,e.onUncaughtError)(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function ni(e,t,n){try{(0,e.onCaughtError)(n.value,{componentStack:n.stack,errorBoundary:1===t.tag?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function no(e,t,n){return(n=ek(n)).tag=3,n.payload={element:null},n.callback=function(){na(e,t)},n}function nl(e){return(e=ek(e)).tag=3,e}function ns(e,t,n,r){var a=n.type.getDerivedStateFromError;if("function"==typeof a){var i=r.value;e.payload=function(){return a(i)},e.callback=function(){ni(t,n,r)}}var o=n.stateNode;null!==o&&"function"==typeof o.componentDidCatch&&(e.callback=function(){ni(t,n,r),"function"!=typeof a&&(null===uW?uW=new Set([this]):uW.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:null!==e?e:""})})}function nu(e,t,n,r){t.child=null===e?sA(t,null,n,r):sC(t,e.child,n,r)}function nc(e,t,n,r,a){n=n.render;var i=t.ref;if("ref"in r){var o={};for(var l in r)"ref"!==l&&(o[l]=r[l])}else o=r;return en(t),r=e8(e,t,n,o,i,a),l=tt(),null===e||s2?(l6&&l&&F(t),t.flags|=1,nu(e,t,r,a),t.child):(tn(e,t,a),nI(e,t,a))}function nd(e,t,n,r,a){if(null===e){var i=n.type;return"function"!=typeof i||ax(i)||void 0!==i.defaultProps||null!==n.compare?((e=aT(n.type,null,r,t,t.mode,a)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=i,nf(e,t,i,r,a))}if(i=e.child,!nF(e,a)){var o=i.memoizedProps;if((n=null!==(n=n.compare)?n:eb)(o,r)&&e.ref===t.ref)return nI(e,t,a)}return t.flags|=1,(e=aE(i,r)).ref=t.ref,e.return=t,t.child=e}function nf(e,t,n,r,a){if(null!==e){var i=e.memoizedProps;
389if(eb(i,r)&&e.ref===t.ref)if(s2=!1,t.pendingProps=r=i,!nF(e,a))return t.lanes=e.lanes,nI(e,t,a);else(131072&e.flags)!=0&&(s2=!0)}return nS(e,t,n,r,a)}function np(e,t,n,r){var a=r.children,i=null!==e?e.memoizedState:null;if(null===e&&null===t.stateNode&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),"hidden"===r.mode){if((128&t.flags)!=0){if(i=null!==i?i.baseLanes|n:n,null!==e){for(r=t.child=e.child,a=0;null!==r;)a=a|r.lanes|r.childLanes,r=r.sibling;r=a&~i}else r=0,t.child=null;return nh(e,t,i,n,r)}if((0x20000000&n)==0)return r=t.lanes=0x20000000,nh(e,t,null!==i?i.baseLanes|n:n,n,r);t.memoizedState={baseLanes:0,cachePool:null},null!==e&&ex(t,null!==i?i.cachePool:null),null!==i?eK(t,i):eY(),eJ(t)}else null!==i?(ex(t,i.cachePool),eK(t,i),e0(),t.memoizedState=null):(null!==e&&ex(t,null),eY(),e0());return nu(e,t,a,n),t.child}function nm(e,t){return null!==e&&22===e.tag||null!==t.stateNode||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function nh(e,t,n,r,a){var i=eS();return t.memoizedState={baseLanes:n,cachePool:i=null===i?null:{parent:ih?so._currentValue:so._currentValue2,pool:i}},null!==e&&ex(t,null),eY(),eJ(t),null!==e&&ee(e,t,r,!0),t.childLanes=a,null}function ng(e,t){return(t=nC({mode:t.mode,children:t.children},e.mode)).ref=e.ref,e.child=t,t.return=e,t}function nv(e,t,n){return sC(t,e.child,null,n),e=ng(t,t.pendingProps),e.flags|=2,e1(t),t.memoizedState=null,e}function n_(e,t){var n=t.ref;if(null===n)null!==e&&null!==e.ref&&(t.flags|=4194816);else{if("function"!=typeof n&&"object"!=typeof n)throw Error(r(284));(null===e||e.ref!==n)&&(t.flags|=4194816)}}function nS(e,t,n,r,a){return en(t),n=e8(e,t,n,r,void 0,a),r=tt(),null===e||s2?(l6&&r&&F(t),t.flags|=1,nu(e,t,n,a),t.child):(tn(e,t,a),nI(e,t,a))}function nx(e,t,n,r,a,i){return en(t),t.updateQueue=null,n=e7(t,r,n,a),e9(e),r=tt(),null===e||s2?(l6&&r&&F(t),t.flags|=1,nu(e,t,n,i),t.child):(tn(e,t,i),nI(e,t,i))}function nE(e,t,n,r,a){if(en(t),null===t.stateNode){var i=lS,o=n.contextType;"object"==typeof o&&null!==o&&(i=er(o)),t.memoizedState=null!==(i=new n(r,i)).state&&void 0!==i.state?i.state:null,i.updater=s0,t.stateNode=i,i._reactInternals=t,(i=t.stateNode).props=r,i.state=t.memoizedState,i.refs={},eO(t),o=n.contextType,i.context="object"==typeof o&&null!==o?er(o):lS,i.state=t.memoizedState,"function"==typeof(o=n.getDerivedStateFromProps)&&(t7(t,n,o,r),i.state=t.memoizedState),"function"==typeof n.getDerivedStateFromProps||"function"==typeof i.getSnapshotBeforeUpdate||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||(o=i.state,"function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),o!==i.state&&s0.enqueueReplaceState(i,i.state,null),ej(t,r,i,a),eW(),i.state=t.memoizedState),"function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!0}else if(null===e){i=t.stateNode;var l=t.memoizedProps,s=nr(n,l);i.props=s;var u=i.context,c=n.contextType;o=lS,"object"==typeof c&&null!==c&&(o=er(c));var d=n.getDerivedStateFromProps;c="function"==typeof d||"function"==typeof i.getSnapshotBeforeUpdate,l=t.pendingProps!==l,c||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(l||u!==o)&&nn(t,i,r,o),sL=!1;var f=t.memoizedState;i.state=f,ej(t,r,i,a),eW(),u=t.memoizedState,l||f!==u||sL?("function"==typeof d&&(t7(t,n,d,r),u=t.memoizedState),(s=sL||nt(t,n,s,r,f,u,o))?(c||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||("function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount()),"function"==typeof i.componentDidMount&&(t.flags|=4194308)):("function"==typeof i.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=u),i.props=r,i.state=u,i.context=o,r=s):("function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,eG(e,t),c=nr(n,o=t.memoizedProps),i.props=c,d=t.pendingProps,f=i.context,u=n.contextType,s=lS,"object"==typeof u&&null!==u&&(s=er(u)),(u="function"==typeof(l=n.getDerivedStateFromProps)||"function"==typeof i.getSnapshotBeforeUpdate)||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(o!==d||f!==s)&&nn(t,i,r,s),sL=!1,f=t.memoizedState,i.state=f,ej(t,r,i,a),eW();var p=t.memoizedState;
389o!==d||f!==p||sL||null!==e&&null!==e.dependencies&&et(e.dependencies)?("function"==typeof l&&(t7(t,n,l,r),p=t.memoizedState),(c=sL||nt(t,n,c,r,f,p,s)||null!==e&&null!==e.dependencies&&et(e.dependencies))?(u||"function"!=typeof i.UNSAFE_componentWillUpdate&&"function"!=typeof i.componentWillUpdate||("function"==typeof i.componentWillUpdate&&i.componentWillUpdate(r,p,s),"function"==typeof i.UNSAFE_componentWillUpdate&&i.UNSAFE_componentWillUpdate(r,p,s)),"function"==typeof i.componentDidUpdate&&(t.flags|=4),"function"==typeof i.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof i.componentDidUpdate||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),i.props=r,i.state=p,i.context=s,r=c):("function"!=typeof i.componentDidUpdate||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return i=r,n_(e,t),r=(128&t.flags)!=0,i||r?(i=t.stateNode,n=r&&"function"!=typeof n.getDerivedStateFromError?null:i.render(),t.flags|=1,null!==e&&r?(t.child=sC(t,e.child,null,a),t.child=sC(t,null,n,a)):nu(e,t,n,a),t.memoizedState=i.state,e=t.child):e=nI(e,t,a),e}function nb(e,t,n,r){return q(),t.flags|=256,nu(e,t,n,r),t.child}function nT(e){return{baseLanes:e,cachePool:eE()}}function nM(e,t,n){return e=null!==e?e.childLanes&~n:0,t&&(e|=uI),e}function ny(e,t,n){var a,i=t.pendingProps,o=!1,l=(128&t.flags)!=0;if((a=l)||(a=(null===e||null!==e.memoizedState)&&(2&sO.current)!=0),a&&(o=!0,t.flags&=-129),a=(32&t.flags)!=0,t.flags&=-33,null===e){if(l6){if(o?eQ(t):e0(),(e=l5)?null!==(e=oG(e,l9))&&(t.memoizedState={dehydrated:e,treeContext:null!==lQ?{id:lZ,overflow:lJ}:null,retryLane:0x20000000,hydrationErrors:null},(n=aR(e)).return=t,t.child=n,l4=t,l5=null):e=null,null===e)throw V(t);return oM(e)?t.lanes=32:t.lanes=0x20000000,null}return l=i.children,i=i.fallback,o?(e0(),l=nC({mode:"hidden",children:l},o=t.mode),i=aM(i,o,n,null),l.return=t,i.return=t,l.sibling=i,t.child=l,(i=t.child).memoizedState=nT(n),i.childLanes=nM(e,a,n),t.memoizedState=s3,nm(null,i)):(eQ(t),nR(t,l))}var s=e.memoizedState;if(null!==s){var u=s.dehydrated;if(null!==u){var c=e,d=t,f=l,p=a,m=i,h=u,g=s,v=n;if(f)return 256&d.flags?(eQ(d),d.flags&=-257,nA(c,d,v)):null!==d.memoizedState?(e0(),d.child=c.child,d.flags|=128,null):(e0(),h=m.fallback,g=d.mode,m=nC({mode:"visible",children:m.children},g),h=aM(h,g,v,null),h.flags|=2,m.return=d,h.return=d,m.sibling=h,d.child=m,sC(d,c.child,null,v),(m=d.child).memoizedState=nT(v),m.childLanes=nM(c,p,v),d.memoizedState=s3,nm(null,m));if(eQ(d),oM(h))return""!==(p=oy(h).digest)&&((m=Error(r(419))).stack="",m.digest=p,Y({value:m,source:null,stack:null})),nA(c,d,v);if(s2||ee(c,d,v,!1),p=(v&c.childLanes)!=0,s2||p){if(null!==sN.current)return nA(c,d,v);if(null!==(p=ub)&&0!==(m=T(p,v))&&m!==g.retryLane)throw g.retryLane=m,eI(c,m),rY(p,c,m),s1;return oT(h)||r6(),nA(c,d,v)}return oT(h)?(d.flags|=192,d.child=c.child,null):(c=g.treeContext,i_&&(l5=oN(h),l4=d,l6=!0,l8=null,l9=!1,null!==c&&O(d,c)),d=nR(d,m.children),d.flags|=0x8001000,d)}}return o?(e0(),o=i.fallback,l=t.mode,u=(s=e.child).sibling,(i=aE(s,{mode:"hidden",children:i.children})).subtreeFlags=0x47f00000&s.subtreeFlags,null!==u?o=aE(u,o):(o=aM(o,l,n,null),o.flags|=2),o.return=t,i.return=t,i.sibling=o,t.child=i,nm(null,i),i=t.child,null===(o=e.child.memoizedState)?o=nT(n):(null!==(l=o.cachePool)?(s=ih?so._currentValue:so._currentValue2,l=l.parent!==s?{parent:s,pool:s}:l):l=eE(),o={baseLanes:o.baseLanes|n,cachePool:l}),i.memoizedState=o,i.childLanes=nM(e,a,n),t.memoizedState=s3,nm(e.child,i)):(eQ(t),e=(n=e.child).sibling,(n=aE(n,{mode:"visible",children:i.children})).return=t,n.sibling=null,null!==e&&(null===(a=t.deletions)?(t.deletions=[e],t.flags|=16):a.push(e)),t.child=n,t.memoizedState=null,n)}function nR(e,t){return(t=nC({mode:"visible",children:t},e.mode)).return=e,e.child=t}function nC(e,n){return(e=t(22,e,null,n)).lanes=0,e}function nA(e,t,n){return sC(t,e.child,null,n),e=nR(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function nw(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),Z(e.return,t,n)}function nP(e){for(var t=null;null!==e;){var n=e.alternate;null!==n&&null===e4(n)&&(t=e),e=e.sibling}return t}function nU(e,t,n,r,a,i){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:a,treeForkCount:i}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=a,o.treeForkCount=i)}function nL(e){var t=e.child;for(e.child=null;null!==t;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function nD(e,t,n){var r=t.pendingProps,a=r.revealOrder,i=r.tail;r=r.children;var o=sO.current;if(128&t.flags)return e2(t,o),null;var l=(2&o)!=0;if(l?(o=1&o|2,t.flags|=128):o&=1,e2(t,o),"backwards"===a&&null!==e?(nL(e),nu(e,t,r,n),nL(e)):nu(e,t,r,n),r=l6?lK:0,!l&&null!==e&&(128&e.flags)!=0)n:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&nw(e,n,t);else if(19===e.tag)nw(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break;for(;null===e.sibling;){if(null===e.return||e.return===t)break n;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(a){case"backwards":null===(n=nP(t.child))?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null,nL(t)),nU(t,!0,a,null,i,r);break;case"unstable_legacy-backwards":for(n=null,a=t.child,t.child=null;null!==a;){if(null!==(e=a.alternate)&&null===e4(e)){t.child=a;break}e=a.sibling,a.sibling=n,n=a,a=e}nU(t,!0,n,null,i,r);break;case"together":nU(t,!1,null,null,void 0,r);break;case"independent":t.memoizedState=null;break;default:null===(n=nP(t.child))?(a=t.child,t.child=null):(a=n.sibling,n.sibling=null),nU(t,!1,a,n,i,r)}return t.child}function nN(e,t,n){var r=t.pendingProps;return $(t,t.type,r.value),nu(e,t,r.children,n),t.child}function nI(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),uL|=t.lanes,(n&t.childLanes)==0){if(null===e)return null;else if(ee(e,t,n,!1),(n&t.childLanes)==0)return null}if(null!==e&&t.child!==e.child)throw Error(r(153));if(null!==t.child){for(n=aE(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=aE(e,e.pendingProps)).return=t;n.sibling=null}return t.child}
389function nF(e,t){return(e.lanes&t)!=0||!!(null!==(e=e.dependencies)&&et(e))}function nB(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps)s2=!0;else{if(!nF(e,n)&&(128&t.flags)==0)return s2=!1,function(e,t,n){switch(t.tag){case 3:G(t,t.stateNode.containerInfo),$(t,so,e.memoizedState.cache),q();break;case 27:case 5:z(t);break;case 4:G(t,t.stateNode.containerInfo);break;case 10:$(t,t.type,t.memoizedProps.value);break;case 31:if(null!==t.memoizedState)return t.flags|=128,eZ(t),null;break;case 13:var r=t.memoizedState;if(null!==r){if(null!==r.dehydrated)return eQ(t),t.flags|=128,null;r=ee(e,t,n,!1);var a=t.child.childLanes;return r||(n&a)!=0?ny(e,t,n):(eQ(t),null!==(e=nI(e,t,n))?e.sibling:null)}eQ(t);break;case 19:if(128&t.flags)return nD(e,t,n);if(a=(128&e.flags)!=0,(r=(n&t.childLanes)!=0)||(ee(e,t,n,!1),r=(n&t.childLanes)!=0),a){if(r)return nD(e,t,n);t.flags|=128}if(null!==(a=t.memoizedState)&&(a.rendering=null,a.tail=null,a.lastEffect=null),e2(t,sO.current),r)break;return null;case 22:return t.lanes=0,np(e,t,n,t.pendingProps);case 24:$(t,so,e.memoizedState.cache)}return nI(e,t,n)}(e,t,n);s2=(131072&e.flags)!=0}else s2=!1,l6&&(1048576&t.flags)!=0&&I(t,lK,t.index);switch(t.lanes=0,t.tag){case 16:n:{var a=t.pendingProps;if(e=ey(t.elementType),t.type=e,"function"==typeof e)ax(e)?(a=nr(e,a),t.tag=1,t=nE(null,t,e,a,n)):(t.tag=0,t=nS(null,t,e,a,n));else{if(null!=e){var i=e.$$typeof;if(i===aX){t.tag=11,t=nc(null,t,e,a,n);break n}if(i===aY){t.tag=14,t=nd(null,t,e,a,n);break n}if(i===aj){t.tag=10,t.type=e,t=nN(null,t,n);break n}}throw Error(r(306,t=s(e)||e,""))}}return t;case 0:return nS(e,t,t.type,t.pendingProps,n);case 1:return i=nr(a=t.type,t.pendingProps),nE(e,t,a,i,n);case 3:n:{if(G(t,t.stateNode.containerInfo),null===e)throw Error(r(387));var o=t.pendingProps;a=(i=t.memoizedState).element,eG(e,t),ej(t,o,null,n);var l=t.memoizedState;if($(t,so,o=l.cache),o!==i.cache&&J(t,[so],n,!0),eW(),o=l.element,i_&&i.isDehydrated)if(i={element:o,isDehydrated:!1,cache:l.cache},t.updateQueue.baseState=i,t.memoizedState=i,256&t.flags){t=nb(e,t,o,n);break n}else if(o!==a){Y(a=D(Error(r(424)),t)),t=nb(e,t,o,n);break n}else for(i_&&(l5=oL(t.stateNode.containerInfo),l4=t,l6=!0,l8=null,l9=!0),n=sA(t,null,o,n),t.child=n;n;)n.flags=-3&n.flags|0x8001000,n=n.sibling;else{if(q(),o===a){t=nI(e,t,n);break n}nu(e,t,o,n)}t=t.child}return t;case 26:if(o8)return n_(e,t),null===e?(n=le(t.type,null,t.pendingProps,null))?t.memoizedState=n:l6||(t.stateNode=lo(t.type,t.pendingProps,l2.current,t)):t.memoizedState=le(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:if(ld)return z(t),null===e&&ld&&l6&&(a=t.stateNode=lf(t.type,t.pendingProps,l2.current,l0.current,!1),l4=t,l9=!0,l5=oI(t.type,a,l5)),nu(e,t,t.pendingProps.children,n),n_(e,t),null===e&&(t.flags|=4194304),t.child;case 5:return null===e&&l6&&(o5(t.type,t.pendingProps,l0.current),(i=a=l5)&&(null!==(a=oF(a,t.type,t.pendingProps,l9))?(t.
389stateNode=a,l4=t,l5=oU(a),l9=!1,i=!0):i=!1),i||V(t)),z(t),i=t.type,o=t.pendingProps,l=null!==e?e.memoizedProps:null,a=o.children,iu(i,o)?a=null:null!==l&&iu(i,l)&&(t.flags|=32),null!==t.memoizedState&&(i=e8(e,t,te,null,null,n),ih?iI._currentValue=i:iI._currentValue2=i),n_(e,t),nu(e,t,a,n),t.child;case 6:return null===e&&l6&&(o6(t.pendingProps,l0.current),(e=n=l5)&&(null!==(n=oB(n,t.pendingProps,l9))?(t.stateNode=n,l4=t,l5=null,e=!0):e=!1),e||V(t)),null;case 13:return ny(e,t,n);case 4:return G(t,t.stateNode.containerInfo),a=t.pendingProps,null===e?t.child=sC(t,null,a,n):nu(e,t,a,n),t.child;case 11:return nc(e,t,t.type,t.pendingProps,n);case 7:return a=t.pendingProps,n_(e,t),nu(e,t,a,n),t.child;case 8:case 12:return nu(e,t,t.pendingProps.children,n),t.child;case 10:return nN(e,t,n);case 9:return i=t.type._context,a=t.pendingProps.children,en(t),a=a(i=er(i)),t.flags|=1,nu(e,t,a,n),t.child;case 14:return nd(e,t,t.type,t.pendingProps,n);case 15:return nf(e,t,t.type,t.pendingProps,n);case 19:return nD(e,t,n);case 31:var u=e,c=t,d=n,f=c.pendingProps,p=(128&c.flags)!=0;if(c.flags&=-129,null===u){if(l6){if("hidden"===f.mode)return u=ng(c,f),c.lanes=0x20000000,u.memoizedState={baseLanes:0,cachePool:null},nm(null,u);if(eZ(c),(u=l5)?null!==(u=oO(u,l9))&&(c.memoizedState={dehydrated:u,treeContext:null!==lQ?{id:lZ,overflow:lJ}:null,retryLane:0x20000000,hydrationErrors:null},(d=aR(u)).return=c,c.child=d,l4=c,l5=null):u=null,null===u)throw V(c);return c.lanes=0x20000000,null}return ng(c,f)}var m=u.memoizedState;if(null!==m){var h=m.dehydrated;if(eZ(c),p)if(256&c.flags)c.flags&=-257,c=nv(u,c,d);else if(null!==c.memoizedState)c.child=u.child,c.flags|=128,c=null;else throw Error(r(558));else if(s2||ee(u,c,d,!1),p=(d&u.childLanes)!=0,s2||p){if(null===sN.current){if(null!==(f=ub)&&0!==(h=T(f,d))&&h!==m.retryLane)throw m.retryLane=h,eI(u,h),rY(f,u,h),s1;r6()}c=nv(u,c,d)}else u=m.treeContext,i_&&(l5=oD(h),l4=c,l6=!0,l8=null,l9=!1,null!==u&&O(c,u)),c=ng(c,f),c.flags|=0x8001000;return c}return(u=aE(u.child,{mode:f.mode,children:f.children})).ref=c.ref,c.child=u,u.return=c,u;case 22:return np(e,t,n,t.pendingProps);case 24:return en(t),a=er(so),null===e?(null===(i=eS())&&(i=ub,o=eo(),i.pooledCache=o,o.refCount++,null!==o&&(i.pooledCacheLanes|=n),i=o),t.memoizedState={parent:a,cache:i},eO(t),$(t,so,i)):((e.lanes&n)!=0&&(eG(e,t),ej(t,null,null,n),eW()),i=e.memoizedState,o=t.memoizedState,i.parent!==a?(i={parent:a,cache:a},t.memoizedState=i,0===t.lanes&&(t.memoizedState=t.updateQueue.baseState=i),$(t,so,a)):($(t,so,a=o.cache),a!==i.cache&&J(t,[so],n,!0))),nu(e,t,t.pendingProps.children,n),t.child;case 30:return null===t.stateNode&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),null!=(a=t.pendingProps).name&&"auto"!==a.name?t.flags|=null===e?0x1202000:0x1200000:l6&&F(t),null!==e&&e.memoizedProps.name!==a.name?t.flags|=4194816:n_(e,t),nu(e,t,a.children,n),t.child;case 29:throw t.pendingProps}throw Error(r(156,t.tag))}function nO(e){e.flags|=4}function nG(e){iv&&(e.flags|=8)}function nk(e,t){if(null!==e&&e.child===t.child)return!1;if((16&t.flags)!=0)return!0;for(e=t.child;null!==e;){if((8218&e.flags)!=0||(8218&e.subtreeFlags)!=0)return!0;e=e.sibling}return!1}function nz(e,t,n,r){if(ig)for(n=t.child;null!==n;){if(5===n.tag||6===n.tag)il(e,n.stateNode);else if(!(4===n.tag||ld&&27===n.tag)&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}else if(iv)for(var a=t.child;null!==a;){if(5===a.tag){var i=a.stateNode;n&&r&&(i=oE(i,a.type,a.memoizedProps)),il(e,i)}else if(6===a.tag)i=a.stateNode,n&&r&&(i=ob(i,a.memoizedProps)),il(e,i);else if(4!==a.tag){if(22===a.tag&&null!==a.memoizedState)null!==(i=a.child)&&(i.return=a),nz(e,a,!0,!0);else if(null!==a.child){a.child.return=a,a=a.child;continue}}if(a===t)break;for(;null===a.sibling;){if(null===a.return||a.return===t)return;a=a.return}a.sibling.return=a.return,a=a.sibling}}function nH(e,t){if(iv&&nk(e,t)){var n=(e=t.stateNode).containerInfo,r=ov();(function e(t,n,r,a){var i=!1;if(iv)for(var o=n.child;null!==o;){if(5===o.tag){var l=o.stateNode;r&&a&&(l=oE(l,o.type,o.memoizedProps)),o_(t,l)}else if(6===o.tag)l=o.stateNode,r&&a&&(l=ob(l,o.memoizedProps)),o_(t,l);else if(4!==o.tag){if(22===o.tag&&null!==o.memoizedState)null!==(i=o.child)&&(i.return=o),e(t,o,!0,!0),i=!0;else if(null!==o.child){o.child.return=o,o=o.child;continue}}if(o===n)break;for(;null===o.sibling;){if(null===o.return||o.return===n)return i;o=o.return}o.sibling.return=o.return,o=o.sibling}return i})(r,t,!1,!1),e.pendingChildren=r,nO(t),oS(n,r)}}function nV(e,t,n,r){if(ig)e.memoizedProps!==r&&nO(t);else if(iv){var a=e.stateNode,i=e.memoizedProps;if((e=nk(e,t))||i!==r){var o=l0.current;(i=og(a,n,i,r,!e,null))===a?t.stateNode=a:(nG(t),is(i,n,r,o)&&nO(t),t.stateNode=i,e&&nz(i,t,!1,!1))}else t.stateNode=a}}function nW(e,t,n,r,a){if((32&e.mode)!=0&&(null===n?iR(t,r):iC(t,n,r))){if(e.flags|=0x1000000,(0x13ffff40&a)===a||iA(t,r))if(iw(e.stateNode,t,r))e.flags|=8192;else if(r3())e.flags|=8192;else throw sM=sT,sE}else e.flags&=-0x1000001}function nj(e,t){if(ls(t)){if(e.flags|=0x1000000,!lu(t))if(r3())e.flags|=8192;else throw sM=sT,sE}else e.flags&=-0x1000001}function nX(e,t){null!==t&&(e.flags|=4),16384&e.flags&&(t=22!==e.tag?g():0x20000000,e.lanes|=t,uF|=t)}function nq(e,t){if(!l6)switch(e.tailMode){case"visible":break;case"collapsed":for(var n=e.tail,r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null}}function nK(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=0x47f00000&a.subtreeFlags,r|=0x47f00000&a.flags,a.return=e,a=a.sibling;else for(a=e.child;null!==a;)n|=a.lanes|a.childLanes,r|=a.subtreeFlags,r|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function nY(e,t){switch(B(t),t.tag){case 3:Q(so),k();break;case 26:case 27:case 5:H(t);break;case 4:k();break;case 31:null!==t.memoizedState&&e1(t);break;case 13:e1(t);break;case 19:e3(t);break;case 10:Q(t.type);break;case 22:case 23:e1(t),e$(),null!==e&&c(sS);break;case 24:Q(so)}}function n$(e,t){try{var n=t.updateQueue,r=null!==n?n.lastEffect:null;
389if(null!==r){var a=r.next;n=a;do{if((n.tag&e)===e){r=void 0;var i=n.create;n.inst.destroy=r=i()}n=n.next}while(n!==a)}}catch(e){ap(t,t.return,e)}}function nQ(e,t,n){try{var r=t.updateQueue,a=null!==r?r.lastEffect:null;if(null!==a){var i=a.next;r=i;do{if((r.tag&e)===e){var o=r.inst,l=o.destroy;if(void 0!==l){o.destroy=void 0,a=t;try{l()}catch(e){ap(a,n,e)}}}r=r.next}while(r!==i)}}catch(e){ap(t,t.return,e)}}function nZ(e){var t=e.updateQueue;if(null!==t){var n=e.stateNode;try{eq(t,n)}catch(t){ap(e,e.return,t)}}}function nJ(e,t,n){n.props=nr(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){ap(e,t,n)}}function n0(e,t){try{var n=e.ref;if(null!==n){switch(e.tag){case 26:case 27:case 5:var r=ie(e.stateNode);break;case 30:var a=e.stateNode,i=C(e.memoizedProps,a);(null===a.ref||a.ref.name!==i)&&(a.ref=oc(i)),r=a.ref;break;case 7:null===e.stateNode&&(e.stateNode=of(e)),r=e.stateNode;break;default:r=e.stateNode}"function"==typeof n?e.refCleanup=n(r):n.current=r}}catch(n){ap(e,t,n)}}function n1(e,t){var n=e.ref,r=e.refCleanup;if(null!==n)if("function"==typeof r)try{r()}catch(n){ap(e,t,n)}finally{e.refCleanup=null,null!=(e=e.alternate)&&(e.refCleanup=null)}else if("function"==typeof n)try{n(null)}catch(n){ap(e,t,n)}else n.current=null}function n2(){var e=s4;return s4=!1,e}function n3(e,t){if((5===e.tag||27===e.tag||6===e.tag)&&null===e.alternate&&null!==t)for(var n=0;n<t.length;n++)om(e.stateNode,t[n])}function n4(e){for(var t=e.return;null!==t&&(n8(t)&&om(e.stateNode,t.stateNode),!n6(t));)t=t.return}function n5(e){for(var t=e.return;null!==t&&(n8(t)&&oh(e.stateNode,t.stateNode),!n6(t));)t=t.return}function n6(e){return 5===e.tag||3===e.tag||!!ld&&27===e.tag}function n8(e){return e&&7===e.tag&&null!==e.stateNode}function n9(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{i$(r,t,n,e)}catch(t){ap(e,e.return,t)}}
389function n7(e,t,n){try{iQ(e.stateNode,e.type,n,t,e)}catch(t){ap(e,e.return,t)}}function re(e){return 5===e.tag||3===e.tag||!!o8&&26===e.tag||!!ld&&27===e.tag&&lg(e.type)||4===e.tag}function rt(e){n:for(;;){for(;null===e.sibling;){if(null===e.return||re(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(ld&&27===e.tag&&lg(e.type)||2&e.flags||null===e.child||4===e.tag)continue n;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function rn(e,t,n,r){var a=e.tag;if(5===a||6===a)a=e.stateNode,t?iZ(n,a,t):iq(n,a),n3(e,r),s4=!0;else if(4!==a&&(ld&&27===a&&(n3(e,r),r=null,lg(e.type)&&(n=e.stateNode)),null!==(e=e.child)))for(rn(e,t,n,r),e=e.sibling;null!==e;)rn(e,t,n,r),e=e.sibling}function rr(e,t,n){e=e.containerInfo;try{ox(e,n)}catch(e){ap(t,t.return,e)}}function ra(e){var t=e.stateNode,n=e.memoizedProps;try{lp(e.type,n,t,e)}catch(t){ap(e,e.return,t)}}function ri(e){(30===e.tag||(0x2000000&e.subtreeFlags)!=0)&&(s5=!0)}function ro(){var e=s8;return s8=null,e}function rl(e,t,n,r,a){return s9=0,function e(t,n,r,a,i){if(!ig)return!1;for(var o=!1;null!==t;){if(5===t.tag){var l=t.stateNode;if(null!==a){var s=on(l);a.push(s),oa(s)&&(o=!0)}else o||oa(on(l))&&(o=!0);s5=!0,i8(l,0===s9?n:n+"_"+s9,r),s9++}else(22!==t.tag||null===t.memoizedState)&&(30===t.tag&&i||e(t.child,n,r,a,i)&&(o=!0));t=t.sibling}return o}(e.child,t,n,r,a)}function rs(e,t){if(ig)for(;null!==e;)5===e.tag?i9(e.stateNode,e.memoizedProps):(22!==e.tag||null===e.memoizedState)&&(30===e.tag&&t||rs(e.child,t)),e=e.sibling}function ru(e){if((0x1200000&e.subtreeFlags)!=0)for(e=e.child;null!==e;){if((22!==e.tag||null===e.memoizedState)&&(ru(e),30===e.tag&&(0x1200000&e.flags)!=0&&e.stateNode.paired)){var t=e.memoizedProps;if(null==t.name||"auto"===t.name)throw Error(r(544));var n=t.name;"none"!==(t=w(t.default,t.share))&&(rl(e,n,t,null,!1)||rs(e.child,!1))}e=e.sibling}}function rc(e,t){if(30===e.tag){var n=e.stateNode,r=e.memoizedProps,a=C(r,n),i=w(r.default,n.paired?r.share:r.enter);"none"!==i?rl(e,a,i,null,!1)?(ru(e),n.paired||t||rK(e,r.onEnter)):rs(e.child,!1):ru(e)}else if((0x2000000&e.subtreeFlags)!=0)for(e=e.child;null!==e;)rc(e,t),e=e.sibling;else ru(e)}function rd(e){if(null!==s6&&0!==s6.size){var t=s6;if((0x1200000&e.subtreeFlags)!=0)for(e=e.child;null!==e;){if(22!==e.tag||null===e.memoizedState){if(30===e.tag&&(0x1200000&e.flags)!=0){var n=e.memoizedProps,r=n.name;if(null!=r&&"auto"!==r){var a=t.get(r);if(void 0!==a){var i=w(n.default,n.share);if("none"!==i&&(rl(e,r,i,null,!1)?(a.paired=i=e.stateNode,i.paired=a,rK(e,n.onShare)):rs(e.child,!1)),t.delete(r),0===t.size)break}}}rd(e)}e=e.sibling}}}function rf(e){if(30===e.tag){var t=e.memoizedProps,n=C(t,e.stateNode),r=null!==s6?s6.get(n):void 0,a=w(t.default,void 0!==r?t.share:t.exit);"none"!==a&&(rl(e,n,a,null,!1)?void 0!==r?(r.paired=a=e.stateNode,a.paired=r,s6.delete(n),rK(e,t.onShare)):rK(e,t.onExit):rs(e.child,!1)),null!==s6&&rd(e)}else if((0x2000000&e.subtreeFlags)!=0)for(e=e.child;null!==e;)rf(e),e=e.sibling;else null!==s6&&rd(e)}function rp(e){if((0x1200000&e.subtreeFlags)!=0)for(e=e.child;null!==e;){if(22!==e.tag||null===e.memoizedState){if(30===e.tag&&(0x1200000&e.flags)!=0){var t=e.stateNode;null!==t.paired&&(t.paired=null,rs(e.child,!1))}rp(e)}e=e.sibling}}function rm(e){if(30===e.tag)e.stateNode.paired=null,rs(e.child,!1),rp(e);else if((0x2000000&e.subtreeFlags)!=0)for(e=e.child;null!==e;)rm(e),e=e.sibling;else rp(e)}function rh(e,t,n,r,a,i,o){if(!ig)return!1;for(var l=!1;null!==t;){if(5===t.tag){var s=t.stateNode;if(null!==i&&s9<i.length){var u=i[s9],c=on(s);(oa(u)||oa(c))&&(l=!0),(4&e.flags)==0&&oi(u,c)&&(e.flags|=4),oo(u,c)&&(e.flags|=32)}else e.flags|=32;(4&e.flags)!=0&&i8(s,0===s9?n:n+"_"+s9,a),l&&(4&e.flags)!=0||(null===s8&&(s8=[]),s8.push(s,0===s9?r:r+"_"+s9,t.memoizedProps)),s9++}else(22!==t.tag||null===t.memoizedState)&&(30===t.tag&&o?e.flags|=32&t.flags:rh(e,t.child,n,r,a,i,o)&&(l=!0));t=t.sibling}return l}function rg(e){for(;null!==ua;){var t=ua,n=e,a=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 15:case 5:case 26:case 27:case 6:case 4:case 17:break;case 1:if((1024&i)!=0&&null!==a){n=void 0,i=a.memoizedProps,a=a.memoizedState;var o=t.stateNode;try{var l=nr(t.type,i);n=o.getSnapshotBeforeUpdate(l,a),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){ap(t,t.return,e)}}break;case 3:(1024&i)!=0&&ig&&od(t.stateNode.containerInfo);break;case 30:n&&null!==a&&(n=C(a.memoizedProps,a.stateNode),"none"!==(i=w((i=t.memoizedProps).default,i.update))&&rl(a,n,i,a.memoizedState=[],!0));break;default:if((1024&i)!=0)throw Error(r(163))}if(null!==(a=t.sibling)){a.return=t.return,ua=a;break}ua=t.return}}function rv(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:rw(e,n),4&r&&n$(5,n);break;case 1:if(rw(e,n),4&r)if(e=n.stateNode,null===t)try{e.componentDidMount()}catch(e){ap(n,n.return,e)}else{var a=nr(n.type,t.memoizedProps);t=t.memoizedState;
389try{e.componentDidUpdate(a,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){ap(n,n.return,e)}}64&r&&nZ(n),512&r&&n0(n,n.return);break;case 3:if(rw(e,n),64&r&&null!==(r=n.updateQueue)){if(e=null,null!==n.child)switch(n.child.tag){case 27:case 5:e=ie(n.child.stateNode);break;case 1:e=n.child.stateNode}try{eq(r,e)}catch(e){ap(n,n.return,e)}}break;case 27:ld&&null===t&&4&r&&ra(n);case 26:case 5:if(rw(e,n),null===t){if(4&r)n9(n);else if(64&r){e=n.type,t=n.memoizedProps,a=n.stateNode;try{oX(a,e,t,n)}catch(e){ap(n,n.return,e)}}}512&r&&n0(n,n.return);break;case 12:rw(e,n);break;case 31:rw(e,n),4&r&&rE(e,n);break;case 13:rw(e,n),4&r&&rb(e,n),64&r&&null!==(r=n.memoizedState)&&null!==(r=r.dehydrated)&&oR(r,n=av.bind(null,n));break;case 22:if(!(r=null!==n.memoizedState||s7)){var i=null!==t&&null!==t.memoizedState||ue;t=s7,a=ue,s7=r,(ue=i)&&!a?(r=2*!!ld,(8772&n.subtreeFlags)!=0&&(r|=1),function e(t,n,r){for(r=(8772&n.subtreeFlags)!=0?r:-2&r,n=n.child;null!==n;){var a=n.alternate,i=t,o=n,l=o.flags,s=(1&r)!=0;switch(o.tag){case 0:case 11:case 15:e(i,o,r),n$(4,o);break;case 1:if(e(i,o,r),"function"==typeof(i=(a=o).stateNode).componentDidMount)try{i.componentDidMount()}catch(e){ap(a,a.return,e)}if(null!==(i=(a=o).updateQueue)){var u=a.stateNode;try{var c=i.shared.hiddenCallbacks;if(null!==c)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)eX(c[i],u)}catch(e){ap(a,a.return,e)}}s&&64&l&&nZ(o),n0(o,o.return);break;case 27:ld&&(2&r)!=0&&ra(o);case 5:5!==o.tag&&27!==o.tag||n4(o),e(i,o,r),s&&null===a&&4&l&&n9(o),n0(o,o.return);break;case 6:n4(o);break;case 26:o8&&(u=o.stateNode,null!==o.memoizedState||null===u||s7||la(o7(u.ownerDocument),o.type,u)),e(i,o,r),s&&null===a&&4&l&&n9(o),n0(o,o.return);break;case 12:e(i,o,r);break;case 31:e(i,o,r),s&&4&l&&rE(i,o);break;case 13:e(i,o,r),s&&4&l&&rb(i,o);break;case 22:null===o.memoizedState&&e(i,o,r),n0(o,o.return);break;case 30:e(i,o,r),n0(o,o.return);break;case 7:n0(o,o.return);default:e(i,o,r)}n=n.sibling}}(e,n,r)):rw(e,n),s7=t,ue=a}break;case 30:rw(e,n),512&r&&n0(n,n.return);break;case 7:512&r&&n0(n,n.return);default:rw(e,n)}}function r_(e,t){if(ig)for(e=e.child;null!==e;)(function e(t,n){if(ig)switch(t.tag){case 5:case 26:try{var r=t.stateNode;n?i3(r):i5(t.stateNode,t.memoizedProps)}catch(e){ap(t,t.return,e)}!function t(n,r){if(ig&&0x4000000&n.subtreeFlags)for(n=n.child;null!==n;){var a=n;if(ig)switch(a.tag){case 4:e(a,r);break;case 22:null===a.memoizedState&&t(a,r);break;default:t(a,r)}n=n.sibling}}(t,n);break;case 6:try{var a=t.stateNode;n?i4(a):i6(a,t.memoizedProps),s4=!0}catch(e){ap(t,t.return,e)}break;case 18:try{var i=t.stateNode;n?o0(i):o1(t.stateNode)}catch(e){ap(t,t.return,e)}break;case 22:case 23:null===t.memoizedState&&r_(t,n);break;default:r_(t,n)}})(e,t),e=e.sibling}function rS(e,t,n){for(n=n.child;null!==n;)rx(e,t,n),n=n.sibling}function rx(e,t,n){if(lO&&"function"==typeof lO.onCommitFiberUnmount)try{lO.onCommitFiberUnmount(lB,n)}catch{}switch(n.tag){case 26:if(o8){ue||n1(n,t),rS(e,t,n),n.memoizedState?ln(n.memoizedState):n.stateNode&&(ue||li(n.stateNode));break}case 27:if(ld){ue||n1(n,t),n5(n);var r=uu,a=uc;lg(n.type)&&(uu=n.stateNode,uc=!1),rS(e,t,n),lm(n.stateNode,n.type,n.memoizedProps),uu=r,uc=a;break}case 5:ue||n1(n,t),n5(n);case 6:if(6===n.tag&&n5(n),ig){if(r=uu,a=uc,uu=null,rS(e,t,n),uu=r,uc=a,null!==uu)if(uc)try{i1(uu,n.stateNode),s4=!0}catch(e){ap(n,t,e)}else try{i0(uu,n.stateNode),s4=!0}catch(e){ap(n,t,e)}}else rS(e,t,n);break;case 18:ig&&null!==uu&&(uc?oJ(uu,n.stateNode):oZ(uu,n.stateNode));break;case 4:ig?(r=uu,a=uc,uu=n.stateNode.containerInfo,uc=!0,rS(e,t,n),uu=r,uc=a):(iv&&rr(n.stateNode,n,ov()),rS(e,t,n));break;case 0:case 11:case 14:case 15:nQ(2,n,t),ue||nQ(4,n,t),rS(e,t,n);break;case 1:ue||(n1(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount&&nJ(n,t,r)),rS(e,t,n);break;case 21:default:rS(e,t,n);break;case 22:ue=(r=ue)||null!==n.memoizedState,rS(e,t,n),ue=r;break;case 30:n1(n,t),rS(e,t,n);break;case 7:ue||n1(n,t),rS(e,t,n)}}function rE(e,t){if(i_&&null===t.memoizedState&&null!==(e=t.alternate)&&null!==(e=e.memoizedState)){e=e.dehydrated;try{oK(e)}catch(e){ap(t,t.return,e)}}}function rb(e,t){if(i_&&null===t.memoizedState&&null!==(e=t.alternate)&&null!==(e=e.memoizedState)&&null!==(e=e.dehydrated))try{oY(e)}catch(e){ap(t,t.return,e)}}function rT(e,t){var n=function(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return null===t&&(t=e.stateNode=new ur),t;case 22:return null===(t=(e=e.stateNode)._retryCache)&&(t=e._retryCache=new ur),t;default:throw Error(r(435,e.tag))}}(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=a_.bind(null,e,t);t.then(r,r)}})}function rM(e,t,n){var a=t.deletions;if(null!==a)for(var i=0;i<a.length;i++){var o=a[i],l=e,s=t;if(ig){var u=s;n:for(;null!==u;){switch(u.tag){case 27:if(ld){if(lg(u.type)){uu=u.stateNode,uc=!1;break n}break}case 5:uu=u.stateNode,uc=!1;break n;case 3:case 4:uu=u.stateNode.containerInfo,uc=!0;break n}u=u.return}if(null===uu)throw Error(r(160));
389rx(l,s,o),uu=null,uc=!1}else rx(l,s,o);null!==(l=o.alternate)&&(l.return=null),o.return=null}if(13886&t.subtreeFlags)for(t=t.child;null!==t;)ry(t,e,n),t=t.sibling}function ry(e,t,n){var a=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(4&i&&null!==(a=null!==(a=e.updateQueue)?a.events:null))for(var o=0;o<a.length;o++){var l=a[o];l.ref.impl=l.nextImpl}rM(t,e,n),rR(e),4&i&&(nQ(3,e,e.return),n$(3,e),nQ(5,e,e.return));break;case 1:rM(t,e,n),rR(e),512&i&&(ue||null===a||n1(a,a.return)),64&i&&s7&&null!==(e=e.updateQueue)&&null!==(t=e.callbacks)&&(i=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=null===i?t:i.concat(t));break;case 26:if(o8){o=ud,rM(t,e,n),rR(e),512&i&&(ue||null===a||n1(a,a.return)),4&i&&(n=null!==a?a.memoizedState:null,i=e.memoizedState,null===a?null===i?null===e.stateNode?e.stateNode=s7?lo(e.type,e.memoizedProps,t.containerInfo,e):lr(o,e.type,e.memoizedProps,e):s7||la(o,e.type,e.stateNode):e.stateNode=lt(o,i,e.memoizedProps):n!==i?(null===n?null===(t=a.stateNode)||ue||li(t):ln(n),null===i?s7||la(o,e.type,e.stateNode):lt(o,i,e.memoizedProps)):null===i&&null!==e.stateNode&&n7(e,e.memoizedProps,a.memoizedProps));break}case 27:if(ld){rM(t,e,n),rR(e),512&i&&(ue||null===a||n1(a,a.return)),null!==a&&4&i&&n7(e,e.memoizedProps,a.memoizedProps);break}case 5:if(o=ut,ut=!1,rM(t,e,n),ut=o,rR(e),512&i&&(ue||null===a||n1(a,a.return)),ig){if(32&e.flags){t=e.stateNode;try{i2(t),s4=!0}catch(t){ap(e,e.return,t)}}4&i&&null!=e.stateNode&&(t=e.memoizedProps,n7(e,t,null!==a?a.memoizedProps:t)),1024&i&&(un=!0)}else iv&&null!==e.alternate&&(e.alternate.stateNode=e.stateNode);break;case 6:if(rM(t,e,n),rR(e),4&i&&ig){if(null===e.stateNode)throw Error(r(162));t=e.memoizedProps,i=null!==a?a.memoizedProps:t,n=e.stateNode;try{iY(n,i,t),s4=!0}catch(t){ap(e,e.return,t)}}break;case 3:if(s4=!1,o8?(ll(),o=ud,ud=o7(t.containerInfo),rM(t,e,n),ud=o):rM(t,e,n),rR(e),4&i){if(ig&&i_&&null!==a&&a.memoizedState.isDehydrated)try{oq(t.containerInfo)}catch(t){ap(e,e.return,t)}if(iv){i=t.containerInfo,t=t.pendingChildren;try{ox(i,t),s4=!0}catch(t){ap(e,e.return,t)}}}un&&(un=!1,function e(t){if(1024&t.subtreeFlags)for(t=t.child;null!==t;){var n=t;e(n),5===n.tag&&1024&n.flags&&iF(n.stateNode),t=t.sibling}}(e)),s4=!1;break;case 4:a=ut,ut=s7,o=n2(),o8?(l=ud,ud=o7(e.stateNode.containerInfo),rM(t,e,n),rR(e),ud=l):(rM(t,e,n),rR(e)),s4&&uo&&(ul=!0),s4=o,ut=a,4&i&&iv&&rr(e.stateNode,e,e.stateNode.pendingChildren);break;case 12:rM(t,e,n),rR(e);break;case 31:case 19:rM(t,e,n),rR(e),4&i&&null!==(t=e.updateQueue)&&(e.updateQueue=null,rT(e,t));break;case 13:rM(t,e,n),rR(e),8192&e.child.flags&&null!==e.memoizedState!=(null!==a&&null!==a.memoizedState)&&(uk=lP()),4&i&&null!==(t=e.updateQueue)&&(e.updateQueue=null,rT(e,t));break;case 22:o=null!==e.memoizedState,l=null!==a&&null!==a.memoizedState;var s=s7,u=ue,c=ut;s7=s||o,ut=c||o,ue=u||l,rM(t,e,n),ue=u,ut=c,s7=s,rR(e),8192&i&&((t=e.stateNode)._visibility=o?-2&t._visibility:1|t._visibility,!o||null===a||l||s7||ue||(t=2*!!ld,n=l||ue,a=s7,l=ue,s7=o||s7,ue=n,function e(t,n){for(t=t.child;null!==t;){var r=t;switch(r.tag){case 0:case 11:case 14:case 15:nQ(4,r,r.return),e(r,n);break;case 1:n1(r,r.return);var a=r.stateNode;"function"==typeof a.componentWillUnmount&&nJ(r,r.return,a),e(r,n);break;case 27:ld&&(2&n)!=0&&lm(r.stateNode,r.type,r.memoizedProps);case 5:n1(r,r.return),5!==r.tag&&27!==r.tag||n5(r),e(r,n);break;case 6:n5(r);break;case 26:n1(r,r.return),o8&&(a=r.stateNode,null!==r.memoizedState||null===a||ue||li(a)),e(r,n);break;case 22:null===r.memoizedState&&e(r,n);break;case 30:n1(r,r.return),e(r,n);break;case 7:n1(r,r.return);default:e(r,n)}t=t.sibling}}(e,t),s7=a,ue=l),ig&&(o||!ut)&&r_(e,o)),4&i&&null!==(t=e.updateQueue)&&null!==(i=t.retryQueue)&&(t.retryQueue=null,rT(e,i));break;case 30:512&i&&(ue||null===a||n1(a,a.return)),i=n2(),o=uo,l=(0x13ffff00&n)===n,s=e.memoizedProps,uo=l&&"none"!==w(s.default,s.update),rM(t,e,n),rR(e),l&&null!==a&&s4&&(e.flags|=4),uo=o,s4=i;break;case 21:break;case 7:512&i&&(ue||null===a||n1(a,a.return)),a&&null!==a.stateNode&&op(e,a.stateNode);default:rM(t,e,n),rR(e)}}function rR(e){var t=e.flags;if(2&t){try{for(var n,a=e.return;null!==a;){if(re(a)){n=a;break}a=a.return}a=null;for(var i=e.return;null!==i;){if(n8(i)){var o=i.stateNode;null===a?a=[o]:a.push(o)}if(n6(i))break;i=i.return}var l=a;if(ig){if(null==n)throw Error(r(160));switch(n.tag){case 27:if(ld){var s=n.stateNode,u=rt(e);rn(e,u,s,l);break}case 5:var c=n.stateNode;32&n.flags&&(i2(c),n.flags&=-33);var d=rt(e);rn(e,d,c,l);break;case 3:case 4:var f=n.stateNode.containerInfo,p=rt(e);!function e(t,n,r,a){var i=t.tag;if(5===i||6===i)i=t.stateNode,n?iJ(r,i,n):iK(r,i),n3(t,a),s4=!0;else if(4!==i&&(ld&&27===i&&(n3(t,a),a=null,lg(t.type)&&(r=t.stateNode,n=null)),null!==(t=t.child)))for(e(t,n,r,a),t=t.sibling;null!==t;)e(t,n,r,a),t=t.sibling}(e,p,f,l);break;default:throw Error(r(161))}}else!function e(t,n){if(5===t.tag||ld&&27===t.tag)n3(t,n);else if(4!==t.tag&&null!==(t=t.child))for(e(t,n),t=t.sibling;null!==t;)e(t,n),t=t.sibling}(e,l)}catch(t){ap(e,e.return,t)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function rC(e,t){if(9270&t.subtreeFlags)for(t=t.child;null!==t;)rA(t,e),t=t.sibling;else!function e(t,n){for(t=t.child;null!==t;){if(30===t.tag){var r=t.memoizedProps,a=t.stateNode,i=C(r,a),o=w(r.default,r.update);if(n)var l=null===(a=a.clones)?null:a.map(or);else l=t.memoizedState,t.memoizedState=null;a=t;var s=t.child;s9=0,i=rh(a,s,i,i,o,l,!1),(4&t.flags)!=0&&i&&(n||rK(t,r.onUpdate))}else(0x2000000&t.subtreeFlags)!=0&&e(t,n);t=t.sibling}}(t,!1)}function rA(e,t){var n=e.alternate;if(null===n)rc(e,!1);else switch(e.tag){case 3:if(us=ui=!1,ro(),rC(t,e),!ui&&!ul){if(null!==(e=s8))for(var r=0;r<e.length;r+=3)i7(e[r],e[r+1],e[r+2]);oe(t.containerInfo),us=!0}s8=null;break;case 5:default:rC(t,e);break;case 4:r=ui,ui=!1,rC(t,e),ui&&(ul=!0),ui=r;break;case 22:null===e.memoizedState&&(null!==n.memoizedState?rc(e,!1):rC(t,e));break;case 30:r=ui;var a=ro();ui=!1,rC(t,e),ui&&(e.flags|=4);var i=e.memoizedProps,o=e.stateNode;t=C(i,o),o=C(n.memoizedProps,o);var l=w(i.default,i.update);"none"===l?n=!1:(i=n.memoizedState,n.memoizedState=null,n=e.child,s9=0,n=rh(e,n,t,o,l,i,!0),s9!==(null===i?0:i.length)&&(e.flags|=32)),(4&e.flags)!=0&&n?(rK(e,e.memoizedProps.onUpdate),s8=a):null!==a&&(a.push.apply(a,s8),s8=a),ui=(32&e.flags)!=0||r}}function rw(e,t){if(8772&t.subtreeFlags)for(t=t.child;null!==t;)rv(e,t.alternate,t),t=t.sibling}function rP(e,t){var n=null;null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),e=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(e=t.memoizedState.cachePool.pool),e!==n&&(null!=e&&e.refCount++,null!=n&&el(n))}function rU(e,t){e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&el(e))}function rL(e,t,n,r){var a=(0x13ffff00&n)===n;if(t.subtreeFlags&(a?10262:10256))for(t=t.child;null!==t;)rD(e,t,n,r),t=t.sibling;else a&&function e(t){for(t=t.child;null!==t;)30===t.tag?rs(t.child,!1):(0x2000000&t.subtreeFlags)!=0&&e(t),t=t.sibling}(t)}function rD(e,t,n,r){var a=(0x13ffff00&n)===n;a&&null===t.alternate&&null!==t.return&&null!==t.return.alternate&&rm(t);var i=t.flags;switch(t.tag){case 0:case 11:case 15:rL(e,t,n,r),2048&i&&n$(9,t);break;case 1:case 31:case 13:default:rL(e,t,n,r);break;case 3:rL(e,t,n,r),a&&ig&&us&&ot(e.containerInfo),2048&i&&(e=null,null!==t.alternate&&(e=t.alternate.memoizedState.cache),(t=t.memoizedState.cache)!==e&&(t.refCount++,null!=e&&el(e)));break;case 12:if(2048&i){rL(e,t,n,r),e=t.stateNode;try{var o=t.memoizedProps,l=o.id,s=o.onPostCommit;"function"==typeof s&&s(l,null===t.alternate?"mount":"update",e.passiveEffectDuration,-0)}catch(e){ap(t,t.return,e)}}else rL(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,l=t.alternate,null!==t.memoizedState?(a&&null!==l&&null===l.memoizedState&&rm(l),2&o._visibility?rL(e,t,n,r):rN(e,t)):(a&&null!==l&&null!==l.memoizedState&&rm(t),2&o._visibility?rL(e,t,n,r):(o._visibility|=2,function e(t,n,r,a,i){for(i=i&&(10256&n.subtreeFlags)!=0,n=n.child;null!==n;){var o=n,l=o.flags;switch(o.tag){case 0:case 11:case 15:e(t,o,r,a,i),n$(8,o);break;case 23:break;case 22:var s=o.stateNode;null!==o.memoizedState?2&s._visibility?e(t,o,r,a,i):rN(t,o):(s._visibility|=2,e(t,o,r,a,i)),i&&2048&l&&rP(o.alternate,o);break;case 24:e(t,o,r,a,i),i&&2048&l&&rU(o.alternate,o);break;default:e(t,o,r,a,i)}n=n.sibling}}(e,t,n,r,(10256&t.subtreeFlags)!=0))),2048&i&&rP(l,t);break;case 24:rL(e,t,n,r),2048&i&&rU(t.alternate,t);break;case 30:a&&null!==(a=t.alternate)&&(rs(a.child,!0),rs(t.child,!0)),rL(e,t,n,r)}}function rN(e,t){if(10256&t.subtreeFlags)for(t=t.child;null!==t;){var n=t,r=n.flags;switch(n.tag){case 22:rN(e,n),2048&r&&rP(n.alternate,n);break;case 24:rN(e,n),2048&r&&rU(n.alternate,n);break;default:rN(e,n)}t=t.sibling}}function rI(e,t,n){if(e.subtreeFlags&uf)for(e=e.child;null!==e;)rF(e,t,n),e=e.sibling}function rF(e,t,n){switch(e.tag){case 26:if(rI(e,t,n),e.flags&uf)if(null!==e.memoizedState)lc(n,ud,e.memoizedState,e.memoizedProps);else{var r=e.stateNode,a=e.type;e=e.memoizedProps,((0x13ffff40&t)===t||iA(a,e))&&iU(n,r,a,e)}break;case 5:rI(e,t,n),e.flags&uf&&(r=e.stateNode,a=e.type,e=e.memoizedProps,((0x13ffff40&t)===t||iA(a,e))&&iU(n,r,a,e));break;case 3:case 4:o8?(r=ud,ud=o7(e.stateNode.containerInfo),rI(e,t,n),ud=r):rI(e,t,n);break;case 22:null===e.memoizedState&&(null!==(r=e.alternate)&&null!==r.memoizedState?(r=uf,uf=0x1000000,rI(e,t,n),uf=r):rI(e,t,n));break;case 30:(e.flags&uf)!=0&&null!=(r=e.memoizedProps.name)&&"auto"!==r&&((a=e.stateNode).paired=null,null===s6&&(s6=new Map),s6.set(r,a)),rI(e,t,n);break;default:rI(e,t,n)}}function rB(e){var t=e.alternate;if(null!==t&&null!==(e=t.child)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(null!==e)}}function rO(e){var t=e.deletions;if((16&e.flags)!=0){if(null!==t)for(var n=0;n<t.length;n++){var r=t[n];ua=r,rk(r,e)}rB(e)}if(10256&e.subtreeFlags)for(e=e.child;null!==e;)rG(e),e=e.sibling}function rG(e){switch(e.tag){case 0:case 11:case 15:rO(e),2048&e.flags&&nQ(9,e,e.return);break;case 3:case 12:default:rO(e);break;case 22:var t=e.stateNode;null!==e.memoizedState&&2&t._visibility&&(null===e.return||13!==e.return.tag)?(t._visibility&=-3,function e(t){var n=t.deletions;if((16&t.flags)!=0){if(null!==n)for(var r=0;r<n.length;r++){var a=n[r];ua=a,rk(a,t)}rB(t)}for(t=t.child;null!==t;){switch((n=t).tag){case 0:case 11:case 15:nQ(8,n,n.return),e(n);break;case 22:2&(r=n.stateNode)._visibility&&(r._visibility&=-3,e(n));break;default:e(n)}t=t.sibling}}(e)):rO(e)}}function rk(e,t){for(;null!==ua;){var n=ua;switch(n.tag){case 0:case 11:case 15:nQ(8,n,t);break;case 23:case 22:if(null!==n.memoizedState&&null!==n.memoizedState.cachePool){var r=n.memoizedState.cachePool.pool;null!=r&&r.refCount++}break;case 24:el(n.memoizedState.cache)}if(null!==(r=n.child))r.return=n,ua=r;else for(n=e;null!==ua;){var a=(r=ua).sibling,i=r.return;if(function e(t){var n=t.alternate;null!==n&&(t.alternate=null,e(n)),t.child=null,t.deletions=null,t.sibling=null,5===t.tag&&null!==(n=t.stateNode)&&iy(n),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}(r),r===n){ua=null;break}if(null!==a){a.return=i,ua=a;break}ua=i}}}function rz(e){var t=iS(e);if(null!=t){if("string"!=typeof t.memoizedProps["data-testname"])throw Error(r(364));return t}if(null===(e=ik(e)))throw Error(r(362));return e.stateNode.current}function rH(e,t){var n=e.tag;switch(t.$$typeof){case um:if(e.type===t.value)return!0;break;case uh:n:{for(t=t.value,e=[e,0],n=0;n<e.length;){var a=e[n++],i=a.tag,o=e[n++],l=t[o];if(5!==i&&26!==i&&27!==i||!iV(a)){for(;null!=l&&rH(a,l);)l=t[++o];if(o===t.length){t=!0;break n}for(a=a.child;null!==a;)e.push(a,o),a=a.sibling}}t=!1}return t;case ug:if((5===n||26===n||27===n)&&iW(e.stateNode,t.value))return!0;break;case u_:if((5===n||6===n||26===n||27===n)&&null!==(e=iH(e))&&0<=e.indexOf(t.value))return!0;break;case uv:if((5===n||26===n||27===n)&&"string"==typeof(e=e.memoizedProps["data-testname"])&&e.toLowerCase()===t.value.toLowerCase())return!0;break;default:throw Error(r(365))}return!1}function rV(e){switch(e.$$typeof){case um:return"<"+(s(e.value)||"Unknown")+">";case uh:return":has("+(rV(e)||"")+")";case ug:return'[role="'+e.value+'"]';
389case u_:return'"'+e.value+'"';case uv:return'[data-testname="'+e.value+'"]';default:throw Error(r(365))}}function rW(e,t){var n=[];e=[e,0];for(var r=0;r<e.length;){var a=e[r++],i=a.tag,o=e[r++],l=t[o];if(5!==i&&26!==i&&27!==i||!iV(a)){for(;null!=l&&rH(a,l);)l=t[++o];if(o===t.length)n.push(a);else for(a=a.child;null!==a;)e.push(a,o),a=a.sibling}}return n}function rj(e,t){if(!iG)throw Error(r(363));e=rW(e=rz(e),t),t=[],e=Array.from(e);for(var n=0;n<e.length;){var a=e[n++],i=a.tag;if(5===i||26===i||27===i)iV(a)||t.push(a.stateNode);else for(a=a.child;null!==a;)e.push(a),a=a.sibling}return t}function rX(){return(2&uE)!=0&&0!==uM?uM&-uM:null!==a6.T?ev():iT()}function rq(){if(0===uI)if((0x20000000&uM)==0||l6){var e=lM;(3932160&(lM<<=1))==0&&(lM=262144),uI=e}else uI=0x20000000;return null!==(e=sF.current)&&(e.flags|=32),uI}function rK(e,t){if(null!=t){var n=e.stateNode,r=n.ref;null===r&&(r=n.ref=oc(C(e.memoizedProps,n))),null===uJ&&(uJ=[]),uJ.push(t.bind(null,r))}}function rY(e,t,n){(e===ub&&(2===uy||9===uy)||null!==e.cancelPendingCommit)&&(r1(e,0),rZ(e,uM,uI,!1)),_(e,n),((2&uE)==0||e!==ub)&&(e===ub&&((2&uE)==0&&(uD|=n),4===uU&&rZ(e,uM,uI,!1)),ec(e))}function r$(e,t,n){if((6&uE)!=0)throw Error(r(327));for(var a=!n&&(127&t)==0&&(t&e.expiredLanes)==0||m(e,t),i=a?function(e,t){var n=uE;uE|=2;var a=r4(),i=r5();ub!==e||uM!==t?(uV=null,uH=lP()+500,r1(e,t)):uA=m(e,t);n:for(;;)try{if(0!==uy&&null!==uT){t=uT;var o=uR;r:switch(uy){case 1:uy=0,uR=null,ae(e,t,o,1);break;case 2:case 9:if(eT(o)){uy=0,uR=null,r7(t);break}t=function(){2!==uy&&9!==uy||ub!==e||(uy=7),ec(e)},o.then(t,t);break n;case 3:uy=7;break n;case 4:uy=5;break n;case 7:eT(o)?(uy=0,uR=null,r7(t)):(uy=0,uR=null,ae(e,t,o,7));break;case 5:var l=null;switch(uT.tag){case 26:l=uT.memoizedState;case 5:case 27:var s=uT,u=s.type,c=s.pendingProps;if(l?lu(l):iw(s.stateNode,u,c)){uy=0,uR=null;var d=s.sibling;if(null!==d)uT=d;else{var f=s.return;null!==f?(uT=f,at(f)):uT=null}break r}}uy=0,uR=null,ae(e,t,o,5);break;case 6:uy=0,uR=null,ae(e,t,o,6);break;case 8:r0(),uU=6;break n;default:throw Error(r(462))}}for(;null!==uT&&!lA();)r9(uT);break}catch(t){r2(e,t)}return sn=st=null,a6.H=a,a6.A=i,uE=n,null!==uT?0:(ub=null,uM=0,eL(),uU)}(e,t):r8(e,t,!0),o=a;;){if(0===i)uA&&!a&&rZ(e,t,0,!1);else{if(n=e.current.alternate,o&&!function(e){for(var t=e;;){var n=t.tag;if((0===n||11===n||15===n)&&16384&t.flags&&null!==(n=t.updateQueue)&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var a=n[r],i=a.getSnapshot;a=a.value;try{if(!lk(i(),a))return!1}catch{return!1}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(n)){i=r8(e,t,!1),o=!1;continue}if(2===i){if(o=t,e.errorRecoveryDisabledLanes&o)var l=0;else l=0!=(l=-0x20000001&e.pendingLanes)?l:0x20000000&l?0x20000000:0;if(0!==l){t=l;n:{i=uB;var s=i_&&e.current.memoizedState.isDehydrated;if(s&&(r1(e,l).flags|=256),2!==(l=r8(e,l,!1))&&6!==l){if(uw&&!s){e.errorRecoveryDisabledLanes|=o,uD|=o,i=4;break n}o=uO,uO=i,null!==o&&(null===uO?uO=o:uO.push.apply(uO,o))}i=l}if(o=!1,2!==i)continue}}if(1===i){r1(e,0),rZ(e,t,0,!0);break}n:{switch(a=e,o=i){case 0:case 1:throw Error(r(345));case 4:if((4194048&t)!==t&&(0x3c00000&t)!==t)break;case 6:rZ(a,t,uI,!uC);break n;case 2:uO=null;break;case 3:case 5:break;default:throw Error(r(329))}if((0x3c00000&t)===t&&10<(i=uk+300-lP())){if(rZ(a,t,uI,!uC),0!==p(a,0,!0))break n;uK=t,a.timeoutHandle=id(rQ.bind(null,a,n,uO,uV,uG,t,uI,uD,uF,uC,o,"Throttled",-0,0),i);break n}rQ(a,n,uO,uV,uG,t,uI,uD,uF,uC,o,null,-0,0)}}break}ec(e)}function rQ(e,t,n,r,a,i,o,l,s,u,c,d,f,p){e.timeoutHandle=im;var m=t.subtreeFlags,h=(0x13ffff00&i)===i;if(d=null,(h||8192&m||(0x1002000&m)==0x1002000)&&(d=iP(),s6=null,rF(t,i,d),h&&iL(d,e.containerInfo),null!==(m=iD(d,m=(0x3c00000&i)===i?uk-lP():(4194048&i)===i?uz-lP():0)))){uK=i,e.cancelPendingCommit=m(ar.bind(null,e,t,i,n,r,a,o,l,s,u,c,d,null,f,p)),rZ(e,i,o,!u);return}ar(e,t,i,n,r,a,o,l,s,u,c,d)}function rZ(e,t,n,r){t=h(e,t)&~uN&~uD,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var a=t;0<a;){var i=31-lx(a),o=1<<i;r[i]=-1,a&=~o}0!==n&&E(e,n,t)}function rJ(){return(6&uE)!=0||(ed(0,!1),!1)}function r0(){if(null!==uT){if(0===uy)var e=uT.return;else e=uT,sn=st=null,tr(e),sy=null,sR=0,e=uT;for(;null!==e;)nY(e.alternate,e),e=e.return;uT=null}}function r1(e,t){var n=e.timeoutHandle;return n!==im&&(e.timeoutHandle=im,ip(n)),null!==(n=e.cancelPendingCommit)&&(e.cancelPendingCommit=null,n()),uK=0,r0(),ub=e,uT=n=aE(e.current,null),uM=t,uy=0,uR=null,uC=!1,uA=m(e,t),uw=!1,uF=uI=uN=uD=uL=uU=0,uO=uB=null,uG=!1,uP=h(e,t),eL(),n}function r2(e,t){sk=null,a6.H=s$,t===sx||t===sb?(t=eR(),uy=3):t===sE?(t=eR(),uy=4):uy=t===s1?8:null!==t&&"object"==typeof t&&"function"==typeof t.then?6:1,uR=t,null===uT&&(uU=1,na(e,D(t,e.current)))}function r3(){var e=sF.current;return null===e||((4194048&uM)===uM?null===sB:((0x3c00000&uM)===uM||(0x20000000&uM)!=0)&&e===sB)}function r4(){var e=a6.H;return a6.H=s$,null===e?s$:e}function r5(){var e=a6.A;return a6.A=up,e}function r6(){uU=4,uC||(4194048&uM)!==uM&&null!==sF.current||(uA=!0),(0x7ffffff&uL)==0&&(0x7ffffff&uD)==0||null===ub||rZ(ub,uM,uI,!1)}function r8(e,t,n){var r=uE;uE|=2;var a=r4(),i=r5();(ub!==e||uM!==t)&&(uV=null,r1(e,t)),t=!1;var o=uU;n:for(;;)try{if(0!==uy&&null!==uT){var l=uT,s=uR;switch(uy){case 8:r0(),o=6;break n;case 3:case 2:case 9:case 6:null===sF.current&&(t=!0);var u=uy;if(uy=0,uR=null,ae(e,l,s,u),n&&uA){o=0;break n}break;default:u=uy,uy=0,uR=null,ae(e,l,s,u)}}(function(){for(;null!==uT;)r9(uT)})(),o=uU;break}catch(t){r2(e,t)}return t&&e.shellSuspendCounter++,sn=st=null,uE=r,a6.H=a,a6.A=i,null===uT&&(ub=null,uM=0,eL()),o}function r9(e){var t=nB(e.alternate,e,uP);e.memoizedProps=e.pendingProps,null===t?at(e):uT=t}function r7(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=nx(n,t,t.pendingProps,t.type,void 0,uM);break;case 11:t=nx(n,t,t.pendingProps,t.type.render,t.ref,uM);break;case 5:tr(t);var r=t;i_&&r===l4&&(l6?(j(r),5===r.tag&&null!=r.stateNode&&(l5=r.stateNode)):(j(r),l6=!0));default:nY(n,t),t=nB(n,t=uT=ab(t,uP),uP)}e.memoizedProps=e.pendingProps,null===t?at(e):uT=t}function ae(e,t,n,a){sn=st=null,tr(t),sy=null,sR=0;var i=t.return;try{if(function(e,t,n,a,i){if(n.flags|=32768,null!==a&&"object"==typeof a&&"function"==typeof a.then){if(null!==(t=n.alternate)&&ee(t,n,i,!0),null!==(n=sF.current)){switch(n.tag){case 31:case 13:case 19:return null===sB?r6():null===n.alternate&&0===uU&&(uU=3),n.flags&=-257,n.flags|=65536,n.lanes=i,a===sT?n.flags|=16384:(null===(t=n.updateQueue)?n.updateQueue=new Set([a]):t.add(a),am(e,a,i)),!1;case 22:return n.flags|=65536,a===sT?n.flags|=16384:(null===(t=n.updateQueue)?(t={transitions:null,markerInstances:null,retryQueue:new Set([a])},n.updateQueue=t):null===(n=t.retryQueue)?t.retryQueue=new Set([a]):n.add(a),am(e,a,i)),!1}throw Error(r(435,n.tag))}return am(e,a,i),r6(),!1}if(l6)return null!==(t=sF.current)?((65536&t.flags)==0&&(t.flags|=256),t.flags|=65536,t.lanes=i,a!==l7&&Y(D(e=Error(r(422),{cause:a}),n))):(a!==l7&&Y(D(t=Error(r(423),{cause:a}),n)),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,a=D(a,n),i=no(e.stateNode,a,i),eV(e,i),4!==uU&&(uU=2)),!1;var o=Error(r(520),{cause:a});if(o=D(o,n),null===uB?uB=[o]:uB.push(o),4!==uU&&(uU=2),null===t)return!0;a=D(a,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=no(n.stateNode,a,e),eV(n,e),!1;case 1:if(t=n.type,o=n.stateNode,(128&n.flags)==0&&("function"==typeof t.getDerivedStateFromError||null!==o&&"function"==typeof o.componentDidCatch&&(null===uW||!uW.has(o))))return n.flags|=65536,i&=-i,n.lanes|=i,ns(i=nl(i),e,n,a),eV(n,i),!1;break;case 22:if(null!==n.memoizedState)return n.flags|=65536,!1}n=n.return}while(null!==n)return!1}(e,i,t,n,uM)){uU=1,na(e,D(n,e.current)),uT=null;return}}catch(t){if(null!==i)throw uT=i,t;uU=1,na(e,D(n,e.current)),uT=null;return}32768&t.flags?(l6||1===a?e=!0:uA||(0x20000000&uM)!=0?e=!1:(uC=e=!0,(2===a||9===a||3===a||6===a)&&null!==(a=sF.current)&&13===a.tag&&(a.flags|=16384)),an(t,e)):at(t)}function at(e){var t=e;do{if((32768&t.flags)!=0)return void an(t,uC);e=t.return;var n=function(e,t,n){var a=t.pendingProps;switch(B(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return nK(t),null;case 3:return n=t.stateNode,a=null,null!==e&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Q(so),k(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(null===e||null===e.child)&&(X(t)?nO(t):null===e||e.memoizedState.isDehydrated&&(256&t.flags)==0||(t.flags|=1024,K())),nH(e,t),nK(t),null;case 26:if(o8){var i=t.type,o=t.memoizedState;return null===e?(nO(t),null!==o?(nK(t),nj(t,o)):(nK(t),nW(t,i,null,a,n))):o?o!==e.memoizedState?(nO(t),nK(t),nj(t,o)):(nK(t),t.flags&=-0x1000001):(o=e.memoizedProps,ig?o!==a&&nO(t):nV(e,t,i,a),nK(t),nW(t,i,o,a,n)),null}case 27:if(ld){if(H(t),n=l2.current,i=t.type,null!==e&&null!=t.stateNode)ig?e.memoizedProps!==a&&nO(t):nV(e,t,i,a);else{if(!a){if(null===t.stateNode)throw Error(r(166));return nK(t),t.subtreeFlags&=-0x2000001,null}e=l0.current,X(t)?W(t,e):(t.stateNode=e=lf(i,a,n,e,!0),nO(t))}return nK(t),t.subtreeFlags&=-0x2000001,null}case 5:if(H(t),i=t.type,null!==e&&null!=t.stateNode)nV(e,t,i,a);else{if(!a){if(null===t.stateNode)throw Error(r(166));return nK(t),t.subtreeFlags&=-0x2000001,null}if(o=l0.current,X(t))W(t,o),o$(t.stateNode,i,a,o)&&(t.flags|=64);else{var l=io(i,a,l2.current,o,t);nG(t),nz(l,t,!1,!1),t.stateNode=l,is(l,i,a,o)&&nO(t)}
389}return nK(t),t.subtreeFlags&=-0x2000001,nW(t,t.type,null===e?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&null!=t.stateNode)n=e.memoizedProps,ig?n!==a&&nO(t):iv&&(n!==a?(e=l2.current,n=l0.current,nG(t),t.stateNode=ic(a,e,n,t)):t.stateNode=e.stateNode);else{if("string"!=typeof a&&null===t.stateNode)throw Error(r(166));if(e=l2.current,n=l0.current,X(t)){if(!i_)throw Error(r(176));if(e=t.stateNode,n=t.memoizedProps,a=null,null!==(i=l4))switch(i.tag){case 27:case 5:a=i.memoizedProps}oz(e,n,t,a)||V(t,!0)}else nG(t),t.stateNode=ic(a,e,n,t)}return nK(t),null;case 31:if(n=t.memoizedState,null===e||null!==e.memoizedState){if(a=X(t),null!==n){if(null===e){if(!a)throw Error(r(318));if(!i_)throw Error(r(556));if(!(e=null!==(e=t.memoizedState)?e.dehydrated:null))throw Error(r(557));oH(e,t)}else q(),(128&t.flags)==0&&(t.memoizedState=null),t.flags|=4;nK(t),e=!1}else n=K(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return 256&t.flags?(e1(t),t):(e1(t),null);if((128&t.flags)!=0)throw Error(r(558))}return nK(t),null;case 13:if(a=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(i=X(t),null!==a&&null!==a.dehydrated){if(null===e){if(!i)throw Error(r(318));if(!i_)throw Error(r(344));if(!(i=null!==(i=t.memoizedState)?i.dehydrated:null))throw Error(r(317));oV(i,t)}else q(),(128&t.flags)==0&&(t.memoizedState=null),t.flags|=4;nK(t),i=!1}else i=K(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return 256&t.flags?(e1(t),t):(e1(t),null)}return e1(t),(128&t.flags)!=0?(t.lanes=n,t):(n=null!==a,e=null!==e&&null!==e.memoizedState,n&&(a=t.child,i=null,null!==a.alternate&&null!==a.alternate.memoizedState&&null!==a.alternate.memoizedState.cachePool&&(i=a.alternate.memoizedState.cachePool.pool),o=null,null!==a.memoizedState&&null!==a.memoizedState.cachePool&&(o=a.memoizedState.cachePool.pool),o!==i&&(a.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),nX(t,t.updateQueue),nK(t),null);case 4:return k(),nH(e,t),null===e&&ix(t.stateNode.containerInfo),t.flags|=0x4000000,nK(t),null;case 10:return Q(t.type),nK(t),null;case 19:if(e3(t),null===(a=t.memoizedState))return nK(t),null;if(i=(128&t.flags)!=0,null===(o=a.rendering))if(i)nq(a,!1);else{if(0!==uU||null!==e&&(128&e.flags)!=0)for(e=t.child;null!==e;){if(null!==(o=e4(e))){for(t.flags|=128,nq(a,!1),t.updateQueue=e=o.updateQueue,nX(t,e),t.subtreeFlags=0,e=n,n=t.child;null!==n;)ab(n,e),n=n.sibling;return e2(t,1&sO.current|2),l6&&N(t,a.treeForkCount),t.child}e=e.sibling}null!==a.tail&&lP()>uH&&(t.flags|=128,i=!0,nq(a,!1),t.lanes=4194304)}else{if(!i)if(null!==(e=e4(o))){if(t.flags|=128,i=!0,t.updateQueue=e=e.updateQueue,nX(t,e),nq(a,!0),null===a.tail&&"collapsed"!==a.tailMode&&"visible"!==a.tailMode&&!o.alternate&&!l6)return nK(t),null}else 2*lP()-a.renderingStartTime>uH&&0x20000000!==n&&(t.flags|=128,i=!0,nq(a,!1),t.lanes=4194304);a.isBackwards?(o.sibling=t.child,t.child=o):(null!==(e=a.last)?e.sibling=o:t.child=o,a.last=o)}if(null!==a.tail){e=a.tail;n:{for(n=e;null!==n;){if(null!==n.alternate){n=!1;break n}n=n.sibling}n=!0}return a.rendering=e,a.tail=e.sibling,a.renderingStartTime=lP(),e.sibling=null,o=sO.current,o=i?1&o|2:1&o,"visible"===a.tailMode||"collapsed"===a.tailMode||!n||l6?e2(t,o):(n=o,d(sF,t),d(sO,n),null===sB&&(sB=t)),l6&&N(t,a.treeForkCount),e}return nK(t),null;case 22:case 23:return e1(t),e$(),a=null!==t.memoizedState,null!==e?null!==e.memoizedState!==a&&(t.flags|=8192):a&&(t.flags|=8192),a?(0x20000000&n)!=0&&(128&t.flags)==0&&(nK(t),6&t.subtreeFlags&&(t.flags|=8192)):nK(t),null!==(n=t.updateQueue)&&nX(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),a=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(a=t.memoizedState.cachePool.pool),a!==n&&(t.flags|=2048),null!==e&&c(sS),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Q(so),nK(t),null;case 25:return null;case 30:return t.flags|=0x2000000,nK(t),null}throw Error(r(156,t.tag))}(t.alternate,t,uP);if(null!==n){uT=n;return}if(null!==(t=t.sibling)){uT=t;return}uT=t=e}while(null!==t)0===uU&&(uU=5)}function an(e,t){do{var n=function(e,t){switch(B(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Q(so),k(),(65536&(e=t.flags))!=0&&(128&e)==0?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return H(t),null;case 31:if(null!==t.memoizedState){if(e1(t),null===t.alternate)throw Error(r(340));q()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 13:if(e1(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(r(340));q()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return e3(t),65536&(e=t.flags)?(t.flags=-65537&e|128,null!==(e=t.memoizedState)&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return k(),null;case 10:return Q(t.type),null;case 22:case 23:return e1(t),e$(),null!==e&&c(sS),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return Q(so),null;default:return null}}(e.alternate,e);if(null!==n){n.flags&=32767,uT=n;return}if(null!==(n=e.return)&&(n.flags|=32768,n.subtreeFlags=0,n.deleti
389ons=null),!t&&null!==(e=e.sibling)){uT=e;return}uT=e=n}while(null!==e)uU=6,uT=null}function ar(e,t,n,a,i,o,l,s,u,c,d,f){e.cancelPendingCommit=null;do ac();while(0!==uj)if((6&uE)!=0)throw Error(r(327));if(null!==t){if(t===e.current)throw Error(r(177));e===ub&&(uT=ub=null,uM=0),uq=t,uX=e,uK=n,u$=i,uQ=a,function(e,t,n,r,a,i,o){var l,s=t.lanes|t.childLanes;if(uY=s,function(e,t,n,r,a,i){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var l=e.entanglements,s=e.expirationTimes,u=e.hiddenUpdates;for(n=o&~n;0<n;){var c=31-lx(n),d=1<<c;l[c]=0,s[c]=-1;var f=u[c];if(null!==f)for(u[c]=null,c=0;c<f.length;c++){var p=f[c];null!==p&&(p.lane&=-0x20000001)}n&=~d}0!==r&&E(e,r,0),0!==i&&0===a&&0!==e.tag&&(e.suspendedLanes|=i&~(o&~t))}(e,n,s|=sU,r,a,i),uJ=null,(0x13ffff00&n)===n?(l=e.transitionTypes,e.transitionTypes=null,u0=l,r=10262):(u0=null,r=10256),(t.subtreeFlags&r)!=0||(t.flags&r)!=0?(e.callbackNode=null,e.callbackPriority=0,lR(lD,function(){return ad(),null})):(e.callbackNode=null,e.callbackPriority=0),s5=!1,r=(13878&t.flags)!=0,(13878&t.subtreeFlags)!=0||r){r=a6.T,a6.T=null,a=ib(),iE(2),i=uE,uE|=4;try{var u=e,c=t,d=n;for(ia(u.containerInfo),u=(0x13ffff00&d)===d,ua=c,c=u?9270:1024;null!==ua;){if(d=ua,u){var f=d.deletions;if(null!==f)for(var p=0;p<f.length;p++)u&&rf(f[p])}if(null===d.alternate&&(2&d.flags)!=0)u&&ri(d),rg(u);else{if(22===d.tag){if(f=d.alternate,null!==d.memoizedState){null!==f&&null===f.memoizedState&&u&&rf(f),rg(u);continue}else if(null!==f&&null!==f.memoizedState){u&&ri(d),rg(u);continue}}f=d.child,(d.subtreeFlags&c)!=0&&null!==f?(f.return=d,ua=f):(u&&function e(t){for(t=t.child;null!==t;){if(30===t.tag){var n=t.memoizedProps,r=C(n,t.stateNode);n=w(n.default,n.update),t.flags&=-5,"none"!==n&&rl(t,r,n,t.memoizedState=[],!1)}else(0x2000000&t.subtreeFlags)!=0&&e(t);t=t.sibling}}(d),rg(u))}}s6=null}finally{uE=i,iE(a),a6.T=r}}uj=1,s5?uZ=ol(o,e.containerInfo,u0,ao,al,ai,as,ad,aa,null,null):(ao(),al(),as())}(e,t,n,l,s,u,f)}}function aa(e){0!==uj&&(0,uX.onRecoverableError)(e,{componentStack:null})}function ai(){3===uj&&(uj=0,rA(uq,uX),uj=4)}function ao(){if(1===uj){uj=0;var e=uX,t=uq,n=uK,r=(13878&t.flags)!=0;if((13878&t.subtreeFlags)!=0||r){r=a6.T,a6.T=null;var a=ib();iE(2);var i=uE;uE|=4;try{uo=ul=!1,ry(t,e,n),ii(e.containerInfo)}finally{uE=i,iE(a),a6.T=r}}e.current=t,uj=2}}function al(){if(2===uj){uj=0;var e=uX,t=uq,n=(8772&t.flags)!=0;if((8772&t.subtreeFlags)!=0||n){n=a6.T,a6.T=null;var r=ib();iE(2);var a=uE;uE|=4;try{rv(e,t.alternate,t)}finally{uE=a,iE(r),a6.T=n}}uj=3}}function as(){if(4===uj||3===uj){uj=0;var e=uZ;uZ=null,lw();var t=uX,n=uq,r=uK,a=uQ,i=(0x13ffff00&r)===r?10262:10256;if((n.subtreeFlags&i)!=0||(n.flags&i)!=0?uj=5:(uj=0,uq=uX=null,au(t,t.pendingLanes)),0===(i=t.pendingLanes)&&(uW=null),y(r),n=n.stateNode,lO&&"function"==typeof lO.onCommitFiberRoot)try{lO.onCommitFiberRoot(lB,n,void 0,(128&n.current.flags)==128)}catch{}if(null!==a){n=a6.T,i=ib(),iE(2),a6.T=null;try{for(var o=t.onRecoverableError,l=0;l<a.length;l++){var s=a[l];o(s.value,{componentStack:s.stack})}}finally{a6.T=n,iE(i)}}if(a=uJ,o=u0,u0=null,null!==a&&(uJ=null,null===o&&(o=[]),null!==e))for(s=0;s<a.length;s++)void 0!==(n=(0,a[s])(o))&&ou(e,n);(3&uK)!=0&&ac(),ec(t),i=t.pendingLanes,(261930&r)!=0&&(42&i)!=0?t===u2?u1++:(u1=0,u2=t):(u1=0,u2=null),i_&&oQ(),ed(0,!1)}}function au(e,t){0==(e.pooledCacheLanes&=t)&&null!=(t=e.pooledCache)&&(e.pooledCache=null,el(t))}function ac(){return null!==uZ&&(os(uZ),uZ=null),ao(),al(),as(),ad()}function ad(){if(5!==uj)return!1;var e=uX,t=uY;uY=0;var n=y(uK),a=32>n?32:n;n=a6.T;var i=ib();try{iE(a),a6.T=null,a=u$,u$=null;var o=uX,l=uK;if(uj=0,uq=uX=null,uK=0,(6&uE)!=0)throw Error(r(331));var s=uE;if(uE|=4,rG(o.current),rD(o,o.current,l,a),uE=s,ed(0,!1),lO&&"function"==typeof lO.onPostCommitFiberRoot)try{lO.onPostCommitFiberRoot(lB,o)}catch{}return!0}finally{iE(i),a6.T=n,au(e,t)}}function af(e,t,n){t=D(n,t),t=no(e.stateNode,t,2),null!==(e=ez(e,t,2))&&(_(e,2),ec(e))}function ap(e,t,n){if(3===e.tag)af(e,e,n);else for(;null!==t;){if(3===t.tag){af(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===uW||!uW.has(r))){e=D(n,e),null!==(r=ez(t,n=nl(2),2))&&(ns(n,r,t,e),_(r,2),ec(r));break}}t=t.return}}function am(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new ux;var a=new Set;r.set(t,a)}else void 0===(a=r.get(t))&&(a=new Set,r.set(t,a));a.has(n)||(uw=!0,a.add(n),e=ah.bind(null,e,t,n),t.then(e,e))}function ah(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,ub===e&&(uM&n)===n&&((4===uU||3===uU&&(0x3c00000&uM)===uM&&300>lP()-uk)&&(2&uE)==0?r1(e,0):uN|=n,uF===uM&&(uF=0)),ec(e)}function ag(e,t){0===t&&(t=g()),null!==(e=eI(e,t))&&(_(e,t),ec(e))}function av(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),ag(e,n)}function a_(e,t){var n=0;switch(e.tag){case 31:case 13:var a=e.stateNode,i=e.memoizedState;null!==i&&(n=i.retryLane);break;case 19:a=e.stateNode;break;case 22:a=e.stateNode._retryCache;break;default:throw Error(r(314))}null!==a&&a.delete(t),ag(e,n)}function aS(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.t
389ype=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ax(e){return!(!(e=e.prototype)||!e.isReactComponent)}function aE(e,n){var r=e.alternate;return null===r?((r=t(e.tag,n,e.key,e.mode)).elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=n,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=0x47f00000&e.flags,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,n=e.dependencies,r.dependencies=null===n?null:{lanes:n.lanes,firstContext:n.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function ab(e,t){e.flags&=0x47f00002;var n=e.alternate;return null===n?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,e.dependencies=null===(t=n.dependencies)?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function aT(e,n,a,i,o,l){var s=0;if("function"==typeof(i=e))ax(i)&&(s=1);else if("string"==typeof i)s=o8&&ld?o9(e,a,l0.current)?26:lh(e)?27:5:o8?o9(e,a,l0.current)?26:5:ld&&lh(e)?27:5;else n:switch(i){case aQ:return(e=t(31,a,n,o)).elementType=aQ,e.lanes=l,e;case az:return aM(a.children,o,l,n);case aH:s=8,o|=24;break;case aV:return(e=t(12,a,n,2|o)).elementType=aV,e.lanes=l,e;case aq:return(e=t(13,a,n,o)).elementType=aq,e.lanes=l,e;case aK:return(e=t(19,a,n,o)).elementType=aK,e.lanes=l,e;case aZ:case a0:return(e=t(30,a,n,e=32|o)).elementType=a0,e.lanes=l,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if("object"==typeof i&&null!==i)switch(i.$$typeof){case aj:s=10;break n;case aW:s=9;break n;case aX:s=11;break n;case aY:s=14;break n;case a$:s=16,i=null;break n}s=29,a=Error(r(130,null===e?"null":typeof e,"")),i=null}return(n=t(s,a,n,o)).elementType=e,n.type=i,n.lanes=l,n}function aM(e,n,r,a){return(e=t(7,e,a,n)).lanes=r,e}function ay(e,n,r){return(e=t(6,e,null,n)).lanes=r,e}function aR(e){var n=t(18,null,null,0);return n.stateNode=e,n}function aC(e,n,r){return(n=t(4,null!==e.children?e.children:[],e.key,n)).lanes=r,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function aA(e,t,n,r,a,i,o,l,s){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=im,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=v(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=v(0),this.hiddenUpdates=v(null),this.identifierPrefix=r,this.onUncaughtError=a,this.onCaughtError=i,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=s,this.transitionTypes=null,this.incompleteTransitions=new Map}function aw(e,n,r,a,i,o,l,s,u,c,d,f){return e=new aA(e,n,r,l,u,c,d,f,s),n=1,!0===o&&(n|=24),o=t(3,null,null,n),e.current=o,o.stateNode=e,n=eo(),n.refCount++,e.pooledCache=n,n.refCount++,o.memoizedState={element:a,isDehydrated:r,cache:n},eO(o),e}function aP(e){var t=e._reactInternals;if(void 0===t)throw"function"==typeof e.render?Error(r(188)):Error(r(268,e=Object.keys(e).join(",")));return null===(e=null!==(e=o(t))?function e(t){var n=t.tag;if(5===n||26===n||27===n||6===n)return t;for(t=t.child;null!==t;){if(null!==(n=e(t)))return n;t=t.sibling}return null}(e):null)?null:ie(e.stateNode)}function aU(e,t,n,r,a,i){a=lS,null===r.context?r.context=a:r.pendingContext=a,(r=ek(t)).payload={element:n},null!==(i=void 0===i?null:i)&&(r.callback=i),null!==(n=ez(e,r,t))&&(rY(n,e,t),eH(n,e,t))}function aL(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function aD(e,t){aL(e,t),(e=e.alternate)&&aL(e,t)}var aN={},aI=x.default,aF=ne.default,aB=Object.assign,aO=Symbol.for("react.element"),aG=Symbol.for("react.transitional.element"),ak=Symbol.for("react.portal"),az=Symbol.for("react.fragment"),aH=Symbol.for("react.strict_mode"),aV=Symbol.for("react.profiler"),aW=Symbol.for("react.consumer"),aj=Symbol.for("react.context"),aX=Symbol.for("react.forward_ref"),aq=Symbol.for("react.suspense"),aK=Symbol.for("react.suspense_list"),aY=Symbol.for("react.memo"),a$=Symbol.for("react.lazy"),aQ=Symbol.for("react.activity"),aZ=Symbol.for("react.legacy_hidden"),aJ=Symbol.for("react.memo_cache_sentinel"),a0=Symbol.for("react.view_transition"),a1=Symbol.for("react.recoverable"),a2=Symbol.iterator,a3=Symbol.for("react.optimistic_key"),a4=Symbol.for("react.client.reference"),a5=Array.isArray,a6=aI.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,a8=e.rendererVersion,a9=e.rendererPackageName,a7=e.extraDevToolsConfig,ie=e.getPublicInstance,it=e.getRootHostContext,ir=e.getChildHostContext,ia=e.prepareForCommit,ii=e.resetAfterCommit,io=e.createInstance;e.cloneMutableInstance;var il=e.appendInitialChild,is=e.finalizeInitialChildren,iu=e.shouldSetTextContent,ic=e.createTextInstance;e.cloneMutableTextInstance;var id=e.scheduleTimeout,ip=e.cancelTimeout,im=e.noTimeout,ih=e.isPrimaryRenderer;e.warnsIfNotActing;var ig=e.supportsMutation,iv=e.supportsPersistence,i_=e.supportsHydration,iS=e.getInstanceFromNode;e.beforeActiveInstanceBlur;
389var ix=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var iE=e.setCurrentUpdatePriority,ib=e.getCurrentUpdatePriority,iT=e.resolveUpdatePriority;e.trackSchedulerEvent,e.resolveEventType,e.resolveEventTimeStamp;var iM=e.shouldAttemptEagerTransition,iy=e.detachDeletedInstance;e.requestPostPaintCallback;var iR=e.maySuspendCommit,iC=e.maySuspendCommitOnUpdate,iA=e.maySuspendCommitInSyncRender,iw=e.preloadInstance,iP=e.startSuspendingCommit,iU=e.suspendInstance,iL=e.suspendOnActiveViewTransition,iD=e.waitForCommitToBeReady;e.getSuspendedCommitReason;var iN=e.NotPendingTransition,iI=e.HostTransitionContext,iF=e.resetFormInstance;e.bindToConsole;var iB=e.supportsMicrotasks,iO=e.scheduleMicrotask,iG=e.supportsTestSelectors,ik=e.findFiberRoot,iz=e.getBoundingRect,iH=e.getTextContent,iV=e.isHiddenSubtree,iW=e.matchAccessibilityRole,ij=e.setFocusIfFocusable,iX=e.setupIntersectionObserver,iq=e.appendChild,iK=e.appendChildToContainer,iY=e.commitTextUpdate,i$=e.commitMount,iQ=e.commitUpdate,iZ=e.insertBefore,iJ=e.insertInContainerBefore,i0=e.removeChild,i1=e.removeChildFromContainer,i2=e.resetTextContent,i3=e.hideInstance,i4=e.hideTextInstance,i5=e.unhideInstance,i6=e.unhideTextInstance,i8=e.applyViewTransitionName,i9=e.restoreViewTransitionName,i7=e.cancelViewTransitionName,oe=e.cancelRootViewTransitionName,ot=e.restoreRootViewTransitionName;e.cloneRootViewTransitionContainer,e.removeRootViewTransitionClone;var on=e.measureInstance,or=e.measureClonedInstance,oa=e.wasInstanceInViewport,oi=e.hasInstanceChanged,oo=e.hasInstanceAffectedParent,ol=e.startViewTransition;e.startGestureTransition;var os=e.stopViewTransition,ou=e.addViewTransitionFinishedListener;e.getCurrentGestureOffset;var oc=e.createViewTransitionInstance,od=e.clearContainer,of=e.createFragmentInstance,op=e.updateFragmentInstanceFiber,om=e.commitNewChildToFragmentInstance,oh=e.deleteChildFromFragmentInstance,og=e.cloneInstance,ov=e.createContainerChildSet,o_=e.appendChildToContainerChildSet,oS=e.finalizeContainerChildren,ox=e.replaceContainerChildren,oE=e.cloneHiddenInstance,ob=e.cloneHiddenTextInstance,oT=e.isSuspenseInstancePending,oM=e.isSuspenseInstanceFallback,oy=e.getSuspenseInstanceFallbackErrorDetails,oR=e.registerSuspenseInstanceRetry,oC=e.canHydrateFormStateMarker,oA=e.isFormStateMarkerMatching,ow=e.getNextHydratableSibling,oP=e.getNextHydratableSiblingAfterSingleton,oU=e.getFirstHydratableChild,oL=e.getFirstHydratableChildWithinContainer,oD=e.getFirstHydratableChildWithinActivityInstance,oN=e.getFirstHydratableChildWithinSuspenseInstance,oI=e.getFirstHydratableChildWithinSingleton,oF=e.canHydrateInstance,oB=e.canHydrateTextInstance,oO=e.canHydrateActivityInstance,oG=e.canHydrateSuspenseInstance,ok=e.hydrateInstance,oz=e.hydrateTextInstance,oH=e.hydrateActivityInstance,oV=e.hydrateSuspenseInstance,oW=e.getNextHydratableInstanceAfterActivityInstance,oj=e.getNextHydratableInstanceAfterSuspenseInstance,oX=e.commitHydratedInstance,oq=e.commitHydratedContainer,oK=e.commitHydratedActivityInstance,oY=e.commitHydratedSuspenseInstance,o$=e.finalizeHydratedChildren,oQ=e.flushHydrationEvents;e.clearActivityBoundary;var oZ=e.clearSuspenseBoundary;e.clearActivityBoundaryFromContainer;var oJ=e.clearSuspenseBoundaryFromContainer,o0=e.hideDehydratedBoundary,o1=e.unhideDehydratedBoundary,o2=e.shouldDeleteUnhydratedTailInstances;e.diffHydratedPropsForDevWarnings,e.diffHydratedTextForDevWarnings,e.describeHydratableInstanceForDevWarnings;var o3,o4,o5=e.validateHydratableInstance,o6=e.validateHydratableTextInstance,o8=e.supportsResources,o9=e.isHostHoistableType,o7=e.getHoistableRoot,le=e.getResource,lt=e.acquireResource,ln=e.releaseResource,lr=e.hydrateHoistable,la=e.mountHoistable,li=e.unmountHoistable,lo=e.createHoistableInstance,ll=e.prepareToCommitHoistables,ls=e.mayResourceSuspendCommit,lu=e.preloadResource,lc=e.suspendResource,ld=e.supportsSingletons,lf=e.resolveSingletonInstance,lp=e.acquireSingletonInstance,lm=e.releaseSingletonInstance,lh=e.isHostSingletonType,lg=e.isSingletonScope,lv=[],l_=-1,lS={},lx=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(lE(e)/lb|0)|0},lE=Math.log,lb=Math.LN2,lT=256,lM=262144,ly=4194304,lR=aF.unstable_scheduleCallback,lC=aF.unstable_cancelCallback,lA=aF.unstable_shouldYield,lw=aF.unstable_requestPaint,lP=aF.unstable_now,lU=aF.unstable_ImmediatePriority,lL=aF.unstable_UserBlockingPriority,lD=aF.unstable_NormalPriority,lN=aF.unstable_IdlePriority,lI=aF.log,lF=aF.unstable_setDisableYieldValue,lB=null,lO=null,lG=0,lk="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},lz="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof S.default&&"function"==typeof S.default.emit)return void S.default.emit("uncaughtException",e);console.error(e)},lH=Object.prototype.hasOwnProperty,lV=!1,lW=new WeakMap,lj=[],lX=0,lq=null,lK=0,lY=[],l$=0,lQ=null,lZ=1,lJ="",l0=u(null),l1=u(null),l2=u(null),l3=u(null),l4=null,l5=null,l6=!1,l8=null,l9=!1,l7=Error(r(519)),se=u(null),st=null,sn=null,sr="u">typeof AbortController?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},sa=aF.unstable_scheduleCallback,si=aF.unstable_NormalPriority,so={$$typeof:aj,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},sl=null,ss=null,su=null,sc=!1,sd=!1,sf=!1,sp=0,sm=null,sh=0,sg=0,sv=null,s_=a6.S;a6.S=function(e,t){if(uz=lP(),"object"==typeof t&&null!==t&&"function"==typeof t.then&&function(e){if(null===sm){var t=sm=[];sh=0,sg=ev(),sv={status:"pending",value:void 0,then:function(e){t.push(e)}}}sh++,e.then(e_,e_)}(t),null!==sl)for(var n=ss;null!==n;)es(n,sl),n=n.next;if(null!=(n=e.types)){for(var r=ss;null!==r;)es(r,n),r=r.next;if(0!==sg){null===(r=sl)&&(r=sl=[]);for(var a=0;a<n.length;a++){var i=n[a];-1===r.indexOf(i)&&r.push(i)}}}null!==s_&&s_(e,t)};var sS=u(null),sx=Error(r(460)),sE=Error(r(474)),sb=Error(r(542)),sT={then:function(){}}
389,sM=null,sy=null,sR=0,sC=eU(!0),sA=eU(!1),sw=[],sP=0,sU=0,sL=!1,sD=!1,sN=u(null),sI=u(0),sF=u(null),sB=null,sO=u(0),sG=0,sk=null,sz=null,sH=null,sV=!1,sW=!1,sj=!1,sX=0,sq=0,sK=null,sY=0,s$={readContext:er,use:ts,useCallback:e5,useContext:e5,useEffect:e5,useImperativeHandle:e5,useLayoutEffect:e5,useInsertionEffect:e5,useMemo:e5,useReducer:e5,useRef:e5,useState:e5,useDebugValue:e5,useDeferredValue:e5,useTransition:e5,useSyncExternalStore:e5,useId:e5,useHostTransitionStatus:e5,useFormState:e5,useActionState:e5,useOptimistic:e5,useMemoCache:e5,useCacheRefresh:e5,useEffectEvent:e5},sQ={readContext:er,use:ts,useCallback:function(e,t){return ta().memoizedState=[e,void 0===t?null:t],e},useContext:er,useEffect:tO,useImperativeHandle:function(e,t,n){n=null!=n?n.concat([e]):null,tF(4194308,4,tV.bind(null,t,e),n)},useLayoutEffect:function(e,t){return tF(4194308,4,e,t)},useInsertionEffect:function(e,t){tF(4,2,e,t)},useMemo:function(e,t){var n=ta();t=void 0===t?null:t;var r=e();return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ta();if(void 0!==n)var a=n(t);else a=t;return r.memoizedState=r.baseState=a,r.queue=e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},e=e.dispatch=t2.bind(null,sk,e),[r.memoizedState,e]},useRef:function(e){return ta().memoizedState={current:e}},useState:function(e){var t=(e=tx(e)).queue,n=t3.bind(null,sk,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:tj,useDeferredValue:function(e,t){return tK(ta(),e,t)},useTransition:function(){var e=tx(!1);return e=t$.bind(null,sk,e.queue,!0,!1),ta().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var a=sk,i=ta();if(l6){if(void 0===n)throw Error(r(407));n=n()}else{if(n=t(),null===ub)throw Error(r(349));(127&uM)!=0||th(a,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,tO(tv.bind(null,a,o,e),[e]),a.flags|=2048,tN(9,{destroy:void 0},tg.bind(null,a,o,n,t),null),n},useId:function(){var e=ta(),t=ub.identifierPrefix;if(l6){var n=lJ,r=lZ;t="_"+t+"R_"+(n=(r&~(1<<32-lx(r)-1)).toString(32)+n),0<(n=sX++)&&(t+="H"+n.toString(32)),t+="_"}else t="_"+t+"r_"+(n=sY++).toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:tZ,useFormState:tw,useActionState:tw,useOptimistic:function(e){var t=ta();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=t5.bind(null,sk,!0,n),n.dispatch=t,[e,t]},useMemoCache:tu,useCacheRefresh:function(){return ta().memoizedState=t1.bind(null,sk)},useEffectEvent:function(e){var t=ta(),n={impl:e};return t.memoizedState=n,function(){if((2&uE)!=0)throw Error(r(440));return n.impl.apply(void 0,arguments)}}},sZ={readContext:er,use:ts,useCallback:tX,useContext:er,useEffect:tG,useImperativeHandle:tW,useInsertionEffect:tz,useLayoutEffect:tH,useMemo:tq,useReducer:td,useRef:tI,useState:function(){return td(tc)},useDebugValue:tj,useDeferredValue:function(e,t){return tY(ti(),sz.memoizedState,e,t)},useTransition:function(){var e=td(tc)[0],t=ti().memoizedState;return["boolean"==typeof e?e:tl(e),t]},useSyncExternalStore:tm,useId:tJ,useHostTransitionStatus:tZ,useFormState:tP,useActionState:tP,useOptimistic:function(e,t){return tE(ti(),sz,e,t)},useMemoCache:tu,useCacheRefresh:t0,useEffectEvent:tk},sJ={readContext:er,use:ts,useCallback:tX,useContext:er,useEffect:tG,useImperativeHandle:tW,useInsertionEffect:tz,useLayoutEffect:tH,useMemo:tq,useReducer:tp,useRef:tI,useState:function(){return tp(tc)},useDebugValue:tj,useDeferredValue:function(e,t){var n=ti();return null===sz?tK(n,e,t):tY(n,sz.memoizedState,e,t)},useTransition:function(){var e=tp(tc)[0],t=ti().memoizedState;return["boolean"==typeof e?e:tl(e),t]},useSyncExternalStore:tm,useId:tJ,useHostTransitionStatus:tZ,useFormState:tD,useActionState:tD,useOptimistic:function(e,t){var n=ti();return null!==sz?tE(n,sz,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:tu,useCacheRefresh:t0,useEffectEvent:tk},s0={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=rX(),a=ek(r);a.payload=t,null!=n&&(a.callback=n),null!==(t=ez(e,a,r))&&(rY(t,e,r),eH(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=rX(),a=ek(r);
389a.tag=1,a.payload=t,null!=n&&(a.callback=n),null!==(t=ez(e,a,r))&&(rY(t,e,r),eH(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=rX(),r=ek(n);r.tag=2,null!=t&&(r.callback=t),null!==(t=ez(e,r,n))&&(rY(t,e,n),eH(t,e,n))}},s1=Error(r(461)),s2=!1,s3={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},s4=!1,s5=!1,s6=null,s8=null,s9=0,s7=!1,ue=!1,ut=!1,un=!1,ur="function"==typeof WeakSet?WeakSet:Set,ua=null,ui=!1,uo=!1,ul=!1,us=!1,uu=null,uc=!1,ud=null,uf=8192,up={getCacheForType:function(e){var t=er(so),n=t.data.get(e);return void 0===n&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return er(so).controller.signal}},um=0,uh=1,ug=2,uv=3,u_=4;if("function"==typeof Symbol&&Symbol.for){var uS=Symbol.for;um=uS("selector.component"),uh=uS("selector.has_pseudo_class"),ug=uS("selector.role"),uv=uS("selector.test_id"),u_=uS("selector.text")}var ux="function"==typeof WeakMap?WeakMap:Map,uE=0,ub=null,uT=null,uM=0,uy=0,uR=null,uC=!1,uA=!1,uw=!1,uP=0,uU=0,uL=0,uD=0,uN=0,uI=0,uF=0,uB=null,uO=null,uG=!1,uk=0,uz=0,uH=1/0,uV=null,uW=null,uj=0,uX=null,uq=null,uK=0,uY=0,u$=null,uQ=null,uZ=null,uJ=null,u0=null,u1=0,u2=null;return aN.attemptContinuousHydration=function(e){if(13===e.tag||31===e.tag){var t=eI(e,0x4000000);null!==t&&rY(t,e,0x4000000),aD(e,0x4000000)}},aN.attemptHydrationAtCurrentPriority=function(e){if(13===e.tag||31===e.tag){var t=rX(),n=eI(e,t=M(t));null!==n&&rY(n,e,t),aD(e,t)}},aN.attemptSynchronousHydration=function(e){switch(e.tag){case 3:if((e=e.stateNode).current.memoizedState.isDehydrated){var t=f(e.pendingLanes);if(0!==t){for(e.pendingLanes|=2,e.entangledLanes|=2;t;){var n=1<<31-lx(t);e.entanglements[1]|=n,t&=~n}ec(e),(6&uE)==0&&(uH=lP()+500,ed(0,!1))}}break;case 31:case 13:null!==(t=eI(e,2))&&rY(t,e,2),rJ(),aD(e,2)}},aN.batchedUpdates=function(e,t){return e(t)},aN.createComponentSelector=function(e){return{$$typeof:um,value:e}},aN.createContainer=function(e,t,n,r,a,i,o,l,s,u){return aw(e,t,!1,null,n,r,i,null,o,l,s,u)},aN.createHasPseudoClassSelector=function(e){return{$$typeof:uh,value:e}},aN.createHydrationContainer=function(e,t,n,r,a,i,o,l,s,u,c,d,f,p){var m;return(e=aw(n,r,!0,e,a,i,l,p,s,u,c,d)).context=lS,n=e.current,(a=ek(r=M(r=rX()))).callback=null!=(m=t)?m:null,ez(n,a,r),t=r,e.current.lanes=t,_(e,t),ec(e),e},aN.createPortal=function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:ak,key:null==r?null:r===a3?a3:""+r,children:e,containerInfo:t,implementation:n}},aN.createRoleSelector=function(e){return{$$typeof:ug,value:e}},aN.createTestNameSelector=function(e){return{$$typeof:uv,value:e}},aN.createTextSelector=function(e){return{$$typeof:u_,value:e}},aN.defaultOnCaughtError=function(e){console.error(e)},aN.defaultOnRecoverableError=function(e){lz(e)},aN.defaultOnUncaughtError=function(e){lz(e)},aN.deferredUpdates=function(e){var t=a6.T,n=ib();try{return iE(32),a6.T=null,e()}finally{iE(n),a6.T=t}},aN.discreteUpdates=function(e,t,n,r,a){var i=a6.T,o=ib();try{return iE(2),a6.T=null,e(t,n,r,a)}finally{iE(o),a6.T=i,0===uE&&(uH=lP()+500)}},aN.findAllNodes=rj,aN.findBoundingRects=function(e,t){if(!iG)throw Error(r(363));t=rj(e,t),e=[];for(var n=0;n<t.length;n++)e.push(iz(t[n]));for(t=e.length-1;0<t;t--){n=e[t];for(var a=n.x,i=a+n.width,o=n.y,l=o+n.height,s=t-1;0<=s;s--)if(t!==s){var u=e[s],c=u.x,d=c+u.width,f=u.y,p=f+u.height;if(a>=c&&o>=f&&i<=d&&l<=p){e.splice(t,1);break}if(a!==c||n.width!==u.width||p<o||f>l){if(!(o!==f||n.height!==u.height||d<a||c>i)){c>a&&(u.width+=c-a,u.x=a),d<i&&(u.width=i-c),e.splice(t,1);break}}else{f>o&&(u.height+=f-o,u.y=o),p<l&&(u.height=l-f),e.splice(t,1);break}}}return e},aN.findHostInstance=aP,aN.findHostInstanceWithNoPortals=function(e){return null===(e=null!==(e=o(e))?function e(t){var n=t.tag;if(5===n||26===n||27===n||6===n)return t;for(t=t.child;null!==t;){if(4!==t.tag&&null!==(n=e(t)))return n;t=t.sibling}return null}(e):null)?null:ie(e.stateNode)},aN.findHostInstanceWithWarning=function(e){return aP(e)},aN.flushPassiveEffects=ac,aN.flushSyncFromReconciler=function(e){var t=uE;uE|=1;var n=a6.T,r=ib();try{if(iE(2),a6.T=null,e)return e()}finally{iE(r),a6.T=n,(6&(uE=t))==0&&ed(0,!1)}},aN.flushSyncWork=rJ,aN.focusWithin=function(e,t){if(!iG)throw Error(r(363));for(t=Array.from(t=rW(e=rz(e),t)),e=0;e<t.length;){var n=t[e++],a=n.tag;if(!iV(n)){if((5===a||26===a||27===a)&&ij(n.stateNode))return!0;for(n=n.child;null!==n;)t.push(n),n=n.sibling}}return!1},aN.getFindAllNodesFailureDescription=function(e,t){if(!iG)throw Error(r(363));var n=0,a=[];e=[rz(e),0];for(var i=0;i<e.length;){var o=e[i++],l=o.tag,s=e[i++],u=t[s];if((5!==l&&26!==l&&27!==l||!iV(o))&&(rH(o,u)&&(a.push(rV(u)),++s>n&&(n=s)),s<t.length))for(o=o.child;null!==o;)e.push(o,s),o=o.sibling}if(n<t.length){for(e=[];n<t.length;n++)e.push(rV(t[n]));return`findAllNodes was able to match part of the selector: 390 `+a.join(" > ")+` 391 392No matching component was found for: 393 `+e.join(" > ")}return null},aN.getPublicRootInstance=function(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 27:case 5:return ie(e.child.stateNode);default:return e.child.stateNode}},aN.injectIntoDevTools=function(){var e={bundleType:0,version:a8,rendererPackageName:a9,currentDispatcherRef:a6,reconcilerVersion:"19.3.0"};if(null!==a7&&(e.rendererConfig=a7),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;
393if(t.isDisabled||!t.supportsFiber)e=!0;else{try{lB=t.inject(e),lO=t}catch{}e=!!t.checkDCE}}return e},aN.isAlreadyRendering=function(){return(6&uE)!=0},aN.observeVisibleRects=function(e,t,n,a){if(!iG)throw Error(r(363));var i=iX(e=rj(e,t),n,a).disconnect;return{disconnect:function(){i()}}},aN.shouldError=function(){return null},aN.shouldSuspend=function(){return!1},aN.startHostTransition=function(e,t,a,i){if(5!==e.tag)throw Error(r(476));var o=tQ(e).queue;t$(e,o,t,iN,null===a?n:function(){var t=tQ(e);return null===t.next&&(t=e.alternate.memoizedState),t4(e,t.next.queue,{},rX()),a(i)})},aN.updateContainer=function(e,t,n,r){var a=t.current,i=rX();return aU(a,i,e,t,n,r),i},aN.updateContainerSync=function(e,t,n,r){return aU(t.current,2,e,t,n,r),2},aN},nK.exports.default=nK.exports,Object.defineProperty(nK.exports,"__esModule",{value:!0})),nq.exports=nK.exports),(h=nq.exports)&&h.__esModule&&Object.prototype.hasOwnProperty.call(h,"default"))?h.default:h,n$={},nQ=/^three(?=[A-Z])/,nZ=e=>`${e[0].toUpperCase()}${e.slice(1)}`,nJ=0;function n0(e){if("function"==typeof e){let t=`${nJ++}`;return n$[t]=e,t}Object.assign(n$,e)}function n1(e,t){let n=nZ(e),r=n$[n];if("primitive"!==e&&!r)throw Error(`R3F: ${n} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if("primitive"===e&&!t.object)throw Error("R3F: Primitives without 'object' are invalid!");if(void 0!==t.args&&!Array.isArray(t.args))throw Error("R3F: The args prop must be an array!")}function n2(e){if(e.isHidden){var t,n;e.props.attach&&null!=(t=e.parent)&&t.object?nR(e.parent,e):nN(e.object)&&(e.object.visible=null==(n=e.previousVisible)||n),e.previousVisible=void 0,e.isHidden=!1,nD(e)}}function n3(e,t,n){let r=t.root.getState();if(e.parent||e.object===r.scene){if(!t.object){var a,i;let e=n$[nZ(t.type)];t.object=null!=(a=t.props.object)?a:new e(...null!=(i=t.props.args
393)?i:[]),t.object.__r3f=t}if(nL(t.object,t.props),t.props.attach)nR(e,t);else if(nN(t.object)&&nN(e.object)){let r=e.object.children.indexOf(null==n?void 0:n.object);if(n&&-1!==r){let n=e.object.children.indexOf(t.object);-1!==n?(e.object.children.splice(n,1),e.object.children.splice(n<r?r-1:r,0,t.object)):(t.object.parent=e.object,e.object.children.splice(r,0,t.object),t.object.dispatchEvent({type:"added"}),e.object.dispatchEvent({type:"childadded",child:t.object}))}else e.object.add(t.object)}for(let e of t.children)n3(t,e);nD(t)}}function n4(e,t){if(t){if(t.parent===e){let n=e.children.indexOf(t);-1!==n&&e.children.splice(n,1)}t.parent=e,e.children.push(t),n3(e,t)}}function n5(e,t,n){if(!t||!n)return;if(t.parent===e){let n=e.children.indexOf(t);-1!==n&&e.children.splice(n,1)}t.parent=e;let r=e.children.indexOf(n);-1!==r?e.children.splice(r,0,t):e.children.push(t),n3(e,t,n)}function n6(e){if("function"==typeof e.dispose){let t=()=>{try{e.dispose()}catch{}};"u">typeof IS_REACT_ACT_ENVIRONMENT?t():(0,ne.unstable_scheduleCallback)(ne.unstable_IdlePriority,t)}}function n8(e,t,n){if(!t)return;t.parent=null;let r=e.children.indexOf(t);-1!==r&&e.children.splice(r,1),t.props.attach?nC(e,t):nN(t.object)&&nN(e.object)&&(e.object.remove(t.object),function(e,t){let{internal:n}=e.getState();n.interaction=n.interaction.filter(e=>e!==t),n.initialHits=n.initialHits.filter(e=>e!==t),n.hovered.forEach((e,r)=>{(e.eventObject===t||e.object===t)&&n.hovered.delete(r)}),n.capturedMap.forEach((e,r)=>{nF(n.capturedMap,t,e,r)})}(nu(t),t.object));let a=null!==t.props.dispose&&!1!==n;for(let e=t.children.length-1;e>=0;e--){let n=t.children[e];n8(t,n,a)}t.children.length=0,delete t.object.__r3f,a&&"primitive"!==t.type&&"Scene"!==t.object.type&&n6(t.object),void 0===n&&nD(t)}let n9=[],n7=()=>{},re={},rt=0,rn=((u=nY({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:function(e,t,n){var r;
393return n1(e=nZ(e)in n$?e:e.replace(nQ,""),t),"primitive"===e&&null!=(r=t.object)&&r.__r3f&&delete t.object.__r3f,nT(t.object,n,e,t)},removeChild:n8,appendChild:n4,appendInitialChild:n4,insertBefore:n5,appendChildToContainer(e,t){let n=e.getState().scene.__r3f;t&&n&&n4(n,t)},removeChildFromContainer(e,t){let n=e.getState().scene.__r3f;t&&n&&n8(n,t)},insertInContainerBefore(e,t,n){let r=e.getState().scene.__r3f;t&&n&&r&&n5(r,t,n)},getRootHostContext:()=>re,getChildHostContext:()=>re,commitUpdate(e,t,n,r,a){var i,o,l;n1(t,r);let s=!1;if("primitive"===e.type&&n.object!==r.object||(null==(i=r.args)?void 0:i.length)!==(null==(o=n.args)?void 0:o.length)?s=!0:null!=(l=r.args)&&l.some((e,t)=>{var r;return e!==(null==(r=n.args)?void 0:r[t])})&&(s=!0),s)n9.push([e,nb(r),a]);else{let t=function(e,t){let n={};for(let r in t)if(!nA.includes(r)&&!nx.equ(t[r],e.props[r]))for(let e in n[r]=t[r],t)e.startsWith(`${r}-`)&&(n[e]=t[e]);for(let r in e.props){if(nA.includes(r)||t.hasOwnProperty(r))continue;let{root:a,key:i}=nM(e.object,r);if(a.constructor&&0===a.constructor.length){let e=function(e){let t=nw.get(e.constructor);try{t||(t=new e.constructor,nw.set(e.constructor,t))}catch(e){}return t}(a);nx.und(e)||(n[r]=e[i])}else n[r]=0}return n}(e,r),n=e.props.attach;e.props=nb(r),void 0!==n?e.props.attach=n:delete e.props.attach,Object.keys(t).length&&nL(e.object,t)}},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:e=>null==e?void 0:e.object,prepareForCommit:()=>null,preparePortalMount:e=>nT(e.getState().scene,e,"",{}),resetAfterCommit:function(){if(0!==n9.length)try{!function(){for(let[e]of n9){let t=e.parent;if(t)for(let n of(e.props.attach?nC(t,e):nN(e.object)&&nN(t.object)&&t.object.remove(e.object),e.children))n.props.attach?nC(e,n):nN(n.object)&&nN(e.object)&&e.object.remove(n.object);e.isHidden&&n2(e),e.object.__r3f&&delete e.object.__r3f,"primitive"!==e.type&&n6(e.object)}for(let[r,a,i]of n9){r.props=a;let o=r.parent;if(o){let a=n$[nZ(r.type)],l=r.object;r.object=null!=(e=r.props.object)?e:new a(...null!=(t=r.props.args
393)?t:[]),r.object.__r3f=r;var e,t,n=r.object;for(let e of[i,i.alternate])if(null!==e)if("function"==typeof e.ref){null==e.refCleanup||e.refCleanup();let t=e.ref(n);"function"==typeof t&&(e.refCleanup=t)}else e.ref&&(e.ref.current=n);for(let e of(!function(e,t,n){let{internal:r}=e.getState();for(let e=0;e<r.interaction.length;e++)r.interaction[e]===t&&(r.interaction[e]=n);for(let e=0;e<r.initialHits.length;e++)r.initialHits[e]===t&&(r.initialHits[e]=n);r.hovered.forEach((e,a)=>{if(e.eventObject===t||e.object===t){r.hovered.delete(a);let i={...e,eventObject:e.eventObject===t?n:e.eventObject,object:e.object===t?n:e.object};r.hovered.set(nI(i),i)}}),r.capturedMap.forEach(e=>{let r=e.get(t);r&&(e.delete(t),e.set(n,r))})}(nu(r),l,r.object),nL(r.object,r.props),r.props.attach?nR(o,r):nN(r.object)&&nN(o.object)&&o.object.add(r.object),r.children))e.props.attach?nR(r,e):nN(e.object)&&nN(r.object)&&r.object.add(e.object);nD(r)}}}()}finally{n9.length=0}},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:function(e){if(!e.isHidden){var t;e.props.attach&&null!=(t=e.parent)&&t.object?nC(e.parent,e):nN(e.object)&&(e.previousVisible=e.object.visible,e.object.visible=!1),e.isHidden=!0,nD(e)}},unhideInstance:n2,createTextInstance:n7,hideTextInstance:n7,unhideTextInstance:n7,supportsMicrotasks:!0,scheduleMicrotask:function(e){"function"==typeof queueMicrotask?queueMicrotask(e):"u">typeof Promise?Promise.resolve().then(e).catch(e=>{setTimeout(()=>{throw e})}):setTimeout(e)},scheduleTimeout:"function"==typeof setTimeout?setTimeout:void 0,cancelTimeout:"function"==typeof clearTimeout?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:x.createContext(null),setCurrentUpdatePriority(e){rt=e},getCurrentUpdatePriority:()=>rt,resolveUpdatePriority(){var e;if(0!==rt)return rt;let t="u">typeof window?null==(e=window.event)?void 0:e.type:void 0;if(void 0===t)return 32;switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch((0,ne.unstable_getCurrentPriorityLevel)()){case ne.unstable_ImmediatePriority:return 2;case ne.unstable_UserBlockingPriority:return 8;case ne.unstable_NormalPriority:case ne.unstable_LowPriority:return 32;case ne.unstable_IdlePriority:return 0x10000000;default:return 32}default:return 32}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:"9.8.1",applyViewTransitionName(e,t,n){},restoreViewTransitionName(e,t){},cancelViewTransitionName(e,t,n){},cancelRootViewTransitionName(e){},restoreRootViewTransitionName(e){},InstanceMeasurement:null,measureInstance:e=>null,wasInstanceInViewport:e=>!0,hasInstanceChanged:(e,t)=>!1,hasInstanceAffectedParent:(e,t)=>!1,suspendOnActiveViewTransition(e,t){},startViewTransition:(e,t,n,r,a,i,o,l,s,u,c)=>(r(),a(),null==c||c(),o(),null),startGestureTransition:(e,t,n,r,a,i,o,l,s,u)=>(o(),l(),null==u||u(),null),stopViewTransition(e){},addViewTransitionFinishedListener(e,t){t()},createViewTransitionInstance:e=>null,getCurrentGestureOffset(e){throw Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance:(e,t)=>e,cloneMutableTextInstance:e=>e,cloneRootViewTransitionContainer(e){throw Error("Not implemented.")},removeRootViewTransitionClone(e,t){throw Error("Not implemented.")},createFragmentInstance:e=>null,updateFragmentInstanceFiber(e,t){},commitNewChildToFragmentInstance(e,t){},deleteChildFromFragmentInstance(e,t){},measureClonedInstance:e=>
393null,maySuspendCommitOnUpdate:(e,t,n)=>!1,maySuspendCommitInSyncRender:(e,t)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(e,t)=>null})).injectIntoDevTools(),u),rr=new Map;function ra(e,t){let n=e.state;switch(t.type){case"use":if("disposed"===n.status)return!1;return e.state={status:"open"},!0;case"unmount":if("disposed"===n.status)return!1;return e.state={status:"closing",token:t.token},!0;case"dispose":if("closing"!==n.status||n.token!==t.token)return!1;return e.state={status:"disposed"},!0}}function ri({store:e,children:t,onCreated:n,rootElement:r}){return nd(()=>{let t=e.getState();t.set(e=>({internal:{...e.internal,active:!0}})),n&&n(t),e.getState().events.connected||null==t.events.connect||t.events.connect(r)},[]),(0,_.jsx)(nO.Provider,{value:e,children:t})}function ro(e){try{return e()}catch(e){console.warn("[R3F] Error while unmounting root; teardown may be incomplete:",e)}}let rl=new Set,rs=new Set,ru=new Set;function rc(e,t){if(e.size)for(let{callback:n}of e.values())n(t)}function rd(e,t){switch(e){case"before":return rc(rl,t);case"after":return rc(rs,t);case"tail":return rc(ru,t)}}function rf(e,r,a){let i=r.clock.getDelta();"never"===r.frameloop&&"number"==typeof e&&(i=e-r.clock.elapsedTime,r.clock.oldTime=r.clock.elapsedTime,r.clock.elapsedTime=e),t=r.internal.subscribers;for(let e=0;e<t.length;e++)(n=t[e]).ref.current(n.store.getState(),i,a);return!r.internal.priority&&r.gl.render&&r.gl.render(r.scene,r.camera),r.internal.frames=Math.max(0,r.internal.frames-1),"always"===r.frameloop?1:r.internal.frames}let rp=!1,rm=!1;function rh(e){for(let n of(a=requestAnimationFrame(rh),rp=!0,r=0,rd("before",e),rm=!0,rr.values())){var t;(i=n.store.getState()).internal.active&&("always"===i.frameloop||i.internal.frames>0)&&!(null!=(t=i.gl.xr)&&t.isPresenting)&&(r+=rf(e,i))}if(rm=!1,rd("after",e),0===r)return rd("tail",e),rp=!1,cancelAnimationFrame(a)}function rg(e,t=1){var n;if(!e)return rr.forEach(e=>rg(e.store.getState(),t));(null==(n=e.gl.xr)||!n.isPresenting)&&e.internal.active&&"never"!==e.frameloop&&(t>1?e.internal.frames=Math.min(60,e.internal.frames+t):rm?e.internal.frames=2:e.internal.frames=1,rp||(rp=!0,requestAnimationFrame(rh)))}function rv(e,t=!0,n,r){if(t&&rd("before",e),n)rf(e,n,r);else for(let t of rr.values())rf(e,t.store.getState());t&&rd("after",e)}let r_={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function rS(e){let{handlePointer:t}=function(e){function t(e){return e.filter(e=>["Move","Over","Enter","Out","Leave"].some(t=>{var n;return null==(n=e.__r3f)?void 0:n.handlers["onPointer"+t]}))}function n(t){let{internal:n}=e.getState();for(let e of n.hovered.values())if(!t.length||!t.find(t=>t.object===e.object&&t.index===e.index&&t.instanceId===e.instanceId)){let r=e.eventObject.__r3f;if(n.hovered.delete(nI(e)),null!=r&&r.eventCount){let n=r.handlers,a={...e,intersections:t};null==n.onPointerOut||n.onPointerOut(a),null==n.onPointerLeave||n.onPointerLeave(a)}}}function r(e,t){for(let n=0;n<t.length;n++){let r=t[n].__r3f;null==r||null==r.handlers.onPointerMissed||r.handlers.onPointerMissed(e)}}return{handlePointer:function(a){switch(a){case"onPointerLeave":case"onPointerCancel":return()=>n([]);case"onLostPointerCapture":return t=>{let{internal:r}=e.getState();"pointerId"in t&&r.capturedMap.has(t.pointerId)&&requestAnimationFrame(()=>{r.capturedMap.has(t.pointerId)&&(r.capturedMap.delete(t.pointerId),n([]))})}}return function(i){let{onPointerMissed:o,internal:l}=e.getState();l.lastEvent.current=i;let s="onPointerMove"===a,u="onClick"===a||"onContextMenu"===a||"onDoubleClick"===a,c=function(t,n){let r=e.getState(),a=new Set,i=[],o=n?n(r.internal.interaction):r.internal.interaction;for(let e=0;e<o.length;e++){let t=nS(o[e]);t&&(t.raycaster.camera=void 0)}r.previousRoot||null==r.events.compute||r.events.compute(t,r);let l=o.flatMap(function(e){let n=nS(e);if(!n||!n.events.enabled||null===n.raycaster.camera)return[];if(void 0===n.raycaster.camera){var r;null==n.events.compute||n.events.compute(t,n,null==(r=n.previousRoot)?void 0:r.getState()),void 0===n.raycaster.camera&&(n.raycaster.camera=null)}return n.raycaster.camera?n.raycaster.intersectObject(e,!0):[]}).sort((e,t)=>
393{let n=nS(e.object),r=nS(t.object);return n&&r&&r.events.priority-n.events.priority||e.distance-t.distance}).filter(e=>{let t=nI(e);return!a.has(t)&&(a.add(t),!0)});for(let e of(r.events.filter&&(l=r.events.filter(l,r)),l)){let t=e.object;for(;t;){var s;null!=(s=t.__r3f)&&s.eventCount&&i.push({...e,eventObject:t}),t=t.parent}}if("pointerId"in t&&r.internal.capturedMap.has(t.pointerId))for(let e of r.internal.capturedMap.get(t.pointerId).values())a.has(nI(e.intersection))||i.push(e.intersection);return i}(i,s?t:void 0),d=u?function(t){let{internal:n}=e.getState(),r=t.offsetX-n.initialClick[0],a=t.offsetY-n.initialClick[1];return Math.round(Math.sqrt(r*r+a*a))}(i):0;"onPointerDown"===a&&(l.initialClick=[i.offsetX,i.offsetY],l.initialHits=c.map(e=>e.eventObject)),u&&!c.length&&d<=2&&(r(i,l.interaction),o&&o(i)),s&&n(c),!function(e,t,r,a){if(e.length){let i={stopped:!1};for(let o of e){let l=nS(o.object);if(l||o.object.traverseAncestors(e=>{let t=nS(e);if(t)return l=t,!1}),l){let{raycaster:s,pointer:u,camera:c,internal:d}=l,f=new E.Vector3(u.x,u.y,0).unproject(c),p=e=>{var t,n;return null!=(t=null==(n=d.capturedMap.get(e))?void 0:n.has(o.eventObject))&&t},m=e=>{let n={intersection:o,target:t.target};d.capturedMap.has(e)?d.capturedMap.get(e).set(o.eventObject,n):d.capturedMap.set(e,new Map([[o.eventObject,n]])),t.target.setPointerCapture(e)},h=e=>{let t=d.capturedMap.get(e);t&&nF(d.capturedMap,o.eventObject,t,e)},g={};for(let e in t){let n=t[e];"function"!=typeof n&&(g[e]=n)}let v={...o,...g,pointer:u,intersections:e,stopped:i.stopped,delta:r,unprojectedPoint:f,ray:s.ray,camera:c,stopPropagation(){let r="pointerId"in t&&d.capturedMap.get(t.pointerId);(!r||r.has(o.eventObject))&&(v.stopped=i.stopped=!0,d.hovered.size&&Array.from(d.hovered.values()).find(e=>e.eventObject===o.eventObject)&&n([...e.slice(0,e.indexOf(o)),o]))},target:{hasPointerCapture:p,setPointerCapture:m,releasePointerCapture:h},currentTarget:{hasPointerCapture:p,setPointerCapture:m,releasePointerCapture:h},nativeEvent:t};if(a(v),!0===i.stopped)break}}}}(c,i,d,function(e){let t=e.eventObject,n=t.__r3f;if(!(null!=n&&n.eventCount))return;let o=n.handlers;if(s){if(o.onPointerOver||o.onPointerEnter||o.onPointerOut||o.onPointerLeave){let t=nI(e),n=l.hovered.get(t);n?n.stopped&&e.stopPropagation():(l.hovered.set(t,e),null==o.onPointerOver||o.onPointerOver(e),null==o.onPointerEnter||o.onPointerEnter(e))}null==o.onPointerMove||o.onPointerMove(e)}else{let n=o[a];n?(!u||l.initialHits.includes(t))&&(r(i,l.interaction.filter(e=>!l.initialHits.includes(e))),n(e)):u&&l.initialHits.includes(t)&&r(i,l.interaction.filter(e=>!l.initialHits.includes(e)))}})}}}}(e);return{priority:1,enabled:!0,compute(e,t,n){t.pointer.set(e.offsetX/t.size.width*2-1,-(2*(e.offsetY/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)},connected:void 0,handlers:Object.keys(r_).reduce((e,n)=>({...e,[n]:t(n)}),{}),update:()=>{var t;let{events:n,internal:r}=e.getState();null!=(t=r.lastEvent)&&t.current&&n.handlers&&n.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{let{set:n,events:r}=e.getState();if(null==r.disconnect||r.disconnect(),n(e=>({events:{...e.events,connected:t}})),r.handlers)for(let e in r.handlers){let n=r.handlers[e],[a,i]=r_[e];t.addEventListener(a,n,{passive:i})}},disconnect:()=>{let{set:t,events:n}=e.getState();if(n.connected){if(n.handlers)for(let e in n.handlers){let t=n.handlers[e],[r]=r_[e];n.connected.removeEventListener(r,t)}t(e=>({events:{...e.events,connected:void 0}}))}}}}e.i(8560),e.s(["ACESFilmicToneMapping",()=>E.ACESFilmicToneMapping,"AddEquation",()=>E.AddEquation,"AddOperation",()=>E.AddOperation,"AdditiveAnimationBlendMode",()=>E.AdditiveAnimationBlendMode,"AdditiveBlending",()=>E.AdditiveBlending,"AgXToneMapping",()=>E.AgXToneMapping,"AlphaFormat",()=>E.AlphaFormat,"AlwaysCompare",()=>E.AlwaysCompare,"AlwaysDepth",()=>E.AlwaysDepth,"AlwaysStencilFunc",()=>E.AlwaysStencilFunc,"AmbientLight",()=>E.AmbientLight,"AnimationAction",()=>E.AnimationAction,"AnimationClip",()=>E.AnimationClip,"AnimationLoader",()=>E.AnimationLoader,"AnimationMixer",()=>E.AnimationMixer,"AnimationObjectGroup",()=>E.AnimationObjectGroup,"AnimationUtils",()=>E.AnimationUtils,"ArcCurve",()=>E.ArcCurve,"ArrayCamera",()=>E.ArrayCamera,"ArrowHelper",()=>E.ArrowHelper,"AttachedBindMode",()=>E.AttachedBindMode,"Audio",()=>E.Audio,"AudioAnalyser",()=>E.AudioAnalyser,"AudioContext",()=>E.AudioContext,"AudioListener",()=>E.AudioListener,"AudioLoader",()=>E.AudioLoader,"AxesHelper",()=>E.AxesHelper,"BackSide",()=>E.BackSide,"BasicDepthPacking",()=>E.BasicDepthPacking,"BasicShadowMap",()=>E.BasicShadowMap,"BatchedMesh",()=>E.BatchedMesh,"BezierInterpolant",()=>E.BezierInterpolant,"Bone",()=>E.Bone,"BooleanKeyframeTrack",()=>E.BooleanKeyframeTrack,"Box2",()=>E.Box2,"Box3",()=>E.Box3,"Box3Helper",()=>E.Box3Helper,"BoxGeometry",()=>E.BoxGeometry,"BoxHelper",()=>E.BoxHelper,"BufferAttribute",()=>E.BufferAttribute,"BufferGeometry",()=>E.BufferGeometry,"BufferGeometryLoader",()=>E.BufferGeometryLoader,"ByteType",()=>E.ByteType,"Cache",()=>E.Cache,"Camera",()=>E.Camera,"CameraHelper",()=>E.CameraHelper,"CanvasTexture",()=>E.CanvasTexture,"CapsuleGeometry",()=>E.CapsuleGeometry,"CatmullRomCurve3",()=>E.CatmullRomCurve3,"CineonToneMapping",()=>E.CineonToneMapping,"CircleGeometry",()=>E.CircleGeometry,"ClampToEdgeWrapping",()=>E.ClampToEdgeWrapping,"Clock",()=>E.Clock,"Color",()=>E.Color,"ColorKeyframeTrack",()=>E.ColorKeyframeTrack,"ColorManagement",()=>E.ColorManagement,"Compatibility",()=>E.Compatibility,"CompressedArrayTexture",()=>E.CompressedArrayTexture,"CompressedCubeTexture",()=>E.CompressedCubeTexture,"CompressedTexture",()=>E.CompressedTexture,"CompressedTextureLoader",()=>E.CompressedTextureLoader,"ConeGeometry",()=>E.ConeGeometry,"ConstantAlphaFactor",()=>E.ConstantAlphaFactor,"ConstantColorFactor",()=>E.ConstantColorFactor,"Controls",()=>E.Controls,"CubeCamera",()=>E.CubeCamera,"CubeDepthTexture",()=>E.CubeDepthTexture,"CubeReflectionMapping",()=>E.CubeReflectionMapping,"CubeRefractionMapping",()=>E.CubeRefractionMapping,"CubeTexture",()=>E.CubeTexture,"CubeTextureLoader",()=>E.CubeTextureLoader,"CubeUVReflectionMapping",()=>E.CubeUVReflectionMapping,"CubicBezierCurve",()=>E.CubicBezierCurve,"CubicBezierCurve3",()=>E.CubicBezierCurve3,"CubicInterpolant",()=>E.CubicInterpolant,"CullFaceBack",()=>E.CullFaceBack,"CullFaceFront",()=>E.CullFaceFront,"CullFaceFrontBack",()=>E.CullFaceFrontBack,"CullFaceNone",()=>E.CullFaceNone,"Curve",()=>E.Curve,"CurvePath",()=>E.CurvePath,"CustomBlending",()=>E.CustomBlending,"CustomToneMapping",()=>E.CustomToneMapping,"CylinderGeometry",()=>E.CylinderGeometry,"Cylindrical",()=>E.Cylindrical,"Data3DTexture",()=>E.Data3DTexture,"DataArrayTexture",()=>E.DataArrayTexture,"DataTexture",()=>E.DataTexture,"DataTextureLoader",()=>E.DataTextureLoader,"DataUtils",()=>E.DataUtils,"DecrementStencilOp",()=>E.DecrementStencilOp,"DecrementWrapStencilOp",()=>E.DecrementWrapStencilOp,"DefaultLoadingManager",()=>E.DefaultLoadingManager,"DepthFormat",()=>E.DepthFormat,"DepthStencilFormat",()=>E.DepthStencilFormat,"DepthTexture",()=>E.DepthTexture,"DetachedBindMode",()=>E.DetachedBindMode,"DirectionalLight",()=>E.DirectionalLight,"DirectionalLightHelper",()=>E.DirectionalLightHelper,"DiscreteInterpolant",()=>E.DiscreteInterpolant,"DodecahedronGeometry",()=>E.DodecahedronGeometry,"DoubleSide",()=>E.DoubleSide,"DstAlphaFactor",()=>E.DstAlphaFactor,"DstColorFactor",()=>E.DstColorFactor,"DynamicCopyUsage",()=>E.DynamicCopyUsage,"DynamicDrawUsage",()=>E.DynamicDrawUsage,"DynamicReadUsage",()=>E.DynamicReadUsage,"EdgesGeometry",()=>E.EdgesGeometry,"EllipseCurve",()=>E.EllipseCurve,"EqualCompare",()=>E.EqualCompare,"EqualDepth",()=>E.EqualDepth,"EqualStencilFunc",()=>E.EqualStencilFunc,"EquirectangularReflectionMapping",()=>E.EquirectangularReflectionMapping,"EquirectangularRefractionMapping",()=>E.EquirectangularRefractionMapping,"Euler",()=>E.Euler,"EventDispatcher",()=>E.EventDispatcher,"ExternalTexture",()=>E.ExternalTexture,"ExtrudeGeometry",()=>E.ExtrudeGeometry,"FileLoader",()=>E.FileLoader,"Float16BufferAttribute",()=>E.Float16BufferAttribute,"Float32BufferAttribute",()=>E.Float32BufferAttribute,"FloatType",()=>E.FloatType,"Fog",()=>E.Fog,"FogExp2",()=>E.FogExp2,"FramebufferTexture",()=>E.FramebufferTexture,"FrontSide",()=>E.FrontSide,"Frustum",()=>E.Frustum,"FrustumArray",()=>E.FrustumArray,"GLBufferAttribute",()=>E.GLBufferAttribute,"GLSL1",()=>E.GLSL1,"GLSL3",()=>E.GLSL3,"GreaterCompare",()=>E.GreaterCompare,"GreaterDepth",()=>E.GreaterDepth,"GreaterEqualCompare",()=>E.GreaterEqualCompare,"GreaterEqualDepth",()=>E.GreaterEqualDepth,"GreaterEqualStencilFunc",()=>E.GreaterEqualStencilFunc,"GreaterStencilFunc",()=>E.GreaterStencilFunc,"GridHelper",()=>E.GridHelper,"Group",()=>E.Group,"HTMLTexture",()=>E.HTMLTexture,"HalfFloatType",()=>E.HalfFloatType,"HemisphereLight",()=>E.HemisphereLight,"HemisphereLightHelper",()=>E.HemisphereLightHelper,"IcosahedronGeometry",()=>E.IcosahedronGeometry,"ImageBitmapLoader",()=>E.ImageBitmapLoader,"ImageLoader",()=>E.ImageLoader,"ImageUtils",()=>E.ImageUtils,"IncrementStencilOp",()=>E.IncrementStencilOp,"IncrementWrapStencilOp",()=>E.IncrementWrapStencilOp,"InstancedBufferAttribute",()=>E.InstancedBufferAttribute,"InstancedBufferGeometry",()=>E.InstancedBufferGeometry,"InstancedInterleavedBuffer",()=>E.InstancedInterleavedBuffer,"InstancedMesh",()=>E.InstancedMesh,"Int16BufferAttribute",()=>E.Int16BufferAttribute,"Int32BufferAttribute",()=>E.Int32BufferAttribute,"Int8BufferAttribute",()=>E.Int8BufferAttribute,"IntType",()=>E.IntType,"InterleavedBuffer",()=>E.InterleavedBuffer,"InterleavedBufferAttribute",()=>E.InterleavedBufferAttribute,"Interpolant",()=>E.Interpolant,"InterpolateBezier",()=>E.InterpolateBezier,"InterpolateDiscrete",()=>E.InterpolateDiscrete,"InterpolateLinear",()=>E.InterpolateLinear,"InterpolateSmooth",()=>E.InterpolateSmooth,"InterpolationSamplingMode",()=>E.InterpolationSamplingMode,"InterpolationSamplingType",()=>E.InterpolationSamplingType,"InvertStencilOp",()=>E.InvertStencilOp,"KeepStencilOp",()=>E.KeepStencilOp,"KeyframeTrack",()=>E.KeyframeTrack,"LOD",()=>E.LOD,"LatheGeometry",()=>E.LatheGeometry,"Layers",()=>E.Layers,"LessCompare",()=>E.LessCompare,"LessDepth",()=>E.LessDepth,"LessEqualCompare",()=>E.LessEqualCompare,"LessEqualDepth",()=>E.LessEqualDepth,"LessEqualStencilFunc",()=>E.LessEqualStencilFunc,"LessStencilFunc",()=>E.LessStencilFunc,"Light",()=>
393E.Light,"LightProbe",()=>E.LightProbe,"Line",()=>E.Line,"Line3",()=>E.Line3,"LineBasicMaterial",()=>E.LineBasicMaterial,"LineCurve",()=>E.LineCurve,"LineCurve3",()=>E.LineCurve3,"LineDashedMaterial",()=>E.LineDashedMaterial,"LineLoop",()=>E.LineLoop,"LineSegments",()=>E.LineSegments,"LinearFilter",()=>E.LinearFilter,"LinearInterpolant",()=>E.LinearInterpolant,"LinearMipMapLinearFilter",()=>E.LinearMipMapLinearFilter,"LinearMipMapNearestFilter",()=>E.LinearMipMapNearestFilter,"LinearMipmapLinearFilter",()=>E.LinearMipmapLinearFilter,"LinearMipmapNearestFilter",()=>E.LinearMipmapNearestFilter,"LinearSRGBColorSpace",()=>E.LinearSRGBColorSpace,"LinearToneMapping",()=>E.LinearToneMapping,"LinearTransfer",()=>E.LinearTransfer,"Loader",()=>E.Loader,"LoaderUtils",()=>E.LoaderUtils,"LoadingManager",()=>E.LoadingManager,"LoopOnce",()=>E.LoopOnce,"LoopPingPong",()=>E.LoopPingPong,"LoopRepeat",()=>E.LoopRepeat,"MOUSE",()=>E.MOUSE,"Material",()=>E.Material,"MaterialBlending",()=>E.MaterialBlending,"MaterialLoader",()=>E.MaterialLoader,"MathUtils",()=>E.MathUtils,"Matrix2",()=>E.Matrix2,"Matrix3",()=>E.Matrix3,"Matrix4",()=>E.Matrix4,"MaxEquation",()=>E.MaxEquation,"Mesh",()=>E.Mesh,"MeshBasicMaterial",()=>E.MeshBasicMaterial,"MeshDepthMaterial",()=>E.MeshDepthMaterial,"MeshDistanceMaterial",()=>E.MeshDistanceMaterial,"MeshLambertMaterial",()=>E.MeshLambertMaterial,"MeshMatcapMaterial",()=>E.MeshMatcapMaterial,"MeshNormalMaterial",()=>E.MeshNormalMaterial,"MeshPhongMaterial",()=>E.MeshPhongMaterial,"MeshPhysicalMaterial",()=>E.MeshPhysicalMaterial,"MeshStandardMaterial",()=>E.MeshStandardMaterial,"MeshToonMaterial",()=>E.MeshToonMaterial,"MinEquation",()=>E.MinEquation,"MirroredRepeatWrapping",()=>E.MirroredRepeatWrapping,"MixOperation",()=>E.MixOperation,"MultiplyBlending",()=>E.MultiplyBlending,"MultiplyOperation",()=>E.MultiplyOperation,"NearestFilter",()=>E.NearestFilter,"NearestMipMapLinearFilter",()=>E.NearestMipMapLinearFilter,"NearestMipMapNearestFilter",()=>E.NearestMipMapNearestFilter,"NearestMipmapLinearFilter",()=>E.NearestMipmapLinearFilter,"NearestMipmapNearestFilter",()=>E.NearestMipmapNearestFilter,"NeutralToneMapping",()=>E.NeutralToneMapping,"NeverCompare",()=>E.NeverCompare,"NeverDepth",()=>E.NeverDepth,"NeverStencilFunc",()=>E.NeverStencilFunc,"NoBlending",()=>E.NoBlending,"NoColorSpace",()=>E.NoColorSpace,"NoNormalPacking",()=>E.NoNormalPacking,"NoToneMapping",()=>E.NoToneMapping,"NormalAnimationBlendMode",()=>E.NormalAnimationBlendMode,"NormalBlending",()=>E.NormalBlending,"NormalGAPacking",()=>E.NormalGAPacking,"NormalRGPacking",()=>E.NormalRGPacking,"NotEqualCompare",()=>E.NotEqualCompare,"NotEqualDepth",()=>E.NotEqualDepth,"NotEqualStencilFunc",()=>E.NotEqualStencilFunc,"NumberKeyframeTrack",()=>E.NumberKeyframeTrack,"Object3D",()=>E.Object3D,"ObjectLoader",()=>E.ObjectLoader,"ObjectSpaceNormalMap",()=>E.ObjectSpaceNormalMap,"OctahedronGeometry",()=>E.OctahedronGeometry,"OneFactor",()=>E.OneFactor,"OneMinusConstantAlphaFactor",()=>E.OneMinusConstantAlphaFactor,"OneMinusConstantColorFactor",()=>E.OneMinusConstantColorFactor,"OneMinusDstAlphaFactor",()=>E.OneMinusDstAlphaFactor,"OneMinusDstColorFactor",()=>E.OneMinusDstColorFactor,"OneMinusSrcAlphaFactor",()=>E.OneMinusSrcAlphaFactor,"OneMinusSrcColorFactor",()=>E.OneMinusSrcColorFactor,"OrthographicCamera",()=>E.OrthographicCamera,"PCFShadowMap",()=>E.PCFShadowMap,"PCFSoftShadowMap",()=>E.PCFSoftShadowMap,"PMREMGenerator",0,W,"Path",()=>E.Path,"PerspectiveCamera",()=>E.PerspectiveCamera,"Plane",()=>E.Plane,"PlaneGeometry",()=>E.PlaneGeometry,"PlaneHelper",()=>E.PlaneHelper,"PointLight",()=>E.PointLight,"PointLightHelper",()=>E.PointLightHelper,"Points",()=>E.Points,"PointsMaterial",()=>E.PointsMaterial,"PolarGridHelper",()=>E.PolarGridHelper,"PolyhedronGeometry",()=>E.PolyhedronGeometry,"PositionalAudio",()=>E.PositionalAudio,"PropertyBinding",()=>E.PropertyBinding,"PropertyMixer",()=>E.PropertyMixer,"QuadraticBezierCurve",()=>E.QuadraticBezierCurve,"QuadraticBezierCurve3",()=>E.QuadraticBezierCurve3,"Quaternion",()=>E.Quaternion,"QuaternionKeyframeTrack",()=>E.QuaternionKeyframeTrack,"QuaternionLinearInterpolant",()=>E.QuaternionLinearInterpolant,"R11_EAC_Format",()=>E.R11_EAC_Format,"RED_GREEN_RGTC2_Format",()=>
393E.RED_GREEN_RGTC2_Format,"RED_RGTC1_Format",()=>E.RED_RGTC1_Format,"REVISION",()=>E.REVISION,"RG11_EAC_Format",()=>E.RG11_EAC_Format,"RGBADepthPacking",()=>E.RGBADepthPacking,"RGBAFormat",()=>E.RGBAFormat,"RGBAIntegerFormat",()=>E.RGBAIntegerFormat,"RGBA_ASTC_10x10_Format",()=>E.RGBA_ASTC_10x10_Format,"RGBA_ASTC_10x5_Format",()=>E.RGBA_ASTC_10x5_Format,"RGBA_ASTC_10x6_Format",()=>E.RGBA_ASTC_10x6_Format,"RGBA_ASTC_10x8_Format",()=>E.RGBA_ASTC_10x8_Format,"RGBA_ASTC_12x10_Format",()=>E.RGBA_ASTC_12x10_Format,"RGBA_ASTC_12x12_Format",()=>E.RGBA_ASTC_12x12_Format,"RGBA_ASTC_4x4_Format",()=>E.RGBA_ASTC_4x4_Format,"RGBA_ASTC_5x4_Format",()=>E.RGBA_ASTC_5x4_Format,"RGBA_ASTC_5x5_Format",()=>E.RGBA_ASTC_5x5_Format,"RGBA_ASTC_6x5_Format",()=>E.RGBA_ASTC_6x5_Format,"RGBA_ASTC_6x6_Format",()=>E.RGBA_ASTC_6x6_Format,"RGBA_ASTC_8x5_Format",()=>E.RGBA_ASTC_8x5_Format,"RGBA_ASTC_8x6_Format",()=>E.RGBA_ASTC_8x6_Format,"RGBA_ASTC_8x8_Format",()=>E.RGBA_ASTC_8x8_Format,"RGBA_BPTC_Format",()=>E.RGBA_BPTC_Format,"RGBA_ETC2_EAC_Format",()=>E.RGBA_ETC2_EAC_Format,"RGBA_PVRTC_2BPPV1_Format",()=>E.RGBA_PVRTC_2BPPV1_Format,"RGBA_PVRTC_4BPPV1_Format",()=>E.RGBA_PVRTC_4BPPV1_Format,"RGBA_S3TC_DXT1_Format",()=>E.RGBA_S3TC_DXT1_Format,"RGBA_S3TC_DXT3_Format",()=>E.RGBA_S3TC_DXT3_Format,"RGBA_S3TC_DXT5_Format",()=>E.RGBA_S3TC_DXT5_Format,"RGBDepthPacking",()=>E.RGBDepthPacking,"RGBFormat",()=>E.RGBFormat,"RGBIntegerFormat",()=>E.RGBIntegerFormat,"RGB_BPTC_SIGNED_Format",()=>E.RGB_BPTC_SIGNED_Format,"RGB_BPTC_UNSIGNED_Format",()=>E.RGB_BPTC_UNSIGNED_Format,"RGB_ETC1_Format",()=>E.RGB_ETC1_Format,"RGB_ETC2_Format",()=>E.RGB_ETC2_Format,"RGB_PVRTC_2BPPV1_Format",()=>E.RGB_PVRTC_2BPPV1_Format,"RGB_PVRTC_4BPPV1_Format",()=>E.RGB_PVRTC_4BPPV1_Format,"RGB_S3TC_DXT1_Format",()=>E.RGB_S3TC_DXT1_Format,"RGDepthPacking",()=>E.RGDepthPacking,"RGFormat",()=>E.RGFormat,"RGIntegerFormat",()=>E.RGIntegerFormat,"RawShaderMaterial",()=>E.RawShaderMaterial,"Ray",()=>E.Ray,"Raycaster",()=>E.Raycaster,"RectAreaLight",()=>E.RectAreaLight,"RedFormat",()=>E.RedFormat,"RedIntegerFormat",()=>E.RedIntegerFormat,"ReinhardToneMapping",()=>E.ReinhardToneMapping,"RenderTarget",()=>E.RenderTarget,"RenderTarget3D",()=>E.RenderTarget3D,"RepeatWrapping",()=>E.RepeatWrapping,"ReplaceStencilOp",()=>E.ReplaceStencilOp,"ReverseSubtractEquation",()=>E.ReverseSubtractEquation,"RingGeometry",()=>E.RingGeometry,"SIGNED_R11_EAC_Format",()=>E.SIGNED_R11_EAC_Format,"SIGNED_RED_GREEN_RGTC2_Format",()=>E.SIGNED_RED_GREEN_RGTC2_Format,"SIGNED_RED_RGTC1_Format",()=>E.SIGNED_RED_RGTC1_Format,"SIGNED_RG11_EAC_Format",()=>E.SIGNED_RG11_EAC_Format,"SRGBColorSpace",()=>E.SRGBColorSpace,"SRGBTransfer",()=>E.SRGBTransfer,"Scene",()=>E.Scene,"ShaderChunk",0,y,"ShaderLib",0,C,"ShaderMaterial",()=>E.ShaderMaterial,"ShadowMaterial",()=>E.ShadowMaterial,"Shape",()=>E.Shape,"ShapeGeometry",()=>E.ShapeGeometry,"ShapePath",()=>E.ShapePath,"ShapeUtils",()=>E.ShapeUtils,"ShortType",()=>E.ShortType,"Skeleton",()=>E.Skeleton,"SkeletonHelper",()=>E.SkeletonHelper,"SkinnedMesh",()=>E.SkinnedMesh,"Source",()=>E.Source,"Sphere",()=>E.Sphere,"SphereGeometry",()=>E.SphereGeometry,"Spherical",()=>E.Spherical,"SphericalHarmonics3",()=>E.SphericalHarmonics3,"SplineCurve",()=>E.SplineCurve,"SpotLight",()=>E.SpotLight,"SpotLightHelper",()=>E.SpotLightHelper,"Sprite",()=>E.Sprite,"SpriteMaterial",()=>E.SpriteMaterial,"SrcAlphaFactor",()=>E.SrcAlphaFactor,"SrcAlphaSaturateFactor",()=>E.SrcAlphaSaturateFactor,"SrcColorFactor",()=>E.SrcColorFactor,"StaticCopyUsage",()=>E.StaticCopyUsage,"StaticDrawUsage",()=>E.StaticDrawUsage,"StaticReadUsage",()=>E.StaticReadUsage,"StereoCamera",()=>E.StereoCamera,"StreamCopyUsage",()=>E.StreamCopyUsage,"StreamDrawUsage",()=>E.StreamDrawUsage,"StreamReadUsage",()=>E.StreamReadUsage,"StringKeyframeTrack",()=>E.StringKeyframeTrack,"SubtractEquation",()=>E.SubtractEquation,"SubtractiveBlending",()=>E.SubtractiveBlending,"TOUCH",()=>E.TOUCH,"TangentSpaceNormalMap",()=>E.TangentSpaceNormalMap,"TetrahedronGeometry",()=>E.TetrahedronGeometry,"Texture",()=>E.Texture,"TextureLoader",()=>E.TextureLoader,"TextureUtils",()=>E.TextureUtils,"Timer",()=>E.Timer,"TimestampQuery",()=>E.TimestampQuery,"TorusGeometry",()=>E.TorusGeometry,"TorusKnotGeometry",()=>
393E.TorusKnotGeometry,"Triangle",()=>E.Triangle,"TriangleFanDrawMode",()=>E.TriangleFanDrawMode,"TriangleStripDrawMode",()=>E.TriangleStripDrawMode,"TrianglesDrawMode",()=>E.TrianglesDrawMode,"TubeGeometry",()=>E.TubeGeometry,"UVMapping",()=>E.UVMapping,"Uint16BufferAttribute",()=>E.Uint16BufferAttribute,"Uint32BufferAttribute",()=>E.Uint32BufferAttribute,"Uint8BufferAttribute",()=>E.Uint8BufferAttribute,"Uint8ClampedBufferAttribute",()=>E.Uint8ClampedBufferAttribute,"Uniform",()=>E.Uniform,"UniformsGroup",()=>E.UniformsGroup,"UniformsLib",0,R,"UniformsUtils",()=>E.UniformsUtils,"UnsignedByteType",()=>E.UnsignedByteType,"UnsignedInt101111Type",()=>E.UnsignedInt101111Type,"UnsignedInt248Type",()=>E.UnsignedInt248Type,"UnsignedInt5999Type",()=>E.UnsignedInt5999Type,"UnsignedIntType",()=>E.UnsignedIntType,"UnsignedShort4444Type",()=>E.UnsignedShort4444Type,"UnsignedShort5551Type",()=>E.UnsignedShort5551Type,"UnsignedShortType",()=>E.UnsignedShortType,"VSMShadowMap",()=>E.VSMShadowMap,"Vector2",()=>E.Vector2,"Vector3",()=>E.Vector3,"Vector4",()=>E.Vector4,"VectorKeyframeTrack",()=>E.VectorKeyframeTrack,"VideoFrameTexture",()=>E.VideoFrameTexture,"VideoTexture",()=>E.VideoTexture,"WebGL3DRenderTarget",()=>E.WebGL3DRenderTarget,"WebGLArrayRenderTarget",()=>E.WebGLArrayRenderTarget,"WebGLCoordinateSystem",()=>E.WebGLCoordinateSystem,"WebGLCubeRenderTarget",0,$,"WebGLRenderTarget",()=>E.WebGLRenderTarget,"WebGLRenderer",0,t2,"WebGLUtils",0,tj,"WebGPUCoordinateSystem",()=>E.WebGPUCoordinateSystem,"WebXRController",()=>E.WebXRController,"WireframeGeometry",()=>E.WireframeGeometry,"WrapAroundEnding",()=>E.WrapAroundEnding,"ZeroCurvatureEnding",()=>E.ZeroCurvatureEnding,"ZeroFactor",()=>E.ZeroFactor,"ZeroSlopeEnding",()=>E.ZeroSlopeEnding,"ZeroStencilOp",()=>E.ZeroStencilOp,"createCanvasElement",()=>E.createCanvasElement,"error",()=>E.error,"getConsoleFunction",()=>E.getConsoleFunction,"log",()=>E.log,"setConsoleFunction",()=>E.setConsoleFunction,"warn",()=>E.warn,"warnOnce",()=>E.warnOnce],32009);var rx=e.i(32009);function rE(e,t){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>e(...r),t)}}let rb=["x","y","top","bottom","left","right","width","height"];function rT({ref:e,children:t,fallback:n,resize:r,style:a,gl:i,events:o=rS,eventSource:l,eventPrefix:s,shadows:u,linear:c,flat:d,legacy:f,orthographic:p,frameloop:m,dpr:h,performance:g,raycaster:v,camera:S,scene:b,onPointerMissed:T,onCreated:M,...y}){let R,C,A,w;x.useMemo(()=>n0(rx),[]);let P=(R=no(),C=function(){let e=no(),[t]=nt.default.useState(()=>new Map);t.clear();let n=e;for(;n;){let e=n.type;ns(e)&&e!==na&&!t.has(e)&&t.set(e,nt.default.use(nr(e))),n=n.return}return t}(),A=nt.default.useMemo(()=>Array.from(C.keys()).reduce((e,t)=>n=>nt.default.createElement(e,null,nt.default.createElement(t.Provider,{...n,value:C.get(t)})),e=>nt.default.createElement(ni,{...e})),[C]),w=nh(),x.useMemo(()=>({children:e})=>{let t=nn(R,!0,e=>e.type===x.StrictMode)?x.StrictMode:x.Fragment;return(0,_.jsx)(t,{children:(0,_.jsx)(w,{children:(0,_.jsx)(A,{children:e})})})},[R,A,w])),[U,L]=function({debounce:e,scroll:t,polyfill:n,offsetSize:r}={debounce:0,scroll:!1,offsetSize:!1}){var a,i,o;let l=n||("u"<typeof window?class{}:window.ResizeObserver);if(!l)throw Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");let[s,u]=(0,x.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),c=(0,x.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),d=e?"number"==typeof e?e:e.scroll:null,f=e?"number"==typeof e?e:e.resize:null,p=(0,x.useRef)(!1);(0,x.useEffect)(()=>(p.current=!0,()=>void(p.current=!1)));let[m,h,g]=(0,x.useMemo)(()=>{let e=()=>{let e,t;if(!c.current.element)return;let{left:n,top:a,width:i,height:o,bottom:l,right:s,x:d,y:f}=c.current.element.getBoundingClientRect(),m={left:n,top:a,width:i,height:o,bottom:l,right:s,x:d,y:f};c.current.element instanceof HTMLElement&&r&&(m.height=c.current.element.offsetHeight,m.width=c.current.element.offsetWidth),Object.freeze(m),p.
393current&&(e=c.current.lastBounds,t=m,!rb.every(n=>e[n]===t[n]))&&u(c.current.lastBounds=m)};return[e,f?rE(e,f):e,d?rE(e,d):e]},[u,r,d,f]);function v(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(e=>e.removeEventListener("scroll",g,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function _(){c.current.element&&(c.current.resizeObserver=new l(g),c.current.resizeObserver.observe(c.current.element),t&&c.current.scrollContainers&&c.current.scrollContainers.forEach(e=>e.addEventListener("scroll",g,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{g()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}return a=g,i=!!t,(0,x.useEffect)(()=>{if(i)return window.addEventListener("scroll",a,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",a,!0)},[a,i]),o=h,(0,x.useEffect)(()=>(window.addEventListener("resize",o),()=>void window.removeEventListener("resize",o)),[o]),(0,x.useEffect)(()=>{v(),_()},[t,g,h]),(0,x.useEffect)(()=>v,[]),[e=>{e&&e!==c.current.element&&(v(),c.current.element=e,c.current.scrollContainers=function e(t){let n=[];if(!t||t===document.body)return n;let{overflow:r,overflowX:a,overflowY:i}=window.getComputedStyle(t);return[r,a,i].some(e=>"auto"===e||"scroll"===e)&&n.push(t),[...n,...e(t.parentElement)]}(e),_())},s,m]}({scroll:!0,debounce:{scroll:50,resize:0},...r}),D=x.useRef(null),N=x.useRef(null);x.useImperativeHandle(e,()=>D.current);let I=nf(T),F=x.useCallback(e=>null==I.current?void 0:I.current(e),[I]),[B,O]=x.useState(!1),[G,k]=x.useState(!1);if(B)throw B;if(G)throw G;let z=x.useRef(null),[H,V]=function(){let[e,t]=x.useState(null),n=x.useCallback(()=>t(null),[]),r=x.useCallback(e=>t(t=>null!=t?t:Promise.resolve(e).then(np,np)),[]);return[e?(0,_.jsx)(x.Suspense,{fallback:null,children:(0,_.jsx)(nm,{promise:e,onSettled:n})}):null,r]}(),W=x.useRef(null),j=()=>l?l&&l.hasOwnProperty("current")?l.current:l:N.current;x.useInsertionEffect(()=>()=>{let e=z.current;z.current=null,null==e||e.unmount()},[]),nd(()=>{let e=D.current;if(L.width>0&&L.height>0&&e){let n,r,a,l,T,y,R,C,A,w,U,D,I,B,G;z.current||(r=null==(n=rr.get(e))?void 0:n.fiber,a=null==n?void 0:n.store,n&&console.warn("R3F.createRoot should only be called once!"),l="function"==typeof reportError?reportError:console.error,U=a||(C=(R=(y=(T=(e,t)=>{let n,r=new E.Vector3,a=new E.Vector3,i=new E.Vector3;function o(e=t().camera,n=a,l=t().size){let{width:s,height:u,top:c,left:d}=l,f=s/u;n.isVector3?i.copy(n):i.set(...n);let p=e.getWorldPosition(r).distanceTo(i);if(e&&e.isOrthographicCamera)return{width:s/e.zoom,height:u/e.zoom,top:c,left:d,factor:1,distance:p,aspect:f};{let t=2*Math.tan(e.fov*Math.PI/180/2)*p,n=s/u*t;return{width:n,height:t,top:c,left:d,factor:s/n,distance:p,aspect:f}}}let l=t=>e(e=>({performance:{...e.performance,current:t}})),s=new E.Vector2;return{set:e,get:t,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(e=1)=>rg(t(),e),advance:(e,n)=>rv(e,n,t()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new E.Clock,pointer:s,mouse:s,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{let e=t();n&&clearTimeout(n),e.performance.current!==e.performance.min&&l(e.performance.min),n=setTimeout(()=>l(t().performance.max),e.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:o},setEvents:t=>e(e=>({...e,events:{...e.events,...t}})),setSize:(n,r,i=0,l=0)=>{let s=t().camera,u={width:n,height:r,top:i,left:l};e(e=>({size:u,viewport:{...e.viewport,...o(s,a,u)}}
393))},setDpr:t=>e(e=>{let n=n_(t);return{viewport:{...e.viewport,dpr:n,initialDpr:e.viewport.initialDpr||n}}}),setFrameloop:(n="always")=>{let r=t().clock;r.stop(),r.elapsedTime=0,"never"!==n&&(r.start(),r.elapsedTime=0),e(()=>({frameloop:n}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:x.createRef(),active:!1,frames:0,priority:0,subscribe:(e,n,r)=>{let a=t().internal;return a.priority=a.priority+ +(n>0),a.subscribers.push({ref:e,priority:n,store:r}),a.subscribers=a.subscribers.sort((e,t)=>e.priority-t.priority),()=>{let r=t().internal;null!=r&&r.subscribers&&(r.priority=r.priority-(n>0),r.subscribers=r.subscribers.filter(t=>t.ref!==e))}}}}})?t6(T,void 0):t6).getState()).size,A=R.viewport.dpr,w=R.camera,y.subscribe(()=>{let{camera:e,size:t,viewport:n,gl:r,set:a}=y.getState();if(t.width!==C.width||t.height!==C.height||n.dpr!==A){C=t,A=n.dpr;!e.manual&&(e&&e.isOrthographicCamera?(e.left=-(t.width/2),e.right=t.width/2,e.top=t.height/2,e.bottom=-(t.height/2)):e.aspect=t.width/t.height,e.updateProjectionMatrix());n.dpr>0&&r.setPixelRatio(n.dpr);let a="u">typeof HTMLCanvasElement&&r.domElement instanceof HTMLCanvasElement;r.setSize(t.width,t.height,a)}e!==w&&(w=e,a(t=>({viewport:{...t.viewport,...t.viewport.getCurrentViewport(e)}})))}),y.subscribe(e=>rg(e)),y),D=r||rn.createContainer(U,1,null,!1,null,"",l,l,l,null),B=n||{fiber:D,store:U,state:{status:"open"},ready:Object.assign(Promise.resolve(I=void 0),{status:"fulfilled",value:I}),configuration:{},ownsRenderer:!1},n||rr.set(e,B),G=!1,z.current={get ready(){return B.ready},configure(t={}){let n,r,a;if(!ra(B,{type:"use"})){var i;let e;return(e=Promise.reject(i=Error("R3F: Cannot configure a root after disposal has started."))).catch(()=>{}),Object.assign(e,{status:"rejected",reason:i})}let o=B.ready,{promise:l,resolve:s,reject:u}=((a=new Promise((e,t)=>{n=t=>{Object.assign(a,{status:"fulfilled",value:t}),e(t)},r=e=>{Object.assign(a,{status:"rejected",reason:e}),t(e)}})).status="pending",a.catch(()=>{}),{promise:a,resolve:n,reject:r});B.ready=l;let c=n=>{let r=U.getState();r.gl||(B.ownsRenderer=!nB(t.gl),r.set({gl:n})),function({store:e,configuration:t},n,r){var a,i,o;let{gl:l,scene:s,camera:u,shadows:c=!1,linear:d=!1,flat:f=!1,legacy:p=!1,frameloop:m="always",dpr:h=[1,2],performance:g,onPointerMissed:v}=r,_=function(e,t){if(!t&&"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&e.parentElement){let{width:t,height:n,top:r,left:a}=e.parentElement.getBoundingClientRect();return{width:t,height:n,top:r,left:a}}return!t&&"u">typeof OffscreenCanvas&&e instanceof OffscreenCanvas?{width:e.width,height:e.height,top:0,left:0}:{width:0,height:0,top:0,left:0,...t}}(n,r.size),S={...r,shadows:c,linear:d,flat:f,legacy:p,frameloop:m,size:_},x=e.getState(),b=x.gl,T=t.previous,M=e=>!T||!nx.equ(S[e],T[e],nj);t.previous=void 0;let y=x.raycaster;if(y||x.set({raycaster:y=new E.Raycaster}),M("raycaster")){let{params:e,...t}=null!=(a=r.raycaster)?a:{};nL(y,{...t,params:{...y.params,...e}})}if(!x.camera||x.camera===t.camera&&M("camera")){t.camera=u;let e=null==u?void 0:u.isCamera,n=e?u:r.orthographic?new E.OrthographicCamera(0,0,0,0,.1,1e3):new E.PerspectiveCamera(75,0,.1,1e3);!e&&(n.position.z=5,u&&(nL(n,u),!n.manual&&("aspect"in u||"left"in u||"right"in u||"bottom"in u||"top"in u)&&(n.manual=!0,n.updateProjectionMatrix())),x.camera||null!=u&&u.rotation||n.lookAt(0,0,0)),x.set({camera:n}),y.camera=n}if(!x.scene){let t;null!=s&&s.isScene?nT(t=s,e,"",{}):(nT(t=new E.Scene,e,"",{}),s&&nL(t,s)),x.set({scene:t})}if(r.events&&!x.events.handlers&&x.set({events:r.events(e)}),M("size")&&x.setSize(_.width,_.height,_.top,_.left),x.viewport.dpr!==n_(h)&&x.setDpr(h),M("frameloop")&&x.setFrameloop(m),M("onPointerMissed")&&x.set({onPointerMissed:v}),g&&M("performance")&&x.set(e=>({performance:{...e.performance,...g}})),!x.xr){let t=(t,n)=>{let r=e.getState();"never"!==r.frameloop&&rv(t,!0,r,n)},n=()=>{let n=e.getState();n.gl.xr.enabled=n.gl.xr.isPresenting,n.gl.xr.setAnimationLoop(n.gl.xr.isPresenting?t:null),n.gl.xr.isPresenting||rg(n)},r={connect(){let t=e.getState().gl;t.xr.addEventListener("sessionstart",n),t.xr.addEventListener("sessionend",n)},disconnect(){let t=e.getState().gl;t.xr.removeEventListener("sessionstart",n),t.xr.removeEventListener("sessionend",n)}};"function"==typeof(null==(i=b.xr)?void 0:i.addEventListener)&&r.connect(),x.set({xr:r})}if(b.shadowMap&&M("shadows")){let e=b.shadowMap.enabled,t=b.shadowMap.type;if(b.shadowMap.enabled=!!c,nx.boo(c))b.shadowMap.type=E.PCFSoftShadowMap;else if(nx.str(c)){let e={basic:E.BasicShadowMap,percentage:E.PCFSh
393adowMap,soft:E.PCFSoftShadowMap,variance:E.VSMShadowMap};b.shadowMap.type=null!=(o=e[c])?o:E.PCFSoftShadowMap}else nx.obj(c)&&Object.assign(b.shadowMap,c);(e!==b.shadowMap.enabled||t!==b.shadowMap.type)&&(b.shadowMap.needsUpdate=!0)}let R=!l||nx.fun(l)||nB(l)?void 0:l;M("legacy")&&(E.ColorManagement.enabled=!p,x.set({legacy:p})),M("linear")&&((null==R?void 0:R.outputColorSpace)===void 0&&(b.outputColorSpace=d?E.LinearSRGBColorSpace:E.SRGBColorSpace),x.set({linear:d})),M("flat")&&((null==R?void 0:R.toneMapping)===void 0&&(b.toneMapping=f?E.NoToneMapping:E.ACESFilmicToneMapping),x.set({flat:f})),R&&M("gl")&&nL(b,R),t.previous=S}(B,e,t),s(this)},d=()=>{try{var n,r;let a,i=null!=(n=U.getState().gl)?n:(r=t.gl,a={canvas:e,powerPreference:"high-performance",antialias:!0,alpha:!0},"function"==typeof r?r(a):nB(r)?r:new t2({...a,...r}));nX(i)?Promise.resolve(i).then(c).catch(u):c(i)}catch(e){u(e)}};return"pending"===o.status?o.then(d,u):d(),l},render(t){if(!ra(B,{type:"use"}))return U;if(U.getState().gl||"fulfilled"!==B.ready.status||this.configure(),"rejected"===B.ready.status)throw B.ready.reason;let n=()=>{var r;if("open"!==B.state.status||"rejected"===B.ready.status)return;if("pending"===B.ready.status)return void B.ready.then(n,l);let a=null==(r=B.configuration.previous)?void 0:r.onCreated,i=(0,_.jsx)(ri,{store:U,children:t,onCreated:a,rootElement:e});G?rn.updateContainer(i,D,null,np):(G=!0,rn.updateContainerSync(i,D,null,np),rn.flushSyncWork())};return n(),U},unmount(){rr.get(e)===B&&function(e){let t=rr.get(e),n=Symbol("unmount");if(!t||!ra(t,{type:"unmount",token:n}))return;let r=()=>{var a;let i;if("pending"===t.ready.status)return void t.ready.then(r,r);if(!ra(t,{type:"dispose",token:n}))return;rr.delete(e);let o=t.store.getState();o.internal.active=!1,ro(()=>null==o.events.disconnect?void 0:o.events.disconnect()),null!=(a=o.gl)&&a.xr&&ro(()=>o.xr.disconnect()),o.scene&&ro(()=>(function(e){for(let t in"Scene"!==e.type&&(null==e.dispose||e.dispose()),e){let n=e[t];(null==n?void 0:n.type)!=="Scene"&&(null==n||null==n.dispose||n.dispose())}})(o.scene));let l=o.gl;l&&t.ownsRenderer?i=ro(()=>(function(e){if((null==e.hasInitialized?void 0:e.hasInitialized())===!1)return;let t=ro(()=>{var t;return e.dispose?e.dispose():null==(t=e.renderLists)||null==t.dispose?void 0:t.dispose()});if(nX(t))return Promise.resolve(t).catch(e=>console.warn("[R3F] Error disposing renderer",e)).then(()=>ro(()=>null==e.forceContextLoss?void 0:e.forceContextLoss()));ro(()=>null==e.forceContextLoss?void 0:e.forceContextLoss())})(l)):l&&(ro(()=>{var e;return null==(e=l.renderLists)||null==e.dispose?void 0:e.dispose()}),ro(()=>null==l.forceContextLoss?void 0:l.forceContextLoss())),nX(i)&&i.then(()=>void 0)};rn.updateContainer(null,t.fiber,null,()=>{"closing"===t.state.status&&t.state.token===n&&rn.updateContainer(null,t.fiber,null,r)})}(e)}}),z.current.configure({gl:i,scene:b,events:o,shadows:u,linear:c,flat:d,legacy:f,orthographic:p,frameloop:m,dpr:h,performance:g,raycaster:v,camera:S,size:L,onPointerMissed:F,onCreated:e=>{var t;W.current=e,null==e.events.connect||e.events.connect(null!=(t=j())?t:N.current),s&&e.setEvents({compute:(e,t)=>{let n=e[s+"X"],r=e[s+"Y"];t.pointer.set(n/t.size.width*2-1,-(2*(r/t.size.height))+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),null==M||M(e)}}).catch(k),"fulfilled"===z.current.ready.status?z.current.render((0,_.jsx)(P,{children:(0,_.jsx)(nv,{set
393:k,children:(0,_.jsx)(x.Suspense,{fallback:(0,_.jsx)(ng,{set:O}),children:null!=t?t:null})})})):"pending"===z.current.ready.status&&V(z.current.ready)}}),x.useEffect(()=>{var e;let t=null==(e=W.current)?void 0:e.get(),n=j();t&&n&&t.events.connected!==n&&(null==t.events.connect||t.events.connect(n))}),x.useEffect(()=>{let e=D.current;return()=>{var t;e.isConnected||null==(t=z.current)||t.unmount()}},[]);let X=l?"none":"auto";return(0,_.jsxs)("div",{ref:N,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:X,...a},...y,children:[(0,_.jsx)("div",{ref:U,style:{width:"100%",height:"100%"},children:(0,_.jsx)("canvas",{ref:D,style:{display:"block"},children:n})}),H]})}function rM(e){return(0,_.jsx)(ni,{children:(0,_.jsx)(rT,{...e})})}var ry=E,rR=(c=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),d=new Float32Array([0,0,2,0,0,2]),(f=new ry.BufferGeometry).setAttribute("position",new ry.BufferAttribute(c,3)),f.setAttribute("uv",new ry.BufferAttribute(d,2)),f),rC=class e{static get fullscreenGeometry(){return rR}constructor(e="Pass",t=new ry.Scene,n=new ry.OrthographicCamera){this.name=e,this.renderer=null,this.scene=t,this.camera=n,this.screen=null,this.rtt=!0,this.needsSwap=!0,this.needsDepthBlit=!1,this.needsDepthTexture=!1,this.enabled=!0}get renderToScreen(){return!this.rtt}set renderToScreen(e){if(this.rtt===e){let t=this.fullscreenMaterial;null!==t&&(t.needsUpdate=!0),this.rtt=!e}}set mainScene(e){}set mainCamera(e){}setRenderer(e){this.renderer=e}isEnabled(){return this.enabled}setEnabled(e){this.enabled=e}get fullscreenMaterial(){return null!==this.screen?this.screen.material:null}set fullscreenMaterial(t){let n=this.screen;null!==n?n.material=t:((n=new ry.Mesh(e.fullscreenGeometry,t)).frustumCulled=!1,null===this.scene&&(this.scene=new ry.Scene),this.scene.add(n),this.screen=n)}getFullscreenMaterial(){return this.fullscreenMaterial}setFullscreenMaterial(e){this.fullscreenMaterial=e}getDepthTexture(){return null}setDepthTexture(e,t=ry.BasicDepthPacking){}render(e,t,n,r,a){throw Error("Render method not implemented!")}setSize(e,t){}initialize(e,t,n){}dispose(){for(let t of Object.keys(this)){let n=this[t];(n instanceof ry.WebGLRenderTarget||n instanceof ry.Material||n instanceof ry.Texture||n instanceof e)&&this[t].dispose()}null!==this.fullscreenMaterial&&this.fullscreenMaterial.dispose()}},rA=class extends rC{constructor(){super("ClearMaskPass",null,null),this.needsSwap=!1}render(e,t,n,r,a){let i=e.state.buffers.stencil;i.setLocked(!1),i.setTest(!1)}},rw=`#ifdef COLOR_WRITE 394#include <common> 395#include <dithering_pars_fragment> 396#ifdef FRAMEBUFFER_PRECISION_HIGH 397uniform mediump sampler2D inputBuffer; 398#else 399uniform lowp sampler2D inputBuffer; 400#endif 401#endif 402#ifdef DEPTH_WRITE 403#include <packing> 404#ifdef GL_FRAGMENT_PRECISION_HIGH 405uniform highp sampler2D depthBuffer; 406#else 407uniform mediump sampler2D depthBuffer; 408#endif 409float readDepth(const in vec2 uv){ 410#if DEPTH_PACKING == 3201 411return unpackRGBAToDepth(texture2D(depthBuffer,uv)); 412#else 413return texture2D(depthBuffer,uv).r; 414#endif 415} 416#endif 417#ifdef USE_WEIGHTS 418uniform vec4 channelWeights; 419#endif 420uniform float opacity;varying vec2 vUv;void main(){ 421#ifdef COLOR_WRITE 422vec4 texel=texture2D(inputBuffer,vUv); 423#ifdef USE_WEIGHTS 424texel*=channelWeights; 425#endif 426gl_FragColor=opacity*texel; 427#ifdef COLOR_SPACE_CONVERSION 428#include <colorspace_fragment> 429#endif 430#include <dithering_fragment> 431#else 432gl_FragColor=vec4(0.0); 433#endif 434#ifdef DEPTH_WRITE 435gl_FragDepth=readDepth(vUv); 436#endif 437}`,rP="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",rU=class extends ry.ShaderMaterial{constructor(){super({name:"CopyMaterial",defines:{COLOR_SPACE_CONVERSION:"1",DEPTH_PACKING:"0",COLOR_WRITE:"1"},uniforms:{inputBuffer:new ry.Uniform(null),depthBuffer:new ry.Uniform(null),channelWeights:new ry.Uniform(null),opacity:new ry.Uniform(1)},blending:ry.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:rw,vertexShader:rP}),this.depthFunc=ry.AlwaysDepth}get inputBuffer(){return this.uniforms.inputBuffer.value}set inputBuffer(e){let t=null!==e;this.colorWrite!==t&&(t?this.defines.COLOR_WRITE=!0:delete this.defines.COLOR_WRITE,this.colorWrite=t,this.needsUpdate=!0),this.uniforms.inputBuffer.value=e}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(e){let t=null!==e;this.depthWrite!==t&&(t?this.defines.DEPTH_WRITE=!0:delete this.defines.DEPTH_WRITE,this.depthTest=t,this.depthWrite=t,this.needsUpdate=!0),this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}get colorSpaceConversion(){return void 0!==this.defines.COLOR_SPACE_CONVERSION}set colorSpaceConversion(e){this.colorSpaceConversion!==e&&(e?this.defines.COLOR_SPACE_CONVERSION=!0:delete this.defines.COLOR_SPACE_CONVERSION,this.needsUpdate=!0)}get channelWeights(){return this.uniforms.channelWeights.value}set channelWeights(e){null!==e?(this.defines.USE_WEIGHTS="1",this.uniforms.channelWeights.value=e):delete this.defines.USE_WEIGHTS,this.needsUpdate=!0}setInputBuffer(e){this.uniforms.inputBuffer.value=e}getOpacity(e){return this.uniforms.opacity.value}setOpacity(e){this.uniforms.opacity.value=e}},rL=class extends rC{constructor(e,t=!0){super("CopyPass"),this.fullscreenMaterial=new rU,this.needsSwap=!1,this.renderTarget=e,void 0===e&&(this.renderTarget=new ry.WebGLRenderTarget(1,1,{minFilter:ry.LinearFilter,magFilter:ry.LinearFilter,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=t}get resize(){return this.autoResize}set resize(e){this.autoResize=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(e){this.autoResize=e}render(e,t,n,r,a){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){this.autoResize&&this.renderTarget.setSize(e,t)}initialize(e,t,n){void 0!==n&&(this.renderTarget.texture.type=n,n!==ry.UnsignedByteType?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":null!==e&&e.outputColorSpace
437===ry.SRGBColorSpace&&(this.renderTarget.texture.colorSpace=ry.SRGBColorSpace))}},rD=new ry.Color,rN=class extends rC{constructor(e=!0,t=!0,n=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=e,this.depth=t,this.stencil=n,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(e,t,n){this.color=e,this.depth=t,this.stencil=n}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(e){this.overrideClearColor=e}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(e){this.overrideClearAlpha=e}render(e,t,n,r,a){let i=this.overrideClearColor,o=this.overrideClearAlpha,l=e.getClearAlpha(),s=null!==i,u=o>=0;s?(e.getClearColor(rD),e.setClearColor(i,u?o:l)):u&&e.setClearAlpha(o),e.setRenderTarget(this.renderToScreen?null:t),e.clear(this.color,this.depth,this.stencil),s?e.setClearColor(rD,l):u&&e.setClearAlpha(l)}},rI=class extends rC{constructor(e,t){super("MaskPass",e,t),this.needsSwap=!1,this.clearPass=new rN(!1,!1,!0),this.inverse=!1}set mainScene(e){this.scene=e}set mainCamera(e){this.camera=e}get inverted(){return this.inverse}set inverted(e){this.inverse=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(e){this.inverted=e}render(e,t,n,r,a){let i=e.getContext(),o=e.state.buffers,l=this.scene,s=this.camera,u=this.clearPass,c=+!this.inverted;o.color.setMask(!1),o.depth.setMask(!1),o.color.setLocked(!0),o.depth.setLocked(!0),o.stencil.setTest(!0),o.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),o.stencil.setFunc(i.ALWAYS,c,0xffffffff),o.stencil.setClear(1-c),o.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?u.render(e,null):(u.render(e,t),u.render(e,n))),this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),e.render(l,s),e.setRenderTarget(n)),e.render(l,s),o.color.setLocked(!1),o.depth.setLocked(!1),o.stencil.setLocked(!1),o.stencil.setFunc(i.EQUAL,1,0xffffffff),o.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),o.stencil.setLocked(!0)}},rF=class{constructor(){this.startTime=performance.now(),this.previousTime=0,this.currentTime=0,this._delta=0,this._elapsed=0,this._fixedDelta=1e3/60,this.timescale=1,this.useFixedDelta=!1,this._autoReset=!1}get autoReset(){return this._autoReset}set autoReset(e){"u">typeof document&&void 0!==document.hidden&&(e?document.addEventListener("visibilitychange",this):document.removeEventListener("visibilitychange",this),this._autoReset=e)}get delta(){return .001*this._delta}get fixedDelta(){return .001*this._fixedDelta}set fixedDelta(e){this._fixedDelta=1e3*e}get elapsed(){return .001*this._elapsed}update(e){this.useFixedDelta?this._delta=this.fixedDelta:(this.previousTime=this.currentTime,this.currentTime=(void 0!==e?e:performance.now())-this.startTime,this._delta=this.currentTime-this.previousTime),this._delta*=this.timescale,this._elapsed+=this._delta}reset(){this._delta=0,this._elapsed=0,this.currentTime=performance.now()-this.startTime}getDelta(){return this.delta}getElapsed(){return this.elapsed}handleEvent(e){document.hidden||(this.currentTime=performance.now()-this.startTime)}dispose(){this.autoReset=!1}},rB=class{constructor(e=null,{depthBuffer:t=!0,stencilBuffer:n=!1,multisampling:r=0,frameBufferType:a}={}){this.renderer=null,this.inputBuffer=this.createBuffer(t,n,a,r),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new rL,this.depthRenderTarget=null,this.passes=[],this.timer=new rF,this.autoRenderToScreen=!0,this.setRenderer(e)}get stableDepthTexture(){return null===this.depthRenderTarget?null:this.depthRenderTarget.depthTexture}get multisampling(){return this.inputBuffer.samples}set multisampling(e){this.multisampling!==e&&(this.inputBuffer.samples=e,this.outputBuffer.samples=e,this.inputBuffer.dispose(),this.outputBuffer.dispose())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(e){if(this.renderer=e,null!==e){let t=e.getSize(new ry.Vector2),n=e.getContext().getContextAttributes().alpha,r=this.inputBuffer.texture.type;
437for(let a of(r===ry.UnsignedByteType&&e.outputColorSpace===ry.SRGBColorSpace&&(this.inputBuffer.texture.colorSpace=ry.SRGBColorSpace,this.outputBuffer.texture.colorSpace=ry.SRGBColorSpace,this.inputBuffer.dispose(),this.outputBuffer.dispose()),e.autoClear=!1,this.setSize(t.width,t.height),this.passes))a.initialize(e,n,r)}}replaceRenderer(e,t=!0){let n=this.renderer,r=n.domElement.parentNode;return this.setRenderer(e),t&&null!==r&&(r.removeChild(n.domElement),r.appendChild(e.domElement)),n}createDepthTexture(){let e=new ry.DepthTexture;e.name="EffectComposer.InputDepth",this.inputBuffer.stencilBuffer?(e.format=ry.DepthStencilFormat,e.type=ry.UnsignedInt248Type):e.type=ry.FloatType;let t=e.clone();t.name="EffectComposer.OutputDepth";let n=e.clone();n.name="EffectComposer.StableDepth",this.inputBuffer.depthTexture=e,this.outputBuffer.depthTexture=t,this.inputBuffer.dispose(),this.outputBuffer.dispose();let{width:r,height:a}=this.inputBuffer;this.depthRenderTarget=new ry.WebGLRenderTarget(r,a,{depthBuffer:!0,stencilBuffer:this.inputBuffer.stencilBuffer,depthTexture:n})}blitDepthBuffer(e){let t=this.renderer,n=this.depthRenderTarget,r=t.properties,a=t.getContext();t.setRenderTarget(n);let i=r.get(e).__webglFramebuffer,o=r.get(n).__webglFramebuffer,l=e.stencilBuffer?a.DEPTH_BUFFER_BIT|a.STENCIL_BUFFER_BIT:a.DEPTH_BUFFER_BIT;a.bindFramebuffer(a.READ_FRAMEBUFFER,i),a.bindFramebuffer(a.DRAW_FRAMEBUFFER,o),a.blitFramebuffer(0,0,e.width,e.height,0,0,n.width,n.height,l,a.NEAREST),a.bindFramebuffer(a.READ_FRAMEBUFFER,null),a.bindFramebuffer(a.DRAW_FRAMEBUFFER,null),t.setRenderTarget(null)}deleteDepthTexture(){let e=this.stableDepthTexture;for(let t of this.passes)t.getDepthTexture()===e&&t.setDepthTexture(null);null!==this.depthRenderTarget&&(this.depthRenderTarget.dispose(),this.depthRenderTarget=null),null!==this.inputBuffer.depthTexture&&(this.inputBuffer.depthTexture.dispose(),this.inputBuffer.depthTexture=null),null!==this.outputBuffer.depthTexture&&(this.outputBuffer.depthTexture.dispose(),this.outputBuffer.depthTexture=null)}createBuffer(e,t,n,r){let a=this.renderer,i=null===a?new ry.Vector2:a.getDrawingBufferSize(new ry.Vector2),o=new ry.WebGLRenderTarget(i.width,i.height,{minFilter:ry.LinearFilter,magFilter:ry.LinearFilter,samples:r,stencilBuffer:t,depthBuffer:e,type:n});return n===ry.UnsignedByteType&&null!==a&&a.outputColorSpace===ry.SRGBColorSpace&&(o.texture.colorSpace=ry.SRGBColorSpace),o.texture.name="EffectComposer.Buffer",o.texture.generateMipmaps=!1,o}setMainScene(e){for(let t of this.passes)t.mainScene=e}setMainCamera(e){for(let t of this.passes)t.mainCamera=e}addPass(e,t){let n=this.passes,r=this.renderer,a=r.getDrawingBufferSize(new ry.Vector2),i=r.getContext().getContextAttributes().alpha,o=this.inputBuffer.texture.type;if(e.renderer=r,e.setSize(a.width,a.height),e.initialize(r,i,o),this.autoRenderToScreen&&(n.length>0&&(n[n.length-1].renderToScreen=!1),e.renderToScreen&&(this.autoRenderToScreen=!1)),void 0!==t?n.splice(t,0,e):n.push(e),this.autoRenderToScreen&&(n[n.length-1].renderToScreen=!0),e.needsDepthTexture||null!==this.depthRenderTarget)if(null===this.depthRenderTarget)for(let e of(this.createDepthTexture(),n))e.setDepthTexture(this.stableDepthTexture);else e.setDepthTexture(this.stableDepthTexture)}removePass(e){let t=this.passes,n=t.indexOf(e);if(-1!==n&&t.splice(n,1).length>0){let r=this.stableDepthTexture;null!==r&&(t.reduce((e,t)=>e||t.needsDepthTexture,!1)||(e.getDepthTexture()===r&&e.setDepthTexture(null),this.deleteDepthTexture())),this.autoRenderToScreen&&n===t.length&&(e.renderToScreen=!1,t.length>0&&(t[t.length-1].renderToScreen=!0))}}removeAllPasses(){let e=this.passes;this.deleteDepthTexture(),e.length>0&&(this.autoRenderToScreen&&(e[e.length-1].renderToScreen=!1),this.passes=[])}render(e){let t,n=this.renderer,r=this.copyPass,a=this.inputBuffer,i=this.outputBuffer,o=!1;
437for(let l of(void 0===e&&(this.timer.update(),e=this.timer.getDelta()),this.passes))if(l.enabled){if(l.render(n,a,i,e,o),l.needsDepthBlit&&null!==this.depthRenderTarget&&this.blitDepthBuffer(a),l.needsSwap){if(o){r.renderToScreen=l.renderToScreen;let t=n.getContext(),s=n.state.buffers.stencil;s.setFunc(t.NOTEQUAL,1,0xffffffff),r.render(n,a,i,e,o),s.setFunc(t.EQUAL,1,0xffffffff)}t=a,a=i,i=t}l instanceof rI?o=!0:l instanceof rA&&(o=!1)}}setSize(e,t,n){let r=this.renderer,a=r.getSize(new ry.Vector2);(void 0===e||void 0===t)&&(e=a.width,t=a.height),(a.width!==e||a.height!==t)&&r.setSize(e,t,n);let i=r.getDrawingBufferSize(new ry.Vector2);for(let e of(this.inputBuffer.setSize(i.width,i.height),this.outputBuffer.setSize(i.width,i.height),null!==this.depthRenderTarget&&this.depthRenderTarget.setSize(i.width,i.height),this.passes))e.setSize(i.width,i.height)}reset(){this.dispose(),this.autoRenderToScreen=!0}dispose(){for(let e of this.passes)e.dispose();this.deleteDepthTexture(),this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.copyPass.dispose(),this.timer.dispose(),this.passes=[],rC.fullscreenGeometry.dispose()}},rO={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},rG=class{constructor(){this.shaderParts=new Map([[rO.FRAGMENT_HEAD,null],[rO.FRAGMENT_MAIN_UV,null],[rO.FRAGMENT_MAIN_IMAGE,null],[rO.VERTEX_HEAD,null],[rO.VERTEX_MAIN_SUPPORT,null]]),this.defines=new Map,this.uniforms=new Map,this.blendModes=new Map,this.extensions=new Set,this.attributes=0,this.varyings=new Set,this.uvTransformation=!1,this.readDepth=!1,this.colorSpace=ry.LinearSRGBColorSpace}},rk=!1,rz=class{constructor(e=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(e),this.meshCount=0,this.replaceMaterial=e=>{if(e.isMesh){let t;if(e.material.flatShading)switch(e.material.side){case ry.DoubleSide:t=this.materialsFlatShadedDoubleSide;break;case ry.BackSide:t=this.materialsFlatShadedBackSide;break;default:t=this.materialsFlatShaded}else switch(e.material.side){case ry.DoubleSide:t=this.materialsDoubleSide;break;case ry.BackSide:t=this.materialsBackSide;break;default:t=this.materials}this.originalMaterials.set(e,e.material),e.isSkinnedMesh?e.material=t[2]:e.isInstancedMesh?e.material=t[1]:e.material=t[0],++this.meshCount}}}cloneMaterial(e){if(!(e instanceof ry.ShaderMaterial))return e.clone();let t=e.uniforms,n=new Map;for(let e in t){let r=t[e].value;r.isRenderTargetTexture&&(t[e].value=null,n.set(e,r))}let r=e.clone();for(let e of n)t[e[0]].value=e[1],r.uniforms[e[0]].value=e[1];return r}setMaterial(e){if(this.disposeMaterials(),this.material=e,null!==e){let t=this.materials=[this.cloneMaterial(e),this.cloneMaterial(e),this.cloneMaterial(e)];for(let n of t)n.uniforms=Object.assign({},e.uniforms),n.side=ry.FrontSide;t[2].skinning=!0,this.materialsBackSide=t.map(t=>{let n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.side=ry.BackSide,n}),this.materialsDoubleSide=t.map(t=>{let n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.side=ry.DoubleSide,n}),this.materialsFlatShaded=t.map(t=>{let n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.flatShading=!0,n}),this.materialsFlatShadedBackSide=t.map(t=>{let n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.flatShading=!0,n.side=ry.BackSide,n}),this.materialsFlatShadedDoubleSide=t.map(t=>{let n=this.cloneMaterial(t);return n.uniforms=Object.assign({},e.uniforms),n.flatShading=!0,n.side=ry.DoubleSide,n})}}render(e,t,n){let r=e.shadowMap.enabled;if(e.shadowMap.enabled=!1,rk){let r=this.originalMaterials;for(let a of(this.meshCount=0,t.traverse(this.replaceMaterial),e.render(t,n),r))a[0].material=a[1];this.meshCount!==r.size&&r.clear()}else{let r=t.overrideMaterial;t.overrideMaterial=this.material,e.render(t,n),t.overrideMaterial=r}e.shadowMap.enabled=r}disposeMaterials(){if(null!==this.material)for(let e of this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide))e.dispose()}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return rk}static set workaroundEnabled(e){rk=e}},rH=class extends ry.EventDispatcher{constructor(e=null,t=-1,n=-1,r=1){super(),null!==e&&this.addEventListener("change",()=>e.setSize(this.baseSize.width,this.baseSize.height)),this.baseSize=new ry.Vector2(1,1),this.preferredSize=new ry.Vector2(t,n),this.target=this.preferredSize,this.s=r,this.effectiveSize=new ry.Vector2,this.addEventListener("change",()=>this.updateEffectiveSize()),this.updateEffectiveSize()}updateEffectiveSize(){let e=this.baseSize,t=this.preferredSize,n=this.effectiveSize,r=this.scale;-1!==t.width?n.width=t.width:-1!==t.height?n.width=Math.round(t.height*(e.width/Math.max(e.height,1))):n.width=Math.round(e.width*r),-1!==t.height?n.height=t.height:-1!==t.width?n.height=Math.round(t.width/
437Math.max(e.width/Math.max(e.height,1),1)):n.height=Math.round(e.height*r)}get width(){return this.effectiveSize.width}set width(e){this.preferredWidth=e}get height(){return this.effectiveSize.height}set height(e){this.preferredHeight=e}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(e){this.s!==e&&(this.s=e,this.preferredSize.setScalar(-1),this.dispatchEvent({type:"change"}))}getScale(){return this.scale}setScale(e){this.scale=e}get baseWidth(){return this.baseSize.width}set baseWidth(e){this.baseSize.width!==e&&(this.baseSize.width=e,this.dispatchEvent({type:"change"}))}getBaseWidth(){return this.baseWidth}setBaseWidth(e){this.baseWidth=e}get baseHeight(){return this.baseSize.height}set baseHeight(e){this.baseSize.height!==e&&(this.baseSize.height=e,this.dispatchEvent({type:"change"}))}getBaseHeight(){return this.baseHeight}setBaseHeight(e){this.baseHeight=e}setBaseSize(e,t){(this.baseSize.width!==e||this.baseSize.height!==t)&&(this.baseSize.set(e,t),this.dispatchEvent({type:"change"}))}get preferredWidth(){return this.preferredSize.width}set preferredWidth(e){this.preferredSize.width!==e&&(this.preferredSize.width=e,this.dispatchEvent({type:"change"}))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(e){this.preferredWidth=e}get preferredHeight(){return this.preferredSize.height}set preferredHeight(e){this.preferredSize.height!==e&&(this.preferredSize.height=e,this.dispatchEvent({type:"change"}))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(e){this.preferredHeight=e}setPreferredSize(e,t){(this.preferredSize.width!==e||this.preferredSize.height!==t)&&(this.preferredSize.set(e,t),this.dispatchEvent({type:"change"}))}copy(e){this.s=e.scale,this.baseSize.set(e.baseWidth,e.baseHeight),this.preferredSize.set(e.preferredWidth,e.preferredHeight),this.dispatchEvent({type:"change"})}static get AUTO_SIZE(){return -1}},rV=new Map([[0,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb+src.rgb;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[1,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return mix(dst,src,src.a*opacity);}"],[2,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=(dst.rgb+src.rgb)*0.5;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[3,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(b.xy,a.z));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[4,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=dst.rgb,b=src.rgb;vec3 c=mix(step(0.0,b)*(1.0-min(vec3(1.0),(1.0-a)/max(b,1e-9))),vec3(1.0),step(1.0,a));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[5,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=dst.rgb,b=src.rgb;vec3 c=step(0.0,a)*mix(min(vec3(1.0),a/max(1.0-b,1e-9)),vec3(1.0),step(1.0,b));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[6,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=min(dst.rgb,src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[7,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=abs(dst.rgb-src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[8,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb/max(src.rgb,1e-9);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[9,null],[10,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb+src.rgb-2.0*dst.rgb*src.rgb;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[11,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=min(dst.rgb,1.0);vec3 b=min(src.rgb,1.0);vec3 c=mix(2.0*a*b,1.0-2.0*(1.0-a)*(1.0-b),step(0.5,b));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[12,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=step(1.0,dst.rgb+src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[13,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(b.x,a.yz));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[14,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(1.0-src.rgb,0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[15,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=src.rgb*max(1.0-dst.rgb,0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[16,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(dst.rgb,src.rgb);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[17,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=clamp(src.rgb+dst.rgb-1.0,0.0,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[18,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=min(dst.rgb+src.rgb,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[19,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=clamp(2.0*src.rgb+dst.rgb-1.0,0.0,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[20,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(a.xy,b.z));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[21,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb*src.rgb;return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[22,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(1.0-abs(1.0-dst.rgb-src.rgb),0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[23,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return mix(dst,src,opacity);}"],[24,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=2.0*src.rgb*dst.rgb;vec3 b=1.0-2.0*(1.0-src.rgb)*(1.0-dst.rgb);vec3 c=mix(a,b,step(0.5,dst.rgb));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[25,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 src2=2.0*src.rgb;vec3 c=mix(mix(src2,dst.rgb,step(0.5*dst.rgb,src.rgb)),max(src2-1.0,vec3(0.0)),step(dst.rgb,src2-1.0));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[26,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=min(dst.rgb*dst.rgb/max(1.0-src.rgb,1e-9),1.0);vec3 c=mix(a,src.rgb,step(1.0,src.rgb));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[27,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 a=RGBToHSL(dst.rgb);vec3 b=RGBToHSL(src.rgb);vec3 c=HSLToRGB(vec3(a.x,b.y,a.z));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[28,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=dst.rgb+src.rgb-min(dst.rgb*src.rgb,1.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[29,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 src2=2.0*src.rgb;vec3 d=dst.rgb+(src2-1.0);vec3 w=step(0.5,src.rgb);vec3 a=dst.rgb-(1.0-src2)*dst.rgb*(1.0-dst.rgb);vec3 b=mix(d*(sqrt(dst.rgb)-dst.rgb),d*dst.rgb*((16.0*dst.rgb-12.0)*dst.rgb+3.0),w*(1.0-step(0.25,dst.rgb)));vec3 c=mix(a,b,w);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[30,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){return src;}"],[31,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=max(dst.rgb-src.rgb,0.0);return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"],[32,"vec4 blend(const in vec4 dst,const in vec4 src,const in float opacity){vec3 c=mix(max(1.0-min((1.0-dst.rgb)/(2.0*src.rgb),1.0),0.0),min(dst.rgb/(2.0*(1.0-src.rgb)),1.0),step(0.5,src.rgb));return mix(dst,vec4(c,max(dst.a,src.a)),opacity);}"]]),rW=class extends ry.EventDispatcher{constructor(e,t=1){super(),this._blendFunction=e,this.opacity=new ry.Uniform(t)}getOpacity(){return this.opacity.value}setOpacity(e){this.opacity.value=e}get blendFunction(){return this._blendFunction}set blendFunction(e){this._blendFunction=e,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(e){this.blendFunction=e}getShaderCode(){return rV.get(this.blendFunction)}};ry.CanvasTexture;var rj=class extends ry.EventDispatcher{constructor(e,t,{attributes:n=0,blendFunction:r=23,defines:a=new Map,uniforms:i=new Map,extensions:o=null,vertexShader:l=null}={}){super(),this.name=e,this.renderer=null,this.attributes=n,this.fragmentShader=t,this.vertexShader=l,this.defines=a,this.uniforms=i,this.extensions=o,this.blendMode=new rW(r),this.blendMode.addEventListener("change",e=>
437this.setChanged()),this._inputColorSpace=ry.LinearSRGBColorSpace,this._outputColorSpace=ry.NoColorSpace}get inputColorSpace(){return this._inputColorSpace}set inputColorSpace(e){this._inputColorSpace=e,this.setChanged()}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e,this.setChanged()}set mainScene(e){}set mainCamera(e){}getName(){return this.name}setRenderer(e){this.renderer=e}getDefines(){return this.defines}getUniforms(){return this.uniforms}getExtensions(){return this.extensions}getBlendMode(){return this.blendMode}getAttributes(){return this.attributes}setAttributes(e){this.attributes=e,this.setChanged()}getFragmentShader(){return this.fragmentShader}setFragmentShader(e){this.fragmentShader=e,this.setChanged()}getVertexShader(){return this.vertexShader}setVertexShader(e){this.vertexShader=e,this.setChanged()}setChanged(){this.dispatchEvent({type:"change"})}setDepthTexture(e,t=ry.BasicDepthPacking){}update(e,t,n){}setSize(e,t){}initialize(e,t,n){}dispose(){for(let e of Object.keys(this)){let t=this[e];(t instanceof ry.WebGLRenderTarget||t instanceof ry.Material||t instanceof ry.Texture||t instanceof rC)&&this[e].dispose()}}},rX=`#ifdef FRAMEBUFFER_PRECISION_HIGH 438uniform mediump sampler2D inputBuffer; 439#else 440uniform lowp sampler2D inputBuffer; 441#endif 442varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25; 443#include <colorspace_fragment> 444}`,rq=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],rK=class extends ry.ShaderMaterial{constructor(e=new ry.Vector4){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new ry.Uniform(null),texelSize:new ry.Uniform(new ry.Vector4),scale:new ry.Uniform(1),kernel:new ry.Uniform(0)},blending:ry.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:rX,vertexShader:"uniform vec4 texelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize.xy*vec2(kernel)+texelSize.zw)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}"}),this.setTexelSize(e.x,e.y),this.kernelSize=2}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.inputBuffer=e}get kernelSequence(){return rq[this.kernelSize]}get scale(){return this.uniforms.scale.value}set scale(e){this.uniforms.scale.value=e}getScale(){return this.uniforms.scale.value}setScale(e){this.uniforms.scale.value=e}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(e){this.uniforms.kernel.value=e}setKernel(e){this.kernel=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t,.5*e,.5*t)}setSize(e,t){let n=1/e,r=1/t;this.uniforms.texelSize.value.set(n,r,.5*n,.5*r)}},rY=class extends rC{constructor({kernelSize:e=2,resolutionScale:t=.5,width:n=rH.AUTO_SIZE,height:r=rH.AUTO_SIZE,resolutionX:a=n,resolutionY:i=r}={}){super("KawaseBlurPass"),this.renderTargetA=new ry.WebGLRenderTarget(1,1,{depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";const o=this.resolution=new rH(this,a,i,t);o.addEventListener("change",e=>this.setSize(o.baseWidth,o.baseHeight)),this._blurMaterial=new rK,this._blurMaterial.kernelSize=e,this.copyMaterial=new rU}getResolution(){return this.resolution}get blurMaterial(){return this._blurMaterial}set blurMaterial(e){this._blurMaterial=e}get dithering(){return this.copyMaterial.dithering}set dithering(e){this.copyMaterial.dithering=e}get kernelSize(){return this.blurMaterial.kernelSize}set kernelSize(e){this.blurMaterial.kernelSize=e}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get scale(){return this.blurMaterial.scale}set scale(e){this.blurMaterial.scale=e}getScale(){return this.blurMaterial.scale}setScale(e){this.blurMaterial.scale=e}getKernelSize(){return this.kernelSize}setKernelSize(e){this.kernelSize=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,n,r,a){let i=this.scene,o=this.camera,l=this.renderTargetA,s=this.renderTargetB,u=this.blurMaterial,c=u.kernelSequence,d=t;this.fullscreenMaterial=u;for(let t=0,n=c.length;t<n;++t){let n=(1&t)==0?l:s;u.kernel=c[t],u.inputBuffer=d.texture,e.setRenderTarget(n),e.render(i,o),d=n}this.fullscreenMaterial=this.copyMaterial,this.copyMaterial.inputBuffer=d.texture,e.setRenderTarget(this.renderToScreen?null:n),e.render(i,o)}setSize(e,t){let n=this.resolution;n.setBaseSize(e,t);let r=n.width,a=n.height;this.renderTargetA.setSize(r,a),this.renderTargetB.setSize(r,a),this.blurMaterial.setSize(e,t)}initialize(e,t,n){void 0!==n&&(this.renderTargetA.texture.type=n,this.renderTargetB.texture.type=n,n!==ry.UnsignedByteType?(this.blurMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.copyMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1"):null!==e&&e.outputColorSpace
444===ry.SRGBColorSpace&&(this.renderTargetA.texture.colorSpace=ry.SRGBColorSpace,this.renderTargetB.texture.colorSpace=ry.SRGBColorSpace))}static get AUTO_SIZE(){return rH.AUTO_SIZE}},r$=`#include <common> 445#ifdef FRAMEBUFFER_PRECISION_HIGH 446uniform mediump sampler2D inputBuffer; 447#else 448uniform lowp sampler2D inputBuffer; 449#endif 450#ifdef RANGE 451uniform vec2 range; 452#elif defined(THRESHOLD) 453uniform float threshold;uniform float smoothing; 454#endif 455varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);float l=luminance(texel.rgb);float mask=1.0; 456#ifdef RANGE 457float low=step(range.x,l);float high=step(l,range.y);mask=low*high; 458#elif defined(THRESHOLD) 459mask=smoothstep(threshold,threshold+smoothing,l); 460#endif 461#ifdef COLOR 462gl_FragColor=texel*mask; 463#else 464gl_FragColor=vec4(l*mask); 465#endif 466}`,rQ=class extends ry.ShaderMaterial{constructor(e=!1,t=null){super({name:"LuminanceMaterial",defines:{THREE_REVISION:ry.REVISION.replace(/\D+/g,"")},uniforms:{inputBuffer:new ry.Uniform(null),threshold:new ry.Uniform(0),smoothing:new ry.Uniform(1),range:new ry.Uniform(null)},blending:ry.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:r$,vertexShader:rP}),this.colorOutput=e,this.luminanceRange=t}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get threshold(){return this.uniforms.threshold.value}set threshold(e){this.smoothing>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.threshold.value=e}getThreshold(){return this.threshold}setThreshold(e){this.threshold=e}get smoothing(){return this.uniforms.smoothing.value}set smoothing(e){this.threshold>0||e>0?this.defines.THRESHOLD="1":delete this.defines.THRESHOLD,this.uniforms.smoothing.value=e}getSmoothingFactor(){return this.smoothing}setSmoothingFactor(e){this.smoothing=e}get useThreshold(){return this.threshold>0||this.smoothing>0}set useThreshold(e){}get colorOutput(){return void 0!==this.defines.COLOR}set colorOutput(e){e?this.defines.COLOR="1":delete this.defines.COLOR,this.needsUpdate=!0}isColorOutputEnabled(e){return this.colorOutput}setColorOutputEnabled(e){this.colorOutput=e}get useRange(){return null!==this.luminanceRange}set useRange(e){this.luminanceRange=null}get luminanceRange(){return this.uniforms.range.value}set luminanceRange(e){null!==e?this.defines.RANGE="1":delete this.defines.RANGE,this.uniforms.range.value=e,this.needsUpdate=!0}getLuminanceRange(){return this.luminanceRange}setLuminanceRange(e){this.luminanceRange=e}},rZ=class extends rC{constructor({renderTarget:e,luminanceRange:t,colorOutput:n,resolutionScale:r=1,width:a=rH.AUTO_SIZE,height:i=rH.AUTO_SIZE,resolutionX:o=a,resolutionY:l=i}={}){super("LuminancePass"),this.fullscreenMaterial=new rQ(n,t),this.needsSwap=!1,this.renderTarget=e,void 0===this.renderTarget&&(this.renderTarget=new ry.WebGLRenderTarget(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="LuminancePass.Target");const s=this.resolution=new rH(this,o,l,r);s.addEventListener("change",e=>this.setSize(s.baseWidth,s.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}render(e,t,n,r,a){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){let n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height)}initialize(e,t,n){void 0!==n&&n!==ry.UnsignedByteType&&(this.renderTarget.texture.type=n,this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}},rJ=`#ifdef FRAMEBUFFER_PRECISION_HIGH 467uniform mediump sampler2D inputBuffer; 468#else 469uniform lowp sampler2D inputBuffer; 470#endif 471#define WEIGHT_INNER 0.125 472#define WEIGHT_OUTER 0.05556 473varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;float clampToBorder(const in vec2 uv){return float(uv.s>=0.0&&uv.s<=1.0&&uv.t>=0.0&&uv.t<=1.0);}void main(){vec4 c=vec4(0.0);vec4 w=WEIGHT_INNER*vec4(clampToBorder(vUv00),clampToBorder(vUv01),clampToBorder(vUv02),clampToBorder(vUv03));c+=w.x*texture2D(inputBuffer,vUv00);c+=w.y*texture2D(inputBuffer,vUv01);c+=w.z*texture2D(inputBuffer,vUv02);c+=w.w*texture2D(inputBuffer,vUv03);w=WEIGHT_OUTER*vec4(clampToBorder(vUv04),clampToBorder(vUv05),clampToBorder(vUv06),clampToBorder(vUv07));c+=w.x*texture2D(inputBuffer,vUv04);c+=w.y*texture2D(inputBuffer,vUv05);c+=w.z*texture2D(inputBuffer,vUv06);c+=w.w*texture2D(inputBuffer,vUv07);w=WEIGHT_OUTER*vec4(clampToBorder(vUv08),clampToBorder(vUv09),clampToBorder(vUv10),clampToBorder(vUv11));c+=w.x*texture2D(inputBuffer,vUv08);c+=w.y*texture2D(inputBuffer,vUv09);c+=w.z*texture2D(inputBuffer,vUv10);c+=w.w*texture2D(inputBuffer,vUv11);c+=WEIGHT_OUTER*texture2D(inputBuffer,vUv);gl_FragColor=c; 474#include <colorspace_fragment> 475}`,r0=class extends ry.ShaderMaterial{constructor(){super({name:"DownsamplingMaterial",uniforms:{inputBuffer:new ry.Uniform(null),texelSize:new ry.Uniform(new ry.Vector2)},blending:ry.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:rJ,vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv00;varying vec2 vUv01;varying vec2 vUv02;varying vec2 vUv03;varying vec2 vUv04;varying vec2 vUv05;varying vec2 vUv06;varying vec2 vUv07;varying vec2 vUv08;varying vec2 vUv09;varying vec2 vUv10;varying vec2 vUv11;void main(){vUv=position.xy*0.5+0.5;
475vUv00=vUv+texelSize*vec2(-1.0,1.0);vUv01=vUv+texelSize*vec2(1.0,1.0);vUv02=vUv+texelSize*vec2(-1.0,-1.0);vUv03=vUv+texelSize*vec2(1.0,-1.0);vUv04=vUv+texelSize*vec2(-2.0,2.0);vUv05=vUv+texelSize*vec2(0.0,2.0);vUv06=vUv+texelSize*vec2(2.0,2.0);vUv07=vUv+texelSize*vec2(-2.0,0.0);vUv08=vUv+texelSize*vec2(2.0,0.0);vUv09=vUv+texelSize*vec2(-2.0,-2.0);vUv10=vUv+texelSize*vec2(0.0,-2.0);vUv11=vUv+texelSize*vec2(2.0,-2.0);gl_Position=vec4(position.xy,1.0,1.0);}"})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},r1=`#ifdef FRAMEBUFFER_PRECISION_HIGH 476uniform mediump sampler2D inputBuffer;uniform mediump sampler2D supportBuffer; 477#else 478uniform lowp sampler2D inputBuffer;uniform lowp sampler2D supportBuffer; 479#endif 480uniform float radius;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vec4 c=vec4(0.0);c+=texture2D(inputBuffer,vUv0)*0.0625;c+=texture2D(inputBuffer,vUv1)*0.125;c+=texture2D(inputBuffer,vUv2)*0.0625;c+=texture2D(inputBuffer,vUv3)*0.125;c+=texture2D(inputBuffer,vUv)*0.25;c+=texture2D(inputBuffer,vUv4)*0.125;c+=texture2D(inputBuffer,vUv5)*0.0625;c+=texture2D(inputBuffer,vUv6)*0.125;c+=texture2D(inputBuffer,vUv7)*0.0625;vec4 baseColor=texture2D(supportBuffer,vUv);gl_FragColor=mix(baseColor,c,radius); 481#include <colorspace_fragment> 482}`,r2=class extends ry.ShaderMaterial{constructor(){super({name:"UpsamplingMaterial",uniforms:{inputBuffer:new ry.Uniform(null),supportBuffer:new ry.Uniform(null),texelSize:new ry.Uniform(new ry.Vector2),radius:new ry.Uniform(.85)},blending:ry.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:r1,vertexShader:"uniform vec2 texelSize;varying vec2 vUv;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;varying vec2 vUv4;varying vec2 vUv5;varying vec2 vUv6;varying vec2 vUv7;void main(){vUv=position.xy*0.5+0.5;vUv0=vUv+texelSize*vec2(-1.0,1.0);vUv1=vUv+texelSize*vec2(0.0,1.0);vUv2=vUv+texelSize*vec2(1.0,1.0);vUv3=vUv+texelSize*vec2(-1.0,0.0);vUv4=vUv+texelSize*vec2(1.0,0.0);vUv5=vUv+texelSize*vec2(-1.0,-1.0);vUv6=vUv+texelSize*vec2(0.0,-1.0);vUv7=vUv+texelSize*vec2(1.0,-1.0);gl_Position=vec4(position.xy,1.0,1.0);}"})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}set supportBuffer(e){this.uniforms.supportBuffer.value=e}get radius(){return this.uniforms.radius.value}set radius(e){this.uniforms.radius.value=e}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},r3=class extends rC{constructor(){super("MipmapBlurPass"),this.needsSwap=!1,this.renderTarget=new ry.WebGLRenderTarget(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Upsampling.Mipmap0",this.downsamplingMipmaps=[],this.upsamplingMipmaps=[],this.downsamplingMaterial=new r0,this.upsamplingMaterial=new r2,this.resolution=new ry.Vector2}get texture(){return this.renderTarget.texture}get levels(){return this.downsamplingMipmaps.length}set levels(e){if(this.levels!==e){let t=this.renderTarget;this.dispose(),this.downsamplingMipmaps=[],this.upsamplingMipmaps=[];for(let n=0;n<e;++n){let e=t.clone();e.texture.name="Downsampling.Mipmap"+n,this.downsamplingMipmaps.push(e)}this.upsamplingMipmaps.push(t);for(let n=1,r=e-1;n<r;++n){let e=t.clone();e.texture.name="Upsampling.Mipmap"+n,this.upsamplingMipmaps.push(e)}this.setSize(this.resolution.x,this.resolution.y)}}get radius(){return this.upsamplingMaterial.radius}set radius(e){this.upsamplingMaterial.radius=e}render(e,t,n,r,a){let{scene:i,camera:o}=this,{downsamplingMaterial:l,upsamplingMaterial:s}=this,{downsamplingMipmaps:u,upsamplingMipmaps:c}=this,d=t;this.fullscreenMaterial=l;for(let t=0,n=u.length;t<n;++t){let n=u[t];l.setSize(d.width,d.height),l.inputBuffer=d.texture,e.setRenderTarget(n),e.render(i,o),d=n}this.fullscreenMaterial=s;for(let t=c.length-1;t>=0;--t){let n=c[t];s.setSize(d.width,d.height),s.inputBuffer=d.texture,s.supportBuffer=u[t].texture,e.setRenderTarget(n),e.render(i,o),d=n}}setSize(e,t){let n=this.resolution;n.set(e,t);let r=n.width,a=n.height;for(let e=0,t=this.downsamplingMipmaps.length;e<t;++e)r=Math.round(.5*r),a=Math.round(.5*a),this.downsamplingMipmaps[e].setSize(r,a),e<this.upsamplingMipmaps.length&&this.upsamplingMipmaps[e].setSize(r,a)}initialize(e,t,n){if(void 0!==n){let t=this.downsamplingMipmaps.concat(this.upsamplingMipmaps);for(let e of t)e.texture.type=n;if(n!==ry.UnsignedByteType)this.downsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1",this.upsamplingMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1";
482else if(null!==e&&e.outputColorSpace===ry.SRGBColorSpace)for(let e of t)e.texture.colorSpace=ry.SRGBColorSpace}}dispose(){for(let e of(super.dispose(),this.downsamplingMipmaps.concat(this.upsamplingMipmaps)))e.dispose()}},r4=`#ifdef FRAMEBUFFER_PRECISION_HIGH 483uniform mediump sampler2D map; 484#else 485uniform lowp sampler2D map; 486#endif 487uniform float intensity;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){outputColor=texture2D(map,uv)*intensity;}`,r5=class extends rj{constructor({blendFunction:e=28,luminanceThreshold:t=1,luminanceSmoothing:n=.03,mipmapBlur:r=!0,intensity:a=1,radius:i=.85,levels:o=8,kernelSize:l=3,resolutionScale:s=.5,width:u=rH.AUTO_SIZE,height:c=rH.AUTO_SIZE,resolutionX:d=u,resolutionY:f=c}={}){super("BloomEffect",r4,{blendFunction:e,uniforms:new Map([["map",new ry.Uniform(null)],["intensity",new ry.Uniform(a)]])}),this.renderTarget=new ry.WebGLRenderTarget(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="Bloom.Target",this.blurPass=new rY({kernelSize:l}),this.luminancePass=new rZ({colorOutput:!0}),this.luminanceMaterial.threshold=t,this.luminanceMaterial.smoothing=n,this.mipmapBlurPass=new r3,this.mipmapBlurPass.enabled=r,this.mipmapBlurPass.radius=i,this.mipmapBlurPass.levels=o,this.uniforms.get("map").value=r?this.mipmapBlurPass.texture:this.renderTarget.texture;const p=this.resolution=new rH(this,d,f,s);p.addEventListener("change",e=>this.setSize(p.baseWidth,p.baseHeight))}get texture(){return this.mipmapBlurPass.enabled?this.mipmapBlurPass.texture:this.renderTarget.texture}getTexture(){return this.texture}getResolution(){return this.resolution}getBlurPass(){return this.blurPass}getLuminancePass(){return this.luminancePass}get luminanceMaterial(){return this.luminancePass.fullscreenMaterial}getLuminanceMaterial(){return this.luminancePass.fullscreenMaterial}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get dithering(){return this.blurPass.dithering}set dithering(e){this.blurPass.dithering=e}get kernelSize(){return this.blurPass.kernelSize}set kernelSize(e){this.blurPass.kernelSize=e}get distinction(){return console.warn(this.name,"distinction was removed"),1}set distinction(e){console.warn(this.name,"distinction was removed")}get intensity(){return this.uniforms.get("intensity").value}set intensity(e){this.uniforms.get("intensity").value=e}getIntensity(){return this.intensity}setIntensity(e){this.intensity=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}update(e,t,n){let r=this.renderTarget,a=this.luminancePass;a.enabled?(a.render(e,t),this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(e,a.renderTarget):this.blurPass.render(e,a.renderTarget,r)):this.mipmapBlurPass.enabled?this.mipmapBlurPass.render(e,t):this.blurPass.render(e,t,r)}setSize(e,t){let n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height),this.blurPass.resolution.copy(n),this.luminancePass.setSize(e,t),this.mipmapBlurPass.setSize(e,t)}initialize(e,t,n){this.blurPass.initialize(e,t,n),this.luminancePass.initialize(e,t,n),this.mipmapBlurPass.initialize(e,t,n),void 0!==n&&(this.renderTarget.texture.type=n,null!==e&&e.outputColorSpace===ry.SRGBColorSpace&&(this.renderTarget.texture.colorSpace=ry.SRGBColorSpace))}};ry.ShaderMaterial;ry.ShaderMaterial;ry.ShaderMaterial,ry.DataTexture;ry.ShaderMaterial;var r6=class extends rC{constructor(e,t,n=null){super("RenderPass",e,t),this.needsSwap=!1,this.needsDepthBlit=!0,this.clearPass=new rN,this.overrideMaterialManager=null===n?null:new rz(n),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}set mainScene(e){this.scene=e}set mainCamera(e){this.camera=e}get renderToScreen(){return super.renderToScreen}set renderToScreen(e){super.renderToScreen=e,this.clearPass.renderToScreen=e}get overrideMaterial(){let e=this.overrideMaterialManager;return null!==e?e.material:null}set overrideMaterial(e){let t=this.overrideMaterialManager;null!==e?null!==t?t.setMaterial(e):this.overrideMaterialManager=new rz(e):null!==t&&(t.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(e){this.overrideMaterial=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getSelection(){return this.selection}setSelection(e){this.selection=e}
487isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(e){this.ignoreBackground=e}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(e){this.skipShadowMapUpdate=e}getClearPass(){return this.clearPass}render(e,t,n,r,a){let i=this.scene,o=this.camera,l=this.selection,s=o.layers.mask,u=i.background,c=e.shadowMap.autoUpdate,d=this.renderToScreen?null:t;null!==l&&o.layers.set(l.getLayer()),this.skipShadowMapUpdate&&(e.shadowMap.autoUpdate=!1),(this.ignoreBackground||null!==this.clearPass.overrideClearColor)&&(i.background=null),this.clearPass.enabled&&this.clearPass.render(e,t),e.setRenderTarget(d),null!==this.overrideMaterialManager?this.overrideMaterialManager.render(e,i,o):e.render(i,o),o.layers.mask=s,i.background=u,e.shadowMap.autoUpdate=c}};ry.Data3DTexture,ry.ShaderMaterial,ry.ShaderMaterial;ry.ShaderMaterial;ry.ShaderMaterial;ry.ShaderMaterial;ry.ShaderMaterial;var r8=`#include <packing> 488#ifdef GL_FRAGMENT_PRECISION_HIGH 489uniform highp sampler2D depthBuffer; 490#else 491uniform mediump sampler2D depthBuffer; 492#endif 493#ifdef DOWNSAMPLE_NORMALS 494uniform lowp sampler2D normalBuffer; 495#endif 496varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;float readDepth(const in vec2 uv){ 497#if DEPTH_PACKING == 3201 498return unpackRGBAToDepth(texture2D(depthBuffer,uv)); 499#else 500return texture2D(depthBuffer,uv).r; 501#endif 502}int findBestDepth(const in float samples[4]){float c=(samples[0]+samples[1]+samples[2]+samples[3])*0.25;float distances[4];distances[0]=abs(c-samples[0]);distances[1]=abs(c-samples[1]);distances[2]=abs(c-samples[2]);distances[3]=abs(c-samples[3]);float maxDistance=max(max(distances[0],distances[1]),max(distances[2],distances[3]));int remaining[3];int rejected[3];int i,j,k;for(i=0,j=0,k=0;i<4;++i){if(distances[i]<maxDistance){remaining[j++]=i;}else{rejected[k++]=i;}}for(;j<3;++j){remaining[j]=rejected[--k];}vec3 s=vec3(samples[remaining[0]],samples[remaining[1]],samples[remaining[2]]);c=(s.x+s.y+s.z)/3.0;distances[0]=abs(c-s.x);distances[1]=abs(c-s.y);distances[2]=abs(c-s.z);float minDistance=min(distances[0],min(distances[1],distances[2]));for(i=0;i<3;++i){if(distances[i]==minDistance){break;}}return remaining[i];}void main(){float d[4];d[0]=readDepth(vUv0);d[1]=readDepth(vUv1);d[2]=readDepth(vUv2);d[3]=readDepth(vUv3);int index=findBestDepth(d); 503#ifdef DOWNSAMPLE_NORMALS 504vec3 n[4];n[0]=texture2D(normalBuffer,vUv0).rgb;n[1]=texture2D(normalBuffer,vUv1).rgb;n[2]=texture2D(normalBuffer,vUv2).rgb;n[3]=texture2D(normalBuffer,vUv3).rgb; 505#else 506vec3 n[4];n[0]=vec3(0.0);n[1]=vec3(0.0);n[2]=vec3(0.0);n[3]=vec3(0.0); 507#endif 508gl_FragColor=vec4(n[index],d[index]);}`,r9=class extends ry.ShaderMaterial{constructor(){super({name:"DepthDownsamplingMaterial",defines:{DEPTH_PACKING:"0"},uniforms:{depthBuffer:new ry.Uniform(null),normalBuffer:new ry.Uniform(null),texelSize:new ry.Uniform(new ry.Vector2)},blending:ry.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:r8,vertexShader:"uniform vec2 texelSize;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vUv0=uv;vUv1=vec2(uv.x,uv.y+texelSize.y);vUv2=vec2(uv.x+texelSize.x,uv.y);vUv3=uv+texelSize;gl_Position=vec4(position.xy,1.0,1.0);}"})}set depthBuffer(e){this.uniforms.depthBuffer.value=e}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=ry.BasicDepthPacking){this.depthBuffer=e,this.depthPacking=t}set normalBuffer(e){this.uniforms.normalBuffer.value=e,null!==e?this.defines.DOWNSAMPLE_NORMALS="1":delete this.defines.DOWNSAMPLE_NORMALS,this.needsUpdate=!0}setNormalBuffer(e){this.normalBuffer=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t)}setSize(e,t){this.uniforms.texelSize.value.set(1/e,1/t)}},r7=class extends rC{constructor({normalBuffer:e=null,resolutionScale:t=.5,width:n=rH.AUTO_SIZE,height:r=rH.AUTO_SIZE,resolutionX:a=n,resolutionY:i=r}={}){super("DepthDownsamplingPass");const o=new r9;o.normalBuffer=e,this.fullscreenMaterial=o,this.needsDepthTexture=!0,this.needsSwap=!1,this.renderTarget=new ry.WebGLRenderTarget(1,1,{minFilter:ry.NearestFilter,magFilter:ry.NearestFilter,depthBuffer:!1,type:ry.FloatType}),this.renderTarget.texture.name="DepthDownsamplingPass.Target",this.renderTarget.texture.generateMipmaps=!1;const l=this.resolution=new rH(this,a,i,t);l.addEventListener("change",e=>this.setSize(l.baseWidth,l.baseHeight))}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}
508setDepthTexture(e,t=ry.BasicDepthPacking){this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t}render(e,t,n,r,a){e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){let n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height),this.fullscreenMaterial.setSize(e,t)}initialize(e,t,n){let r=e.getContext();if(!(r.getExtension("EXT_color_buffer_float")||r.getExtension("EXT_color_buffer_half_float")))throw Error("Rendering to float texture is not supported.")}},ae=`#ifdef FRAMEBUFFER_PRECISION_HIGH 509uniform mediump sampler2D inputBuffer; 510#else 511uniform lowp sampler2D inputBuffer; 512#endif 513uniform vec4 maskParams;varying vec2 vUv;varying vec2 vUv2;varying vec2 vOffset;float linearGradientMask(const in float x){return smoothstep(maskParams.x,maskParams.y,x)-smoothstep(maskParams.w,maskParams.z,x);}void main(){vec2 dUv=vOffset*(1.0-linearGradientMask(vUv2.y));vec4 sum=texture2D(inputBuffer,vec2(vUv.x-dUv.x,vUv.y+dUv.y));sum+=texture2D(inputBuffer,vec2(vUv.x+dUv.x,vUv.y+dUv.y));sum+=texture2D(inputBuffer,vec2(vUv.x+dUv.x,vUv.y-dUv.y));sum+=texture2D(inputBuffer,vec2(vUv.x-dUv.x,vUv.y-dUv.y));gl_FragColor=sum*0.25; 514#include <colorspace_fragment> 515}`,at=`#include <packing> 516#define packFloatToRGBA(v) packDepthToRGBA(v) 517#define unpackRGBAToFloat(v) unpackRGBAToDepth(v) 518uniform lowp sampler2D luminanceBuffer0;uniform lowp sampler2D luminanceBuffer1;uniform float minLuminance;uniform float deltaTime;uniform float tau;varying vec2 vUv;void main(){float l0=unpackRGBAToFloat(texture2D(luminanceBuffer0,vUv)); 519#if __VERSION__ < 300 520float l1=texture2DLodEXT(luminanceBuffer1,vUv,MIP_LEVEL_1X1).r; 521#else 522float l1=textureLod(luminanceBuffer1,vUv,MIP_LEVEL_1X1).r; 523#endif 524l0=max(minLuminance,l0);l1=max(minLuminance,l1);float adaptedLum=l0+(l1-l0)*(1.0-exp(-deltaTime*tau));gl_FragColor=(adaptedLum==1.0)?vec4(1.0):packFloatToRGBA(adaptedLum);}`,an=class extends ry.ShaderMaterial{constructor(){super({name:"AdaptiveLuminanceMaterial",defines:{MIP_LEVEL_1X1:"0.0"},uniforms:{luminanceBuffer0:new ry.Uniform(null),luminanceBuffer1:new ry.Uniform(null),minLuminance:new ry.Uniform(.01),deltaTime:new ry.Uniform(0),tau:new ry.Uniform(1)},extensions:{shaderTextureLOD:!0},blending:ry.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:at,vertexShader:rP})}set luminanceBuffer0(e){this.uniforms.luminanceBuffer0.value=e}setLuminanceBuffer0(e){this.uniforms.luminanceBuffer0.value=e}set luminanceBuffer1(e){this.uniforms.luminanceBuffer1.value=e}setLuminanceBuffer1(e){this.uniforms.luminanceBuffer1.value=e}set mipLevel1x1(e){this.defines.MIP_LEVEL_1X1=e.toFixed(1),this.needsUpdate=!0}setMipLevel1x1(e){this.mipLevel1x1=e}set deltaTime(e){this.uniforms.deltaTime.value=e}setDeltaTime(e){this.uniforms.deltaTime.value=e}get minLuminance(){return this.uniforms.minLuminance.value}set minLuminance(e){this.uniforms.minLuminance.value=e}getMinLuminance(){return this.uniforms.minLuminance.value}setMinLuminance(e){this.uniforms.minLuminance.value=e}get adaptationRate(){return this.uniforms.tau.value}set adaptationRate(e){this.uniforms.tau.value=e}getAdaptationRate(){return this.uniforms.tau.value}setAdaptationRate(e){this.uniforms.tau.value=e}},ar=`uniform float offset;uniform float darkness;void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){const vec2 center=vec2(0.5);vec3 color=inputColor.rgb; 525#if VIGNETTE_TECHNIQUE == 0 526float d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offset)); 527#else 528vec2 coord=(uv-center)*vec2(offset);color=mix(color,vec3(1.0-darkness),dot(coord,coord)); 529#endif 530outputColor=vec4(color,inputColor.a);}`,aa=class extends rj{constructor({blendFunction:e,eskil:t=!1,technique:n=1*!!t,offset:r=.5,darkness:a=.5}={}){super("VignetteEffect",ar,{blendFunction:e,defines:new Map([["VIGNETTE_TECHNIQUE",n.toFixed(0)]]),uniforms:new Map([["offset",new ry.Uniform(r)],["darkness",new ry.Uniform(a)]])})}get technique(){return Number(this.defines.get("VIGNETTE_TECHNIQUE"))}set technique(e){this.technique!==e&&(this.defines.set("VIGNETTE_TECHNIQUE",e.toFixed(0)),this.setChanged())}get eskil(){return 1===this.technique}set eskil(e){this.technique=1*!!e}getTechnique(){return this.technique}setTechnique(e){this.technique=e}get offset(){return this.uniforms.get("offset").value}set offset(e){this.uniforms.get("offset").value=e}getOffset(){return this.offset}setOffset(e){this.offset=e}get darkness(){return this.uniforms.get("darkness").value}set darkness(e){this.uniforms.get("darkness").value=e}getDarkness(){return this.darkness}setDarkness(e){this.darkness=e}};ry.Loader,ry.Loader,ry.Loader;ry.ShaderMaterial;ry.ShaderMaterial;var ai=`#include <common> 531#include <packing> 532#include <dithering_pars_fragment> 533#define packFloatToRGBA(v) packDepthToRGBA(v) 534#define unpackRGBAToFloat(v) unpackRGBAToDepth(v) 535#ifdef FRAMEBUFFER_PRECISION_HIGH 536uniform mediump sampler2D inputBuffer; 537#else 538uniform lowp sampler2D inputBuffer; 539#endif 540#if DEPTH_PACKING == 3201 541uniform lowp sampler2D depthBuffer; 542#elif defined(GL_FRAGMENT_PRECISION_HIGH) 543uniform highp sampler2D depthBuffer; 544#else 545uniform mediump sampler2D depthBuffer; 546#endif 547uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;vec4 sRGBToLinear(const in vec4 value){return 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);}float readDepth(const in vec2 uv){ 548#if DEPTH_PACKING == 3201 549float depth=unpackRGBAToDepth(texture2D(depthBuffer,uv)); 550#else 551float depth=texture2D(depthBuffer,uv).r; 552#endif 553#if defined(USE_LOGARITHMIC_DEPTH_BUFFER) || defined(LOG_DEPTH) 554float d=pow(2.0,depth*log2(cameraFar+1.0))-1.0;float a=cameraFar/(cameraFar-cameraNear);float b=cameraFar*cameraNear/(cameraNear-cameraFar);depth=a+b/d; 555#elif defined(USE_REVERSED_DEPTH_BUFFER) 556depth=1.0-depth; 557#endif 558return depth;}float getViewZ(const in float depth){ 559#ifdef PERSPECTIVE_CAMERA 560return perspectiveDepthToViewZ(depth,cameraNear,cameraFar); 561#else 562return orthographicDepthToViewZ(depth,cameraNear,cameraFar); 563#endif 564}vec3 RGBToHCV(const in vec3 RGB){vec4 P=mix(vec4(RGB.bg,-1.0,2.0/3.0),vec4(RGB.gb,0.0,-1.0/3.0),step(RGB.b,RGB.g));vec4 Q=mix(vec4(P.xyw,RGB.r),vec4(RGB.r,P.yzx),step(P.x,RGB.r));float C=Q.x-min(Q.w,Q.y);float H=abs((Q.w-Q.y)/(6.0*C+EPSILON)+Q.z);return vec3(H,C,Q.x);}vec3 RGBToHSL(const in vec3 RGB){vec3 HCV=RGBToHCV(RGB);float L=HCV.z-HCV.y*0.5;float S=HCV.y/(1.0-abs(L*2.0-1.0)+EPSILON);return vec3(HCV.x,S,L);}vec3 HueToRGB(const in float H){float R=abs(H*6.0-3.0)-1.0;float G=2.0-abs(H*6.0-2.0);float B=2.0-abs(H*6.0-4.0);return clamp(vec3(R,G,B),0.0,1.0);}vec3 HSLToRGB(const in vec3 HSL){vec3 RGB=HueToRGB(HSL.x);float C=(1.0-abs(2.0*HSL.z-1.0))*HSL.y;return(RGB-0.5)*C+HSL.z;}FRAGMENT_HEAD void main(){FRAGMENT_MAIN_UV vec4 color0=texture2D(inputBuffer,UV);vec4 color1=vec4(0.0);FRAGMENT_MAIN_IMAGE color0.a=clamp(color0.a,0.0,1.0);gl_FragColor=color0; 565#ifdef ENCODE_OUTPUT 566#include <colorspace_fragment> 567#endif 568#include <dithering_fragment> 569}`,ao=class extends ry.ShaderMaterial{constructor(e,t,n,r,a=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:ry.REVISION.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new ry.Uniform(null),depthBuffer:new ry.Uniform(null),resolution:new ry.Uniform(new ry.Vector2),texelSize:new ry.Uniform(new ry.Vector2),cameraNear:new ry.Uniform(.3),cameraFar:new ry.Uniform(1e3),aspect:ne
569w ry.Uniform(1),time:new ry.Uniform(0)},blending:ry.NoBlending,toneMapped:!1,depthWrite:!1,depthTest:!1,dithering:a}),e&&this.setShaderParts(e),t&&this.setDefines(t),n&&this.setUniforms(n),this.copyCameraSettings(r)}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(e){this.uniforms.depthBuffer.value=e}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=ry.BasicDepthPacking){this.depthBuffer=e,this.depthPacking=t}setShaderData(e){this.setShaderParts(e.shaderParts),this.setDefines(e.defines),this.setUniforms(e.uniforms),this.setExtensions(e.extensions)}setShaderParts(e){return this.fragmentShader=ai.replace(rO.FRAGMENT_HEAD,e.get(rO.FRAGMENT_HEAD)||"").replace(rO.FRAGMENT_MAIN_UV,e.get(rO.FRAGMENT_MAIN_UV)||"").replace(rO.FRAGMENT_MAIN_IMAGE,e.get(rO.FRAGMENT_MAIN_IMAGE)||""),this.vertexShader="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEAD void main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORT gl_Position=vec4(position.xy,1.0,1.0);}".replace(rO.VERTEX_HEAD,e.get(rO.VERTEX_HEAD)||"").replace(rO.VERTEX_MAIN_SUPPORT,e.get(rO.VERTEX_MAIN_SUPPORT)||""),this.needsUpdate=!0,this}setDefines(e){for(let t of e.entries())this.defines[t[0]]=t[1];return this.needsUpdate=!0,this}setUniforms(e){for(let t of e.entries())this.uniforms[t[0]]=t[1];return this}setExtensions(e){for(let t of(this.extensions={},e))this.extensions[t]=!0;return this}get encodeOutput(){return void 0!==this.defines.ENCODE_OUTPUT}set encodeOutput(e){this.encodeOutput!==e&&(e?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(e){return this.encodeOutput}setOutputEncodingEnabled(e){this.encodeOutput=e}get time(){return this.uniforms.time.value}set time(e){this.uniforms.time.value=e}setDeltaTime(e){this.uniforms.time.value+=e}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof ry.PerspectiveCamera?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(e,t){let n=this.uniforms;n.resolution.value.set(e,t),n.texelSize.value.set(1/e,1/t),n.aspect.value=e/t}static get Section(){return rO}};ry.ShaderMaterial,ry.REVISION.replace(/\D+/g,"");var al=255/256;function as(e,t,n){for(let r of t){let t="$1"+e+r.charAt(0).toUpperCase()+r.slice(1),a=RegExp("([^\\.])(\\b"+r+"\\b)","g");for(let e of n.entries())null!==e[1]&&n.set(e[0],e[1].replace(a,t))}}new Float32Array([255/256/0x1000000,255/256/65536,255/256/256,255/256]),new Float32Array([al,al/256,al/65536,1/0x1000000]);var au=class extends rC{constructor(e,...t){super("EffectPass"),this.fullscreenMaterial=new ao(null,null,null,e),this.listener=e=>this.handleEvent(e),this.effects=[],this.setEffects(t),this.skipRendering=!1,this.minTime=1,this.maxTime=1/0,this.timeScale=1}set mainScene(e){for(let t of this.effects)t.mainScene=e}set mainCamera(e){for(let t of(this.fullscreenMaterial.copyCameraSettings(e),this.effects))t.mainCamera=e}get encodeOutput(){return this.fullscreenMaterial.encodeOutput}set encodeOutput(e){this.fullscreenMaterial.encodeOutput=e}get dithering(){return this.fullscreenMaterial.dithering}set dithering(e){let t=this.fullscreenMaterial;t.dithering=e,t.needsUpdate=!0}setEffects(e){for(let e of this.effects)e.removeEventListener("change",this.listener);for(let t of(this.effects=e.sort((e,t)=>t.attributes-e.attributes),this.effects))t.addEventListener("change",this.listener)}updateMaterial(){let e=new rG,t=0;for(let n of this.effects)if(9===n.blendMode.blendFunction)e.attributes|=1&n.getAttributes();else if((e.attributes&n.getAttributes()&2)!=0)throw Error(`Convolution effects cannot be merged (${n.name})`);else!function(e,t,n){let r=t.getFragmentShader(),a=t.getVertexShader(),i=void 0!==r&&/mainImage/.test(r),o=void 0!==r&&/mainUv/.test(r);if(n.attributes|=t.getAttributes(),void 0===r)throw Error(`Missing fragment shader (${t.name})`);if(o&&(2&n.attributes)!=0)throw Error(`Effects that transform UVs are incompatible with convolution effects (${t.name})`);if(i||o){let l=/\w+\s+(\w+)\([\w\s,]*\)\s*{/g,s=n.shaderParts,u=s.get(rO.FRAGMENT_HEAD)||"",c=s.get(rO.FRAGMENT_MAIN_UV)||"",d=s.get(rO.FRAGMENT_MAIN_IMAGE)||"",f=s.get(rO.VERTEX_HEAD)||"",p=s.get(rO.VERTEX_MAIN_SUPPORT)||"",m=new Set,h=new Set;
569if(o&&(c+=` ${e}MainUv(UV); 570`,n.uvTransformation=!0),null!==a&&/mainSupport/.test(a)){let t=/mainSupport *\([\w\s]*?uv\s*?\)/.test(a);for(let r of(p+=` ${e}MainSupport(`,p+=t?"vUv);\n":");\n",a.matchAll(/(?:varying\s+\w+\s+([\S\s]*?);)/g)))for(let e of r[1].split(/\s*,\s*/))n.varyings.add(e),m.add(e),h.add(e);for(let e of a.matchAll(l))h.add(e[1])}for(let e of r.matchAll(l))h.add(e[1]);for(let e of t.defines.keys())h.add(e.replace(/\([\w\s,]*\)/g,""));for(let e of t.uniforms.keys())h.add(e);h.delete("while"),h.delete("for"),h.delete("if"),t.uniforms.forEach((t,r)=>n.uniforms.set(e+r.charAt(0).toUpperCase()+r.slice(1),t)),t.defines.forEach((t,r)=>n.defines.set(e+r.charAt(0).toUpperCase()+r.slice(1),t));let g=new Map([["fragment",r],["vertex",a]]);as(e,h,n.defines),as(e,h,g),r=g.get("fragment"),a=g.get("vertex");let v=t.blendMode;if(n.blendModes.set(v.blendFunction,v),i){null!==t.inputColorSpace&&t.inputColorSpace!==n.colorSpace&&(d+=t.inputColorSpace===ry.SRGBColorSpace?"color0 = sRGBTransferOETF(color0);\n ":"color0 = sRGBToLinear(color0);
570\n "),t.outputColorSpace!==ry.NoColorSpace?n.colorSpace=t.outputColorSpace:null!==t.inputColorSpace&&(n.colorSpace=t.inputColorSpace),d+=`${e}MainImage(color0, UV, `,(1&n.attributes)!=0&&/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/.test(r)&&(d+="depth, ",n.readDepth=!0),d+="color1);\n ";let a=e+"BlendOpacity";n.uniforms.set(a,v.opacity),d+=`color0 = blend${v.blendFunction}(color0, color1, ${a}); 571 572 `,u+=`uniform float ${a}; 573 574`}if(u+=r+"\n",null!==a&&(f+=a+"\n"),s.set(rO.FRAGMENT_HEAD,u),s.set(rO.FRAGMENT_MAIN_UV,c),s.set(rO.FRAGMENT_MAIN_IMAGE,d),s.set(rO.VERTEX_HEAD,f),s.set(rO.VERTEX_MAIN_SUPPORT,p),null!==t.extensions)for(let e of t.extensions)n.extensions.add(e)}else throw Error(`Could not find mainImage or mainUv function (${t.name})`)}("e"+t++,n,e);let n=e.shaderParts.get(rO.FRAGMENT_HEAD),r=e.shaderParts.get(rO.FRAGMENT_MAIN_IMAGE),a=e.shaderParts.get(rO.FRAGMENT_MAIN_UV),i=/\bblend\b/g;for(let t of e.blendModes.values())n+=t.getShaderCode().replace(i,`blend${t.blendFunction}`)+"\n";for(let[t,i]of((1&e.attributes)!=0?(e.readDepth&&(r="float depth = readDepth(UV);\n\n "+r),this.needsDepthTexture=null===this.getDepthTexture()):this.needsDepthTexture=!1,e.colorSpace===ry.SRGBColorSpace&&(r+="color0 = sRGBToLinear(color0);\n "),e.uvTransformation?(a="vec2 transformedUv = vUv;\n"+a,e.defines.set("UV","transformedUv")):e.defines.set("UV","vUv"),e.shaderParts.set(rO.FRAGMENT_HEAD,n),e.shaderParts.set(rO.FRAGMENT_MAIN_IMAGE,r),e.shaderParts.set(rO.FRAGMENT_MAIN_UV,a),e.shaderParts))null!==i&&e.shaderParts.set(t,i.trim().replace(/^#/,"\n#"));this.skipRendering=0===t,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(e)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(e,t=ry.BasicDepthPacking){for(let n of(this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t,this.effects))n.setDepthTexture(e,t)}render(e,t,n,r,a){for(let n of this.effects)n.update(e,t,r);if(!this.skipRendering||this.renderToScreen){let a=this.fullscreenMaterial;a.inputBuffer=t.texture,a.time+=r*this.timeScale,e.setRenderTarget(this.renderToScreen?null:n),e.render(this.scene,this.camera)}}setSize(e,t){for(let n of(this.fullscreenMaterial.setSize(e,t),this.effects))n.setSize(e,t)}initialize(e,t,n){for(let r of(this.renderer=e,this.effects))r.initialize(e,t,n);this.updateMaterial(),void 0!==n&&n!==ry.UnsignedByteType&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){for(let e of(super.dispose(),this.effects))e.removeEventListener("change",this.listener),e.dispose()}handleEvent(e){"change"===e.type&&this.recompile()}},ac=class extends rC{constructor(e,t,{renderTarget:n,resolutionScale:r=1,width:a=rH.AUTO_SIZE,height:i=rH.AUTO_SIZE,resolutionX:o=a,resolutionY:l=i}={}){super("NormalPass"),this.needsSwap=!1,this.renderPass=new r6(e,t,new ry.MeshNormalMaterial);const s=this.renderPass;s.ignoreBackground=!0,s.skipShadowMapUpdate=!0;const u=s.getClearPass();u.overrideClearColor=new ry.Color(7829503),u.overrideClearAlpha=1,this.renderTarget=n,void 0===this.renderTarget&&(this.renderTarget=new ry.WebGLRenderTarget(1,1,{minFilter:ry.NearestFilter,magFilter:ry.NearestFilter}),this.renderTarget.texture.name="NormalPass.Target");const c=this.resolution=new rH(this,o,l,r);c.addEventListener("change",e=>this.setSize(c.baseWidth,c.baseHeight))}set mainScene(e){this.renderPass.mainScene=e}set mainCamera(e){this.renderPass.mainCamera=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,n,r,a){let i=this.renderToScreen?null:this.renderTarget;this.renderPass.render(e,i,i)}setSize(e,t){let n=this.resolution;n.setBaseSize(e,t),this.renderTarget.setSize(n.width,n.height)}};function ad(e,t,n,r){var a;return(a=e+(t-e)*.75)+(n+(r-n)*.75-a)*.875}function af(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1]),new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1]),new Float32Array(2),new Float32Array(2),new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125]),new Uint8Array([0,0]),new Uint8Array([3,0]),new Uint8Array([0,3]),new Uint8Array([3,3]),new Uint8Array([1,0]),new Uint8Array([4,0]),new Uint8Array([1,3]),new Uint8Array([4,3]),new Uint8Array([0,1]),new Uint8Array([3,1]),new Uint8Array([0,4]),new Uint8Array([3,4]),new Uint8Array([1,1]),new Uint8Array([4,1]),new Uint8Array([1,4]),new Uint8Array([4,4]),new Uint8Array([0,0]),new Uint8Array([1,0]),new Uint8Array([0,2]),new Uint8Array([1,2]),new Uint8Array([2,0]),new Uint8Array([3,0]),new Uint8Array([2,2]),new Uint8Array([3,2]),new Uint8Array([0,1]),new Uint8Array([1,1]),new Uint8Array([0,3]),new Uint8Array([1,3]),new Uint8Array([2,1]),new Uint8Array([3,1]),new Uint8Array([2,3]),new Uint8Array([3,3]),ad(0,0,0,0),new Float32Array([0,0,0,0]),ad(0,0,0,1),new Float32Array([0,0,0,1]),ad(0,0,1,0),new Float32Array([0,0,1,0]),ad(0,0,1,1),new Float32Array([0,0,1,1]),ad(0,1,0,0),new Float32Array([0,1,0,0]),ad(0,1,0,1),new Float32Array([0,1,0,1]),ad(0,1,1,0),new Float32Array([0,1,1,0]),ad(0,1,1,1),new Float32Array([0,1,1,1]),ad(1,0,0,0),new Float32Array([1,0,0,0]),ad(1,0,0,1),new Float32Array([1,0,0,1]),ad(1,0,1,0),new Float32Array([1,0,1,0]),ad(1,0,1,1),new Float32Array([1,0,1,1]),ad(1,1,0,0),new Float32Array([1,1,0,0]),ad(1,1,0,1),new Float32Array([1,1,0,1]),ad(1,1,1,0),new Float32Array([1,1,1,0]),ad(1,1,1,1),new Float32Array([1,1,1,1]);new E.Vector2,new E.Vector2;function ap(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}var am=function e(t,n,r){var a=this;ap(this,e),af(this,"dot2",function(e,t){return a.x*e+a.y*t}),af(this,"dot3",function(e,t,n){return a.x*e+a.y*t+a.z*n}),this.x=t,this.y=n,this.z=r},ah=[new am(1,1,0),new am(-1,1,0),new am(1,-1,0),new am(-1,-1,0),new am(1,0,1),new am(-1,0,1),new am(1,0,-1),new am(-1,0,-1),new am(0,1,1),new am(0,-1,1),new am(0,1,-1),new am(0,-1,-1)],ag=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,
574127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180],av=Array(512),a_=Array(512),aS=0;(aS=Math.floor(aS))<256&&(aS|=aS<<8);for(var ax,aE=0;aE<256;aE++)ax=1&aE?ag[aE]^255&aS:ag[aE]^aS>>8&255,av[aE]=av[aE+256]=ax,a_[aE]=a_[aE+256]=ah[ax%12];function ab(e){var t=function(e){if("number"==typeof e)e=Math.abs(e);else if("string"==typeof e){var t=e;e=0;for(var n=0;n<t.length;n++)e=(e+(n+1)*(t.charCodeAt(n)%96))%0x7fffffff}return 0===e&&(e=311),e}(e);return function(){var e=48271*t%0x7fffffff;return t=e,e/0x7fffffff}}new function e(t){var n=this;ap(this,e),af(this,"seed",0),af(this,"init",function(e){n.seed=e,n.value=ab(e)}),af(this,"value",ab(this.seed)),this.init(t)}(Math.random());var aT=E;new aT.OrthographicCamera(-1,1,1,-1,0,1);class aM extends aT.BufferGeometry{constructor(){super(),this.setAttribute("position",new aT.Float32BufferAttribute([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new aT.Float32BufferAttribute([0,2,0,0,2,0],2))}}function ay(e){return e&&e.__esModule?e.default:e}new aM,E.BufferGeometry;var aR={};aR=JSON.parse('{"architecture":"attention-v3-int8","formatVersion":3,"globalBias":[-0.32877659797668457,0.4370867609977722,-0.05251404270529747,1.3072023391723633,0.0477047860622406,0.24477416276931763,0.009111796505749226,-0.17459993064403534],"globalFeatureInverseStandardDeviation":[10.771836280822754,1.9548665285110474,1.612365484237671],"globalFeatureMean":[0.9198138117790222,-0.49808526039123535,0.03374629095196724],"globalWeights":[101,-4,7,-127,6,-11,3,1,0,-16,-7,8,-8,-1,7,-4,0,0,-12,-3,-13,1,0,2],"headBias":[-0.15895532071590424,0.007501596584916115,-0.47742825746536255,0.01632097363471985,-0.48355796933174133,-0.1052703931927681,-0.8414919376373291,-0.21046382188796997],"headWeights":[-45,-7,-45,-20,7,-13,120,-24,-15,-26,-19,1,27,-48,-4,-10,1,-5,-24,64,91,-1,-68,39,54,39,101,-40,-127,64,-41,-17,-23,-19,3,35,-2,33,3,9,-64,-32,30,42,-112,12,28,-11,15,2,-4,-7,7,-3,-5,1,76,48,-34,-67,103,-40,-26,1,58,-11,46,-41,5,-6,-17,-8,13,17,-35,45,27,-17,-28,7,-53,12,-51,6,-32,-5,58,-9,-28,-21,37,-12,1,20,2,2,11,7,-4,-9,2,-15,-1,-8,16,12,-27,-1,61,-5,-1,4,-7,-2,7,4,1,4,-2,4,-18,-16,28,6,-65,16,3,-3,-5,-2,0,-40,-21,-22,14,30,-21,49,15,-64,43,19,23,18,5,-15,21,21,30,17,-11,-6,22,-38,-20,97,-46,-5,-13,-59,26,-13,11,-2,-10,-8,2,-15,-17,-27,-9,26,7,-7,6,9,-32,5,-9,12,49,17,-1,24,20,35,14,-33,-50,-1,-4,-26,11,11,9,-80,30,9,36,6,-12,-4,-7,39,-10,-30,-49,1,-43,-20,-34,76,-36,-10,15,-8,43,31,38,-42,39,37,-7,7,8,16,28,-83,32,9,23,-13,39,119,23,-127,-24,8,-48,-29,-7,-33,-12,58,-24,-29,-19,12,-55,-90,0,126,26,42,54,22],"keyProjectionWeights":[0,-1,-1,1,1,1,1,1,-64,32,49,23,-25,4,27,-22,0,1,-1,-1,-1,1,1,0,-34,38,64,88,13,-53,-41,58,-7,-4,79,-41,27,26,14,2,-2,1,1,1,-1,-1,1,1,1,-1,-1,-1,-1,-1,1,1,4,-3,126,42,-40,-116,35,20],"name":"residual-attention-v3-50m-qat-int8-epoch-25-zo-278w","outputBias":-0.0005526235327124596,"outputWeights":[11,11,14,-27,9,-22,127,6],"quantization":{"scales":{"globalWeight":0.021090541950849095,"headWeight":0.04935851140909355,"keyWeight":0.1733924937791441,"outputWeight":0.0030087142047955295,"tapInputWeight":0.1096231754049479,"tapOutputWeight":0.017949438644286102,"valueWeight":0.013986751242596301},"scheme":"symmetric-int8-per-tensor","zeroPoint":0},"summaryQueries":[0.0038647791370749474,0.09565000981092453,0.002756686182692647,-0.08183622360229492,-0.15209506452083588,-0.0006105066277086735,0.0010439646430313587,-0.03020688332617283,0.005065929610282183,0.14488759636878967,0.003160916268825531,-0.0855727270245552,-0.3123375475406647,0.00039022407145239413,0.0037786494940519333,0.1451321840286255,-0.002009483054280281,0.0597594790160656,0.0045239729806780815,-0.08765853196382523,-0.13884992897510529,-0.0021647117100656033,0.003985927440226078,0.09727758169174194,0.007170629221946001,0.0786278173327446,0.004103775601834059,-0.1198369711637497,-0.2925199568271637,-0.002055276418104768,0.0030450925696641207,0.14401987195014954],"supportedDenoiseSamples":[4,8,16],"tapFeatureInverseStandardDeviation":[2.283243417739868,0.8810898065567017,0.8210930228233337,3.752316474914551,3.6375720500946045,2.670454978942871,10.249449729919434,0.12639354169368744,100],"tapFeatureMean":[0.010318092070519924,0.01364430133253336,0.13411010801792145,-0.004725644364953041,0.10053129494190216,0.8384788632392883,0.9203217625617981,1.7139031887054443,1],"tapInputBias":[0.4780646860599518,-0.45214661955833435,0.289407879114151,0.34804567694664,-0.1320028454065323,0.17722633481025696,0.011480014771223068,-0.26692497
574730255127],"tapInputWeights":[0,1,7,0,-1,-7,0,31,-2,-1,14,-126,0,0,-1,2,26,-2,0,66,-73,0,0,0,-12,22,-3,0,-76,-90,0,-1,-7,-3,58,-1,0,2,6,0,0,3,4,-40,0,0,3,-13,0,0,1,-7,-13,0,0,-7,10,0,-2,-7,0,-39,-2,0,-13,-19,0,-2,20,-1,3,-1],"tapOutputBias":[-0.3867710530757904,0.1349504142999649,0.35706064105033875,-0.5938405394554138,-0.031154220923781395,1.4079623222351074,-1.9221038818359375,0.6029739379882812],"tapOutputWeights":[18,-4,47,19,74,-94,-21,-9,73,-59,88,-10,-3,71,-7,24,20,74,24,-31,-12,-10,-15,-45,-126,2,-4,27,-5,24,35,-11,-4,9,-8,26,-10,27,26,-20,17,-50,5,-35,0,-5,12,-71,89,-58,22,-83,-115,7,-16,-89,89,22,1,-20,-22,-25,-26,44],"valueProjectionWeights":[-16,-6,40,-17,84,-76,59,51,-10,-2,-10,-1,-23,74,-70,23,-5,4,4,-7,-77,127,20,-48,-36,4,-17,-12,-4,10,29,-27,-2,11,-47,-50,-54,-3,14,11,-23,-1,109,31,4,-100,-33,-36,-19,0,-8,20,-35,-24,79,2,44,2,5,7,22,-70,-67,-35]}');let aC=[["tapInputWeight","tapInputWeights",8,9],["tapOutputWeight","tapOutputWeights",8,8],["globalWeight","globalWeights",8,3],["keyWeight","keyProjectionWeights",8,8],["valueWeight","valueProjectionWeights",8,8],["headWeight","headWeights",8,32],["outputWeight","outputWeights",1,8]],aA=e=>{let t=ay(aR).quantization?.scales?.[e];if(!(t>0)||!Number.isFinite(t))throw Error(`The bundled N8AO neural model has no valid ${e} scale.`);return t};if("attention-v3-int8"!==ay(aR).architecture||3!==ay(aR).formatVersion||ay(aR).quantization?.scheme!=="symmetric-int8-per-tensor"||ay(aR).quantization?.zeroPoint!==0||ay(aR).supportedDenoiseSamples?.join(",")!=="4,8,16"||aC.some(([,e,t,n])=>ay(aR)[e]?.length!==t*n||ay(aR)[e].some(e=>!Number.isInteger(e)||e<-127||e>127)))throw Error("The bundled N8AO neural denoise model has an unsupported layout.");let aw=e=>{if(!Number.isFinite(e))throw Error("The bundled N8AO neural model contains a non-finite value.");if(Object.is(e,-0))return"0.0";let t=Number(e).toString();return/[.eE]/.test(t)?t:`${t}.0`},aP=["x","y","z","w"],aU=e=>[...aP.map(t=>`${e}.lo.${t}`),...aP.map(t=>`${e}.hi.${t}`)],aL=e=>e.filter(Boolean).join(" + ")||"0.0",aD=(e,t,n,r,a,i)=>{let o=r.map((r,a)=>{var i;return i=e[t*n+a],0===i?null:1===i?r:-1===i?`(-${r})`:i<0?`(-${aw(-i)} * ${r})`:`${aw(i)} * ${r}`});return`${aw(a)} * (${aL(o)}) + ${aw(i[t])}`},aN=(e,t=" ")=>`vec4( 575${e.map(e=>`${t} ${e}`).join(",\n")} 576${t})`,aI=({functionName:e,scaleName:t,weights:n,bias:r,width:a=8,relu:i=!1})=>{let o=aU("inputToken"),l=aA(t),s=Array.from({length:8},(e,t)=>aD(n,t,a,o,l,r)),u=aN(s.slice(0,4)),c=aN(s.slice(4)),d=e=>i?`max(${e}, vec4(0.0))`:e;return` 577 NeuralToken neural${e[0].toUpperCase()}${e.slice(1)}(NeuralToken inputToken) { 578 return NeuralToken( 579 ${d(u)}, 580 ${d(c)} 581 ); 582 } 583`},aF=(e,t,n,r,a,i,o,l={})=>Array.from({length:a},(a,s)=>{let u=t[s];for(let t=0;t<i;t++){let a=e[s*i+t]*o;u-=a*r[t]*n[t],Object.hasOwn(l,t)&&(u+=a*r[t]*l[t])}return u}),aB=aA("tapInputWeight"),aO=aF(ay(aR).tapInputWeights,ay(aR).tapInputBias,ay(aR).tapFeatureMean,ay(aR).tapFeatureInverseStandardDeviation,8,9,aB,{8:1}),aG=aU("scaledInput"),ak=Array.from({length:8},(e,t)=>aD(ay(aR).tapInputWeights,t,9,aG,aB,aO)),az=` 584 NeuralToken neuralTapInput(NeuralToken raw) { 585 NeuralToken scaledInput = NeuralToken( 586 raw.lo * ${aN(ay(aR).tapFeatureInverseStandardDeviation.slice(0,4)," ")}, 587 raw.hi * ${aN(ay(aR).tapFeatureInverseStandardDeviation.slice(4,8)," ")} 588 ); 589 return NeuralToken( 590 max(${aN(ak.slice(0,4))}, vec4(0.0)), 591 max(${aN(ak.slice(4))}, vec4(0.0)) 592 ); 593 } 594`,aH=aA("globalWeight"),aV=aF(ay(aR).globalWeights,ay(aR).globalBias,ay(aR).globalFeatureMean,ay(aR).globalFeatureInverseStandardDeviation,8,3,aH),aW=aP.slice(0,3).map(e=>`scaledInput.${e}`),aj=Array.from({length:8},(e,t)=>aD(ay(aR).globalWeights,t,3,aW,aH,aV)),aX=` 595 NeuralToken neuralEncodeGlobal(vec4 raw) { 596 vec3 scaledInput = raw.xyz * vec3( 597 ${ay(aR).globalFeatureInverseStandardDeviation.map(aw).join(", ")} 598 ); 599 return NeuralToken( 600 max(${aN(aj.slice(0,4))}, vec4(0.0)), 601 max(${aN(aj.slice(4))}, vec4(0.0)) 602 ); 603 } 604`,aq=aU("key"),aK=Array.from({length:4},(e,t)=>aL(aq.map((e,n)=>{var r;return r=ay(aR).summaryQueries[8*t+n],0===r?null:`${aw(r)} * ${e}`}))),aY=` 605 vec4 neuralQueryScores(NeuralToken key) { 606 return ${aN(aK)}; 607 } 608`,a$=[];for(let e=0;e<4;e++)a$.push(...aP.map(t=>`runningSummaryLo[${e}].${t}`),...aP.map(t=>`runningSummaryHi[${e}].${t}`));let aQ=aA("headWeight"),aZ=Array.from({length:8},(e,t)=>aD(ay(aR).headWeights,t,32,a$,aQ,ay(aR).headBias)),aJ=` 609 NeuralToken neuralHead( 610 vec4 runningSummaryLo[4], 611 vec4 runningSummaryHi[4] 612 ) { 613 return NeuralToken( 614 max(${aN(aZ.slice(0,4))}, vec4(0.0)), 615 max(${aN(aZ.slice(4))}, vec4(0.0)) 616 ); 617 } 618`,a0=aD(ay(aR).outputWeights,0,8,aU("head"),aA("outputWeight"),[ay(aR
618).outputBias]),a1=` 619 float neuralOutput(NeuralToken head) { 620 return ${a0}; 621 } 622`;[az,aI({functionName:"tapOutput",scaleName:"tapOutputWeight",weights:ay(aR).tapOutputWeights,bias:ay(aR).tapOutputBias,relu:!0}),aX,aI({functionName:"keyProject",scaleName:"keyWeight",weights:ay(aR).keyProjectionWeights,bias:Array(8).fill(0)}),aI({functionName:"valueProject",scaleName:"valueWeight",weights:ay(aR).valueProjectionWeights,bias:Array(8).fill(0)}),aY,aJ,a1].join("\n"),aC.reduce((e,[,t])=>e+ay(aR)[t].length,0),aC.reduce((e,[,t])=>e+ay(aR)[t].filter(e=>0!==e).length,0),parseInt(E.REVISION.replace(/\D+/g,"")),E.WebGLRenderTarget;var a2=new WeakMap,a3=0,a4=["blendMode-blendFunction","blendMode-opacity-value"];function a5(e){return function({blendFunction:t,opacity:n,ref:r,...a}){let i=a2.get(e);if(!i){let t=`@react-three/postprocessing/${e.name}-${a3++}`;n0({[t]:e}),a2.set(e,i=t)}let o=nk(e=>e.camera),l=(0,x.useRef)(null),s=(0,x.useCallback)(e=>{if(l.current=e,"function"!=typeof r){r&&(r.current=e);return}let t=r(e);if("function"==typeof t)return()=>{l.current=null,t()}},[l,r]);return!function(e,t,n,r=function(e,t){let n=e;for(let e of t.split("-")){if(null==n)return;n=n[e]}return n},a=function(e,t,n){let r=t.split("-"),a=e;for(let e=0;e<r.length-1;e++){if(null==a)return;a=a[r[e]]}null!=a&&(a[r[r.length-1]]=n)}){let i=(0,x.useRef)(null),o=nk(e=>e.invalidate);(0,x.useLayoutEffect)(()=>{let l="object"==typeof e&&null!=e&&"current"in e?e.current:e;if(!l)return;i.current?.instance!==l&&(i.current={instance:l,defaults:new Map,applied:new Map});let{defaults:s,applied:u}=i.current,c=!1;for(let e of n){if(!s.has(e)){let t=r(l,e);s.set(e,t),u.set(e,t)}let n=void 0!==t[e]?t[e]:s.get(e);Object.is(u.get(e),n)||(a(l,e,n),u.set(e,n),c=!0)}c&&o()})}(l,{"blendMode-blendFunction":t,"blendMode-opacity-value":n},a4),(0,_.jsx)(i,{ref:s,camera:o,...a})}}var a6=(0,x.createContext)(null),a8=e=>(2&e.getAttributes())==2,a9=e=>/mainUv/.test(e.getFragmentShader()??"");function a7(e){let t=new WeakMap;return{acquire(n,r){let a=t.get(n);a?(a.count++,a.forcedValue=r):t.set(n,{count:1,original:n[e],forcedValue:r})},release(n){let r=t.get(n);r&&--r.count<=0&&(n[e]===r.forcedValue&&(n[e]=r.original),t.delete(n))}}}var ie=a7("autoClear"),it=a7("toneMapping"),ir=new E.Vector2,ia=(e,t)=>new r6(e,t),ii=new WeakSet,io=new WeakSet;function il(e){ii.has(e)&&(e instanceof au&&e.setEffects([]),rC.prototype.dispose.call(e))}var is=(0,x.memo)(function({children:e,camera:t,scene:n,resolutionScale:r,enabled:a=!0,renderPriority:i=1,autoClear:o=!0,autoRenderToScreen:l=!0,depthBuffer:s,enableNormalPass:u,stencilBuffer:c,multisampling:d=8,frameBufferType:f=E.HalfFloatType,renderPass:p=ia,mergeMode:m="auto",ref:h}){let{gl:g,scene:v,camera:S}=nk(),b=n||v,T=t||S;g.getSize(ir);let[M,y]=(0,x.useState)(null),[,R]=(0,x.useReducer)(e=>e+1,0);(0,x.useEffect)(()=>{ie.acquire(g,!1);let e=new rB(g,{depthBuffer:s,stencilBuffer:c,multisampling:d,frameBufferType:f});e.autoRenderToScreen=l,e.addPass(p(b,T));let t=null,n=null;return u&&((t=new ac(b,T)).enabled=!1,e.addPass(t),void 0!==r&&((n=new r7({normalBuffer:t.texture,resolutionScale:r})).enabled=!1,e.addPass(n))),e.setSize(ir.width,ir.height),y({composer:e,normalPass:t,downSamplingPass:n}),()=>{for(let t of e.passes)il(t);e.dispose(),ie.release(g)}},[T,g,s,c,d,f,l,p,b,u,r]);let C=(0,x.useRef)({width:-1,height:-1,pixelRatio:-1});nz((e,t)=>{if(!a||!M)return;let{composer:n}=M;g.getSize(ir);let r=g.getPixelRatio(),i=C.current;(ir.width!==i.width||ir.height!==i.height||r!==i.pixelRatio)&&(n.setSize(ir.width,ir.height),i.width=ir.width,i.height=ir.height,i.pixelRatio=r);let l=g.autoClear;g.autoClear=o,c&&!o&&g.clearStencil(),n.render(t),g.autoClear=l},a?i:0);let A=(0,x.useRef)(null),w=(0,x.useRef)([]),[P,U]=(0,x.useState)(0);(0,x.useLayoutEffect)(()=>{var e,t;let n,r;if(!M)return;let a=(e=A.current,t=e=>e instanceof rj||e instanceof rC,(n=e.__r3f)?n.children.map(e=>e.object).filter(t):[]);r=w.current,!(a.length===r.length&&a.every((e,t)=>e===r[t]))&&(w.current=a,1)&&U(e=>e+1)}),(0,x.useLayoutEffect)(()=>{if(!M)return;let{composer:e,normalPass:t,downSamplingPass:n}=M,r=function(e,t,n){let r=[];for(let a=0;a<e.length;a++){let i=e[a];if(i instanceof rj){let o=[i],l=a8(i),s=a9(i);if("none"!==n){let t;for(;(t=e[a+1])instanceof rj;){let e=a8(t),r=a9(t);if("auto"===n&&(l&&e||l&&r||s&&e))break;o.push(t),l||=e,s||=r,a++}}let u=new au(t,...o);ii.add(u),r.push(u)}else i instanceof rC&&r.push(i)}return r}(w.current,T,m);if(r.some(e=>io.has(e))){let e=new rL;ii.add(e),r.push(e)}for(let t of r)e.addPass(t);return r.length&&(t&&(t.enabled=!0),n&&(n.enabled=!0)),()=>{for(let t of r)e.removePass(t),il(t);t&&(t.enabled=!1),n&&(n.enabled=!1)}},[M,P,T,m]),(0,x.useEffect)(()=>(it.acquire(g,E.NoToneMapping),g.toneMapping=E.NoToneMapping,()=>{it.release(g)}),[g]);let L=(0,x.useMemo)(()=>
622M?{composer:M.composer,normalPass:M.normalPass,downSamplingPass:M.downSamplingPass,resolutionScale:r,camera:T,scene:b,requestRebuild:R,autoClear:o}:null,[M,r,T,b,R,o]);return((0,x.useImperativeHandle)(h,()=>M?.composer,[M]),L)?(0,_.jsx)(a6.Provider,{value:L,children:(0,_.jsx)("group",{ref:A,children:e})}):null}),iu=a5(r5);function ic({blendFunction:e=0,luminanceThreshold:t,luminanceSmoothing:n,mipmapBlur:r,radius:a,levels:i,resolutionScale:o,resolutionX:l,resolutionY:s,...u}){let c=(0,x.useMemo)(()=>[{luminanceThreshold:t,luminanceSmoothing:n,mipmapBlur:r,radius:a,levels:i,resolutionScale:o,resolutionX:l,resolutionY:s}],[t,n,r,a,i,o,l,s]);return(0,_.jsx)(iu,{blendFunction:e,args:c,...u})}var id=a5(aa),ip=e.i(63611),im=e.i(70515),ih=e.i(27684);let ig=new E.Vector3,iv=new E.Vector3,i_=new E.Vector3;function iS(){let{camera:e}=nk(),t=(0,x.useRef)(0),n=(0,x.useRef)(0),r=(0,x.useRef)(0),a=(0,x.useRef)((0,ih.pinnedProgress)()),i=(0,x.useRef)(!0);return nz((o,l)=>{let s=a.current??ip.scrollState.progress;if(null!==a.current){let t=E.MathUtils.clamp(s,0,1);im.posCurve.getPoint(t,ig),im.targetCurve.getPoint(t,iv),e.position.copy(ig),e.lookAt(iv);return}let u=Math.min(1,3.5*l);t.current+=(s-t.current)*u;let c=E.MathUtils.clamp(t.current,0,1);im.posCurve.getPoint(c,ig),im.targetCurve.getPoint(c,iv),n.current+=(ip.scrollState.pointerX-n.current)*Math.min(1,2*l),r.current+=(ip.scrollState.pointerY-r.current)*Math.min(1,2*l),ig.x+=1.6*n.current,ig.y+=-(.9*r.current),i.current?(e.position.copy(ig),i_.copy(iv),i.current=!1):(e.position.lerp(ig,Math.min(1,4*l)),i_.lerp(iv,Math.min(1,4*l))),e.lookAt(i_)}),null}var ix=e.i(78459);let iE=[{h:0,zenith:"#0a1020",horizon:"#1a2338",sunColor:"#8fa6d8",sunOpacity:0,elev:-30,azim:200,keyColor:"#4a6fa5",keyIntensity:.1,hemiSky:"#2a3a5a",hemiGround:"#14161c",hemiIntensity:.28,ambient:.12,fog:"#131a28",bg:"#0d1424",bloomIntensity:.9,bloomThreshold:.35,windowGlow:1,lampOn:1},{h:5.6,zenith:"#16203a",horizon:"#3c3a58",sunColor:"#c98a86",sunOpacity:.08,elev:-14,azim:-8,keyColor:"#5a6fa0",keyIntensity:.16,hemiSky:"#33405f",hemiGround:"#1b1d24",hemiIntensity:.4,ambient:.16,fog:"#1e2438",bg:"#18203a",bloomIntensity:.8,bloomThreshold:.4,windowGlow:.96,lampOn:1},{h:6.6,zenith:"#3a4a72",horizon:"#c98468",sunColor:"#ff9a5a",sunOpacity:.45,elev:-3,azim:2,keyColor:"#ff9a6a",keyIntensity:.45,hemiSky:"#6e7fa4",hemiGround:"#4a4038",hemiIntensity:.7,ambient:.24,fog:"#7a6a72",bg:"#8a7a80",bloomIntensity:.6,bloomThreshold:.55,windowGlow:.7,lampOn:.9},{h:7.3,zenith:"#5b7099",horizon:"#ffb877",sunColor:"#ffd9a0",sunOpacity:.9,elev:7,azim:10,keyColor:"#ffb063",keyIntensity:1.45,hemiSky:"#e6c49a",hemiGround:"#8a6f60",hemiIntensity:1,ambient:.36,fog:"#c9a184",bg:"#cfa781",bloomIntensity:.45,bloomThreshold:.66,windowGlow:.38,lampOn:.1},{h:9.5,zenith:"#5f95d4",horizon:"#cfe6f5",sunColor:"#fff8e8",sunOpacity:.75,elev:36,azim:46,keyColor:"#f8f4ea",keyIntensity:2.2,hemiSky:"#c4dcf4",hemiGround:"#8a8f88",hemiIntensity:1,ambient:.4,fog:"#c2d8e8",bg:"#bcd2e6",bloomIntensity:.25,bloomThreshold:.85,windowGlow:.1,lampOn:0},{h:13,zenith:"#6f9ecb",horizon:"#dfeaf0",sunColor:"#fffdf6",sunOpacity:.6,elev:76,azim:92,keyColor:"#fffaf0",keyIntensity:2.35,hemiSky:"#d6e4f0",hemiGround:"#94958c",hemiIntensity:1.35,ambient:.55,fog:"#ccd8e0",bg:"#c8d2da",bloomIntensity:.2,bloomThreshold:.9,windowGlow:.05,lampOn:0},{h:16.5,zenith:"#7b93b8",horizon:"#f2d3a2",sunColor:"#ffe2ae",sunOpacity:.8,elev:30,azim:138,keyColor:"#ffcf8e",keyIntensity:1.72,hemiSky:"#e4d6c0",hemiGround:"#8d8070",hemiIntensity:1.32,ambient:.5,fog:"#d8c3a6",bg:"#d2bfa4",bloomIntensity:.28,bloomThreshold:.8,windowGlow:.16,lampOn:0}
622,{h:18.8,zenith:"#46567c",horizon:"#e6a45f",sunColor:"#ffbe78",sunOpacity:.9,elev:5,azim:168,keyColor:"#ffb063",keyIntensity:1.4,hemiSky:"#e6c49a",hemiGround:"#8a6f60",hemiIntensity:1,ambient:.4,fog:"#c69a72",bg:"#caa079",bloomIntensity:.4,bloomThreshold:.7,windowGlow:.55,lampOn:.12},{h:19.4,zenith:"#2e3a5e",horizon:"#e0714a",sunColor:"#ff8452",sunOpacity:.75,elev:-1,azim:176,keyColor:"#ff7a4a",keyIntensity:.62,hemiSky:"#a8809a",hemiGround:"#5c4a48",hemiIntensity:.7,ambient:.3,fog:"#9c6a68",bg:"#a06a5e",bloomIntensity:.6,bloomThreshold:.58,windowGlow:.82,lampOn:.75},{h:20.2,zenith:"#16203c",horizon:"#4a4668",sunColor:"#7a6a9a",sunOpacity:.16,elev:-12,azim:184,keyColor:"#5a6a9a",keyIntensity:.18,hemiSky:"#3c4a70",hemiGround:"#20222c",hemiIntensity:.42,ambient:.18,fog:"#2a3048",bg:"#222c48",bloomIntensity:.82,bloomThreshold:.4,windowGlow:.97,lampOn:1},{h:24,zenith:"#0a1020",horizon:"#1a2338",sunColor:"#8fa6d8",sunOpacity:0,elev:-30,azim:200,keyColor:"#4a6fa5",keyIntensity:.1,hemiSky:"#2a3a5a",hemiGround:"#14161c",hemiIntensity:.28,ambient:.12,fog:"#131a28",bg:"#0d1424",bloomIntensity:.9,bloomThreshold:.35,windowGlow:1,lampOn:1}],ib=new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"Asia/Singapore"}),iT=-1/0,iM=0;function iy(){let e=Date.now();if(e-iT<1e3)return iM;iT=e;let t=(0,ih.pinnedHour)();if(null!==t)return iM=t,t;let[n,r,a]=ib.format(new Date).split(":").map(Number);return iM=n+r/60+(a||0)/3600}let iR={zenith:new E.Color,horizon:new E.Color,sunColor:new E.Color,sunOpacity:0,sunDir:new E.Vector3,keyColor:new E.Color,keyIntensity:0,hemiSky:new E.Color,hemiGround:new E.Color,hemiIntensity:0,ambient:0,fog:new E.Color,bg:new E.Color,bloomIntensity:0,bloomThreshold:0,windowGlow:0,lampOn:0},iC=new E.Color,iA=new E.Color,iw=E.MathUtils.lerp;function iP(e,t,n,r){iC.set(t),iA.set(n),iC.convertSRGBToLinear(),iA.convertSRGBToLinear(),e.copy(iC).lerp(iA,r).convertLinearToSRGB()}let iU=NaN;function iL(e,t=iR){let n=(e%24+24)%24;if(t===iR){if(n===iU)return t;iU=n}let r=0;for(;r<iE.length-2&&iE[r+1].h<=n;)r++;let a=iE[r],i=iE[r+1],o=i.h-a.h,l=o>0?(n-a.h)/o:0,s=E.MathUtils.smoothstep(E.MathUtils.clamp(l,0,1),0,1);iP(t.zenith,a.zenith,i.zenith,s),iP(t.horizon,a.horizon,i.horizon,s),iP(t.sunColor,a.sunColor,i.sunColor,s),iP(t.keyColor,a.keyColor,i.keyColor,s),iP(t.hemiSky,a.hemiSky,i.hemiSky,s),iP(t.hemiGround,a.hemiGround,i.hemiGround,s),iP(t.fog,a.fog,i.fog,s),iP(t.bg,a.bg,i.bg,s),t.sunOpacity=iw(a.sunOpacity,i.sunOpacity,s),t.keyIntensity=iw(a.keyIntensity,i.keyIntensity,s),t.hemiIntensity=iw(a.hemiIntensity,i.hemiIntensity,s),t.ambient=iw(a.ambient,i.ambient,s),t.bloomIntensity=iw(a.bloomIntensity,i.bloomIntensity,s),t.bloomThreshold=iw(a.bloomThreshold,i.bloomThreshold,s),t.windowGlow=iw(a.windowGlow,i.windowGlow,s),t.lampOn=iw(a.lampOn,i.lampOn,s);let u=E.MathUtils.degToRad(iw(a.elev,i.elev,s)),c=E.MathUtils.degToRad(iw(a.azim,i.azim,s)),d=Math.cos(u);return t.sunDir.set(d*Math.cos(c),Math.sin(u),d*Math.sin(c)),t}iL(iy());let iD={value:0},iN=` 623 varying vec3 vWorld; 624 void main() { 625 vWorld = position; 626 gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); 627 } 628`,iI=` 629 varying vec3 vWorld; 630 uniform vec3 uZenith; 631 uniform vec3 uHorizon; 632 uniform float uHaze; 633 uniform float uOvercast; 634 uniform float uTime; 635 636 float hash(vec2 p) { 637 return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); 638 } 639 float vnoise(vec2 p) { 640 vec2 i = floor(p), f = fract(p); 641 vec2 u = f * f * (3.0 - 2.0 * f); 642 return mix(mix(hash(i), hash(i + vec2(1.0, 0.0)), u.x), 643 mix(hash(i + vec2(0.0, 1.0)), hash(i + vec2(1.0, 1.0)), u.x), u.y); 644 } 645 float fbm(vec2 p) { 646 float v = 0.0, a = 0.5, norm = 0.0; 647 for (int i = 0; i < OCTAVES; i++) { 648 v += a * vnoise(p); norm += a; p *= 2.07; a *= 0.5; 649 } 650 // Normalised, so dropping an octave on phones costs detail but not cover â 651 // an un-normalised sum has a lower mean and would thin the deck out. 652 return v / norm; 653 } 654 655 void main() { 656 vec3 dir = normalize(vWorld); 657 float h = clamp(dir.y * 0.5 + 0.5, 0.0, 1.0); 658 // Pale, bright band near the horizon (tropical haze). 659 float glow = pow(1.0 - abs(dir.y), 3.5); 660 // Haze pales the horizon toward a brighter version of itself, so the effect
661 // stays correct whatever the hour tints it to (amber at dusk, navy at night). 662 vec3 pale = clamp(uHorizon * 1.45 + 0.05, 0.0, 1.0); 663 vec3 horizon = mix(uHorizon, pale, uHaze * 0.6); 664 vec3 col = mix(horizon, uZenith, pow(h, 1.1)); 665 col += horizon * glow * (0.25 + uHaze * 0.4); 666 667 // Cloud deck. Overcast belongs in the sky, not in the scene's fog, so this 668 // is the only thing "cloudy" changes. Projecting onto a plane above the 669 // camera makes the cover foreshorten toward the horizon like real cloud. 670 if (uOvercast > 0.001) { 671 vec2 cp = dir.xz / max(dir.y, 0.12) * 0.55 + uTime * 0.004; 672 float n = fbm(cp); 673 float puff = smoothstep(0.34, 0.86, n); 674 // Only above the horizon, easing in so the deck meets the skyline softly. 675 float sky = smoothstep(0.0, 0.22, dir.y); 676 float cover = uOvercast * sky * mix(0.55, 1.0, puff); 677 // Cloud colour comes from the palette, so the deck is white by day, 678 // amber at golden hour and near-black at night without extra uniforms. 679 vec3 lit = clamp(mix(uHorizon, uZenith, 0.25) * 1.25 + 0.04, 0.0, 1.0); 680 vec3 shade = mix(uZenith, uHorizon, 0.35) * 0.62; 681 vec3 cloud = mix(shade, lit, puff); 682 col = mix(col, cloud, cover); 683 } 684 gl_FragColor = vec4(col, 1.0); 685 } 686`;function iF(){let e=(0,x.useRef)(null),t=(0,x.useRef)(null);nz(()=>{e.current&&e.current.position.copy(iR.sunDir).multiplyScalar(190),t.current&&(t.current.color.copy(iR.sunColor),t.current.opacity=iR.sunOpacity*(1-.92*iD.value))});let n=(0,x.useMemo)(()=>{let e=document.createElement("canvas");e.width=e.height=256;let t=e.getContext("2d"),n=t.createRadialGradient(128,128,8,128,128,128);n.addColorStop(0,"rgba(255,255,255,0.95)"),n.addColorStop(.4,"rgba(255,255,255,0.4)"),n.addColorStop(1,"rgba(255,255,255,0)"),t.fillStyle=n,t.fillRect(0,0,256,256);let r=new E.CanvasTexture(e);return r.colorSpace=E.SRGBColorSpace,r},[]);return(0,x.useEffect)(()=>()=>n.dispose(),[n]),(0,_.jsx)("sprite",{ref:e,scale:[150,150,1],children:(0,_.jsx)("spriteMaterial",{ref:t,map:n,transparent:!0,depthWrite:!1,opacity:0})})}function iB({lite:e=!1}){let t=(0,x.useRef)(null),n=(0,x.useMemo)(()=>({uZenith:{value:new E.Color("#46567c")},uHorizon:{value:new E.Color("#e6a45f")},uHaze:{value:.4},uOvercast:{value:0},uTime:{value:0}}),[]);return nz((e,n)=>{if(!t.current)return;t.current.uniforms.uZenith.value.copy(iR.zenith),t.current.uniforms.uHorizon.value.copy(iR.horizon),t.current.uniforms.uTime.value+=n;let r=ix.weatherState.condition,a="thunder"===r?.95:"rain"===r?.88:"cloudy"===r?.85:"haze"===r?.2:"sunny"===r?.06:.18,i=Math.min(1,.8*n),o=t.current.uniforms.uHaze,l=t.current.uniforms.uOvercast;o.value+=(("haze"===r?1:"thunder"===r?.5:"rain"===r?.45:.3)-o.value)*i,l.value+=(a-l.value)*i,iD.value=l.value}),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("mesh",{scale:[300,300,300],children:[(0,_.jsx)("sphereGeometry",{args:[1,32,24]}),(0,_.jsx)("shaderMaterial",{ref:t,defines:{OCTAVES:e?2:3},vertexShader:iN,fragmentShader:iI,uniforms:n,side:E.BackSide,depthWrite:!1})]}),(0,_.jsx)(iF,{})]})}function iO(){let e=(0,x.useMemo)(()=>{let e=document.createElement("canvas");e.width=e.height=512;let t=e.getContext("2d");t.fillStyle="#8f9086",t.fillRect(0,0,512,512);for(let e=0;e<900;e++){let e=120+Math.floor(40*Math.random());t.fillStyle=`rgba(${e},${e},${e-6},0.06)`,t.fillRect(512*Math.random(),512*Math.random(),3,3)}t.strokeStyle="rgba(70,72,66,0.35)",t.lineWidth=2;for(let e=0;e<=512;e+=64)t.beginPath(),t.moveTo(e,0),t.lineTo(e,512),t.moveTo(0,e),t.lineTo(512,e),t.stroke();let n=new E.CanvasTexture(e);return n.wrapS=n.wrapT=E.RepeatWrapping,n.repeat.set(30,30),n.colorSpace
686=E.SRGBColorSpace,n},[]);return(0,x.useEffect)(()=>()=>e.dispose(),[e]),(0,_.jsxs)("mesh",{rotation:[-Math.PI/2,0,0],position:[0,0,-70],children:[(0,_.jsx)("planeGeometry",{args:[600,600]}),(0,_.jsx)("meshStandardMaterial",{map:e,color:"#9a9b90",roughness:.98,metalness:0})]})}let iG=["#9fc0d6","#e2ca8f","#a3cbb8","#d3a6b6","#b6c6dc"],ik="#c2beb2",iz=null,iH=null;function iV({w:e,d:t,roofY:n,seed:r}){let a=(0,x.useMemo)(()=>{let n=613*r+17,a=()=>(n=(9301*n+49297)%233280)/233280;return{poles:Array.from({length:2+Math.floor(2*a())},()=>({x:(a()-.5)*(e-2),z:(a()-.5)*(t-2),h:2+2.5*a(),aerial:a()>.5})),dish:{x:(a()-.5)*(e-3),z:(a()-.5)*(t-3),tilt:.5+.4*a(),rot:a()*Math.PI*2}}},[e,t,r]);return(0,_.jsxs)("group",{position:[0,n,0],children:[a.poles.map((e,t)=>(0,_.jsxs)("group",{position:[e.x,0,e.z],children:[(0,_.jsxs)("mesh",{position:[0,e.h/2,0],children:[(0,_.jsx)("cylinderGeometry",{args:[.04,.04,e.h,6]}),(0,_.jsx)("meshStandardMaterial",{color:"#6a6d67",roughness:.7,metalness:.4})]}),e.aerial&&[.3,.55,.8].map((t,n)=>(0,_.jsxs)("mesh",{position:[0,e.h*t,0],children:[(0,_.jsx)("boxGeometry",{args:[1.2-.25*n,.05,.05]}),(0,_.jsx)("meshStandardMaterial",{color:"#787b74",roughness:.7,metalness:.4})]},n))]},t)),(0,_.jsxs)("group",{position:[a.dish.x,0,a.dish.z],rotation:[0,a.dish.rot,0],children:[(0,_.jsxs)("mesh",{position:[0,.5,0],children:[(0,_.jsx)("cylinderGeometry",{args:[.05,.05,1,6]}),(0,_.jsx)("meshStandardMaterial",{color:"#6a6d67",roughness:.7,metalness:.4})]}),(0,_.jsxs)("mesh",{position:[0,1,.2],rotation:[a.dish.tilt,0,0],children:[(0,_.jsx)("sphereGeometry",{args:[.7,14,10,0,2*Math.PI,0,.34*Math.PI]}),(0,_.jsx)("meshStandardMaterial",{color:"#d8d5cc",roughness:.6,metalness:.1,side:E.DoubleSide})]})]})]})}function iW({w:e,d:t,floors:n,totalH:r,seed:a,lite:i=!1}){let o=(0,x.useMemo)(()=>{let r=(a%2==0?-1:1)*e*.17,i=t/2,o=i+.35,l=i+3.2-.35,s=l-o,u=r-2.9,c=u+.825,d=u+2.4749999999999996,f=Math.hypot(s,1.6),p=new E.Vector3(0,1.6,s).normalize(),m=new E.Vector3(0,1.6,-s).normalize(),h=new E.Vector3(0,0,1),g=new E.Quaternion().setFromUnitVectors(h,p),v=new E.Quaternion().setFromUnitVectors(h,m),_=[],S=[],x=[],b=[],T=[{y0:0,h:4.2},...Array.from({length:n},(e,t)=>({y0:4.2+3.2*t,h:3.2}))],M=(o+l)/2;for(let{y0:e,h:t}of T){let n=t/2,a=Math.hypot(s,n),f=new E.Vector3(1.518,.18,a),p=1.6===n?g:new E.Quaternion().setFromUnitVectors(h,new E.Vector3(0,n,s).normalize()),m=1.6===n?v:new E.Quaternion().setFromUnitVectors(h,new E.Vector3(0,n,-s).normalize());_.push({p:new E.Vector3(c,e+n/2,M),q:p,s:f}),_.push({p:new E.Vector3(d,e+1.5*n,M),q:m,s:f}),S.push(new E.Vector3(u+1.65,e+n,l-.1)),S.push(new E.Vector3(u+1.65,e+t,o)),x.push(new E.Vector3(u+1.65,e+n+.55,l+.23)),b.push(new E.Vector3(r+2.9-1.25,e+1.5,i+3.2+.01))}return{coreX:r,zFace:i,stairW:3.3,stairX0:u,flightLen:f,flights:_,landings:S,rails:x,openings:b}},[e,t,n,a]),{coreX:l,zFace:s,stairW:u,stairX0:c,flightLen:d}=o,f=(0,x.useMemo)(()=>{let e=(e,t)=>n=>{if(!n)return;let r=new E.Matrix4,a=new E.Quaternion;e.forEach((e,i)=>{r.compose(e.p,e.q??a,e.s??t),n.setMatrixAt(i,r)}),n.instanceMatrix.needsUpdate=!0};return{flights:e(o.flights,new E.Vector3(.46*u,.18,d)),landings:e(o.landings.map(e=>({p:e})),new E.Vector3(u,.2,.9)),rails:e(o.rails.map(e=>({p:e})),new E.Vector3(u,1.1,.14)),openings:e(o.openings.map(e=>({p:e})),new E.Vector3(1.55,1.5,.12))}},[o,u,d]);return(0,_.jsxs)("group",{children:[(0,_.jsxs)("mesh",{position:[l+2.9-1.25,(r+2.2)/2,s+1.6-.3],children:[(0,_.jsx)("boxGeometry",{args:[2.5,r+2.2,3.2+.6]}),(0,_.jsx)("meshStandardMaterial",{color:"#b0aca1",roughness:.95})]}),(0,_.jsxs)("mesh",{position:[c+.09,r/2,s+1.6-.3],children:[(0,_.jsx)("boxGeometry",{args:[.18,r,3.2+.6]}),(0,_.jsx)("meshStandardMaterial",{color:"#b6b2a7",roughness:.95})]}),!i&&(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)("instancedMesh",{ref:f.flights,args:[void 0,void 0,o.flights.length],children:[(0,_.jsx)("boxGeometry",{args:[1,1,1]}),(0,_.jsx)("meshStandardMaterial",{color:"#c0bcb1",roughness:.95})]}),(0,_.jsxs)("instancedMesh",{ref:f.landings,args:[void 0,void 0,o.landings.length],children:[(0,_.jsx)("boxGeometry",{args:[1,1,1]}),(0,_.jsx)("meshStandardMaterial",{color:"#bab6ab",roughness:.95})]}),(0,_.jsxs)("instancedMesh",{ref:f.rails,args:[void 0,void 0,o.rails.length],children:[(0,_.jsx)("boxGeometry",{args:[1,1,1]}),(0,_.jsx)("meshStandardMaterial",{color:"#b8b4a9",roughness:.9})]})]}),(0,_.jsxs)("instancedMesh",{ref:f.openings,args:[void 0,void 0,o.openings.length],children:[(0,_.jsx)("boxGeometry",{args:[1,1,1]}),(0,_.jsx)("meshStandardMaterial",{color:"#2a2f36",roughness:.85})]})]})}function ij({def:e,lite:t,facadeMat:n}){let{x:r,z:a,w:i,d:o,floors:l,rotY:s,face:u,seed:c,kind:d="slab"}=e,f=3.2*l,p=4.2+f,m=(0,x.useMemo)(()=>(function(e,t,n){let r=30*t+24,a=22*n,i=document.createElement("canvas");i.width=r,i.height=a;
686let o=i.getContext("2d"),l=document.createElement("canvas");l.width=r,l.height=a;let s=l.getContext("2d"),u=document.createElement("canvas");u.width=r,u.height=a;let c=u.getContext("2d"),d=9301*e+49297,f=()=>(d=(9301*d+49297)%233280)/233280;o.fillStyle=ik,o.fillRect(0,0,r,a),s.fillStyle="#000",s.fillRect(0,0,r,a),c.fillStyle="#8a8a8a",c.fillRect(0,0,r,a);for(let e=0;e<240;e++){let e=150+Math.floor(40*f());o.fillStyle=`rgba(${e},${e-4},${e-12},0.05)`,o.fillRect(f()*r,f()*a,2,8+20*f())}let p=iG[e%iG.length],m=Math.floor(f()*Math.max(1,n-3));o.fillStyle=p,o.globalAlpha=.55,o.fillRect(0,(n-m-2)*22,r,44),o.globalAlpha=1;for(let e=0;e<n;e++){let r=(n-1-e)*22;for(let e=0;e<t;e++){let t=12+30*e;c.fillStyle="#b8b8b8",c.fillRect(t,r+3,3,16);let n=t+6,a=r+4,i=f(),l=i>.86?"#e6c88f":i>.55?"#aeb7bd":"#49555f";o.fillStyle="#0a0c10",o.fillRect(n-1,a-1,20,11),o.fillStyle=l,o.fillRect(n,a,18,9),o.fillStyle="#0a0c10",o.fillRect(n+9-.75,a,1.5,9),c.fillStyle="#3a3a3a",c.fillRect(n,a,18,9),i>.86&&(s.fillStyle="#c99a52",s.fillRect(n,a,18,9))}}let h=e=>{let t=new E.CanvasTexture(e);return t.colorSpace=E.SRGBColorSpace,t.anisotropy=8,t},g=h(i),v=h(l),_=new E.CanvasTexture(u);return _.anisotropy=8,{map:g,emissive:v,bump:_}})(c,Math.max(3,Math.round(i/4)),l),[c,i,l]),h=(0,x.useMemo)(()=>Array.from({length:l+1},(e,t)=>4.2+3.2*t),[l]),g=(0,x.useCallback)(e=>{if(!e)return;let t=new E.Matrix4;h.forEach((n,r)=>{t.compose(new E.Vector3(0,n,0),new E.Quaternion,new E.Vector3(i+.4,.24,o+.4)),e.setMatrixAt(r,t)}),e.instanceMatrix.needsUpdate=!0},[h,i,o]),v=Math.max(3,Math.round(i/3.2)),S=Math.max(2,Math.round(o/3.2)),b=v*S,T="point"===d||l>16?1.05:.9,M=(0,x.useCallback)(e=>{if(!e)return;let t=new E.Matrix4,n=0;for(let r=0;r<v;r++){let a=-i/2+.9+r*(i-1.8)/(v-1);for(let r=0;r<S;r++){let i=-o/2+.9+r*(o-1.8)/(S-1);t.compose(new E.Vector3(a,2.1,i),new E.Quaternion,new E.Vector3(T,4.2,T)),e.setMatrixAt(n++,t)}}e.instanceMatrix.needsUpdate=!0},[v,S,i,o,T]),y=(0,x.useMemo)(()=>{let e=new E.MeshStandardMaterial({map:m.map,emissiveMap:m.emissive,emissive:new E.Color("#ffffff"),emissiveIntensity:.45,bumpMap:m.bump,bumpScale:2.2,roughness:.9,metalness:0}),t=(function(){if(iH)return iH;let e=document.createElement("canvas");e.width=e.height=256;let t=e.getContext("2d");t.fillStyle=ik,t.fillRect(0,0,256,256);for(let e=0;e<260;e++){let e=150+Math.floor(40*Math.random());t.fillStyle=`rgba(${e},${e-4},${e-12},0.05)`,t.fillRect(256*Math.random(),256*Math.random(),2,10+26*Math.random())}let n=new E.CanvasTexture(e);
686return n.wrapS=n.wrapT=E.RepeatWrapping,n.colorSpace=E.SRGBColorSpace,n.anisotropy=8,iH=n,n})().clone();t.wrapS=t.wrapT=E.RepeatWrapping,t.repeat.set(Math.max(1,Math.round(o/4)),Math.max(1,Math.round(f/4))),t.needsUpdate=!0;let n=new E.MeshStandardMaterial({map:t,color:"#cbc7bb",roughness:.93,metalness:0});return{list:[n,n,n,n,e,e],facadeMaterial:e,gableMaterial:n,gable:t}},[m,o,f]);(0,x.useEffect)(()=>(n(y.facadeMaterial),()=>n(null)),[n,y]),(0,x.useEffect)(()=>()=>{y.facadeMaterial.dispose(),y.gableMaterial.dispose(),y.gable.dispose()},[y]);let R=(0,x.useMemo)(()=>{let e,t,n;return(e=document.createElement("canvas")).width=256,e.height=160,(t=e.getContext("2d")).fillStyle="#eae6da",t.fillRect(0,0,256,160),t.strokeStyle="#3a4a5f",t.lineWidth=8,t.strokeRect(6,6,244,148),t.fillStyle="#233246",t.font="bold 110px Arial, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillText(String(100+137*c%780),128,86),(n=new E.CanvasTexture(e)).colorSpace=E.SRGBColorSpace,n},[c]),C=u>0?Math.PI/2:-Math.PI/2,A=4.2+(Math.max(0,l-2)+.5)*3.2,w=(0,x.useMemo)(()=>{let e=(function(){if(iz)return iz;let e=document.createElement("canvas");e.width=e.height=128;let t=e.getContext("2d");t.fillStyle="#c9c5b9",t.fillRect(0,0,128,128);for(let e=0;e<500;e++){let e=150+Math.floor(50*Math.random());t.fillStyle=`rgba(${e},${e-4},${e-12},0.06)`,t.fillRect(128*Math.random(),128*Math.random(),2,2)}t.strokeStyle="rgba(120,116,106,0.5)",t.lineWidth=2,t.strokeRect(1,1,126,126),t.beginPath(),t.moveTo(64,0),t.lineTo(64,128),t.moveTo(0,64),t.lineTo(128,64),t.stroke();let n=new E.CanvasTexture(e);
686return n.wrapS=n.wrapT=E.RepeatWrapping,n.colorSpace=E.SRGBColorSpace,iz=n,n})().clone();return e.wrapS=e.wrapT=E.RepeatWrapping,e.repeat.set(Math.max(2,Math.round((i+.6)/2)),Math.max(2,Math.round((o+.6)/2))),e.needsUpdate=!0,e},[i,o]);return(0,x.useEffect)(()=>()=>{m.map.dispose(),m.emissive.dispose(),m.bump.dispose(),R.dispose(),w.dispose()},[m,R,w]),(0,_.jsxs)("group",{position:[r,0,a],rotation:[0,s,0],children:[(0,_.jsx)("mesh",{position:[0,4.2+f/2,0],material:y.list,children:(0,_.jsx)("boxGeometry",{args:[i,f,o]})}),(0,_.jsxs)("instancedMesh",{ref:g,args:[void 0,void 0,h.length],children:[(0,_.jsx)("boxGeometry",{args:[1,1,1]}),(0,_.jsx)("meshStandardMaterial",{color:"#b3afa4",roughness:.95})]}),(0,_.jsxs)("instancedMesh",{ref:M,args:[void 0,void 0,b],children:[(0,_.jsx)("boxGeometry",{args:[1,1,1]}),(0,_.jsx)("meshStandardMaterial",{color:"#a7a398",roughness:.9})]}),(0,_.jsxs)("mesh",{position:[0,4.2-.32,0],children:[(0,_.jsx)("boxGeometry",{args:[i+.3,.4,o+.3]}),(0,_.jsx)("meshStandardMaterial",{color:"#8f8c82",roughness:.95})]}),(0,_.jsxs)("mesh",{position:[0,.1,0],children:[(0,_.jsx)("boxGeometry",{args:[i+.6,.2,o+.6]}),(0,_.jsx)("meshStandardMaterial",{map:w,color:"#c6c2b6",roughness:.65,metalness:.05})]}),(0,_.jsxs)("mesh",{position:[0,p+.3,0],children:[(0,_.jsx)("boxGeometry",{args:[i+.7,.6,o+.7]}),(0,_.jsx)("meshStandardMaterial",{color:"#b0aca1",roughness:.95})]}),(0,_.jsxs)("mesh",{position:[.18*i,p+1.6,0],children:[(0,_.jsx)("boxGeometry",{args:[.3*i,2,.5*o]}),(0,_.jsx)("meshStandardMaterial",{color:"#9a9d97",roughness:.9})]}),(0,_.jsxs)("mesh",{position:[-(.25*i),p+1.3,.1*o],children:[(0,_.jsx)("boxGeometry",{args:[.22*i,1.6,.3*o]}),(0,_.jsx)("meshStandardMaterial",{color:"#8f938c",roughness:.9})]}),"point"===d&&(0,_.jsxs)("mesh",{position:[0,p+2.4,0],children:[(0,_.jsx)("boxGeometry",{args:[.42*i,4.8,.42*o]}),(0,_.jsx)("meshStandardMaterial",{color:"#9fa199",roughness:.9})]}),(0,_.jsxs)("mesh",{position:[u*(i/2+.32),A,0],rotation:[0,C,0],children:[(0,_.jsx)("planeGeometry",{args:[2.6,1.6]}),(0,_.jsx)("meshStandardMaterial",{map:R,roughness:.7,side:E.DoubleSide})]}),(0,_.jsx)(iW,{w:i,d:o,floors:l,totalH:p,seed:c,lite:t}),(0,_.jsx)(iV,{w:i,d:o,roofY:p+.7,seed:c})]})}let iX=[{x:-19,z:-4,w:15,d:8,floors:10,rotY:.03,face:1,seed:1},{x:20,z:2,w:14,d:7,floors:12,rotY:-.04,face:-1,seed:2},{x:-30,z:-38,w:16,d:8,floors:14,rotY:.05,face:1,seed:3},{x:22,z:-24,w:13,d:7,floors:9,rotY:-.03,face:-1,seed:4},{x:-12,z:-60,w:13,d:7,floors:11,rotY:.04,face:1,seed:5},{x:20,z:-56,w:15,d:8,floors:13,rotY:-.05,face:-1,seed:6},{x:-33,z:-16,w:12,d:12,floors:22,rotY:.02,face:1,seed:7,kind:"point"},{x:34,z:-34,w:12,d:7,floors:8,rotY:-.03,face:-1,seed:8},{x:-11,z:-78,w:12,d:7,floors:10,rotY:.04,face:1,seed:9},{x:14,z:-78,w:13,d:7,floors:12,rotY:-.04,face:-1,seed:10},{x:2,z:-120,w:14,d:8,floors:15,rotY:.02,face:1,seed:11},{x:26,z:-8,w:11,d:11,floors:27,rotY:-.03,face:-1,seed:12,kind:"point"}];function iq({lite:e=!1}){let t=(0,x.useRef)([]),n=(0,x.useMemo)(()=>iX.map((e,n)=>e=>{t.current[n]=e}),[]);return nz(()=>{let n=.2+iR.windowGlow*(e?2.6:1.6);for(let e of t.current)e&&(e.emissiveIntensity=n)}),(0,_.jsx)("group",{children:iX.map((t,r)=>(0,_.jsx)(ij,{def:t,lite:e,facadeMat:n[r]},t.seed))})}let iK=[-.6,0,-37.2],iY=null;function i$({curve:e,mosaic:t}){let n=(0,x.useMemo)(()=>new E.TubeGeometry(e,90,.5,10,!1),[e]);return(0,x.useEffect)(()=>()=>n.dispose(),[n]),(0,_.jsx)("mesh",{geometry:n,children:(0,_.jsx)("meshStandardMaterial",{map:t,roughness:.85,metalness:0})})}function iQ({curve:e}){let t=(0,x.useMemo)(()=>{let t=[],n=new E.Vector3(0,0,1);for(let r=1;r<=13;r++){let a=r/14,i=e.getPointAt(a),o=e.getTangentAt(a).normalize(),l=new E.Quaternion().setFromUnitVectors(n,o);t.push({pos:new E.Vector3(i.x,i.y+.5,i.z),quat:l,r:1.15-.55*a})}return t},[e]);return(0,_.jsx)(_.Fragment,{children:t.map((e,t)=>(0,_.jsxs)("mesh",{position:e.pos,quaternion:e.quat,children:[(0,_.jsx)("torusGeometry",{args:[e.r,.085,8,22]}),(0,_.jsx)("meshStandardMaterial",{color:t%3==0?"#e2a53a":"#c65a28",roughness:.5,metalness:.15})]},t))})}function iZ({mosaic:e}){return(0,_.jsxs)("group",{position:[1.9,2,0],rotation:[0,0,-.15],children:[(0,_.jsxs)("mesh",{children:[(0,_.jsx)("icosahedronGeometry",{args:[1.35,0]}),(0,_.jsx)("meshStandardMaterial",{map:e,roughness:.85,metalness:0})]}),(0,_.jsxs)("mesh",{position:[1.35,-.25,0],rotation:[0,0,-.1],children:[(0,_.jsx)("coneGeometry",{args:[.85,1.7,5]}),(0,_.jsx)("meshStandardMaterial",{map:e,roughness:.85,metalness:0})]}),(0,_.jsxs)("mesh",{position:[.9,-.85,0],rotation:[0,0,-.25],children:[(0,_.jsx)("boxGeometry",{args:[1.6,.5,1.4]}),(0,_.jsx)("meshStandardMaterial",{color:"#e6d8bc",roughness:.9})]}),[-.72,.72].map(e=>(0,_.jsxs)("group",{position:[.45,.55,e],children:[(0,_.jsxs)("mesh",{children:[(0,_.jsx)("sphereGeometry",{args:[.42,18,18]}),(0,_.jsx)("meshStandardMaterial",{color:"#f2ead6",roughness:.6})]}),(0,_.jsxs)("mesh",{position:[.34,0,0],children:[(0,_.jsx)("sphereGeometry",{args:[.2,16,16]}),(0,_.jsx)("meshStandardMaterial",{color:"#241a12",roughness:.5})]})]},e)),[-.28,.28].map(e=>(0,_.jsxs)("mesh",{position:[2.05,-.25,e],children:[(0,_.jsx)("sphereGeometry",{args:[.11,10,10]}),(0,_.jsx)("meshStandardMaterial",{color:"#2a180e",roughness:.6})]},e)),[-.5,.5].map(t=>(0,_.jsxs)("mesh",{position:[-.5,1,t],rotation:[0,0,.3],children:[(0,_.jsx)("coneGeometry",{args:[.24,.7,5]}),(0,_.jsx)("meshStandardMaterial",{map:e,roughness:.85})]},t))]})}function iJ(){let e=(0,x.useMemo)(()=>(function(){if(iY)return iY;let e=document.createElement("canvas");e.width=e.height=256;let t=e.getContext("2d");t.fillStyle="#5a2a18",t.fillRect(0,0,256,256);let n=["#c85a2a","#b8481e","#d46a30","#c0501f"];for(let e=0;e<256;e+=12)for(let r=0;r<256;r+=12){let a=Math.random();t.fillStyle=a<.12?"#ecdcbe":a<.2?"#e2a53a":n[(r+e)%n.length],t.fillRect(r+1,e+1,10,10)}let r=new E.CanvasTexture(e);return r.wrapS=r.wrapT=E.RepeatWrapping,r.repeat.set(2,2),r.colorSpace
686=E.SRGBColorSpace,iY=r,r})(),[]),t=(0,x.useMemo)(()=>{let e=[];for(let t=0;t<15;t++){let n=t/14,r=1.2-18*n,a=.55+.5*Math.sin(n*Math.PI*2.6)*(1-.5*n),i=1.1*Math.sin(n*Math.PI*1.7);e.push(new E.Vector3(r,a,i))}return new E.CatmullRomCurve3(e,!1,"catmullrom",.5)},[]);return(0,_.jsxs)("group",{position:iK,rotation:[0,-.4,0],children:[(0,_.jsxs)("mesh",{rotation:[-Math.PI/2,0,0],position:[-6.3,.02,0],scale:[1.25,.5,1],children:[(0,_.jsx)("circleGeometry",{args:[9,44]}),(0,_.jsx)("meshStandardMaterial",{color:"#cdb078",roughness:1})]}),(0,_.jsxs)("mesh",{rotation:[-Math.PI/2,0,0],position:[-6.3,.03,0],scale:[1.25,.5,1],children:[(0,_.jsx)("ringGeometry",{args:[8.7,9.3,44]}),(0,_.jsx)("meshStandardMaterial",{color:"#b7b3a7",roughness:.95,side:E.DoubleSide})]}),(0,_.jsx)(i$,{curve:t,mosaic:e}),(0,_.jsx)(iQ,{curve:t}),(0,_.jsx)(iZ,{mosaic:e}),(0,_.jsxs)("mesh",{position:[-1.5,.7,1.6],rotation:[.55,0,0],children:[(0,_.jsx)("boxGeometry",{args:[.9,.12,3]}),(0,_.jsx)("meshStandardMaterial",{color:"#d8cdae",roughness:.7,metalness:.05})]})]})}let i0=[-3,0,-103],i1=[{name:"CHICKEN RICE",cn:"鸡é¥",color:"#c0392b",no:"01-14"},{name:"LAKSA",cn:"廿²",color:"#e08a2e",no:"01-15"},{name:"WANTON MEE",cn:"äºåé¢",color:"#2e7d5b",no:"01-16"},{name:"ROJAK",cn:"åå",color:"#6d4fae",no:"01-17"},{name:"KOPI · TEH",cn:"åå¡",color:"#8a5a2b",no:"01-18"}];function i2({stall:e,x:t}){let n=(0,x.useMemo)(()=>{let t,n,r;return(t=document.createElement("canvas")).width=384,t.height=128,(n=t.getContext("2d")).fillStyle=e.color,n.fillRect(0,0,384,128),n.fillStyle="rgba(255,255,255,0.9)",n.fillRect(6,6,372,116),n.fillStyle=e.color,n.fillRect(12,12,360,104),n.fillStyle="#fff",n.textBaseline="middle",n.font="bold 62px 'PingFang SC','Hiragino Sans GB','Microsoft YaHei',sans-serif",n.textAlign="left",n.fillText(e.cn,26,56),n.font="bold 30px Arial, sans-serif",n.fillText(e.name,26,98),n.textAlign="right",n.font="600 22px Arial, sans-serif",n.fillText(e.no,360,30),(r=new E.CanvasTexture(t)).colorSpace
686=E.SRGBColorSpace,r},[e]);return(0,x.useEffect)(()=>()=>n.dispose(),[n]),(0,_.jsxs)("group",{position:[t,0,-4],children:[(0,_.jsxs)("mesh",{position:[0,2.4,-.6],children:[(0,_.jsx)("boxGeometry",{args:[4.4,4.8,.2]}),(0,_.jsx)("meshStandardMaterial",{color:"#c9c6bd",roughness:.9})]}),(0,_.jsxs)("mesh",{position:[0,1.05,.7],children:[(0,_.jsx)("boxGeometry",{args:[4.2,1.1,1.6]}),(0,_.jsx)("meshStandardMaterial",{color:"#b8bcc0",roughness:.4,metalness:.5})]}),(0,_.jsxs)("mesh",{position:[0,.5,1.5],children:[(0,_.jsx)("boxGeometry",{args:[4.2,1,.12]}),(0,_.jsx)("meshStandardMaterial",{color:"#8f9498",roughness:.5,metalness:.4})]}),(0,_.jsxs)("mesh",{position:[0,4.15,.9],children:[(0,_.jsx)("planeGeometry",{args:[4.3,1.35]}),(0,_.jsx)("meshStandardMaterial",{map:n,emissiveMap:n,emissive:"#ffffff",emissiveIntensity:.35,roughness:.6})]}),(0,_.jsxs)("mesh",{position:[0,3.35,1],children:[(0,_.jsx)("boxGeometry",{args:[3.8,.08,.08]}),(0,_.jsx)("meshBasicMaterial",{color:"#fff6e0",toneMapped:!1})]})]})}function i3({pos:e,seed:t}){let n=["#c0392b","#2e7d8a","#d99a2b","#3a6ea5"],r=n[t%n.length];return(0,_.jsxs)("group",{position:e,children:[(0,_.jsxs)("mesh",{position:[0,.74,0],children:[(0,_.jsx)("cylinderGeometry",{args:[1.05,1.05,.1,24]}),(0,_.jsx)("meshStandardMaterial",{color:"#d7d1c2",roughness:.7,metalness:.05})]}),(0,_.jsxs)("mesh",{position:[0,.37,0],children:[(0,_.jsx)("cylinderGeometry",{args:[.14,.14,.74,10]}),(0,_.jsx)("meshStandardMaterial",{color:"#9a9d97",roughness:.5,metalness:.4})]}),[0,1,2,3].map(e=>{let t=e/4*Math.PI*2+Math.PI/4,n=1.55*Math.cos(t),a=1.55*Math.sin(t);return(0,_.jsxs)("group",{position:[n,0,a],children:[(0,_.jsxs)("mesh",{position:[0,.46,0],children:[(0,_.jsx)("cylinderGeometry",{args:[.3,.3,.08,16]}),(0,_.jsx)("meshStandardMaterial",{color:r,roughness:.6})]}),(0,_.jsxs)("mesh",{position:[0,.23,0],children:[(0,_.jsx)("cylinderGeometry",{args:[.06,.06,.46,8]}),(0,_.jsx)("meshStandardMaterial",{color:"#8f9297",roughness:.5,metalness:.4})]})]},e)})]})}function i4(){let e=(0,x.useMemo)(()=>Array.from({length:7},(e,t)=>({pos:[-9+3*t,5.6,2.6],warm:t%2==0})),[]);return(0,_.jsx)(_.Fragment,{children:e.map((e,t)=>(0,_.jsxs)("group",{position:e.pos,children:[(0,_.jsxs)("mesh",{position:[0,1.15,0],children:[(0,_.jsx)("cylinderGeometry",{args:[.02,.02,1.6,5]}),(0,_.jsx)("meshStandardMaterial",{color:"#3a3a3a",roughness:.8})]}),(0,_.jsxs)("mesh",{position:[0,.5,0],children:[(0,_.jsx)("cylinderGeometry",{args:[.12,.16,.14,8]}),(0,_.jsx)("meshStandardMaterial",{color:"#7a5230",roughness:.7})]}),(0,_.jsxs)("mesh",{children:[(0,_.jsx)("sphereGeometry",{args:[.42,16,12]}),(0,_.jsx)("meshStandardMaterial",{color:e.warm?"#e8632e":"#e0304a",emissive:e.warm?"#e8632e":"#e0304a",emissiveIntensity:.25,roughness:.7})]})]},t))})}function i5(){let e=(0,x.useMemo)(()=>[-13,-6.5,0,6.5,13].flatMap(e=>[-5,4.5].map(t=>[e,t])),[]),t=(0,x.useMemo)(()=>{let e=[];return[-8,-2.7,2.7,8].forEach(t=>[.5,4].forEach(n=>e.push([t,n]))),e},[]);return(0,_.jsxs)("group",{position:i0,children:[(0,_.jsxs)("mesh",{rotation:[-Math.PI/2,0,0],position:[0,.02,0],children:[(0,_.jsx)("planeGeometry",{args:[30,16]}),(0,_.jsx)("meshStandardMaterial",{color:"#a8a49a",roughness:.95})]}),e.map(([e,t],n)=>(0,_.jsxs)("mesh",{position:[e,3.35,t],children:[(0,_.jsx)("boxGeometry",{args:[.5,6.7,.5]}),(0,_.jsx)("meshStandardMaterial",{color:"#b7b3a8",roughness:.9})]},n)),[-5,4.5].map(e=>(0,_.jsxs)("mesh",{position:[0,6.5,e],children:[(0,_.jsx)("boxGeometry",{args:[28,.5,.6]}),(0,_.jsx)("meshStandardMaterial",{color:"#8f9498",roughness:.7,metalness:.2})]},e)),(0,_.jsxs)("mesh",{position:[0,6.9,-3],rotation:[.27,0,0],children:[(0,_.jsx)("boxGeometry",{args:[30,.3,6.2]}),(0,_.jsx)("meshStandardMaterial",{color:"#7c8a86",roughness:.9})]}),(0,_.jsxs)("mesh",{position:[0,6.9,3],rotation:[-.27,0,0],children:[(0,_.jsx)("boxGeometry",{args:[30,.3,6.2]}),(0,_.jsx)("meshStandardMaterial",{color:"#7c8a86",roughness:.9})]}),(0,_.jsxs)("mesh",{position:[0,7.75,0],children:[(0,_.jsx)("boxGeometry",{args:[30,.35,.35]}),(0,_.jsx)("meshStandardMaterial",{color:"#5f6e6a",roughness:.9})]}),i1.map((e,t)=>(0,_.jsx)(i2,{stall:e,x:-10+5*t},e.no)),t.map(([e,t],n)=>(0,_.jsx)(i3,{pos:[e,0,t],seed:n},n)),(0,_.jsx)(i4,{})]})}let i6=[0,0,-175];function i8(){return(0,_.jsx)("group",{position:[0,10.2,3.4],children:[-11,0,11].map((e,t)=>(0,_.jsxs)("group",{position:[e,0,0],children:[(0,_.jsxs)("mesh",{children:[(0,_.jsx)("boxGeometry",{args:[10.4,3.1,2.6]}),(0,_.jsx)("meshStandardMaterial",{color:"#eef1f4",roughness:.4,metalness:.15})]}),(0,_.jsxs)("mesh",{position:[0,.55,1.36],children:[(0,_.jsx)("boxGeometry",{args:[9.2,1.1,.1]}),(0,_.jsx)("meshStandardMaterial",{color:"#25343f",roughness:.3,metalness:.3})]}),(0,_.jsxs)("mesh",{position:[0,-.25,1.36],children:[(0,_.jsx)("boxGeometry",{args:[10.2,.35,.1]}),(0,_.jsx)("meshStandardMaterial",{color:"#d23b2e",roughness:.5})]}),[-3.2,0,3.2].map(e=>(0,_.jsxs)("mesh",{position:[e,-.1,1.42],children:[(0,_.jsx)("boxGeometry",{args:[1.3,2.1,.1]}),(0,_.jsx)("meshStandardMaterial",{color:"#c9d2d8",roughness:.4,metalness:.2})]},e))]},t))})}function i9(){let e=(0,x.useMemo)(()=>Array.from({length:11}
686,(e,t)=>-70+14*t),[]),t=(0,x.useMemo)(()=>[-18,-9,0,9,18],[]);return(0,_.jsxs)("group",{position:i6,children:[e.map(e=>(0,_.jsxs)("mesh",{position:[e,4.25,0],children:[(0,_.jsx)("boxGeometry",{args:[2,8.5,2.2]}),(0,_.jsx)("meshStandardMaterial",{color:"#b9b5aa",roughness:.9})]},e)),(0,_.jsxs)("mesh",{position:[0,8.5,0],children:[(0,_.jsx)("boxGeometry",{args:[150,.8,9]}),(0,_.jsx)("meshStandardMaterial",{color:"#a7a49b",roughness:.95})]}),[3.4,-1.8].map(e=>[-.7,.7].map(t=>(0,_.jsxs)("mesh",{position:[0,9,e+t],children:[(0,_.jsx)("boxGeometry",{args:[150,.18,.14]}),(0,_.jsx)("meshStandardMaterial",{color:"#6f7378",roughness:.5,metalness:.5})]},`${e}-${t}`))),(0,_.jsxs)("mesh",{position:[0,9.05,0],children:[(0,_.jsx)("boxGeometry",{args:[44,.6,13]}),(0,_.jsx)("meshStandardMaterial",{color:"#c6c3ba",roughness:.9})]}),[6.2,-6.2].map(e=>(0,_.jsxs)("mesh",{position:[0,9.8,e],children:[(0,_.jsx)("boxGeometry",{args:[44,1.1,.16]}),(0,_.jsx)("meshStandardMaterial",{color:"#aebfca",roughness:.35,metalness:.15})]},e)),t.flatMap(e=>[6.3,-6.3].map(t=>(0,_.jsxs)("mesh",{position:[e,12.2,t],children:[(0,_.jsx)("cylinderGeometry",{args:[.28,.28,6.6,10]}),(0,_.jsx)("meshStandardMaterial",{color:"#c8ccce",roughness:.35,metalness:.6})]},`${e}-${t}`))),[6.4,-6.4].map(e=>(0,_.jsxs)("mesh",{position:[0,15.4,e],children:[(0,_.jsx)("boxGeometry",{args:[46,.5,.6]}),(0,_.jsx)("meshStandardMaterial",{color:"#8f9498",roughness:.6,metalness:.3})]},e)),(0,_.jsxs)("mesh",{position:[0,12.05,0],rotation:[0,0,Math.PI/2],children:[(0,_.jsx)("cylinderGeometry",{args:[7.4,7.4,46,28,1,!0,.15*Math.PI,.7*Math.PI]}),(0,_.jsx)("meshStandardMaterial",{color:"#eef1f3",side:E.DoubleSide,roughness:.45,metalness:.2})]}),(0,_.jsxs)("mesh",{position:[0,15.9,6.5],children:[(0,_.jsx)("boxGeometry",{args:[9,1.3,.2]}),(0,_.jsx)("meshStandardMaterial",{color:"#1f6f4a",roughness:.7})]}),(0,_.jsx)(i8,{})]})}let i7="#ffb765",oe=[...iX.map(e=>({x0:e.x-e.w/2-.6,x1:e.x+e.w/2+.6,z0:e.z-e.d/2-.6,z1:e.z+e.d/2+3.2+.6})),{x0:-18,x1:5,z0:-46,z1:-33},{x0:-20,x1:14,z0:-112,z1:-94},{x0:-75,x1:75,z0:-182,z1:-168}];function ot(e,t){return oe.some(n=>e+.8>n.x0&&e-.8<n.x1&&t+.8>n.z0&&t-.8<n.z1)}function on({lite:e=!1}){let{camera:t}=nk(),n=e?2:3,r=(0,x.useMemo)(()=>(function(){let e=new ImageData(128,128),t=e.data;for(let e=0;e<128;e++)for(let n=0;n<128;n++){let r,a=Math.hypot(n+.5-64,e+.5-64);if(a<=2)r=.85;else if(a>=64)r=0;else{let e=(a-2)/62;r=e<.45?.85+-(e/.45*.57):.28*(1-(e-.45)/.55)}let i=(128*e+n)*4;t[i]=t[i+1]=t[i+2]=255,t[i+3]=Math.round(255*r)}let n=document.createElement("canvas");n.width=n.height=128,n.getContext("2d").putImageData(e,0,0);let r=new E.CanvasTexture(n);return r.colorSpace=E.SRGBColorSpace,r})(),[]);(0,x.useEffect)(()=>()=>r.dispose(),[r]);let a=(0,x.useMemo)(()=>{let e=[],t=[0,2.5,-2.5,5,-5,7.5,-7.5];for(let n=0;n<14;n++){let r=n%2==0?-1:1,a=9.5*r,i=12-13*n,o=a-1.6*r,l=t.map(e=>i+e).find(e=>!ot(a,e)&&!ot(o,e));void 0!==l&&e.push({x:a,z:l,side:r,head:new E.Vector3(o,6.7,l)})}return e},[]),i=(0,x.useMemo)(()=>{let e=new E.Quaternion,t=new E.Quaternion().setFromEuler(new E.Euler(-Math.PI/2,0,0)),n=e=>t=>{if(!t)return;let n=new E.Matrix4;for(let r=0;r<a.length;r++)e(r,n),t.setMatrixAt(r,n);t.instanceMatrix.needsUpdate=!0};return{poles:n((t,n)=>{let r=a[t];n.compose(new E.Vector3(r.x,3.5,r.z),e,new E.Vector3(.13,7,.13))}),arms:n((t,n)=>{let r=a[t];n.compose(new E.Vector3(r.x-.85*r.side,6.88,r.z),e,new E.Vector3(1.8,.14,.14))}),heads:n((t,n)=>{n.compose(a[t].head,e,new E.Vector3(.95,.26,.5))}),pools:n((e,n)=>{let r=a[e];n.compose(new E.Vector3(r.head.x,.07,r.z),t,new E.Vector3(24,24,1))})}},[a]),o=(0,x.useRef)(null),l=(0,x.useRef)(null),s=(0,x.useRef)([]),u=(0,x.useRef)({idx:new Int32Array(3),dist:new Float64Array(3)});return nz(()=>{let n=iR.lampOn;o.current&&(o.current.emissiveIntensity=n*(e?5:3.2)),l.current&&(l.current.opacity=n*(e?1:.8));let r=s.current.length;if(!r)return;let{idx:i,dist:c}=u.current,d=t.position.z;for(let e=0;e<r;e++)i[e]=-1,c[e]=1/0;for(let e=0;e<a.length;e++){let t=Math.abs(a[e].z-d);for(let n=0;n<r;n++)if(t<c[n]){for(let e=r-1;e>n;e--)i[e]=i[e-1],c[e]=c[e-1];i[n]=e,c[n]=t;break}}for(let e=0;e<r;e++){let t=s.current[e];if(t){if(i[e]<0){t.intensity=0;continue}t.position.copy(a[i[e]].head),t.intensity=160*n}}}),(0,_.jsxs)("group",{children:[(0,_.jsxs)("instancedMesh",{ref:i.poles,args:[void 0,void 0,a.length],children:[(0,_.jsx)("cylinderGeometry",{args:[1,1,1,6]}),(0,_.jsx)("meshStandardMaterial",{color:"#6f736e",roughness:.75,metalness:.35})]}),(0,_.jsxs)("instancedMesh",{ref:i.arms,args:[void 0,void 0,a.length],children:[(0,_.jsx)("boxGeometry",{args:[1,1,1]}),(0,_.jsx)("meshStandardMaterial",{color:"#6f736e",roughness:.75,metalness:.35})]}),(0,_.jsxs)("instancedMesh",{ref:i.heads,args:[void 0,void 0,a.length],children:[(0,_.jsx)("boxGeometry",{args:[1,1,1]}),(0,_.jsx)("meshStandardMaterial",{ref:o,color:"#3a3a38",emissive:i7,emissiveIntensity:0,roughness:.6})]}),(0,_.jsxs)("instancedMesh",{ref:i.pools,args:[void 0,void 0,a.length],renderOrder:2,children:[(0,_.jsx)("planeGeometry",{args:[1,1]}),(0,_.jsx)("meshBasicMaterial",{ref:l,map:r,color:i7,transparent:!0,opacity:0,depthWrite:!1,blending:E.AdditiveBlending})]}),Array.from({length:n},(e,t)=>(0,_.jsx)("pointLight",{ref:e=>{s.current[t]=e,s.current.length=n},color:i7,intensity:0,distance:52,decay:2},t))]})}function or({lite:e=!1}){let{scene:t,camera:n}=nk(),r=(0,x.useRef)(null),a=(0,x.useRef)(null),i=(0,x.useRef)(null),o=(0,x.useRef)({fog:.005,rain:0,thunder:0}),l=(0,x.useRef)(2+4*Math.random()),s=e?450:1400,u=(0,x.useMemo)(()=>new E.FogExp2(im.NIGHT.fog.getHex(),.005),[]);(0,x.useEffect)(()=>(t.fog=u,()=>{t.fog=null}),[t,u]);let c=(0,x.useMemo)(()=>{let e=new Float32Array(3*s);for(let t=0;t<s;t++)e[3*t]=(Math.random()-.5)*60,e[3*t+1]=60*Math.random(),e[3*t+2]=(Math.random()-.5)*60;return e},[s]);return nz((e,t)=>{let c=function(e){switch(e){case"thunder":return{fog:.007,rain:1,thunder:1};case"rain":return{fog:.006,rain:1,thunder:0};case"haze":return{fog:.011,rain:0,thunder:0};default:return{fog:.004,rain:0,thunder:0}}}(ix.weatherState.condition),d=o.current,f=Math.min(1,.8*t);if(d.fog+=(c.fog-d.fog)*f,d.rain+=(c.rain-d.rain)*f,d.thunder+=(c.thu
686nder-d.thunder)*f,u.density=d.fog,r.current&&a.current&&(a.current.opacity=.5*d.rain,r.current.visible=d.rain>.02,r.current.visible)){let e=r.current.geometry.attributes.position.array,a=55*t;for(let t=0;t<s;t++)e[3*t+1]-=a,e[3*t+1]<0&&(e[3*t+1]=60);r.current.geometry.attributes.position.needsUpdate=!0,r.current.position.set(n.position.x,n.position.y-30,n.position.z)}if(i.current){i.current.position.set(n.position.x,50,n.position.z-20);let e=0;if(d.thunder>.1){l.current-=t,l.current<0&&(l.current=2.5+5*Math.random(),i.current.userData.strike=.18);let n=i.current.userData.strike??0;n>0&&(e=(Math.random()>.4?1:.3)*300*d.thunder,i.current.userData.strike=n-t)}i.current.intensity=e}}),(0,_.jsxs)("group",{children:[(0,_.jsxs)("points",{ref:r,children:[(0,_.jsx)("bufferGeometry",{children:(0,_.jsx)("bufferAttribute",{attach:"attributes-position",args:[c,3]})}),(0,_.jsx)("pointsMaterial",{ref:a,color:"#9fd4e0",size:.14,sizeAttenuation:!0,transparent:!0,opacity:0,depthWrite:!1})]}),(0,_.jsx)("pointLight",{ref:i,color:"#cfe8ff",intensity:0,distance:400,decay:.6})]})}function oa({lite:e}){let{scene:t}=nk(),n=(0,x.useRef)(null),r=(0,x.useRef)(null),a=(0,x.useRef)(null),i=(0,x.useRef)(new E.Color);return(0,x.useEffect)(()=>(t.background=i.current,()=>{t.background=null}),[t]),nz(()=>{let o=iL(iy());i.current.copy(o.bg),t.fog&&t.fog.color.copy(o.fog);let l=iD.value;n.current&&(n.current.color.copy(o.keyColor),n.current.intensity=o.keyIntensity*(1-.82*l),n.current.position.copy(o.sunDir).multiplyScalar(120));let s=e?1+1.7*o.lampOn:1;r.current&&(r.current.color.copy(o.hemiSky),r.current.groundColor.copy(o.hemiGround),r.current.intensity=o.hemiIntensity*s*(1+.55*l)),a.current&&(a.current.intensity=o.ambient*s*(1+.3*l))}),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("hemisphereLight",{ref:r}),(0,_.jsx)("directionalLight",{ref:n}),(0,_.jsx)("ambientLight",{ref:a}),!e&&(0,_.jsx)(oo,{})]})}let oi={current:null};function oo(){return nz(()=>{let e=oi.current;e&&(e.intensity=iR.bloomIntensity,e.luminanceMaterial.threshold=iR.bloomThreshold)}),null}function ol({lite:e=!1}){return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(oa,{lite:e}),(0,_.jsx)(iS,{}),(0,_.jsx)(iB,{lite:e}),(0,_.jsx)(iO,{}),(0,_.jsx)(iq,{lite:e}),(0,_.jsx)(iJ,{}),(0,_.jsx)(i5,{}),(0,_.jsx)(i9,{}),(0,_.jsx)(on,{lite:e}),(0,_.jsx)(or,{lite:e}),!e&&(0,_.jsxs)(is,{children:[(0,_.jsx)(ic,{ref:oi,intensity:iR.bloomIntensity,luminanceThreshold:iR.bloomThreshold,luminanceSmoothing:.4,mipmapBlur:!0}
686),(0,_.jsx)(id,{eskil:!1,offset:.32,darkness:.6})]})]})}function os({fps:e}){let t=nk(e=>e.invalidate);return(0,x.useEffect)(()=>{let n=0,r=0,a=1e3/e,i=e=>{n=requestAnimationFrame(i),e-r<a-1||(r=e,t())};return n=requestAnimationFrame(i),()=>cancelAnimationFrame(n)},[e,t]),null}function ou({onLost:e,onRestored:t}){let n=nk(e=>e.gl);return(0,x.useEffect)(()=>{let r=n.domElement,a=t=>{t.preventDefault(),e()},i=()=>t();return r.addEventListener("webglcontextlost",a,!1),r.addEventListener("webglcontextrestored",i,!1),()=>{r.removeEventListener("webglcontextlost",a),r.removeEventListener("webglcontextrestored",i)}},[n,e,t]),null}function oc({hour:e}){let t=iL(e??18.8),n=`#${t.zenith.getHexString()}`,r=`#${t.horizon.getHexString()}`,a=`#${t.sunColor.getHexString()}`;return(0,_.jsx)("div",{"aria-hidden":!0,style:{position:"fixed",inset:0,zIndex:-1,background:`radial-gradient(50% 40% at 72% 20%, ${a}${Math.round(128*t.sunOpacity).toString(16).padStart(2,"0")} 0%, transparent 55%),linear-gradient(180deg, ${n} 0%, ${r} 100%)`}})}e.s(["default",0,function(){let e=function(){let[e,t]=(0,x.useState)(null);return(0,x.useEffect)(()=>{let e;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return void t("poster");let n=navigator.hardwareConcurrency??8,r=()=>t(window.innerWidth<768||n<=4?"lite":"full");r();let a=()=>{clearTimeout(e),e=setTimeout(r,200)};return window.addEventListener("resize",a),()=>{clearTimeout(e),window.removeEventListener("resize",a)}},[]),e}(),[t,n]=(0,x.useState)(0),[r,a]=(0,x.useState)(!1),i=(0,x.useRef)(0),o=(0,x.useRef)(null),l=(0,x.useCallback)(()=>{o.current||(o.current=setTimeout(()=>{o.current=null,i.current+=1,i.current>3?a(!0):n(e=>e+1)},1500))},[]),s=(0,x.useCallback)(()=>{o.current&&(clearTimeout(o.current),o.current=null)},[]);if((0,x.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]),null===e)return(0,_.jsx)(oc,{hour:null});if("poster"===e||r)return(0,_.jsx)(oc,{hour:iy()});let u="lite"===e;return(0,_.jsx)("div",{style:{position:"fixed",inset:0,zIndex:-1},"aria-hidden":!0,children:(0,_.jsxs)(rM,{gl:{antialias:!u,powerPreference:"high-performance",toneMapping:E.ACESFilmicToneMapping},dpr:u?[1,1.3]:[1,1.75],frameloop:u?"demand":"always",camera:{fov:52,near:1,far:500,position:[4.5,1.75,7]},onCreated:({camera:e})=>{let t=(0,ih.pinnedProgress)();if(null!==t){let n=im.posCurve.getPoint(t),r=im.targetCurve.getPoint(t);e.position.copy(n),e.lookAt(r)}},children:[(0,_.jsx)(ou,{onLost:l,onRestored:s}),u&&(0,_.jsx)(os,{fps:30}),(0,_.jsx)(x.Suspense,{fallback:null,children:(0,_.jsx)(ol,{lite:u})})]},t)})}],88727)}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.