stereoframe-runtime 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/stereoframe.js +408 -186
  2. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
- var $Y="184";var ZY=0,F$=1,WY=2;var b6=1,YY=2,Z6=3,z9=0,bJ=1,cJ=2,w9=0,V8=1,f6=2,N$=3,O$=4,XY=5;var W6=100,KY=101,HY=102,UY=103,GY=104,EY=200,FY=201,NY=202,OY=203,qY=204,RY=205,LY=206,DY=207,MY=208,kY=209,BY=210,VY=211,CY=212,IY=213,zY=214,wY=0,PY=1,_Y=2,q$=3,TY=4,AY=5,SY=6,jY=7,vY=0,yY=1,hY=2,rJ=0,R$=1,L$=2,D$=3,g6=4,M$=5,k$=6,B$=7;var Y6=301,C8=302,u7=303,m7=304,p6=306,X8=1000,X6=1001,l7=1002,L9=1003,c7=1004;var I8=1005;var BJ=1006,K6=1007;var P9=1008;var D9=1009,xY=1010,bY=1011,d6=1012,V$=1013,K8=1014,tJ=1015,fJ=1016,C$=1017,I$=1018,H6=1020,fY=35902,gY=35899,pY=1021,dY=1022,_9=1023,z8=1026,w8=1027,uY=1028,z$=1029,P8=1030,w$=1031;var P$=1033,n7=33776,s7=33777,i7=33778,o7=33779,_$=35840,T$=35841,A$=35842,S$=35843,j$=36196,v$=37492,y$=37496,h$=37488,x$=37489,a7=37490,b$=37491,f$=37808,g$=37809,p$=37810,d$=37811,u$=37812,m$=37813,l$=37814,c$=37815,n$=37816,s$=37817,i$=37818,o$=37819,a$=37820,r$=37821,t$=36492,e$=36494,JZ=36495,QZ=36283,$Z=36284,r7=36285,ZZ=36286;var WZ=2300,t7=2301;var YZ=0,u6=1,U6=2;var XZ=0,mY=1,_8="",H8="srgb",uJ="srgb-linear",KZ="linear",UJ="srgb";var lY=512,cY=513,nY=514,e7=515,sY=516,iY=517,JQ=518,oY=519;var G6=35048;var HZ="300 es",UZ=2000;function GH(J){for(let Q=J.length-1;Q>=0;--Q)if(J[Q]>=65535)return!0;return!1}function EH(J){return ArrayBuffer.isView(J)&&!(J instanceof DataView)}function J6(J){return document.createElementNS("http://www.w3.org/1999/xhtml",J)}function aY(){let J=J6("canvas");return J.style.display="block",J}var DW={},Q6=null;function x6(...J){let Q="THREE."+J.shift();if(Q6)Q6("log",Q,...J);else console.log(Q,...J)}function rY(J){let Q=J[0];if(typeof Q==="string"&&Q.startsWith("TSL:")){let $=J[1];if($&&$.isStackTrace)J[0]+=" "+$.getLocation();else J[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return J}function C0(...J){J=rY(J);let Q="THREE."+J.shift();if(Q6)Q6("warn",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.warn($.getError(Q));else console.warn(Q,...J)}}function A0(...J){J=rY(J);let Q="THREE."+J.shift();if(Q6)Q6("error",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.error($.getError(Q));else console.error(Q,...J)}}function g7(...J){let Q=J.join(" ");if(Q in DW)return;DW[Q]=!0,C0(...J)}function tY(J,Q,$){return new Promise(function(Z,W){function Y(){switch(J.clientWaitSync(Q,J.SYNC_FLUSH_COMMANDS_BIT,0)){case J.WAIT_FAILED:W();break;case J.TIMEOUT_EXPIRED:setTimeout(Y,$);break;default:Z()}}setTimeout(Y,$)})}var eY={[0]:1,[2]:6,[4]:7,[3]:5,[1]:0,[6]:2,[7]:4,[5]:3};class T9{addEventListener(J,Q){if(this._listeners===void 0)this._listeners={};let $=this._listeners;if($[J]===void 0)$[J]=[];if($[J].indexOf(Q)===-1)$[J].push(Q)}hasEventListener(J,Q){let $=this._listeners;if($===void 0)return!1;return $[J]!==void 0&&$[J].indexOf(Q)!==-1}removeEventListener(J,Q){let $=this._listeners;if($===void 0)return;let Z=$[J];if(Z!==void 0){let W=Z.indexOf(Q);if(W!==-1)Z.splice(W,1)}}dispatchEvent(J){let Q=this._listeners;if(Q===void 0)return;let $=Q[J.type];if($!==void 0){J.target=this;let Z=$.slice(0);for(let W=0,Y=Z.length;W<Y;W++)Z[W].call(this,J);J.target=null}}}var hJ=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],MW=1234567,y6=Math.PI/180,k8=180/Math.PI;function R9(){let J=Math.random()*4294967295|0,Q=Math.random()*4294967295|0,$=Math.random()*4294967295|0,Z=Math.random()*4294967295|0;return(hJ[J&255]+hJ[J>>8&255]+hJ[J>>16&255]+hJ[J>>24&255]+"-"+hJ[Q&255]+hJ[Q>>8&255]+"-"+hJ[Q>>16&15|64]+hJ[Q>>24&255]+"-"+hJ[$&63|128]+hJ[$>>8&255]+"-"+hJ[$>>16&255]+hJ[$>>24&255]+hJ[Z&255]+hJ[Z>>8&255]+hJ[Z>>16&255]+hJ[Z>>24&255]).toLowerCase()}function m0(J,Q,$){return Math.max(Q,Math.min($,J))}function GZ(J,Q){return(J%Q+Q)%Q}function FH(J,Q,$,Z,W){return Z+(J-Q)*(W-Z)/($-Q)}function NH(J,Q,$){if(J!==Q)return($-J)/(Q-J);else return 0}function h6(J,Q,$){return(1-$)*J+$*Q}function OH(J,Q,$,Z){return h6(J,Q,1-Math.exp(-$*Z))}function qH(J,Q=1){return Q-Math.abs(GZ(J,Q*2)-Q)}function RH(J,Q,$){if(J<=Q)return 0;if(J>=$)return 1;return J=(J-Q)/($-Q),J*J*(3-2*J)}function LH(J,Q,$){if(J<=Q)return 0;if(J>=$)return 1;return J=(J-Q)/($-Q),J*J*J*(J*(J*6-15)+10)}function DH(J,Q){return J+Math.floor(Math.random()*(Q-J+1))}function MH(J,Q){return J+Math.random()*(Q-J)}function kH(J){return J*(0.5-Math.random())}function BH(J){if(J!==void 0)MW=J;let Q=MW+=1831565813;return Q=Math.imul(Q^Q>>>15,Q|1),Q^=Q+Math.imul(Q^Q>>>7,Q|61),((Q^Q>>>14)>>>0)/4294967296}function VH(J){return J*y6}function CH(J){return J*k8}function IH(J){return(J&J-1)===0&&J!==0}function zH(J){return Math.pow(2,Math.ceil(Math.log(J)/Math.LN2))}function wH(J){return Math.pow(2,Math.floor(Math.log(J)/Math.LN2))}function PH(J,Q,$,Z,W){let{cos:Y,sin:X}=Math,K=Y($/2),H=X($/2),U=Y((Q+Z)/2),G=X((Q+Z)/2),F=Y((Q-Z)/2),E=X((Q-Z)/2),O=Y((Z-Q)/2),R=X((Z-Q)/2);switch(W){case"XYX":J.set(K*G,H*F,H*E,K*U);break;case"YZY":J.set(H*E,K*G,H*F,K*U);break;case"ZXZ":J.set(H*F,H*E,K*G,K*U);break;case"XZX":J.set(K*G,H*R,H*O,K*U);break;case"YXY":J.set(H*O,K*G,H*R,K*U);break;case"ZYZ":J.set(H*R,H*O,K*G,K*U);break;default:C0("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+W)}}function q9(J,Q){switch(Q.constructor){case Float32Array:return J;case Uint32Array:return J/4294967295;case Uint16Array:return J/65535;case Uint8Array:return J/255;case Int32Array:return Math.max(J/2147483647,-1);case Int16Array:return Math.max(J/32767,-1);case Int8Array:return Math.max(J/127,-1);default:throw Error("Invalid component type.")}}function $J(J,Q){switch(Q.constructor){case Float32Array:return J;case Uint32Array:return Math.round(J*4294967295);case Uint16Array:return Math.round(J*65535);case Uint8Array:return Math.round(J*255);case Int32Array:return Math.round(J*2147483647);case Int16Array:return Math.round(J*32767);case Int8Array:return Math.round(J*127);default:throw Error("Invalid component type.")}}var E6={DEG2RAD:y6,RAD2DEG:k8,generateUUID:R9,clamp:m0,euclideanModulo:GZ,mapLinear:FH,inverseLerp:NH,lerp:h6,damp:OH,pingpong:qH,smoothstep:RH,smootherstep:LH,randInt:DH,randFloat:MH,randFloatSpread:kH,seededRandom:BH,degToRad:VH,radToDeg:CH,isPowerOfTwo:IH,ceilPowerOfTwo:zH,floorPowerOfTwo:wH,setQuaternionFromProperEuler:PH,normalize:$J,denormalize:q9};class p0{static{p0.prototype.isVector2=!0}constructor(J=0,Q=0){this.x=J,this.y=Q}get width(){return this.x}set width(J){this.x=J}get height(){return this.y}set height(J){this.y=J}set(J,Q){return this.x=J,this.y=Q,this}setScalar(J){return this.x=J,this.y=J,this}setX(J){return this.x=J,this}setY(J){return this.y=J,this}setComponent(J,Q){switch(J){case 0:this.x=Q;break;case 1:this.y=Q;break;default:throw Error("index is out of range: "+J)}return this}getComponent(J){switch(J){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+J)}}clone(){return new this.constructor(this.x,this.y)}copy(J){return this.x=J.x,this.y=J.y,this}add(J){return this.x+=J.x,this.y+=J.y,this}addScalar(J){return this.x+=J,this.y+=J,this}addVectors(J,Q){return this.x=J.x+Q.x,this.y=J.y+Q.y,this}addScaledVector(J,Q){return this.x+=J.x*Q,this.y+=J.y*Q,this}sub(J){return this.x-=J.x,this.y-=J.y,this}subScalar(J){return this.x-=J,this.y-=J,this}subVectors(J,Q){return this.x=J.x-Q.x,this.y=J.y-Q.y,this}multiply(J){return this.x*=J.x,this.y*=J.y,this}multiplyScalar(J){return this.x*=J,this.y*=J,this}divide(J){return this.x/=J.x,this.y/=J.y,this}divideScalar(J){return this.multiplyScalar(1/J)}applyMatrix3(J){let Q=this.x,$=this.y,Z=J.elements;return this.x=Z[0]*Q+Z[3]*$+Z[6],this.y=Z[1]*Q+Z[4]*$+Z[7],this}min(J){return this.x=Math.min(this.x,J.x),this.y=Math.min(this.y,J.y),this}max(J){return this.x=Math.max(this.x,J.x),this.y=Math.max(this.y,J.y),this}clamp(J,Q){return this.x=m0(this.x,J.x,Q.x),this.y=m0(this.y,J.y,Q.y),this}clampScalar(J,Q){return this.x=m0(this.x,J,Q),this.y=m0(this.y,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(m0($,J,Q))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(J){return this.x*J.x+this.y*J.y}cross(J){return this.x*J.y-this.y*J.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(J){let Q=Math.sqrt(this.lengthSq()*J.lengthSq());if(Q===0)return Math.PI/2;let $=this.dot(J)/Q;return Math.acos(m0($,-1,1))}distanceTo(J){return Math.sqrt(this.distanceToSquared(J))}distanceToSquared(J){let Q=this.x-J.x,$=this.y-J.y;return Q*Q+$*$}manhattanDistanceTo(J){return Math.abs(this.x-J.x)+Math.abs(this.y-J.y)}setLength(J){return this.normalize().multiplyScalar(J)}lerp(J,Q){return this.x+=(J.x-this.x)*Q,this.y+=(J.y-this.y)*Q,this}lerpVectors(J,Q,$){return this.x=J.x+(Q.x-J.x)*$,this.y=J.y+(Q.y-J.y)*$,this}equals(J){return J.x===this.x&&J.y===this.y}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this}rotateAround(J,Q){let $=Math.cos(Q),Z=Math.sin(Q),W=this.x-J.x,Y=this.y-J.y;return this.x=W*$-Y*Z+J.x,this.y=W*Z+Y*$+J.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class PJ{constructor(J=0,Q=0,$=0,Z=1){this.isQuaternion=!0,this._x=J,this._y=Q,this._z=$,this._w=Z}static slerpFlat(J,Q,$,Z,W,Y,X){let K=$[Z+0],H=$[Z+1],U=$[Z+2],G=$[Z+3],F=W[Y+0],E=W[Y+1],O=W[Y+2],R=W[Y+3];if(G!==R||K!==F||H!==E||U!==O){let C=K*F+H*E+U*O+G*R;if(C<0)F=-F,E=-E,O=-O,R=-R,C=-C;let q=1-X;if(C<0.9995){let N=Math.acos(C),L=Math.sin(N);q=Math.sin(q*N)/L,X=Math.sin(X*N)/L,K=K*q+F*X,H=H*q+E*X,U=U*q+O*X,G=G*q+R*X}else{K=K*q+F*X,H=H*q+E*X,U=U*q+O*X,G=G*q+R*X;let N=1/Math.sqrt(K*K+H*H+U*U+G*G);K*=N,H*=N,U*=N,G*=N}}J[Q]=K,J[Q+1]=H,J[Q+2]=U,J[Q+3]=G}static multiplyQuaternionsFlat(J,Q,$,Z,W,Y){let X=$[Z],K=$[Z+1],H=$[Z+2],U=$[Z+3],G=W[Y],F=W[Y+1],E=W[Y+2],O=W[Y+3];return J[Q]=X*O+U*G+K*E-H*F,J[Q+1]=K*O+U*F+H*G-X*E,J[Q+2]=H*O+U*E+X*F-K*G,J[Q+3]=U*O-X*G-K*F-H*E,J}get x(){return this._x}set x(J){this._x=J,this._onChangeCallback()}get y(){return this._y}set y(J){this._y=J,this._onChangeCallback()}get z(){return this._z}set z(J){this._z=J,this._onChangeCallback()}get w(){return this._w}set w(J){this._w=J,this._onChangeCallback()}set(J,Q,$,Z){return this._x=J,this._y=Q,this._z=$,this._w=Z,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(J){return this._x=J.x,this._y=J.y,this._z=J.z,this._w=J.w,this._onChangeCallback(),this}setFromEuler(J,Q=!0){let{_x:$,_y:Z,_z:W,_order:Y}=J,X=Math.cos,K=Math.sin,H=X($/2),U=X(Z/2),G=X(W/2),F=K($/2),E=K(Z/2),O=K(W/2);switch(Y){case"XYZ":this._x=F*U*G+H*E*O,this._y=H*E*G-F*U*O,this._z=H*U*O+F*E*G,this._w=H*U*G-F*E*O;break;case"YXZ":this._x=F*U*G+H*E*O,this._y=H*E*G-F*U*O,this._z=H*U*O-F*E*G,this._w=H*U*G+F*E*O;break;case"ZXY":this._x=F*U*G-H*E*O,this._y=H*E*G+F*U*O,this._z=H*U*O+F*E*G,this._w=H*U*G-F*E*O;break;case"ZYX":this._x=F*U*G-H*E*O,this._y=H*E*G+F*U*O,this._z=H*U*O-F*E*G,this._w=H*U*G+F*E*O;break;case"YZX":this._x=F*U*G+H*E*O,this._y=H*E*G+F*U*O,this._z=H*U*O-F*E*G,this._w=H*U*G-F*E*O;break;case"XZY":this._x=F*U*G-H*E*O,this._y=H*E*G-F*U*O,this._z=H*U*O+F*E*G,this._w=H*U*G+F*E*O;break;default:C0("Quaternion: .setFromEuler() encountered an unknown order: "+Y)}if(Q===!0)this._onChangeCallback();return this}setFromAxisAngle(J,Q){let $=Q/2,Z=Math.sin($);return this._x=J.x*Z,this._y=J.y*Z,this._z=J.z*Z,this._w=Math.cos($),this._onChangeCallback(),this}setFromRotationMatrix(J){let Q=J.elements,$=Q[0],Z=Q[4],W=Q[8],Y=Q[1],X=Q[5],K=Q[9],H=Q[2],U=Q[6],G=Q[10],F=$+X+G;if(F>0){let E=0.5/Math.sqrt(F+1);this._w=0.25/E,this._x=(U-K)*E,this._y=(W-H)*E,this._z=(Y-Z)*E}else if($>X&&$>G){let E=2*Math.sqrt(1+$-X-G);this._w=(U-K)/E,this._x=0.25*E,this._y=(Z+Y)/E,this._z=(W+H)/E}else if(X>G){let E=2*Math.sqrt(1+X-$-G);this._w=(W-H)/E,this._x=(Z+Y)/E,this._y=0.25*E,this._z=(K+U)/E}else{let E=2*Math.sqrt(1+G-$-X);this._w=(Y-Z)/E,this._x=(W+H)/E,this._y=(K+U)/E,this._z=0.25*E}return this._onChangeCallback(),this}setFromUnitVectors(J,Q){let $=J.dot(Q)+1;if($<0.00000001)if($=0,Math.abs(J.x)>Math.abs(J.z))this._x=-J.y,this._y=J.x,this._z=0,this._w=$;else this._x=0,this._y=-J.z,this._z=J.y,this._w=$;else this._x=J.y*Q.z-J.z*Q.y,this._y=J.z*Q.x-J.x*Q.z,this._z=J.x*Q.y-J.y*Q.x,this._w=$;return this.normalize()}angleTo(J){return 2*Math.acos(Math.abs(m0(this.dot(J),-1,1)))}rotateTowards(J,Q){let $=this.angleTo(J);if($===0)return this;let Z=Math.min(1,Q/$);return this.slerp(J,Z),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(J){return this._x*J._x+this._y*J._y+this._z*J._z+this._w*J._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let J=this.length();if(J===0)this._x=0,this._y=0,this._z=0,this._w=1;else J=1/J,this._x=this._x*J,this._y=this._y*J,this._z=this._z*J,this._w=this._w*J;return this._onChangeCallback(),this}multiply(J){return this.multiplyQuaternions(this,J)}premultiply(J){return this.multiplyQuaternions(J,this)}multiplyQuaternions(J,Q){let{_x:$,_y:Z,_z:W,_w:Y}=J,X=Q._x,K=Q._y,H=Q._z,U=Q._w;return this._x=$*U+Y*X+Z*H-W*K,this._y=Z*U+Y*K+W*X-$*H,this._z=W*U+Y*H+$*K-Z*X,this._w=Y*U-$*X-Z*K-W*H,this._onChangeCallback(),this}slerp(J,Q){let{_x:$,_y:Z,_z:W,_w:Y}=J,X=this.dot(J);if(X<0)$=-$,Z=-Z,W=-W,Y=-Y,X=-X;let K=1-Q;if(X<0.9995){let H=Math.acos(X),U=Math.sin(H);K=Math.sin(K*H)/U,Q=Math.sin(Q*H)/U,this._x=this._x*K+$*Q,this._y=this._y*K+Z*Q,this._z=this._z*K+W*Q,this._w=this._w*K+Y*Q,this._onChangeCallback()}else this._x=this._x*K+$*Q,this._y=this._y*K+Z*Q,this._z=this._z*K+W*Q,this._w=this._w*K+Y*Q,this.normalize();return this}slerpQuaternions(J,Q,$){return this.copy(J).slerp(Q,$)}random(){let J=2*Math.PI*Math.random(),Q=2*Math.PI*Math.random(),$=Math.random(),Z=Math.sqrt(1-$),W=Math.sqrt($);return this.set(Z*Math.sin(J),Z*Math.cos(J),W*Math.sin(Q),W*Math.cos(Q))}equals(J){return J._x===this._x&&J._y===this._y&&J._z===this._z&&J._w===this._w}fromArray(J,Q=0){return this._x=J[Q],this._y=J[Q+1],this._z=J[Q+2],this._w=J[Q+3],this._onChangeCallback(),this}toArray(J=[],Q=0){return J[Q]=this._x,J[Q+1]=this._y,J[Q+2]=this._z,J[Q+3]=this._w,J}fromBufferAttribute(J,Q){return this._x=J.getX(Q),this._y=J.getY(Q),this._z=J.getZ(Q),this._w=J.getW(Q),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(J){return this._onChangeCallback=J,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class j{static{j.prototype.isVector3=!0}constructor(J=0,Q=0,$=0){this.x=J,this.y=Q,this.z=$}set(J,Q,$){if($===void 0)$=this.z;return this.x=J,this.y=Q,this.z=$,this}setScalar(J){return this.x=J,this.y=J,this.z=J,this}setX(J){return this.x=J,this}setY(J){return this.y=J,this}setZ(J){return this.z=J,this}setComponent(J,Q){switch(J){case 0:this.x=Q;break;case 1:this.y=Q;break;case 2:this.z=Q;break;default:throw Error("index is out of range: "+J)}return this}getComponent(J){switch(J){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+J)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(J){return this.x=J.x,this.y=J.y,this.z=J.z,this}add(J){return this.x+=J.x,this.y+=J.y,this.z+=J.z,this}addScalar(J){return this.x+=J,this.y+=J,this.z+=J,this}addVectors(J,Q){return this.x=J.x+Q.x,this.y=J.y+Q.y,this.z=J.z+Q.z,this}addScaledVector(J,Q){return this.x+=J.x*Q,this.y+=J.y*Q,this.z+=J.z*Q,this}sub(J){return this.x-=J.x,this.y-=J.y,this.z-=J.z,this}subScalar(J){return this.x-=J,this.y-=J,this.z-=J,this}subVectors(J,Q){return this.x=J.x-Q.x,this.y=J.y-Q.y,this.z=J.z-Q.z,this}multiply(J){return this.x*=J.x,this.y*=J.y,this.z*=J.z,this}multiplyScalar(J){return this.x*=J,this.y*=J,this.z*=J,this}multiplyVectors(J,Q){return this.x=J.x*Q.x,this.y=J.y*Q.y,this.z=J.z*Q.z,this}applyEuler(J){return this.applyQuaternion(kW.setFromEuler(J))}applyAxisAngle(J,Q){return this.applyQuaternion(kW.setFromAxisAngle(J,Q))}applyMatrix3(J){let Q=this.x,$=this.y,Z=this.z,W=J.elements;return this.x=W[0]*Q+W[3]*$+W[6]*Z,this.y=W[1]*Q+W[4]*$+W[7]*Z,this.z=W[2]*Q+W[5]*$+W[8]*Z,this}applyNormalMatrix(J){return this.applyMatrix3(J).normalize()}applyMatrix4(J){let Q=this.x,$=this.y,Z=this.z,W=J.elements,Y=1/(W[3]*Q+W[7]*$+W[11]*Z+W[15]);return this.x=(W[0]*Q+W[4]*$+W[8]*Z+W[12])*Y,this.y=(W[1]*Q+W[5]*$+W[9]*Z+W[13])*Y,this.z=(W[2]*Q+W[6]*$+W[10]*Z+W[14])*Y,this}applyQuaternion(J){let Q=this.x,$=this.y,Z=this.z,W=J.x,Y=J.y,X=J.z,K=J.w,H=2*(Y*Z-X*$),U=2*(X*Q-W*Z),G=2*(W*$-Y*Q);return this.x=Q+K*H+Y*G-X*U,this.y=$+K*U+X*H-W*G,this.z=Z+K*G+W*U-Y*H,this}project(J){return this.applyMatrix4(J.matrixWorldInverse).applyMatrix4(J.projectionMatrix)}unproject(J){return this.applyMatrix4(J.projectionMatrixInverse).applyMatrix4(J.matrixWorld)}transformDirection(J){let Q=this.x,$=this.y,Z=this.z,W=J.elements;return this.x=W[0]*Q+W[4]*$+W[8]*Z,this.y=W[1]*Q+W[5]*$+W[9]*Z,this.z=W[2]*Q+W[6]*$+W[10]*Z,this.normalize()}divide(J){return this.x/=J.x,this.y/=J.y,this.z/=J.z,this}divideScalar(J){return this.multiplyScalar(1/J)}min(J){return this.x=Math.min(this.x,J.x),this.y=Math.min(this.y,J.y),this.z=Math.min(this.z,J.z),this}max(J){return this.x=Math.max(this.x,J.x),this.y=Math.max(this.y,J.y),this.z=Math.max(this.z,J.z),this}clamp(J,Q){return this.x=m0(this.x,J.x,Q.x),this.y=m0(this.y,J.y,Q.y),this.z=m0(this.z,J.z,Q.z),this}clampScalar(J,Q){return this.x=m0(this.x,J,Q),this.y=m0(this.y,J,Q),this.z=m0(this.z,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(m0($,J,Q))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(J){return this.x*J.x+this.y*J.y+this.z*J.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(J){return this.normalize().multiplyScalar(J)}lerp(J,Q){return this.x+=(J.x-this.x)*Q,this.y+=(J.y-this.y)*Q,this.z+=(J.z-this.z)*Q,this}lerpVectors(J,Q,$){return this.x=J.x+(Q.x-J.x)*$,this.y=J.y+(Q.y-J.y)*$,this.z=J.z+(Q.z-J.z)*$,this}cross(J){return this.crossVectors(this,J)}crossVectors(J,Q){let{x:$,y:Z,z:W}=J,Y=Q.x,X=Q.y,K=Q.z;return this.x=Z*K-W*X,this.y=W*Y-$*K,this.z=$*X-Z*Y,this}projectOnVector(J){let Q=J.lengthSq();if(Q===0)return this.set(0,0,0);let $=J.dot(this)/Q;return this.copy(J).multiplyScalar($)}projectOnPlane(J){return xQ.copy(this).projectOnVector(J),this.sub(xQ)}reflect(J){return this.sub(xQ.copy(J).multiplyScalar(2*this.dot(J)))}angleTo(J){let Q=Math.sqrt(this.lengthSq()*J.lengthSq());if(Q===0)return Math.PI/2;let $=this.dot(J)/Q;return Math.acos(m0($,-1,1))}distanceTo(J){return Math.sqrt(this.distanceToSquared(J))}distanceToSquared(J){let Q=this.x-J.x,$=this.y-J.y,Z=this.z-J.z;return Q*Q+$*$+Z*Z}manhattanDistanceTo(J){return Math.abs(this.x-J.x)+Math.abs(this.y-J.y)+Math.abs(this.z-J.z)}setFromSpherical(J){return this.setFromSphericalCoords(J.radius,J.phi,J.theta)}setFromSphericalCoords(J,Q,$){let Z=Math.sin(Q)*J;return this.x=Z*Math.sin($),this.y=Math.cos(Q)*J,this.z=Z*Math.cos($),this}setFromCylindrical(J){return this.setFromCylindricalCoords(J.radius,J.theta,J.y)}setFromCylindricalCoords(J,Q,$){return this.x=J*Math.sin(Q),this.y=$,this.z=J*Math.cos(Q),this}setFromMatrixPosition(J){let Q=J.elements;return this.x=Q[12],this.y=Q[13],this.z=Q[14],this}setFromMatrixScale(J){let Q=this.setFromMatrixColumn(J,0).length(),$=this.setFromMatrixColumn(J,1).length(),Z=this.setFromMatrixColumn(J,2).length();return this.x=Q,this.y=$,this.z=Z,this}setFromMatrixColumn(J,Q){return this.fromArray(J.elements,Q*4)}setFromMatrix3Column(J,Q){return this.fromArray(J.elements,Q*3)}setFromEuler(J){return this.x=J._x,this.y=J._y,this.z=J._z,this}setFromColor(J){return this.x=J.r,this.y=J.g,this.z=J.b,this}equals(J){return J.x===this.x&&J.y===this.y&&J.z===this.z}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this.z=J[Q+2],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J[Q+2]=this.z,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this.z=J.getZ(Q),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let J=Math.random()*Math.PI*2,Q=Math.random()*2-1,$=Math.sqrt(1-Q*Q);return this.x=$*Math.cos(J),this.y=Q,this.z=$*Math.sin(J),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}var xQ=new j,kW=new PJ;class h0{static{h0.prototype.isMatrix3=!0}constructor(J,Q,$,Z,W,Y,X,K,H){if(this.elements=[1,0,0,0,1,0,0,0,1],J!==void 0)this.set(J,Q,$,Z,W,Y,X,K,H)}set(J,Q,$,Z,W,Y,X,K,H){let U=this.elements;return U[0]=J,U[1]=Z,U[2]=X,U[3]=Q,U[4]=W,U[5]=K,U[6]=$,U[7]=Y,U[8]=H,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(J){let Q=this.elements,$=J.elements;return Q[0]=$[0],Q[1]=$[1],Q[2]=$[2],Q[3]=$[3],Q[4]=$[4],Q[5]=$[5],Q[6]=$[6],Q[7]=$[7],Q[8]=$[8],this}extractBasis(J,Q,$){return J.setFromMatrix3Column(this,0),Q.setFromMatrix3Column(this,1),$.setFromMatrix3Column(this,2),this}setFromMatrix4(J){let Q=J.elements;return this.set(Q[0],Q[4],Q[8],Q[1],Q[5],Q[9],Q[2],Q[6],Q[10]),this}multiply(J){return this.multiplyMatrices(this,J)}premultiply(J){return this.multiplyMatrices(J,this)}multiplyMatrices(J,Q){let $=J.elements,Z=Q.elements,W=this.elements,Y=$[0],X=$[3],K=$[6],H=$[1],U=$[4],G=$[7],F=$[2],E=$[5],O=$[8],R=Z[0],C=Z[3],q=Z[6],N=Z[1],L=Z[4],M=Z[7],k=Z[2],_=Z[5],P=Z[8];return W[0]=Y*R+X*N+K*k,W[3]=Y*C+X*L+K*_,W[6]=Y*q+X*M+K*P,W[1]=H*R+U*N+G*k,W[4]=H*C+U*L+G*_,W[7]=H*q+U*M+G*P,W[2]=F*R+E*N+O*k,W[5]=F*C+E*L+O*_,W[8]=F*q+E*M+O*P,this}multiplyScalar(J){let Q=this.elements;return Q[0]*=J,Q[3]*=J,Q[6]*=J,Q[1]*=J,Q[4]*=J,Q[7]*=J,Q[2]*=J,Q[5]*=J,Q[8]*=J,this}determinant(){let J=this.elements,Q=J[0],$=J[1],Z=J[2],W=J[3],Y=J[4],X=J[5],K=J[6],H=J[7],U=J[8];return Q*Y*U-Q*X*H-$*W*U+$*X*K+Z*W*H-Z*Y*K}invert(){let J=this.elements,Q=J[0],$=J[1],Z=J[2],W=J[3],Y=J[4],X=J[5],K=J[6],H=J[7],U=J[8],G=U*Y-X*H,F=X*K-U*W,E=H*W-Y*K,O=Q*G+$*F+Z*E;if(O===0)return this.set(0,0,0,0,0,0,0,0,0);let R=1/O;return J[0]=G*R,J[1]=(Z*H-U*$)*R,J[2]=(X*$-Z*Y)*R,J[3]=F*R,J[4]=(U*Q-Z*K)*R,J[5]=(Z*W-X*Q)*R,J[6]=E*R,J[7]=($*K-H*Q)*R,J[8]=(Y*Q-$*W)*R,this}transpose(){let J,Q=this.elements;return J=Q[1],Q[1]=Q[3],Q[3]=J,J=Q[2],Q[2]=Q[6],Q[6]=J,J=Q[5],Q[5]=Q[7],Q[7]=J,this}getNormalMatrix(J){return this.setFromMatrix4(J).invert().transpose()}transposeIntoArray(J){let Q=this.elements;return J[0]=Q[0],J[1]=Q[3],J[2]=Q[6],J[3]=Q[1],J[4]=Q[4],J[5]=Q[7],J[6]=Q[2],J[7]=Q[5],J[8]=Q[8],this}setUvTransform(J,Q,$,Z,W,Y,X){let K=Math.cos(W),H=Math.sin(W);return this.set($*K,$*H,-$*(K*Y+H*X)+Y+J,-Z*H,Z*K,-Z*(-H*Y+K*X)+X+Q,0,0,1),this}scale(J,Q){return this.premultiply(bQ.makeScale(J,Q)),this}rotate(J){return this.premultiply(bQ.makeRotation(-J)),this}translate(J,Q){return this.premultiply(bQ.makeTranslation(J,Q)),this}makeTranslation(J,Q){if(J.isVector2)this.set(1,0,J.x,0,1,J.y,0,0,1);else this.set(1,0,J,0,1,Q,0,0,1);return this}makeRotation(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(Q,-$,0,$,Q,0,0,0,1),this}makeScale(J,Q){return this.set(J,0,0,0,Q,0,0,0,1),this}equals(J){let Q=this.elements,$=J.elements;for(let Z=0;Z<9;Z++)if(Q[Z]!==$[Z])return!1;return!0}fromArray(J,Q=0){for(let $=0;$<9;$++)this.elements[$]=J[$+Q];return this}toArray(J=[],Q=0){let $=this.elements;return J[Q]=$[0],J[Q+1]=$[1],J[Q+2]=$[2],J[Q+3]=$[3],J[Q+4]=$[4],J[Q+5]=$[5],J[Q+6]=$[6],J[Q+7]=$[7],J[Q+8]=$[8],J}clone(){return new this.constructor().fromArray(this.elements)}}var bQ=new h0,BW=new h0().set(0.4123908,0.3575843,0.1804808,0.212639,0.7151687,0.0721923,0.0193308,0.1191948,0.9505322),VW=new h0().set(3.2409699,-1.5373832,-0.4986108,-0.9692436,1.8759675,0.0415551,0.0556301,-0.203977,1.0569715);function _H(){let J={enabled:!0,workingColorSpace:"srgb-linear",spaces:{},convert:function(W,Y,X){if(this.enabled===!1||Y===X||!Y||!X)return W;if(this.spaces[Y].transfer==="srgb")W.r=m9(W.r),W.g=m9(W.g),W.b=m9(W.b);if(this.spaces[Y].primaries!==this.spaces[X].primaries)W.applyMatrix3(this.spaces[Y].toXYZ),W.applyMatrix3(this.spaces[X].fromXYZ);if(this.spaces[X].transfer==="srgb")W.r=e8(W.r),W.g=e8(W.g),W.b=e8(W.b);return W},workingToColorSpace:function(W,Y){return this.convert(W,this.workingColorSpace,Y)},colorSpaceToWorking:function(W,Y){return this.convert(W,Y,this.workingColorSpace)},getPrimaries:function(W){return this.spaces[W].primaries},getTransfer:function(W){if(W==="")return"linear";return this.spaces[W].transfer},getToneMappingMode:function(W){return this.spaces[W].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(W,Y=this.workingColorSpace){return W.fromArray(this.spaces[Y].luminanceCoefficients)},define:function(W){Object.assign(this.spaces,W)},_getMatrix:function(W,Y,X){return W.copy(this.spaces[Y].toXYZ).multiply(this.spaces[X].fromXYZ)},_getDrawingBufferColorSpace:function(W){return this.spaces[W].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(W=this.workingColorSpace){return this.spaces[W].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(W,Y){return g7("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),J.workingToColorSpace(W,Y)},toWorkingColorSpace:function(W,Y){return g7("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),J.colorSpaceToWorking(W,Y)}},Q=[0.64,0.33,0.3,0.6,0.15,0.06],$=[0.2126,0.7152,0.0722],Z=[0.3127,0.329];return J.define({["srgb-linear"]:{primaries:Q,whitePoint:Z,transfer:"linear",toXYZ:BW,fromXYZ:VW,luminanceCoefficients:$,workingColorSpaceConfig:{unpackColorSpace:"srgb"},outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}},["srgb"]:{primaries:Q,whitePoint:Z,transfer:"srgb",toXYZ:BW,fromXYZ:VW,luminanceCoefficients:$,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}}}),J}var s0=_H();function m9(J){return J<0.04045?J*0.0773993808:Math.pow(J*0.9478672986+0.0521327014,2.4)}function e8(J){return J<0.0031308?J*12.92:1.055*Math.pow(J,0.41666)-0.055}var g8;class EZ{static getDataURL(J,Q="image/png"){if(/^data:/i.test(J.src))return J.src;if(typeof HTMLCanvasElement>"u")return J.src;let $;if(J instanceof HTMLCanvasElement)$=J;else{if(g8===void 0)g8=J6("canvas");g8.width=J.width,g8.height=J.height;let Z=g8.getContext("2d");if(J instanceof ImageData)Z.putImageData(J,0,0);else Z.drawImage(J,0,0,J.width,J.height);$=g8}return $.toDataURL(Q)}static sRGBToLinear(J){if(typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&J instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&J instanceof ImageBitmap){let Q=J6("canvas");Q.width=J.width,Q.height=J.height;let $=Q.getContext("2d");$.drawImage(J,0,0,J.width,J.height);let Z=$.getImageData(0,0,J.width,J.height),W=Z.data;for(let Y=0;Y<W.length;Y++)W[Y]=m9(W[Y]/255)*255;return $.putImageData(Z,0,0),Q}else if(J.data){let Q=J.data.slice(0);for(let $=0;$<Q.length;$++)if(Q instanceof Uint8Array||Q instanceof Uint8ClampedArray)Q[$]=Math.floor(m9(Q[$]/255)*255);else Q[$]=m9(Q[$]);return{data:Q,width:J.width,height:J.height}}else return C0("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),J}}var TH=0;class m6{constructor(J=null){this.isSource=!0,Object.defineProperty(this,"id",{value:TH++}),this.uuid=R9(),this.data=J,this.dataReady=!0,this.version=0}getSize(J){let Q=this.data;if(typeof HTMLVideoElement<"u"&&Q instanceof HTMLVideoElement)J.set(Q.videoWidth,Q.videoHeight,0);else if(typeof VideoFrame<"u"&&Q instanceof VideoFrame)J.set(Q.displayWidth,Q.displayHeight,0);else if(Q!==null)J.set(Q.width,Q.height,Q.depth||0);else J.set(0,0,0);return J}set needsUpdate(J){if(J===!0)this.version++}toJSON(J){let Q=J===void 0||typeof J==="string";if(!Q&&J.images[this.uuid]!==void 0)return J.images[this.uuid];let $={uuid:this.uuid,url:""},Z=this.data;if(Z!==null){let W;if(Array.isArray(Z)){W=[];for(let Y=0,X=Z.length;Y<X;Y++)if(Z[Y].isDataTexture)W.push(fQ(Z[Y].image));else W.push(fQ(Z[Y]))}else W=fQ(Z);$.url=W}if(!Q)J.images[this.uuid]=$;return $}}function fQ(J){if(typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&J instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&J instanceof ImageBitmap)return EZ.getDataURL(J);else if(J.data)return{data:Array.from(J.data),width:J.width,height:J.height,type:J.data.constructor.name};else return C0("Texture: Unable to serialize Texture."),{}}var AH=0,gQ=new j;class wJ extends T9{constructor(J=wJ.DEFAULT_IMAGE,Q=wJ.DEFAULT_MAPPING,$=1001,Z=1001,W=1006,Y=1008,X=1023,K=1009,H=wJ.DEFAULT_ANISOTROPY,U=""){super();this.isTexture=!0,Object.defineProperty(this,"id",{value:AH++}),this.uuid=R9(),this.name="",this.source=new m6(J),this.mipmaps=[],this.mapping=Q,this.channel=0,this.wrapS=$,this.wrapT=Z,this.magFilter=W,this.minFilter=Y,this.anisotropy=H,this.format=X,this.internalFormat=null,this.type=K,this.offset=new p0(0,0),this.repeat=new p0(1,1),this.center=new p0(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new h0,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=U,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=J&&J.depth&&J.depth>1?!0:!1,this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(gQ).x}get height(){return this.source.getSize(gQ).y}get depth(){return this.source.getSize(gQ).z}get image(){return this.source.data}set image(J){this.source.data=J}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(J,Q){this.updateRanges.push({start:J,count:Q})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(J){return this.name=J.name,this.source=J.source,this.mipmaps=J.mipmaps.slice(0),this.mapping=J.mapping,this.channel=J.channel,this.wrapS=J.wrapS,this.wrapT=J.wrapT,this.magFilter=J.magFilter,this.minFilter=J.minFilter,this.anisotropy=J.anisotropy,this.format=J.format,this.internalFormat=J.internalFormat,this.type=J.type,this.normalized=J.normalized,this.offset.copy(J.offset),this.repeat.copy(J.repeat),this.center.copy(J.center),this.rotation=J.rotation,this.matrixAutoUpdate=J.matrixAutoUpdate,this.matrix.copy(J.matrix),this.generateMipmaps=J.generateMipmaps,this.premultiplyAlpha=J.premultiplyAlpha,this.flipY=J.flipY,this.unpackAlignment=J.unpackAlignment,this.colorSpace=J.colorSpace,this.renderTarget=J.renderTarget,this.isRenderTargetTexture=J.isRenderTargetTexture,this.isArrayTexture=J.isArrayTexture,this.userData=JSON.parse(JSON.stringify(J.userData)),this.needsUpdate=!0,this}setValues(J){for(let Q in J){let $=J[Q];if($===void 0){C0(`Texture.setValues(): parameter '${Q}' has value of undefined.`);continue}let Z=this[Q];if(Z===void 0){C0(`Texture.setValues(): property '${Q}' does not exist.`);continue}if(Z&&$&&(Z.isVector2&&$.isVector2))Z.copy($);else if(Z&&$&&(Z.isVector3&&$.isVector3))Z.copy($);else if(Z&&$&&(Z.isMatrix3&&$.isMatrix3))Z.copy($);else this[Q]=$}}toJSON(J){let Q=J===void 0||typeof J==="string";if(!Q&&J.textures[this.uuid]!==void 0)return J.textures[this.uuid];let $={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(J).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(Object.keys(this.userData).length>0)$.userData=this.userData;if(!Q)J.textures[this.uuid]=$;return $}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(J){if(this.mapping!==300)return J;if(J.applyMatrix3(this.matrix),J.x<0||J.x>1)switch(this.wrapS){case 1000:J.x=J.x-Math.floor(J.x);break;case 1001:J.x=J.x<0?0:1;break;case 1002:if(Math.abs(Math.floor(J.x)%2)===1)J.x=Math.ceil(J.x)-J.x;else J.x=J.x-Math.floor(J.x);break}if(J.y<0||J.y>1)switch(this.wrapT){case 1000:J.y=J.y-Math.floor(J.y);break;case 1001:J.y=J.y<0?0:1;break;case 1002:if(Math.abs(Math.floor(J.y)%2)===1)J.y=Math.ceil(J.y)-J.y;else J.y=J.y-Math.floor(J.y);break}if(this.flipY)J.y=1-J.y;return J}set needsUpdate(J){if(J===!0)this.version++,this.source.needsUpdate=!0}set needsPMREMUpdate(J){if(J===!0)this.pmremVersion++}}wJ.DEFAULT_IMAGE=null;wJ.DEFAULT_MAPPING=300;wJ.DEFAULT_ANISOTROPY=1;class QJ{static{QJ.prototype.isVector4=!0}constructor(J=0,Q=0,$=0,Z=1){this.x=J,this.y=Q,this.z=$,this.w=Z}get width(){return this.z}set width(J){this.z=J}get height(){return this.w}set height(J){this.w=J}set(J,Q,$,Z){return this.x=J,this.y=Q,this.z=$,this.w=Z,this}setScalar(J){return this.x=J,this.y=J,this.z=J,this.w=J,this}setX(J){return this.x=J,this}setY(J){return this.y=J,this}setZ(J){return this.z=J,this}setW(J){return this.w=J,this}setComponent(J,Q){switch(J){case 0:this.x=Q;break;case 1:this.y=Q;break;case 2:this.z=Q;break;case 3:this.w=Q;break;default:throw Error("index is out of range: "+J)}return this}getComponent(J){switch(J){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+J)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(J){return this.x=J.x,this.y=J.y,this.z=J.z,this.w=J.w!==void 0?J.w:1,this}add(J){return this.x+=J.x,this.y+=J.y,this.z+=J.z,this.w+=J.w,this}addScalar(J){return this.x+=J,this.y+=J,this.z+=J,this.w+=J,this}addVectors(J,Q){return this.x=J.x+Q.x,this.y=J.y+Q.y,this.z=J.z+Q.z,this.w=J.w+Q.w,this}addScaledVector(J,Q){return this.x+=J.x*Q,this.y+=J.y*Q,this.z+=J.z*Q,this.w+=J.w*Q,this}sub(J){return this.x-=J.x,this.y-=J.y,this.z-=J.z,this.w-=J.w,this}subScalar(J){return this.x-=J,this.y-=J,this.z-=J,this.w-=J,this}subVectors(J,Q){return this.x=J.x-Q.x,this.y=J.y-Q.y,this.z=J.z-Q.z,this.w=J.w-Q.w,this}multiply(J){return this.x*=J.x,this.y*=J.y,this.z*=J.z,this.w*=J.w,this}multiplyScalar(J){return this.x*=J,this.y*=J,this.z*=J,this.w*=J,this}applyMatrix4(J){let Q=this.x,$=this.y,Z=this.z,W=this.w,Y=J.elements;return this.x=Y[0]*Q+Y[4]*$+Y[8]*Z+Y[12]*W,this.y=Y[1]*Q+Y[5]*$+Y[9]*Z+Y[13]*W,this.z=Y[2]*Q+Y[6]*$+Y[10]*Z+Y[14]*W,this.w=Y[3]*Q+Y[7]*$+Y[11]*Z+Y[15]*W,this}divide(J){return this.x/=J.x,this.y/=J.y,this.z/=J.z,this.w/=J.w,this}divideScalar(J){return this.multiplyScalar(1/J)}setAxisAngleFromQuaternion(J){this.w=2*Math.acos(J.w);let Q=Math.sqrt(1-J.w*J.w);if(Q<0.0001)this.x=1,this.y=0,this.z=0;else this.x=J.x/Q,this.y=J.y/Q,this.z=J.z/Q;return this}setAxisAngleFromRotationMatrix(J){let Q,$,Z,W,Y=0.01,X=0.1,K=J.elements,H=K[0],U=K[4],G=K[8],F=K[1],E=K[5],O=K[9],R=K[2],C=K[6],q=K[10];if(Math.abs(U-F)<0.01&&Math.abs(G-R)<0.01&&Math.abs(O-C)<0.01){if(Math.abs(U+F)<0.1&&Math.abs(G+R)<0.1&&Math.abs(O+C)<0.1&&Math.abs(H+E+q-3)<0.1)return this.set(1,0,0,0),this;Q=Math.PI;let L=(H+1)/2,M=(E+1)/2,k=(q+1)/2,_=(U+F)/4,P=(G+R)/4,V=(O+C)/4;if(L>M&&L>k)if(L<0.01)$=0,Z=0.707106781,W=0.707106781;else $=Math.sqrt(L),Z=_/$,W=P/$;else if(M>k)if(M<0.01)$=0.707106781,Z=0,W=0.707106781;else Z=Math.sqrt(M),$=_/Z,W=V/Z;else if(k<0.01)$=0.707106781,Z=0.707106781,W=0;else W=Math.sqrt(k),$=P/W,Z=V/W;return this.set($,Z,W,Q),this}let N=Math.sqrt((C-O)*(C-O)+(G-R)*(G-R)+(F-U)*(F-U));if(Math.abs(N)<0.001)N=1;return this.x=(C-O)/N,this.y=(G-R)/N,this.z=(F-U)/N,this.w=Math.acos((H+E+q-1)/2),this}setFromMatrixPosition(J){let Q=J.elements;return this.x=Q[12],this.y=Q[13],this.z=Q[14],this.w=Q[15],this}min(J){return this.x=Math.min(this.x,J.x),this.y=Math.min(this.y,J.y),this.z=Math.min(this.z,J.z),this.w=Math.min(this.w,J.w),this}max(J){return this.x=Math.max(this.x,J.x),this.y=Math.max(this.y,J.y),this.z=Math.max(this.z,J.z),this.w=Math.max(this.w,J.w),this}clamp(J,Q){return this.x=m0(this.x,J.x,Q.x),this.y=m0(this.y,J.y,Q.y),this.z=m0(this.z,J.z,Q.z),this.w=m0(this.w,J.w,Q.w),this}clampScalar(J,Q){return this.x=m0(this.x,J,Q),this.y=m0(this.y,J,Q),this.z=m0(this.z,J,Q),this.w=m0(this.w,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(m0($,J,Q))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(J){return this.x*J.x+this.y*J.y+this.z*J.z+this.w*J.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(J){return this.normalize().multiplyScalar(J)}lerp(J,Q){return this.x+=(J.x-this.x)*Q,this.y+=(J.y-this.y)*Q,this.z+=(J.z-this.z)*Q,this.w+=(J.w-this.w)*Q,this}lerpVectors(J,Q,$){return this.x=J.x+(Q.x-J.x)*$,this.y=J.y+(Q.y-J.y)*$,this.z=J.z+(Q.z-J.z)*$,this.w=J.w+(Q.w-J.w)*$,this}equals(J){return J.x===this.x&&J.y===this.y&&J.z===this.z&&J.w===this.w}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this.z=J[Q+2],this.w=J[Q+3],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J[Q+2]=this.z,J[Q+3]=this.w,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this.z=J.getZ(Q),this.w=J.getW(Q),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class FZ extends T9{constructor(J=1,Q=1,$={}){super();$=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},$),this.isRenderTarget=!0,this.width=J,this.height=Q,this.depth=$.depth,this.scissor=new QJ(0,0,J,Q),this.scissorTest=!1,this.viewport=new QJ(0,0,J,Q),this.textures=[];let Z={width:J,height:Q,depth:$.depth},W=new wJ(Z),Y=$.count;for(let X=0;X<Y;X++)this.textures[X]=W.clone(),this.textures[X].isRenderTargetTexture=!0,this.textures[X].renderTarget=this;this._setTextureOptions($),this.depthBuffer=$.depthBuffer,this.stencilBuffer=$.stencilBuffer,this.resolveDepthBuffer=$.resolveDepthBuffer,this.resolveStencilBuffer=$.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=$.depthTexture,this.samples=$.samples,this.multiview=$.multiview}_setTextureOptions(J={}){let Q={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};if(J.mapping!==void 0)Q.mapping=J.mapping;if(J.wrapS!==void 0)Q.wrapS=J.wrapS;if(J.wrapT!==void 0)Q.wrapT=J.wrapT;if(J.wrapR!==void 0)Q.wrapR=J.wrapR;if(J.magFilter!==void 0)Q.magFilter=J.magFilter;if(J.minFilter!==void 0)Q.minFilter=J.minFilter;if(J.format!==void 0)Q.format=J.format;if(J.type!==void 0)Q.type=J.type;if(J.anisotropy!==void 0)Q.anisotropy=J.anisotropy;if(J.colorSpace!==void 0)Q.colorSpace=J.colorSpace;if(J.flipY!==void 0)Q.flipY=J.flipY;if(J.generateMipmaps!==void 0)Q.generateMipmaps=J.generateMipmaps;if(J.internalFormat!==void 0)Q.internalFormat=J.internalFormat;for(let $=0;$<this.textures.length;$++)this.textures[$].setValues(Q)}get texture(){return this.textures[0]}set texture(J){this.textures[0]=J}set depthTexture(J){if(this._depthTexture!==null)this._depthTexture.renderTarget=null;if(J!==null)J.renderTarget=this;this._depthTexture=J}get depthTexture(){return this._depthTexture}setSize(J,Q,$=1){if(this.width!==J||this.height!==Q||this.depth!==$){this.width=J,this.height=Q,this.depth=$;for(let Z=0,W=this.textures.length;Z<W;Z++)if(this.textures[Z].image.width=J,this.textures[Z].image.height=Q,this.textures[Z].image.depth=$,this.textures[Z].isData3DTexture!==!0)this.textures[Z].isArrayTexture=this.textures[Z].image.depth>1;this.dispose()}this.viewport.set(0,0,J,Q),this.scissor.set(0,0,J,Q)}clone(){return new this.constructor().copy(this)}copy(J){this.width=J.width,this.height=J.height,this.depth=J.depth,this.scissor.copy(J.scissor),this.scissorTest=J.scissorTest,this.viewport.copy(J.viewport),this.textures.length=0;for(let Q=0,$=J.textures.length;Q<$;Q++){this.textures[Q]=J.textures[Q].clone(),this.textures[Q].isRenderTargetTexture=!0,this.textures[Q].renderTarget=this;let Z=Object.assign({},J.textures[Q].image);this.textures[Q].source=new m6(Z)}if(this.depthBuffer=J.depthBuffer,this.stencilBuffer=J.stencilBuffer,this.resolveDepthBuffer=J.resolveDepthBuffer,this.resolveStencilBuffer=J.resolveStencilBuffer,J.depthTexture!==null)this.depthTexture=J.depthTexture.clone();return this.samples=J.samples,this.multiview=J.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}}class nJ extends FZ{constructor(J=1,Q=1,$={}){super(J,Q,$);this.isWebGLRenderTarget=!0}}class QQ extends wJ{constructor(J=null,Q=1,$=1,Z=1){super(null);this.isDataArrayTexture=!0,this.image={data:J,width:Q,height:$,depth:Z},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(J){this.layerUpdates.add(J)}clearLayerUpdates(){this.layerUpdates.clear()}}class NZ extends wJ{constructor(J=null,Q=1,$=1,Z=1){super(null);this.isData3DTexture=!0,this.image={data:J,width:Q,height:$,depth:Z},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class S0{static{S0.prototype.isMatrix4=!0}constructor(J,Q,$,Z,W,Y,X,K,H,U,G,F,E,O,R,C){if(this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],J!==void 0)this.set(J,Q,$,Z,W,Y,X,K,H,U,G,F,E,O,R,C)}set(J,Q,$,Z,W,Y,X,K,H,U,G,F,E,O,R,C){let q=this.elements;return q[0]=J,q[4]=Q,q[8]=$,q[12]=Z,q[1]=W,q[5]=Y,q[9]=X,q[13]=K,q[2]=H,q[6]=U,q[10]=G,q[14]=F,q[3]=E,q[7]=O,q[11]=R,q[15]=C,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new S0().fromArray(this.elements)}copy(J){let Q=this.elements,$=J.elements;return Q[0]=$[0],Q[1]=$[1],Q[2]=$[2],Q[3]=$[3],Q[4]=$[4],Q[5]=$[5],Q[6]=$[6],Q[7]=$[7],Q[8]=$[8],Q[9]=$[9],Q[10]=$[10],Q[11]=$[11],Q[12]=$[12],Q[13]=$[13],Q[14]=$[14],Q[15]=$[15],this}copyPosition(J){let Q=this.elements,$=J.elements;return Q[12]=$[12],Q[13]=$[13],Q[14]=$[14],this}setFromMatrix3(J){let Q=J.elements;return this.set(Q[0],Q[3],Q[6],0,Q[1],Q[4],Q[7],0,Q[2],Q[5],Q[8],0,0,0,0,1),this}extractBasis(J,Q,$){if(this.determinant()===0)return J.set(1,0,0),Q.set(0,1,0),$.set(0,0,1),this;return J.setFromMatrixColumn(this,0),Q.setFromMatrixColumn(this,1),$.setFromMatrixColumn(this,2),this}makeBasis(J,Q,$){return this.set(J.x,Q.x,$.x,0,J.y,Q.y,$.y,0,J.z,Q.z,$.z,0,0,0,0,1),this}extractRotation(J){if(J.determinant()===0)return this.identity();let Q=this.elements,$=J.elements,Z=1/p8.setFromMatrixColumn(J,0).length(),W=1/p8.setFromMatrixColumn(J,1).length(),Y=1/p8.setFromMatrixColumn(J,2).length();return Q[0]=$[0]*Z,Q[1]=$[1]*Z,Q[2]=$[2]*Z,Q[3]=0,Q[4]=$[4]*W,Q[5]=$[5]*W,Q[6]=$[6]*W,Q[7]=0,Q[8]=$[8]*Y,Q[9]=$[9]*Y,Q[10]=$[10]*Y,Q[11]=0,Q[12]=0,Q[13]=0,Q[14]=0,Q[15]=1,this}makeRotationFromEuler(J){let Q=this.elements,$=J.x,Z=J.y,W=J.z,Y=Math.cos($),X=Math.sin($),K=Math.cos(Z),H=Math.sin(Z),U=Math.cos(W),G=Math.sin(W);if(J.order==="XYZ"){let F=Y*U,E=Y*G,O=X*U,R=X*G;Q[0]=K*U,Q[4]=-K*G,Q[8]=H,Q[1]=E+O*H,Q[5]=F-R*H,Q[9]=-X*K,Q[2]=R-F*H,Q[6]=O+E*H,Q[10]=Y*K}else if(J.order==="YXZ"){let F=K*U,E=K*G,O=H*U,R=H*G;Q[0]=F+R*X,Q[4]=O*X-E,Q[8]=Y*H,Q[1]=Y*G,Q[5]=Y*U,Q[9]=-X,Q[2]=E*X-O,Q[6]=R+F*X,Q[10]=Y*K}else if(J.order==="ZXY"){let F=K*U,E=K*G,O=H*U,R=H*G;Q[0]=F-R*X,Q[4]=-Y*G,Q[8]=O+E*X,Q[1]=E+O*X,Q[5]=Y*U,Q[9]=R-F*X,Q[2]=-Y*H,Q[6]=X,Q[10]=Y*K}else if(J.order==="ZYX"){let F=Y*U,E=Y*G,O=X*U,R=X*G;Q[0]=K*U,Q[4]=O*H-E,Q[8]=F*H+R,Q[1]=K*G,Q[5]=R*H+F,Q[9]=E*H-O,Q[2]=-H,Q[6]=X*K,Q[10]=Y*K}else if(J.order==="YZX"){let F=Y*K,E=Y*H,O=X*K,R=X*H;Q[0]=K*U,Q[4]=R-F*G,Q[8]=O*G+E,Q[1]=G,Q[5]=Y*U,Q[9]=-X*U,Q[2]=-H*U,Q[6]=E*G+O,Q[10]=F-R*G}else if(J.order==="XZY"){let F=Y*K,E=Y*H,O=X*K,R=X*H;Q[0]=K*U,Q[4]=-G,Q[8]=H*U,Q[1]=F*G+R,Q[5]=Y*U,Q[9]=E*G-O,Q[2]=O*G-E,Q[6]=X*U,Q[10]=R*G+F}return Q[3]=0,Q[7]=0,Q[11]=0,Q[12]=0,Q[13]=0,Q[14]=0,Q[15]=1,this}makeRotationFromQuaternion(J){return this.compose(SH,J,jH)}lookAt(J,Q,$){let Z=this.elements;if(oJ.subVectors(J,Q),oJ.lengthSq()===0)oJ.z=1;if(oJ.normalize(),J8.crossVectors($,oJ),J8.lengthSq()===0){if(Math.abs($.z)===1)oJ.x+=0.0001;else oJ.z+=0.0001;oJ.normalize(),J8.crossVectors($,oJ)}return J8.normalize(),N7.crossVectors(oJ,J8),Z[0]=J8.x,Z[4]=N7.x,Z[8]=oJ.x,Z[1]=J8.y,Z[5]=N7.y,Z[9]=oJ.y,Z[2]=J8.z,Z[6]=N7.z,Z[10]=oJ.z,this}multiply(J){return this.multiplyMatrices(this,J)}premultiply(J){return this.multiplyMatrices(J,this)}multiplyMatrices(J,Q){let $=J.elements,Z=Q.elements,W=this.elements,Y=$[0],X=$[4],K=$[8],H=$[12],U=$[1],G=$[5],F=$[9],E=$[13],O=$[2],R=$[6],C=$[10],q=$[14],N=$[3],L=$[7],M=$[11],k=$[15],_=Z[0],P=Z[4],V=Z[8],D=Z[12],B=Z[1],A=Z[5],z=Z[9],S=Z[13],y=Z[2],v=Z[6],h=Z[10],g=Z[14],p=Z[3],c=Z[7],a=Z[11],Q0=Z[15];return W[0]=Y*_+X*B+K*y+H*p,W[4]=Y*P+X*A+K*v+H*c,W[8]=Y*V+X*z+K*h+H*a,W[12]=Y*D+X*S+K*g+H*Q0,W[1]=U*_+G*B+F*y+E*p,W[5]=U*P+G*A+F*v+E*c,W[9]=U*V+G*z+F*h+E*a,W[13]=U*D+G*S+F*g+E*Q0,W[2]=O*_+R*B+C*y+q*p,W[6]=O*P+R*A+C*v+q*c,W[10]=O*V+R*z+C*h+q*a,W[14]=O*D+R*S+C*g+q*Q0,W[3]=N*_+L*B+M*y+k*p,W[7]=N*P+L*A+M*v+k*c,W[11]=N*V+L*z+M*h+k*a,W[15]=N*D+L*S+M*g+k*Q0,this}multiplyScalar(J){let Q=this.elements;return Q[0]*=J,Q[4]*=J,Q[8]*=J,Q[12]*=J,Q[1]*=J,Q[5]*=J,Q[9]*=J,Q[13]*=J,Q[2]*=J,Q[6]*=J,Q[10]*=J,Q[14]*=J,Q[3]*=J,Q[7]*=J,Q[11]*=J,Q[15]*=J,this}determinant(){let J=this.elements,Q=J[0],$=J[4],Z=J[8],W=J[12],Y=J[1],X=J[5],K=J[9],H=J[13],U=J[2],G=J[6],F=J[10],E=J[14],O=J[3],R=J[7],C=J[11],q=J[15],N=K*E-H*F,L=X*E-H*G,M=X*F-K*G,k=Y*E-H*U,_=Y*F-K*U,P=Y*G-X*U;return Q*(R*N-C*L+q*M)-$*(O*N-C*k+q*_)+Z*(O*L-R*k+q*P)-W*(O*M-R*_+C*P)}transpose(){let J=this.elements,Q;return Q=J[1],J[1]=J[4],J[4]=Q,Q=J[2],J[2]=J[8],J[8]=Q,Q=J[6],J[6]=J[9],J[9]=Q,Q=J[3],J[3]=J[12],J[12]=Q,Q=J[7],J[7]=J[13],J[13]=Q,Q=J[11],J[11]=J[14],J[14]=Q,this}setPosition(J,Q,$){let Z=this.elements;if(J.isVector3)Z[12]=J.x,Z[13]=J.y,Z[14]=J.z;else Z[12]=J,Z[13]=Q,Z[14]=$;return this}invert(){let J=this.elements,Q=J[0],$=J[1],Z=J[2],W=J[3],Y=J[4],X=J[5],K=J[6],H=J[7],U=J[8],G=J[9],F=J[10],E=J[11],O=J[12],R=J[13],C=J[14],q=J[15],N=Q*X-$*Y,L=Q*K-Z*Y,M=Q*H-W*Y,k=$*K-Z*X,_=$*H-W*X,P=Z*H-W*K,V=U*R-G*O,D=U*C-F*O,B=U*q-E*O,A=G*C-F*R,z=G*q-E*R,S=F*q-E*C,y=N*S-L*z+M*A+k*B-_*D+P*V;if(y===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let v=1/y;return J[0]=(X*S-K*z+H*A)*v,J[1]=(Z*z-$*S-W*A)*v,J[2]=(R*P-C*_+q*k)*v,J[3]=(F*_-G*P-E*k)*v,J[4]=(K*B-Y*S-H*D)*v,J[5]=(Q*S-Z*B+W*D)*v,J[6]=(C*M-O*P-q*L)*v,J[7]=(U*P-F*M+E*L)*v,J[8]=(Y*z-X*B+H*V)*v,J[9]=($*B-Q*z-W*V)*v,J[10]=(O*_-R*M+q*N)*v,J[11]=(G*M-U*_-E*N)*v,J[12]=(X*D-Y*A-K*V)*v,J[13]=(Q*A-$*D+Z*V)*v,J[14]=(R*L-O*k-C*N)*v,J[15]=(U*k-G*L+F*N)*v,this}scale(J){let Q=this.elements,$=J.x,Z=J.y,W=J.z;return Q[0]*=$,Q[4]*=Z,Q[8]*=W,Q[1]*=$,Q[5]*=Z,Q[9]*=W,Q[2]*=$,Q[6]*=Z,Q[10]*=W,Q[3]*=$,Q[7]*=Z,Q[11]*=W,this}getMaxScaleOnAxis(){let J=this.elements,Q=J[0]*J[0]+J[1]*J[1]+J[2]*J[2],$=J[4]*J[4]+J[5]*J[5]+J[6]*J[6],Z=J[8]*J[8]+J[9]*J[9]+J[10]*J[10];return Math.sqrt(Math.max(Q,$,Z))}makeTranslation(J,Q,$){if(J.isVector3)this.set(1,0,0,J.x,0,1,0,J.y,0,0,1,J.z,0,0,0,1);else this.set(1,0,0,J,0,1,0,Q,0,0,1,$,0,0,0,1);return this}makeRotationX(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(1,0,0,0,0,Q,-$,0,0,$,Q,0,0,0,0,1),this}makeRotationY(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(Q,0,$,0,0,1,0,0,-$,0,Q,0,0,0,0,1),this}makeRotationZ(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(Q,-$,0,0,$,Q,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(J,Q){let $=Math.cos(Q),Z=Math.sin(Q),W=1-$,Y=J.x,X=J.y,K=J.z,H=W*Y,U=W*X;return this.set(H*Y+$,H*X-Z*K,H*K+Z*X,0,H*X+Z*K,U*X+$,U*K-Z*Y,0,H*K-Z*X,U*K+Z*Y,W*K*K+$,0,0,0,0,1),this}makeScale(J,Q,$){return this.set(J,0,0,0,0,Q,0,0,0,0,$,0,0,0,0,1),this}makeShear(J,Q,$,Z,W,Y){return this.set(1,$,W,0,J,1,Y,0,Q,Z,1,0,0,0,0,1),this}compose(J,Q,$){let Z=this.elements,W=Q._x,Y=Q._y,X=Q._z,K=Q._w,H=W+W,U=Y+Y,G=X+X,F=W*H,E=W*U,O=W*G,R=Y*U,C=Y*G,q=X*G,N=K*H,L=K*U,M=K*G,k=$.x,_=$.y,P=$.z;return Z[0]=(1-(R+q))*k,Z[1]=(E+M)*k,Z[2]=(O-L)*k,Z[3]=0,Z[4]=(E-M)*_,Z[5]=(1-(F+q))*_,Z[6]=(C+N)*_,Z[7]=0,Z[8]=(O+L)*P,Z[9]=(C-N)*P,Z[10]=(1-(F+R))*P,Z[11]=0,Z[12]=J.x,Z[13]=J.y,Z[14]=J.z,Z[15]=1,this}decompose(J,Q,$){let Z=this.elements;J.x=Z[12],J.y=Z[13],J.z=Z[14];let W=this.determinant();if(W===0)return $.set(1,1,1),Q.identity(),this;let Y=p8.set(Z[0],Z[1],Z[2]).length(),X=p8.set(Z[4],Z[5],Z[6]).length(),K=p8.set(Z[8],Z[9],Z[10]).length();if(W<0)Y=-Y;E9.copy(this);let H=1/Y,U=1/X,G=1/K;return E9.elements[0]*=H,E9.elements[1]*=H,E9.elements[2]*=H,E9.elements[4]*=U,E9.elements[5]*=U,E9.elements[6]*=U,E9.elements[8]*=G,E9.elements[9]*=G,E9.elements[10]*=G,Q.setFromRotationMatrix(E9),$.x=Y,$.y=X,$.z=K,this}makePerspective(J,Q,$,Z,W,Y,X=2000,K=!1){let H=this.elements,U=2*W/(Q-J),G=2*W/($-Z),F=(Q+J)/(Q-J),E=($+Z)/($-Z),O,R;if(K)O=W/(Y-W),R=Y*W/(Y-W);else if(X===2000)O=-(Y+W)/(Y-W),R=-2*Y*W/(Y-W);else if(X===2001)O=-Y/(Y-W),R=-Y*W/(Y-W);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+X);return H[0]=U,H[4]=0,H[8]=F,H[12]=0,H[1]=0,H[5]=G,H[9]=E,H[13]=0,H[2]=0,H[6]=0,H[10]=O,H[14]=R,H[3]=0,H[7]=0,H[11]=-1,H[15]=0,this}makeOrthographic(J,Q,$,Z,W,Y,X=2000,K=!1){let H=this.elements,U=2/(Q-J),G=2/($-Z),F=-(Q+J)/(Q-J),E=-($+Z)/($-Z),O,R;if(K)O=1/(Y-W),R=Y/(Y-W);else if(X===2000)O=-2/(Y-W),R=-(Y+W)/(Y-W);else if(X===2001)O=-1/(Y-W),R=-W/(Y-W);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+X);return H[0]=U,H[4]=0,H[8]=0,H[12]=F,H[1]=0,H[5]=G,H[9]=0,H[13]=E,H[2]=0,H[6]=0,H[10]=O,H[14]=R,H[3]=0,H[7]=0,H[11]=0,H[15]=1,this}equals(J){let Q=this.elements,$=J.elements;for(let Z=0;Z<16;Z++)if(Q[Z]!==$[Z])return!1;return!0}fromArray(J,Q=0){for(let $=0;$<16;$++)this.elements[$]=J[$+Q];return this}toArray(J=[],Q=0){let $=this.elements;return J[Q]=$[0],J[Q+1]=$[1],J[Q+2]=$[2],J[Q+3]=$[3],J[Q+4]=$[4],J[Q+5]=$[5],J[Q+6]=$[6],J[Q+7]=$[7],J[Q+8]=$[8],J[Q+9]=$[9],J[Q+10]=$[10],J[Q+11]=$[11],J[Q+12]=$[12],J[Q+13]=$[13],J[Q+14]=$[14],J[Q+15]=$[15],J}}var p8=new j,E9=new S0,SH=new j(0,0,0),jH=new j(1,1,1),J8=new j,N7=new j,oJ=new j,CW=new S0,IW=new PJ;class l9{constructor(J=0,Q=0,$=0,Z=l9.DEFAULT_ORDER){this.isEuler=!0,this._x=J,this._y=Q,this._z=$,this._order=Z}get x(){return this._x}set x(J){this._x=J,this._onChangeCallback()}get y(){return this._y}set y(J){this._y=J,this._onChangeCallback()}get z(){return this._z}set z(J){this._z=J,this._onChangeCallback()}get order(){return this._order}set order(J){this._order=J,this._onChangeCallback()}set(J,Q,$,Z=this._order){return this._x=J,this._y=Q,this._z=$,this._order=Z,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(J){return this._x=J._x,this._y=J._y,this._z=J._z,this._order=J._order,this._onChangeCallback(),this}setFromRotationMatrix(J,Q=this._order,$=!0){let Z=J.elements,W=Z[0],Y=Z[4],X=Z[8],K=Z[1],H=Z[5],U=Z[9],G=Z[2],F=Z[6],E=Z[10];switch(Q){case"XYZ":if(this._y=Math.asin(m0(X,-1,1)),Math.abs(X)<0.9999999)this._x=Math.atan2(-U,E),this._z=Math.atan2(-Y,W);else this._x=Math.atan2(F,H),this._z=0;break;case"YXZ":if(this._x=Math.asin(-m0(U,-1,1)),Math.abs(U)<0.9999999)this._y=Math.atan2(X,E),this._z=Math.atan2(K,H);else this._y=Math.atan2(-G,W),this._z=0;break;case"ZXY":if(this._x=Math.asin(m0(F,-1,1)),Math.abs(F)<0.9999999)this._y=Math.atan2(-G,E),this._z=Math.atan2(-Y,H);else this._y=0,this._z=Math.atan2(K,W);break;case"ZYX":if(this._y=Math.asin(-m0(G,-1,1)),Math.abs(G)<0.9999999)this._x=Math.atan2(F,E),this._z=Math.atan2(K,W);else this._x=0,this._z=Math.atan2(-Y,H);break;case"YZX":if(this._z=Math.asin(m0(K,-1,1)),Math.abs(K)<0.9999999)this._x=Math.atan2(-U,H),this._y=Math.atan2(-G,W);else this._x=0,this._y=Math.atan2(X,E);break;case"XZY":if(this._z=Math.asin(-m0(Y,-1,1)),Math.abs(Y)<0.9999999)this._x=Math.atan2(F,H),this._y=Math.atan2(X,W);else this._x=Math.atan2(-U,E),this._y=0;break;default:C0("Euler: .setFromRotationMatrix() encountered an unknown order: "+Q)}if(this._order=Q,$===!0)this._onChangeCallback();return this}setFromQuaternion(J,Q,$){return CW.makeRotationFromQuaternion(J),this.setFromRotationMatrix(CW,Q,$)}setFromVector3(J,Q=this._order){return this.set(J.x,J.y,J.z,Q)}reorder(J){return IW.setFromEuler(this),this.setFromQuaternion(IW,J)}equals(J){return J._x===this._x&&J._y===this._y&&J._z===this._z&&J._order===this._order}fromArray(J){if(this._x=J[0],this._y=J[1],this._z=J[2],J[3]!==void 0)this._order=J[3];return this._onChangeCallback(),this}toArray(J=[],Q=0){return J[Q]=this._x,J[Q+1]=this._y,J[Q+2]=this._z,J[Q+3]=this._order,J}_onChange(J){return this._onChangeCallback=J,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}l9.DEFAULT_ORDER="XYZ";class $Q{constructor(){this.mask=1}set(J){this.mask=(1<<J|0)>>>0}enable(J){this.mask|=1<<J|0}enableAll(){this.mask=-1}toggle(J){this.mask^=1<<J|0}disable(J){this.mask&=~(1<<J|0)}disableAll(){this.mask=0}test(J){return(this.mask&J.mask)!==0}isEnabled(J){return(this.mask&(1<<J|0))!==0}}var vH=0,zW=new j,d8=new PJ,x9=new S0,O7=new j,w6=new j,yH=new j,hH=new PJ,wW=new j(1,0,0),PW=new j(0,1,0),_W=new j(0,0,1),TW={type:"added"},xH={type:"removed"},u8={type:"childadded",child:null},pQ={type:"childremoved",child:null};class FJ extends T9{constructor(){super();this.isObject3D=!0,Object.defineProperty(this,"id",{value:vH++}),this.uuid=R9(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=FJ.DEFAULT_UP.clone();let J=new j,Q=new l9,$=new PJ,Z=new j(1,1,1);function W(){$.setFromEuler(Q,!1)}function Y(){Q.setFromQuaternion($,void 0,!1)}Q._onChange(W),$._onChange(Y),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:J},rotation:{configurable:!0,enumerable:!0,value:Q},quaternion:{configurable:!0,enumerable:!0,value:$},scale:{configurable:!0,enumerable:!0,value:Z},modelViewMatrix:{value:new S0},normalMatrix:{value:new h0}}),this.matrix=new S0,this.matrixWorld=new S0,this.matrixAutoUpdate=FJ.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=FJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new $Q,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(J){if(this.matrixAutoUpdate)this.updateMatrix();this.matrix.premultiply(J),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(J){return this.quaternion.premultiply(J),this}setRotationFromAxisAngle(J,Q){this.quaternion.setFromAxisAngle(J,Q)}setRotationFromEuler(J){this.quaternion.setFromEuler(J,!0)}setRotationFromMatrix(J){this.quaternion.setFromRotationMatrix(J)}setRotationFromQuaternion(J){this.quaternion.copy(J)}rotateOnAxis(J,Q){return d8.setFromAxisAngle(J,Q),this.quaternion.multiply(d8),this}rotateOnWorldAxis(J,Q){return d8.setFromAxisAngle(J,Q),this.quaternion.premultiply(d8),this}rotateX(J){return this.rotateOnAxis(wW,J)}rotateY(J){return this.rotateOnAxis(PW,J)}rotateZ(J){return this.rotateOnAxis(_W,J)}translateOnAxis(J,Q){return zW.copy(J).applyQuaternion(this.quaternion),this.position.add(zW.multiplyScalar(Q)),this}translateX(J){return this.translateOnAxis(wW,J)}translateY(J){return this.translateOnAxis(PW,J)}translateZ(J){return this.translateOnAxis(_W,J)}localToWorld(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(this.matrixWorld)}worldToLocal(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(x9.copy(this.matrixWorld).invert())}lookAt(J,Q,$){if(J.isVector3)O7.copy(J);else O7.set(J,Q,$);let Z=this.parent;if(this.updateWorldMatrix(!0,!1),w6.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight)x9.lookAt(w6,O7,this.up);else x9.lookAt(O7,w6,this.up);if(this.quaternion.setFromRotationMatrix(x9),Z)x9.extractRotation(Z.matrixWorld),d8.setFromRotationMatrix(x9),this.quaternion.premultiply(d8.invert())}add(J){if(arguments.length>1){for(let Q=0;Q<arguments.length;Q++)this.add(arguments[Q]);return this}if(J===this)return A0("Object3D.add: object can't be added as a child of itself.",J),this;if(J&&J.isObject3D)J.removeFromParent(),J.parent=this,this.children.push(J),J.dispatchEvent(TW),u8.child=J,this.dispatchEvent(u8),u8.child=null;else A0("Object3D.add: object not an instance of THREE.Object3D.",J);return this}remove(J){if(arguments.length>1){for(let $=0;$<arguments.length;$++)this.remove(arguments[$]);return this}let Q=this.children.indexOf(J);if(Q!==-1)J.parent=null,this.children.splice(Q,1),J.dispatchEvent(xH),pQ.child=J,this.dispatchEvent(pQ),pQ.child=null;return this}removeFromParent(){let J=this.parent;if(J!==null)J.remove(this);return this}clear(){return this.remove(...this.children)}attach(J){if(this.updateWorldMatrix(!0,!1),x9.copy(this.matrixWorld).invert(),J.parent!==null)J.parent.updateWorldMatrix(!0,!1),x9.multiply(J.parent.matrixWorld);return J.applyMatrix4(x9),J.removeFromParent(),J.parent=this,this.children.push(J),J.updateWorldMatrix(!1,!0),J.dispatchEvent(TW),u8.child=J,this.dispatchEvent(u8),u8.child=null,this}getObjectById(J){return this.getObjectByProperty("id",J)}getObjectByName(J){return this.getObjectByProperty("name",J)}getObjectByProperty(J,Q){if(this[J]===Q)return this;for(let $=0,Z=this.children.length;$<Z;$++){let Y=this.children[$].getObjectByProperty(J,Q);if(Y!==void 0)return Y}return}getObjectsByProperty(J,Q,$=[]){if(this[J]===Q)$.push(this);let Z=this.children;for(let W=0,Y=Z.length;W<Y;W++)Z[W].getObjectsByProperty(J,Q,$);return $}getWorldPosition(J){return this.updateWorldMatrix(!0,!1),J.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(J){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(w6,J,yH),J}getWorldScale(J){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(w6,hH,J),J}getWorldDirection(J){this.updateWorldMatrix(!0,!1);let Q=this.matrixWorld.elements;return J.set(Q[8],Q[9],Q[10]).normalize()}raycast(){}traverse(J){J(this);let Q=this.children;for(let $=0,Z=Q.length;$<Z;$++)Q[$].traverse(J)}traverseVisible(J){if(this.visible===!1)return;J(this);let Q=this.children;for(let $=0,Z=Q.length;$<Z;$++)Q[$].traverseVisible(J)}traverseAncestors(J){let Q=this.parent;if(Q!==null)J(Q),Q.traverseAncestors(J)}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let J=this.pivot;if(J!==null){let{x:Q,y:$,z:Z}=J,W=this.matrix.elements;W[12]+=Q-W[0]*Q-W[4]*$-W[8]*Z,W[13]+=$-W[1]*Q-W[5]*$-W[9]*Z,W[14]+=Z-W[2]*Q-W[6]*$-W[10]*Z}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(J){if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldNeedsUpdate||J){if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);this.matrixWorldNeedsUpdate=!1,J=!0}let Q=this.children;for(let $=0,Z=Q.length;$<Z;$++)Q[$].updateMatrixWorld(J)}updateWorldMatrix(J,Q){let $=this.parent;if(J===!0&&$!==null)$.updateWorldMatrix(!0,!1);if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);if(Q===!0){let Z=this.children;for(let W=0,Y=Z.length;W<Y;W++)Z[W].updateWorldMatrix(!1,!0)}}toJSON(J){let Q=J===void 0||typeof J==="string",$={};if(Q)J={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},$.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"};let Z={};if(Z.uuid=this.uuid,Z.type=this.type,this.name!=="")Z.name=this.name;if(this.castShadow===!0)Z.castShadow=!0;if(this.receiveShadow===!0)Z.receiveShadow=!0;if(this.visible===!1)Z.visible=!1;if(this.frustumCulled===!1)Z.frustumCulled=!1;if(this.renderOrder!==0)Z.renderOrder=this.renderOrder;if(this.static!==!1)Z.static=this.static;if(Object.keys(this.userData).length>0)Z.userData=this.userData;if(Z.layers=this.layers.mask,Z.matrix=this.matrix.toArray(),Z.up=this.up.toArray(),this.pivot!==null)Z.pivot=this.pivot.toArray();if(this.matrixAutoUpdate===!1)Z.matrixAutoUpdate=!1;if(this.morphTargetDictionary!==void 0)Z.morphTargetDictionary=Object.assign({},this.morphTargetDictionary);if(this.morphTargetInfluences!==void 0)Z.morphTargetInfluences=this.morphTargetInfluences.slice();if(this.isInstancedMesh){if(Z.type="InstancedMesh",Z.count=this.count,Z.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null)Z.instanceColor=this.instanceColor.toJSON()}if(this.isBatchedMesh){if(Z.type="BatchedMesh",Z.perObjectFrustumCulled=this.perObjectFrustumCulled,Z.sortObjects=this.sortObjects,Z.drawRanges=this._drawRanges,Z.reservedRanges=this._reservedRanges,Z.geometryInfo=this._geometryInfo.map((X)=>({...X,boundingBox:X.boundingBox?X.boundingBox.toJSON():void 0,boundingSphere:X.boundingSphere?X.boundingSphere.toJSON():void 0})),Z.instanceInfo=this._instanceInfo.map((X)=>({...X})),Z.availableInstanceIds=this._availableInstanceIds.slice(),Z.availableGeometryIds=this._availableGeometryIds.slice(),Z.nextIndexStart=this._nextIndexStart,Z.nextVertexStart=this._nextVertexStart,Z.geometryCount=this._geometryCount,Z.maxInstanceCount=this._maxInstanceCount,Z.maxVertexCount=this._maxVertexCount,Z.maxIndexCount=this._maxIndexCount,Z.geometryInitialized=this._geometryInitialized,Z.matricesTexture=this._matricesTexture.toJSON(J),Z.indirectTexture=this._indirectTexture.toJSON(J),this._colorsTexture!==null)Z.colorsTexture=this._colorsTexture.toJSON(J);if(this.boundingSphere!==null)Z.boundingSphere=this.boundingSphere.toJSON();if(this.boundingBox!==null)Z.boundingBox=this.boundingBox.toJSON()}function W(X,K){if(X[K.uuid]===void 0)X[K.uuid]=K.toJSON(J);return K.uuid}if(this.isScene){if(this.background){if(this.background.isColor)Z.background=this.background.toJSON();else if(this.background.isTexture)Z.background=this.background.toJSON(J).uuid}if(this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0)Z.environment=this.environment.toJSON(J).uuid}else if(this.isMesh||this.isLine||this.isPoints){Z.geometry=W(J.geometries,this.geometry);let X=this.geometry.parameters;if(X!==void 0&&X.shapes!==void 0){let K=X.shapes;if(Array.isArray(K))for(let H=0,U=K.length;H<U;H++){let G=K[H];W(J.shapes,G)}else W(J.shapes,K)}}if(this.isSkinnedMesh){if(Z.bindMode=this.bindMode,Z.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0)W(J.skeletons,this.skeleton),Z.skeleton=this.skeleton.uuid}if(this.material!==void 0)if(Array.isArray(this.material)){let X=[];for(let K=0,H=this.material.length;K<H;K++)X.push(W(J.materials,this.material[K]));Z.material=X}else Z.material=W(J.materials,this.material);if(this.children.length>0){Z.children=[];for(let X=0;X<this.children.length;X++)Z.children.push(this.children[X].toJSON(J).object)}if(this.animations.length>0){Z.animations=[];for(let X=0;X<this.animations.length;X++){let K=this.animations[X];Z.animations.push(W(J.animations,K))}}if(Q){let X=Y(J.geometries),K=Y(J.materials),H=Y(J.textures),U=Y(J.images),G=Y(J.shapes),F=Y(J.skeletons),E=Y(J.animations),O=Y(J.nodes);if(X.length>0)$.geometries=X;if(K.length>0)$.materials=K;if(H.length>0)$.textures=H;if(U.length>0)$.images=U;if(G.length>0)$.shapes=G;if(F.length>0)$.skeletons=F;if(E.length>0)$.animations=E;if(O.length>0)$.nodes=O}return $.object=Z,$;function Y(X){let K=[];for(let H in X){let U=X[H];delete U.metadata,K.push(U)}return K}}clone(J){return new this.constructor().copy(this,J)}copy(J,Q=!0){if(this.name=J.name,this.up.copy(J.up),this.position.copy(J.position),this.rotation.order=J.rotation.order,this.quaternion.copy(J.quaternion),this.scale.copy(J.scale),this.pivot=J.pivot!==null?J.pivot.clone():null,this.matrix.copy(J.matrix),this.matrixWorld.copy(J.matrixWorld),this.matrixAutoUpdate=J.matrixAutoUpdate,this.matrixWorldAutoUpdate=J.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=J.matrixWorldNeedsUpdate,this.layers.mask=J.layers.mask,this.visible=J.visible,this.castShadow=J.castShadow,this.receiveShadow=J.receiveShadow,this.frustumCulled=J.frustumCulled,this.renderOrder=J.renderOrder,this.static=J.static,this.animations=J.animations.slice(),this.userData=JSON.parse(JSON.stringify(J.userData)),Q===!0)for(let $=0;$<J.children.length;$++){let Z=J.children[$];this.add(Z.clone())}return this}}FJ.DEFAULT_UP=new j(0,1,0);FJ.DEFAULT_MATRIX_AUTO_UPDATE=!0;FJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class W9 extends FJ{constructor(){super();this.isGroup=!0,this.type="Group"}}var bH={type:"move"};class l6{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){if(this._hand===null)this._hand=new W9,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1};return this._hand}getTargetRaySpace(){if(this._targetRay===null)this._targetRay=new W9,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new j,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new j;return this._targetRay}getGripSpace(){if(this._grip===null)this._grip=new W9,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new j,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new j,this._grip.eventsEnabled=!1;return this._grip}dispatchEvent(J){if(this._targetRay!==null)this._targetRay.dispatchEvent(J);if(this._grip!==null)this._grip.dispatchEvent(J);if(this._hand!==null)this._hand.dispatchEvent(J);return this}connect(J){if(J&&J.hand){let Q=this._hand;if(Q)for(let $ of J.hand.values())this._getHandJoint(Q,$)}return this.dispatchEvent({type:"connected",data:J}),this}disconnect(J){if(this.dispatchEvent({type:"disconnected",data:J}),this._targetRay!==null)this._targetRay.visible=!1;if(this._grip!==null)this._grip.visible=!1;if(this._hand!==null)this._hand.visible=!1;return this}update(J,Q,$){let Z=null,W=null,Y=null,X=this._targetRay,K=this._grip,H=this._hand;if(J&&Q.session.visibilityState!=="visible-blurred"){if(H&&J.hand){Y=!0;for(let R of J.hand.values()){let C=Q.getJointPose(R,$),q=this._getHandJoint(H,R);if(C!==null)q.matrix.fromArray(C.transform.matrix),q.matrix.decompose(q.position,q.rotation,q.scale),q.matrixWorldNeedsUpdate=!0,q.jointRadius=C.radius;q.visible=C!==null}let U=H.joints["index-finger-tip"],G=H.joints["thumb-tip"],F=U.position.distanceTo(G.position),E=0.02,O=0.005;if(H.inputState.pinching&&F>E+O)H.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:J.handedness,target:this});else if(!H.inputState.pinching&&F<=E-O)H.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:J.handedness,target:this})}else if(K!==null&&J.gripSpace){if(W=Q.getPose(J.gripSpace,$),W!==null){if(K.matrix.fromArray(W.transform.matrix),K.matrix.decompose(K.position,K.rotation,K.scale),K.matrixWorldNeedsUpdate=!0,W.linearVelocity)K.hasLinearVelocity=!0,K.linearVelocity.copy(W.linearVelocity);else K.hasLinearVelocity=!1;if(W.angularVelocity)K.hasAngularVelocity=!0,K.angularVelocity.copy(W.angularVelocity);else K.hasAngularVelocity=!1;if(K.eventsEnabled)K.dispatchEvent({type:"gripUpdated",data:J,target:this})}}if(X!==null){if(Z=Q.getPose(J.targetRaySpace,$),Z===null&&W!==null)Z=W;if(Z!==null){if(X.matrix.fromArray(Z.transform.matrix),X.matrix.decompose(X.position,X.rotation,X.scale),X.matrixWorldNeedsUpdate=!0,Z.linearVelocity)X.hasLinearVelocity=!0,X.linearVelocity.copy(Z.linearVelocity);else X.hasLinearVelocity=!1;if(Z.angularVelocity)X.hasAngularVelocity=!0,X.angularVelocity.copy(Z.angularVelocity);else X.hasAngularVelocity=!1;this.dispatchEvent(bH)}}}if(X!==null)X.visible=Z!==null;if(K!==null)K.visible=W!==null;if(H!==null)H.visible=Y!==null;return this}_getHandJoint(J,Q){if(J.joints[Q.jointName]===void 0){let $=new W9;$.matrixAutoUpdate=!1,$.visible=!1,J.joints[Q.jointName]=$,J.add($)}return J.joints[Q.jointName]}}var JX={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Q8={h:0,s:0,l:0},q7={h:0,s:0,l:0};function dQ(J,Q,$){if($<0)$+=1;if($>1)$-=1;if($<0.16666666666666666)return J+(Q-J)*6*$;if($<0.5)return Q;if($<0.6666666666666666)return J+(Q-J)*6*(0.6666666666666666-$);return J}class R0{constructor(J,Q,$){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(J,Q,$)}set(J,Q,$){if(Q===void 0&&$===void 0){let Z=J;if(Z&&Z.isColor)this.copy(Z);else if(typeof Z==="number")this.setHex(Z);else if(typeof Z==="string")this.setStyle(Z)}else this.setRGB(J,Q,$);return this}setScalar(J){return this.r=J,this.g=J,this.b=J,this}setHex(J,Q="srgb"){return J=Math.floor(J),this.r=(J>>16&255)/255,this.g=(J>>8&255)/255,this.b=(J&255)/255,s0.colorSpaceToWorking(this,Q),this}setRGB(J,Q,$,Z=s0.workingColorSpace){return this.r=J,this.g=Q,this.b=$,s0.colorSpaceToWorking(this,Z),this}setHSL(J,Q,$,Z=s0.workingColorSpace){if(J=GZ(J,1),Q=m0(Q,0,1),$=m0($,0,1),Q===0)this.r=this.g=this.b=$;else{let W=$<=0.5?$*(1+Q):$+Q-$*Q,Y=2*$-W;this.r=dQ(Y,W,J+0.3333333333333333),this.g=dQ(Y,W,J),this.b=dQ(Y,W,J-0.3333333333333333)}return s0.colorSpaceToWorking(this,Z),this}setStyle(J,Q="srgb"){function $(W){if(W===void 0)return;if(parseFloat(W)<1)C0("Color: Alpha component of "+J+" will be ignored.")}let Z;if(Z=/^(\w+)\(([^\)]*)\)/.exec(J)){let W,Y=Z[1],X=Z[2];switch(Y){case"rgb":case"rgba":if(W=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(X))return $(W[4]),this.setRGB(Math.min(255,parseInt(W[1],10))/255,Math.min(255,parseInt(W[2],10))/255,Math.min(255,parseInt(W[3],10))/255,Q);if(W=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(X))return $(W[4]),this.setRGB(Math.min(100,parseInt(W[1],10))/100,Math.min(100,parseInt(W[2],10))/100,Math.min(100,parseInt(W[3],10))/100,Q);break;case"hsl":case"hsla":if(W=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(X))return $(W[4]),this.setHSL(parseFloat(W[1])/360,parseFloat(W[2])/100,parseFloat(W[3])/100,Q);break;default:C0("Color: Unknown color model "+J)}}else if(Z=/^\#([A-Fa-f\d]+)$/.exec(J)){let W=Z[1],Y=W.length;if(Y===3)return this.setRGB(parseInt(W.charAt(0),16)/15,parseInt(W.charAt(1),16)/15,parseInt(W.charAt(2),16)/15,Q);else if(Y===6)return this.setHex(parseInt(W,16),Q);else C0("Color: Invalid hex color "+J)}else if(J&&J.length>0)return this.setColorName(J,Q);return this}setColorName(J,Q="srgb"){let $=JX[J.toLowerCase()];if($!==void 0)this.setHex($,Q);else C0("Color: Unknown color "+J);return this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(J){return this.r=J.r,this.g=J.g,this.b=J.b,this}copySRGBToLinear(J){return this.r=m9(J.r),this.g=m9(J.g),this.b=m9(J.b),this}copyLinearToSRGB(J){return this.r=e8(J.r),this.g=e8(J.g),this.b=e8(J.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(J="srgb"){return s0.workingToColorSpace(xJ.copy(this),J),Math.round(m0(xJ.r*255,0,255))*65536+Math.round(m0(xJ.g*255,0,255))*256+Math.round(m0(xJ.b*255,0,255))}getHexString(J="srgb"){return("000000"+this.getHex(J).toString(16)).slice(-6)}getHSL(J,Q=s0.workingColorSpace){s0.workingToColorSpace(xJ.copy(this),Q);let{r:$,g:Z,b:W}=xJ,Y=Math.max($,Z,W),X=Math.min($,Z,W),K,H,U=(X+Y)/2;if(X===Y)K=0,H=0;else{let G=Y-X;switch(H=U<=0.5?G/(Y+X):G/(2-Y-X),Y){case $:K=(Z-W)/G+(Z<W?6:0);break;case Z:K=(W-$)/G+2;break;case W:K=($-Z)/G+4;break}K/=6}return J.h=K,J.s=H,J.l=U,J}getRGB(J,Q=s0.workingColorSpace){return s0.workingToColorSpace(xJ.copy(this),Q),J.r=xJ.r,J.g=xJ.g,J.b=xJ.b,J}getStyle(J="srgb"){s0.workingToColorSpace(xJ.copy(this),J);let{r:Q,g:$,b:Z}=xJ;if(J!=="srgb")return`color(${J} ${Q.toFixed(3)} ${$.toFixed(3)} ${Z.toFixed(3)})`;return`rgb(${Math.round(Q*255)},${Math.round($*255)},${Math.round(Z*255)})`}offsetHSL(J,Q,$){return this.getHSL(Q8),this.setHSL(Q8.h+J,Q8.s+Q,Q8.l+$)}add(J){return this.r+=J.r,this.g+=J.g,this.b+=J.b,this}addColors(J,Q){return this.r=J.r+Q.r,this.g=J.g+Q.g,this.b=J.b+Q.b,this}addScalar(J){return this.r+=J,this.g+=J,this.b+=J,this}sub(J){return this.r=Math.max(0,this.r-J.r),this.g=Math.max(0,this.g-J.g),this.b=Math.max(0,this.b-J.b),this}multiply(J){return this.r*=J.r,this.g*=J.g,this.b*=J.b,this}multiplyScalar(J){return this.r*=J,this.g*=J,this.b*=J,this}lerp(J,Q){return this.r+=(J.r-this.r)*Q,this.g+=(J.g-this.g)*Q,this.b+=(J.b-this.b)*Q,this}lerpColors(J,Q,$){return this.r=J.r+(Q.r-J.r)*$,this.g=J.g+(Q.g-J.g)*$,this.b=J.b+(Q.b-J.b)*$,this}lerpHSL(J,Q){this.getHSL(Q8),J.getHSL(q7);let $=h6(Q8.h,q7.h,Q),Z=h6(Q8.s,q7.s,Q),W=h6(Q8.l,q7.l,Q);return this.setHSL($,Z,W),this}setFromVector3(J){return this.r=J.x,this.g=J.y,this.b=J.z,this}applyMatrix3(J){let Q=this.r,$=this.g,Z=this.b,W=J.elements;return this.r=W[0]*Q+W[3]*$+W[6]*Z,this.g=W[1]*Q+W[4]*$+W[7]*Z,this.b=W[2]*Q+W[5]*$+W[8]*Z,this}equals(J){return J.r===this.r&&J.g===this.g&&J.b===this.b}fromArray(J,Q=0){return this.r=J[Q],this.g=J[Q+1],this.b=J[Q+2],this}toArray(J=[],Q=0){return J[Q]=this.r,J[Q+1]=this.g,J[Q+2]=this.b,J}fromBufferAttribute(J,Q){return this.r=J.getX(Q),this.g=J.getY(Q),this.b=J.getZ(Q),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}var xJ=new R0;R0.NAMES=JX;class ZQ extends FJ{constructor(){super();if(this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new l9,this.environmentIntensity=1,this.environmentRotation=new l9,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(J,Q){if(super.copy(J,Q),J.background!==null)this.background=J.background.clone();if(J.environment!==null)this.environment=J.environment.clone();if(J.fog!==null)this.fog=J.fog.clone();if(this.backgroundBlurriness=J.backgroundBlurriness,this.backgroundIntensity=J.backgroundIntensity,this.backgroundRotation.copy(J.backgroundRotation),this.environmentIntensity=J.environmentIntensity,this.environmentRotation.copy(J.environmentRotation),J.overrideMaterial!==null)this.overrideMaterial=J.overrideMaterial.clone();return this.matrixAutoUpdate=J.matrixAutoUpdate,this}toJSON(J){let Q=super.toJSON(J);if(this.fog!==null)Q.object.fog=this.fog.toJSON();if(this.backgroundBlurriness>0)Q.object.backgroundBlurriness=this.backgroundBlurriness;if(this.backgroundIntensity!==1)Q.object.backgroundIntensity=this.backgroundIntensity;if(Q.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1)Q.object.environmentIntensity=this.environmentIntensity;return Q.object.environmentRotation=this.environmentRotation.toArray(),Q}}var F9=new j,b9=new j,uQ=new j,f9=new j,m8=new j,l8=new j,AW=new j,mQ=new j,lQ=new j,cQ=new j,nQ=new QJ,sQ=new QJ,iQ=new QJ;class Z9{constructor(J=new j,Q=new j,$=new j){this.a=J,this.b=Q,this.c=$}static getNormal(J,Q,$,Z){Z.subVectors($,Q),F9.subVectors(J,Q),Z.cross(F9);let W=Z.lengthSq();if(W>0)return Z.multiplyScalar(1/Math.sqrt(W));return Z.set(0,0,0)}static getBarycoord(J,Q,$,Z,W){F9.subVectors(Z,Q),b9.subVectors($,Q),uQ.subVectors(J,Q);let Y=F9.dot(F9),X=F9.dot(b9),K=F9.dot(uQ),H=b9.dot(b9),U=b9.dot(uQ),G=Y*H-X*X;if(G===0)return W.set(0,0,0),null;let F=1/G,E=(H*K-X*U)*F,O=(Y*U-X*K)*F;return W.set(1-E-O,O,E)}static containsPoint(J,Q,$,Z){if(this.getBarycoord(J,Q,$,Z,f9)===null)return!1;return f9.x>=0&&f9.y>=0&&f9.x+f9.y<=1}static getInterpolation(J,Q,$,Z,W,Y,X,K){if(this.getBarycoord(J,Q,$,Z,f9)===null){if(K.x=0,K.y=0,"z"in K)K.z=0;if("w"in K)K.w=0;return null}return K.setScalar(0),K.addScaledVector(W,f9.x),K.addScaledVector(Y,f9.y),K.addScaledVector(X,f9.z),K}static getInterpolatedAttribute(J,Q,$,Z,W,Y){return nQ.setScalar(0),sQ.setScalar(0),iQ.setScalar(0),nQ.fromBufferAttribute(J,Q),sQ.fromBufferAttribute(J,$),iQ.fromBufferAttribute(J,Z),Y.setScalar(0),Y.addScaledVector(nQ,W.x),Y.addScaledVector(sQ,W.y),Y.addScaledVector(iQ,W.z),Y}static isFrontFacing(J,Q,$,Z){return F9.subVectors($,Q),b9.subVectors(J,Q),F9.cross(b9).dot(Z)<0}set(J,Q,$){return this.a.copy(J),this.b.copy(Q),this.c.copy($),this}setFromPointsAndIndices(J,Q,$,Z){return this.a.copy(J[Q]),this.b.copy(J[$]),this.c.copy(J[Z]),this}setFromAttributeAndIndices(J,Q,$,Z){return this.a.fromBufferAttribute(J,Q),this.b.fromBufferAttribute(J,$),this.c.fromBufferAttribute(J,Z),this}clone(){return new this.constructor().copy(this)}copy(J){return this.a.copy(J.a),this.b.copy(J.b),this.c.copy(J.c),this}getArea(){return F9.subVectors(this.c,this.b),b9.subVectors(this.a,this.b),F9.cross(b9).length()*0.5}getMidpoint(J){return J.addVectors(this.a,this.b).add(this.c).multiplyScalar(0.3333333333333333)}getNormal(J){return Z9.getNormal(this.a,this.b,this.c,J)}getPlane(J){return J.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(J,Q){return Z9.getBarycoord(J,this.a,this.b,this.c,Q)}getInterpolation(J,Q,$,Z,W){return Z9.getInterpolation(J,this.a,this.b,this.c,Q,$,Z,W)}containsPoint(J){return Z9.containsPoint(J,this.a,this.b,this.c)}isFrontFacing(J){return Z9.isFrontFacing(this.a,this.b,this.c,J)}intersectsBox(J){return J.intersectsTriangle(this)}closestPointToPoint(J,Q){let $=this.a,Z=this.b,W=this.c,Y,X;m8.subVectors(Z,$),l8.subVectors(W,$),mQ.subVectors(J,$);let K=m8.dot(mQ),H=l8.dot(mQ);if(K<=0&&H<=0)return Q.copy($);lQ.subVectors(J,Z);let U=m8.dot(lQ),G=l8.dot(lQ);if(U>=0&&G<=U)return Q.copy(Z);let F=K*G-U*H;if(F<=0&&K>=0&&U<=0)return Y=K/(K-U),Q.copy($).addScaledVector(m8,Y);cQ.subVectors(J,W);let E=m8.dot(cQ),O=l8.dot(cQ);if(O>=0&&E<=O)return Q.copy(W);let R=E*H-K*O;if(R<=0&&H>=0&&O<=0)return X=H/(H-O),Q.copy($).addScaledVector(l8,X);let C=U*O-E*G;if(C<=0&&G-U>=0&&E-O>=0)return AW.subVectors(W,Z),X=(G-U)/(G-U+(E-O)),Q.copy(Z).addScaledVector(AW,X);let q=1/(C+R+F);return Y=R*q,X=F*q,Q.copy($).addScaledVector(m8,Y).addScaledVector(l8,X)}equals(J){return J.a.equals(this.a)&&J.b.equals(this.b)&&J.c.equals(this.c)}}class sJ{constructor(J=new j(1/0,1/0,1/0),Q=new j(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=J,this.max=Q}set(J,Q){return this.min.copy(J),this.max.copy(Q),this}setFromArray(J){this.makeEmpty();for(let Q=0,$=J.length;Q<$;Q+=3)this.expandByPoint(N9.fromArray(J,Q));return this}setFromBufferAttribute(J){this.makeEmpty();for(let Q=0,$=J.count;Q<$;Q++)this.expandByPoint(N9.fromBufferAttribute(J,Q));return this}setFromPoints(J){this.makeEmpty();for(let Q=0,$=J.length;Q<$;Q++)this.expandByPoint(J[Q]);return this}setFromCenterAndSize(J,Q){let $=N9.copy(Q).multiplyScalar(0.5);return this.min.copy(J).sub($),this.max.copy(J).add($),this}setFromObject(J,Q=!1){return this.makeEmpty(),this.expandByObject(J,Q)}clone(){return new this.constructor().copy(this)}copy(J){return this.min.copy(J.min),this.max.copy(J.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(J){return this.isEmpty()?J.set(0,0,0):J.addVectors(this.min,this.max).multiplyScalar(0.5)}getSize(J){return this.isEmpty()?J.set(0,0,0):J.subVectors(this.max,this.min)}expandByPoint(J){return this.min.min(J),this.max.max(J),this}expandByVector(J){return this.min.sub(J),this.max.add(J),this}expandByScalar(J){return this.min.addScalar(-J),this.max.addScalar(J),this}expandByObject(J,Q=!1){J.updateWorldMatrix(!1,!1);let $=J.geometry;if($!==void 0){let W=$.getAttribute("position");if(Q===!0&&W!==void 0&&J.isInstancedMesh!==!0)for(let Y=0,X=W.count;Y<X;Y++){if(J.isMesh===!0)J.getVertexPosition(Y,N9);else N9.fromBufferAttribute(W,Y);N9.applyMatrix4(J.matrixWorld),this.expandByPoint(N9)}else{if(J.boundingBox!==void 0){if(J.boundingBox===null)J.computeBoundingBox();R7.copy(J.boundingBox)}else{if($.boundingBox===null)$.computeBoundingBox();R7.copy($.boundingBox)}R7.applyMatrix4(J.matrixWorld),this.union(R7)}}let Z=J.children;for(let W=0,Y=Z.length;W<Y;W++)this.expandByObject(Z[W],Q);return this}containsPoint(J){return J.x>=this.min.x&&J.x<=this.max.x&&J.y>=this.min.y&&J.y<=this.max.y&&J.z>=this.min.z&&J.z<=this.max.z}containsBox(J){return this.min.x<=J.min.x&&J.max.x<=this.max.x&&this.min.y<=J.min.y&&J.max.y<=this.max.y&&this.min.z<=J.min.z&&J.max.z<=this.max.z}getParameter(J,Q){return Q.set((J.x-this.min.x)/(this.max.x-this.min.x),(J.y-this.min.y)/(this.max.y-this.min.y),(J.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(J){return J.max.x>=this.min.x&&J.min.x<=this.max.x&&J.max.y>=this.min.y&&J.min.y<=this.max.y&&J.max.z>=this.min.z&&J.min.z<=this.max.z}intersectsSphere(J){return this.clampPoint(J.center,N9),N9.distanceToSquared(J.center)<=J.radius*J.radius}intersectsPlane(J){let Q,$;if(J.normal.x>0)Q=J.normal.x*this.min.x,$=J.normal.x*this.max.x;else Q=J.normal.x*this.max.x,$=J.normal.x*this.min.x;if(J.normal.y>0)Q+=J.normal.y*this.min.y,$+=J.normal.y*this.max.y;else Q+=J.normal.y*this.max.y,$+=J.normal.y*this.min.y;if(J.normal.z>0)Q+=J.normal.z*this.min.z,$+=J.normal.z*this.max.z;else Q+=J.normal.z*this.max.z,$+=J.normal.z*this.min.z;return Q<=-J.constant&&$>=-J.constant}intersectsTriangle(J){if(this.isEmpty())return!1;this.getCenter(P6),L7.subVectors(this.max,P6),c8.subVectors(J.a,P6),n8.subVectors(J.b,P6),s8.subVectors(J.c,P6),$8.subVectors(n8,c8),Z8.subVectors(s8,n8),R8.subVectors(c8,s8);let Q=[0,-$8.z,$8.y,0,-Z8.z,Z8.y,0,-R8.z,R8.y,$8.z,0,-$8.x,Z8.z,0,-Z8.x,R8.z,0,-R8.x,-$8.y,$8.x,0,-Z8.y,Z8.x,0,-R8.y,R8.x,0];if(!oQ(Q,c8,n8,s8,L7))return!1;if(Q=[1,0,0,0,1,0,0,0,1],!oQ(Q,c8,n8,s8,L7))return!1;return D7.crossVectors($8,Z8),Q=[D7.x,D7.y,D7.z],oQ(Q,c8,n8,s8,L7)}clampPoint(J,Q){return Q.copy(J).clamp(this.min,this.max)}distanceToPoint(J){return this.clampPoint(J,N9).distanceTo(J)}getBoundingSphere(J){if(this.isEmpty())J.makeEmpty();else this.getCenter(J.center),J.radius=this.getSize(N9).length()*0.5;return J}intersect(J){if(this.min.max(J.min),this.max.min(J.max),this.isEmpty())this.makeEmpty();return this}union(J){return this.min.min(J.min),this.max.max(J.max),this}applyMatrix4(J){if(this.isEmpty())return this;return g9[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(J),g9[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(J),g9[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(J),g9[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(J),g9[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(J),g9[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(J),g9[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(J),g9[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(J),this.setFromPoints(g9),this}translate(J){return this.min.add(J),this.max.add(J),this}equals(J){return J.min.equals(this.min)&&J.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(J){return this.min.fromArray(J.min),this.max.fromArray(J.max),this}}var g9=[new j,new j,new j,new j,new j,new j,new j,new j],N9=new j,R7=new sJ,c8=new j,n8=new j,s8=new j,$8=new j,Z8=new j,R8=new j,P6=new j,L7=new j,D7=new j,L8=new j;function oQ(J,Q,$,Z,W){for(let Y=0,X=J.length-3;Y<=X;Y+=3){L8.fromArray(J,Y);let K=W.x*Math.abs(L8.x)+W.y*Math.abs(L8.y)+W.z*Math.abs(L8.z),H=Q.dot(L8),U=$.dot(L8),G=Z.dot(L8);if(Math.max(-Math.max(H,U,G),Math.min(H,U,G))>K)return!1}return!0}var u9=fH();function fH(){let J=new ArrayBuffer(4),Q=new Float32Array(J),$=new Uint32Array(J),Z=new Uint32Array(512),W=new Uint32Array(512);for(let H=0;H<256;++H){let U=H-127;if(U<-27)Z[H]=0,Z[H|256]=32768,W[H]=24,W[H|256]=24;else if(U<-14)Z[H]=1024>>-U-14,Z[H|256]=1024>>-U-14|32768,W[H]=-U-1,W[H|256]=-U-1;else if(U<=15)Z[H]=U+15<<10,Z[H|256]=U+15<<10|32768,W[H]=13,W[H|256]=13;else if(U<128)Z[H]=31744,Z[H|256]=64512,W[H]=24,W[H|256]=24;else Z[H]=31744,Z[H|256]=64512,W[H]=13,W[H|256]=13}let Y=new Uint32Array(2048),X=new Uint32Array(64),K=new Uint32Array(64);for(let H=1;H<1024;++H){let U=H<<13,G=0;while((U&8388608)===0)U<<=1,G-=8388608;U&=-8388609,G+=947912704,Y[H]=U|G}for(let H=1024;H<2048;++H)Y[H]=939524096+(H-1024<<13);for(let H=1;H<31;++H)X[H]=H<<23;X[31]=1199570944,X[32]=2147483648;for(let H=33;H<63;++H)X[H]=2147483648+(H-32<<23);X[63]=3347054592;for(let H=1;H<64;++H)if(H!==32)K[H]=1024;return{floatView:Q,uint32View:$,baseTable:Z,shiftTable:W,mantissaTable:Y,exponentTable:X,offsetTable:K}}function gH(J){if(Math.abs(J)>65504)C0("DataUtils.toHalfFloat(): Value out of range.");J=m0(J,-65504,65504),u9.floatView[0]=J;let Q=u9.uint32View[0],$=Q>>23&511;return u9.baseTable[$]+((Q&8388607)>>u9.shiftTable[$])}function pH(J){let Q=J>>10;return u9.uint32View[0]=u9.mantissaTable[u9.offsetTable[Q]+(J&1023)]+u9.exponentTable[Q],u9.floatView[0]}class T8{static toHalfFloat(J){return gH(J)}static fromHalfFloat(J){return pH(J)}}var zJ=new j,M7=new p0,dH=0;class JJ extends T9{constructor(J,Q,$=!1){super();if(Array.isArray(J))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:dH++}),this.name="",this.array=J,this.itemSize=Q,this.count=J!==void 0?J.length/Q:0,this.normalized=$,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(J){if(J===!0)this.version++}setUsage(J){return this.usage=J,this}addUpdateRange(J,Q){this.updateRanges.push({start:J,count:Q})}clearUpdateRanges(){this.updateRanges.length=0}copy(J){return this.name=J.name,this.array=new J.array.constructor(J.array),this.itemSize=J.itemSize,this.count=J.count,this.normalized=J.normalized,this.usage=J.usage,this.gpuType=J.gpuType,this}copyAt(J,Q,$){J*=this.itemSize,$*=Q.itemSize;for(let Z=0,W=this.itemSize;Z<W;Z++)this.array[J+Z]=Q.array[$+Z];return this}copyArray(J){return this.array.set(J),this}applyMatrix3(J){if(this.itemSize===2)for(let Q=0,$=this.count;Q<$;Q++)M7.fromBufferAttribute(this,Q),M7.applyMatrix3(J),this.setXY(Q,M7.x,M7.y);else if(this.itemSize===3)for(let Q=0,$=this.count;Q<$;Q++)zJ.fromBufferAttribute(this,Q),zJ.applyMatrix3(J),this.setXYZ(Q,zJ.x,zJ.y,zJ.z);return this}applyMatrix4(J){for(let Q=0,$=this.count;Q<$;Q++)zJ.fromBufferAttribute(this,Q),zJ.applyMatrix4(J),this.setXYZ(Q,zJ.x,zJ.y,zJ.z);return this}applyNormalMatrix(J){for(let Q=0,$=this.count;Q<$;Q++)zJ.fromBufferAttribute(this,Q),zJ.applyNormalMatrix(J),this.setXYZ(Q,zJ.x,zJ.y,zJ.z);return this}transformDirection(J){for(let Q=0,$=this.count;Q<$;Q++)zJ.fromBufferAttribute(this,Q),zJ.transformDirection(J),this.setXYZ(Q,zJ.x,zJ.y,zJ.z);return this}set(J,Q=0){return this.array.set(J,Q),this}getComponent(J,Q){let $=this.array[J*this.itemSize+Q];if(this.normalized)$=q9($,this.array);return $}setComponent(J,Q,$){if(this.normalized)$=$J($,this.array);return this.array[J*this.itemSize+Q]=$,this}getX(J){let Q=this.array[J*this.itemSize];if(this.normalized)Q=q9(Q,this.array);return Q}setX(J,Q){if(this.normalized)Q=$J(Q,this.array);return this.array[J*this.itemSize]=Q,this}getY(J){let Q=this.array[J*this.itemSize+1];if(this.normalized)Q=q9(Q,this.array);return Q}setY(J,Q){if(this.normalized)Q=$J(Q,this.array);return this.array[J*this.itemSize+1]=Q,this}getZ(J){let Q=this.array[J*this.itemSize+2];if(this.normalized)Q=q9(Q,this.array);return Q}setZ(J,Q){if(this.normalized)Q=$J(Q,this.array);return this.array[J*this.itemSize+2]=Q,this}getW(J){let Q=this.array[J*this.itemSize+3];if(this.normalized)Q=q9(Q,this.array);return Q}setW(J,Q){if(this.normalized)Q=$J(Q,this.array);return this.array[J*this.itemSize+3]=Q,this}setXY(J,Q,$){if(J*=this.itemSize,this.normalized)Q=$J(Q,this.array),$=$J($,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this}setXYZ(J,Q,$,Z){if(J*=this.itemSize,this.normalized)Q=$J(Q,this.array),$=$J($,this.array),Z=$J(Z,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this.array[J+2]=Z,this}setXYZW(J,Q,$,Z,W){if(J*=this.itemSize,this.normalized)Q=$J(Q,this.array),$=$J($,this.array),Z=$J(Z,this.array),W=$J(W,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this.array[J+2]=Z,this.array[J+3]=W,this}onUpload(J){return this.onUploadCallback=J,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let J={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};if(this.name!=="")J.name=this.name;if(this.usage!==35044)J.usage=this.usage;return J}dispose(){this.dispatchEvent({type:"dispose"})}}class WQ extends JJ{constructor(J,Q,$){super(new Uint16Array(J),Q,$)}}class YQ extends JJ{constructor(J,Q,$){super(new Uint32Array(J),Q,$)}}class NJ extends JJ{constructor(J,Q,$){super(new Float32Array(J),Q,$)}}var uH=new sJ,_6=new j,aQ=new j;class mJ{constructor(J=new j,Q=-1){this.isSphere=!0,this.center=J,this.radius=Q}set(J,Q){return this.center.copy(J),this.radius=Q,this}setFromPoints(J,Q){let $=this.center;if(Q!==void 0)$.copy(Q);else uH.setFromPoints(J).getCenter($);let Z=0;for(let W=0,Y=J.length;W<Y;W++)Z=Math.max(Z,$.distanceToSquared(J[W]));return this.radius=Math.sqrt(Z),this}copy(J){return this.center.copy(J.center),this.radius=J.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(J){return J.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(J){return J.distanceTo(this.center)-this.radius}intersectsSphere(J){let Q=this.radius+J.radius;return J.center.distanceToSquared(this.center)<=Q*Q}intersectsBox(J){return J.intersectsSphere(this)}intersectsPlane(J){return Math.abs(J.distanceToPoint(this.center))<=this.radius}clampPoint(J,Q){let $=this.center.distanceToSquared(J);if(Q.copy(J),$>this.radius*this.radius)Q.sub(this.center).normalize(),Q.multiplyScalar(this.radius).add(this.center);return Q}getBoundingBox(J){if(this.isEmpty())return J.makeEmpty(),J;return J.set(this.center,this.center),J.expandByScalar(this.radius),J}applyMatrix4(J){return this.center.applyMatrix4(J),this.radius=this.radius*J.getMaxScaleOnAxis(),this}translate(J){return this.center.add(J),this}expandByPoint(J){if(this.isEmpty())return this.center.copy(J),this.radius=0,this;_6.subVectors(J,this.center);let Q=_6.lengthSq();if(Q>this.radius*this.radius){let $=Math.sqrt(Q),Z=($-this.radius)*0.5;this.center.addScaledVector(_6,Z/$),this.radius+=Z}return this}union(J){if(J.isEmpty())return this;if(this.isEmpty())return this.copy(J),this;if(this.center.equals(J.center)===!0)this.radius=Math.max(this.radius,J.radius);else aQ.subVectors(J.center,this.center).setLength(J.radius),this.expandByPoint(_6.copy(J.center).add(aQ)),this.expandByPoint(_6.copy(J.center).sub(aQ));return this}equals(J){return J.center.equals(this.center)&&J.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(J){return this.radius=J.radius,this.center.fromArray(J.center),this}}var mH=0,$9=new S0,rQ=new FJ,i8=new j,aJ=new sJ,T6=new sJ,AJ=new j;class RJ extends T9{constructor(){super();this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:mH++}),this.uuid=R9(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(J){if(Array.isArray(J))this.index=new((GH(J))?YQ:WQ)(J,1);else this.index=J;return this}setIndirect(J,Q=0){return this.indirect=J,this.indirectOffset=Q,this}getIndirect(){return this.indirect}getAttribute(J){return this.attributes[J]}setAttribute(J,Q){return this.attributes[J]=Q,this}deleteAttribute(J){return delete this.attributes[J],this}hasAttribute(J){return this.attributes[J]!==void 0}addGroup(J,Q,$=0){this.groups.push({start:J,count:Q,materialIndex:$})}clearGroups(){this.groups=[]}setDrawRange(J,Q){this.drawRange.start=J,this.drawRange.count=Q}applyMatrix4(J){let Q=this.attributes.position;if(Q!==void 0)Q.applyMatrix4(J),Q.needsUpdate=!0;let $=this.attributes.normal;if($!==void 0){let W=new h0().getNormalMatrix(J);$.applyNormalMatrix(W),$.needsUpdate=!0}let Z=this.attributes.tangent;if(Z!==void 0)Z.transformDirection(J),Z.needsUpdate=!0;if(this.boundingBox!==null)this.computeBoundingBox();if(this.boundingSphere!==null)this.computeBoundingSphere();return this}applyQuaternion(J){return $9.makeRotationFromQuaternion(J),this.applyMatrix4($9),this}rotateX(J){return $9.makeRotationX(J),this.applyMatrix4($9),this}rotateY(J){return $9.makeRotationY(J),this.applyMatrix4($9),this}rotateZ(J){return $9.makeRotationZ(J),this.applyMatrix4($9),this}translate(J,Q,$){return $9.makeTranslation(J,Q,$),this.applyMatrix4($9),this}scale(J,Q,$){return $9.makeScale(J,Q,$),this.applyMatrix4($9),this}lookAt(J){return rQ.lookAt(J),rQ.updateMatrix(),this.applyMatrix4(rQ.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(i8).negate(),this.translate(i8.x,i8.y,i8.z),this}setFromPoints(J){let Q=this.getAttribute("position");if(Q===void 0){let $=[];for(let Z=0,W=J.length;Z<W;Z++){let Y=J[Z];$.push(Y.x,Y.y,Y.z||0)}this.setAttribute("position",new NJ($,3))}else{let $=Math.min(J.length,Q.count);for(let Z=0;Z<$;Z++){let W=J[Z];Q.setXYZ(Z,W.x,W.y,W.z||0)}if(J.length>Q.count)C0("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.");Q.needsUpdate=!0}return this}computeBoundingBox(){if(this.boundingBox===null)this.boundingBox=new sJ;let J=this.attributes.position,Q=this.morphAttributes.position;if(J&&J.isGLBufferAttribute){A0("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new j(-1/0,-1/0,-1/0),new j(1/0,1/0,1/0));return}if(J!==void 0){if(this.boundingBox.setFromBufferAttribute(J),Q)for(let $=0,Z=Q.length;$<Z;$++){let W=Q[$];if(aJ.setFromBufferAttribute(W),this.morphTargetsRelative)AJ.addVectors(this.boundingBox.min,aJ.min),this.boundingBox.expandByPoint(AJ),AJ.addVectors(this.boundingBox.max,aJ.max),this.boundingBox.expandByPoint(AJ);else this.boundingBox.expandByPoint(aJ.min),this.boundingBox.expandByPoint(aJ.max)}}else this.boundingBox.makeEmpty();if(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))A0('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){if(this.boundingSphere===null)this.boundingSphere=new mJ;let J=this.attributes.position,Q=this.morphAttributes.position;if(J&&J.isGLBufferAttribute){A0("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new j,1/0);return}if(J){let $=this.boundingSphere.center;if(aJ.setFromBufferAttribute(J),Q)for(let W=0,Y=Q.length;W<Y;W++){let X=Q[W];if(T6.setFromBufferAttribute(X),this.morphTargetsRelative)AJ.addVectors(aJ.min,T6.min),aJ.expandByPoint(AJ),AJ.addVectors(aJ.max,T6.max),aJ.expandByPoint(AJ);else aJ.expandByPoint(T6.min),aJ.expandByPoint(T6.max)}aJ.getCenter($);let Z=0;for(let W=0,Y=J.count;W<Y;W++)AJ.fromBufferAttribute(J,W),Z=Math.max(Z,$.distanceToSquared(AJ));if(Q)for(let W=0,Y=Q.length;W<Y;W++){let X=Q[W],K=this.morphTargetsRelative;for(let H=0,U=X.count;H<U;H++){if(AJ.fromBufferAttribute(X,H),K)i8.fromBufferAttribute(J,H),AJ.add(i8);Z=Math.max(Z,$.distanceToSquared(AJ))}}if(this.boundingSphere.radius=Math.sqrt(Z),isNaN(this.boundingSphere.radius))A0('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let J=this.index,Q=this.attributes;if(J===null||Q.position===void 0||Q.normal===void 0||Q.uv===void 0){A0("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let{position:$,normal:Z,uv:W}=Q;if(this.hasAttribute("tangent")===!1)this.setAttribute("tangent",new JJ(new Float32Array(4*$.count),4));let Y=this.getAttribute("tangent"),X=[],K=[];for(let V=0;V<$.count;V++)X[V]=new j,K[V]=new j;let H=new j,U=new j,G=new j,F=new p0,E=new p0,O=new p0,R=new j,C=new j;function q(V,D,B){H.fromBufferAttribute($,V),U.fromBufferAttribute($,D),G.fromBufferAttribute($,B),F.fromBufferAttribute(W,V),E.fromBufferAttribute(W,D),O.fromBufferAttribute(W,B),U.sub(H),G.sub(H),E.sub(F),O.sub(F);let A=1/(E.x*O.y-O.x*E.y);if(!isFinite(A))return;R.copy(U).multiplyScalar(O.y).addScaledVector(G,-E.y).multiplyScalar(A),C.copy(G).multiplyScalar(E.x).addScaledVector(U,-O.x).multiplyScalar(A),X[V].add(R),X[D].add(R),X[B].add(R),K[V].add(C),K[D].add(C),K[B].add(C)}let N=this.groups;if(N.length===0)N=[{start:0,count:J.count}];for(let V=0,D=N.length;V<D;++V){let B=N[V],A=B.start,z=B.count;for(let S=A,y=A+z;S<y;S+=3)q(J.getX(S+0),J.getX(S+1),J.getX(S+2))}let L=new j,M=new j,k=new j,_=new j;function P(V){k.fromBufferAttribute(Z,V),_.copy(k);let D=X[V];L.copy(D),L.sub(k.multiplyScalar(k.dot(D))).normalize(),M.crossVectors(_,D);let A=M.dot(K[V])<0?-1:1;Y.setXYZW(V,L.x,L.y,L.z,A)}for(let V=0,D=N.length;V<D;++V){let B=N[V],A=B.start,z=B.count;for(let S=A,y=A+z;S<y;S+=3)P(J.getX(S+0)),P(J.getX(S+1)),P(J.getX(S+2))}}computeVertexNormals(){let J=this.index,Q=this.getAttribute("position");if(Q!==void 0){let $=this.getAttribute("normal");if($===void 0)$=new JJ(new Float32Array(Q.count*3),3),this.setAttribute("normal",$);else for(let F=0,E=$.count;F<E;F++)$.setXYZ(F,0,0,0);let Z=new j,W=new j,Y=new j,X=new j,K=new j,H=new j,U=new j,G=new j;if(J)for(let F=0,E=J.count;F<E;F+=3){let O=J.getX(F+0),R=J.getX(F+1),C=J.getX(F+2);Z.fromBufferAttribute(Q,O),W.fromBufferAttribute(Q,R),Y.fromBufferAttribute(Q,C),U.subVectors(Y,W),G.subVectors(Z,W),U.cross(G),X.fromBufferAttribute($,O),K.fromBufferAttribute($,R),H.fromBufferAttribute($,C),X.add(U),K.add(U),H.add(U),$.setXYZ(O,X.x,X.y,X.z),$.setXYZ(R,K.x,K.y,K.z),$.setXYZ(C,H.x,H.y,H.z)}else for(let F=0,E=Q.count;F<E;F+=3)Z.fromBufferAttribute(Q,F+0),W.fromBufferAttribute(Q,F+1),Y.fromBufferAttribute(Q,F+2),U.subVectors(Y,W),G.subVectors(Z,W),U.cross(G),$.setXYZ(F+0,U.x,U.y,U.z),$.setXYZ(F+1,U.x,U.y,U.z),$.setXYZ(F+2,U.x,U.y,U.z);this.normalizeNormals(),$.needsUpdate=!0}}normalizeNormals(){let J=this.attributes.normal;for(let Q=0,$=J.count;Q<$;Q++)AJ.fromBufferAttribute(J,Q),AJ.normalize(),J.setXYZ(Q,AJ.x,AJ.y,AJ.z)}toNonIndexed(){function J(X,K){let{array:H,itemSize:U,normalized:G}=X,F=new H.constructor(K.length*U),E=0,O=0;for(let R=0,C=K.length;R<C;R++){if(X.isInterleavedBufferAttribute)E=K[R]*X.data.stride+X.offset;else E=K[R]*U;for(let q=0;q<U;q++)F[O++]=H[E++]}return new JJ(F,U,G)}if(this.index===null)return C0("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let Q=new RJ,$=this.index.array,Z=this.attributes;for(let X in Z){let K=Z[X],H=J(K,$);Q.setAttribute(X,H)}let W=this.morphAttributes;for(let X in W){let K=[],H=W[X];for(let U=0,G=H.length;U<G;U++){let F=H[U],E=J(F,$);K.push(E)}Q.morphAttributes[X]=K}Q.morphTargetsRelative=this.morphTargetsRelative;let Y=this.groups;for(let X=0,K=Y.length;X<K;X++){let H=Y[X];Q.addGroup(H.start,H.count,H.materialIndex)}return Q}toJSON(){let J={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(J.uuid=this.uuid,J.type=this.type,this.name!=="")J.name=this.name;if(Object.keys(this.userData).length>0)J.userData=this.userData;if(this.parameters!==void 0){let K=this.parameters;for(let H in K)if(K[H]!==void 0)J[H]=K[H];return J}J.data={attributes:{}};let Q=this.index;if(Q!==null)J.data.index={type:Q.array.constructor.name,array:Array.prototype.slice.call(Q.array)};let $=this.attributes;for(let K in $){let H=$[K];J.data.attributes[K]=H.toJSON(J.data)}let Z={},W=!1;for(let K in this.morphAttributes){let H=this.morphAttributes[K],U=[];for(let G=0,F=H.length;G<F;G++){let E=H[G];U.push(E.toJSON(J.data))}if(U.length>0)Z[K]=U,W=!0}if(W)J.data.morphAttributes=Z,J.data.morphTargetsRelative=this.morphTargetsRelative;let Y=this.groups;if(Y.length>0)J.data.groups=JSON.parse(JSON.stringify(Y));let X=this.boundingSphere;if(X!==null)J.data.boundingSphere=X.toJSON();return J}clone(){return new this.constructor().copy(this)}copy(J){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let Q={};this.name=J.name;let $=J.index;if($!==null)this.setIndex($.clone());let Z=J.attributes;for(let H in Z){let U=Z[H];this.setAttribute(H,U.clone(Q))}let W=J.morphAttributes;for(let H in W){let U=[],G=W[H];for(let F=0,E=G.length;F<E;F++)U.push(G[F].clone(Q));this.morphAttributes[H]=U}this.morphTargetsRelative=J.morphTargetsRelative;let Y=J.groups;for(let H=0,U=Y.length;H<U;H++){let G=Y[H];this.addGroup(G.start,G.count,G.materialIndex)}let X=J.boundingBox;if(X!==null)this.boundingBox=X.clone();let K=J.boundingSphere;if(K!==null)this.boundingSphere=K.clone();return this.drawRange.start=J.drawRange.start,this.drawRange.count=J.drawRange.count,this.userData=J.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class c6{constructor(J,Q){this.isInterleavedBuffer=!0,this.array=J,this.stride=Q,this.count=J!==void 0?J.length/Q:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=R9()}onUploadCallback(){}set needsUpdate(J){if(J===!0)this.version++}setUsage(J){return this.usage=J,this}addUpdateRange(J,Q){this.updateRanges.push({start:J,count:Q})}clearUpdateRanges(){this.updateRanges.length=0}copy(J){return this.array=new J.array.constructor(J.array),this.count=J.count,this.stride=J.stride,this.usage=J.usage,this}copyAt(J,Q,$){J*=this.stride,$*=Q.stride;for(let Z=0,W=this.stride;Z<W;Z++)this.array[J+Z]=Q.array[$+Z];return this}set(J,Q=0){return this.array.set(J,Q),this}clone(J){if(J.arrayBuffers===void 0)J.arrayBuffers={};if(this.array.buffer._uuid===void 0)this.array.buffer._uuid=R9();if(J.arrayBuffers[this.array.buffer._uuid]===void 0)J.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer;let Q=new this.array.constructor(J.arrayBuffers[this.array.buffer._uuid]),$=new this.constructor(Q,this.stride);return $.setUsage(this.usage),$}onUpload(J){return this.onUploadCallback=J,this}toJSON(J){if(J.arrayBuffers===void 0)J.arrayBuffers={};if(this.array.buffer._uuid===void 0)this.array.buffer._uuid=R9();if(J.arrayBuffers[this.array.buffer._uuid]===void 0)J.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer));return{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}var dJ=new j;class F6{constructor(J,Q,$,Z=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=J,this.itemSize=Q,this.offset=$,this.normalized=Z}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(J){this.data.needsUpdate=J}applyMatrix4(J){for(let Q=0,$=this.data.count;Q<$;Q++)dJ.fromBufferAttribute(this,Q),dJ.applyMatrix4(J),this.setXYZ(Q,dJ.x,dJ.y,dJ.z);return this}applyNormalMatrix(J){for(let Q=0,$=this.count;Q<$;Q++)dJ.fromBufferAttribute(this,Q),dJ.applyNormalMatrix(J),this.setXYZ(Q,dJ.x,dJ.y,dJ.z);return this}transformDirection(J){for(let Q=0,$=this.count;Q<$;Q++)dJ.fromBufferAttribute(this,Q),dJ.transformDirection(J),this.setXYZ(Q,dJ.x,dJ.y,dJ.z);return this}getComponent(J,Q){let $=this.array[J*this.data.stride+this.offset+Q];if(this.normalized)$=q9($,this.array);return $}setComponent(J,Q,$){if(this.normalized)$=$J($,this.array);return this.data.array[J*this.data.stride+this.offset+Q]=$,this}setX(J,Q){if(this.normalized)Q=$J(Q,this.array);return this.data.array[J*this.data.stride+this.offset]=Q,this}setY(J,Q){if(this.normalized)Q=$J(Q,this.array);return this.data.array[J*this.data.stride+this.offset+1]=Q,this}setZ(J,Q){if(this.normalized)Q=$J(Q,this.array);return this.data.array[J*this.data.stride+this.offset+2]=Q,this}setW(J,Q){if(this.normalized)Q=$J(Q,this.array);return this.data.array[J*this.data.stride+this.offset+3]=Q,this}getX(J){let Q=this.data.array[J*this.data.stride+this.offset];if(this.normalized)Q=q9(Q,this.array);return Q}getY(J){let Q=this.data.array[J*this.data.stride+this.offset+1];if(this.normalized)Q=q9(Q,this.array);return Q}getZ(J){let Q=this.data.array[J*this.data.stride+this.offset+2];if(this.normalized)Q=q9(Q,this.array);return Q}getW(J){let Q=this.data.array[J*this.data.stride+this.offset+3];if(this.normalized)Q=q9(Q,this.array);return Q}setXY(J,Q,$){if(J=J*this.data.stride+this.offset,this.normalized)Q=$J(Q,this.array),$=$J($,this.array);return this.data.array[J+0]=Q,this.data.array[J+1]=$,this}setXYZ(J,Q,$,Z){if(J=J*this.data.stride+this.offset,this.normalized)Q=$J(Q,this.array),$=$J($,this.array),Z=$J(Z,this.array);return this.data.array[J+0]=Q,this.data.array[J+1]=$,this.data.array[J+2]=Z,this}setXYZW(J,Q,$,Z,W){if(J=J*this.data.stride+this.offset,this.normalized)Q=$J(Q,this.array),$=$J($,this.array),Z=$J(Z,this.array),W=$J(W,this.array);return this.data.array[J+0]=Q,this.data.array[J+1]=$,this.data.array[J+2]=Z,this.data.array[J+3]=W,this}clone(J){if(J===void 0){x6("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let Q=[];for(let $=0;$<this.count;$++){let Z=$*this.data.stride+this.offset;for(let W=0;W<this.itemSize;W++)Q.push(this.data.array[Z+W])}return new JJ(new this.array.constructor(Q),this.itemSize,this.normalized)}else{if(J.interleavedBuffers===void 0)J.interleavedBuffers={};if(J.interleavedBuffers[this.data.uuid]===void 0)J.interleavedBuffers[this.data.uuid]=this.data.clone(J);return new F6(J.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}}toJSON(J){if(J===void 0){x6("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let Q=[];for(let $=0;$<this.count;$++){let Z=$*this.data.stride+this.offset;for(let W=0;W<this.itemSize;W++)Q.push(this.data.array[Z+W])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:Q,normalized:this.normalized}}else{if(J.interleavedBuffers===void 0)J.interleavedBuffers={};if(J.interleavedBuffers[this.data.uuid]===void 0)J.interleavedBuffers[this.data.uuid]=this.data.toJSON(J);return{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}}var lH=0;class eJ extends T9{constructor(){super();this.isMaterial=!0,Object.defineProperty(this,"id",{value:lH++}),this.uuid=R9(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new R0(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(J){if(this._alphaTest>0!==J>0)this.version++;this._alphaTest=J}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(J){if(J===void 0)return;for(let Q in J){let $=J[Q];if($===void 0){C0(`Material: parameter '${Q}' has value of undefined.`);continue}let Z=this[Q];if(Z===void 0){C0(`Material: '${Q}' is not a property of THREE.${this.type}.`);continue}if(Z&&Z.isColor)Z.set($);else if(Z&&Z.isVector3&&($&&$.isVector3))Z.copy($);else this[Q]=$}}toJSON(J){let Q=J===void 0||typeof J==="string";if(Q)J={textures:{},images:{}};let $={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};if($.uuid=this.uuid,$.type=this.type,this.name!=="")$.name=this.name;if(this.color&&this.color.isColor)$.color=this.color.getHex();if(this.roughness!==void 0)$.roughness=this.roughness;if(this.metalness!==void 0)$.metalness=this.metalness;if(this.sheen!==void 0)$.sheen=this.sheen;if(this.sheenColor&&this.sheenColor.isColor)$.sheenColor=this.sheenColor.getHex();if(this.sheenRoughness!==void 0)$.sheenRoughness=this.sheenRoughness;if(this.emissive&&this.emissive.isColor)$.emissive=this.emissive.getHex();if(this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1)$.emissiveIntensity=this.emissiveIntensity;if(this.specular&&this.specular.isColor)$.specular=this.specular.getHex();if(this.specularIntensity!==void 0)$.specularIntensity=this.specularIntensity;if(this.specularColor&&this.specularColor.isColor)$.specularColor=this.specularColor.getHex();if(this.shininess!==void 0)$.shininess=this.shininess;if(this.clearcoat!==void 0)$.clearcoat=this.clearcoat;if(this.clearcoatRoughness!==void 0)$.clearcoatRoughness=this.clearcoatRoughness;if(this.clearcoatMap&&this.clearcoatMap.isTexture)$.clearcoatMap=this.clearcoatMap.toJSON(J).uuid;if(this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture)$.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(J).uuid;if(this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture)$.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(J).uuid,$.clearcoatNormalScale=this.clearcoatNormalScale.toArray();if(this.sheenColorMap&&this.sheenColorMap.isTexture)$.sheenColorMap=this.sheenColorMap.toJSON(J).uuid;if(this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture)$.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(J).uuid;if(this.dispersion!==void 0)$.dispersion=this.dispersion;if(this.iridescence!==void 0)$.iridescence=this.iridescence;if(this.iridescenceIOR!==void 0)$.iridescenceIOR=this.iridescenceIOR;if(this.iridescenceThicknessRange!==void 0)$.iridescenceThicknessRange=this.iridescenceThicknessRange;if(this.iridescenceMap&&this.iridescenceMap.isTexture)$.iridescenceMap=this.iridescenceMap.toJSON(J).uuid;if(this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture)$.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(J).uuid;if(this.anisotropy!==void 0)$.anisotropy=this.anisotropy;if(this.anisotropyRotation!==void 0)$.anisotropyRotation=this.anisotropyRotation;if(this.anisotropyMap&&this.anisotropyMap.isTexture)$.anisotropyMap=this.anisotropyMap.toJSON(J).uuid;if(this.map&&this.map.isTexture)$.map=this.map.toJSON(J).uuid;if(this.matcap&&this.matcap.isTexture)$.matcap=this.matcap.toJSON(J).uuid;if(this.alphaMap&&this.alphaMap.isTexture)$.alphaMap=this.alphaMap.toJSON(J).uuid;if(this.lightMap&&this.lightMap.isTexture)$.lightMap=this.lightMap.toJSON(J).uuid,$.lightMapIntensity=this.lightMapIntensity;if(this.aoMap&&this.aoMap.isTexture)$.aoMap=this.aoMap.toJSON(J).uuid,$.aoMapIntensity=this.aoMapIntensity;if(this.bumpMap&&this.bumpMap.isTexture)$.bumpMap=this.bumpMap.toJSON(J).uuid,$.bumpScale=this.bumpScale;if(this.normalMap&&this.normalMap.isTexture)$.normalMap=this.normalMap.toJSON(J).uuid,$.normalMapType=this.normalMapType,$.normalScale=this.normalScale.toArray();if(this.displacementMap&&this.displacementMap.isTexture)$.displacementMap=this.displacementMap.toJSON(J).uuid,$.displacementScale=this.displacementScale,$.displacementBias=this.displacementBias;if(this.roughnessMap&&this.roughnessMap.isTexture)$.roughnessMap=this.roughnessMap.toJSON(J).uuid;if(this.metalnessMap&&this.metalnessMap.isTexture)$.metalnessMap=this.metalnessMap.toJSON(J).uuid;if(this.emissiveMap&&this.emissiveMap.isTexture)$.emissiveMap=this.emissiveMap.toJSON(J).uuid;if(this.specularMap&&this.specularMap.isTexture)$.specularMap=this.specularMap.toJSON(J).uuid;if(this.specularIntensityMap&&this.specularIntensityMap.isTexture)$.specularIntensityMap=this.specularIntensityMap.toJSON(J).uuid;if(this.specularColorMap&&this.specularColorMap.isTexture)$.specularColorMap=this.specularColorMap.toJSON(J).uuid;if(this.envMap&&this.envMap.isTexture){if($.envMap=this.envMap.toJSON(J).uuid,this.combine!==void 0)$.combine=this.combine}if(this.envMapRotation!==void 0)$.envMapRotation=this.envMapRotation.toArray();if(this.envMapIntensity!==void 0)$.envMapIntensity=this.envMapIntensity;if(this.reflectivity!==void 0)$.reflectivity=this.reflectivity;if(this.refractionRatio!==void 0)$.refractionRatio=this.refractionRatio;if(this.gradientMap&&this.gradientMap.isTexture)$.gradientMap=this.gradientMap.toJSON(J).uuid;if(this.transmission!==void 0)$.transmission=this.transmission;if(this.transmissionMap&&this.transmissionMap.isTexture)$.transmissionMap=this.transmissionMap.toJSON(J).uuid;if(this.thickness!==void 0)$.thickness=this.thickness;if(this.thicknessMap&&this.thicknessMap.isTexture)$.thicknessMap=this.thicknessMap.toJSON(J).uuid;if(this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0)$.attenuationDistance=this.attenuationDistance;if(this.attenuationColor!==void 0)$.attenuationColor=this.attenuationColor.getHex();if(this.size!==void 0)$.size=this.size;if(this.shadowSide!==null)$.shadowSide=this.shadowSide;if(this.sizeAttenuation!==void 0)$.sizeAttenuation=this.sizeAttenuation;if(this.blending!==1)$.blending=this.blending;if(this.side!==0)$.side=this.side;if(this.vertexColors===!0)$.vertexColors=!0;if(this.opacity<1)$.opacity=this.opacity;if(this.transparent===!0)$.transparent=!0;if(this.blendSrc!==204)$.blendSrc=this.blendSrc;if(this.blendDst!==205)$.blendDst=this.blendDst;if(this.blendEquation!==100)$.blendEquation=this.blendEquation;if(this.blendSrcAlpha!==null)$.blendSrcAlpha=this.blendSrcAlpha;if(this.blendDstAlpha!==null)$.blendDstAlpha=this.blendDstAlpha;if(this.blendEquationAlpha!==null)$.blendEquationAlpha=this.blendEquationAlpha;if(this.blendColor&&this.blendColor.isColor)$.blendColor=this.blendColor.getHex();if(this.blendAlpha!==0)$.blendAlpha=this.blendAlpha;if(this.depthFunc!==3)$.depthFunc=this.depthFunc;if(this.depthTest===!1)$.depthTest=this.depthTest;if(this.depthWrite===!1)$.depthWrite=this.depthWrite;if(this.colorWrite===!1)$.colorWrite=this.colorWrite;if(this.stencilWriteMask!==255)$.stencilWriteMask=this.stencilWriteMask;if(this.stencilFunc!==519)$.stencilFunc=this.stencilFunc;if(this.stencilRef!==0)$.stencilRef=this.stencilRef;if(this.stencilFuncMask!==255)$.stencilFuncMask=this.stencilFuncMask;if(this.stencilFail!==7680)$.stencilFail=this.stencilFail;if(this.stencilZFail!==7680)$.stencilZFail=this.stencilZFail;if(this.stencilZPass!==7680)$.stencilZPass=this.stencilZPass;if(this.stencilWrite===!0)$.stencilWrite=this.stencilWrite;if(this.rotation!==void 0&&this.rotation!==0)$.rotation=this.rotation;if(this.polygonOffset===!0)$.polygonOffset=!0;if(this.polygonOffsetFactor!==0)$.polygonOffsetFactor=this.polygonOffsetFactor;if(this.polygonOffsetUnits!==0)$.polygonOffsetUnits=this.polygonOffsetUnits;if(this.linewidth!==void 0&&this.linewidth!==1)$.linewidth=this.linewidth;if(this.dashSize!==void 0)$.dashSize=this.dashSize;if(this.gapSize!==void 0)$.gapSize=this.gapSize;if(this.scale!==void 0)$.scale=this.scale;if(this.dithering===!0)$.dithering=!0;if(this.alphaTest>0)$.alphaTest=this.alphaTest;if(this.alphaHash===!0)$.alphaHash=!0;if(this.alphaToCoverage===!0)$.alphaToCoverage=!0;if(this.premultipliedAlpha===!0)$.premultipliedAlpha=!0;if(this.forceSinglePass===!0)$.forceSinglePass=!0;if(this.allowOverride===!1)$.allowOverride=!1;if(this.wireframe===!0)$.wireframe=!0;if(this.wireframeLinewidth>1)$.wireframeLinewidth=this.wireframeLinewidth;if(this.wireframeLinecap!=="round")$.wireframeLinecap=this.wireframeLinecap;if(this.wireframeLinejoin!=="round")$.wireframeLinejoin=this.wireframeLinejoin;if(this.flatShading===!0)$.flatShading=!0;if(this.visible===!1)$.visible=!1;if(this.toneMapped===!1)$.toneMapped=!1;if(this.fog===!1)$.fog=!1;if(Object.keys(this.userData).length>0)$.userData=this.userData;function Z(W){let Y=[];for(let X in W){let K=W[X];delete K.metadata,Y.push(K)}return Y}if(Q){let W=Z(J.textures),Y=Z(J.images);if(W.length>0)$.textures=W;if(Y.length>0)$.images=Y}return $}clone(){return new this.constructor().copy(this)}copy(J){this.name=J.name,this.blending=J.blending,this.side=J.side,this.vertexColors=J.vertexColors,this.opacity=J.opacity,this.transparent=J.transparent,this.blendSrc=J.blendSrc,this.blendDst=J.blendDst,this.blendEquation=J.blendEquation,this.blendSrcAlpha=J.blendSrcAlpha,this.blendDstAlpha=J.blendDstAlpha,this.blendEquationAlpha=J.blendEquationAlpha,this.blendColor.copy(J.blendColor),this.blendAlpha=J.blendAlpha,this.depthFunc=J.depthFunc,this.depthTest=J.depthTest,this.depthWrite=J.depthWrite,this.stencilWriteMask=J.stencilWriteMask,this.stencilFunc=J.stencilFunc,this.stencilRef=J.stencilRef,this.stencilFuncMask=J.stencilFuncMask,this.stencilFail=J.stencilFail,this.stencilZFail=J.stencilZFail,this.stencilZPass=J.stencilZPass,this.stencilWrite=J.stencilWrite;let Q=J.clippingPlanes,$=null;if(Q!==null){let Z=Q.length;$=Array(Z);for(let W=0;W!==Z;++W)$[W]=Q[W].clone()}return this.clippingPlanes=$,this.clipIntersection=J.clipIntersection,this.clipShadows=J.clipShadows,this.shadowSide=J.shadowSide,this.colorWrite=J.colorWrite,this.precision=J.precision,this.polygonOffset=J.polygonOffset,this.polygonOffsetFactor=J.polygonOffsetFactor,this.polygonOffsetUnits=J.polygonOffsetUnits,this.dithering=J.dithering,this.alphaTest=J.alphaTest,this.alphaHash=J.alphaHash,this.alphaToCoverage=J.alphaToCoverage,this.premultipliedAlpha=J.premultipliedAlpha,this.forceSinglePass=J.forceSinglePass,this.allowOverride=J.allowOverride,this.visible=J.visible,this.toneMapped=J.toneMapped,this.userData=JSON.parse(JSON.stringify(J.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(J){if(J===!0)this.version++}}var p9=new j,tQ=new j,k7=new j,W8=new j,eQ=new j,B7=new j,J$=new j;class N6{constructor(J=new j,Q=new j(0,0,-1)){this.origin=J,this.direction=Q}set(J,Q){return this.origin.copy(J),this.direction.copy(Q),this}copy(J){return this.origin.copy(J.origin),this.direction.copy(J.direction),this}at(J,Q){return Q.copy(this.origin).addScaledVector(this.direction,J)}lookAt(J){return this.direction.copy(J).sub(this.origin).normalize(),this}recast(J){return this.origin.copy(this.at(J,p9)),this}closestPointToPoint(J,Q){Q.subVectors(J,this.origin);let $=Q.dot(this.direction);if($<0)return Q.copy(this.origin);return Q.copy(this.origin).addScaledVector(this.direction,$)}distanceToPoint(J){return Math.sqrt(this.distanceSqToPoint(J))}distanceSqToPoint(J){let Q=p9.subVectors(J,this.origin).dot(this.direction);if(Q<0)return this.origin.distanceToSquared(J);return p9.copy(this.origin).addScaledVector(this.direction,Q),p9.distanceToSquared(J)}distanceSqToSegment(J,Q,$,Z){tQ.copy(J).add(Q).multiplyScalar(0.5),k7.copy(Q).sub(J).normalize(),W8.copy(this.origin).sub(tQ);let W=J.distanceTo(Q)*0.5,Y=-this.direction.dot(k7),X=W8.dot(this.direction),K=-W8.dot(k7),H=W8.lengthSq(),U=Math.abs(1-Y*Y),G,F,E,O;if(U>0)if(G=Y*K-X,F=Y*X-K,O=W*U,G>=0)if(F>=-O)if(F<=O){let R=1/U;G*=R,F*=R,E=G*(G+Y*F+2*X)+F*(Y*G+F+2*K)+H}else F=W,G=Math.max(0,-(Y*F+X)),E=-G*G+F*(F+2*K)+H;else F=-W,G=Math.max(0,-(Y*F+X)),E=-G*G+F*(F+2*K)+H;else if(F<=-O)G=Math.max(0,-(-Y*W+X)),F=G>0?-W:Math.min(Math.max(-W,-K),W),E=-G*G+F*(F+2*K)+H;else if(F<=O)G=0,F=Math.min(Math.max(-W,-K),W),E=F*(F+2*K)+H;else G=Math.max(0,-(Y*W+X)),F=G>0?W:Math.min(Math.max(-W,-K),W),E=-G*G+F*(F+2*K)+H;else F=Y>0?-W:W,G=Math.max(0,-(Y*F+X)),E=-G*G+F*(F+2*K)+H;if($)$.copy(this.origin).addScaledVector(this.direction,G);if(Z)Z.copy(tQ).addScaledVector(k7,F);return E}intersectSphere(J,Q){p9.subVectors(J.center,this.origin);let $=p9.dot(this.direction),Z=p9.dot(p9)-$*$,W=J.radius*J.radius;if(Z>W)return null;let Y=Math.sqrt(W-Z),X=$-Y,K=$+Y;if(K<0)return null;if(X<0)return this.at(K,Q);return this.at(X,Q)}intersectsSphere(J){if(J.radius<0)return!1;return this.distanceSqToPoint(J.center)<=J.radius*J.radius}distanceToPlane(J){let Q=J.normal.dot(this.direction);if(Q===0){if(J.distanceToPoint(this.origin)===0)return 0;return null}let $=-(this.origin.dot(J.normal)+J.constant)/Q;return $>=0?$:null}intersectPlane(J,Q){let $=this.distanceToPlane(J);if($===null)return null;return this.at($,Q)}intersectsPlane(J){let Q=J.distanceToPoint(this.origin);if(Q===0)return!0;if(J.normal.dot(this.direction)*Q<0)return!0;return!1}intersectBox(J,Q){let $,Z,W,Y,X,K,H=1/this.direction.x,U=1/this.direction.y,G=1/this.direction.z,F=this.origin;if(H>=0)$=(J.min.x-F.x)*H,Z=(J.max.x-F.x)*H;else $=(J.max.x-F.x)*H,Z=(J.min.x-F.x)*H;if(U>=0)W=(J.min.y-F.y)*U,Y=(J.max.y-F.y)*U;else W=(J.max.y-F.y)*U,Y=(J.min.y-F.y)*U;if($>Y||W>Z)return null;if(W>$||isNaN($))$=W;if(Y<Z||isNaN(Z))Z=Y;if(G>=0)X=(J.min.z-F.z)*G,K=(J.max.z-F.z)*G;else X=(J.max.z-F.z)*G,K=(J.min.z-F.z)*G;if($>K||X>Z)return null;if(X>$||$!==$)$=X;if(K<Z||Z!==Z)Z=K;if(Z<0)return null;return this.at($>=0?$:Z,Q)}intersectsBox(J){return this.intersectBox(J,p9)!==null}intersectTriangle(J,Q,$,Z,W){eQ.subVectors(Q,J),B7.subVectors($,J),J$.crossVectors(eQ,B7);let Y=this.direction.dot(J$),X;if(Y>0){if(Z)return null;X=1}else if(Y<0)X=-1,Y=-Y;else return null;W8.subVectors(this.origin,J);let K=X*this.direction.dot(B7.crossVectors(W8,B7));if(K<0)return null;let H=X*this.direction.dot(eQ.cross(W8));if(H<0)return null;if(K+H>Y)return null;let U=-X*W8.dot(J$);if(U<0)return null;return this.at(U/Y,W)}applyMatrix4(J){return this.origin.applyMatrix4(J),this.direction.transformDirection(J),this}equals(J){return J.origin.equals(this.origin)&&J.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class A9 extends eJ{constructor(J){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new R0(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new l9,this.combine=0,this.reflectivity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.specularMap=J.specularMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.combine=J.combine,this.reflectivity=J.reflectivity,this.refractionRatio=J.refractionRatio,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.fog=J.fog,this}}var SW=new S0,D8=new N6,V7=new mJ,jW=new j,C7=new j,I7=new j,z7=new j,Q$=new j,w7=new j,vW=new j,P7=new j;class GJ extends FJ{constructor(J=new RJ,Q=new A9){super();this.isMesh=!0,this.type="Mesh",this.geometry=J,this.material=Q,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(J,Q){if(super.copy(J,Q),J.morphTargetInfluences!==void 0)this.morphTargetInfluences=J.morphTargetInfluences.slice();if(J.morphTargetDictionary!==void 0)this.morphTargetDictionary=Object.assign({},J.morphTargetDictionary);return this.material=Array.isArray(J.material)?J.material.slice():J.material,this.geometry=J.geometry,this}updateMorphTargets(){let Q=this.geometry.morphAttributes,$=Object.keys(Q);if($.length>0){let Z=Q[$[0]];if(Z!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let W=0,Y=Z.length;W<Y;W++){let X=Z[W].name||String(W);this.morphTargetInfluences.push(0),this.morphTargetDictionary[X]=W}}}}getVertexPosition(J,Q){let $=this.geometry,Z=$.attributes.position,W=$.morphAttributes.position,Y=$.morphTargetsRelative;Q.fromBufferAttribute(Z,J);let X=this.morphTargetInfluences;if(W&&X){w7.set(0,0,0);for(let K=0,H=W.length;K<H;K++){let U=X[K],G=W[K];if(U===0)continue;if(Q$.fromBufferAttribute(G,J),Y)w7.addScaledVector(Q$,U);else w7.addScaledVector(Q$.sub(Q),U)}Q.add(w7)}return Q}raycast(J,Q){let $=this.geometry,Z=this.material,W=this.matrixWorld;if(Z===void 0)return;if($.boundingSphere===null)$.computeBoundingSphere();if(V7.copy($.boundingSphere),V7.applyMatrix4(W),D8.copy(J.ray).recast(J.near),V7.containsPoint(D8.origin)===!1){if(D8.intersectSphere(V7,jW)===null)return;if(D8.origin.distanceToSquared(jW)>(J.far-J.near)**2)return}if(SW.copy(W).invert(),D8.copy(J.ray).applyMatrix4(SW),$.boundingBox!==null){if(D8.intersectsBox($.boundingBox)===!1)return}this._computeIntersections(J,Q,D8)}_computeIntersections(J,Q,$){let Z,W=this.geometry,Y=this.material,X=W.index,K=W.attributes.position,H=W.attributes.uv,U=W.attributes.uv1,G=W.attributes.normal,F=W.groups,E=W.drawRange;if(X!==null)if(Array.isArray(Y))for(let O=0,R=F.length;O<R;O++){let C=F[O],q=Y[C.materialIndex],N=Math.max(C.start,E.start),L=Math.min(X.count,Math.min(C.start+C.count,E.start+E.count));for(let M=N,k=L;M<k;M+=3){let _=X.getX(M),P=X.getX(M+1),V=X.getX(M+2);if(Z=_7(this,q,J,$,H,U,G,_,P,V),Z)Z.faceIndex=Math.floor(M/3),Z.face.materialIndex=C.materialIndex,Q.push(Z)}}else{let O=Math.max(0,E.start),R=Math.min(X.count,E.start+E.count);for(let C=O,q=R;C<q;C+=3){let N=X.getX(C),L=X.getX(C+1),M=X.getX(C+2);if(Z=_7(this,Y,J,$,H,U,G,N,L,M),Z)Z.faceIndex=Math.floor(C/3),Q.push(Z)}}else if(K!==void 0)if(Array.isArray(Y))for(let O=0,R=F.length;O<R;O++){let C=F[O],q=Y[C.materialIndex],N=Math.max(C.start,E.start),L=Math.min(K.count,Math.min(C.start+C.count,E.start+E.count));for(let M=N,k=L;M<k;M+=3){let _=M,P=M+1,V=M+2;if(Z=_7(this,q,J,$,H,U,G,_,P,V),Z)Z.faceIndex=Math.floor(M/3),Z.face.materialIndex=C.materialIndex,Q.push(Z)}}else{let O=Math.max(0,E.start),R=Math.min(K.count,E.start+E.count);for(let C=O,q=R;C<q;C+=3){let N=C,L=C+1,M=C+2;if(Z=_7(this,Y,J,$,H,U,G,N,L,M),Z)Z.faceIndex=Math.floor(C/3),Q.push(Z)}}}}function cH(J,Q,$,Z,W,Y,X,K){let H;if(Q.side===1)H=Z.intersectTriangle(X,Y,W,!0,K);else H=Z.intersectTriangle(W,Y,X,Q.side===0,K);if(H===null)return null;P7.copy(K),P7.applyMatrix4(J.matrixWorld);let U=$.ray.origin.distanceTo(P7);if(U<$.near||U>$.far)return null;return{distance:U,point:P7.clone(),object:J}}function _7(J,Q,$,Z,W,Y,X,K,H,U){J.getVertexPosition(K,C7),J.getVertexPosition(H,I7),J.getVertexPosition(U,z7);let G=cH(J,Q,$,Z,C7,I7,z7,vW);if(G){let F=new j;if(Z9.getBarycoord(vW,C7,I7,z7,F),W)G.uv=Z9.getInterpolatedAttribute(W,K,H,U,F,new p0);if(Y)G.uv1=Z9.getInterpolatedAttribute(Y,K,H,U,F,new p0);if(X){if(G.normal=Z9.getInterpolatedAttribute(X,K,H,U,F,new j),G.normal.dot(Z.direction)>0)G.normal.multiplyScalar(-1)}let E={a:K,b:H,c:U,normal:new j,materialIndex:0};Z9.getNormal(C7,I7,z7,E.normal),G.face=E,G.barycoord=F}return G}var A6=new QJ,yW=new QJ,hW=new QJ,nH=new QJ,xW=new S0,T7=new j,$$=new mJ,bW=new S0,Z$=new N6;class XQ extends GJ{constructor(J,Q){super(J,Q);this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new S0,this.bindMatrixInverse=new S0,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let J=this.geometry;if(this.boundingBox===null)this.boundingBox=new sJ;this.boundingBox.makeEmpty();let Q=J.getAttribute("position");for(let $=0;$<Q.count;$++)this.getVertexPosition($,T7),this.boundingBox.expandByPoint(T7)}computeBoundingSphere(){let J=this.geometry;if(this.boundingSphere===null)this.boundingSphere=new mJ;this.boundingSphere.makeEmpty();let Q=J.getAttribute("position");for(let $=0;$<Q.count;$++)this.getVertexPosition($,T7),this.boundingSphere.expandByPoint(T7)}copy(J,Q){if(super.copy(J,Q),this.bindMode=J.bindMode,this.bindMatrix.copy(J.bindMatrix),this.bindMatrixInverse.copy(J.bindMatrixInverse),this.skeleton=J.skeleton,J.boundingBox!==null)this.boundingBox=J.boundingBox.clone();if(J.boundingSphere!==null)this.boundingSphere=J.boundingSphere.clone();return this}raycast(J,Q){let $=this.material,Z=this.matrixWorld;if($===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if($$.copy(this.boundingSphere),$$.applyMatrix4(Z),J.ray.intersectsSphere($$)===!1)return;if(bW.copy(Z).invert(),Z$.copy(J.ray).applyMatrix4(bW),this.boundingBox!==null){if(Z$.intersectsBox(this.boundingBox)===!1)return}this._computeIntersections(J,Q,Z$)}getVertexPosition(J,Q){return super.getVertexPosition(J,Q),this.applyBoneTransform(J,Q),Q}bind(J,Q){if(this.skeleton=J,Q===void 0)this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),Q=this.matrixWorld;this.bindMatrix.copy(Q),this.bindMatrixInverse.copy(Q).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let J=new QJ,Q=this.geometry.attributes.skinWeight;for(let $=0,Z=Q.count;$<Z;$++){J.fromBufferAttribute(Q,$);let W=1/J.manhattanLength();if(W!==1/0)J.multiplyScalar(W);else J.set(1,0,0,0);Q.setXYZW($,J.x,J.y,J.z,J.w)}}updateMatrixWorld(J){if(super.updateMatrixWorld(J),this.bindMode==="attached")this.bindMatrixInverse.copy(this.matrixWorld).invert();else if(this.bindMode==="detached")this.bindMatrixInverse.copy(this.bindMatrix).invert();else C0("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(J,Q){let $=this.skeleton,Z=this.geometry;if(yW.fromBufferAttribute(Z.attributes.skinIndex,J),hW.fromBufferAttribute(Z.attributes.skinWeight,J),Q.isVector4)A6.copy(Q),Q.set(0,0,0,0);else A6.set(...Q,1),Q.set(0,0,0);A6.applyMatrix4(this.bindMatrix);for(let W=0;W<4;W++){let Y=hW.getComponent(W);if(Y!==0){let X=yW.getComponent(W);xW.multiplyMatrices($.bones[X].matrixWorld,$.boneInverses[X]),Q.addScaledVector(nH.copy(A6).applyMatrix4(xW),Y)}}if(Q.isVector4)Q.w=A6.w;return Q.applyMatrix4(this.bindMatrixInverse)}}class n6 extends FJ{constructor(){super();this.isBone=!0,this.type="Bone"}}class O6 extends wJ{constructor(J=null,Q=1,$=1,Z,W,Y,X,K,H=1003,U=1003,G,F){super(null,Y,X,K,H,U,Z,W,G,F);this.isDataTexture=!0,this.image={data:J,width:Q,height:$},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}var fW=new S0,sH=new S0;class s6{constructor(J=[],Q=[]){this.uuid=R9(),this.bones=J.slice(0),this.boneInverses=Q,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){let J=this.bones,Q=this.boneInverses;if(this.boneMatrices=new Float32Array(J.length*16),Q.length===0)this.calculateInverses();else if(J.length!==Q.length){C0("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let $=0,Z=this.bones.length;$<Z;$++)this.boneInverses.push(new S0)}}calculateInverses(){this.boneInverses.length=0;for(let J=0,Q=this.bones.length;J<Q;J++){let $=new S0;if(this.bones[J])$.copy(this.bones[J].matrixWorld).invert();this.boneInverses.push($)}}pose(){for(let J=0,Q=this.bones.length;J<Q;J++){let $=this.bones[J];if($)$.matrixWorld.copy(this.boneInverses[J]).invert()}for(let J=0,Q=this.bones.length;J<Q;J++){let $=this.bones[J];if($){if($.parent&&$.parent.isBone)$.matrix.copy($.parent.matrixWorld).invert(),$.matrix.multiply($.matrixWorld);else $.matrix.copy($.matrixWorld);$.matrix.decompose($.position,$.quaternion,$.scale)}}}update(){let J=this.bones,Q=this.boneInverses,$=this.boneMatrices,Z=this.boneTexture;for(let W=0,Y=J.length;W<Y;W++){let X=J[W]?J[W].matrixWorld:sH;fW.multiplyMatrices(X,Q[W]),fW.toArray($,W*16)}if(Z!==null)Z.needsUpdate=!0}clone(){return new s6(this.bones,this.boneInverses)}computeBoneTexture(){let J=Math.sqrt(this.bones.length*4);J=Math.ceil(J/4)*4,J=Math.max(J,4);let Q=new Float32Array(J*J*4);Q.set(this.boneMatrices);let $=new O6(Q,J,J,1023,1015);return $.needsUpdate=!0,this.boneMatrices=Q,this.boneTexture=$,this}getBoneByName(J){for(let Q=0,$=this.bones.length;Q<$;Q++){let Z=this.bones[Q];if(Z.name===J)return Z}return}dispose(){if(this.boneTexture!==null)this.boneTexture.dispose(),this.boneTexture=null}fromJSON(J,Q){this.uuid=J.uuid;for(let $=0,Z=J.bones.length;$<Z;$++){let W=J.bones[$],Y=Q[W];if(Y===void 0)C0("Skeleton: No bone found with UUID:",W),Y=new n6;this.bones.push(Y),this.boneInverses.push(new S0().fromArray(J.boneInverses[$]))}return this.init(),this}toJSON(){let J={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};J.uuid=this.uuid;let Q=this.bones,$=this.boneInverses;for(let Z=0,W=Q.length;Z<W;Z++){let Y=Q[Z];J.bones.push(Y.uuid);let X=$[Z];J.boneInverses.push(X.toArray())}return J}}class B8 extends JJ{constructor(J,Q,$,Z=1){super(J,Q,$);this.isInstancedBufferAttribute=!0,this.meshPerAttribute=Z}copy(J){return super.copy(J),this.meshPerAttribute=J.meshPerAttribute,this}toJSON(){let J=super.toJSON();return J.meshPerAttribute=this.meshPerAttribute,J.isInstancedBufferAttribute=!0,J}}var o8=new S0,gW=new S0,A7=[],pW=new sJ,iH=new S0,S6=new GJ,j6=new mJ;class q6 extends GJ{constructor(J,Q,$){super(J,Q);this.isInstancedMesh=!0,this.instanceMatrix=new B8(new Float32Array($*16),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=$,this.boundingBox=null,this.boundingSphere=null;for(let Z=0;Z<$;Z++)this.setMatrixAt(Z,iH)}computeBoundingBox(){let J=this.geometry,Q=this.count;if(this.boundingBox===null)this.boundingBox=new sJ;if(J.boundingBox===null)J.computeBoundingBox();this.boundingBox.makeEmpty();for(let $=0;$<Q;$++)this.getMatrixAt($,o8),pW.copy(J.boundingBox).applyMatrix4(o8),this.boundingBox.union(pW)}computeBoundingSphere(){let J=this.geometry,Q=this.count;if(this.boundingSphere===null)this.boundingSphere=new mJ;if(J.boundingSphere===null)J.computeBoundingSphere();this.boundingSphere.makeEmpty();for(let $=0;$<Q;$++)this.getMatrixAt($,o8),j6.copy(J.boundingSphere).applyMatrix4(o8),this.boundingSphere.union(j6)}copy(J,Q){if(super.copy(J,Q),this.instanceMatrix.copy(J.instanceMatrix),J.previousInstanceMatrix!==null)this.previousInstanceMatrix=J.previousInstanceMatrix.clone();if(J.morphTexture!==null)this.morphTexture=J.morphTexture.clone();if(J.instanceColor!==null)this.instanceColor=J.instanceColor.clone();if(this.count=J.count,J.boundingBox!==null)this.boundingBox=J.boundingBox.clone();if(J.boundingSphere!==null)this.boundingSphere=J.boundingSphere.clone();return this}getColorAt(J,Q){if(this.instanceColor===null)return Q.setRGB(1,1,1);else return Q.fromArray(this.instanceColor.array,J*3)}getMatrixAt(J,Q){return Q.fromArray(this.instanceMatrix.array,J*16)}getMorphAt(J,Q){let $=Q.morphTargetInfluences,Z=this.morphTexture.source.data.data,W=$.length+1,Y=J*W+1;for(let X=0;X<$.length;X++)$[X]=Z[Y+X]}raycast(J,Q){let $=this.matrixWorld,Z=this.count;if(S6.geometry=this.geometry,S6.material=this.material,S6.material===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(j6.copy(this.boundingSphere),j6.applyMatrix4($),J.ray.intersectsSphere(j6)===!1)return;for(let W=0;W<Z;W++){this.getMatrixAt(W,o8),gW.multiplyMatrices($,o8),S6.matrixWorld=gW,S6.raycast(J,A7);for(let Y=0,X=A7.length;Y<X;Y++){let K=A7[Y];K.instanceId=W,K.object=this,Q.push(K)}A7.length=0}}setColorAt(J,Q){if(this.instanceColor===null)this.instanceColor=new B8(new Float32Array(this.instanceMatrix.count*3).fill(1),3);return Q.toArray(this.instanceColor.array,J*3),this}setMatrixAt(J,Q){return Q.toArray(this.instanceMatrix.array,J*16),this}setMorphAt(J,Q){let $=Q.morphTargetInfluences,Z=$.length+1;if(this.morphTexture===null)this.morphTexture=new O6(new Float32Array(Z*this.count),Z,this.count,1028,1015);let W=this.morphTexture.source.data.data,Y=0;for(let H=0;H<$.length;H++)Y+=$[H];let X=this.geometry.morphTargetsRelative?1:1-Y,K=Z*J;return W[K]=X,W.set($,K+1),this}updateMorphTargets(){}dispose(){if(this.dispatchEvent({type:"dispose"}),this.morphTexture!==null)this.morphTexture.dispose(),this.morphTexture=null}}var W$=new j,oH=new j,aH=new h0;class O9{constructor(J=new j(1,0,0),Q=0){this.isPlane=!0,this.normal=J,this.constant=Q}set(J,Q){return this.normal.copy(J),this.constant=Q,this}setComponents(J,Q,$,Z){return this.normal.set(J,Q,$),this.constant=Z,this}setFromNormalAndCoplanarPoint(J,Q){return this.normal.copy(J),this.constant=-Q.dot(this.normal),this}setFromCoplanarPoints(J,Q,$){let Z=W$.subVectors($,Q).cross(oH.subVectors(J,Q)).normalize();return this.setFromNormalAndCoplanarPoint(Z,J),this}copy(J){return this.normal.copy(J.normal),this.constant=J.constant,this}normalize(){let J=1/this.normal.length();return this.normal.multiplyScalar(J),this.constant*=J,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(J){return this.normal.dot(J)+this.constant}distanceToSphere(J){return this.distanceToPoint(J.center)-J.radius}projectPoint(J,Q){return Q.copy(J).addScaledVector(this.normal,-this.distanceToPoint(J))}intersectLine(J,Q,$=!0){let Z=J.delta(W$),W=this.normal.dot(Z);if(W===0){if(this.distanceToPoint(J.start)===0)return Q.copy(J.start);return null}let Y=-(J.start.dot(this.normal)+this.constant)/W;if($===!0&&(Y<0||Y>1))return null;return Q.copy(J.start).addScaledVector(Z,Y)}intersectsLine(J){let Q=this.distanceToPoint(J.start),$=this.distanceToPoint(J.end);return Q<0&&$>0||$<0&&Q>0}intersectsBox(J){return J.intersectsPlane(this)}intersectsSphere(J){return J.intersectsPlane(this)}coplanarPoint(J){return J.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(J,Q){let $=Q||aH.getNormalMatrix(J),Z=this.coplanarPoint(W$).applyMatrix4(J),W=this.normal.applyMatrix3($).normalize();return this.constant=-Z.dot(W),this}translate(J){return this.constant-=J.dot(this.normal),this}equals(J){return J.normal.equals(this.normal)&&J.constant===this.constant}clone(){return new this.constructor().copy(this)}}var M8=new mJ,rH=new p0(0.5,0.5),S7=new j;class A8{constructor(J=new O9,Q=new O9,$=new O9,Z=new O9,W=new O9,Y=new O9){this.planes=[J,Q,$,Z,W,Y]}set(J,Q,$,Z,W,Y){let X=this.planes;return X[0].copy(J),X[1].copy(Q),X[2].copy($),X[3].copy(Z),X[4].copy(W),X[5].copy(Y),this}copy(J){let Q=this.planes;for(let $=0;$<6;$++)Q[$].copy(J.planes[$]);return this}setFromProjectionMatrix(J,Q=2000,$=!1){let Z=this.planes,W=J.elements,Y=W[0],X=W[1],K=W[2],H=W[3],U=W[4],G=W[5],F=W[6],E=W[7],O=W[8],R=W[9],C=W[10],q=W[11],N=W[12],L=W[13],M=W[14],k=W[15];if(Z[0].setComponents(H-Y,E-U,q-O,k-N).normalize(),Z[1].setComponents(H+Y,E+U,q+O,k+N).normalize(),Z[2].setComponents(H+X,E+G,q+R,k+L).normalize(),Z[3].setComponents(H-X,E-G,q-R,k-L).normalize(),$)Z[4].setComponents(K,F,C,M).normalize(),Z[5].setComponents(H-K,E-F,q-C,k-M).normalize();else if(Z[4].setComponents(H-K,E-F,q-C,k-M).normalize(),Q===2000)Z[5].setComponents(H+K,E+F,q+C,k+M).normalize();else if(Q===2001)Z[5].setComponents(K,F,C,M).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+Q);return this}intersectsObject(J){if(J.boundingSphere!==void 0){if(J.boundingSphere===null)J.computeBoundingSphere();M8.copy(J.boundingSphere).applyMatrix4(J.matrixWorld)}else{let Q=J.geometry;if(Q.boundingSphere===null)Q.computeBoundingSphere();M8.copy(Q.boundingSphere).applyMatrix4(J.matrixWorld)}return this.intersectsSphere(M8)}intersectsSprite(J){M8.center.set(0,0,0);let Q=rH.distanceTo(J.center);return M8.radius=0.7071067811865476+Q,M8.applyMatrix4(J.matrixWorld),this.intersectsSphere(M8)}intersectsSphere(J){let Q=this.planes,$=J.center,Z=-J.radius;for(let W=0;W<6;W++)if(Q[W].distanceToPoint($)<Z)return!1;return!0}intersectsBox(J){let Q=this.planes;for(let $=0;$<6;$++){let Z=Q[$];if(S7.x=Z.normal.x>0?J.max.x:J.min.x,S7.y=Z.normal.y>0?J.max.y:J.min.y,S7.z=Z.normal.z>0?J.max.z:J.min.z,Z.distanceToPoint(S7)<0)return!1}return!0}containsPoint(J){let Q=this.planes;for(let $=0;$<6;$++)if(Q[$].distanceToPoint(J)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class i6 extends eJ{constructor(J){super();this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new R0(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.linewidth=J.linewidth,this.linecap=J.linecap,this.linejoin=J.linejoin,this.fog=J.fog,this}}var p7=new j,d7=new j,dW=new S0,v6=new N6,j7=new mJ,Y$=new j,uW=new j;class R6 extends FJ{constructor(J=new RJ,Q=new i6){super();this.isLine=!0,this.type="Line",this.geometry=J,this.material=Q,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(J,Q){return super.copy(J,Q),this.material=Array.isArray(J.material)?J.material.slice():J.material,this.geometry=J.geometry,this}computeLineDistances(){let J=this.geometry;if(J.index===null){let Q=J.attributes.position,$=[0];for(let Z=1,W=Q.count;Z<W;Z++)p7.fromBufferAttribute(Q,Z-1),d7.fromBufferAttribute(Q,Z),$[Z]=$[Z-1],$[Z]+=p7.distanceTo(d7);J.setAttribute("lineDistance",new NJ($,1))}else C0("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(J,Q){let $=this.geometry,Z=this.matrixWorld,W=J.params.Line.threshold,Y=$.drawRange;if($.boundingSphere===null)$.computeBoundingSphere();if(j7.copy($.boundingSphere),j7.applyMatrix4(Z),j7.radius+=W,J.ray.intersectsSphere(j7)===!1)return;dW.copy(Z).invert(),v6.copy(J.ray).applyMatrix4(dW);let X=W/((this.scale.x+this.scale.y+this.scale.z)/3),K=X*X,H=this.isLineSegments?2:1,U=$.index,F=$.attributes.position;if(U!==null){let E=Math.max(0,Y.start),O=Math.min(U.count,Y.start+Y.count);for(let R=E,C=O-1;R<C;R+=H){let q=U.getX(R),N=U.getX(R+1),L=v7(this,J,v6,K,q,N,R);if(L)Q.push(L)}if(this.isLineLoop){let R=U.getX(O-1),C=U.getX(E),q=v7(this,J,v6,K,R,C,O-1);if(q)Q.push(q)}}else{let E=Math.max(0,Y.start),O=Math.min(F.count,Y.start+Y.count);for(let R=E,C=O-1;R<C;R+=H){let q=v7(this,J,v6,K,R,R+1,R);if(q)Q.push(q)}if(this.isLineLoop){let R=v7(this,J,v6,K,O-1,E,O-1);if(R)Q.push(R)}}}updateMorphTargets(){let Q=this.geometry.morphAttributes,$=Object.keys(Q);if($.length>0){let Z=Q[$[0]];if(Z!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let W=0,Y=Z.length;W<Y;W++){let X=Z[W].name||String(W);this.morphTargetInfluences.push(0),this.morphTargetDictionary[X]=W}}}}}function v7(J,Q,$,Z,W,Y,X){let K=J.geometry.attributes.position;if(p7.fromBufferAttribute(K,W),d7.fromBufferAttribute(K,Y),$.distanceSqToSegment(p7,d7,Y$,uW)>Z)return;Y$.applyMatrix4(J.matrixWorld);let U=Q.ray.origin.distanceTo(Y$);if(U<Q.near||U>Q.far)return;return{distance:U,point:uW.clone().applyMatrix4(J.matrixWorld),index:X,face:null,faceIndex:null,barycoord:null,object:J}}var mW=new j,lW=new j;class KQ extends R6{constructor(J,Q){super(J,Q);this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let J=this.geometry;if(J.index===null){let Q=J.attributes.position,$=[];for(let Z=0,W=Q.count;Z<W;Z+=2)mW.fromBufferAttribute(Q,Z),lW.fromBufferAttribute(Q,Z+1),$[Z]=Z===0?0:$[Z-1],$[Z+1]=$[Z]+mW.distanceTo(lW);J.setAttribute("lineDistance",new NJ($,1))}else C0("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class HQ extends R6{constructor(J,Q){super(J,Q);this.isLineLoop=!0,this.type="LineLoop"}}class o6 extends eJ{constructor(J){super();this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new R0(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.alphaMap=J.alphaMap,this.size=J.size,this.sizeAttenuation=J.sizeAttenuation,this.fog=J.fog,this}}var cW=new S0,E$=new N6,y7=new mJ,h7=new j;class s9 extends FJ{constructor(J=new RJ,Q=new o6){super();this.isPoints=!0,this.type="Points",this.geometry=J,this.material=Q,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(J,Q){return super.copy(J,Q),this.material=Array.isArray(J.material)?J.material.slice():J.material,this.geometry=J.geometry,this}raycast(J,Q){let $=this.geometry,Z=this.matrixWorld,W=J.params.Points.threshold,Y=$.drawRange;if($.boundingSphere===null)$.computeBoundingSphere();if(y7.copy($.boundingSphere),y7.applyMatrix4(Z),y7.radius+=W,J.ray.intersectsSphere(y7)===!1)return;cW.copy(Z).invert(),E$.copy(J.ray).applyMatrix4(cW);let X=W/((this.scale.x+this.scale.y+this.scale.z)/3),K=X*X,H=$.index,G=$.attributes.position;if(H!==null){let F=Math.max(0,Y.start),E=Math.min(H.count,Y.start+Y.count);for(let O=F,R=E;O<R;O++){let C=H.getX(O);h7.fromBufferAttribute(G,C),nW(h7,C,K,Z,J,Q,this)}}else{let F=Math.max(0,Y.start),E=Math.min(G.count,Y.start+Y.count);for(let O=F,R=E;O<R;O++)h7.fromBufferAttribute(G,O),nW(h7,O,K,Z,J,Q,this)}}updateMorphTargets(){let Q=this.geometry.morphAttributes,$=Object.keys(Q);if($.length>0){let Z=Q[$[0]];if(Z!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let W=0,Y=Z.length;W<Y;W++){let X=Z[W].name||String(W);this.morphTargetInfluences.push(0),this.morphTargetDictionary[X]=W}}}}}function nW(J,Q,$,Z,W,Y,X){let K=E$.distanceSqToPoint(J);if(K<$){let H=new j;E$.closestPointToPoint(J,H),H.applyMatrix4(Z);let U=W.ray.origin.distanceTo(H);if(U<W.near||U>W.far)return;Y.push({distance:U,distanceToRay:Math.sqrt(K),point:H,index:Q,face:null,faceIndex:null,barycoord:null,object:X})}}class UQ extends wJ{constructor(J=[],Q=301,$,Z,W,Y,X,K,H,U){super(J,Q,$,Z,W,Y,X,K,H,U);this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(J){this.image=J}}class U8 extends wJ{constructor(J,Q,$=1014,Z,W,Y,X=1003,K=1003,H,U=1026,G=1){if(U!==1026&&U!==1027)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let F={width:J,height:Q,depth:G};super(F,Z,W,Y,X,K,U,$,H);this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(J){return super.copy(J),this.source=new m6(Object.assign({},J.image)),this.compareFunction=J.compareFunction,this}toJSON(J){let Q=super.toJSON(J);if(this.compareFunction!==null)Q.compareFunction=this.compareFunction;return Q}}class OZ extends U8{constructor(J,Q=1014,$=301,Z,W,Y=1003,X=1003,K,H=1026){let U={width:J,height:J,depth:1},G=[U,U,U,U,U,U];super(J,J,Q,$,Z,W,Y,X,K,H);this.image=G,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(J){this.image=J}}class GQ extends wJ{constructor(J=null){super();this.sourceTexture=J,this.isExternalTexture=!0}copy(J){return super.copy(J),this.sourceTexture=J.sourceTexture,this}}class Y9 extends RJ{constructor(J=1,Q=1,$=1,Z=1,W=1,Y=1){super();this.type="BoxGeometry",this.parameters={width:J,height:Q,depth:$,widthSegments:Z,heightSegments:W,depthSegments:Y};let X=this;Z=Math.floor(Z),W=Math.floor(W),Y=Math.floor(Y);let K=[],H=[],U=[],G=[],F=0,E=0;O("z","y","x",-1,-1,$,Q,J,Y,W,0),O("z","y","x",1,-1,$,Q,-J,Y,W,1),O("x","z","y",1,1,J,$,Q,Z,Y,2),O("x","z","y",1,-1,J,$,-Q,Z,Y,3),O("x","y","z",1,-1,J,Q,$,Z,W,4),O("x","y","z",-1,-1,J,Q,-$,Z,W,5),this.setIndex(K),this.setAttribute("position",new NJ(H,3)),this.setAttribute("normal",new NJ(U,3)),this.setAttribute("uv",new NJ(G,2));function O(R,C,q,N,L,M,k,_,P,V,D){let B=M/P,A=k/V,z=M/2,S=k/2,y=_/2,v=P+1,h=V+1,g=0,p=0,c=new j;for(let a=0;a<h;a++){let Q0=a*A-S;for(let H0=0;H0<v;H0++){let J0=H0*B-z;c[R]=J0*N,c[C]=Q0*L,c[q]=y,H.push(c.x,c.y,c.z),c[R]=0,c[C]=0,c[q]=_>0?1:-1,U.push(c.x,c.y,c.z),G.push(H0/P),G.push(1-a/V),g+=1}}for(let a=0;a<V;a++)for(let Q0=0;Q0<P;Q0++){let H0=F+Q0+v*a,J0=F+Q0+v*(a+1),x0=F+(Q0+1)+v*(a+1),v0=F+(Q0+1)+v*a;K.push(H0,J0,v0),K.push(J0,x0,v0),p+=6}X.addGroup(E,p,D),E+=p,F+=g}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new Y9(J.width,J.height,J.depth,J.widthSegments,J.heightSegments,J.depthSegments)}}class a6 extends RJ{constructor(J=1,Q=1,$=1,Z=32,W=1,Y=!1,X=0,K=Math.PI*2){super();this.type="CylinderGeometry",this.parameters={radiusTop:J,radiusBottom:Q,height:$,radialSegments:Z,heightSegments:W,openEnded:Y,thetaStart:X,thetaLength:K};let H=this;Z=Math.floor(Z),W=Math.floor(W);let U=[],G=[],F=[],E=[],O=0,R=[],C=$/2,q=0;if(N(),Y===!1){if(J>0)L(!0);if(Q>0)L(!1)}this.setIndex(U),this.setAttribute("position",new NJ(G,3)),this.setAttribute("normal",new NJ(F,3)),this.setAttribute("uv",new NJ(E,2));function N(){let M=new j,k=new j,_=0,P=(Q-J)/$;for(let V=0;V<=W;V++){let D=[],B=V/W,A=B*(Q-J)+J;for(let z=0;z<=Z;z++){let S=z/Z,y=S*K+X,v=Math.sin(y),h=Math.cos(y);k.x=A*v,k.y=-B*$+C,k.z=A*h,G.push(k.x,k.y,k.z),M.set(v,P,h).normalize(),F.push(M.x,M.y,M.z),E.push(S,1-B),D.push(O++)}R.push(D)}for(let V=0;V<Z;V++)for(let D=0;D<W;D++){let B=R[D][V],A=R[D+1][V],z=R[D+1][V+1],S=R[D][V+1];if(J>0||D!==0)U.push(B,A,S),_+=3;if(Q>0||D!==W-1)U.push(A,z,S),_+=3}H.addGroup(q,_,0),q+=_}function L(M){let k=O,_=new p0,P=new j,V=0,D=M===!0?J:Q,B=M===!0?1:-1;for(let z=1;z<=Z;z++)G.push(0,C*B,0),F.push(0,B,0),E.push(0.5,0.5),O++;let A=O;for(let z=0;z<=Z;z++){let y=z/Z*K+X,v=Math.cos(y),h=Math.sin(y);P.x=D*h,P.y=C*B,P.z=D*v,G.push(P.x,P.y,P.z),F.push(0,B,0),_.x=v*0.5+0.5,_.y=h*0.5*B+0.5,E.push(_.x,_.y),O++}for(let z=0;z<Z;z++){let S=k+z,y=A+z;if(M===!0)U.push(y,y+1,S);else U.push(y+1,y,S);V+=3}H.addGroup(q,V,M===!0?1:2),q+=V}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new a6(J.radiusTop,J.radiusBottom,J.height,J.radialSegments,J.heightSegments,J.openEnded,J.thetaStart,J.thetaLength)}}class EQ extends RJ{constructor(J=[],Q=[],$=1,Z=0){super();this.type="PolyhedronGeometry",this.parameters={vertices:J,indices:Q,radius:$,detail:Z};let W=[],Y=[];if(X(Z),H($),U(),this.setAttribute("position",new NJ(W,3)),this.setAttribute("normal",new NJ(W.slice(),3)),this.setAttribute("uv",new NJ(Y,2)),Z===0)this.computeVertexNormals();else this.normalizeNormals();function X(N){let L=new j,M=new j,k=new j;for(let _=0;_<Q.length;_+=3)E(Q[_+0],L),E(Q[_+1],M),E(Q[_+2],k),K(L,M,k,N)}function K(N,L,M,k){let _=k+1,P=[];for(let V=0;V<=_;V++){P[V]=[];let D=N.clone().lerp(M,V/_),B=L.clone().lerp(M,V/_),A=_-V;for(let z=0;z<=A;z++)if(z===0&&V===_)P[V][z]=D;else P[V][z]=D.clone().lerp(B,z/A)}for(let V=0;V<_;V++)for(let D=0;D<2*(_-V)-1;D++){let B=Math.floor(D/2);if(D%2===0)F(P[V][B+1]),F(P[V+1][B]),F(P[V][B]);else F(P[V][B+1]),F(P[V+1][B+1]),F(P[V+1][B])}}function H(N){let L=new j;for(let M=0;M<W.length;M+=3)L.x=W[M+0],L.y=W[M+1],L.z=W[M+2],L.normalize().multiplyScalar(N),W[M+0]=L.x,W[M+1]=L.y,W[M+2]=L.z}function U(){let N=new j;for(let L=0;L<W.length;L+=3){N.x=W[L+0],N.y=W[L+1],N.z=W[L+2];let M=C(N)/2/Math.PI+0.5,k=q(N)/Math.PI+0.5;Y.push(M,1-k)}O(),G()}function G(){for(let N=0;N<Y.length;N+=6){let L=Y[N+0],M=Y[N+2],k=Y[N+4],_=Math.max(L,M,k),P=Math.min(L,M,k);if(_>0.9&&P<0.1){if(L<0.2)Y[N+0]+=1;if(M<0.2)Y[N+2]+=1;if(k<0.2)Y[N+4]+=1}}}function F(N){W.push(N.x,N.y,N.z)}function E(N,L){let M=N*3;L.x=J[M+0],L.y=J[M+1],L.z=J[M+2]}function O(){let N=new j,L=new j,M=new j,k=new j,_=new p0,P=new p0,V=new p0;for(let D=0,B=0;D<W.length;D+=9,B+=6){N.set(W[D+0],W[D+1],W[D+2]),L.set(W[D+3],W[D+4],W[D+5]),M.set(W[D+6],W[D+7],W[D+8]),_.set(Y[B+0],Y[B+1]),P.set(Y[B+2],Y[B+3]),V.set(Y[B+4],Y[B+5]),k.copy(N).add(L).add(M).divideScalar(3);let A=C(k);R(_,B+0,N,A),R(P,B+2,L,A),R(V,B+4,M,A)}}function R(N,L,M,k){if(k<0&&N.x===1)Y[L]=N.x-1;if(M.x===0&&M.z===0)Y[L]=k/2/Math.PI+0.5}function C(N){return Math.atan2(N.z,-N.x)}function q(N){return Math.atan2(-N.y,Math.sqrt(N.x*N.x+N.z*N.z))}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new EQ(J.vertices,J.indices,J.radius,J.detail)}}class qZ{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){C0("Curve: .getPoint() not implemented.")}getPointAt(J,Q){let $=this.getUtoTmapping(J);return this.getPoint($,Q)}getPoints(J=5){let Q=[];for(let $=0;$<=J;$++)Q.push(this.getPoint($/J));return Q}getSpacedPoints(J=5){let Q=[];for(let $=0;$<=J;$++)Q.push(this.getPointAt($/J));return Q}getLength(){let J=this.getLengths();return J[J.length-1]}getLengths(J=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===J+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let Q=[],$,Z=this.getPoint(0),W=0;Q.push(0);for(let Y=1;Y<=J;Y++)$=this.getPoint(Y/J),W+=$.distanceTo(Z),Q.push(W),Z=$;return this.cacheArcLengths=Q,Q}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(J,Q=null){let $=this.getLengths(),Z=0,W=$.length,Y;if(Q)Y=Q;else Y=J*$[W-1];let X=0,K=W-1,H;while(X<=K)if(Z=Math.floor(X+(K-X)/2),H=$[Z]-Y,H<0)X=Z+1;else if(H>0)K=Z-1;else{K=Z;break}if(Z=K,$[Z]===Y)return Z/(W-1);let U=$[Z],F=$[Z+1]-U,E=(Y-U)/F;return(Z+E)/(W-1)}getTangent(J,Q){let Z=J-0.0001,W=J+0.0001;if(Z<0)Z=0;if(W>1)W=1;let Y=this.getPoint(Z),X=this.getPoint(W),K=Q||(Y.isVector2?new p0:new j);return K.copy(X).sub(Y).normalize(),K}getTangentAt(J,Q){let $=this.getUtoTmapping(J);return this.getTangent($,Q)}computeFrenetFrames(J,Q=!1){let $=new j,Z=[],W=[],Y=[],X=new j,K=new S0;for(let E=0;E<=J;E++){let O=E/J;Z[E]=this.getTangentAt(O,new j)}W[0]=new j,Y[0]=new j;let H=Number.MAX_VALUE,U=Math.abs(Z[0].x),G=Math.abs(Z[0].y),F=Math.abs(Z[0].z);if(U<=H)H=U,$.set(1,0,0);if(G<=H)H=G,$.set(0,1,0);if(F<=H)$.set(0,0,1);X.crossVectors(Z[0],$).normalize(),W[0].crossVectors(Z[0],X),Y[0].crossVectors(Z[0],W[0]);for(let E=1;E<=J;E++){if(W[E]=W[E-1].clone(),Y[E]=Y[E-1].clone(),X.crossVectors(Z[E-1],Z[E]),X.length()>Number.EPSILON){X.normalize();let O=Math.acos(m0(Z[E-1].dot(Z[E]),-1,1));W[E].applyMatrix4(K.makeRotationAxis(X,O))}Y[E].crossVectors(Z[E],W[E])}if(Q===!0){let E=Math.acos(m0(W[0].dot(W[J]),-1,1));if(E/=J,Z[0].dot(X.crossVectors(W[0],W[J]))>0)E=-E;for(let O=1;O<=J;O++)W[O].applyMatrix4(K.makeRotationAxis(Z[O],E*O)),Y[O].crossVectors(Z[O],W[O])}return{tangents:Z,normals:W,binormals:Y}}clone(){return new this.constructor().copy(this)}copy(J){return this.arcLengthDivisions=J.arcLengthDivisions,this}toJSON(){let J={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return J.arcLengthDivisions=this.arcLengthDivisions,J.type=this.type,J}fromJSON(J){return this.arcLengthDivisions=J.arcLengthDivisions,this}}function RZ(){let J=0,Q=0,$=0,Z=0;function W(Y,X,K,H){J=Y,Q=K,$=-3*Y+3*X-2*K-H,Z=2*Y-2*X+K+H}return{initCatmullRom:function(Y,X,K,H,U){W(X,K,U*(K-Y),U*(H-X))},initNonuniformCatmullRom:function(Y,X,K,H,U,G,F){let E=(X-Y)/U-(K-Y)/(U+G)+(K-X)/G,O=(K-X)/G-(H-X)/(G+F)+(H-K)/F;E*=G,O*=G,W(X,K,E,O)},calc:function(Y){let X=Y*Y,K=X*Y;return J+Q*Y+$*X+Z*K}}}var sW=new j,iW=new j,X$=new RZ,K$=new RZ,H$=new RZ;class FQ extends qZ{constructor(J=[],Q=!1,$="centripetal",Z=0.5){super();this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=J,this.closed=Q,this.curveType=$,this.tension=Z}getPoint(J,Q=new j){let $=Q,Z=this.points,W=Z.length,Y=(W-(this.closed?0:1))*J,X=Math.floor(Y),K=Y-X;if(this.closed)X+=X>0?0:(Math.floor(Math.abs(X)/W)+1)*W;else if(K===0&&X===W-1)X=W-2,K=1;let H,U;if(this.closed||X>0)H=Z[(X-1)%W];else iW.subVectors(Z[0],Z[1]).add(Z[0]),H=iW;let G=Z[X%W],F=Z[(X+1)%W];if(this.closed||X+2<W)U=Z[(X+2)%W];else sW.subVectors(Z[W-1],Z[W-2]).add(Z[W-1]),U=sW;if(this.curveType==="centripetal"||this.curveType==="chordal"){let E=this.curveType==="chordal"?0.5:0.25,O=Math.pow(H.distanceToSquared(G),E),R=Math.pow(G.distanceToSquared(F),E),C=Math.pow(F.distanceToSquared(U),E);if(R<0.0001)R=1;if(O<0.0001)O=R;if(C<0.0001)C=R;X$.initNonuniformCatmullRom(H.x,G.x,F.x,U.x,O,R,C),K$.initNonuniformCatmullRom(H.y,G.y,F.y,U.y,O,R,C),H$.initNonuniformCatmullRom(H.z,G.z,F.z,U.z,O,R,C)}else if(this.curveType==="catmullrom")X$.initCatmullRom(H.x,G.x,F.x,U.x,this.tension),K$.initCatmullRom(H.y,G.y,F.y,U.y,this.tension),H$.initCatmullRom(H.z,G.z,F.z,U.z,this.tension);return $.set(X$.calc(K),K$.calc(K),H$.calc(K)),$}copy(J){super.copy(J),this.points=[];for(let Q=0,$=J.points.length;Q<$;Q++){let Z=J.points[Q];this.points.push(Z.clone())}return this.closed=J.closed,this.curveType=J.curveType,this.tension=J.tension,this}toJSON(){let J=super.toJSON();J.points=[];for(let Q=0,$=this.points.length;Q<$;Q++){let Z=this.points[Q];J.points.push(Z.toArray())}return J.closed=this.closed,J.curveType=this.curveType,J.tension=this.tension,J}fromJSON(J){super.fromJSON(J),this.points=[];for(let Q=0,$=J.points.length;Q<$;Q++){let Z=J.points[Q];this.points.push(new j().fromArray(Z))}return this.closed=J.closed,this.curveType=J.curveType,this.tension=J.tension,this}}class r6 extends EQ{constructor(J=1,Q=0){let $=(1+Math.sqrt(5))/2,Z=[-1,$,0,1,$,0,-1,-$,0,1,-$,0,0,-1,$,0,1,$,0,-1,-$,0,1,-$,$,0,-1,$,0,1,-$,0,-1,-$,0,1],W=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(Z,W,J,Q);this.type="IcosahedronGeometry",this.parameters={radius:J,detail:Q}}static fromJSON(J){return new r6(J.radius,J.detail)}}class M9 extends RJ{constructor(J=1,Q=1,$=1,Z=1){super();this.type="PlaneGeometry",this.parameters={width:J,height:Q,widthSegments:$,heightSegments:Z};let W=J/2,Y=Q/2,X=Math.floor($),K=Math.floor(Z),H=X+1,U=K+1,G=J/X,F=Q/K,E=[],O=[],R=[],C=[];for(let q=0;q<U;q++){let N=q*F-Y;for(let L=0;L<H;L++){let M=L*G-W;O.push(M,-N,0),R.push(0,0,1),C.push(L/X),C.push(1-q/K)}}for(let q=0;q<K;q++)for(let N=0;N<X;N++){let L=N+H*q,M=N+H*(q+1),k=N+1+H*(q+1),_=N+1+H*q;E.push(L,M,_),E.push(M,k,_)}this.setIndex(E),this.setAttribute("position",new NJ(O,3)),this.setAttribute("normal",new NJ(R,3)),this.setAttribute("uv",new NJ(C,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new M9(J.width,J.height,J.widthSegments,J.heightSegments)}}class t6 extends RJ{constructor(J=1,Q=32,$=16,Z=0,W=Math.PI*2,Y=0,X=Math.PI){super();this.type="SphereGeometry",this.parameters={radius:J,widthSegments:Q,heightSegments:$,phiStart:Z,phiLength:W,thetaStart:Y,thetaLength:X},Q=Math.max(3,Math.floor(Q)),$=Math.max(2,Math.floor($));let K=Math.min(Y+X,Math.PI),H=0,U=[],G=new j,F=new j,E=[],O=[],R=[],C=[];for(let q=0;q<=$;q++){let N=[],L=q/$,M=0;if(q===0&&Y===0)M=0.5/Q;else if(q===$&&K===Math.PI)M=-0.5/Q;for(let k=0;k<=Q;k++){let _=k/Q;G.x=-J*Math.cos(Z+_*W)*Math.sin(Y+L*X),G.y=J*Math.cos(Y+L*X),G.z=J*Math.sin(Z+_*W)*Math.sin(Y+L*X),O.push(G.x,G.y,G.z),F.copy(G).normalize(),R.push(F.x,F.y,F.z),C.push(_+M,1-L),N.push(H++)}U.push(N)}for(let q=0;q<$;q++)for(let N=0;N<Q;N++){let L=U[q][N+1],M=U[q][N],k=U[q+1][N],_=U[q+1][N+1];if(q!==0||Y>0)E.push(L,M,_);if(q!==$-1||K<Math.PI)E.push(M,k,_)}this.setIndex(E),this.setAttribute("position",new NJ(O,3)),this.setAttribute("normal",new NJ(R,3)),this.setAttribute("uv",new NJ(C,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new t6(J.radius,J.widthSegments,J.heightSegments,J.phiStart,J.phiLength,J.thetaStart,J.thetaLength)}}class e6 extends RJ{constructor(J=1,Q=0.4,$=12,Z=48,W=Math.PI*2,Y=0,X=Math.PI*2){super();this.type="TorusGeometry",this.parameters={radius:J,tube:Q,radialSegments:$,tubularSegments:Z,arc:W,thetaStart:Y,thetaLength:X},$=Math.floor($),Z=Math.floor(Z);let K=[],H=[],U=[],G=[],F=new j,E=new j,O=new j;for(let R=0;R<=$;R++){let C=Y+R/$*X;for(let q=0;q<=Z;q++){let N=q/Z*W;E.x=(J+Q*Math.cos(C))*Math.cos(N),E.y=(J+Q*Math.cos(C))*Math.sin(N),E.z=Q*Math.sin(C),H.push(E.x,E.y,E.z),F.x=J*Math.cos(N),F.y=J*Math.sin(N),O.subVectors(E,F).normalize(),U.push(O.x,O.y,O.z),G.push(q/Z),G.push(R/$)}}for(let R=1;R<=$;R++)for(let C=1;C<=Z;C++){let q=(Z+1)*R+C-1,N=(Z+1)*(R-1)+C-1,L=(Z+1)*(R-1)+C,M=(Z+1)*R+C;K.push(q,N,M),K.push(N,L,M)}this.setIndex(K),this.setAttribute("position",new NJ(H,3)),this.setAttribute("normal",new NJ(U,3)),this.setAttribute("uv",new NJ(G,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new e6(J.radius,J.tube,J.radialSegments,J.tubularSegments,J.arc)}}function S8(J){let Q={};for(let $ in J){Q[$]={};for(let Z in J[$]){let W=J[$][Z];if(oW(W))if(W.isRenderTargetTexture)C0("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),Q[$][Z]=null;else Q[$][Z]=W.clone();else if(Array.isArray(W))if(oW(W[0])){let Y=[];for(let X=0,K=W.length;X<K;X++)Y[X]=W[X].clone();Q[$][Z]=Y}else Q[$][Z]=W.slice();else Q[$][Z]=W}}return Q}function gJ(J){let Q={};for(let $=0;$<J.length;$++){let Z=S8(J[$]);for(let W in Z)Q[W]=Z[W]}return Q}function oW(J){return J&&(J.isColor||J.isMatrix3||J.isMatrix4||J.isVector2||J.isVector3||J.isVector4||J.isTexture||J.isQuaternion)}function tH(J){let Q=[];for(let $=0;$<J.length;$++)Q.push(J[$].clone());return Q}function LZ(J){let Q=J.getRenderTarget();if(Q===null)return J.outputColorSpace;if(Q.isXRRenderTarget===!0)return Q.texture.colorSpace;return s0.workingColorSpace}var j8={clone:S8,merge:gJ},eH=`void main() {
1
+ var P1=Object.defineProperty;var T1=(J)=>J;function A1(J,Q){this[J]=T1.bind(null,Q)}var S1=(J,Q)=>{for(var $ in Q)P1(J,$,{get:Q[$],enumerable:!0,configurable:!0,set:A1.bind(Q,$)})};var eW={};S1(eW,{warnOnce:()=>DQ,warn:()=>O0,setConsoleFunction:()=>$5,log:()=>M7,getConsoleFunction:()=>Z5,error:()=>v0,createCanvasElement:()=>oX,ZeroStencilOp:()=>zG,ZeroSlopeEnding:()=>OG,ZeroFactor:()=>GX,ZeroCurvatureEnding:()=>NG,WrapAroundEnding:()=>qG,WireframeGeometry:()=>CW,WebXRController:()=>b7,WebGPUCoordinateSystem:()=>aG,WebGLUtils:()=>QE,WebGLRenderer:()=>tW,WebGLRenderTarget:()=>PJ,WebGLCubeRenderTarget:()=>aW,WebGLCoordinateSystem:()=>EW,WebGLArrayRenderTarget:()=>rX,WebGL3DRenderTarget:()=>tX,VideoTexture:()=>RW,VideoFrameTexture:()=>YK,VectorKeyframeTrack:()=>X8,Vector4:()=>FJ,Vector3:()=>T,Vector2:()=>i,VSMShadowMap:()=>I6,UnsignedShortType:()=>S7,UnsignedShort5551Type:()=>_Z,UnsignedShort4444Type:()=>zZ,UnsignedIntType:()=>z8,UnsignedInt5999Type:()=>hX,UnsignedInt248Type:()=>T6,UnsignedInt101111Type:()=>fX,UnsignedByteType:()=>S9,UniformsUtils:()=>X9,UniformsLib:()=>L0,UniformsGroup:()=>TK,Uniform:()=>lW,Uint8ClampedBufferAttribute:()=>QK,Uint8BufferAttribute:()=>JK,Uint32BufferAttribute:()=>gQ,Uint16BufferAttribute:()=>fQ,UVMapping:()=>$G,TubeGeometry:()=>Z$,TrianglesDrawMode:()=>KW,TriangleStripDrawMode:()=>j7,TriangleFanDrawMode:()=>A6,Triangle:()=>W9,TorusKnotGeometry:()=>$$,TorusGeometry:()=>f6,TimestampQuery:()=>rG,Timer:()=>s7,TextureUtils:()=>eK,TextureLoader:()=>u6,Texture:()=>MJ,TetrahedronGeometry:()=>Q$,TangentSpaceNormalMap:()=>HW,TOUCH:()=>aU,SubtractiveBlending:()=>VZ,SubtractEquation:()=>XX,StringKeyframeTrack:()=>S8,StreamReadUsage:()=>cG,StreamDrawUsage:()=>dG,StreamCopyUsage:()=>iG,StereoCamera:()=>VK,StaticReadUsage:()=>mG,StaticDrawUsage:()=>uG,StaticCopyUsage:()=>nG,SrcColorFactor:()=>FX,SrcAlphaSaturateFactor:()=>MX,SrcAlphaFactor:()=>OX,SpriteMaterial:()=>pQ,Sprite:()=>NW,SpotLightHelper:()=>fK,SpotLight:()=>n7,SplineCurve:()=>aQ,SphericalHarmonics3:()=>G$,Spherical:()=>yK,SphereGeometry:()=>$6,Sphere:()=>_J,Source:()=>W8,SkinnedMesh:()=>h7,SkeletonHelper:()=>gK,Skeleton:()=>y6,ShortType:()=>bX,ShapeUtils:()=>w9,ShapePath:()=>rK,ShapeGeometry:()=>J$,Shape:()=>B8,ShadowMaterial:()=>IW,ShaderMaterial:()=>LJ,ShaderLib:()=>r9,ShaderChunk:()=>ZJ,Scene:()=>t8,SRGBTransfer:()=>OJ,SRGBColorSpace:()=>_8,SIGNED_RG11_EAC_Format:()=>gZ,SIGNED_RED_RGTC1_Format:()=>WW,SIGNED_RED_GREEN_RGTC2_Format:()=>YW,SIGNED_R11_EAC_Format:()=>fZ,RingGeometry:()=>eQ,ReverseSubtractEquation:()=>KX,ReplaceStencilOp:()=>wG,RepeatWrapping:()=>I8,RenderTarget3D:()=>PK,RenderTarget:()=>xQ,ReinhardToneMapping:()=>z7,RedIntegerFormat:()=>wZ,RedFormat:()=>uX,RectAreaLight:()=>xW,Raycaster:()=>jK,Ray:()=>J6,RawShaderMaterial:()=>p6,RGIntegerFormat:()=>PZ,RGFormat:()=>a8,RGDepthPacking:()=>VG,RGB_S3TC_DXT1_Format:()=>_Q,RGB_PVRTC_4BPPV1_Format:()=>AZ,RGB_PVRTC_2BPPV1_Format:()=>SZ,RGB_ETC2_Format:()=>xZ,RGB_ETC1_Format:()=>yZ,RGB_BPTC_UNSIGNED_Format:()=>$W,RGB_BPTC_SIGNED_Format:()=>QW,RGBIntegerFormat:()=>KG,RGBFormat:()=>pX,RGBDepthPacking:()=>MG,RGBA_S3TC_DXT5_Format:()=>TQ,RGBA_S3TC_DXT3_Format:()=>PQ,RGBA_S3TC_DXT1_Format:()=>wQ,RGBA_PVRTC_4BPPV1_Format:()=>jZ,RGBA_PVRTC_2BPPV1_Format:()=>vZ,RGBA_ETC2_EAC_Format:()=>bZ,RGBA_BPTC_Format:()=>JW,RGBA_ASTC_8x8_Format:()=>sZ,RGBA_ASTC_8x6_Format:()=>nZ,RGBA_ASTC_8x5_Format:()=>cZ,RGBA_ASTC_6x6_Format:()=>lZ,RGBA_ASTC_6x5_Format:()=>mZ,RGBA_ASTC_5x5_Format:()=>dZ,RGBA_ASTC_5x4_Format:()=>uZ,RGBA_ASTC_4x4_Format:()=>pZ,RGBA_ASTC_12x12_Format:()=>eZ,RGBA_ASTC_12x10_Format:()=>tZ,RGBA_ASTC_10x8_Format:()=>aZ,RGBA_ASTC_10x6_Format:()=>oZ,RGBA_ASTC_10x5_Format:()=>iZ,RGBA_ASTC_10x10_Format:()=>rZ,RGBAIntegerFormat:()=>TZ,RGBAFormat:()=>i9,RGBADepthPacking:()=>kG,RG11_EAC_Format:()=>AQ,REVISION:()=>QX,RED_RGTC1_Format:()=>ZW,RED_GREEN_RGTC2_Format:()=>SQ,R11_EAC_Format:()=>hZ,QuaternionLinearInterpolant:()=>vW,QuaternionKeyframeTrack:()=>G8,Quaternion:()=>IJ,QuadraticBezierCurve3:()=>oQ,QuadraticBezierCurve:()=>iQ,PropertyMixer:()=>dW,PropertyBinding:()=>GJ,PositionalAudio:()=>CK,PolyhedronGeometry:()=>T8,PolarGridHelper:()=>mK,PointsMaterial:()=>x6,Points:()=>o9,PointLightHelper:()=>pK,PointLight:()=>E8,PlaneHelper:()=>iK,PlaneGeometry:()=>C9,Plane:()=>_9,PerspectiveCamera:()=>BJ,Path:()=>V7,PMREMGenerator:()=>l6,PCFSoftShadowMap:()=>WX,PCFShadowMap:()=>C7,OrthographicCamera:()=>a9,OneMinusSrcColorFactor:()=>NX,OneMinusSrcAlphaFactor:()=>qX,OneMinusDstColorFactor:()=>kX,OneMinusDstAlphaFactor:()=>LX,OneMinusConstantColorFactor:()=>BX,OneMinusConstantAlphaFactor:()=>IX,OneFactor:()=>EX,OctahedronGeometry:()=>m7,ObjectSpaceNormalMap:()=>dX,ObjectLoader:()=>kK,Object3D:()=>HJ,NumberKeyframeTrack:()=>Y8,NotEqualStencilFunc:()=>fG,NotEqualDepth:()=>SX,NotEqualCompare:()=>sX,NormalRGPacking:()=>CG,NormalGAPacking:()=>IG,NormalBlending:()=>m8,NormalAnimationBlendMode:()=>RG,NoToneMapping:()=>E9,NoNormalPacking:()=>BG,NoColorSpace:()=>r8,NoBlending:()=>M9,NeverStencilFunc:()=>vG,NeverDepth:()=>zX,NeverCompare:()=>mX,NeutralToneMapping:()=>T7,NearestMipmapNearestFilter:()=>zQ,NearestMipmapLinearFilter:()=>s8,NearestMipMapNearestFilter:()=>ZG,NearestMipMapLinearFilter:()=>WG,NearestFilter:()=>A9,MultiplyOperation:()=>jX,MultiplyBlending:()=>BZ,MixOperation:()=>vX,MirroredRepeatWrapping:()=>IQ,MinEquation:()=>HX,MeshToonMaterial:()=>_W,MeshStandardMaterial:()=>sJ,MeshPhysicalMaterial:()=>iJ,MeshPhongMaterial:()=>zW,MeshNormalMaterial:()=>wW,MeshMatcapMaterial:()=>PW,MeshLambertMaterial:()=>l7,MeshDistanceMaterial:()=>Y$,MeshDepthMaterial:()=>W$,MeshBasicMaterial:()=>cJ,Mesh:()=>a0,MaxEquation:()=>UX,Matrix4:()=>y0,Matrix3:()=>o0,Matrix2:()=>cW,MathUtils:()=>j6,MaterialLoader:()=>E$,MaterialBlending:()=>eU,Material:()=>vJ,MOUSE:()=>oU,LoopRepeat:()=>UG,LoopPingPong:()=>GG,LoopOnce:()=>HG,LoadingManager:()=>H$,LoaderUtils:()=>c9,Loader:()=>nJ,LinearTransfer:()=>UW,LinearToneMapping:()=>I7,LinearSRGBColorSpace:()=>eJ,LinearMipmapNearestFilter:()=>P6,LinearMipmapLinearFilter:()=>s9,LinearMipMapNearestFilter:()=>YG,LinearMipMapLinearFilter:()=>XG,LinearInterpolant:()=>X$,LinearFilter:()=>jJ,LineSegments:()=>N9,LineLoop:()=>f7,LineDashedMaterial:()=>TW,LineCurve3:()=>VW,LineCurve:()=>sQ,LineBasicMaterial:()=>uJ,Line3:()=>hK,Line:()=>T9,LightProbe:()=>bW,Light:()=>j9,LessStencilFunc:()=>yG,LessEqualStencilFunc:()=>bG,LessEqualDepth:()=>CZ,LessEqualCompare:()=>vQ,LessDepth:()=>wX,LessCompare:()=>lX,Layers:()=>x7,LatheGeometry:()=>tQ,LOD:()=>OW,KeyframeTrack:()=>O9,KeepStencilOp:()=>_G,InvertStencilOp:()=>jG,InterpolationSamplingType:()=>tG,InterpolationSamplingMode:()=>eG,InterpolateSmooth:()=>EG,InterpolateLinear:()=>jQ,InterpolateDiscrete:()=>XW,InterpolateBezier:()=>FG,Interpolant:()=>U8,InterleavedBufferAttribute:()=>m9,InterleavedBuffer:()=>w8,IntType:()=>IZ,Int8BufferAttribute:()=>eX,Int32BufferAttribute:()=>ZK,Int16BufferAttribute:()=>$K,InstancedMesh:()=>K8,InstancedInterleavedBuffer:()=>AK,InstancedBufferGeometry:()=>hW,InstancedBufferAttribute:()=>l9,IncrementWrapStencilOp:()=>AG,IncrementStencilOp:()=>PG,ImageUtils:()=>FW,ImageLoader:()=>C6,ImageBitmapLoader:()=>F$,IcosahedronGeometry:()=>h6,HemisphereLightHelper:()=>uK,HemisphereLight:()=>Z6,HalfFloatType:()=>wJ,HTMLTexture:()=>GK,Group:()=>U9,GridHelper:()=>dK,GreaterStencilFunc:()=>hG,GreaterEqualStencilFunc:()=>gG,GreaterEqualDepth:()=>TX,GreaterEqualCompare:()=>yQ,GreaterDepth:()=>AX,GreaterCompare:()=>nX,GLSL3:()=>GW,GLSL1:()=>oG,GLBufferAttribute:()=>SK,FrustumArray:()=>uQ,Frustum:()=>H8,FrontSide:()=>n9,FramebufferTexture:()=>XK,FogExp2:()=>bQ,Fog:()=>hQ,FloatType:()=>F9,Float32BufferAttribute:()=>I0,Float16BufferAttribute:()=>WK,FileLoader:()=>G9,ExtrudeGeometry:()=>rQ,ExternalTexture:()=>dQ,EventDispatcher:()=>V9,Euler:()=>P9,EquirectangularRefractionMapping:()=>CQ,EquirectangularReflectionMapping:()=>BQ,EqualStencilFunc:()=>xG,EqualDepth:()=>PX,EqualCompare:()=>cX,EllipseCurve:()=>u7,EdgesGeometry:()=>DW,DynamicReadUsage:()=>lG,DynamicDrawUsage:()=>S6,DynamicCopyUsage:()=>sG,DstColorFactor:()=>DX,DstAlphaFactor:()=>RX,DoubleSide:()=>Y9,DodecahedronGeometry:()=>cQ,DiscreteInterpolant:()=>SW,DirectionalLightHelper:()=>lK,DirectionalLight:()=>v9,DetachedBindMode:()=>QG,DepthTexture:()=>P8,DepthStencilFormat:()=>o8,DepthFormat:()=>i8,DefaultLoadingManager:()=>qK,DecrementWrapStencilOp:()=>SG,DecrementStencilOp:()=>TG,DataUtils:()=>e8,DataTextureLoader:()=>U$,DataTexture:()=>k9,DataArrayTexture:()=>v7,Data3DTexture:()=>y7,Cylindrical:()=>xK,CylinderGeometry:()=>Q6,CustomToneMapping:()=>w7,CustomBlending:()=>YX,CurvePath:()=>BW,Curve:()=>B9,CullFaceNone:()=>$X,CullFaceFrontBack:()=>rU,CullFaceFront:()=>ZX,CullFaceBack:()=>MZ,CubicInterpolant:()=>AW,CubicBezierCurve3:()=>MW,CubicBezierCurve:()=>nQ,CubeUVReflectionMapping:()=>A7,CubeTextureLoader:()=>DK,CubeTexture:()=>b6,CubeRefractionMapping:()=>n8,CubeReflectionMapping:()=>_6,CubeDepthTexture:()=>LW,CubeCamera:()=>gW,Controls:()=>tK,ConstantColorFactor:()=>VX,ConstantAlphaFactor:()=>CX,ConeGeometry:()=>p7,CompressedTextureLoader:()=>LK,CompressedTexture:()=>g7,CompressedCubeTexture:()=>HK,CompressedArrayTexture:()=>KK,Compatibility:()=>J5,ColorManagement:()=>t0,ColorKeyframeTrack:()=>K$,Color:()=>e,Clock:()=>vK,ClampToEdgeWrapping:()=>w6,CircleGeometry:()=>lQ,CineonToneMapping:()=>_7,CatmullRomCurve3:()=>d7,CapsuleGeometry:()=>mQ,CanvasTexture:()=>UK,CameraHelper:()=>cK,Camera:()=>c7,Cache:()=>d9,ByteType:()=>xX,BufferGeometryLoader:()=>fW,BufferGeometry:()=>u0,BufferAttribute:()=>i0,BoxHelper:()=>nK,BoxGeometry:()=>J9,Box3Helper:()=>sK,Box3:()=>SJ,Box2:()=>bK,BooleanKeyframeTrack:()=>A8,Bone:()=>v6,BezierInterpolant:()=>jW,BatchedMesh:()=>qW,BasicShadowMap:()=>tU,BasicDepthPacking:()=>DG,BackSide:()=>pJ,AxesHelper:()=>aK,AudioLoader:()=>MK,AudioListener:()=>BK,AudioContext:()=>N$,AudioAnalyser:()=>IK,Audio:()=>uW,AttachedBindMode:()=>JG,ArrowHelper:()=>oK,ArrayCamera:()=>pW,ArcCurve:()=>kW,AnimationUtils:()=>OK,AnimationObjectGroup:()=>wK,AnimationMixer:()=>O$,AnimationLoader:()=>RK,AnimationClip:()=>C8,AnimationAction:()=>mW,AmbientLight:()=>d6,AlwaysStencilFunc:()=>pG,AlwaysDepth:()=>_X,AlwaysCompare:()=>iX,AlphaFormat:()=>gX,AgXToneMapping:()=>P7,AdditiveBlending:()=>l8,AdditiveAnimationBlendMode:()=>LG,AddOperation:()=>yX,AddEquation:()=>z6,ACESFilmicToneMapping:()=>c8});var QX="184",oU={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},aU={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},$X=0,MZ=1,ZX=2,rU=3,tU=0,C7=1,WX=2,I6=3,n9=0,pJ=1,Y9=2,M9=0,m8=1,l8=2,VZ=3,BZ=4,YX=5,eU=6,z6=100,XX=101,KX=102,HX=103,UX=104,GX=200,EX=201,FX=202,NX=203,OX=204,qX=205,RX=206,LX=207,DX=208,kX=209,MX=210,VX=211,BX=212,CX=213,IX=214,zX=0,_X=1,wX=2,CZ=3,PX=4,TX=5,AX=6,SX=7,jX=0,vX=1,yX=2,E9=0,I7=1,z7=2,_7=3,c8=4,w7=5,P7=6,T7=7,JG="attached",QG="detached",$G=300,_6=301,n8=302,BQ=303,CQ=304,A7=306,I8=1000,w6=1001,IQ=1002,A9=1003,zQ=1004,ZG=1004,s8=1005,WG=1005,jJ=1006,P6=1007,YG=1007,s9=1008,XG=1008,S9=1009,xX=1010,bX=1011,S7=1012,IZ=1013,z8=1014,F9=1015,wJ=1016,zZ=1017,_Z=1018,T6=1020,hX=35902,fX=35899,gX=1021,pX=1022,i9=1023,i8=1026,o8=1027,uX=1028,wZ=1029,a8=1030,PZ=1031,KG=1032,TZ=1033,_Q=33776,wQ=33777,PQ=33778,TQ=33779,AZ=35840,SZ=35841,jZ=35842,vZ=35843,yZ=36196,xZ=37492,bZ=37496,hZ=37488,fZ=37489,AQ=37490,gZ=37491,pZ=37808,uZ=37809,dZ=37810,mZ=37811,lZ=37812,cZ=37813,nZ=37814,sZ=37815,iZ=37816,oZ=37817,aZ=37818,rZ=37819,tZ=37820,eZ=37821,JW=36492,QW=36494,$W=36495,ZW=36283,WW=36284,SQ=36285,YW=36286,HG=2200,UG=2201,GG=2202,XW=2300,jQ=2301,EG=2302,FG=2303,NG=2400,OG=2401,qG=2402,RG=2500,LG=2501,KW=0,j7=1,A6=2,DG=3200,kG=3201,MG=3202,VG=3203,HW=0,dX=1,r8="",_8="srgb",eJ="srgb-linear",UW="linear",OJ="srgb",BG="",CG="rg",IG="ga",zG=0,_G=7680,wG=7681,PG=7682,TG=7683,AG=34055,SG=34056,jG=5386,vG=512,yG=513,xG=514,bG=515,hG=516,fG=517,gG=518,pG=519,mX=512,lX=513,cX=514,vQ=515,nX=516,sX=517,yQ=518,iX=519,uG=35044,S6=35048,dG=35040,mG=35045,lG=35049,cG=35041,nG=35046,sG=35050,iG=35042,oG="100",GW="300 es",EW=2000,aG=2001,rG={COMPUTE:"compute",RENDER:"render"},tG={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},eG={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},J5={TEXTURE_COMPARE:"depthTextureCompare"};function j1(J){for(let Q=J.length-1;Q>=0;--Q)if(J[Q]>=65535)return!0;return!1}var v1={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function L7(J,Q){return new v1[J](Q)}function Q5(J){return ArrayBuffer.isView(J)&&!(J instanceof DataView)}function k7(J){return document.createElementNS("http://www.w3.org/1999/xhtml",J)}function oX(){let J=k7("canvas");return J.style.display="block",J}var pH={},d8=null;function $5(J){d8=J}function Z5(){return d8}function M7(...J){let Q="THREE."+J.shift();if(d8)d8("log",Q,...J);else console.log(Q,...J)}function W5(J){let Q=J[0];if(typeof Q==="string"&&Q.startsWith("TSL:")){let $=J[1];if($&&$.isStackTrace)J[0]+=" "+$.getLocation();else J[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return J}function O0(...J){J=W5(J);let Q="THREE."+J.shift();if(d8)d8("warn",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.warn($.getError(Q));else console.warn(Q,...J)}}function v0(...J){J=W5(J);let Q="THREE."+J.shift();if(d8)d8("error",Q,...J);else{let $=J[0];if($&&$.isStackTrace)console.error($.getError(Q));else console.error(Q,...J)}}function DQ(...J){let Q=J.join(" ");if(Q in pH)return;pH[Q]=!0,O0(...J)}function Y5(J,Q,$){return new Promise(function(Z,W){function Y(){switch(J.clientWaitSync(Q,J.SYNC_FLUSH_COMMANDS_BIT,0)){case J.WAIT_FAILED:W();break;case J.TIMEOUT_EXPIRED:setTimeout(Y,$);break;default:Z()}}setTimeout(Y,$)})}var X5={[0]:1,[2]:6,[4]:7,[3]:5,[1]:0,[6]:2,[7]:4,[5]:3};class V9{addEventListener(J,Q){if(this._listeners===void 0)this._listeners={};let $=this._listeners;if($[J]===void 0)$[J]=[];if($[J].indexOf(Q)===-1)$[J].push(Q)}hasEventListener(J,Q){let $=this._listeners;if($===void 0)return!1;return $[J]!==void 0&&$[J].indexOf(Q)!==-1}removeEventListener(J,Q){let $=this._listeners;if($===void 0)return;let Z=$[J];if(Z!==void 0){let W=Z.indexOf(Q);if(W!==-1)Z.splice(W,1)}}dispatchEvent(J){let Q=this._listeners;if(Q===void 0)return;let $=Q[J.type];if($!==void 0){J.target=this;let Z=$.slice(0);for(let W=0,Y=Z.length;W<Y;W++)Z[W].call(this,J);J.target=null}}}var aJ=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],uH=1234567,M6=Math.PI/180,V6=180/Math.PI;function D9(){let J=Math.random()*4294967295|0,Q=Math.random()*4294967295|0,$=Math.random()*4294967295|0,Z=Math.random()*4294967295|0;return(aJ[J&255]+aJ[J>>8&255]+aJ[J>>16&255]+aJ[J>>24&255]+"-"+aJ[Q&255]+aJ[Q>>8&255]+"-"+aJ[Q>>16&15|64]+aJ[Q>>24&255]+"-"+aJ[$&63|128]+aJ[$>>8&255]+"-"+aJ[$>>16&255]+aJ[$>>24&255]+aJ[Z&255]+aJ[Z>>8&255]+aJ[Z>>16&255]+aJ[Z>>24&255]).toLowerCase()}function s0(J,Q,$){return Math.max(Q,Math.min($,J))}function aX(J,Q){return(J%Q+Q)%Q}function y1(J,Q,$,Z,W){return Z+(J-Q)*(W-Z)/($-Q)}function x1(J,Q,$){if(J!==Q)return($-J)/(Q-J);else return 0}function qQ(J,Q,$){return(1-$)*J+$*Q}function b1(J,Q,$,Z){return qQ(J,Q,1-Math.exp(-$*Z))}function h1(J,Q=1){return Q-Math.abs(aX(J,Q*2)-Q)}function f1(J,Q,$){if(J<=Q)return 0;if(J>=$)return 1;return J=(J-Q)/($-Q),J*J*(3-2*J)}function g1(J,Q,$){if(J<=Q)return 0;if(J>=$)return 1;return J=(J-Q)/($-Q),J*J*J*(J*(J*6-15)+10)}function p1(J,Q){return J+Math.floor(Math.random()*(Q-J+1))}function u1(J,Q){return J+Math.random()*(Q-J)}function d1(J){return J*(0.5-Math.random())}function m1(J){if(J!==void 0)uH=J;let Q=uH+=1831565813;return Q=Math.imul(Q^Q>>>15,Q|1),Q^=Q+Math.imul(Q^Q>>>7,Q|61),((Q^Q>>>14)>>>0)/4294967296}function l1(J){return J*M6}function c1(J){return J*V6}function n1(J){return(J&J-1)===0&&J!==0}function s1(J){return Math.pow(2,Math.ceil(Math.log(J)/Math.LN2))}function i1(J){return Math.pow(2,Math.floor(Math.log(J)/Math.LN2))}function o1(J,Q,$,Z,W){let{cos:Y,sin:X}=Math,K=Y($/2),H=X($/2),U=Y((Q+Z)/2),G=X((Q+Z)/2),F=Y((Q-Z)/2),E=X((Q-Z)/2),O=Y((Z-Q)/2),R=X((Z-Q)/2);switch(W){case"XYX":J.set(K*G,H*F,H*E,K*U);break;case"YZY":J.set(H*E,K*G,H*F,K*U);break;case"ZXZ":J.set(H*F,H*E,K*G,K*U);break;case"XZX":J.set(K*G,H*R,H*O,K*U);break;case"YXY":J.set(H*O,K*G,H*R,K*U);break;case"ZYZ":J.set(H*R,H*O,K*G,K*U);break;default:O0("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+W)}}function Z9(J,Q){switch(Q.constructor){case Float32Array:return J;case Uint32Array:return J/4294967295;case Uint16Array:return J/65535;case Uint8Array:return J/255;case Int32Array:return Math.max(J/2147483647,-1);case Int16Array:return Math.max(J/32767,-1);case Int8Array:return Math.max(J/127,-1);default:throw Error("Invalid component type.")}}function QJ(J,Q){switch(Q.constructor){case Float32Array:return J;case Uint32Array:return Math.round(J*4294967295);case Uint16Array:return Math.round(J*65535);case Uint8Array:return Math.round(J*255);case Int32Array:return Math.round(J*2147483647);case Int16Array:return Math.round(J*32767);case Int8Array:return Math.round(J*127);default:throw Error("Invalid component type.")}}var j6={DEG2RAD:M6,RAD2DEG:V6,generateUUID:D9,clamp:s0,euclideanModulo:aX,mapLinear:y1,inverseLerp:x1,lerp:qQ,damp:b1,pingpong:h1,smoothstep:f1,smootherstep:g1,randInt:p1,randFloat:u1,randFloatSpread:d1,seededRandom:m1,degToRad:l1,radToDeg:c1,isPowerOfTwo:n1,ceilPowerOfTwo:s1,floorPowerOfTwo:i1,setQuaternionFromProperEuler:o1,normalize:QJ,denormalize:Z9};class i{static{i.prototype.isVector2=!0}constructor(J=0,Q=0){this.x=J,this.y=Q}get width(){return this.x}set width(J){this.x=J}get height(){return this.y}set height(J){this.y=J}set(J,Q){return this.x=J,this.y=Q,this}setScalar(J){return this.x=J,this.y=J,this}setX(J){return this.x=J,this}setY(J){return this.y=J,this}setComponent(J,Q){switch(J){case 0:this.x=Q;break;case 1:this.y=Q;break;default:throw Error("index is out of range: "+J)}return this}getComponent(J){switch(J){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+J)}}clone(){return new this.constructor(this.x,this.y)}copy(J){return this.x=J.x,this.y=J.y,this}add(J){return this.x+=J.x,this.y+=J.y,this}addScalar(J){return this.x+=J,this.y+=J,this}addVectors(J,Q){return this.x=J.x+Q.x,this.y=J.y+Q.y,this}addScaledVector(J,Q){return this.x+=J.x*Q,this.y+=J.y*Q,this}sub(J){return this.x-=J.x,this.y-=J.y,this}subScalar(J){return this.x-=J,this.y-=J,this}subVectors(J,Q){return this.x=J.x-Q.x,this.y=J.y-Q.y,this}multiply(J){return this.x*=J.x,this.y*=J.y,this}multiplyScalar(J){return this.x*=J,this.y*=J,this}divide(J){return this.x/=J.x,this.y/=J.y,this}divideScalar(J){return this.multiplyScalar(1/J)}applyMatrix3(J){let Q=this.x,$=this.y,Z=J.elements;return this.x=Z[0]*Q+Z[3]*$+Z[6],this.y=Z[1]*Q+Z[4]*$+Z[7],this}min(J){return this.x=Math.min(this.x,J.x),this.y=Math.min(this.y,J.y),this}max(J){return this.x=Math.max(this.x,J.x),this.y=Math.max(this.y,J.y),this}clamp(J,Q){return this.x=s0(this.x,J.x,Q.x),this.y=s0(this.y,J.y,Q.y),this}clampScalar(J,Q){return this.x=s0(this.x,J,Q),this.y=s0(this.y,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(s0($,J,Q))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(J){return this.x*J.x+this.y*J.y}cross(J){return this.x*J.y-this.y*J.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(J){let Q=Math.sqrt(this.lengthSq()*J.lengthSq());if(Q===0)return Math.PI/2;let $=this.dot(J)/Q;return Math.acos(s0($,-1,1))}distanceTo(J){return Math.sqrt(this.distanceToSquared(J))}distanceToSquared(J){let Q=this.x-J.x,$=this.y-J.y;return Q*Q+$*$}manhattanDistanceTo(J){return Math.abs(this.x-J.x)+Math.abs(this.y-J.y)}setLength(J){return this.normalize().multiplyScalar(J)}lerp(J,Q){return this.x+=(J.x-this.x)*Q,this.y+=(J.y-this.y)*Q,this}lerpVectors(J,Q,$){return this.x=J.x+(Q.x-J.x)*$,this.y=J.y+(Q.y-J.y)*$,this}equals(J){return J.x===this.x&&J.y===this.y}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this}rotateAround(J,Q){let $=Math.cos(Q),Z=Math.sin(Q),W=this.x-J.x,Y=this.y-J.y;return this.x=W*$-Y*Z+J.x,this.y=W*Z+Y*$+J.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class IJ{constructor(J=0,Q=0,$=0,Z=1){this.isQuaternion=!0,this._x=J,this._y=Q,this._z=$,this._w=Z}static slerpFlat(J,Q,$,Z,W,Y,X){let K=$[Z+0],H=$[Z+1],U=$[Z+2],G=$[Z+3],F=W[Y+0],E=W[Y+1],O=W[Y+2],R=W[Y+3];if(G!==R||K!==F||H!==E||U!==O){let k=K*F+H*E+U*O+G*R;if(k<0)F=-F,E=-E,O=-O,R=-R,k=-k;let q=1-X;if(k<0.9995){let N=Math.acos(k),L=Math.sin(N);q=Math.sin(q*N)/L,X=Math.sin(X*N)/L,K=K*q+F*X,H=H*q+E*X,U=U*q+O*X,G=G*q+R*X}else{K=K*q+F*X,H=H*q+E*X,U=U*q+O*X,G=G*q+R*X;let N=1/Math.sqrt(K*K+H*H+U*U+G*G);K*=N,H*=N,U*=N,G*=N}}J[Q]=K,J[Q+1]=H,J[Q+2]=U,J[Q+3]=G}static multiplyQuaternionsFlat(J,Q,$,Z,W,Y){let X=$[Z],K=$[Z+1],H=$[Z+2],U=$[Z+3],G=W[Y],F=W[Y+1],E=W[Y+2],O=W[Y+3];return J[Q]=X*O+U*G+K*E-H*F,J[Q+1]=K*O+U*F+H*G-X*E,J[Q+2]=H*O+U*E+X*F-K*G,J[Q+3]=U*O-X*G-K*F-H*E,J}get x(){return this._x}set x(J){this._x=J,this._onChangeCallback()}get y(){return this._y}set y(J){this._y=J,this._onChangeCallback()}get z(){return this._z}set z(J){this._z=J,this._onChangeCallback()}get w(){return this._w}set w(J){this._w=J,this._onChangeCallback()}set(J,Q,$,Z){return this._x=J,this._y=Q,this._z=$,this._w=Z,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(J){return this._x=J.x,this._y=J.y,this._z=J.z,this._w=J.w,this._onChangeCallback(),this}setFromEuler(J,Q=!0){let{_x:$,_y:Z,_z:W,_order:Y}=J,X=Math.cos,K=Math.sin,H=X($/2),U=X(Z/2),G=X(W/2),F=K($/2),E=K(Z/2),O=K(W/2);switch(Y){case"XYZ":this._x=F*U*G+H*E*O,this._y=H*E*G-F*U*O,this._z=H*U*O+F*E*G,this._w=H*U*G-F*E*O;break;case"YXZ":this._x=F*U*G+H*E*O,this._y=H*E*G-F*U*O,this._z=H*U*O-F*E*G,this._w=H*U*G+F*E*O;break;case"ZXY":this._x=F*U*G-H*E*O,this._y=H*E*G+F*U*O,this._z=H*U*O+F*E*G,this._w=H*U*G-F*E*O;break;case"ZYX":this._x=F*U*G-H*E*O,this._y=H*E*G+F*U*O,this._z=H*U*O-F*E*G,this._w=H*U*G+F*E*O;break;case"YZX":this._x=F*U*G+H*E*O,this._y=H*E*G+F*U*O,this._z=H*U*O-F*E*G,this._w=H*U*G-F*E*O;break;case"XZY":this._x=F*U*G-H*E*O,this._y=H*E*G-F*U*O,this._z=H*U*O+F*E*G,this._w=H*U*G+F*E*O;break;default:O0("Quaternion: .setFromEuler() encountered an unknown order: "+Y)}if(Q===!0)this._onChangeCallback();return this}setFromAxisAngle(J,Q){let $=Q/2,Z=Math.sin($);return this._x=J.x*Z,this._y=J.y*Z,this._z=J.z*Z,this._w=Math.cos($),this._onChangeCallback(),this}setFromRotationMatrix(J){let Q=J.elements,$=Q[0],Z=Q[4],W=Q[8],Y=Q[1],X=Q[5],K=Q[9],H=Q[2],U=Q[6],G=Q[10],F=$+X+G;if(F>0){let E=0.5/Math.sqrt(F+1);this._w=0.25/E,this._x=(U-K)*E,this._y=(W-H)*E,this._z=(Y-Z)*E}else if($>X&&$>G){let E=2*Math.sqrt(1+$-X-G);this._w=(U-K)/E,this._x=0.25*E,this._y=(Z+Y)/E,this._z=(W+H)/E}else if(X>G){let E=2*Math.sqrt(1+X-$-G);this._w=(W-H)/E,this._x=(Z+Y)/E,this._y=0.25*E,this._z=(K+U)/E}else{let E=2*Math.sqrt(1+G-$-X);this._w=(Y-Z)/E,this._x=(W+H)/E,this._y=(K+U)/E,this._z=0.25*E}return this._onChangeCallback(),this}setFromUnitVectors(J,Q){let $=J.dot(Q)+1;if($<0.00000001)if($=0,Math.abs(J.x)>Math.abs(J.z))this._x=-J.y,this._y=J.x,this._z=0,this._w=$;else this._x=0,this._y=-J.z,this._z=J.y,this._w=$;else this._x=J.y*Q.z-J.z*Q.y,this._y=J.z*Q.x-J.x*Q.z,this._z=J.x*Q.y-J.y*Q.x,this._w=$;return this.normalize()}angleTo(J){return 2*Math.acos(Math.abs(s0(this.dot(J),-1,1)))}rotateTowards(J,Q){let $=this.angleTo(J);if($===0)return this;let Z=Math.min(1,Q/$);return this.slerp(J,Z),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(J){return this._x*J._x+this._y*J._y+this._z*J._z+this._w*J._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let J=this.length();if(J===0)this._x=0,this._y=0,this._z=0,this._w=1;else J=1/J,this._x=this._x*J,this._y=this._y*J,this._z=this._z*J,this._w=this._w*J;return this._onChangeCallback(),this}multiply(J){return this.multiplyQuaternions(this,J)}premultiply(J){return this.multiplyQuaternions(J,this)}multiplyQuaternions(J,Q){let{_x:$,_y:Z,_z:W,_w:Y}=J,X=Q._x,K=Q._y,H=Q._z,U=Q._w;return this._x=$*U+Y*X+Z*H-W*K,this._y=Z*U+Y*K+W*X-$*H,this._z=W*U+Y*H+$*K-Z*X,this._w=Y*U-$*X-Z*K-W*H,this._onChangeCallback(),this}slerp(J,Q){let{_x:$,_y:Z,_z:W,_w:Y}=J,X=this.dot(J);if(X<0)$=-$,Z=-Z,W=-W,Y=-Y,X=-X;let K=1-Q;if(X<0.9995){let H=Math.acos(X),U=Math.sin(H);K=Math.sin(K*H)/U,Q=Math.sin(Q*H)/U,this._x=this._x*K+$*Q,this._y=this._y*K+Z*Q,this._z=this._z*K+W*Q,this._w=this._w*K+Y*Q,this._onChangeCallback()}else this._x=this._x*K+$*Q,this._y=this._y*K+Z*Q,this._z=this._z*K+W*Q,this._w=this._w*K+Y*Q,this.normalize();return this}slerpQuaternions(J,Q,$){return this.copy(J).slerp(Q,$)}random(){let J=2*Math.PI*Math.random(),Q=2*Math.PI*Math.random(),$=Math.random(),Z=Math.sqrt(1-$),W=Math.sqrt($);return this.set(Z*Math.sin(J),Z*Math.cos(J),W*Math.sin(Q),W*Math.cos(Q))}equals(J){return J._x===this._x&&J._y===this._y&&J._z===this._z&&J._w===this._w}fromArray(J,Q=0){return this._x=J[Q],this._y=J[Q+1],this._z=J[Q+2],this._w=J[Q+3],this._onChangeCallback(),this}toArray(J=[],Q=0){return J[Q]=this._x,J[Q+1]=this._y,J[Q+2]=this._z,J[Q+3]=this._w,J}fromBufferAttribute(J,Q){return this._x=J.getX(Q),this._y=J.getY(Q),this._z=J.getZ(Q),this._w=J.getW(Q),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(J){return this._onChangeCallback=J,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class T{static{T.prototype.isVector3=!0}constructor(J=0,Q=0,$=0){this.x=J,this.y=Q,this.z=$}set(J,Q,$){if($===void 0)$=this.z;return this.x=J,this.y=Q,this.z=$,this}setScalar(J){return this.x=J,this.y=J,this.z=J,this}setX(J){return this.x=J,this}setY(J){return this.y=J,this}setZ(J){return this.z=J,this}setComponent(J,Q){switch(J){case 0:this.x=Q;break;case 1:this.y=Q;break;case 2:this.z=Q;break;default:throw Error("index is out of range: "+J)}return this}getComponent(J){switch(J){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+J)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(J){return this.x=J.x,this.y=J.y,this.z=J.z,this}add(J){return this.x+=J.x,this.y+=J.y,this.z+=J.z,this}addScalar(J){return this.x+=J,this.y+=J,this.z+=J,this}addVectors(J,Q){return this.x=J.x+Q.x,this.y=J.y+Q.y,this.z=J.z+Q.z,this}addScaledVector(J,Q){return this.x+=J.x*Q,this.y+=J.y*Q,this.z+=J.z*Q,this}sub(J){return this.x-=J.x,this.y-=J.y,this.z-=J.z,this}subScalar(J){return this.x-=J,this.y-=J,this.z-=J,this}subVectors(J,Q){return this.x=J.x-Q.x,this.y=J.y-Q.y,this.z=J.z-Q.z,this}multiply(J){return this.x*=J.x,this.y*=J.y,this.z*=J.z,this}multiplyScalar(J){return this.x*=J,this.y*=J,this.z*=J,this}multiplyVectors(J,Q){return this.x=J.x*Q.x,this.y=J.y*Q.y,this.z=J.z*Q.z,this}applyEuler(J){return this.applyQuaternion(dH.setFromEuler(J))}applyAxisAngle(J,Q){return this.applyQuaternion(dH.setFromAxisAngle(J,Q))}applyMatrix3(J){let Q=this.x,$=this.y,Z=this.z,W=J.elements;return this.x=W[0]*Q+W[3]*$+W[6]*Z,this.y=W[1]*Q+W[4]*$+W[7]*Z,this.z=W[2]*Q+W[5]*$+W[8]*Z,this}applyNormalMatrix(J){return this.applyMatrix3(J).normalize()}applyMatrix4(J){let Q=this.x,$=this.y,Z=this.z,W=J.elements,Y=1/(W[3]*Q+W[7]*$+W[11]*Z+W[15]);return this.x=(W[0]*Q+W[4]*$+W[8]*Z+W[12])*Y,this.y=(W[1]*Q+W[5]*$+W[9]*Z+W[13])*Y,this.z=(W[2]*Q+W[6]*$+W[10]*Z+W[14])*Y,this}applyQuaternion(J){let Q=this.x,$=this.y,Z=this.z,W=J.x,Y=J.y,X=J.z,K=J.w,H=2*(Y*Z-X*$),U=2*(X*Q-W*Z),G=2*(W*$-Y*Q);return this.x=Q+K*H+Y*G-X*U,this.y=$+K*U+X*H-W*G,this.z=Z+K*G+W*U-Y*H,this}project(J){return this.applyMatrix4(J.matrixWorldInverse).applyMatrix4(J.projectionMatrix)}unproject(J){return this.applyMatrix4(J.projectionMatrixInverse).applyMatrix4(J.matrixWorld)}transformDirection(J){let Q=this.x,$=this.y,Z=this.z,W=J.elements;return this.x=W[0]*Q+W[4]*$+W[8]*Z,this.y=W[1]*Q+W[5]*$+W[9]*Z,this.z=W[2]*Q+W[6]*$+W[10]*Z,this.normalize()}divide(J){return this.x/=J.x,this.y/=J.y,this.z/=J.z,this}divideScalar(J){return this.multiplyScalar(1/J)}min(J){return this.x=Math.min(this.x,J.x),this.y=Math.min(this.y,J.y),this.z=Math.min(this.z,J.z),this}max(J){return this.x=Math.max(this.x,J.x),this.y=Math.max(this.y,J.y),this.z=Math.max(this.z,J.z),this}clamp(J,Q){return this.x=s0(this.x,J.x,Q.x),this.y=s0(this.y,J.y,Q.y),this.z=s0(this.z,J.z,Q.z),this}clampScalar(J,Q){return this.x=s0(this.x,J,Q),this.y=s0(this.y,J,Q),this.z=s0(this.z,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(s0($,J,Q))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(J){return this.x*J.x+this.y*J.y+this.z*J.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(J){return this.normalize().multiplyScalar(J)}lerp(J,Q){return this.x+=(J.x-this.x)*Q,this.y+=(J.y-this.y)*Q,this.z+=(J.z-this.z)*Q,this}lerpVectors(J,Q,$){return this.x=J.x+(Q.x-J.x)*$,this.y=J.y+(Q.y-J.y)*$,this.z=J.z+(Q.z-J.z)*$,this}cross(J){return this.crossVectors(this,J)}crossVectors(J,Q){let{x:$,y:Z,z:W}=J,Y=Q.x,X=Q.y,K=Q.z;return this.x=Z*K-W*X,this.y=W*Y-$*K,this.z=$*X-Z*Y,this}projectOnVector(J){let Q=J.lengthSq();if(Q===0)return this.set(0,0,0);let $=J.dot(this)/Q;return this.copy(J).multiplyScalar($)}projectOnPlane(J){return FY.copy(this).projectOnVector(J),this.sub(FY)}reflect(J){return this.sub(FY.copy(J).multiplyScalar(2*this.dot(J)))}angleTo(J){let Q=Math.sqrt(this.lengthSq()*J.lengthSq());if(Q===0)return Math.PI/2;let $=this.dot(J)/Q;return Math.acos(s0($,-1,1))}distanceTo(J){return Math.sqrt(this.distanceToSquared(J))}distanceToSquared(J){let Q=this.x-J.x,$=this.y-J.y,Z=this.z-J.z;return Q*Q+$*$+Z*Z}manhattanDistanceTo(J){return Math.abs(this.x-J.x)+Math.abs(this.y-J.y)+Math.abs(this.z-J.z)}setFromSpherical(J){return this.setFromSphericalCoords(J.radius,J.phi,J.theta)}setFromSphericalCoords(J,Q,$){let Z=Math.sin(Q)*J;return this.x=Z*Math.sin($),this.y=Math.cos(Q)*J,this.z=Z*Math.cos($),this}setFromCylindrical(J){return this.setFromCylindricalCoords(J.radius,J.theta,J.y)}setFromCylindricalCoords(J,Q,$){return this.x=J*Math.sin(Q),this.y=$,this.z=J*Math.cos(Q),this}setFromMatrixPosition(J){let Q=J.elements;return this.x=Q[12],this.y=Q[13],this.z=Q[14],this}setFromMatrixScale(J){let Q=this.setFromMatrixColumn(J,0).length(),$=this.setFromMatrixColumn(J,1).length(),Z=this.setFromMatrixColumn(J,2).length();return this.x=Q,this.y=$,this.z=Z,this}setFromMatrixColumn(J,Q){return this.fromArray(J.elements,Q*4)}setFromMatrix3Column(J,Q){return this.fromArray(J.elements,Q*3)}setFromEuler(J){return this.x=J._x,this.y=J._y,this.z=J._z,this}setFromColor(J){return this.x=J.r,this.y=J.g,this.z=J.b,this}equals(J){return J.x===this.x&&J.y===this.y&&J.z===this.z}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this.z=J[Q+2],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J[Q+2]=this.z,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this.z=J.getZ(Q),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let J=Math.random()*Math.PI*2,Q=Math.random()*2-1,$=Math.sqrt(1-Q*Q);return this.x=$*Math.cos(J),this.y=Q,this.z=$*Math.sin(J),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}var FY=new T,dH=new IJ;class o0{static{o0.prototype.isMatrix3=!0}constructor(J,Q,$,Z,W,Y,X,K,H){if(this.elements=[1,0,0,0,1,0,0,0,1],J!==void 0)this.set(J,Q,$,Z,W,Y,X,K,H)}set(J,Q,$,Z,W,Y,X,K,H){let U=this.elements;return U[0]=J,U[1]=Z,U[2]=X,U[3]=Q,U[4]=W,U[5]=K,U[6]=$,U[7]=Y,U[8]=H,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(J){let Q=this.elements,$=J.elements;return Q[0]=$[0],Q[1]=$[1],Q[2]=$[2],Q[3]=$[3],Q[4]=$[4],Q[5]=$[5],Q[6]=$[6],Q[7]=$[7],Q[8]=$[8],this}extractBasis(J,Q,$){return J.setFromMatrix3Column(this,0),Q.setFromMatrix3Column(this,1),$.setFromMatrix3Column(this,2),this}setFromMatrix4(J){let Q=J.elements;return this.set(Q[0],Q[4],Q[8],Q[1],Q[5],Q[9],Q[2],Q[6],Q[10]),this}multiply(J){return this.multiplyMatrices(this,J)}premultiply(J){return this.multiplyMatrices(J,this)}multiplyMatrices(J,Q){let $=J.elements,Z=Q.elements,W=this.elements,Y=$[0],X=$[3],K=$[6],H=$[1],U=$[4],G=$[7],F=$[2],E=$[5],O=$[8],R=Z[0],k=Z[3],q=Z[6],N=Z[1],L=Z[4],D=Z[7],V=Z[2],I=Z[5],z=Z[8];return W[0]=Y*R+X*N+K*V,W[3]=Y*k+X*L+K*I,W[6]=Y*q+X*D+K*z,W[1]=H*R+U*N+G*V,W[4]=H*k+U*L+G*I,W[7]=H*q+U*D+G*z,W[2]=F*R+E*N+O*V,W[5]=F*k+E*L+O*I,W[8]=F*q+E*D+O*z,this}multiplyScalar(J){let Q=this.elements;return Q[0]*=J,Q[3]*=J,Q[6]*=J,Q[1]*=J,Q[4]*=J,Q[7]*=J,Q[2]*=J,Q[5]*=J,Q[8]*=J,this}determinant(){let J=this.elements,Q=J[0],$=J[1],Z=J[2],W=J[3],Y=J[4],X=J[5],K=J[6],H=J[7],U=J[8];return Q*Y*U-Q*X*H-$*W*U+$*X*K+Z*W*H-Z*Y*K}invert(){let J=this.elements,Q=J[0],$=J[1],Z=J[2],W=J[3],Y=J[4],X=J[5],K=J[6],H=J[7],U=J[8],G=U*Y-X*H,F=X*K-U*W,E=H*W-Y*K,O=Q*G+$*F+Z*E;if(O===0)return this.set(0,0,0,0,0,0,0,0,0);let R=1/O;return J[0]=G*R,J[1]=(Z*H-U*$)*R,J[2]=(X*$-Z*Y)*R,J[3]=F*R,J[4]=(U*Q-Z*K)*R,J[5]=(Z*W-X*Q)*R,J[6]=E*R,J[7]=($*K-H*Q)*R,J[8]=(Y*Q-$*W)*R,this}transpose(){let J,Q=this.elements;return J=Q[1],Q[1]=Q[3],Q[3]=J,J=Q[2],Q[2]=Q[6],Q[6]=J,J=Q[5],Q[5]=Q[7],Q[7]=J,this}getNormalMatrix(J){return this.setFromMatrix4(J).invert().transpose()}transposeIntoArray(J){let Q=this.elements;return J[0]=Q[0],J[1]=Q[3],J[2]=Q[6],J[3]=Q[1],J[4]=Q[4],J[5]=Q[7],J[6]=Q[2],J[7]=Q[5],J[8]=Q[8],this}setUvTransform(J,Q,$,Z,W,Y,X){let K=Math.cos(W),H=Math.sin(W);return this.set($*K,$*H,-$*(K*Y+H*X)+Y+J,-Z*H,Z*K,-Z*(-H*Y+K*X)+X+Q,0,0,1),this}scale(J,Q){return this.premultiply(NY.makeScale(J,Q)),this}rotate(J){return this.premultiply(NY.makeRotation(-J)),this}translate(J,Q){return this.premultiply(NY.makeTranslation(J,Q)),this}makeTranslation(J,Q){if(J.isVector2)this.set(1,0,J.x,0,1,J.y,0,0,1);else this.set(1,0,J,0,1,Q,0,0,1);return this}makeRotation(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(Q,-$,0,$,Q,0,0,0,1),this}makeScale(J,Q){return this.set(J,0,0,0,Q,0,0,0,1),this}equals(J){let Q=this.elements,$=J.elements;for(let Z=0;Z<9;Z++)if(Q[Z]!==$[Z])return!1;return!0}fromArray(J,Q=0){for(let $=0;$<9;$++)this.elements[$]=J[$+Q];return this}toArray(J=[],Q=0){let $=this.elements;return J[Q]=$[0],J[Q+1]=$[1],J[Q+2]=$[2],J[Q+3]=$[3],J[Q+4]=$[4],J[Q+5]=$[5],J[Q+6]=$[6],J[Q+7]=$[7],J[Q+8]=$[8],J}clone(){return new this.constructor().fromArray(this.elements)}}var NY=new o0,mH=new o0().set(0.4123908,0.3575843,0.1804808,0.212639,0.7151687,0.0721923,0.0193308,0.1191948,0.9505322),lH=new o0().set(3.2409699,-1.5373832,-0.4986108,-0.9692436,1.8759675,0.0415551,0.0556301,-0.203977,1.0569715);function a1(){let J={enabled:!0,workingColorSpace:"srgb-linear",spaces:{},convert:function(W,Y,X){if(this.enabled===!1||Y===X||!Y||!X)return W;if(this.spaces[Y].transfer==="srgb")W.r=V8(W.r),W.g=V8(W.g),W.b=V8(W.b);if(this.spaces[Y].primaries!==this.spaces[X].primaries)W.applyMatrix3(this.spaces[Y].toXYZ),W.applyMatrix3(this.spaces[X].fromXYZ);if(this.spaces[X].transfer==="srgb")W.r=D7(W.r),W.g=D7(W.g),W.b=D7(W.b);return W},workingToColorSpace:function(W,Y){return this.convert(W,this.workingColorSpace,Y)},colorSpaceToWorking:function(W,Y){return this.convert(W,Y,this.workingColorSpace)},getPrimaries:function(W){return this.spaces[W].primaries},getTransfer:function(W){if(W==="")return"linear";return this.spaces[W].transfer},getToneMappingMode:function(W){return this.spaces[W].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(W,Y=this.workingColorSpace){return W.fromArray(this.spaces[Y].luminanceCoefficients)},define:function(W){Object.assign(this.spaces,W)},_getMatrix:function(W,Y,X){return W.copy(this.spaces[Y].toXYZ).multiply(this.spaces[X].fromXYZ)},_getDrawingBufferColorSpace:function(W){return this.spaces[W].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(W=this.workingColorSpace){return this.spaces[W].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(W,Y){return DQ("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),J.workingToColorSpace(W,Y)},toWorkingColorSpace:function(W,Y){return DQ("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),J.colorSpaceToWorking(W,Y)}},Q=[0.64,0.33,0.3,0.6,0.15,0.06],$=[0.2126,0.7152,0.0722],Z=[0.3127,0.329];return J.define({["srgb-linear"]:{primaries:Q,whitePoint:Z,transfer:"linear",toXYZ:mH,fromXYZ:lH,luminanceCoefficients:$,workingColorSpaceConfig:{unpackColorSpace:"srgb"},outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}},["srgb"]:{primaries:Q,whitePoint:Z,transfer:"srgb",toXYZ:mH,fromXYZ:lH,luminanceCoefficients:$,outputColorSpaceConfig:{drawingBufferColorSpace:"srgb"}}}),J}var t0=a1();function V8(J){return J<0.04045?J*0.0773993808:Math.pow(J*0.9478672986+0.0521327014,2.4)}function D7(J){return J<0.0031308?J*12.92:1.055*Math.pow(J,0.41666)-0.055}var r6;class FW{static getDataURL(J,Q="image/png"){if(/^data:/i.test(J.src))return J.src;if(typeof HTMLCanvasElement>"u")return J.src;let $;if(J instanceof HTMLCanvasElement)$=J;else{if(r6===void 0)r6=k7("canvas");r6.width=J.width,r6.height=J.height;let Z=r6.getContext("2d");if(J instanceof ImageData)Z.putImageData(J,0,0);else Z.drawImage(J,0,0,J.width,J.height);$=r6}return $.toDataURL(Q)}static sRGBToLinear(J){if(typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&J instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&J instanceof ImageBitmap){let Q=k7("canvas");Q.width=J.width,Q.height=J.height;let $=Q.getContext("2d");$.drawImage(J,0,0,J.width,J.height);let Z=$.getImageData(0,0,J.width,J.height),W=Z.data;for(let Y=0;Y<W.length;Y++)W[Y]=V8(W[Y]/255)*255;return $.putImageData(Z,0,0),Q}else if(J.data){let Q=J.data.slice(0);for(let $=0;$<Q.length;$++)if(Q instanceof Uint8Array||Q instanceof Uint8ClampedArray)Q[$]=Math.floor(V8(Q[$]/255)*255);else Q[$]=V8(Q[$]);return{data:Q,width:J.width,height:J.height}}else return O0("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),J}}var r1=0;class W8{constructor(J=null){this.isSource=!0,Object.defineProperty(this,"id",{value:r1++}),this.uuid=D9(),this.data=J,this.dataReady=!0,this.version=0}getSize(J){let Q=this.data;if(typeof HTMLVideoElement<"u"&&Q instanceof HTMLVideoElement)J.set(Q.videoWidth,Q.videoHeight,0);else if(typeof VideoFrame<"u"&&Q instanceof VideoFrame)J.set(Q.displayWidth,Q.displayHeight,0);else if(Q!==null)J.set(Q.width,Q.height,Q.depth||0);else J.set(0,0,0);return J}set needsUpdate(J){if(J===!0)this.version++}toJSON(J){let Q=J===void 0||typeof J==="string";if(!Q&&J.images[this.uuid]!==void 0)return J.images[this.uuid];let $={uuid:this.uuid,url:""},Z=this.data;if(Z!==null){let W;if(Array.isArray(Z)){W=[];for(let Y=0,X=Z.length;Y<X;Y++)if(Z[Y].isDataTexture)W.push(OY(Z[Y].image));else W.push(OY(Z[Y]))}else W=OY(Z);$.url=W}if(!Q)J.images[this.uuid]=$;return $}}function OY(J){if(typeof HTMLImageElement<"u"&&J instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&J instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&J instanceof ImageBitmap)return FW.getDataURL(J);else if(J.data)return{data:Array.from(J.data),width:J.width,height:J.height,type:J.data.constructor.name};else return O0("Texture: Unable to serialize Texture."),{}}var t1=0,qY=new T;class MJ extends V9{constructor(J=MJ.DEFAULT_IMAGE,Q=MJ.DEFAULT_MAPPING,$=1001,Z=1001,W=1006,Y=1008,X=1023,K=1009,H=MJ.DEFAULT_ANISOTROPY,U=""){super();this.isTexture=!0,Object.defineProperty(this,"id",{value:t1++}),this.uuid=D9(),this.name="",this.source=new W8(J),this.mipmaps=[],this.mapping=Q,this.channel=0,this.wrapS=$,this.wrapT=Z,this.magFilter=W,this.minFilter=Y,this.anisotropy=H,this.format=X,this.internalFormat=null,this.type=K,this.offset=new i(0,0),this.repeat=new i(1,1),this.center=new i(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new o0,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=U,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=J&&J.depth&&J.depth>1?!0:!1,this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(qY).x}get height(){return this.source.getSize(qY).y}get depth(){return this.source.getSize(qY).z}get image(){return this.source.data}set image(J){this.source.data=J}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(J,Q){this.updateRanges.push({start:J,count:Q})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(J){return this.name=J.name,this.source=J.source,this.mipmaps=J.mipmaps.slice(0),this.mapping=J.mapping,this.channel=J.channel,this.wrapS=J.wrapS,this.wrapT=J.wrapT,this.magFilter=J.magFilter,this.minFilter=J.minFilter,this.anisotropy=J.anisotropy,this.format=J.format,this.internalFormat=J.internalFormat,this.type=J.type,this.normalized=J.normalized,this.offset.copy(J.offset),this.repeat.copy(J.repeat),this.center.copy(J.center),this.rotation=J.rotation,this.matrixAutoUpdate=J.matrixAutoUpdate,this.matrix.copy(J.matrix),this.generateMipmaps=J.generateMipmaps,this.premultiplyAlpha=J.premultiplyAlpha,this.flipY=J.flipY,this.unpackAlignment=J.unpackAlignment,this.colorSpace=J.colorSpace,this.renderTarget=J.renderTarget,this.isRenderTargetTexture=J.isRenderTargetTexture,this.isArrayTexture=J.isArrayTexture,this.userData=JSON.parse(JSON.stringify(J.userData)),this.needsUpdate=!0,this}setValues(J){for(let Q in J){let $=J[Q];if($===void 0){O0(`Texture.setValues(): parameter '${Q}' has value of undefined.`);continue}let Z=this[Q];if(Z===void 0){O0(`Texture.setValues(): property '${Q}' does not exist.`);continue}if(Z&&$&&(Z.isVector2&&$.isVector2))Z.copy($);else if(Z&&$&&(Z.isVector3&&$.isVector3))Z.copy($);else if(Z&&$&&(Z.isMatrix3&&$.isMatrix3))Z.copy($);else this[Q]=$}}toJSON(J){let Q=J===void 0||typeof J==="string";if(!Q&&J.textures[this.uuid]!==void 0)return J.textures[this.uuid];let $={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(J).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(Object.keys(this.userData).length>0)$.userData=this.userData;if(!Q)J.textures[this.uuid]=$;return $}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(J){if(this.mapping!==300)return J;if(J.applyMatrix3(this.matrix),J.x<0||J.x>1)switch(this.wrapS){case 1000:J.x=J.x-Math.floor(J.x);break;case 1001:J.x=J.x<0?0:1;break;case 1002:if(Math.abs(Math.floor(J.x)%2)===1)J.x=Math.ceil(J.x)-J.x;else J.x=J.x-Math.floor(J.x);break}if(J.y<0||J.y>1)switch(this.wrapT){case 1000:J.y=J.y-Math.floor(J.y);break;case 1001:J.y=J.y<0?0:1;break;case 1002:if(Math.abs(Math.floor(J.y)%2)===1)J.y=Math.ceil(J.y)-J.y;else J.y=J.y-Math.floor(J.y);break}if(this.flipY)J.y=1-J.y;return J}set needsUpdate(J){if(J===!0)this.version++,this.source.needsUpdate=!0}set needsPMREMUpdate(J){if(J===!0)this.pmremVersion++}}MJ.DEFAULT_IMAGE=null;MJ.DEFAULT_MAPPING=300;MJ.DEFAULT_ANISOTROPY=1;class FJ{static{FJ.prototype.isVector4=!0}constructor(J=0,Q=0,$=0,Z=1){this.x=J,this.y=Q,this.z=$,this.w=Z}get width(){return this.z}set width(J){this.z=J}get height(){return this.w}set height(J){this.w=J}set(J,Q,$,Z){return this.x=J,this.y=Q,this.z=$,this.w=Z,this}setScalar(J){return this.x=J,this.y=J,this.z=J,this.w=J,this}setX(J){return this.x=J,this}setY(J){return this.y=J,this}setZ(J){return this.z=J,this}setW(J){return this.w=J,this}setComponent(J,Q){switch(J){case 0:this.x=Q;break;case 1:this.y=Q;break;case 2:this.z=Q;break;case 3:this.w=Q;break;default:throw Error("index is out of range: "+J)}return this}getComponent(J){switch(J){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+J)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(J){return this.x=J.x,this.y=J.y,this.z=J.z,this.w=J.w!==void 0?J.w:1,this}add(J){return this.x+=J.x,this.y+=J.y,this.z+=J.z,this.w+=J.w,this}addScalar(J){return this.x+=J,this.y+=J,this.z+=J,this.w+=J,this}addVectors(J,Q){return this.x=J.x+Q.x,this.y=J.y+Q.y,this.z=J.z+Q.z,this.w=J.w+Q.w,this}addScaledVector(J,Q){return this.x+=J.x*Q,this.y+=J.y*Q,this.z+=J.z*Q,this.w+=J.w*Q,this}sub(J){return this.x-=J.x,this.y-=J.y,this.z-=J.z,this.w-=J.w,this}subScalar(J){return this.x-=J,this.y-=J,this.z-=J,this.w-=J,this}subVectors(J,Q){return this.x=J.x-Q.x,this.y=J.y-Q.y,this.z=J.z-Q.z,this.w=J.w-Q.w,this}multiply(J){return this.x*=J.x,this.y*=J.y,this.z*=J.z,this.w*=J.w,this}multiplyScalar(J){return this.x*=J,this.y*=J,this.z*=J,this.w*=J,this}applyMatrix4(J){let Q=this.x,$=this.y,Z=this.z,W=this.w,Y=J.elements;return this.x=Y[0]*Q+Y[4]*$+Y[8]*Z+Y[12]*W,this.y=Y[1]*Q+Y[5]*$+Y[9]*Z+Y[13]*W,this.z=Y[2]*Q+Y[6]*$+Y[10]*Z+Y[14]*W,this.w=Y[3]*Q+Y[7]*$+Y[11]*Z+Y[15]*W,this}divide(J){return this.x/=J.x,this.y/=J.y,this.z/=J.z,this.w/=J.w,this}divideScalar(J){return this.multiplyScalar(1/J)}setAxisAngleFromQuaternion(J){this.w=2*Math.acos(J.w);let Q=Math.sqrt(1-J.w*J.w);if(Q<0.0001)this.x=1,this.y=0,this.z=0;else this.x=J.x/Q,this.y=J.y/Q,this.z=J.z/Q;return this}setAxisAngleFromRotationMatrix(J){let Q,$,Z,W,Y=0.01,X=0.1,K=J.elements,H=K[0],U=K[4],G=K[8],F=K[1],E=K[5],O=K[9],R=K[2],k=K[6],q=K[10];if(Math.abs(U-F)<0.01&&Math.abs(G-R)<0.01&&Math.abs(O-k)<0.01){if(Math.abs(U+F)<0.1&&Math.abs(G+R)<0.1&&Math.abs(O+k)<0.1&&Math.abs(H+E+q-3)<0.1)return this.set(1,0,0,0),this;Q=Math.PI;let L=(H+1)/2,D=(E+1)/2,V=(q+1)/2,I=(U+F)/4,z=(G+R)/4,B=(O+k)/4;if(L>D&&L>V)if(L<0.01)$=0,Z=0.707106781,W=0.707106781;else $=Math.sqrt(L),Z=I/$,W=z/$;else if(D>V)if(D<0.01)$=0.707106781,Z=0,W=0.707106781;else Z=Math.sqrt(D),$=I/Z,W=B/Z;else if(V<0.01)$=0.707106781,Z=0.707106781,W=0;else W=Math.sqrt(V),$=z/W,Z=B/W;return this.set($,Z,W,Q),this}let N=Math.sqrt((k-O)*(k-O)+(G-R)*(G-R)+(F-U)*(F-U));if(Math.abs(N)<0.001)N=1;return this.x=(k-O)/N,this.y=(G-R)/N,this.z=(F-U)/N,this.w=Math.acos((H+E+q-1)/2),this}setFromMatrixPosition(J){let Q=J.elements;return this.x=Q[12],this.y=Q[13],this.z=Q[14],this.w=Q[15],this}min(J){return this.x=Math.min(this.x,J.x),this.y=Math.min(this.y,J.y),this.z=Math.min(this.z,J.z),this.w=Math.min(this.w,J.w),this}max(J){return this.x=Math.max(this.x,J.x),this.y=Math.max(this.y,J.y),this.z=Math.max(this.z,J.z),this.w=Math.max(this.w,J.w),this}clamp(J,Q){return this.x=s0(this.x,J.x,Q.x),this.y=s0(this.y,J.y,Q.y),this.z=s0(this.z,J.z,Q.z),this.w=s0(this.w,J.w,Q.w),this}clampScalar(J,Q){return this.x=s0(this.x,J,Q),this.y=s0(this.y,J,Q),this.z=s0(this.z,J,Q),this.w=s0(this.w,J,Q),this}clampLength(J,Q){let $=this.length();return this.divideScalar($||1).multiplyScalar(s0($,J,Q))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(J){return this.x*J.x+this.y*J.y+this.z*J.z+this.w*J.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(J){return this.normalize().multiplyScalar(J)}lerp(J,Q){return this.x+=(J.x-this.x)*Q,this.y+=(J.y-this.y)*Q,this.z+=(J.z-this.z)*Q,this.w+=(J.w-this.w)*Q,this}lerpVectors(J,Q,$){return this.x=J.x+(Q.x-J.x)*$,this.y=J.y+(Q.y-J.y)*$,this.z=J.z+(Q.z-J.z)*$,this.w=J.w+(Q.w-J.w)*$,this}equals(J){return J.x===this.x&&J.y===this.y&&J.z===this.z&&J.w===this.w}fromArray(J,Q=0){return this.x=J[Q],this.y=J[Q+1],this.z=J[Q+2],this.w=J[Q+3],this}toArray(J=[],Q=0){return J[Q]=this.x,J[Q+1]=this.y,J[Q+2]=this.z,J[Q+3]=this.w,J}fromBufferAttribute(J,Q){return this.x=J.getX(Q),this.y=J.getY(Q),this.z=J.getZ(Q),this.w=J.getW(Q),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class xQ extends V9{constructor(J=1,Q=1,$={}){super();$=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},$),this.isRenderTarget=!0,this.width=J,this.height=Q,this.depth=$.depth,this.scissor=new FJ(0,0,J,Q),this.scissorTest=!1,this.viewport=new FJ(0,0,J,Q),this.textures=[];let Z={width:J,height:Q,depth:$.depth},W=new MJ(Z),Y=$.count;for(let X=0;X<Y;X++)this.textures[X]=W.clone(),this.textures[X].isRenderTargetTexture=!0,this.textures[X].renderTarget=this;this._setTextureOptions($),this.depthBuffer=$.depthBuffer,this.stencilBuffer=$.stencilBuffer,this.resolveDepthBuffer=$.resolveDepthBuffer,this.resolveStencilBuffer=$.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=$.depthTexture,this.samples=$.samples,this.multiview=$.multiview}_setTextureOptions(J={}){let Q={minFilter:1006,generateMipmaps:!1,flipY:!1,internalFormat:null};if(J.mapping!==void 0)Q.mapping=J.mapping;if(J.wrapS!==void 0)Q.wrapS=J.wrapS;if(J.wrapT!==void 0)Q.wrapT=J.wrapT;if(J.wrapR!==void 0)Q.wrapR=J.wrapR;if(J.magFilter!==void 0)Q.magFilter=J.magFilter;if(J.minFilter!==void 0)Q.minFilter=J.minFilter;if(J.format!==void 0)Q.format=J.format;if(J.type!==void 0)Q.type=J.type;if(J.anisotropy!==void 0)Q.anisotropy=J.anisotropy;if(J.colorSpace!==void 0)Q.colorSpace=J.colorSpace;if(J.flipY!==void 0)Q.flipY=J.flipY;if(J.generateMipmaps!==void 0)Q.generateMipmaps=J.generateMipmaps;if(J.internalFormat!==void 0)Q.internalFormat=J.internalFormat;for(let $=0;$<this.textures.length;$++)this.textures[$].setValues(Q)}get texture(){return this.textures[0]}set texture(J){this.textures[0]=J}set depthTexture(J){if(this._depthTexture!==null)this._depthTexture.renderTarget=null;if(J!==null)J.renderTarget=this;this._depthTexture=J}get depthTexture(){return this._depthTexture}setSize(J,Q,$=1){if(this.width!==J||this.height!==Q||this.depth!==$){this.width=J,this.height=Q,this.depth=$;for(let Z=0,W=this.textures.length;Z<W;Z++)if(this.textures[Z].image.width=J,this.textures[Z].image.height=Q,this.textures[Z].image.depth=$,this.textures[Z].isData3DTexture!==!0)this.textures[Z].isArrayTexture=this.textures[Z].image.depth>1;this.dispose()}this.viewport.set(0,0,J,Q),this.scissor.set(0,0,J,Q)}clone(){return new this.constructor().copy(this)}copy(J){this.width=J.width,this.height=J.height,this.depth=J.depth,this.scissor.copy(J.scissor),this.scissorTest=J.scissorTest,this.viewport.copy(J.viewport),this.textures.length=0;for(let Q=0,$=J.textures.length;Q<$;Q++){this.textures[Q]=J.textures[Q].clone(),this.textures[Q].isRenderTargetTexture=!0,this.textures[Q].renderTarget=this;let Z=Object.assign({},J.textures[Q].image);this.textures[Q].source=new W8(Z)}if(this.depthBuffer=J.depthBuffer,this.stencilBuffer=J.stencilBuffer,this.resolveDepthBuffer=J.resolveDepthBuffer,this.resolveStencilBuffer=J.resolveStencilBuffer,J.depthTexture!==null)this.depthTexture=J.depthTexture.clone();return this.samples=J.samples,this.multiview=J.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}}class PJ extends xQ{constructor(J=1,Q=1,$={}){super(J,Q,$);this.isWebGLRenderTarget=!0}}class v7 extends MJ{constructor(J=null,Q=1,$=1,Z=1){super(null);this.isDataArrayTexture=!0,this.image={data:J,width:Q,height:$,depth:Z},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(J){this.layerUpdates.add(J)}clearLayerUpdates(){this.layerUpdates.clear()}}class rX extends PJ{constructor(J=1,Q=1,$=1,Z={}){super(J,Q,Z);this.isWebGLArrayRenderTarget=!0,this.depth=$,this.texture=new v7(null,J,Q,$),this._setTextureOptions(Z),this.texture.isRenderTargetTexture=!0}}class y7 extends MJ{constructor(J=null,Q=1,$=1,Z=1){super(null);this.isData3DTexture=!0,this.image={data:J,width:Q,height:$,depth:Z},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class tX extends PJ{constructor(J=1,Q=1,$=1,Z={}){super(J,Q,Z);this.isWebGL3DRenderTarget=!0,this.depth=$,this.texture=new y7(null,J,Q,$),this._setTextureOptions(Z),this.texture.isRenderTargetTexture=!0}}class y0{static{y0.prototype.isMatrix4=!0}constructor(J,Q,$,Z,W,Y,X,K,H,U,G,F,E,O,R,k){if(this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],J!==void 0)this.set(J,Q,$,Z,W,Y,X,K,H,U,G,F,E,O,R,k)}set(J,Q,$,Z,W,Y,X,K,H,U,G,F,E,O,R,k){let q=this.elements;return q[0]=J,q[4]=Q,q[8]=$,q[12]=Z,q[1]=W,q[5]=Y,q[9]=X,q[13]=K,q[2]=H,q[6]=U,q[10]=G,q[14]=F,q[3]=E,q[7]=O,q[11]=R,q[15]=k,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new y0().fromArray(this.elements)}copy(J){let Q=this.elements,$=J.elements;return Q[0]=$[0],Q[1]=$[1],Q[2]=$[2],Q[3]=$[3],Q[4]=$[4],Q[5]=$[5],Q[6]=$[6],Q[7]=$[7],Q[8]=$[8],Q[9]=$[9],Q[10]=$[10],Q[11]=$[11],Q[12]=$[12],Q[13]=$[13],Q[14]=$[14],Q[15]=$[15],this}copyPosition(J){let Q=this.elements,$=J.elements;return Q[12]=$[12],Q[13]=$[13],Q[14]=$[14],this}setFromMatrix3(J){let Q=J.elements;return this.set(Q[0],Q[3],Q[6],0,Q[1],Q[4],Q[7],0,Q[2],Q[5],Q[8],0,0,0,0,1),this}extractBasis(J,Q,$){if(this.determinant()===0)return J.set(1,0,0),Q.set(0,1,0),$.set(0,0,1),this;return J.setFromMatrixColumn(this,0),Q.setFromMatrixColumn(this,1),$.setFromMatrixColumn(this,2),this}makeBasis(J,Q,$){return this.set(J.x,Q.x,$.x,0,J.y,Q.y,$.y,0,J.z,Q.z,$.z,0,0,0,0,1),this}extractRotation(J){if(J.determinant()===0)return this.identity();let Q=this.elements,$=J.elements,Z=1/t6.setFromMatrixColumn(J,0).length(),W=1/t6.setFromMatrixColumn(J,1).length(),Y=1/t6.setFromMatrixColumn(J,2).length();return Q[0]=$[0]*Z,Q[1]=$[1]*Z,Q[2]=$[2]*Z,Q[3]=0,Q[4]=$[4]*W,Q[5]=$[5]*W,Q[6]=$[6]*W,Q[7]=0,Q[8]=$[8]*Y,Q[9]=$[9]*Y,Q[10]=$[10]*Y,Q[11]=0,Q[12]=0,Q[13]=0,Q[14]=0,Q[15]=1,this}makeRotationFromEuler(J){let Q=this.elements,$=J.x,Z=J.y,W=J.z,Y=Math.cos($),X=Math.sin($),K=Math.cos(Z),H=Math.sin(Z),U=Math.cos(W),G=Math.sin(W);if(J.order==="XYZ"){let F=Y*U,E=Y*G,O=X*U,R=X*G;Q[0]=K*U,Q[4]=-K*G,Q[8]=H,Q[1]=E+O*H,Q[5]=F-R*H,Q[9]=-X*K,Q[2]=R-F*H,Q[6]=O+E*H,Q[10]=Y*K}else if(J.order==="YXZ"){let F=K*U,E=K*G,O=H*U,R=H*G;Q[0]=F+R*X,Q[4]=O*X-E,Q[8]=Y*H,Q[1]=Y*G,Q[5]=Y*U,Q[9]=-X,Q[2]=E*X-O,Q[6]=R+F*X,Q[10]=Y*K}else if(J.order==="ZXY"){let F=K*U,E=K*G,O=H*U,R=H*G;Q[0]=F-R*X,Q[4]=-Y*G,Q[8]=O+E*X,Q[1]=E+O*X,Q[5]=Y*U,Q[9]=R-F*X,Q[2]=-Y*H,Q[6]=X,Q[10]=Y*K}else if(J.order==="ZYX"){let F=Y*U,E=Y*G,O=X*U,R=X*G;Q[0]=K*U,Q[4]=O*H-E,Q[8]=F*H+R,Q[1]=K*G,Q[5]=R*H+F,Q[9]=E*H-O,Q[2]=-H,Q[6]=X*K,Q[10]=Y*K}else if(J.order==="YZX"){let F=Y*K,E=Y*H,O=X*K,R=X*H;Q[0]=K*U,Q[4]=R-F*G,Q[8]=O*G+E,Q[1]=G,Q[5]=Y*U,Q[9]=-X*U,Q[2]=-H*U,Q[6]=E*G+O,Q[10]=F-R*G}else if(J.order==="XZY"){let F=Y*K,E=Y*H,O=X*K,R=X*H;Q[0]=K*U,Q[4]=-G,Q[8]=H*U,Q[1]=F*G+R,Q[5]=Y*U,Q[9]=E*G-O,Q[2]=O*G-E,Q[6]=X*U,Q[10]=R*G+F}return Q[3]=0,Q[7]=0,Q[11]=0,Q[12]=0,Q[13]=0,Q[14]=0,Q[15]=1,this}makeRotationFromQuaternion(J){return this.compose(e1,J,JF)}lookAt(J,Q,$){let Z=this.elements;if(R9.subVectors(J,Q),R9.lengthSq()===0)R9.z=1;if(R9.normalize(),x8.crossVectors($,R9),x8.lengthSq()===0){if(Math.abs($.z)===1)R9.x+=0.0001;else R9.z+=0.0001;R9.normalize(),x8.crossVectors($,R9)}return x8.normalize(),P$.crossVectors(R9,x8),Z[0]=x8.x,Z[4]=P$.x,Z[8]=R9.x,Z[1]=x8.y,Z[5]=P$.y,Z[9]=R9.y,Z[2]=x8.z,Z[6]=P$.z,Z[10]=R9.z,this}multiply(J){return this.multiplyMatrices(this,J)}premultiply(J){return this.multiplyMatrices(J,this)}multiplyMatrices(J,Q){let $=J.elements,Z=Q.elements,W=this.elements,Y=$[0],X=$[4],K=$[8],H=$[12],U=$[1],G=$[5],F=$[9],E=$[13],O=$[2],R=$[6],k=$[10],q=$[14],N=$[3],L=$[7],D=$[11],V=$[15],I=Z[0],z=Z[4],B=Z[8],M=Z[12],C=Z[1],j=Z[5],w=Z[9],v=Z[13],b=Z[2],S=Z[6],h=Z[10],x=Z[14],p=Z[3],c=Z[7],o=Z[11],W0=Z[15];return W[0]=Y*I+X*C+K*b+H*p,W[4]=Y*z+X*j+K*S+H*c,W[8]=Y*B+X*w+K*h+H*o,W[12]=Y*M+X*v+K*x+H*W0,W[1]=U*I+G*C+F*b+E*p,W[5]=U*z+G*j+F*S+E*c,W[9]=U*B+G*w+F*h+E*o,W[13]=U*M+G*v+F*x+E*W0,W[2]=O*I+R*C+k*b+q*p,W[6]=O*z+R*j+k*S+q*c,W[10]=O*B+R*w+k*h+q*o,W[14]=O*M+R*v+k*x+q*W0,W[3]=N*I+L*C+D*b+V*p,W[7]=N*z+L*j+D*S+V*c,W[11]=N*B+L*w+D*h+V*o,W[15]=N*M+L*v+D*x+V*W0,this}multiplyScalar(J){let Q=this.elements;return Q[0]*=J,Q[4]*=J,Q[8]*=J,Q[12]*=J,Q[1]*=J,Q[5]*=J,Q[9]*=J,Q[13]*=J,Q[2]*=J,Q[6]*=J,Q[10]*=J,Q[14]*=J,Q[3]*=J,Q[7]*=J,Q[11]*=J,Q[15]*=J,this}determinant(){let J=this.elements,Q=J[0],$=J[4],Z=J[8],W=J[12],Y=J[1],X=J[5],K=J[9],H=J[13],U=J[2],G=J[6],F=J[10],E=J[14],O=J[3],R=J[7],k=J[11],q=J[15],N=K*E-H*F,L=X*E-H*G,D=X*F-K*G,V=Y*E-H*U,I=Y*F-K*U,z=Y*G-X*U;return Q*(R*N-k*L+q*D)-$*(O*N-k*V+q*I)+Z*(O*L-R*V+q*z)-W*(O*D-R*I+k*z)}transpose(){let J=this.elements,Q;return Q=J[1],J[1]=J[4],J[4]=Q,Q=J[2],J[2]=J[8],J[8]=Q,Q=J[6],J[6]=J[9],J[9]=Q,Q=J[3],J[3]=J[12],J[12]=Q,Q=J[7],J[7]=J[13],J[13]=Q,Q=J[11],J[11]=J[14],J[14]=Q,this}setPosition(J,Q,$){let Z=this.elements;if(J.isVector3)Z[12]=J.x,Z[13]=J.y,Z[14]=J.z;else Z[12]=J,Z[13]=Q,Z[14]=$;return this}invert(){let J=this.elements,Q=J[0],$=J[1],Z=J[2],W=J[3],Y=J[4],X=J[5],K=J[6],H=J[7],U=J[8],G=J[9],F=J[10],E=J[11],O=J[12],R=J[13],k=J[14],q=J[15],N=Q*X-$*Y,L=Q*K-Z*Y,D=Q*H-W*Y,V=$*K-Z*X,I=$*H-W*X,z=Z*H-W*K,B=U*R-G*O,M=U*k-F*O,C=U*q-E*O,j=G*k-F*R,w=G*q-E*R,v=F*q-E*k,b=N*v-L*w+D*j+V*C-I*M+z*B;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/b;return J[0]=(X*v-K*w+H*j)*S,J[1]=(Z*w-$*v-W*j)*S,J[2]=(R*z-k*I+q*V)*S,J[3]=(F*I-G*z-E*V)*S,J[4]=(K*C-Y*v-H*M)*S,J[5]=(Q*v-Z*C+W*M)*S,J[6]=(k*D-O*z-q*L)*S,J[7]=(U*z-F*D+E*L)*S,J[8]=(Y*w-X*C+H*B)*S,J[9]=($*C-Q*w-W*B)*S,J[10]=(O*I-R*D+q*N)*S,J[11]=(G*D-U*I-E*N)*S,J[12]=(X*M-Y*j-K*B)*S,J[13]=(Q*j-$*M+Z*B)*S,J[14]=(R*L-O*V-k*N)*S,J[15]=(U*V-G*L+F*N)*S,this}scale(J){let Q=this.elements,$=J.x,Z=J.y,W=J.z;return Q[0]*=$,Q[4]*=Z,Q[8]*=W,Q[1]*=$,Q[5]*=Z,Q[9]*=W,Q[2]*=$,Q[6]*=Z,Q[10]*=W,Q[3]*=$,Q[7]*=Z,Q[11]*=W,this}getMaxScaleOnAxis(){let J=this.elements,Q=J[0]*J[0]+J[1]*J[1]+J[2]*J[2],$=J[4]*J[4]+J[5]*J[5]+J[6]*J[6],Z=J[8]*J[8]+J[9]*J[9]+J[10]*J[10];return Math.sqrt(Math.max(Q,$,Z))}makeTranslation(J,Q,$){if(J.isVector3)this.set(1,0,0,J.x,0,1,0,J.y,0,0,1,J.z,0,0,0,1);else this.set(1,0,0,J,0,1,0,Q,0,0,1,$,0,0,0,1);return this}makeRotationX(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(1,0,0,0,0,Q,-$,0,0,$,Q,0,0,0,0,1),this}makeRotationY(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(Q,0,$,0,0,1,0,0,-$,0,Q,0,0,0,0,1),this}makeRotationZ(J){let Q=Math.cos(J),$=Math.sin(J);return this.set(Q,-$,0,0,$,Q,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(J,Q){let $=Math.cos(Q),Z=Math.sin(Q),W=1-$,Y=J.x,X=J.y,K=J.z,H=W*Y,U=W*X;return this.set(H*Y+$,H*X-Z*K,H*K+Z*X,0,H*X+Z*K,U*X+$,U*K-Z*Y,0,H*K-Z*X,U*K+Z*Y,W*K*K+$,0,0,0,0,1),this}makeScale(J,Q,$){return this.set(J,0,0,0,0,Q,0,0,0,0,$,0,0,0,0,1),this}makeShear(J,Q,$,Z,W,Y){return this.set(1,$,W,0,J,1,Y,0,Q,Z,1,0,0,0,0,1),this}compose(J,Q,$){let Z=this.elements,W=Q._x,Y=Q._y,X=Q._z,K=Q._w,H=W+W,U=Y+Y,G=X+X,F=W*H,E=W*U,O=W*G,R=Y*U,k=Y*G,q=X*G,N=K*H,L=K*U,D=K*G,V=$.x,I=$.y,z=$.z;return Z[0]=(1-(R+q))*V,Z[1]=(E+D)*V,Z[2]=(O-L)*V,Z[3]=0,Z[4]=(E-D)*I,Z[5]=(1-(F+q))*I,Z[6]=(k+N)*I,Z[7]=0,Z[8]=(O+L)*z,Z[9]=(k-N)*z,Z[10]=(1-(F+R))*z,Z[11]=0,Z[12]=J.x,Z[13]=J.y,Z[14]=J.z,Z[15]=1,this}decompose(J,Q,$){let Z=this.elements;J.x=Z[12],J.y=Z[13],J.z=Z[14];let W=this.determinant();if(W===0)return $.set(1,1,1),Q.identity(),this;let Y=t6.set(Z[0],Z[1],Z[2]).length(),X=t6.set(Z[4],Z[5],Z[6]).length(),K=t6.set(Z[8],Z[9],Z[10]).length();if(W<0)Y=-Y;g9.copy(this);let H=1/Y,U=1/X,G=1/K;return g9.elements[0]*=H,g9.elements[1]*=H,g9.elements[2]*=H,g9.elements[4]*=U,g9.elements[5]*=U,g9.elements[6]*=U,g9.elements[8]*=G,g9.elements[9]*=G,g9.elements[10]*=G,Q.setFromRotationMatrix(g9),$.x=Y,$.y=X,$.z=K,this}makePerspective(J,Q,$,Z,W,Y,X=2000,K=!1){let H=this.elements,U=2*W/(Q-J),G=2*W/($-Z),F=(Q+J)/(Q-J),E=($+Z)/($-Z),O,R;if(K)O=W/(Y-W),R=Y*W/(Y-W);else if(X===2000)O=-(Y+W)/(Y-W),R=-2*Y*W/(Y-W);else if(X===2001)O=-Y/(Y-W),R=-Y*W/(Y-W);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+X);return H[0]=U,H[4]=0,H[8]=F,H[12]=0,H[1]=0,H[5]=G,H[9]=E,H[13]=0,H[2]=0,H[6]=0,H[10]=O,H[14]=R,H[3]=0,H[7]=0,H[11]=-1,H[15]=0,this}makeOrthographic(J,Q,$,Z,W,Y,X=2000,K=!1){let H=this.elements,U=2/(Q-J),G=2/($-Z),F=-(Q+J)/(Q-J),E=-($+Z)/($-Z),O,R;if(K)O=1/(Y-W),R=Y/(Y-W);else if(X===2000)O=-2/(Y-W),R=-(Y+W)/(Y-W);else if(X===2001)O=-1/(Y-W),R=-W/(Y-W);else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+X);return H[0]=U,H[4]=0,H[8]=0,H[12]=F,H[1]=0,H[5]=G,H[9]=0,H[13]=E,H[2]=0,H[6]=0,H[10]=O,H[14]=R,H[3]=0,H[7]=0,H[11]=0,H[15]=1,this}equals(J){let Q=this.elements,$=J.elements;for(let Z=0;Z<16;Z++)if(Q[Z]!==$[Z])return!1;return!0}fromArray(J,Q=0){for(let $=0;$<16;$++)this.elements[$]=J[$+Q];return this}toArray(J=[],Q=0){let $=this.elements;return J[Q]=$[0],J[Q+1]=$[1],J[Q+2]=$[2],J[Q+3]=$[3],J[Q+4]=$[4],J[Q+5]=$[5],J[Q+6]=$[6],J[Q+7]=$[7],J[Q+8]=$[8],J[Q+9]=$[9],J[Q+10]=$[10],J[Q+11]=$[11],J[Q+12]=$[12],J[Q+13]=$[13],J[Q+14]=$[14],J[Q+15]=$[15],J}}var t6=new T,g9=new y0,e1=new T(0,0,0),JF=new T(1,1,1),x8=new T,P$=new T,R9=new T,cH=new y0,nH=new IJ;class P9{constructor(J=0,Q=0,$=0,Z=P9.DEFAULT_ORDER){this.isEuler=!0,this._x=J,this._y=Q,this._z=$,this._order=Z}get x(){return this._x}set x(J){this._x=J,this._onChangeCallback()}get y(){return this._y}set y(J){this._y=J,this._onChangeCallback()}get z(){return this._z}set z(J){this._z=J,this._onChangeCallback()}get order(){return this._order}set order(J){this._order=J,this._onChangeCallback()}set(J,Q,$,Z=this._order){return this._x=J,this._y=Q,this._z=$,this._order=Z,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(J){return this._x=J._x,this._y=J._y,this._z=J._z,this._order=J._order,this._onChangeCallback(),this}setFromRotationMatrix(J,Q=this._order,$=!0){let Z=J.elements,W=Z[0],Y=Z[4],X=Z[8],K=Z[1],H=Z[5],U=Z[9],G=Z[2],F=Z[6],E=Z[10];switch(Q){case"XYZ":if(this._y=Math.asin(s0(X,-1,1)),Math.abs(X)<0.9999999)this._x=Math.atan2(-U,E),this._z=Math.atan2(-Y,W);else this._x=Math.atan2(F,H),this._z=0;break;case"YXZ":if(this._x=Math.asin(-s0(U,-1,1)),Math.abs(U)<0.9999999)this._y=Math.atan2(X,E),this._z=Math.atan2(K,H);else this._y=Math.atan2(-G,W),this._z=0;break;case"ZXY":if(this._x=Math.asin(s0(F,-1,1)),Math.abs(F)<0.9999999)this._y=Math.atan2(-G,E),this._z=Math.atan2(-Y,H);else this._y=0,this._z=Math.atan2(K,W);break;case"ZYX":if(this._y=Math.asin(-s0(G,-1,1)),Math.abs(G)<0.9999999)this._x=Math.atan2(F,E),this._z=Math.atan2(K,W);else this._x=0,this._z=Math.atan2(-Y,H);break;case"YZX":if(this._z=Math.asin(s0(K,-1,1)),Math.abs(K)<0.9999999)this._x=Math.atan2(-U,H),this._y=Math.atan2(-G,W);else this._x=0,this._y=Math.atan2(X,E);break;case"XZY":if(this._z=Math.asin(-s0(Y,-1,1)),Math.abs(Y)<0.9999999)this._x=Math.atan2(F,H),this._y=Math.atan2(X,W);else this._x=Math.atan2(-U,E),this._y=0;break;default:O0("Euler: .setFromRotationMatrix() encountered an unknown order: "+Q)}if(this._order=Q,$===!0)this._onChangeCallback();return this}setFromQuaternion(J,Q,$){return cH.makeRotationFromQuaternion(J),this.setFromRotationMatrix(cH,Q,$)}setFromVector3(J,Q=this._order){return this.set(J.x,J.y,J.z,Q)}reorder(J){return nH.setFromEuler(this),this.setFromQuaternion(nH,J)}equals(J){return J._x===this._x&&J._y===this._y&&J._z===this._z&&J._order===this._order}fromArray(J){if(this._x=J[0],this._y=J[1],this._z=J[2],J[3]!==void 0)this._order=J[3];return this._onChangeCallback(),this}toArray(J=[],Q=0){return J[Q]=this._x,J[Q+1]=this._y,J[Q+2]=this._z,J[Q+3]=this._order,J}_onChange(J){return this._onChangeCallback=J,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}P9.DEFAULT_ORDER="XYZ";class x7{constructor(){this.mask=1}set(J){this.mask=(1<<J|0)>>>0}enable(J){this.mask|=1<<J|0}enableAll(){this.mask=-1}toggle(J){this.mask^=1<<J|0}disable(J){this.mask&=~(1<<J|0)}disableAll(){this.mask=0}test(J){return(this.mask&J.mask)!==0}isEnabled(J){return(this.mask&(1<<J|0))!==0}}var QF=0,sH=new T,e6=new IJ,O8=new y0,T$=new T,QQ=new T,$F=new T,ZF=new IJ,iH=new T(1,0,0),oH=new T(0,1,0),aH=new T(0,0,1),rH={type:"added"},WF={type:"removed"},J7={type:"childadded",child:null},RY={type:"childremoved",child:null};class HJ extends V9{constructor(){super();this.isObject3D=!0,Object.defineProperty(this,"id",{value:QF++}),this.uuid=D9(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=HJ.DEFAULT_UP.clone();let J=new T,Q=new P9,$=new IJ,Z=new T(1,1,1);function W(){$.setFromEuler(Q,!1)}function Y(){Q.setFromQuaternion($,void 0,!1)}Q._onChange(W),$._onChange(Y),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:J},rotation:{configurable:!0,enumerable:!0,value:Q},quaternion:{configurable:!0,enumerable:!0,value:$},scale:{configurable:!0,enumerable:!0,value:Z},modelViewMatrix:{value:new y0},normalMatrix:{value:new o0}}),this.matrix=new y0,this.matrixWorld=new y0,this.matrixAutoUpdate=HJ.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=HJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new x7,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(J){if(this.matrixAutoUpdate)this.updateMatrix();this.matrix.premultiply(J),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(J){return this.quaternion.premultiply(J),this}setRotationFromAxisAngle(J,Q){this.quaternion.setFromAxisAngle(J,Q)}setRotationFromEuler(J){this.quaternion.setFromEuler(J,!0)}setRotationFromMatrix(J){this.quaternion.setFromRotationMatrix(J)}setRotationFromQuaternion(J){this.quaternion.copy(J)}rotateOnAxis(J,Q){return e6.setFromAxisAngle(J,Q),this.quaternion.multiply(e6),this}rotateOnWorldAxis(J,Q){return e6.setFromAxisAngle(J,Q),this.quaternion.premultiply(e6),this}rotateX(J){return this.rotateOnAxis(iH,J)}rotateY(J){return this.rotateOnAxis(oH,J)}rotateZ(J){return this.rotateOnAxis(aH,J)}translateOnAxis(J,Q){return sH.copy(J).applyQuaternion(this.quaternion),this.position.add(sH.multiplyScalar(Q)),this}translateX(J){return this.translateOnAxis(iH,J)}translateY(J){return this.translateOnAxis(oH,J)}translateZ(J){return this.translateOnAxis(aH,J)}localToWorld(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(this.matrixWorld)}worldToLocal(J){return this.updateWorldMatrix(!0,!1),J.applyMatrix4(O8.copy(this.matrixWorld).invert())}lookAt(J,Q,$){if(J.isVector3)T$.copy(J);else T$.set(J,Q,$);let Z=this.parent;if(this.updateWorldMatrix(!0,!1),QQ.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight)O8.lookAt(QQ,T$,this.up);else O8.lookAt(T$,QQ,this.up);if(this.quaternion.setFromRotationMatrix(O8),Z)O8.extractRotation(Z.matrixWorld),e6.setFromRotationMatrix(O8),this.quaternion.premultiply(e6.invert())}add(J){if(arguments.length>1){for(let Q=0;Q<arguments.length;Q++)this.add(arguments[Q]);return this}if(J===this)return v0("Object3D.add: object can't be added as a child of itself.",J),this;if(J&&J.isObject3D)J.removeFromParent(),J.parent=this,this.children.push(J),J.dispatchEvent(rH),J7.child=J,this.dispatchEvent(J7),J7.child=null;else v0("Object3D.add: object not an instance of THREE.Object3D.",J);return this}remove(J){if(arguments.length>1){for(let $=0;$<arguments.length;$++)this.remove(arguments[$]);return this}let Q=this.children.indexOf(J);if(Q!==-1)J.parent=null,this.children.splice(Q,1),J.dispatchEvent(WF),RY.child=J,this.dispatchEvent(RY),RY.child=null;return this}removeFromParent(){let J=this.parent;if(J!==null)J.remove(this);return this}clear(){return this.remove(...this.children)}attach(J){if(this.updateWorldMatrix(!0,!1),O8.copy(this.matrixWorld).invert(),J.parent!==null)J.parent.updateWorldMatrix(!0,!1),O8.multiply(J.parent.matrixWorld);return J.applyMatrix4(O8),J.removeFromParent(),J.parent=this,this.children.push(J),J.updateWorldMatrix(!1,!0),J.dispatchEvent(rH),J7.child=J,this.dispatchEvent(J7),J7.child=null,this}getObjectById(J){return this.getObjectByProperty("id",J)}getObjectByName(J){return this.getObjectByProperty("name",J)}getObjectByProperty(J,Q){if(this[J]===Q)return this;for(let $=0,Z=this.children.length;$<Z;$++){let Y=this.children[$].getObjectByProperty(J,Q);if(Y!==void 0)return Y}return}getObjectsByProperty(J,Q,$=[]){if(this[J]===Q)$.push(this);let Z=this.children;for(let W=0,Y=Z.length;W<Y;W++)Z[W].getObjectsByProperty(J,Q,$);return $}getWorldPosition(J){return this.updateWorldMatrix(!0,!1),J.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(J){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(QQ,J,$F),J}getWorldScale(J){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(QQ,ZF,J),J}getWorldDirection(J){this.updateWorldMatrix(!0,!1);let Q=this.matrixWorld.elements;return J.set(Q[8],Q[9],Q[10]).normalize()}raycast(){}traverse(J){J(this);let Q=this.children;for(let $=0,Z=Q.length;$<Z;$++)Q[$].traverse(J)}traverseVisible(J){if(this.visible===!1)return;J(this);let Q=this.children;for(let $=0,Z=Q.length;$<Z;$++)Q[$].traverseVisible(J)}traverseAncestors(J){let Q=this.parent;if(Q!==null)J(Q),Q.traverseAncestors(J)}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);let J=this.pivot;if(J!==null){let{x:Q,y:$,z:Z}=J,W=this.matrix.elements;W[12]+=Q-W[0]*Q-W[4]*$-W[8]*Z,W[13]+=$-W[1]*Q-W[5]*$-W[9]*Z,W[14]+=Z-W[2]*Q-W[6]*$-W[10]*Z}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(J){if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldNeedsUpdate||J){if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);this.matrixWorldNeedsUpdate=!1,J=!0}let Q=this.children;for(let $=0,Z=Q.length;$<Z;$++)Q[$].updateMatrixWorld(J)}updateWorldMatrix(J,Q){let $=this.parent;if(J===!0&&$!==null)$.updateWorldMatrix(!0,!1);if(this.matrixAutoUpdate)this.updateMatrix();if(this.matrixWorldAutoUpdate===!0)if(this.parent===null)this.matrixWorld.copy(this.matrix);else this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix);if(Q===!0){let Z=this.children;for(let W=0,Y=Z.length;W<Y;W++)Z[W].updateWorldMatrix(!1,!0)}}toJSON(J){let Q=J===void 0||typeof J==="string",$={};if(Q)J={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},$.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"};let Z={};if(Z.uuid=this.uuid,Z.type=this.type,this.name!=="")Z.name=this.name;if(this.castShadow===!0)Z.castShadow=!0;if(this.receiveShadow===!0)Z.receiveShadow=!0;if(this.visible===!1)Z.visible=!1;if(this.frustumCulled===!1)Z.frustumCulled=!1;if(this.renderOrder!==0)Z.renderOrder=this.renderOrder;if(this.static!==!1)Z.static=this.static;if(Object.keys(this.userData).length>0)Z.userData=this.userData;if(Z.layers=this.layers.mask,Z.matrix=this.matrix.toArray(),Z.up=this.up.toArray(),this.pivot!==null)Z.pivot=this.pivot.toArray();if(this.matrixAutoUpdate===!1)Z.matrixAutoUpdate=!1;if(this.morphTargetDictionary!==void 0)Z.morphTargetDictionary=Object.assign({},this.morphTargetDictionary);if(this.morphTargetInfluences!==void 0)Z.morphTargetInfluences=this.morphTargetInfluences.slice();if(this.isInstancedMesh){if(Z.type="InstancedMesh",Z.count=this.count,Z.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null)Z.instanceColor=this.instanceColor.toJSON()}if(this.isBatchedMesh){if(Z.type="BatchedMesh",Z.perObjectFrustumCulled=this.perObjectFrustumCulled,Z.sortObjects=this.sortObjects,Z.drawRanges=this._drawRanges,Z.reservedRanges=this._reservedRanges,Z.geometryInfo=this._geometryInfo.map((X)=>({...X,boundingBox:X.boundingBox?X.boundingBox.toJSON():void 0,boundingSphere:X.boundingSphere?X.boundingSphere.toJSON():void 0})),Z.instanceInfo=this._instanceInfo.map((X)=>({...X})),Z.availableInstanceIds=this._availableInstanceIds.slice(),Z.availableGeometryIds=this._availableGeometryIds.slice(),Z.nextIndexStart=this._nextIndexStart,Z.nextVertexStart=this._nextVertexStart,Z.geometryCount=this._geometryCount,Z.maxInstanceCount=this._maxInstanceCount,Z.maxVertexCount=this._maxVertexCount,Z.maxIndexCount=this._maxIndexCount,Z.geometryInitialized=this._geometryInitialized,Z.matricesTexture=this._matricesTexture.toJSON(J),Z.indirectTexture=this._indirectTexture.toJSON(J),this._colorsTexture!==null)Z.colorsTexture=this._colorsTexture.toJSON(J);if(this.boundingSphere!==null)Z.boundingSphere=this.boundingSphere.toJSON();if(this.boundingBox!==null)Z.boundingBox=this.boundingBox.toJSON()}function W(X,K){if(X[K.uuid]===void 0)X[K.uuid]=K.toJSON(J);return K.uuid}if(this.isScene){if(this.background){if(this.background.isColor)Z.background=this.background.toJSON();else if(this.background.isTexture)Z.background=this.background.toJSON(J).uuid}if(this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0)Z.environment=this.environment.toJSON(J).uuid}else if(this.isMesh||this.isLine||this.isPoints){Z.geometry=W(J.geometries,this.geometry);let X=this.geometry.parameters;if(X!==void 0&&X.shapes!==void 0){let K=X.shapes;if(Array.isArray(K))for(let H=0,U=K.length;H<U;H++){let G=K[H];W(J.shapes,G)}else W(J.shapes,K)}}if(this.isSkinnedMesh){if(Z.bindMode=this.bindMode,Z.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0)W(J.skeletons,this.skeleton),Z.skeleton=this.skeleton.uuid}if(this.material!==void 0)if(Array.isArray(this.material)){let X=[];for(let K=0,H=this.material.length;K<H;K++)X.push(W(J.materials,this.material[K]));Z.material=X}else Z.material=W(J.materials,this.material);if(this.children.length>0){Z.children=[];for(let X=0;X<this.children.length;X++)Z.children.push(this.children[X].toJSON(J).object)}if(this.animations.length>0){Z.animations=[];for(let X=0;X<this.animations.length;X++){let K=this.animations[X];Z.animations.push(W(J.animations,K))}}if(Q){let X=Y(J.geometries),K=Y(J.materials),H=Y(J.textures),U=Y(J.images),G=Y(J.shapes),F=Y(J.skeletons),E=Y(J.animations),O=Y(J.nodes);if(X.length>0)$.geometries=X;if(K.length>0)$.materials=K;if(H.length>0)$.textures=H;if(U.length>0)$.images=U;if(G.length>0)$.shapes=G;if(F.length>0)$.skeletons=F;if(E.length>0)$.animations=E;if(O.length>0)$.nodes=O}return $.object=Z,$;function Y(X){let K=[];for(let H in X){let U=X[H];delete U.metadata,K.push(U)}return K}}clone(J){return new this.constructor().copy(this,J)}copy(J,Q=!0){if(this.name=J.name,this.up.copy(J.up),this.position.copy(J.position),this.rotation.order=J.rotation.order,this.quaternion.copy(J.quaternion),this.scale.copy(J.scale),this.pivot=J.pivot!==null?J.pivot.clone():null,this.matrix.copy(J.matrix),this.matrixWorld.copy(J.matrixWorld),this.matrixAutoUpdate=J.matrixAutoUpdate,this.matrixWorldAutoUpdate=J.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=J.matrixWorldNeedsUpdate,this.layers.mask=J.layers.mask,this.visible=J.visible,this.castShadow=J.castShadow,this.receiveShadow=J.receiveShadow,this.frustumCulled=J.frustumCulled,this.renderOrder=J.renderOrder,this.static=J.static,this.animations=J.animations.slice(),this.userData=JSON.parse(JSON.stringify(J.userData)),Q===!0)for(let $=0;$<J.children.length;$++){let Z=J.children[$];this.add(Z.clone())}return this}}HJ.DEFAULT_UP=new T(0,1,0);HJ.DEFAULT_MATRIX_AUTO_UPDATE=!0;HJ.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class U9 extends HJ{constructor(){super();this.isGroup=!0,this.type="Group"}}var YF={type:"move"};class b7{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){if(this._hand===null)this._hand=new U9,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1};return this._hand}getTargetRaySpace(){if(this._targetRay===null)this._targetRay=new U9,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new T,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new T;return this._targetRay}getGripSpace(){if(this._grip===null)this._grip=new U9,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new T,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new T,this._grip.eventsEnabled=!1;return this._grip}dispatchEvent(J){if(this._targetRay!==null)this._targetRay.dispatchEvent(J);if(this._grip!==null)this._grip.dispatchEvent(J);if(this._hand!==null)this._hand.dispatchEvent(J);return this}connect(J){if(J&&J.hand){let Q=this._hand;if(Q)for(let $ of J.hand.values())this._getHandJoint(Q,$)}return this.dispatchEvent({type:"connected",data:J}),this}disconnect(J){if(this.dispatchEvent({type:"disconnected",data:J}),this._targetRay!==null)this._targetRay.visible=!1;if(this._grip!==null)this._grip.visible=!1;if(this._hand!==null)this._hand.visible=!1;return this}update(J,Q,$){let Z=null,W=null,Y=null,X=this._targetRay,K=this._grip,H=this._hand;if(J&&Q.session.visibilityState!=="visible-blurred"){if(H&&J.hand){Y=!0;for(let R of J.hand.values()){let k=Q.getJointPose(R,$),q=this._getHandJoint(H,R);if(k!==null)q.matrix.fromArray(k.transform.matrix),q.matrix.decompose(q.position,q.rotation,q.scale),q.matrixWorldNeedsUpdate=!0,q.jointRadius=k.radius;q.visible=k!==null}let U=H.joints["index-finger-tip"],G=H.joints["thumb-tip"],F=U.position.distanceTo(G.position),E=0.02,O=0.005;if(H.inputState.pinching&&F>E+O)H.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:J.handedness,target:this});else if(!H.inputState.pinching&&F<=E-O)H.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:J.handedness,target:this})}else if(K!==null&&J.gripSpace){if(W=Q.getPose(J.gripSpace,$),W!==null){if(K.matrix.fromArray(W.transform.matrix),K.matrix.decompose(K.position,K.rotation,K.scale),K.matrixWorldNeedsUpdate=!0,W.linearVelocity)K.hasLinearVelocity=!0,K.linearVelocity.copy(W.linearVelocity);else K.hasLinearVelocity=!1;if(W.angularVelocity)K.hasAngularVelocity=!0,K.angularVelocity.copy(W.angularVelocity);else K.hasAngularVelocity=!1;if(K.eventsEnabled)K.dispatchEvent({type:"gripUpdated",data:J,target:this})}}if(X!==null){if(Z=Q.getPose(J.targetRaySpace,$),Z===null&&W!==null)Z=W;if(Z!==null){if(X.matrix.fromArray(Z.transform.matrix),X.matrix.decompose(X.position,X.rotation,X.scale),X.matrixWorldNeedsUpdate=!0,Z.linearVelocity)X.hasLinearVelocity=!0,X.linearVelocity.copy(Z.linearVelocity);else X.hasLinearVelocity=!1;if(Z.angularVelocity)X.hasAngularVelocity=!0,X.angularVelocity.copy(Z.angularVelocity);else X.hasAngularVelocity=!1;this.dispatchEvent(YF)}}}if(X!==null)X.visible=Z!==null;if(K!==null)K.visible=W!==null;if(H!==null)H.visible=Y!==null;return this}_getHandJoint(J,Q){if(J.joints[Q.jointName]===void 0){let $=new U9;$.matrixAutoUpdate=!1,$.visible=!1,J.joints[Q.jointName]=$,J.add($)}return J.joints[Q.jointName]}}var K5={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},b8={h:0,s:0,l:0},A$={h:0,s:0,l:0};function LY(J,Q,$){if($<0)$+=1;if($>1)$-=1;if($<0.16666666666666666)return J+(Q-J)*6*$;if($<0.5)return Q;if($<0.6666666666666666)return J+(Q-J)*6*(0.6666666666666666-$);return J}class e{constructor(J,Q,$){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(J,Q,$)}set(J,Q,$){if(Q===void 0&&$===void 0){let Z=J;if(Z&&Z.isColor)this.copy(Z);else if(typeof Z==="number")this.setHex(Z);else if(typeof Z==="string")this.setStyle(Z)}else this.setRGB(J,Q,$);return this}setScalar(J){return this.r=J,this.g=J,this.b=J,this}setHex(J,Q="srgb"){return J=Math.floor(J),this.r=(J>>16&255)/255,this.g=(J>>8&255)/255,this.b=(J&255)/255,t0.colorSpaceToWorking(this,Q),this}setRGB(J,Q,$,Z=t0.workingColorSpace){return this.r=J,this.g=Q,this.b=$,t0.colorSpaceToWorking(this,Z),this}setHSL(J,Q,$,Z=t0.workingColorSpace){if(J=aX(J,1),Q=s0(Q,0,1),$=s0($,0,1),Q===0)this.r=this.g=this.b=$;else{let W=$<=0.5?$*(1+Q):$+Q-$*Q,Y=2*$-W;this.r=LY(Y,W,J+0.3333333333333333),this.g=LY(Y,W,J),this.b=LY(Y,W,J-0.3333333333333333)}return t0.colorSpaceToWorking(this,Z),this}setStyle(J,Q="srgb"){function $(W){if(W===void 0)return;if(parseFloat(W)<1)O0("Color: Alpha component of "+J+" will be ignored.")}let Z;if(Z=/^(\w+)\(([^\)]*)\)/.exec(J)){let W,Y=Z[1],X=Z[2];switch(Y){case"rgb":case"rgba":if(W=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(X))return $(W[4]),this.setRGB(Math.min(255,parseInt(W[1],10))/255,Math.min(255,parseInt(W[2],10))/255,Math.min(255,parseInt(W[3],10))/255,Q);if(W=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(X))return $(W[4]),this.setRGB(Math.min(100,parseInt(W[1],10))/100,Math.min(100,parseInt(W[2],10))/100,Math.min(100,parseInt(W[3],10))/100,Q);break;case"hsl":case"hsla":if(W=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(X))return $(W[4]),this.setHSL(parseFloat(W[1])/360,parseFloat(W[2])/100,parseFloat(W[3])/100,Q);break;default:O0("Color: Unknown color model "+J)}}else if(Z=/^\#([A-Fa-f\d]+)$/.exec(J)){let W=Z[1],Y=W.length;if(Y===3)return this.setRGB(parseInt(W.charAt(0),16)/15,parseInt(W.charAt(1),16)/15,parseInt(W.charAt(2),16)/15,Q);else if(Y===6)return this.setHex(parseInt(W,16),Q);else O0("Color: Invalid hex color "+J)}else if(J&&J.length>0)return this.setColorName(J,Q);return this}setColorName(J,Q="srgb"){let $=K5[J.toLowerCase()];if($!==void 0)this.setHex($,Q);else O0("Color: Unknown color "+J);return this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(J){return this.r=J.r,this.g=J.g,this.b=J.b,this}copySRGBToLinear(J){return this.r=V8(J.r),this.g=V8(J.g),this.b=V8(J.b),this}copyLinearToSRGB(J){return this.r=D7(J.r),this.g=D7(J.g),this.b=D7(J.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(J="srgb"){return t0.workingToColorSpace(rJ.copy(this),J),Math.round(s0(rJ.r*255,0,255))*65536+Math.round(s0(rJ.g*255,0,255))*256+Math.round(s0(rJ.b*255,0,255))}getHexString(J="srgb"){return("000000"+this.getHex(J).toString(16)).slice(-6)}getHSL(J,Q=t0.workingColorSpace){t0.workingToColorSpace(rJ.copy(this),Q);let{r:$,g:Z,b:W}=rJ,Y=Math.max($,Z,W),X=Math.min($,Z,W),K,H,U=(X+Y)/2;if(X===Y)K=0,H=0;else{let G=Y-X;switch(H=U<=0.5?G/(Y+X):G/(2-Y-X),Y){case $:K=(Z-W)/G+(Z<W?6:0);break;case Z:K=(W-$)/G+2;break;case W:K=($-Z)/G+4;break}K/=6}return J.h=K,J.s=H,J.l=U,J}getRGB(J,Q=t0.workingColorSpace){return t0.workingToColorSpace(rJ.copy(this),Q),J.r=rJ.r,J.g=rJ.g,J.b=rJ.b,J}getStyle(J="srgb"){t0.workingToColorSpace(rJ.copy(this),J);let{r:Q,g:$,b:Z}=rJ;if(J!=="srgb")return`color(${J} ${Q.toFixed(3)} ${$.toFixed(3)} ${Z.toFixed(3)})`;return`rgb(${Math.round(Q*255)},${Math.round($*255)},${Math.round(Z*255)})`}offsetHSL(J,Q,$){return this.getHSL(b8),this.setHSL(b8.h+J,b8.s+Q,b8.l+$)}add(J){return this.r+=J.r,this.g+=J.g,this.b+=J.b,this}addColors(J,Q){return this.r=J.r+Q.r,this.g=J.g+Q.g,this.b=J.b+Q.b,this}addScalar(J){return this.r+=J,this.g+=J,this.b+=J,this}sub(J){return this.r=Math.max(0,this.r-J.r),this.g=Math.max(0,this.g-J.g),this.b=Math.max(0,this.b-J.b),this}multiply(J){return this.r*=J.r,this.g*=J.g,this.b*=J.b,this}multiplyScalar(J){return this.r*=J,this.g*=J,this.b*=J,this}lerp(J,Q){return this.r+=(J.r-this.r)*Q,this.g+=(J.g-this.g)*Q,this.b+=(J.b-this.b)*Q,this}lerpColors(J,Q,$){return this.r=J.r+(Q.r-J.r)*$,this.g=J.g+(Q.g-J.g)*$,this.b=J.b+(Q.b-J.b)*$,this}lerpHSL(J,Q){this.getHSL(b8),J.getHSL(A$);let $=qQ(b8.h,A$.h,Q),Z=qQ(b8.s,A$.s,Q),W=qQ(b8.l,A$.l,Q);return this.setHSL($,Z,W),this}setFromVector3(J){return this.r=J.x,this.g=J.y,this.b=J.z,this}applyMatrix3(J){let Q=this.r,$=this.g,Z=this.b,W=J.elements;return this.r=W[0]*Q+W[3]*$+W[6]*Z,this.g=W[1]*Q+W[4]*$+W[7]*Z,this.b=W[2]*Q+W[5]*$+W[8]*Z,this}equals(J){return J.r===this.r&&J.g===this.g&&J.b===this.b}fromArray(J,Q=0){return this.r=J[Q],this.g=J[Q+1],this.b=J[Q+2],this}toArray(J=[],Q=0){return J[Q]=this.r,J[Q+1]=this.g,J[Q+2]=this.b,J}fromBufferAttribute(J,Q){return this.r=J.getX(Q),this.g=J.getY(Q),this.b=J.getZ(Q),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}var rJ=new e;e.NAMES=K5;class bQ{constructor(J,Q=0.00025){this.isFogExp2=!0,this.name="",this.color=new e(J),this.density=Q}clone(){return new bQ(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class hQ{constructor(J,Q=1,$=1000){this.isFog=!0,this.name="",this.color=new e(J),this.near=Q,this.far=$}clone(){return new hQ(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class t8 extends HJ{constructor(){super();if(this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new P9,this.environmentIntensity=1,this.environmentRotation=new P9,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(J,Q){if(super.copy(J,Q),J.background!==null)this.background=J.background.clone();if(J.environment!==null)this.environment=J.environment.clone();if(J.fog!==null)this.fog=J.fog.clone();if(this.backgroundBlurriness=J.backgroundBlurriness,this.backgroundIntensity=J.backgroundIntensity,this.backgroundRotation.copy(J.backgroundRotation),this.environmentIntensity=J.environmentIntensity,this.environmentRotation.copy(J.environmentRotation),J.overrideMaterial!==null)this.overrideMaterial=J.overrideMaterial.clone();return this.matrixAutoUpdate=J.matrixAutoUpdate,this}toJSON(J){let Q=super.toJSON(J);if(this.fog!==null)Q.object.fog=this.fog.toJSON();if(this.backgroundBlurriness>0)Q.object.backgroundBlurriness=this.backgroundBlurriness;if(this.backgroundIntensity!==1)Q.object.backgroundIntensity=this.backgroundIntensity;if(Q.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1)Q.object.environmentIntensity=this.environmentIntensity;return Q.object.environmentRotation=this.environmentRotation.toArray(),Q}}var p9=new T,q8=new T,DY=new T,R8=new T,Q7=new T,$7=new T,tH=new T,kY=new T,MY=new T,VY=new T,BY=new FJ,CY=new FJ,IY=new FJ;class W9{constructor(J=new T,Q=new T,$=new T){this.a=J,this.b=Q,this.c=$}static getNormal(J,Q,$,Z){Z.subVectors($,Q),p9.subVectors(J,Q),Z.cross(p9);let W=Z.lengthSq();if(W>0)return Z.multiplyScalar(1/Math.sqrt(W));return Z.set(0,0,0)}static getBarycoord(J,Q,$,Z,W){p9.subVectors(Z,Q),q8.subVectors($,Q),DY.subVectors(J,Q);let Y=p9.dot(p9),X=p9.dot(q8),K=p9.dot(DY),H=q8.dot(q8),U=q8.dot(DY),G=Y*H-X*X;if(G===0)return W.set(0,0,0),null;let F=1/G,E=(H*K-X*U)*F,O=(Y*U-X*K)*F;return W.set(1-E-O,O,E)}static containsPoint(J,Q,$,Z){if(this.getBarycoord(J,Q,$,Z,R8)===null)return!1;return R8.x>=0&&R8.y>=0&&R8.x+R8.y<=1}static getInterpolation(J,Q,$,Z,W,Y,X,K){if(this.getBarycoord(J,Q,$,Z,R8)===null){if(K.x=0,K.y=0,"z"in K)K.z=0;if("w"in K)K.w=0;return null}return K.setScalar(0),K.addScaledVector(W,R8.x),K.addScaledVector(Y,R8.y),K.addScaledVector(X,R8.z),K}static getInterpolatedAttribute(J,Q,$,Z,W,Y){return BY.setScalar(0),CY.setScalar(0),IY.setScalar(0),BY.fromBufferAttribute(J,Q),CY.fromBufferAttribute(J,$),IY.fromBufferAttribute(J,Z),Y.setScalar(0),Y.addScaledVector(BY,W.x),Y.addScaledVector(CY,W.y),Y.addScaledVector(IY,W.z),Y}static isFrontFacing(J,Q,$,Z){return p9.subVectors($,Q),q8.subVectors(J,Q),p9.cross(q8).dot(Z)<0}set(J,Q,$){return this.a.copy(J),this.b.copy(Q),this.c.copy($),this}setFromPointsAndIndices(J,Q,$,Z){return this.a.copy(J[Q]),this.b.copy(J[$]),this.c.copy(J[Z]),this}setFromAttributeAndIndices(J,Q,$,Z){return this.a.fromBufferAttribute(J,Q),this.b.fromBufferAttribute(J,$),this.c.fromBufferAttribute(J,Z),this}clone(){return new this.constructor().copy(this)}copy(J){return this.a.copy(J.a),this.b.copy(J.b),this.c.copy(J.c),this}getArea(){return p9.subVectors(this.c,this.b),q8.subVectors(this.a,this.b),p9.cross(q8).length()*0.5}getMidpoint(J){return J.addVectors(this.a,this.b).add(this.c).multiplyScalar(0.3333333333333333)}getNormal(J){return W9.getNormal(this.a,this.b,this.c,J)}getPlane(J){return J.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(J,Q){return W9.getBarycoord(J,this.a,this.b,this.c,Q)}getInterpolation(J,Q,$,Z,W){return W9.getInterpolation(J,this.a,this.b,this.c,Q,$,Z,W)}containsPoint(J){return W9.containsPoint(J,this.a,this.b,this.c)}isFrontFacing(J){return W9.isFrontFacing(this.a,this.b,this.c,J)}intersectsBox(J){return J.intersectsTriangle(this)}closestPointToPoint(J,Q){let $=this.a,Z=this.b,W=this.c,Y,X;Q7.subVectors(Z,$),$7.subVectors(W,$),kY.subVectors(J,$);let K=Q7.dot(kY),H=$7.dot(kY);if(K<=0&&H<=0)return Q.copy($);MY.subVectors(J,Z);let U=Q7.dot(MY),G=$7.dot(MY);if(U>=0&&G<=U)return Q.copy(Z);let F=K*G-U*H;if(F<=0&&K>=0&&U<=0)return Y=K/(K-U),Q.copy($).addScaledVector(Q7,Y);VY.subVectors(J,W);let E=Q7.dot(VY),O=$7.dot(VY);if(O>=0&&E<=O)return Q.copy(W);let R=E*H-K*O;if(R<=0&&H>=0&&O<=0)return X=H/(H-O),Q.copy($).addScaledVector($7,X);let k=U*O-E*G;if(k<=0&&G-U>=0&&E-O>=0)return tH.subVectors(W,Z),X=(G-U)/(G-U+(E-O)),Q.copy(Z).addScaledVector(tH,X);let q=1/(k+R+F);return Y=R*q,X=F*q,Q.copy($).addScaledVector(Q7,Y).addScaledVector($7,X)}equals(J){return J.a.equals(this.a)&&J.b.equals(this.b)&&J.c.equals(this.c)}}class SJ{constructor(J=new T(1/0,1/0,1/0),Q=new T(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=J,this.max=Q}set(J,Q){return this.min.copy(J),this.max.copy(Q),this}setFromArray(J){this.makeEmpty();for(let Q=0,$=J.length;Q<$;Q+=3)this.expandByPoint(u9.fromArray(J,Q));return this}setFromBufferAttribute(J){this.makeEmpty();for(let Q=0,$=J.count;Q<$;Q++)this.expandByPoint(u9.fromBufferAttribute(J,Q));return this}setFromPoints(J){this.makeEmpty();for(let Q=0,$=J.length;Q<$;Q++)this.expandByPoint(J[Q]);return this}setFromCenterAndSize(J,Q){let $=u9.copy(Q).multiplyScalar(0.5);return this.min.copy(J).sub($),this.max.copy(J).add($),this}setFromObject(J,Q=!1){return this.makeEmpty(),this.expandByObject(J,Q)}clone(){return new this.constructor().copy(this)}copy(J){return this.min.copy(J.min),this.max.copy(J.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(J){return this.isEmpty()?J.set(0,0,0):J.addVectors(this.min,this.max).multiplyScalar(0.5)}getSize(J){return this.isEmpty()?J.set(0,0,0):J.subVectors(this.max,this.min)}expandByPoint(J){return this.min.min(J),this.max.max(J),this}expandByVector(J){return this.min.sub(J),this.max.add(J),this}expandByScalar(J){return this.min.addScalar(-J),this.max.addScalar(J),this}expandByObject(J,Q=!1){J.updateWorldMatrix(!1,!1);let $=J.geometry;if($!==void 0){let W=$.getAttribute("position");if(Q===!0&&W!==void 0&&J.isInstancedMesh!==!0)for(let Y=0,X=W.count;Y<X;Y++){if(J.isMesh===!0)J.getVertexPosition(Y,u9);else u9.fromBufferAttribute(W,Y);u9.applyMatrix4(J.matrixWorld),this.expandByPoint(u9)}else{if(J.boundingBox!==void 0){if(J.boundingBox===null)J.computeBoundingBox();S$.copy(J.boundingBox)}else{if($.boundingBox===null)$.computeBoundingBox();S$.copy($.boundingBox)}S$.applyMatrix4(J.matrixWorld),this.union(S$)}}let Z=J.children;for(let W=0,Y=Z.length;W<Y;W++)this.expandByObject(Z[W],Q);return this}containsPoint(J){return J.x>=this.min.x&&J.x<=this.max.x&&J.y>=this.min.y&&J.y<=this.max.y&&J.z>=this.min.z&&J.z<=this.max.z}containsBox(J){return this.min.x<=J.min.x&&J.max.x<=this.max.x&&this.min.y<=J.min.y&&J.max.y<=this.max.y&&this.min.z<=J.min.z&&J.max.z<=this.max.z}getParameter(J,Q){return Q.set((J.x-this.min.x)/(this.max.x-this.min.x),(J.y-this.min.y)/(this.max.y-this.min.y),(J.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(J){return J.max.x>=this.min.x&&J.min.x<=this.max.x&&J.max.y>=this.min.y&&J.min.y<=this.max.y&&J.max.z>=this.min.z&&J.min.z<=this.max.z}intersectsSphere(J){return this.clampPoint(J.center,u9),u9.distanceToSquared(J.center)<=J.radius*J.radius}intersectsPlane(J){let Q,$;if(J.normal.x>0)Q=J.normal.x*this.min.x,$=J.normal.x*this.max.x;else Q=J.normal.x*this.max.x,$=J.normal.x*this.min.x;if(J.normal.y>0)Q+=J.normal.y*this.min.y,$+=J.normal.y*this.max.y;else Q+=J.normal.y*this.max.y,$+=J.normal.y*this.min.y;if(J.normal.z>0)Q+=J.normal.z*this.min.z,$+=J.normal.z*this.max.z;else Q+=J.normal.z*this.max.z,$+=J.normal.z*this.min.z;return Q<=-J.constant&&$>=-J.constant}intersectsTriangle(J){if(this.isEmpty())return!1;this.getCenter($Q),j$.subVectors(this.max,$Q),Z7.subVectors(J.a,$Q),W7.subVectors(J.b,$Q),Y7.subVectors(J.c,$Q),h8.subVectors(W7,Z7),f8.subVectors(Y7,W7),K6.subVectors(Z7,Y7);let Q=[0,-h8.z,h8.y,0,-f8.z,f8.y,0,-K6.z,K6.y,h8.z,0,-h8.x,f8.z,0,-f8.x,K6.z,0,-K6.x,-h8.y,h8.x,0,-f8.y,f8.x,0,-K6.y,K6.x,0];if(!zY(Q,Z7,W7,Y7,j$))return!1;if(Q=[1,0,0,0,1,0,0,0,1],!zY(Q,Z7,W7,Y7,j$))return!1;return v$.crossVectors(h8,f8),Q=[v$.x,v$.y,v$.z],zY(Q,Z7,W7,Y7,j$)}clampPoint(J,Q){return Q.copy(J).clamp(this.min,this.max)}distanceToPoint(J){return this.clampPoint(J,u9).distanceTo(J)}getBoundingSphere(J){if(this.isEmpty())J.makeEmpty();else this.getCenter(J.center),J.radius=this.getSize(u9).length()*0.5;return J}intersect(J){if(this.min.max(J.min),this.max.min(J.max),this.isEmpty())this.makeEmpty();return this}union(J){return this.min.min(J.min),this.max.max(J.max),this}applyMatrix4(J){if(this.isEmpty())return this;return L8[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(J),L8[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(J),L8[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(J),L8[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(J),L8[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(J),L8[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(J),L8[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(J),L8[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(J),this.setFromPoints(L8),this}translate(J){return this.min.add(J),this.max.add(J),this}equals(J){return J.min.equals(this.min)&&J.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(J){return this.min.fromArray(J.min),this.max.fromArray(J.max),this}}var L8=[new T,new T,new T,new T,new T,new T,new T,new T],u9=new T,S$=new SJ,Z7=new T,W7=new T,Y7=new T,h8=new T,f8=new T,K6=new T,$Q=new T,j$=new T,v$=new T,H6=new T;function zY(J,Q,$,Z,W){for(let Y=0,X=J.length-3;Y<=X;Y+=3){H6.fromArray(J,Y);let K=W.x*Math.abs(H6.x)+W.y*Math.abs(H6.y)+W.z*Math.abs(H6.z),H=Q.dot(H6),U=$.dot(H6),G=Z.dot(H6);if(Math.max(-Math.max(H,U,G),Math.min(H,U,G))>K)return!1}return!0}var M8=XF();function XF(){let J=new ArrayBuffer(4),Q=new Float32Array(J),$=new Uint32Array(J),Z=new Uint32Array(512),W=new Uint32Array(512);for(let H=0;H<256;++H){let U=H-127;if(U<-27)Z[H]=0,Z[H|256]=32768,W[H]=24,W[H|256]=24;else if(U<-14)Z[H]=1024>>-U-14,Z[H|256]=1024>>-U-14|32768,W[H]=-U-1,W[H|256]=-U-1;else if(U<=15)Z[H]=U+15<<10,Z[H|256]=U+15<<10|32768,W[H]=13,W[H|256]=13;else if(U<128)Z[H]=31744,Z[H|256]=64512,W[H]=24,W[H|256]=24;else Z[H]=31744,Z[H|256]=64512,W[H]=13,W[H|256]=13}let Y=new Uint32Array(2048),X=new Uint32Array(64),K=new Uint32Array(64);for(let H=1;H<1024;++H){let U=H<<13,G=0;while((U&8388608)===0)U<<=1,G-=8388608;U&=-8388609,G+=947912704,Y[H]=U|G}for(let H=1024;H<2048;++H)Y[H]=939524096+(H-1024<<13);for(let H=1;H<31;++H)X[H]=H<<23;X[31]=1199570944,X[32]=2147483648;for(let H=33;H<63;++H)X[H]=2147483648+(H-32<<23);X[63]=3347054592;for(let H=1;H<64;++H)if(H!==32)K[H]=1024;return{floatView:Q,uint32View:$,baseTable:Z,shiftTable:W,mantissaTable:Y,exponentTable:X,offsetTable:K}}function H9(J){if(Math.abs(J)>65504)O0("DataUtils.toHalfFloat(): Value out of range.");J=s0(J,-65504,65504),M8.floatView[0]=J;let Q=M8.uint32View[0],$=Q>>23&511;return M8.baseTable[$]+((Q&8388607)>>M8.shiftTable[$])}function NQ(J){let Q=J>>10;return M8.uint32View[0]=M8.mantissaTable[M8.offsetTable[Q]+(J&1023)]+M8.exponentTable[Q],M8.floatView[0]}class e8{static toHalfFloat(J){return H9(J)}static fromHalfFloat(J){return NQ(J)}}var gJ=new T,y$=new i,KF=0;class i0 extends V9{constructor(J,Q,$=!1){super();if(Array.isArray(J))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:KF++}),this.name="",this.array=J,this.itemSize=Q,this.count=J!==void 0?J.length/Q:0,this.normalized=$,this.usage=35044,this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(J){if(J===!0)this.version++}setUsage(J){return this.usage=J,this}addUpdateRange(J,Q){this.updateRanges.push({start:J,count:Q})}clearUpdateRanges(){this.updateRanges.length=0}copy(J){return this.name=J.name,this.array=new J.array.constructor(J.array),this.itemSize=J.itemSize,this.count=J.count,this.normalized=J.normalized,this.usage=J.usage,this.gpuType=J.gpuType,this}copyAt(J,Q,$){J*=this.itemSize,$*=Q.itemSize;for(let Z=0,W=this.itemSize;Z<W;Z++)this.array[J+Z]=Q.array[$+Z];return this}copyArray(J){return this.array.set(J),this}applyMatrix3(J){if(this.itemSize===2)for(let Q=0,$=this.count;Q<$;Q++)y$.fromBufferAttribute(this,Q),y$.applyMatrix3(J),this.setXY(Q,y$.x,y$.y);else if(this.itemSize===3)for(let Q=0,$=this.count;Q<$;Q++)gJ.fromBufferAttribute(this,Q),gJ.applyMatrix3(J),this.setXYZ(Q,gJ.x,gJ.y,gJ.z);return this}applyMatrix4(J){for(let Q=0,$=this.count;Q<$;Q++)gJ.fromBufferAttribute(this,Q),gJ.applyMatrix4(J),this.setXYZ(Q,gJ.x,gJ.y,gJ.z);return this}applyNormalMatrix(J){for(let Q=0,$=this.count;Q<$;Q++)gJ.fromBufferAttribute(this,Q),gJ.applyNormalMatrix(J),this.setXYZ(Q,gJ.x,gJ.y,gJ.z);return this}transformDirection(J){for(let Q=0,$=this.count;Q<$;Q++)gJ.fromBufferAttribute(this,Q),gJ.transformDirection(J),this.setXYZ(Q,gJ.x,gJ.y,gJ.z);return this}set(J,Q=0){return this.array.set(J,Q),this}getComponent(J,Q){let $=this.array[J*this.itemSize+Q];if(this.normalized)$=Z9($,this.array);return $}setComponent(J,Q,$){if(this.normalized)$=QJ($,this.array);return this.array[J*this.itemSize+Q]=$,this}getX(J){let Q=this.array[J*this.itemSize];if(this.normalized)Q=Z9(Q,this.array);return Q}setX(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize]=Q,this}getY(J){let Q=this.array[J*this.itemSize+1];if(this.normalized)Q=Z9(Q,this.array);return Q}setY(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize+1]=Q,this}getZ(J){let Q=this.array[J*this.itemSize+2];if(this.normalized)Q=Z9(Q,this.array);return Q}setZ(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize+2]=Q,this}getW(J){let Q=this.array[J*this.itemSize+3];if(this.normalized)Q=Z9(Q,this.array);return Q}setW(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize+3]=Q,this}setXY(J,Q,$){if(J*=this.itemSize,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this}setXYZ(J,Q,$,Z){if(J*=this.itemSize,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),Z=QJ(Z,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this.array[J+2]=Z,this}setXYZW(J,Q,$,Z,W){if(J*=this.itemSize,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),Z=QJ(Z,this.array),W=QJ(W,this.array);return this.array[J+0]=Q,this.array[J+1]=$,this.array[J+2]=Z,this.array[J+3]=W,this}onUpload(J){return this.onUploadCallback=J,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let J={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};if(this.name!=="")J.name=this.name;if(this.usage!==35044)J.usage=this.usage;return J}dispose(){this.dispatchEvent({type:"dispose"})}}class eX extends i0{constructor(J,Q,$){super(new Int8Array(J),Q,$)}}class JK extends i0{constructor(J,Q,$){super(new Uint8Array(J),Q,$)}}class QK extends i0{constructor(J,Q,$){super(new Uint8ClampedArray(J),Q,$)}}class $K extends i0{constructor(J,Q,$){super(new Int16Array(J),Q,$)}}class fQ extends i0{constructor(J,Q,$){super(new Uint16Array(J),Q,$)}}class ZK extends i0{constructor(J,Q,$){super(new Int32Array(J),Q,$)}}class gQ extends i0{constructor(J,Q,$){super(new Uint32Array(J),Q,$)}}class WK extends i0{constructor(J,Q,$){super(new Uint16Array(J),Q,$);this.isFloat16BufferAttribute=!0}getX(J){let Q=NQ(this.array[J*this.itemSize]);if(this.normalized)Q=Z9(Q,this.array);return Q}setX(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize]=H9(Q),this}getY(J){let Q=NQ(this.array[J*this.itemSize+1]);if(this.normalized)Q=Z9(Q,this.array);return Q}setY(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize+1]=H9(Q),this}getZ(J){let Q=NQ(this.array[J*this.itemSize+2]);if(this.normalized)Q=Z9(Q,this.array);return Q}setZ(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize+2]=H9(Q),this}getW(J){let Q=NQ(this.array[J*this.itemSize+3]);if(this.normalized)Q=Z9(Q,this.array);return Q}setW(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.array[J*this.itemSize+3]=H9(Q),this}setXY(J,Q,$){if(J*=this.itemSize,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array);return this.array[J+0]=H9(Q),this.array[J+1]=H9($),this}setXYZ(J,Q,$,Z){if(J*=this.itemSize,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),Z=QJ(Z,this.array);return this.array[J+0]=H9(Q),this.array[J+1]=H9($),this.array[J+2]=H9(Z),this}setXYZW(J,Q,$,Z,W){if(J*=this.itemSize,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),Z=QJ(Z,this.array),W=QJ(W,this.array);return this.array[J+0]=H9(Q),this.array[J+1]=H9($),this.array[J+2]=H9(Z),this.array[J+3]=H9(W),this}}class I0 extends i0{constructor(J,Q,$){super(new Float32Array(J),Q,$)}}var HF=new SJ,ZQ=new T,_Y=new T;class _J{constructor(J=new T,Q=-1){this.isSphere=!0,this.center=J,this.radius=Q}set(J,Q){return this.center.copy(J),this.radius=Q,this}setFromPoints(J,Q){let $=this.center;if(Q!==void 0)$.copy(Q);else HF.setFromPoints(J).getCenter($);let Z=0;for(let W=0,Y=J.length;W<Y;W++)Z=Math.max(Z,$.distanceToSquared(J[W]));return this.radius=Math.sqrt(Z),this}copy(J){return this.center.copy(J.center),this.radius=J.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(J){return J.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(J){return J.distanceTo(this.center)-this.radius}intersectsSphere(J){let Q=this.radius+J.radius;return J.center.distanceToSquared(this.center)<=Q*Q}intersectsBox(J){return J.intersectsSphere(this)}intersectsPlane(J){return Math.abs(J.distanceToPoint(this.center))<=this.radius}clampPoint(J,Q){let $=this.center.distanceToSquared(J);if(Q.copy(J),$>this.radius*this.radius)Q.sub(this.center).normalize(),Q.multiplyScalar(this.radius).add(this.center);return Q}getBoundingBox(J){if(this.isEmpty())return J.makeEmpty(),J;return J.set(this.center,this.center),J.expandByScalar(this.radius),J}applyMatrix4(J){return this.center.applyMatrix4(J),this.radius=this.radius*J.getMaxScaleOnAxis(),this}translate(J){return this.center.add(J),this}expandByPoint(J){if(this.isEmpty())return this.center.copy(J),this.radius=0,this;ZQ.subVectors(J,this.center);let Q=ZQ.lengthSq();if(Q>this.radius*this.radius){let $=Math.sqrt(Q),Z=($-this.radius)*0.5;this.center.addScaledVector(ZQ,Z/$),this.radius+=Z}return this}union(J){if(J.isEmpty())return this;if(this.isEmpty())return this.copy(J),this;if(this.center.equals(J.center)===!0)this.radius=Math.max(this.radius,J.radius);else _Y.subVectors(J.center,this.center).setLength(J.radius),this.expandByPoint(ZQ.copy(J.center).add(_Y)),this.expandByPoint(ZQ.copy(J.center).sub(_Y));return this}equals(J){return J.center.equals(this.center)&&J.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(J){return this.radius=J.radius,this.center.fromArray(J.center),this}}var UF=0,z9=new y0,wY=new HJ,X7=new T,L9=new SJ,WQ=new SJ,lJ=new T;class u0 extends V9{constructor(){super();this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:UF++}),this.uuid=D9(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(J){if(Array.isArray(J))this.index=new((j1(J))?gQ:fQ)(J,1);else this.index=J;return this}setIndirect(J,Q=0){return this.indirect=J,this.indirectOffset=Q,this}getIndirect(){return this.indirect}getAttribute(J){return this.attributes[J]}setAttribute(J,Q){return this.attributes[J]=Q,this}deleteAttribute(J){return delete this.attributes[J],this}hasAttribute(J){return this.attributes[J]!==void 0}addGroup(J,Q,$=0){this.groups.push({start:J,count:Q,materialIndex:$})}clearGroups(){this.groups=[]}setDrawRange(J,Q){this.drawRange.start=J,this.drawRange.count=Q}applyMatrix4(J){let Q=this.attributes.position;if(Q!==void 0)Q.applyMatrix4(J),Q.needsUpdate=!0;let $=this.attributes.normal;if($!==void 0){let W=new o0().getNormalMatrix(J);$.applyNormalMatrix(W),$.needsUpdate=!0}let Z=this.attributes.tangent;if(Z!==void 0)Z.transformDirection(J),Z.needsUpdate=!0;if(this.boundingBox!==null)this.computeBoundingBox();if(this.boundingSphere!==null)this.computeBoundingSphere();return this}applyQuaternion(J){return z9.makeRotationFromQuaternion(J),this.applyMatrix4(z9),this}rotateX(J){return z9.makeRotationX(J),this.applyMatrix4(z9),this}rotateY(J){return z9.makeRotationY(J),this.applyMatrix4(z9),this}rotateZ(J){return z9.makeRotationZ(J),this.applyMatrix4(z9),this}translate(J,Q,$){return z9.makeTranslation(J,Q,$),this.applyMatrix4(z9),this}scale(J,Q,$){return z9.makeScale(J,Q,$),this.applyMatrix4(z9),this}lookAt(J){return wY.lookAt(J),wY.updateMatrix(),this.applyMatrix4(wY.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(X7).negate(),this.translate(X7.x,X7.y,X7.z),this}setFromPoints(J){let Q=this.getAttribute("position");if(Q===void 0){let $=[];for(let Z=0,W=J.length;Z<W;Z++){let Y=J[Z];$.push(Y.x,Y.y,Y.z||0)}this.setAttribute("position",new I0($,3))}else{let $=Math.min(J.length,Q.count);for(let Z=0;Z<$;Z++){let W=J[Z];Q.setXYZ(Z,W.x,W.y,W.z||0)}if(J.length>Q.count)O0("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.");Q.needsUpdate=!0}return this}computeBoundingBox(){if(this.boundingBox===null)this.boundingBox=new SJ;let J=this.attributes.position,Q=this.morphAttributes.position;if(J&&J.isGLBufferAttribute){v0("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new T(-1/0,-1/0,-1/0),new T(1/0,1/0,1/0));return}if(J!==void 0){if(this.boundingBox.setFromBufferAttribute(J),Q)for(let $=0,Z=Q.length;$<Z;$++){let W=Q[$];if(L9.setFromBufferAttribute(W),this.morphTargetsRelative)lJ.addVectors(this.boundingBox.min,L9.min),this.boundingBox.expandByPoint(lJ),lJ.addVectors(this.boundingBox.max,L9.max),this.boundingBox.expandByPoint(lJ);else this.boundingBox.expandByPoint(L9.min),this.boundingBox.expandByPoint(L9.max)}}else this.boundingBox.makeEmpty();if(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))v0('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){if(this.boundingSphere===null)this.boundingSphere=new _J;let J=this.attributes.position,Q=this.morphAttributes.position;if(J&&J.isGLBufferAttribute){v0("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new T,1/0);return}if(J){let $=this.boundingSphere.center;if(L9.setFromBufferAttribute(J),Q)for(let W=0,Y=Q.length;W<Y;W++){let X=Q[W];if(WQ.setFromBufferAttribute(X),this.morphTargetsRelative)lJ.addVectors(L9.min,WQ.min),L9.expandByPoint(lJ),lJ.addVectors(L9.max,WQ.max),L9.expandByPoint(lJ);else L9.expandByPoint(WQ.min),L9.expandByPoint(WQ.max)}L9.getCenter($);let Z=0;for(let W=0,Y=J.count;W<Y;W++)lJ.fromBufferAttribute(J,W),Z=Math.max(Z,$.distanceToSquared(lJ));if(Q)for(let W=0,Y=Q.length;W<Y;W++){let X=Q[W],K=this.morphTargetsRelative;for(let H=0,U=X.count;H<U;H++){if(lJ.fromBufferAttribute(X,H),K)X7.fromBufferAttribute(J,H),lJ.add(X7);Z=Math.max(Z,$.distanceToSquared(lJ))}}if(this.boundingSphere.radius=Math.sqrt(Z),isNaN(this.boundingSphere.radius))v0('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let J=this.index,Q=this.attributes;if(J===null||Q.position===void 0||Q.normal===void 0||Q.uv===void 0){v0("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let{position:$,normal:Z,uv:W}=Q;if(this.hasAttribute("tangent")===!1)this.setAttribute("tangent",new i0(new Float32Array(4*$.count),4));let Y=this.getAttribute("tangent"),X=[],K=[];for(let B=0;B<$.count;B++)X[B]=new T,K[B]=new T;let H=new T,U=new T,G=new T,F=new i,E=new i,O=new i,R=new T,k=new T;function q(B,M,C){H.fromBufferAttribute($,B),U.fromBufferAttribute($,M),G.fromBufferAttribute($,C),F.fromBufferAttribute(W,B),E.fromBufferAttribute(W,M),O.fromBufferAttribute(W,C),U.sub(H),G.sub(H),E.sub(F),O.sub(F);let j=1/(E.x*O.y-O.x*E.y);if(!isFinite(j))return;R.copy(U).multiplyScalar(O.y).addScaledVector(G,-E.y).multiplyScalar(j),k.copy(G).multiplyScalar(E.x).addScaledVector(U,-O.x).multiplyScalar(j),X[B].add(R),X[M].add(R),X[C].add(R),K[B].add(k),K[M].add(k),K[C].add(k)}let N=this.groups;if(N.length===0)N=[{start:0,count:J.count}];for(let B=0,M=N.length;B<M;++B){let C=N[B],j=C.start,w=C.count;for(let v=j,b=j+w;v<b;v+=3)q(J.getX(v+0),J.getX(v+1),J.getX(v+2))}let L=new T,D=new T,V=new T,I=new T;function z(B){V.fromBufferAttribute(Z,B),I.copy(V);let M=X[B];L.copy(M),L.sub(V.multiplyScalar(V.dot(M))).normalize(),D.crossVectors(I,M);let j=D.dot(K[B])<0?-1:1;Y.setXYZW(B,L.x,L.y,L.z,j)}for(let B=0,M=N.length;B<M;++B){let C=N[B],j=C.start,w=C.count;for(let v=j,b=j+w;v<b;v+=3)z(J.getX(v+0)),z(J.getX(v+1)),z(J.getX(v+2))}}computeVertexNormals(){let J=this.index,Q=this.getAttribute("position");if(Q!==void 0){let $=this.getAttribute("normal");if($===void 0)$=new i0(new Float32Array(Q.count*3),3),this.setAttribute("normal",$);else for(let F=0,E=$.count;F<E;F++)$.setXYZ(F,0,0,0);let Z=new T,W=new T,Y=new T,X=new T,K=new T,H=new T,U=new T,G=new T;if(J)for(let F=0,E=J.count;F<E;F+=3){let O=J.getX(F+0),R=J.getX(F+1),k=J.getX(F+2);Z.fromBufferAttribute(Q,O),W.fromBufferAttribute(Q,R),Y.fromBufferAttribute(Q,k),U.subVectors(Y,W),G.subVectors(Z,W),U.cross(G),X.fromBufferAttribute($,O),K.fromBufferAttribute($,R),H.fromBufferAttribute($,k),X.add(U),K.add(U),H.add(U),$.setXYZ(O,X.x,X.y,X.z),$.setXYZ(R,K.x,K.y,K.z),$.setXYZ(k,H.x,H.y,H.z)}else for(let F=0,E=Q.count;F<E;F+=3)Z.fromBufferAttribute(Q,F+0),W.fromBufferAttribute(Q,F+1),Y.fromBufferAttribute(Q,F+2),U.subVectors(Y,W),G.subVectors(Z,W),U.cross(G),$.setXYZ(F+0,U.x,U.y,U.z),$.setXYZ(F+1,U.x,U.y,U.z),$.setXYZ(F+2,U.x,U.y,U.z);this.normalizeNormals(),$.needsUpdate=!0}}normalizeNormals(){let J=this.attributes.normal;for(let Q=0,$=J.count;Q<$;Q++)lJ.fromBufferAttribute(J,Q),lJ.normalize(),J.setXYZ(Q,lJ.x,lJ.y,lJ.z)}toNonIndexed(){function J(X,K){let{array:H,itemSize:U,normalized:G}=X,F=new H.constructor(K.length*U),E=0,O=0;for(let R=0,k=K.length;R<k;R++){if(X.isInterleavedBufferAttribute)E=K[R]*X.data.stride+X.offset;else E=K[R]*U;for(let q=0;q<U;q++)F[O++]=H[E++]}return new i0(F,U,G)}if(this.index===null)return O0("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let Q=new u0,$=this.index.array,Z=this.attributes;for(let X in Z){let K=Z[X],H=J(K,$);Q.setAttribute(X,H)}let W=this.morphAttributes;for(let X in W){let K=[],H=W[X];for(let U=0,G=H.length;U<G;U++){let F=H[U],E=J(F,$);K.push(E)}Q.morphAttributes[X]=K}Q.morphTargetsRelative=this.morphTargetsRelative;let Y=this.groups;for(let X=0,K=Y.length;X<K;X++){let H=Y[X];Q.addGroup(H.start,H.count,H.materialIndex)}return Q}toJSON(){let J={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(J.uuid=this.uuid,J.type=this.type,this.name!=="")J.name=this.name;if(Object.keys(this.userData).length>0)J.userData=this.userData;if(this.parameters!==void 0){let K=this.parameters;for(let H in K)if(K[H]!==void 0)J[H]=K[H];return J}J.data={attributes:{}};let Q=this.index;if(Q!==null)J.data.index={type:Q.array.constructor.name,array:Array.prototype.slice.call(Q.array)};let $=this.attributes;for(let K in $){let H=$[K];J.data.attributes[K]=H.toJSON(J.data)}let Z={},W=!1;for(let K in this.morphAttributes){let H=this.morphAttributes[K],U=[];for(let G=0,F=H.length;G<F;G++){let E=H[G];U.push(E.toJSON(J.data))}if(U.length>0)Z[K]=U,W=!0}if(W)J.data.morphAttributes=Z,J.data.morphTargetsRelative=this.morphTargetsRelative;let Y=this.groups;if(Y.length>0)J.data.groups=JSON.parse(JSON.stringify(Y));let X=this.boundingSphere;if(X!==null)J.data.boundingSphere=X.toJSON();return J}clone(){return new this.constructor().copy(this)}copy(J){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let Q={};this.name=J.name;let $=J.index;if($!==null)this.setIndex($.clone());let Z=J.attributes;for(let H in Z){let U=Z[H];this.setAttribute(H,U.clone(Q))}let W=J.morphAttributes;for(let H in W){let U=[],G=W[H];for(let F=0,E=G.length;F<E;F++)U.push(G[F].clone(Q));this.morphAttributes[H]=U}this.morphTargetsRelative=J.morphTargetsRelative;let Y=J.groups;for(let H=0,U=Y.length;H<U;H++){let G=Y[H];this.addGroup(G.start,G.count,G.materialIndex)}let X=J.boundingBox;if(X!==null)this.boundingBox=X.clone();let K=J.boundingSphere;if(K!==null)this.boundingSphere=K.clone();return this.drawRange.start=J.drawRange.start,this.drawRange.count=J.drawRange.count,this.userData=J.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class w8{constructor(J,Q){this.isInterleavedBuffer=!0,this.array=J,this.stride=Q,this.count=J!==void 0?J.length/Q:0,this.usage=35044,this.updateRanges=[],this.version=0,this.uuid=D9()}onUploadCallback(){}set needsUpdate(J){if(J===!0)this.version++}setUsage(J){return this.usage=J,this}addUpdateRange(J,Q){this.updateRanges.push({start:J,count:Q})}clearUpdateRanges(){this.updateRanges.length=0}copy(J){return this.array=new J.array.constructor(J.array),this.count=J.count,this.stride=J.stride,this.usage=J.usage,this}copyAt(J,Q,$){J*=this.stride,$*=Q.stride;for(let Z=0,W=this.stride;Z<W;Z++)this.array[J+Z]=Q.array[$+Z];return this}set(J,Q=0){return this.array.set(J,Q),this}clone(J){if(J.arrayBuffers===void 0)J.arrayBuffers={};if(this.array.buffer._uuid===void 0)this.array.buffer._uuid=D9();if(J.arrayBuffers[this.array.buffer._uuid]===void 0)J.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer;let Q=new this.array.constructor(J.arrayBuffers[this.array.buffer._uuid]),$=new this.constructor(Q,this.stride);return $.setUsage(this.usage),$}onUpload(J){return this.onUploadCallback=J,this}toJSON(J){if(J.arrayBuffers===void 0)J.arrayBuffers={};if(this.array.buffer._uuid===void 0)this.array.buffer._uuid=D9();if(J.arrayBuffers[this.array.buffer._uuid]===void 0)J.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer));return{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}var $9=new T;class m9{constructor(J,Q,$,Z=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=J,this.itemSize=Q,this.offset=$,this.normalized=Z}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(J){this.data.needsUpdate=J}applyMatrix4(J){for(let Q=0,$=this.data.count;Q<$;Q++)$9.fromBufferAttribute(this,Q),$9.applyMatrix4(J),this.setXYZ(Q,$9.x,$9.y,$9.z);return this}applyNormalMatrix(J){for(let Q=0,$=this.count;Q<$;Q++)$9.fromBufferAttribute(this,Q),$9.applyNormalMatrix(J),this.setXYZ(Q,$9.x,$9.y,$9.z);return this}transformDirection(J){for(let Q=0,$=this.count;Q<$;Q++)$9.fromBufferAttribute(this,Q),$9.transformDirection(J),this.setXYZ(Q,$9.x,$9.y,$9.z);return this}getComponent(J,Q){let $=this.array[J*this.data.stride+this.offset+Q];if(this.normalized)$=Z9($,this.array);return $}setComponent(J,Q,$){if(this.normalized)$=QJ($,this.array);return this.data.array[J*this.data.stride+this.offset+Q]=$,this}setX(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset]=Q,this}setY(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset+1]=Q,this}setZ(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset+2]=Q,this}setW(J,Q){if(this.normalized)Q=QJ(Q,this.array);return this.data.array[J*this.data.stride+this.offset+3]=Q,this}getX(J){let Q=this.data.array[J*this.data.stride+this.offset];if(this.normalized)Q=Z9(Q,this.array);return Q}getY(J){let Q=this.data.array[J*this.data.stride+this.offset+1];if(this.normalized)Q=Z9(Q,this.array);return Q}getZ(J){let Q=this.data.array[J*this.data.stride+this.offset+2];if(this.normalized)Q=Z9(Q,this.array);return Q}getW(J){let Q=this.data.array[J*this.data.stride+this.offset+3];if(this.normalized)Q=Z9(Q,this.array);return Q}setXY(J,Q,$){if(J=J*this.data.stride+this.offset,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array);return this.data.array[J+0]=Q,this.data.array[J+1]=$,this}setXYZ(J,Q,$,Z){if(J=J*this.data.stride+this.offset,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),Z=QJ(Z,this.array);return this.data.array[J+0]=Q,this.data.array[J+1]=$,this.data.array[J+2]=Z,this}setXYZW(J,Q,$,Z,W){if(J=J*this.data.stride+this.offset,this.normalized)Q=QJ(Q,this.array),$=QJ($,this.array),Z=QJ(Z,this.array),W=QJ(W,this.array);return this.data.array[J+0]=Q,this.data.array[J+1]=$,this.data.array[J+2]=Z,this.data.array[J+3]=W,this}clone(J){if(J===void 0){M7("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let Q=[];for(let $=0;$<this.count;$++){let Z=$*this.data.stride+this.offset;for(let W=0;W<this.itemSize;W++)Q.push(this.data.array[Z+W])}return new i0(new this.array.constructor(Q),this.itemSize,this.normalized)}else{if(J.interleavedBuffers===void 0)J.interleavedBuffers={};if(J.interleavedBuffers[this.data.uuid]===void 0)J.interleavedBuffers[this.data.uuid]=this.data.clone(J);return new m9(J.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}}toJSON(J){if(J===void 0){M7("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let Q=[];for(let $=0;$<this.count;$++){let Z=$*this.data.stride+this.offset;for(let W=0;W<this.itemSize;W++)Q.push(this.data.array[Z+W])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:Q,normalized:this.normalized}}else{if(J.interleavedBuffers===void 0)J.interleavedBuffers={};if(J.interleavedBuffers[this.data.uuid]===void 0)J.interleavedBuffers[this.data.uuid]=this.data.toJSON(J);return{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}}var GF=0;class vJ extends V9{constructor(){super();this.isMaterial=!0,Object.defineProperty(this,"id",{value:GF++}),this.uuid=D9(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new e(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(J){if(this._alphaTest>0!==J>0)this.version++;this._alphaTest=J}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(J){if(J===void 0)return;for(let Q in J){let $=J[Q];if($===void 0){O0(`Material: parameter '${Q}' has value of undefined.`);continue}let Z=this[Q];if(Z===void 0){O0(`Material: '${Q}' is not a property of THREE.${this.type}.`);continue}if(Z&&Z.isColor)Z.set($);else if(Z&&Z.isVector3&&($&&$.isVector3))Z.copy($);else this[Q]=$}}toJSON(J){let Q=J===void 0||typeof J==="string";if(Q)J={textures:{},images:{}};let $={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};if($.uuid=this.uuid,$.type=this.type,this.name!=="")$.name=this.name;if(this.color&&this.color.isColor)$.color=this.color.getHex();if(this.roughness!==void 0)$.roughness=this.roughness;if(this.metalness!==void 0)$.metalness=this.metalness;if(this.sheen!==void 0)$.sheen=this.sheen;if(this.sheenColor&&this.sheenColor.isColor)$.sheenColor=this.sheenColor.getHex();if(this.sheenRoughness!==void 0)$.sheenRoughness=this.sheenRoughness;if(this.emissive&&this.emissive.isColor)$.emissive=this.emissive.getHex();if(this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1)$.emissiveIntensity=this.emissiveIntensity;if(this.specular&&this.specular.isColor)$.specular=this.specular.getHex();if(this.specularIntensity!==void 0)$.specularIntensity=this.specularIntensity;if(this.specularColor&&this.specularColor.isColor)$.specularColor=this.specularColor.getHex();if(this.shininess!==void 0)$.shininess=this.shininess;if(this.clearcoat!==void 0)$.clearcoat=this.clearcoat;if(this.clearcoatRoughness!==void 0)$.clearcoatRoughness=this.clearcoatRoughness;if(this.clearcoatMap&&this.clearcoatMap.isTexture)$.clearcoatMap=this.clearcoatMap.toJSON(J).uuid;if(this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture)$.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(J).uuid;if(this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture)$.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(J).uuid,$.clearcoatNormalScale=this.clearcoatNormalScale.toArray();if(this.sheenColorMap&&this.sheenColorMap.isTexture)$.sheenColorMap=this.sheenColorMap.toJSON(J).uuid;if(this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture)$.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(J).uuid;if(this.dispersion!==void 0)$.dispersion=this.dispersion;if(this.iridescence!==void 0)$.iridescence=this.iridescence;if(this.iridescenceIOR!==void 0)$.iridescenceIOR=this.iridescenceIOR;if(this.iridescenceThicknessRange!==void 0)$.iridescenceThicknessRange=this.iridescenceThicknessRange;if(this.iridescenceMap&&this.iridescenceMap.isTexture)$.iridescenceMap=this.iridescenceMap.toJSON(J).uuid;if(this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture)$.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(J).uuid;if(this.anisotropy!==void 0)$.anisotropy=this.anisotropy;if(this.anisotropyRotation!==void 0)$.anisotropyRotation=this.anisotropyRotation;if(this.anisotropyMap&&this.anisotropyMap.isTexture)$.anisotropyMap=this.anisotropyMap.toJSON(J).uuid;if(this.map&&this.map.isTexture)$.map=this.map.toJSON(J).uuid;if(this.matcap&&this.matcap.isTexture)$.matcap=this.matcap.toJSON(J).uuid;if(this.alphaMap&&this.alphaMap.isTexture)$.alphaMap=this.alphaMap.toJSON(J).uuid;if(this.lightMap&&this.lightMap.isTexture)$.lightMap=this.lightMap.toJSON(J).uuid,$.lightMapIntensity=this.lightMapIntensity;if(this.aoMap&&this.aoMap.isTexture)$.aoMap=this.aoMap.toJSON(J).uuid,$.aoMapIntensity=this.aoMapIntensity;if(this.bumpMap&&this.bumpMap.isTexture)$.bumpMap=this.bumpMap.toJSON(J).uuid,$.bumpScale=this.bumpScale;if(this.normalMap&&this.normalMap.isTexture)$.normalMap=this.normalMap.toJSON(J).uuid,$.normalMapType=this.normalMapType,$.normalScale=this.normalScale.toArray();if(this.displacementMap&&this.displacementMap.isTexture)$.displacementMap=this.displacementMap.toJSON(J).uuid,$.displacementScale=this.displacementScale,$.displacementBias=this.displacementBias;if(this.roughnessMap&&this.roughnessMap.isTexture)$.roughnessMap=this.roughnessMap.toJSON(J).uuid;if(this.metalnessMap&&this.metalnessMap.isTexture)$.metalnessMap=this.metalnessMap.toJSON(J).uuid;if(this.emissiveMap&&this.emissiveMap.isTexture)$.emissiveMap=this.emissiveMap.toJSON(J).uuid;if(this.specularMap&&this.specularMap.isTexture)$.specularMap=this.specularMap.toJSON(J).uuid;if(this.specularIntensityMap&&this.specularIntensityMap.isTexture)$.specularIntensityMap=this.specularIntensityMap.toJSON(J).uuid;if(this.specularColorMap&&this.specularColorMap.isTexture)$.specularColorMap=this.specularColorMap.toJSON(J).uuid;if(this.envMap&&this.envMap.isTexture){if($.envMap=this.envMap.toJSON(J).uuid,this.combine!==void 0)$.combine=this.combine}if(this.envMapRotation!==void 0)$.envMapRotation=this.envMapRotation.toArray();if(this.envMapIntensity!==void 0)$.envMapIntensity=this.envMapIntensity;if(this.reflectivity!==void 0)$.reflectivity=this.reflectivity;if(this.refractionRatio!==void 0)$.refractionRatio=this.refractionRatio;if(this.gradientMap&&this.gradientMap.isTexture)$.gradientMap=this.gradientMap.toJSON(J).uuid;if(this.transmission!==void 0)$.transmission=this.transmission;if(this.transmissionMap&&this.transmissionMap.isTexture)$.transmissionMap=this.transmissionMap.toJSON(J).uuid;if(this.thickness!==void 0)$.thickness=this.thickness;if(this.thicknessMap&&this.thicknessMap.isTexture)$.thicknessMap=this.thicknessMap.toJSON(J).uuid;if(this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0)$.attenuationDistance=this.attenuationDistance;if(this.attenuationColor!==void 0)$.attenuationColor=this.attenuationColor.getHex();if(this.size!==void 0)$.size=this.size;if(this.shadowSide!==null)$.shadowSide=this.shadowSide;if(this.sizeAttenuation!==void 0)$.sizeAttenuation=this.sizeAttenuation;if(this.blending!==1)$.blending=this.blending;if(this.side!==0)$.side=this.side;if(this.vertexColors===!0)$.vertexColors=!0;if(this.opacity<1)$.opacity=this.opacity;if(this.transparent===!0)$.transparent=!0;if(this.blendSrc!==204)$.blendSrc=this.blendSrc;if(this.blendDst!==205)$.blendDst=this.blendDst;if(this.blendEquation!==100)$.blendEquation=this.blendEquation;if(this.blendSrcAlpha!==null)$.blendSrcAlpha=this.blendSrcAlpha;if(this.blendDstAlpha!==null)$.blendDstAlpha=this.blendDstAlpha;if(this.blendEquationAlpha!==null)$.blendEquationAlpha=this.blendEquationAlpha;if(this.blendColor&&this.blendColor.isColor)$.blendColor=this.blendColor.getHex();if(this.blendAlpha!==0)$.blendAlpha=this.blendAlpha;if(this.depthFunc!==3)$.depthFunc=this.depthFunc;if(this.depthTest===!1)$.depthTest=this.depthTest;if(this.depthWrite===!1)$.depthWrite=this.depthWrite;if(this.colorWrite===!1)$.colorWrite=this.colorWrite;if(this.stencilWriteMask!==255)$.stencilWriteMask=this.stencilWriteMask;if(this.stencilFunc!==519)$.stencilFunc=this.stencilFunc;if(this.stencilRef!==0)$.stencilRef=this.stencilRef;if(this.stencilFuncMask!==255)$.stencilFuncMask=this.stencilFuncMask;if(this.stencilFail!==7680)$.stencilFail=this.stencilFail;if(this.stencilZFail!==7680)$.stencilZFail=this.stencilZFail;if(this.stencilZPass!==7680)$.stencilZPass=this.stencilZPass;if(this.stencilWrite===!0)$.stencilWrite=this.stencilWrite;if(this.rotation!==void 0&&this.rotation!==0)$.rotation=this.rotation;if(this.polygonOffset===!0)$.polygonOffset=!0;if(this.polygonOffsetFactor!==0)$.polygonOffsetFactor=this.polygonOffsetFactor;if(this.polygonOffsetUnits!==0)$.polygonOffsetUnits=this.polygonOffsetUnits;if(this.linewidth!==void 0&&this.linewidth!==1)$.linewidth=this.linewidth;if(this.dashSize!==void 0)$.dashSize=this.dashSize;if(this.gapSize!==void 0)$.gapSize=this.gapSize;if(this.scale!==void 0)$.scale=this.scale;if(this.dithering===!0)$.dithering=!0;if(this.alphaTest>0)$.alphaTest=this.alphaTest;if(this.alphaHash===!0)$.alphaHash=!0;if(this.alphaToCoverage===!0)$.alphaToCoverage=!0;if(this.premultipliedAlpha===!0)$.premultipliedAlpha=!0;if(this.forceSinglePass===!0)$.forceSinglePass=!0;if(this.allowOverride===!1)$.allowOverride=!1;if(this.wireframe===!0)$.wireframe=!0;if(this.wireframeLinewidth>1)$.wireframeLinewidth=this.wireframeLinewidth;if(this.wireframeLinecap!=="round")$.wireframeLinecap=this.wireframeLinecap;if(this.wireframeLinejoin!=="round")$.wireframeLinejoin=this.wireframeLinejoin;if(this.flatShading===!0)$.flatShading=!0;if(this.visible===!1)$.visible=!1;if(this.toneMapped===!1)$.toneMapped=!1;if(this.fog===!1)$.fog=!1;if(Object.keys(this.userData).length>0)$.userData=this.userData;function Z(W){let Y=[];for(let X in W){let K=W[X];delete K.metadata,Y.push(K)}return Y}if(Q){let W=Z(J.textures),Y=Z(J.images);if(W.length>0)$.textures=W;if(Y.length>0)$.images=Y}return $}clone(){return new this.constructor().copy(this)}copy(J){this.name=J.name,this.blending=J.blending,this.side=J.side,this.vertexColors=J.vertexColors,this.opacity=J.opacity,this.transparent=J.transparent,this.blendSrc=J.blendSrc,this.blendDst=J.blendDst,this.blendEquation=J.blendEquation,this.blendSrcAlpha=J.blendSrcAlpha,this.blendDstAlpha=J.blendDstAlpha,this.blendEquationAlpha=J.blendEquationAlpha,this.blendColor.copy(J.blendColor),this.blendAlpha=J.blendAlpha,this.depthFunc=J.depthFunc,this.depthTest=J.depthTest,this.depthWrite=J.depthWrite,this.stencilWriteMask=J.stencilWriteMask,this.stencilFunc=J.stencilFunc,this.stencilRef=J.stencilRef,this.stencilFuncMask=J.stencilFuncMask,this.stencilFail=J.stencilFail,this.stencilZFail=J.stencilZFail,this.stencilZPass=J.stencilZPass,this.stencilWrite=J.stencilWrite;let Q=J.clippingPlanes,$=null;if(Q!==null){let Z=Q.length;$=Array(Z);for(let W=0;W!==Z;++W)$[W]=Q[W].clone()}return this.clippingPlanes=$,this.clipIntersection=J.clipIntersection,this.clipShadows=J.clipShadows,this.shadowSide=J.shadowSide,this.colorWrite=J.colorWrite,this.precision=J.precision,this.polygonOffset=J.polygonOffset,this.polygonOffsetFactor=J.polygonOffsetFactor,this.polygonOffsetUnits=J.polygonOffsetUnits,this.dithering=J.dithering,this.alphaTest=J.alphaTest,this.alphaHash=J.alphaHash,this.alphaToCoverage=J.alphaToCoverage,this.premultipliedAlpha=J.premultipliedAlpha,this.forceSinglePass=J.forceSinglePass,this.allowOverride=J.allowOverride,this.visible=J.visible,this.toneMapped=J.toneMapped,this.userData=JSON.parse(JSON.stringify(J.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(J){if(J===!0)this.version++}}class pQ extends vJ{constructor(J){super();this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new e(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.alphaMap=J.alphaMap,this.rotation=J.rotation,this.sizeAttenuation=J.sizeAttenuation,this.fog=J.fog,this}}var K7,YQ=new T,H7=new T,U7=new T,G7=new i,XQ=new i,H5=new y0,x$=new T,KQ=new T,b$=new T,eH=new i,PY=new i,JU=new i;class NW extends HJ{constructor(J=new pQ){super();if(this.isSprite=!0,this.type="Sprite",K7===void 0){K7=new u0;let Q=new Float32Array([-0.5,-0.5,0,0,0,0.5,-0.5,0,1,0,0.5,0.5,0,1,1,-0.5,0.5,0,0,1]),$=new w8(Q,5);K7.setIndex([0,1,2,0,2,3]),K7.setAttribute("position",new m9($,3,0,!1)),K7.setAttribute("uv",new m9($,2,3,!1))}this.geometry=K7,this.material=J,this.center=new i(0.5,0.5),this.count=1}raycast(J,Q){if(J.camera===null)v0('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.');if(H7.setFromMatrixScale(this.matrixWorld),H5.copy(J.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(J.camera.matrixWorldInverse,this.matrixWorld),U7.setFromMatrixPosition(this.modelViewMatrix),J.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1)H7.multiplyScalar(-U7.z);let $=this.material.rotation,Z,W;if($!==0)W=Math.cos($),Z=Math.sin($);let Y=this.center;h$(x$.set(-0.5,-0.5,0),U7,Y,H7,Z,W),h$(KQ.set(0.5,-0.5,0),U7,Y,H7,Z,W),h$(b$.set(0.5,0.5,0),U7,Y,H7,Z,W),eH.set(0,0),PY.set(1,0),JU.set(1,1);let X=J.ray.intersectTriangle(x$,KQ,b$,!1,YQ);if(X===null){if(h$(KQ.set(-0.5,0.5,0),U7,Y,H7,Z,W),PY.set(0,1),X=J.ray.intersectTriangle(x$,b$,KQ,!1,YQ),X===null)return}let K=J.ray.origin.distanceTo(YQ);if(K<J.near||K>J.far)return;Q.push({distance:K,point:YQ.clone(),uv:W9.getInterpolation(YQ,x$,KQ,b$,eH,PY,JU,new i),face:null,object:this})}copy(J,Q){if(super.copy(J,Q),J.center!==void 0)this.center.copy(J.center);return this.material=J.material,this}}function h$(J,Q,$,Z,W,Y){if(G7.subVectors(J,$).addScalar(0.5).multiply(Z),W!==void 0)XQ.x=Y*G7.x-W*G7.y,XQ.y=W*G7.x+Y*G7.y;else XQ.copy(G7);J.copy(Q),J.x+=XQ.x,J.y+=XQ.y,J.applyMatrix4(H5)}var f$=new T,QU=new T;class OW extends HJ{constructor(){super();this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(J){super.copy(J,!1);let Q=J.levels;for(let $=0,Z=Q.length;$<Z;$++){let W=Q[$];this.addLevel(W.object.clone(),W.distance,W.hysteresis)}return this.autoUpdate=J.autoUpdate,this}addLevel(J,Q=0,$=0){Q=Math.abs(Q);let Z=this.levels,W;for(W=0;W<Z.length;W++)if(Q<Z[W].distance)break;return Z.splice(W,0,{distance:Q,hysteresis:$,object:J}),this.add(J),this}removeLevel(J){let Q=this.levels;for(let $=0;$<Q.length;$++)if(Q[$].distance===J){let Z=Q.splice($,1);return this.remove(Z[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(J){let Q=this.levels;if(Q.length>0){let $,Z;for($=1,Z=Q.length;$<Z;$++){let W=Q[$].distance;if(Q[$].object.visible)W-=W*Q[$].hysteresis;if(J<W)break}return Q[$-1].object}return null}raycast(J,Q){if(this.levels.length>0){f$.setFromMatrixPosition(this.matrixWorld);let Z=J.ray.origin.distanceTo(f$);this.getObjectForDistance(Z).raycast(J,Q)}}update(J){let Q=this.levels;if(Q.length>1){f$.setFromMatrixPosition(J.matrixWorld),QU.setFromMatrixPosition(this.matrixWorld);let $=f$.distanceTo(QU)/J.zoom;Q[0].object.visible=!0;let Z,W;for(Z=1,W=Q.length;Z<W;Z++){let Y=Q[Z].distance;if(Q[Z].object.visible)Y-=Y*Q[Z].hysteresis;if($>=Y)Q[Z-1].object.visible=!1,Q[Z].object.visible=!0;else break}this._currentLevel=Z-1;for(;Z<W;Z++)Q[Z].object.visible=!1}}toJSON(J){let Q=super.toJSON(J);if(this.autoUpdate===!1)Q.object.autoUpdate=!1;Q.object.levels=[];let $=this.levels;for(let Z=0,W=$.length;Z<W;Z++){let Y=$[Z];Q.object.levels.push({object:Y.object.uuid,distance:Y.distance,hysteresis:Y.hysteresis})}return Q}}var D8=new T,TY=new T,g$=new T,g8=new T,AY=new T,p$=new T,SY=new T;class J6{constructor(J=new T,Q=new T(0,0,-1)){this.origin=J,this.direction=Q}set(J,Q){return this.origin.copy(J),this.direction.copy(Q),this}copy(J){return this.origin.copy(J.origin),this.direction.copy(J.direction),this}at(J,Q){return Q.copy(this.origin).addScaledVector(this.direction,J)}lookAt(J){return this.direction.copy(J).sub(this.origin).normalize(),this}recast(J){return this.origin.copy(this.at(J,D8)),this}closestPointToPoint(J,Q){Q.subVectors(J,this.origin);let $=Q.dot(this.direction);if($<0)return Q.copy(this.origin);return Q.copy(this.origin).addScaledVector(this.direction,$)}distanceToPoint(J){return Math.sqrt(this.distanceSqToPoint(J))}distanceSqToPoint(J){let Q=D8.subVectors(J,this.origin).dot(this.direction);if(Q<0)return this.origin.distanceToSquared(J);return D8.copy(this.origin).addScaledVector(this.direction,Q),D8.distanceToSquared(J)}distanceSqToSegment(J,Q,$,Z){TY.copy(J).add(Q).multiplyScalar(0.5),g$.copy(Q).sub(J).normalize(),g8.copy(this.origin).sub(TY);let W=J.distanceTo(Q)*0.5,Y=-this.direction.dot(g$),X=g8.dot(this.direction),K=-g8.dot(g$),H=g8.lengthSq(),U=Math.abs(1-Y*Y),G,F,E,O;if(U>0)if(G=Y*K-X,F=Y*X-K,O=W*U,G>=0)if(F>=-O)if(F<=O){let R=1/U;G*=R,F*=R,E=G*(G+Y*F+2*X)+F*(Y*G+F+2*K)+H}else F=W,G=Math.max(0,-(Y*F+X)),E=-G*G+F*(F+2*K)+H;else F=-W,G=Math.max(0,-(Y*F+X)),E=-G*G+F*(F+2*K)+H;else if(F<=-O)G=Math.max(0,-(-Y*W+X)),F=G>0?-W:Math.min(Math.max(-W,-K),W),E=-G*G+F*(F+2*K)+H;else if(F<=O)G=0,F=Math.min(Math.max(-W,-K),W),E=F*(F+2*K)+H;else G=Math.max(0,-(Y*W+X)),F=G>0?W:Math.min(Math.max(-W,-K),W),E=-G*G+F*(F+2*K)+H;else F=Y>0?-W:W,G=Math.max(0,-(Y*F+X)),E=-G*G+F*(F+2*K)+H;if($)$.copy(this.origin).addScaledVector(this.direction,G);if(Z)Z.copy(TY).addScaledVector(g$,F);return E}intersectSphere(J,Q){D8.subVectors(J.center,this.origin);let $=D8.dot(this.direction),Z=D8.dot(D8)-$*$,W=J.radius*J.radius;if(Z>W)return null;let Y=Math.sqrt(W-Z),X=$-Y,K=$+Y;if(K<0)return null;if(X<0)return this.at(K,Q);return this.at(X,Q)}intersectsSphere(J){if(J.radius<0)return!1;return this.distanceSqToPoint(J.center)<=J.radius*J.radius}distanceToPlane(J){let Q=J.normal.dot(this.direction);if(Q===0){if(J.distanceToPoint(this.origin)===0)return 0;return null}let $=-(this.origin.dot(J.normal)+J.constant)/Q;return $>=0?$:null}intersectPlane(J,Q){let $=this.distanceToPlane(J);if($===null)return null;return this.at($,Q)}intersectsPlane(J){let Q=J.distanceToPoint(this.origin);if(Q===0)return!0;if(J.normal.dot(this.direction)*Q<0)return!0;return!1}intersectBox(J,Q){let $,Z,W,Y,X,K,H=1/this.direction.x,U=1/this.direction.y,G=1/this.direction.z,F=this.origin;if(H>=0)$=(J.min.x-F.x)*H,Z=(J.max.x-F.x)*H;else $=(J.max.x-F.x)*H,Z=(J.min.x-F.x)*H;if(U>=0)W=(J.min.y-F.y)*U,Y=(J.max.y-F.y)*U;else W=(J.max.y-F.y)*U,Y=(J.min.y-F.y)*U;if($>Y||W>Z)return null;if(W>$||isNaN($))$=W;if(Y<Z||isNaN(Z))Z=Y;if(G>=0)X=(J.min.z-F.z)*G,K=(J.max.z-F.z)*G;else X=(J.max.z-F.z)*G,K=(J.min.z-F.z)*G;if($>K||X>Z)return null;if(X>$||$!==$)$=X;if(K<Z||Z!==Z)Z=K;if(Z<0)return null;return this.at($>=0?$:Z,Q)}intersectsBox(J){return this.intersectBox(J,D8)!==null}intersectTriangle(J,Q,$,Z,W){AY.subVectors(Q,J),p$.subVectors($,J),SY.crossVectors(AY,p$);let Y=this.direction.dot(SY),X;if(Y>0){if(Z)return null;X=1}else if(Y<0)X=-1,Y=-Y;else return null;g8.subVectors(this.origin,J);let K=X*this.direction.dot(p$.crossVectors(g8,p$));if(K<0)return null;let H=X*this.direction.dot(AY.cross(g8));if(H<0)return null;if(K+H>Y)return null;let U=-X*g8.dot(SY);if(U<0)return null;return this.at(U/Y,W)}applyMatrix4(J){return this.origin.applyMatrix4(J),this.direction.transformDirection(J),this}equals(J){return J.origin.equals(this.origin)&&J.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class cJ extends vJ{constructor(J){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new e(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new P9,this.combine=0,this.reflectivity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.specularMap=J.specularMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.combine=J.combine,this.reflectivity=J.reflectivity,this.refractionRatio=J.refractionRatio,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.fog=J.fog,this}}var $U=new y0,U6=new J6,u$=new _J,ZU=new T,d$=new T,m$=new T,l$=new T,jY=new T,c$=new T,WU=new T,n$=new T;class a0 extends HJ{constructor(J=new u0,Q=new cJ){super();this.isMesh=!0,this.type="Mesh",this.geometry=J,this.material=Q,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(J,Q){if(super.copy(J,Q),J.morphTargetInfluences!==void 0)this.morphTargetInfluences=J.morphTargetInfluences.slice();if(J.morphTargetDictionary!==void 0)this.morphTargetDictionary=Object.assign({},J.morphTargetDictionary);return this.material=Array.isArray(J.material)?J.material.slice():J.material,this.geometry=J.geometry,this}updateMorphTargets(){let Q=this.geometry.morphAttributes,$=Object.keys(Q);if($.length>0){let Z=Q[$[0]];if(Z!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let W=0,Y=Z.length;W<Y;W++){let X=Z[W].name||String(W);this.morphTargetInfluences.push(0),this.morphTargetDictionary[X]=W}}}}getVertexPosition(J,Q){let $=this.geometry,Z=$.attributes.position,W=$.morphAttributes.position,Y=$.morphTargetsRelative;Q.fromBufferAttribute(Z,J);let X=this.morphTargetInfluences;if(W&&X){c$.set(0,0,0);for(let K=0,H=W.length;K<H;K++){let U=X[K],G=W[K];if(U===0)continue;if(jY.fromBufferAttribute(G,J),Y)c$.addScaledVector(jY,U);else c$.addScaledVector(jY.sub(Q),U)}Q.add(c$)}return Q}raycast(J,Q){let $=this.geometry,Z=this.material,W=this.matrixWorld;if(Z===void 0)return;if($.boundingSphere===null)$.computeBoundingSphere();if(u$.copy($.boundingSphere),u$.applyMatrix4(W),U6.copy(J.ray).recast(J.near),u$.containsPoint(U6.origin)===!1){if(U6.intersectSphere(u$,ZU)===null)return;if(U6.origin.distanceToSquared(ZU)>(J.far-J.near)**2)return}if($U.copy(W).invert(),U6.copy(J.ray).applyMatrix4($U),$.boundingBox!==null){if(U6.intersectsBox($.boundingBox)===!1)return}this._computeIntersections(J,Q,U6)}_computeIntersections(J,Q,$){let Z,W=this.geometry,Y=this.material,X=W.index,K=W.attributes.position,H=W.attributes.uv,U=W.attributes.uv1,G=W.attributes.normal,F=W.groups,E=W.drawRange;if(X!==null)if(Array.isArray(Y))for(let O=0,R=F.length;O<R;O++){let k=F[O],q=Y[k.materialIndex],N=Math.max(k.start,E.start),L=Math.min(X.count,Math.min(k.start+k.count,E.start+E.count));for(let D=N,V=L;D<V;D+=3){let I=X.getX(D),z=X.getX(D+1),B=X.getX(D+2);if(Z=s$(this,q,J,$,H,U,G,I,z,B),Z)Z.faceIndex=Math.floor(D/3),Z.face.materialIndex=k.materialIndex,Q.push(Z)}}else{let O=Math.max(0,E.start),R=Math.min(X.count,E.start+E.count);for(let k=O,q=R;k<q;k+=3){let N=X.getX(k),L=X.getX(k+1),D=X.getX(k+2);if(Z=s$(this,Y,J,$,H,U,G,N,L,D),Z)Z.faceIndex=Math.floor(k/3),Q.push(Z)}}else if(K!==void 0)if(Array.isArray(Y))for(let O=0,R=F.length;O<R;O++){let k=F[O],q=Y[k.materialIndex],N=Math.max(k.start,E.start),L=Math.min(K.count,Math.min(k.start+k.count,E.start+E.count));for(let D=N,V=L;D<V;D+=3){let I=D,z=D+1,B=D+2;if(Z=s$(this,q,J,$,H,U,G,I,z,B),Z)Z.faceIndex=Math.floor(D/3),Z.face.materialIndex=k.materialIndex,Q.push(Z)}}else{let O=Math.max(0,E.start),R=Math.min(K.count,E.start+E.count);for(let k=O,q=R;k<q;k+=3){let N=k,L=k+1,D=k+2;if(Z=s$(this,Y,J,$,H,U,G,N,L,D),Z)Z.faceIndex=Math.floor(k/3),Q.push(Z)}}}}function EF(J,Q,$,Z,W,Y,X,K){let H;if(Q.side===1)H=Z.intersectTriangle(X,Y,W,!0,K);else H=Z.intersectTriangle(W,Y,X,Q.side===0,K);if(H===null)return null;n$.copy(K),n$.applyMatrix4(J.matrixWorld);let U=$.ray.origin.distanceTo(n$);if(U<$.near||U>$.far)return null;return{distance:U,point:n$.clone(),object:J}}function s$(J,Q,$,Z,W,Y,X,K,H,U){J.getVertexPosition(K,d$),J.getVertexPosition(H,m$),J.getVertexPosition(U,l$);let G=EF(J,Q,$,Z,d$,m$,l$,WU);if(G){let F=new T;if(W9.getBarycoord(WU,d$,m$,l$,F),W)G.uv=W9.getInterpolatedAttribute(W,K,H,U,F,new i);if(Y)G.uv1=W9.getInterpolatedAttribute(Y,K,H,U,F,new i);if(X){if(G.normal=W9.getInterpolatedAttribute(X,K,H,U,F,new T),G.normal.dot(Z.direction)>0)G.normal.multiplyScalar(-1)}let E={a:K,b:H,c:U,normal:new T,materialIndex:0};W9.getNormal(d$,m$,l$,E.normal),G.face=E,G.barycoord=F}return G}var HQ=new FJ,YU=new FJ,XU=new FJ,FF=new FJ,KU=new y0,i$=new T,vY=new _J,HU=new y0,yY=new J6;class h7 extends a0{constructor(J,Q){super(J,Q);this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new y0,this.bindMatrixInverse=new y0,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){let J=this.geometry;if(this.boundingBox===null)this.boundingBox=new SJ;this.boundingBox.makeEmpty();let Q=J.getAttribute("position");for(let $=0;$<Q.count;$++)this.getVertexPosition($,i$),this.boundingBox.expandByPoint(i$)}computeBoundingSphere(){let J=this.geometry;if(this.boundingSphere===null)this.boundingSphere=new _J;this.boundingSphere.makeEmpty();let Q=J.getAttribute("position");for(let $=0;$<Q.count;$++)this.getVertexPosition($,i$),this.boundingSphere.expandByPoint(i$)}copy(J,Q){if(super.copy(J,Q),this.bindMode=J.bindMode,this.bindMatrix.copy(J.bindMatrix),this.bindMatrixInverse.copy(J.bindMatrixInverse),this.skeleton=J.skeleton,J.boundingBox!==null)this.boundingBox=J.boundingBox.clone();if(J.boundingSphere!==null)this.boundingSphere=J.boundingSphere.clone();return this}raycast(J,Q){let $=this.material,Z=this.matrixWorld;if($===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(vY.copy(this.boundingSphere),vY.applyMatrix4(Z),J.ray.intersectsSphere(vY)===!1)return;if(HU.copy(Z).invert(),yY.copy(J.ray).applyMatrix4(HU),this.boundingBox!==null){if(yY.intersectsBox(this.boundingBox)===!1)return}this._computeIntersections(J,Q,yY)}getVertexPosition(J,Q){return super.getVertexPosition(J,Q),this.applyBoneTransform(J,Q),Q}bind(J,Q){if(this.skeleton=J,Q===void 0)this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),Q=this.matrixWorld;this.bindMatrix.copy(Q),this.bindMatrixInverse.copy(Q).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let J=new FJ,Q=this.geometry.attributes.skinWeight;for(let $=0,Z=Q.count;$<Z;$++){J.fromBufferAttribute(Q,$);let W=1/J.manhattanLength();if(W!==1/0)J.multiplyScalar(W);else J.set(1,0,0,0);Q.setXYZW($,J.x,J.y,J.z,J.w)}}updateMatrixWorld(J){if(super.updateMatrixWorld(J),this.bindMode==="attached")this.bindMatrixInverse.copy(this.matrixWorld).invert();else if(this.bindMode==="detached")this.bindMatrixInverse.copy(this.bindMatrix).invert();else O0("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(J,Q){let $=this.skeleton,Z=this.geometry;if(YU.fromBufferAttribute(Z.attributes.skinIndex,J),XU.fromBufferAttribute(Z.attributes.skinWeight,J),Q.isVector4)HQ.copy(Q),Q.set(0,0,0,0);else HQ.set(...Q,1),Q.set(0,0,0);HQ.applyMatrix4(this.bindMatrix);for(let W=0;W<4;W++){let Y=XU.getComponent(W);if(Y!==0){let X=YU.getComponent(W);KU.multiplyMatrices($.bones[X].matrixWorld,$.boneInverses[X]),Q.addScaledVector(FF.copy(HQ).applyMatrix4(KU),Y)}}if(Q.isVector4)Q.w=HQ.w;return Q.applyMatrix4(this.bindMatrixInverse)}}class v6 extends HJ{constructor(){super();this.isBone=!0,this.type="Bone"}}class k9 extends MJ{constructor(J=null,Q=1,$=1,Z,W,Y,X,K,H=1003,U=1003,G,F){super(null,Y,X,K,H,U,Z,W,G,F);this.isDataTexture=!0,this.image={data:J,width:Q,height:$},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}var UU=new y0,NF=new y0;class y6{constructor(J=[],Q=[]){this.uuid=D9(),this.bones=J.slice(0),this.boneInverses=Q,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){let J=this.bones,Q=this.boneInverses;if(this.boneMatrices=new Float32Array(J.length*16),Q.length===0)this.calculateInverses();else if(J.length!==Q.length){O0("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let $=0,Z=this.bones.length;$<Z;$++)this.boneInverses.push(new y0)}}calculateInverses(){this.boneInverses.length=0;for(let J=0,Q=this.bones.length;J<Q;J++){let $=new y0;if(this.bones[J])$.copy(this.bones[J].matrixWorld).invert();this.boneInverses.push($)}}pose(){for(let J=0,Q=this.bones.length;J<Q;J++){let $=this.bones[J];if($)$.matrixWorld.copy(this.boneInverses[J]).invert()}for(let J=0,Q=this.bones.length;J<Q;J++){let $=this.bones[J];if($){if($.parent&&$.parent.isBone)$.matrix.copy($.parent.matrixWorld).invert(),$.matrix.multiply($.matrixWorld);else $.matrix.copy($.matrixWorld);$.matrix.decompose($.position,$.quaternion,$.scale)}}}update(){let J=this.bones,Q=this.boneInverses,$=this.boneMatrices,Z=this.boneTexture;for(let W=0,Y=J.length;W<Y;W++){let X=J[W]?J[W].matrixWorld:NF;UU.multiplyMatrices(X,Q[W]),UU.toArray($,W*16)}if(Z!==null)Z.needsUpdate=!0}clone(){return new y6(this.bones,this.boneInverses)}computeBoneTexture(){let J=Math.sqrt(this.bones.length*4);J=Math.ceil(J/4)*4,J=Math.max(J,4);let Q=new Float32Array(J*J*4);Q.set(this.boneMatrices);let $=new k9(Q,J,J,1023,1015);return $.needsUpdate=!0,this.boneMatrices=Q,this.boneTexture=$,this}getBoneByName(J){for(let Q=0,$=this.bones.length;Q<$;Q++){let Z=this.bones[Q];if(Z.name===J)return Z}return}dispose(){if(this.boneTexture!==null)this.boneTexture.dispose(),this.boneTexture=null}fromJSON(J,Q){this.uuid=J.uuid;for(let $=0,Z=J.bones.length;$<Z;$++){let W=J.bones[$],Y=Q[W];if(Y===void 0)O0("Skeleton: No bone found with UUID:",W),Y=new v6;this.bones.push(Y),this.boneInverses.push(new y0().fromArray(J.boneInverses[$]))}return this.init(),this}toJSON(){let J={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};J.uuid=this.uuid;let Q=this.bones,$=this.boneInverses;for(let Z=0,W=Q.length;Z<W;Z++){let Y=Q[Z];J.bones.push(Y.uuid);let X=$[Z];J.boneInverses.push(X.toArray())}return J}}class l9 extends i0{constructor(J,Q,$,Z=1){super(J,Q,$);this.isInstancedBufferAttribute=!0,this.meshPerAttribute=Z}copy(J){return super.copy(J),this.meshPerAttribute=J.meshPerAttribute,this}toJSON(){let J=super.toJSON();return J.meshPerAttribute=this.meshPerAttribute,J.isInstancedBufferAttribute=!0,J}}var E7=new y0,GU=new y0,o$=[],EU=new SJ,OF=new y0,UQ=new a0,GQ=new _J;class K8 extends a0{constructor(J,Q,$){super(J,Q);this.isInstancedMesh=!0,this.instanceMatrix=new l9(new Float32Array($*16),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=$,this.boundingBox=null,this.boundingSphere=null;for(let Z=0;Z<$;Z++)this.setMatrixAt(Z,OF)}computeBoundingBox(){let J=this.geometry,Q=this.count;if(this.boundingBox===null)this.boundingBox=new SJ;if(J.boundingBox===null)J.computeBoundingBox();this.boundingBox.makeEmpty();for(let $=0;$<Q;$++)this.getMatrixAt($,E7),EU.copy(J.boundingBox).applyMatrix4(E7),this.boundingBox.union(EU)}computeBoundingSphere(){let J=this.geometry,Q=this.count;if(this.boundingSphere===null)this.boundingSphere=new _J;if(J.boundingSphere===null)J.computeBoundingSphere();this.boundingSphere.makeEmpty();for(let $=0;$<Q;$++)this.getMatrixAt($,E7),GQ.copy(J.boundingSphere).applyMatrix4(E7),this.boundingSphere.union(GQ)}copy(J,Q){if(super.copy(J,Q),this.instanceMatrix.copy(J.instanceMatrix),J.previousInstanceMatrix!==null)this.previousInstanceMatrix=J.previousInstanceMatrix.clone();if(J.morphTexture!==null)this.morphTexture=J.morphTexture.clone();if(J.instanceColor!==null)this.instanceColor=J.instanceColor.clone();if(this.count=J.count,J.boundingBox!==null)this.boundingBox=J.boundingBox.clone();if(J.boundingSphere!==null)this.boundingSphere=J.boundingSphere.clone();return this}getColorAt(J,Q){if(this.instanceColor===null)return Q.setRGB(1,1,1);else return Q.fromArray(this.instanceColor.array,J*3)}getMatrixAt(J,Q){return Q.fromArray(this.instanceMatrix.array,J*16)}getMorphAt(J,Q){let $=Q.morphTargetInfluences,Z=this.morphTexture.source.data.data,W=$.length+1,Y=J*W+1;for(let X=0;X<$.length;X++)$[X]=Z[Y+X]}raycast(J,Q){let $=this.matrixWorld,Z=this.count;if(UQ.geometry=this.geometry,UQ.material=this.material,UQ.material===void 0)return;if(this.boundingSphere===null)this.computeBoundingSphere();if(GQ.copy(this.boundingSphere),GQ.applyMatrix4($),J.ray.intersectsSphere(GQ)===!1)return;for(let W=0;W<Z;W++){this.getMatrixAt(W,E7),GU.multiplyMatrices($,E7),UQ.matrixWorld=GU,UQ.raycast(J,o$);for(let Y=0,X=o$.length;Y<X;Y++){let K=o$[Y];K.instanceId=W,K.object=this,Q.push(K)}o$.length=0}}setColorAt(J,Q){if(this.instanceColor===null)this.instanceColor=new l9(new Float32Array(this.instanceMatrix.count*3).fill(1),3);return Q.toArray(this.instanceColor.array,J*3),this}setMatrixAt(J,Q){return Q.toArray(this.instanceMatrix.array,J*16),this}setMorphAt(J,Q){let $=Q.morphTargetInfluences,Z=$.length+1;if(this.morphTexture===null)this.morphTexture=new k9(new Float32Array(Z*this.count),Z,this.count,1028,1015);let W=this.morphTexture.source.data.data,Y=0;for(let H=0;H<$.length;H++)Y+=$[H];let X=this.geometry.morphTargetsRelative?1:1-Y,K=Z*J;return W[K]=X,W.set($,K+1),this}updateMorphTargets(){}dispose(){if(this.dispatchEvent({type:"dispose"}),this.morphTexture!==null)this.morphTexture.dispose(),this.morphTexture=null}}var xY=new T,qF=new T,RF=new o0;class _9{constructor(J=new T(1,0,0),Q=0){this.isPlane=!0,this.normal=J,this.constant=Q}set(J,Q){return this.normal.copy(J),this.constant=Q,this}setComponents(J,Q,$,Z){return this.normal.set(J,Q,$),this.constant=Z,this}setFromNormalAndCoplanarPoint(J,Q){return this.normal.copy(J),this.constant=-Q.dot(this.normal),this}setFromCoplanarPoints(J,Q,$){let Z=xY.subVectors($,Q).cross(qF.subVectors(J,Q)).normalize();return this.setFromNormalAndCoplanarPoint(Z,J),this}copy(J){return this.normal.copy(J.normal),this.constant=J.constant,this}normalize(){let J=1/this.normal.length();return this.normal.multiplyScalar(J),this.constant*=J,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(J){return this.normal.dot(J)+this.constant}distanceToSphere(J){return this.distanceToPoint(J.center)-J.radius}projectPoint(J,Q){return Q.copy(J).addScaledVector(this.normal,-this.distanceToPoint(J))}intersectLine(J,Q,$=!0){let Z=J.delta(xY),W=this.normal.dot(Z);if(W===0){if(this.distanceToPoint(J.start)===0)return Q.copy(J.start);return null}let Y=-(J.start.dot(this.normal)+this.constant)/W;if($===!0&&(Y<0||Y>1))return null;return Q.copy(J.start).addScaledVector(Z,Y)}intersectsLine(J){let Q=this.distanceToPoint(J.start),$=this.distanceToPoint(J.end);return Q<0&&$>0||$<0&&Q>0}intersectsBox(J){return J.intersectsPlane(this)}intersectsSphere(J){return J.intersectsPlane(this)}coplanarPoint(J){return J.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(J,Q){let $=Q||RF.getNormalMatrix(J),Z=this.coplanarPoint(xY).applyMatrix4(J),W=this.normal.applyMatrix3($).normalize();return this.constant=-Z.dot(W),this}translate(J){return this.constant-=J.dot(this.normal),this}equals(J){return J.normal.equals(this.normal)&&J.constant===this.constant}clone(){return new this.constructor().copy(this)}}var G6=new _J,LF=new i(0.5,0.5),a$=new T;class H8{constructor(J=new _9,Q=new _9,$=new _9,Z=new _9,W=new _9,Y=new _9){this.planes=[J,Q,$,Z,W,Y]}set(J,Q,$,Z,W,Y){let X=this.planes;return X[0].copy(J),X[1].copy(Q),X[2].copy($),X[3].copy(Z),X[4].copy(W),X[5].copy(Y),this}copy(J){let Q=this.planes;for(let $=0;$<6;$++)Q[$].copy(J.planes[$]);return this}setFromProjectionMatrix(J,Q=2000,$=!1){let Z=this.planes,W=J.elements,Y=W[0],X=W[1],K=W[2],H=W[3],U=W[4],G=W[5],F=W[6],E=W[7],O=W[8],R=W[9],k=W[10],q=W[11],N=W[12],L=W[13],D=W[14],V=W[15];if(Z[0].setComponents(H-Y,E-U,q-O,V-N).normalize(),Z[1].setComponents(H+Y,E+U,q+O,V+N).normalize(),Z[2].setComponents(H+X,E+G,q+R,V+L).normalize(),Z[3].setComponents(H-X,E-G,q-R,V-L).normalize(),$)Z[4].setComponents(K,F,k,D).normalize(),Z[5].setComponents(H-K,E-F,q-k,V-D).normalize();else if(Z[4].setComponents(H-K,E-F,q-k,V-D).normalize(),Q===2000)Z[5].setComponents(H+K,E+F,q+k,V+D).normalize();else if(Q===2001)Z[5].setComponents(K,F,k,D).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+Q);return this}intersectsObject(J){if(J.boundingSphere!==void 0){if(J.boundingSphere===null)J.computeBoundingSphere();G6.copy(J.boundingSphere).applyMatrix4(J.matrixWorld)}else{let Q=J.geometry;if(Q.boundingSphere===null)Q.computeBoundingSphere();G6.copy(Q.boundingSphere).applyMatrix4(J.matrixWorld)}return this.intersectsSphere(G6)}intersectsSprite(J){G6.center.set(0,0,0);let Q=LF.distanceTo(J.center);return G6.radius=0.7071067811865476+Q,G6.applyMatrix4(J.matrixWorld),this.intersectsSphere(G6)}intersectsSphere(J){let Q=this.planes,$=J.center,Z=-J.radius;for(let W=0;W<6;W++)if(Q[W].distanceToPoint($)<Z)return!1;return!0}intersectsBox(J){let Q=this.planes;for(let $=0;$<6;$++){let Z=Q[$];if(a$.x=Z.normal.x>0?J.max.x:J.min.x,a$.y=Z.normal.y>0?J.max.y:J.min.y,a$.z=Z.normal.z>0?J.max.z:J.min.z,Z.distanceToPoint(a$)<0)return!1}return!0}containsPoint(J){let Q=this.planes;for(let $=0;$<6;$++)if(Q[$].distanceToPoint(J)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}var Q8=new y0,$8=new H8;class uQ{constructor(){this.coordinateSystem=2000}intersectsObject(J,Q){if(!Q.isArrayCamera||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(Q8.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),$8.setFromProjectionMatrix(Q8,Z.coordinateSystem,Z.reversedDepth),$8.intersectsObject(J))return!0}return!1}intersectsSprite(J,Q){if(!Q||!Q.cameras||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(Q8.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),$8.setFromProjectionMatrix(Q8,Z.coordinateSystem,Z.reversedDepth),$8.intersectsSprite(J))return!0}return!1}intersectsSphere(J,Q){if(!Q||!Q.cameras||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(Q8.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),$8.setFromProjectionMatrix(Q8,Z.coordinateSystem,Z.reversedDepth),$8.intersectsSphere(J))return!0}return!1}intersectsBox(J,Q){if(!Q||!Q.cameras||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(Q8.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),$8.setFromProjectionMatrix(Q8,Z.coordinateSystem,Z.reversedDepth),$8.intersectsBox(J))return!0}return!1}containsPoint(J,Q){if(!Q||!Q.cameras||Q.cameras.length===0)return!1;for(let $=0;$<Q.cameras.length;$++){let Z=Q.cameras[$];if(Q8.multiplyMatrices(Z.projectionMatrix,Z.matrixWorldInverse),$8.setFromProjectionMatrix(Q8,Z.coordinateSystem,Z.reversedDepth),$8.containsPoint(J))return!0}return!1}clone(){return new uQ}}function bY(J,Q){return J-Q}function DF(J,Q){return J.z-Q.z}function kF(J,Q){return Q.z-J.z}class U5{constructor(){this.index=0,this.pool=[],this.list=[]}push(J,Q,$,Z){let W=this.pool,Y=this.list;if(this.index>=W.length)W.push({start:-1,count:-1,z:-1,index:-1});let X=W[this.index];Y.push(X),this.index++,X.start=J,X.count=Q,X.z=$,X.index=Z}reset(){this.list.length=0,this.index=0}}var K9=new y0,MF=new e(1,1,1),FU=new H8,VF=new uQ,r$=new SJ,E6=new _J,EQ=new T,NU=new T,BF=new T,hY=new U5,tJ=new a0,t$=[];function CF(J,Q,$=0){let Z=Q.itemSize;if(J.isInterleavedBufferAttribute||J.array.constructor!==Q.array.constructor){let W=J.count;for(let Y=0;Y<W;Y++)for(let X=0;X<Z;X++)Q.setComponent(Y+$,X,J.getComponent(Y,X))}else Q.array.set(J.array,$*Z);Q.needsUpdate=!0}function F6(J,Q){if(J.constructor!==Q.constructor){let $=Math.min(J.length,Q.length);for(let Z=0;Z<$;Z++)Q[Z]=J[Z]}else{let $=Math.min(J.length,Q.length);Q.set(new J.constructor(J.buffer,0,$))}}class qW extends a0{constructor(J,Q,$=Q*2,Z){super(new u0,Z);this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=J,this._maxVertexCount=Q,this._maxIndexCount=$,this._multiDrawCounts=new Int32Array(J),this._multiDrawStarts=new Int32Array(J),this._multiDrawCount=0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let J=Math.sqrt(this._maxInstanceCount*4);J=Math.ceil(J/4)*4,J=Math.max(J,4);let Q=new Float32Array(J*J*4),$=new k9(Q,J,J,1023,1015);this._matricesTexture=$}_initIndirectTexture(){let J=Math.sqrt(this._maxInstanceCount);J=Math.ceil(J);let Q=new Uint32Array(J*J),$=new k9(Q,J,J,1029,1014);this._indirectTexture=$}_initColorsTexture(){let J=Math.sqrt(this._maxInstanceCount);J=Math.ceil(J);let Q=new Float32Array(J*J*4).fill(1),$=new k9(Q,J,J,1023,1015);$.colorSpace=t0.workingColorSpace,this._colorsTexture=$}_initializeGeometry(J){let Q=this.geometry,$=this._maxVertexCount,Z=this._maxIndexCount;if(this._geometryInitialized===!1){for(let W in J.attributes){let Y=J.getAttribute(W),{array:X,itemSize:K,normalized:H}=Y,U=new X.constructor($*K),G=new i0(U,K,H);Q.setAttribute(W,G)}if(J.getIndex()!==null){let W=$>65535?new Uint32Array(Z):new Uint16Array(Z);Q.setIndex(new i0(W,1))}this._geometryInitialized=!0}}_validateGeometry(J){let Q=this.geometry;if(Boolean(J.getIndex())!==Boolean(Q.getIndex()))throw Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(let $ in Q.attributes){if(!J.hasAttribute($))throw Error(`THREE.BatchedMesh: Added geometry missing "${$}". All geometries must have consistent attributes.`);let Z=J.getAttribute($),W=Q.getAttribute($);if(Z.itemSize!==W.itemSize||Z.normalized!==W.normalized)throw Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(J){let Q=this._instanceInfo;if(J<0||J>=Q.length||Q[J].active===!1)throw Error(`THREE.BatchedMesh: Invalid instanceId ${J}. Instance is either out of range or has been deleted.`)}validateGeometryId(J){let Q=this._geometryInfo;if(J<0||J>=Q.length||Q[J].active===!1)throw Error(`THREE.BatchedMesh: Invalid geometryId ${J}. Geometry is either out of range or has been deleted.`)}setCustomSort(J){return this.customSort=J,this}computeBoundingBox(){if(this.boundingBox===null)this.boundingBox=new SJ;let J=this.boundingBox,Q=this._instanceInfo;J.makeEmpty();for(let $=0,Z=Q.length;$<Z;$++){if(Q[$].active===!1)continue;let W=Q[$].geometryIndex;this.getMatrixAt($,K9),this.getBoundingBoxAt(W,r$).applyMatrix4(K9),J.union(r$)}}computeBoundingSphere(){if(this.boundingSphere===null)this.boundingSphere=new _J;let J=this.boundingSphere,Q=this._instanceInfo;J.makeEmpty();for(let $=0,Z=Q.length;$<Z;$++){if(Q[$].active===!1)continue;let W=Q[$].geometryIndex;this.getMatrixAt($,K9),this.getBoundingSphereAt(W,E6).applyMatrix4(K9),J.union(E6)}}addInstance(J){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw Error("THREE.BatchedMesh: Maximum item count reached.");let $={visible:!0,active:!0,geometryIndex:J},Z=null;if(this._availableInstanceIds.length>0)this._availableInstanceIds.sort(bY),Z=this._availableInstanceIds.shift(),this._instanceInfo[Z]=$;else Z=this._instanceInfo.length,this._instanceInfo.push($);let W=this._matricesTexture;K9.identity().toArray(W.image.data,Z*16),W.needsUpdate=!0;let Y=this._colorsTexture;if(Y)MF.toArray(Y.image.data,Z*4),Y.needsUpdate=!0;return this._visibilityChanged=!0,Z}addGeometry(J,Q=-1,$=-1){this._initializeGeometry(J),this._validateGeometry(J);let Z={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},W=this._geometryInfo;Z.vertexStart=this._nextVertexStart,Z.reservedVertexCount=Q===-1?J.getAttribute("position").count:Q;let Y=J.getIndex();if(Y!==null)Z.indexStart=this._nextIndexStart,Z.reservedIndexCount=$===-1?Y.count:$;if(Z.indexStart!==-1&&Z.indexStart+Z.reservedIndexCount>this._maxIndexCount||Z.vertexStart+Z.reservedVertexCount>this._maxVertexCount)throw Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let K;if(this._availableGeometryIds.length>0)this._availableGeometryIds.sort(bY),K=this._availableGeometryIds.shift(),W[K]=Z;else K=this._geometryCount,this._geometryCount++,W.push(Z);return this.setGeometryAt(K,J),this._nextIndexStart=Z.indexStart+Z.reservedIndexCount,this._nextVertexStart=Z.vertexStart+Z.reservedVertexCount,K}setGeometryAt(J,Q){if(J>=this._geometryCount)throw Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(Q);let $=this.geometry,Z=$.getIndex()!==null,W=$.getIndex(),Y=Q.getIndex(),X=this._geometryInfo[J];if(Z&&Y.count>X.reservedIndexCount||Q.attributes.position.count>X.reservedVertexCount)throw Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");let{vertexStart:K,reservedVertexCount:H}=X;X.vertexCount=Q.getAttribute("position").count;for(let U in $.attributes){let G=Q.getAttribute(U),F=$.getAttribute(U);CF(G,F,K);let E=G.itemSize;for(let O=G.count,R=H;O<R;O++){let k=K+O;for(let q=0;q<E;q++)F.setComponent(k,q,0)}F.needsUpdate=!0,F.addUpdateRange(K*E,H*E)}if(Z){let{indexStart:U,reservedIndexCount:G}=X;X.indexCount=Q.getIndex().count;for(let F=0;F<Y.count;F++)W.setX(U+F,K+Y.getX(F));for(let F=Y.count,E=G;F<E;F++)W.setX(U+F,K);W.needsUpdate=!0,W.addUpdateRange(U,X.reservedIndexCount)}if(X.start=Z?X.indexStart:X.vertexStart,X.count=Z?X.indexCount:X.vertexCount,X.boundingBox=null,Q.boundingBox!==null)X.boundingBox=Q.boundingBox.clone();if(X.boundingSphere=null,Q.boundingSphere!==null)X.boundingSphere=Q.boundingSphere.clone();return this._visibilityChanged=!0,J}deleteGeometry(J){let Q=this._geometryInfo;if(J>=Q.length||Q[J].active===!1)return this;let $=this._instanceInfo;for(let Z=0,W=$.length;Z<W;Z++)if($[Z].active&&$[Z].geometryIndex===J)this.deleteInstance(Z);return Q[J].active=!1,this._availableGeometryIds.push(J),this._visibilityChanged=!0,this}deleteInstance(J){return this.validateInstanceId(J),this._instanceInfo[J].active=!1,this._availableInstanceIds.push(J),this._visibilityChanged=!0,this}optimize(){let J=0,Q=0,$=this._geometryInfo,Z=$.map((Y,X)=>X).sort((Y,X)=>{return $[Y].vertexStart-$[X].vertexStart}),W=this.geometry;for(let Y=0,X=$.length;Y<X;Y++){let K=Z[Y],H=$[K];if(H.active===!1)continue;if(W.index!==null){if(H.indexStart!==Q){let{indexStart:U,vertexStart:G,reservedIndexCount:F}=H,E=W.index,O=E.array,R=J-G;for(let k=U;k<U+F;k++)O[k]=O[k]+R;E.array.copyWithin(Q,U,U+F),E.addUpdateRange(Q,F),E.needsUpdate=!0,H.indexStart=Q}Q+=H.reservedIndexCount}if(H.vertexStart!==J){let{vertexStart:U,reservedVertexCount:G}=H,F=W.attributes;for(let E in F){let O=F[E],{array:R,itemSize:k}=O;R.copyWithin(J*k,U*k,(U+G)*k),O.addUpdateRange(J*k,G*k),O.needsUpdate=!0}H.vertexStart=J}J+=H.reservedVertexCount,H.start=W.index?H.indexStart:H.vertexStart}return this._nextIndexStart=Q,this._nextVertexStart=J,this._visibilityChanged=!0,this}getBoundingBoxAt(J,Q){if(J>=this._geometryCount)return null;let $=this.geometry,Z=this._geometryInfo[J];if(Z.boundingBox===null){let W=new SJ,Y=$.index,X=$.attributes.position;for(let K=Z.start,H=Z.start+Z.count;K<H;K++){let U=K;if(Y)U=Y.getX(U);W.expandByPoint(EQ.fromBufferAttribute(X,U))}Z.boundingBox=W}return Q.copy(Z.boundingBox),Q}getBoundingSphereAt(J,Q){if(J>=this._geometryCount)return null;let $=this.geometry,Z=this._geometryInfo[J];if(Z.boundingSphere===null){let W=new _J;this.getBoundingBoxAt(J,r$),r$.getCenter(W.center);let Y=$.index,X=$.attributes.position,K=0;for(let H=Z.start,U=Z.start+Z.count;H<U;H++){let G=H;if(Y)G=Y.getX(G);EQ.fromBufferAttribute(X,G),K=Math.max(K,W.center.distanceToSquared(EQ))}W.radius=Math.sqrt(K),Z.boundingSphere=W}return Q.copy(Z.boundingSphere),Q}setMatrixAt(J,Q){this.validateInstanceId(J);let $=this._matricesTexture,Z=this._matricesTexture.image.data;return Q.toArray(Z,J*16),$.needsUpdate=!0,this}getMatrixAt(J,Q){return this.validateInstanceId(J),Q.fromArray(this._matricesTexture.image.data,J*16)}setColorAt(J,Q){if(this.validateInstanceId(J),this._colorsTexture===null)this._initColorsTexture();return Q.toArray(this._colorsTexture.image.data,J*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(J,Q){if(this.validateInstanceId(J),this._colorsTexture===null)if(Q.isVector4)return Q.set(1,1,1,1);else return Q.setRGB(1,1,1);else return Q.fromArray(this._colorsTexture.image.data,J*4)}setVisibleAt(J,Q){if(this.validateInstanceId(J),this._instanceInfo[J].visible===Q)return this;return this._instanceInfo[J].visible=Q,this._visibilityChanged=!0,this}getVisibleAt(J){return this.validateInstanceId(J),this._instanceInfo[J].visible}setGeometryIdAt(J,Q){return this.validateInstanceId(J),this.validateGeometryId(Q),this._instanceInfo[J].geometryIndex=Q,this}getGeometryIdAt(J){return this.validateInstanceId(J),this._instanceInfo[J].geometryIndex}getGeometryRangeAt(J,Q={}){this.validateGeometryId(J);let $=this._geometryInfo[J];return Q.vertexStart=$.vertexStart,Q.vertexCount=$.vertexCount,Q.reservedVertexCount=$.reservedVertexCount,Q.indexStart=$.indexStart,Q.indexCount=$.indexCount,Q.reservedIndexCount=$.reservedIndexCount,Q.start=$.start,Q.count=$.count,Q}setInstanceCount(J){let Q=this._availableInstanceIds,$=this._instanceInfo;Q.sort(bY);while(Q[Q.length-1]===$.length-1)$.pop(),Q.pop();if(J<$.length)throw Error(`BatchedMesh: Instance ids outside the range ${J} are being used. Cannot shrink instance count.`);let Z=new Int32Array(J),W=new Int32Array(J);F6(this._multiDrawCounts,Z),F6(this._multiDrawStarts,W),this._multiDrawCounts=Z,this._multiDrawStarts=W,this._maxInstanceCount=J;let Y=this._indirectTexture,X=this._matricesTexture,K=this._colorsTexture;if(Y.dispose(),this._initIndirectTexture(),F6(Y.image.data,this._indirectTexture.image.data),X.dispose(),this._initMatricesTexture(),F6(X.image.data,this._matricesTexture.image.data),K)K.dispose(),this._initColorsTexture(),F6(K.image.data,this._colorsTexture.image.data)}setGeometrySize(J,Q){let $=[...this._geometryInfo].filter((X)=>X.active);if(Math.max(...$.map((X)=>X.vertexStart+X.reservedVertexCount))>J)throw Error(`BatchedMesh: Geometry vertex values are being used outside the range ${Q}. Cannot shrink further.`);if(this.geometry.index){if(Math.max(...$.map((K)=>K.indexStart+K.reservedIndexCount))>Q)throw Error(`BatchedMesh: Geometry index values are being used outside the range ${Q}. Cannot shrink further.`)}let W=this.geometry;if(W.dispose(),this._maxVertexCount=J,this._maxIndexCount=Q,this._geometryInitialized)this._geometryInitialized=!1,this.geometry=new u0,this._initializeGeometry(W);let Y=this.geometry;if(W.index)F6(W.index.array,Y.index.array);for(let X in W.attributes)F6(W.attributes[X].array,Y.attributes[X].array)}raycast(J,Q){let $=this._instanceInfo,Z=this._geometryInfo,W=this.matrixWorld,Y=this.geometry;if(tJ.material=this.material,tJ.geometry.index=Y.index,tJ.geometry.attributes=Y.attributes,tJ.geometry.boundingBox===null)tJ.geometry.boundingBox=new SJ;if(tJ.geometry.boundingSphere===null)tJ.geometry.boundingSphere=new _J;for(let X=0,K=$.length;X<K;X++){if(!$[X].visible||!$[X].active)continue;let H=$[X].geometryIndex,U=Z[H];tJ.geometry.setDrawRange(U.start,U.count),this.getMatrixAt(X,tJ.matrixWorld).premultiply(W),this.getBoundingBoxAt(H,tJ.geometry.boundingBox),this.getBoundingSphereAt(H,tJ.geometry.boundingSphere),tJ.raycast(J,t$);for(let G=0,F=t$.length;G<F;G++){let E=t$[G];E.object=this,E.batchId=X,Q.push(E)}t$.length=0}tJ.material=null,tJ.geometry.index=null,tJ.geometry.attributes={},tJ.geometry.setDrawRange(0,1/0)}copy(J){if(super.copy(J),this.geometry=J.geometry.clone(),this.perObjectFrustumCulled=J.perObjectFrustumCulled,this.sortObjects=J.sortObjects,this.boundingBox=J.boundingBox!==null?J.boundingBox.clone():null,this.boundingSphere=J.boundingSphere!==null?J.boundingSphere.clone():null,this._geometryInfo=J._geometryInfo.map((Q)=>({...Q,boundingBox:Q.boundingBox!==null?Q.boundingBox.clone():null,boundingSphere:Q.boundingSphere!==null?Q.boundingSphere.clone():null})),this._instanceInfo=J._instanceInfo.map((Q)=>({...Q})),this._availableInstanceIds=J._availableInstanceIds.slice(),this._availableGeometryIds=J._availableGeometryIds.slice(),this._nextIndexStart=J._nextIndexStart,this._nextVertexStart=J._nextVertexStart,this._geometryCount=J._geometryCount,this._maxInstanceCount=J._maxInstanceCount,this._maxVertexCount=J._maxVertexCount,this._maxIndexCount=J._maxIndexCount,this._geometryInitialized=J._geometryInitialized,this._multiDrawCounts=J._multiDrawCounts.slice(),this._multiDrawStarts=J._multiDrawStarts.slice(),this._indirectTexture=J._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=J._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null)this._colorsTexture=J._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice();return this}dispose(){if(this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null)this._colorsTexture.dispose(),this._colorsTexture=null}onBeforeRender(J,Q,$,Z,W){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;let Y=Z.getIndex(),X=Y===null?1:Y.array.BYTES_PER_ELEMENT,K=1;if(W.wireframe)K=2,X=Z.attributes.position.count>65535?4:2;let H=this._instanceInfo,U=this._multiDrawStarts,G=this._multiDrawCounts,F=this._geometryInfo,E=this.perObjectFrustumCulled,O=this._indirectTexture,R=O.image.data,k=$.isArrayCamera?VF:FU;if(E&&!$.isArrayCamera)K9.multiplyMatrices($.projectionMatrix,$.matrixWorldInverse).multiply(this.matrixWorld),FU.setFromProjectionMatrix(K9,$.coordinateSystem,$.reversedDepth);let q=0;if(this.sortObjects){K9.copy(this.matrixWorld).invert(),EQ.setFromMatrixPosition($.matrixWorld).applyMatrix4(K9),NU.set(0,0,-1).transformDirection($.matrixWorld).transformDirection(K9);for(let D=0,V=H.length;D<V;D++)if(H[D].visible&&H[D].active){let I=H[D].geometryIndex;this.getMatrixAt(D,K9),this.getBoundingSphereAt(I,E6).applyMatrix4(K9);let z=!1;if(E)z=!k.intersectsSphere(E6,$);if(!z){let B=F[I],M=BF.subVectors(E6.center,EQ).dot(NU);hY.push(B.start,B.count,M,D)}}let N=hY.list,L=this.customSort;if(L===null)N.sort(W.transparent?kF:DF);else L.call(this,N,$);for(let D=0,V=N.length;D<V;D++){let I=N[D];U[q]=I.start*X*K,G[q]=I.count*K,R[q]=I.index,q++}hY.reset()}else for(let N=0,L=H.length;N<L;N++)if(H[N].visible&&H[N].active){let D=H[N].geometryIndex,V=!1;if(E)this.getMatrixAt(N,K9),this.getBoundingSphereAt(D,E6).applyMatrix4(K9),V=!k.intersectsSphere(E6,$);if(!V){let I=F[D];U[q]=I.start*X*K,G[q]=I.count*K,R[q]=N,q++}}O.needsUpdate=!0,this._multiDrawCount=q,this._visibilityChanged=!1}onBeforeShadow(J,Q,$,Z,W,Y){this.onBeforeRender(J,null,Z,W,Y)}}class uJ extends vJ{constructor(J){super();this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new e(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.linewidth=J.linewidth,this.linecap=J.linecap,this.linejoin=J.linejoin,this.fog=J.fog,this}}var LZ=new T,DZ=new T,OU=new y0,FQ=new J6,e$=new _J,fY=new T,qU=new T;class T9 extends HJ{constructor(J=new u0,Q=new uJ){super();this.isLine=!0,this.type="Line",this.geometry=J,this.material=Q,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(J,Q){return super.copy(J,Q),this.material=Array.isArray(J.material)?J.material.slice():J.material,this.geometry=J.geometry,this}computeLineDistances(){let J=this.geometry;if(J.index===null){let Q=J.attributes.position,$=[0];for(let Z=1,W=Q.count;Z<W;Z++)LZ.fromBufferAttribute(Q,Z-1),DZ.fromBufferAttribute(Q,Z),$[Z]=$[Z-1],$[Z]+=LZ.distanceTo(DZ);J.setAttribute("lineDistance",new I0($,1))}else O0("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(J,Q){let $=this.geometry,Z=this.matrixWorld,W=J.params.Line.threshold,Y=$.drawRange;if($.boundingSphere===null)$.computeBoundingSphere();if(e$.copy($.boundingSphere),e$.applyMatrix4(Z),e$.radius+=W,J.ray.intersectsSphere(e$)===!1)return;OU.copy(Z).invert(),FQ.copy(J.ray).applyMatrix4(OU);let X=W/((this.scale.x+this.scale.y+this.scale.z)/3),K=X*X,H=this.isLineSegments?2:1,U=$.index,F=$.attributes.position;if(U!==null){let E=Math.max(0,Y.start),O=Math.min(U.count,Y.start+Y.count);for(let R=E,k=O-1;R<k;R+=H){let q=U.getX(R),N=U.getX(R+1),L=JZ(this,J,FQ,K,q,N,R);if(L)Q.push(L)}if(this.isLineLoop){let R=U.getX(O-1),k=U.getX(E),q=JZ(this,J,FQ,K,R,k,O-1);if(q)Q.push(q)}}else{let E=Math.max(0,Y.start),O=Math.min(F.count,Y.start+Y.count);for(let R=E,k=O-1;R<k;R+=H){let q=JZ(this,J,FQ,K,R,R+1,R);if(q)Q.push(q)}if(this.isLineLoop){let R=JZ(this,J,FQ,K,O-1,E,O-1);if(R)Q.push(R)}}}updateMorphTargets(){let Q=this.geometry.morphAttributes,$=Object.keys(Q);if($.length>0){let Z=Q[$[0]];if(Z!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let W=0,Y=Z.length;W<Y;W++){let X=Z[W].name||String(W);this.morphTargetInfluences.push(0),this.morphTargetDictionary[X]=W}}}}}function JZ(J,Q,$,Z,W,Y,X){let K=J.geometry.attributes.position;if(LZ.fromBufferAttribute(K,W),DZ.fromBufferAttribute(K,Y),$.distanceSqToSegment(LZ,DZ,fY,qU)>Z)return;fY.applyMatrix4(J.matrixWorld);let U=Q.ray.origin.distanceTo(fY);if(U<Q.near||U>Q.far)return;return{distance:U,point:qU.clone().applyMatrix4(J.matrixWorld),index:X,face:null,faceIndex:null,barycoord:null,object:J}}var RU=new T,LU=new T;class N9 extends T9{constructor(J,Q){super(J,Q);this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let J=this.geometry;if(J.index===null){let Q=J.attributes.position,$=[];for(let Z=0,W=Q.count;Z<W;Z+=2)RU.fromBufferAttribute(Q,Z),LU.fromBufferAttribute(Q,Z+1),$[Z]=Z===0?0:$[Z-1],$[Z+1]=$[Z]+RU.distanceTo(LU);J.setAttribute("lineDistance",new I0($,1))}else O0("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class f7 extends T9{constructor(J,Q){super(J,Q);this.isLineLoop=!0,this.type="LineLoop"}}class x6 extends vJ{constructor(J){super();this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new e(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.alphaMap=J.alphaMap,this.size=J.size,this.sizeAttenuation=J.sizeAttenuation,this.fog=J.fog,this}}var DU=new y0,aY=new J6,QZ=new _J,$Z=new T;class o9 extends HJ{constructor(J=new u0,Q=new x6){super();this.isPoints=!0,this.type="Points",this.geometry=J,this.material=Q,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(J,Q){return super.copy(J,Q),this.material=Array.isArray(J.material)?J.material.slice():J.material,this.geometry=J.geometry,this}raycast(J,Q){let $=this.geometry,Z=this.matrixWorld,W=J.params.Points.threshold,Y=$.drawRange;if($.boundingSphere===null)$.computeBoundingSphere();if(QZ.copy($.boundingSphere),QZ.applyMatrix4(Z),QZ.radius+=W,J.ray.intersectsSphere(QZ)===!1)return;DU.copy(Z).invert(),aY.copy(J.ray).applyMatrix4(DU);let X=W/((this.scale.x+this.scale.y+this.scale.z)/3),K=X*X,H=$.index,G=$.attributes.position;if(H!==null){let F=Math.max(0,Y.start),E=Math.min(H.count,Y.start+Y.count);for(let O=F,R=E;O<R;O++){let k=H.getX(O);$Z.fromBufferAttribute(G,k),kU($Z,k,K,Z,J,Q,this)}}else{let F=Math.max(0,Y.start),E=Math.min(G.count,Y.start+Y.count);for(let O=F,R=E;O<R;O++)$Z.fromBufferAttribute(G,O),kU($Z,O,K,Z,J,Q,this)}}updateMorphTargets(){let Q=this.geometry.morphAttributes,$=Object.keys(Q);if($.length>0){let Z=Q[$[0]];if(Z!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let W=0,Y=Z.length;W<Y;W++){let X=Z[W].name||String(W);this.morphTargetInfluences.push(0),this.morphTargetDictionary[X]=W}}}}}function kU(J,Q,$,Z,W,Y,X){let K=aY.distanceSqToPoint(J);if(K<$){let H=new T;aY.closestPointToPoint(J,H),H.applyMatrix4(Z);let U=W.ray.origin.distanceTo(H);if(U<W.near||U>W.far)return;Y.push({distance:U,distanceToRay:Math.sqrt(K),point:H,index:Q,face:null,faceIndex:null,barycoord:null,object:X})}}class RW extends MJ{constructor(J,Q,$,Z,W=1006,Y=1006,X,K,H){super(J,Q,$,Z,W,Y,X,K,H);this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;let U=this;function G(){U.needsUpdate=!0,U._requestVideoFrameCallbackId=J.requestVideoFrameCallback(G)}if("requestVideoFrameCallback"in J)this._requestVideoFrameCallbackId=J.requestVideoFrameCallback(G)}clone(){return new this.constructor(this.image).copy(this)}update(){let J=this.image;if("requestVideoFrameCallback"in J===!1&&J.readyState>=J.HAVE_CURRENT_DATA)this.needsUpdate=!0}dispose(){if(this._requestVideoFrameCallbackId!==0)this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0;super.dispose()}}class YK extends RW{constructor(J,Q,$,Z,W,Y,X,K){super({},J,Q,$,Z,W,Y,X,K);this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(J){this.image=J,this.needsUpdate=!0}}class XK extends MJ{constructor(J,Q){super({width:J,height:Q});this.isFramebufferTexture=!0,this.magFilter=1003,this.minFilter=1003,this.generateMipmaps=!1,this.needsUpdate=!0}}class g7 extends MJ{constructor(J,Q,$,Z,W,Y,X,K,H,U,G,F){super(null,Y,X,K,H,U,Z,W,G,F);this.isCompressedTexture=!0,this.image={width:Q,height:$},this.mipmaps=J,this.flipY=!1,this.generateMipmaps=!1}}class KK extends g7{constructor(J,Q,$,Z,W,Y){super(J,Q,$,W,Y);this.isCompressedArrayTexture=!0,this.image.depth=Z,this.wrapR=1001,this.layerUpdates=new Set}addLayerUpdate(J){this.layerUpdates.add(J)}clearLayerUpdates(){this.layerUpdates.clear()}}class HK extends g7{constructor(J,Q,$){super(void 0,J[0].width,J[0].height,Q,$,301);this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=J}}class b6 extends MJ{constructor(J=[],Q=301,$,Z,W,Y,X,K,H,U){super(J,Q,$,Z,W,Y,X,K,H,U);this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(J){this.image=J}}class UK extends MJ{constructor(J,Q,$,Z,W,Y,X,K,H){super(J,Q,$,Z,W,Y,X,K,H);this.isCanvasTexture=!0,this.needsUpdate=!0}}class GK extends MJ{constructor(J,Q,$,Z,W,Y,X,K,H){super(J,Q,$,Z,W,Y,X,K,H);this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;let U=J?J.parentNode:null;if(U!==null&&"requestPaint"in U)U.onpaint=()=>{this.needsUpdate=!0},U.requestPaint()}dispose(){let J=this.image?this.image.parentNode:null;if(J!==null&&"onpaint"in J)J.onpaint=null;super.dispose()}}class P8 extends MJ{constructor(J,Q,$=1014,Z,W,Y,X=1003,K=1003,H,U=1026,G=1){if(U!==1026&&U!==1027)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");let F={width:J,height:Q,depth:G};super(F,Z,W,Y,X,K,U,$,H);this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(J){return super.copy(J),this.source=new W8(Object.assign({},J.image)),this.compareFunction=J.compareFunction,this}toJSON(J){let Q=super.toJSON(J);if(this.compareFunction!==null)Q.compareFunction=this.compareFunction;return Q}}class LW extends P8{constructor(J,Q=1014,$=301,Z,W,Y=1003,X=1003,K,H=1026){let U={width:J,height:J,depth:1},G=[U,U,U,U,U,U];super(J,J,Q,$,Z,W,Y,X,K,H);this.image=G,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(J){this.image=J}}class dQ extends MJ{constructor(J=null){super();this.sourceTexture=J,this.isExternalTexture=!0}copy(J){return super.copy(J),this.sourceTexture=J.sourceTexture,this}}class J9 extends u0{constructor(J=1,Q=1,$=1,Z=1,W=1,Y=1){super();this.type="BoxGeometry",this.parameters={width:J,height:Q,depth:$,widthSegments:Z,heightSegments:W,depthSegments:Y};let X=this;Z=Math.floor(Z),W=Math.floor(W),Y=Math.floor(Y);let K=[],H=[],U=[],G=[],F=0,E=0;O("z","y","x",-1,-1,$,Q,J,Y,W,0),O("z","y","x",1,-1,$,Q,-J,Y,W,1),O("x","z","y",1,1,J,$,Q,Z,Y,2),O("x","z","y",1,-1,J,$,-Q,Z,Y,3),O("x","y","z",1,-1,J,Q,$,Z,W,4),O("x","y","z",-1,-1,J,Q,-$,Z,W,5),this.setIndex(K),this.setAttribute("position",new I0(H,3)),this.setAttribute("normal",new I0(U,3)),this.setAttribute("uv",new I0(G,2));function O(R,k,q,N,L,D,V,I,z,B,M){let C=D/z,j=V/B,w=D/2,v=V/2,b=I/2,S=z+1,h=B+1,x=0,p=0,c=new T;for(let o=0;o<h;o++){let W0=o*j-v;for(let H0=0;H0<S;H0++){let J0=H0*C-w;c[R]=J0*N,c[k]=W0*L,c[q]=b,H.push(c.x,c.y,c.z),c[R]=0,c[k]=0,c[q]=I>0?1:-1,U.push(c.x,c.y,c.z),G.push(H0/z),G.push(1-o/B),x+=1}}for(let o=0;o<B;o++)for(let W0=0;W0<z;W0++){let H0=F+W0+S*o,J0=F+W0+S*(o+1),c0=F+(W0+1)+S*(o+1),d0=F+(W0+1)+S*o;K.push(H0,J0,d0),K.push(J0,c0,d0),p+=6}X.addGroup(E,p,M),E+=p,F+=x}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new J9(J.width,J.height,J.depth,J.widthSegments,J.heightSegments,J.depthSegments)}}class mQ extends u0{constructor(J=1,Q=1,$=4,Z=8,W=1){super();this.type="CapsuleGeometry",this.parameters={radius:J,height:Q,capSegments:$,radialSegments:Z,heightSegments:W},Q=Math.max(0,Q),$=Math.max(1,Math.floor($)),Z=Math.max(3,Math.floor(Z)),W=Math.max(1,Math.floor(W));let Y=[],X=[],K=[],H=[],U=Q/2,G=Math.PI/2*J,F=Q,E=2*G+F,O=$*2+W,R=Z+1,k=new T,q=new T;for(let N=0;N<=O;N++){let L=0,D=0,V=0,I=0;if(N<=$){let M=N/$,C=M*Math.PI/2;D=-U-J*Math.cos(C),V=J*Math.sin(C),I=-J*Math.cos(C),L=M*G}else if(N<=$+W){let M=(N-$)/W;D=-U+M*Q,V=J,I=0,L=G+M*F}else{let M=(N-$-W)/$,C=M*Math.PI/2;D=U+J*Math.sin(C),V=J*Math.cos(C),I=J*Math.sin(C),L=G+F+M*G}let z=Math.max(0,Math.min(1,L/E)),B=0;if(N===0)B=0.5/Z;else if(N===O)B=-0.5/Z;for(let M=0;M<=Z;M++){let C=M/Z,j=C*Math.PI*2,w=Math.sin(j),v=Math.cos(j);q.x=-V*v,q.y=D,q.z=V*w,X.push(q.x,q.y,q.z),k.set(-V*v,I,V*w),k.normalize(),K.push(k.x,k.y,k.z),H.push(C+B,z)}if(N>0){let M=(N-1)*R;for(let C=0;C<Z;C++){let j=M+C,w=M+C+1,v=N*R+C,b=N*R+C+1;Y.push(j,w,v),Y.push(w,b,v)}}}this.setIndex(Y),this.setAttribute("position",new I0(X,3)),this.setAttribute("normal",new I0(K,3)),this.setAttribute("uv",new I0(H,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new mQ(J.radius,J.height,J.capSegments,J.radialSegments,J.heightSegments)}}class lQ extends u0{constructor(J=1,Q=32,$=0,Z=Math.PI*2){super();this.type="CircleGeometry",this.parameters={radius:J,segments:Q,thetaStart:$,thetaLength:Z},Q=Math.max(3,Q);let W=[],Y=[],X=[],K=[],H=new T,U=new i;Y.push(0,0,0),X.push(0,0,1),K.push(0.5,0.5);for(let G=0,F=3;G<=Q;G++,F+=3){let E=$+G/Q*Z;H.x=J*Math.cos(E),H.y=J*Math.sin(E),Y.push(H.x,H.y,H.z),X.push(0,0,1),U.x=(Y[F]/J+1)/2,U.y=(Y[F+1]/J+1)/2,K.push(U.x,U.y)}for(let G=1;G<=Q;G++)W.push(G,G+1,0);this.setIndex(W),this.setAttribute("position",new I0(Y,3)),this.setAttribute("normal",new I0(X,3)),this.setAttribute("uv",new I0(K,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new lQ(J.radius,J.segments,J.thetaStart,J.thetaLength)}}class Q6 extends u0{constructor(J=1,Q=1,$=1,Z=32,W=1,Y=!1,X=0,K=Math.PI*2){super();this.type="CylinderGeometry",this.parameters={radiusTop:J,radiusBottom:Q,height:$,radialSegments:Z,heightSegments:W,openEnded:Y,thetaStart:X,thetaLength:K};let H=this;Z=Math.floor(Z),W=Math.floor(W);let U=[],G=[],F=[],E=[],O=0,R=[],k=$/2,q=0;if(N(),Y===!1){if(J>0)L(!0);if(Q>0)L(!1)}this.setIndex(U),this.setAttribute("position",new I0(G,3)),this.setAttribute("normal",new I0(F,3)),this.setAttribute("uv",new I0(E,2));function N(){let D=new T,V=new T,I=0,z=(Q-J)/$;for(let B=0;B<=W;B++){let M=[],C=B/W,j=C*(Q-J)+J;for(let w=0;w<=Z;w++){let v=w/Z,b=v*K+X,S=Math.sin(b),h=Math.cos(b);V.x=j*S,V.y=-C*$+k,V.z=j*h,G.push(V.x,V.y,V.z),D.set(S,z,h).normalize(),F.push(D.x,D.y,D.z),E.push(v,1-C),M.push(O++)}R.push(M)}for(let B=0;B<Z;B++)for(let M=0;M<W;M++){let C=R[M][B],j=R[M+1][B],w=R[M+1][B+1],v=R[M][B+1];if(J>0||M!==0)U.push(C,j,v),I+=3;if(Q>0||M!==W-1)U.push(j,w,v),I+=3}H.addGroup(q,I,0),q+=I}function L(D){let V=O,I=new i,z=new T,B=0,M=D===!0?J:Q,C=D===!0?1:-1;for(let w=1;w<=Z;w++)G.push(0,k*C,0),F.push(0,C,0),E.push(0.5,0.5),O++;let j=O;for(let w=0;w<=Z;w++){let b=w/Z*K+X,S=Math.cos(b),h=Math.sin(b);z.x=M*h,z.y=k*C,z.z=M*S,G.push(z.x,z.y,z.z),F.push(0,C,0),I.x=S*0.5+0.5,I.y=h*0.5*C+0.5,E.push(I.x,I.y),O++}for(let w=0;w<Z;w++){let v=V+w,b=j+w;if(D===!0)U.push(b,b+1,v);else U.push(b+1,b,v);B+=3}H.addGroup(q,B,D===!0?1:2),q+=B}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new Q6(J.radiusTop,J.radiusBottom,J.height,J.radialSegments,J.heightSegments,J.openEnded,J.thetaStart,J.thetaLength)}}class p7 extends Q6{constructor(J=1,Q=1,$=32,Z=1,W=!1,Y=0,X=Math.PI*2){super(0,J,Q,$,Z,W,Y,X);this.type="ConeGeometry",this.parameters={radius:J,height:Q,radialSegments:$,heightSegments:Z,openEnded:W,thetaStart:Y,thetaLength:X}}static fromJSON(J){return new p7(J.radius,J.height,J.radialSegments,J.heightSegments,J.openEnded,J.thetaStart,J.thetaLength)}}class T8 extends u0{constructor(J=[],Q=[],$=1,Z=0){super();this.type="PolyhedronGeometry",this.parameters={vertices:J,indices:Q,radius:$,detail:Z};let W=[],Y=[];if(X(Z),H($),U(),this.setAttribute("position",new I0(W,3)),this.setAttribute("normal",new I0(W.slice(),3)),this.setAttribute("uv",new I0(Y,2)),Z===0)this.computeVertexNormals();else this.normalizeNormals();function X(N){let L=new T,D=new T,V=new T;for(let I=0;I<Q.length;I+=3)E(Q[I+0],L),E(Q[I+1],D),E(Q[I+2],V),K(L,D,V,N)}function K(N,L,D,V){let I=V+1,z=[];for(let B=0;B<=I;B++){z[B]=[];let M=N.clone().lerp(D,B/I),C=L.clone().lerp(D,B/I),j=I-B;for(let w=0;w<=j;w++)if(w===0&&B===I)z[B][w]=M;else z[B][w]=M.clone().lerp(C,w/j)}for(let B=0;B<I;B++)for(let M=0;M<2*(I-B)-1;M++){let C=Math.floor(M/2);if(M%2===0)F(z[B][C+1]),F(z[B+1][C]),F(z[B][C]);else F(z[B][C+1]),F(z[B+1][C+1]),F(z[B+1][C])}}function H(N){let L=new T;for(let D=0;D<W.length;D+=3)L.x=W[D+0],L.y=W[D+1],L.z=W[D+2],L.normalize().multiplyScalar(N),W[D+0]=L.x,W[D+1]=L.y,W[D+2]=L.z}function U(){let N=new T;for(let L=0;L<W.length;L+=3){N.x=W[L+0],N.y=W[L+1],N.z=W[L+2];let D=k(N)/2/Math.PI+0.5,V=q(N)/Math.PI+0.5;Y.push(D,1-V)}O(),G()}function G(){for(let N=0;N<Y.length;N+=6){let L=Y[N+0],D=Y[N+2],V=Y[N+4],I=Math.max(L,D,V),z=Math.min(L,D,V);if(I>0.9&&z<0.1){if(L<0.2)Y[N+0]+=1;if(D<0.2)Y[N+2]+=1;if(V<0.2)Y[N+4]+=1}}}function F(N){W.push(N.x,N.y,N.z)}function E(N,L){let D=N*3;L.x=J[D+0],L.y=J[D+1],L.z=J[D+2]}function O(){let N=new T,L=new T,D=new T,V=new T,I=new i,z=new i,B=new i;for(let M=0,C=0;M<W.length;M+=9,C+=6){N.set(W[M+0],W[M+1],W[M+2]),L.set(W[M+3],W[M+4],W[M+5]),D.set(W[M+6],W[M+7],W[M+8]),I.set(Y[C+0],Y[C+1]),z.set(Y[C+2],Y[C+3]),B.set(Y[C+4],Y[C+5]),V.copy(N).add(L).add(D).divideScalar(3);let j=k(V);R(I,C+0,N,j),R(z,C+2,L,j),R(B,C+4,D,j)}}function R(N,L,D,V){if(V<0&&N.x===1)Y[L]=N.x-1;if(D.x===0&&D.z===0)Y[L]=V/2/Math.PI+0.5}function k(N){return Math.atan2(N.z,-N.x)}function q(N){return Math.atan2(-N.y,Math.sqrt(N.x*N.x+N.z*N.z))}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new T8(J.vertices,J.indices,J.radius,J.detail)}}class cQ extends T8{constructor(J=1,Q=0){let $=(1+Math.sqrt(5))/2,Z=1/$,W=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-Z,-$,0,-Z,$,0,Z,-$,0,Z,$,-Z,-$,0,-Z,$,0,Z,-$,0,Z,$,0,-$,0,-Z,$,0,-Z,-$,0,Z,$,0,Z],Y=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(W,Y,J,Q);this.type="DodecahedronGeometry",this.parameters={radius:J,detail:Q}}static fromJSON(J){return new cQ(J.radius,J.detail)}}var ZZ=new T,WZ=new T,gY=new T,YZ=new W9;class DW extends u0{constructor(J=null,Q=1){super();if(this.type="EdgesGeometry",this.parameters={geometry:J,thresholdAngle:Q},J!==null){let Z=Math.pow(10,4),W=Math.cos(M6*Q),Y=J.getIndex(),X=J.getAttribute("position"),K=Y?Y.count:X.count,H=[0,0,0],U=["a","b","c"],G=[,,,],F={},E=[];for(let O=0;O<K;O+=3){if(Y)H[0]=Y.getX(O),H[1]=Y.getX(O+1),H[2]=Y.getX(O+2);else H[0]=O,H[1]=O+1,H[2]=O+2;let{a:R,b:k,c:q}=YZ;if(R.fromBufferAttribute(X,H[0]),k.fromBufferAttribute(X,H[1]),q.fromBufferAttribute(X,H[2]),YZ.getNormal(gY),G[0]=`${Math.round(R.x*Z)},${Math.round(R.y*Z)},${Math.round(R.z*Z)}`,G[1]=`${Math.round(k.x*Z)},${Math.round(k.y*Z)},${Math.round(k.z*Z)}`,G[2]=`${Math.round(q.x*Z)},${Math.round(q.y*Z)},${Math.round(q.z*Z)}`,G[0]===G[1]||G[1]===G[2]||G[2]===G[0])continue;for(let N=0;N<3;N++){let L=(N+1)%3,D=G[N],V=G[L],I=YZ[U[N]],z=YZ[U[L]],B=`${D}_${V}`,M=`${V}_${D}`;if(M in F&&F[M]){if(gY.dot(F[M].normal)<=W)E.push(I.x,I.y,I.z),E.push(z.x,z.y,z.z);F[M]=null}else if(!(B in F))F[B]={index0:H[N],index1:H[L],normal:gY.clone()}}}for(let O in F)if(F[O]){let{index0:R,index1:k}=F[O];ZZ.fromBufferAttribute(X,R),WZ.fromBufferAttribute(X,k),E.push(ZZ.x,ZZ.y,ZZ.z),E.push(WZ.x,WZ.y,WZ.z)}this.setAttribute("position",new I0(E,3))}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}}class B9{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){O0("Curve: .getPoint() not implemented.")}getPointAt(J,Q){let $=this.getUtoTmapping(J);return this.getPoint($,Q)}getPoints(J=5){let Q=[];for(let $=0;$<=J;$++)Q.push(this.getPoint($/J));return Q}getSpacedPoints(J=5){let Q=[];for(let $=0;$<=J;$++)Q.push(this.getPointAt($/J));return Q}getLength(){let J=this.getLengths();return J[J.length-1]}getLengths(J=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===J+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let Q=[],$,Z=this.getPoint(0),W=0;Q.push(0);for(let Y=1;Y<=J;Y++)$=this.getPoint(Y/J),W+=$.distanceTo(Z),Q.push(W),Z=$;return this.cacheArcLengths=Q,Q}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(J,Q=null){let $=this.getLengths(),Z=0,W=$.length,Y;if(Q)Y=Q;else Y=J*$[W-1];let X=0,K=W-1,H;while(X<=K)if(Z=Math.floor(X+(K-X)/2),H=$[Z]-Y,H<0)X=Z+1;else if(H>0)K=Z-1;else{K=Z;break}if(Z=K,$[Z]===Y)return Z/(W-1);let U=$[Z],F=$[Z+1]-U,E=(Y-U)/F;return(Z+E)/(W-1)}getTangent(J,Q){let Z=J-0.0001,W=J+0.0001;if(Z<0)Z=0;if(W>1)W=1;let Y=this.getPoint(Z),X=this.getPoint(W),K=Q||(Y.isVector2?new i:new T);return K.copy(X).sub(Y).normalize(),K}getTangentAt(J,Q){let $=this.getUtoTmapping(J);return this.getTangent($,Q)}computeFrenetFrames(J,Q=!1){let $=new T,Z=[],W=[],Y=[],X=new T,K=new y0;for(let E=0;E<=J;E++){let O=E/J;Z[E]=this.getTangentAt(O,new T)}W[0]=new T,Y[0]=new T;let H=Number.MAX_VALUE,U=Math.abs(Z[0].x),G=Math.abs(Z[0].y),F=Math.abs(Z[0].z);if(U<=H)H=U,$.set(1,0,0);if(G<=H)H=G,$.set(0,1,0);if(F<=H)$.set(0,0,1);X.crossVectors(Z[0],$).normalize(),W[0].crossVectors(Z[0],X),Y[0].crossVectors(Z[0],W[0]);for(let E=1;E<=J;E++){if(W[E]=W[E-1].clone(),Y[E]=Y[E-1].clone(),X.crossVectors(Z[E-1],Z[E]),X.length()>Number.EPSILON){X.normalize();let O=Math.acos(s0(Z[E-1].dot(Z[E]),-1,1));W[E].applyMatrix4(K.makeRotationAxis(X,O))}Y[E].crossVectors(Z[E],W[E])}if(Q===!0){let E=Math.acos(s0(W[0].dot(W[J]),-1,1));if(E/=J,Z[0].dot(X.crossVectors(W[0],W[J]))>0)E=-E;for(let O=1;O<=J;O++)W[O].applyMatrix4(K.makeRotationAxis(Z[O],E*O)),Y[O].crossVectors(Z[O],W[O])}return{tangents:Z,normals:W,binormals:Y}}clone(){return new this.constructor().copy(this)}copy(J){return this.arcLengthDivisions=J.arcLengthDivisions,this}toJSON(){let J={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return J.arcLengthDivisions=this.arcLengthDivisions,J.type=this.type,J}fromJSON(J){return this.arcLengthDivisions=J.arcLengthDivisions,this}}class u7 extends B9{constructor(J=0,Q=0,$=1,Z=1,W=0,Y=Math.PI*2,X=!1,K=0){super();this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=J,this.aY=Q,this.xRadius=$,this.yRadius=Z,this.aStartAngle=W,this.aEndAngle=Y,this.aClockwise=X,this.aRotation=K}getPoint(J,Q=new i){let $=Q,Z=Math.PI*2,W=this.aEndAngle-this.aStartAngle,Y=Math.abs(W)<Number.EPSILON;while(W<0)W+=Z;while(W>Z)W-=Z;if(W<Number.EPSILON)if(Y)W=0;else W=Z;if(this.aClockwise===!0&&!Y)if(W===Z)W=-Z;else W=W-Z;let X=this.aStartAngle+J*W,K=this.aX+this.xRadius*Math.cos(X),H=this.aY+this.yRadius*Math.sin(X);if(this.aRotation!==0){let U=Math.cos(this.aRotation),G=Math.sin(this.aRotation),F=K-this.aX,E=H-this.aY;K=F*U-E*G+this.aX,H=F*G+E*U+this.aY}return $.set(K,H)}copy(J){return super.copy(J),this.aX=J.aX,this.aY=J.aY,this.xRadius=J.xRadius,this.yRadius=J.yRadius,this.aStartAngle=J.aStartAngle,this.aEndAngle=J.aEndAngle,this.aClockwise=J.aClockwise,this.aRotation=J.aRotation,this}toJSON(){let J=super.toJSON();return J.aX=this.aX,J.aY=this.aY,J.xRadius=this.xRadius,J.yRadius=this.yRadius,J.aStartAngle=this.aStartAngle,J.aEndAngle=this.aEndAngle,J.aClockwise=this.aClockwise,J.aRotation=this.aRotation,J}fromJSON(J){return super.fromJSON(J),this.aX=J.aX,this.aY=J.aY,this.xRadius=J.xRadius,this.yRadius=J.yRadius,this.aStartAngle=J.aStartAngle,this.aEndAngle=J.aEndAngle,this.aClockwise=J.aClockwise,this.aRotation=J.aRotation,this}}class kW extends u7{constructor(J,Q,$,Z,W,Y){super(J,Q,$,$,Z,W,Y);this.isArcCurve=!0,this.type="ArcCurve"}}function EK(){let J=0,Q=0,$=0,Z=0;function W(Y,X,K,H){J=Y,Q=K,$=-3*Y+3*X-2*K-H,Z=2*Y-2*X+K+H}return{initCatmullRom:function(Y,X,K,H,U){W(X,K,U*(K-Y),U*(H-X))},initNonuniformCatmullRom:function(Y,X,K,H,U,G,F){let E=(X-Y)/U-(K-Y)/(U+G)+(K-X)/G,O=(K-X)/G-(H-X)/(G+F)+(H-K)/F;E*=G,O*=G,W(X,K,E,O)},calc:function(Y){let X=Y*Y,K=X*Y;return J+Q*Y+$*X+Z*K}}}var MU=new T,VU=new T,pY=new EK,uY=new EK,dY=new EK;class d7 extends B9{constructor(J=[],Q=!1,$="centripetal",Z=0.5){super();this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=J,this.closed=Q,this.curveType=$,this.tension=Z}getPoint(J,Q=new T){let $=Q,Z=this.points,W=Z.length,Y=(W-(this.closed?0:1))*J,X=Math.floor(Y),K=Y-X;if(this.closed)X+=X>0?0:(Math.floor(Math.abs(X)/W)+1)*W;else if(K===0&&X===W-1)X=W-2,K=1;let H,U;if(this.closed||X>0)H=Z[(X-1)%W];else VU.subVectors(Z[0],Z[1]).add(Z[0]),H=VU;let G=Z[X%W],F=Z[(X+1)%W];if(this.closed||X+2<W)U=Z[(X+2)%W];else MU.subVectors(Z[W-1],Z[W-2]).add(Z[W-1]),U=MU;if(this.curveType==="centripetal"||this.curveType==="chordal"){let E=this.curveType==="chordal"?0.5:0.25,O=Math.pow(H.distanceToSquared(G),E),R=Math.pow(G.distanceToSquared(F),E),k=Math.pow(F.distanceToSquared(U),E);if(R<0.0001)R=1;if(O<0.0001)O=R;if(k<0.0001)k=R;pY.initNonuniformCatmullRom(H.x,G.x,F.x,U.x,O,R,k),uY.initNonuniformCatmullRom(H.y,G.y,F.y,U.y,O,R,k),dY.initNonuniformCatmullRom(H.z,G.z,F.z,U.z,O,R,k)}else if(this.curveType==="catmullrom")pY.initCatmullRom(H.x,G.x,F.x,U.x,this.tension),uY.initCatmullRom(H.y,G.y,F.y,U.y,this.tension),dY.initCatmullRom(H.z,G.z,F.z,U.z,this.tension);return $.set(pY.calc(K),uY.calc(K),dY.calc(K)),$}copy(J){super.copy(J),this.points=[];for(let Q=0,$=J.points.length;Q<$;Q++){let Z=J.points[Q];this.points.push(Z.clone())}return this.closed=J.closed,this.curveType=J.curveType,this.tension=J.tension,this}toJSON(){let J=super.toJSON();J.points=[];for(let Q=0,$=this.points.length;Q<$;Q++){let Z=this.points[Q];J.points.push(Z.toArray())}return J.closed=this.closed,J.curveType=this.curveType,J.tension=this.tension,J}fromJSON(J){super.fromJSON(J),this.points=[];for(let Q=0,$=J.points.length;Q<$;Q++){let Z=J.points[Q];this.points.push(new T().fromArray(Z))}return this.closed=J.closed,this.curveType=J.curveType,this.tension=J.tension,this}}function BU(J,Q,$,Z,W){let Y=(Z-Q)*0.5,X=(W-$)*0.5,K=J*J,H=J*K;return(2*$-2*Z+Y+X)*H+(-3*$+3*Z-2*Y-X)*K+Y*J+$}function IF(J,Q){let $=1-J;return $*$*Q}function zF(J,Q){return 2*(1-J)*J*Q}function _F(J,Q){return J*J*Q}function RQ(J,Q,$,Z){return IF(J,Q)+zF(J,$)+_F(J,Z)}function wF(J,Q){let $=1-J;return $*$*$*Q}function PF(J,Q){let $=1-J;return 3*$*$*J*Q}function TF(J,Q){return 3*(1-J)*J*J*Q}function AF(J,Q){return J*J*J*Q}function LQ(J,Q,$,Z,W){return wF(J,Q)+PF(J,$)+TF(J,Z)+AF(J,W)}class nQ extends B9{constructor(J=new i,Q=new i,$=new i,Z=new i){super();this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=J,this.v1=Q,this.v2=$,this.v3=Z}getPoint(J,Q=new i){let $=Q,Z=this.v0,W=this.v1,Y=this.v2,X=this.v3;return $.set(LQ(J,Z.x,W.x,Y.x,X.x),LQ(J,Z.y,W.y,Y.y,X.y)),$}copy(J){return super.copy(J),this.v0.copy(J.v0),this.v1.copy(J.v1),this.v2.copy(J.v2),this.v3.copy(J.v3),this}toJSON(){let J=super.toJSON();return J.v0=this.v0.toArray(),J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J.v3=this.v3.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v0.fromArray(J.v0),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this.v3.fromArray(J.v3),this}}class MW extends B9{constructor(J=new T,Q=new T,$=new T,Z=new T){super();this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=J,this.v1=Q,this.v2=$,this.v3=Z}getPoint(J,Q=new T){let $=Q,Z=this.v0,W=this.v1,Y=this.v2,X=this.v3;return $.set(LQ(J,Z.x,W.x,Y.x,X.x),LQ(J,Z.y,W.y,Y.y,X.y),LQ(J,Z.z,W.z,Y.z,X.z)),$}copy(J){return super.copy(J),this.v0.copy(J.v0),this.v1.copy(J.v1),this.v2.copy(J.v2),this.v3.copy(J.v3),this}toJSON(){let J=super.toJSON();return J.v0=this.v0.toArray(),J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J.v3=this.v3.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v0.fromArray(J.v0),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this.v3.fromArray(J.v3),this}}class sQ extends B9{constructor(J=new i,Q=new i){super();this.isLineCurve=!0,this.type="LineCurve",this.v1=J,this.v2=Q}getPoint(J,Q=new i){let $=Q;if(J===1)$.copy(this.v2);else $.copy(this.v2).sub(this.v1),$.multiplyScalar(J).add(this.v1);return $}getPointAt(J,Q){return this.getPoint(J,Q)}getTangent(J,Q=new i){return Q.subVectors(this.v2,this.v1).normalize()}getTangentAt(J,Q){return this.getTangent(J,Q)}copy(J){return super.copy(J),this.v1.copy(J.v1),this.v2.copy(J.v2),this}toJSON(){let J=super.toJSON();return J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this}}class VW extends B9{constructor(J=new T,Q=new T){super();this.isLineCurve3=!0,this.type="LineCurve3",this.v1=J,this.v2=Q}getPoint(J,Q=new T){let $=Q;if(J===1)$.copy(this.v2);else $.copy(this.v2).sub(this.v1),$.multiplyScalar(J).add(this.v1);return $}getPointAt(J,Q){return this.getPoint(J,Q)}getTangent(J,Q=new T){return Q.subVectors(this.v2,this.v1).normalize()}getTangentAt(J,Q){return this.getTangent(J,Q)}copy(J){return super.copy(J),this.v1.copy(J.v1),this.v2.copy(J.v2),this}toJSON(){let J=super.toJSON();return J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this}}class iQ extends B9{constructor(J=new i,Q=new i,$=new i){super();this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=J,this.v1=Q,this.v2=$}getPoint(J,Q=new i){let $=Q,Z=this.v0,W=this.v1,Y=this.v2;return $.set(RQ(J,Z.x,W.x,Y.x),RQ(J,Z.y,W.y,Y.y)),$}copy(J){return super.copy(J),this.v0.copy(J.v0),this.v1.copy(J.v1),this.v2.copy(J.v2),this}toJSON(){let J=super.toJSON();return J.v0=this.v0.toArray(),J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v0.fromArray(J.v0),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this}}class oQ extends B9{constructor(J=new T,Q=new T,$=new T){super();this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=J,this.v1=Q,this.v2=$}getPoint(J,Q=new T){let $=Q,Z=this.v0,W=this.v1,Y=this.v2;return $.set(RQ(J,Z.x,W.x,Y.x),RQ(J,Z.y,W.y,Y.y),RQ(J,Z.z,W.z,Y.z)),$}copy(J){return super.copy(J),this.v0.copy(J.v0),this.v1.copy(J.v1),this.v2.copy(J.v2),this}toJSON(){let J=super.toJSON();return J.v0=this.v0.toArray(),J.v1=this.v1.toArray(),J.v2=this.v2.toArray(),J}fromJSON(J){return super.fromJSON(J),this.v0.fromArray(J.v0),this.v1.fromArray(J.v1),this.v2.fromArray(J.v2),this}}class aQ extends B9{constructor(J=[]){super();this.isSplineCurve=!0,this.type="SplineCurve",this.points=J}getPoint(J,Q=new i){let $=Q,Z=this.points,W=(Z.length-1)*J,Y=Math.floor(W),X=W-Y,K=Z[Y===0?Y:Y-1],H=Z[Y],U=Z[Y>Z.length-2?Z.length-1:Y+1],G=Z[Y>Z.length-3?Z.length-1:Y+2];return $.set(BU(X,K.x,H.x,U.x,G.x),BU(X,K.y,H.y,U.y,G.y)),$}copy(J){super.copy(J),this.points=[];for(let Q=0,$=J.points.length;Q<$;Q++){let Z=J.points[Q];this.points.push(Z.clone())}return this}toJSON(){let J=super.toJSON();J.points=[];for(let Q=0,$=this.points.length;Q<$;Q++){let Z=this.points[Q];J.points.push(Z.toArray())}return J}fromJSON(J){super.fromJSON(J),this.points=[];for(let Q=0,$=J.points.length;Q<$;Q++){let Z=J.points[Q];this.points.push(new i().fromArray(Z))}return this}}var kZ=Object.freeze({__proto__:null,ArcCurve:kW,CatmullRomCurve3:d7,CubicBezierCurve:nQ,CubicBezierCurve3:MW,EllipseCurve:u7,LineCurve:sQ,LineCurve3:VW,QuadraticBezierCurve:iQ,QuadraticBezierCurve3:oQ,SplineCurve:aQ});class BW extends B9{constructor(){super();this.type="CurvePath",this.curves=[],this.autoClose=!1}add(J){this.curves.push(J)}closePath(){let J=this.curves[0].getPoint(0),Q=this.curves[this.curves.length-1].getPoint(1);if(!J.equals(Q)){let $=J.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new kZ[$](Q,J))}return this}getPoint(J,Q){let $=J*this.getLength(),Z=this.getCurveLengths(),W=0;while(W<Z.length){if(Z[W]>=$){let Y=Z[W]-$,X=this.curves[W],K=X.getLength(),H=K===0?0:1-Y/K;return X.getPointAt(H,Q)}W++}return null}getLength(){let J=this.getCurveLengths();return J[J.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let J=[],Q=0;for(let $=0,Z=this.curves.length;$<Z;$++)Q+=this.curves[$].getLength(),J.push(Q);return this.cacheLengths=J,J}getSpacedPoints(J=40){let Q=[];for(let $=0;$<=J;$++)Q.push(this.getPoint($/J));if(this.autoClose)Q.push(Q[0]);return Q}getPoints(J=12){let Q=[],$;for(let Z=0,W=this.curves;Z<W.length;Z++){let Y=W[Z],X=Y.isEllipseCurve?J*2:Y.isLineCurve||Y.isLineCurve3?1:Y.isSplineCurve?J*Y.points.length:J,K=Y.getPoints(X);for(let H=0;H<K.length;H++){let U=K[H];if($&&$.equals(U))continue;Q.push(U),$=U}}if(this.autoClose&&Q.length>1&&!Q[Q.length-1].equals(Q[0]))Q.push(Q[0]);return Q}copy(J){super.copy(J),this.curves=[];for(let Q=0,$=J.curves.length;Q<$;Q++){let Z=J.curves[Q];this.curves.push(Z.clone())}return this.autoClose=J.autoClose,this}toJSON(){let J=super.toJSON();J.autoClose=this.autoClose,J.curves=[];for(let Q=0,$=this.curves.length;Q<$;Q++){let Z=this.curves[Q];J.curves.push(Z.toJSON())}return J}fromJSON(J){super.fromJSON(J),this.autoClose=J.autoClose,this.curves=[];for(let Q=0,$=J.curves.length;Q<$;Q++){let Z=J.curves[Q];this.curves.push(new kZ[Z.type]().fromJSON(Z))}return this}}class V7 extends BW{constructor(J){super();if(this.type="Path",this.currentPoint=new i,J)this.setFromPoints(J)}setFromPoints(J){this.moveTo(J[0].x,J[0].y);for(let Q=1,$=J.length;Q<$;Q++)this.lineTo(J[Q].x,J[Q].y);return this}moveTo(J,Q){return this.currentPoint.set(J,Q),this}lineTo(J,Q){let $=new sQ(this.currentPoint.clone(),new i(J,Q));return this.curves.push($),this.currentPoint.set(J,Q),this}quadraticCurveTo(J,Q,$,Z){let W=new iQ(this.currentPoint.clone(),new i(J,Q),new i($,Z));return this.curves.push(W),this.currentPoint.set($,Z),this}bezierCurveTo(J,Q,$,Z,W,Y){let X=new nQ(this.currentPoint.clone(),new i(J,Q),new i($,Z),new i(W,Y));return this.curves.push(X),this.currentPoint.set(W,Y),this}splineThru(J){let Q=[this.currentPoint.clone()].concat(J),$=new aQ(Q);return this.curves.push($),this.currentPoint.copy(J[J.length-1]),this}arc(J,Q,$,Z,W,Y){let X=this.currentPoint.x,K=this.currentPoint.y;return this.absarc(J+X,Q+K,$,Z,W,Y),this}absarc(J,Q,$,Z,W,Y){return this.absellipse(J,Q,$,$,Z,W,Y),this}ellipse(J,Q,$,Z,W,Y,X,K){let H=this.currentPoint.x,U=this.currentPoint.y;return this.absellipse(J+H,Q+U,$,Z,W,Y,X,K),this}absellipse(J,Q,$,Z,W,Y,X,K){let H=new u7(J,Q,$,Z,W,Y,X,K);if(this.curves.length>0){let G=H.getPoint(0);if(!G.equals(this.currentPoint))this.lineTo(G.x,G.y)}this.curves.push(H);let U=H.getPoint(1);return this.currentPoint.copy(U),this}copy(J){return super.copy(J),this.currentPoint.copy(J.currentPoint),this}toJSON(){let J=super.toJSON();return J.currentPoint=this.currentPoint.toArray(),J}fromJSON(J){return super.fromJSON(J),this.currentPoint.fromArray(J.currentPoint),this}}class B8 extends V7{constructor(J){super(J);this.uuid=D9(),this.type="Shape",this.holes=[]}getPointsHoles(J){let Q=[];for(let $=0,Z=this.holes.length;$<Z;$++)Q[$]=this.holes[$].getPoints(J);return Q}extractPoints(J){return{shape:this.getPoints(J),holes:this.getPointsHoles(J)}}copy(J){super.copy(J),this.holes=[];for(let Q=0,$=J.holes.length;Q<$;Q++){let Z=J.holes[Q];this.holes.push(Z.clone())}return this}toJSON(){let J=super.toJSON();J.uuid=this.uuid,J.holes=[];for(let Q=0,$=this.holes.length;Q<$;Q++){let Z=this.holes[Q];J.holes.push(Z.toJSON())}return J}fromJSON(J){super.fromJSON(J),this.uuid=J.uuid,this.holes=[];for(let Q=0,$=J.holes.length;Q<$;Q++){let Z=J.holes[Q];this.holes.push(new V7().fromJSON(Z))}return this}}function SF(J,Q,$=2){let Z=Q&&Q.length,W=Z?Q[0]*$:J.length,Y=G5(J,0,W,$,!0),X=[];if(!Y||Y.next===Y.prev)return X;let K,H,U;if(Z)Y=bF(J,Q,Y,$);if(J.length>80*$){K=J[0],H=J[1];let G=K,F=H;for(let E=$;E<W;E+=$){let O=J[E],R=J[E+1];if(O<K)K=O;if(R<H)H=R;if(O>G)G=O;if(R>F)F=R}U=Math.max(G-K,F-H),U=U!==0?32767/U:0}return kQ(Y,X,$,K,H,U,0),X}function G5(J,Q,$,Z,W){let Y;if(W===sF(J,Q,$,Z)>0)for(let X=Q;X<$;X+=Z)Y=CU(X/Z|0,J[X],J[X+1],Y);else for(let X=$-Z;X>=Q;X-=Z)Y=CU(X/Z|0,J[X],J[X+1],Y);if(Y&&B7(Y,Y.next))VQ(Y),Y=Y.next;return Y}function B6(J,Q){if(!J)return J;if(!Q)Q=J;let $=J,Z;do if(Z=!1,!$.steiner&&(B7($,$.next)||zJ($.prev,$,$.next)===0)){if(VQ($),$=Q=$.prev,$===$.next)break;Z=!0}else $=$.next;while(Z||$!==Q);return Q}function kQ(J,Q,$,Z,W,Y,X){if(!J)return;if(!X&&Y)uF(J,Z,W,Y);let K=J;while(J.prev!==J.next){let{prev:H,next:U}=J;if(Y?vF(J,Z,W,Y):jF(J)){Q.push(H.i,J.i,U.i),VQ(J),J=U.next,K=U.next;continue}if(J=U,J===K){if(!X)kQ(B6(J),Q,$,Z,W,Y,1);else if(X===1)J=yF(B6(J),Q),kQ(J,Q,$,Z,W,Y,2);else if(X===2)xF(J,Q,$,Z,W,Y);break}}}function jF(J){let Q=J.prev,$=J,Z=J.next;if(zJ(Q,$,Z)>=0)return!1;let W=Q.x,Y=$.x,X=Z.x,K=Q.y,H=$.y,U=Z.y,G=Math.min(W,Y,X),F=Math.min(K,H,U),E=Math.max(W,Y,X),O=Math.max(K,H,U),R=Z.next;while(R!==Q){if(R.x>=G&&R.x<=E&&R.y>=F&&R.y<=O&&OQ(W,K,Y,H,X,U,R.x,R.y)&&zJ(R.prev,R,R.next)>=0)return!1;R=R.next}return!0}function vF(J,Q,$,Z){let W=J.prev,Y=J,X=J.next;if(zJ(W,Y,X)>=0)return!1;let K=W.x,H=Y.x,U=X.x,G=W.y,F=Y.y,E=X.y,O=Math.min(K,H,U),R=Math.min(G,F,E),k=Math.max(K,H,U),q=Math.max(G,F,E),N=rY(O,R,Q,$,Z),L=rY(k,q,Q,$,Z),D=J.prevZ,V=J.nextZ;while(D&&D.z>=N&&V&&V.z<=L){if(D.x>=O&&D.x<=k&&D.y>=R&&D.y<=q&&D!==W&&D!==X&&OQ(K,G,H,F,U,E,D.x,D.y)&&zJ(D.prev,D,D.next)>=0)return!1;if(D=D.prevZ,V.x>=O&&V.x<=k&&V.y>=R&&V.y<=q&&V!==W&&V!==X&&OQ(K,G,H,F,U,E,V.x,V.y)&&zJ(V.prev,V,V.next)>=0)return!1;V=V.nextZ}while(D&&D.z>=N){if(D.x>=O&&D.x<=k&&D.y>=R&&D.y<=q&&D!==W&&D!==X&&OQ(K,G,H,F,U,E,D.x,D.y)&&zJ(D.prev,D,D.next)>=0)return!1;D=D.prevZ}while(V&&V.z<=L){if(V.x>=O&&V.x<=k&&V.y>=R&&V.y<=q&&V!==W&&V!==X&&OQ(K,G,H,F,U,E,V.x,V.y)&&zJ(V.prev,V,V.next)>=0)return!1;V=V.nextZ}return!0}function yF(J,Q){let $=J;do{let Z=$.prev,W=$.next.next;if(!B7(Z,W)&&F5(Z,$,$.next,W)&&MQ(Z,W)&&MQ(W,Z))Q.push(Z.i,$.i,W.i),VQ($),VQ($.next),$=J=W;$=$.next}while($!==J);return B6($)}function xF(J,Q,$,Z,W,Y){let X=J;do{let K=X.next.next;while(K!==X.prev){if(X.i!==K.i&&lF(X,K)){let H=N5(X,K);X=B6(X,X.next),H=B6(H,H.next),kQ(X,Q,$,Z,W,Y,0),kQ(H,Q,$,Z,W,Y,0);return}K=K.next}X=X.next}while(X!==J)}function bF(J,Q,$,Z){let W=[];for(let Y=0,X=Q.length;Y<X;Y++){let K=Q[Y]*Z,H=Y<X-1?Q[Y+1]*Z:J.length,U=G5(J,K,H,Z,!1);if(U===U.next)U.steiner=!0;W.push(mF(U))}W.sort(hF);for(let Y=0;Y<W.length;Y++)$=fF(W[Y],$);return $}function hF(J,Q){let $=J.x-Q.x;if($===0){if($=J.y-Q.y,$===0){let Z=(J.next.y-J.y)/(J.next.x-J.x),W=(Q.next.y-Q.y)/(Q.next.x-Q.x);$=Z-W}}return $}function fF(J,Q){let $=gF(J,Q);if(!$)return Q;let Z=N5($,J);return B6(Z,Z.next),B6($,$.next)}function gF(J,Q){let $=Q,Z=J.x,W=J.y,Y=-1/0,X;if(B7(J,$))return $;do{if(B7(J,$.next))return $.next;else if(W<=$.y&&W>=$.next.y&&$.next.y!==$.y){let F=$.x+(W-$.y)*($.next.x-$.x)/($.next.y-$.y);if(F<=Z&&F>Y){if(Y=F,X=$.x<$.next.x?$:$.next,F===Z)return X}}$=$.next}while($!==Q);if(!X)return null;let K=X,H=X.x,U=X.y,G=1/0;$=X;do{if(Z>=$.x&&$.x>=H&&Z!==$.x&&E5(W<U?Z:Y,W,H,U,W<U?Y:Z,W,$.x,$.y)){let F=Math.abs(W-$.y)/(Z-$.x);if(MQ($,J)&&(F<G||F===G&&($.x>X.x||$.x===X.x&&pF(X,$))))X=$,G=F}$=$.next}while($!==K);return X}function pF(J,Q){return zJ(J.prev,J,Q.prev)<0&&zJ(Q.next,J,J.next)<0}function uF(J,Q,$,Z){let W=J;do{if(W.z===0)W.z=rY(W.x,W.y,Q,$,Z);W.prevZ=W.prev,W.nextZ=W.next,W=W.next}while(W!==J);W.prevZ.nextZ=null,W.prevZ=null,dF(W)}function dF(J){let Q,$=1;do{let Z=J,W;J=null;let Y=null;Q=0;while(Z){Q++;let X=Z,K=0;for(let U=0;U<$;U++)if(K++,X=X.nextZ,!X)break;let H=$;while(K>0||H>0&&X){if(K!==0&&(H===0||!X||Z.z<=X.z))W=Z,Z=Z.nextZ,K--;else W=X,X=X.nextZ,H--;if(Y)Y.nextZ=W;else J=W;W.prevZ=Y,Y=W}Z=X}Y.nextZ=null,$*=2}while(Q>1);return J}function rY(J,Q,$,Z,W){return J=(J-$)*W|0,Q=(Q-Z)*W|0,J=(J|J<<8)&16711935,J=(J|J<<4)&252645135,J=(J|J<<2)&858993459,J=(J|J<<1)&1431655765,Q=(Q|Q<<8)&16711935,Q=(Q|Q<<4)&252645135,Q=(Q|Q<<2)&858993459,Q=(Q|Q<<1)&1431655765,J|Q<<1}function mF(J){let Q=J,$=J;do{if(Q.x<$.x||Q.x===$.x&&Q.y<$.y)$=Q;Q=Q.next}while(Q!==J);return $}function E5(J,Q,$,Z,W,Y,X,K){return(W-X)*(Q-K)>=(J-X)*(Y-K)&&(J-X)*(Z-K)>=($-X)*(Q-K)&&($-X)*(Y-K)>=(W-X)*(Z-K)}function OQ(J,Q,$,Z,W,Y,X,K){return!(J===X&&Q===K)&&E5(J,Q,$,Z,W,Y,X,K)}function lF(J,Q){return J.next.i!==Q.i&&J.prev.i!==Q.i&&!cF(J,Q)&&(MQ(J,Q)&&MQ(Q,J)&&nF(J,Q)&&(zJ(J.prev,J,Q.prev)||zJ(J,Q.prev,Q))||B7(J,Q)&&zJ(J.prev,J,J.next)>0&&zJ(Q.prev,Q,Q.next)>0)}function zJ(J,Q,$){return(Q.y-J.y)*($.x-Q.x)-(Q.x-J.x)*($.y-Q.y)}function B7(J,Q){return J.x===Q.x&&J.y===Q.y}function F5(J,Q,$,Z){let W=KZ(zJ(J,Q,$)),Y=KZ(zJ(J,Q,Z)),X=KZ(zJ($,Z,J)),K=KZ(zJ($,Z,Q));if(W!==Y&&X!==K)return!0;if(W===0&&XZ(J,$,Q))return!0;if(Y===0&&XZ(J,Z,Q))return!0;if(X===0&&XZ($,J,Z))return!0;if(K===0&&XZ($,Q,Z))return!0;return!1}function XZ(J,Q,$){return Q.x<=Math.max(J.x,$.x)&&Q.x>=Math.min(J.x,$.x)&&Q.y<=Math.max(J.y,$.y)&&Q.y>=Math.min(J.y,$.y)}function KZ(J){return J>0?1:J<0?-1:0}function cF(J,Q){let $=J;do{if($.i!==J.i&&$.next.i!==J.i&&$.i!==Q.i&&$.next.i!==Q.i&&F5($,$.next,J,Q))return!0;$=$.next}while($!==J);return!1}function MQ(J,Q){return zJ(J.prev,J,J.next)<0?zJ(J,Q,J.next)>=0&&zJ(J,J.prev,Q)>=0:zJ(J,Q,J.prev)<0||zJ(J,J.next,Q)<0}function nF(J,Q){let $=J,Z=!1,W=(J.x+Q.x)/2,Y=(J.y+Q.y)/2;do{if($.y>Y!==$.next.y>Y&&$.next.y!==$.y&&W<($.next.x-$.x)*(Y-$.y)/($.next.y-$.y)+$.x)Z=!Z;$=$.next}while($!==J);return Z}function N5(J,Q){let $=tY(J.i,J.x,J.y),Z=tY(Q.i,Q.x,Q.y),W=J.next,Y=Q.prev;return J.next=Q,Q.prev=J,$.next=W,W.prev=$,Z.next=$,$.prev=Z,Y.next=Z,Z.prev=Y,Z}function CU(J,Q,$,Z){let W=tY(J,Q,$);if(!Z)W.prev=W,W.next=W;else W.next=Z.next,W.prev=Z,Z.next.prev=W,Z.next=W;return W}function VQ(J){if(J.next.prev=J.prev,J.prev.next=J.next,J.prevZ)J.prevZ.nextZ=J.nextZ;if(J.nextZ)J.nextZ.prevZ=J.prevZ}function tY(J,Q,$){return{i:J,x:Q,y:$,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function sF(J,Q,$,Z){let W=0;for(let Y=Q,X=$-Z;Y<$;Y+=Z)W+=(J[X]-J[Y])*(J[Y+1]+J[X+1]),X=Y;return W}class O5{static triangulate(J,Q,$=2){return SF(J,Q,$)}}class w9{static area(J){let Q=J.length,$=0;for(let Z=Q-1,W=0;W<Q;Z=W++)$+=J[Z].x*J[W].y-J[W].x*J[Z].y;return $*0.5}static isClockWise(J){return w9.area(J)<0}static triangulateShape(J,Q){let $=[],Z=[],W=[];IU(J),zU($,J);let Y=J.length;Q.forEach(IU);for(let K=0;K<Q.length;K++)Z.push(Y),Y+=Q[K].length,zU($,Q[K]);let X=O5.triangulate($,Z);for(let K=0;K<X.length;K+=3)W.push(X.slice(K,K+3));return W}}function IU(J){let Q=J.length;if(Q>2&&J[Q-1].equals(J[0]))J.pop()}function zU(J,Q){for(let $=0;$<Q.length;$++)J.push(Q[$].x),J.push(Q[$].y)}class rQ extends u0{constructor(J=new B8([new i(0.5,0.5),new i(-0.5,0.5),new i(-0.5,-0.5),new i(0.5,-0.5)]),Q={}){super();this.type="ExtrudeGeometry",this.parameters={shapes:J,options:Q},J=Array.isArray(J)?J:[J];let $=this,Z=[],W=[];for(let X=0,K=J.length;X<K;X++){let H=J[X];Y(H)}this.setAttribute("position",new I0(Z,3)),this.setAttribute("uv",new I0(W,2)),this.computeVertexNormals();function Y(X){let K=[],H=Q.curveSegments!==void 0?Q.curveSegments:12,U=Q.steps!==void 0?Q.steps:1,G=Q.depth!==void 0?Q.depth:1,F=Q.bevelEnabled!==void 0?Q.bevelEnabled:!0,E=Q.bevelThickness!==void 0?Q.bevelThickness:0.2,O=Q.bevelSize!==void 0?Q.bevelSize:E-0.1,R=Q.bevelOffset!==void 0?Q.bevelOffset:0,k=Q.bevelSegments!==void 0?Q.bevelSegments:3,q=Q.extrudePath,N=Q.UVGenerator!==void 0?Q.UVGenerator:iF,L,D=!1,V,I,z,B;if(q){L=q.getSpacedPoints(U),D=!0,F=!1;let Q0=q.isCatmullRomCurve3?q.closed:!1;V=q.computeFrenetFrames(U,Q0),I=new T,z=new T,B=new T}if(!F)k=0,E=0,O=0,R=0;let M=X.extractPoints(H),C=M.shape,j=M.holes;if(!w9.isClockWise(C)){C=C.reverse();for(let Q0=0,X0=j.length;Q0<X0;Q0++){let $0=j[Q0];if(w9.isClockWise($0))j[Q0]=$0.reverse()}}function v(Q0){let _0=Q0[0];for(let C0=1;C0<=Q0.length;C0++){let m0=C0%Q0.length,y=Q0[m0],YJ=y.x-_0.x,h0=y.y-_0.y,l0=YJ*YJ+h0*h0,U0=Math.max(Math.abs(y.x),Math.abs(y.y),Math.abs(_0.x),Math.abs(_0.y)),NJ=0.000000000000000000010000000000000001*U0*U0;if(l0<=NJ){Q0.splice(m0,1),C0--;continue}_0=y}}v(C),j.forEach(v);let b=j.length,S=C;for(let Q0=0;Q0<b;Q0++){let X0=j[Q0];C=C.concat(X0)}function h(Q0,X0,$0){if(!X0)v0("ExtrudeGeometry: vec does not exist");return Q0.clone().addScaledVector(X0,$0)}let x=C.length;function p(Q0,X0,$0){let _0,C0,m0,y=Q0.x-X0.x,YJ=Q0.y-X0.y,h0=$0.x-Q0.x,l0=$0.y-Q0.y,U0=y*y+YJ*YJ,NJ=y*l0-YJ*h0;if(Math.abs(NJ)>Number.EPSILON){let T0=Math.sqrt(U0),A=Math.sqrt(h0*h0+l0*l0),_=X0.x-YJ/T0,u=X0.y+y/T0,r=$0.x-l0/A,Z0=$0.y+h0/A,K0=((r-_)*l0-(Z0-u)*h0)/(y*l0-YJ*h0);_0=_+y*K0-Q0.x,C0=u+YJ*K0-Q0.y;let D0=_0*_0+C0*C0;if(D0<=2)return new i(_0,C0);else m0=Math.sqrt(D0/2)}else{let T0=!1;if(y>Number.EPSILON){if(h0>Number.EPSILON)T0=!0}else if(y<-Number.EPSILON){if(h0<-Number.EPSILON)T0=!0}else if(Math.sign(YJ)===Math.sign(l0))T0=!0;if(T0)_0=-YJ,C0=y,m0=Math.sqrt(U0);else _0=y,C0=YJ,m0=Math.sqrt(U0/2)}return new i(_0/m0,C0/m0)}let c=[];for(let Q0=0,X0=S.length,$0=X0-1,_0=Q0+1;Q0<X0;Q0++,$0++,_0++){if($0===X0)$0=0;if(_0===X0)_0=0;c[Q0]=p(S[Q0],S[$0],S[_0])}let o=[],W0,H0=c.concat();for(let Q0=0,X0=b;Q0<X0;Q0++){let $0=j[Q0];W0=[];for(let _0=0,C0=$0.length,m0=C0-1,y=_0+1;_0<C0;_0++,m0++,y++){if(m0===C0)m0=0;if(y===C0)y=0;W0[_0]=p($0[_0],$0[m0],$0[y])}o.push(W0),H0=H0.concat(W0)}let J0;if(k===0)J0=w9.triangulateShape(S,j);else{let Q0=[],X0=[];for(let $0=0;$0<k;$0++){let _0=$0/k,C0=E*Math.cos(_0*Math.PI/2),m0=O*Math.sin(_0*Math.PI/2)+R;for(let y=0,YJ=S.length;y<YJ;y++){let h0=h(S[y],c[y],m0);if(E0(h0.x,h0.y,-C0),_0===0)Q0.push(h0)}for(let y=0,YJ=b;y<YJ;y++){let h0=j[y];W0=o[y];let l0=[];for(let U0=0,NJ=h0.length;U0<NJ;U0++){let T0=h(h0[U0],W0[U0],m0);if(E0(T0.x,T0.y,-C0),_0===0)l0.push(T0)}if(_0===0)X0.push(l0)}}J0=w9.triangulateShape(Q0,X0)}let c0=J0.length,d0=O+R;for(let Q0=0;Q0<x;Q0++){let X0=F?h(C[Q0],H0[Q0],d0):C[Q0];if(!D)E0(X0.x,X0.y,0);else z.copy(V.normals[0]).multiplyScalar(X0.x),I.copy(V.binormals[0]).multiplyScalar(X0.y),B.copy(L[0]).add(z).add(I),E0(B.x,B.y,B.z)}for(let Q0=1;Q0<=U;Q0++)for(let X0=0;X0<x;X0++){let $0=F?h(C[X0],H0[X0],d0):C[X0];if(!D)E0($0.x,$0.y,G/U*Q0);else z.copy(V.normals[Q0]).multiplyScalar($0.x),I.copy(V.binormals[Q0]).multiplyScalar($0.y),B.copy(L[Q0]).add(z).add(I),E0(B.x,B.y,B.z)}for(let Q0=k-1;Q0>=0;Q0--){let X0=Q0/k,$0=E*Math.cos(X0*Math.PI/2),_0=O*Math.sin(X0*Math.PI/2)+R;for(let C0=0,m0=S.length;C0<m0;C0++){let y=h(S[C0],c[C0],_0);E0(y.x,y.y,G+$0)}for(let C0=0,m0=j.length;C0<m0;C0++){let y=j[C0];W0=o[C0];for(let YJ=0,h0=y.length;YJ<h0;YJ++){let l0=h(y[YJ],W0[YJ],_0);if(!D)E0(l0.x,l0.y,G+$0);else E0(l0.x,l0.y+L[U-1].y,L[U-1].x+$0)}}}s(),F0();function s(){let Q0=Z.length/3;if(F){let X0=0,$0=x*X0;for(let _0=0;_0<c0;_0++){let C0=J0[_0];j0(C0[2]+$0,C0[1]+$0,C0[0]+$0)}X0=U+k*2,$0=x*X0;for(let _0=0;_0<c0;_0++){let C0=J0[_0];j0(C0[0]+$0,C0[1]+$0,C0[2]+$0)}}else{for(let X0=0;X0<c0;X0++){let $0=J0[X0];j0($0[2],$0[1],$0[0])}for(let X0=0;X0<c0;X0++){let $0=J0[X0];j0($0[0]+x*U,$0[1]+x*U,$0[2]+x*U)}}$.addGroup(Q0,Z.length/3-Q0,0)}function F0(){let Q0=Z.length/3,X0=0;z0(S,X0),X0+=S.length;for(let $0=0,_0=j.length;$0<_0;$0++){let C0=j[$0];z0(C0,X0),X0+=C0.length}$.addGroup(Q0,Z.length/3-Q0,1)}function z0(Q0,X0){let $0=Q0.length;while(--$0>=0){let _0=$0,C0=$0-1;if(C0<0)C0=Q0.length-1;for(let m0=0,y=U+k*2;m0<y;m0++){let YJ=x*m0,h0=x*(m0+1),l0=X0+_0+YJ,U0=X0+C0+YJ,NJ=X0+C0+h0,T0=X0+_0+h0;WJ(l0,U0,NJ,T0)}}}function E0(Q0,X0,$0){K.push(Q0),K.push(X0),K.push($0)}function j0(Q0,X0,$0){x0(Q0),x0(X0),x0($0);let _0=Z.length/3,C0=N.generateTopUV($,Z,_0-3,_0-2,_0-1);n0(C0[0]),n0(C0[1]),n0(C0[2])}function WJ(Q0,X0,$0,_0){x0(Q0),x0(X0),x0(_0),x0(X0),x0($0),x0(_0);let C0=Z.length/3,m0=N.generateSideWallUV($,Z,C0-6,C0-3,C0-2,C0-1);n0(m0[0]),n0(m0[1]),n0(m0[3]),n0(m0[1]),n0(m0[2]),n0(m0[3])}function x0(Q0){Z.push(K[Q0*3+0]),Z.push(K[Q0*3+1]),Z.push(K[Q0*3+2])}function n0(Q0){W.push(Q0.x),W.push(Q0.y)}}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}toJSON(){let J=super.toJSON(),Q=this.parameters.shapes,$=this.parameters.options;return oF(Q,$,J)}static fromJSON(J,Q){let $=[];for(let W=0,Y=J.shapes.length;W<Y;W++){let X=Q[J.shapes[W]];$.push(X)}let Z=J.options.extrudePath;if(Z!==void 0)J.options.extrudePath=new kZ[Z.type]().fromJSON(Z);return new rQ($,J.options)}}var iF={generateTopUV:function(J,Q,$,Z,W){let Y=Q[$*3],X=Q[$*3+1],K=Q[Z*3],H=Q[Z*3+1],U=Q[W*3],G=Q[W*3+1];return[new i(Y,X),new i(K,H),new i(U,G)]},generateSideWallUV:function(J,Q,$,Z,W,Y){let X=Q[$*3],K=Q[$*3+1],H=Q[$*3+2],U=Q[Z*3],G=Q[Z*3+1],F=Q[Z*3+2],E=Q[W*3],O=Q[W*3+1],R=Q[W*3+2],k=Q[Y*3],q=Q[Y*3+1],N=Q[Y*3+2];if(Math.abs(K-G)<Math.abs(X-U))return[new i(X,1-H),new i(U,1-F),new i(E,1-R),new i(k,1-N)];else return[new i(K,1-H),new i(G,1-F),new i(O,1-R),new i(q,1-N)]}};function oF(J,Q,$){if($.shapes=[],Array.isArray(J))for(let Z=0,W=J.length;Z<W;Z++){let Y=J[Z];$.shapes.push(Y.uuid)}else $.shapes.push(J.uuid);if($.options=Object.assign({},Q),Q.extrudePath!==void 0)$.options.extrudePath=Q.extrudePath.toJSON();return $}class h6 extends T8{constructor(J=1,Q=0){let $=(1+Math.sqrt(5))/2,Z=[-1,$,0,1,$,0,-1,-$,0,1,-$,0,0,-1,$,0,1,$,0,-1,-$,0,1,-$,$,0,-1,$,0,1,-$,0,-1,-$,0,1],W=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(Z,W,J,Q);this.type="IcosahedronGeometry",this.parameters={radius:J,detail:Q}}static fromJSON(J){return new h6(J.radius,J.detail)}}class tQ extends u0{constructor(J=[new i(0,-0.5),new i(0.5,0),new i(0,0.5)],Q=12,$=0,Z=Math.PI*2){super();this.type="LatheGeometry",this.parameters={points:J,segments:Q,phiStart:$,phiLength:Z},Q=Math.floor(Q),Z=s0(Z,0,Math.PI*2);let W=[],Y=[],X=[],K=[],H=[],U=1/Q,G=new T,F=new i,E=new T,O=new T,R=new T,k=0,q=0;for(let N=0;N<=J.length-1;N++)switch(N){case 0:k=J[N+1].x-J[N].x,q=J[N+1].y-J[N].y,E.x=q*1,E.y=-k,E.z=q*0,R.copy(E),E.normalize(),K.push(E.x,E.y,E.z);break;case J.length-1:K.push(R.x,R.y,R.z);break;default:k=J[N+1].x-J[N].x,q=J[N+1].y-J[N].y,E.x=q*1,E.y=-k,E.z=q*0,O.copy(E),E.x+=R.x,E.y+=R.y,E.z+=R.z,E.normalize(),K.push(E.x,E.y,E.z),R.copy(O)}for(let N=0;N<=Q;N++){let L=$+N*U*Z,D=Math.sin(L),V=Math.cos(L);for(let I=0;I<=J.length-1;I++){G.x=J[I].x*D,G.y=J[I].y,G.z=J[I].x*V,Y.push(G.x,G.y,G.z),F.x=N/Q,F.y=I/(J.length-1),X.push(F.x,F.y);let z=K[3*I+0]*D,B=K[3*I+1],M=K[3*I+0]*V;H.push(z,B,M)}}for(let N=0;N<Q;N++)for(let L=0;L<J.length-1;L++){let D=L+N*J.length,V=D,I=D+J.length,z=D+J.length+1,B=D+1;W.push(V,I,B),W.push(z,B,I)}this.setIndex(W),this.setAttribute("position",new I0(Y,3)),this.setAttribute("uv",new I0(X,2)),this.setAttribute("normal",new I0(H,3))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new tQ(J.points,J.segments,J.phiStart,J.phiLength)}}class m7 extends T8{constructor(J=1,Q=0){let $=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],Z=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super($,Z,J,Q);this.type="OctahedronGeometry",this.parameters={radius:J,detail:Q}}static fromJSON(J){return new m7(J.radius,J.detail)}}class C9 extends u0{constructor(J=1,Q=1,$=1,Z=1){super();this.type="PlaneGeometry",this.parameters={width:J,height:Q,widthSegments:$,heightSegments:Z};let W=J/2,Y=Q/2,X=Math.floor($),K=Math.floor(Z),H=X+1,U=K+1,G=J/X,F=Q/K,E=[],O=[],R=[],k=[];for(let q=0;q<U;q++){let N=q*F-Y;for(let L=0;L<H;L++){let D=L*G-W;O.push(D,-N,0),R.push(0,0,1),k.push(L/X),k.push(1-q/K)}}for(let q=0;q<K;q++)for(let N=0;N<X;N++){let L=N+H*q,D=N+H*(q+1),V=N+1+H*(q+1),I=N+1+H*q;E.push(L,D,I),E.push(D,V,I)}this.setIndex(E),this.setAttribute("position",new I0(O,3)),this.setAttribute("normal",new I0(R,3)),this.setAttribute("uv",new I0(k,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new C9(J.width,J.height,J.widthSegments,J.heightSegments)}}class eQ extends u0{constructor(J=0.5,Q=1,$=32,Z=1,W=0,Y=Math.PI*2){super();this.type="RingGeometry",this.parameters={innerRadius:J,outerRadius:Q,thetaSegments:$,phiSegments:Z,thetaStart:W,thetaLength:Y},$=Math.max(3,$),Z=Math.max(1,Z);let X=[],K=[],H=[],U=[],G=J,F=(Q-J)/Z,E=new T,O=new i;for(let R=0;R<=Z;R++){for(let k=0;k<=$;k++){let q=W+k/$*Y;E.x=G*Math.cos(q),E.y=G*Math.sin(q),K.push(E.x,E.y,E.z),H.push(0,0,1),O.x=(E.x/Q+1)/2,O.y=(E.y/Q+1)/2,U.push(O.x,O.y)}G+=F}for(let R=0;R<Z;R++){let k=R*($+1);for(let q=0;q<$;q++){let N=q+k,L=N,D=N+$+1,V=N+$+2,I=N+1;X.push(L,D,I),X.push(D,V,I)}}this.setIndex(X),this.setAttribute("position",new I0(K,3)),this.setAttribute("normal",new I0(H,3)),this.setAttribute("uv",new I0(U,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new eQ(J.innerRadius,J.outerRadius,J.thetaSegments,J.phiSegments,J.thetaStart,J.thetaLength)}}class J$ extends u0{constructor(J=new B8([new i(0,0.5),new i(-0.5,-0.5),new i(0.5,-0.5)]),Q=12){super();this.type="ShapeGeometry",this.parameters={shapes:J,curveSegments:Q};let $=[],Z=[],W=[],Y=[],X=0,K=0;if(Array.isArray(J)===!1)H(J);else for(let U=0;U<J.length;U++)H(J[U]),this.addGroup(X,K,U),X+=K,K=0;this.setIndex($),this.setAttribute("position",new I0(Z,3)),this.setAttribute("normal",new I0(W,3)),this.setAttribute("uv",new I0(Y,2));function H(U){let G=Z.length/3,F=U.extractPoints(Q),E=F.shape,O=F.holes;if(w9.isClockWise(E)===!1)E=E.reverse();for(let k=0,q=O.length;k<q;k++){let N=O[k];if(w9.isClockWise(N)===!0)O[k]=N.reverse()}let R=w9.triangulateShape(E,O);for(let k=0,q=O.length;k<q;k++){let N=O[k];E=E.concat(N)}for(let k=0,q=E.length;k<q;k++){let N=E[k];Z.push(N.x,N.y,0),W.push(0,0,1),Y.push(N.x,N.y)}for(let k=0,q=R.length;k<q;k++){let N=R[k],L=N[0]+G,D=N[1]+G,V=N[2]+G;$.push(L,D,V),K+=3}}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}toJSON(){let J=super.toJSON(),Q=this.parameters.shapes;return aF(Q,J)}static fromJSON(J,Q){let $=[];for(let Z=0,W=J.shapes.length;Z<W;Z++){let Y=Q[J.shapes[Z]];$.push(Y)}return new J$($,J.curveSegments)}}function aF(J,Q){if(Q.shapes=[],Array.isArray(J))for(let $=0,Z=J.length;$<Z;$++){let W=J[$];Q.shapes.push(W.uuid)}else Q.shapes.push(J.uuid);return Q}class $6 extends u0{constructor(J=1,Q=32,$=16,Z=0,W=Math.PI*2,Y=0,X=Math.PI){super();this.type="SphereGeometry",this.parameters={radius:J,widthSegments:Q,heightSegments:$,phiStart:Z,phiLength:W,thetaStart:Y,thetaLength:X},Q=Math.max(3,Math.floor(Q)),$=Math.max(2,Math.floor($));let K=Math.min(Y+X,Math.PI),H=0,U=[],G=new T,F=new T,E=[],O=[],R=[],k=[];for(let q=0;q<=$;q++){let N=[],L=q/$,D=0;if(q===0&&Y===0)D=0.5/Q;else if(q===$&&K===Math.PI)D=-0.5/Q;for(let V=0;V<=Q;V++){let I=V/Q;G.x=-J*Math.cos(Z+I*W)*Math.sin(Y+L*X),G.y=J*Math.cos(Y+L*X),G.z=J*Math.sin(Z+I*W)*Math.sin(Y+L*X),O.push(G.x,G.y,G.z),F.copy(G).normalize(),R.push(F.x,F.y,F.z),k.push(I+D,1-L),N.push(H++)}U.push(N)}for(let q=0;q<$;q++)for(let N=0;N<Q;N++){let L=U[q][N+1],D=U[q][N],V=U[q+1][N],I=U[q+1][N+1];if(q!==0||Y>0)E.push(L,D,I);if(q!==$-1||K<Math.PI)E.push(D,V,I)}this.setIndex(E),this.setAttribute("position",new I0(O,3)),this.setAttribute("normal",new I0(R,3)),this.setAttribute("uv",new I0(k,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new $6(J.radius,J.widthSegments,J.heightSegments,J.phiStart,J.phiLength,J.thetaStart,J.thetaLength)}}class Q$ extends T8{constructor(J=1,Q=0){let $=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],Z=[2,1,0,0,3,2,1,3,0,2,3,1];super($,Z,J,Q);this.type="TetrahedronGeometry",this.parameters={radius:J,detail:Q}}static fromJSON(J){return new Q$(J.radius,J.detail)}}class f6 extends u0{constructor(J=1,Q=0.4,$=12,Z=48,W=Math.PI*2,Y=0,X=Math.PI*2){super();this.type="TorusGeometry",this.parameters={radius:J,tube:Q,radialSegments:$,tubularSegments:Z,arc:W,thetaStart:Y,thetaLength:X},$=Math.floor($),Z=Math.floor(Z);let K=[],H=[],U=[],G=[],F=new T,E=new T,O=new T;for(let R=0;R<=$;R++){let k=Y+R/$*X;for(let q=0;q<=Z;q++){let N=q/Z*W;E.x=(J+Q*Math.cos(k))*Math.cos(N),E.y=(J+Q*Math.cos(k))*Math.sin(N),E.z=Q*Math.sin(k),H.push(E.x,E.y,E.z),F.x=J*Math.cos(N),F.y=J*Math.sin(N),O.subVectors(E,F).normalize(),U.push(O.x,O.y,O.z),G.push(q/Z),G.push(R/$)}}for(let R=1;R<=$;R++)for(let k=1;k<=Z;k++){let q=(Z+1)*R+k-1,N=(Z+1)*(R-1)+k-1,L=(Z+1)*(R-1)+k,D=(Z+1)*R+k;K.push(q,N,D),K.push(N,L,D)}this.setIndex(K),this.setAttribute("position",new I0(H,3)),this.setAttribute("normal",new I0(U,3)),this.setAttribute("uv",new I0(G,2))}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new f6(J.radius,J.tube,J.radialSegments,J.tubularSegments,J.arc)}}class $$ extends u0{constructor(J=1,Q=0.4,$=64,Z=8,W=2,Y=3){super();this.type="TorusKnotGeometry",this.parameters={radius:J,tube:Q,tubularSegments:$,radialSegments:Z,p:W,q:Y},$=Math.floor($),Z=Math.floor(Z);let X=[],K=[],H=[],U=[],G=new T,F=new T,E=new T,O=new T,R=new T,k=new T,q=new T;for(let L=0;L<=$;++L){let D=L/$*W*Math.PI*2;N(D,W,Y,J,E),N(D+0.01,W,Y,J,O),k.subVectors(O,E),q.addVectors(O,E),R.crossVectors(k,q),q.crossVectors(R,k),R.normalize(),q.normalize();for(let V=0;V<=Z;++V){let I=V/Z*Math.PI*2,z=-Q*Math.cos(I),B=Q*Math.sin(I);G.x=E.x+(z*q.x+B*R.x),G.y=E.y+(z*q.y+B*R.y),G.z=E.z+(z*q.z+B*R.z),K.push(G.x,G.y,G.z),F.subVectors(G,E).normalize(),H.push(F.x,F.y,F.z),U.push(L/$),U.push(V/Z)}}for(let L=1;L<=$;L++)for(let D=1;D<=Z;D++){let V=(Z+1)*(L-1)+(D-1),I=(Z+1)*L+(D-1),z=(Z+1)*L+D,B=(Z+1)*(L-1)+D;X.push(V,I,B),X.push(I,z,B)}this.setIndex(X),this.setAttribute("position",new I0(K,3)),this.setAttribute("normal",new I0(H,3)),this.setAttribute("uv",new I0(U,2));function N(L,D,V,I,z){let B=Math.cos(L),M=Math.sin(L),C=V/D*L,j=Math.cos(C);z.x=I*(2+j)*0.5*B,z.y=I*(2+j)*M*0.5,z.z=I*Math.sin(C)*0.5}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}static fromJSON(J){return new $$(J.radius,J.tube,J.tubularSegments,J.radialSegments,J.p,J.q)}}class Z$ extends u0{constructor(J=new oQ(new T(-1,-1,0),new T(-1,1,0),new T(1,1,0)),Q=64,$=1,Z=8,W=!1){super();this.type="TubeGeometry",this.parameters={path:J,tubularSegments:Q,radius:$,radialSegments:Z,closed:W};let Y=J.computeFrenetFrames(Q,W);this.tangents=Y.tangents,this.normals=Y.normals,this.binormals=Y.binormals;let X=new T,K=new T,H=new i,U=new T,G=[],F=[],E=[],O=[];R(),this.setIndex(O),this.setAttribute("position",new I0(G,3)),this.setAttribute("normal",new I0(F,3)),this.setAttribute("uv",new I0(E,2));function R(){for(let L=0;L<Q;L++)k(L);k(W===!1?Q:0),N(),q()}function k(L){U=J.getPointAt(L/Q,U);let D=Y.normals[L],V=Y.binormals[L];for(let I=0;I<=Z;I++){let z=I/Z*Math.PI*2,B=Math.sin(z),M=-Math.cos(z);K.x=M*D.x+B*V.x,K.y=M*D.y+B*V.y,K.z=M*D.z+B*V.z,K.normalize(),F.push(K.x,K.y,K.z),X.x=U.x+$*K.x,X.y=U.y+$*K.y,X.z=U.z+$*K.z,G.push(X.x,X.y,X.z)}}function q(){for(let L=1;L<=Q;L++)for(let D=1;D<=Z;D++){let V=(Z+1)*(L-1)+(D-1),I=(Z+1)*L+(D-1),z=(Z+1)*L+D,B=(Z+1)*(L-1)+D;O.push(V,I,B),O.push(I,z,B)}}function N(){for(let L=0;L<=Q;L++)for(let D=0;D<=Z;D++)H.x=L/Q,H.y=D/Z,E.push(H.x,H.y)}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}toJSON(){let J=super.toJSON();return J.path=this.parameters.path.toJSON(),J}static fromJSON(J){return new Z$(new kZ[J.path.type]().fromJSON(J.path),J.tubularSegments,J.radius,J.radialSegments,J.closed)}}class CW extends u0{constructor(J=null){super();if(this.type="WireframeGeometry",this.parameters={geometry:J},J!==null){let Q=[],$=new Set,Z=new T,W=new T;if(J.index!==null){let Y=J.attributes.position,X=J.index,K=J.groups;if(K.length===0)K=[{start:0,count:X.count,materialIndex:0}];for(let H=0,U=K.length;H<U;++H){let G=K[H],F=G.start,E=G.count;for(let O=F,R=F+E;O<R;O+=3)for(let k=0;k<3;k++){let q=X.getX(O+k),N=X.getX(O+(k+1)%3);if(Z.fromBufferAttribute(Y,q),W.fromBufferAttribute(Y,N),_U(Z,W,$)===!0)Q.push(Z.x,Z.y,Z.z),Q.push(W.x,W.y,W.z)}}}else{let Y=J.attributes.position;for(let X=0,K=Y.count/3;X<K;X++)for(let H=0;H<3;H++){let U=3*X+H,G=3*X+(H+1)%3;if(Z.fromBufferAttribute(Y,U),W.fromBufferAttribute(Y,G),_U(Z,W,$)===!0)Q.push(Z.x,Z.y,Z.z),Q.push(W.x,W.y,W.z)}}this.setAttribute("position",new I0(Q,3))}}copy(J){return super.copy(J),this.parameters=Object.assign({},J.parameters),this}}function _U(J,Q,$){let Z=`${J.x},${J.y},${J.z}-${Q.x},${Q.y},${Q.z}`,W=`${Q.x},${Q.y},${Q.z}-${J.x},${J.y},${J.z}`;if($.has(Z)===!0||$.has(W)===!0)return!1;else return $.add(Z),$.add(W),!0}var wU=Object.freeze({__proto__:null,BoxGeometry:J9,CapsuleGeometry:mQ,CircleGeometry:lQ,ConeGeometry:p7,CylinderGeometry:Q6,DodecahedronGeometry:cQ,EdgesGeometry:DW,ExtrudeGeometry:rQ,IcosahedronGeometry:h6,LatheGeometry:tQ,OctahedronGeometry:m7,PlaneGeometry:C9,PolyhedronGeometry:T8,RingGeometry:eQ,ShapeGeometry:J$,SphereGeometry:$6,TetrahedronGeometry:Q$,TorusGeometry:f6,TorusKnotGeometry:$$,TubeGeometry:Z$,WireframeGeometry:CW});class IW extends vJ{constructor(J){super();this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new e(0),this.transparent=!0,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.fog=J.fog,this}}function g6(J){let Q={};for(let $ in J){Q[$]={};for(let Z in J[$]){let W=J[$][Z];if(PU(W))if(W.isRenderTargetTexture)O0("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),Q[$][Z]=null;else Q[$][Z]=W.clone();else if(Array.isArray(W))if(PU(W[0])){let Y=[];for(let X=0,K=W.length;X<K;X++)Y[X]=W[X].clone();Q[$][Z]=Y}else Q[$][Z]=W.slice();else Q[$][Z]=W}}return Q}function Q9(J){let Q={};for(let $=0;$<J.length;$++){let Z=g6(J[$]);for(let W in Z)Q[W]=Z[W]}return Q}function PU(J){return J&&(J.isColor||J.isMatrix3||J.isMatrix4||J.isVector2||J.isVector3||J.isVector4||J.isTexture||J.isQuaternion)}function rF(J){let Q=[];for(let $=0;$<J.length;$++)Q.push(J[$].clone());return Q}function FK(J){let Q=J.getRenderTarget();if(Q===null)return J.outputColorSpace;if(Q.isXRRenderTarget===!0)return Q.texture.colorSpace;return t0.workingColorSpace}var X9={clone:g6,merge:Q9},tF=`void main() {
2
2
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3
- }`,JU=`void main() {
3
+ }`,eF=`void main() {
4
4
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
5
- }`;class SJ extends eJ{constructor(J){super();if(this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=eH,this.fragmentShader=JU,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,J!==void 0)this.setValues(J)}copy(J){return super.copy(J),this.fragmentShader=J.fragmentShader,this.vertexShader=J.vertexShader,this.uniforms=S8(J.uniforms),this.uniformsGroups=tH(J.uniformsGroups),this.defines=Object.assign({},J.defines),this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.fog=J.fog,this.lights=J.lights,this.clipping=J.clipping,this.extensions=Object.assign({},J.extensions),this.glslVersion=J.glslVersion,this.defaultAttributeValues=Object.assign({},J.defaultAttributeValues),this.index0AttributeName=J.index0AttributeName,this.uniformsNeedUpdate=J.uniformsNeedUpdate,this}toJSON(J){let Q=super.toJSON(J);Q.glslVersion=this.glslVersion,Q.uniforms={};for(let Z in this.uniforms){let Y=this.uniforms[Z].value;if(Y&&Y.isTexture)Q.uniforms[Z]={type:"t",value:Y.toJSON(J).uuid};else if(Y&&Y.isColor)Q.uniforms[Z]={type:"c",value:Y.getHex()};else if(Y&&Y.isVector2)Q.uniforms[Z]={type:"v2",value:Y.toArray()};else if(Y&&Y.isVector3)Q.uniforms[Z]={type:"v3",value:Y.toArray()};else if(Y&&Y.isVector4)Q.uniforms[Z]={type:"v4",value:Y.toArray()};else if(Y&&Y.isMatrix3)Q.uniforms[Z]={type:"m3",value:Y.toArray()};else if(Y&&Y.isMatrix4)Q.uniforms[Z]={type:"m4",value:Y.toArray()};else Q.uniforms[Z]={value:Y}}if(Object.keys(this.defines).length>0)Q.defines=this.defines;Q.vertexShader=this.vertexShader,Q.fragmentShader=this.fragmentShader,Q.lights=this.lights,Q.clipping=this.clipping;let $={};for(let Z in this.extensions)if(this.extensions[Z]===!0)$[Z]=!0;if(Object.keys($).length>0)Q.extensions=$;return Q}}class DZ extends SJ{constructor(J){super(J);this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class X9 extends eJ{constructor(J){super();this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new R0(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new R0(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new p0(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new l9,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.defines={STANDARD:""},this.color.copy(J.color),this.roughness=J.roughness,this.metalness=J.metalness,this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.emissive.copy(J.emissive),this.emissiveMap=J.emissiveMap,this.emissiveIntensity=J.emissiveIntensity,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.roughnessMap=J.roughnessMap,this.metalnessMap=J.metalnessMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.envMapIntensity=J.envMapIntensity,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.flatShading=J.flatShading,this.fog=J.fog,this}}class lJ extends X9{constructor(J){super();this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new p0(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return m0(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(Q){this.ior=(1+0.4*Q)/(1-0.4*Q)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new R0(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new R0(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new R0(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(J)}get anisotropy(){return this._anisotropy}set anisotropy(J){if(this._anisotropy>0!==J>0)this.version++;this._anisotropy=J}get clearcoat(){return this._clearcoat}set clearcoat(J){if(this._clearcoat>0!==J>0)this.version++;this._clearcoat=J}get iridescence(){return this._iridescence}set iridescence(J){if(this._iridescence>0!==J>0)this.version++;this._iridescence=J}get dispersion(){return this._dispersion}set dispersion(J){if(this._dispersion>0!==J>0)this.version++;this._dispersion=J}get sheen(){return this._sheen}set sheen(J){if(this._sheen>0!==J>0)this.version++;this._sheen=J}get transmission(){return this._transmission}set transmission(J){if(this._transmission>0!==J>0)this.version++;this._transmission=J}copy(J){return super.copy(J),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=J.anisotropy,this.anisotropyRotation=J.anisotropyRotation,this.anisotropyMap=J.anisotropyMap,this.clearcoat=J.clearcoat,this.clearcoatMap=J.clearcoatMap,this.clearcoatRoughness=J.clearcoatRoughness,this.clearcoatRoughnessMap=J.clearcoatRoughnessMap,this.clearcoatNormalMap=J.clearcoatNormalMap,this.clearcoatNormalScale.copy(J.clearcoatNormalScale),this.dispersion=J.dispersion,this.ior=J.ior,this.iridescence=J.iridescence,this.iridescenceMap=J.iridescenceMap,this.iridescenceIOR=J.iridescenceIOR,this.iridescenceThicknessRange=[...J.iridescenceThicknessRange],this.iridescenceThicknessMap=J.iridescenceThicknessMap,this.sheen=J.sheen,this.sheenColor.copy(J.sheenColor),this.sheenColorMap=J.sheenColorMap,this.sheenRoughness=J.sheenRoughness,this.sheenRoughnessMap=J.sheenRoughnessMap,this.transmission=J.transmission,this.transmissionMap=J.transmissionMap,this.thickness=J.thickness,this.thicknessMap=J.thicknessMap,this.attenuationDistance=J.attenuationDistance,this.attenuationColor.copy(J.attenuationColor),this.specularIntensity=J.specularIntensity,this.specularIntensityMap=J.specularIntensityMap,this.specularColor.copy(J.specularColor),this.specularColorMap=J.specularColorMap,this}}class MZ extends eJ{constructor(J){super();this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(J)}copy(J){return super.copy(J),this.depthPacking=J.depthPacking,this.map=J.map,this.alphaMap=J.alphaMap,this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this}}class kZ extends eJ{constructor(J){super();this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(J)}copy(J){return super.copy(J),this.map=J.map,this.alphaMap=J.alphaMap,this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this}}function x7(J,Q){if(!J||J.constructor===Q)return J;if(typeof Q.BYTES_PER_ELEMENT==="number")return new Q(J);return Array.prototype.slice.call(J)}function QU(J){function Q(W,Y){return J[W]-J[Y]}let $=J.length,Z=Array($);for(let W=0;W!==$;++W)Z[W]=W;return Z.sort(Q),Z}function aW(J,Q,$){let Z=J.length,W=new J.constructor(Z);for(let Y=0,X=0;X!==Z;++Y){let K=$[Y]*Q;for(let H=0;H!==Q;++H)W[X++]=J[K+H]}return W}function QX(J,Q,$,Z){let W=1,Y=J[0];while(Y!==void 0&&Y[Z]===void 0)Y=J[W++];if(Y===void 0)return;let X=Y[Z];if(X===void 0)return;if(Array.isArray(X))do{if(X=Y[Z],X!==void 0)Q.push(Y.time),$.push(...X);Y=J[W++]}while(Y!==void 0);else if(X.toArray!==void 0)do{if(X=Y[Z],X!==void 0)Q.push(Y.time),X.toArray($,$.length);Y=J[W++]}while(Y!==void 0);else do{if(X=Y[Z],X!==void 0)Q.push(Y.time),$.push(X);Y=J[W++]}while(Y!==void 0)}class i9{constructor(J,Q,$,Z){this.parameterPositions=J,this._cachedIndex=0,this.resultBuffer=Z!==void 0?Z:new Q.constructor($),this.sampleValues=Q,this.valueSize=$,this.settings=null,this.DefaultSettings_={}}evaluate(J){let Q=this.parameterPositions,$=this._cachedIndex,Z=Q[$],W=Q[$-1];J:{Q:{let Y;$:{Z:if(!(J<Z)){for(let X=$+2;;){if(Z===void 0){if(J<W)break Z;return $=Q.length,this._cachedIndex=$,this.copySampleValue_($-1)}if($===X)break;if(W=Z,Z=Q[++$],J<Z)break Q}Y=Q.length;break $}if(!(J>=W)){let X=Q[1];if(J<X)$=2,W=X;for(let K=$-2;;){if(W===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if($===K)break;if(Z=W,W=Q[--$-1],J>=W)break Q}Y=$,$=0;break $}break J}while($<Y){let X=$+Y>>>1;if(J<Q[X])Y=X;else $=X+1}if(Z=Q[$],W=Q[$-1],W===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(Z===void 0)return $=Q.length,this._cachedIndex=$,this.copySampleValue_($-1)}this._cachedIndex=$,this.intervalChanged_($,W,Z)}return this.interpolate_($,W,J,Z)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(J){let Q=this.resultBuffer,$=this.sampleValues,Z=this.valueSize,W=J*Z;for(let Y=0;Y!==Z;++Y)Q[Y]=$[W+Y];return Q}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}}class BZ extends i9{constructor(J,Q,$,Z){super(J,Q,$,Z);this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(J,Q,$){let Z=this.parameterPositions,W=J-2,Y=J+1,X=Z[W],K=Z[Y];if(X===void 0)switch(this.getSettings_().endingStart){case 2401:W=J,X=2*Q-$;break;case 2402:W=Z.length-2,X=Q+Z[W]-Z[W+1];break;default:W=J,X=$}if(K===void 0)switch(this.getSettings_().endingEnd){case 2401:Y=J,K=2*$-Q;break;case 2402:Y=1,K=$+Z[1]-Z[0];break;default:Y=J-1,K=Q}let H=($-Q)*0.5,U=this.valueSize;this._weightPrev=H/(Q-X),this._weightNext=H/(K-$),this._offsetPrev=W*U,this._offsetNext=Y*U}interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=J*X,H=K-X,U=this._offsetPrev,G=this._offsetNext,F=this._weightPrev,E=this._weightNext,O=($-Q)/(Z-Q),R=O*O,C=R*O,q=-F*C+2*F*R-F*O,N=(1+F)*C+(-1.5-2*F)*R+(-0.5+F)*O+1,L=(-1-E)*C+(1.5+E)*R+0.5*O,M=E*C-E*R;for(let k=0;k!==X;++k)W[k]=q*Y[U+k]+N*Y[H+k]+L*Y[K+k]+M*Y[G+k];return W}}class NQ extends i9{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=J*X,H=K-X,U=($-Q)/(Z-Q),G=1-U;for(let F=0;F!==X;++F)W[F]=Y[H+F]*G+Y[K+F]*U;return W}}class VZ extends i9{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J){return this.copySampleValue_(J-1)}}class CZ extends i9{interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=J*X,H=K-X,U=this.settings||this.DefaultSettings_,G=U.inTangents,F=U.outTangents;if(!G||!F){let R=($-Q)/(Z-Q),C=1-R;for(let q=0;q!==X;++q)W[q]=Y[H+q]*C+Y[K+q]*R;return W}let E=X*2,O=J-1;for(let R=0;R!==X;++R){let C=Y[H+R],q=Y[K+R],N=O*E+R*2,L=F[N],M=F[N+1],k=J*E+R*2,_=G[k],P=G[k+1],V=($-Q)/(Z-Q),D,B,A,z,S;for(let y=0;y<8;y++){D=V*V,B=D*V,A=1-V,z=A*A,S=z*A;let h=S*Q+3*z*V*L+3*A*D*_+B*Z-$;if(Math.abs(h)<0.0000000001)break;let g=3*z*(L-Q)+6*A*V*(_-L)+3*D*(Z-_);if(Math.abs(g)<0.0000000001)break;V=V-h/g,V=Math.max(0,Math.min(1,V))}W[R]=S*C+3*z*V*M+3*A*D*P+B*q}return W}}class J9{constructor(J,Q,$,Z){if(J===void 0)throw Error("THREE.KeyframeTrack: track name is undefined");if(Q===void 0||Q.length===0)throw Error("THREE.KeyframeTrack: no keyframes in track named "+J);this.name=J,this.times=x7(Q,this.TimeBufferType),this.values=x7($,this.ValueBufferType),this.setInterpolation(Z||this.DefaultInterpolation)}static toJSON(J){let Q=J.constructor,$;if(Q.toJSON!==this.toJSON)$=Q.toJSON(J);else{$={name:J.name,times:x7(J.times,Array),values:x7(J.values,Array)};let Z=J.getInterpolation();if(Z!==J.DefaultInterpolation)$.interpolation=Z}return $.type=J.ValueTypeName,$}InterpolantFactoryMethodDiscrete(J){return new VZ(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodLinear(J){return new NQ(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodSmooth(J){return new BZ(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodBezier(J){let Q=new CZ(this.times,this.values,this.getValueSize(),J);if(this.settings)Q.settings=this.settings;return Q}setInterpolation(J){let Q;switch(J){case 2300:Q=this.InterpolantFactoryMethodDiscrete;break;case 2301:Q=this.InterpolantFactoryMethodLinear;break;case 2302:Q=this.InterpolantFactoryMethodSmooth;break;case 2303:Q=this.InterpolantFactoryMethodBezier;break}if(Q===void 0){let $="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(J!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error($);return C0("KeyframeTrack:",$),this}return this.createInterpolant=Q,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302;case this.InterpolantFactoryMethodBezier:return 2303}}getValueSize(){return this.values.length/this.times.length}shift(J){if(J!==0){let Q=this.times;for(let $=0,Z=Q.length;$!==Z;++$)Q[$]+=J}return this}scale(J){if(J!==1){let Q=this.times;for(let $=0,Z=Q.length;$!==Z;++$)Q[$]*=J}return this}trim(J,Q){let $=this.times,Z=$.length,W=0,Y=Z-1;while(W!==Z&&$[W]<J)++W;while(Y!==-1&&$[Y]>Q)--Y;if(++Y,W!==0||Y!==Z){if(W>=Y)Y=Math.max(Y,1),W=Y-1;let X=this.getValueSize();this.times=$.slice(W,Y),this.values=this.values.slice(W*X,Y*X)}return this}validate(){let J=!0,Q=this.getValueSize();if(Q-Math.floor(Q)!==0)A0("KeyframeTrack: Invalid value size in track.",this),J=!1;let $=this.times,Z=this.values,W=$.length;if(W===0)A0("KeyframeTrack: Track is empty.",this),J=!1;let Y=null;for(let X=0;X!==W;X++){let K=$[X];if(typeof K==="number"&&isNaN(K)){A0("KeyframeTrack: Time is not a valid number.",this,X,K),J=!1;break}if(Y!==null&&Y>K){A0("KeyframeTrack: Out of order keys.",this,X,K,Y),J=!1;break}Y=K}if(Z!==void 0){if(EH(Z))for(let X=0,K=Z.length;X!==K;++X){let H=Z[X];if(isNaN(H)){A0("KeyframeTrack: Value is not a valid number.",this,X,H),J=!1;break}}}return J}optimize(){let J=this.times.slice(),Q=this.values.slice(),$=this.getValueSize(),Z=this.getInterpolation()===2302,W=J.length-1,Y=1;for(let X=1;X<W;++X){let K=!1,H=J[X],U=J[X+1];if(H!==U&&(X!==1||H!==J[0]))if(!Z){let G=X*$,F=G-$,E=G+$;for(let O=0;O!==$;++O){let R=Q[G+O];if(R!==Q[F+O]||R!==Q[E+O]){K=!0;break}}}else K=!0;if(K){if(X!==Y){J[Y]=J[X];let G=X*$,F=Y*$;for(let E=0;E!==$;++E)Q[F+E]=Q[G+E]}++Y}}if(W>0){J[Y]=J[W];for(let X=W*$,K=Y*$,H=0;H!==$;++H)Q[K+H]=Q[X+H];++Y}if(Y!==J.length)this.times=J.slice(0,Y),this.values=Q.slice(0,Y*$);else this.times=J,this.values=Q;return this}clone(){let J=this.times.slice(),Q=this.values.slice(),Z=new this.constructor(this.name,J,Q);return Z.createInterpolant=this.createInterpolant,Z}}J9.prototype.ValueTypeName="";J9.prototype.TimeBufferType=Float32Array;J9.prototype.ValueBufferType=Float32Array;J9.prototype.DefaultInterpolation=2301;class G8 extends J9{constructor(J,Q,$){super(J,Q,$)}}G8.prototype.ValueTypeName="bool";G8.prototype.ValueBufferType=Array;G8.prototype.DefaultInterpolation=2300;G8.prototype.InterpolantFactoryMethodLinear=void 0;G8.prototype.InterpolantFactoryMethodSmooth=void 0;class OQ extends J9{constructor(J,Q,$,Z){super(J,Q,$,Z)}}OQ.prototype.ValueTypeName="color";class c9 extends J9{constructor(J,Q,$,Z){super(J,Q,$,Z)}}c9.prototype.ValueTypeName="number";class IZ extends i9{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=($-Q)/(Z-Q),H=J*X;for(let U=H+X;H!==U;H+=4)PJ.slerpFlat(W,0,Y,H-X,Y,H,K);return W}}class o9 extends J9{constructor(J,Q,$,Z){super(J,Q,$,Z)}InterpolantFactoryMethodLinear(J){return new IZ(this.times,this.values,this.getValueSize(),J)}}o9.prototype.ValueTypeName="quaternion";o9.prototype.InterpolantFactoryMethodSmooth=void 0;class E8 extends J9{constructor(J,Q,$){super(J,Q,$)}}E8.prototype.ValueTypeName="string";E8.prototype.ValueBufferType=Array;E8.prototype.DefaultInterpolation=2300;E8.prototype.InterpolantFactoryMethodLinear=void 0;E8.prototype.InterpolantFactoryMethodSmooth=void 0;class n9 extends J9{constructor(J,Q,$,Z){super(J,Q,$,Z)}}n9.prototype.ValueTypeName="vector";class $6{constructor(J="",Q=-1,$=[],Z=2500){if(this.name=J,this.tracks=$,this.duration=Q,this.blendMode=Z,this.uuid=R9(),this.userData={},this.duration<0)this.resetDuration()}static parse(J){let Q=[],$=J.tracks,Z=1/(J.fps||1);for(let Y=0,X=$.length;Y!==X;++Y)Q.push(ZU($[Y]).scale(Z));let W=new this(J.name,J.duration,Q,J.blendMode);return W.uuid=J.uuid,W.userData=JSON.parse(J.userData||"{}"),W}static toJSON(J){let Q=[],$=J.tracks,Z={name:J.name,duration:J.duration,tracks:Q,uuid:J.uuid,blendMode:J.blendMode,userData:JSON.stringify(J.userData)};for(let W=0,Y=$.length;W!==Y;++W)Q.push(J9.toJSON($[W]));return Z}static CreateFromMorphTargetSequence(J,Q,$,Z){let W=Q.length,Y=[];for(let X=0;X<W;X++){let K=[],H=[];K.push((X+W-1)%W,X,(X+1)%W),H.push(0,1,0);let U=QU(K);if(K=aW(K,1,U),H=aW(H,1,U),!Z&&K[0]===0)K.push(W),H.push(H[0]);Y.push(new c9(".morphTargetInfluences["+Q[X].name+"]",K,H).scale(1/$))}return new this(J,-1,Y)}static findByName(J,Q){let $=J;if(!Array.isArray(J)){let Z=J;$=Z.geometry&&Z.geometry.animations||Z.animations}for(let Z=0;Z<$.length;Z++)if($[Z].name===Q)return $[Z];return null}static CreateClipsFromMorphTargetSequences(J,Q,$){let Z={},W=/^([\w-]*?)([\d]+)$/;for(let X=0,K=J.length;X<K;X++){let H=J[X],U=H.name.match(W);if(U&&U.length>1){let G=U[1],F=Z[G];if(!F)Z[G]=F=[];F.push(H)}}let Y=[];for(let X in Z)Y.push(this.CreateFromMorphTargetSequence(X,Z[X],Q,$));return Y}static parseAnimation(J,Q){if(C0("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!J)return A0("AnimationClip: No animation in JSONLoader data."),null;let $=function(G,F,E,O,R){if(E.length!==0){let C=[],q=[];if(QX(E,C,q,O),C.length!==0)R.push(new G(F,C,q))}},Z=[],W=J.name||"default",Y=J.fps||30,X=J.blendMode,K=J.length||-1,H=J.hierarchy||[];for(let G=0;G<H.length;G++){let F=H[G].keys;if(!F||F.length===0)continue;if(F[0].morphTargets){let E={},O;for(O=0;O<F.length;O++)if(F[O].morphTargets)for(let R=0;R<F[O].morphTargets.length;R++)E[F[O].morphTargets[R]]=-1;for(let R in E){let C=[],q=[];for(let N=0;N!==F[O].morphTargets.length;++N){let L=F[O];C.push(L.time),q.push(L.morphTarget===R?1:0)}Z.push(new c9(".morphTargetInfluence["+R+"]",C,q))}K=E.length*Y}else{let E=".bones["+Q[G].name+"]";$(n9,E+".position",F,"pos",Z),$(o9,E+".quaternion",F,"rot",Z),$(n9,E+".scale",F,"scl",Z)}}if(Z.length===0)return null;return new this(W,K,Z,X)}resetDuration(){let J=this.tracks,Q=0;for(let $=0,Z=J.length;$!==Z;++$){let W=this.tracks[$];Q=Math.max(Q,W.times[W.times.length-1])}return this.duration=Q,this}trim(){for(let J=0;J<this.tracks.length;J++)this.tracks[J].trim(0,this.duration);return this}validate(){let J=!0;for(let Q=0;Q<this.tracks.length;Q++)J=J&&this.tracks[Q].validate();return J}optimize(){for(let J=0;J<this.tracks.length;J++)this.tracks[J].optimize();return this}clone(){let J=[];for(let $=0;$<this.tracks.length;$++)J.push(this.tracks[$].clone());let Q=new this.constructor(this.name,this.duration,J,this.blendMode);return Q.userData=JSON.parse(JSON.stringify(this.userData)),Q}toJSON(){return this.constructor.toJSON(this)}}function $U(J){switch(J.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return c9;case"vector":case"vector2":case"vector3":case"vector4":return n9;case"color":return OQ;case"quaternion":return o9;case"bool":case"boolean":return G8;case"string":return E8}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+J)}function ZU(J){if(J.type===void 0)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let Q=$U(J.type);if(J.times===void 0){let $=[],Z=[];QX(J.keys,$,Z,"value"),J.times=$,J.values=Z}if(Q.parse!==void 0)return Q.parse(J);else return new Q(J.name,J.times,J.values,J.interpolation)}var I9={enabled:!1,files:{},add:function(J,Q){if(this.enabled===!1)return;if(rW(J))return;this.files[J]=Q},get:function(J){if(this.enabled===!1)return;if(rW(J))return;return this.files[J]},remove:function(J){delete this.files[J]},clear:function(){this.files={}}};function rW(J){try{let Q=J.slice(J.indexOf(":")+1);return new URL(Q).protocol==="blob:"}catch(Q){return!1}}class zZ{constructor(J,Q,$){let Z=this,W=!1,Y=0,X=0,K=void 0,H=[];this.onStart=void 0,this.onLoad=J,this.onProgress=Q,this.onError=$,this._abortController=null,this.itemStart=function(U){if(X++,W===!1){if(Z.onStart!==void 0)Z.onStart(U,Y,X)}W=!0},this.itemEnd=function(U){if(Y++,Z.onProgress!==void 0)Z.onProgress(U,Y,X);if(Y===X){if(W=!1,Z.onLoad!==void 0)Z.onLoad()}},this.itemError=function(U){if(Z.onError!==void 0)Z.onError(U)},this.resolveURL=function(U){if(K)return K(U);return U},this.setURLModifier=function(U){return K=U,this},this.addHandler=function(U,G){return H.push(U,G),this},this.removeHandler=function(U){let G=H.indexOf(U);if(G!==-1)H.splice(G,2);return this},this.getHandler=function(U){for(let G=0,F=H.length;G<F;G+=2){let E=H[G],O=H[G+1];if(E.global)E.lastIndex=0;if(E.test(U))return O}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){if(!this._abortController)this._abortController=new AbortController;return this._abortController}}var $X=new zZ;class S9{constructor(J){if(this.manager=J!==void 0?J:$X,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(J,Q){let $=this;return new Promise(function(Z,W){$.load(J,Z,Q,W)})}parse(){}setCrossOrigin(J){return this.crossOrigin=J,this}setWithCredentials(J){return this.withCredentials=J,this}setPath(J){return this.path=J,this}setResourcePath(J){return this.resourcePath=J,this}setRequestHeader(J){return this.requestHeader=J,this}abort(){return this}}S9.DEFAULT_MATERIAL_NAME="__DEFAULT";var d9={};class ZX extends Error{constructor(J,Q){super(J);this.response=Q}}class L6 extends S9{constructor(J){super(J);this.mimeType="",this.responseType="",this._abortController=new AbortController}load(J,Q,$,Z){if(J===void 0)J="";if(this.path!==void 0)J=this.path+J;J=this.manager.resolveURL(J);let W=I9.get(`file:${J}`);if(W!==void 0){this.manager.itemStart(J),setTimeout(()=>{if(Q)Q(W);this.manager.itemEnd(J)},0);return}if(d9[J]!==void 0){d9[J].push({onLoad:Q,onProgress:$,onError:Z});return}d9[J]=[],d9[J].push({onLoad:Q,onProgress:$,onError:Z});let Y=new Request(J,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),X=this.mimeType,K=this.responseType;fetch(Y).then((H)=>{if(H.status===200||H.status===0){if(H.status===0)C0("FileLoader: HTTP Status 0 received.");if(typeof ReadableStream>"u"||H.body===void 0||H.body.getReader===void 0)return H;let U=d9[J],G=H.body.getReader(),F=H.headers.get("X-File-Size")||H.headers.get("Content-Length"),E=F?parseInt(F):0,O=E!==0,R=0,C=new ReadableStream({start(q){N();function N(){G.read().then(({done:L,value:M})=>{if(L)q.close();else{R+=M.byteLength;let k=new ProgressEvent("progress",{lengthComputable:O,loaded:R,total:E});for(let _=0,P=U.length;_<P;_++){let V=U[_];if(V.onProgress)V.onProgress(k)}q.enqueue(M),N()}},(L)=>{q.error(L)})}}});return new Response(C)}else throw new ZX(`fetch for "${H.url}" responded with ${H.status}: ${H.statusText}`,H)}).then((H)=>{switch(K){case"arraybuffer":return H.arrayBuffer();case"blob":return H.blob();case"document":return H.text().then((U)=>{return new DOMParser().parseFromString(U,X)});case"json":return H.json();default:if(X==="")return H.text();else{let G=/charset="?([^;"\s]*)"?/i.exec(X),F=G&&G[1]?G[1].toLowerCase():void 0,E=new TextDecoder(F);return H.arrayBuffer().then((O)=>E.decode(O))}}}).then((H)=>{I9.add(`file:${J}`,H);let U=d9[J];delete d9[J];for(let G=0,F=U.length;G<F;G++){let E=U[G];if(E.onLoad)E.onLoad(H)}}).catch((H)=>{let U=d9[J];if(U===void 0)throw this.manager.itemError(J),H;delete d9[J];for(let G=0,F=U.length;G<F;G++){let E=U[G];if(E.onError)E.onError(H)}this.manager.itemError(J)}).finally(()=>{this.manager.itemEnd(J)}),this.manager.itemStart(J)}setResponseType(J){return this.responseType=J,this}setMimeType(J){return this.mimeType=J,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}var a8=new WeakMap;class wZ extends S9{constructor(J){super(J)}load(J,Q,$,Z){if(this.path!==void 0)J=this.path+J;J=this.manager.resolveURL(J);let W=this,Y=I9.get(`image:${J}`);if(Y!==void 0){if(Y.complete===!0)W.manager.itemStart(J),setTimeout(function(){if(Q)Q(Y);W.manager.itemEnd(J)},0);else{let G=a8.get(Y);if(G===void 0)G=[],a8.set(Y,G);G.push({onLoad:Q,onError:Z})}return Y}let X=J6("img");function K(){if(U(),Q)Q(this);let G=a8.get(this)||[];for(let F=0;F<G.length;F++){let E=G[F];if(E.onLoad)E.onLoad(this)}a8.delete(this),W.manager.itemEnd(J)}function H(G){if(U(),Z)Z(G);I9.remove(`image:${J}`);let F=a8.get(this)||[];for(let E=0;E<F.length;E++){let O=F[E];if(O.onError)O.onError(G)}a8.delete(this),W.manager.itemError(J),W.manager.itemEnd(J)}function U(){X.removeEventListener("load",K,!1),X.removeEventListener("error",H,!1)}if(X.addEventListener("load",K,!1),X.addEventListener("error",H,!1),J.slice(0,5)!=="data:"){if(this.crossOrigin!==void 0)X.crossOrigin=this.crossOrigin}return I9.add(`image:${J}`,X),W.manager.itemStart(J),X.src=J,X}}class qQ extends S9{constructor(J){super(J)}load(J,Q,$,Z){let W=this,Y=new O6,X=new L6(this.manager);return X.setResponseType("arraybuffer"),X.setRequestHeader(this.requestHeader),X.setPath(this.path),X.setWithCredentials(W.withCredentials),X.load(J,function(K){let H;try{H=W.parse(K)}catch(U){if(Z!==void 0)Z(U);else A0(U);return}if(H.image!==void 0)Y.image=H.image;else if(H.data!==void 0)Y.image.width=H.width,Y.image.height=H.height,Y.image.data=H.data;if(Y.wrapS=H.wrapS!==void 0?H.wrapS:1001,Y.wrapT=H.wrapT!==void 0?H.wrapT:1001,Y.magFilter=H.magFilter!==void 0?H.magFilter:1006,Y.minFilter=H.minFilter!==void 0?H.minFilter:1006,Y.anisotropy=H.anisotropy!==void 0?H.anisotropy:1,H.colorSpace!==void 0)Y.colorSpace=H.colorSpace;if(H.flipY!==void 0)Y.flipY=H.flipY;if(H.format!==void 0)Y.format=H.format;if(H.type!==void 0)Y.type=H.type;if(H.mipmaps!==void 0)Y.mipmaps=H.mipmaps,Y.minFilter=1008;if(H.mipmapCount===1)Y.minFilter=1006;if(H.generateMipmaps!==void 0)Y.generateMipmaps=H.generateMipmaps;if(Y.needsUpdate=!0,Q)Q(Y,H)},$,Z),Y}}class D6 extends S9{constructor(J){super(J)}load(J,Q,$,Z){let W=new wJ,Y=new wZ(this.manager);return Y.setCrossOrigin(this.crossOrigin),Y.setPath(this.path),Y.load(J,function(X){if(W.image=X,W.needsUpdate=!0,Q!==void 0)Q(W)},$,Z),W}}class a9 extends FJ{constructor(J,Q=1){super();this.isLight=!0,this.type="Light",this.color=new R0(J),this.intensity=Q}dispose(){this.dispatchEvent({type:"dispose"})}copy(J,Q){return super.copy(J,Q),this.color.copy(J.color),this.intensity=J.intensity,this}toJSON(J){let Q=super.toJSON(J);return Q.object.color=this.color.getHex(),Q.object.intensity=this.intensity,Q}}class M6 extends a9{constructor(J,Q,$){super(J,$);this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(FJ.DEFAULT_UP),this.updateMatrix(),this.groundColor=new R0(Q)}copy(J,Q){return super.copy(J,Q),this.groundColor.copy(J.groundColor),this}toJSON(J){let Q=super.toJSON(J);return Q.object.groundColor=this.groundColor.getHex(),Q}}var U$=new S0,tW=new j,eW=new j;class RQ{constructor(J){this.camera=J,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new p0(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new S0,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new A8,this._frameExtents=new p0(1,1),this._viewportCount=1,this._viewports=[new QJ(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(J){let Q=this.camera,$=this.matrix;if(tW.setFromMatrixPosition(J.matrixWorld),Q.position.copy(tW),eW.setFromMatrixPosition(J.target.matrixWorld),Q.lookAt(eW),Q.updateMatrixWorld(),U$.multiplyMatrices(Q.projectionMatrix,Q.matrixWorldInverse),this._frustum.setFromProjectionMatrix(U$,Q.coordinateSystem,Q.reversedDepth),Q.coordinateSystem===2001||Q.reversedDepth)$.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,1,0,0,0,0,1);else $.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);$.multiply(U$)}getViewport(J){return this._viewports[J]}getFrameExtents(){return this._frameExtents}dispose(){if(this.map)this.map.dispose();if(this.mapPass)this.mapPass.dispose()}copy(J){return this.camera=J.camera.clone(),this.intensity=J.intensity,this.bias=J.bias,this.radius=J.radius,this.autoUpdate=J.autoUpdate,this.needsUpdate=J.needsUpdate,this.normalBias=J.normalBias,this.blurSamples=J.blurSamples,this.mapSize.copy(J.mapSize),this.biasNode=J.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let J={};if(this.intensity!==1)J.intensity=this.intensity;if(this.bias!==0)J.bias=this.bias;if(this.normalBias!==0)J.normalBias=this.normalBias;if(this.radius!==1)J.radius=this.radius;if(this.mapSize.x!==512||this.mapSize.y!==512)J.mapSize=this.mapSize.toArray();return J.camera=this.camera.toJSON(!1).object,delete J.camera.matrix,J}}var b7=new j,f7=new PJ,C9=new j;class LQ extends FJ{constructor(){super();this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new S0,this.projectionMatrix=new S0,this.projectionMatrixInverse=new S0,this.coordinateSystem=2000,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(J,Q){return super.copy(J,Q),this.matrixWorldInverse.copy(J.matrixWorldInverse),this.projectionMatrix.copy(J.projectionMatrix),this.projectionMatrixInverse.copy(J.projectionMatrixInverse),this.coordinateSystem=J.coordinateSystem,this}getWorldDirection(J){return super.getWorldDirection(J).negate()}updateMatrixWorld(J){if(super.updateMatrixWorld(J),this.matrixWorld.decompose(b7,f7,C9),C9.x===1&&C9.y===1&&C9.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(b7,f7,C9.set(1,1,1)).invert()}updateWorldMatrix(J,Q){if(super.updateWorldMatrix(J,Q),this.matrixWorld.decompose(b7,f7,C9),C9.x===1&&C9.y===1&&C9.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(b7,f7,C9.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}var Y8=new j,JY=new p0,QY=new p0;class kJ extends LQ{constructor(J=50,Q=1,$=0.1,Z=2000){super();this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=J,this.zoom=1,this.near=$,this.far=Z,this.focus=10,this.aspect=Q,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(J,Q){return super.copy(J,Q),this.fov=J.fov,this.zoom=J.zoom,this.near=J.near,this.far=J.far,this.focus=J.focus,this.aspect=J.aspect,this.view=J.view===null?null:Object.assign({},J.view),this.filmGauge=J.filmGauge,this.filmOffset=J.filmOffset,this}setFocalLength(J){let Q=0.5*this.getFilmHeight()/J;this.fov=k8*2*Math.atan(Q),this.updateProjectionMatrix()}getFocalLength(){let J=Math.tan(y6*0.5*this.fov);return 0.5*this.getFilmHeight()/J}getEffectiveFOV(){return k8*2*Math.atan(Math.tan(y6*0.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(J,Q,$){Y8.set(-1,-1,0.5).applyMatrix4(this.projectionMatrixInverse),Q.set(Y8.x,Y8.y).multiplyScalar(-J/Y8.z),Y8.set(1,1,0.5).applyMatrix4(this.projectionMatrixInverse),$.set(Y8.x,Y8.y).multiplyScalar(-J/Y8.z)}getViewSize(J,Q){return this.getViewBounds(J,JY,QY),Q.subVectors(QY,JY)}setViewOffset(J,Q,$,Z,W,Y){if(this.aspect=J/Q,this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=J,this.view.fullHeight=Q,this.view.offsetX=$,this.view.offsetY=Z,this.view.width=W,this.view.height=Y,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let J=this.near,Q=J*Math.tan(y6*0.5*this.fov)/this.zoom,$=2*Q,Z=this.aspect*$,W=-0.5*Z,Y=this.view;if(this.view!==null&&this.view.enabled){let{fullWidth:K,fullHeight:H}=Y;W+=Y.offsetX*Z/K,Q-=Y.offsetY*$/H,Z*=Y.width/K,$*=Y.height/H}let X=this.filmOffset;if(X!==0)W+=J*X/this.getFilmWidth();this.projectionMatrix.makePerspective(W,W+Z,Q,Q-$,J,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(J){let Q=super.toJSON(J);if(Q.object.fov=this.fov,Q.object.zoom=this.zoom,Q.object.near=this.near,Q.object.far=this.far,Q.object.focus=this.focus,Q.object.aspect=this.aspect,this.view!==null)Q.object.view=Object.assign({},this.view);return Q.object.filmGauge=this.filmGauge,Q.object.filmOffset=this.filmOffset,Q}}class WX extends RQ{constructor(){super(new kJ(50,1,0.5,500));this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(J){let Q=this.camera,$=k8*2*J.angle*this.focus,Z=this.mapSize.width/this.mapSize.height*this.aspect,W=J.distance||Q.far;if($!==Q.fov||Z!==Q.aspect||W!==Q.far)Q.fov=$,Q.aspect=Z,Q.far=W,Q.updateProjectionMatrix();super.updateMatrices(J)}copy(J){return super.copy(J),this.focus=J.focus,this}}class DQ extends a9{constructor(J,Q,$=0,Z=Math.PI/3,W=0,Y=2){super(J,Q);this.isSpotLight=!0,this.type="SpotLight",this.position.copy(FJ.DEFAULT_UP),this.updateMatrix(),this.target=new FJ,this.distance=$,this.angle=Z,this.penumbra=W,this.decay=Y,this.map=null,this.shadow=new WX}get power(){return this.intensity*Math.PI}set power(J){this.intensity=J/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(J,Q){return super.copy(J,Q),this.distance=J.distance,this.angle=J.angle,this.penumbra=J.penumbra,this.decay=J.decay,this.target=J.target.clone(),this.map=J.map,this.shadow=J.shadow.clone(),this}toJSON(J){let Q=super.toJSON(J);if(Q.object.distance=this.distance,Q.object.angle=this.angle,Q.object.decay=this.decay,Q.object.penumbra=this.penumbra,Q.object.target=this.target.uuid,this.map&&this.map.isTexture)Q.object.map=this.map.toJSON(J).uuid;return Q.object.shadow=this.shadow.toJSON(),Q}}class YX extends RQ{constructor(){super(new kJ(90,1,0.5,500));this.isPointLightShadow=!0}}class k6 extends a9{constructor(J,Q,$=0,Z=2){super(J,Q);this.isPointLight=!0,this.type="PointLight",this.distance=$,this.decay=Z,this.shadow=new YX}get power(){return this.intensity*4*Math.PI}set power(J){this.intensity=J/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(J,Q){return super.copy(J,Q),this.distance=J.distance,this.decay=J.decay,this.shadow=J.shadow.clone(),this}toJSON(J){let Q=super.toJSON(J);return Q.object.distance=this.distance,Q.object.decay=this.decay,Q.object.shadow=this.shadow.toJSON(),Q}}class v8 extends LQ{constructor(J=-1,Q=1,$=1,Z=-1,W=0.1,Y=2000){super();this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=J,this.right=Q,this.top=$,this.bottom=Z,this.near=W,this.far=Y,this.updateProjectionMatrix()}copy(J,Q){return super.copy(J,Q),this.left=J.left,this.right=J.right,this.top=J.top,this.bottom=J.bottom,this.near=J.near,this.far=J.far,this.zoom=J.zoom,this.view=J.view===null?null:Object.assign({},J.view),this}setViewOffset(J,Q,$,Z,W,Y){if(this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=J,this.view.fullHeight=Q,this.view.offsetX=$,this.view.offsetY=Z,this.view.width=W,this.view.height=Y,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let J=(this.right-this.left)/(2*this.zoom),Q=(this.top-this.bottom)/(2*this.zoom),$=(this.right+this.left)/2,Z=(this.top+this.bottom)/2,W=$-J,Y=$+J,X=Z+Q,K=Z-Q;if(this.view!==null&&this.view.enabled){let H=(this.right-this.left)/this.view.fullWidth/this.zoom,U=(this.top-this.bottom)/this.view.fullHeight/this.zoom;W+=H*this.view.offsetX,Y=W+H*this.view.width,X-=U*this.view.offsetY,K=X-U*this.view.height}this.projectionMatrix.makeOrthographic(W,Y,X,K,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(J){let Q=super.toJSON(J);if(Q.object.zoom=this.zoom,Q.object.left=this.left,Q.object.right=this.right,Q.object.top=this.top,Q.object.bottom=this.bottom,Q.object.near=this.near,Q.object.far=this.far,this.view!==null)Q.object.view=Object.assign({},this.view);return Q}}class XX extends RQ{constructor(){super(new v8(-5,5,5,-5,0.5,500));this.isDirectionalLightShadow=!0}}class j9 extends a9{constructor(J,Q){super(J,Q);this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(FJ.DEFAULT_UP),this.updateMatrix(),this.target=new FJ,this.shadow=new XX}dispose(){super.dispose(),this.shadow.dispose()}copy(J){return super.copy(J),this.target=J.target.clone(),this.shadow=J.shadow.clone(),this}toJSON(J){let Q=super.toJSON(J);return Q.object.shadow=this.shadow.toJSON(),Q.object.target=this.target.uuid,Q}}class J7 extends a9{constructor(J,Q){super(J,Q);this.isAmbientLight=!0,this.type="AmbientLight"}}class F8{static extractUrlBase(J){let Q=J.lastIndexOf("/");if(Q===-1)return"./";return J.slice(0,Q+1)}static resolveURL(J,Q){if(typeof J!=="string"||J==="")return"";if(/^https?:\/\//i.test(Q)&&/^\//.test(J))Q=Q.replace(/(^https?:\/\/[^\/]+).*/i,"$1");if(/^(https?:)?\/\//i.test(J))return J;if(/^data:.*,.*$/i.test(J))return J;if(/^blob:.*$/i.test(J))return J;return Q+J}}var G$=new WeakMap;class MQ extends S9{constructor(J){super(J);if(this.isImageBitmapLoader=!0,typeof createImageBitmap>"u")C0("ImageBitmapLoader: createImageBitmap() not supported.");if(typeof fetch>"u")C0("ImageBitmapLoader: fetch() not supported.");this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(J){return this.options=J,this}load(J,Q,$,Z){if(J===void 0)J="";if(this.path!==void 0)J=this.path+J;J=this.manager.resolveURL(J);let W=this,Y=I9.get(`image-bitmap:${J}`);if(Y!==void 0){if(W.manager.itemStart(J),Y.then){Y.then((H)=>{if(G$.has(Y)===!0){if(Z)Z(G$.get(Y));W.manager.itemError(J),W.manager.itemEnd(J)}else{if(Q)Q(H);W.manager.itemEnd(J)}});return}setTimeout(function(){if(Q)Q(Y);W.manager.itemEnd(J)},0);return}let X={};X.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",X.headers=this.requestHeader,X.signal=typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let K=fetch(J,X).then(function(H){return H.blob()}).then(function(H){return createImageBitmap(H,Object.assign(W.options,{colorSpaceConversion:"none"}))}).then(function(H){if(I9.add(`image-bitmap:${J}`,H),Q)Q(H);W.manager.itemEnd(J)}).catch(function(H){if(Z)Z(H);G$.set(K,H),I9.remove(`image-bitmap:${J}`),W.manager.itemError(J),W.manager.itemEnd(J)});I9.add(`image-bitmap:${J}`,K),W.manager.itemStart(J)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}var r8=-90,t8=1;class PZ extends FJ{constructor(J,Q,$){super();this.type="CubeCamera",this.renderTarget=$,this.coordinateSystem=null,this.activeMipmapLevel=0;let Z=new kJ(r8,t8,J,Q);Z.layers=this.layers,this.add(Z);let W=new kJ(r8,t8,J,Q);W.layers=this.layers,this.add(W);let Y=new kJ(r8,t8,J,Q);Y.layers=this.layers,this.add(Y);let X=new kJ(r8,t8,J,Q);X.layers=this.layers,this.add(X);let K=new kJ(r8,t8,J,Q);K.layers=this.layers,this.add(K);let H=new kJ(r8,t8,J,Q);H.layers=this.layers,this.add(H)}updateCoordinateSystem(){let J=this.coordinateSystem,Q=this.children.concat(),[$,Z,W,Y,X,K]=Q;for(let H of Q)this.remove(H);if(J===2000)$.up.set(0,1,0),$.lookAt(1,0,0),Z.up.set(0,1,0),Z.lookAt(-1,0,0),W.up.set(0,0,-1),W.lookAt(0,1,0),Y.up.set(0,0,1),Y.lookAt(0,-1,0),X.up.set(0,1,0),X.lookAt(0,0,1),K.up.set(0,1,0),K.lookAt(0,0,-1);else if(J===2001)$.up.set(0,-1,0),$.lookAt(-1,0,0),Z.up.set(0,-1,0),Z.lookAt(1,0,0),W.up.set(0,0,1),W.lookAt(0,1,0),Y.up.set(0,0,-1),Y.lookAt(0,-1,0),X.up.set(0,-1,0),X.lookAt(0,0,1),K.up.set(0,-1,0),K.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+J);for(let H of Q)this.add(H),H.updateMatrixWorld()}update(J,Q){if(this.parent===null)this.updateMatrixWorld();let{renderTarget:$,activeMipmapLevel:Z}=this;if(this.coordinateSystem!==J.coordinateSystem)this.coordinateSystem=J.coordinateSystem,this.updateCoordinateSystem();let[W,Y,X,K,H,U]=this.children,G=J.getRenderTarget(),F=J.getActiveCubeFace(),E=J.getActiveMipmapLevel(),O=J.xr.enabled;J.xr.enabled=!1;let R=$.texture.generateMipmaps;$.texture.generateMipmaps=!1;let C=!1;if(J.isWebGLRenderer===!0)C=J.state.buffers.depth.getReversed();else C=J.reversedDepthBuffer;if(J.setRenderTarget($,0,Z),C&&J.autoClear===!1)J.clearDepth();if(J.render(Q,W),J.setRenderTarget($,1,Z),C&&J.autoClear===!1)J.clearDepth();if(J.render(Q,Y),J.setRenderTarget($,2,Z),C&&J.autoClear===!1)J.clearDepth();if(J.render(Q,X),J.setRenderTarget($,3,Z),C&&J.autoClear===!1)J.clearDepth();if(J.render(Q,K),J.setRenderTarget($,4,Z),C&&J.autoClear===!1)J.clearDepth();if(J.render(Q,H),$.texture.generateMipmaps=R,J.setRenderTarget($,5,Z),C&&J.autoClear===!1)J.clearDepth();J.render(Q,U),J.setRenderTarget(G,F,E),J.xr.enabled=O,$.texture.needsPMREMUpdate=!0}}class _Z extends kJ{constructor(J=[]){super();this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=J}}class TZ{constructor(J,Q,$){this.binding=J,this.valueSize=$;let Z,W,Y;switch(Q){case"quaternion":Z=this._slerp,W=this._slerpAdditive,Y=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array($*6),this._workIndex=5;break;case"string":case"bool":Z=this._select,W=this._select,Y=this._setAdditiveIdentityOther,this.buffer=Array($*5);break;default:Z=this._lerp,W=this._lerpAdditive,Y=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array($*5)}this._mixBufferRegion=Z,this._mixBufferRegionAdditive=W,this._setIdentity=Y,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(J,Q){let $=this.buffer,Z=this.valueSize,W=J*Z+Z,Y=this.cumulativeWeight;if(Y===0){for(let X=0;X!==Z;++X)$[W+X]=$[X];Y=Q}else{Y+=Q;let X=Q/Y;this._mixBufferRegion($,W,0,X,Z)}this.cumulativeWeight=Y}accumulateAdditive(J){let Q=this.buffer,$=this.valueSize,Z=$*this._addIndex;if(this.cumulativeWeightAdditive===0)this._setIdentity();this._mixBufferRegionAdditive(Q,Z,0,J,$),this.cumulativeWeightAdditive+=J}apply(J){let Q=this.valueSize,$=this.buffer,Z=J*Q+Q,W=this.cumulativeWeight,Y=this.cumulativeWeightAdditive,X=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,W<1){let K=Q*this._origIndex;this._mixBufferRegion($,Z,K,1-W,Q)}if(Y>0)this._mixBufferRegionAdditive($,Z,this._addIndex*Q,1,Q);for(let K=Q,H=Q+Q;K!==H;++K)if($[K]!==$[K+Q]){X.setValue($,Z);break}}saveOriginalState(){let J=this.binding,Q=this.buffer,$=this.valueSize,Z=$*this._origIndex;J.getValue(Q,Z);for(let W=$,Y=Z;W!==Y;++W)Q[W]=Q[Z+W%$];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let J=this.valueSize*3;this.binding.setValue(this.buffer,J)}_setAdditiveIdentityNumeric(){let J=this._addIndex*this.valueSize,Q=J+this.valueSize;for(let $=J;$<Q;$++)this.buffer[$]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let J=this._origIndex*this.valueSize,Q=this._addIndex*this.valueSize;for(let $=0;$<this.valueSize;$++)this.buffer[Q+$]=this.buffer[J+$]}_select(J,Q,$,Z,W){if(Z>=0.5)for(let Y=0;Y!==W;++Y)J[Q+Y]=J[$+Y]}_slerp(J,Q,$,Z){PJ.slerpFlat(J,Q,J,Q,J,$,Z)}_slerpAdditive(J,Q,$,Z,W){let Y=this._workIndex*W;PJ.multiplyQuaternionsFlat(J,Y,J,Q,J,$),PJ.slerpFlat(J,Q,J,Q,J,Y,Z)}_lerp(J,Q,$,Z,W){let Y=1-Z;for(let X=0;X!==W;++X){let K=Q+X;J[K]=J[K]*Y+J[$+X]*Z}}_lerpAdditive(J,Q,$,Z,W){for(let Y=0;Y!==W;++Y){let X=Q+Y;J[X]=J[X]+J[$+Y]*Z}}}var AZ="\\[\\]\\.:\\/",WU=new RegExp("["+AZ+"]","g"),SZ="[^"+AZ+"]",YU="[^"+AZ.replace("\\.","")+"]",XU=/((?:WC+[\/:])*)/.source.replace("WC",SZ),KU=/(WCOD+)?/.source.replace("WCOD",YU),HU=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",SZ),UU=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",SZ),GU=new RegExp("^"+XU+KU+HU+UU+"$"),EU=["material","materials","bones","map"];class KX{constructor(J,Q,$){let Z=$||e0.parseTrackName(Q);this._targetGroup=J,this._bindings=J.subscribe_(Q,Z)}getValue(J,Q){this.bind();let $=this._targetGroup.nCachedObjects_,Z=this._bindings[$];if(Z!==void 0)Z.getValue(J,Q)}setValue(J,Q){let $=this._bindings;for(let Z=this._targetGroup.nCachedObjects_,W=$.length;Z!==W;++Z)$[Z].setValue(J,Q)}bind(){let J=this._bindings;for(let Q=this._targetGroup.nCachedObjects_,$=J.length;Q!==$;++Q)J[Q].bind()}unbind(){let J=this._bindings;for(let Q=this._targetGroup.nCachedObjects_,$=J.length;Q!==$;++Q)J[Q].unbind()}}class e0{constructor(J,Q,$){this.path=Q,this.parsedPath=$||e0.parseTrackName(Q),this.node=e0.findNode(J,this.parsedPath.nodeName),this.rootNode=J,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(J,Q,$){if(!(J&&J.isAnimationObjectGroup))return new e0(J,Q,$);else return new e0.Composite(J,Q,$)}static sanitizeNodeName(J){return J.replace(/\s/g,"_").replace(WU,"")}static parseTrackName(J){let Q=GU.exec(J);if(Q===null)throw Error("PropertyBinding: Cannot parse trackName: "+J);let $={nodeName:Q[2],objectName:Q[3],objectIndex:Q[4],propertyName:Q[5],propertyIndex:Q[6]},Z=$.nodeName&&$.nodeName.lastIndexOf(".");if(Z!==void 0&&Z!==-1){let W=$.nodeName.substring(Z+1);if(EU.indexOf(W)!==-1)$.nodeName=$.nodeName.substring(0,Z),$.objectName=W}if($.propertyName===null||$.propertyName.length===0)throw Error("PropertyBinding: can not parse propertyName from trackName: "+J);return $}static findNode(J,Q){if(Q===void 0||Q===""||Q==="."||Q===-1||Q===J.name||Q===J.uuid)return J;if(J.skeleton){let $=J.skeleton.getBoneByName(Q);if($!==void 0)return $}if(J.children){let $=function(W){for(let Y=0;Y<W.length;Y++){let X=W[Y];if(X.name===Q||X.uuid===Q)return X;let K=$(X.children);if(K)return K}return null},Z=$(J.children);if(Z)return Z}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(J,Q){J[Q]=this.targetObject[this.propertyName]}_getValue_array(J,Q){let $=this.resolvedProperty;for(let Z=0,W=$.length;Z!==W;++Z)J[Q++]=$[Z]}_getValue_arrayElement(J,Q){J[Q]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(J,Q){this.resolvedProperty.toArray(J,Q)}_setValue_direct(J,Q){this.targetObject[this.propertyName]=J[Q]}_setValue_direct_setNeedsUpdate(J,Q){this.targetObject[this.propertyName]=J[Q],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(J,Q){this.targetObject[this.propertyName]=J[Q],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(J,Q){let $=this.resolvedProperty;for(let Z=0,W=$.length;Z!==W;++Z)$[Z]=J[Q++]}_setValue_array_setNeedsUpdate(J,Q){let $=this.resolvedProperty;for(let Z=0,W=$.length;Z!==W;++Z)$[Z]=J[Q++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(J,Q){let $=this.resolvedProperty;for(let Z=0,W=$.length;Z!==W;++Z)$[Z]=J[Q++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(J,Q){this.resolvedProperty[this.propertyIndex]=J[Q]}_setValue_arrayElement_setNeedsUpdate(J,Q){this.resolvedProperty[this.propertyIndex]=J[Q],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(J,Q){this.resolvedProperty[this.propertyIndex]=J[Q],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(J,Q){this.resolvedProperty.fromArray(J,Q)}_setValue_fromArray_setNeedsUpdate(J,Q){this.resolvedProperty.fromArray(J,Q),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(J,Q){this.resolvedProperty.fromArray(J,Q),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(J,Q){this.bind(),this.getValue(J,Q)}_setValue_unbound(J,Q){this.bind(),this.setValue(J,Q)}bind(){let J=this.node,Q=this.parsedPath,$=Q.objectName,Z=Q.propertyName,W=Q.propertyIndex;if(!J)J=e0.findNode(this.rootNode,Q.nodeName),this.node=J;if(this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!J){C0("PropertyBinding: No target node found for track: "+this.path+".");return}if($){let H=Q.objectIndex;switch($){case"materials":if(!J.material){A0("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!J.material.materials){A0("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}J=J.material.materials;break;case"bones":if(!J.skeleton){A0("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}J=J.skeleton.bones;for(let U=0;U<J.length;U++)if(J[U].name===H){H=U;break}break;case"map":if("map"in J){J=J.map;break}if(!J.material){A0("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!J.material.map){A0("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}J=J.material.map;break;default:if(J[$]===void 0){A0("PropertyBinding: Can not bind to objectName of node undefined.",this);return}J=J[$]}if(H!==void 0){if(J[H]===void 0){A0("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,J);return}J=J[H]}}let Y=J[Z];if(Y===void 0){let H=Q.nodeName;A0("PropertyBinding: Trying to update property for track: "+H+"."+Z+" but it wasn't found.",J);return}let X=this.Versioning.None;if(this.targetObject=J,J.isMaterial===!0)X=this.Versioning.NeedsUpdate;else if(J.isObject3D===!0)X=this.Versioning.MatrixWorldNeedsUpdate;let K=this.BindingType.Direct;if(W!==void 0){if(Z==="morphTargetInfluences"){if(!J.geometry){A0("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!J.geometry.morphAttributes){A0("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}if(J.morphTargetDictionary[W]!==void 0)W=J.morphTargetDictionary[W]}K=this.BindingType.ArrayElement,this.resolvedProperty=Y,this.propertyIndex=W}else if(Y.fromArray!==void 0&&Y.toArray!==void 0)K=this.BindingType.HasFromToArray,this.resolvedProperty=Y;else if(Array.isArray(Y))K=this.BindingType.EntireArray,this.resolvedProperty=Y;else this.propertyName=Z;this.getValue=this.GetterByBindingType[K],this.setValue=this.SetterByBindingTypeAndVersioning[K][X]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}e0.Composite=KX;e0.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};e0.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};e0.prototype.GetterByBindingType=[e0.prototype._getValue_direct,e0.prototype._getValue_array,e0.prototype._getValue_arrayElement,e0.prototype._getValue_toArray];e0.prototype.SetterByBindingTypeAndVersioning=[[e0.prototype._setValue_direct,e0.prototype._setValue_direct_setNeedsUpdate,e0.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[e0.prototype._setValue_array,e0.prototype._setValue_array_setNeedsUpdate,e0.prototype._setValue_array_setMatrixWorldNeedsUpdate],[e0.prototype._setValue_arrayElement,e0.prototype._setValue_arrayElement_setNeedsUpdate,e0.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[e0.prototype._setValue_fromArray,e0.prototype._setValue_fromArray_setNeedsUpdate,e0.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class jZ{constructor(J,Q,$=null,Z=Q.blendMode){this._mixer=J,this._clip=Q,this._localRoot=$,this.blendMode=Z;let W=Q.tracks,Y=W.length,X=Array(Y),K={endingStart:2400,endingEnd:2400};for(let H=0;H!==Y;++H){let U=W[H].createInterpolant(null);if(X[H]=U,U.settings)Object.assign(K,U.settings);U.settings=K}this._interpolantSettings=K,this._interpolants=X,this._propertyBindings=Array(Y),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(J){return this._startTime=J,this}setLoop(J,Q){return this.loop=J,this.repetitions=Q,this}setEffectiveWeight(J){return this.weight=J,this._effectiveWeight=this.enabled?J:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(J){return this._scheduleFading(J,0,1)}fadeOut(J){return this._scheduleFading(J,1,0)}crossFadeFrom(J,Q,$=!1){if(J.fadeOut(Q),this.fadeIn(Q),$===!0){let Z=this._clip.duration,W=J._clip.duration,Y=W/Z,X=Z/W;J.warp(1,Y,Q),this.warp(X,1,Q)}return this}crossFadeTo(J,Q,$=!1){return J.crossFadeFrom(this,Q,$)}stopFading(){let J=this._weightInterpolant;if(J!==null)this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(J);return this}setEffectiveTimeScale(J){return this.timeScale=J,this._effectiveTimeScale=this.paused?0:J,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(J){return this.timeScale=this._clip.duration/J,this.stopWarping()}syncWith(J){return this.time=J.time,this.timeScale=J.timeScale,this.stopWarping()}halt(J){return this.warp(this._effectiveTimeScale,0,J)}warp(J,Q,$){let Z=this._mixer,W=Z.time,Y=this.timeScale,X=this._timeScaleInterpolant;if(X===null)X=Z._lendControlInterpolant(),this._timeScaleInterpolant=X;let{parameterPositions:K,sampleValues:H}=X;return K[0]=W,K[1]=W+$,H[0]=J/Y,H[1]=Q/Y,this}stopWarping(){let J=this._timeScaleInterpolant;if(J!==null)this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(J);return this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(J,Q,$,Z){if(!this.enabled){this._updateWeight(J);return}let W=this._startTime;if(W!==null){let K=(J-W)*$;if(K<0||$===0)Q=0;else this._startTime=null,Q=$*K}Q*=this._updateTimeScale(J);let Y=this._updateTime(Q),X=this._updateWeight(J);if(X>0){let K=this._interpolants,H=this._propertyBindings;switch(this.blendMode){case 2501:for(let U=0,G=K.length;U!==G;++U)K[U].evaluate(Y),H[U].accumulateAdditive(X);break;case 2500:default:for(let U=0,G=K.length;U!==G;++U)K[U].evaluate(Y),H[U].accumulate(Z,X)}}}_updateWeight(J){let Q=0;if(this.enabled){Q=this.weight;let $=this._weightInterpolant;if($!==null){let Z=$.evaluate(J)[0];if(Q*=Z,J>$.parameterPositions[1]){if(this.stopFading(),Z===0)this.enabled=!1}}}return this._effectiveWeight=Q,Q}_updateTimeScale(J){let Q=0;if(!this.paused){Q=this.timeScale;let $=this._timeScaleInterpolant;if($!==null){let Z=$.evaluate(J)[0];if(Q*=Z,J>$.parameterPositions[1])if(this.stopWarping(),Q===0)this.paused=!0;else this.timeScale=Q}}return this._effectiveTimeScale=Q,Q}_updateTime(J){let Q=this._clip.duration,$=this.loop,Z=this.time+J,W=this._loopCount,Y=$===2202;if(J===0){if(W===-1)return Z;return Y&&(W&1)===1?Q-Z:Z}if($===2200){if(W===-1)this._loopCount=0,this._setEndings(!0,!0,!1);J:{if(Z>=Q)Z=Q;else if(Z<0)Z=0;else{this.time=Z;break J}if(this.clampWhenFinished)this.paused=!0;else this.enabled=!1;this.time=Z,this._mixer.dispatchEvent({type:"finished",action:this,direction:J<0?-1:1})}}else{if(W===-1)if(J>=0)W=0,this._setEndings(!0,this.repetitions===0,Y);else this._setEndings(this.repetitions===0,!0,Y);if(Z>=Q||Z<0){let X=Math.floor(Z/Q);Z-=Q*X,W+=Math.abs(X);let K=this.repetitions-W;if(K<=0){if(this.clampWhenFinished)this.paused=!0;else this.enabled=!1;Z=J>0?Q:0,this.time=Z,this._mixer.dispatchEvent({type:"finished",action:this,direction:J>0?1:-1})}else{if(K===1){let H=J<0;this._setEndings(H,!H,Y)}else this._setEndings(!1,!1,Y);this._loopCount=W,this.time=Z,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:X})}}else this._loopCount=W,this.time=Z;if(Y&&(W&1)===1)return Q-Z}return Z}_setEndings(J,Q,$){let Z=this._interpolantSettings;if($)Z.endingStart=2401,Z.endingEnd=2401;else{if(J)Z.endingStart=this.zeroSlopeAtStart?2401:2400;else Z.endingStart=2402;if(Q)Z.endingEnd=this.zeroSlopeAtEnd?2401:2400;else Z.endingEnd=2402}}_scheduleFading(J,Q,$){let Z=this._mixer,W=Z.time,Y=this._weightInterpolant;if(Y===null)Y=Z._lendControlInterpolant(),this._weightInterpolant=Y;let{parameterPositions:X,sampleValues:K}=Y;return X[0]=W,K[0]=Q,X[1]=W+J,K[1]=$,this}}var FU=new Float32Array(1);class kQ extends T9{constructor(J){super();if(this._root=J,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(J,Q){let $=J._localRoot||this._root,Z=J._clip.tracks,W=Z.length,Y=J._propertyBindings,X=J._interpolants,K=$.uuid,H=this._bindingsByRootAndName,U=H[K];if(U===void 0)U={},H[K]=U;for(let G=0;G!==W;++G){let F=Z[G],E=F.name,O=U[E];if(O!==void 0)++O.referenceCount,Y[G]=O;else{if(O=Y[G],O!==void 0){if(O._cacheIndex===null)++O.referenceCount,this._addInactiveBinding(O,K,E);continue}let R=Q&&Q._propertyBindings[G].binding.parsedPath;O=new TZ(e0.create($,E,R),F.ValueTypeName,F.getValueSize()),++O.referenceCount,this._addInactiveBinding(O,K,E),Y[G]=O}X[G].resultBuffer=O.buffer}}_activateAction(J){if(!this._isActiveAction(J)){if(J._cacheIndex===null){let $=(J._localRoot||this._root).uuid,Z=J._clip.uuid,W=this._actionsByClip[Z];this._bindAction(J,W&&W.knownActions[0]),this._addInactiveAction(J,Z,$)}let Q=J._propertyBindings;for(let $=0,Z=Q.length;$!==Z;++$){let W=Q[$];if(W.useCount++===0)this._lendBinding(W),W.saveOriginalState()}this._lendAction(J)}}_deactivateAction(J){if(this._isActiveAction(J)){let Q=J._propertyBindings;for(let $=0,Z=Q.length;$!==Z;++$){let W=Q[$];if(--W.useCount===0)W.restoreOriginalState(),this._takeBackBinding(W)}this._takeBackAction(J)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let J=this;this.stats={actions:{get total(){return J._actions.length},get inUse(){return J._nActiveActions}},bindings:{get total(){return J._bindings.length},get inUse(){return J._nActiveBindings}},controlInterpolants:{get total(){return J._controlInterpolants.length},get inUse(){return J._nActiveControlInterpolants}}}}_isActiveAction(J){let Q=J._cacheIndex;return Q!==null&&Q<this._nActiveActions}_addInactiveAction(J,Q,$){let Z=this._actions,W=this._actionsByClip,Y=W[Q];if(Y===void 0)Y={knownActions:[J],actionByRoot:{}},J._byClipCacheIndex=0,W[Q]=Y;else{let X=Y.knownActions;J._byClipCacheIndex=X.length,X.push(J)}J._cacheIndex=Z.length,Z.push(J),Y.actionByRoot[$]=J}_removeInactiveAction(J){let Q=this._actions,$=Q[Q.length-1],Z=J._cacheIndex;$._cacheIndex=Z,Q[Z]=$,Q.pop(),J._cacheIndex=null;let W=J._clip.uuid,Y=this._actionsByClip,X=Y[W],K=X.knownActions,H=K[K.length-1],U=J._byClipCacheIndex;H._byClipCacheIndex=U,K[U]=H,K.pop(),J._byClipCacheIndex=null;let G=X.actionByRoot,F=(J._localRoot||this._root).uuid;if(delete G[F],K.length===0)delete Y[W];this._removeInactiveBindingsForAction(J)}_removeInactiveBindingsForAction(J){let Q=J._propertyBindings;for(let $=0,Z=Q.length;$!==Z;++$){let W=Q[$];if(--W.referenceCount===0)this._removeInactiveBinding(W)}}_lendAction(J){let Q=this._actions,$=J._cacheIndex,Z=this._nActiveActions++,W=Q[Z];J._cacheIndex=Z,Q[Z]=J,W._cacheIndex=$,Q[$]=W}_takeBackAction(J){let Q=this._actions,$=J._cacheIndex,Z=--this._nActiveActions,W=Q[Z];J._cacheIndex=Z,Q[Z]=J,W._cacheIndex=$,Q[$]=W}_addInactiveBinding(J,Q,$){let Z=this._bindingsByRootAndName,W=this._bindings,Y=Z[Q];if(Y===void 0)Y={},Z[Q]=Y;Y[$]=J,J._cacheIndex=W.length,W.push(J)}_removeInactiveBinding(J){let Q=this._bindings,$=J.binding,Z=$.rootNode.uuid,W=$.path,Y=this._bindingsByRootAndName,X=Y[Z],K=Q[Q.length-1],H=J._cacheIndex;if(K._cacheIndex=H,Q[H]=K,Q.pop(),delete X[W],Object.keys(X).length===0)delete Y[Z]}_lendBinding(J){let Q=this._bindings,$=J._cacheIndex,Z=this._nActiveBindings++,W=Q[Z];J._cacheIndex=Z,Q[Z]=J,W._cacheIndex=$,Q[$]=W}_takeBackBinding(J){let Q=this._bindings,$=J._cacheIndex,Z=--this._nActiveBindings,W=Q[Z];J._cacheIndex=Z,Q[Z]=J,W._cacheIndex=$,Q[$]=W}_lendControlInterpolant(){let J=this._controlInterpolants,Q=this._nActiveControlInterpolants++,$=J[Q];if($===void 0)$=new NQ(new Float32Array(2),new Float32Array(2),1,FU),$.__cacheIndex=Q,J[Q]=$;return $}_takeBackControlInterpolant(J){let Q=this._controlInterpolants,$=J.__cacheIndex,Z=--this._nActiveControlInterpolants,W=Q[Z];J.__cacheIndex=Z,Q[Z]=J,W.__cacheIndex=$,Q[$]=W}clipAction(J,Q,$){let Z=Q||this._root,W=Z.uuid,Y=typeof J==="string"?$6.findByName(Z,J):J,X=Y!==null?Y.uuid:J,K=this._actionsByClip[X],H=null;if($===void 0)if(Y!==null)$=Y.blendMode;else $=2500;if(K!==void 0){let G=K.actionByRoot[W];if(G!==void 0&&G.blendMode===$)return G;if(H=K.knownActions[0],Y===null)Y=H._clip}if(Y===null)return null;let U=new jZ(this,Y,Q,$);return this._bindAction(U,H),this._addInactiveAction(U,X,W),U}existingAction(J,Q){let $=Q||this._root,Z=$.uuid,W=typeof J==="string"?$6.findByName($,J):J,Y=W?W.uuid:J,X=this._actionsByClip[Y];if(X!==void 0)return X.actionByRoot[Z]||null;return null}stopAllAction(){let J=this._actions,Q=this._nActiveActions;for(let $=Q-1;$>=0;--$)J[$].stop();return this}update(J){J*=this.timeScale;let Q=this._actions,$=this._nActiveActions,Z=this.time+=J,W=Math.sign(J),Y=this._accuIndex^=1;for(let H=0;H!==$;++H)Q[H]._update(Z,J,W,Y);let X=this._bindings,K=this._nActiveBindings;for(let H=0;H!==K;++H)X[H].apply(Y);return this}setTime(J){this.time=0;for(let Q=0;Q<this._actions.length;Q++)this._actions[Q].time=0;return this.update(J)}getRoot(){return this._root}uncacheClip(J){let Q=this._actions,$=J.uuid,Z=this._actionsByClip,W=Z[$];if(W!==void 0){let Y=W.knownActions;for(let X=0,K=Y.length;X!==K;++X){let H=Y[X];this._deactivateAction(H);let U=H._cacheIndex,G=Q[Q.length-1];H._cacheIndex=null,H._byClipCacheIndex=null,G._cacheIndex=U,Q[U]=G,Q.pop(),this._removeInactiveBindingsForAction(H)}delete Z[$]}}uncacheRoot(J){let Q=J.uuid,$=this._actionsByClip;for(let Y in $){let X=$[Y].actionByRoot,K=X[Q];if(K!==void 0)this._deactivateAction(K),this._removeInactiveAction(K)}let Z=this._bindingsByRootAndName,W=Z[Q];if(W!==void 0)for(let Y in W){let X=W[Y];X.restoreOriginalState(),this._removeInactiveBinding(X)}}uncacheAction(J,Q){let $=this.existingAction(J,Q);if($!==null)this._deactivateAction($),this._removeInactiveAction($)}}class vZ{static{vZ.prototype.isMatrix2=!0}constructor(J,Q,$,Z){if(this.elements=[1,0,0,1],J!==void 0)this.set(J,Q,$,Z)}identity(){return this.set(1,0,0,1),this}fromArray(J,Q=0){for(let $=0;$<4;$++)this.elements[$]=J[$+Q];return this}set(J,Q,$,Z){let W=this.elements;return W[0]=J,W[2]=Q,W[1]=$,W[3]=Z,this}}function yZ(J,Q,$,Z){let W=NU(Z);switch($){case 1021:return J*Q;case 1028:return J*Q/W.components*W.byteLength;case 1029:return J*Q/W.components*W.byteLength;case 1030:return J*Q*2/W.components*W.byteLength;case 1031:return J*Q*2/W.components*W.byteLength;case 1022:return J*Q*3/W.components*W.byteLength;case 1023:return J*Q*4/W.components*W.byteLength;case 1033:return J*Q*4/W.components*W.byteLength;case 33776:case 33777:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*8;case 33778:case 33779:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*16;case 35841:case 35843:return Math.max(J,16)*Math.max(Q,8)/4;case 35840:case 35842:return Math.max(J,8)*Math.max(Q,8)/2;case 36196:case 37492:case 37488:case 37489:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*8;case 37496:case 37490:case 37491:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*16;case 37808:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*16;case 37809:return Math.floor((J+4)/5)*Math.floor((Q+3)/4)*16;case 37810:return Math.floor((J+4)/5)*Math.floor((Q+4)/5)*16;case 37811:return Math.floor((J+5)/6)*Math.floor((Q+4)/5)*16;case 37812:return Math.floor((J+5)/6)*Math.floor((Q+5)/6)*16;case 37813:return Math.floor((J+7)/8)*Math.floor((Q+4)/5)*16;case 37814:return Math.floor((J+7)/8)*Math.floor((Q+5)/6)*16;case 37815:return Math.floor((J+7)/8)*Math.floor((Q+7)/8)*16;case 37816:return Math.floor((J+9)/10)*Math.floor((Q+4)/5)*16;case 37817:return Math.floor((J+9)/10)*Math.floor((Q+5)/6)*16;case 37818:return Math.floor((J+9)/10)*Math.floor((Q+7)/8)*16;case 37819:return Math.floor((J+9)/10)*Math.floor((Q+9)/10)*16;case 37820:return Math.floor((J+11)/12)*Math.floor((Q+9)/10)*16;case 37821:return Math.floor((J+11)/12)*Math.floor((Q+11)/12)*16;case 36492:case 36494:case 36495:return Math.ceil(J/4)*Math.ceil(Q/4)*16;case 36283:case 36284:return Math.ceil(J/4)*Math.ceil(Q/4)*8;case 36285:case 36286:return Math.ceil(J/4)*Math.ceil(Q/4)*16}throw Error(`Unable to determine texture byte length for ${$} format.`)}function NU(J){switch(J){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw Error(`Unknown texture type ${J}.`)}if(typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"184"}}));if(typeof window<"u")if(window.__THREE__)C0("WARNING: Multiple instances of Three.js being imported.");else window.__THREE__="184";function AX(){let J=null,Q=!1,$=null,Z=null;function W(Y,X){$(Y,X),Z=J.requestAnimationFrame(W)}return{start:function(){if(Q===!0)return;if($===null)return;if(J===null)return;Z=J.requestAnimationFrame(W),Q=!0},stop:function(){if(J!==null)J.cancelAnimationFrame(Z);Q=!1},setAnimationLoop:function(Y){$=Y},setContext:function(Y){J=Y}}}function OU(J){let Q=new WeakMap;function $(K,H){let{array:U,usage:G}=K,F=U.byteLength,E=J.createBuffer();J.bindBuffer(H,E),J.bufferData(H,U,G),K.onUploadCallback();let O;if(U instanceof Float32Array)O=J.FLOAT;else if(typeof Float16Array<"u"&&U instanceof Float16Array)O=J.HALF_FLOAT;else if(U instanceof Uint16Array)if(K.isFloat16BufferAttribute)O=J.HALF_FLOAT;else O=J.UNSIGNED_SHORT;else if(U instanceof Int16Array)O=J.SHORT;else if(U instanceof Uint32Array)O=J.UNSIGNED_INT;else if(U instanceof Int32Array)O=J.INT;else if(U instanceof Int8Array)O=J.BYTE;else if(U instanceof Uint8Array)O=J.UNSIGNED_BYTE;else if(U instanceof Uint8ClampedArray)O=J.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+U);return{buffer:E,type:O,bytesPerElement:U.BYTES_PER_ELEMENT,version:K.version,size:F}}function Z(K,H,U){let{array:G,updateRanges:F}=H;if(J.bindBuffer(U,K),F.length===0)J.bufferSubData(U,0,G);else{F.sort((O,R)=>O.start-R.start);let E=0;for(let O=1;O<F.length;O++){let R=F[E],C=F[O];if(C.start<=R.start+R.count+1)R.count=Math.max(R.count,C.start+C.count-R.start);else++E,F[E]=C}F.length=E+1;for(let O=0,R=F.length;O<R;O++){let C=F[O];J.bufferSubData(U,C.start*G.BYTES_PER_ELEMENT,G,C.start,C.count)}H.clearUpdateRanges()}H.onUploadCallback()}function W(K){if(K.isInterleavedBufferAttribute)K=K.data;return Q.get(K)}function Y(K){if(K.isInterleavedBufferAttribute)K=K.data;let H=Q.get(K);if(H)J.deleteBuffer(H.buffer),Q.delete(K)}function X(K,H){if(K.isInterleavedBufferAttribute)K=K.data;if(K.isGLBufferAttribute){let G=Q.get(K);if(!G||G.version<K.version)Q.set(K,{buffer:K.buffer,type:K.type,bytesPerElement:K.elementSize,version:K.version});return}let U=Q.get(K);if(U===void 0)Q.set(K,$(K,H));else if(U.version<K.version){if(U.size!==K.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.");Z(U.buffer,K,H),U.version=K.version}}return{get:W,remove:Y,update:X}}var qU=`#ifdef USE_ALPHAHASH
5
+ }`;class LJ extends vJ{constructor(J){super();if(this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=tF,this.fragmentShader=eF,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,J!==void 0)this.setValues(J)}copy(J){return super.copy(J),this.fragmentShader=J.fragmentShader,this.vertexShader=J.vertexShader,this.uniforms=g6(J.uniforms),this.uniformsGroups=rF(J.uniformsGroups),this.defines=Object.assign({},J.defines),this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.fog=J.fog,this.lights=J.lights,this.clipping=J.clipping,this.extensions=Object.assign({},J.extensions),this.glslVersion=J.glslVersion,this.defaultAttributeValues=Object.assign({},J.defaultAttributeValues),this.index0AttributeName=J.index0AttributeName,this.uniformsNeedUpdate=J.uniformsNeedUpdate,this}toJSON(J){let Q=super.toJSON(J);Q.glslVersion=this.glslVersion,Q.uniforms={};for(let Z in this.uniforms){let Y=this.uniforms[Z].value;if(Y&&Y.isTexture)Q.uniforms[Z]={type:"t",value:Y.toJSON(J).uuid};else if(Y&&Y.isColor)Q.uniforms[Z]={type:"c",value:Y.getHex()};else if(Y&&Y.isVector2)Q.uniforms[Z]={type:"v2",value:Y.toArray()};else if(Y&&Y.isVector3)Q.uniforms[Z]={type:"v3",value:Y.toArray()};else if(Y&&Y.isVector4)Q.uniforms[Z]={type:"v4",value:Y.toArray()};else if(Y&&Y.isMatrix3)Q.uniforms[Z]={type:"m3",value:Y.toArray()};else if(Y&&Y.isMatrix4)Q.uniforms[Z]={type:"m4",value:Y.toArray()};else Q.uniforms[Z]={value:Y}}if(Object.keys(this.defines).length>0)Q.defines=this.defines;Q.vertexShader=this.vertexShader,Q.fragmentShader=this.fragmentShader,Q.lights=this.lights,Q.clipping=this.clipping;let $={};for(let Z in this.extensions)if(this.extensions[Z]===!0)$[Z]=!0;if(Object.keys($).length>0)Q.extensions=$;return Q}}class p6 extends LJ{constructor(J){super(J);this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class sJ extends vJ{constructor(J){super();this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new e(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new P9,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.defines={STANDARD:""},this.color.copy(J.color),this.roughness=J.roughness,this.metalness=J.metalness,this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.emissive.copy(J.emissive),this.emissiveMap=J.emissiveMap,this.emissiveIntensity=J.emissiveIntensity,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.roughnessMap=J.roughnessMap,this.metalnessMap=J.metalnessMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.envMapIntensity=J.envMapIntensity,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.flatShading=J.flatShading,this.fog=J.fog,this}}class iJ extends sJ{constructor(J){super();this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new i(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return s0(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(Q){this.ior=(1+0.4*Q)/(1-0.4*Q)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new e(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new e(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new e(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(J)}get anisotropy(){return this._anisotropy}set anisotropy(J){if(this._anisotropy>0!==J>0)this.version++;this._anisotropy=J}get clearcoat(){return this._clearcoat}set clearcoat(J){if(this._clearcoat>0!==J>0)this.version++;this._clearcoat=J}get iridescence(){return this._iridescence}set iridescence(J){if(this._iridescence>0!==J>0)this.version++;this._iridescence=J}get dispersion(){return this._dispersion}set dispersion(J){if(this._dispersion>0!==J>0)this.version++;this._dispersion=J}get sheen(){return this._sheen}set sheen(J){if(this._sheen>0!==J>0)this.version++;this._sheen=J}get transmission(){return this._transmission}set transmission(J){if(this._transmission>0!==J>0)this.version++;this._transmission=J}copy(J){return super.copy(J),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=J.anisotropy,this.anisotropyRotation=J.anisotropyRotation,this.anisotropyMap=J.anisotropyMap,this.clearcoat=J.clearcoat,this.clearcoatMap=J.clearcoatMap,this.clearcoatRoughness=J.clearcoatRoughness,this.clearcoatRoughnessMap=J.clearcoatRoughnessMap,this.clearcoatNormalMap=J.clearcoatNormalMap,this.clearcoatNormalScale.copy(J.clearcoatNormalScale),this.dispersion=J.dispersion,this.ior=J.ior,this.iridescence=J.iridescence,this.iridescenceMap=J.iridescenceMap,this.iridescenceIOR=J.iridescenceIOR,this.iridescenceThicknessRange=[...J.iridescenceThicknessRange],this.iridescenceThicknessMap=J.iridescenceThicknessMap,this.sheen=J.sheen,this.sheenColor.copy(J.sheenColor),this.sheenColorMap=J.sheenColorMap,this.sheenRoughness=J.sheenRoughness,this.sheenRoughnessMap=J.sheenRoughnessMap,this.transmission=J.transmission,this.transmissionMap=J.transmissionMap,this.thickness=J.thickness,this.thicknessMap=J.thicknessMap,this.attenuationDistance=J.attenuationDistance,this.attenuationColor.copy(J.attenuationColor),this.specularIntensity=J.specularIntensity,this.specularIntensityMap=J.specularIntensityMap,this.specularColor.copy(J.specularColor),this.specularColorMap=J.specularColorMap,this}}class zW extends vJ{constructor(J){super();this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new e(16777215),this.specular=new e(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new P9,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.specular.copy(J.specular),this.shininess=J.shininess,this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.emissive.copy(J.emissive),this.emissiveMap=J.emissiveMap,this.emissiveIntensity=J.emissiveIntensity,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.specularMap=J.specularMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.combine=J.combine,this.reflectivity=J.reflectivity,this.envMapIntensity=J.envMapIntensity,this.refractionRatio=J.refractionRatio,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.flatShading=J.flatShading,this.fog=J.fog,this}}class _W extends vJ{constructor(J){super();this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new e(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.gradientMap=J.gradientMap,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.emissive.copy(J.emissive),this.emissiveMap=J.emissiveMap,this.emissiveIntensity=J.emissiveIntensity,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.alphaMap=J.alphaMap,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.fog=J.fog,this}}class wW extends vJ{constructor(J){super();this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(J)}copy(J){return super.copy(J),this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.flatShading=J.flatShading,this}}class l7 extends vJ{constructor(J){super();this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new e(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new e(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new P9,this.combine=0,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=0.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.color.copy(J.color),this.map=J.map,this.lightMap=J.lightMap,this.lightMapIntensity=J.lightMapIntensity,this.aoMap=J.aoMap,this.aoMapIntensity=J.aoMapIntensity,this.emissive.copy(J.emissive),this.emissiveMap=J.emissiveMap,this.emissiveIntensity=J.emissiveIntensity,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.specularMap=J.specularMap,this.alphaMap=J.alphaMap,this.envMap=J.envMap,this.envMapRotation.copy(J.envMapRotation),this.combine=J.combine,this.reflectivity=J.reflectivity,this.envMapIntensity=J.envMapIntensity,this.refractionRatio=J.refractionRatio,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.wireframeLinecap=J.wireframeLinecap,this.wireframeLinejoin=J.wireframeLinejoin,this.flatShading=J.flatShading,this.fog=J.fog,this}}class W$ extends vJ{constructor(J){super();this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(J)}copy(J){return super.copy(J),this.depthPacking=J.depthPacking,this.map=J.map,this.alphaMap=J.alphaMap,this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this}}class Y$ extends vJ{constructor(J){super();this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(J)}copy(J){return super.copy(J),this.map=J.map,this.alphaMap=J.alphaMap,this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this}}class PW extends vJ{constructor(J){super();this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new e(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new i(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(J)}copy(J){return super.copy(J),this.defines={MATCAP:""},this.color.copy(J.color),this.matcap=J.matcap,this.map=J.map,this.bumpMap=J.bumpMap,this.bumpScale=J.bumpScale,this.normalMap=J.normalMap,this.normalMapType=J.normalMapType,this.normalScale.copy(J.normalScale),this.displacementMap=J.displacementMap,this.displacementScale=J.displacementScale,this.displacementBias=J.displacementBias,this.alphaMap=J.alphaMap,this.wireframe=J.wireframe,this.wireframeLinewidth=J.wireframeLinewidth,this.flatShading=J.flatShading,this.fog=J.fog,this}}class TW extends uJ{constructor(J){super();this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(J)}copy(J){return super.copy(J),this.scale=J.scale,this.dashSize=J.dashSize,this.gapSize=J.gapSize,this}}function k6(J,Q){if(!J||J.constructor===Q)return J;if(typeof Q.BYTES_PER_ELEMENT==="number")return new Q(J);return Array.prototype.slice.call(J)}function q5(J){function Q(W,Y){return J[W]-J[Y]}let $=J.length,Z=Array($);for(let W=0;W!==$;++W)Z[W]=W;return Z.sort(Q),Z}function eY(J,Q,$){let Z=J.length,W=new J.constructor(Z);for(let Y=0,X=0;X!==Z;++Y){let K=$[Y]*Q;for(let H=0;H!==Q;++H)W[X++]=J[K+H]}return W}function NK(J,Q,$,Z){let W=1,Y=J[0];while(Y!==void 0&&Y[Z]===void 0)Y=J[W++];if(Y===void 0)return;let X=Y[Z];if(X===void 0)return;if(Array.isArray(X))do{if(X=Y[Z],X!==void 0)Q.push(Y.time),$.push(...X);Y=J[W++]}while(Y!==void 0);else if(X.toArray!==void 0)do{if(X=Y[Z],X!==void 0)Q.push(Y.time),X.toArray($,$.length);Y=J[W++]}while(Y!==void 0);else do{if(X=Y[Z],X!==void 0)Q.push(Y.time),$.push(X);Y=J[W++]}while(Y!==void 0)}function JN(J,Q,$,Z,W=30){let Y=J.clone();Y.name=Q;let X=[];for(let H=0;H<Y.tracks.length;++H){let U=Y.tracks[H],G=U.getValueSize(),F=[],E=[];for(let O=0;O<U.times.length;++O){let R=U.times[O]*W;if(R<$||R>=Z)continue;F.push(U.times[O]);for(let k=0;k<G;++k)E.push(U.values[O*G+k])}if(F.length===0)continue;U.times=k6(F,U.times.constructor),U.values=k6(E,U.values.constructor),X.push(U)}Y.tracks=X;let K=1/0;for(let H=0;H<Y.tracks.length;++H)if(K>Y.tracks[H].times[0])K=Y.tracks[H].times[0];for(let H=0;H<Y.tracks.length;++H)Y.tracks[H].shift(-1*K);return Y.resetDuration(),Y}function QN(J,Q=0,$=J,Z=30){if(Z<=0)Z=30;let W=$.tracks.length,Y=Q/Z;for(let X=0;X<W;++X){let K=$.tracks[X],H=K.ValueTypeName;if(H==="bool"||H==="string")continue;let U=J.tracks.find(function(N){return N.name===K.name&&N.ValueTypeName===H});if(U===void 0)continue;let G=0,F=K.getValueSize();if(K.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)G=F/3;let E=0,O=U.getValueSize();if(U.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)E=O/3;let R=K.times.length-1,k;if(Y<=K.times[0]){let N=G,L=F-G;k=K.values.slice(N,L)}else if(Y>=K.times[R]){let N=R*F+G,L=N+F-G;k=K.values.slice(N,L)}else{let N=K.createInterpolant(),L=G,D=F-G;N.evaluate(Y),k=N.resultBuffer.slice(L,D)}if(H==="quaternion")new IJ().fromArray(k).normalize().conjugate().toArray(k);let q=U.times.length;for(let N=0;N<q;++N){let L=N*O+E;if(H==="quaternion")IJ.multiplyQuaternionsFlat(U.values,L,k,0,U.values,L);else{let D=O-E*2;for(let V=0;V<D;++V)U.values[L+V]-=k[V]}}}return J.blendMode=2501,J}class OK{static convertArray(J,Q){return k6(J,Q)}static isTypedArray(J){return Q5(J)}static getKeyframeOrder(J){return q5(J)}static sortedArray(J,Q,$){return eY(J,Q,$)}static flattenJSON(J,Q,$,Z){NK(J,Q,$,Z)}static subclip(J,Q,$,Z,W=30){return JN(J,Q,$,Z,W)}static makeClipAdditive(J,Q=0,$=J,Z=30){return QN(J,Q,$,Z)}}class U8{constructor(J,Q,$,Z){this.parameterPositions=J,this._cachedIndex=0,this.resultBuffer=Z!==void 0?Z:new Q.constructor($),this.sampleValues=Q,this.valueSize=$,this.settings=null,this.DefaultSettings_={}}evaluate(J){let Q=this.parameterPositions,$=this._cachedIndex,Z=Q[$],W=Q[$-1];J:{Q:{let Y;$:{Z:if(!(J<Z)){for(let X=$+2;;){if(Z===void 0){if(J<W)break Z;return $=Q.length,this._cachedIndex=$,this.copySampleValue_($-1)}if($===X)break;if(W=Z,Z=Q[++$],J<Z)break Q}Y=Q.length;break $}if(!(J>=W)){let X=Q[1];if(J<X)$=2,W=X;for(let K=$-2;;){if(W===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if($===K)break;if(Z=W,W=Q[--$-1],J>=W)break Q}Y=$,$=0;break $}break J}while($<Y){let X=$+Y>>>1;if(J<Q[X])Y=X;else $=X+1}if(Z=Q[$],W=Q[$-1],W===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(Z===void 0)return $=Q.length,this._cachedIndex=$,this.copySampleValue_($-1)}this._cachedIndex=$,this.intervalChanged_($,W,Z)}return this.interpolate_($,W,J,Z)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(J){let Q=this.resultBuffer,$=this.sampleValues,Z=this.valueSize,W=J*Z;for(let Y=0;Y!==Z;++Y)Q[Y]=$[W+Y];return Q}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}}class AW extends U8{constructor(J,Q,$,Z){super(J,Q,$,Z);this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(J,Q,$){let Z=this.parameterPositions,W=J-2,Y=J+1,X=Z[W],K=Z[Y];if(X===void 0)switch(this.getSettings_().endingStart){case 2401:W=J,X=2*Q-$;break;case 2402:W=Z.length-2,X=Q+Z[W]-Z[W+1];break;default:W=J,X=$}if(K===void 0)switch(this.getSettings_().endingEnd){case 2401:Y=J,K=2*$-Q;break;case 2402:Y=1,K=$+Z[1]-Z[0];break;default:Y=J-1,K=Q}let H=($-Q)*0.5,U=this.valueSize;this._weightPrev=H/(Q-X),this._weightNext=H/(K-$),this._offsetPrev=W*U,this._offsetNext=Y*U}interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=J*X,H=K-X,U=this._offsetPrev,G=this._offsetNext,F=this._weightPrev,E=this._weightNext,O=($-Q)/(Z-Q),R=O*O,k=R*O,q=-F*k+2*F*R-F*O,N=(1+F)*k+(-1.5-2*F)*R+(-0.5+F)*O+1,L=(-1-E)*k+(1.5+E)*R+0.5*O,D=E*k-E*R;for(let V=0;V!==X;++V)W[V]=q*Y[U+V]+N*Y[H+V]+L*Y[K+V]+D*Y[G+V];return W}}class X$ extends U8{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=J*X,H=K-X,U=($-Q)/(Z-Q),G=1-U;for(let F=0;F!==X;++F)W[F]=Y[H+F]*G+Y[K+F]*U;return W}}class SW extends U8{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J){return this.copySampleValue_(J-1)}}class jW extends U8{interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=J*X,H=K-X,U=this.settings||this.DefaultSettings_,G=U.inTangents,F=U.outTangents;if(!G||!F){let R=($-Q)/(Z-Q),k=1-R;for(let q=0;q!==X;++q)W[q]=Y[H+q]*k+Y[K+q]*R;return W}let E=X*2,O=J-1;for(let R=0;R!==X;++R){let k=Y[H+R],q=Y[K+R],N=O*E+R*2,L=F[N],D=F[N+1],V=J*E+R*2,I=G[V],z=G[V+1],B=($-Q)/(Z-Q),M,C,j,w,v;for(let b=0;b<8;b++){M=B*B,C=M*B,j=1-B,w=j*j,v=w*j;let h=v*Q+3*w*B*L+3*j*M*I+C*Z-$;if(Math.abs(h)<0.0000000001)break;let x=3*w*(L-Q)+6*j*B*(I-L)+3*M*(Z-I);if(Math.abs(x)<0.0000000001)break;B=B-h/x,B=Math.max(0,Math.min(1,B))}W[R]=v*k+3*w*B*D+3*j*M*z+C*q}return W}}class O9{constructor(J,Q,$,Z){if(J===void 0)throw Error("THREE.KeyframeTrack: track name is undefined");if(Q===void 0||Q.length===0)throw Error("THREE.KeyframeTrack: no keyframes in track named "+J);this.name=J,this.times=k6(Q,this.TimeBufferType),this.values=k6($,this.ValueBufferType),this.setInterpolation(Z||this.DefaultInterpolation)}static toJSON(J){let Q=J.constructor,$;if(Q.toJSON!==this.toJSON)$=Q.toJSON(J);else{$={name:J.name,times:k6(J.times,Array),values:k6(J.values,Array)};let Z=J.getInterpolation();if(Z!==J.DefaultInterpolation)$.interpolation=Z}return $.type=J.ValueTypeName,$}InterpolantFactoryMethodDiscrete(J){return new SW(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodLinear(J){return new X$(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodSmooth(J){return new AW(this.times,this.values,this.getValueSize(),J)}InterpolantFactoryMethodBezier(J){let Q=new jW(this.times,this.values,this.getValueSize(),J);if(this.settings)Q.settings=this.settings;return Q}setInterpolation(J){let Q;switch(J){case 2300:Q=this.InterpolantFactoryMethodDiscrete;break;case 2301:Q=this.InterpolantFactoryMethodLinear;break;case 2302:Q=this.InterpolantFactoryMethodSmooth;break;case 2303:Q=this.InterpolantFactoryMethodBezier;break}if(Q===void 0){let $="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(J!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error($);return O0("KeyframeTrack:",$),this}return this.createInterpolant=Q,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302;case this.InterpolantFactoryMethodBezier:return 2303}}getValueSize(){return this.values.length/this.times.length}shift(J){if(J!==0){let Q=this.times;for(let $=0,Z=Q.length;$!==Z;++$)Q[$]+=J}return this}scale(J){if(J!==1){let Q=this.times;for(let $=0,Z=Q.length;$!==Z;++$)Q[$]*=J}return this}trim(J,Q){let $=this.times,Z=$.length,W=0,Y=Z-1;while(W!==Z&&$[W]<J)++W;while(Y!==-1&&$[Y]>Q)--Y;if(++Y,W!==0||Y!==Z){if(W>=Y)Y=Math.max(Y,1),W=Y-1;let X=this.getValueSize();this.times=$.slice(W,Y),this.values=this.values.slice(W*X,Y*X)}return this}validate(){let J=!0,Q=this.getValueSize();if(Q-Math.floor(Q)!==0)v0("KeyframeTrack: Invalid value size in track.",this),J=!1;let $=this.times,Z=this.values,W=$.length;if(W===0)v0("KeyframeTrack: Track is empty.",this),J=!1;let Y=null;for(let X=0;X!==W;X++){let K=$[X];if(typeof K==="number"&&isNaN(K)){v0("KeyframeTrack: Time is not a valid number.",this,X,K),J=!1;break}if(Y!==null&&Y>K){v0("KeyframeTrack: Out of order keys.",this,X,K,Y),J=!1;break}Y=K}if(Z!==void 0){if(Q5(Z))for(let X=0,K=Z.length;X!==K;++X){let H=Z[X];if(isNaN(H)){v0("KeyframeTrack: Value is not a valid number.",this,X,H),J=!1;break}}}return J}optimize(){let J=this.times.slice(),Q=this.values.slice(),$=this.getValueSize(),Z=this.getInterpolation()===2302,W=J.length-1,Y=1;for(let X=1;X<W;++X){let K=!1,H=J[X],U=J[X+1];if(H!==U&&(X!==1||H!==J[0]))if(!Z){let G=X*$,F=G-$,E=G+$;for(let O=0;O!==$;++O){let R=Q[G+O];if(R!==Q[F+O]||R!==Q[E+O]){K=!0;break}}}else K=!0;if(K){if(X!==Y){J[Y]=J[X];let G=X*$,F=Y*$;for(let E=0;E!==$;++E)Q[F+E]=Q[G+E]}++Y}}if(W>0){J[Y]=J[W];for(let X=W*$,K=Y*$,H=0;H!==$;++H)Q[K+H]=Q[X+H];++Y}if(Y!==J.length)this.times=J.slice(0,Y),this.values=Q.slice(0,Y*$);else this.times=J,this.values=Q;return this}clone(){let J=this.times.slice(),Q=this.values.slice(),Z=new this.constructor(this.name,J,Q);return Z.createInterpolant=this.createInterpolant,Z}}O9.prototype.ValueTypeName="";O9.prototype.TimeBufferType=Float32Array;O9.prototype.ValueBufferType=Float32Array;O9.prototype.DefaultInterpolation=2301;class A8 extends O9{constructor(J,Q,$){super(J,Q,$)}}A8.prototype.ValueTypeName="bool";A8.prototype.ValueBufferType=Array;A8.prototype.DefaultInterpolation=2300;A8.prototype.InterpolantFactoryMethodLinear=void 0;A8.prototype.InterpolantFactoryMethodSmooth=void 0;class K$ extends O9{constructor(J,Q,$,Z){super(J,Q,$,Z)}}K$.prototype.ValueTypeName="color";class Y8 extends O9{constructor(J,Q,$,Z){super(J,Q,$,Z)}}Y8.prototype.ValueTypeName="number";class vW extends U8{constructor(J,Q,$,Z){super(J,Q,$,Z)}interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=($-Q)/(Z-Q),H=J*X;for(let U=H+X;H!==U;H+=4)IJ.slerpFlat(W,0,Y,H-X,Y,H,K);return W}}class G8 extends O9{constructor(J,Q,$,Z){super(J,Q,$,Z)}InterpolantFactoryMethodLinear(J){return new vW(this.times,this.values,this.getValueSize(),J)}}G8.prototype.ValueTypeName="quaternion";G8.prototype.InterpolantFactoryMethodSmooth=void 0;class S8 extends O9{constructor(J,Q,$){super(J,Q,$)}}S8.prototype.ValueTypeName="string";S8.prototype.ValueBufferType=Array;S8.prototype.DefaultInterpolation=2300;S8.prototype.InterpolantFactoryMethodLinear=void 0;S8.prototype.InterpolantFactoryMethodSmooth=void 0;class X8 extends O9{constructor(J,Q,$,Z){super(J,Q,$,Z)}}X8.prototype.ValueTypeName="vector";class C8{constructor(J="",Q=-1,$=[],Z=2500){if(this.name=J,this.tracks=$,this.duration=Q,this.blendMode=Z,this.uuid=D9(),this.userData={},this.duration<0)this.resetDuration()}static parse(J){let Q=[],$=J.tracks,Z=1/(J.fps||1);for(let Y=0,X=$.length;Y!==X;++Y)Q.push(ZN($[Y]).scale(Z));let W=new this(J.name,J.duration,Q,J.blendMode);return W.uuid=J.uuid,W.userData=JSON.parse(J.userData||"{}"),W}static toJSON(J){let Q=[],$=J.tracks,Z={name:J.name,duration:J.duration,tracks:Q,uuid:J.uuid,blendMode:J.blendMode,userData:JSON.stringify(J.userData)};for(let W=0,Y=$.length;W!==Y;++W)Q.push(O9.toJSON($[W]));return Z}static CreateFromMorphTargetSequence(J,Q,$,Z){let W=Q.length,Y=[];for(let X=0;X<W;X++){let K=[],H=[];K.push((X+W-1)%W,X,(X+1)%W),H.push(0,1,0);let U=q5(K);if(K=eY(K,1,U),H=eY(H,1,U),!Z&&K[0]===0)K.push(W),H.push(H[0]);Y.push(new Y8(".morphTargetInfluences["+Q[X].name+"]",K,H).scale(1/$))}return new this(J,-1,Y)}static findByName(J,Q){let $=J;if(!Array.isArray(J)){let Z=J;$=Z.geometry&&Z.geometry.animations||Z.animations}for(let Z=0;Z<$.length;Z++)if($[Z].name===Q)return $[Z];return null}static CreateClipsFromMorphTargetSequences(J,Q,$){let Z={},W=/^([\w-]*?)([\d]+)$/;for(let X=0,K=J.length;X<K;X++){let H=J[X],U=H.name.match(W);if(U&&U.length>1){let G=U[1],F=Z[G];if(!F)Z[G]=F=[];F.push(H)}}let Y=[];for(let X in Z)Y.push(this.CreateFromMorphTargetSequence(X,Z[X],Q,$));return Y}static parseAnimation(J,Q){if(O0("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!J)return v0("AnimationClip: No animation in JSONLoader data."),null;let $=function(G,F,E,O,R){if(E.length!==0){let k=[],q=[];if(NK(E,k,q,O),k.length!==0)R.push(new G(F,k,q))}},Z=[],W=J.name||"default",Y=J.fps||30,X=J.blendMode,K=J.length||-1,H=J.hierarchy||[];for(let G=0;G<H.length;G++){let F=H[G].keys;if(!F||F.length===0)continue;if(F[0].morphTargets){let E={},O;for(O=0;O<F.length;O++)if(F[O].morphTargets)for(let R=0;R<F[O].morphTargets.length;R++)E[F[O].morphTargets[R]]=-1;for(let R in E){let k=[],q=[];for(let N=0;N!==F[O].morphTargets.length;++N){let L=F[O];k.push(L.time),q.push(L.morphTarget===R?1:0)}Z.push(new Y8(".morphTargetInfluence["+R+"]",k,q))}K=E.length*Y}else{let E=".bones["+Q[G].name+"]";$(X8,E+".position",F,"pos",Z),$(G8,E+".quaternion",F,"rot",Z),$(X8,E+".scale",F,"scl",Z)}}if(Z.length===0)return null;return new this(W,K,Z,X)}resetDuration(){let J=this.tracks,Q=0;for(let $=0,Z=J.length;$!==Z;++$){let W=this.tracks[$];Q=Math.max(Q,W.times[W.times.length-1])}return this.duration=Q,this}trim(){for(let J=0;J<this.tracks.length;J++)this.tracks[J].trim(0,this.duration);return this}validate(){let J=!0;for(let Q=0;Q<this.tracks.length;Q++)J=J&&this.tracks[Q].validate();return J}optimize(){for(let J=0;J<this.tracks.length;J++)this.tracks[J].optimize();return this}clone(){let J=[];for(let $=0;$<this.tracks.length;$++)J.push(this.tracks[$].clone());let Q=new this.constructor(this.name,this.duration,J,this.blendMode);return Q.userData=JSON.parse(JSON.stringify(this.userData)),Q}toJSON(){return this.constructor.toJSON(this)}}function $N(J){switch(J.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Y8;case"vector":case"vector2":case"vector3":case"vector4":return X8;case"color":return K$;case"quaternion":return G8;case"bool":case"boolean":return A8;case"string":return S8}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+J)}function ZN(J){if(J.type===void 0)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let Q=$N(J.type);if(J.times===void 0){let $=[],Z=[];NK(J.keys,$,Z,"value"),J.times=$,J.values=Z}if(Q.parse!==void 0)return Q.parse(J);else return new Q(J.name,J.times,J.values,J.interpolation)}var d9={enabled:!1,files:{},add:function(J,Q){if(this.enabled===!1)return;if(TU(J))return;this.files[J]=Q},get:function(J){if(this.enabled===!1)return;if(TU(J))return;return this.files[J]},remove:function(J){delete this.files[J]},clear:function(){this.files={}}};function TU(J){try{let Q=J.slice(J.indexOf(":")+1);return new URL(Q).protocol==="blob:"}catch(Q){return!1}}class H${constructor(J,Q,$){let Z=this,W=!1,Y=0,X=0,K=void 0,H=[];this.onStart=void 0,this.onLoad=J,this.onProgress=Q,this.onError=$,this._abortController=null,this.itemStart=function(U){if(X++,W===!1){if(Z.onStart!==void 0)Z.onStart(U,Y,X)}W=!0},this.itemEnd=function(U){if(Y++,Z.onProgress!==void 0)Z.onProgress(U,Y,X);if(Y===X){if(W=!1,Z.onLoad!==void 0)Z.onLoad()}},this.itemError=function(U){if(Z.onError!==void 0)Z.onError(U)},this.resolveURL=function(U){if(K)return K(U);return U},this.setURLModifier=function(U){return K=U,this},this.addHandler=function(U,G){return H.push(U,G),this},this.removeHandler=function(U){let G=H.indexOf(U);if(G!==-1)H.splice(G,2);return this},this.getHandler=function(U){for(let G=0,F=H.length;G<F;G+=2){let E=H[G],O=H[G+1];if(E.global)E.lastIndex=0;if(E.test(U))return O}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){if(!this._abortController)this._abortController=new AbortController;return this._abortController}}var qK=new H$;class nJ{constructor(J){if(this.manager=J!==void 0?J:qK,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(J,Q){let $=this;return new Promise(function(Z,W){$.load(J,Z,Q,W)})}parse(){}setCrossOrigin(J){return this.crossOrigin=J,this}setWithCredentials(J){return this.withCredentials=J,this}setPath(J){return this.path=J,this}setResourcePath(J){return this.resourcePath=J,this}setRequestHeader(J){return this.requestHeader=J,this}abort(){return this}}nJ.DEFAULT_MATERIAL_NAME="__DEFAULT";var k8={};class R5 extends Error{constructor(J,Q){super(J);this.response=Q}}class G9 extends nJ{constructor(J){super(J);this.mimeType="",this.responseType="",this._abortController=new AbortController}load(J,Q,$,Z){if(J===void 0)J="";if(this.path!==void 0)J=this.path+J;J=this.manager.resolveURL(J);let W=d9.get(`file:${J}`);if(W!==void 0){this.manager.itemStart(J),setTimeout(()=>{if(Q)Q(W);this.manager.itemEnd(J)},0);return}if(k8[J]!==void 0){k8[J].push({onLoad:Q,onProgress:$,onError:Z});return}k8[J]=[],k8[J].push({onLoad:Q,onProgress:$,onError:Z});let Y=new Request(J,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),X=this.mimeType,K=this.responseType;fetch(Y).then((H)=>{if(H.status===200||H.status===0){if(H.status===0)O0("FileLoader: HTTP Status 0 received.");if(typeof ReadableStream>"u"||H.body===void 0||H.body.getReader===void 0)return H;let U=k8[J],G=H.body.getReader(),F=H.headers.get("X-File-Size")||H.headers.get("Content-Length"),E=F?parseInt(F):0,O=E!==0,R=0,k=new ReadableStream({start(q){N();function N(){G.read().then(({done:L,value:D})=>{if(L)q.close();else{R+=D.byteLength;let V=new ProgressEvent("progress",{lengthComputable:O,loaded:R,total:E});for(let I=0,z=U.length;I<z;I++){let B=U[I];if(B.onProgress)B.onProgress(V)}q.enqueue(D),N()}},(L)=>{q.error(L)})}}});return new Response(k)}else throw new R5(`fetch for "${H.url}" responded with ${H.status}: ${H.statusText}`,H)}).then((H)=>{switch(K){case"arraybuffer":return H.arrayBuffer();case"blob":return H.blob();case"document":return H.text().then((U)=>{return new DOMParser().parseFromString(U,X)});case"json":return H.json();default:if(X==="")return H.text();else{let G=/charset="?([^;"\s]*)"?/i.exec(X),F=G&&G[1]?G[1].toLowerCase():void 0,E=new TextDecoder(F);return H.arrayBuffer().then((O)=>E.decode(O))}}}).then((H)=>{d9.add(`file:${J}`,H);let U=k8[J];delete k8[J];for(let G=0,F=U.length;G<F;G++){let E=U[G];if(E.onLoad)E.onLoad(H)}}).catch((H)=>{let U=k8[J];if(U===void 0)throw this.manager.itemError(J),H;delete k8[J];for(let G=0,F=U.length;G<F;G++){let E=U[G];if(E.onError)E.onError(H)}this.manager.itemError(J)}).finally(()=>{this.manager.itemEnd(J)}),this.manager.itemStart(J)}setResponseType(J){return this.responseType=J,this}setMimeType(J){return this.mimeType=J,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class RK extends nJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,Y=new G9(this.manager);Y.setPath(this.path),Y.setRequestHeader(this.requestHeader),Y.setWithCredentials(this.withCredentials),Y.load(J,function(X){try{Q(W.parse(JSON.parse(X)))}catch(K){if(Z)Z(K);else v0(K);W.manager.itemError(J)}},$,Z)}parse(J){let Q=[];for(let $=0;$<J.length;$++){let Z=C8.parse(J[$]);Q.push(Z)}return Q}}class LK extends nJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,Y=[],X=new g7,K=new G9(this.manager);K.setPath(this.path),K.setResponseType("arraybuffer"),K.setRequestHeader(this.requestHeader),K.setWithCredentials(W.withCredentials);let H=0;function U(G){K.load(J[G],function(F){let E=W.parse(F,!0);if(Y[G]={width:E.width,height:E.height,format:E.format,mipmaps:E.mipmaps},H+=1,H===6){if(E.mipmapCount===1)X.minFilter=1006;if(X.image=Y,X.format=E.format,X.needsUpdate=!0,Q)Q(X)}},$,Z)}if(Array.isArray(J))for(let G=0,F=J.length;G<F;++G)U(G);else K.load(J,function(G){let F=W.parse(G,!0);if(F.isCubemap){let E=F.mipmaps.length/F.mipmapCount;for(let O=0;O<E;O++){Y[O]={mipmaps:[]};for(let R=0;R<F.mipmapCount;R++)Y[O].mipmaps.push(F.mipmaps[O*F.mipmapCount+R]),Y[O].format=F.format,Y[O].width=F.width,Y[O].height=F.height}X.image=Y}else X.image.width=F.width,X.image.height=F.height,X.mipmaps=F.mipmaps;if(F.mipmapCount===1)X.minFilter=1006;if(X.format=F.format,X.needsUpdate=!0,Q)Q(X)},$,Z);return X}}var F7=new WeakMap;class C6 extends nJ{constructor(J){super(J)}load(J,Q,$,Z){if(this.path!==void 0)J=this.path+J;J=this.manager.resolveURL(J);let W=this,Y=d9.get(`image:${J}`);if(Y!==void 0){if(Y.complete===!0)W.manager.itemStart(J),setTimeout(function(){if(Q)Q(Y);W.manager.itemEnd(J)},0);else{let G=F7.get(Y);if(G===void 0)G=[],F7.set(Y,G);G.push({onLoad:Q,onError:Z})}return Y}let X=k7("img");function K(){if(U(),Q)Q(this);let G=F7.get(this)||[];for(let F=0;F<G.length;F++){let E=G[F];if(E.onLoad)E.onLoad(this)}F7.delete(this),W.manager.itemEnd(J)}function H(G){if(U(),Z)Z(G);d9.remove(`image:${J}`);let F=F7.get(this)||[];for(let E=0;E<F.length;E++){let O=F[E];if(O.onError)O.onError(G)}F7.delete(this),W.manager.itemError(J),W.manager.itemEnd(J)}function U(){X.removeEventListener("load",K,!1),X.removeEventListener("error",H,!1)}if(X.addEventListener("load",K,!1),X.addEventListener("error",H,!1),J.slice(0,5)!=="data:"){if(this.crossOrigin!==void 0)X.crossOrigin=this.crossOrigin}return d9.add(`image:${J}`,X),W.manager.itemStart(J),X.src=J,X}}class DK extends nJ{constructor(J){super(J)}load(J,Q,$,Z){let W=new b6;W.colorSpace="srgb";let Y=new C6(this.manager);Y.setCrossOrigin(this.crossOrigin),Y.setPath(this.path);let X=0;function K(H){Y.load(J[H],function(U){if(W.images[H]=U,X++,X===6){if(W.needsUpdate=!0,Q)Q(W)}},void 0,Z)}for(let H=0;H<J.length;++H)K(H);return W}}class U$ extends nJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,Y=new k9,X=new G9(this.manager);return X.setResponseType("arraybuffer"),X.setRequestHeader(this.requestHeader),X.setPath(this.path),X.setWithCredentials(W.withCredentials),X.load(J,function(K){let H;try{H=W.parse(K)}catch(U){if(Z!==void 0)Z(U);else v0(U);return}if(H.image!==void 0)Y.image=H.image;else if(H.data!==void 0)Y.image.width=H.width,Y.image.height=H.height,Y.image.data=H.data;if(Y.wrapS=H.wrapS!==void 0?H.wrapS:1001,Y.wrapT=H.wrapT!==void 0?H.wrapT:1001,Y.magFilter=H.magFilter!==void 0?H.magFilter:1006,Y.minFilter=H.minFilter!==void 0?H.minFilter:1006,Y.anisotropy=H.anisotropy!==void 0?H.anisotropy:1,H.colorSpace!==void 0)Y.colorSpace=H.colorSpace;if(H.flipY!==void 0)Y.flipY=H.flipY;if(H.format!==void 0)Y.format=H.format;if(H.type!==void 0)Y.type=H.type;if(H.mipmaps!==void 0)Y.mipmaps=H.mipmaps,Y.minFilter=1008;if(H.mipmapCount===1)Y.minFilter=1006;if(H.generateMipmaps!==void 0)Y.generateMipmaps=H.generateMipmaps;if(Y.needsUpdate=!0,Q)Q(Y,H)},$,Z),Y}}class u6 extends nJ{constructor(J){super(J)}load(J,Q,$,Z){let W=new MJ,Y=new C6(this.manager);return Y.setCrossOrigin(this.crossOrigin),Y.setPath(this.path),Y.load(J,function(X){if(W.image=X,W.needsUpdate=!0,Q!==void 0)Q(W)},$,Z),W}}class j9 extends HJ{constructor(J,Q=1){super();this.isLight=!0,this.type="Light",this.color=new e(J),this.intensity=Q}dispose(){this.dispatchEvent({type:"dispose"})}copy(J,Q){return super.copy(J,Q),this.color.copy(J.color),this.intensity=J.intensity,this}toJSON(J){let Q=super.toJSON(J);return Q.object.color=this.color.getHex(),Q.object.intensity=this.intensity,Q}}class Z6 extends j9{constructor(J,Q,$){super(J,$);this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(HJ.DEFAULT_UP),this.updateMatrix(),this.groundColor=new e(Q)}copy(J,Q){return super.copy(J,Q),this.groundColor.copy(J.groundColor),this}toJSON(J){let Q=super.toJSON(J);return Q.object.groundColor=this.groundColor.getHex(),Q}}var mY=new y0,AU=new T,SU=new T;class yW{constructor(J){this.camera=J,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new i(512,512),this.mapType=1009,this.map=null,this.mapPass=null,this.matrix=new y0,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new H8,this._frameExtents=new i(1,1),this._viewportCount=1,this._viewports=[new FJ(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(J){let Q=this.camera,$=this.matrix;if(AU.setFromMatrixPosition(J.matrixWorld),Q.position.copy(AU),SU.setFromMatrixPosition(J.target.matrixWorld),Q.lookAt(SU),Q.updateMatrixWorld(),mY.multiplyMatrices(Q.projectionMatrix,Q.matrixWorldInverse),this._frustum.setFromProjectionMatrix(mY,Q.coordinateSystem,Q.reversedDepth),Q.coordinateSystem===2001||Q.reversedDepth)$.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,1,0,0,0,0,1);else $.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);$.multiply(mY)}getViewport(J){return this._viewports[J]}getFrameExtents(){return this._frameExtents}dispose(){if(this.map)this.map.dispose();if(this.mapPass)this.mapPass.dispose()}copy(J){return this.camera=J.camera.clone(),this.intensity=J.intensity,this.bias=J.bias,this.radius=J.radius,this.autoUpdate=J.autoUpdate,this.needsUpdate=J.needsUpdate,this.normalBias=J.normalBias,this.blurSamples=J.blurSamples,this.mapSize.copy(J.mapSize),this.biasNode=J.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let J={};if(this.intensity!==1)J.intensity=this.intensity;if(this.bias!==0)J.bias=this.bias;if(this.normalBias!==0)J.normalBias=this.normalBias;if(this.radius!==1)J.radius=this.radius;if(this.mapSize.x!==512||this.mapSize.y!==512)J.mapSize=this.mapSize.toArray();return J.camera=this.camera.toJSON(!1).object,delete J.camera.matrix,J}}var HZ=new T,UZ=new IJ,Z8=new T;class c7 extends HJ{constructor(){super();this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new y0,this.projectionMatrix=new y0,this.projectionMatrixInverse=new y0,this.coordinateSystem=2000,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(J,Q){return super.copy(J,Q),this.matrixWorldInverse.copy(J.matrixWorldInverse),this.projectionMatrix.copy(J.projectionMatrix),this.projectionMatrixInverse.copy(J.projectionMatrixInverse),this.coordinateSystem=J.coordinateSystem,this}getWorldDirection(J){return super.getWorldDirection(J).negate()}updateMatrixWorld(J){if(super.updateMatrixWorld(J),this.matrixWorld.decompose(HZ,UZ,Z8),Z8.x===1&&Z8.y===1&&Z8.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(HZ,UZ,Z8.set(1,1,1)).invert()}updateWorldMatrix(J,Q){if(super.updateWorldMatrix(J,Q),this.matrixWorld.decompose(HZ,UZ,Z8),Z8.x===1&&Z8.y===1&&Z8.z===1)this.matrixWorldInverse.copy(this.matrixWorld).invert();else this.matrixWorldInverse.compose(HZ,UZ,Z8.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}var p8=new T,jU=new i,vU=new i;class BJ extends c7{constructor(J=50,Q=1,$=0.1,Z=2000){super();this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=J,this.zoom=1,this.near=$,this.far=Z,this.focus=10,this.aspect=Q,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(J,Q){return super.copy(J,Q),this.fov=J.fov,this.zoom=J.zoom,this.near=J.near,this.far=J.far,this.focus=J.focus,this.aspect=J.aspect,this.view=J.view===null?null:Object.assign({},J.view),this.filmGauge=J.filmGauge,this.filmOffset=J.filmOffset,this}setFocalLength(J){let Q=0.5*this.getFilmHeight()/J;this.fov=V6*2*Math.atan(Q),this.updateProjectionMatrix()}getFocalLength(){let J=Math.tan(M6*0.5*this.fov);return 0.5*this.getFilmHeight()/J}getEffectiveFOV(){return V6*2*Math.atan(Math.tan(M6*0.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(J,Q,$){p8.set(-1,-1,0.5).applyMatrix4(this.projectionMatrixInverse),Q.set(p8.x,p8.y).multiplyScalar(-J/p8.z),p8.set(1,1,0.5).applyMatrix4(this.projectionMatrixInverse),$.set(p8.x,p8.y).multiplyScalar(-J/p8.z)}getViewSize(J,Q){return this.getViewBounds(J,jU,vU),Q.subVectors(vU,jU)}setViewOffset(J,Q,$,Z,W,Y){if(this.aspect=J/Q,this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=J,this.view.fullHeight=Q,this.view.offsetX=$,this.view.offsetY=Z,this.view.width=W,this.view.height=Y,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let J=this.near,Q=J*Math.tan(M6*0.5*this.fov)/this.zoom,$=2*Q,Z=this.aspect*$,W=-0.5*Z,Y=this.view;if(this.view!==null&&this.view.enabled){let{fullWidth:K,fullHeight:H}=Y;W+=Y.offsetX*Z/K,Q-=Y.offsetY*$/H,Z*=Y.width/K,$*=Y.height/H}let X=this.filmOffset;if(X!==0)W+=J*X/this.getFilmWidth();this.projectionMatrix.makePerspective(W,W+Z,Q,Q-$,J,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(J){let Q=super.toJSON(J);if(Q.object.fov=this.fov,Q.object.zoom=this.zoom,Q.object.near=this.near,Q.object.far=this.far,Q.object.focus=this.focus,Q.object.aspect=this.aspect,this.view!==null)Q.object.view=Object.assign({},this.view);return Q.object.filmGauge=this.filmGauge,Q.object.filmOffset=this.filmOffset,Q}}class L5 extends yW{constructor(){super(new BJ(50,1,0.5,500));this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(J){let Q=this.camera,$=V6*2*J.angle*this.focus,Z=this.mapSize.width/this.mapSize.height*this.aspect,W=J.distance||Q.far;if($!==Q.fov||Z!==Q.aspect||W!==Q.far)Q.fov=$,Q.aspect=Z,Q.far=W,Q.updateProjectionMatrix();super.updateMatrices(J)}copy(J){return super.copy(J),this.focus=J.focus,this}}class n7 extends j9{constructor(J,Q,$=0,Z=Math.PI/3,W=0,Y=2){super(J,Q);this.isSpotLight=!0,this.type="SpotLight",this.position.copy(HJ.DEFAULT_UP),this.updateMatrix(),this.target=new HJ,this.distance=$,this.angle=Z,this.penumbra=W,this.decay=Y,this.map=null,this.shadow=new L5}get power(){return this.intensity*Math.PI}set power(J){this.intensity=J/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(J,Q){return super.copy(J,Q),this.distance=J.distance,this.angle=J.angle,this.penumbra=J.penumbra,this.decay=J.decay,this.target=J.target.clone(),this.map=J.map,this.shadow=J.shadow.clone(),this}toJSON(J){let Q=super.toJSON(J);if(Q.object.distance=this.distance,Q.object.angle=this.angle,Q.object.decay=this.decay,Q.object.penumbra=this.penumbra,Q.object.target=this.target.uuid,this.map&&this.map.isTexture)Q.object.map=this.map.toJSON(J).uuid;return Q.object.shadow=this.shadow.toJSON(),Q}}class D5 extends yW{constructor(){super(new BJ(90,1,0.5,500));this.isPointLightShadow=!0}}class E8 extends j9{constructor(J,Q,$=0,Z=2){super(J,Q);this.isPointLight=!0,this.type="PointLight",this.distance=$,this.decay=Z,this.shadow=new D5}get power(){return this.intensity*4*Math.PI}set power(J){this.intensity=J/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(J,Q){return super.copy(J,Q),this.distance=J.distance,this.decay=J.decay,this.shadow=J.shadow.clone(),this}toJSON(J){let Q=super.toJSON(J);return Q.object.distance=this.distance,Q.object.decay=this.decay,Q.object.shadow=this.shadow.toJSON(),Q}}class a9 extends c7{constructor(J=-1,Q=1,$=1,Z=-1,W=0.1,Y=2000){super();this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=J,this.right=Q,this.top=$,this.bottom=Z,this.near=W,this.far=Y,this.updateProjectionMatrix()}copy(J,Q){return super.copy(J,Q),this.left=J.left,this.right=J.right,this.top=J.top,this.bottom=J.bottom,this.near=J.near,this.far=J.far,this.zoom=J.zoom,this.view=J.view===null?null:Object.assign({},J.view),this}setViewOffset(J,Q,$,Z,W,Y){if(this.view===null)this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1};this.view.enabled=!0,this.view.fullWidth=J,this.view.fullHeight=Q,this.view.offsetX=$,this.view.offsetY=Z,this.view.width=W,this.view.height=Y,this.updateProjectionMatrix()}clearViewOffset(){if(this.view!==null)this.view.enabled=!1;this.updateProjectionMatrix()}updateProjectionMatrix(){let J=(this.right-this.left)/(2*this.zoom),Q=(this.top-this.bottom)/(2*this.zoom),$=(this.right+this.left)/2,Z=(this.top+this.bottom)/2,W=$-J,Y=$+J,X=Z+Q,K=Z-Q;if(this.view!==null&&this.view.enabled){let H=(this.right-this.left)/this.view.fullWidth/this.zoom,U=(this.top-this.bottom)/this.view.fullHeight/this.zoom;W+=H*this.view.offsetX,Y=W+H*this.view.width,X-=U*this.view.offsetY,K=X-U*this.view.height}this.projectionMatrix.makeOrthographic(W,Y,X,K,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(J){let Q=super.toJSON(J);if(Q.object.zoom=this.zoom,Q.object.left=this.left,Q.object.right=this.right,Q.object.top=this.top,Q.object.bottom=this.bottom,Q.object.near=this.near,Q.object.far=this.far,this.view!==null)Q.object.view=Object.assign({},this.view);return Q}}class k5 extends yW{constructor(){super(new a9(-5,5,5,-5,0.5,500));this.isDirectionalLightShadow=!0}}class v9 extends j9{constructor(J,Q){super(J,Q);this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(HJ.DEFAULT_UP),this.updateMatrix(),this.target=new HJ,this.shadow=new k5}dispose(){super.dispose(),this.shadow.dispose()}copy(J){return super.copy(J),this.target=J.target.clone(),this.shadow=J.shadow.clone(),this}toJSON(J){let Q=super.toJSON(J);return Q.object.shadow=this.shadow.toJSON(),Q.object.target=this.target.uuid,Q}}class d6 extends j9{constructor(J,Q){super(J,Q);this.isAmbientLight=!0,this.type="AmbientLight"}}class xW extends j9{constructor(J,Q,$=10,Z=10){super(J,Q);this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=$,this.height=Z}get power(){return this.intensity*this.width*this.height*Math.PI}set power(J){this.intensity=J/(this.width*this.height*Math.PI)}copy(J){return super.copy(J),this.width=J.width,this.height=J.height,this}toJSON(J){let Q=super.toJSON(J);return Q.object.width=this.width,Q.object.height=this.height,Q}}class G${constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let J=0;J<9;J++)this.coefficients.push(new T)}set(J){for(let Q=0;Q<9;Q++)this.coefficients[Q].copy(J[Q]);return this}zero(){for(let J=0;J<9;J++)this.coefficients[J].set(0,0,0);return this}getAt(J,Q){let{x:$,y:Z,z:W}=J,Y=this.coefficients;return Q.copy(Y[0]).multiplyScalar(0.282095),Q.addScaledVector(Y[1],0.488603*Z),Q.addScaledVector(Y[2],0.488603*W),Q.addScaledVector(Y[3],0.488603*$),Q.addScaledVector(Y[4],1.092548*($*Z)),Q.addScaledVector(Y[5],1.092548*(Z*W)),Q.addScaledVector(Y[6],0.315392*(3*W*W-1)),Q.addScaledVector(Y[7],1.092548*($*W)),Q.addScaledVector(Y[8],0.546274*($*$-Z*Z)),Q}getIrradianceAt(J,Q){let{x:$,y:Z,z:W}=J,Y=this.coefficients;return Q.copy(Y[0]).multiplyScalar(0.886227),Q.addScaledVector(Y[1],1.023328*Z),Q.addScaledVector(Y[2],1.023328*W),Q.addScaledVector(Y[3],1.023328*$),Q.addScaledVector(Y[4],0.858086*$*Z),Q.addScaledVector(Y[5],0.858086*Z*W),Q.addScaledVector(Y[6],0.743125*W*W-0.247708),Q.addScaledVector(Y[7],0.858086*$*W),Q.addScaledVector(Y[8],0.429043*($*$-Z*Z)),Q}add(J){for(let Q=0;Q<9;Q++)this.coefficients[Q].add(J.coefficients[Q]);return this}addScaledSH(J,Q){for(let $=0;$<9;$++)this.coefficients[$].addScaledVector(J.coefficients[$],Q);return this}scale(J){for(let Q=0;Q<9;Q++)this.coefficients[Q].multiplyScalar(J);return this}lerp(J,Q){for(let $=0;$<9;$++)this.coefficients[$].lerp(J.coefficients[$],Q);return this}equals(J){for(let Q=0;Q<9;Q++)if(!this.coefficients[Q].equals(J.coefficients[Q]))return!1;return!0}copy(J){return this.set(J.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(J,Q=0){let $=this.coefficients;for(let Z=0;Z<9;Z++)$[Z].fromArray(J,Q+Z*3);return this}toArray(J=[],Q=0){let $=this.coefficients;for(let Z=0;Z<9;Z++)$[Z].toArray(J,Q+Z*3);return J}static getBasisAt(J,Q){let{x:$,y:Z,z:W}=J;Q[0]=0.282095,Q[1]=0.488603*Z,Q[2]=0.488603*W,Q[3]=0.488603*$,Q[4]=1.092548*$*Z,Q[5]=1.092548*Z*W,Q[6]=0.315392*(3*W*W-1),Q[7]=1.092548*$*W,Q[8]=0.546274*($*$-Z*Z)}}class bW extends j9{constructor(J=new G$,Q=1){super(void 0,Q);this.isLightProbe=!0,this.sh=J}copy(J){return super.copy(J),this.sh.copy(J.sh),this}toJSON(J){let Q=super.toJSON(J);return Q.object.sh=this.sh.toArray(),Q}}class E$ extends nJ{constructor(J){super(J);this.textures={}}load(J,Q,$,Z){let W=this,Y=new G9(W.manager);Y.setPath(W.path),Y.setRequestHeader(W.requestHeader),Y.setWithCredentials(W.withCredentials),Y.load(J,function(X){try{Q(W.parse(JSON.parse(X)))}catch(K){if(Z)Z(K);else v0(K);W.manager.itemError(J)}},$,Z)}parse(J){let Q=this.textures;function $(W){if(Q[W]===void 0)O0("MaterialLoader: Undefined texture",W);return Q[W]}let Z=this.createMaterialFromType(J.type);if(J.uuid!==void 0)Z.uuid=J.uuid;if(J.name!==void 0)Z.name=J.name;if(J.color!==void 0&&Z.color!==void 0)Z.color.setHex(J.color);if(J.roughness!==void 0)Z.roughness=J.roughness;if(J.metalness!==void 0)Z.metalness=J.metalness;if(J.sheen!==void 0)Z.sheen=J.sheen;if(J.sheenColor!==void 0)Z.sheenColor=new e().setHex(J.sheenColor);if(J.sheenRoughness!==void 0)Z.sheenRoughness=J.sheenRoughness;if(J.emissive!==void 0&&Z.emissive!==void 0)Z.emissive.setHex(J.emissive);if(J.specular!==void 0&&Z.specular!==void 0)Z.specular.setHex(J.specular);if(J.specularIntensity!==void 0)Z.specularIntensity=J.specularIntensity;if(J.specularColor!==void 0&&Z.specularColor!==void 0)Z.specularColor.setHex(J.specularColor);if(J.shininess!==void 0)Z.shininess=J.shininess;if(J.clearcoat!==void 0)Z.clearcoat=J.clearcoat;if(J.clearcoatRoughness!==void 0)Z.clearcoatRoughness=J.clearcoatRoughness;if(J.dispersion!==void 0)Z.dispersion=J.dispersion;if(J.iridescence!==void 0)Z.iridescence=J.iridescence;if(J.iridescenceIOR!==void 0)Z.iridescenceIOR=J.iridescenceIOR;if(J.iridescenceThicknessRange!==void 0)Z.iridescenceThicknessRange=J.iridescenceThicknessRange;if(J.transmission!==void 0)Z.transmission=J.transmission;if(J.thickness!==void 0)Z.thickness=J.thickness;if(J.attenuationDistance!==void 0)Z.attenuationDistance=J.attenuationDistance;if(J.attenuationColor!==void 0&&Z.attenuationColor!==void 0)Z.attenuationColor.setHex(J.attenuationColor);if(J.anisotropy!==void 0)Z.anisotropy=J.anisotropy;if(J.anisotropyRotation!==void 0)Z.anisotropyRotation=J.anisotropyRotation;if(J.fog!==void 0)Z.fog=J.fog;if(J.flatShading!==void 0)Z.flatShading=J.flatShading;if(J.blending!==void 0)Z.blending=J.blending;if(J.combine!==void 0)Z.combine=J.combine;if(J.side!==void 0)Z.side=J.side;if(J.shadowSide!==void 0)Z.shadowSide=J.shadowSide;if(J.opacity!==void 0)Z.opacity=J.opacity;if(J.transparent!==void 0)Z.transparent=J.transparent;if(J.alphaTest!==void 0)Z.alphaTest=J.alphaTest;if(J.alphaHash!==void 0)Z.alphaHash=J.alphaHash;if(J.depthFunc!==void 0)Z.depthFunc=J.depthFunc;if(J.depthTest!==void 0)Z.depthTest=J.depthTest;if(J.depthWrite!==void 0)Z.depthWrite=J.depthWrite;if(J.colorWrite!==void 0)Z.colorWrite=J.colorWrite;if(J.blendSrc!==void 0)Z.blendSrc=J.blendSrc;if(J.blendDst!==void 0)Z.blendDst=J.blendDst;if(J.blendEquation!==void 0)Z.blendEquation=J.blendEquation;if(J.blendSrcAlpha!==void 0)Z.blendSrcAlpha=J.blendSrcAlpha;if(J.blendDstAlpha!==void 0)Z.blendDstAlpha=J.blendDstAlpha;if(J.blendEquationAlpha!==void 0)Z.blendEquationAlpha=J.blendEquationAlpha;if(J.blendColor!==void 0&&Z.blendColor!==void 0)Z.blendColor.setHex(J.blendColor);if(J.blendAlpha!==void 0)Z.blendAlpha=J.blendAlpha;if(J.stencilWriteMask!==void 0)Z.stencilWriteMask=J.stencilWriteMask;if(J.stencilFunc!==void 0)Z.stencilFunc=J.stencilFunc;if(J.stencilRef!==void 0)Z.stencilRef=J.stencilRef;if(J.stencilFuncMask!==void 0)Z.stencilFuncMask=J.stencilFuncMask;if(J.stencilFail!==void 0)Z.stencilFail=J.stencilFail;if(J.stencilZFail!==void 0)Z.stencilZFail=J.stencilZFail;if(J.stencilZPass!==void 0)Z.stencilZPass=J.stencilZPass;if(J.stencilWrite!==void 0)Z.stencilWrite=J.stencilWrite;if(J.wireframe!==void 0)Z.wireframe=J.wireframe;if(J.wireframeLinewidth!==void 0)Z.wireframeLinewidth=J.wireframeLinewidth;if(J.wireframeLinecap!==void 0)Z.wireframeLinecap=J.wireframeLinecap;if(J.wireframeLinejoin!==void 0)Z.wireframeLinejoin=J.wireframeLinejoin;if(J.rotation!==void 0)Z.rotation=J.rotation;if(J.linewidth!==void 0)Z.linewidth=J.linewidth;if(J.dashSize!==void 0)Z.dashSize=J.dashSize;if(J.gapSize!==void 0)Z.gapSize=J.gapSize;if(J.scale!==void 0)Z.scale=J.scale;if(J.polygonOffset!==void 0)Z.polygonOffset=J.polygonOffset;if(J.polygonOffsetFactor!==void 0)Z.polygonOffsetFactor=J.polygonOffsetFactor;if(J.polygonOffsetUnits!==void 0)Z.polygonOffsetUnits=J.polygonOffsetUnits;if(J.dithering!==void 0)Z.dithering=J.dithering;if(J.alphaToCoverage!==void 0)Z.alphaToCoverage=J.alphaToCoverage;if(J.premultipliedAlpha!==void 0)Z.premultipliedAlpha=J.premultipliedAlpha;if(J.forceSinglePass!==void 0)Z.forceSinglePass=J.forceSinglePass;if(J.allowOverride!==void 0)Z.allowOverride=J.allowOverride;if(J.visible!==void 0)Z.visible=J.visible;if(J.toneMapped!==void 0)Z.toneMapped=J.toneMapped;if(J.userData!==void 0)Z.userData=J.userData;if(J.vertexColors!==void 0)if(typeof J.vertexColors==="number")Z.vertexColors=J.vertexColors>0;else Z.vertexColors=J.vertexColors;if(J.uniforms!==void 0)for(let W in J.uniforms){let Y=J.uniforms[W];switch(Z.uniforms[W]={},Y.type){case"t":Z.uniforms[W].value=$(Y.value);break;case"c":Z.uniforms[W].value=new e().setHex(Y.value);break;case"v2":Z.uniforms[W].value=new i().fromArray(Y.value);break;case"v3":Z.uniforms[W].value=new T().fromArray(Y.value);break;case"v4":Z.uniforms[W].value=new FJ().fromArray(Y.value);break;case"m3":Z.uniforms[W].value=new o0().fromArray(Y.value);break;case"m4":Z.uniforms[W].value=new y0().fromArray(Y.value);break;default:Z.uniforms[W].value=Y.value}}if(J.defines!==void 0)Z.defines=J.defines;if(J.vertexShader!==void 0)Z.vertexShader=J.vertexShader;if(J.fragmentShader!==void 0)Z.fragmentShader=J.fragmentShader;if(J.glslVersion!==void 0)Z.glslVersion=J.glslVersion;if(J.extensions!==void 0)for(let W in J.extensions)Z.extensions[W]=J.extensions[W];if(J.lights!==void 0)Z.lights=J.lights;if(J.clipping!==void 0)Z.clipping=J.clipping;if(J.size!==void 0)Z.size=J.size;if(J.sizeAttenuation!==void 0)Z.sizeAttenuation=J.sizeAttenuation;if(J.map!==void 0)Z.map=$(J.map);if(J.matcap!==void 0)Z.matcap=$(J.matcap);if(J.alphaMap!==void 0)Z.alphaMap=$(J.alphaMap);if(J.bumpMap!==void 0)Z.bumpMap=$(J.bumpMap);if(J.bumpScale!==void 0)Z.bumpScale=J.bumpScale;if(J.normalMap!==void 0)Z.normalMap=$(J.normalMap);if(J.normalMapType!==void 0)Z.normalMapType=J.normalMapType;if(J.normalScale!==void 0){let W=J.normalScale;if(Array.isArray(W)===!1)W=[W,W];Z.normalScale=new i().fromArray(W)}if(J.displacementMap!==void 0)Z.displacementMap=$(J.displacementMap);if(J.displacementScale!==void 0)Z.displacementScale=J.displacementScale;if(J.displacementBias!==void 0)Z.displacementBias=J.displacementBias;if(J.roughnessMap!==void 0)Z.roughnessMap=$(J.roughnessMap);if(J.metalnessMap!==void 0)Z.metalnessMap=$(J.metalnessMap);if(J.emissiveMap!==void 0)Z.emissiveMap=$(J.emissiveMap);if(J.emissiveIntensity!==void 0)Z.emissiveIntensity=J.emissiveIntensity;if(J.specularMap!==void 0)Z.specularMap=$(J.specularMap);if(J.specularIntensityMap!==void 0)Z.specularIntensityMap=$(J.specularIntensityMap);if(J.specularColorMap!==void 0)Z.specularColorMap=$(J.specularColorMap);if(J.envMap!==void 0)Z.envMap=$(J.envMap);if(J.envMapRotation!==void 0)Z.envMapRotation.fromArray(J.envMapRotation);if(J.envMapIntensity!==void 0)Z.envMapIntensity=J.envMapIntensity;if(J.reflectivity!==void 0)Z.reflectivity=J.reflectivity;if(J.refractionRatio!==void 0)Z.refractionRatio=J.refractionRatio;if(J.lightMap!==void 0)Z.lightMap=$(J.lightMap);if(J.lightMapIntensity!==void 0)Z.lightMapIntensity=J.lightMapIntensity;if(J.aoMap!==void 0)Z.aoMap=$(J.aoMap);if(J.aoMapIntensity!==void 0)Z.aoMapIntensity=J.aoMapIntensity;if(J.gradientMap!==void 0)Z.gradientMap=$(J.gradientMap);if(J.clearcoatMap!==void 0)Z.clearcoatMap=$(J.clearcoatMap);if(J.clearcoatRoughnessMap!==void 0)Z.clearcoatRoughnessMap=$(J.clearcoatRoughnessMap);if(J.clearcoatNormalMap!==void 0)Z.clearcoatNormalMap=$(J.clearcoatNormalMap);if(J.clearcoatNormalScale!==void 0)Z.clearcoatNormalScale=new i().fromArray(J.clearcoatNormalScale);if(J.iridescenceMap!==void 0)Z.iridescenceMap=$(J.iridescenceMap);if(J.iridescenceThicknessMap!==void 0)Z.iridescenceThicknessMap=$(J.iridescenceThicknessMap);if(J.transmissionMap!==void 0)Z.transmissionMap=$(J.transmissionMap);if(J.thicknessMap!==void 0)Z.thicknessMap=$(J.thicknessMap);if(J.anisotropyMap!==void 0)Z.anisotropyMap=$(J.anisotropyMap);if(J.sheenColorMap!==void 0)Z.sheenColorMap=$(J.sheenColorMap);if(J.sheenRoughnessMap!==void 0)Z.sheenRoughnessMap=$(J.sheenRoughnessMap);return Z}setTextures(J){return this.textures=J,this}createMaterialFromType(J){return E$.createMaterialFromType(J)}static createMaterialFromType(J){return new{ShadowMaterial:IW,SpriteMaterial:pQ,RawShaderMaterial:p6,ShaderMaterial:LJ,PointsMaterial:x6,MeshPhysicalMaterial:iJ,MeshStandardMaterial:sJ,MeshPhongMaterial:zW,MeshToonMaterial:_W,MeshNormalMaterial:wW,MeshLambertMaterial:l7,MeshDepthMaterial:W$,MeshDistanceMaterial:Y$,MeshBasicMaterial:cJ,MeshMatcapMaterial:PW,LineDashedMaterial:TW,LineBasicMaterial:uJ,Material:vJ}[J]}}class c9{static extractUrlBase(J){let Q=J.lastIndexOf("/");if(Q===-1)return"./";return J.slice(0,Q+1)}static resolveURL(J,Q){if(typeof J!=="string"||J==="")return"";if(/^https?:\/\//i.test(Q)&&/^\//.test(J))Q=Q.replace(/(^https?:\/\/[^\/]+).*/i,"$1");if(/^(https?:)?\/\//i.test(J))return J;if(/^data:.*,.*$/i.test(J))return J;if(/^blob:.*$/i.test(J))return J;return Q+J}}class hW extends u0{constructor(){super();this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(J){return super.copy(J),this.instanceCount=J.instanceCount,this}toJSON(){let J=super.toJSON();return J.instanceCount=this.instanceCount,J.isInstancedBufferGeometry=!0,J}}class fW extends nJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,Y=new G9(W.manager);Y.setPath(W.path),Y.setRequestHeader(W.requestHeader),Y.setWithCredentials(W.withCredentials),Y.load(J,function(X){try{Q(W.parse(JSON.parse(X)))}catch(K){if(Z)Z(K);else v0(K);W.manager.itemError(J)}},$,Z)}parse(J){let Q={},$={};function Z(E,O){if(Q[O]!==void 0)return Q[O];let k=E.interleavedBuffers[O],q=W(E,k.buffer),N=L7(k.type,q),L=new w8(N,k.stride);return L.uuid=k.uuid,Q[O]=L,L}function W(E,O){if($[O]!==void 0)return $[O];let k=E.arrayBuffers[O],q=new Uint32Array(k).buffer;return $[O]=q,q}let Y=J.isInstancedBufferGeometry?new hW:new u0,X=J.data.index;if(X!==void 0){let E=L7(X.type,X.array);Y.setIndex(new i0(E,1))}let K=J.data.attributes;for(let E in K){let O=K[E],R;if(O.isInterleavedBufferAttribute){let k=Z(J.data,O.data);R=new m9(k,O.itemSize,O.offset,O.normalized)}else{let k=L7(O.type,O.array);R=new(O.isInstancedBufferAttribute?l9:i0)(k,O.itemSize,O.normalized)}if(O.name!==void 0)R.name=O.name;if(O.usage!==void 0)R.setUsage(O.usage);Y.setAttribute(E,R)}let H=J.data.morphAttributes;if(H)for(let E in H){let O=H[E],R=[];for(let k=0,q=O.length;k<q;k++){let N=O[k],L;if(N.isInterleavedBufferAttribute){let D=Z(J.data,N.data);L=new m9(D,N.itemSize,N.offset,N.normalized)}else{let D=L7(N.type,N.array);L=new i0(D,N.itemSize,N.normalized)}if(N.name!==void 0)L.name=N.name;R.push(L)}Y.morphAttributes[E]=R}if(J.data.morphTargetsRelative)Y.morphTargetsRelative=!0;let G=J.data.groups||J.data.drawcalls||J.data.offsets;if(G!==void 0)for(let E=0,O=G.length;E!==O;++E){let R=G[E];Y.addGroup(R.start,R.count,R.materialIndex)}let F=J.data.boundingSphere;if(F!==void 0)Y.boundingSphere=new _J().fromJSON(F);if(J.name)Y.name=J.name;if(J.userData)Y.userData=J.userData;return Y}}var lY={};class kK extends nJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,Y=this.path===""?c9.extractUrlBase(J):this.path;this.resourcePath=this.resourcePath||Y;let X=new G9(this.manager);X.setPath(this.path),X.setRequestHeader(this.requestHeader),X.setWithCredentials(this.withCredentials),X.load(J,function(K){let H=null;try{H=JSON.parse(K)}catch(G){if(Z!==void 0)Z(G);v0("ObjectLoader: Can't parse "+J+".",G.message);return}let U=H.metadata;if(U===void 0||U.type===void 0||U.type.toLowerCase()==="geometry"){if(Z!==void 0)Z(Error("THREE.ObjectLoader: Can't load "+J));v0("ObjectLoader: Can't load "+J);return}W.parse(H,Q)},$,Z)}async loadAsync(J,Q){let $=this,Z=this.path===""?c9.extractUrlBase(J):this.path;this.resourcePath=this.resourcePath||Z;let W=new G9(this.manager);W.setPath(this.path),W.setRequestHeader(this.requestHeader),W.setWithCredentials(this.withCredentials);let Y=await W.loadAsync(J,Q),X;try{X=JSON.parse(Y)}catch(H){throw Error("ObjectLoader: Can't parse "+J+". "+H.message)}let K=X.metadata;if(K===void 0||K.type===void 0||K.type.toLowerCase()==="geometry")throw Error("THREE.ObjectLoader: Can't load "+J);return await $.parseAsync(X)}parse(J,Q){let $=this.parseAnimations(J.animations),Z=this.parseShapes(J.shapes),W=this.parseGeometries(J.geometries,Z),Y=this.parseImages(J.images,function(){if(Q!==void 0)Q(H)}),X=this.parseTextures(J.textures,Y),K=this.parseMaterials(J.materials,X),H=this.parseObject(J.object,W,K,X,$),U=this.parseSkeletons(J.skeletons,H);if(this.bindSkeletons(H,U),this.bindLightTargets(H),Q!==void 0){let G=!1;for(let F in Y)if(Y[F].data instanceof HTMLImageElement){G=!0;break}if(G===!1)Q(H)}return H}async parseAsync(J){let Q=this.parseAnimations(J.animations),$=this.parseShapes(J.shapes),Z=this.parseGeometries(J.geometries,$),W=await this.parseImagesAsync(J.images),Y=this.parseTextures(J.textures,W),X=this.parseMaterials(J.materials,Y),K=this.parseObject(J.object,Z,X,Y,Q),H=this.parseSkeletons(J.skeletons,K);return this.bindSkeletons(K,H),this.bindLightTargets(K),K}static registerGeometry(J,Q){lY[J]=Q}parseShapes(J){let Q={};if(J!==void 0)for(let $=0,Z=J.length;$<Z;$++){let W=new B8().fromJSON(J[$]);Q[W.uuid]=W}return Q}parseSkeletons(J,Q){let $={},Z={};if(Q.traverse(function(W){if(W.isBone)Z[W.uuid]=W}),J!==void 0)for(let W=0,Y=J.length;W<Y;W++){let X=new y6().fromJSON(J[W],Z);$[X.uuid]=X}return $}parseGeometries(J,Q){let $={};if(J!==void 0){let Z=new fW;for(let W=0,Y=J.length;W<Y;W++){let X,K=J[W];switch(K.type){case"BufferGeometry":case"InstancedBufferGeometry":X=Z.parse(K);break;default:if(K.type in wU)X=wU[K.type].fromJSON(K,Q);else if(K.type in lY)X=lY[K.type].fromJSON(K,Q);else O0(`ObjectLoader: Unknown geometry type "${K.type}". Use .registerGeometry() before starting the deserialization process.`)}if(X.uuid=K.uuid,K.name!==void 0)X.name=K.name;if(K.userData!==void 0)X.userData=K.userData;$[K.uuid]=X}}return $}parseMaterials(J,Q){let $={},Z={};if(J!==void 0){let W=new E$;W.setTextures(Q);for(let Y=0,X=J.length;Y<X;Y++){let K=J[Y];if($[K.uuid]===void 0)$[K.uuid]=W.parse(K);Z[K.uuid]=$[K.uuid]}}return Z}parseAnimations(J){let Q={};if(J!==void 0)for(let $=0;$<J.length;$++){let Z=J[$],W=C8.parse(Z);Q[W.uuid]=W}return Q}parseImages(J,Q){let $=this,Z={},W;function Y(K){return $.manager.itemStart(K),W.load(K,function(){$.manager.itemEnd(K)},void 0,function(){$.manager.itemError(K),$.manager.itemEnd(K)})}function X(K){if(typeof K==="string"){let H=K,U=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(H)?H:$.resourcePath+H;return Y(U)}else if(K.data)return{data:L7(K.type,K.data),width:K.width,height:K.height};else return null}if(J!==void 0&&J.length>0){let K=new H$(Q);W=new C6(K),W.setCrossOrigin(this.crossOrigin);for(let H=0,U=J.length;H<U;H++){let G=J[H],F=G.url;if(Array.isArray(F)){let E=[];for(let O=0,R=F.length;O<R;O++){let k=F[O],q=X(k);if(q!==null)if(q instanceof HTMLImageElement)E.push(q);else E.push(new k9(q.data,q.width,q.height))}Z[G.uuid]=new W8(E)}else{let E=X(G.url);Z[G.uuid]=new W8(E)}}}return Z}async parseImagesAsync(J){let Q=this,$={},Z;async function W(Y){if(typeof Y==="string"){let X=Y,K=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(X)?X:Q.resourcePath+X;return await Z.loadAsync(K)}else if(Y.data)return{data:L7(Y.type,Y.data),width:Y.width,height:Y.height};else return null}if(J!==void 0&&J.length>0){Z=new C6(this.manager),Z.setCrossOrigin(this.crossOrigin);for(let Y=0,X=J.length;Y<X;Y++){let K=J[Y],H=K.url;if(Array.isArray(H)){let U=[];for(let G=0,F=H.length;G<F;G++){let E=H[G],O=await W(E);if(O!==null)if(O instanceof HTMLImageElement)U.push(O);else U.push(new k9(O.data,O.width,O.height))}$[K.uuid]=new W8(U)}else{let U=await W(K.url);$[K.uuid]=new W8(U)}}}return $}parseTextures(J,Q){function $(W,Y){if(typeof W==="number")return W;return O0("ObjectLoader.parseTexture: Constant should be in numeric form.",W),Y[W]}let Z={};if(J!==void 0)for(let W=0,Y=J.length;W<Y;W++){let X=J[W];if(X.image===void 0)O0('ObjectLoader: No "image" specified for',X.uuid);if(Q[X.image]===void 0)O0("ObjectLoader: Undefined image",X.image);let K=Q[X.image],H=K.data,U;if(Array.isArray(H)){if(U=new b6,H.length===6)U.needsUpdate=!0}else{if(H&&H.data)U=new k9;else U=new MJ;if(H)U.needsUpdate=!0}if(U.source=K,U.uuid=X.uuid,X.name!==void 0)U.name=X.name;if(X.mapping!==void 0)U.mapping=$(X.mapping,WN);if(X.channel!==void 0)U.channel=X.channel;if(X.offset!==void 0)U.offset.fromArray(X.offset);if(X.repeat!==void 0)U.repeat.fromArray(X.repeat);if(X.center!==void 0)U.center.fromArray(X.center);if(X.rotation!==void 0)U.rotation=X.rotation;if(X.wrap!==void 0)U.wrapS=$(X.wrap[0],yU),U.wrapT=$(X.wrap[1],yU);if(X.format!==void 0)U.format=X.format;if(X.internalFormat!==void 0)U.internalFormat=X.internalFormat;if(X.type!==void 0)U.type=X.type;if(X.colorSpace!==void 0)U.colorSpace=X.colorSpace;if(X.minFilter!==void 0)U.minFilter=$(X.minFilter,xU);if(X.magFilter!==void 0)U.magFilter=$(X.magFilter,xU);if(X.anisotropy!==void 0)U.anisotropy=X.anisotropy;if(X.flipY!==void 0)U.flipY=X.flipY;if(X.generateMipmaps!==void 0)U.generateMipmaps=X.generateMipmaps;if(X.premultiplyAlpha!==void 0)U.premultiplyAlpha=X.premultiplyAlpha;if(X.unpackAlignment!==void 0)U.unpackAlignment=X.unpackAlignment;if(X.compareFunction!==void 0)U.compareFunction=X.compareFunction;if(X.normalized!==void 0)U.normalized=X.normalized;if(X.userData!==void 0)U.userData=X.userData;Z[X.uuid]=U}return Z}parseObject(J,Q,$,Z,W){let Y;function X(F){if(Q[F]===void 0)O0("ObjectLoader: Undefined geometry",F);return Q[F]}function K(F){if(F===void 0)return;if(Array.isArray(F)){let E=[];for(let O=0,R=F.length;O<R;O++){let k=F[O];if($[k]===void 0)O0("ObjectLoader: Undefined material",k);E.push($[k])}return E}if($[F]===void 0)O0("ObjectLoader: Undefined material",F);return $[F]}function H(F){if(Z[F]===void 0)O0("ObjectLoader: Undefined texture",F);return Z[F]}let U,G;switch(J.type){case"Scene":if(Y=new t8,J.background!==void 0)if(Number.isInteger(J.background))Y.background=new e(J.background);else Y.background=H(J.background);if(J.environment!==void 0)Y.environment=H(J.environment);if(J.fog!==void 0){if(J.fog.type==="Fog")Y.fog=new hQ(J.fog.color,J.fog.near,J.fog.far);else if(J.fog.type==="FogExp2")Y.fog=new bQ(J.fog.color,J.fog.density);if(J.fog.name!=="")Y.fog.name=J.fog.name}if(J.backgroundBlurriness!==void 0)Y.backgroundBlurriness=J.backgroundBlurriness;if(J.backgroundIntensity!==void 0)Y.backgroundIntensity=J.backgroundIntensity;if(J.backgroundRotation!==void 0)Y.backgroundRotation.fromArray(J.backgroundRotation);if(J.environmentIntensity!==void 0)Y.environmentIntensity=J.environmentIntensity;if(J.environmentRotation!==void 0)Y.environmentRotation.fromArray(J.environmentRotation);break;case"PerspectiveCamera":if(Y=new BJ(J.fov,J.aspect,J.near,J.far),J.focus!==void 0)Y.focus=J.focus;if(J.zoom!==void 0)Y.zoom=J.zoom;if(J.filmGauge!==void 0)Y.filmGauge=J.filmGauge;if(J.filmOffset!==void 0)Y.filmOffset=J.filmOffset;if(J.view!==void 0)Y.view=Object.assign({},J.view);break;case"OrthographicCamera":if(Y=new a9(J.left,J.right,J.top,J.bottom,J.near,J.far),J.zoom!==void 0)Y.zoom=J.zoom;if(J.view!==void 0)Y.view=Object.assign({},J.view);break;case"AmbientLight":Y=new d6(J.color,J.intensity);break;case"DirectionalLight":Y=new v9(J.color,J.intensity),Y.target=J.target||"";break;case"PointLight":Y=new E8(J.color,J.intensity,J.distance,J.decay);break;case"RectAreaLight":Y=new xW(J.color,J.intensity,J.width,J.height);break;case"SpotLight":Y=new n7(J.color,J.intensity,J.distance,J.angle,J.penumbra,J.decay),Y.target=J.target||"";break;case"HemisphereLight":Y=new Z6(J.color,J.groundColor,J.intensity);break;case"LightProbe":let F=new G$().fromArray(J.sh);Y=new bW(F,J.intensity);break;case"SkinnedMesh":if(U=X(J.geometry),G=K(J.material),Y=new h7(U,G),J.bindMode!==void 0)Y.bindMode=J.bindMode;if(J.bindMatrix!==void 0)Y.bindMatrix.fromArray(J.bindMatrix);if(J.skeleton!==void 0)Y.skeleton=J.skeleton;break;case"Mesh":U=X(J.geometry),G=K(J.material),Y=new a0(U,G);break;case"InstancedMesh":U=X(J.geometry),G=K(J.material);let{count:E,instanceMatrix:O,instanceColor:R}=J;if(Y=new K8(U,G,E),Y.instanceMatrix=new l9(new Float32Array(O.array),16),R!==void 0)Y.instanceColor=new l9(new Float32Array(R.array),R.itemSize);break;case"BatchedMesh":if(U=X(J.geometry),G=K(J.material),Y=new qW(J.maxInstanceCount,J.maxVertexCount,J.maxIndexCount,G),Y.geometry=U,Y.perObjectFrustumCulled=J.perObjectFrustumCulled,Y.sortObjects=J.sortObjects,Y._drawRanges=J.drawRanges,Y._reservedRanges=J.reservedRanges,Y._geometryInfo=J.geometryInfo.map((k)=>{let q=null,N=null;if(k.boundingBox!==void 0)q=new SJ().fromJSON(k.boundingBox);if(k.boundingSphere!==void 0)N=new _J().fromJSON(k.boundingSphere);return{...k,boundingBox:q,boundingSphere:N}}),Y._instanceInfo=J.instanceInfo,Y._availableInstanceIds=J._availableInstanceIds,Y._availableGeometryIds=J._availableGeometryIds,Y._nextIndexStart=J.nextIndexStart,Y._nextVertexStart=J.nextVertexStart,Y._geometryCount=J.geometryCount,Y._maxInstanceCount=J.maxInstanceCount,Y._maxVertexCount=J.maxVertexCount,Y._maxIndexCount=J.maxIndexCount,Y._geometryInitialized=J.geometryInitialized,Y._matricesTexture=H(J.matricesTexture.uuid),Y._indirectTexture=H(J.indirectTexture.uuid),J.colorsTexture!==void 0)Y._colorsTexture=H(J.colorsTexture.uuid);if(J.boundingSphere!==void 0)Y.boundingSphere=new _J().fromJSON(J.boundingSphere);if(J.boundingBox!==void 0)Y.boundingBox=new SJ().fromJSON(J.boundingBox);break;case"LOD":Y=new OW;break;case"Line":Y=new T9(X(J.geometry),K(J.material));break;case"LineLoop":Y=new f7(X(J.geometry),K(J.material));break;case"LineSegments":Y=new N9(X(J.geometry),K(J.material));break;case"PointCloud":case"Points":Y=new o9(X(J.geometry),K(J.material));break;case"Sprite":Y=new NW(K(J.material));break;case"Group":Y=new U9;break;case"Bone":Y=new v6;break;default:Y=new HJ}if(Y.uuid=J.uuid,J.name!==void 0)Y.name=J.name;if(J.matrix!==void 0){if(Y.matrix.fromArray(J.matrix),J.matrixAutoUpdate!==void 0)Y.matrixAutoUpdate=J.matrixAutoUpdate;if(Y.matrixAutoUpdate)Y.matrix.decompose(Y.position,Y.quaternion,Y.scale)}else{if(J.position!==void 0)Y.position.fromArray(J.position);if(J.rotation!==void 0)Y.rotation.fromArray(J.rotation);if(J.quaternion!==void 0)Y.quaternion.fromArray(J.quaternion);if(J.scale!==void 0)Y.scale.fromArray(J.scale)}if(J.up!==void 0)Y.up.fromArray(J.up);if(J.pivot!==void 0)Y.pivot=new T().fromArray(J.pivot);if(J.morphTargetDictionary!==void 0)Y.morphTargetDictionary=Object.assign({},J.morphTargetDictionary);if(J.morphTargetInfluences!==void 0)Y.morphTargetInfluences=J.morphTargetInfluences.slice();if(J.castShadow!==void 0)Y.castShadow=J.castShadow;if(J.receiveShadow!==void 0)Y.receiveShadow=J.receiveShadow;if(J.shadow){if(J.shadow.intensity!==void 0)Y.shadow.intensity=J.shadow.intensity;if(J.shadow.bias!==void 0)Y.shadow.bias=J.shadow.bias;if(J.shadow.normalBias!==void 0)Y.shadow.normalBias=J.shadow.normalBias;if(J.shadow.radius!==void 0)Y.shadow.radius=J.shadow.radius;if(J.shadow.mapSize!==void 0)Y.shadow.mapSize.fromArray(J.shadow.mapSize);if(J.shadow.camera!==void 0)Y.shadow.camera=this.parseObject(J.shadow.camera)}if(J.visible!==void 0)Y.visible=J.visible;if(J.frustumCulled!==void 0)Y.frustumCulled=J.frustumCulled;if(J.renderOrder!==void 0)Y.renderOrder=J.renderOrder;if(J.static!==void 0)Y.static=J.static;if(J.userData!==void 0)Y.userData=J.userData;if(J.layers!==void 0)Y.layers.mask=J.layers;if(J.children!==void 0){let F=J.children;for(let E=0;E<F.length;E++)Y.add(this.parseObject(F[E],Q,$,Z,W))}if(J.animations!==void 0){let F=J.animations;for(let E=0;E<F.length;E++){let O=F[E];Y.animations.push(W[O])}}if(J.type==="LOD"){if(J.autoUpdate!==void 0)Y.autoUpdate=J.autoUpdate;let F=J.levels;for(let E=0;E<F.length;E++){let O=F[E],R=Y.getObjectByProperty("uuid",O.object);if(R!==void 0)Y.addLevel(R,O.distance,O.hysteresis)}}return Y}bindSkeletons(J,Q){if(Object.keys(Q).length===0)return;J.traverse(function($){if($.isSkinnedMesh===!0&&$.skeleton!==void 0){let Z=Q[$.skeleton];if(Z===void 0)O0("ObjectLoader: No skeleton found with UUID:",$.skeleton);else $.bind(Z,$.bindMatrix)}})}bindLightTargets(J){J.traverse(function(Q){if(Q.isDirectionalLight||Q.isSpotLight){let $=Q.target,Z=J.getObjectByProperty("uuid",$);if(Z!==void 0)Q.target=Z;else Q.target=new HJ}})}}var WN={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,CubeUVReflectionMapping:306},yU={RepeatWrapping:1000,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},xU={NearestFilter:1003,NearestMipmapNearestFilter:1004,NearestMipmapLinearFilter:1005,LinearFilter:1006,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:1008},cY=new WeakMap;class F$ extends nJ{constructor(J){super(J);if(this.isImageBitmapLoader=!0,typeof createImageBitmap>"u")O0("ImageBitmapLoader: createImageBitmap() not supported.");if(typeof fetch>"u")O0("ImageBitmapLoader: fetch() not supported.");this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(J){return this.options=J,this}load(J,Q,$,Z){if(J===void 0)J="";if(this.path!==void 0)J=this.path+J;J=this.manager.resolveURL(J);let W=this,Y=d9.get(`image-bitmap:${J}`);if(Y!==void 0){if(W.manager.itemStart(J),Y.then){Y.then((H)=>{if(cY.has(Y)===!0){if(Z)Z(cY.get(Y));W.manager.itemError(J),W.manager.itemEnd(J)}else{if(Q)Q(H);W.manager.itemEnd(J)}});return}setTimeout(function(){if(Q)Q(Y);W.manager.itemEnd(J)},0);return}let X={};X.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",X.headers=this.requestHeader,X.signal=typeof AbortSignal.any==="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;let K=fetch(J,X).then(function(H){return H.blob()}).then(function(H){return createImageBitmap(H,Object.assign(W.options,{colorSpaceConversion:"none"}))}).then(function(H){if(d9.add(`image-bitmap:${J}`,H),Q)Q(H);W.manager.itemEnd(J)}).catch(function(H){if(Z)Z(H);cY.set(K,H),d9.remove(`image-bitmap:${J}`),W.manager.itemError(J),W.manager.itemEnd(J)});d9.add(`image-bitmap:${J}`,K),W.manager.itemStart(J)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}var GZ;class N${static getContext(){if(GZ===void 0)GZ=new(window.AudioContext||window.webkitAudioContext);return GZ}static setContext(J){GZ=J}}class MK extends nJ{constructor(J){super(J)}load(J,Q,$,Z){let W=this,Y=new G9(this.manager);Y.setResponseType("arraybuffer"),Y.setPath(this.path),Y.setRequestHeader(this.requestHeader),Y.setWithCredentials(this.withCredentials),Y.load(J,function(K){try{let H=K.slice(0),U=N$.getContext(),G=J+"#decode";W.manager.itemStart(G),U.decodeAudioData(H,function(F){Q(F),W.manager.itemEnd(G)}).catch(function(F){X(F),W.manager.itemEnd(G)})}catch(H){X(H)}},$,Z);function X(K){if(Z)Z(K);else v0(K);W.manager.itemError(J)}}}var bU=new y0,hU=new y0,N6=new y0;class VK{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=0.064,this.cameraL=new BJ,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new BJ,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(J){let Q=this._cache;if(Q.focus!==J.focus||Q.fov!==J.fov||Q.aspect!==J.aspect*this.aspect||Q.near!==J.near||Q.far!==J.far||Q.zoom!==J.zoom||Q.eyeSep!==this.eyeSep){Q.focus=J.focus,Q.fov=J.fov,Q.aspect=J.aspect*this.aspect,Q.near=J.near,Q.far=J.far,Q.zoom=J.zoom,Q.eyeSep=this.eyeSep,N6.copy(J.projectionMatrix);let Z=Q.eyeSep/2,W=Z*Q.near/Q.focus,Y=Q.near*Math.tan(M6*Q.fov*0.5)/Q.zoom,X,K;hU.elements[12]=-Z,bU.elements[12]=Z,X=-Y*Q.aspect+W,K=Y*Q.aspect+W,N6.elements[0]=2*Q.near/(K-X),N6.elements[8]=(K+X)/(K-X),this.cameraL.projectionMatrix.copy(N6),X=-Y*Q.aspect-W,K=Y*Q.aspect-W,N6.elements[0]=2*Q.near/(K-X),N6.elements[8]=(K+X)/(K-X),this.cameraR.projectionMatrix.copy(N6)}this.cameraL.matrixWorld.copy(J.matrixWorld).multiply(hU),this.cameraR.matrixWorld.copy(J.matrixWorld).multiply(bU)}}var N7=-90,O7=1;class gW extends HJ{constructor(J,Q,$){super();this.type="CubeCamera",this.renderTarget=$,this.coordinateSystem=null,this.activeMipmapLevel=0;let Z=new BJ(N7,O7,J,Q);Z.layers=this.layers,this.add(Z);let W=new BJ(N7,O7,J,Q);W.layers=this.layers,this.add(W);let Y=new BJ(N7,O7,J,Q);Y.layers=this.layers,this.add(Y);let X=new BJ(N7,O7,J,Q);X.layers=this.layers,this.add(X);let K=new BJ(N7,O7,J,Q);K.layers=this.layers,this.add(K);let H=new BJ(N7,O7,J,Q);H.layers=this.layers,this.add(H)}updateCoordinateSystem(){let J=this.coordinateSystem,Q=this.children.concat(),[$,Z,W,Y,X,K]=Q;for(let H of Q)this.remove(H);if(J===2000)$.up.set(0,1,0),$.lookAt(1,0,0),Z.up.set(0,1,0),Z.lookAt(-1,0,0),W.up.set(0,0,-1),W.lookAt(0,1,0),Y.up.set(0,0,1),Y.lookAt(0,-1,0),X.up.set(0,1,0),X.lookAt(0,0,1),K.up.set(0,1,0),K.lookAt(0,0,-1);else if(J===2001)$.up.set(0,-1,0),$.lookAt(-1,0,0),Z.up.set(0,-1,0),Z.lookAt(1,0,0),W.up.set(0,0,1),W.lookAt(0,1,0),Y.up.set(0,0,-1),Y.lookAt(0,-1,0),X.up.set(0,-1,0),X.lookAt(0,0,1),K.up.set(0,-1,0),K.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+J);for(let H of Q)this.add(H),H.updateMatrixWorld()}update(J,Q){if(this.parent===null)this.updateMatrixWorld();let{renderTarget:$,activeMipmapLevel:Z}=this;if(this.coordinateSystem!==J.coordinateSystem)this.coordinateSystem=J.coordinateSystem,this.updateCoordinateSystem();let[W,Y,X,K,H,U]=this.children,G=J.getRenderTarget(),F=J.getActiveCubeFace(),E=J.getActiveMipmapLevel(),O=J.xr.enabled;J.xr.enabled=!1;let R=$.texture.generateMipmaps;$.texture.generateMipmaps=!1;let k=!1;if(J.isWebGLRenderer===!0)k=J.state.buffers.depth.getReversed();else k=J.reversedDepthBuffer;if(J.setRenderTarget($,0,Z),k&&J.autoClear===!1)J.clearDepth();if(J.render(Q,W),J.setRenderTarget($,1,Z),k&&J.autoClear===!1)J.clearDepth();if(J.render(Q,Y),J.setRenderTarget($,2,Z),k&&J.autoClear===!1)J.clearDepth();if(J.render(Q,X),J.setRenderTarget($,3,Z),k&&J.autoClear===!1)J.clearDepth();if(J.render(Q,K),J.setRenderTarget($,4,Z),k&&J.autoClear===!1)J.clearDepth();if(J.render(Q,H),$.texture.generateMipmaps=R,J.setRenderTarget($,5,Z),k&&J.autoClear===!1)J.clearDepth();J.render(Q,U),J.setRenderTarget(G,F,E),J.xr.enabled=O,$.texture.needsPMREMUpdate=!0}}class pW extends BJ{constructor(J=[]){super();this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=J}}class s7{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(J){if(this._document=J,J.hidden!==void 0)this._pageVisibilityHandler=YN.bind(this),J.addEventListener("visibilitychange",this._pageVisibilityHandler,!1)}disconnect(){if(this._pageVisibilityHandler!==null)this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null;this._document=null}getDelta(){return this._delta/1000}getElapsed(){return this._elapsed/1000}getTimescale(){return this._timescale}setTimescale(J){return this._timescale=J,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(J){if(this._pageVisibilityHandler!==null&&this._document.hidden===!0)this._delta=0;else this._previousTime=this._currentTime,this._currentTime=(J!==void 0?J:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta;return this}}function YN(){if(this._document.hidden===!1)this.reset()}var O6=new T,nY=new IJ,XN=new T,q6=new T,R6=new T;class BK extends HJ{constructor(){super();this.type="AudioListener",this.context=N$.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new s7}getInput(){return this.gain}removeFilter(){if(this.filter!==null)this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null;return this}getFilter(){return this.filter}setFilter(J){if(this.filter!==null)this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination);else this.gain.disconnect(this.context.destination);return this.filter=J,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(J){return this.gain.gain.setTargetAtTime(J,this.context.currentTime,0.01),this}updateMatrixWorld(J){super.updateMatrixWorld(J),this._timer.update();let Q=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(O6,nY,XN),q6.set(0,0,-1).applyQuaternion(nY),R6.set(0,1,0).applyQuaternion(nY),Q.positionX){let $=this.context.currentTime+this.timeDelta;Q.positionX.linearRampToValueAtTime(O6.x,$),Q.positionY.linearRampToValueAtTime(O6.y,$),Q.positionZ.linearRampToValueAtTime(O6.z,$),Q.forwardX.linearRampToValueAtTime(q6.x,$),Q.forwardY.linearRampToValueAtTime(q6.y,$),Q.forwardZ.linearRampToValueAtTime(q6.z,$),Q.upX.linearRampToValueAtTime(R6.x,$),Q.upY.linearRampToValueAtTime(R6.y,$),Q.upZ.linearRampToValueAtTime(R6.z,$)}else Q.setPosition(O6.x,O6.y,O6.z),Q.setOrientation(q6.x,q6.y,q6.z,R6.x,R6.y,R6.z)}}class uW extends HJ{constructor(J){super();this.type="Audio",this.listener=J,this.context=J.context,this.gain=this.context.createGain(),this.gain.connect(J.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(J){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=J,this.connect(),this}setMediaElementSource(J){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(J),this.connect(),this}setMediaStreamSource(J){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(J),this.connect(),this}setBuffer(J){if(this.buffer=J,this.sourceType="buffer",this.autoplay)this.play();return this}play(J=0){if(this.isPlaying===!0){O0("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){O0("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+J;let Q=this.context.createBufferSource();return Q.buffer=this.buffer,Q.loop=this.loop,Q.loopStart=this.loopStart,Q.loopEnd=this.loopEnd,Q.onended=this.onEnded.bind(this),Q.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=Q,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){O0("Audio: this Audio has no playback control.");return}if(this.isPlaying===!0){if(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0)this._progress=this._progress%(this.duration||this.buffer.duration);this.source.stop(),this.source.onended=null,this.isPlaying=!1}return this}stop(J=0){if(this.hasPlaybackControl===!1){O0("Audio: this Audio has no playback control.");return}if(this._progress=0,this.source!==null)this.source.stop(this.context.currentTime+J),this.source.onended=null;return this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let J=1,Q=this.filters.length;J<Q;J++)this.filters[J-1].connect(this.filters[J]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected===!1)return;if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let J=1,Q=this.filters.length;J<Q;J++)this.filters[J-1].disconnect(this.filters[J]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(J){if(!J)J=[];if(this._connected===!0)this.disconnect(),this.filters=J.slice(),this.connect();else this.filters=J.slice();return this}setDetune(J){if(this.detune=J,this.isPlaying===!0&&this.source.detune!==void 0)this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,0.01);return this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(J){return this.setFilters(J?[J]:[])}setPlaybackRate(J){if(this.hasPlaybackControl===!1){O0("Audio: this Audio has no playback control.");return}if(this.playbackRate=J,this.isPlaying===!0)this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,0.01);return this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){if(this.hasPlaybackControl===!1)return O0("Audio: this Audio has no playback control."),!1;return this.loop}setLoop(J){if(this.hasPlaybackControl===!1){O0("Audio: this Audio has no playback control.");return}if(this.loop=J,this.isPlaying===!0)this.source.loop=this.loop;return this}setLoopStart(J){return this.loopStart=J,this}setLoopEnd(J){return this.loopEnd=J,this}getVolume(){return this.gain.gain.value}setVolume(J){return this.gain.gain.setTargetAtTime(J,this.context.currentTime,0.01),this}copy(J,Q){if(super.copy(J,Q),J.sourceType!=="buffer")return O0("Audio: Audio source type cannot be copied."),this;return this.autoplay=J.autoplay,this.buffer=J.buffer,this.detune=J.detune,this.loop=J.loop,this.loopStart=J.loopStart,this.loopEnd=J.loopEnd,this.offset=J.offset,this.duration=J.duration,this.playbackRate=J.playbackRate,this.hasPlaybackControl=J.hasPlaybackControl,this.sourceType=J.sourceType,this.filters=J.filters.slice(),this}clone(J){return new this.constructor(this.listener).copy(this,J)}}var L6=new T,fU=new IJ,KN=new T,D6=new T;class CK extends uW{constructor(J){super(J);this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(J){return this.panner.refDistance=J,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(J){return this.panner.rolloffFactor=J,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(J){return this.panner.distanceModel=J,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(J){return this.panner.maxDistance=J,this}setDirectionalCone(J,Q,$){return this.panner.coneInnerAngle=J,this.panner.coneOuterAngle=Q,this.panner.coneOuterGain=$,this}updateMatrixWorld(J){if(super.updateMatrixWorld(J),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(L6,fU,KN),D6.set(0,0,1).applyQuaternion(fU);let Q=this.panner;if(Q.positionX){let $=this.context.currentTime+this.listener.timeDelta;Q.positionX.linearRampToValueAtTime(L6.x,$),Q.positionY.linearRampToValueAtTime(L6.y,$),Q.positionZ.linearRampToValueAtTime(L6.z,$),Q.orientationX.linearRampToValueAtTime(D6.x,$),Q.orientationY.linearRampToValueAtTime(D6.y,$),Q.orientationZ.linearRampToValueAtTime(D6.z,$)}else Q.setPosition(L6.x,L6.y,L6.z),Q.setOrientation(D6.x,D6.y,D6.z)}}class IK{constructor(J,Q=2048){this.analyser=J.context.createAnalyser(),this.analyser.fftSize=Q,this.data=new Uint8Array(this.analyser.frequencyBinCount),J.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let J=0,Q=this.getFrequencyData();for(let $=0;$<Q.length;$++)J+=Q[$];return J/Q.length}}class dW{constructor(J,Q,$){this.binding=J,this.valueSize=$;let Z,W,Y;switch(Q){case"quaternion":Z=this._slerp,W=this._slerpAdditive,Y=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array($*6),this._workIndex=5;break;case"string":case"bool":Z=this._select,W=this._select,Y=this._setAdditiveIdentityOther,this.buffer=Array($*5);break;default:Z=this._lerp,W=this._lerpAdditive,Y=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array($*5)}this._mixBufferRegion=Z,this._mixBufferRegionAdditive=W,this._setIdentity=Y,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(J,Q){let $=this.buffer,Z=this.valueSize,W=J*Z+Z,Y=this.cumulativeWeight;if(Y===0){for(let X=0;X!==Z;++X)$[W+X]=$[X];Y=Q}else{Y+=Q;let X=Q/Y;this._mixBufferRegion($,W,0,X,Z)}this.cumulativeWeight=Y}accumulateAdditive(J){let Q=this.buffer,$=this.valueSize,Z=$*this._addIndex;if(this.cumulativeWeightAdditive===0)this._setIdentity();this._mixBufferRegionAdditive(Q,Z,0,J,$),this.cumulativeWeightAdditive+=J}apply(J){let Q=this.valueSize,$=this.buffer,Z=J*Q+Q,W=this.cumulativeWeight,Y=this.cumulativeWeightAdditive,X=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,W<1){let K=Q*this._origIndex;this._mixBufferRegion($,Z,K,1-W,Q)}if(Y>0)this._mixBufferRegionAdditive($,Z,this._addIndex*Q,1,Q);for(let K=Q,H=Q+Q;K!==H;++K)if($[K]!==$[K+Q]){X.setValue($,Z);break}}saveOriginalState(){let J=this.binding,Q=this.buffer,$=this.valueSize,Z=$*this._origIndex;J.getValue(Q,Z);for(let W=$,Y=Z;W!==Y;++W)Q[W]=Q[Z+W%$];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let J=this.valueSize*3;this.binding.setValue(this.buffer,J)}_setAdditiveIdentityNumeric(){let J=this._addIndex*this.valueSize,Q=J+this.valueSize;for(let $=J;$<Q;$++)this.buffer[$]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let J=this._origIndex*this.valueSize,Q=this._addIndex*this.valueSize;for(let $=0;$<this.valueSize;$++)this.buffer[Q+$]=this.buffer[J+$]}_select(J,Q,$,Z,W){if(Z>=0.5)for(let Y=0;Y!==W;++Y)J[Q+Y]=J[$+Y]}_slerp(J,Q,$,Z){IJ.slerpFlat(J,Q,J,Q,J,$,Z)}_slerpAdditive(J,Q,$,Z,W){let Y=this._workIndex*W;IJ.multiplyQuaternionsFlat(J,Y,J,Q,J,$),IJ.slerpFlat(J,Q,J,Q,J,Y,Z)}_lerp(J,Q,$,Z,W){let Y=1-Z;for(let X=0;X!==W;++X){let K=Q+X;J[K]=J[K]*Y+J[$+X]*Z}}_lerpAdditive(J,Q,$,Z,W){for(let Y=0;Y!==W;++Y){let X=Q+Y;J[X]=J[X]+J[$+Y]*Z}}}var zK="\\[\\]\\.:\\/",HN=new RegExp("["+zK+"]","g"),_K="[^"+zK+"]",UN="[^"+zK.replace("\\.","")+"]",GN=/((?:WC+[\/:])*)/.source.replace("WC",_K),EN=/(WCOD+)?/.source.replace("WCOD",UN),FN=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",_K),NN=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",_K),ON=new RegExp("^"+GN+EN+FN+NN+"$"),qN=["material","materials","bones","map"];class M5{constructor(J,Q,$){let Z=$||GJ.parseTrackName(Q);this._targetGroup=J,this._bindings=J.subscribe_(Q,Z)}getValue(J,Q){this.bind();let $=this._targetGroup.nCachedObjects_,Z=this._bindings[$];if(Z!==void 0)Z.getValue(J,Q)}setValue(J,Q){let $=this._bindings;for(let Z=this._targetGroup.nCachedObjects_,W=$.length;Z!==W;++Z)$[Z].setValue(J,Q)}bind(){let J=this._bindings;for(let Q=this._targetGroup.nCachedObjects_,$=J.length;Q!==$;++Q)J[Q].bind()}unbind(){let J=this._bindings;for(let Q=this._targetGroup.nCachedObjects_,$=J.length;Q!==$;++Q)J[Q].unbind()}}class GJ{constructor(J,Q,$){this.path=Q,this.parsedPath=$||GJ.parseTrackName(Q),this.node=GJ.findNode(J,this.parsedPath.nodeName),this.rootNode=J,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(J,Q,$){if(!(J&&J.isAnimationObjectGroup))return new GJ(J,Q,$);else return new GJ.Composite(J,Q,$)}static sanitizeNodeName(J){return J.replace(/\s/g,"_").replace(HN,"")}static parseTrackName(J){let Q=ON.exec(J);if(Q===null)throw Error("PropertyBinding: Cannot parse trackName: "+J);let $={nodeName:Q[2],objectName:Q[3],objectIndex:Q[4],propertyName:Q[5],propertyIndex:Q[6]},Z=$.nodeName&&$.nodeName.lastIndexOf(".");if(Z!==void 0&&Z!==-1){let W=$.nodeName.substring(Z+1);if(qN.indexOf(W)!==-1)$.nodeName=$.nodeName.substring(0,Z),$.objectName=W}if($.propertyName===null||$.propertyName.length===0)throw Error("PropertyBinding: can not parse propertyName from trackName: "+J);return $}static findNode(J,Q){if(Q===void 0||Q===""||Q==="."||Q===-1||Q===J.name||Q===J.uuid)return J;if(J.skeleton){let $=J.skeleton.getBoneByName(Q);if($!==void 0)return $}if(J.children){let $=function(W){for(let Y=0;Y<W.length;Y++){let X=W[Y];if(X.name===Q||X.uuid===Q)return X;let K=$(X.children);if(K)return K}return null},Z=$(J.children);if(Z)return Z}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(J,Q){J[Q]=this.targetObject[this.propertyName]}_getValue_array(J,Q){let $=this.resolvedProperty;for(let Z=0,W=$.length;Z!==W;++Z)J[Q++]=$[Z]}_getValue_arrayElement(J,Q){J[Q]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(J,Q){this.resolvedProperty.toArray(J,Q)}_setValue_direct(J,Q){this.targetObject[this.propertyName]=J[Q]}_setValue_direct_setNeedsUpdate(J,Q){this.targetObject[this.propertyName]=J[Q],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(J,Q){this.targetObject[this.propertyName]=J[Q],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(J,Q){let $=this.resolvedProperty;for(let Z=0,W=$.length;Z!==W;++Z)$[Z]=J[Q++]}_setValue_array_setNeedsUpdate(J,Q){let $=this.resolvedProperty;for(let Z=0,W=$.length;Z!==W;++Z)$[Z]=J[Q++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(J,Q){let $=this.resolvedProperty;for(let Z=0,W=$.length;Z!==W;++Z)$[Z]=J[Q++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(J,Q){this.resolvedProperty[this.propertyIndex]=J[Q]}_setValue_arrayElement_setNeedsUpdate(J,Q){this.resolvedProperty[this.propertyIndex]=J[Q],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(J,Q){this.resolvedProperty[this.propertyIndex]=J[Q],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(J,Q){this.resolvedProperty.fromArray(J,Q)}_setValue_fromArray_setNeedsUpdate(J,Q){this.resolvedProperty.fromArray(J,Q),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(J,Q){this.resolvedProperty.fromArray(J,Q),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(J,Q){this.bind(),this.getValue(J,Q)}_setValue_unbound(J,Q){this.bind(),this.setValue(J,Q)}bind(){let J=this.node,Q=this.parsedPath,$=Q.objectName,Z=Q.propertyName,W=Q.propertyIndex;if(!J)J=GJ.findNode(this.rootNode,Q.nodeName),this.node=J;if(this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!J){O0("PropertyBinding: No target node found for track: "+this.path+".");return}if($){let H=Q.objectIndex;switch($){case"materials":if(!J.material){v0("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!J.material.materials){v0("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}J=J.material.materials;break;case"bones":if(!J.skeleton){v0("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}J=J.skeleton.bones;for(let U=0;U<J.length;U++)if(J[U].name===H){H=U;break}break;case"map":if("map"in J){J=J.map;break}if(!J.material){v0("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!J.material.map){v0("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}J=J.material.map;break;default:if(J[$]===void 0){v0("PropertyBinding: Can not bind to objectName of node undefined.",this);return}J=J[$]}if(H!==void 0){if(J[H]===void 0){v0("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,J);return}J=J[H]}}let Y=J[Z];if(Y===void 0){let H=Q.nodeName;v0("PropertyBinding: Trying to update property for track: "+H+"."+Z+" but it wasn't found.",J);return}let X=this.Versioning.None;if(this.targetObject=J,J.isMaterial===!0)X=this.Versioning.NeedsUpdate;else if(J.isObject3D===!0)X=this.Versioning.MatrixWorldNeedsUpdate;let K=this.BindingType.Direct;if(W!==void 0){if(Z==="morphTargetInfluences"){if(!J.geometry){v0("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!J.geometry.morphAttributes){v0("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}if(J.morphTargetDictionary[W]!==void 0)W=J.morphTargetDictionary[W]}K=this.BindingType.ArrayElement,this.resolvedProperty=Y,this.propertyIndex=W}else if(Y.fromArray!==void 0&&Y.toArray!==void 0)K=this.BindingType.HasFromToArray,this.resolvedProperty=Y;else if(Array.isArray(Y))K=this.BindingType.EntireArray,this.resolvedProperty=Y;else this.propertyName=Z;this.getValue=this.GetterByBindingType[K],this.setValue=this.SetterByBindingTypeAndVersioning[K][X]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}GJ.Composite=M5;GJ.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};GJ.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};GJ.prototype.GetterByBindingType=[GJ.prototype._getValue_direct,GJ.prototype._getValue_array,GJ.prototype._getValue_arrayElement,GJ.prototype._getValue_toArray];GJ.prototype.SetterByBindingTypeAndVersioning=[[GJ.prototype._setValue_direct,GJ.prototype._setValue_direct_setNeedsUpdate,GJ.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[GJ.prototype._setValue_array,GJ.prototype._setValue_array_setNeedsUpdate,GJ.prototype._setValue_array_setMatrixWorldNeedsUpdate],[GJ.prototype._setValue_arrayElement,GJ.prototype._setValue_arrayElement_setNeedsUpdate,GJ.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[GJ.prototype._setValue_fromArray,GJ.prototype._setValue_fromArray_setNeedsUpdate,GJ.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class wK{constructor(){this.isAnimationObjectGroup=!0,this.uuid=D9(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;let J={};this._indicesByUUID=J;for(let $=0,Z=arguments.length;$!==Z;++$)J[arguments[$].uuid]=$;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};let Q=this;this.stats={objects:{get total(){return Q._objects.length},get inUse(){return this.total-Q.nCachedObjects_}},get bindingsPerObject(){return Q._bindings.length}}}add(){let J=this._objects,Q=this._indicesByUUID,$=this._paths,Z=this._parsedPaths,W=this._bindings,Y=W.length,X=void 0,K=J.length,H=this.nCachedObjects_;for(let U=0,G=arguments.length;U!==G;++U){let F=arguments[U],E=F.uuid,O=Q[E];if(O===void 0){O=K++,Q[E]=O,J.push(F);for(let R=0,k=Y;R!==k;++R)W[R].push(new GJ(F,$[R],Z[R]))}else if(O<H){X=J[O];let R=--H,k=J[R];Q[k.uuid]=O,J[O]=k,Q[E]=R,J[R]=F;for(let q=0,N=Y;q!==N;++q){let L=W[q],D=L[R],V=L[O];if(L[O]=D,V===void 0)V=new GJ(F,$[q],Z[q]);L[R]=V}}else if(J[O]!==X)v0("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=H}remove(){let J=this._objects,Q=this._indicesByUUID,$=this._bindings,Z=$.length,W=this.nCachedObjects_;for(let Y=0,X=arguments.length;Y!==X;++Y){let K=arguments[Y],H=K.uuid,U=Q[H];if(U!==void 0&&U>=W){let G=W++,F=J[G];Q[F.uuid]=U,J[U]=F,Q[H]=G,J[G]=K;for(let E=0,O=Z;E!==O;++E){let R=$[E],k=R[G],q=R[U];R[U]=k,R[G]=q}}}this.nCachedObjects_=W}uncache(){let J=this._objects,Q=this._indicesByUUID,$=this._bindings,Z=$.length,W=this.nCachedObjects_,Y=J.length;for(let X=0,K=arguments.length;X!==K;++X){let H=arguments[X],U=H.uuid,G=Q[U];if(G!==void 0)if(delete Q[U],G<W){let F=--W,E=J[F],O=--Y,R=J[O];Q[E.uuid]=G,J[G]=E,Q[R.uuid]=F,J[F]=R,J.pop();for(let k=0,q=Z;k!==q;++k){let N=$[k],L=N[F],D=N[O];N[G]=L,N[F]=D,N.pop()}}else{let F=--Y,E=J[F];if(F>0)Q[E.uuid]=G;J[G]=E,J.pop();for(let O=0,R=Z;O!==R;++O){let k=$[O];k[G]=k[F],k.pop()}}}this.nCachedObjects_=W}subscribe_(J,Q){let $=this._bindingsIndicesByPath,Z=$[J],W=this._bindings;if(Z!==void 0)return W[Z];let Y=this._paths,X=this._parsedPaths,K=this._objects,H=K.length,U=this.nCachedObjects_,G=Array(H);Z=W.length,$[J]=Z,Y.push(J),X.push(Q),W.push(G);for(let F=U,E=K.length;F!==E;++F){let O=K[F];G[F]=new GJ(O,J,Q)}return G}unsubscribe_(J){let Q=this._bindingsIndicesByPath,$=Q[J];if($!==void 0){let Z=this._paths,W=this._parsedPaths,Y=this._bindings,X=Y.length-1,K=Y[X],H=J[X];Q[H]=$,Y[$]=K,Y.pop(),W[$]=W[X],W.pop(),Z[$]=Z[X],Z.pop()}}}class mW{constructor(J,Q,$=null,Z=Q.blendMode){this._mixer=J,this._clip=Q,this._localRoot=$,this.blendMode=Z;let W=Q.tracks,Y=W.length,X=Array(Y),K={endingStart:2400,endingEnd:2400};for(let H=0;H!==Y;++H){let U=W[H].createInterpolant(null);if(X[H]=U,U.settings)Object.assign(K,U.settings);U.settings=K}this._interpolantSettings=K,this._interpolants=X,this._propertyBindings=Array(Y),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(J){return this._startTime=J,this}setLoop(J,Q){return this.loop=J,this.repetitions=Q,this}setEffectiveWeight(J){return this.weight=J,this._effectiveWeight=this.enabled?J:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(J){return this._scheduleFading(J,0,1)}fadeOut(J){return this._scheduleFading(J,1,0)}crossFadeFrom(J,Q,$=!1){if(J.fadeOut(Q),this.fadeIn(Q),$===!0){let Z=this._clip.duration,W=J._clip.duration,Y=W/Z,X=Z/W;J.warp(1,Y,Q),this.warp(X,1,Q)}return this}crossFadeTo(J,Q,$=!1){return J.crossFadeFrom(this,Q,$)}stopFading(){let J=this._weightInterpolant;if(J!==null)this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(J);return this}setEffectiveTimeScale(J){return this.timeScale=J,this._effectiveTimeScale=this.paused?0:J,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(J){return this.timeScale=this._clip.duration/J,this.stopWarping()}syncWith(J){return this.time=J.time,this.timeScale=J.timeScale,this.stopWarping()}halt(J){return this.warp(this._effectiveTimeScale,0,J)}warp(J,Q,$){let Z=this._mixer,W=Z.time,Y=this.timeScale,X=this._timeScaleInterpolant;if(X===null)X=Z._lendControlInterpolant(),this._timeScaleInterpolant=X;let{parameterPositions:K,sampleValues:H}=X;return K[0]=W,K[1]=W+$,H[0]=J/Y,H[1]=Q/Y,this}stopWarping(){let J=this._timeScaleInterpolant;if(J!==null)this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(J);return this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(J,Q,$,Z){if(!this.enabled){this._updateWeight(J);return}let W=this._startTime;if(W!==null){let K=(J-W)*$;if(K<0||$===0)Q=0;else this._startTime=null,Q=$*K}Q*=this._updateTimeScale(J);let Y=this._updateTime(Q),X=this._updateWeight(J);if(X>0){let K=this._interpolants,H=this._propertyBindings;switch(this.blendMode){case 2501:for(let U=0,G=K.length;U!==G;++U)K[U].evaluate(Y),H[U].accumulateAdditive(X);break;case 2500:default:for(let U=0,G=K.length;U!==G;++U)K[U].evaluate(Y),H[U].accumulate(Z,X)}}}_updateWeight(J){let Q=0;if(this.enabled){Q=this.weight;let $=this._weightInterpolant;if($!==null){let Z=$.evaluate(J)[0];if(Q*=Z,J>$.parameterPositions[1]){if(this.stopFading(),Z===0)this.enabled=!1}}}return this._effectiveWeight=Q,Q}_updateTimeScale(J){let Q=0;if(!this.paused){Q=this.timeScale;let $=this._timeScaleInterpolant;if($!==null){let Z=$.evaluate(J)[0];if(Q*=Z,J>$.parameterPositions[1])if(this.stopWarping(),Q===0)this.paused=!0;else this.timeScale=Q}}return this._effectiveTimeScale=Q,Q}_updateTime(J){let Q=this._clip.duration,$=this.loop,Z=this.time+J,W=this._loopCount,Y=$===2202;if(J===0){if(W===-1)return Z;return Y&&(W&1)===1?Q-Z:Z}if($===2200){if(W===-1)this._loopCount=0,this._setEndings(!0,!0,!1);J:{if(Z>=Q)Z=Q;else if(Z<0)Z=0;else{this.time=Z;break J}if(this.clampWhenFinished)this.paused=!0;else this.enabled=!1;this.time=Z,this._mixer.dispatchEvent({type:"finished",action:this,direction:J<0?-1:1})}}else{if(W===-1)if(J>=0)W=0,this._setEndings(!0,this.repetitions===0,Y);else this._setEndings(this.repetitions===0,!0,Y);if(Z>=Q||Z<0){let X=Math.floor(Z/Q);Z-=Q*X,W+=Math.abs(X);let K=this.repetitions-W;if(K<=0){if(this.clampWhenFinished)this.paused=!0;else this.enabled=!1;Z=J>0?Q:0,this.time=Z,this._mixer.dispatchEvent({type:"finished",action:this,direction:J>0?1:-1})}else{if(K===1){let H=J<0;this._setEndings(H,!H,Y)}else this._setEndings(!1,!1,Y);this._loopCount=W,this.time=Z,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:X})}}else this._loopCount=W,this.time=Z;if(Y&&(W&1)===1)return Q-Z}return Z}_setEndings(J,Q,$){let Z=this._interpolantSettings;if($)Z.endingStart=2401,Z.endingEnd=2401;else{if(J)Z.endingStart=this.zeroSlopeAtStart?2401:2400;else Z.endingStart=2402;if(Q)Z.endingEnd=this.zeroSlopeAtEnd?2401:2400;else Z.endingEnd=2402}}_scheduleFading(J,Q,$){let Z=this._mixer,W=Z.time,Y=this._weightInterpolant;if(Y===null)Y=Z._lendControlInterpolant(),this._weightInterpolant=Y;let{parameterPositions:X,sampleValues:K}=Y;return X[0]=W,K[0]=Q,X[1]=W+J,K[1]=$,this}}var RN=new Float32Array(1);class O$ extends V9{constructor(J){super();if(this._root=J,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(J,Q){let $=J._localRoot||this._root,Z=J._clip.tracks,W=Z.length,Y=J._propertyBindings,X=J._interpolants,K=$.uuid,H=this._bindingsByRootAndName,U=H[K];if(U===void 0)U={},H[K]=U;for(let G=0;G!==W;++G){let F=Z[G],E=F.name,O=U[E];if(O!==void 0)++O.referenceCount,Y[G]=O;else{if(O=Y[G],O!==void 0){if(O._cacheIndex===null)++O.referenceCount,this._addInactiveBinding(O,K,E);continue}let R=Q&&Q._propertyBindings[G].binding.parsedPath;O=new dW(GJ.create($,E,R),F.ValueTypeName,F.getValueSize()),++O.referenceCount,this._addInactiveBinding(O,K,E),Y[G]=O}X[G].resultBuffer=O.buffer}}_activateAction(J){if(!this._isActiveAction(J)){if(J._cacheIndex===null){let $=(J._localRoot||this._root).uuid,Z=J._clip.uuid,W=this._actionsByClip[Z];this._bindAction(J,W&&W.knownActions[0]),this._addInactiveAction(J,Z,$)}let Q=J._propertyBindings;for(let $=0,Z=Q.length;$!==Z;++$){let W=Q[$];if(W.useCount++===0)this._lendBinding(W),W.saveOriginalState()}this._lendAction(J)}}_deactivateAction(J){if(this._isActiveAction(J)){let Q=J._propertyBindings;for(let $=0,Z=Q.length;$!==Z;++$){let W=Q[$];if(--W.useCount===0)W.restoreOriginalState(),this._takeBackBinding(W)}this._takeBackAction(J)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let J=this;this.stats={actions:{get total(){return J._actions.length},get inUse(){return J._nActiveActions}},bindings:{get total(){return J._bindings.length},get inUse(){return J._nActiveBindings}},controlInterpolants:{get total(){return J._controlInterpolants.length},get inUse(){return J._nActiveControlInterpolants}}}}_isActiveAction(J){let Q=J._cacheIndex;return Q!==null&&Q<this._nActiveActions}_addInactiveAction(J,Q,$){let Z=this._actions,W=this._actionsByClip,Y=W[Q];if(Y===void 0)Y={knownActions:[J],actionByRoot:{}},J._byClipCacheIndex=0,W[Q]=Y;else{let X=Y.knownActions;J._byClipCacheIndex=X.length,X.push(J)}J._cacheIndex=Z.length,Z.push(J),Y.actionByRoot[$]=J}_removeInactiveAction(J){let Q=this._actions,$=Q[Q.length-1],Z=J._cacheIndex;$._cacheIndex=Z,Q[Z]=$,Q.pop(),J._cacheIndex=null;let W=J._clip.uuid,Y=this._actionsByClip,X=Y[W],K=X.knownActions,H=K[K.length-1],U=J._byClipCacheIndex;H._byClipCacheIndex=U,K[U]=H,K.pop(),J._byClipCacheIndex=null;let G=X.actionByRoot,F=(J._localRoot||this._root).uuid;if(delete G[F],K.length===0)delete Y[W];this._removeInactiveBindingsForAction(J)}_removeInactiveBindingsForAction(J){let Q=J._propertyBindings;for(let $=0,Z=Q.length;$!==Z;++$){let W=Q[$];if(--W.referenceCount===0)this._removeInactiveBinding(W)}}_lendAction(J){let Q=this._actions,$=J._cacheIndex,Z=this._nActiveActions++,W=Q[Z];J._cacheIndex=Z,Q[Z]=J,W._cacheIndex=$,Q[$]=W}_takeBackAction(J){let Q=this._actions,$=J._cacheIndex,Z=--this._nActiveActions,W=Q[Z];J._cacheIndex=Z,Q[Z]=J,W._cacheIndex=$,Q[$]=W}_addInactiveBinding(J,Q,$){let Z=this._bindingsByRootAndName,W=this._bindings,Y=Z[Q];if(Y===void 0)Y={},Z[Q]=Y;Y[$]=J,J._cacheIndex=W.length,W.push(J)}_removeInactiveBinding(J){let Q=this._bindings,$=J.binding,Z=$.rootNode.uuid,W=$.path,Y=this._bindingsByRootAndName,X=Y[Z],K=Q[Q.length-1],H=J._cacheIndex;if(K._cacheIndex=H,Q[H]=K,Q.pop(),delete X[W],Object.keys(X).length===0)delete Y[Z]}_lendBinding(J){let Q=this._bindings,$=J._cacheIndex,Z=this._nActiveBindings++,W=Q[Z];J._cacheIndex=Z,Q[Z]=J,W._cacheIndex=$,Q[$]=W}_takeBackBinding(J){let Q=this._bindings,$=J._cacheIndex,Z=--this._nActiveBindings,W=Q[Z];J._cacheIndex=Z,Q[Z]=J,W._cacheIndex=$,Q[$]=W}_lendControlInterpolant(){let J=this._controlInterpolants,Q=this._nActiveControlInterpolants++,$=J[Q];if($===void 0)$=new X$(new Float32Array(2),new Float32Array(2),1,RN),$.__cacheIndex=Q,J[Q]=$;return $}_takeBackControlInterpolant(J){let Q=this._controlInterpolants,$=J.__cacheIndex,Z=--this._nActiveControlInterpolants,W=Q[Z];J.__cacheIndex=Z,Q[Z]=J,W.__cacheIndex=$,Q[$]=W}clipAction(J,Q,$){let Z=Q||this._root,W=Z.uuid,Y=typeof J==="string"?C8.findByName(Z,J):J,X=Y!==null?Y.uuid:J,K=this._actionsByClip[X],H=null;if($===void 0)if(Y!==null)$=Y.blendMode;else $=2500;if(K!==void 0){let G=K.actionByRoot[W];if(G!==void 0&&G.blendMode===$)return G;if(H=K.knownActions[0],Y===null)Y=H._clip}if(Y===null)return null;let U=new mW(this,Y,Q,$);return this._bindAction(U,H),this._addInactiveAction(U,X,W),U}existingAction(J,Q){let $=Q||this._root,Z=$.uuid,W=typeof J==="string"?C8.findByName($,J):J,Y=W?W.uuid:J,X=this._actionsByClip[Y];if(X!==void 0)return X.actionByRoot[Z]||null;return null}stopAllAction(){let J=this._actions,Q=this._nActiveActions;for(let $=Q-1;$>=0;--$)J[$].stop();return this}update(J){J*=this.timeScale;let Q=this._actions,$=this._nActiveActions,Z=this.time+=J,W=Math.sign(J),Y=this._accuIndex^=1;for(let H=0;H!==$;++H)Q[H]._update(Z,J,W,Y);let X=this._bindings,K=this._nActiveBindings;for(let H=0;H!==K;++H)X[H].apply(Y);return this}setTime(J){this.time=0;for(let Q=0;Q<this._actions.length;Q++)this._actions[Q].time=0;return this.update(J)}getRoot(){return this._root}uncacheClip(J){let Q=this._actions,$=J.uuid,Z=this._actionsByClip,W=Z[$];if(W!==void 0){let Y=W.knownActions;for(let X=0,K=Y.length;X!==K;++X){let H=Y[X];this._deactivateAction(H);let U=H._cacheIndex,G=Q[Q.length-1];H._cacheIndex=null,H._byClipCacheIndex=null,G._cacheIndex=U,Q[U]=G,Q.pop(),this._removeInactiveBindingsForAction(H)}delete Z[$]}}uncacheRoot(J){let Q=J.uuid,$=this._actionsByClip;for(let Y in $){let X=$[Y].actionByRoot,K=X[Q];if(K!==void 0)this._deactivateAction(K),this._removeInactiveAction(K)}let Z=this._bindingsByRootAndName,W=Z[Q];if(W!==void 0)for(let Y in W){let X=W[Y];X.restoreOriginalState(),this._removeInactiveBinding(X)}}uncacheAction(J,Q){let $=this.existingAction(J,Q);if($!==null)this._deactivateAction($),this._removeInactiveAction($)}}class PK extends xQ{constructor(J=1,Q=1,$=1,Z={}){super(J,Q,Z);this.isRenderTarget3D=!0,this.depth=$,this.texture=new y7(null,J,Q,$),this._setTextureOptions(Z),this.texture.isRenderTargetTexture=!0}}class lW{constructor(J){this.value=J}clone(){return new lW(this.value.clone===void 0?this.value:this.value.clone())}}var LN=0;class TK extends V9{constructor(){super();this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:LN++}),this.name="",this.usage=35044,this.uniforms=[]}add(J){return this.uniforms.push(J),this}remove(J){let Q=this.uniforms.indexOf(J);if(Q!==-1)this.uniforms.splice(Q,1);return this}setName(J){return this.name=J,this}setUsage(J){return this.usage=J,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(J){this.name=J.name,this.usage=J.usage;let Q=J.uniforms;this.uniforms.length=0;for(let $=0,Z=Q.length;$<Z;$++){let W=Array.isArray(Q[$])?Q[$]:[Q[$]];for(let Y=0;Y<W.length;Y++)this.uniforms.push(W[Y].clone())}return this}clone(){return new this.constructor().copy(this)}}class AK extends w8{constructor(J,Q,$=1){super(J,Q);this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=$}copy(J){return super.copy(J),this.meshPerAttribute=J.meshPerAttribute,this}clone(J){let Q=super.clone(J);return Q.meshPerAttribute=this.meshPerAttribute,Q}toJSON(J){let Q=super.toJSON(J);return Q.isInstancedInterleavedBuffer=!0,Q.meshPerAttribute=this.meshPerAttribute,Q}}class SK{constructor(J,Q,$,Z,W,Y=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=J,this.type=Q,this.itemSize=$,this.elementSize=Z,this.count=W,this.normalized=Y,this.version=0}set needsUpdate(J){if(J===!0)this.version++}setBuffer(J){return this.buffer=J,this}setType(J,Q){return this.type=J,this.elementSize=Q,this}setItemSize(J){return this.itemSize=J,this}setCount(J){return this.count=J,this}}var gU=new y0;class jK{constructor(J,Q,$=0,Z=1/0){this.ray=new J6(J,Q),this.near=$,this.far=Z,this.camera=null,this.layers=new x7,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(J,Q){this.ray.set(J,Q)}setFromCamera(J,Q){if(Q.isPerspectiveCamera)this.ray.origin.setFromMatrixPosition(Q.matrixWorld),this.ray.direction.set(J.x,J.y,0.5).unproject(Q).sub(this.ray.origin).normalize(),this.camera=Q;else if(Q.isOrthographicCamera)this.ray.origin.set(J.x,J.y,(Q.near+Q.far)/(Q.near-Q.far)).unproject(Q),this.ray.direction.set(0,0,-1).transformDirection(Q.matrixWorld),this.camera=Q;else v0("Raycaster: Unsupported camera type: "+Q.type)}setFromXRController(J){return gU.identity().extractRotation(J.matrixWorld),this.ray.origin.setFromMatrixPosition(J.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(gU),this}intersectObject(J,Q=!0,$=[]){return JX(J,this,$,Q),$.sort(pU),$}intersectObjects(J,Q=!0,$=[]){for(let Z=0,W=J.length;Z<W;Z++)JX(J[Z],this,$,Q);return $.sort(pU),$}}function pU(J,Q){return J.distance-Q.distance}function JX(J,Q,$,Z){let W=!0;if(J.layers.test(Q.layers)){if(J.raycast(Q,$)===!1)W=!1}if(W===!0&&Z===!0){let Y=J.children;for(let X=0,K=Y.length;X<K;X++)JX(Y[X],Q,$,!0)}}class vK{constructor(J=!0){this.autoStart=J,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,O0("Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let J=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let Q=performance.now();J=(Q-this.oldTime)/1000,this.oldTime=Q,this.elapsedTime+=J}return J}}class yK{constructor(J=1,Q=0,$=0){this.radius=J,this.phi=Q,this.theta=$}set(J,Q,$){return this.radius=J,this.phi=Q,this.theta=$,this}copy(J){return this.radius=J.radius,this.phi=J.phi,this.theta=J.theta,this}makeSafe(){return this.phi=s0(this.phi,0.000001,Math.PI-0.000001),this}setFromVector3(J){return this.setFromCartesianCoords(J.x,J.y,J.z)}setFromCartesianCoords(J,Q,$){if(this.radius=Math.sqrt(J*J+Q*Q+$*$),this.radius===0)this.theta=0,this.phi=0;else this.theta=Math.atan2(J,$),this.phi=Math.acos(s0(Q/this.radius,-1,1));return this}clone(){return new this.constructor().copy(this)}}class xK{constructor(J=1,Q=0,$=0){this.radius=J,this.theta=Q,this.y=$}set(J,Q,$){return this.radius=J,this.theta=Q,this.y=$,this}copy(J){return this.radius=J.radius,this.theta=J.theta,this.y=J.y,this}setFromVector3(J){return this.setFromCartesianCoords(J.x,J.y,J.z)}setFromCartesianCoords(J,Q,$){return this.radius=Math.sqrt(J*J+$*$),this.theta=Math.atan2(J,$),this.y=Q,this}clone(){return new this.constructor().copy(this)}}class cW{static{cW.prototype.isMatrix2=!0}constructor(J,Q,$,Z){if(this.elements=[1,0,0,1],J!==void 0)this.set(J,Q,$,Z)}identity(){return this.set(1,0,0,1),this}fromArray(J,Q=0){for(let $=0;$<4;$++)this.elements[$]=J[$+Q];return this}set(J,Q,$,Z){let W=this.elements;return W[0]=J,W[2]=Q,W[1]=$,W[3]=Z,this}}var uU=new i;class bK{constructor(J=new i(1/0,1/0),Q=new i(-1/0,-1/0)){this.isBox2=!0,this.min=J,this.max=Q}set(J,Q){return this.min.copy(J),this.max.copy(Q),this}setFromPoints(J){this.makeEmpty();for(let Q=0,$=J.length;Q<$;Q++)this.expandByPoint(J[Q]);return this}setFromCenterAndSize(J,Q){let $=uU.copy(Q).multiplyScalar(0.5);return this.min.copy(J).sub($),this.max.copy(J).add($),this}clone(){return new this.constructor().copy(this)}copy(J){return this.min.copy(J.min),this.max.copy(J.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(J){return this.isEmpty()?J.set(0,0):J.addVectors(this.min,this.max).multiplyScalar(0.5)}getSize(J){return this.isEmpty()?J.set(0,0):J.subVectors(this.max,this.min)}expandByPoint(J){return this.min.min(J),this.max.max(J),this}expandByVector(J){return this.min.sub(J),this.max.add(J),this}expandByScalar(J){return this.min.addScalar(-J),this.max.addScalar(J),this}containsPoint(J){return J.x>=this.min.x&&J.x<=this.max.x&&J.y>=this.min.y&&J.y<=this.max.y}containsBox(J){return this.min.x<=J.min.x&&J.max.x<=this.max.x&&this.min.y<=J.min.y&&J.max.y<=this.max.y}getParameter(J,Q){return Q.set((J.x-this.min.x)/(this.max.x-this.min.x),(J.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(J){return J.max.x>=this.min.x&&J.min.x<=this.max.x&&J.max.y>=this.min.y&&J.min.y<=this.max.y}clampPoint(J,Q){return Q.copy(J).clamp(this.min,this.max)}distanceToPoint(J){return this.clampPoint(J,uU).distanceTo(J)}intersect(J){if(this.min.max(J.min),this.max.min(J.max),this.isEmpty())this.makeEmpty();return this}union(J){return this.min.min(J.min),this.max.max(J.max),this}translate(J){return this.min.add(J),this.max.add(J),this}equals(J){return J.min.equals(this.min)&&J.max.equals(this.max)}}var dU=new T,EZ=new T,q7=new T,R7=new T,sY=new T,DN=new T,kN=new T;class hK{constructor(J=new T,Q=new T){this.start=J,this.end=Q}set(J,Q){return this.start.copy(J),this.end.copy(Q),this}copy(J){return this.start.copy(J.start),this.end.copy(J.end),this}getCenter(J){return J.addVectors(this.start,this.end).multiplyScalar(0.5)}delta(J){return J.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(J,Q){return this.delta(Q).multiplyScalar(J).add(this.start)}closestPointToPointParameter(J,Q){dU.subVectors(J,this.start),EZ.subVectors(this.end,this.start);let $=EZ.dot(EZ);if($===0)return 0;let W=EZ.dot(dU)/$;if(Q)W=s0(W,0,1);return W}closestPointToPoint(J,Q,$){let Z=this.closestPointToPointParameter(J,Q);return this.delta($).multiplyScalar(Z).add(this.start)}distanceSqToLine3(J,Q=DN,$=kN){let W,Y,X=this.start,K=J.start,H=this.end,U=J.end;q7.subVectors(H,X),R7.subVectors(U,K),sY.subVectors(X,K);let G=q7.dot(q7),F=R7.dot(R7),E=R7.dot(sY);if(G<=0.00000000000000010000000000000001&&F<=0.00000000000000010000000000000001)return Q.copy(X),$.copy(K),Q.sub($),Q.dot(Q);if(G<=0.00000000000000010000000000000001)W=0,Y=E/F,Y=s0(Y,0,1);else{let O=q7.dot(sY);if(F<=0.00000000000000010000000000000001)Y=0,W=s0(-O/G,0,1);else{let R=q7.dot(R7),k=G*F-R*R;if(k!==0)W=s0((R*E-O*F)/k,0,1);else W=0;if(Y=(R*W+E)/F,Y<0)Y=0,W=s0(-O/G,0,1);else if(Y>1)Y=1,W=s0((R-O)/G,0,1)}}return Q.copy(X).addScaledVector(q7,W),$.copy(K).addScaledVector(R7,Y),Q.distanceToSquared($)}applyMatrix4(J){return this.start.applyMatrix4(J),this.end.applyMatrix4(J),this}equals(J){return J.start.equals(this.start)&&J.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}var mU=new T;class fK extends HJ{constructor(J,Q){super();this.light=J,this.matrixAutoUpdate=!1,this.color=Q,this.type="SpotLightHelper";let $=new u0,Z=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let Y=0,X=1,K=32;Y<K;Y++,X++){let H=Y/K*Math.PI*2,U=X/K*Math.PI*2;Z.push(Math.cos(H),Math.sin(H),1,Math.cos(U),Math.sin(U),1)}$.setAttribute("position",new I0(Z,3));let W=new uJ({fog:!1,toneMapped:!1});this.cone=new N9($,W),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){if(this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent)this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld);else this.matrix.copy(this.light.matrixWorld);this.matrixWorld.copy(this.light.matrixWorld);let J=this.light.distance?this.light.distance:1000,Q=J*Math.tan(this.light.angle);if(this.cone.scale.set(Q,Q,J),mU.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(mU),this.color!==void 0)this.cone.material.color.set(this.color);else this.cone.material.color.copy(this.light.color)}}var u8=new T,FZ=new y0,iY=new y0;class gK extends N9{constructor(J){let Q=V5(J),$=new u0,Z=[],W=[];for(let H=0;H<Q.length;H++){let U=Q[H];if(U.parent&&U.parent.isBone)Z.push(0,0,0),Z.push(0,0,0),W.push(0,0,0),W.push(0,0,0)}$.setAttribute("position",new I0(Z,3)),$.setAttribute("color",new I0(W,3));let Y=new uJ({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super($,Y);this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=J,this.bones=Q,this.matrix=J.matrixWorld,this.matrixAutoUpdate=!1;let X=new e(255),K=new e(65280);this.setColors(X,K)}updateMatrixWorld(J){let Q=this.bones,$=this.geometry,Z=$.getAttribute("position");iY.copy(this.root.matrixWorld).invert();for(let W=0,Y=0;W<Q.length;W++){let X=Q[W];if(X.parent&&X.parent.isBone)FZ.multiplyMatrices(iY,X.matrixWorld),u8.setFromMatrixPosition(FZ),Z.setXYZ(Y,u8.x,u8.y,u8.z),FZ.multiplyMatrices(iY,X.parent.matrixWorld),u8.setFromMatrixPosition(FZ),Z.setXYZ(Y+1,u8.x,u8.y,u8.z),Y+=2}$.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(J)}setColors(J,Q){let Z=this.geometry.getAttribute("color");for(let W=0;W<Z.count;W+=2)Z.setXYZ(W,J.r,J.g,J.b),Z.setXYZ(W+1,Q.r,Q.g,Q.b);return Z.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function V5(J){let Q=[];if(J.isBone===!0)Q.push(J);for(let $=0;$<J.children.length;$++)Q.push(...V5(J.children[$]));return Q}class pK extends a0{constructor(J,Q,$){let Z=new $6(Q,4,2),W=new cJ({wireframe:!0,fog:!1,toneMapped:!1});super(Z,W);this.light=J,this.color=$,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){if(this.light.updateWorldMatrix(!0,!1),this.color!==void 0)this.material.color.set(this.color);else this.material.color.copy(this.light.color)}}var MN=new T,lU=new e,cU=new e;class uK extends HJ{constructor(J,Q,$){super();this.light=J,this.matrix=J.matrixWorld,this.matrixAutoUpdate=!1,this.color=$,this.type="HemisphereLightHelper";let Z=new m7(Q);if(Z.rotateY(Math.PI*0.5),this.material=new cJ({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0)this.material.vertexColors=!0;let W=Z.getAttribute("position"),Y=new Float32Array(W.count*3);Z.setAttribute("color",new i0(Y,3)),this.add(new a0(Z,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){let J=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{let Q=J.geometry.getAttribute("color");lU.copy(this.light.color),cU.copy(this.light.groundColor);for(let $=0,Z=Q.count;$<Z;$++){let W=$<Z/2?lU:cU;Q.setXYZ($,W.r,W.g,W.b)}Q.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),J.lookAt(MN.setFromMatrixPosition(this.light.matrixWorld).negate())}}class dK extends N9{constructor(J=10,Q=10,$=4473924,Z=8947848){$=new e($),Z=new e(Z);let W=Q/2,Y=J/Q,X=J/2,K=[],H=[];for(let F=0,E=0,O=-X;F<=Q;F++,O+=Y){K.push(-X,0,O,X,0,O),K.push(O,0,-X,O,0,X);let R=F===W?$:Z;R.toArray(H,E),E+=3,R.toArray(H,E),E+=3,R.toArray(H,E),E+=3,R.toArray(H,E),E+=3}let U=new u0;U.setAttribute("position",new I0(K,3)),U.setAttribute("color",new I0(H,3));let G=new uJ({vertexColors:!0,toneMapped:!1});super(U,G);this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class mK extends N9{constructor(J=10,Q=16,$=8,Z=64,W=4473924,Y=8947848){W=new e(W),Y=new e(Y);let X=[],K=[];if(Q>1)for(let G=0;G<Q;G++){let F=G/Q*(Math.PI*2),E=Math.sin(F)*J,O=Math.cos(F)*J;X.push(0,0,0),X.push(E,0,O);let R=G&1?W:Y;K.push(R.r,R.g,R.b),K.push(R.r,R.g,R.b)}for(let G=0;G<$;G++){let F=G&1?W:Y,E=J-J/$*G;for(let O=0;O<Z;O++){let R=O/Z*(Math.PI*2),k=Math.sin(R)*E,q=Math.cos(R)*E;X.push(k,0,q),K.push(F.r,F.g,F.b),R=(O+1)/Z*(Math.PI*2),k=Math.sin(R)*E,q=Math.cos(R)*E,X.push(k,0,q),K.push(F.r,F.g,F.b)}}let H=new u0;H.setAttribute("position",new I0(X,3)),H.setAttribute("color",new I0(K,3));let U=new uJ({vertexColors:!0,toneMapped:!1});super(H,U);this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}var nU=new T,NZ=new T,sU=new T;class lK extends HJ{constructor(J,Q,$){super();if(this.light=J,this.matrix=J.matrixWorld,this.matrixAutoUpdate=!1,this.color=$,this.type="DirectionalLightHelper",Q===void 0)Q=1;let Z=new u0;Z.setAttribute("position",new I0([-Q,Q,0,Q,Q,0,Q,-Q,0,-Q,-Q,0,-Q,Q,0],3));let W=new uJ({fog:!1,toneMapped:!1});this.lightPlane=new T9(Z,W),this.add(this.lightPlane),Z=new u0,Z.setAttribute("position",new I0([0,0,0,0,0,1],3)),this.targetLine=new T9(Z,W),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){if(this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),nU.setFromMatrixPosition(this.light.matrixWorld),NZ.setFromMatrixPosition(this.light.target.matrixWorld),sU.subVectors(NZ,nU),this.lightPlane.lookAt(NZ),this.color!==void 0)this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color);else this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color);this.targetLine.lookAt(NZ),this.targetLine.scale.z=sU.length()}}var OZ=new T,AJ=new c7;class cK extends N9{constructor(J){let Q=new u0,$=new uJ({color:16777215,vertexColors:!0,toneMapped:!1}),Z=[],W=[],Y={};X("n1","n2"),X("n2","n4"),X("n4","n3"),X("n3","n1"),X("f1","f2"),X("f2","f4"),X("f4","f3"),X("f3","f1"),X("n1","f1"),X("n2","f2"),X("n3","f3"),X("n4","f4"),X("p","n1"),X("p","n2"),X("p","n3"),X("p","n4"),X("u1","u2"),X("u2","u3"),X("u3","u1"),X("c","t"),X("p","c"),X("cn1","cn2"),X("cn3","cn4"),X("cf1","cf2"),X("cf3","cf4");function X(O,R){K(O),K(R)}function K(O){if(Z.push(0,0,0),W.push(0,0,0),Y[O]===void 0)Y[O]=[];Y[O].push(Z.length/3-1)}Q.setAttribute("position",new I0(Z,3)),Q.setAttribute("color",new I0(W,3));super(Q,$);if(this.type="CameraHelper",this.camera=J,this.camera.updateProjectionMatrix)this.camera.updateProjectionMatrix();this.matrix=J.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=Y,this.update();let H=new e(16755200),U=new e(16711680),G=new e(43775),F=new e(16777215),E=new e(3355443);this.setColors(H,U,G,F,E)}setColors(J,Q,$,Z,W){let X=this.geometry.getAttribute("color");return X.setXYZ(0,J.r,J.g,J.b),X.setXYZ(1,J.r,J.g,J.b),X.setXYZ(2,J.r,J.g,J.b),X.setXYZ(3,J.r,J.g,J.b),X.setXYZ(4,J.r,J.g,J.b),X.setXYZ(5,J.r,J.g,J.b),X.setXYZ(6,J.r,J.g,J.b),X.setXYZ(7,J.r,J.g,J.b),X.setXYZ(8,J.r,J.g,J.b),X.setXYZ(9,J.r,J.g,J.b),X.setXYZ(10,J.r,J.g,J.b),X.setXYZ(11,J.r,J.g,J.b),X.setXYZ(12,J.r,J.g,J.b),X.setXYZ(13,J.r,J.g,J.b),X.setXYZ(14,J.r,J.g,J.b),X.setXYZ(15,J.r,J.g,J.b),X.setXYZ(16,J.r,J.g,J.b),X.setXYZ(17,J.r,J.g,J.b),X.setXYZ(18,J.r,J.g,J.b),X.setXYZ(19,J.r,J.g,J.b),X.setXYZ(20,J.r,J.g,J.b),X.setXYZ(21,J.r,J.g,J.b),X.setXYZ(22,J.r,J.g,J.b),X.setXYZ(23,J.r,J.g,J.b),X.setXYZ(24,Q.r,Q.g,Q.b),X.setXYZ(25,Q.r,Q.g,Q.b),X.setXYZ(26,Q.r,Q.g,Q.b),X.setXYZ(27,Q.r,Q.g,Q.b),X.setXYZ(28,Q.r,Q.g,Q.b),X.setXYZ(29,Q.r,Q.g,Q.b),X.setXYZ(30,Q.r,Q.g,Q.b),X.setXYZ(31,Q.r,Q.g,Q.b),X.setXYZ(32,$.r,$.g,$.b),X.setXYZ(33,$.r,$.g,$.b),X.setXYZ(34,$.r,$.g,$.b),X.setXYZ(35,$.r,$.g,$.b),X.setXYZ(36,$.r,$.g,$.b),X.setXYZ(37,$.r,$.g,$.b),X.setXYZ(38,Z.r,Z.g,Z.b),X.setXYZ(39,Z.r,Z.g,Z.b),X.setXYZ(40,W.r,W.g,W.b),X.setXYZ(41,W.r,W.g,W.b),X.setXYZ(42,W.r,W.g,W.b),X.setXYZ(43,W.r,W.g,W.b),X.setXYZ(44,W.r,W.g,W.b),X.setXYZ(45,W.r,W.g,W.b),X.setXYZ(46,W.r,W.g,W.b),X.setXYZ(47,W.r,W.g,W.b),X.setXYZ(48,W.r,W.g,W.b),X.setXYZ(49,W.r,W.g,W.b),X.needsUpdate=!0,this}update(){let J=this.geometry,Q=this.pointMap,$=1,Z=1,W,Y;if(AJ.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)W=1,Y=0;else if(this.camera.coordinateSystem===2000)W=-1,Y=1;else if(this.camera.coordinateSystem===2001)W=0,Y=1;else throw Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);bJ("c",Q,J,AJ,0,0,W),bJ("t",Q,J,AJ,0,0,Y),bJ("n1",Q,J,AJ,-1,-1,W),bJ("n2",Q,J,AJ,1,-1,W),bJ("n3",Q,J,AJ,-1,1,W),bJ("n4",Q,J,AJ,1,1,W),bJ("f1",Q,J,AJ,-1,-1,Y),bJ("f2",Q,J,AJ,1,-1,Y),bJ("f3",Q,J,AJ,-1,1,Y),bJ("f4",Q,J,AJ,1,1,Y),bJ("u1",Q,J,AJ,0.7,1.1,W),bJ("u2",Q,J,AJ,-0.7,1.1,W),bJ("u3",Q,J,AJ,0,2,W),bJ("cf1",Q,J,AJ,-1,0,Y),bJ("cf2",Q,J,AJ,1,0,Y),bJ("cf3",Q,J,AJ,0,-1,Y),bJ("cf4",Q,J,AJ,0,1,Y),bJ("cn1",Q,J,AJ,-1,0,W),bJ("cn2",Q,J,AJ,1,0,W),bJ("cn3",Q,J,AJ,0,-1,W),bJ("cn4",Q,J,AJ,0,1,W),J.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function bJ(J,Q,$,Z,W,Y,X){OZ.set(W,Y,X).unproject(Z);let K=Q[J];if(K!==void 0){let H=$.getAttribute("position");for(let U=0,G=K.length;U<G;U++)H.setXYZ(K[U],OZ.x,OZ.y,OZ.z)}}var qZ=new SJ;class nK extends N9{constructor(J,Q=16776960){let $=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),Z=new Float32Array(24),W=new u0;W.setIndex(new i0($,1)),W.setAttribute("position",new i0(Z,3));super(W,new uJ({color:Q,toneMapped:!1}));this.object=J,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0)qZ.setFromObject(this.object);if(qZ.isEmpty())return;let{min:J,max:Q}=qZ,$=this.geometry.attributes.position,Z=$.array;Z[0]=Q.x,Z[1]=Q.y,Z[2]=Q.z,Z[3]=J.x,Z[4]=Q.y,Z[5]=Q.z,Z[6]=J.x,Z[7]=J.y,Z[8]=Q.z,Z[9]=Q.x,Z[10]=J.y,Z[11]=Q.z,Z[12]=Q.x,Z[13]=Q.y,Z[14]=J.z,Z[15]=J.x,Z[16]=Q.y,Z[17]=J.z,Z[18]=J.x,Z[19]=J.y,Z[20]=J.z,Z[21]=Q.x,Z[22]=J.y,Z[23]=J.z,$.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(J){return this.object=J,this.update(),this}copy(J,Q){return super.copy(J,Q),this.object=J.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class sK extends N9{constructor(J,Q=16776960){let $=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),Z=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],W=new u0;W.setIndex(new i0($,1)),W.setAttribute("position",new I0(Z,3));super(W,new uJ({color:Q,toneMapped:!1}));this.box=J,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(J){let Q=this.box;if(Q.isEmpty())return;Q.getCenter(this.position),Q.getSize(this.scale),this.scale.multiplyScalar(0.5),super.updateMatrixWorld(J)}dispose(){this.geometry.dispose(),this.material.dispose()}}class iK extends T9{constructor(J,Q=1,$=16776960){let Z=$,W=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],Y=new u0;Y.setAttribute("position",new I0(W,3)),Y.computeBoundingSphere();super(Y,new uJ({color:Z,toneMapped:!1}));this.type="PlaneHelper",this.plane=J,this.size=Q;let X=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],K=new u0;K.setAttribute("position",new I0(X,3)),K.computeBoundingSphere(),this.add(new a0(K,new cJ({color:Z,opacity:0.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(J){this.position.set(0,0,0),this.scale.set(0.5*this.size,0.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(J)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}var iU=new T,RZ,oY;class oK extends HJ{constructor(J=new T(0,0,1),Q=new T(0,0,0),$=1,Z=16776960,W=$*0.2,Y=W*0.2){super();if(this.type="ArrowHelper",RZ===void 0)RZ=new u0,RZ.setAttribute("position",new I0([0,0,0,0,1,0],3)),oY=new p7(0.5,1,5,1),oY.translate(0,-0.5,0);this.position.copy(Q),this.line=new T9(RZ,new uJ({color:Z,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new a0(oY,new cJ({color:Z,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(J),this.setLength($,W,Y)}setDirection(J){if(J.y>0.99999)this.quaternion.set(0,0,0,1);else if(J.y<-0.99999)this.quaternion.set(1,0,0,0);else{iU.set(J.z,0,-J.x).normalize();let Q=Math.acos(J.y);this.quaternion.setFromAxisAngle(iU,Q)}}setLength(J,Q=J*0.2,$=Q*0.2){this.line.scale.set(1,Math.max(0.0001,J-Q),1),this.line.updateMatrix(),this.cone.scale.set($,Q,$),this.cone.position.y=J,this.cone.updateMatrix()}setColor(J){this.line.material.color.set(J),this.cone.material.color.set(J)}copy(J){return super.copy(J,!1),this.line.copy(J.line),this.cone.copy(J.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class aK extends N9{constructor(J=1){let Q=[0,0,0,J,0,0,0,0,0,0,J,0,0,0,0,0,0,J],$=[1,0,0,1,0.6,0,0,1,0,0.6,1,0,0,0,1,0,0.6,1],Z=new u0;Z.setAttribute("position",new I0(Q,3)),Z.setAttribute("color",new I0($,3));let W=new uJ({vertexColors:!0,toneMapped:!1});super(Z,W);this.type="AxesHelper"}setColors(J,Q,$){let Z=new e,W=this.geometry.attributes.color.array;return Z.set(J),Z.toArray(W,0),Z.toArray(W,3),Z.set(Q),Z.toArray(W,6),Z.toArray(W,9),Z.set($),Z.toArray(W,12),Z.toArray(W,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class rK{constructor(){this.type="ShapePath",this.color=new e,this.subPaths=[],this.currentPath=null}moveTo(J,Q){return this.currentPath=new V7,this.subPaths.push(this.currentPath),this.currentPath.moveTo(J,Q),this}lineTo(J,Q){return this.currentPath.lineTo(J,Q),this}quadraticCurveTo(J,Q,$,Z){return this.currentPath.quadraticCurveTo(J,Q,$,Z),this}bezierCurveTo(J,Q,$,Z,W,Y){return this.currentPath.bezierCurveTo(J,Q,$,Z,W,Y),this}splineThru(J){return this.currentPath.splineThru(J),this}toShapes(J){function Q(q){let N=[];for(let L=0,D=q.length;L<D;L++){let V=q[L],I=new B8;I.curves=V.curves,N.push(I)}return N}function $(q,N){let L=N.length,D=!1;for(let V=L-1,I=0;I<L;V=I++){let z=N[V],B=N[I],M=B.x-z.x,C=B.y-z.y;if(Math.abs(C)>Number.EPSILON){if(C<0)z=N[I],M=-M,B=N[V],C=-C;if(q.y<z.y||q.y>B.y)continue;if(q.y===z.y){if(q.x===z.x)return!0}else{let j=C*(q.x-z.x)-M*(q.y-z.y);if(j===0)return!0;if(j<0)continue;D=!D}}else{if(q.y!==z.y)continue;if(B.x<=q.x&&q.x<=z.x||z.x<=q.x&&q.x<=B.x)return!0}}return D}let Z=w9.isClockWise,W=this.subPaths;if(W.length===0)return[];let Y,X,K,H=[];if(W.length===1)return X=W[0],K=new B8,K.curves=X.curves,H.push(K),H;let U=!Z(W[0].getPoints());U=J?!U:U;let G=[],F=[],E=[],O=0,R;F[O]=void 0,E[O]=[];for(let q=0,N=W.length;q<N;q++)if(X=W[q],R=X.getPoints(),Y=Z(R),Y=J?!Y:Y,Y){if(!U&&F[O])O++;if(F[O]={s:new B8,p:R},F[O].s.curves=X.curves,U)O++;E[O]=[]}else E[O].push({h:X,p:R[0]});if(!F[0])return Q(W);if(F.length>1){let q=!1,N=0;for(let L=0,D=F.length;L<D;L++)G[L]=[];for(let L=0,D=F.length;L<D;L++){let V=E[L];for(let I=0;I<V.length;I++){let z=V[I],B=!0;for(let M=0;M<F.length;M++)if($(z.p,F[M].p)){if(L!==M)N++;if(B)B=!1,G[M].push(z);else q=!0}if(B)G[L].push(z)}}if(N>0&&q===!1)E=G}let k;for(let q=0,N=F.length;q<N;q++){K=F[q].s,H.push(K),k=E[q];for(let L=0,D=k.length;L<D;L++)K.holes.push(k[L].h)}return H}}class tK extends V9{constructor(J,Q=null){super();this.object=J,this.domElement=Q,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(J){if(J===void 0){O0("Controls: connect() now requires an element.");return}if(this.domElement!==null)this.disconnect();this.domElement=J}disconnect(){}dispose(){}update(){}}function VN(J,Q){let $=J.image&&J.image.width?J.image.width/J.image.height:1;if($>Q)J.repeat.x=1,J.repeat.y=$/Q,J.offset.x=0,J.offset.y=(1-J.repeat.y)/2;else J.repeat.x=Q/$,J.repeat.y=1,J.offset.x=(1-J.repeat.x)/2,J.offset.y=0;return J}function BN(J,Q){let $=J.image&&J.image.width?J.image.width/J.image.height:1;if($>Q)J.repeat.x=Q/$,J.repeat.y=1,J.offset.x=(1-J.repeat.x)/2,J.offset.y=0;else J.repeat.x=1,J.repeat.y=$/Q,J.offset.x=0,J.offset.y=(1-J.repeat.y)/2;return J}function CN(J){return J.repeat.x=1,J.repeat.y=1,J.offset.x=0,J.offset.y=0,J}function nW(J,Q,$,Z){let W=IN(Z);switch($){case 1021:return J*Q;case 1028:return J*Q/W.components*W.byteLength;case 1029:return J*Q/W.components*W.byteLength;case 1030:return J*Q*2/W.components*W.byteLength;case 1031:return J*Q*2/W.components*W.byteLength;case 1022:return J*Q*3/W.components*W.byteLength;case 1023:return J*Q*4/W.components*W.byteLength;case 1033:return J*Q*4/W.components*W.byteLength;case 33776:case 33777:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*8;case 33778:case 33779:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*16;case 35841:case 35843:return Math.max(J,16)*Math.max(Q,8)/4;case 35840:case 35842:return Math.max(J,8)*Math.max(Q,8)/2;case 36196:case 37492:case 37488:case 37489:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*8;case 37496:case 37490:case 37491:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*16;case 37808:return Math.floor((J+3)/4)*Math.floor((Q+3)/4)*16;case 37809:return Math.floor((J+4)/5)*Math.floor((Q+3)/4)*16;case 37810:return Math.floor((J+4)/5)*Math.floor((Q+4)/5)*16;case 37811:return Math.floor((J+5)/6)*Math.floor((Q+4)/5)*16;case 37812:return Math.floor((J+5)/6)*Math.floor((Q+5)/6)*16;case 37813:return Math.floor((J+7)/8)*Math.floor((Q+4)/5)*16;case 37814:return Math.floor((J+7)/8)*Math.floor((Q+5)/6)*16;case 37815:return Math.floor((J+7)/8)*Math.floor((Q+7)/8)*16;case 37816:return Math.floor((J+9)/10)*Math.floor((Q+4)/5)*16;case 37817:return Math.floor((J+9)/10)*Math.floor((Q+5)/6)*16;case 37818:return Math.floor((J+9)/10)*Math.floor((Q+7)/8)*16;case 37819:return Math.floor((J+9)/10)*Math.floor((Q+9)/10)*16;case 37820:return Math.floor((J+11)/12)*Math.floor((Q+9)/10)*16;case 37821:return Math.floor((J+11)/12)*Math.floor((Q+11)/12)*16;case 36492:case 36494:case 36495:return Math.ceil(J/4)*Math.ceil(Q/4)*16;case 36283:case 36284:return Math.ceil(J/4)*Math.ceil(Q/4)*8;case 36285:case 36286:return Math.ceil(J/4)*Math.ceil(Q/4)*16}throw Error(`Unable to determine texture byte length for ${$} format.`)}function IN(J){switch(J){case 1009:case 1010:return{byteLength:1,components:1};case 1012:case 1011:case 1016:return{byteLength:2,components:1};case 1017:case 1018:return{byteLength:2,components:4};case 1014:case 1013:case 1015:return{byteLength:4,components:1};case 35902:case 35899:return{byteLength:4,components:3}}throw Error(`Unknown texture type ${J}.`)}class eK{static contain(J,Q){return VN(J,Q)}static cover(J,Q){return BN(J,Q)}static fill(J){return CN(J)}static getByteLength(J,Q,$,Z){return nW(J,Q,$,Z)}}if(typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"184"}}));if(typeof window<"u")if(window.__THREE__)O0("WARNING: Multiple instances of Three.js being imported.");else window.__THREE__="184";function l5(){let J=null,Q=!1,$=null,Z=null;function W(Y,X){$(Y,X),Z=J.requestAnimationFrame(W)}return{start:function(){if(Q===!0)return;if($===null)return;if(J===null)return;Z=J.requestAnimationFrame(W),Q=!0},stop:function(){if(J!==null)J.cancelAnimationFrame(Z);Q=!1},setAnimationLoop:function(Y){$=Y},setContext:function(Y){J=Y}}}function zN(J){let Q=new WeakMap;function $(K,H){let{array:U,usage:G}=K,F=U.byteLength,E=J.createBuffer();J.bindBuffer(H,E),J.bufferData(H,U,G),K.onUploadCallback();let O;if(U instanceof Float32Array)O=J.FLOAT;else if(typeof Float16Array<"u"&&U instanceof Float16Array)O=J.HALF_FLOAT;else if(U instanceof Uint16Array)if(K.isFloat16BufferAttribute)O=J.HALF_FLOAT;else O=J.UNSIGNED_SHORT;else if(U instanceof Int16Array)O=J.SHORT;else if(U instanceof Uint32Array)O=J.UNSIGNED_INT;else if(U instanceof Int32Array)O=J.INT;else if(U instanceof Int8Array)O=J.BYTE;else if(U instanceof Uint8Array)O=J.UNSIGNED_BYTE;else if(U instanceof Uint8ClampedArray)O=J.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+U);return{buffer:E,type:O,bytesPerElement:U.BYTES_PER_ELEMENT,version:K.version,size:F}}function Z(K,H,U){let{array:G,updateRanges:F}=H;if(J.bindBuffer(U,K),F.length===0)J.bufferSubData(U,0,G);else{F.sort((O,R)=>O.start-R.start);let E=0;for(let O=1;O<F.length;O++){let R=F[E],k=F[O];if(k.start<=R.start+R.count+1)R.count=Math.max(R.count,k.start+k.count-R.start);else++E,F[E]=k}F.length=E+1;for(let O=0,R=F.length;O<R;O++){let k=F[O];J.bufferSubData(U,k.start*G.BYTES_PER_ELEMENT,G,k.start,k.count)}H.clearUpdateRanges()}H.onUploadCallback()}function W(K){if(K.isInterleavedBufferAttribute)K=K.data;return Q.get(K)}function Y(K){if(K.isInterleavedBufferAttribute)K=K.data;let H=Q.get(K);if(H)J.deleteBuffer(H.buffer),Q.delete(K)}function X(K,H){if(K.isInterleavedBufferAttribute)K=K.data;if(K.isGLBufferAttribute){let G=Q.get(K);if(!G||G.version<K.version)Q.set(K,{buffer:K.buffer,type:K.type,bytesPerElement:K.elementSize,version:K.version});return}let U=Q.get(K);if(U===void 0)Q.set(K,$(K,H));else if(U.version<K.version){if(U.size!==K.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.");Z(U.buffer,K,H),U.version=K.version}}return{get:W,remove:Y,update:X}}var _N=`#ifdef USE_ALPHAHASH
6
6
  if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
7
- #endif`,RU=`#ifdef USE_ALPHAHASH
7
+ #endif`,wN=`#ifdef USE_ALPHAHASH
8
8
  const float ALPHA_HASH_SCALE = 0.05;
9
9
  float hash2D( vec2 value ) {
10
10
  return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
@@ -39,20 +39,20 @@ var $Y="184";var ZY=0,F$=1,WY=2;var b6=1,YY=2,Z6=3,z9=0,bJ=1,cJ=2,w9=0,V8=1,f6=2
39
39
  : cases.z;
40
40
  return clamp( threshold , 1.0e-6, 1.0 );
41
41
  }
42
- #endif`,LU=`#ifdef USE_ALPHAMAP
42
+ #endif`,PN=`#ifdef USE_ALPHAMAP
43
43
  diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
44
- #endif`,DU=`#ifdef USE_ALPHAMAP
44
+ #endif`,TN=`#ifdef USE_ALPHAMAP
45
45
  uniform sampler2D alphaMap;
46
- #endif`,MU=`#ifdef USE_ALPHATEST
46
+ #endif`,AN=`#ifdef USE_ALPHATEST
47
47
  #ifdef ALPHA_TO_COVERAGE
48
48
  diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
49
49
  if ( diffuseColor.a == 0.0 ) discard;
50
50
  #else
51
51
  if ( diffuseColor.a < alphaTest ) discard;
52
52
  #endif
53
- #endif`,kU=`#ifdef USE_ALPHATEST
53
+ #endif`,SN=`#ifdef USE_ALPHATEST
54
54
  uniform float alphaTest;
55
- #endif`,BU=`#ifdef USE_AOMAP
55
+ #endif`,jN=`#ifdef USE_AOMAP
56
56
  float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
57
57
  reflectedLight.indirectDiffuse *= ambientOcclusion;
58
58
  #if defined( USE_CLEARCOAT )
@@ -65,10 +65,10 @@ var $Y="184";var ZY=0,F$=1,WY=2;var b6=1,YY=2,Z6=3,z9=0,bJ=1,cJ=2,w9=0,V8=1,f6=2
65
65
  float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
66
66
  reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
67
67
  #endif
68
- #endif`,VU=`#ifdef USE_AOMAP
68
+ #endif`,vN=`#ifdef USE_AOMAP
69
69
  uniform sampler2D aoMap;
70
70
  uniform float aoMapIntensity;
71
- #endif`,CU=`#ifdef USE_BATCHING
71
+ #endif`,yN=`#ifdef USE_BATCHING
72
72
  #if ! defined( GL_ANGLE_multi_draw )
73
73
  #define gl_DrawID _gl_DrawID
74
74
  uniform int _gl_DrawID;
@@ -102,15 +102,15 @@ var $Y="184";var ZY=0,F$=1,WY=2;var b6=1,YY=2,Z6=3,z9=0,bJ=1,cJ=2,w9=0,V8=1,f6=2
102
102
  int y = j / size;
103
103
  return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
104
104
  }
105
- #endif`,IU=`#ifdef USE_BATCHING
105
+ #endif`,xN=`#ifdef USE_BATCHING
106
106
  mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
107
- #endif`,zU=`vec3 transformed = vec3( position );
107
+ #endif`,bN=`vec3 transformed = vec3( position );
108
108
  #ifdef USE_ALPHAHASH
109
109
  vPosition = vec3( position );
110
- #endif`,wU=`vec3 objectNormal = vec3( normal );
110
+ #endif`,hN=`vec3 objectNormal = vec3( normal );
111
111
  #ifdef USE_TANGENT
112
112
  vec3 objectTangent = vec3( tangent.xyz );
113
- #endif`,PU=`float G_BlinnPhong_Implicit( ) {
113
+ #endif`,fN=`float G_BlinnPhong_Implicit( ) {
114
114
  return 0.25;
115
115
  }
116
116
  float D_BlinnPhong( const in float shininess, const in float dotNH ) {
@@ -124,7 +124,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
124
124
  float G = G_BlinnPhong_Implicit( );
125
125
  float D = D_BlinnPhong( shininess, dotNH );
126
126
  return F * ( G * D );
127
- } // validated`,_U=`#ifdef USE_IRIDESCENCE
127
+ } // validated`,gN=`#ifdef USE_IRIDESCENCE
128
128
  const mat3 XYZ_TO_REC709 = mat3(
129
129
  3.2404542, -0.9692660, 0.0556434,
130
130
  -1.5371385, 1.8760108, -0.2040259,
@@ -187,7 +187,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
187
187
  }
188
188
  return max( I, vec3( 0.0 ) );
189
189
  }
190
- #endif`,TU=`#ifdef USE_BUMPMAP
190
+ #endif`,pN=`#ifdef USE_BUMPMAP
191
191
  uniform sampler2D bumpMap;
192
192
  uniform float bumpScale;
193
193
  vec2 dHdxy_fwd() {
@@ -208,7 +208,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
208
208
  vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
209
209
  return normalize( abs( fDet ) * surf_norm - vGrad );
210
210
  }
211
- #endif`,AU=`#if NUM_CLIPPING_PLANES > 0
211
+ #endif`,uN=`#if NUM_CLIPPING_PLANES > 0
212
212
  vec4 plane;
213
213
  #ifdef ALPHA_TO_COVERAGE
214
214
  float distanceToPlane, distanceGradient;
@@ -254,20 +254,20 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
254
254
  if ( clipped ) discard;
255
255
  #endif
256
256
  #endif
257
- #endif`,SU=`#if NUM_CLIPPING_PLANES > 0
257
+ #endif`,dN=`#if NUM_CLIPPING_PLANES > 0
258
258
  varying vec3 vClipPosition;
259
259
  uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
260
- #endif`,jU=`#if NUM_CLIPPING_PLANES > 0
260
+ #endif`,mN=`#if NUM_CLIPPING_PLANES > 0
261
261
  varying vec3 vClipPosition;
262
- #endif`,vU=`#if NUM_CLIPPING_PLANES > 0
262
+ #endif`,lN=`#if NUM_CLIPPING_PLANES > 0
263
263
  vClipPosition = - mvPosition.xyz;
264
- #endif`,yU=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
264
+ #endif`,cN=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
265
265
  diffuseColor *= vColor;
266
- #endif`,hU=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
266
+ #endif`,nN=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
267
267
  varying vec4 vColor;
268
- #endif`,xU=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
268
+ #endif`,sN=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
269
269
  varying vec4 vColor;
270
- #endif`,bU=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
270
+ #endif`,iN=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
271
271
  vColor = vec4( 1.0 );
272
272
  #endif
273
273
  #ifdef USE_COLOR_ALPHA
@@ -280,7 +280,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve
280
280
  #endif
281
281
  #ifdef USE_BATCHING_COLOR
282
282
  vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
283
- #endif`,fU=`#define PI 3.141592653589793
283
+ #endif`,oN=`#define PI 3.141592653589793
284
284
  #define PI2 6.283185307179586
285
285
  #define PI_HALF 1.5707963267948966
286
286
  #define RECIPROCAL_PI 0.3183098861837907
@@ -347,7 +347,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
347
347
  float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
348
348
  float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
349
349
  return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
350
- } // validated`,gU=`#ifdef ENVMAP_TYPE_CUBE_UV
350
+ } // validated`,aN=`#ifdef ENVMAP_TYPE_CUBE_UV
351
351
  #define cubeUV_minMipLevel 4.0
352
352
  #define cubeUV_minTileSize 16.0
353
353
  float getFace( vec3 direction ) {
@@ -440,7 +440,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
440
440
  return vec4( mix( color0, color1, mipF ), 1.0 );
441
441
  }
442
442
  }
443
- #endif`,pU=`vec3 transformedNormal = objectNormal;
443
+ #endif`,rN=`vec3 transformedNormal = objectNormal;
444
444
  #ifdef USE_TANGENT
445
445
  vec3 transformedTangent = objectTangent;
446
446
  #endif
@@ -469,21 +469,21 @@ transformedNormal = normalMatrix * transformedNormal;
469
469
  #ifdef FLIP_SIDED
470
470
  transformedTangent = - transformedTangent;
471
471
  #endif
472
- #endif`,dU=`#ifdef USE_DISPLACEMENTMAP
472
+ #endif`,tN=`#ifdef USE_DISPLACEMENTMAP
473
473
  uniform sampler2D displacementMap;
474
474
  uniform float displacementScale;
475
475
  uniform float displacementBias;
476
- #endif`,uU=`#ifdef USE_DISPLACEMENTMAP
476
+ #endif`,eN=`#ifdef USE_DISPLACEMENTMAP
477
477
  transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
478
- #endif`,mU=`#ifdef USE_EMISSIVEMAP
478
+ #endif`,JO=`#ifdef USE_EMISSIVEMAP
479
479
  vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
480
480
  #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
481
481
  emissiveColor = sRGBTransferEOTF( emissiveColor );
482
482
  #endif
483
483
  totalEmissiveRadiance *= emissiveColor.rgb;
484
- #endif`,lU=`#ifdef USE_EMISSIVEMAP
484
+ #endif`,QO=`#ifdef USE_EMISSIVEMAP
485
485
  uniform sampler2D emissiveMap;
486
- #endif`,cU="gl_FragColor = linearToOutputTexel( gl_FragColor );",nU=`vec4 LinearTransferOETF( in vec4 value ) {
486
+ #endif`,$O="gl_FragColor = linearToOutputTexel( gl_FragColor );",ZO=`vec4 LinearTransferOETF( in vec4 value ) {
487
487
  return value;
488
488
  }
489
489
  vec4 sRGBTransferEOTF( in vec4 value ) {
@@ -491,7 +491,7 @@ vec4 sRGBTransferEOTF( in vec4 value ) {
491
491
  }
492
492
  vec4 sRGBTransferOETF( in vec4 value ) {
493
493
  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 );
494
- }`,sU=`#ifdef USE_ENVMAP
494
+ }`,WO=`#ifdef USE_ENVMAP
495
495
  #ifdef ENV_WORLDPOS
496
496
  vec3 cameraToFrag;
497
497
  if ( isOrthographic ) {
@@ -518,7 +518,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
518
518
  outgoingLight += envColor.xyz * specularStrength * reflectivity;
519
519
  #endif
520
520
  #endif
521
- #endif`,iU=`#ifdef USE_ENVMAP
521
+ #endif`,YO=`#ifdef USE_ENVMAP
522
522
  uniform float envMapIntensity;
523
523
  uniform mat3 envMapRotation;
524
524
  #ifdef ENVMAP_TYPE_CUBE
@@ -526,7 +526,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
526
526
  #else
527
527
  uniform sampler2D envMap;
528
528
  #endif
529
- #endif`,oU=`#ifdef USE_ENVMAP
529
+ #endif`,XO=`#ifdef USE_ENVMAP
530
530
  uniform float reflectivity;
531
531
  #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
532
532
  #define ENV_WORLDPOS
@@ -537,7 +537,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
537
537
  #else
538
538
  varying vec3 vReflect;
539
539
  #endif
540
- #endif`,aU=`#ifdef USE_ENVMAP
540
+ #endif`,KO=`#ifdef USE_ENVMAP
541
541
  #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
542
542
  #define ENV_WORLDPOS
543
543
  #endif
@@ -548,7 +548,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
548
548
  varying vec3 vReflect;
549
549
  uniform float refractionRatio;
550
550
  #endif
551
- #endif`,rU=`#ifdef USE_ENVMAP
551
+ #endif`,HO=`#ifdef USE_ENVMAP
552
552
  #ifdef ENV_WORLDPOS
553
553
  vWorldPosition = worldPosition.xyz;
554
554
  #else
@@ -565,18 +565,18 @@ vec4 sRGBTransferOETF( in vec4 value ) {
565
565
  vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
566
566
  #endif
567
567
  #endif
568
- #endif`,tU=`#ifdef USE_FOG
568
+ #endif`,UO=`#ifdef USE_FOG
569
569
  vFogDepth = - mvPosition.z;
570
- #endif`,eU=`#ifdef USE_FOG
570
+ #endif`,GO=`#ifdef USE_FOG
571
571
  varying float vFogDepth;
572
- #endif`,JG=`#ifdef USE_FOG
572
+ #endif`,EO=`#ifdef USE_FOG
573
573
  #ifdef FOG_EXP2
574
574
  float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
575
575
  #else
576
576
  float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
577
577
  #endif
578
578
  gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
579
- #endif`,QG=`#ifdef USE_FOG
579
+ #endif`,FO=`#ifdef USE_FOG
580
580
  uniform vec3 fogColor;
581
581
  varying float vFogDepth;
582
582
  #ifdef FOG_EXP2
@@ -585,7 +585,7 @@ vec4 sRGBTransferOETF( in vec4 value ) {
585
585
  uniform float fogNear;
586
586
  uniform float fogFar;
587
587
  #endif
588
- #endif`,$G=`#ifdef USE_GRADIENTMAP
588
+ #endif`,NO=`#ifdef USE_GRADIENTMAP
589
589
  uniform sampler2D gradientMap;
590
590
  #endif
591
591
  vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
@@ -597,12 +597,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
597
597
  vec2 fw = fwidth( coord ) * 0.5;
598
598
  return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
599
599
  #endif
600
- }`,ZG=`#ifdef USE_LIGHTMAP
600
+ }`,OO=`#ifdef USE_LIGHTMAP
601
601
  uniform sampler2D lightMap;
602
602
  uniform float lightMapIntensity;
603
- #endif`,WG=`LambertMaterial material;
603
+ #endif`,qO=`LambertMaterial material;
604
604
  material.diffuseColor = diffuseColor.rgb;
605
- material.specularStrength = specularStrength;`,YG=`varying vec3 vViewPosition;
605
+ material.specularStrength = specularStrength;`,RO=`varying vec3 vViewPosition;
606
606
  struct LambertMaterial {
607
607
  vec3 diffuseColor;
608
608
  float specularStrength;
@@ -616,7 +616,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr
616
616
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
617
617
  }
618
618
  #define RE_Direct RE_Direct_Lambert
619
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,XG=`uniform bool receiveShadow;
619
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,LO=`uniform bool receiveShadow;
620
620
  uniform vec3 ambientLightColor;
621
621
  #if defined( USE_LIGHT_PROBES )
622
622
  uniform vec3 lightProbe[ 9 ];
@@ -733,7 +733,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
733
733
  return irradiance;
734
734
  }
735
735
  #endif
736
- #include <lightprobes_pars_fragment>`,KG=`#ifdef USE_ENVMAP
736
+ #include <lightprobes_pars_fragment>`,DO=`#ifdef USE_ENVMAP
737
737
  vec3 getIBLIrradiance( const in vec3 normal ) {
738
738
  #ifdef ENVMAP_TYPE_CUBE_UV
739
739
  vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
@@ -766,8 +766,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi
766
766
  #endif
767
767
  }
768
768
  #endif
769
- #endif`,HG=`ToonMaterial material;
770
- material.diffuseColor = diffuseColor.rgb;`,UG=`varying vec3 vViewPosition;
769
+ #endif`,kO=`ToonMaterial material;
770
+ material.diffuseColor = diffuseColor.rgb;`,MO=`varying vec3 vViewPosition;
771
771
  struct ToonMaterial {
772
772
  vec3 diffuseColor;
773
773
  };
@@ -779,11 +779,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo
779
779
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
780
780
  }
781
781
  #define RE_Direct RE_Direct_Toon
782
- #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,GG=`BlinnPhongMaterial material;
782
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,VO=`BlinnPhongMaterial material;
783
783
  material.diffuseColor = diffuseColor.rgb;
784
784
  material.specularColor = specular;
785
785
  material.specularShininess = shininess;
786
- material.specularStrength = specularStrength;`,EG=`varying vec3 vViewPosition;
786
+ material.specularStrength = specularStrength;`,BO=`varying vec3 vViewPosition;
787
787
  struct BlinnPhongMaterial {
788
788
  vec3 diffuseColor;
789
789
  vec3 specularColor;
@@ -800,7 +800,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom
800
800
  reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
801
801
  }
802
802
  #define RE_Direct RE_Direct_BlinnPhong
803
- #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,FG=`PhysicalMaterial material;
803
+ #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,CO=`PhysicalMaterial material;
804
804
  material.diffuseColor = diffuseColor.rgb;
805
805
  material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
806
806
  material.metalness = metalnessFactor;
@@ -890,7 +890,7 @@ material.roughness = min( material.roughness, 1.0 );
890
890
  material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
891
891
  material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
892
892
  material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
893
- #endif`,NG=`uniform sampler2D dfgLUT;
893
+ #endif`,IO=`uniform sampler2D dfgLUT;
894
894
  struct PhysicalMaterial {
895
895
  vec3 diffuseColor;
896
896
  vec3 diffuseContribution;
@@ -1250,7 +1250,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia
1250
1250
  #define RE_IndirectSpecular RE_IndirectSpecular_Physical
1251
1251
  float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1252
1252
  return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1253
- }`,OG=`
1253
+ }`,zO=`
1254
1254
  vec3 geometryPosition = - vViewPosition;
1255
1255
  vec3 geometryNormal = normal;
1256
1256
  vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
@@ -1372,7 +1372,7 @@ IncidentLight directLight;
1372
1372
  #if defined( RE_IndirectSpecular )
1373
1373
  vec3 radiance = vec3( 0.0 );
1374
1374
  vec3 clearcoatRadiance = vec3( 0.0 );
1375
- #endif`,qG=`#if defined( RE_IndirectDiffuse )
1375
+ #endif`,_O=`#if defined( RE_IndirectDiffuse )
1376
1376
  #ifdef USE_LIGHTMAP
1377
1377
  vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1378
1378
  vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
@@ -1393,7 +1393,7 @@ IncidentLight directLight;
1393
1393
  #ifdef USE_CLEARCOAT
1394
1394
  clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1395
1395
  #endif
1396
- #endif`,RG=`#if defined( RE_IndirectDiffuse )
1396
+ #endif`,wO=`#if defined( RE_IndirectDiffuse )
1397
1397
  #if defined( LAMBERT ) || defined( PHONG )
1398
1398
  irradiance += iblIrradiance;
1399
1399
  #endif
@@ -1401,7 +1401,7 @@ IncidentLight directLight;
1401
1401
  #endif
1402
1402
  #if defined( RE_IndirectSpecular )
1403
1403
  RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1404
- #endif`,LG=`#ifdef USE_LIGHT_PROBES_GRID
1404
+ #endif`,PO=`#ifdef USE_LIGHT_PROBES_GRID
1405
1405
  uniform highp sampler3D probesSH;
1406
1406
  uniform vec3 probesMin;
1407
1407
  uniform vec3 probesMax;
@@ -1446,27 +1446,27 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1446
1446
  result += c8 * 0.429043 * ( x * x - y * y );
1447
1447
  return max( result, vec3( 0.0 ) );
1448
1448
  }
1449
- #endif`,DG=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1449
+ #endif`,TO=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1450
1450
  gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1451
- #endif`,MG=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1451
+ #endif`,AO=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1452
1452
  uniform float logDepthBufFC;
1453
1453
  varying float vFragDepth;
1454
1454
  varying float vIsPerspective;
1455
- #endif`,kG=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1455
+ #endif`,SO=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1456
1456
  varying float vFragDepth;
1457
1457
  varying float vIsPerspective;
1458
- #endif`,BG=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1458
+ #endif`,jO=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1459
1459
  vFragDepth = 1.0 + gl_Position.w;
1460
1460
  vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1461
- #endif`,VG=`#ifdef USE_MAP
1461
+ #endif`,vO=`#ifdef USE_MAP
1462
1462
  vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1463
1463
  #ifdef DECODE_VIDEO_TEXTURE
1464
1464
  sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1465
1465
  #endif
1466
1466
  diffuseColor *= sampledDiffuseColor;
1467
- #endif`,CG=`#ifdef USE_MAP
1467
+ #endif`,yO=`#ifdef USE_MAP
1468
1468
  uniform sampler2D map;
1469
- #endif`,IG=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1469
+ #endif`,xO=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1470
1470
  #if defined( USE_POINTS_UV )
1471
1471
  vec2 uv = vUv;
1472
1472
  #else
@@ -1478,7 +1478,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1478
1478
  #endif
1479
1479
  #ifdef USE_ALPHAMAP
1480
1480
  diffuseColor.a *= texture2D( alphaMap, uv ).g;
1481
- #endif`,zG=`#if defined( USE_POINTS_UV )
1481
+ #endif`,bO=`#if defined( USE_POINTS_UV )
1482
1482
  varying vec2 vUv;
1483
1483
  #else
1484
1484
  #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
@@ -1490,19 +1490,19 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1490
1490
  #endif
1491
1491
  #ifdef USE_ALPHAMAP
1492
1492
  uniform sampler2D alphaMap;
1493
- #endif`,wG=`float metalnessFactor = metalness;
1493
+ #endif`,hO=`float metalnessFactor = metalness;
1494
1494
  #ifdef USE_METALNESSMAP
1495
1495
  vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1496
1496
  metalnessFactor *= texelMetalness.b;
1497
- #endif`,PG=`#ifdef USE_METALNESSMAP
1497
+ #endif`,fO=`#ifdef USE_METALNESSMAP
1498
1498
  uniform sampler2D metalnessMap;
1499
- #endif`,_G=`#ifdef USE_INSTANCING_MORPH
1499
+ #endif`,gO=`#ifdef USE_INSTANCING_MORPH
1500
1500
  float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1501
1501
  float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1502
1502
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1503
1503
  morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1504
1504
  }
1505
- #endif`,TG=`#if defined( USE_MORPHCOLORS )
1505
+ #endif`,pO=`#if defined( USE_MORPHCOLORS )
1506
1506
  vColor *= morphTargetBaseInfluence;
1507
1507
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1508
1508
  #if defined( USE_COLOR_ALPHA )
@@ -1511,12 +1511,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1511
1511
  if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1512
1512
  #endif
1513
1513
  }
1514
- #endif`,AG=`#ifdef USE_MORPHNORMALS
1514
+ #endif`,uO=`#ifdef USE_MORPHNORMALS
1515
1515
  objectNormal *= morphTargetBaseInfluence;
1516
1516
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1517
1517
  if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1518
1518
  }
1519
- #endif`,SG=`#ifdef USE_MORPHTARGETS
1519
+ #endif`,dO=`#ifdef USE_MORPHTARGETS
1520
1520
  #ifndef USE_INSTANCING_MORPH
1521
1521
  uniform float morphTargetBaseInfluence;
1522
1522
  uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
@@ -1530,12 +1530,12 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1530
1530
  ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1531
1531
  return texelFetch( morphTargetsTexture, morphUV, 0 );
1532
1532
  }
1533
- #endif`,jG=`#ifdef USE_MORPHTARGETS
1533
+ #endif`,mO=`#ifdef USE_MORPHTARGETS
1534
1534
  transformed *= morphTargetBaseInfluence;
1535
1535
  for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1536
1536
  if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1537
1537
  }
1538
- #endif`,vG=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1538
+ #endif`,lO=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1539
1539
  #ifdef FLAT_SHADED
1540
1540
  vec3 fdx = dFdx( vViewPosition );
1541
1541
  vec3 fdy = dFdy( vViewPosition );
@@ -1576,7 +1576,7 @@ vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1576
1576
  tbn2[1] *= faceDirection;
1577
1577
  #endif
1578
1578
  #endif
1579
- vec3 nonPerturbedNormal = normal;`,yG=`#ifdef USE_NORMALMAP_OBJECTSPACE
1579
+ vec3 nonPerturbedNormal = normal;`,cO=`#ifdef USE_NORMALMAP_OBJECTSPACE
1580
1580
  normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1581
1581
  #ifdef FLIP_SIDED
1582
1582
  normal = - normal;
@@ -1594,25 +1594,25 @@ vec3 nonPerturbedNormal = normal;`,yG=`#ifdef USE_NORMALMAP_OBJECTSPACE
1594
1594
  normal = normalize( tbn * mapN );
1595
1595
  #elif defined( USE_BUMPMAP )
1596
1596
  normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1597
- #endif`,hG=`#ifndef FLAT_SHADED
1597
+ #endif`,nO=`#ifndef FLAT_SHADED
1598
1598
  varying vec3 vNormal;
1599
1599
  #ifdef USE_TANGENT
1600
1600
  varying vec3 vTangent;
1601
1601
  varying vec3 vBitangent;
1602
1602
  #endif
1603
- #endif`,xG=`#ifndef FLAT_SHADED
1603
+ #endif`,sO=`#ifndef FLAT_SHADED
1604
1604
  varying vec3 vNormal;
1605
1605
  #ifdef USE_TANGENT
1606
1606
  varying vec3 vTangent;
1607
1607
  varying vec3 vBitangent;
1608
1608
  #endif
1609
- #endif`,bG=`#ifndef FLAT_SHADED
1609
+ #endif`,iO=`#ifndef FLAT_SHADED
1610
1610
  vNormal = normalize( transformedNormal );
1611
1611
  #ifdef USE_TANGENT
1612
1612
  vTangent = normalize( transformedTangent );
1613
1613
  vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1614
1614
  #endif
1615
- #endif`,fG=`#ifdef USE_NORMALMAP
1615
+ #endif`,oO=`#ifdef USE_NORMALMAP
1616
1616
  uniform sampler2D normalMap;
1617
1617
  uniform vec2 normalScale;
1618
1618
  #endif
@@ -1634,13 +1634,13 @@ vec3 nonPerturbedNormal = normal;`,yG=`#ifdef USE_NORMALMAP_OBJECTSPACE
1634
1634
  float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1635
1635
  return mat3( T * scale, B * scale, N );
1636
1636
  }
1637
- #endif`,gG=`#ifdef USE_CLEARCOAT
1637
+ #endif`,aO=`#ifdef USE_CLEARCOAT
1638
1638
  vec3 clearcoatNormal = nonPerturbedNormal;
1639
- #endif`,pG=`#ifdef USE_CLEARCOAT_NORMALMAP
1639
+ #endif`,rO=`#ifdef USE_CLEARCOAT_NORMALMAP
1640
1640
  vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1641
1641
  clearcoatMapN.xy *= clearcoatNormalScale;
1642
1642
  clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1643
- #endif`,dG=`#ifdef USE_CLEARCOATMAP
1643
+ #endif`,tO=`#ifdef USE_CLEARCOATMAP
1644
1644
  uniform sampler2D clearcoatMap;
1645
1645
  #endif
1646
1646
  #ifdef USE_CLEARCOAT_NORMALMAP
@@ -1649,18 +1649,18 @@ vec3 nonPerturbedNormal = normal;`,yG=`#ifdef USE_NORMALMAP_OBJECTSPACE
1649
1649
  #endif
1650
1650
  #ifdef USE_CLEARCOAT_ROUGHNESSMAP
1651
1651
  uniform sampler2D clearcoatRoughnessMap;
1652
- #endif`,uG=`#ifdef USE_IRIDESCENCEMAP
1652
+ #endif`,eO=`#ifdef USE_IRIDESCENCEMAP
1653
1653
  uniform sampler2D iridescenceMap;
1654
1654
  #endif
1655
1655
  #ifdef USE_IRIDESCENCE_THICKNESSMAP
1656
1656
  uniform sampler2D iridescenceThicknessMap;
1657
- #endif`,mG=`#ifdef OPAQUE
1657
+ #endif`,Jq=`#ifdef OPAQUE
1658
1658
  diffuseColor.a = 1.0;
1659
1659
  #endif
1660
1660
  #ifdef USE_TRANSMISSION
1661
1661
  diffuseColor.a *= material.transmissionAlpha;
1662
1662
  #endif
1663
- gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,lG=`vec3 packNormalToRGB( const in vec3 normal ) {
1663
+ gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Qq=`vec3 packNormalToRGB( const in vec3 normal ) {
1664
1664
  return normalize( normal ) * 0.5 + 0.5;
1665
1665
  }
1666
1666
  vec3 unpackRGBToNormal( const in vec3 rgb ) {
@@ -1739,9 +1739,9 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
1739
1739
  #else
1740
1740
  return ( near * far ) / ( ( far - near ) * depth - far );
1741
1741
  #endif
1742
- }`,cG=`#ifdef PREMULTIPLIED_ALPHA
1742
+ }`,$q=`#ifdef PREMULTIPLIED_ALPHA
1743
1743
  gl_FragColor.rgb *= gl_FragColor.a;
1744
- #endif`,nG=`vec4 mvPosition = vec4( transformed, 1.0 );
1744
+ #endif`,Zq=`vec4 mvPosition = vec4( transformed, 1.0 );
1745
1745
  #ifdef USE_BATCHING
1746
1746
  mvPosition = batchingMatrix * mvPosition;
1747
1747
  #endif
@@ -1749,22 +1749,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const
1749
1749
  mvPosition = instanceMatrix * mvPosition;
1750
1750
  #endif
1751
1751
  mvPosition = modelViewMatrix * mvPosition;
1752
- gl_Position = projectionMatrix * mvPosition;`,sG=`#ifdef DITHERING
1752
+ gl_Position = projectionMatrix * mvPosition;`,Wq=`#ifdef DITHERING
1753
1753
  gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1754
- #endif`,iG=`#ifdef DITHERING
1754
+ #endif`,Yq=`#ifdef DITHERING
1755
1755
  vec3 dithering( vec3 color ) {
1756
1756
  float grid_position = rand( gl_FragCoord.xy );
1757
1757
  vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1758
1758
  dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1759
1759
  return color + dither_shift_RGB;
1760
1760
  }
1761
- #endif`,oG=`float roughnessFactor = roughness;
1761
+ #endif`,Xq=`float roughnessFactor = roughness;
1762
1762
  #ifdef USE_ROUGHNESSMAP
1763
1763
  vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1764
1764
  roughnessFactor *= texelRoughness.g;
1765
- #endif`,aG=`#ifdef USE_ROUGHNESSMAP
1765
+ #endif`,Kq=`#ifdef USE_ROUGHNESSMAP
1766
1766
  uniform sampler2D roughnessMap;
1767
- #endif`,rG=`#if NUM_SPOT_LIGHT_COORDS > 0
1767
+ #endif`,Hq=`#if NUM_SPOT_LIGHT_COORDS > 0
1768
1768
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1769
1769
  #endif
1770
1770
  #if NUM_SPOT_LIGHT_MAPS > 0
@@ -1964,7 +1964,7 @@ gl_Position = projectionMatrix * mvPosition;`,sG=`#ifdef DITHERING
1964
1964
  }
1965
1965
  #endif
1966
1966
  #endif
1967
- #endif`,tG=`#if NUM_SPOT_LIGHT_COORDS > 0
1967
+ #endif`,Uq=`#if NUM_SPOT_LIGHT_COORDS > 0
1968
1968
  uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1969
1969
  varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1970
1970
  #endif
@@ -2005,7 +2005,7 @@ gl_Position = projectionMatrix * mvPosition;`,sG=`#ifdef DITHERING
2005
2005
  };
2006
2006
  uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2007
2007
  #endif
2008
- #endif`,eG=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2008
+ #endif`,Gq=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2009
2009
  #ifdef HAS_NORMAL
2010
2010
  vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
2011
2011
  #else
@@ -2041,7 +2041,7 @@ gl_Position = projectionMatrix * mvPosition;`,sG=`#ifdef DITHERING
2041
2041
  vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2042
2042
  }
2043
2043
  #pragma unroll_loop_end
2044
- #endif`,J5=`float getShadowMask() {
2044
+ #endif`,Eq=`float getShadowMask() {
2045
2045
  float shadow = 1.0;
2046
2046
  #ifdef USE_SHADOWMAP
2047
2047
  #if NUM_DIR_LIGHT_SHADOWS > 0
@@ -2073,12 +2073,12 @@ gl_Position = projectionMatrix * mvPosition;`,sG=`#ifdef DITHERING
2073
2073
  #endif
2074
2074
  #endif
2075
2075
  return shadow;
2076
- }`,Q5=`#ifdef USE_SKINNING
2076
+ }`,Fq=`#ifdef USE_SKINNING
2077
2077
  mat4 boneMatX = getBoneMatrix( skinIndex.x );
2078
2078
  mat4 boneMatY = getBoneMatrix( skinIndex.y );
2079
2079
  mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2080
2080
  mat4 boneMatW = getBoneMatrix( skinIndex.w );
2081
- #endif`,$5=`#ifdef USE_SKINNING
2081
+ #endif`,Nq=`#ifdef USE_SKINNING
2082
2082
  uniform mat4 bindMatrix;
2083
2083
  uniform mat4 bindMatrixInverse;
2084
2084
  uniform highp sampler2D boneTexture;
@@ -2093,7 +2093,7 @@ gl_Position = projectionMatrix * mvPosition;`,sG=`#ifdef DITHERING
2093
2093
  vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2094
2094
  return mat4( v1, v2, v3, v4 );
2095
2095
  }
2096
- #endif`,Z5=`#ifdef USE_SKINNING
2096
+ #endif`,Oq=`#ifdef USE_SKINNING
2097
2097
  vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2098
2098
  vec4 skinned = vec4( 0.0 );
2099
2099
  skinned += boneMatX * skinVertex * skinWeight.x;
@@ -2101,7 +2101,7 @@ gl_Position = projectionMatrix * mvPosition;`,sG=`#ifdef DITHERING
2101
2101
  skinned += boneMatZ * skinVertex * skinWeight.z;
2102
2102
  skinned += boneMatW * skinVertex * skinWeight.w;
2103
2103
  transformed = ( bindMatrixInverse * skinned ).xyz;
2104
- #endif`,W5=`#ifdef USE_SKINNING
2104
+ #endif`,qq=`#ifdef USE_SKINNING
2105
2105
  mat4 skinMatrix = mat4( 0.0 );
2106
2106
  skinMatrix += skinWeight.x * boneMatX;
2107
2107
  skinMatrix += skinWeight.y * boneMatY;
@@ -2112,17 +2112,17 @@ gl_Position = projectionMatrix * mvPosition;`,sG=`#ifdef DITHERING
2112
2112
  #ifdef USE_TANGENT
2113
2113
  objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2114
2114
  #endif
2115
- #endif`,Y5=`float specularStrength;
2115
+ #endif`,Rq=`float specularStrength;
2116
2116
  #ifdef USE_SPECULARMAP
2117
2117
  vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2118
2118
  specularStrength = texelSpecular.r;
2119
2119
  #else
2120
2120
  specularStrength = 1.0;
2121
- #endif`,X5=`#ifdef USE_SPECULARMAP
2121
+ #endif`,Lq=`#ifdef USE_SPECULARMAP
2122
2122
  uniform sampler2D specularMap;
2123
- #endif`,K5=`#if defined( TONE_MAPPING )
2123
+ #endif`,Dq=`#if defined( TONE_MAPPING )
2124
2124
  gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2125
- #endif`,H5=`#ifndef saturate
2125
+ #endif`,kq=`#ifndef saturate
2126
2126
  #define saturate( a ) clamp( a, 0.0, 1.0 )
2127
2127
  #endif
2128
2128
  uniform float toneMappingExposure;
@@ -2219,7 +2219,7 @@ vec3 NeutralToneMapping( vec3 color ) {
2219
2219
  float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2220
2220
  return mix( color, vec3( newPeak ), g );
2221
2221
  }
2222
- vec3 CustomToneMapping( vec3 color ) { return color; }`,U5=`#ifdef USE_TRANSMISSION
2222
+ vec3 CustomToneMapping( vec3 color ) { return color; }`,Mq=`#ifdef USE_TRANSMISSION
2223
2223
  material.transmission = transmission;
2224
2224
  material.transmissionAlpha = 1.0;
2225
2225
  material.thickness = thickness;
@@ -2240,7 +2240,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,U5=`#ifdef USE_TRANSMISS
2240
2240
  material.attenuationColor, material.attenuationDistance );
2241
2241
  material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2242
2242
  totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2243
- #endif`,G5=`#ifdef USE_TRANSMISSION
2243
+ #endif`,Vq=`#ifdef USE_TRANSMISSION
2244
2244
  uniform float transmission;
2245
2245
  uniform float thickness;
2246
2246
  uniform float attenuationDistance;
@@ -2366,7 +2366,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,U5=`#ifdef USE_TRANSMISS
2366
2366
  float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2367
2367
  return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2368
2368
  }
2369
- #endif`,E5=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2369
+ #endif`,Bq=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2370
2370
  varying vec2 vUv;
2371
2371
  #endif
2372
2372
  #ifdef USE_MAP
@@ -2436,7 +2436,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,U5=`#ifdef USE_TRANSMISS
2436
2436
  #ifdef USE_THICKNESSMAP
2437
2437
  uniform mat3 thicknessMapTransform;
2438
2438
  varying vec2 vThicknessMapUv;
2439
- #endif`,F5=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2439
+ #endif`,Cq=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2440
2440
  varying vec2 vUv;
2441
2441
  #endif
2442
2442
  #ifdef USE_MAP
@@ -2530,7 +2530,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,U5=`#ifdef USE_TRANSMISS
2530
2530
  #ifdef USE_THICKNESSMAP
2531
2531
  uniform mat3 thicknessMapTransform;
2532
2532
  varying vec2 vThicknessMapUv;
2533
- #endif`,N5=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2533
+ #endif`,Iq=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2534
2534
  vUv = vec3( uv, 1 ).xy;
2535
2535
  #endif
2536
2536
  #ifdef USE_MAP
@@ -2601,7 +2601,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,U5=`#ifdef USE_TRANSMISS
2601
2601
  #endif
2602
2602
  #ifdef USE_THICKNESSMAP
2603
2603
  vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2604
- #endif`,O5=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2604
+ #endif`,zq=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2605
2605
  vec4 worldPosition = vec4( transformed, 1.0 );
2606
2606
  #ifdef USE_BATCHING
2607
2607
  worldPosition = batchingMatrix * worldPosition;
@@ -2610,12 +2610,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,U5=`#ifdef USE_TRANSMISS
2610
2610
  worldPosition = instanceMatrix * worldPosition;
2611
2611
  #endif
2612
2612
  worldPosition = modelMatrix * worldPosition;
2613
- #endif`,q5=`varying vec2 vUv;
2613
+ #endif`,_q=`varying vec2 vUv;
2614
2614
  uniform mat3 uvTransform;
2615
2615
  void main() {
2616
2616
  vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2617
2617
  gl_Position = vec4( position.xy, 1.0, 1.0 );
2618
- }`,R5=`uniform sampler2D t2D;
2618
+ }`,wq=`uniform sampler2D t2D;
2619
2619
  uniform float backgroundIntensity;
2620
2620
  varying vec2 vUv;
2621
2621
  void main() {
@@ -2627,14 +2627,14 @@ void main() {
2627
2627
  gl_FragColor = texColor;
2628
2628
  #include <tonemapping_fragment>
2629
2629
  #include <colorspace_fragment>
2630
- }`,L5=`varying vec3 vWorldDirection;
2630
+ }`,Pq=`varying vec3 vWorldDirection;
2631
2631
  #include <common>
2632
2632
  void main() {
2633
2633
  vWorldDirection = transformDirection( position, modelMatrix );
2634
2634
  #include <begin_vertex>
2635
2635
  #include <project_vertex>
2636
2636
  gl_Position.z = gl_Position.w;
2637
- }`,D5=`#ifdef ENVMAP_TYPE_CUBE
2637
+ }`,Tq=`#ifdef ENVMAP_TYPE_CUBE
2638
2638
  uniform samplerCube envMap;
2639
2639
  #elif defined( ENVMAP_TYPE_CUBE_UV )
2640
2640
  uniform sampler2D envMap;
@@ -2656,14 +2656,14 @@ void main() {
2656
2656
  gl_FragColor = texColor;
2657
2657
  #include <tonemapping_fragment>
2658
2658
  #include <colorspace_fragment>
2659
- }`,M5=`varying vec3 vWorldDirection;
2659
+ }`,Aq=`varying vec3 vWorldDirection;
2660
2660
  #include <common>
2661
2661
  void main() {
2662
2662
  vWorldDirection = transformDirection( position, modelMatrix );
2663
2663
  #include <begin_vertex>
2664
2664
  #include <project_vertex>
2665
2665
  gl_Position.z = gl_Position.w;
2666
- }`,k5=`uniform samplerCube tCube;
2666
+ }`,Sq=`uniform samplerCube tCube;
2667
2667
  uniform float tFlip;
2668
2668
  uniform float opacity;
2669
2669
  varying vec3 vWorldDirection;
@@ -2673,7 +2673,7 @@ void main() {
2673
2673
  gl_FragColor.a *= opacity;
2674
2674
  #include <tonemapping_fragment>
2675
2675
  #include <colorspace_fragment>
2676
- }`,B5=`#include <common>
2676
+ }`,jq=`#include <common>
2677
2677
  #include <batching_pars_vertex>
2678
2678
  #include <uv_pars_vertex>
2679
2679
  #include <displacementmap_pars_vertex>
@@ -2700,7 +2700,7 @@ void main() {
2700
2700
  #include <logdepthbuf_vertex>
2701
2701
  #include <clipping_planes_vertex>
2702
2702
  vHighPrecisionZW = gl_Position.zw;
2703
- }`,V5=`#if DEPTH_PACKING == 3200
2703
+ }`,vq=`#if DEPTH_PACKING == 3200
2704
2704
  uniform float opacity;
2705
2705
  #endif
2706
2706
  #include <common>
@@ -2738,7 +2738,7 @@ void main() {
2738
2738
  #elif DEPTH_PACKING == 3203
2739
2739
  gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2740
2740
  #endif
2741
- }`,C5=`#define DISTANCE
2741
+ }`,yq=`#define DISTANCE
2742
2742
  varying vec3 vWorldPosition;
2743
2743
  #include <common>
2744
2744
  #include <batching_pars_vertex>
@@ -2765,7 +2765,7 @@ void main() {
2765
2765
  #include <worldpos_vertex>
2766
2766
  #include <clipping_planes_vertex>
2767
2767
  vWorldPosition = worldPosition.xyz;
2768
- }`,I5=`#define DISTANCE
2768
+ }`,xq=`#define DISTANCE
2769
2769
  uniform vec3 referencePosition;
2770
2770
  uniform float nearDistance;
2771
2771
  uniform float farDistance;
@@ -2788,13 +2788,13 @@ void main () {
2788
2788
  dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2789
2789
  dist = saturate( dist );
2790
2790
  gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
2791
- }`,z5=`varying vec3 vWorldDirection;
2791
+ }`,bq=`varying vec3 vWorldDirection;
2792
2792
  #include <common>
2793
2793
  void main() {
2794
2794
  vWorldDirection = transformDirection( position, modelMatrix );
2795
2795
  #include <begin_vertex>
2796
2796
  #include <project_vertex>
2797
- }`,w5=`uniform sampler2D tEquirect;
2797
+ }`,hq=`uniform sampler2D tEquirect;
2798
2798
  varying vec3 vWorldDirection;
2799
2799
  #include <common>
2800
2800
  void main() {
@@ -2803,7 +2803,7 @@ void main() {
2803
2803
  gl_FragColor = texture2D( tEquirect, sampleUV );
2804
2804
  #include <tonemapping_fragment>
2805
2805
  #include <colorspace_fragment>
2806
- }`,P5=`uniform float scale;
2806
+ }`,fq=`uniform float scale;
2807
2807
  attribute float lineDistance;
2808
2808
  varying float vLineDistance;
2809
2809
  #include <common>
@@ -2825,7 +2825,7 @@ void main() {
2825
2825
  #include <logdepthbuf_vertex>
2826
2826
  #include <clipping_planes_vertex>
2827
2827
  #include <fog_vertex>
2828
- }`,_5=`uniform vec3 diffuse;
2828
+ }`,gq=`uniform vec3 diffuse;
2829
2829
  uniform float opacity;
2830
2830
  uniform float dashSize;
2831
2831
  uniform float totalSize;
@@ -2853,7 +2853,7 @@ void main() {
2853
2853
  #include <colorspace_fragment>
2854
2854
  #include <fog_fragment>
2855
2855
  #include <premultiplied_alpha_fragment>
2856
- }`,T5=`#include <common>
2856
+ }`,pq=`#include <common>
2857
2857
  #include <batching_pars_vertex>
2858
2858
  #include <uv_pars_vertex>
2859
2859
  #include <envmap_pars_vertex>
@@ -2885,7 +2885,7 @@ void main() {
2885
2885
  #include <worldpos_vertex>
2886
2886
  #include <envmap_vertex>
2887
2887
  #include <fog_vertex>
2888
- }`,A5=`uniform vec3 diffuse;
2888
+ }`,uq=`uniform vec3 diffuse;
2889
2889
  uniform float opacity;
2890
2890
  #ifndef FLAT_SHADED
2891
2891
  varying vec3 vNormal;
@@ -2933,7 +2933,7 @@ void main() {
2933
2933
  #include <fog_fragment>
2934
2934
  #include <premultiplied_alpha_fragment>
2935
2935
  #include <dithering_fragment>
2936
- }`,S5=`#define LAMBERT
2936
+ }`,dq=`#define LAMBERT
2937
2937
  varying vec3 vViewPosition;
2938
2938
  #include <common>
2939
2939
  #include <batching_pars_vertex>
@@ -2972,7 +2972,7 @@ void main() {
2972
2972
  #include <envmap_vertex>
2973
2973
  #include <shadowmap_vertex>
2974
2974
  #include <fog_vertex>
2975
- }`,j5=`#define LAMBERT
2975
+ }`,mq=`#define LAMBERT
2976
2976
  uniform vec3 diffuse;
2977
2977
  uniform vec3 emissive;
2978
2978
  uniform float opacity;
@@ -3030,7 +3030,7 @@ void main() {
3030
3030
  #include <fog_fragment>
3031
3031
  #include <premultiplied_alpha_fragment>
3032
3032
  #include <dithering_fragment>
3033
- }`,v5=`#define MATCAP
3033
+ }`,lq=`#define MATCAP
3034
3034
  varying vec3 vViewPosition;
3035
3035
  #include <common>
3036
3036
  #include <batching_pars_vertex>
@@ -3064,7 +3064,7 @@ void main() {
3064
3064
  #include <clipping_planes_vertex>
3065
3065
  #include <fog_vertex>
3066
3066
  vViewPosition = - mvPosition.xyz;
3067
- }`,y5=`#define MATCAP
3067
+ }`,cq=`#define MATCAP
3068
3068
  uniform vec3 diffuse;
3069
3069
  uniform float opacity;
3070
3070
  uniform sampler2D matcap;
@@ -3110,7 +3110,7 @@ void main() {
3110
3110
  #include <fog_fragment>
3111
3111
  #include <premultiplied_alpha_fragment>
3112
3112
  #include <dithering_fragment>
3113
- }`,h5=`#define NORMAL
3113
+ }`,nq=`#define NORMAL
3114
3114
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3115
3115
  varying vec3 vViewPosition;
3116
3116
  #endif
@@ -3143,7 +3143,7 @@ void main() {
3143
3143
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3144
3144
  vViewPosition = - mvPosition.xyz;
3145
3145
  #endif
3146
- }`,x5=`#define NORMAL
3146
+ }`,sq=`#define NORMAL
3147
3147
  uniform float opacity;
3148
3148
  #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3149
3149
  varying vec3 vViewPosition;
@@ -3164,7 +3164,7 @@ void main() {
3164
3164
  #ifdef OPAQUE
3165
3165
  gl_FragColor.a = 1.0;
3166
3166
  #endif
3167
- }`,b5=`#define PHONG
3167
+ }`,iq=`#define PHONG
3168
3168
  varying vec3 vViewPosition;
3169
3169
  #include <common>
3170
3170
  #include <batching_pars_vertex>
@@ -3203,7 +3203,7 @@ void main() {
3203
3203
  #include <envmap_vertex>
3204
3204
  #include <shadowmap_vertex>
3205
3205
  #include <fog_vertex>
3206
- }`,f5=`#define PHONG
3206
+ }`,oq=`#define PHONG
3207
3207
  uniform vec3 diffuse;
3208
3208
  uniform vec3 emissive;
3209
3209
  uniform vec3 specular;
@@ -3263,7 +3263,7 @@ void main() {
3263
3263
  #include <fog_fragment>
3264
3264
  #include <premultiplied_alpha_fragment>
3265
3265
  #include <dithering_fragment>
3266
- }`,g5=`#define STANDARD
3266
+ }`,aq=`#define STANDARD
3267
3267
  varying vec3 vViewPosition;
3268
3268
  #ifdef USE_TRANSMISSION
3269
3269
  varying vec3 vWorldPosition;
@@ -3306,7 +3306,7 @@ void main() {
3306
3306
  #ifdef USE_TRANSMISSION
3307
3307
  vWorldPosition = worldPosition.xyz;
3308
3308
  #endif
3309
- }`,p5=`#define STANDARD
3309
+ }`,rq=`#define STANDARD
3310
3310
  #ifdef PHYSICAL
3311
3311
  #define IOR
3312
3312
  #define USE_SPECULAR
@@ -3431,7 +3431,7 @@ void main() {
3431
3431
  #include <fog_fragment>
3432
3432
  #include <premultiplied_alpha_fragment>
3433
3433
  #include <dithering_fragment>
3434
- }`,d5=`#define TOON
3434
+ }`,tq=`#define TOON
3435
3435
  varying vec3 vViewPosition;
3436
3436
  #include <common>
3437
3437
  #include <batching_pars_vertex>
@@ -3468,7 +3468,7 @@ void main() {
3468
3468
  #include <worldpos_vertex>
3469
3469
  #include <shadowmap_vertex>
3470
3470
  #include <fog_vertex>
3471
- }`,u5=`#define TOON
3471
+ }`,eq=`#define TOON
3472
3472
  uniform vec3 diffuse;
3473
3473
  uniform vec3 emissive;
3474
3474
  uniform float opacity;
@@ -3520,7 +3520,7 @@ void main() {
3520
3520
  #include <fog_fragment>
3521
3521
  #include <premultiplied_alpha_fragment>
3522
3522
  #include <dithering_fragment>
3523
- }`,m5=`uniform float size;
3523
+ }`,JR=`uniform float size;
3524
3524
  uniform float scale;
3525
3525
  #include <common>
3526
3526
  #include <color_pars_vertex>
@@ -3551,7 +3551,7 @@ void main() {
3551
3551
  #include <clipping_planes_vertex>
3552
3552
  #include <worldpos_vertex>
3553
3553
  #include <fog_vertex>
3554
- }`,l5=`uniform vec3 diffuse;
3554
+ }`,QR=`uniform vec3 diffuse;
3555
3555
  uniform float opacity;
3556
3556
  #include <common>
3557
3557
  #include <color_pars_fragment>
@@ -3576,7 +3576,7 @@ void main() {
3576
3576
  #include <colorspace_fragment>
3577
3577
  #include <fog_fragment>
3578
3578
  #include <premultiplied_alpha_fragment>
3579
- }`,c5=`#include <common>
3579
+ }`,$R=`#include <common>
3580
3580
  #include <batching_pars_vertex>
3581
3581
  #include <fog_pars_vertex>
3582
3582
  #include <morphtarget_pars_vertex>
@@ -3599,7 +3599,7 @@ void main() {
3599
3599
  #include <worldpos_vertex>
3600
3600
  #include <shadowmap_vertex>
3601
3601
  #include <fog_vertex>
3602
- }`,n5=`uniform vec3 color;
3602
+ }`,ZR=`uniform vec3 color;
3603
3603
  uniform float opacity;
3604
3604
  #include <common>
3605
3605
  #include <fog_pars_fragment>
@@ -3615,7 +3615,7 @@ void main() {
3615
3615
  #include <colorspace_fragment>
3616
3616
  #include <fog_fragment>
3617
3617
  #include <premultiplied_alpha_fragment>
3618
- }`,s5=`uniform float rotation;
3618
+ }`,WR=`uniform float rotation;
3619
3619
  uniform vec2 center;
3620
3620
  #include <common>
3621
3621
  #include <uv_pars_vertex>
@@ -3639,7 +3639,7 @@ void main() {
3639
3639
  #include <logdepthbuf_vertex>
3640
3640
  #include <clipping_planes_vertex>
3641
3641
  #include <fog_vertex>
3642
- }`,i5=`uniform vec3 diffuse;
3642
+ }`,YR=`uniform vec3 diffuse;
3643
3643
  uniform float opacity;
3644
3644
  #include <common>
3645
3645
  #include <uv_pars_fragment>
@@ -3664,7 +3664,7 @@ void main() {
3664
3664
  #include <tonemapping_fragment>
3665
3665
  #include <colorspace_fragment>
3666
3666
  #include <fog_fragment>
3667
- }`,l0={alphahash_fragment:qU,alphahash_pars_fragment:RU,alphamap_fragment:LU,alphamap_pars_fragment:DU,alphatest_fragment:MU,alphatest_pars_fragment:kU,aomap_fragment:BU,aomap_pars_fragment:VU,batching_pars_vertex:CU,batching_vertex:IU,begin_vertex:zU,beginnormal_vertex:wU,bsdfs:PU,iridescence_fragment:_U,bumpmap_pars_fragment:TU,clipping_planes_fragment:AU,clipping_planes_pars_fragment:SU,clipping_planes_pars_vertex:jU,clipping_planes_vertex:vU,color_fragment:yU,color_pars_fragment:hU,color_pars_vertex:xU,color_vertex:bU,common:fU,cube_uv_reflection_fragment:gU,defaultnormal_vertex:pU,displacementmap_pars_vertex:dU,displacementmap_vertex:uU,emissivemap_fragment:mU,emissivemap_pars_fragment:lU,colorspace_fragment:cU,colorspace_pars_fragment:nU,envmap_fragment:sU,envmap_common_pars_fragment:iU,envmap_pars_fragment:oU,envmap_pars_vertex:aU,envmap_physical_pars_fragment:KG,envmap_vertex:rU,fog_vertex:tU,fog_pars_vertex:eU,fog_fragment:JG,fog_pars_fragment:QG,gradientmap_pars_fragment:$G,lightmap_pars_fragment:ZG,lights_lambert_fragment:WG,lights_lambert_pars_fragment:YG,lights_pars_begin:XG,lights_toon_fragment:HG,lights_toon_pars_fragment:UG,lights_phong_fragment:GG,lights_phong_pars_fragment:EG,lights_physical_fragment:FG,lights_physical_pars_fragment:NG,lights_fragment_begin:OG,lights_fragment_maps:qG,lights_fragment_end:RG,lightprobes_pars_fragment:LG,logdepthbuf_fragment:DG,logdepthbuf_pars_fragment:MG,logdepthbuf_pars_vertex:kG,logdepthbuf_vertex:BG,map_fragment:VG,map_pars_fragment:CG,map_particle_fragment:IG,map_particle_pars_fragment:zG,metalnessmap_fragment:wG,metalnessmap_pars_fragment:PG,morphinstance_vertex:_G,morphcolor_vertex:TG,morphnormal_vertex:AG,morphtarget_pars_vertex:SG,morphtarget_vertex:jG,normal_fragment_begin:vG,normal_fragment_maps:yG,normal_pars_fragment:hG,normal_pars_vertex:xG,normal_vertex:bG,normalmap_pars_fragment:fG,clearcoat_normal_fragment_begin:gG,clearcoat_normal_fragment_maps:pG,clearcoat_pars_fragment:dG,iridescence_pars_fragment:uG,opaque_fragment:mG,packing:lG,premultiplied_alpha_fragment:cG,project_vertex:nG,dithering_fragment:sG,dithering_pars_fragment:iG,roughnessmap_fragment:oG,roughnessmap_pars_fragment:aG,shadowmap_pars_fragment:rG,shadowmap_pars_vertex:tG,shadowmap_vertex:eG,shadowmask_pars_fragment:J5,skinbase_vertex:Q5,skinning_pars_vertex:$5,skinning_vertex:Z5,skinnormal_vertex:W5,specularmap_fragment:Y5,specularmap_pars_fragment:X5,tonemapping_fragment:K5,tonemapping_pars_fragment:H5,transmission_fragment:U5,transmission_pars_fragment:G5,uv_pars_fragment:E5,uv_pars_vertex:F5,uv_vertex:N5,worldpos_vertex:O5,background_vert:q5,background_frag:R5,backgroundCube_vert:L5,backgroundCube_frag:D5,cube_vert:M5,cube_frag:k5,depth_vert:B5,depth_frag:V5,distance_vert:C5,distance_frag:I5,equirect_vert:z5,equirect_frag:w5,linedashed_vert:P5,linedashed_frag:_5,meshbasic_vert:T5,meshbasic_frag:A5,meshlambert_vert:S5,meshlambert_frag:j5,meshmatcap_vert:v5,meshmatcap_frag:y5,meshnormal_vert:h5,meshnormal_frag:x5,meshphong_vert:b5,meshphong_frag:f5,meshphysical_vert:g5,meshphysical_frag:p5,meshtoon_vert:d5,meshtoon_frag:u5,points_vert:m5,points_frag:l5,shadow_vert:c5,shadow_frag:n5,sprite_vert:s5,sprite_frag:i5},U0={common:{diffuse:{value:new R0(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new h0},alphaMap:{value:null},alphaMapTransform:{value:new h0},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new h0}},envmap:{envMap:{value:null},envMapRotation:{value:new h0},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:0.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new h0}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new h0}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new h0},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new h0},normalScale:{value:new p0(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new h0},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new h0}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new h0}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new h0}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:0.00025},fogNear:{value:1},fogFar:{value:2000},fogColor:{value:new R0(16777215)}},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 j},probesMax:{value:new j},probesResolution:{value:new j}},points:{diffuse:{value:new R0(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new h0},alphaTest:{value:0},uvTransform:{value:new h0}},sprite:{diffuse:{value:new R0(16777215)},opacity:{value:1},center:{value:new p0(0.5,0.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new h0},alphaMap:{value:null},alphaMapTransform:{value:new h0},alphaTest:{value:0}}},y9={basic:{uniforms:gJ([U0.common,U0.specularmap,U0.envmap,U0.aomap,U0.lightmap,U0.fog]),vertexShader:l0.meshbasic_vert,fragmentShader:l0.meshbasic_frag},lambert:{uniforms:gJ([U0.common,U0.specularmap,U0.envmap,U0.aomap,U0.lightmap,U0.emissivemap,U0.bumpmap,U0.normalmap,U0.displacementmap,U0.fog,U0.lights,{emissive:{value:new R0(0)},envMapIntensity:{value:1}}]),vertexShader:l0.meshlambert_vert,fragmentShader:l0.meshlambert_frag},phong:{uniforms:gJ([U0.common,U0.specularmap,U0.envmap,U0.aomap,U0.lightmap,U0.emissivemap,U0.bumpmap,U0.normalmap,U0.displacementmap,U0.fog,U0.lights,{emissive:{value:new R0(0)},specular:{value:new R0(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:l0.meshphong_vert,fragmentShader:l0.meshphong_frag},standard:{uniforms:gJ([U0.common,U0.envmap,U0.aomap,U0.lightmap,U0.emissivemap,U0.bumpmap,U0.normalmap,U0.displacementmap,U0.roughnessmap,U0.metalnessmap,U0.fog,U0.lights,{emissive:{value:new R0(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:l0.meshphysical_vert,fragmentShader:l0.meshphysical_frag},toon:{uniforms:gJ([U0.common,U0.aomap,U0.lightmap,U0.emissivemap,U0.bumpmap,U0.normalmap,U0.displacementmap,U0.gradientmap,U0.fog,U0.lights,{emissive:{value:new R0(0)}}]),vertexShader:l0.meshtoon_vert,fragmentShader:l0.meshtoon_frag},matcap:{uniforms:gJ([U0.common,U0.bumpmap,U0.normalmap,U0.displacementmap,U0.fog,{matcap:{value:null}}]),vertexShader:l0.meshmatcap_vert,fragmentShader:l0.meshmatcap_frag},points:{uniforms:gJ([U0.points,U0.fog]),vertexShader:l0.points_vert,fragmentShader:l0.points_frag},dashed:{uniforms:gJ([U0.common,U0.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:l0.linedashed_vert,fragmentShader:l0.linedashed_frag},depth:{uniforms:gJ([U0.common,U0.displacementmap]),vertexShader:l0.depth_vert,fragmentShader:l0.depth_frag},normal:{uniforms:gJ([U0.common,U0.bumpmap,U0.normalmap,U0.displacementmap,{opacity:{value:1}}]),vertexShader:l0.meshnormal_vert,fragmentShader:l0.meshnormal_frag},sprite:{uniforms:gJ([U0.sprite,U0.fog]),vertexShader:l0.sprite_vert,fragmentShader:l0.sprite_frag},background:{uniforms:{uvTransform:{value:new h0},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:l0.background_vert,fragmentShader:l0.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new h0}},vertexShader:l0.backgroundCube_vert,fragmentShader:l0.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:l0.cube_vert,fragmentShader:l0.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:l0.equirect_vert,fragmentShader:l0.equirect_frag},distance:{uniforms:gJ([U0.common,U0.displacementmap,{referencePosition:{value:new j},nearDistance:{value:1},farDistance:{value:1000}}]),vertexShader:l0.distance_vert,fragmentShader:l0.distance_frag},shadow:{uniforms:gJ([U0.lights,U0.fog,{color:{value:new R0(0)},opacity:{value:1}}]),vertexShader:l0.shadow_vert,fragmentShader:l0.shadow_frag}};y9.physical={uniforms:gJ([y9.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new h0},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new h0},clearcoatNormalScale:{value:new p0(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new h0},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new h0},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new h0},sheen:{value:0},sheenColor:{value:new R0(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new h0},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new h0},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new h0},transmissionSamplerSize:{value:new p0},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new h0},attenuationDistance:{value:0},attenuationColor:{value:new R0(0)},specularColor:{value:new R0(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new h0},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new h0},anisotropyVector:{value:new p0},anisotropyMap:{value:null},anisotropyMapTransform:{value:new h0}}]),vertexShader:l0.meshphysical_vert,fragmentShader:l0.meshphysical_frag};var BQ={r:0,b:0,g:0},o5=new S0,SX=new h0;SX.set(-1,0,0,0,1,0,0,0,1);function a5(J,Q,$,Z,W,Y){let X=new R0(0),K=W===!0?0:1,H,U,G=null,F=0,E=null;function O(L){let M=L.isScene===!0?L.background:null;if(M&&M.isTexture){let k=L.backgroundBlurriness>0;M=Q.get(M,k)}return M}function R(L){let M=!1,k=O(L);if(k===null)q(X,K);else if(k&&k.isColor)q(k,1),M=!0;let _=J.xr.getEnvironmentBlendMode();if(_==="additive")$.buffers.color.setClear(0,0,0,1,Y);else if(_==="alpha-blend")$.buffers.color.setClear(0,0,0,0,Y);if(J.autoClear||M)$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),J.clear(J.autoClearColor,J.autoClearDepth,J.autoClearStencil)}function C(L,M){let k=O(M);if(k&&(k.isCubeTexture||k.mapping===p6)){if(U===void 0)U=new GJ(new Y9(1,1,1),new SJ({name:"BackgroundCubeMaterial",uniforms:S8(y9.backgroundCube.uniforms),vertexShader:y9.backgroundCube.vertexShader,fragmentShader:y9.backgroundCube.fragmentShader,side:bJ,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),U.geometry.deleteAttribute("normal"),U.geometry.deleteAttribute("uv"),U.onBeforeRender=function(_,P,V){this.matrixWorld.copyPosition(V.matrixWorld)},Object.defineProperty(U.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),Z.update(U);if(U.material.uniforms.envMap.value=k,U.material.uniforms.backgroundBlurriness.value=M.backgroundBlurriness,U.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,U.material.uniforms.backgroundRotation.value.setFromMatrix4(o5.makeRotationFromEuler(M.backgroundRotation)).transpose(),k.isCubeTexture&&k.isRenderTargetTexture===!1)U.material.uniforms.backgroundRotation.value.premultiply(SX);if(U.material.toneMapped=s0.getTransfer(k.colorSpace)!==UJ,G!==k||F!==k.version||E!==J.toneMapping)U.material.needsUpdate=!0,G=k,F=k.version,E=J.toneMapping;U.layers.enableAll(),L.unshift(U,U.geometry,U.material,0,0,null)}else if(k&&k.isTexture){if(H===void 0)H=new GJ(new M9(2,2),new SJ({name:"BackgroundMaterial",uniforms:S8(y9.background.uniforms),vertexShader:y9.background.vertexShader,fragmentShader:y9.background.fragmentShader,side:z9,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),H.geometry.deleteAttribute("normal"),Object.defineProperty(H.material,"map",{get:function(){return this.uniforms.t2D.value}}),Z.update(H);if(H.material.uniforms.t2D.value=k,H.material.uniforms.backgroundIntensity.value=M.backgroundIntensity,H.material.toneMapped=s0.getTransfer(k.colorSpace)!==UJ,k.matrixAutoUpdate===!0)k.updateMatrix();if(H.material.uniforms.uvTransform.value.copy(k.matrix),G!==k||F!==k.version||E!==J.toneMapping)H.material.needsUpdate=!0,G=k,F=k.version,E=J.toneMapping;H.layers.enableAll(),L.unshift(H,H.geometry,H.material,0,0,null)}}function q(L,M){L.getRGB(BQ,LZ(J)),$.buffers.color.setClear(BQ.r,BQ.g,BQ.b,M,Y)}function N(){if(U!==void 0)U.geometry.dispose(),U.material.dispose(),U=void 0;if(H!==void 0)H.geometry.dispose(),H.material.dispose(),H=void 0}return{getClearColor:function(){return X},setClearColor:function(L,M=1){X.set(L),K=M,q(X,K)},getClearAlpha:function(){return K},setClearAlpha:function(L){K=L,q(X,K)},render:R,addToRenderList:C,dispose:N}}function r5(J,Q){let $=J.getParameter(J.MAX_VERTEX_ATTRIBS),Z={},W=E(null),Y=W,X=!1;function K(z,S,y,v,h){let g=!1,p=F(z,v,y,S);if(Y!==p)Y=p,U(Y.object);if(g=O(z,v,y,h),g)R(z,v,y,h);if(h!==null)Q.update(h,J.ELEMENT_ARRAY_BUFFER);if(g||X){if(X=!1,k(z,S,y,v),h!==null)J.bindBuffer(J.ELEMENT_ARRAY_BUFFER,Q.get(h).buffer)}}function H(){return J.createVertexArray()}function U(z){return J.bindVertexArray(z)}function G(z){return J.deleteVertexArray(z)}function F(z,S,y,v){let h=v.wireframe===!0,g=Z[S.id];if(g===void 0)g={},Z[S.id]=g;let p=z.isInstancedMesh===!0?z.id:0,c=g[p];if(c===void 0)c={},g[p]=c;let a=c[y.id];if(a===void 0)a={},c[y.id]=a;let Q0=a[h];if(Q0===void 0)Q0=E(H()),a[h]=Q0;return Q0}function E(z){let S=[],y=[],v=[];for(let h=0;h<$;h++)S[h]=0,y[h]=0,v[h]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:S,enabledAttributes:y,attributeDivisors:v,object:z,attributes:{},index:null}}function O(z,S,y,v){let h=Y.attributes,g=S.attributes,p=0,c=y.getAttributes();for(let a in c)if(c[a].location>=0){let H0=h[a],J0=g[a];if(J0===void 0){if(a==="instanceMatrix"&&z.instanceMatrix)J0=z.instanceMatrix;if(a==="instanceColor"&&z.instanceColor)J0=z.instanceColor}if(H0===void 0)return!0;if(H0.attribute!==J0)return!0;if(J0&&H0.data!==J0.data)return!0;p++}if(Y.attributesNum!==p)return!0;if(Y.index!==v)return!0;return!1}function R(z,S,y,v){let h={},g=S.attributes,p=0,c=y.getAttributes();for(let a in c)if(c[a].location>=0){let H0=g[a];if(H0===void 0){if(a==="instanceMatrix"&&z.instanceMatrix)H0=z.instanceMatrix;if(a==="instanceColor"&&z.instanceColor)H0=z.instanceColor}let J0={};if(J0.attribute=H0,H0&&H0.data)J0.data=H0.data;h[a]=J0,p++}Y.attributes=h,Y.attributesNum=p,Y.index=v}function C(){let z=Y.newAttributes;for(let S=0,y=z.length;S<y;S++)z[S]=0}function q(z){N(z,0)}function N(z,S){let{newAttributes:y,enabledAttributes:v,attributeDivisors:h}=Y;if(y[z]=1,v[z]===0)J.enableVertexAttribArray(z),v[z]=1;if(h[z]!==S)J.vertexAttribDivisor(z,S),h[z]=S}function L(){let{newAttributes:z,enabledAttributes:S}=Y;for(let y=0,v=S.length;y<v;y++)if(S[y]!==z[y])J.disableVertexAttribArray(y),S[y]=0}function M(z,S,y,v,h,g,p){if(p===!0)J.vertexAttribIPointer(z,S,y,h,g);else J.vertexAttribPointer(z,S,y,v,h,g)}function k(z,S,y,v){C();let h=v.attributes,g=y.getAttributes(),p=S.defaultAttributeValues;for(let c in g){let a=g[c];if(a.location>=0){let Q0=h[c];if(Q0===void 0){if(c==="instanceMatrix"&&z.instanceMatrix)Q0=z.instanceMatrix;if(c==="instanceColor"&&z.instanceColor)Q0=z.instanceColor}if(Q0!==void 0){let{normalized:H0,itemSize:J0}=Q0,x0=Q.get(Q0);if(x0===void 0)continue;let{buffer:v0,type:s,bytesPerElement:Y0}=x0,D0=s===J.INT||s===J.UNSIGNED_INT||Q0.gpuType===V$;if(Q0.isInterleavedBufferAttribute){let G0=Q0.data,w0=G0.stride,i0=Q0.offset;if(G0.isInstancedInterleavedBuffer){for(let j0=0;j0<a.locationSize;j0++)N(a.location+j0,G0.meshPerAttribute);if(z.isInstancedMesh!==!0&&v._maxInstanceCount===void 0)v._maxInstanceCount=G0.meshPerAttribute*G0.count}else for(let j0=0;j0<a.locationSize;j0++)q(a.location+j0);J.bindBuffer(J.ARRAY_BUFFER,v0);for(let j0=0;j0<a.locationSize;j0++)M(a.location+j0,J0/a.locationSize,s,H0,w0*Y0,(i0+J0/a.locationSize*j0)*Y0,D0)}else{if(Q0.isInstancedBufferAttribute){for(let G0=0;G0<a.locationSize;G0++)N(a.location+G0,Q0.meshPerAttribute);if(z.isInstancedMesh!==!0&&v._maxInstanceCount===void 0)v._maxInstanceCount=Q0.meshPerAttribute*Q0.count}else for(let G0=0;G0<a.locationSize;G0++)q(a.location+G0);J.bindBuffer(J.ARRAY_BUFFER,v0);for(let G0=0;G0<a.locationSize;G0++)M(a.location+G0,J0/a.locationSize,s,H0,J0*Y0,J0/a.locationSize*G0*Y0,D0)}}else if(p!==void 0){let H0=p[c];if(H0!==void 0)switch(H0.length){case 2:J.vertexAttrib2fv(a.location,H0);break;case 3:J.vertexAttrib3fv(a.location,H0);break;case 4:J.vertexAttrib4fv(a.location,H0);break;default:J.vertexAttrib1fv(a.location,H0)}}}}L()}function _(){B();for(let z in Z){let S=Z[z];for(let y in S){let v=S[y];for(let h in v){let g=v[h];for(let p in g)G(g[p].object),delete g[p];delete v[h]}}delete Z[z]}}function P(z){if(Z[z.id]===void 0)return;let S=Z[z.id];for(let y in S){let v=S[y];for(let h in v){let g=v[h];for(let p in g)G(g[p].object),delete g[p];delete v[h]}}delete Z[z.id]}function V(z){for(let S in Z){let y=Z[S];for(let v in y){let h=y[v];if(h[z.id]===void 0)continue;let g=h[z.id];for(let p in g)G(g[p].object),delete g[p];delete h[z.id]}}}function D(z){for(let S in Z){let y=Z[S],v=z.isInstancedMesh===!0?z.id:0,h=y[v];if(h===void 0)continue;for(let g in h){let p=h[g];for(let c in p)G(p[c].object),delete p[c];delete h[g]}if(delete y[v],Object.keys(y).length===0)delete Z[S]}}function B(){if(A(),X=!0,Y===W)return;Y=W,U(Y.object)}function A(){W.geometry=null,W.program=null,W.wireframe=!1}return{setup:K,reset:B,resetDefaultState:A,dispose:_,releaseStatesOfGeometry:P,releaseStatesOfObject:D,releaseStatesOfProgram:V,initAttributes:C,enableAttribute:q,disableUnusedAttributes:L}}function t5(J,Q,$){let Z;function W(H){Z=H}function Y(H,U){J.drawArrays(Z,H,U),$.update(U,Z,1)}function X(H,U,G){if(G===0)return;J.drawArraysInstanced(Z,H,U,G),$.update(U,Z,G)}function K(H,U,G){if(G===0)return;Q.get("WEBGL_multi_draw").multiDrawArraysWEBGL(Z,H,0,U,0,G);let E=0;for(let O=0;O<G;O++)E+=U[O];$.update(E,Z,1)}this.setMode=W,this.render=Y,this.renderInstances=X,this.renderMultiDraw=K}function e5(J,Q,$,Z){let W;function Y(){if(W!==void 0)return W;if(Q.has("EXT_texture_filter_anisotropic")===!0){let V=Q.get("EXT_texture_filter_anisotropic");W=J.getParameter(V.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else W=0;return W}function X(V){if(V!==_9&&Z.convert(V)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_FORMAT))return!1;return!0}function K(V){let D=V===fJ&&(Q.has("EXT_color_buffer_half_float")||Q.has("EXT_color_buffer_float"));if(V!==D9&&Z.convert(V)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_TYPE)&&V!==tJ&&!D)return!1;return!0}function H(V){if(V==="highp"){if(J.getShaderPrecisionFormat(J.VERTEX_SHADER,J.HIGH_FLOAT).precision>0&&J.getShaderPrecisionFormat(J.FRAGMENT_SHADER,J.HIGH_FLOAT).precision>0)return"highp";V="mediump"}if(V==="mediump"){if(J.getShaderPrecisionFormat(J.VERTEX_SHADER,J.MEDIUM_FLOAT).precision>0&&J.getShaderPrecisionFormat(J.FRAGMENT_SHADER,J.MEDIUM_FLOAT).precision>0)return"mediump"}return"lowp"}let U=$.precision!==void 0?$.precision:"highp",G=H(U);if(G!==U)C0("WebGLRenderer:",U,"not supported, using",G,"instead."),U=G;let F=$.logarithmicDepthBuffer===!0,E=$.reversedDepthBuffer===!0&&Q.has("EXT_clip_control");if($.reversedDepthBuffer===!0&&E===!1)C0("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let O=J.getParameter(J.MAX_TEXTURE_IMAGE_UNITS),R=J.getParameter(J.MAX_VERTEX_TEXTURE_IMAGE_UNITS),C=J.getParameter(J.MAX_TEXTURE_SIZE),q=J.getParameter(J.MAX_CUBE_MAP_TEXTURE_SIZE),N=J.getParameter(J.MAX_VERTEX_ATTRIBS),L=J.getParameter(J.MAX_VERTEX_UNIFORM_VECTORS),M=J.getParameter(J.MAX_VARYING_VECTORS),k=J.getParameter(J.MAX_FRAGMENT_UNIFORM_VECTORS),_=J.getParameter(J.MAX_SAMPLES),P=J.getParameter(J.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:Y,getMaxPrecision:H,textureFormatReadable:X,textureTypeReadable:K,precision:U,logarithmicDepthBuffer:F,reversedDepthBuffer:E,maxTextures:O,maxVertexTextures:R,maxTextureSize:C,maxCubemapSize:q,maxAttributes:N,maxVertexUniforms:L,maxVaryings:M,maxFragmentUniforms:k,maxSamples:_,samples:P}}function JE(J){let Q=this,$=null,Z=0,W=!1,Y=!1,X=new O9,K=new h0,H={value:null,needsUpdate:!1};this.uniform=H,this.numPlanes=0,this.numIntersection=0,this.init=function(F,E){let O=F.length!==0||E||Z!==0||W;return W=E,Z=F.length,O},this.beginShadows=function(){Y=!0,G(null)},this.endShadows=function(){Y=!1},this.setGlobalState=function(F,E){$=G(F,E,0)},this.setState=function(F,E,O){let{clippingPlanes:R,clipIntersection:C,clipShadows:q}=F,N=J.get(F);if(!W||R===null||R.length===0||Y&&!q)if(Y)G(null);else U();else{let L=Y?0:Z,M=L*4,k=N.clippingState||null;H.value=k,k=G(R,E,M,O);for(let _=0;_!==M;++_)k[_]=$[_];N.clippingState=k,this.numIntersection=C?this.numPlanes:0,this.numPlanes+=L}};function U(){if(H.value!==$)H.value=$,H.needsUpdate=Z>0;Q.numPlanes=Z,Q.numIntersection=0}function G(F,E,O,R){let C=F!==null?F.length:0,q=null;if(C!==0){if(q=H.value,R!==!0||q===null){let N=O+C*4,L=E.matrixWorldInverse;if(K.getNormalMatrix(L),q===null||q.length<N)q=new Float32Array(N);for(let M=0,k=O;M!==C;++M,k+=4)X.copy(F[M]).applyMatrix4(L,K),X.normal.toArray(q,k),q[k+3]=X.constant}H.value=q,H.needsUpdate=!0}return Q.numPlanes=C,Q.numIntersection=0,q}}var N8=4,HX=[0.125,0.215,0.35,0.446,0.526,0.582],y8=20,QE=256,Q7=new v8,UX=new R0,hZ=null,xZ=0,bZ=0,fZ=!1,$E=new j;class Y7{constructor(J){this._renderer=J,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(J,Q=0,$=0.1,Z=100,W={}){let{size:Y=256,position:X=$E}=W;hZ=this._renderer.getRenderTarget(),xZ=this._renderer.getActiveCubeFace(),bZ=this._renderer.getActiveMipmapLevel(),fZ=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(Y);let K=this._allocateTargets();if(K.depthBuffer=!0,this._sceneToCubeUV(J,$,Z,K,X),Q>0)this._blur(K,0,0,Q);return this._applyPMREM(K),this._cleanup(K),K}fromEquirectangular(J,Q=null){return this._fromTexture(J,Q)}fromCubemap(J,Q=null){return this._fromTexture(J,Q)}compileCubemapShader(){if(this._cubemapMaterial===null)this._cubemapMaterial=FX(),this._compileMaterial(this._cubemapMaterial)}compileEquirectangularShader(){if(this._equirectMaterial===null)this._equirectMaterial=EX(),this._compileMaterial(this._equirectMaterial)}dispose(){if(this._dispose(),this._cubemapMaterial!==null)this._cubemapMaterial.dispose();if(this._equirectMaterial!==null)this._equirectMaterial.dispose();if(this._backgroundBox!==null)this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose()}_setSize(J){this._lodMax=Math.floor(Math.log2(J)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){if(this._blurMaterial!==null)this._blurMaterial.dispose();if(this._ggxMaterial!==null)this._ggxMaterial.dispose();if(this._pingPongRenderTarget!==null)this._pingPongRenderTarget.dispose();for(let J=0;J<this._lodMeshes.length;J++)this._lodMeshes[J].geometry.dispose()}_cleanup(J){this._renderer.setRenderTarget(hZ,xZ,bZ),this._renderer.xr.enabled=fZ,J.scissorTest=!1,B6(J,0,0,J.width,J.height)}_fromTexture(J,Q){if(J.mapping===Y6||J.mapping===C8)this._setSize(J.image.length===0?16:J.image[0].width||J.image[0].image.width);else this._setSize(J.image.width/4);hZ=this._renderer.getRenderTarget(),xZ=this._renderer.getActiveCubeFace(),bZ=this._renderer.getActiveMipmapLevel(),fZ=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let $=Q||this._allocateTargets();return this._textureToCubeUV(J,$),this._applyPMREM($),this._cleanup($),$}_allocateTargets(){let J=3*Math.max(this._cubeSize,112),Q=4*this._cubeSize,$={magFilter:BJ,minFilter:BJ,generateMipmaps:!1,type:fJ,format:_9,colorSpace:uJ,depthBuffer:!1},Z=GX(J,Q,$);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==J||this._pingPongRenderTarget.height!==Q){if(this._pingPongRenderTarget!==null)this._dispose();this._pingPongRenderTarget=GX(J,Q,$);let{_lodMax:W}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=ZE(W)),this._blurMaterial=YE(W,J,Q),this._ggxMaterial=WE(W,J,Q)}return Z}_compileMaterial(J){let Q=new GJ(new RJ,J);this._renderer.compile(Q,Q7)}_sceneToCubeUV(J,Q,$,Z,W){let K=new kJ(90,1,Q,$),H=[1,-1,1,1,1,1],U=[1,1,1,-1,-1,-1],G=this._renderer,F=G.autoClear,E=G.toneMapping;if(G.getClearColor(UX),G.toneMapping=rJ,G.autoClear=!1,G.state.buffers.depth.getReversed())G.setRenderTarget(Z),G.clearDepth(),G.setRenderTarget(null);if(this._backgroundBox===null)this._backgroundBox=new GJ(new Y9,new A9({name:"PMREM.Background",side:bJ,depthWrite:!1,depthTest:!1}));let R=this._backgroundBox,C=R.material,q=!1,N=J.background;if(N){if(N.isColor)C.color.copy(N),J.background=null,q=!0}else C.color.copy(UX),q=!0;for(let L=0;L<6;L++){let M=L%3;if(M===0)K.up.set(0,H[L],0),K.position.set(W.x,W.y,W.z),K.lookAt(W.x+U[L],W.y,W.z);else if(M===1)K.up.set(0,0,H[L]),K.position.set(W.x,W.y,W.z),K.lookAt(W.x,W.y+U[L],W.z);else K.up.set(0,H[L],0),K.position.set(W.x,W.y,W.z),K.lookAt(W.x,W.y,W.z+U[L]);let k=this._cubeSize;if(B6(Z,M*k,L>2?k:0,k,k),G.setRenderTarget(Z),q)G.render(R,K);G.render(J,K)}G.toneMapping=E,G.autoClear=F,J.background=N}_textureToCubeUV(J,Q){let $=this._renderer,Z=J.mapping===Y6||J.mapping===C8;if(Z){if(this._cubemapMaterial===null)this._cubemapMaterial=FX();this._cubemapMaterial.uniforms.flipEnvMap.value=J.isRenderTargetTexture===!1?-1:1}else if(this._equirectMaterial===null)this._equirectMaterial=EX();let W=Z?this._cubemapMaterial:this._equirectMaterial,Y=this._lodMeshes[0];Y.material=W;let X=W.uniforms;X.envMap.value=J;let K=this._cubeSize;B6(Q,0,0,3*K,2*K),$.setRenderTarget(Q),$.render(Y,Q7)}_applyPMREM(J){let Q=this._renderer,$=Q.autoClear;Q.autoClear=!1;let Z=this._lodMeshes.length;for(let W=1;W<Z;W++)this._applyGGXFilter(J,W-1,W);Q.autoClear=$}_applyGGXFilter(J,Q,$){let Z=this._renderer,W=this._pingPongRenderTarget,Y=this._ggxMaterial,X=this._lodMeshes[$];X.material=Y;let K=Y.uniforms,H=$/(this._lodMeshes.length-1),U=Q/(this._lodMeshes.length-1),G=Math.sqrt(H*H-U*U),F=0+H*1.25,E=G*F,{_lodMax:O}=this,R=this._sizeLods[$],C=3*R*($>O-N8?$-O+N8:0),q=4*(this._cubeSize-R);K.envMap.value=J.texture,K.roughness.value=E,K.mipInt.value=O-Q,B6(W,C,q,3*R,2*R),Z.setRenderTarget(W),Z.render(X,Q7),K.envMap.value=W.texture,K.roughness.value=0,K.mipInt.value=O-$,B6(J,C,q,3*R,2*R),Z.setRenderTarget(J),Z.render(X,Q7)}_blur(J,Q,$,Z,W){let Y=this._pingPongRenderTarget;this._halfBlur(J,Y,Q,$,Z,"latitudinal",W),this._halfBlur(Y,J,$,$,Z,"longitudinal",W)}_halfBlur(J,Q,$,Z,W,Y,X){let K=this._renderer,H=this._blurMaterial;if(Y!=="latitudinal"&&Y!=="longitudinal")A0("blur direction must be either latitudinal or longitudinal!");let U=3,G=this._lodMeshes[Z];G.material=H;let F=H.uniforms,E=this._sizeLods[$]-1,O=isFinite(W)?Math.PI/(2*E):2*Math.PI/(2*y8-1),R=W/O,C=isFinite(W)?1+Math.floor(U*R):y8;if(C>y8)C0(`sigmaRadians, ${W}, is too large and will clip, as it requested ${C} samples when the maximum is set to ${y8}`);let q=[],N=0;for(let P=0;P<y8;++P){let V=P/R,D=Math.exp(-V*V/2);if(q.push(D),P===0)N+=D;else if(P<C)N+=2*D}for(let P=0;P<q.length;P++)q[P]=q[P]/N;if(F.envMap.value=J.texture,F.samples.value=C,F.weights.value=q,F.latitudinal.value=Y==="latitudinal",X)F.poleAxis.value=X;let{_lodMax:L}=this;F.dTheta.value=O,F.mipInt.value=L-$;let M=this._sizeLods[Z],k=3*M*(Z>L-N8?Z-L+N8:0),_=4*(this._cubeSize-M);B6(Q,k,_,3*M,2*M),K.setRenderTarget(Q),K.render(G,Q7)}}function ZE(J){let Q=[],$=[],Z=[],W=J,Y=J-N8+1+HX.length;for(let X=0;X<Y;X++){let K=Math.pow(2,W);Q.push(K);let H=1/K;if(X>J-N8)H=HX[X-J+N8-1];else if(X===0)H=0;$.push(H);let U=1/(K-2),G=-U,F=1+U,E=[G,G,F,G,F,F,G,G,F,F,G,F],O=6,R=6,C=3,q=2,N=1,L=new Float32Array(C*R*O),M=new Float32Array(q*R*O),k=new Float32Array(N*R*O);for(let P=0;P<O;P++){let V=P%3*2/3-1,D=P>2?0:-1,B=[V,D,0,V+0.6666666666666666,D,0,V+0.6666666666666666,D+1,0,V,D,0,V+0.6666666666666666,D+1,0,V,D+1,0];L.set(B,C*R*P),M.set(E,q*R*P);let A=[P,P,P,P,P,P];k.set(A,N*R*P)}let _=new RJ;if(_.setAttribute("position",new JJ(L,C)),_.setAttribute("uv",new JJ(M,q)),_.setAttribute("faceIndex",new JJ(k,N)),Z.push(new GJ(_,null)),W>N8)W--}return{lodMeshes:Z,sizeLods:Q,sigmas:$}}function GX(J,Q,$){let Z=new nJ(J,Q,$);return Z.texture.mapping=p6,Z.texture.name="PMREM.cubeUv",Z.scissorTest=!0,Z}function B6(J,Q,$,Z,W){J.viewport.set(Q,$,Z,W),J.scissor.set(Q,$,Z,W)}function WE(J,Q,$){return new SJ({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:QE,CUBEUV_TEXEL_WIDTH:1/Q,CUBEUV_TEXEL_HEIGHT:1/$,CUBEUV_MAX_MIP:`${J}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:CQ(),fragmentShader:`
3667
+ }`,ZJ={alphahash_fragment:_N,alphahash_pars_fragment:wN,alphamap_fragment:PN,alphamap_pars_fragment:TN,alphatest_fragment:AN,alphatest_pars_fragment:SN,aomap_fragment:jN,aomap_pars_fragment:vN,batching_pars_vertex:yN,batching_vertex:xN,begin_vertex:bN,beginnormal_vertex:hN,bsdfs:fN,iridescence_fragment:gN,bumpmap_pars_fragment:pN,clipping_planes_fragment:uN,clipping_planes_pars_fragment:dN,clipping_planes_pars_vertex:mN,clipping_planes_vertex:lN,color_fragment:cN,color_pars_fragment:nN,color_pars_vertex:sN,color_vertex:iN,common:oN,cube_uv_reflection_fragment:aN,defaultnormal_vertex:rN,displacementmap_pars_vertex:tN,displacementmap_vertex:eN,emissivemap_fragment:JO,emissivemap_pars_fragment:QO,colorspace_fragment:$O,colorspace_pars_fragment:ZO,envmap_fragment:WO,envmap_common_pars_fragment:YO,envmap_pars_fragment:XO,envmap_pars_vertex:KO,envmap_physical_pars_fragment:DO,envmap_vertex:HO,fog_vertex:UO,fog_pars_vertex:GO,fog_fragment:EO,fog_pars_fragment:FO,gradientmap_pars_fragment:NO,lightmap_pars_fragment:OO,lights_lambert_fragment:qO,lights_lambert_pars_fragment:RO,lights_pars_begin:LO,lights_toon_fragment:kO,lights_toon_pars_fragment:MO,lights_phong_fragment:VO,lights_phong_pars_fragment:BO,lights_physical_fragment:CO,lights_physical_pars_fragment:IO,lights_fragment_begin:zO,lights_fragment_maps:_O,lights_fragment_end:wO,lightprobes_pars_fragment:PO,logdepthbuf_fragment:TO,logdepthbuf_pars_fragment:AO,logdepthbuf_pars_vertex:SO,logdepthbuf_vertex:jO,map_fragment:vO,map_pars_fragment:yO,map_particle_fragment:xO,map_particle_pars_fragment:bO,metalnessmap_fragment:hO,metalnessmap_pars_fragment:fO,morphinstance_vertex:gO,morphcolor_vertex:pO,morphnormal_vertex:uO,morphtarget_pars_vertex:dO,morphtarget_vertex:mO,normal_fragment_begin:lO,normal_fragment_maps:cO,normal_pars_fragment:nO,normal_pars_vertex:sO,normal_vertex:iO,normalmap_pars_fragment:oO,clearcoat_normal_fragment_begin:aO,clearcoat_normal_fragment_maps:rO,clearcoat_pars_fragment:tO,iridescence_pars_fragment:eO,opaque_fragment:Jq,packing:Qq,premultiplied_alpha_fragment:$q,project_vertex:Zq,dithering_fragment:Wq,dithering_pars_fragment:Yq,roughnessmap_fragment:Xq,roughnessmap_pars_fragment:Kq,shadowmap_pars_fragment:Hq,shadowmap_pars_vertex:Uq,shadowmap_vertex:Gq,shadowmask_pars_fragment:Eq,skinbase_vertex:Fq,skinning_pars_vertex:Nq,skinning_vertex:Oq,skinnormal_vertex:qq,specularmap_fragment:Rq,specularmap_pars_fragment:Lq,tonemapping_fragment:Dq,tonemapping_pars_fragment:kq,transmission_fragment:Mq,transmission_pars_fragment:Vq,uv_pars_fragment:Bq,uv_pars_vertex:Cq,uv_vertex:Iq,worldpos_vertex:zq,background_vert:_q,background_frag:wq,backgroundCube_vert:Pq,backgroundCube_frag:Tq,cube_vert:Aq,cube_frag:Sq,depth_vert:jq,depth_frag:vq,distance_vert:yq,distance_frag:xq,equirect_vert:bq,equirect_frag:hq,linedashed_vert:fq,linedashed_frag:gq,meshbasic_vert:pq,meshbasic_frag:uq,meshlambert_vert:dq,meshlambert_frag:mq,meshmatcap_vert:lq,meshmatcap_frag:cq,meshnormal_vert:nq,meshnormal_frag:sq,meshphong_vert:iq,meshphong_frag:oq,meshphysical_vert:aq,meshphysical_frag:rq,meshtoon_vert:tq,meshtoon_frag:eq,points_vert:JR,points_frag:QR,shadow_vert:$R,shadow_frag:ZR,sprite_vert:WR,sprite_frag:YR},L0={common:{diffuse:{value:new e(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new o0},alphaMap:{value:null},alphaMapTransform:{value:new o0},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new o0}},envmap:{envMap:{value:null},envMapRotation:{value:new o0},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:0.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new o0}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new o0}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new o0},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new o0},normalScale:{value:new i(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new o0},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new o0}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new o0}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new o0}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:0.00025},fogNear:{value:1},fogFar:{value:2000},fogColor:{value:new e(16777215)}},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 T},probesMax:{value:new T},probesResolution:{value:new T}},points:{diffuse:{value:new e(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new o0},alphaTest:{value:0},uvTransform:{value:new o0}},sprite:{diffuse:{value:new e(16777215)},opacity:{value:1},center:{value:new i(0.5,0.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new o0},alphaMap:{value:null},alphaMapTransform:{value:new o0},alphaTest:{value:0}}},r9={basic:{uniforms:Q9([L0.common,L0.specularmap,L0.envmap,L0.aomap,L0.lightmap,L0.fog]),vertexShader:ZJ.meshbasic_vert,fragmentShader:ZJ.meshbasic_frag},lambert:{uniforms:Q9([L0.common,L0.specularmap,L0.envmap,L0.aomap,L0.lightmap,L0.emissivemap,L0.bumpmap,L0.normalmap,L0.displacementmap,L0.fog,L0.lights,{emissive:{value:new e(0)},envMapIntensity:{value:1}}]),vertexShader:ZJ.meshlambert_vert,fragmentShader:ZJ.meshlambert_frag},phong:{uniforms:Q9([L0.common,L0.specularmap,L0.envmap,L0.aomap,L0.lightmap,L0.emissivemap,L0.bumpmap,L0.normalmap,L0.displacementmap,L0.fog,L0.lights,{emissive:{value:new e(0)},specular:{value:new e(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:ZJ.meshphong_vert,fragmentShader:ZJ.meshphong_frag},standard:{uniforms:Q9([L0.common,L0.envmap,L0.aomap,L0.lightmap,L0.emissivemap,L0.bumpmap,L0.normalmap,L0.displacementmap,L0.roughnessmap,L0.metalnessmap,L0.fog,L0.lights,{emissive:{value:new e(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ZJ.meshphysical_vert,fragmentShader:ZJ.meshphysical_frag},toon:{uniforms:Q9([L0.common,L0.aomap,L0.lightmap,L0.emissivemap,L0.bumpmap,L0.normalmap,L0.displacementmap,L0.gradientmap,L0.fog,L0.lights,{emissive:{value:new e(0)}}]),vertexShader:ZJ.meshtoon_vert,fragmentShader:ZJ.meshtoon_frag},matcap:{uniforms:Q9([L0.common,L0.bumpmap,L0.normalmap,L0.displacementmap,L0.fog,{matcap:{value:null}}]),vertexShader:ZJ.meshmatcap_vert,fragmentShader:ZJ.meshmatcap_frag},points:{uniforms:Q9([L0.points,L0.fog]),vertexShader:ZJ.points_vert,fragmentShader:ZJ.points_frag},dashed:{uniforms:Q9([L0.common,L0.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ZJ.linedashed_vert,fragmentShader:ZJ.linedashed_frag},depth:{uniforms:Q9([L0.common,L0.displacementmap]),vertexShader:ZJ.depth_vert,fragmentShader:ZJ.depth_frag},normal:{uniforms:Q9([L0.common,L0.bumpmap,L0.normalmap,L0.displacementmap,{opacity:{value:1}}]),vertexShader:ZJ.meshnormal_vert,fragmentShader:ZJ.meshnormal_frag},sprite:{uniforms:Q9([L0.sprite,L0.fog]),vertexShader:ZJ.sprite_vert,fragmentShader:ZJ.sprite_frag},background:{uniforms:{uvTransform:{value:new o0},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ZJ.background_vert,fragmentShader:ZJ.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new o0}},vertexShader:ZJ.backgroundCube_vert,fragmentShader:ZJ.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ZJ.cube_vert,fragmentShader:ZJ.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ZJ.equirect_vert,fragmentShader:ZJ.equirect_frag},distance:{uniforms:Q9([L0.common,L0.displacementmap,{referencePosition:{value:new T},nearDistance:{value:1},farDistance:{value:1000}}]),vertexShader:ZJ.distance_vert,fragmentShader:ZJ.distance_frag},shadow:{uniforms:Q9([L0.lights,L0.fog,{color:{value:new e(0)},opacity:{value:1}}]),vertexShader:ZJ.shadow_vert,fragmentShader:ZJ.shadow_frag}};r9.physical={uniforms:Q9([r9.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new o0},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new o0},clearcoatNormalScale:{value:new i(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new o0},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new o0},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new o0},sheen:{value:0},sheenColor:{value:new e(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new o0},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new o0},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new o0},transmissionSamplerSize:{value:new i},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new o0},attenuationDistance:{value:0},attenuationColor:{value:new e(0)},specularColor:{value:new e(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new o0},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new o0},anisotropyVector:{value:new i},anisotropyMap:{value:null},anisotropyMapTransform:{value:new o0}}]),vertexShader:ZJ.meshphysical_vert,fragmentShader:ZJ.meshphysical_frag};var sW={r:0,b:0,g:0},XR=new y0,c5=new o0;c5.set(-1,0,0,0,1,0,0,0,1);function KR(J,Q,$,Z,W,Y){let X=new e(0),K=W===!0?0:1,H,U,G=null,F=0,E=null;function O(L){let D=L.isScene===!0?L.background:null;if(D&&D.isTexture){let V=L.backgroundBlurriness>0;D=Q.get(D,V)}return D}function R(L){let D=!1,V=O(L);if(V===null)q(X,K);else if(V&&V.isColor)q(V,1),D=!0;let I=J.xr.getEnvironmentBlendMode();if(I==="additive")$.buffers.color.setClear(0,0,0,1,Y);else if(I==="alpha-blend")$.buffers.color.setClear(0,0,0,0,Y);if(J.autoClear||D)$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),J.clear(J.autoClearColor,J.autoClearDepth,J.autoClearStencil)}function k(L,D){let V=O(D);if(V&&(V.isCubeTexture||V.mapping===A7)){if(U===void 0)U=new a0(new J9(1,1,1),new LJ({name:"BackgroundCubeMaterial",uniforms:g6(r9.backgroundCube.uniforms),vertexShader:r9.backgroundCube.vertexShader,fragmentShader:r9.backgroundCube.fragmentShader,side:pJ,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),U.geometry.deleteAttribute("normal"),U.geometry.deleteAttribute("uv"),U.onBeforeRender=function(I,z,B){this.matrixWorld.copyPosition(B.matrixWorld)},Object.defineProperty(U.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),Z.update(U);if(U.material.uniforms.envMap.value=V,U.material.uniforms.backgroundBlurriness.value=D.backgroundBlurriness,U.material.uniforms.backgroundIntensity.value=D.backgroundIntensity,U.material.uniforms.backgroundRotation.value.setFromMatrix4(XR.makeRotationFromEuler(D.backgroundRotation)).transpose(),V.isCubeTexture&&V.isRenderTargetTexture===!1)U.material.uniforms.backgroundRotation.value.premultiply(c5);if(U.material.toneMapped=t0.getTransfer(V.colorSpace)!==OJ,G!==V||F!==V.version||E!==J.toneMapping)U.material.needsUpdate=!0,G=V,F=V.version,E=J.toneMapping;U.layers.enableAll(),L.unshift(U,U.geometry,U.material,0,0,null)}else if(V&&V.isTexture){if(H===void 0)H=new a0(new C9(2,2),new LJ({name:"BackgroundMaterial",uniforms:g6(r9.background.uniforms),vertexShader:r9.background.vertexShader,fragmentShader:r9.background.fragmentShader,side:n9,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),H.geometry.deleteAttribute("normal"),Object.defineProperty(H.material,"map",{get:function(){return this.uniforms.t2D.value}}),Z.update(H);if(H.material.uniforms.t2D.value=V,H.material.uniforms.backgroundIntensity.value=D.backgroundIntensity,H.material.toneMapped=t0.getTransfer(V.colorSpace)!==OJ,V.matrixAutoUpdate===!0)V.updateMatrix();if(H.material.uniforms.uvTransform.value.copy(V.matrix),G!==V||F!==V.version||E!==J.toneMapping)H.material.needsUpdate=!0,G=V,F=V.version,E=J.toneMapping;H.layers.enableAll(),L.unshift(H,H.geometry,H.material,0,0,null)}}function q(L,D){L.getRGB(sW,FK(J)),$.buffers.color.setClear(sW.r,sW.g,sW.b,D,Y)}function N(){if(U!==void 0)U.geometry.dispose(),U.material.dispose(),U=void 0;if(H!==void 0)H.geometry.dispose(),H.material.dispose(),H=void 0}return{getClearColor:function(){return X},setClearColor:function(L,D=1){X.set(L),K=D,q(X,K)},getClearAlpha:function(){return K},setClearAlpha:function(L){K=L,q(X,K)},render:R,addToRenderList:k,dispose:N}}function HR(J,Q){let $=J.getParameter(J.MAX_VERTEX_ATTRIBS),Z={},W=E(null),Y=W,X=!1;function K(w,v,b,S,h){let x=!1,p=F(w,S,b,v);if(Y!==p)Y=p,U(Y.object);if(x=O(w,S,b,h),x)R(w,S,b,h);if(h!==null)Q.update(h,J.ELEMENT_ARRAY_BUFFER);if(x||X){if(X=!1,V(w,v,b,S),h!==null)J.bindBuffer(J.ELEMENT_ARRAY_BUFFER,Q.get(h).buffer)}}function H(){return J.createVertexArray()}function U(w){return J.bindVertexArray(w)}function G(w){return J.deleteVertexArray(w)}function F(w,v,b,S){let h=S.wireframe===!0,x=Z[v.id];if(x===void 0)x={},Z[v.id]=x;let p=w.isInstancedMesh===!0?w.id:0,c=x[p];if(c===void 0)c={},x[p]=c;let o=c[b.id];if(o===void 0)o={},c[b.id]=o;let W0=o[h];if(W0===void 0)W0=E(H()),o[h]=W0;return W0}function E(w){let v=[],b=[],S=[];for(let h=0;h<$;h++)v[h]=0,b[h]=0,S[h]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:v,enabledAttributes:b,attributeDivisors:S,object:w,attributes:{},index:null}}function O(w,v,b,S){let h=Y.attributes,x=v.attributes,p=0,c=b.getAttributes();for(let o in c)if(c[o].location>=0){let H0=h[o],J0=x[o];if(J0===void 0){if(o==="instanceMatrix"&&w.instanceMatrix)J0=w.instanceMatrix;if(o==="instanceColor"&&w.instanceColor)J0=w.instanceColor}if(H0===void 0)return!0;if(H0.attribute!==J0)return!0;if(J0&&H0.data!==J0.data)return!0;p++}if(Y.attributesNum!==p)return!0;if(Y.index!==S)return!0;return!1}function R(w,v,b,S){let h={},x=v.attributes,p=0,c=b.getAttributes();for(let o in c)if(c[o].location>=0){let H0=x[o];if(H0===void 0){if(o==="instanceMatrix"&&w.instanceMatrix)H0=w.instanceMatrix;if(o==="instanceColor"&&w.instanceColor)H0=w.instanceColor}let J0={};if(J0.attribute=H0,H0&&H0.data)J0.data=H0.data;h[o]=J0,p++}Y.attributes=h,Y.attributesNum=p,Y.index=S}function k(){let w=Y.newAttributes;for(let v=0,b=w.length;v<b;v++)w[v]=0}function q(w){N(w,0)}function N(w,v){let{newAttributes:b,enabledAttributes:S,attributeDivisors:h}=Y;if(b[w]=1,S[w]===0)J.enableVertexAttribArray(w),S[w]=1;if(h[w]!==v)J.vertexAttribDivisor(w,v),h[w]=v}function L(){let{newAttributes:w,enabledAttributes:v}=Y;for(let b=0,S=v.length;b<S;b++)if(v[b]!==w[b])J.disableVertexAttribArray(b),v[b]=0}function D(w,v,b,S,h,x,p){if(p===!0)J.vertexAttribIPointer(w,v,b,h,x);else J.vertexAttribPointer(w,v,b,S,h,x)}function V(w,v,b,S){k();let h=S.attributes,x=b.getAttributes(),p=v.defaultAttributeValues;for(let c in x){let o=x[c];if(o.location>=0){let W0=h[c];if(W0===void 0){if(c==="instanceMatrix"&&w.instanceMatrix)W0=w.instanceMatrix;if(c==="instanceColor"&&w.instanceColor)W0=w.instanceColor}if(W0!==void 0){let{normalized:H0,itemSize:J0}=W0,c0=Q.get(W0);if(c0===void 0)continue;let{buffer:d0,type:s,bytesPerElement:F0}=c0,z0=s===J.INT||s===J.UNSIGNED_INT||W0.gpuType===IZ;if(W0.isInterleavedBufferAttribute){let E0=W0.data,j0=E0.stride,WJ=W0.offset;if(E0.isInstancedInterleavedBuffer){for(let x0=0;x0<o.locationSize;x0++)N(o.location+x0,E0.meshPerAttribute);if(w.isInstancedMesh!==!0&&S._maxInstanceCount===void 0)S._maxInstanceCount=E0.meshPerAttribute*E0.count}else for(let x0=0;x0<o.locationSize;x0++)q(o.location+x0);J.bindBuffer(J.ARRAY_BUFFER,d0);for(let x0=0;x0<o.locationSize;x0++)D(o.location+x0,J0/o.locationSize,s,H0,j0*F0,(WJ+J0/o.locationSize*x0)*F0,z0)}else{if(W0.isInstancedBufferAttribute){for(let E0=0;E0<o.locationSize;E0++)N(o.location+E0,W0.meshPerAttribute);if(w.isInstancedMesh!==!0&&S._maxInstanceCount===void 0)S._maxInstanceCount=W0.meshPerAttribute*W0.count}else for(let E0=0;E0<o.locationSize;E0++)q(o.location+E0);J.bindBuffer(J.ARRAY_BUFFER,d0);for(let E0=0;E0<o.locationSize;E0++)D(o.location+E0,J0/o.locationSize,s,H0,J0*F0,J0/o.locationSize*E0*F0,z0)}}else if(p!==void 0){let H0=p[c];if(H0!==void 0)switch(H0.length){case 2:J.vertexAttrib2fv(o.location,H0);break;case 3:J.vertexAttrib3fv(o.location,H0);break;case 4:J.vertexAttrib4fv(o.location,H0);break;default:J.vertexAttrib1fv(o.location,H0)}}}}L()}function I(){C();for(let w in Z){let v=Z[w];for(let b in v){let S=v[b];for(let h in S){let x=S[h];for(let p in x)G(x[p].object),delete x[p];delete S[h]}}delete Z[w]}}function z(w){if(Z[w.id]===void 0)return;let v=Z[w.id];for(let b in v){let S=v[b];for(let h in S){let x=S[h];for(let p in x)G(x[p].object),delete x[p];delete S[h]}}delete Z[w.id]}function B(w){for(let v in Z){let b=Z[v];for(let S in b){let h=b[S];if(h[w.id]===void 0)continue;let x=h[w.id];for(let p in x)G(x[p].object),delete x[p];delete h[w.id]}}}function M(w){for(let v in Z){let b=Z[v],S=w.isInstancedMesh===!0?w.id:0,h=b[S];if(h===void 0)continue;for(let x in h){let p=h[x];for(let c in p)G(p[c].object),delete p[c];delete h[x]}if(delete b[S],Object.keys(b).length===0)delete Z[v]}}function C(){if(j(),X=!0,Y===W)return;Y=W,U(Y.object)}function j(){W.geometry=null,W.program=null,W.wireframe=!1}return{setup:K,reset:C,resetDefaultState:j,dispose:I,releaseStatesOfGeometry:z,releaseStatesOfObject:M,releaseStatesOfProgram:B,initAttributes:k,enableAttribute:q,disableUnusedAttributes:L}}function UR(J,Q,$){let Z;function W(H){Z=H}function Y(H,U){J.drawArrays(Z,H,U),$.update(U,Z,1)}function X(H,U,G){if(G===0)return;J.drawArraysInstanced(Z,H,U,G),$.update(U,Z,G)}function K(H,U,G){if(G===0)return;Q.get("WEBGL_multi_draw").multiDrawArraysWEBGL(Z,H,0,U,0,G);let E=0;for(let O=0;O<G;O++)E+=U[O];$.update(E,Z,1)}this.setMode=W,this.render=Y,this.renderInstances=X,this.renderMultiDraw=K}function GR(J,Q,$,Z){let W;function Y(){if(W!==void 0)return W;if(Q.has("EXT_texture_filter_anisotropic")===!0){let B=Q.get("EXT_texture_filter_anisotropic");W=J.getParameter(B.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else W=0;return W}function X(B){if(B!==i9&&Z.convert(B)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_FORMAT))return!1;return!0}function K(B){let M=B===wJ&&(Q.has("EXT_color_buffer_half_float")||Q.has("EXT_color_buffer_float"));if(B!==S9&&Z.convert(B)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_TYPE)&&B!==F9&&!M)return!1;return!0}function H(B){if(B==="highp"){if(J.getShaderPrecisionFormat(J.VERTEX_SHADER,J.HIGH_FLOAT).precision>0&&J.getShaderPrecisionFormat(J.FRAGMENT_SHADER,J.HIGH_FLOAT).precision>0)return"highp";B="mediump"}if(B==="mediump"){if(J.getShaderPrecisionFormat(J.VERTEX_SHADER,J.MEDIUM_FLOAT).precision>0&&J.getShaderPrecisionFormat(J.FRAGMENT_SHADER,J.MEDIUM_FLOAT).precision>0)return"mediump"}return"lowp"}let U=$.precision!==void 0?$.precision:"highp",G=H(U);if(G!==U)O0("WebGLRenderer:",U,"not supported, using",G,"instead."),U=G;let F=$.logarithmicDepthBuffer===!0,E=$.reversedDepthBuffer===!0&&Q.has("EXT_clip_control");if($.reversedDepthBuffer===!0&&E===!1)O0("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");let O=J.getParameter(J.MAX_TEXTURE_IMAGE_UNITS),R=J.getParameter(J.MAX_VERTEX_TEXTURE_IMAGE_UNITS),k=J.getParameter(J.MAX_TEXTURE_SIZE),q=J.getParameter(J.MAX_CUBE_MAP_TEXTURE_SIZE),N=J.getParameter(J.MAX_VERTEX_ATTRIBS),L=J.getParameter(J.MAX_VERTEX_UNIFORM_VECTORS),D=J.getParameter(J.MAX_VARYING_VECTORS),V=J.getParameter(J.MAX_FRAGMENT_UNIFORM_VECTORS),I=J.getParameter(J.MAX_SAMPLES),z=J.getParameter(J.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:Y,getMaxPrecision:H,textureFormatReadable:X,textureTypeReadable:K,precision:U,logarithmicDepthBuffer:F,reversedDepthBuffer:E,maxTextures:O,maxVertexTextures:R,maxTextureSize:k,maxCubemapSize:q,maxAttributes:N,maxVertexUniforms:L,maxVaryings:D,maxFragmentUniforms:V,maxSamples:I,samples:z}}function ER(J){let Q=this,$=null,Z=0,W=!1,Y=!1,X=new _9,K=new o0,H={value:null,needsUpdate:!1};this.uniform=H,this.numPlanes=0,this.numIntersection=0,this.init=function(F,E){let O=F.length!==0||E||Z!==0||W;return W=E,Z=F.length,O},this.beginShadows=function(){Y=!0,G(null)},this.endShadows=function(){Y=!1},this.setGlobalState=function(F,E){$=G(F,E,0)},this.setState=function(F,E,O){let{clippingPlanes:R,clipIntersection:k,clipShadows:q}=F,N=J.get(F);if(!W||R===null||R.length===0||Y&&!q)if(Y)G(null);else U();else{let L=Y?0:Z,D=L*4,V=N.clippingState||null;H.value=V,V=G(R,E,D,O);for(let I=0;I!==D;++I)V[I]=$[I];N.clippingState=V,this.numIntersection=k?this.numPlanes:0,this.numPlanes+=L}};function U(){if(H.value!==$)H.value=$,H.needsUpdate=Z>0;Q.numPlanes=Z,Q.numIntersection=0}function G(F,E,O,R){let k=F!==null?F.length:0,q=null;if(k!==0){if(q=H.value,R!==!0||q===null){let N=O+k*4,L=E.matrixWorldInverse;if(K.getNormalMatrix(L),q===null||q.length<N)q=new Float32Array(N);for(let D=0,V=O;D!==k;++D,V+=4)X.copy(F[D]).applyMatrix4(L,K),X.normal.toArray(q,V),q[V+3]=X.constant}H.value=q,H.needsUpdate=!0}return Q.numPlanes=k,Q.numIntersection=0,q}}var W6=4,B5=[0.125,0.215,0.35,0.446,0.526,0.582],m6=20,FR=256,q$=new a9,C5=new e,JH=null,QH=0,$H=0,ZH=!1,NR=new T;class l6{constructor(J){this._renderer=J,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(J,Q=0,$=0.1,Z=100,W={}){let{size:Y=256,position:X=NR}=W;JH=this._renderer.getRenderTarget(),QH=this._renderer.getActiveCubeFace(),$H=this._renderer.getActiveMipmapLevel(),ZH=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(Y);let K=this._allocateTargets();if(K.depthBuffer=!0,this._sceneToCubeUV(J,$,Z,K,X),Q>0)this._blur(K,0,0,Q);return this._applyPMREM(K),this._cleanup(K),K}fromEquirectangular(J,Q=null){return this._fromTexture(J,Q)}fromCubemap(J,Q=null){return this._fromTexture(J,Q)}compileCubemapShader(){if(this._cubemapMaterial===null)this._cubemapMaterial=_5(),this._compileMaterial(this._cubemapMaterial)}compileEquirectangularShader(){if(this._equirectMaterial===null)this._equirectMaterial=z5(),this._compileMaterial(this._equirectMaterial)}dispose(){if(this._dispose(),this._cubemapMaterial!==null)this._cubemapMaterial.dispose();if(this._equirectMaterial!==null)this._equirectMaterial.dispose();if(this._backgroundBox!==null)this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose()}_setSize(J){this._lodMax=Math.floor(Math.log2(J)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){if(this._blurMaterial!==null)this._blurMaterial.dispose();if(this._ggxMaterial!==null)this._ggxMaterial.dispose();if(this._pingPongRenderTarget!==null)this._pingPongRenderTarget.dispose();for(let J=0;J<this._lodMeshes.length;J++)this._lodMeshes[J].geometry.dispose()}_cleanup(J){this._renderer.setRenderTarget(JH,QH,$H),this._renderer.xr.enabled=ZH,J.scissorTest=!1,i7(J,0,0,J.width,J.height)}_fromTexture(J,Q){if(J.mapping===_6||J.mapping===n8)this._setSize(J.image.length===0?16:J.image[0].width||J.image[0].image.width);else this._setSize(J.image.width/4);JH=this._renderer.getRenderTarget(),QH=this._renderer.getActiveCubeFace(),$H=this._renderer.getActiveMipmapLevel(),ZH=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let $=Q||this._allocateTargets();return this._textureToCubeUV(J,$),this._applyPMREM($),this._cleanup($),$}_allocateTargets(){let J=3*Math.max(this._cubeSize,112),Q=4*this._cubeSize,$={magFilter:jJ,minFilter:jJ,generateMipmaps:!1,type:wJ,format:i9,colorSpace:eJ,depthBuffer:!1},Z=I5(J,Q,$);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==J||this._pingPongRenderTarget.height!==Q){if(this._pingPongRenderTarget!==null)this._dispose();this._pingPongRenderTarget=I5(J,Q,$);let{_lodMax:W}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=OR(W)),this._blurMaterial=RR(W,J,Q),this._ggxMaterial=qR(W,J,Q)}return Z}_compileMaterial(J){let Q=new a0(new u0,J);this._renderer.compile(Q,q$)}_sceneToCubeUV(J,Q,$,Z,W){let K=new BJ(90,1,Q,$),H=[1,-1,1,1,1,1],U=[1,1,1,-1,-1,-1],G=this._renderer,F=G.autoClear,E=G.toneMapping;if(G.getClearColor(C5),G.toneMapping=E9,G.autoClear=!1,G.state.buffers.depth.getReversed())G.setRenderTarget(Z),G.clearDepth(),G.setRenderTarget(null);if(this._backgroundBox===null)this._backgroundBox=new a0(new J9,new cJ({name:"PMREM.Background",side:pJ,depthWrite:!1,depthTest:!1}));let R=this._backgroundBox,k=R.material,q=!1,N=J.background;if(N){if(N.isColor)k.color.copy(N),J.background=null,q=!0}else k.color.copy(C5),q=!0;for(let L=0;L<6;L++){let D=L%3;if(D===0)K.up.set(0,H[L],0),K.position.set(W.x,W.y,W.z),K.lookAt(W.x+U[L],W.y,W.z);else if(D===1)K.up.set(0,0,H[L]),K.position.set(W.x,W.y,W.z),K.lookAt(W.x,W.y+U[L],W.z);else K.up.set(0,H[L],0),K.position.set(W.x,W.y,W.z),K.lookAt(W.x,W.y,W.z+U[L]);let V=this._cubeSize;if(i7(Z,D*V,L>2?V:0,V,V),G.setRenderTarget(Z),q)G.render(R,K);G.render(J,K)}G.toneMapping=E,G.autoClear=F,J.background=N}_textureToCubeUV(J,Q){let $=this._renderer,Z=J.mapping===_6||J.mapping===n8;if(Z){if(this._cubemapMaterial===null)this._cubemapMaterial=_5();this._cubemapMaterial.uniforms.flipEnvMap.value=J.isRenderTargetTexture===!1?-1:1}else if(this._equirectMaterial===null)this._equirectMaterial=z5();let W=Z?this._cubemapMaterial:this._equirectMaterial,Y=this._lodMeshes[0];Y.material=W;let X=W.uniforms;X.envMap.value=J;let K=this._cubeSize;i7(Q,0,0,3*K,2*K),$.setRenderTarget(Q),$.render(Y,q$)}_applyPMREM(J){let Q=this._renderer,$=Q.autoClear;Q.autoClear=!1;let Z=this._lodMeshes.length;for(let W=1;W<Z;W++)this._applyGGXFilter(J,W-1,W);Q.autoClear=$}_applyGGXFilter(J,Q,$){let Z=this._renderer,W=this._pingPongRenderTarget,Y=this._ggxMaterial,X=this._lodMeshes[$];X.material=Y;let K=Y.uniforms,H=$/(this._lodMeshes.length-1),U=Q/(this._lodMeshes.length-1),G=Math.sqrt(H*H-U*U),F=0+H*1.25,E=G*F,{_lodMax:O}=this,R=this._sizeLods[$],k=3*R*($>O-W6?$-O+W6:0),q=4*(this._cubeSize-R);K.envMap.value=J.texture,K.roughness.value=E,K.mipInt.value=O-Q,i7(W,k,q,3*R,2*R),Z.setRenderTarget(W),Z.render(X,q$),K.envMap.value=W.texture,K.roughness.value=0,K.mipInt.value=O-$,i7(J,k,q,3*R,2*R),Z.setRenderTarget(J),Z.render(X,q$)}_blur(J,Q,$,Z,W){let Y=this._pingPongRenderTarget;this._halfBlur(J,Y,Q,$,Z,"latitudinal",W),this._halfBlur(Y,J,$,$,Z,"longitudinal",W)}_halfBlur(J,Q,$,Z,W,Y,X){let K=this._renderer,H=this._blurMaterial;if(Y!=="latitudinal"&&Y!=="longitudinal")v0("blur direction must be either latitudinal or longitudinal!");let U=3,G=this._lodMeshes[Z];G.material=H;let F=H.uniforms,E=this._sizeLods[$]-1,O=isFinite(W)?Math.PI/(2*E):2*Math.PI/(2*m6-1),R=W/O,k=isFinite(W)?1+Math.floor(U*R):m6;if(k>m6)O0(`sigmaRadians, ${W}, is too large and will clip, as it requested ${k} samples when the maximum is set to ${m6}`);let q=[],N=0;for(let z=0;z<m6;++z){let B=z/R,M=Math.exp(-B*B/2);if(q.push(M),z===0)N+=M;else if(z<k)N+=2*M}for(let z=0;z<q.length;z++)q[z]=q[z]/N;if(F.envMap.value=J.texture,F.samples.value=k,F.weights.value=q,F.latitudinal.value=Y==="latitudinal",X)F.poleAxis.value=X;let{_lodMax:L}=this;F.dTheta.value=O,F.mipInt.value=L-$;let D=this._sizeLods[Z],V=3*D*(Z>L-W6?Z-L+W6:0),I=4*(this._cubeSize-D);i7(Q,V,I,3*D,2*D),K.setRenderTarget(Q),K.render(G,q$)}}function OR(J){let Q=[],$=[],Z=[],W=J,Y=J-W6+1+B5.length;for(let X=0;X<Y;X++){let K=Math.pow(2,W);Q.push(K);let H=1/K;if(X>J-W6)H=B5[X-J+W6-1];else if(X===0)H=0;$.push(H);let U=1/(K-2),G=-U,F=1+U,E=[G,G,F,G,F,F,G,G,F,F,G,F],O=6,R=6,k=3,q=2,N=1,L=new Float32Array(k*R*O),D=new Float32Array(q*R*O),V=new Float32Array(N*R*O);for(let z=0;z<O;z++){let B=z%3*2/3-1,M=z>2?0:-1,C=[B,M,0,B+0.6666666666666666,M,0,B+0.6666666666666666,M+1,0,B,M,0,B+0.6666666666666666,M+1,0,B,M+1,0];L.set(C,k*R*z),D.set(E,q*R*z);let j=[z,z,z,z,z,z];V.set(j,N*R*z)}let I=new u0;if(I.setAttribute("position",new i0(L,k)),I.setAttribute("uv",new i0(D,q)),I.setAttribute("faceIndex",new i0(V,N)),Z.push(new a0(I,null)),W>W6)W--}return{lodMeshes:Z,sizeLods:Q,sigmas:$}}function I5(J,Q,$){let Z=new PJ(J,Q,$);return Z.texture.mapping=A7,Z.texture.name="PMREM.cubeUv",Z.scissorTest=!0,Z}function i7(J,Q,$,Z,W){J.viewport.set(Q,$,Z,W),J.scissor.set(Q,$,Z,W)}function qR(J,Q,$){return new LJ({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:FR,CUBEUV_TEXEL_WIDTH:1/Q,CUBEUV_TEXEL_HEIGHT:1/$,CUBEUV_MAX_MIP:`${J}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:oW(),fragmentShader:`
3668
3668
 
3669
3669
  precision highp float;
3670
3670
  precision highp int;
@@ -3768,7 +3768,7 @@ void main() {
3768
3768
 
3769
3769
  gl_FragColor = vec4(prefilteredColor, 1.0);
3770
3770
  }
3771
- `,blending:w9,depthTest:!1,depthWrite:!1})}function YE(J,Q,$){let Z=new Float32Array(y8),W=new j(0,1,0);return new SJ({name:"SphericalGaussianBlur",defines:{n:y8,CUBEUV_TEXEL_WIDTH:1/Q,CUBEUV_TEXEL_HEIGHT:1/$,CUBEUV_MAX_MIP:`${J}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:Z},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:W}},vertexShader:CQ(),fragmentShader:`
3771
+ `,blending:M9,depthTest:!1,depthWrite:!1})}function RR(J,Q,$){let Z=new Float32Array(m6),W=new T(0,1,0);return new LJ({name:"SphericalGaussianBlur",defines:{n:m6,CUBEUV_TEXEL_WIDTH:1/Q,CUBEUV_TEXEL_HEIGHT:1/$,CUBEUV_MAX_MIP:`${J}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:Z},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:W}},vertexShader:oW(),fragmentShader:`
3772
3772
 
3773
3773
  precision mediump float;
3774
3774
  precision mediump int;
@@ -3828,7 +3828,7 @@ void main() {
3828
3828
  }
3829
3829
 
3830
3830
  }
3831
- `,blending:w9,depthTest:!1,depthWrite:!1})}function EX(){return new SJ({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:CQ(),fragmentShader:`
3831
+ `,blending:M9,depthTest:!1,depthWrite:!1})}function z5(){return new LJ({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:oW(),fragmentShader:`
3832
3832
 
3833
3833
  precision mediump float;
3834
3834
  precision mediump int;
@@ -3847,7 +3847,7 @@ void main() {
3847
3847
  gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3848
3848
 
3849
3849
  }
3850
- `,blending:w9,depthTest:!1,depthWrite:!1})}function FX(){return new SJ({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:CQ(),fragmentShader:`
3850
+ `,blending:M9,depthTest:!1,depthWrite:!1})}function _5(){return new LJ({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:oW(),fragmentShader:`
3851
3851
 
3852
3852
  precision mediump float;
3853
3853
  precision mediump int;
@@ -3863,7 +3863,7 @@ void main() {
3863
3863
  gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3864
3864
 
3865
3865
  }
3866
- `,blending:w9,depthTest:!1,depthWrite:!1})}function CQ(){return`
3866
+ `,blending:M9,depthTest:!1,depthWrite:!1})}function oW(){return`
3867
3867
 
3868
3868
  precision mediump float;
3869
3869
  precision mediump int;
@@ -3918,7 +3918,7 @@ void main() {
3918
3918
  gl_Position = vec4( position, 1.0 );
3919
3919
 
3920
3920
  }
3921
- `}class mZ extends nJ{constructor(J=1,Q={}){super(J,J,Q);this.isWebGLCubeRenderTarget=!0;let $={width:J,height:J,depth:1},Z=[$,$,$,$,$,$];this.texture=new UQ(Z),this._setTextureOptions(Q),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(J,Q){this.texture.type=Q.type,this.texture.colorSpace=Q.colorSpace,this.texture.generateMipmaps=Q.generateMipmaps,this.texture.minFilter=Q.minFilter,this.texture.magFilter=Q.magFilter;let $={uniforms:{tEquirect:{value:null}},vertexShader:`
3921
+ `}class aW extends PJ{constructor(J=1,Q={}){super(J,J,Q);this.isWebGLCubeRenderTarget=!0;let $={width:J,height:J,depth:1},Z=[$,$,$,$,$,$];this.texture=new b6(Z),this._setTextureOptions(Q),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(J,Q){this.texture.type=Q.type,this.texture.colorSpace=Q.colorSpace,this.texture.generateMipmaps=Q.generateMipmaps,this.texture.minFilter=Q.minFilter,this.texture.magFilter=Q.magFilter;let $={uniforms:{tEquirect:{value:null}},vertexShader:`
3922
3922
 
3923
3923
  varying vec3 vWorldDirection;
3924
3924
 
@@ -3953,7 +3953,7 @@ void main() {
3953
3953
  gl_FragColor = texture2D( tEquirect, sampleUV );
3954
3954
 
3955
3955
  }
3956
- `},Z=new Y9(5,5,5),W=new SJ({name:"CubemapFromEquirect",uniforms:S8($.uniforms),vertexShader:$.vertexShader,fragmentShader:$.fragmentShader,side:bJ,blending:w9});W.uniforms.tEquirect.value=Q;let Y=new GJ(Z,W),X=Q.minFilter;if(Q.minFilter===P9)Q.minFilter=BJ;return new PZ(1,10,this).update(J,Y),Q.minFilter=X,Y.geometry.dispose(),Y.material.dispose(),this}clear(J,Q=!0,$=!0,Z=!0){let W=J.getRenderTarget();for(let Y=0;Y<6;Y++)J.setRenderTarget(this,Y),J.clear(Q,$,Z);J.setRenderTarget(W)}}function XE(J){let Q=new WeakMap,$=new WeakMap,Z=null;function W(E,O=!1){if(E===null||E===void 0)return null;if(O)return X(E);return Y(E)}function Y(E){if(E&&E.isTexture){let O=E.mapping;if(O===u7||O===m7)if(Q.has(E)){let R=Q.get(E).texture;return K(R,E.mapping)}else{let R=E.image;if(R&&R.height>0){let C=new mZ(R.height);return C.fromEquirectangularTexture(J,E),Q.set(E,C),E.addEventListener("dispose",U),K(C.texture,E.mapping)}else return null}}return E}function X(E){if(E&&E.isTexture){let O=E.mapping,R=O===u7||O===m7,C=O===Y6||O===C8;if(R||C){let q=$.get(E),N=q!==void 0?q.texture.pmremVersion:0;if(E.isRenderTargetTexture&&E.pmremVersion!==N){if(Z===null)Z=new Y7(J);return q=R?Z.fromEquirectangular(E,q):Z.fromCubemap(E,q),q.texture.pmremVersion=E.pmremVersion,$.set(E,q),q.texture}else if(q!==void 0)return q.texture;else{let L=E.image;if(R&&L&&L.height>0||C&&L&&H(L)){if(Z===null)Z=new Y7(J);return q=R?Z.fromEquirectangular(E):Z.fromCubemap(E),q.texture.pmremVersion=E.pmremVersion,$.set(E,q),E.addEventListener("dispose",G),q.texture}else return null}}}return E}function K(E,O){if(O===u7)E.mapping=Y6;else if(O===m7)E.mapping=C8;return E}function H(E){let O=0,R=6;for(let C=0;C<R;C++)if(E[C]!==void 0)O++;return O===R}function U(E){let O=E.target;O.removeEventListener("dispose",U);let R=Q.get(O);if(R!==void 0)Q.delete(O),R.dispose()}function G(E){let O=E.target;O.removeEventListener("dispose",G);let R=$.get(O);if(R!==void 0)$.delete(O),R.dispose()}function F(){if(Q=new WeakMap,$=new WeakMap,Z!==null)Z.dispose(),Z=null}return{get:W,dispose:F}}function KE(J){let Q={};function $(Z){if(Q[Z]!==void 0)return Q[Z];let W=J.getExtension(Z);return Q[Z]=W,W}return{has:function(Z){return $(Z)!==null},init:function(){$("EXT_color_buffer_float"),$("WEBGL_clip_cull_distance"),$("OES_texture_float_linear"),$("EXT_color_buffer_half_float"),$("WEBGL_multisampled_render_to_texture"),$("WEBGL_render_shared_exponent")},get:function(Z){let W=$(Z);if(W===null)g7("WebGLRenderer: "+Z+" extension not supported.");return W}}}function HE(J,Q,$,Z){let W={},Y=new WeakMap;function X(F){let E=F.target;if(E.index!==null)Q.remove(E.index);for(let R in E.attributes)Q.remove(E.attributes[R]);E.removeEventListener("dispose",X),delete W[E.id];let O=Y.get(E);if(O)Q.remove(O),Y.delete(E);if(Z.releaseStatesOfGeometry(E),E.isInstancedBufferGeometry===!0)delete E._maxInstanceCount;$.memory.geometries--}function K(F,E){if(W[E.id]===!0)return E;return E.addEventListener("dispose",X),W[E.id]=!0,$.memory.geometries++,E}function H(F){let E=F.attributes;for(let O in E)Q.update(E[O],J.ARRAY_BUFFER)}function U(F){let E=[],O=F.index,R=F.attributes.position,C=0;if(R===void 0)return;if(O!==null){let L=O.array;C=O.version;for(let M=0,k=L.length;M<k;M+=3){let _=L[M+0],P=L[M+1],V=L[M+2];E.push(_,P,P,V,V,_)}}else{let L=R.array;C=R.version;for(let M=0,k=L.length/3-1;M<k;M+=3){let _=M+0,P=M+1,V=M+2;E.push(_,P,P,V,V,_)}}let q=new(R.count>=65535?YQ:WQ)(E,1);q.version=C;let N=Y.get(F);if(N)Q.remove(N);Y.set(F,q)}function G(F){let E=Y.get(F);if(E){let O=F.index;if(O!==null){if(E.version<O.version)U(F)}}else U(F);return Y.get(F)}return{get:K,update:H,getWireframeAttribute:G}}function UE(J,Q,$){let Z;function W(F){Z=F}let Y,X;function K(F){Y=F.type,X=F.bytesPerElement}function H(F,E){J.drawElements(Z,E,Y,F*X),$.update(E,Z,1)}function U(F,E,O){if(O===0)return;J.drawElementsInstanced(Z,E,Y,F*X,O),$.update(E,Z,O)}function G(F,E,O){if(O===0)return;Q.get("WEBGL_multi_draw").multiDrawElementsWEBGL(Z,E,0,Y,F,0,O);let C=0;for(let q=0;q<O;q++)C+=E[q];$.update(C,Z,1)}this.setMode=W,this.setIndex=K,this.render=H,this.renderInstances=U,this.renderMultiDraw=G}function GE(J){let Q={geometries:0,textures:0},$={frame:0,calls:0,triangles:0,points:0,lines:0};function Z(Y,X,K){switch($.calls++,X){case J.TRIANGLES:$.triangles+=K*(Y/3);break;case J.LINES:$.lines+=K*(Y/2);break;case J.LINE_STRIP:$.lines+=K*(Y-1);break;case J.LINE_LOOP:$.lines+=K*Y;break;case J.POINTS:$.points+=K*Y;break;default:A0("WebGLInfo: Unknown draw mode:",X);break}}function W(){$.calls=0,$.triangles=0,$.points=0,$.lines=0}return{memory:Q,render:$,programs:null,autoReset:!0,reset:W,update:Z}}function EE(J,Q,$){let Z=new WeakMap,W=new QJ;function Y(X,K,H){let U=X.morphTargetInfluences,G=K.morphAttributes.position||K.morphAttributes.normal||K.morphAttributes.color,F=G!==void 0?G.length:0,E=Z.get(K);if(E===void 0||E.count!==F){let B=function(){V.dispose(),Z.delete(K),K.removeEventListener("dispose",B)};if(E!==void 0)E.texture.dispose();let O=K.morphAttributes.position!==void 0,R=K.morphAttributes.normal!==void 0,C=K.morphAttributes.color!==void 0,q=K.morphAttributes.position||[],N=K.morphAttributes.normal||[],L=K.morphAttributes.color||[],M=0;if(O===!0)M=1;if(R===!0)M=2;if(C===!0)M=3;let k=K.attributes.position.count*M,_=1;if(k>Q.maxTextureSize)_=Math.ceil(k/Q.maxTextureSize),k=Q.maxTextureSize;let P=new Float32Array(k*_*4*F),V=new QQ(P,k,_,F);V.type=tJ,V.needsUpdate=!0;let D=M*4;for(let A=0;A<F;A++){let z=q[A],S=N[A],y=L[A],v=k*_*4*A;for(let h=0;h<z.count;h++){let g=h*D;if(O===!0)W.fromBufferAttribute(z,h),P[v+g+0]=W.x,P[v+g+1]=W.y,P[v+g+2]=W.z,P[v+g+3]=0;if(R===!0)W.fromBufferAttribute(S,h),P[v+g+4]=W.x,P[v+g+5]=W.y,P[v+g+6]=W.z,P[v+g+7]=0;if(C===!0)W.fromBufferAttribute(y,h),P[v+g+8]=W.x,P[v+g+9]=W.y,P[v+g+10]=W.z,P[v+g+11]=y.itemSize===4?W.w:1}}E={count:F,texture:V,size:new p0(k,_)},Z.set(K,E),K.addEventListener("dispose",B)}if(X.isInstancedMesh===!0&&X.morphTexture!==null)H.getUniforms().setValue(J,"morphTexture",X.morphTexture,$);else{let O=0;for(let C=0;C<U.length;C++)O+=U[C];let R=K.morphTargetsRelative?1:1-O;H.getUniforms().setValue(J,"morphTargetBaseInfluence",R),H.getUniforms().setValue(J,"morphTargetInfluences",U)}H.getUniforms().setValue(J,"morphTargetsTexture",E.texture,$),H.getUniforms().setValue(J,"morphTargetsTextureSize",E.size)}return{update:Y}}function FE(J,Q,$,Z,W){let Y=new WeakMap;function X(U){let G=W.render.frame,F=U.geometry,E=Q.get(U,F);if(Y.get(E)!==G)Q.update(E),Y.set(E,G);if(U.isInstancedMesh){if(U.hasEventListener("dispose",H)===!1)U.addEventListener("dispose",H);if(Y.get(U)!==G){if($.update(U.instanceMatrix,J.ARRAY_BUFFER),U.instanceColor!==null)$.update(U.instanceColor,J.ARRAY_BUFFER);Y.set(U,G)}}if(U.isSkinnedMesh){let O=U.skeleton;if(Y.get(O)!==G)O.update(),Y.set(O,G)}return E}function K(){Y=new WeakMap}function H(U){let G=U.target;if(G.removeEventListener("dispose",H),Z.releaseStatesOfObject(G),$.remove(G.instanceMatrix),G.instanceColor!==null)$.remove(G.instanceColor)}return{update:X,dispose:K}}var NE={[R$]:"LINEAR_TONE_MAPPING",[L$]:"REINHARD_TONE_MAPPING",[D$]:"CINEON_TONE_MAPPING",[g6]:"ACES_FILMIC_TONE_MAPPING",[k$]:"AGX_TONE_MAPPING",[B$]:"NEUTRAL_TONE_MAPPING",[M$]:"CUSTOM_TONE_MAPPING"};function OE(J,Q,$,Z,W){let Y=new nJ(Q,$,{type:J,depthBuffer:Z,stencilBuffer:W,depthTexture:Z?new U8(Q,$):void 0}),X=new nJ(Q,$,{type:fJ,depthBuffer:!1,stencilBuffer:!1}),K=new RJ;K.setAttribute("position",new NJ([-1,3,0,-1,-1,0,3,-1,0],3)),K.setAttribute("uv",new NJ([0,2,0,0,2,0],2));let H=new DZ({uniforms:{tDiffuse:{value:null}},vertexShader:`
3956
+ `},Z=new J9(5,5,5),W=new LJ({name:"CubemapFromEquirect",uniforms:g6($.uniforms),vertexShader:$.vertexShader,fragmentShader:$.fragmentShader,side:pJ,blending:M9});W.uniforms.tEquirect.value=Q;let Y=new a0(Z,W),X=Q.minFilter;if(Q.minFilter===s9)Q.minFilter=jJ;return new gW(1,10,this).update(J,Y),Q.minFilter=X,Y.geometry.dispose(),Y.material.dispose(),this}clear(J,Q=!0,$=!0,Z=!0){let W=J.getRenderTarget();for(let Y=0;Y<6;Y++)J.setRenderTarget(this,Y),J.clear(Q,$,Z);J.setRenderTarget(W)}}function LR(J){let Q=new WeakMap,$=new WeakMap,Z=null;function W(E,O=!1){if(E===null||E===void 0)return null;if(O)return X(E);return Y(E)}function Y(E){if(E&&E.isTexture){let O=E.mapping;if(O===BQ||O===CQ)if(Q.has(E)){let R=Q.get(E).texture;return K(R,E.mapping)}else{let R=E.image;if(R&&R.height>0){let k=new aW(R.height);return k.fromEquirectangularTexture(J,E),Q.set(E,k),E.addEventListener("dispose",U),K(k.texture,E.mapping)}else return null}}return E}function X(E){if(E&&E.isTexture){let O=E.mapping,R=O===BQ||O===CQ,k=O===_6||O===n8;if(R||k){let q=$.get(E),N=q!==void 0?q.texture.pmremVersion:0;if(E.isRenderTargetTexture&&E.pmremVersion!==N){if(Z===null)Z=new l6(J);return q=R?Z.fromEquirectangular(E,q):Z.fromCubemap(E,q),q.texture.pmremVersion=E.pmremVersion,$.set(E,q),q.texture}else if(q!==void 0)return q.texture;else{let L=E.image;if(R&&L&&L.height>0||k&&L&&H(L)){if(Z===null)Z=new l6(J);return q=R?Z.fromEquirectangular(E):Z.fromCubemap(E),q.texture.pmremVersion=E.pmremVersion,$.set(E,q),E.addEventListener("dispose",G),q.texture}else return null}}}return E}function K(E,O){if(O===BQ)E.mapping=_6;else if(O===CQ)E.mapping=n8;return E}function H(E){let O=0,R=6;for(let k=0;k<R;k++)if(E[k]!==void 0)O++;return O===R}function U(E){let O=E.target;O.removeEventListener("dispose",U);let R=Q.get(O);if(R!==void 0)Q.delete(O),R.dispose()}function G(E){let O=E.target;O.removeEventListener("dispose",G);let R=$.get(O);if(R!==void 0)$.delete(O),R.dispose()}function F(){if(Q=new WeakMap,$=new WeakMap,Z!==null)Z.dispose(),Z=null}return{get:W,dispose:F}}function DR(J){let Q={};function $(Z){if(Q[Z]!==void 0)return Q[Z];let W=J.getExtension(Z);return Q[Z]=W,W}return{has:function(Z){return $(Z)!==null},init:function(){$("EXT_color_buffer_float"),$("WEBGL_clip_cull_distance"),$("OES_texture_float_linear"),$("EXT_color_buffer_half_float"),$("WEBGL_multisampled_render_to_texture"),$("WEBGL_render_shared_exponent")},get:function(Z){let W=$(Z);if(W===null)DQ("WebGLRenderer: "+Z+" extension not supported.");return W}}}function kR(J,Q,$,Z){let W={},Y=new WeakMap;function X(F){let E=F.target;if(E.index!==null)Q.remove(E.index);for(let R in E.attributes)Q.remove(E.attributes[R]);E.removeEventListener("dispose",X),delete W[E.id];let O=Y.get(E);if(O)Q.remove(O),Y.delete(E);if(Z.releaseStatesOfGeometry(E),E.isInstancedBufferGeometry===!0)delete E._maxInstanceCount;$.memory.geometries--}function K(F,E){if(W[E.id]===!0)return E;return E.addEventListener("dispose",X),W[E.id]=!0,$.memory.geometries++,E}function H(F){let E=F.attributes;for(let O in E)Q.update(E[O],J.ARRAY_BUFFER)}function U(F){let E=[],O=F.index,R=F.attributes.position,k=0;if(R===void 0)return;if(O!==null){let L=O.array;k=O.version;for(let D=0,V=L.length;D<V;D+=3){let I=L[D+0],z=L[D+1],B=L[D+2];E.push(I,z,z,B,B,I)}}else{let L=R.array;k=R.version;for(let D=0,V=L.length/3-1;D<V;D+=3){let I=D+0,z=D+1,B=D+2;E.push(I,z,z,B,B,I)}}let q=new(R.count>=65535?gQ:fQ)(E,1);q.version=k;let N=Y.get(F);if(N)Q.remove(N);Y.set(F,q)}function G(F){let E=Y.get(F);if(E){let O=F.index;if(O!==null){if(E.version<O.version)U(F)}}else U(F);return Y.get(F)}return{get:K,update:H,getWireframeAttribute:G}}function MR(J,Q,$){let Z;function W(F){Z=F}let Y,X;function K(F){Y=F.type,X=F.bytesPerElement}function H(F,E){J.drawElements(Z,E,Y,F*X),$.update(E,Z,1)}function U(F,E,O){if(O===0)return;J.drawElementsInstanced(Z,E,Y,F*X,O),$.update(E,Z,O)}function G(F,E,O){if(O===0)return;Q.get("WEBGL_multi_draw").multiDrawElementsWEBGL(Z,E,0,Y,F,0,O);let k=0;for(let q=0;q<O;q++)k+=E[q];$.update(k,Z,1)}this.setMode=W,this.setIndex=K,this.render=H,this.renderInstances=U,this.renderMultiDraw=G}function VR(J){let Q={geometries:0,textures:0},$={frame:0,calls:0,triangles:0,points:0,lines:0};function Z(Y,X,K){switch($.calls++,X){case J.TRIANGLES:$.triangles+=K*(Y/3);break;case J.LINES:$.lines+=K*(Y/2);break;case J.LINE_STRIP:$.lines+=K*(Y-1);break;case J.LINE_LOOP:$.lines+=K*Y;break;case J.POINTS:$.points+=K*Y;break;default:v0("WebGLInfo: Unknown draw mode:",X);break}}function W(){$.calls=0,$.triangles=0,$.points=0,$.lines=0}return{memory:Q,render:$,programs:null,autoReset:!0,reset:W,update:Z}}function BR(J,Q,$){let Z=new WeakMap,W=new FJ;function Y(X,K,H){let U=X.morphTargetInfluences,G=K.morphAttributes.position||K.morphAttributes.normal||K.morphAttributes.color,F=G!==void 0?G.length:0,E=Z.get(K);if(E===void 0||E.count!==F){let C=function(){B.dispose(),Z.delete(K),K.removeEventListener("dispose",C)};if(E!==void 0)E.texture.dispose();let O=K.morphAttributes.position!==void 0,R=K.morphAttributes.normal!==void 0,k=K.morphAttributes.color!==void 0,q=K.morphAttributes.position||[],N=K.morphAttributes.normal||[],L=K.morphAttributes.color||[],D=0;if(O===!0)D=1;if(R===!0)D=2;if(k===!0)D=3;let V=K.attributes.position.count*D,I=1;if(V>Q.maxTextureSize)I=Math.ceil(V/Q.maxTextureSize),V=Q.maxTextureSize;let z=new Float32Array(V*I*4*F),B=new v7(z,V,I,F);B.type=F9,B.needsUpdate=!0;let M=D*4;for(let j=0;j<F;j++){let w=q[j],v=N[j],b=L[j],S=V*I*4*j;for(let h=0;h<w.count;h++){let x=h*M;if(O===!0)W.fromBufferAttribute(w,h),z[S+x+0]=W.x,z[S+x+1]=W.y,z[S+x+2]=W.z,z[S+x+3]=0;if(R===!0)W.fromBufferAttribute(v,h),z[S+x+4]=W.x,z[S+x+5]=W.y,z[S+x+6]=W.z,z[S+x+7]=0;if(k===!0)W.fromBufferAttribute(b,h),z[S+x+8]=W.x,z[S+x+9]=W.y,z[S+x+10]=W.z,z[S+x+11]=b.itemSize===4?W.w:1}}E={count:F,texture:B,size:new i(V,I)},Z.set(K,E),K.addEventListener("dispose",C)}if(X.isInstancedMesh===!0&&X.morphTexture!==null)H.getUniforms().setValue(J,"morphTexture",X.morphTexture,$);else{let O=0;for(let k=0;k<U.length;k++)O+=U[k];let R=K.morphTargetsRelative?1:1-O;H.getUniforms().setValue(J,"morphTargetBaseInfluence",R),H.getUniforms().setValue(J,"morphTargetInfluences",U)}H.getUniforms().setValue(J,"morphTargetsTexture",E.texture,$),H.getUniforms().setValue(J,"morphTargetsTextureSize",E.size)}return{update:Y}}function CR(J,Q,$,Z,W){let Y=new WeakMap;function X(U){let G=W.render.frame,F=U.geometry,E=Q.get(U,F);if(Y.get(E)!==G)Q.update(E),Y.set(E,G);if(U.isInstancedMesh){if(U.hasEventListener("dispose",H)===!1)U.addEventListener("dispose",H);if(Y.get(U)!==G){if($.update(U.instanceMatrix,J.ARRAY_BUFFER),U.instanceColor!==null)$.update(U.instanceColor,J.ARRAY_BUFFER);Y.set(U,G)}}if(U.isSkinnedMesh){let O=U.skeleton;if(Y.get(O)!==G)O.update(),Y.set(O,G)}return E}function K(){Y=new WeakMap}function H(U){let G=U.target;if(G.removeEventListener("dispose",H),Z.releaseStatesOfObject(G),$.remove(G.instanceMatrix),G.instanceColor!==null)$.remove(G.instanceColor)}return{update:X,dispose:K}}var IR={[I7]:"LINEAR_TONE_MAPPING",[z7]:"REINHARD_TONE_MAPPING",[_7]:"CINEON_TONE_MAPPING",[c8]:"ACES_FILMIC_TONE_MAPPING",[P7]:"AGX_TONE_MAPPING",[T7]:"NEUTRAL_TONE_MAPPING",[w7]:"CUSTOM_TONE_MAPPING"};function zR(J,Q,$,Z,W){let Y=new PJ(Q,$,{type:J,depthBuffer:Z,stencilBuffer:W,depthTexture:Z?new P8(Q,$):void 0}),X=new PJ(Q,$,{type:wJ,depthBuffer:!1,stencilBuffer:!1}),K=new u0;K.setAttribute("position",new I0([-1,3,0,-1,-1,0,3,-1,0],3)),K.setAttribute("uv",new I0([0,2,0,0,2,0],2));let H=new p6({uniforms:{tDiffuse:{value:null}},vertexShader:`
3957
3957
  precision highp float;
3958
3958
 
3959
3959
  uniform mat4 modelViewMatrix;
@@ -3999,17 +3999,17 @@ void main() {
3999
3999
  #ifdef SRGB_TRANSFER
4000
4000
  gl_FragColor = sRGBTransferOETF( gl_FragColor );
4001
4001
  #endif
4002
- }`,depthTest:!1,depthWrite:!1}),U=new GJ(K,H),G=new v8(-1,1,1,-1,0,1),F=null,E=null,O=!1,R,C=null,q=[],N=!1;this.setSize=function(L,M){Y.setSize(L,M),X.setSize(L,M);for(let k=0;k<q.length;k++){let _=q[k];if(_.setSize)_.setSize(L,M)}},this.setEffects=function(L){q=L,N=q.length>0&&q[0].isRenderPass===!0;let{width:M,height:k}=Y;for(let _=0;_<q.length;_++){let P=q[_];if(P.setSize)P.setSize(M,k)}},this.begin=function(L,M){if(O)return!1;if(L.toneMapping===rJ&&q.length===0)return!1;if(C=M,M!==null){let{width:k,height:_}=M;if(Y.width!==k||Y.height!==_)this.setSize(k,_)}if(N===!1)L.setRenderTarget(Y);return R=L.toneMapping,L.toneMapping=rJ,!0},this.hasRenderPass=function(){return N},this.end=function(L,M){L.toneMapping=R,O=!0;let k=Y,_=X;for(let P=0;P<q.length;P++){let V=q[P];if(V.enabled===!1)continue;if(V.render(L,_,k,M),V.needsSwap!==!1){let D=k;k=_,_=D}}if(F!==L.outputColorSpace||E!==L.toneMapping){if(F=L.outputColorSpace,E=L.toneMapping,H.defines={},s0.getTransfer(F)===UJ)H.defines.SRGB_TRANSFER="";let P=NE[E];if(P)H.defines[P]="";H.needsUpdate=!0}H.uniforms.tDiffuse.value=k.texture,L.setRenderTarget(C),L.render(U,G),C=null,O=!1},this.isCompositing=function(){return O},this.dispose=function(){if(Y.depthTexture)Y.depthTexture.dispose();Y.dispose(),X.dispose(),K.dispose(),H.dispose()}}var jX=new wJ,dZ=new U8(1,1),vX=new QQ,yX=new NZ,hX=new UQ,NX=[],OX=[],qX=new Float32Array(16),RX=new Float32Array(9),LX=new Float32Array(4);function V6(J,Q,$){let Z=J[0];if(Z<=0||Z>0)return J;let W=Q*$,Y=NX[W];if(Y===void 0)Y=new Float32Array(W),NX[W]=Y;if(Q!==0){Z.toArray(Y,0);for(let X=1,K=0;X!==Q;++X)K+=$,J[X].toArray(Y,K)}return Y}function _J(J,Q){if(J.length!==Q.length)return!1;for(let $=0,Z=J.length;$<Z;$++)if(J[$]!==Q[$])return!1;return!0}function TJ(J,Q){for(let $=0,Z=Q.length;$<Z;$++)J[$]=Q[$]}function IQ(J,Q){let $=OX[Q];if($===void 0)$=new Int32Array(Q),OX[Q]=$;for(let Z=0;Z!==Q;++Z)$[Z]=J.allocateTextureUnit();return $}function qE(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1f(this.addr,Q),$[0]=Q}function RE(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y)J.uniform2f(this.addr,Q.x,Q.y),$[0]=Q.x,$[1]=Q.y}else{if(_J($,Q))return;J.uniform2fv(this.addr,Q),TJ($,Q)}}function LE(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z)J.uniform3f(this.addr,Q.x,Q.y,Q.z),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z}else if(Q.r!==void 0){if($[0]!==Q.r||$[1]!==Q.g||$[2]!==Q.b)J.uniform3f(this.addr,Q.r,Q.g,Q.b),$[0]=Q.r,$[1]=Q.g,$[2]=Q.b}else{if(_J($,Q))return;J.uniform3fv(this.addr,Q),TJ($,Q)}}function DE(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z||$[3]!==Q.w)J.uniform4f(this.addr,Q.x,Q.y,Q.z,Q.w),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z,$[3]=Q.w}else{if(_J($,Q))return;J.uniform4fv(this.addr,Q),TJ($,Q)}}function ME(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(_J($,Q))return;J.uniformMatrix2fv(this.addr,!1,Q),TJ($,Q)}else{if(_J($,Z))return;LX.set(Z),J.uniformMatrix2fv(this.addr,!1,LX),TJ($,Z)}}function kE(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(_J($,Q))return;J.uniformMatrix3fv(this.addr,!1,Q),TJ($,Q)}else{if(_J($,Z))return;RX.set(Z),J.uniformMatrix3fv(this.addr,!1,RX),TJ($,Z)}}function BE(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(_J($,Q))return;J.uniformMatrix4fv(this.addr,!1,Q),TJ($,Q)}else{if(_J($,Z))return;qX.set(Z),J.uniformMatrix4fv(this.addr,!1,qX),TJ($,Z)}}function VE(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1i(this.addr,Q),$[0]=Q}function CE(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y)J.uniform2i(this.addr,Q.x,Q.y),$[0]=Q.x,$[1]=Q.y}else{if(_J($,Q))return;J.uniform2iv(this.addr,Q),TJ($,Q)}}function IE(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z)J.uniform3i(this.addr,Q.x,Q.y,Q.z),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z}else{if(_J($,Q))return;J.uniform3iv(this.addr,Q),TJ($,Q)}}function zE(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z||$[3]!==Q.w)J.uniform4i(this.addr,Q.x,Q.y,Q.z,Q.w),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z,$[3]=Q.w}else{if(_J($,Q))return;J.uniform4iv(this.addr,Q),TJ($,Q)}}function wE(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1ui(this.addr,Q),$[0]=Q}function PE(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y)J.uniform2ui(this.addr,Q.x,Q.y),$[0]=Q.x,$[1]=Q.y}else{if(_J($,Q))return;J.uniform2uiv(this.addr,Q),TJ($,Q)}}function _E(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z)J.uniform3ui(this.addr,Q.x,Q.y,Q.z),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z}else{if(_J($,Q))return;J.uniform3uiv(this.addr,Q),TJ($,Q)}}function TE(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z||$[3]!==Q.w)J.uniform4ui(this.addr,Q.x,Q.y,Q.z,Q.w),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z,$[3]=Q.w}else{if(_J($,Q))return;J.uniform4uiv(this.addr,Q),TJ($,Q)}}function AE(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;let Y;if(this.type===J.SAMPLER_2D_SHADOW)dZ.compareFunction=$.isReversedDepthBuffer()?JQ:e7,Y=dZ;else Y=jX;$.setTexture2D(Q||Y,W)}function SE(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTexture3D(Q||yX,W)}function jE(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTextureCube(Q||hX,W)}function vE(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTexture2DArray(Q||vX,W)}function yE(J){switch(J){case 5126:return qE;case 35664:return RE;case 35665:return LE;case 35666:return DE;case 35674:return ME;case 35675:return kE;case 35676:return BE;case 5124:case 35670:return VE;case 35667:case 35671:return CE;case 35668:case 35672:return IE;case 35669:case 35673:return zE;case 5125:return wE;case 36294:return PE;case 36295:return _E;case 36296:return TE;case 35678:case 36198:case 36298:case 36306:case 35682:return AE;case 35679:case 36299:case 36307:return SE;case 35680:case 36300:case 36308:case 36293:return jE;case 36289:case 36303:case 36311:case 36292:return vE}}function hE(J,Q){J.uniform1fv(this.addr,Q)}function xE(J,Q){let $=V6(Q,this.size,2);J.uniform2fv(this.addr,$)}function bE(J,Q){let $=V6(Q,this.size,3);J.uniform3fv(this.addr,$)}function fE(J,Q){let $=V6(Q,this.size,4);J.uniform4fv(this.addr,$)}function gE(J,Q){let $=V6(Q,this.size,4);J.uniformMatrix2fv(this.addr,!1,$)}function pE(J,Q){let $=V6(Q,this.size,9);J.uniformMatrix3fv(this.addr,!1,$)}function dE(J,Q){let $=V6(Q,this.size,16);J.uniformMatrix4fv(this.addr,!1,$)}function uE(J,Q){J.uniform1iv(this.addr,Q)}function mE(J,Q){J.uniform2iv(this.addr,Q)}function lE(J,Q){J.uniform3iv(this.addr,Q)}function cE(J,Q){J.uniform4iv(this.addr,Q)}function nE(J,Q){J.uniform1uiv(this.addr,Q)}function sE(J,Q){J.uniform2uiv(this.addr,Q)}function iE(J,Q){J.uniform3uiv(this.addr,Q)}function oE(J,Q){J.uniform4uiv(this.addr,Q)}function aE(J,Q,$){let Z=this.cache,W=Q.length,Y=IQ($,W);if(!_J(Z,Y))J.uniform1iv(this.addr,Y),TJ(Z,Y);let X;if(this.type===J.SAMPLER_2D_SHADOW)X=dZ;else X=jX;for(let K=0;K!==W;++K)$.setTexture2D(Q[K]||X,Y[K])}function rE(J,Q,$){let Z=this.cache,W=Q.length,Y=IQ($,W);if(!_J(Z,Y))J.uniform1iv(this.addr,Y),TJ(Z,Y);for(let X=0;X!==W;++X)$.setTexture3D(Q[X]||yX,Y[X])}function tE(J,Q,$){let Z=this.cache,W=Q.length,Y=IQ($,W);if(!_J(Z,Y))J.uniform1iv(this.addr,Y),TJ(Z,Y);for(let X=0;X!==W;++X)$.setTextureCube(Q[X]||hX,Y[X])}function eE(J,Q,$){let Z=this.cache,W=Q.length,Y=IQ($,W);if(!_J(Z,Y))J.uniform1iv(this.addr,Y),TJ(Z,Y);for(let X=0;X!==W;++X)$.setTexture2DArray(Q[X]||vX,Y[X])}function J1(J){switch(J){case 5126:return hE;case 35664:return xE;case 35665:return bE;case 35666:return fE;case 35674:return gE;case 35675:return pE;case 35676:return dE;case 5124:case 35670:return uE;case 35667:case 35671:return mE;case 35668:case 35672:return lE;case 35669:case 35673:return cE;case 5125:return nE;case 36294:return sE;case 36295:return iE;case 36296:return oE;case 35678:case 36198:case 36298:case 36306:case 35682:return aE;case 35679:case 36299:case 36307:return rE;case 35680:case 36300:case 36308:case 36293:return tE;case 36289:case 36303:case 36311:case 36292:return eE}}class xX{constructor(J,Q,$){this.id=J,this.addr=$,this.cache=[],this.type=Q.type,this.setValue=yE(Q.type)}}class bX{constructor(J,Q,$){this.id=J,this.addr=$,this.cache=[],this.type=Q.type,this.size=Q.size,this.setValue=J1(Q.type)}}class fX{constructor(J){this.id=J,this.seq=[],this.map={}}setValue(J,Q,$){let Z=this.seq;for(let W=0,Y=Z.length;W!==Y;++W){let X=Z[W];X.setValue(J,Q[X.id],$)}}}var gZ=/(\w+)(\])?(\[|\.)?/g;function DX(J,Q){J.seq.push(Q),J.map[Q.id]=Q}function Q1(J,Q,$){let Z=J.name,W=Z.length;gZ.lastIndex=0;while(!0){let Y=gZ.exec(Z),X=gZ.lastIndex,K=Y[1],H=Y[2]==="]",U=Y[3];if(H)K=K|0;if(U===void 0||U==="["&&X+2===W){DX($,U===void 0?new xX(K,J,Q):new bX(K,J,Q));break}else{let F=$.map[K];if(F===void 0)F=new fX(K),DX($,F);$=F}}}class W7{constructor(J,Q){this.seq=[],this.map={};let $=J.getProgramParameter(Q,J.ACTIVE_UNIFORMS);for(let Y=0;Y<$;++Y){let X=J.getActiveUniform(Q,Y),K=J.getUniformLocation(Q,X.name);Q1(X,K,this)}let Z=[],W=[];for(let Y of this.seq)if(Y.type===J.SAMPLER_2D_SHADOW||Y.type===J.SAMPLER_CUBE_SHADOW||Y.type===J.SAMPLER_2D_ARRAY_SHADOW)Z.push(Y);else W.push(Y);if(Z.length>0)this.seq=Z.concat(W)}setValue(J,Q,$,Z){let W=this.map[Q];if(W!==void 0)W.setValue(J,$,Z)}setOptional(J,Q,$){let Z=Q[$];if(Z!==void 0)this.setValue(J,$,Z)}static upload(J,Q,$,Z){for(let W=0,Y=Q.length;W!==Y;++W){let X=Q[W],K=$[X.id];if(K.needsUpdate!==!1)X.setValue(J,K.value,Z)}}static seqWithValue(J,Q){let $=[];for(let Z=0,W=J.length;Z!==W;++Z){let Y=J[Z];if(Y.id in Q)$.push(Y)}return $}}function MX(J,Q,$){let Z=J.createShader(Q);return J.shaderSource(Z,$),J.compileShader(Z),Z}var $1=37297,Z1=0;function W1(J,Q){let $=J.split(`
4002
+ }`,depthTest:!1,depthWrite:!1}),U=new a0(K,H),G=new a9(-1,1,1,-1,0,1),F=null,E=null,O=!1,R,k=null,q=[],N=!1;this.setSize=function(L,D){Y.setSize(L,D),X.setSize(L,D);for(let V=0;V<q.length;V++){let I=q[V];if(I.setSize)I.setSize(L,D)}},this.setEffects=function(L){q=L,N=q.length>0&&q[0].isRenderPass===!0;let{width:D,height:V}=Y;for(let I=0;I<q.length;I++){let z=q[I];if(z.setSize)z.setSize(D,V)}},this.begin=function(L,D){if(O)return!1;if(L.toneMapping===E9&&q.length===0)return!1;if(k=D,D!==null){let{width:V,height:I}=D;if(Y.width!==V||Y.height!==I)this.setSize(V,I)}if(N===!1)L.setRenderTarget(Y);return R=L.toneMapping,L.toneMapping=E9,!0},this.hasRenderPass=function(){return N},this.end=function(L,D){L.toneMapping=R,O=!0;let V=Y,I=X;for(let z=0;z<q.length;z++){let B=q[z];if(B.enabled===!1)continue;if(B.render(L,I,V,D),B.needsSwap!==!1){let M=V;V=I,I=M}}if(F!==L.outputColorSpace||E!==L.toneMapping){if(F=L.outputColorSpace,E=L.toneMapping,H.defines={},t0.getTransfer(F)===OJ)H.defines.SRGB_TRANSFER="";let z=IR[E];if(z)H.defines[z]="";H.needsUpdate=!0}H.uniforms.tDiffuse.value=V.texture,L.setRenderTarget(k),L.render(U,G),k=null,O=!1},this.isCompositing=function(){return O},this.dispose=function(){if(Y.depthTexture)Y.depthTexture.dispose();Y.dispose(),X.dispose(),K.dispose(),H.dispose()}}var n5=new MJ,XH=new P8(1,1),s5=new v7,i5=new y7,o5=new b6,w5=[],P5=[],T5=new Float32Array(16),A5=new Float32Array(9),S5=new Float32Array(4);function o7(J,Q,$){let Z=J[0];if(Z<=0||Z>0)return J;let W=Q*$,Y=w5[W];if(Y===void 0)Y=new Float32Array(W),w5[W]=Y;if(Q!==0){Z.toArray(Y,0);for(let X=1,K=0;X!==Q;++X)K+=$,J[X].toArray(Y,K)}return Y}function dJ(J,Q){if(J.length!==Q.length)return!1;for(let $=0,Z=J.length;$<Z;$++)if(J[$]!==Q[$])return!1;return!0}function mJ(J,Q){for(let $=0,Z=Q.length;$<Z;$++)J[$]=Q[$]}function rW(J,Q){let $=P5[Q];if($===void 0)$=new Int32Array(Q),P5[Q]=$;for(let Z=0;Z!==Q;++Z)$[Z]=J.allocateTextureUnit();return $}function _R(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1f(this.addr,Q),$[0]=Q}function wR(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y)J.uniform2f(this.addr,Q.x,Q.y),$[0]=Q.x,$[1]=Q.y}else{if(dJ($,Q))return;J.uniform2fv(this.addr,Q),mJ($,Q)}}function PR(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z)J.uniform3f(this.addr,Q.x,Q.y,Q.z),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z}else if(Q.r!==void 0){if($[0]!==Q.r||$[1]!==Q.g||$[2]!==Q.b)J.uniform3f(this.addr,Q.r,Q.g,Q.b),$[0]=Q.r,$[1]=Q.g,$[2]=Q.b}else{if(dJ($,Q))return;J.uniform3fv(this.addr,Q),mJ($,Q)}}function TR(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z||$[3]!==Q.w)J.uniform4f(this.addr,Q.x,Q.y,Q.z,Q.w),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z,$[3]=Q.w}else{if(dJ($,Q))return;J.uniform4fv(this.addr,Q),mJ($,Q)}}function AR(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(dJ($,Q))return;J.uniformMatrix2fv(this.addr,!1,Q),mJ($,Q)}else{if(dJ($,Z))return;S5.set(Z),J.uniformMatrix2fv(this.addr,!1,S5),mJ($,Z)}}function SR(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(dJ($,Q))return;J.uniformMatrix3fv(this.addr,!1,Q),mJ($,Q)}else{if(dJ($,Z))return;A5.set(Z),J.uniformMatrix3fv(this.addr,!1,A5),mJ($,Z)}}function jR(J,Q){let $=this.cache,Z=Q.elements;if(Z===void 0){if(dJ($,Q))return;J.uniformMatrix4fv(this.addr,!1,Q),mJ($,Q)}else{if(dJ($,Z))return;T5.set(Z),J.uniformMatrix4fv(this.addr,!1,T5),mJ($,Z)}}function vR(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1i(this.addr,Q),$[0]=Q}function yR(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y)J.uniform2i(this.addr,Q.x,Q.y),$[0]=Q.x,$[1]=Q.y}else{if(dJ($,Q))return;J.uniform2iv(this.addr,Q),mJ($,Q)}}function xR(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z)J.uniform3i(this.addr,Q.x,Q.y,Q.z),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z}else{if(dJ($,Q))return;J.uniform3iv(this.addr,Q),mJ($,Q)}}function bR(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z||$[3]!==Q.w)J.uniform4i(this.addr,Q.x,Q.y,Q.z,Q.w),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z,$[3]=Q.w}else{if(dJ($,Q))return;J.uniform4iv(this.addr,Q),mJ($,Q)}}function hR(J,Q){let $=this.cache;if($[0]===Q)return;J.uniform1ui(this.addr,Q),$[0]=Q}function fR(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y)J.uniform2ui(this.addr,Q.x,Q.y),$[0]=Q.x,$[1]=Q.y}else{if(dJ($,Q))return;J.uniform2uiv(this.addr,Q),mJ($,Q)}}function gR(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z)J.uniform3ui(this.addr,Q.x,Q.y,Q.z),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z}else{if(dJ($,Q))return;J.uniform3uiv(this.addr,Q),mJ($,Q)}}function pR(J,Q){let $=this.cache;if(Q.x!==void 0){if($[0]!==Q.x||$[1]!==Q.y||$[2]!==Q.z||$[3]!==Q.w)J.uniform4ui(this.addr,Q.x,Q.y,Q.z,Q.w),$[0]=Q.x,$[1]=Q.y,$[2]=Q.z,$[3]=Q.w}else{if(dJ($,Q))return;J.uniform4uiv(this.addr,Q),mJ($,Q)}}function uR(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;let Y;if(this.type===J.SAMPLER_2D_SHADOW)XH.compareFunction=$.isReversedDepthBuffer()?yQ:vQ,Y=XH;else Y=n5;$.setTexture2D(Q||Y,W)}function dR(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTexture3D(Q||i5,W)}function mR(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTextureCube(Q||o5,W)}function lR(J,Q,$){let Z=this.cache,W=$.allocateTextureUnit();if(Z[0]!==W)J.uniform1i(this.addr,W),Z[0]=W;$.setTexture2DArray(Q||s5,W)}function cR(J){switch(J){case 5126:return _R;case 35664:return wR;case 35665:return PR;case 35666:return TR;case 35674:return AR;case 35675:return SR;case 35676:return jR;case 5124:case 35670:return vR;case 35667:case 35671:return yR;case 35668:case 35672:return xR;case 35669:case 35673:return bR;case 5125:return hR;case 36294:return fR;case 36295:return gR;case 36296:return pR;case 35678:case 36198:case 36298:case 36306:case 35682:return uR;case 35679:case 36299:case 36307:return dR;case 35680:case 36300:case 36308:case 36293:return mR;case 36289:case 36303:case 36311:case 36292:return lR}}function nR(J,Q){J.uniform1fv(this.addr,Q)}function sR(J,Q){let $=o7(Q,this.size,2);J.uniform2fv(this.addr,$)}function iR(J,Q){let $=o7(Q,this.size,3);J.uniform3fv(this.addr,$)}function oR(J,Q){let $=o7(Q,this.size,4);J.uniform4fv(this.addr,$)}function aR(J,Q){let $=o7(Q,this.size,4);J.uniformMatrix2fv(this.addr,!1,$)}function rR(J,Q){let $=o7(Q,this.size,9);J.uniformMatrix3fv(this.addr,!1,$)}function tR(J,Q){let $=o7(Q,this.size,16);J.uniformMatrix4fv(this.addr,!1,$)}function eR(J,Q){J.uniform1iv(this.addr,Q)}function JL(J,Q){J.uniform2iv(this.addr,Q)}function QL(J,Q){J.uniform3iv(this.addr,Q)}function $L(J,Q){J.uniform4iv(this.addr,Q)}function ZL(J,Q){J.uniform1uiv(this.addr,Q)}function WL(J,Q){J.uniform2uiv(this.addr,Q)}function YL(J,Q){J.uniform3uiv(this.addr,Q)}function XL(J,Q){J.uniform4uiv(this.addr,Q)}function KL(J,Q,$){let Z=this.cache,W=Q.length,Y=rW($,W);if(!dJ(Z,Y))J.uniform1iv(this.addr,Y),mJ(Z,Y);let X;if(this.type===J.SAMPLER_2D_SHADOW)X=XH;else X=n5;for(let K=0;K!==W;++K)$.setTexture2D(Q[K]||X,Y[K])}function HL(J,Q,$){let Z=this.cache,W=Q.length,Y=rW($,W);if(!dJ(Z,Y))J.uniform1iv(this.addr,Y),mJ(Z,Y);for(let X=0;X!==W;++X)$.setTexture3D(Q[X]||i5,Y[X])}function UL(J,Q,$){let Z=this.cache,W=Q.length,Y=rW($,W);if(!dJ(Z,Y))J.uniform1iv(this.addr,Y),mJ(Z,Y);for(let X=0;X!==W;++X)$.setTextureCube(Q[X]||o5,Y[X])}function GL(J,Q,$){let Z=this.cache,W=Q.length,Y=rW($,W);if(!dJ(Z,Y))J.uniform1iv(this.addr,Y),mJ(Z,Y);for(let X=0;X!==W;++X)$.setTexture2DArray(Q[X]||s5,Y[X])}function EL(J){switch(J){case 5126:return nR;case 35664:return sR;case 35665:return iR;case 35666:return oR;case 35674:return aR;case 35675:return rR;case 35676:return tR;case 5124:case 35670:return eR;case 35667:case 35671:return JL;case 35668:case 35672:return QL;case 35669:case 35673:return $L;case 5125:return ZL;case 36294:return WL;case 36295:return YL;case 36296:return XL;case 35678:case 36198:case 36298:case 36306:case 35682:return KL;case 35679:case 36299:case 36307:return HL;case 35680:case 36300:case 36308:case 36293:return UL;case 36289:case 36303:case 36311:case 36292:return GL}}class a5{constructor(J,Q,$){this.id=J,this.addr=$,this.cache=[],this.type=Q.type,this.setValue=cR(Q.type)}}class r5{constructor(J,Q,$){this.id=J,this.addr=$,this.cache=[],this.type=Q.type,this.size=Q.size,this.setValue=EL(Q.type)}}class t5{constructor(J){this.id=J,this.seq=[],this.map={}}setValue(J,Q,$){let Z=this.seq;for(let W=0,Y=Z.length;W!==Y;++W){let X=Z[W];X.setValue(J,Q[X.id],$)}}}var WH=/(\w+)(\])?(\[|\.)?/g;function j5(J,Q){J.seq.push(Q),J.map[Q.id]=Q}function FL(J,Q,$){let Z=J.name,W=Z.length;WH.lastIndex=0;while(!0){let Y=WH.exec(Z),X=WH.lastIndex,K=Y[1],H=Y[2]==="]",U=Y[3];if(H)K=K|0;if(U===void 0||U==="["&&X+2===W){j5($,U===void 0?new a5(K,J,Q):new r5(K,J,Q));break}else{let F=$.map[K];if(F===void 0)F=new t5(K),j5($,F);$=F}}}class D${constructor(J,Q){this.seq=[],this.map={};let $=J.getProgramParameter(Q,J.ACTIVE_UNIFORMS);for(let Y=0;Y<$;++Y){let X=J.getActiveUniform(Q,Y),K=J.getUniformLocation(Q,X.name);FL(X,K,this)}let Z=[],W=[];for(let Y of this.seq)if(Y.type===J.SAMPLER_2D_SHADOW||Y.type===J.SAMPLER_CUBE_SHADOW||Y.type===J.SAMPLER_2D_ARRAY_SHADOW)Z.push(Y);else W.push(Y);if(Z.length>0)this.seq=Z.concat(W)}setValue(J,Q,$,Z){let W=this.map[Q];if(W!==void 0)W.setValue(J,$,Z)}setOptional(J,Q,$){let Z=Q[$];if(Z!==void 0)this.setValue(J,$,Z)}static upload(J,Q,$,Z){for(let W=0,Y=Q.length;W!==Y;++W){let X=Q[W],K=$[X.id];if(K.needsUpdate!==!1)X.setValue(J,K.value,Z)}}static seqWithValue(J,Q){let $=[];for(let Z=0,W=J.length;Z!==W;++Z){let Y=J[Z];if(Y.id in Q)$.push(Y)}return $}}function v5(J,Q,$){let Z=J.createShader(Q);return J.shaderSource(Z,$),J.compileShader(Z),Z}var NL=37297,OL=0;function qL(J,Q){let $=J.split(`
4003
4003
  `),Z=[],W=Math.max(Q-6,0),Y=Math.min(Q+6,$.length);for(let X=W;X<Y;X++){let K=X+1;Z.push(`${K===Q?">":" "} ${K}: ${$[X]}`)}return Z.join(`
4004
- `)}var kX=new h0;function Y1(J){s0._getMatrix(kX,s0.workingColorSpace,J);let Q=`mat3( ${kX.elements.map(($)=>$.toFixed(4))} )`;switch(s0.getTransfer(J)){case KZ:return[Q,"LinearTransferOETF"];case UJ:return[Q,"sRGBTransferOETF"];default:return C0("WebGLProgram: Unsupported color space: ",J),[Q,"LinearTransferOETF"]}}function BX(J,Q,$){let Z=J.getShaderParameter(Q,J.COMPILE_STATUS),Y=(J.getShaderInfoLog(Q)||"").trim();if(Z&&Y==="")return"";let X=/ERROR: 0:(\d+)/.exec(Y);if(X){let K=parseInt(X[1]);return $.toUpperCase()+`
4004
+ `)}var y5=new o0;function RL(J){t0._getMatrix(y5,t0.workingColorSpace,J);let Q=`mat3( ${y5.elements.map(($)=>$.toFixed(4))} )`;switch(t0.getTransfer(J)){case UW:return[Q,"LinearTransferOETF"];case OJ:return[Q,"sRGBTransferOETF"];default:return O0("WebGLProgram: Unsupported color space: ",J),[Q,"LinearTransferOETF"]}}function x5(J,Q,$){let Z=J.getShaderParameter(Q,J.COMPILE_STATUS),Y=(J.getShaderInfoLog(Q)||"").trim();if(Z&&Y==="")return"";let X=/ERROR: 0:(\d+)/.exec(Y);if(X){let K=parseInt(X[1]);return $.toUpperCase()+`
4005
4005
 
4006
4006
  `+Y+`
4007
4007
 
4008
- `+W1(J.getShaderSource(Q),K)}else return Y}function X1(J,Q){let $=Y1(Q);return[`vec4 ${J}( vec4 value ) {`,` return ${$[1]}( vec4( value.rgb * ${$[0]}, value.a ) );`,"}"].join(`
4009
- `)}var K1={[R$]:"Linear",[L$]:"Reinhard",[D$]:"Cineon",[g6]:"ACESFilmic",[k$]:"AgX",[B$]:"Neutral",[M$]:"Custom"};function H1(J,Q){let $=K1[Q];if($===void 0)return C0("WebGLProgram: Unsupported toneMapping:",Q),"vec3 "+J+"( vec3 color ) { return LinearToneMapping( color ); }";return"vec3 "+J+"( vec3 color ) { return "+$+"ToneMapping( color ); }"}var VQ=new j;function U1(){s0.getLuminanceCoefficients(VQ);let J=VQ.x.toFixed(4),Q=VQ.y.toFixed(4),$=VQ.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${J}, ${Q}, ${$} );`,"\treturn dot( weights, rgb );","}"].join(`
4010
- `)}function G1(J){return[J.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",J.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Z7).join(`
4011
- `)}function E1(J){let Q=[];for(let $ in J){let Z=J[$];if(Z===!1)continue;Q.push("#define "+$+" "+Z)}return Q.join(`
4012
- `)}function F1(J,Q){let $={},Z=J.getProgramParameter(Q,J.ACTIVE_ATTRIBUTES);for(let W=0;W<Z;W++){let Y=J.getActiveAttrib(Q,W),X=Y.name,K=1;if(Y.type===J.FLOAT_MAT2)K=2;if(Y.type===J.FLOAT_MAT3)K=3;if(Y.type===J.FLOAT_MAT4)K=4;$[X]={type:Y.type,location:J.getAttribLocation(Q,X),locationSize:K}}return $}function Z7(J){return J!==""}function VX(J,Q){let $=Q.numSpotLightShadows+Q.numSpotLightMaps-Q.numSpotLightShadowsWithMaps;return J.replace(/NUM_DIR_LIGHTS/g,Q.numDirLights).replace(/NUM_SPOT_LIGHTS/g,Q.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,Q.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,$).replace(/NUM_RECT_AREA_LIGHTS/g,Q.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,Q.numPointLights).replace(/NUM_HEMI_LIGHTS/g,Q.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,Q.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,Q.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,Q.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,Q.numPointLightShadows)}function CX(J,Q){return J.replace(/NUM_CLIPPING_PLANES/g,Q.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,Q.numClippingPlanes-Q.numClipIntersection)}var N1=/^[ \t]*#include +<([\w\d./]+)>/gm;function uZ(J){return J.replace(N1,q1)}var O1=new Map;function q1(J,Q){let $=l0[Q];if($===void 0){let Z=O1.get(Q);if(Z!==void 0)$=l0[Z],C0('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',Q,Z);else throw Error("Can not resolve #include <"+Q+">")}return uZ($)}var R1=/#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 IX(J){return J.replace(R1,L1)}function L1(J,Q,$,Z){let W="";for(let Y=parseInt(Q);Y<parseInt($);Y++)W+=Z.replace(/\[\s*i\s*\]/g,"[ "+Y+" ]").replace(/UNROLLED_LOOP_INDEX/g,Y);return W}function zX(J){let Q=`precision ${J.precision} float;
4008
+ `+qL(J.getShaderSource(Q),K)}else return Y}function LL(J,Q){let $=RL(Q);return[`vec4 ${J}( vec4 value ) {`,` return ${$[1]}( vec4( value.rgb * ${$[0]}, value.a ) );`,"}"].join(`
4009
+ `)}var DL={[I7]:"Linear",[z7]:"Reinhard",[_7]:"Cineon",[c8]:"ACESFilmic",[P7]:"AgX",[T7]:"Neutral",[w7]:"Custom"};function kL(J,Q){let $=DL[Q];if($===void 0)return O0("WebGLProgram: Unsupported toneMapping:",Q),"vec3 "+J+"( vec3 color ) { return LinearToneMapping( color ); }";return"vec3 "+J+"( vec3 color ) { return "+$+"ToneMapping( color ); }"}var iW=new T;function ML(){t0.getLuminanceCoefficients(iW);let J=iW.x.toFixed(4),Q=iW.y.toFixed(4),$=iW.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${J}, ${Q}, ${$} );`,"\treturn dot( weights, rgb );","}"].join(`
4010
+ `)}function VL(J){return[J.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",J.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(L$).join(`
4011
+ `)}function BL(J){let Q=[];for(let $ in J){let Z=J[$];if(Z===!1)continue;Q.push("#define "+$+" "+Z)}return Q.join(`
4012
+ `)}function CL(J,Q){let $={},Z=J.getProgramParameter(Q,J.ACTIVE_ATTRIBUTES);for(let W=0;W<Z;W++){let Y=J.getActiveAttrib(Q,W),X=Y.name,K=1;if(Y.type===J.FLOAT_MAT2)K=2;if(Y.type===J.FLOAT_MAT3)K=3;if(Y.type===J.FLOAT_MAT4)K=4;$[X]={type:Y.type,location:J.getAttribLocation(Q,X),locationSize:K}}return $}function L$(J){return J!==""}function b5(J,Q){let $=Q.numSpotLightShadows+Q.numSpotLightMaps-Q.numSpotLightShadowsWithMaps;return J.replace(/NUM_DIR_LIGHTS/g,Q.numDirLights).replace(/NUM_SPOT_LIGHTS/g,Q.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,Q.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,$).replace(/NUM_RECT_AREA_LIGHTS/g,Q.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,Q.numPointLights).replace(/NUM_HEMI_LIGHTS/g,Q.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,Q.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,Q.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,Q.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,Q.numPointLightShadows)}function h5(J,Q){return J.replace(/NUM_CLIPPING_PLANES/g,Q.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,Q.numClippingPlanes-Q.numClipIntersection)}var IL=/^[ \t]*#include +<([\w\d./]+)>/gm;function KH(J){return J.replace(IL,_L)}var zL=new Map;function _L(J,Q){let $=ZJ[Q];if($===void 0){let Z=zL.get(Q);if(Z!==void 0)$=ZJ[Z],O0('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',Q,Z);else throw Error("Can not resolve #include <"+Q+">")}return KH($)}var wL=/#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 f5(J){return J.replace(wL,PL)}function PL(J,Q,$,Z){let W="";for(let Y=parseInt(Q);Y<parseInt($);Y++)W+=Z.replace(/\[\s*i\s*\]/g,"[ "+Y+" ]").replace(/UNROLLED_LOOP_INDEX/g,Y);return W}function g5(J){let Q=`precision ${J.precision} float;
4013
4013
  precision ${J.precision} int;
4014
4014
  precision ${J.precision} sampler2D;
4015
4015
  precision ${J.precision} samplerCube;
@@ -4029,30 +4029,30 @@ void main() {
4029
4029
  `;if(J.precision==="highp")Q+=`
4030
4030
  #define HIGH_PRECISION`;else if(J.precision==="mediump")Q+=`
4031
4031
  #define MEDIUM_PRECISION`;else if(J.precision==="lowp")Q+=`
4032
- #define LOW_PRECISION`;return Q}var D1={[b6]:"SHADOWMAP_TYPE_PCF",[Z6]:"SHADOWMAP_TYPE_VSM"};function M1(J){return D1[J.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var k1={[Y6]:"ENVMAP_TYPE_CUBE",[C8]:"ENVMAP_TYPE_CUBE",[p6]:"ENVMAP_TYPE_CUBE_UV"};function B1(J){if(J.envMap===!1)return"ENVMAP_TYPE_CUBE";return k1[J.envMapMode]||"ENVMAP_TYPE_CUBE"}var V1={[C8]:"ENVMAP_MODE_REFRACTION"};function C1(J){if(J.envMap===!1)return"ENVMAP_MODE_REFLECTION";return V1[J.envMapMode]||"ENVMAP_MODE_REFLECTION"}var I1={[vY]:"ENVMAP_BLENDING_MULTIPLY",[yY]:"ENVMAP_BLENDING_MIX",[hY]:"ENVMAP_BLENDING_ADD"};function z1(J){if(J.envMap===!1)return"ENVMAP_BLENDING_NONE";return I1[J.combine]||"ENVMAP_BLENDING_NONE"}function w1(J){let Q=J.envMapCubeUVHeight;if(Q===null)return null;let $=Math.log2(Q)-2,Z=1/Q;return{texelWidth:1/(3*Math.max(Math.pow(2,$),112)),texelHeight:Z,maxMip:$}}function P1(J,Q,$,Z){let W=J.getContext(),Y=$.defines,X=$.vertexShader,K=$.fragmentShader,H=M1($),U=B1($),G=C1($),F=z1($),E=w1($),O=G1($),R=E1(Y),C=W.createProgram(),q,N,L=$.glslVersion?"#version "+$.glslVersion+`
4033
- `:"";if($.isRawShaderMaterial){if(q=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R].filter(Z7).join(`
4032
+ #define LOW_PRECISION`;return Q}var TL={[C7]:"SHADOWMAP_TYPE_PCF",[I6]:"SHADOWMAP_TYPE_VSM"};function AL(J){return TL[J.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}var SL={[_6]:"ENVMAP_TYPE_CUBE",[n8]:"ENVMAP_TYPE_CUBE",[A7]:"ENVMAP_TYPE_CUBE_UV"};function jL(J){if(J.envMap===!1)return"ENVMAP_TYPE_CUBE";return SL[J.envMapMode]||"ENVMAP_TYPE_CUBE"}var vL={[n8]:"ENVMAP_MODE_REFRACTION"};function yL(J){if(J.envMap===!1)return"ENVMAP_MODE_REFLECTION";return vL[J.envMapMode]||"ENVMAP_MODE_REFLECTION"}var xL={[jX]:"ENVMAP_BLENDING_MULTIPLY",[vX]:"ENVMAP_BLENDING_MIX",[yX]:"ENVMAP_BLENDING_ADD"};function bL(J){if(J.envMap===!1)return"ENVMAP_BLENDING_NONE";return xL[J.combine]||"ENVMAP_BLENDING_NONE"}function hL(J){let Q=J.envMapCubeUVHeight;if(Q===null)return null;let $=Math.log2(Q)-2,Z=1/Q;return{texelWidth:1/(3*Math.max(Math.pow(2,$),112)),texelHeight:Z,maxMip:$}}function fL(J,Q,$,Z){let W=J.getContext(),Y=$.defines,X=$.vertexShader,K=$.fragmentShader,H=AL($),U=jL($),G=yL($),F=bL($),E=hL($),O=VL($),R=BL(Y),k=W.createProgram(),q,N,L=$.glslVersion?"#version "+$.glslVersion+`
4033
+ `:"";if($.isRawShaderMaterial){if(q=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R].filter(L$).join(`
4034
4034
  `),q.length>0)q+=`
4035
- `;if(N=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R].filter(Z7).join(`
4035
+ `;if(N=["#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R].filter(L$).join(`
4036
4036
  `),N.length>0)N+=`
4037
- `}else q=[zX($),"#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R,$.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",$.batching?"#define USE_BATCHING":"",$.batchingColor?"#define USE_BATCHING_COLOR":"",$.instancing?"#define USE_INSTANCING":"",$.instancingColor?"#define USE_INSTANCING_COLOR":"",$.instancingMorph?"#define USE_INSTANCING_MORPH":"",$.useFog&&$.fog?"#define USE_FOG":"",$.useFog&&$.fogExp2?"#define FOG_EXP2":"",$.map?"#define USE_MAP":"",$.envMap?"#define USE_ENVMAP":"",$.envMap?"#define "+G:"",$.lightMap?"#define USE_LIGHTMAP":"",$.aoMap?"#define USE_AOMAP":"",$.bumpMap?"#define USE_BUMPMAP":"",$.normalMap?"#define USE_NORMALMAP":"",$.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",$.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",$.displacementMap?"#define USE_DISPLACEMENTMAP":"",$.emissiveMap?"#define USE_EMISSIVEMAP":"",$.anisotropy?"#define USE_ANISOTROPY":"",$.anisotropyMap?"#define USE_ANISOTROPYMAP":"",$.clearcoatMap?"#define USE_CLEARCOATMAP":"",$.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",$.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",$.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",$.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",$.specularMap?"#define USE_SPECULARMAP":"",$.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",$.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",$.roughnessMap?"#define USE_ROUGHNESSMAP":"",$.metalnessMap?"#define USE_METALNESSMAP":"",$.alphaMap?"#define USE_ALPHAMAP":"",$.alphaHash?"#define USE_ALPHAHASH":"",$.transmission?"#define USE_TRANSMISSION":"",$.transmissionMap?"#define USE_TRANSMISSIONMAP":"",$.thicknessMap?"#define USE_THICKNESSMAP":"",$.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",$.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",$.mapUv?"#define MAP_UV "+$.mapUv:"",$.alphaMapUv?"#define ALPHAMAP_UV "+$.alphaMapUv:"",$.lightMapUv?"#define LIGHTMAP_UV "+$.lightMapUv:"",$.aoMapUv?"#define AOMAP_UV "+$.aoMapUv:"",$.emissiveMapUv?"#define EMISSIVEMAP_UV "+$.emissiveMapUv:"",$.bumpMapUv?"#define BUMPMAP_UV "+$.bumpMapUv:"",$.normalMapUv?"#define NORMALMAP_UV "+$.normalMapUv:"",$.displacementMapUv?"#define DISPLACEMENTMAP_UV "+$.displacementMapUv:"",$.metalnessMapUv?"#define METALNESSMAP_UV "+$.metalnessMapUv:"",$.roughnessMapUv?"#define ROUGHNESSMAP_UV "+$.roughnessMapUv:"",$.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+$.anisotropyMapUv:"",$.clearcoatMapUv?"#define CLEARCOATMAP_UV "+$.clearcoatMapUv:"",$.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+$.clearcoatNormalMapUv:"",$.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+$.clearcoatRoughnessMapUv:"",$.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+$.iridescenceMapUv:"",$.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+$.iridescenceThicknessMapUv:"",$.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+$.sheenColorMapUv:"",$.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+$.sheenRoughnessMapUv:"",$.specularMapUv?"#define SPECULARMAP_UV "+$.specularMapUv:"",$.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+$.specularColorMapUv:"",$.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+$.specularIntensityMapUv:"",$.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+$.transmissionMapUv:"",$.thicknessMapUv?"#define THICKNESSMAP_UV "+$.thicknessMapUv:"",$.vertexTangents&&$.flatShading===!1?"#define USE_TANGENT":"",$.vertexNormals?"#define HAS_NORMAL":"",$.vertexColors?"#define USE_COLOR":"",$.vertexAlphas?"#define USE_COLOR_ALPHA":"",$.vertexUv1s?"#define USE_UV1":"",$.vertexUv2s?"#define USE_UV2":"",$.vertexUv3s?"#define USE_UV3":"",$.pointsUvs?"#define USE_POINTS_UV":"",$.flatShading?"#define FLAT_SHADED":"",$.skinning?"#define USE_SKINNING":"",$.morphTargets?"#define USE_MORPHTARGETS":"",$.morphNormals&&$.flatShading===!1?"#define USE_MORPHNORMALS":"",$.morphColors?"#define USE_MORPHCOLORS":"",$.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+$.morphTextureStride:"",$.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+$.morphTargetsCount:"",$.doubleSided?"#define DOUBLE_SIDED":"",$.flipSided?"#define FLIP_SIDED":"",$.shadowMapEnabled?"#define USE_SHADOWMAP":"",$.shadowMapEnabled?"#define "+H:"",$.sizeAttenuation?"#define USE_SIZEATTENUATION":"",$.numLightProbes>0?"#define USE_LIGHT_PROBES":"",$.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",$.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","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif",`
4038
- `].filter(Z7).join(`
4039
- `),N=[zX($),"#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R,$.useFog&&$.fog?"#define USE_FOG":"",$.useFog&&$.fogExp2?"#define FOG_EXP2":"",$.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",$.map?"#define USE_MAP":"",$.matcap?"#define USE_MATCAP":"",$.envMap?"#define USE_ENVMAP":"",$.envMap?"#define "+U:"",$.envMap?"#define "+G:"",$.envMap?"#define "+F:"",E?"#define CUBEUV_TEXEL_WIDTH "+E.texelWidth:"",E?"#define CUBEUV_TEXEL_HEIGHT "+E.texelHeight:"",E?"#define CUBEUV_MAX_MIP "+E.maxMip+".0":"",$.lightMap?"#define USE_LIGHTMAP":"",$.aoMap?"#define USE_AOMAP":"",$.bumpMap?"#define USE_BUMPMAP":"",$.normalMap?"#define USE_NORMALMAP":"",$.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",$.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",$.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",$.emissiveMap?"#define USE_EMISSIVEMAP":"",$.anisotropy?"#define USE_ANISOTROPY":"",$.anisotropyMap?"#define USE_ANISOTROPYMAP":"",$.clearcoat?"#define USE_CLEARCOAT":"",$.clearcoatMap?"#define USE_CLEARCOATMAP":"",$.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",$.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",$.dispersion?"#define USE_DISPERSION":"",$.iridescence?"#define USE_IRIDESCENCE":"",$.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",$.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",$.specularMap?"#define USE_SPECULARMAP":"",$.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",$.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",$.roughnessMap?"#define USE_ROUGHNESSMAP":"",$.metalnessMap?"#define USE_METALNESSMAP":"",$.alphaMap?"#define USE_ALPHAMAP":"",$.alphaTest?"#define USE_ALPHATEST":"",$.alphaHash?"#define USE_ALPHAHASH":"",$.sheen?"#define USE_SHEEN":"",$.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",$.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",$.transmission?"#define USE_TRANSMISSION":"",$.transmissionMap?"#define USE_TRANSMISSIONMAP":"",$.thicknessMap?"#define USE_THICKNESSMAP":"",$.vertexTangents&&$.flatShading===!1?"#define USE_TANGENT":"",$.vertexColors||$.instancingColor?"#define USE_COLOR":"",$.vertexAlphas||$.batchingColor?"#define USE_COLOR_ALPHA":"",$.vertexUv1s?"#define USE_UV1":"",$.vertexUv2s?"#define USE_UV2":"",$.vertexUv3s?"#define USE_UV3":"",$.pointsUvs?"#define USE_POINTS_UV":"",$.gradientMap?"#define USE_GRADIENTMAP":"",$.flatShading?"#define FLAT_SHADED":"",$.doubleSided?"#define DOUBLE_SIDED":"",$.flipSided?"#define FLIP_SIDED":"",$.shadowMapEnabled?"#define USE_SHADOWMAP":"",$.shadowMapEnabled?"#define "+H:"",$.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",$.numLightProbes>0?"#define USE_LIGHT_PROBES":"",$.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",$.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",$.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",$.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",$.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",$.toneMapping!==rJ?"#define TONE_MAPPING":"",$.toneMapping!==rJ?l0.tonemapping_pars_fragment:"",$.toneMapping!==rJ?H1("toneMapping",$.toneMapping):"",$.dithering?"#define DITHERING":"",$.opaque?"#define OPAQUE":"",l0.colorspace_pars_fragment,X1("linearToOutputTexel",$.outputColorSpace),U1(),$.useDepthPacking?"#define DEPTH_PACKING "+$.depthPacking:"",`
4040
- `].filter(Z7).join(`
4041
- `);if(X=uZ(X),X=VX(X,$),X=CX(X,$),K=uZ(K),K=VX(K,$),K=CX(K,$),X=IX(X),K=IX(K),$.isRawShaderMaterial!==!0)L=`#version 300 es
4037
+ `}else q=[g5($),"#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R,$.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",$.batching?"#define USE_BATCHING":"",$.batchingColor?"#define USE_BATCHING_COLOR":"",$.instancing?"#define USE_INSTANCING":"",$.instancingColor?"#define USE_INSTANCING_COLOR":"",$.instancingMorph?"#define USE_INSTANCING_MORPH":"",$.useFog&&$.fog?"#define USE_FOG":"",$.useFog&&$.fogExp2?"#define FOG_EXP2":"",$.map?"#define USE_MAP":"",$.envMap?"#define USE_ENVMAP":"",$.envMap?"#define "+G:"",$.lightMap?"#define USE_LIGHTMAP":"",$.aoMap?"#define USE_AOMAP":"",$.bumpMap?"#define USE_BUMPMAP":"",$.normalMap?"#define USE_NORMALMAP":"",$.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",$.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",$.displacementMap?"#define USE_DISPLACEMENTMAP":"",$.emissiveMap?"#define USE_EMISSIVEMAP":"",$.anisotropy?"#define USE_ANISOTROPY":"",$.anisotropyMap?"#define USE_ANISOTROPYMAP":"",$.clearcoatMap?"#define USE_CLEARCOATMAP":"",$.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",$.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",$.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",$.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",$.specularMap?"#define USE_SPECULARMAP":"",$.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",$.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",$.roughnessMap?"#define USE_ROUGHNESSMAP":"",$.metalnessMap?"#define USE_METALNESSMAP":"",$.alphaMap?"#define USE_ALPHAMAP":"",$.alphaHash?"#define USE_ALPHAHASH":"",$.transmission?"#define USE_TRANSMISSION":"",$.transmissionMap?"#define USE_TRANSMISSIONMAP":"",$.thicknessMap?"#define USE_THICKNESSMAP":"",$.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",$.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",$.mapUv?"#define MAP_UV "+$.mapUv:"",$.alphaMapUv?"#define ALPHAMAP_UV "+$.alphaMapUv:"",$.lightMapUv?"#define LIGHTMAP_UV "+$.lightMapUv:"",$.aoMapUv?"#define AOMAP_UV "+$.aoMapUv:"",$.emissiveMapUv?"#define EMISSIVEMAP_UV "+$.emissiveMapUv:"",$.bumpMapUv?"#define BUMPMAP_UV "+$.bumpMapUv:"",$.normalMapUv?"#define NORMALMAP_UV "+$.normalMapUv:"",$.displacementMapUv?"#define DISPLACEMENTMAP_UV "+$.displacementMapUv:"",$.metalnessMapUv?"#define METALNESSMAP_UV "+$.metalnessMapUv:"",$.roughnessMapUv?"#define ROUGHNESSMAP_UV "+$.roughnessMapUv:"",$.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+$.anisotropyMapUv:"",$.clearcoatMapUv?"#define CLEARCOATMAP_UV "+$.clearcoatMapUv:"",$.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+$.clearcoatNormalMapUv:"",$.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+$.clearcoatRoughnessMapUv:"",$.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+$.iridescenceMapUv:"",$.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+$.iridescenceThicknessMapUv:"",$.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+$.sheenColorMapUv:"",$.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+$.sheenRoughnessMapUv:"",$.specularMapUv?"#define SPECULARMAP_UV "+$.specularMapUv:"",$.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+$.specularColorMapUv:"",$.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+$.specularIntensityMapUv:"",$.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+$.transmissionMapUv:"",$.thicknessMapUv?"#define THICKNESSMAP_UV "+$.thicknessMapUv:"",$.vertexTangents&&$.flatShading===!1?"#define USE_TANGENT":"",$.vertexNormals?"#define HAS_NORMAL":"",$.vertexColors?"#define USE_COLOR":"",$.vertexAlphas?"#define USE_COLOR_ALPHA":"",$.vertexUv1s?"#define USE_UV1":"",$.vertexUv2s?"#define USE_UV2":"",$.vertexUv3s?"#define USE_UV3":"",$.pointsUvs?"#define USE_POINTS_UV":"",$.flatShading?"#define FLAT_SHADED":"",$.skinning?"#define USE_SKINNING":"",$.morphTargets?"#define USE_MORPHTARGETS":"",$.morphNormals&&$.flatShading===!1?"#define USE_MORPHNORMALS":"",$.morphColors?"#define USE_MORPHCOLORS":"",$.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+$.morphTextureStride:"",$.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+$.morphTargetsCount:"",$.doubleSided?"#define DOUBLE_SIDED":"",$.flipSided?"#define FLIP_SIDED":"",$.shadowMapEnabled?"#define USE_SHADOWMAP":"",$.shadowMapEnabled?"#define "+H:"",$.sizeAttenuation?"#define USE_SIZEATTENUATION":"",$.numLightProbes>0?"#define USE_LIGHT_PROBES":"",$.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",$.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","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif",`
4038
+ `].filter(L$).join(`
4039
+ `),N=[g5($),"#define SHADER_TYPE "+$.shaderType,"#define SHADER_NAME "+$.shaderName,R,$.useFog&&$.fog?"#define USE_FOG":"",$.useFog&&$.fogExp2?"#define FOG_EXP2":"",$.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",$.map?"#define USE_MAP":"",$.matcap?"#define USE_MATCAP":"",$.envMap?"#define USE_ENVMAP":"",$.envMap?"#define "+U:"",$.envMap?"#define "+G:"",$.envMap?"#define "+F:"",E?"#define CUBEUV_TEXEL_WIDTH "+E.texelWidth:"",E?"#define CUBEUV_TEXEL_HEIGHT "+E.texelHeight:"",E?"#define CUBEUV_MAX_MIP "+E.maxMip+".0":"",$.lightMap?"#define USE_LIGHTMAP":"",$.aoMap?"#define USE_AOMAP":"",$.bumpMap?"#define USE_BUMPMAP":"",$.normalMap?"#define USE_NORMALMAP":"",$.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",$.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",$.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",$.emissiveMap?"#define USE_EMISSIVEMAP":"",$.anisotropy?"#define USE_ANISOTROPY":"",$.anisotropyMap?"#define USE_ANISOTROPYMAP":"",$.clearcoat?"#define USE_CLEARCOAT":"",$.clearcoatMap?"#define USE_CLEARCOATMAP":"",$.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",$.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",$.dispersion?"#define USE_DISPERSION":"",$.iridescence?"#define USE_IRIDESCENCE":"",$.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",$.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",$.specularMap?"#define USE_SPECULARMAP":"",$.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",$.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",$.roughnessMap?"#define USE_ROUGHNESSMAP":"",$.metalnessMap?"#define USE_METALNESSMAP":"",$.alphaMap?"#define USE_ALPHAMAP":"",$.alphaTest?"#define USE_ALPHATEST":"",$.alphaHash?"#define USE_ALPHAHASH":"",$.sheen?"#define USE_SHEEN":"",$.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",$.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",$.transmission?"#define USE_TRANSMISSION":"",$.transmissionMap?"#define USE_TRANSMISSIONMAP":"",$.thicknessMap?"#define USE_THICKNESSMAP":"",$.vertexTangents&&$.flatShading===!1?"#define USE_TANGENT":"",$.vertexColors||$.instancingColor?"#define USE_COLOR":"",$.vertexAlphas||$.batchingColor?"#define USE_COLOR_ALPHA":"",$.vertexUv1s?"#define USE_UV1":"",$.vertexUv2s?"#define USE_UV2":"",$.vertexUv3s?"#define USE_UV3":"",$.pointsUvs?"#define USE_POINTS_UV":"",$.gradientMap?"#define USE_GRADIENTMAP":"",$.flatShading?"#define FLAT_SHADED":"",$.doubleSided?"#define DOUBLE_SIDED":"",$.flipSided?"#define FLIP_SIDED":"",$.shadowMapEnabled?"#define USE_SHADOWMAP":"",$.shadowMapEnabled?"#define "+H:"",$.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",$.numLightProbes>0?"#define USE_LIGHT_PROBES":"",$.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",$.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",$.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",$.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",$.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",$.toneMapping!==E9?"#define TONE_MAPPING":"",$.toneMapping!==E9?ZJ.tonemapping_pars_fragment:"",$.toneMapping!==E9?kL("toneMapping",$.toneMapping):"",$.dithering?"#define DITHERING":"",$.opaque?"#define OPAQUE":"",ZJ.colorspace_pars_fragment,LL("linearToOutputTexel",$.outputColorSpace),ML(),$.useDepthPacking?"#define DEPTH_PACKING "+$.depthPacking:"",`
4040
+ `].filter(L$).join(`
4041
+ `);if(X=KH(X),X=b5(X,$),X=h5(X,$),K=KH(K),K=b5(K,$),K=h5(K,$),X=f5(X),K=f5(K),$.isRawShaderMaterial!==!0)L=`#version 300 es
4042
4042
  `,q=[O,"#define attribute in","#define varying out","#define texture2D texture"].join(`
4043
4043
  `)+`
4044
- `+q,N=["#define varying in",$.glslVersion===HZ?"":"layout(location = 0) out highp vec4 pc_fragColor;",$.glslVersion===HZ?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
4044
+ `+q,N=["#define varying in",$.glslVersion===GW?"":"layout(location = 0) out highp vec4 pc_fragColor;",$.glslVersion===GW?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
4045
4045
  `)+`
4046
- `+N;let M=L+q+X,k=L+N+K,_=MX(W,W.VERTEX_SHADER,M),P=MX(W,W.FRAGMENT_SHADER,k);if(W.attachShader(C,_),W.attachShader(C,P),$.index0AttributeName!==void 0)W.bindAttribLocation(C,0,$.index0AttributeName);else if($.morphTargets===!0)W.bindAttribLocation(C,0,"position");W.linkProgram(C);function V(z){if(J.debug.checkShaderErrors){let S=W.getProgramInfoLog(C)||"",y=W.getShaderInfoLog(_)||"",v=W.getShaderInfoLog(P)||"",h=S.trim(),g=y.trim(),p=v.trim(),c=!0,a=!0;if(W.getProgramParameter(C,W.LINK_STATUS)===!1)if(c=!1,typeof J.debug.onShaderError==="function")J.debug.onShaderError(W,C,_,P);else{let Q0=BX(W,_,"vertex"),H0=BX(W,P,"fragment");A0("THREE.WebGLProgram: Shader Error "+W.getError()+" - VALIDATE_STATUS "+W.getProgramParameter(C,W.VALIDATE_STATUS)+`
4046
+ `+N;let D=L+q+X,V=L+N+K,I=v5(W,W.VERTEX_SHADER,D),z=v5(W,W.FRAGMENT_SHADER,V);if(W.attachShader(k,I),W.attachShader(k,z),$.index0AttributeName!==void 0)W.bindAttribLocation(k,0,$.index0AttributeName);else if($.morphTargets===!0)W.bindAttribLocation(k,0,"position");W.linkProgram(k);function B(w){if(J.debug.checkShaderErrors){let v=W.getProgramInfoLog(k)||"",b=W.getShaderInfoLog(I)||"",S=W.getShaderInfoLog(z)||"",h=v.trim(),x=b.trim(),p=S.trim(),c=!0,o=!0;if(W.getProgramParameter(k,W.LINK_STATUS)===!1)if(c=!1,typeof J.debug.onShaderError==="function")J.debug.onShaderError(W,k,I,z);else{let W0=x5(W,I,"vertex"),H0=x5(W,z,"fragment");v0("THREE.WebGLProgram: Shader Error "+W.getError()+" - VALIDATE_STATUS "+W.getProgramParameter(k,W.VALIDATE_STATUS)+`
4047
4047
 
4048
- Material Name: `+z.name+`
4049
- Material Type: `+z.type+`
4048
+ Material Name: `+w.name+`
4049
+ Material Type: `+w.type+`
4050
4050
 
4051
4051
  Program Info Log: `+h+`
4052
- `+Q0+`
4053
- `+H0)}else if(h!=="")C0("WebGLProgram: Program Info Log:",h);else if(g===""||p==="")a=!1;if(a)z.diagnostics={runnable:c,programLog:h,vertexShader:{log:g,prefix:q},fragmentShader:{log:p,prefix:N}}}W.deleteShader(_),W.deleteShader(P),D=new W7(W,C),B=F1(W,C)}let D;this.getUniforms=function(){if(D===void 0)V(this);return D};let B;this.getAttributes=function(){if(B===void 0)V(this);return B};let A=$.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){if(A===!1)A=W.getProgramParameter(C,$1);return A},this.destroy=function(){Z.releaseStatesOfProgram(this),W.deleteProgram(C),this.program=void 0},this.type=$.shaderType,this.name=$.shaderName,this.id=Z1++,this.cacheKey=Q,this.usedTimes=1,this.program=C,this.vertexShader=_,this.fragmentShader=P,this}var _1=0;class gX{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(J){let{vertexShader:Q,fragmentShader:$}=J,Z=this._getShaderStage(Q),W=this._getShaderStage($),Y=this._getShaderCacheForMaterial(J);if(Y.has(Z)===!1)Y.add(Z),Z.usedTimes++;if(Y.has(W)===!1)Y.add(W),W.usedTimes++;return this}remove(J){let Q=this.materialCache.get(J);for(let $ of Q)if($.usedTimes--,$.usedTimes===0)this.shaderCache.delete($.code);return this.materialCache.delete(J),this}getVertexShaderID(J){return this._getShaderStage(J.vertexShader).id}getFragmentShaderID(J){return this._getShaderStage(J.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(J){let Q=this.materialCache,$=Q.get(J);if($===void 0)$=new Set,Q.set(J,$);return $}_getShaderStage(J){let Q=this.shaderCache,$=Q.get(J);if($===void 0)$=new pX(J),Q.set(J,$);return $}}class pX{constructor(J){this.id=_1++,this.code=J,this.usedTimes=0}}function T1(J){return J===P8||J===a7||J===r7}function A1(J,Q,$,Z,W,Y){let X=new $Q,K=new gX,H=new Set,U=[],G=new Map,F=Z.logarithmicDepthBuffer,E=Z.precision,O={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 R(D){if(H.add(D),D===0)return"uv";return`uv${D}`}function C(D,B,A,z,S,y){let v=z.fog,h=S.geometry,g=D.isMeshStandardMaterial||D.isMeshLambertMaterial||D.isMeshPhongMaterial?z.environment:null,p=D.isMeshStandardMaterial||D.isMeshLambertMaterial&&!D.envMap||D.isMeshPhongMaterial&&!D.envMap,c=Q.get(D.envMap||g,p),a=!!c&&c.mapping===p6?c.image.height:null,Q0=O[D.type];if(D.precision!==null){if(E=Z.getMaxPrecision(D.precision),E!==D.precision)C0("WebGLProgram.getParameters:",D.precision,"not supported, using",E,"instead.")}let H0=h.morphAttributes.position||h.morphAttributes.normal||h.morphAttributes.color,J0=H0!==void 0?H0.length:0,x0=0;if(h.morphAttributes.position!==void 0)x0=1;if(h.morphAttributes.normal!==void 0)x0=2;if(h.morphAttributes.color!==void 0)x0=3;let v0,s,Y0,D0;if(Q0){let b0=y9[Q0];v0=b0.vertexShader,s=b0.fragmentShader}else v0=D.vertexShader,s=D.fragmentShader,K.update(D),Y0=K.getVertexShaderID(D),D0=K.getFragmentShaderID(D);let G0=J.getRenderTarget(),w0=J.state.buffers.depth.getReversed(),i0=S.isInstancedMesh===!0,j0=S.isBatchedMesh===!0,d0=!!D.map,YJ=!!D.matcap,XJ=!!c,u0=!!D.aoMap,jJ=!!D.lightMap,vJ=!!D.bumpMap,CJ=!!D.normalMap,b=!!D.displacementMap,pJ=!!D.emissiveMap,a0=!!D.metalnessMap,t0=!!D.roughnessMap,O0=D.anisotropy>0,qJ=D.clearcoat>0,T0=D.dispersion>0,T=D.iridescence>0,I=D.sheen>0,d=D.transmission>0,r=O0&&!!D.anisotropyMap,t=qJ&&!!D.clearcoatMap,$0=qJ&&!!D.clearcoatNormalMap,E0=qJ&&!!D.clearcoatRoughnessMap,n=T&&!!D.iridescenceMap,o=T&&!!D.iridescenceThicknessMap,K0=I&&!!D.sheenColorMap,B0=I&&!!D.sheenRoughnessMap,W0=!!D.specularMap,F0=!!D.specularColorMap,y0=!!D.specularIntensityMap,g0=d&&!!D.transmissionMap,c0=d&&!!D.thicknessMap,x=!!D.gradientMap,X0=!!D.alphaMap,i=D.alphaTest>0,Z0=!!D.alphaHash,V0=!!D.extensions,e=rJ;if(D.toneMapped){if(G0===null||G0.isXRRenderTarget===!0)e=J.toneMapping}let z0={shaderID:Q0,shaderType:D.type,shaderName:D.name,vertexShader:v0,fragmentShader:s,defines:D.defines,customVertexShaderID:Y0,customFragmentShaderID:D0,isRawShaderMaterial:D.isRawShaderMaterial===!0,glslVersion:D.glslVersion,precision:E,batching:j0,batchingColor:j0&&S._colorsTexture!==null,instancing:i0,instancingColor:i0&&S.instanceColor!==null,instancingMorph:i0&&S.morphTexture!==null,outputColorSpace:G0===null?J.outputColorSpace:G0.isXRRenderTarget===!0?G0.texture.colorSpace:s0.workingColorSpace,alphaToCoverage:!!D.alphaToCoverage,map:d0,matcap:YJ,envMap:XJ,envMapMode:XJ&&c.mapping,envMapCubeUVHeight:a,aoMap:u0,lightMap:jJ,bumpMap:vJ,normalMap:CJ,displacementMap:b,emissiveMap:pJ,normalMapObjectSpace:CJ&&D.normalMapType===mY,normalMapTangentSpace:CJ&&D.normalMapType===XZ,packedNormalMap:CJ&&D.normalMapType===XZ&&T1(D.normalMap.format),metalnessMap:a0,roughnessMap:t0,anisotropy:O0,anisotropyMap:r,clearcoat:qJ,clearcoatMap:t,clearcoatNormalMap:$0,clearcoatRoughnessMap:E0,dispersion:T0,iridescence:T,iridescenceMap:n,iridescenceThicknessMap:o,sheen:I,sheenColorMap:K0,sheenRoughnessMap:B0,specularMap:W0,specularColorMap:F0,specularIntensityMap:y0,transmission:d,transmissionMap:g0,thicknessMap:c0,gradientMap:x,opaque:D.transparent===!1&&D.blending===V8&&D.alphaToCoverage===!1,alphaMap:X0,alphaTest:i,alphaHash:Z0,combine:D.combine,mapUv:d0&&R(D.map.channel),aoMapUv:u0&&R(D.aoMap.channel),lightMapUv:jJ&&R(D.lightMap.channel),bumpMapUv:vJ&&R(D.bumpMap.channel),normalMapUv:CJ&&R(D.normalMap.channel),displacementMapUv:b&&R(D.displacementMap.channel),emissiveMapUv:pJ&&R(D.emissiveMap.channel),metalnessMapUv:a0&&R(D.metalnessMap.channel),roughnessMapUv:t0&&R(D.roughnessMap.channel),anisotropyMapUv:r&&R(D.anisotropyMap.channel),clearcoatMapUv:t&&R(D.clearcoatMap.channel),clearcoatNormalMapUv:$0&&R(D.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:E0&&R(D.clearcoatRoughnessMap.channel),iridescenceMapUv:n&&R(D.iridescenceMap.channel),iridescenceThicknessMapUv:o&&R(D.iridescenceThicknessMap.channel),sheenColorMapUv:K0&&R(D.sheenColorMap.channel),sheenRoughnessMapUv:B0&&R(D.sheenRoughnessMap.channel),specularMapUv:W0&&R(D.specularMap.channel),specularColorMapUv:F0&&R(D.specularColorMap.channel),specularIntensityMapUv:y0&&R(D.specularIntensityMap.channel),transmissionMapUv:g0&&R(D.transmissionMap.channel),thicknessMapUv:c0&&R(D.thicknessMap.channel),alphaMapUv:X0&&R(D.alphaMap.channel),vertexTangents:!!h.attributes.tangent&&(CJ||O0),vertexNormals:!!h.attributes.normal,vertexColors:D.vertexColors,vertexAlphas:D.vertexColors===!0&&!!h.attributes.color&&h.attributes.color.itemSize===4,pointsUvs:S.isPoints===!0&&!!h.attributes.uv&&(d0||X0),fog:!!v,useFog:D.fog===!0,fogExp2:!!v&&v.isFogExp2,flatShading:D.wireframe===!1&&(D.flatShading===!0||h.attributes.normal===void 0&&CJ===!1&&(D.isMeshLambertMaterial||D.isMeshPhongMaterial||D.isMeshStandardMaterial||D.isMeshPhysicalMaterial)),sizeAttenuation:D.sizeAttenuation===!0,logarithmicDepthBuffer:F,reversedDepthBuffer:w0,skinning:S.isSkinnedMesh===!0,morphTargets:h.morphAttributes.position!==void 0,morphNormals:h.morphAttributes.normal!==void 0,morphColors:h.morphAttributes.color!==void 0,morphTargetsCount:J0,morphTextureStride:x0,numDirLights:B.directional.length,numPointLights:B.point.length,numSpotLights:B.spot.length,numSpotLightMaps:B.spotLightMap.length,numRectAreaLights:B.rectArea.length,numHemiLights:B.hemi.length,numDirLightShadows:B.directionalShadowMap.length,numPointLightShadows:B.pointShadowMap.length,numSpotLightShadows:B.spotShadowMap.length,numSpotLightShadowsWithMaps:B.numSpotLightShadowsWithMaps,numLightProbes:B.numLightProbes,numLightProbeGrids:y.length,numClippingPlanes:Y.numPlanes,numClipIntersection:Y.numIntersection,dithering:D.dithering,shadowMapEnabled:J.shadowMap.enabled&&A.length>0,shadowMapType:J.shadowMap.type,toneMapping:e,decodeVideoTexture:d0&&D.map.isVideoTexture===!0&&s0.getTransfer(D.map.colorSpace)===UJ,decodeVideoTextureEmissive:pJ&&D.emissiveMap.isVideoTexture===!0&&s0.getTransfer(D.emissiveMap.colorSpace)===UJ,premultipliedAlpha:D.premultipliedAlpha,doubleSided:D.side===cJ,flipSided:D.side===bJ,useDepthPacking:D.depthPacking>=0,depthPacking:D.depthPacking||0,index0AttributeName:D.index0AttributeName,extensionClipCullDistance:V0&&D.extensions.clipCullDistance===!0&&$.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(V0&&D.extensions.multiDraw===!0||j0)&&$.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:$.has("KHR_parallel_shader_compile"),customProgramCacheKey:D.customProgramCacheKey()};return z0.vertexUv1s=H.has(1),z0.vertexUv2s=H.has(2),z0.vertexUv3s=H.has(3),H.clear(),z0}function q(D){let B=[];if(D.shaderID)B.push(D.shaderID);else B.push(D.customVertexShaderID),B.push(D.customFragmentShaderID);if(D.defines!==void 0)for(let A in D.defines)B.push(A),B.push(D.defines[A]);if(D.isRawShaderMaterial===!1)N(B,D),L(B,D),B.push(J.outputColorSpace);return B.push(D.customProgramCacheKey),B.join()}function N(D,B){D.push(B.precision),D.push(B.outputColorSpace),D.push(B.envMapMode),D.push(B.envMapCubeUVHeight),D.push(B.mapUv),D.push(B.alphaMapUv),D.push(B.lightMapUv),D.push(B.aoMapUv),D.push(B.bumpMapUv),D.push(B.normalMapUv),D.push(B.displacementMapUv),D.push(B.emissiveMapUv),D.push(B.metalnessMapUv),D.push(B.roughnessMapUv),D.push(B.anisotropyMapUv),D.push(B.clearcoatMapUv),D.push(B.clearcoatNormalMapUv),D.push(B.clearcoatRoughnessMapUv),D.push(B.iridescenceMapUv),D.push(B.iridescenceThicknessMapUv),D.push(B.sheenColorMapUv),D.push(B.sheenRoughnessMapUv),D.push(B.specularMapUv),D.push(B.specularColorMapUv),D.push(B.specularIntensityMapUv),D.push(B.transmissionMapUv),D.push(B.thicknessMapUv),D.push(B.combine),D.push(B.fogExp2),D.push(B.sizeAttenuation),D.push(B.morphTargetsCount),D.push(B.morphAttributeCount),D.push(B.numDirLights),D.push(B.numPointLights),D.push(B.numSpotLights),D.push(B.numSpotLightMaps),D.push(B.numHemiLights),D.push(B.numRectAreaLights),D.push(B.numDirLightShadows),D.push(B.numPointLightShadows),D.push(B.numSpotLightShadows),D.push(B.numSpotLightShadowsWithMaps),D.push(B.numLightProbes),D.push(B.shadowMapType),D.push(B.toneMapping),D.push(B.numClippingPlanes),D.push(B.numClipIntersection),D.push(B.depthPacking)}function L(D,B){if(X.disableAll(),B.instancing)X.enable(0);if(B.instancingColor)X.enable(1);if(B.instancingMorph)X.enable(2);if(B.matcap)X.enable(3);if(B.envMap)X.enable(4);if(B.normalMapObjectSpace)X.enable(5);if(B.normalMapTangentSpace)X.enable(6);if(B.clearcoat)X.enable(7);if(B.iridescence)X.enable(8);if(B.alphaTest)X.enable(9);if(B.vertexColors)X.enable(10);if(B.vertexAlphas)X.enable(11);if(B.vertexUv1s)X.enable(12);if(B.vertexUv2s)X.enable(13);if(B.vertexUv3s)X.enable(14);if(B.vertexTangents)X.enable(15);if(B.anisotropy)X.enable(16);if(B.alphaHash)X.enable(17);if(B.batching)X.enable(18);if(B.dispersion)X.enable(19);if(B.batchingColor)X.enable(20);if(B.gradientMap)X.enable(21);if(B.packedNormalMap)X.enable(22);if(B.vertexNormals)X.enable(23);if(D.push(X.mask),X.disableAll(),B.fog)X.enable(0);if(B.useFog)X.enable(1);if(B.flatShading)X.enable(2);if(B.logarithmicDepthBuffer)X.enable(3);if(B.reversedDepthBuffer)X.enable(4);if(B.skinning)X.enable(5);if(B.morphTargets)X.enable(6);if(B.morphNormals)X.enable(7);if(B.morphColors)X.enable(8);if(B.premultipliedAlpha)X.enable(9);if(B.shadowMapEnabled)X.enable(10);if(B.doubleSided)X.enable(11);if(B.flipSided)X.enable(12);if(B.useDepthPacking)X.enable(13);if(B.dithering)X.enable(14);if(B.transmission)X.enable(15);if(B.sheen)X.enable(16);if(B.opaque)X.enable(17);if(B.pointsUvs)X.enable(18);if(B.decodeVideoTexture)X.enable(19);if(B.decodeVideoTextureEmissive)X.enable(20);if(B.alphaToCoverage)X.enable(21);if(B.numLightProbeGrids>0)X.enable(22);D.push(X.mask)}function M(D){let B=O[D.type],A;if(B){let z=y9[B];A=j8.clone(z.uniforms)}else A=D.uniforms;return A}function k(D,B){let A=G.get(B);if(A!==void 0)++A.usedTimes;else A=new P1(J,B,D,W),U.push(A),G.set(B,A);return A}function _(D){if(--D.usedTimes===0){let B=U.indexOf(D);U[B]=U[U.length-1],U.pop(),G.delete(D.cacheKey),D.destroy()}}function P(D){K.remove(D)}function V(){K.dispose()}return{getParameters:C,getProgramCacheKey:q,getUniforms:M,acquireProgram:k,releaseProgram:_,releaseShaderCache:P,programs:U,dispose:V}}function S1(){let J=new WeakMap;function Q(X){return J.has(X)}function $(X){let K=J.get(X);if(K===void 0)K={},J.set(X,K);return K}function Z(X){J.delete(X)}function W(X,K,H){J.get(X)[K]=H}function Y(){J=new WeakMap}return{has:Q,get:$,remove:Z,update:W,dispose:Y}}function j1(J,Q){if(J.groupOrder!==Q.groupOrder)return J.groupOrder-Q.groupOrder;else if(J.renderOrder!==Q.renderOrder)return J.renderOrder-Q.renderOrder;else if(J.material.id!==Q.material.id)return J.material.id-Q.material.id;else if(J.materialVariant!==Q.materialVariant)return J.materialVariant-Q.materialVariant;else if(J.z!==Q.z)return J.z-Q.z;else return J.id-Q.id}function wX(J,Q){if(J.groupOrder!==Q.groupOrder)return J.groupOrder-Q.groupOrder;else if(J.renderOrder!==Q.renderOrder)return J.renderOrder-Q.renderOrder;else if(J.z!==Q.z)return Q.z-J.z;else return J.id-Q.id}function PX(){let J=[],Q=0,$=[],Z=[],W=[];function Y(){Q=0,$.length=0,Z.length=0,W.length=0}function X(E){let O=0;if(E.isInstancedMesh)O+=2;if(E.isSkinnedMesh)O+=1;return O}function K(E,O,R,C,q,N){let L=J[Q];if(L===void 0)L={id:E.id,object:E,geometry:O,material:R,materialVariant:X(E),groupOrder:C,renderOrder:E.renderOrder,z:q,group:N},J[Q]=L;else L.id=E.id,L.object=E,L.geometry=O,L.material=R,L.materialVariant=X(E),L.groupOrder=C,L.renderOrder=E.renderOrder,L.z=q,L.group=N;return Q++,L}function H(E,O,R,C,q,N){let L=K(E,O,R,C,q,N);if(R.transmission>0)Z.push(L);else if(R.transparent===!0)W.push(L);else $.push(L)}function U(E,O,R,C,q,N){let L=K(E,O,R,C,q,N);if(R.transmission>0)Z.unshift(L);else if(R.transparent===!0)W.unshift(L);else $.unshift(L)}function G(E,O){if($.length>1)$.sort(E||j1);if(Z.length>1)Z.sort(O||wX);if(W.length>1)W.sort(O||wX)}function F(){for(let E=Q,O=J.length;E<O;E++){let R=J[E];if(R.id===null)break;R.id=null,R.object=null,R.geometry=null,R.material=null,R.group=null}}return{opaque:$,transmissive:Z,transparent:W,init:Y,push:H,unshift:U,finish:F,sort:G}}function v1(){let J=new WeakMap;function Q(Z,W){let Y=J.get(Z),X;if(Y===void 0)X=new PX,J.set(Z,[X]);else if(W>=Y.length)X=new PX,Y.push(X);else X=Y[W];return X}function $(){J=new WeakMap}return{get:Q,dispose:$}}function y1(){let J={};return{get:function(Q){if(J[Q.id]!==void 0)return J[Q.id];let $;switch(Q.type){case"DirectionalLight":$={direction:new j,color:new R0};break;case"SpotLight":$={position:new j,direction:new j,color:new R0,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":$={position:new j,color:new R0,distance:0,decay:0};break;case"HemisphereLight":$={direction:new j,skyColor:new R0,groundColor:new R0};break;case"RectAreaLight":$={color:new R0,position:new j,halfWidth:new j,halfHeight:new j};break}return J[Q.id]=$,$}}}function h1(){let J={};return{get:function(Q){if(J[Q.id]!==void 0)return J[Q.id];let $;switch(Q.type){case"DirectionalLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new p0};break;case"SpotLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new p0};break;case"PointLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new p0,shadowCameraNear:1,shadowCameraFar:1000};break}return J[Q.id]=$,$}}}var x1=0;function b1(J,Q){return(Q.castShadow?2:0)-(J.castShadow?2:0)+(Q.map?1:0)-(J.map?1:0)}function f1(J){let Q=new y1,$=h1(),Z={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 U=0;U<9;U++)Z.probe.push(new j);let W=new j,Y=new S0,X=new S0;function K(U){let G=0,F=0,E=0;for(let B=0;B<9;B++)Z.probe[B].set(0,0,0);let O=0,R=0,C=0,q=0,N=0,L=0,M=0,k=0,_=0,P=0,V=0;U.sort(b1);for(let B=0,A=U.length;B<A;B++){let z=U[B],S=z.color,y=z.intensity,v=z.distance,h=null;if(z.shadow&&z.shadow.map)if(z.shadow.map.texture.format===P8)h=z.shadow.map.texture;else h=z.shadow.map.depthTexture||z.shadow.map.texture;if(z.isAmbientLight)G+=S.r*y,F+=S.g*y,E+=S.b*y;else if(z.isLightProbe){for(let g=0;g<9;g++)Z.probe[g].addScaledVector(z.sh.coefficients[g],y);V++}else if(z.isDirectionalLight){let g=Q.get(z);if(g.color.copy(z.color).multiplyScalar(z.intensity),z.castShadow){let p=z.shadow,c=$.get(z);c.shadowIntensity=p.intensity,c.shadowBias=p.bias,c.shadowNormalBias=p.normalBias,c.shadowRadius=p.radius,c.shadowMapSize=p.mapSize,Z.directionalShadow[O]=c,Z.directionalShadowMap[O]=h,Z.directionalShadowMatrix[O]=z.shadow.matrix,L++}Z.directional[O]=g,O++}else if(z.isSpotLight){let g=Q.get(z);g.position.setFromMatrixPosition(z.matrixWorld),g.color.copy(S).multiplyScalar(y),g.distance=v,g.coneCos=Math.cos(z.angle),g.penumbraCos=Math.cos(z.angle*(1-z.penumbra)),g.decay=z.decay,Z.spot[C]=g;let p=z.shadow;if(z.map){if(Z.spotLightMap[_]=z.map,_++,p.updateMatrices(z),z.castShadow)P++}if(Z.spotLightMatrix[C]=p.matrix,z.castShadow){let c=$.get(z);c.shadowIntensity=p.intensity,c.shadowBias=p.bias,c.shadowNormalBias=p.normalBias,c.shadowRadius=p.radius,c.shadowMapSize=p.mapSize,Z.spotShadow[C]=c,Z.spotShadowMap[C]=h,k++}C++}else if(z.isRectAreaLight){let g=Q.get(z);g.color.copy(S).multiplyScalar(y),g.halfWidth.set(z.width*0.5,0,0),g.halfHeight.set(0,z.height*0.5,0),Z.rectArea[q]=g,q++}else if(z.isPointLight){let g=Q.get(z);if(g.color.copy(z.color).multiplyScalar(z.intensity),g.distance=z.distance,g.decay=z.decay,z.castShadow){let p=z.shadow,c=$.get(z);c.shadowIntensity=p.intensity,c.shadowBias=p.bias,c.shadowNormalBias=p.normalBias,c.shadowRadius=p.radius,c.shadowMapSize=p.mapSize,c.shadowCameraNear=p.camera.near,c.shadowCameraFar=p.camera.far,Z.pointShadow[R]=c,Z.pointShadowMap[R]=h,Z.pointShadowMatrix[R]=z.shadow.matrix,M++}Z.point[R]=g,R++}else if(z.isHemisphereLight){let g=Q.get(z);g.skyColor.copy(z.color).multiplyScalar(y),g.groundColor.copy(z.groundColor).multiplyScalar(y),Z.hemi[N]=g,N++}}if(q>0)if(J.has("OES_texture_float_linear")===!0)Z.rectAreaLTC1=U0.LTC_FLOAT_1,Z.rectAreaLTC2=U0.LTC_FLOAT_2;else Z.rectAreaLTC1=U0.LTC_HALF_1,Z.rectAreaLTC2=U0.LTC_HALF_2;Z.ambient[0]=G,Z.ambient[1]=F,Z.ambient[2]=E;let D=Z.hash;if(D.directionalLength!==O||D.pointLength!==R||D.spotLength!==C||D.rectAreaLength!==q||D.hemiLength!==N||D.numDirectionalShadows!==L||D.numPointShadows!==M||D.numSpotShadows!==k||D.numSpotMaps!==_||D.numLightProbes!==V)Z.directional.length=O,Z.spot.length=C,Z.rectArea.length=q,Z.point.length=R,Z.hemi.length=N,Z.directionalShadow.length=L,Z.directionalShadowMap.length=L,Z.pointShadow.length=M,Z.pointShadowMap.length=M,Z.spotShadow.length=k,Z.spotShadowMap.length=k,Z.directionalShadowMatrix.length=L,Z.pointShadowMatrix.length=M,Z.spotLightMatrix.length=k+_-P,Z.spotLightMap.length=_,Z.numSpotLightShadowsWithMaps=P,Z.numLightProbes=V,D.directionalLength=O,D.pointLength=R,D.spotLength=C,D.rectAreaLength=q,D.hemiLength=N,D.numDirectionalShadows=L,D.numPointShadows=M,D.numSpotShadows=k,D.numSpotMaps=_,D.numLightProbes=V,Z.version=x1++}function H(U,G){let F=0,E=0,O=0,R=0,C=0,q=G.matrixWorldInverse;for(let N=0,L=U.length;N<L;N++){let M=U[N];if(M.isDirectionalLight){let k=Z.directional[F];k.direction.setFromMatrixPosition(M.matrixWorld),W.setFromMatrixPosition(M.target.matrixWorld),k.direction.sub(W),k.direction.transformDirection(q),F++}else if(M.isSpotLight){let k=Z.spot[O];k.position.setFromMatrixPosition(M.matrixWorld),k.position.applyMatrix4(q),k.direction.setFromMatrixPosition(M.matrixWorld),W.setFromMatrixPosition(M.target.matrixWorld),k.direction.sub(W),k.direction.transformDirection(q),O++}else if(M.isRectAreaLight){let k=Z.rectArea[R];k.position.setFromMatrixPosition(M.matrixWorld),k.position.applyMatrix4(q),X.identity(),Y.copy(M.matrixWorld),Y.premultiply(q),X.extractRotation(Y),k.halfWidth.set(M.width*0.5,0,0),k.halfHeight.set(0,M.height*0.5,0),k.halfWidth.applyMatrix4(X),k.halfHeight.applyMatrix4(X),R++}else if(M.isPointLight){let k=Z.point[E];k.position.setFromMatrixPosition(M.matrixWorld),k.position.applyMatrix4(q),E++}else if(M.isHemisphereLight){let k=Z.hemi[C];k.direction.setFromMatrixPosition(M.matrixWorld),k.direction.transformDirection(q),C++}}}return{setup:K,setupView:H,state:Z}}function _X(J){let Q=new f1(J),$=[],Z=[],W=[];function Y(E){F.camera=E,$.length=0,Z.length=0,W.length=0}function X(E){$.push(E)}function K(E){Z.push(E)}function H(E){W.push(E)}function U(){Q.setup($)}function G(E){Q.setupView($,E)}let F={lightsArray:$,shadowsArray:Z,lightProbeGridArray:W,camera:null,lights:Q,transmissionRenderTarget:{},textureUnits:0};return{init:Y,state:F,setupLights:U,setupLightsView:G,pushLight:X,pushShadow:K,pushLightProbeGrid:H}}function g1(J){let Q=new WeakMap;function $(W,Y=0){let X=Q.get(W),K;if(X===void 0)K=new _X(J),Q.set(W,[K]);else if(Y>=X.length)K=new _X(J),X.push(K);else K=X[Y];return K}function Z(){Q=new WeakMap}return{get:$,dispose:Z}}var p1=`void main() {
4052
+ `+W0+`
4053
+ `+H0)}else if(h!=="")O0("WebGLProgram: Program Info Log:",h);else if(x===""||p==="")o=!1;if(o)w.diagnostics={runnable:c,programLog:h,vertexShader:{log:x,prefix:q},fragmentShader:{log:p,prefix:N}}}W.deleteShader(I),W.deleteShader(z),M=new D$(W,k),C=CL(W,k)}let M;this.getUniforms=function(){if(M===void 0)B(this);return M};let C;this.getAttributes=function(){if(C===void 0)B(this);return C};let j=$.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){if(j===!1)j=W.getProgramParameter(k,NL);return j},this.destroy=function(){Z.releaseStatesOfProgram(this),W.deleteProgram(k),this.program=void 0},this.type=$.shaderType,this.name=$.shaderName,this.id=OL++,this.cacheKey=Q,this.usedTimes=1,this.program=k,this.vertexShader=I,this.fragmentShader=z,this}var gL=0;class e5{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(J){let{vertexShader:Q,fragmentShader:$}=J,Z=this._getShaderStage(Q),W=this._getShaderStage($),Y=this._getShaderCacheForMaterial(J);if(Y.has(Z)===!1)Y.add(Z),Z.usedTimes++;if(Y.has(W)===!1)Y.add(W),W.usedTimes++;return this}remove(J){let Q=this.materialCache.get(J);for(let $ of Q)if($.usedTimes--,$.usedTimes===0)this.shaderCache.delete($.code);return this.materialCache.delete(J),this}getVertexShaderID(J){return this._getShaderStage(J.vertexShader).id}getFragmentShaderID(J){return this._getShaderStage(J.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(J){let Q=this.materialCache,$=Q.get(J);if($===void 0)$=new Set,Q.set(J,$);return $}_getShaderStage(J){let Q=this.shaderCache,$=Q.get(J);if($===void 0)$=new JE(J),Q.set(J,$);return $}}class JE{constructor(J){this.id=gL++,this.code=J,this.usedTimes=0}}function pL(J){return J===a8||J===AQ||J===SQ}function uL(J,Q,$,Z,W,Y){let X=new x7,K=new e5,H=new Set,U=[],G=new Map,F=Z.logarithmicDepthBuffer,E=Z.precision,O={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 R(M){if(H.add(M),M===0)return"uv";return`uv${M}`}function k(M,C,j,w,v,b){let S=w.fog,h=v.geometry,x=M.isMeshStandardMaterial||M.isMeshLambertMaterial||M.isMeshPhongMaterial?w.environment:null,p=M.isMeshStandardMaterial||M.isMeshLambertMaterial&&!M.envMap||M.isMeshPhongMaterial&&!M.envMap,c=Q.get(M.envMap||x,p),o=!!c&&c.mapping===A7?c.image.height:null,W0=O[M.type];if(M.precision!==null){if(E=Z.getMaxPrecision(M.precision),E!==M.precision)O0("WebGLProgram.getParameters:",M.precision,"not supported, using",E,"instead.")}let H0=h.morphAttributes.position||h.morphAttributes.normal||h.morphAttributes.color,J0=H0!==void 0?H0.length:0,c0=0;if(h.morphAttributes.position!==void 0)c0=1;if(h.morphAttributes.normal!==void 0)c0=2;if(h.morphAttributes.color!==void 0)c0=3;let d0,s,F0,z0;if(W0){let e0=r9[W0];d0=e0.vertexShader,s=e0.fragmentShader}else d0=M.vertexShader,s=M.fragmentShader,K.update(M),F0=K.getVertexShaderID(M),z0=K.getFragmentShaderID(M);let E0=J.getRenderTarget(),j0=J.state.buffers.depth.getReversed(),WJ=v.isInstancedMesh===!0,x0=v.isBatchedMesh===!0,n0=!!M.map,Q0=!!M.matcap,X0=!!c,$0=!!M.aoMap,_0=!!M.lightMap,C0=!!M.bumpMap,m0=!!M.normalMap,y=!!M.displacementMap,YJ=!!M.emissiveMap,h0=!!M.metalnessMap,l0=!!M.roughnessMap,U0=M.anisotropy>0,NJ=M.clearcoat>0,T0=M.dispersion>0,A=M.iridescence>0,_=M.sheen>0,u=M.transmission>0,r=U0&&!!M.anisotropyMap,Z0=NJ&&!!M.clearcoatMap,K0=NJ&&!!M.clearcoatNormalMap,D0=NJ&&!!M.clearcoatRoughnessMap,n=A&&!!M.iridescenceMap,t=A&&!!M.iridescenceThicknessMap,R0=_&&!!M.sheenColorMap,A0=_&&!!M.sheenRoughnessMap,N0=!!M.specularMap,k0=!!M.specularColorMap,r0=!!M.specularIntensityMap,$J=u&&!!M.transmissionMap,XJ=u&&!!M.thicknessMap,f=!!M.gradientMap,q0=!!M.alphaMap,a=M.alphaTest>0,G0=!!M.alphaHash,S0=!!M.extensions,Y0=E9;if(M.toneMapped){if(E0===null||E0.isXRRenderTarget===!0)Y0=J.toneMapping}let f0={shaderID:W0,shaderType:M.type,shaderName:M.name,vertexShader:d0,fragmentShader:s,defines:M.defines,customVertexShaderID:F0,customFragmentShaderID:z0,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:E,batching:x0,batchingColor:x0&&v._colorsTexture!==null,instancing:WJ,instancingColor:WJ&&v.instanceColor!==null,instancingMorph:WJ&&v.morphTexture!==null,outputColorSpace:E0===null?J.outputColorSpace:E0.isXRRenderTarget===!0?E0.texture.colorSpace:t0.workingColorSpace,alphaToCoverage:!!M.alphaToCoverage,map:n0,matcap:Q0,envMap:X0,envMapMode:X0&&c.mapping,envMapCubeUVHeight:o,aoMap:$0,lightMap:_0,bumpMap:C0,normalMap:m0,displacementMap:y,emissiveMap:YJ,normalMapObjectSpace:m0&&M.normalMapType===dX,normalMapTangentSpace:m0&&M.normalMapType===HW,packedNormalMap:m0&&M.normalMapType===HW&&pL(M.normalMap.format),metalnessMap:h0,roughnessMap:l0,anisotropy:U0,anisotropyMap:r,clearcoat:NJ,clearcoatMap:Z0,clearcoatNormalMap:K0,clearcoatRoughnessMap:D0,dispersion:T0,iridescence:A,iridescenceMap:n,iridescenceThicknessMap:t,sheen:_,sheenColorMap:R0,sheenRoughnessMap:A0,specularMap:N0,specularColorMap:k0,specularIntensityMap:r0,transmission:u,transmissionMap:$J,thicknessMap:XJ,gradientMap:f,opaque:M.transparent===!1&&M.blending===m8&&M.alphaToCoverage===!1,alphaMap:q0,alphaTest:a,alphaHash:G0,combine:M.combine,mapUv:n0&&R(M.map.channel),aoMapUv:$0&&R(M.aoMap.channel),lightMapUv:_0&&R(M.lightMap.channel),bumpMapUv:C0&&R(M.bumpMap.channel),normalMapUv:m0&&R(M.normalMap.channel),displacementMapUv:y&&R(M.displacementMap.channel),emissiveMapUv:YJ&&R(M.emissiveMap.channel),metalnessMapUv:h0&&R(M.metalnessMap.channel),roughnessMapUv:l0&&R(M.roughnessMap.channel),anisotropyMapUv:r&&R(M.anisotropyMap.channel),clearcoatMapUv:Z0&&R(M.clearcoatMap.channel),clearcoatNormalMapUv:K0&&R(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:D0&&R(M.clearcoatRoughnessMap.channel),iridescenceMapUv:n&&R(M.iridescenceMap.channel),iridescenceThicknessMapUv:t&&R(M.iridescenceThicknessMap.channel),sheenColorMapUv:R0&&R(M.sheenColorMap.channel),sheenRoughnessMapUv:A0&&R(M.sheenRoughnessMap.channel),specularMapUv:N0&&R(M.specularMap.channel),specularColorMapUv:k0&&R(M.specularColorMap.channel),specularIntensityMapUv:r0&&R(M.specularIntensityMap.channel),transmissionMapUv:$J&&R(M.transmissionMap.channel),thicknessMapUv:XJ&&R(M.thicknessMap.channel),alphaMapUv:q0&&R(M.alphaMap.channel),vertexTangents:!!h.attributes.tangent&&(m0||U0),vertexNormals:!!h.attributes.normal,vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!h.attributes.color&&h.attributes.color.itemSize===4,pointsUvs:v.isPoints===!0&&!!h.attributes.uv&&(n0||q0),fog:!!S,useFog:M.fog===!0,fogExp2:!!S&&S.isFogExp2,flatShading:M.wireframe===!1&&(M.flatShading===!0||h.attributes.normal===void 0&&m0===!1&&(M.isMeshLambertMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isMeshPhysicalMaterial)),sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:F,reversedDepthBuffer:j0,skinning:v.isSkinnedMesh===!0,morphTargets:h.morphAttributes.position!==void 0,morphNormals:h.morphAttributes.normal!==void 0,morphColors:h.morphAttributes.color!==void 0,morphTargetsCount:J0,morphTextureStride:c0,numDirLights:C.directional.length,numPointLights:C.point.length,numSpotLights:C.spot.length,numSpotLightMaps:C.spotLightMap.length,numRectAreaLights:C.rectArea.length,numHemiLights:C.hemi.length,numDirLightShadows:C.directionalShadowMap.length,numPointLightShadows:C.pointShadowMap.length,numSpotLightShadows:C.spotShadowMap.length,numSpotLightShadowsWithMaps:C.numSpotLightShadowsWithMaps,numLightProbes:C.numLightProbes,numLightProbeGrids:b.length,numClippingPlanes:Y.numPlanes,numClipIntersection:Y.numIntersection,dithering:M.dithering,shadowMapEnabled:J.shadowMap.enabled&&j.length>0,shadowMapType:J.shadowMap.type,toneMapping:Y0,decodeVideoTexture:n0&&M.map.isVideoTexture===!0&&t0.getTransfer(M.map.colorSpace)===OJ,decodeVideoTextureEmissive:YJ&&M.emissiveMap.isVideoTexture===!0&&t0.getTransfer(M.emissiveMap.colorSpace)===OJ,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===Y9,flipSided:M.side===pJ,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionClipCullDistance:S0&&M.extensions.clipCullDistance===!0&&$.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(S0&&M.extensions.multiDraw===!0||x0)&&$.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:$.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()};return f0.vertexUv1s=H.has(1),f0.vertexUv2s=H.has(2),f0.vertexUv3s=H.has(3),H.clear(),f0}function q(M){let C=[];if(M.shaderID)C.push(M.shaderID);else C.push(M.customVertexShaderID),C.push(M.customFragmentShaderID);if(M.defines!==void 0)for(let j in M.defines)C.push(j),C.push(M.defines[j]);if(M.isRawShaderMaterial===!1)N(C,M),L(C,M),C.push(J.outputColorSpace);return C.push(M.customProgramCacheKey),C.join()}function N(M,C){M.push(C.precision),M.push(C.outputColorSpace),M.push(C.envMapMode),M.push(C.envMapCubeUVHeight),M.push(C.mapUv),M.push(C.alphaMapUv),M.push(C.lightMapUv),M.push(C.aoMapUv),M.push(C.bumpMapUv),M.push(C.normalMapUv),M.push(C.displacementMapUv),M.push(C.emissiveMapUv),M.push(C.metalnessMapUv),M.push(C.roughnessMapUv),M.push(C.anisotropyMapUv),M.push(C.clearcoatMapUv),M.push(C.clearcoatNormalMapUv),M.push(C.clearcoatRoughnessMapUv),M.push(C.iridescenceMapUv),M.push(C.iridescenceThicknessMapUv),M.push(C.sheenColorMapUv),M.push(C.sheenRoughnessMapUv),M.push(C.specularMapUv),M.push(C.specularColorMapUv),M.push(C.specularIntensityMapUv),M.push(C.transmissionMapUv),M.push(C.thicknessMapUv),M.push(C.combine),M.push(C.fogExp2),M.push(C.sizeAttenuation),M.push(C.morphTargetsCount),M.push(C.morphAttributeCount),M.push(C.numDirLights),M.push(C.numPointLights),M.push(C.numSpotLights),M.push(C.numSpotLightMaps),M.push(C.numHemiLights),M.push(C.numRectAreaLights),M.push(C.numDirLightShadows),M.push(C.numPointLightShadows),M.push(C.numSpotLightShadows),M.push(C.numSpotLightShadowsWithMaps),M.push(C.numLightProbes),M.push(C.shadowMapType),M.push(C.toneMapping),M.push(C.numClippingPlanes),M.push(C.numClipIntersection),M.push(C.depthPacking)}function L(M,C){if(X.disableAll(),C.instancing)X.enable(0);if(C.instancingColor)X.enable(1);if(C.instancingMorph)X.enable(2);if(C.matcap)X.enable(3);if(C.envMap)X.enable(4);if(C.normalMapObjectSpace)X.enable(5);if(C.normalMapTangentSpace)X.enable(6);if(C.clearcoat)X.enable(7);if(C.iridescence)X.enable(8);if(C.alphaTest)X.enable(9);if(C.vertexColors)X.enable(10);if(C.vertexAlphas)X.enable(11);if(C.vertexUv1s)X.enable(12);if(C.vertexUv2s)X.enable(13);if(C.vertexUv3s)X.enable(14);if(C.vertexTangents)X.enable(15);if(C.anisotropy)X.enable(16);if(C.alphaHash)X.enable(17);if(C.batching)X.enable(18);if(C.dispersion)X.enable(19);if(C.batchingColor)X.enable(20);if(C.gradientMap)X.enable(21);if(C.packedNormalMap)X.enable(22);if(C.vertexNormals)X.enable(23);if(M.push(X.mask),X.disableAll(),C.fog)X.enable(0);if(C.useFog)X.enable(1);if(C.flatShading)X.enable(2);if(C.logarithmicDepthBuffer)X.enable(3);if(C.reversedDepthBuffer)X.enable(4);if(C.skinning)X.enable(5);if(C.morphTargets)X.enable(6);if(C.morphNormals)X.enable(7);if(C.morphColors)X.enable(8);if(C.premultipliedAlpha)X.enable(9);if(C.shadowMapEnabled)X.enable(10);if(C.doubleSided)X.enable(11);if(C.flipSided)X.enable(12);if(C.useDepthPacking)X.enable(13);if(C.dithering)X.enable(14);if(C.transmission)X.enable(15);if(C.sheen)X.enable(16);if(C.opaque)X.enable(17);if(C.pointsUvs)X.enable(18);if(C.decodeVideoTexture)X.enable(19);if(C.decodeVideoTextureEmissive)X.enable(20);if(C.alphaToCoverage)X.enable(21);if(C.numLightProbeGrids>0)X.enable(22);M.push(X.mask)}function D(M){let C=O[M.type],j;if(C){let w=r9[C];j=X9.clone(w.uniforms)}else j=M.uniforms;return j}function V(M,C){let j=G.get(C);if(j!==void 0)++j.usedTimes;else j=new fL(J,C,M,W),U.push(j),G.set(C,j);return j}function I(M){if(--M.usedTimes===0){let C=U.indexOf(M);U[C]=U[U.length-1],U.pop(),G.delete(M.cacheKey),M.destroy()}}function z(M){K.remove(M)}function B(){K.dispose()}return{getParameters:k,getProgramCacheKey:q,getUniforms:D,acquireProgram:V,releaseProgram:I,releaseShaderCache:z,programs:U,dispose:B}}function dL(){let J=new WeakMap;function Q(X){return J.has(X)}function $(X){let K=J.get(X);if(K===void 0)K={},J.set(X,K);return K}function Z(X){J.delete(X)}function W(X,K,H){J.get(X)[K]=H}function Y(){J=new WeakMap}return{has:Q,get:$,remove:Z,update:W,dispose:Y}}function mL(J,Q){if(J.groupOrder!==Q.groupOrder)return J.groupOrder-Q.groupOrder;else if(J.renderOrder!==Q.renderOrder)return J.renderOrder-Q.renderOrder;else if(J.material.id!==Q.material.id)return J.material.id-Q.material.id;else if(J.materialVariant!==Q.materialVariant)return J.materialVariant-Q.materialVariant;else if(J.z!==Q.z)return J.z-Q.z;else return J.id-Q.id}function p5(J,Q){if(J.groupOrder!==Q.groupOrder)return J.groupOrder-Q.groupOrder;else if(J.renderOrder!==Q.renderOrder)return J.renderOrder-Q.renderOrder;else if(J.z!==Q.z)return Q.z-J.z;else return J.id-Q.id}function u5(){let J=[],Q=0,$=[],Z=[],W=[];function Y(){Q=0,$.length=0,Z.length=0,W.length=0}function X(E){let O=0;if(E.isInstancedMesh)O+=2;if(E.isSkinnedMesh)O+=1;return O}function K(E,O,R,k,q,N){let L=J[Q];if(L===void 0)L={id:E.id,object:E,geometry:O,material:R,materialVariant:X(E),groupOrder:k,renderOrder:E.renderOrder,z:q,group:N},J[Q]=L;else L.id=E.id,L.object=E,L.geometry=O,L.material=R,L.materialVariant=X(E),L.groupOrder=k,L.renderOrder=E.renderOrder,L.z=q,L.group=N;return Q++,L}function H(E,O,R,k,q,N){let L=K(E,O,R,k,q,N);if(R.transmission>0)Z.push(L);else if(R.transparent===!0)W.push(L);else $.push(L)}function U(E,O,R,k,q,N){let L=K(E,O,R,k,q,N);if(R.transmission>0)Z.unshift(L);else if(R.transparent===!0)W.unshift(L);else $.unshift(L)}function G(E,O){if($.length>1)$.sort(E||mL);if(Z.length>1)Z.sort(O||p5);if(W.length>1)W.sort(O||p5)}function F(){for(let E=Q,O=J.length;E<O;E++){let R=J[E];if(R.id===null)break;R.id=null,R.object=null,R.geometry=null,R.material=null,R.group=null}}return{opaque:$,transmissive:Z,transparent:W,init:Y,push:H,unshift:U,finish:F,sort:G}}function lL(){let J=new WeakMap;function Q(Z,W){let Y=J.get(Z),X;if(Y===void 0)X=new u5,J.set(Z,[X]);else if(W>=Y.length)X=new u5,Y.push(X);else X=Y[W];return X}function $(){J=new WeakMap}return{get:Q,dispose:$}}function cL(){let J={};return{get:function(Q){if(J[Q.id]!==void 0)return J[Q.id];let $;switch(Q.type){case"DirectionalLight":$={direction:new T,color:new e};break;case"SpotLight":$={position:new T,direction:new T,color:new e,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":$={position:new T,color:new e,distance:0,decay:0};break;case"HemisphereLight":$={direction:new T,skyColor:new e,groundColor:new e};break;case"RectAreaLight":$={color:new e,position:new T,halfWidth:new T,halfHeight:new T};break}return J[Q.id]=$,$}}}function nL(){let J={};return{get:function(Q){if(J[Q.id]!==void 0)return J[Q.id];let $;switch(Q.type){case"DirectionalLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new i};break;case"SpotLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new i};break;case"PointLight":$={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new i,shadowCameraNear:1,shadowCameraFar:1000};break}return J[Q.id]=$,$}}}var sL=0;function iL(J,Q){return(Q.castShadow?2:0)-(J.castShadow?2:0)+(Q.map?1:0)-(J.map?1:0)}function oL(J){let Q=new cL,$=nL(),Z={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 U=0;U<9;U++)Z.probe.push(new T);let W=new T,Y=new y0,X=new y0;function K(U){let G=0,F=0,E=0;for(let C=0;C<9;C++)Z.probe[C].set(0,0,0);let O=0,R=0,k=0,q=0,N=0,L=0,D=0,V=0,I=0,z=0,B=0;U.sort(iL);for(let C=0,j=U.length;C<j;C++){let w=U[C],v=w.color,b=w.intensity,S=w.distance,h=null;if(w.shadow&&w.shadow.map)if(w.shadow.map.texture.format===a8)h=w.shadow.map.texture;else h=w.shadow.map.depthTexture||w.shadow.map.texture;if(w.isAmbientLight)G+=v.r*b,F+=v.g*b,E+=v.b*b;else if(w.isLightProbe){for(let x=0;x<9;x++)Z.probe[x].addScaledVector(w.sh.coefficients[x],b);B++}else if(w.isDirectionalLight){let x=Q.get(w);if(x.color.copy(w.color).multiplyScalar(w.intensity),w.castShadow){let p=w.shadow,c=$.get(w);c.shadowIntensity=p.intensity,c.shadowBias=p.bias,c.shadowNormalBias=p.normalBias,c.shadowRadius=p.radius,c.shadowMapSize=p.mapSize,Z.directionalShadow[O]=c,Z.directionalShadowMap[O]=h,Z.directionalShadowMatrix[O]=w.shadow.matrix,L++}Z.directional[O]=x,O++}else if(w.isSpotLight){let x=Q.get(w);x.position.setFromMatrixPosition(w.matrixWorld),x.color.copy(v).multiplyScalar(b),x.distance=S,x.coneCos=Math.cos(w.angle),x.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),x.decay=w.decay,Z.spot[k]=x;let p=w.shadow;if(w.map){if(Z.spotLightMap[I]=w.map,I++,p.updateMatrices(w),w.castShadow)z++}if(Z.spotLightMatrix[k]=p.matrix,w.castShadow){let c=$.get(w);c.shadowIntensity=p.intensity,c.shadowBias=p.bias,c.shadowNormalBias=p.normalBias,c.shadowRadius=p.radius,c.shadowMapSize=p.mapSize,Z.spotShadow[k]=c,Z.spotShadowMap[k]=h,V++}k++}else if(w.isRectAreaLight){let x=Q.get(w);x.color.copy(v).multiplyScalar(b),x.halfWidth.set(w.width*0.5,0,0),x.halfHeight.set(0,w.height*0.5,0),Z.rectArea[q]=x,q++}else if(w.isPointLight){let x=Q.get(w);if(x.color.copy(w.color).multiplyScalar(w.intensity),x.distance=w.distance,x.decay=w.decay,w.castShadow){let p=w.shadow,c=$.get(w);c.shadowIntensity=p.intensity,c.shadowBias=p.bias,c.shadowNormalBias=p.normalBias,c.shadowRadius=p.radius,c.shadowMapSize=p.mapSize,c.shadowCameraNear=p.camera.near,c.shadowCameraFar=p.camera.far,Z.pointShadow[R]=c,Z.pointShadowMap[R]=h,Z.pointShadowMatrix[R]=w.shadow.matrix,D++}Z.point[R]=x,R++}else if(w.isHemisphereLight){let x=Q.get(w);x.skyColor.copy(w.color).multiplyScalar(b),x.groundColor.copy(w.groundColor).multiplyScalar(b),Z.hemi[N]=x,N++}}if(q>0)if(J.has("OES_texture_float_linear")===!0)Z.rectAreaLTC1=L0.LTC_FLOAT_1,Z.rectAreaLTC2=L0.LTC_FLOAT_2;else Z.rectAreaLTC1=L0.LTC_HALF_1,Z.rectAreaLTC2=L0.LTC_HALF_2;Z.ambient[0]=G,Z.ambient[1]=F,Z.ambient[2]=E;let M=Z.hash;if(M.directionalLength!==O||M.pointLength!==R||M.spotLength!==k||M.rectAreaLength!==q||M.hemiLength!==N||M.numDirectionalShadows!==L||M.numPointShadows!==D||M.numSpotShadows!==V||M.numSpotMaps!==I||M.numLightProbes!==B)Z.directional.length=O,Z.spot.length=k,Z.rectArea.length=q,Z.point.length=R,Z.hemi.length=N,Z.directionalShadow.length=L,Z.directionalShadowMap.length=L,Z.pointShadow.length=D,Z.pointShadowMap.length=D,Z.spotShadow.length=V,Z.spotShadowMap.length=V,Z.directionalShadowMatrix.length=L,Z.pointShadowMatrix.length=D,Z.spotLightMatrix.length=V+I-z,Z.spotLightMap.length=I,Z.numSpotLightShadowsWithMaps=z,Z.numLightProbes=B,M.directionalLength=O,M.pointLength=R,M.spotLength=k,M.rectAreaLength=q,M.hemiLength=N,M.numDirectionalShadows=L,M.numPointShadows=D,M.numSpotShadows=V,M.numSpotMaps=I,M.numLightProbes=B,Z.version=sL++}function H(U,G){let F=0,E=0,O=0,R=0,k=0,q=G.matrixWorldInverse;for(let N=0,L=U.length;N<L;N++){let D=U[N];if(D.isDirectionalLight){let V=Z.directional[F];V.direction.setFromMatrixPosition(D.matrixWorld),W.setFromMatrixPosition(D.target.matrixWorld),V.direction.sub(W),V.direction.transformDirection(q),F++}else if(D.isSpotLight){let V=Z.spot[O];V.position.setFromMatrixPosition(D.matrixWorld),V.position.applyMatrix4(q),V.direction.setFromMatrixPosition(D.matrixWorld),W.setFromMatrixPosition(D.target.matrixWorld),V.direction.sub(W),V.direction.transformDirection(q),O++}else if(D.isRectAreaLight){let V=Z.rectArea[R];V.position.setFromMatrixPosition(D.matrixWorld),V.position.applyMatrix4(q),X.identity(),Y.copy(D.matrixWorld),Y.premultiply(q),X.extractRotation(Y),V.halfWidth.set(D.width*0.5,0,0),V.halfHeight.set(0,D.height*0.5,0),V.halfWidth.applyMatrix4(X),V.halfHeight.applyMatrix4(X),R++}else if(D.isPointLight){let V=Z.point[E];V.position.setFromMatrixPosition(D.matrixWorld),V.position.applyMatrix4(q),E++}else if(D.isHemisphereLight){let V=Z.hemi[k];V.direction.setFromMatrixPosition(D.matrixWorld),V.direction.transformDirection(q),k++}}}return{setup:K,setupView:H,state:Z}}function d5(J){let Q=new oL(J),$=[],Z=[],W=[];function Y(E){F.camera=E,$.length=0,Z.length=0,W.length=0}function X(E){$.push(E)}function K(E){Z.push(E)}function H(E){W.push(E)}function U(){Q.setup($)}function G(E){Q.setupView($,E)}let F={lightsArray:$,shadowsArray:Z,lightProbeGridArray:W,camera:null,lights:Q,transmissionRenderTarget:{},textureUnits:0};return{init:Y,state:F,setupLights:U,setupLightsView:G,pushLight:X,pushShadow:K,pushLightProbeGrid:H}}function aL(J){let Q=new WeakMap;function $(W,Y=0){let X=Q.get(W),K;if(X===void 0)K=new d5(J),Q.set(W,[K]);else if(Y>=X.length)K=new d5(J),X.push(K);else K=X[Y];return K}function Z(){Q=new WeakMap}return{get:$,dispose:Z}}var rL=`void main() {
4054
4054
  gl_Position = vec4( position, 1.0 );
4055
- }`,d1=`uniform sampler2D shadow_pass;
4055
+ }`,tL=`uniform sampler2D shadow_pass;
4056
4056
  uniform vec2 resolution;
4057
4057
  uniform float radius;
4058
4058
  void main() {
@@ -4077,12 +4077,12 @@ void main() {
4077
4077
  squared_mean = squared_mean / samples;
4078
4078
  float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4079
4079
  gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4080
- }`,u1=[new j(1,0,0),new j(-1,0,0),new j(0,1,0),new j(0,-1,0),new j(0,0,1),new j(0,0,-1)],m1=[new j(0,-1,0),new j(0,-1,0),new j(0,0,1),new j(0,0,-1),new j(0,-1,0),new j(0,-1,0)],TX=new S0,$7=new j,pZ=new j;function l1(J,Q,$){let Z=new A8,W=new p0,Y=new p0,X=new QJ,K=new MZ,H=new kZ,U={},G=$.maxTextureSize,F={[z9]:bJ,[bJ]:z9,[cJ]:cJ},E=new SJ({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new p0},radius:{value:4}},vertexShader:p1,fragmentShader:d1}),O=E.clone();O.defines.HORIZONTAL_PASS=1;let R=new RJ;R.setAttribute("position",new JJ(new Float32Array([-1,-1,0.5,3,-1,0.5,-1,3,0.5]),3));let C=new GJ(R,E),q=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=b6;let N=this.type;this.render=function(P,V,D){if(q.enabled===!1)return;if(q.autoUpdate===!1&&q.needsUpdate===!1)return;if(P.length===0)return;if(this.type===YY)C0("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=b6;let B=J.getRenderTarget(),A=J.getActiveCubeFace(),z=J.getActiveMipmapLevel(),S=J.state;if(S.setBlending(w9),S.buffers.depth.getReversed()===!0)S.buffers.color.setClear(0,0,0,0);else S.buffers.color.setClear(1,1,1,1);S.buffers.depth.setTest(!0),S.setScissorTest(!1);let y=N!==this.type;if(y)V.traverse(function(v){if(v.material)if(Array.isArray(v.material))v.material.forEach((h)=>h.needsUpdate=!0);else v.material.needsUpdate=!0});for(let v=0,h=P.length;v<h;v++){let g=P[v],p=g.shadow;if(p===void 0){C0("WebGLShadowMap:",g,"has no shadow.");continue}if(p.autoUpdate===!1&&p.needsUpdate===!1)continue;W.copy(p.mapSize);let c=p.getFrameExtents();if(W.multiply(c),Y.copy(p.mapSize),W.x>G||W.y>G){if(W.x>G)Y.x=Math.floor(G/c.x),W.x=Y.x*c.x,p.mapSize.x=Y.x;if(W.y>G)Y.y=Math.floor(G/c.y),W.y=Y.y*c.y,p.mapSize.y=Y.y}let a=J.state.buffers.depth.getReversed();if(p.camera._reversedDepth=a,p.map===null||y===!0){if(p.map!==null){if(p.map.depthTexture!==null)p.map.depthTexture.dispose(),p.map.depthTexture=null;p.map.dispose()}if(this.type===Z6){if(g.isPointLight){C0("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}p.map=new nJ(W.x,W.y,{format:P8,type:fJ,minFilter:BJ,magFilter:BJ,generateMipmaps:!1}),p.map.texture.name=g.name+".shadowMap",p.map.depthTexture=new U8(W.x,W.y,tJ),p.map.depthTexture.name=g.name+".shadowMapDepth",p.map.depthTexture.format=z8,p.map.depthTexture.compareFunction=null,p.map.depthTexture.minFilter=L9,p.map.depthTexture.magFilter=L9}else{if(g.isPointLight)p.map=new mZ(W.x),p.map.depthTexture=new OZ(W.x,K8);else p.map=new nJ(W.x,W.y),p.map.depthTexture=new U8(W.x,W.y,K8);if(p.map.depthTexture.name=g.name+".shadowMap",p.map.depthTexture.format=z8,this.type===b6)p.map.depthTexture.compareFunction=a?JQ:e7,p.map.depthTexture.minFilter=BJ,p.map.depthTexture.magFilter=BJ;else p.map.depthTexture.compareFunction=null,p.map.depthTexture.minFilter=L9,p.map.depthTexture.magFilter=L9}p.camera.updateProjectionMatrix()}let Q0=p.map.isWebGLCubeRenderTarget?6:1;for(let H0=0;H0<Q0;H0++){if(p.map.isWebGLCubeRenderTarget)J.setRenderTarget(p.map,H0),J.clear();else{if(H0===0)J.setRenderTarget(p.map),J.clear();let J0=p.getViewport(H0);X.set(Y.x*J0.x,Y.y*J0.y,Y.x*J0.z,Y.y*J0.w),S.viewport(X)}if(g.isPointLight){let{camera:J0,matrix:x0}=p,v0=g.distance||J0.far;if(v0!==J0.far)J0.far=v0,J0.updateProjectionMatrix();$7.setFromMatrixPosition(g.matrixWorld),J0.position.copy($7),pZ.copy(J0.position),pZ.add(u1[H0]),J0.up.copy(m1[H0]),J0.lookAt(pZ),J0.updateMatrixWorld(),x0.makeTranslation(-$7.x,-$7.y,-$7.z),TX.multiplyMatrices(J0.projectionMatrix,J0.matrixWorldInverse),p._frustum.setFromProjectionMatrix(TX,J0.coordinateSystem,J0.reversedDepth)}else p.updateMatrices(g);Z=p.getFrustum(),k(V,D,p.camera,g,this.type)}if(p.isPointLightShadow!==!0&&this.type===Z6)L(p,D);p.needsUpdate=!1}N=this.type,q.needsUpdate=!1,J.setRenderTarget(B,A,z)};function L(P,V){let D=Q.update(C);if(E.defines.VSM_SAMPLES!==P.blurSamples)E.defines.VSM_SAMPLES=P.blurSamples,O.defines.VSM_SAMPLES=P.blurSamples,E.needsUpdate=!0,O.needsUpdate=!0;if(P.mapPass===null)P.mapPass=new nJ(W.x,W.y,{format:P8,type:fJ});E.uniforms.shadow_pass.value=P.map.depthTexture,E.uniforms.resolution.value=P.mapSize,E.uniforms.radius.value=P.radius,J.setRenderTarget(P.mapPass),J.clear(),J.renderBufferDirect(V,null,D,E,C,null),O.uniforms.shadow_pass.value=P.mapPass.texture,O.uniforms.resolution.value=P.mapSize,O.uniforms.radius.value=P.radius,J.setRenderTarget(P.map),J.clear(),J.renderBufferDirect(V,null,D,O,C,null)}function M(P,V,D,B){let A=null,z=D.isPointLight===!0?P.customDistanceMaterial:P.customDepthMaterial;if(z!==void 0)A=z;else if(A=D.isPointLight===!0?H:K,J.localClippingEnabled&&V.clipShadows===!0&&Array.isArray(V.clippingPlanes)&&V.clippingPlanes.length!==0||V.displacementMap&&V.displacementScale!==0||V.alphaMap&&V.alphaTest>0||V.map&&V.alphaTest>0||V.alphaToCoverage===!0){let S=A.uuid,y=V.uuid,v=U[S];if(v===void 0)v={},U[S]=v;let h=v[y];if(h===void 0)h=A.clone(),v[y]=h,V.addEventListener("dispose",_);A=h}if(A.visible=V.visible,A.wireframe=V.wireframe,B===Z6)A.side=V.shadowSide!==null?V.shadowSide:V.side;else A.side=V.shadowSide!==null?V.shadowSide:F[V.side];if(A.alphaMap=V.alphaMap,A.alphaTest=V.alphaToCoverage===!0?0.5:V.alphaTest,A.map=V.map,A.clipShadows=V.clipShadows,A.clippingPlanes=V.clippingPlanes,A.clipIntersection=V.clipIntersection,A.displacementMap=V.displacementMap,A.displacementScale=V.displacementScale,A.displacementBias=V.displacementBias,A.wireframeLinewidth=V.wireframeLinewidth,A.linewidth=V.linewidth,D.isPointLight===!0&&A.isMeshDistanceMaterial===!0){let S=J.properties.get(A);S.light=D}return A}function k(P,V,D,B,A){if(P.visible===!1)return;if(P.layers.test(V.layers)&&(P.isMesh||P.isLine||P.isPoints)){if((P.castShadow||P.receiveShadow&&A===Z6)&&(!P.frustumCulled||Z.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,P.matrixWorld);let y=Q.update(P),v=P.material;if(Array.isArray(v)){let h=y.groups;for(let g=0,p=h.length;g<p;g++){let c=h[g],a=v[c.materialIndex];if(a&&a.visible){let Q0=M(P,a,B,A);P.onBeforeShadow(J,P,V,D,y,Q0,c),J.renderBufferDirect(D,null,y,Q0,P,c),P.onAfterShadow(J,P,V,D,y,Q0,c)}}}else if(v.visible){let h=M(P,v,B,A);P.onBeforeShadow(J,P,V,D,y,h,null),J.renderBufferDirect(D,null,y,h,P,null),P.onAfterShadow(J,P,V,D,y,h,null)}}}let S=P.children;for(let y=0,v=S.length;y<v;y++)k(S[y],V,D,B,A)}function _(P){P.target.removeEventListener("dispose",_);for(let D in U){let B=U[D],A=P.target.uuid;if(A in B)B[A].dispose(),delete B[A]}}}function c1(J,Q){function $(){let x=!1,X0=new QJ,i=null,Z0=new QJ(0,0,0,0);return{setMask:function(V0){if(i!==V0&&!x)J.colorMask(V0,V0,V0,V0),i=V0},setLocked:function(V0){x=V0},setClear:function(V0,e,z0,b0,IJ){if(IJ===!0)V0*=b0,e*=b0,z0*=b0;if(X0.set(V0,e,z0,b0),Z0.equals(X0)===!1)J.clearColor(V0,e,z0,b0),Z0.copy(X0)},reset:function(){x=!1,i=null,Z0.set(-1,0,0,0)}}}function Z(){let x=!1,X0=!1,i=null,Z0=null,V0=null;return{setReversed:function(e){if(X0!==e){let z0=Q.get("EXT_clip_control");if(e)z0.clipControlEXT(z0.LOWER_LEFT_EXT,z0.ZERO_TO_ONE_EXT);else z0.clipControlEXT(z0.LOWER_LEFT_EXT,z0.NEGATIVE_ONE_TO_ONE_EXT);X0=e;let b0=V0;V0=null,this.setClear(b0)}},getReversed:function(){return X0},setTest:function(e){if(e)G0(J.DEPTH_TEST);else w0(J.DEPTH_TEST)},setMask:function(e){if(i!==e&&!x)J.depthMask(e),i=e},setFunc:function(e){if(X0)e=eY[e];if(Z0!==e){switch(e){case wY:J.depthFunc(J.NEVER);break;case PY:J.depthFunc(J.ALWAYS);break;case _Y:J.depthFunc(J.LESS);break;case q$:J.depthFunc(J.LEQUAL);break;case TY:J.depthFunc(J.EQUAL);break;case AY:J.depthFunc(J.GEQUAL);break;case SY:J.depthFunc(J.GREATER);break;case jY:J.depthFunc(J.NOTEQUAL);break;default:J.depthFunc(J.LEQUAL)}Z0=e}},setLocked:function(e){x=e},setClear:function(e){if(V0!==e){if(V0=e,X0)e=1-e;J.clearDepth(e)}},reset:function(){x=!1,i=null,Z0=null,V0=null,X0=!1}}}function W(){let x=!1,X0=null,i=null,Z0=null,V0=null,e=null,z0=null,b0=null,IJ=null;return{setTest:function(ZJ){if(!x)if(ZJ)G0(J.STENCIL_TEST);else w0(J.STENCIL_TEST)},setMask:function(ZJ){if(X0!==ZJ&&!x)J.stencilMask(ZJ),X0=ZJ},setFunc:function(ZJ,B9,G9){if(i!==ZJ||Z0!==B9||V0!==G9)J.stencilFunc(ZJ,B9,G9),i=ZJ,Z0=B9,V0=G9},setOp:function(ZJ,B9,G9){if(e!==ZJ||z0!==B9||b0!==G9)J.stencilOp(ZJ,B9,G9),e=ZJ,z0=B9,b0=G9},setLocked:function(ZJ){x=ZJ},setClear:function(ZJ){if(IJ!==ZJ)J.clearStencil(ZJ),IJ=ZJ},reset:function(){x=!1,X0=null,i=null,Z0=null,V0=null,e=null,z0=null,b0=null,IJ=null}}}let Y=new $,X=new Z,K=new W,H=new WeakMap,U=new WeakMap,G={},F={},E={},O=new WeakMap,R=[],C=null,q=!1,N=null,L=null,M=null,k=null,_=null,P=null,V=null,D=new R0(0,0,0),B=0,A=!1,z=null,S=null,y=null,v=null,h=null,g=J.getParameter(J.MAX_COMBINED_TEXTURE_IMAGE_UNITS),p=!1,c=0,a=J.getParameter(J.VERSION);if(a.indexOf("WebGL")!==-1)c=parseFloat(/^WebGL (\d)/.exec(a)[1]),p=c>=1;else if(a.indexOf("OpenGL ES")!==-1)c=parseFloat(/^OpenGL ES (\d)/.exec(a)[1]),p=c>=2;let Q0=null,H0={},J0=J.getParameter(J.SCISSOR_BOX),x0=J.getParameter(J.VIEWPORT),v0=new QJ().fromArray(J0),s=new QJ().fromArray(x0);function Y0(x,X0,i,Z0){let V0=new Uint8Array(4),e=J.createTexture();J.bindTexture(x,e),J.texParameteri(x,J.TEXTURE_MIN_FILTER,J.NEAREST),J.texParameteri(x,J.TEXTURE_MAG_FILTER,J.NEAREST);for(let z0=0;z0<i;z0++)if(x===J.TEXTURE_3D||x===J.TEXTURE_2D_ARRAY)J.texImage3D(X0,0,J.RGBA,1,1,Z0,0,J.RGBA,J.UNSIGNED_BYTE,V0);else J.texImage2D(X0+z0,0,J.RGBA,1,1,0,J.RGBA,J.UNSIGNED_BYTE,V0);return e}let D0={};D0[J.TEXTURE_2D]=Y0(J.TEXTURE_2D,J.TEXTURE_2D,1),D0[J.TEXTURE_CUBE_MAP]=Y0(J.TEXTURE_CUBE_MAP,J.TEXTURE_CUBE_MAP_POSITIVE_X,6),D0[J.TEXTURE_2D_ARRAY]=Y0(J.TEXTURE_2D_ARRAY,J.TEXTURE_2D_ARRAY,1,1),D0[J.TEXTURE_3D]=Y0(J.TEXTURE_3D,J.TEXTURE_3D,1,1),Y.setClear(0,0,0,1),X.setClear(1),K.setClear(0),G0(J.DEPTH_TEST),X.setFunc(q$),vJ(!1),CJ(F$),G0(J.CULL_FACE),u0(w9);function G0(x){if(G[x]!==!0)J.enable(x),G[x]=!0}function w0(x){if(G[x]!==!1)J.disable(x),G[x]=!1}function i0(x,X0){if(E[x]!==X0){if(J.bindFramebuffer(x,X0),E[x]=X0,x===J.DRAW_FRAMEBUFFER)E[J.FRAMEBUFFER]=X0;if(x===J.FRAMEBUFFER)E[J.DRAW_FRAMEBUFFER]=X0;return!0}return!1}function j0(x,X0){let i=R,Z0=!1;if(x){if(i=O.get(X0),i===void 0)i=[],O.set(X0,i);let V0=x.textures;if(i.length!==V0.length||i[0]!==J.COLOR_ATTACHMENT0){for(let e=0,z0=V0.length;e<z0;e++)i[e]=J.COLOR_ATTACHMENT0+e;i.length=V0.length,Z0=!0}}else if(i[0]!==J.BACK)i[0]=J.BACK,Z0=!0;if(Z0)J.drawBuffers(i)}function d0(x){if(C!==x)return J.useProgram(x),C=x,!0;return!1}let YJ={[W6]:J.FUNC_ADD,[KY]:J.FUNC_SUBTRACT,[HY]:J.FUNC_REVERSE_SUBTRACT};YJ[UY]=J.MIN,YJ[GY]=J.MAX;let XJ={[EY]:J.ZERO,[FY]:J.ONE,[NY]:J.SRC_COLOR,[qY]:J.SRC_ALPHA,[BY]:J.SRC_ALPHA_SATURATE,[MY]:J.DST_COLOR,[LY]:J.DST_ALPHA,[OY]:J.ONE_MINUS_SRC_COLOR,[RY]:J.ONE_MINUS_SRC_ALPHA,[kY]:J.ONE_MINUS_DST_COLOR,[DY]:J.ONE_MINUS_DST_ALPHA,[VY]:J.CONSTANT_COLOR,[CY]:J.ONE_MINUS_CONSTANT_COLOR,[IY]:J.CONSTANT_ALPHA,[zY]:J.ONE_MINUS_CONSTANT_ALPHA};function u0(x,X0,i,Z0,V0,e,z0,b0,IJ,ZJ){if(x===w9){if(q===!0)w0(J.BLEND),q=!1;return}if(q===!1)G0(J.BLEND),q=!0;if(x!==XY){if(x!==N||ZJ!==A){if(L!==W6||_!==W6)J.blendEquation(J.FUNC_ADD),L=W6,_=W6;if(ZJ)switch(x){case V8:J.blendFuncSeparate(J.ONE,J.ONE_MINUS_SRC_ALPHA,J.ONE,J.ONE_MINUS_SRC_ALPHA);break;case f6:J.blendFunc(J.ONE,J.ONE);break;case N$:J.blendFuncSeparate(J.ZERO,J.ONE_MINUS_SRC_COLOR,J.ZERO,J.ONE);break;case O$:J.blendFuncSeparate(J.DST_COLOR,J.ONE_MINUS_SRC_ALPHA,J.ZERO,J.ONE);break;default:A0("WebGLState: Invalid blending: ",x);break}else switch(x){case V8:J.blendFuncSeparate(J.SRC_ALPHA,J.ONE_MINUS_SRC_ALPHA,J.ONE,J.ONE_MINUS_SRC_ALPHA);break;case f6:J.blendFuncSeparate(J.SRC_ALPHA,J.ONE,J.ONE,J.ONE);break;case N$:A0("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case O$:A0("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:A0("WebGLState: Invalid blending: ",x);break}M=null,k=null,P=null,V=null,D.set(0,0,0),B=0,N=x,A=ZJ}return}if(V0=V0||X0,e=e||i,z0=z0||Z0,X0!==L||V0!==_)J.blendEquationSeparate(YJ[X0],YJ[V0]),L=X0,_=V0;if(i!==M||Z0!==k||e!==P||z0!==V)J.blendFuncSeparate(XJ[i],XJ[Z0],XJ[e],XJ[z0]),M=i,k=Z0,P=e,V=z0;if(b0.equals(D)===!1||IJ!==B)J.blendColor(b0.r,b0.g,b0.b,IJ),D.copy(b0),B=IJ;N=x,A=!1}function jJ(x,X0){x.side===cJ?w0(J.CULL_FACE):G0(J.CULL_FACE);let i=x.side===bJ;if(X0)i=!i;vJ(i),x.blending===V8&&x.transparent===!1?u0(w9):u0(x.blending,x.blendEquation,x.blendSrc,x.blendDst,x.blendEquationAlpha,x.blendSrcAlpha,x.blendDstAlpha,x.blendColor,x.blendAlpha,x.premultipliedAlpha),X.setFunc(x.depthFunc),X.setTest(x.depthTest),X.setMask(x.depthWrite),Y.setMask(x.colorWrite);let Z0=x.stencilWrite;if(K.setTest(Z0),Z0)K.setMask(x.stencilWriteMask),K.setFunc(x.stencilFunc,x.stencilRef,x.stencilFuncMask),K.setOp(x.stencilFail,x.stencilZFail,x.stencilZPass);pJ(x.polygonOffset,x.polygonOffsetFactor,x.polygonOffsetUnits),x.alphaToCoverage===!0?G0(J.SAMPLE_ALPHA_TO_COVERAGE):w0(J.SAMPLE_ALPHA_TO_COVERAGE)}function vJ(x){if(z!==x){if(x)J.frontFace(J.CW);else J.frontFace(J.CCW);z=x}}function CJ(x){if(x!==ZY){if(G0(J.CULL_FACE),x!==S)if(x===F$)J.cullFace(J.BACK);else if(x===WY)J.cullFace(J.FRONT);else J.cullFace(J.FRONT_AND_BACK)}else w0(J.CULL_FACE);S=x}function b(x){if(x!==y){if(p)J.lineWidth(x);y=x}}function pJ(x,X0,i){if(x){if(G0(J.POLYGON_OFFSET_FILL),v!==X0||h!==i){if(v=X0,h=i,X.getReversed())X0=-X0;J.polygonOffset(X0,i)}}else w0(J.POLYGON_OFFSET_FILL)}function a0(x){if(x)G0(J.SCISSOR_TEST);else w0(J.SCISSOR_TEST)}function t0(x){if(x===void 0)x=J.TEXTURE0+g-1;if(Q0!==x)J.activeTexture(x),Q0=x}function O0(x,X0,i){if(i===void 0)if(Q0===null)i=J.TEXTURE0+g-1;else i=Q0;let Z0=H0[i];if(Z0===void 0)Z0={type:void 0,texture:void 0},H0[i]=Z0;if(Z0.type!==x||Z0.texture!==X0){if(Q0!==i)J.activeTexture(i),Q0=i;J.bindTexture(x,X0||D0[x]),Z0.type=x,Z0.texture=X0}}function qJ(){let x=H0[Q0];if(x!==void 0&&x.type!==void 0)J.bindTexture(x.type,null),x.type=void 0,x.texture=void 0}function T0(){try{J.compressedTexImage2D(...arguments)}catch(x){A0("WebGLState:",x)}}function T(){try{J.compressedTexImage3D(...arguments)}catch(x){A0("WebGLState:",x)}}function I(){try{J.texSubImage2D(...arguments)}catch(x){A0("WebGLState:",x)}}function d(){try{J.texSubImage3D(...arguments)}catch(x){A0("WebGLState:",x)}}function r(){try{J.compressedTexSubImage2D(...arguments)}catch(x){A0("WebGLState:",x)}}function t(){try{J.compressedTexSubImage3D(...arguments)}catch(x){A0("WebGLState:",x)}}function $0(){try{J.texStorage2D(...arguments)}catch(x){A0("WebGLState:",x)}}function E0(){try{J.texStorage3D(...arguments)}catch(x){A0("WebGLState:",x)}}function n(){try{J.texImage2D(...arguments)}catch(x){A0("WebGLState:",x)}}function o(){try{J.texImage3D(...arguments)}catch(x){A0("WebGLState:",x)}}function K0(x){if(F[x]!==void 0)return F[x];else return J.getParameter(x)}function B0(x,X0){if(F[x]!==X0)J.pixelStorei(x,X0),F[x]=X0}function W0(x){if(v0.equals(x)===!1)J.scissor(x.x,x.y,x.z,x.w),v0.copy(x)}function F0(x){if(s.equals(x)===!1)J.viewport(x.x,x.y,x.z,x.w),s.copy(x)}function y0(x,X0){let i=U.get(X0);if(i===void 0)i=new WeakMap,U.set(X0,i);let Z0=i.get(x);if(Z0===void 0)Z0=J.getUniformBlockIndex(X0,x.name),i.set(x,Z0)}function g0(x,X0){let Z0=U.get(X0).get(x);if(H.get(X0)!==Z0)J.uniformBlockBinding(X0,Z0,x.__bindingPointIndex),H.set(X0,Z0)}function c0(){J.disable(J.BLEND),J.disable(J.CULL_FACE),J.disable(J.DEPTH_TEST),J.disable(J.POLYGON_OFFSET_FILL),J.disable(J.SCISSOR_TEST),J.disable(J.STENCIL_TEST),J.disable(J.SAMPLE_ALPHA_TO_COVERAGE),J.blendEquation(J.FUNC_ADD),J.blendFunc(J.ONE,J.ZERO),J.blendFuncSeparate(J.ONE,J.ZERO,J.ONE,J.ZERO),J.blendColor(0,0,0,0),J.colorMask(!0,!0,!0,!0),J.clearColor(0,0,0,0),J.depthMask(!0),J.depthFunc(J.LESS),X.setReversed(!1),J.clearDepth(1),J.stencilMask(4294967295),J.stencilFunc(J.ALWAYS,0,4294967295),J.stencilOp(J.KEEP,J.KEEP,J.KEEP),J.clearStencil(0),J.cullFace(J.BACK),J.frontFace(J.CCW),J.polygonOffset(0,0),J.activeTexture(J.TEXTURE0),J.bindFramebuffer(J.FRAMEBUFFER,null),J.bindFramebuffer(J.DRAW_FRAMEBUFFER,null),J.bindFramebuffer(J.READ_FRAMEBUFFER,null),J.useProgram(null),J.lineWidth(1),J.scissor(0,0,J.canvas.width,J.canvas.height),J.viewport(0,0,J.canvas.width,J.canvas.height),J.pixelStorei(J.PACK_ALIGNMENT,4),J.pixelStorei(J.UNPACK_ALIGNMENT,4),J.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,!1),J.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),J.pixelStorei(J.UNPACK_COLORSPACE_CONVERSION_WEBGL,J.BROWSER_DEFAULT_WEBGL),J.pixelStorei(J.PACK_ROW_LENGTH,0),J.pixelStorei(J.PACK_SKIP_PIXELS,0),J.pixelStorei(J.PACK_SKIP_ROWS,0),J.pixelStorei(J.UNPACK_ROW_LENGTH,0),J.pixelStorei(J.UNPACK_IMAGE_HEIGHT,0),J.pixelStorei(J.UNPACK_SKIP_PIXELS,0),J.pixelStorei(J.UNPACK_SKIP_ROWS,0),J.pixelStorei(J.UNPACK_SKIP_IMAGES,0),G={},F={},Q0=null,H0={},E={},O=new WeakMap,R=[],C=null,q=!1,N=null,L=null,M=null,k=null,_=null,P=null,V=null,D=new R0(0,0,0),B=0,A=!1,z=null,S=null,y=null,v=null,h=null,v0.set(0,0,J.canvas.width,J.canvas.height),s.set(0,0,J.canvas.width,J.canvas.height),Y.reset(),X.reset(),K.reset()}return{buffers:{color:Y,depth:X,stencil:K},enable:G0,disable:w0,bindFramebuffer:i0,drawBuffers:j0,useProgram:d0,setBlending:u0,setMaterial:jJ,setFlipSided:vJ,setCullFace:CJ,setLineWidth:b,setPolygonOffset:pJ,setScissorTest:a0,activeTexture:t0,bindTexture:O0,unbindTexture:qJ,compressedTexImage2D:T0,compressedTexImage3D:T,texImage2D:n,texImage3D:o,pixelStorei:B0,getParameter:K0,updateUBOMapping:y0,uniformBlockBinding:g0,texStorage2D:$0,texStorage3D:E0,texSubImage2D:I,texSubImage3D:d,compressedTexSubImage2D:r,compressedTexSubImage3D:t,scissor:W0,viewport:F0,reset:c0}}function n1(J,Q,$,Z,W,Y,X){let K=Q.has("WEBGL_multisampled_render_to_texture")?Q.get("WEBGL_multisampled_render_to_texture"):null,H=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),U=new p0,G=new WeakMap,F=new Set,E,O=new WeakMap,R=!1;try{R=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(T){}function C(T,I){return R?new OffscreenCanvas(T,I):J6("canvas")}function q(T,I,d){let r=1,t=T0(T);if(t.width>d||t.height>d)r=d/Math.max(t.width,t.height);if(r<1)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap||typeof VideoFrame<"u"&&T instanceof VideoFrame){let $0=Math.floor(r*t.width),E0=Math.floor(r*t.height);if(E===void 0)E=C($0,E0);let n=I?C($0,E0):E;return n.width=$0,n.height=E0,n.getContext("2d").drawImage(T,0,0,$0,E0),C0("WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+$0+"x"+E0+")."),n}else{if("data"in T)C0("WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+").");return T}return T}function N(T){return T.generateMipmaps}function L(T){J.generateMipmap(T)}function M(T){if(T.isWebGLCubeRenderTarget)return J.TEXTURE_CUBE_MAP;if(T.isWebGL3DRenderTarget)return J.TEXTURE_3D;if(T.isWebGLArrayRenderTarget||T.isCompressedArrayTexture)return J.TEXTURE_2D_ARRAY;return J.TEXTURE_2D}function k(T,I,d,r,t,$0=!1){if(T!==null){if(J[T]!==void 0)return J[T];C0("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let E0;if(r){if(E0=Q.get("EXT_texture_norm16"),!E0)C0("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension")}let n=I;if(I===J.RED){if(d===J.FLOAT)n=J.R32F;if(d===J.HALF_FLOAT)n=J.R16F;if(d===J.UNSIGNED_BYTE)n=J.R8;if(d===J.UNSIGNED_SHORT&&E0)n=E0.R16_EXT;if(d===J.SHORT&&E0)n=E0.R16_SNORM_EXT}if(I===J.RED_INTEGER){if(d===J.UNSIGNED_BYTE)n=J.R8UI;if(d===J.UNSIGNED_SHORT)n=J.R16UI;if(d===J.UNSIGNED_INT)n=J.R32UI;if(d===J.BYTE)n=J.R8I;if(d===J.SHORT)n=J.R16I;if(d===J.INT)n=J.R32I}if(I===J.RG){if(d===J.FLOAT)n=J.RG32F;if(d===J.HALF_FLOAT)n=J.RG16F;if(d===J.UNSIGNED_BYTE)n=J.RG8;if(d===J.UNSIGNED_SHORT&&E0)n=E0.RG16_EXT;if(d===J.SHORT&&E0)n=E0.RG16_SNORM_EXT}if(I===J.RG_INTEGER){if(d===J.UNSIGNED_BYTE)n=J.RG8UI;if(d===J.UNSIGNED_SHORT)n=J.RG16UI;if(d===J.UNSIGNED_INT)n=J.RG32UI;if(d===J.BYTE)n=J.RG8I;if(d===J.SHORT)n=J.RG16I;if(d===J.INT)n=J.RG32I}if(I===J.RGB_INTEGER){if(d===J.UNSIGNED_BYTE)n=J.RGB8UI;if(d===J.UNSIGNED_SHORT)n=J.RGB16UI;if(d===J.UNSIGNED_INT)n=J.RGB32UI;if(d===J.BYTE)n=J.RGB8I;if(d===J.SHORT)n=J.RGB16I;if(d===J.INT)n=J.RGB32I}if(I===J.RGBA_INTEGER){if(d===J.UNSIGNED_BYTE)n=J.RGBA8UI;if(d===J.UNSIGNED_SHORT)n=J.RGBA16UI;if(d===J.UNSIGNED_INT)n=J.RGBA32UI;if(d===J.BYTE)n=J.RGBA8I;if(d===J.SHORT)n=J.RGBA16I;if(d===J.INT)n=J.RGBA32I}if(I===J.RGB){if(d===J.UNSIGNED_SHORT&&E0)n=E0.RGB16_EXT;if(d===J.SHORT&&E0)n=E0.RGB16_SNORM_EXT;if(d===J.UNSIGNED_INT_5_9_9_9_REV)n=J.RGB9_E5;if(d===J.UNSIGNED_INT_10F_11F_11F_REV)n=J.R11F_G11F_B10F}if(I===J.RGBA){let o=$0?KZ:s0.getTransfer(t);if(d===J.FLOAT)n=J.RGBA32F;if(d===J.HALF_FLOAT)n=J.RGBA16F;if(d===J.UNSIGNED_BYTE)n=o===UJ?J.SRGB8_ALPHA8:J.RGBA8;if(d===J.UNSIGNED_SHORT&&E0)n=E0.RGBA16_EXT;if(d===J.SHORT&&E0)n=E0.RGBA16_SNORM_EXT;if(d===J.UNSIGNED_SHORT_4_4_4_4)n=J.RGBA4;if(d===J.UNSIGNED_SHORT_5_5_5_1)n=J.RGB5_A1}if(n===J.R16F||n===J.R32F||n===J.RG16F||n===J.RG32F||n===J.RGBA16F||n===J.RGBA32F)Q.get("EXT_color_buffer_float");return n}function _(T,I){let d;if(T){if(I===null||I===K8||I===H6)d=J.DEPTH24_STENCIL8;else if(I===tJ)d=J.DEPTH32F_STENCIL8;else if(I===d6)d=J.DEPTH24_STENCIL8,C0("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")}else if(I===null||I===K8||I===H6)d=J.DEPTH_COMPONENT24;else if(I===tJ)d=J.DEPTH_COMPONENT32F;else if(I===d6)d=J.DEPTH_COMPONENT16;return d}function P(T,I){if(N(T)===!0||T.isFramebufferTexture&&T.minFilter!==L9&&T.minFilter!==BJ)return Math.log2(Math.max(I.width,I.height))+1;else if(T.mipmaps!==void 0&&T.mipmaps.length>0)return T.mipmaps.length;else if(T.isCompressedTexture&&Array.isArray(T.image))return I.mipmaps.length;else return 1}function V(T){let I=T.target;if(I.removeEventListener("dispose",V),B(I),I.isVideoTexture)G.delete(I);if(I.isHTMLTexture)F.delete(I)}function D(T){let I=T.target;I.removeEventListener("dispose",D),z(I)}function B(T){let I=Z.get(T);if(I.__webglInit===void 0)return;let d=T.source,r=O.get(d);if(r){let t=r[I.__cacheKey];if(t.usedTimes--,t.usedTimes===0)A(T);if(Object.keys(r).length===0)O.delete(d)}Z.remove(T)}function A(T){let I=Z.get(T);J.deleteTexture(I.__webglTexture);let d=T.source,r=O.get(d);delete r[I.__cacheKey],X.memory.textures--}function z(T){let I=Z.get(T);if(T.depthTexture)T.depthTexture.dispose(),Z.remove(T.depthTexture);if(T.isWebGLCubeRenderTarget)for(let r=0;r<6;r++){if(Array.isArray(I.__webglFramebuffer[r]))for(let t=0;t<I.__webglFramebuffer[r].length;t++)J.deleteFramebuffer(I.__webglFramebuffer[r][t]);else J.deleteFramebuffer(I.__webglFramebuffer[r]);if(I.__webglDepthbuffer)J.deleteRenderbuffer(I.__webglDepthbuffer[r])}else{if(Array.isArray(I.__webglFramebuffer))for(let r=0;r<I.__webglFramebuffer.length;r++)J.deleteFramebuffer(I.__webglFramebuffer[r]);else J.deleteFramebuffer(I.__webglFramebuffer);if(I.__webglDepthbuffer)J.deleteRenderbuffer(I.__webglDepthbuffer);if(I.__webglMultisampledFramebuffer)J.deleteFramebuffer(I.__webglMultisampledFramebuffer);if(I.__webglColorRenderbuffer){for(let r=0;r<I.__webglColorRenderbuffer.length;r++)if(I.__webglColorRenderbuffer[r])J.deleteRenderbuffer(I.__webglColorRenderbuffer[r])}if(I.__webglDepthRenderbuffer)J.deleteRenderbuffer(I.__webglDepthRenderbuffer)}let d=T.textures;for(let r=0,t=d.length;r<t;r++){let $0=Z.get(d[r]);if($0.__webglTexture)J.deleteTexture($0.__webglTexture),X.memory.textures--;Z.remove(d[r])}Z.remove(T)}let S=0;function y(){S=0}function v(){return S}function h(T){S=T}function g(){let T=S;if(T>=W.maxTextures)C0("WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+W.maxTextures);return S+=1,T}function p(T){let I=[];return I.push(T.wrapS),I.push(T.wrapT),I.push(T.wrapR||0),I.push(T.magFilter),I.push(T.minFilter),I.push(T.anisotropy),I.push(T.internalFormat),I.push(T.format),I.push(T.type),I.push(T.generateMipmaps),I.push(T.premultiplyAlpha),I.push(T.flipY),I.push(T.unpackAlignment),I.push(T.colorSpace),I.join()}function c(T,I){let d=Z.get(T);if(T.isVideoTexture)O0(T);if(T.isRenderTargetTexture===!1&&T.isExternalTexture!==!0&&T.version>0&&d.__version!==T.version){let r=T.image;if(r===null)C0("WebGLRenderer: Texture marked for update but no image data found.");else if(r.complete===!1)C0("WebGLRenderer: Texture marked for update but image is incomplete");else{w0(d,T,I);return}}else if(T.isExternalTexture)d.__webglTexture=T.sourceTexture?T.sourceTexture:null;$.bindTexture(J.TEXTURE_2D,d.__webglTexture,J.TEXTURE0+I)}function a(T,I){let d=Z.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&d.__version!==T.version){w0(d,T,I);return}else if(T.isExternalTexture)d.__webglTexture=T.sourceTexture?T.sourceTexture:null;$.bindTexture(J.TEXTURE_2D_ARRAY,d.__webglTexture,J.TEXTURE0+I)}function Q0(T,I){let d=Z.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&d.__version!==T.version){w0(d,T,I);return}$.bindTexture(J.TEXTURE_3D,d.__webglTexture,J.TEXTURE0+I)}function H0(T,I){let d=Z.get(T);if(T.isCubeDepthTexture!==!0&&T.version>0&&d.__version!==T.version){i0(d,T,I);return}$.bindTexture(J.TEXTURE_CUBE_MAP,d.__webglTexture,J.TEXTURE0+I)}let J0={[X8]:J.REPEAT,[X6]:J.CLAMP_TO_EDGE,[l7]:J.MIRRORED_REPEAT},x0={[L9]:J.NEAREST,[c7]:J.NEAREST_MIPMAP_NEAREST,[I8]:J.NEAREST_MIPMAP_LINEAR,[BJ]:J.LINEAR,[K6]:J.LINEAR_MIPMAP_NEAREST,[P9]:J.LINEAR_MIPMAP_LINEAR},v0={[lY]:J.NEVER,[oY]:J.ALWAYS,[cY]:J.LESS,[e7]:J.LEQUAL,[nY]:J.EQUAL,[JQ]:J.GEQUAL,[sY]:J.GREATER,[iY]:J.NOTEQUAL};function s(T,I){if(I.type===tJ&&Q.has("OES_texture_float_linear")===!1&&(I.magFilter===BJ||I.magFilter===K6||I.magFilter===I8||I.magFilter===P9||I.minFilter===BJ||I.minFilter===K6||I.minFilter===I8||I.minFilter===P9))C0("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.");if(J.texParameteri(T,J.TEXTURE_WRAP_S,J0[I.wrapS]),J.texParameteri(T,J.TEXTURE_WRAP_T,J0[I.wrapT]),T===J.TEXTURE_3D||T===J.TEXTURE_2D_ARRAY)J.texParameteri(T,J.TEXTURE_WRAP_R,J0[I.wrapR]);if(J.texParameteri(T,J.TEXTURE_MAG_FILTER,x0[I.magFilter]),J.texParameteri(T,J.TEXTURE_MIN_FILTER,x0[I.minFilter]),I.compareFunction)J.texParameteri(T,J.TEXTURE_COMPARE_MODE,J.COMPARE_REF_TO_TEXTURE),J.texParameteri(T,J.TEXTURE_COMPARE_FUNC,v0[I.compareFunction]);if(Q.has("EXT_texture_filter_anisotropic")===!0){if(I.magFilter===L9)return;if(I.minFilter!==I8&&I.minFilter!==P9)return;if(I.type===tJ&&Q.has("OES_texture_float_linear")===!1)return;if(I.anisotropy>1||Z.get(I).__currentAnisotropy){let d=Q.get("EXT_texture_filter_anisotropic");J.texParameterf(T,d.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(I.anisotropy,W.getMaxAnisotropy())),Z.get(I).__currentAnisotropy=I.anisotropy}}}function Y0(T,I){let d=!1;if(T.__webglInit===void 0)T.__webglInit=!0,I.addEventListener("dispose",V);let r=I.source,t=O.get(r);if(t===void 0)t={},O.set(r,t);let $0=p(I);if($0!==T.__cacheKey){if(t[$0]===void 0)t[$0]={texture:J.createTexture(),usedTimes:0},X.memory.textures++,d=!0;t[$0].usedTimes++;let E0=t[T.__cacheKey];if(E0!==void 0){if(t[T.__cacheKey].usedTimes--,E0.usedTimes===0)A(I)}T.__cacheKey=$0,T.__webglTexture=t[$0].texture}return d}function D0(T,I,d){return Math.floor(Math.floor(T/d)/I)}function G0(T,I,d,r){let $0=T.updateRanges;if($0.length===0)$.texSubImage2D(J.TEXTURE_2D,0,0,0,I.width,I.height,d,r,I.data);else{$0.sort((B0,W0)=>B0.start-W0.start);let E0=0;for(let B0=1;B0<$0.length;B0++){let W0=$0[E0],F0=$0[B0],y0=W0.start+W0.count,g0=D0(F0.start,I.width,4),c0=D0(W0.start,I.width,4);if(F0.start<=y0+1&&g0===c0&&D0(F0.start+F0.count-1,I.width,4)===g0)W0.count=Math.max(W0.count,F0.start+F0.count-W0.start);else++E0,$0[E0]=F0}$0.length=E0+1;let n=$.getParameter(J.UNPACK_ROW_LENGTH),o=$.getParameter(J.UNPACK_SKIP_PIXELS),K0=$.getParameter(J.UNPACK_SKIP_ROWS);$.pixelStorei(J.UNPACK_ROW_LENGTH,I.width);for(let B0=0,W0=$0.length;B0<W0;B0++){let F0=$0[B0],y0=Math.floor(F0.start/4),g0=Math.ceil(F0.count/4),c0=y0%I.width,x=Math.floor(y0/I.width),X0=g0,i=1;$.pixelStorei(J.UNPACK_SKIP_PIXELS,c0),$.pixelStorei(J.UNPACK_SKIP_ROWS,x),$.texSubImage2D(J.TEXTURE_2D,0,c0,x,X0,1,d,r,I.data)}T.clearUpdateRanges(),$.pixelStorei(J.UNPACK_ROW_LENGTH,n),$.pixelStorei(J.UNPACK_SKIP_PIXELS,o),$.pixelStorei(J.UNPACK_SKIP_ROWS,K0)}}function w0(T,I,d){let r=J.TEXTURE_2D;if(I.isDataArrayTexture||I.isCompressedArrayTexture)r=J.TEXTURE_2D_ARRAY;if(I.isData3DTexture)r=J.TEXTURE_3D;let t=Y0(T,I),$0=I.source;$.bindTexture(r,T.__webglTexture,J.TEXTURE0+d);let E0=Z.get($0);if($0.version!==E0.__version||t===!0){if($.activeTexture(J.TEXTURE0+d),(typeof ImageBitmap<"u"&&I.image instanceof ImageBitmap)===!1){let i=s0.getPrimaries(s0.workingColorSpace),Z0=I.colorSpace===_8?null:s0.getPrimaries(I.colorSpace),V0=I.colorSpace===_8||i===Z0?J.NONE:J.BROWSER_DEFAULT_WEBGL;$.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,I.flipY),$.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),$.pixelStorei(J.UNPACK_COLORSPACE_CONVERSION_WEBGL,V0)}$.pixelStorei(J.UNPACK_ALIGNMENT,I.unpackAlignment);let o=q(I.image,!1,W.maxTextureSize);o=qJ(I,o);let K0=Y.convert(I.format,I.colorSpace),B0=Y.convert(I.type),W0=k(I.internalFormat,K0,B0,I.normalized,I.colorSpace,I.isVideoTexture);s(r,I);let F0,y0=I.mipmaps,g0=I.isVideoTexture!==!0,c0=E0.__version===void 0||t===!0,x=$0.dataReady,X0=P(I,o);if(I.isDepthTexture){if(W0=_(I.format===w8,I.type),c0)if(g0)$.texStorage2D(J.TEXTURE_2D,1,W0,o.width,o.height);else $.texImage2D(J.TEXTURE_2D,0,W0,o.width,o.height,0,K0,B0,null)}else if(I.isDataTexture)if(y0.length>0){if(g0&&c0)$.texStorage2D(J.TEXTURE_2D,X0,W0,y0[0].width,y0[0].height);for(let i=0,Z0=y0.length;i<Z0;i++)if(F0=y0[i],g0){if(x)$.texSubImage2D(J.TEXTURE_2D,i,0,0,F0.width,F0.height,K0,B0,F0.data)}else $.texImage2D(J.TEXTURE_2D,i,W0,F0.width,F0.height,0,K0,B0,F0.data);I.generateMipmaps=!1}else if(g0){if(c0)$.texStorage2D(J.TEXTURE_2D,X0,W0,o.width,o.height);if(x)G0(I,o,K0,B0)}else $.texImage2D(J.TEXTURE_2D,0,W0,o.width,o.height,0,K0,B0,o.data);else if(I.isCompressedTexture)if(I.isCompressedArrayTexture){if(g0&&c0)$.texStorage3D(J.TEXTURE_2D_ARRAY,X0,W0,y0[0].width,y0[0].height,o.depth);for(let i=0,Z0=y0.length;i<Z0;i++)if(F0=y0[i],I.format!==_9)if(K0!==null)if(g0){if(x)if(I.layerUpdates.size>0){let V0=yZ(F0.width,F0.height,I.format,I.type);for(let e of I.layerUpdates){let z0=F0.data.subarray(e*V0/F0.data.BYTES_PER_ELEMENT,(e+1)*V0/F0.data.BYTES_PER_ELEMENT);$.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,i,0,0,e,F0.width,F0.height,1,K0,z0)}I.clearLayerUpdates()}else $.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,i,0,0,0,F0.width,F0.height,o.depth,K0,F0.data)}else $.compressedTexImage3D(J.TEXTURE_2D_ARRAY,i,W0,F0.width,F0.height,o.depth,0,F0.data,0,0);else C0("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(g0){if(x)$.texSubImage3D(J.TEXTURE_2D_ARRAY,i,0,0,0,F0.width,F0.height,o.depth,K0,B0,F0.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,i,W0,F0.width,F0.height,o.depth,0,K0,B0,F0.data)}else{if(g0&&c0)$.texStorage2D(J.TEXTURE_2D,X0,W0,y0[0].width,y0[0].height);for(let i=0,Z0=y0.length;i<Z0;i++)if(F0=y0[i],I.format!==_9)if(K0!==null)if(g0){if(x)$.compressedTexSubImage2D(J.TEXTURE_2D,i,0,0,F0.width,F0.height,K0,F0.data)}else $.compressedTexImage2D(J.TEXTURE_2D,i,W0,F0.width,F0.height,0,F0.data);else C0("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if(g0){if(x)$.texSubImage2D(J.TEXTURE_2D,i,0,0,F0.width,F0.height,K0,B0,F0.data)}else $.texImage2D(J.TEXTURE_2D,i,W0,F0.width,F0.height,0,K0,B0,F0.data)}else if(I.isDataArrayTexture)if(g0){if(c0)$.texStorage3D(J.TEXTURE_2D_ARRAY,X0,W0,o.width,o.height,o.depth);if(x)if(I.layerUpdates.size>0){let i=yZ(o.width,o.height,I.format,I.type);for(let Z0 of I.layerUpdates){let V0=o.data.subarray(Z0*i/o.data.BYTES_PER_ELEMENT,(Z0+1)*i/o.data.BYTES_PER_ELEMENT);$.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,Z0,o.width,o.height,1,K0,B0,V0)}I.clearLayerUpdates()}else $.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,0,o.width,o.height,o.depth,K0,B0,o.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,0,W0,o.width,o.height,o.depth,0,K0,B0,o.data);else if(I.isData3DTexture)if(g0){if(c0)$.texStorage3D(J.TEXTURE_3D,X0,W0,o.width,o.height,o.depth);if(x)$.texSubImage3D(J.TEXTURE_3D,0,0,0,0,o.width,o.height,o.depth,K0,B0,o.data)}else $.texImage3D(J.TEXTURE_3D,0,W0,o.width,o.height,o.depth,0,K0,B0,o.data);else if(I.isFramebufferTexture){if(c0)if(g0)$.texStorage2D(J.TEXTURE_2D,X0,W0,o.width,o.height);else{let{width:i,height:Z0}=o;for(let V0=0;V0<X0;V0++)$.texImage2D(J.TEXTURE_2D,V0,W0,i,Z0,0,K0,B0,null),i>>=1,Z0>>=1}}else if(I.isHTMLTexture){if("texElementImage2D"in J){let i=J.canvas;if(!i.hasAttribute("layoutsubtree"))i.setAttribute("layoutsubtree","true");if(o.parentNode!==i){i.appendChild(o),F.add(I),i.onpaint=(b0)=>{let IJ=b0.changedElements;for(let ZJ of F)if(IJ.includes(ZJ.image))ZJ.needsUpdate=!0},i.requestPaint();return}let Z0=0,V0=J.RGBA,e=J.RGBA,z0=J.UNSIGNED_BYTE;J.texElementImage2D(J.TEXTURE_2D,Z0,V0,e,z0,o),J.texParameteri(J.TEXTURE_2D,J.TEXTURE_MIN_FILTER,J.LINEAR),J.texParameteri(J.TEXTURE_2D,J.TEXTURE_WRAP_S,J.CLAMP_TO_EDGE),J.texParameteri(J.TEXTURE_2D,J.TEXTURE_WRAP_T,J.CLAMP_TO_EDGE)}}else if(y0.length>0){if(g0&&c0){let i=T0(y0[0]);$.texStorage2D(J.TEXTURE_2D,X0,W0,i.width,i.height)}for(let i=0,Z0=y0.length;i<Z0;i++)if(F0=y0[i],g0){if(x)$.texSubImage2D(J.TEXTURE_2D,i,0,0,K0,B0,F0)}else $.texImage2D(J.TEXTURE_2D,i,W0,K0,B0,F0);I.generateMipmaps=!1}else if(g0){if(c0){let i=T0(o);$.texStorage2D(J.TEXTURE_2D,X0,W0,i.width,i.height)}if(x)$.texSubImage2D(J.TEXTURE_2D,0,0,0,K0,B0,o)}else $.texImage2D(J.TEXTURE_2D,0,W0,K0,B0,o);if(N(I))L(r);if(E0.__version=$0.version,I.onUpdate)I.onUpdate(I)}T.__version=I.version}function i0(T,I,d){if(I.image.length!==6)return;let r=Y0(T,I),t=I.source;$.bindTexture(J.TEXTURE_CUBE_MAP,T.__webglTexture,J.TEXTURE0+d);let $0=Z.get(t);if(t.version!==$0.__version||r===!0){$.activeTexture(J.TEXTURE0+d);let E0=s0.getPrimaries(s0.workingColorSpace),n=I.colorSpace===_8?null:s0.getPrimaries(I.colorSpace),o=I.colorSpace===_8||E0===n?J.NONE:J.BROWSER_DEFAULT_WEBGL;$.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,I.flipY),$.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),$.pixelStorei(J.UNPACK_ALIGNMENT,I.unpackAlignment),$.pixelStorei(J.UNPACK_COLORSPACE_CONVERSION_WEBGL,o);let K0=I.isCompressedTexture||I.image[0].isCompressedTexture,B0=I.image[0]&&I.image[0].isDataTexture,W0=[];for(let e=0;e<6;e++){if(!K0&&!B0)W0[e]=q(I.image[e],!0,W.maxCubemapSize);else W0[e]=B0?I.image[e].image:I.image[e];W0[e]=qJ(I,W0[e])}let F0=W0[0],y0=Y.convert(I.format,I.colorSpace),g0=Y.convert(I.type),c0=k(I.internalFormat,y0,g0,I.normalized,I.colorSpace),x=I.isVideoTexture!==!0,X0=$0.__version===void 0||r===!0,i=t.dataReady,Z0=P(I,F0);s(J.TEXTURE_CUBE_MAP,I);let V0;if(K0){if(x&&X0)$.texStorage2D(J.TEXTURE_CUBE_MAP,Z0,c0,F0.width,F0.height);for(let e=0;e<6;e++){V0=W0[e].mipmaps;for(let z0=0;z0<V0.length;z0++){let b0=V0[z0];if(I.format!==_9)if(y0!==null)if(x){if(i)$.compressedTexSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0,0,0,b0.width,b0.height,y0,b0.data)}else $.compressedTexImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0,c0,b0.width,b0.height,0,b0.data);else C0("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()");else if(x){if(i)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0,0,0,b0.width,b0.height,y0,g0,b0.data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0,c0,b0.width,b0.height,0,y0,g0,b0.data)}}}else{if(V0=I.mipmaps,x&&X0){if(V0.length>0)Z0++;let e=T0(W0[0]);$.texStorage2D(J.TEXTURE_CUBE_MAP,Z0,c0,e.width,e.height)}for(let e=0;e<6;e++)if(B0){if(x){if(i)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,W0[e].width,W0[e].height,y0,g0,W0[e].data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,c0,W0[e].width,W0[e].height,0,y0,g0,W0[e].data);for(let z0=0;z0<V0.length;z0++){let IJ=V0[z0].image[e].image;if(x){if(i)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0+1,0,0,IJ.width,IJ.height,y0,g0,IJ.data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0+1,c0,IJ.width,IJ.height,0,y0,g0,IJ.data)}}else{if(x){if(i)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,y0,g0,W0[e])}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,c0,y0,g0,W0[e]);for(let z0=0;z0<V0.length;z0++){let b0=V0[z0];if(x){if(i)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0+1,0,0,y0,g0,b0.image[e])}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+e,z0+1,c0,y0,g0,b0.image[e])}}}if(N(I))L(J.TEXTURE_CUBE_MAP);if($0.__version=t.version,I.onUpdate)I.onUpdate(I)}T.__version=I.version}function j0(T,I,d,r,t,$0){let E0=Y.convert(d.format,d.colorSpace),n=Y.convert(d.type),o=k(d.internalFormat,E0,n,d.normalized,d.colorSpace),K0=Z.get(I),B0=Z.get(d);if(B0.__renderTarget=I,!K0.__hasExternalTextures){let W0=Math.max(1,I.width>>$0),F0=Math.max(1,I.height>>$0);if(t===J.TEXTURE_3D||t===J.TEXTURE_2D_ARRAY)$.texImage3D(t,$0,o,W0,F0,I.depth,0,E0,n,null);else $.texImage2D(t,$0,o,W0,F0,0,E0,n,null)}if($.bindFramebuffer(J.FRAMEBUFFER,T),t0(I))K.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,r,t,B0.__webglTexture,0,a0(I));else if(t===J.TEXTURE_2D||t>=J.TEXTURE_CUBE_MAP_POSITIVE_X&&t<=J.TEXTURE_CUBE_MAP_NEGATIVE_Z)J.framebufferTexture2D(J.FRAMEBUFFER,r,t,B0.__webglTexture,$0);$.bindFramebuffer(J.FRAMEBUFFER,null)}function d0(T,I,d){if(J.bindRenderbuffer(J.RENDERBUFFER,T),I.depthBuffer){let r=I.depthTexture,t=r&&r.isDepthTexture?r.type:null,$0=_(I.stencilBuffer,t),E0=I.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;if(t0(I))K.renderbufferStorageMultisampleEXT(J.RENDERBUFFER,a0(I),$0,I.width,I.height);else if(d)J.renderbufferStorageMultisample(J.RENDERBUFFER,a0(I),$0,I.width,I.height);else J.renderbufferStorage(J.RENDERBUFFER,$0,I.width,I.height);J.framebufferRenderbuffer(J.FRAMEBUFFER,E0,J.RENDERBUFFER,T)}else{let r=I.textures;for(let t=0;t<r.length;t++){let $0=r[t],E0=Y.convert($0.format,$0.colorSpace),n=Y.convert($0.type),o=k($0.internalFormat,E0,n,$0.normalized,$0.colorSpace);if(t0(I))K.renderbufferStorageMultisampleEXT(J.RENDERBUFFER,a0(I),o,I.width,I.height);else if(d)J.renderbufferStorageMultisample(J.RENDERBUFFER,a0(I),o,I.width,I.height);else J.renderbufferStorage(J.RENDERBUFFER,o,I.width,I.height)}}J.bindRenderbuffer(J.RENDERBUFFER,null)}function YJ(T,I,d){let r=I.isWebGLCubeRenderTarget===!0;if($.bindFramebuffer(J.FRAMEBUFFER,T),!(I.depthTexture&&I.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let t=Z.get(I.depthTexture);if(t.__renderTarget=I,!t.__webglTexture||I.depthTexture.image.width!==I.width||I.depthTexture.image.height!==I.height)I.depthTexture.image.width=I.width,I.depthTexture.image.height=I.height,I.depthTexture.needsUpdate=!0;if(r){if(t.__webglInit===void 0)t.__webglInit=!0,I.depthTexture.addEventListener("dispose",V);if(t.__webglTexture===void 0){t.__webglTexture=J.createTexture(),$.bindTexture(J.TEXTURE_CUBE_MAP,t.__webglTexture),s(J.TEXTURE_CUBE_MAP,I.depthTexture);let K0=Y.convert(I.depthTexture.format),B0=Y.convert(I.depthTexture.type),W0;if(I.depthTexture.format===z8)W0=J.DEPTH_COMPONENT24;else if(I.depthTexture.format===w8)W0=J.DEPTH24_STENCIL8;for(let F0=0;F0<6;F0++)J.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+F0,0,W0,I.width,I.height,0,K0,B0,null)}}else c(I.depthTexture,0);let $0=t.__webglTexture,E0=a0(I),n=r?J.TEXTURE_CUBE_MAP_POSITIVE_X+d:J.TEXTURE_2D,o=I.depthTexture.format===w8?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;if(I.depthTexture.format===z8)if(t0(I))K.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,o,n,$0,0,E0);else J.framebufferTexture2D(J.FRAMEBUFFER,o,n,$0,0);else if(I.depthTexture.format===w8)if(t0(I))K.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,o,n,$0,0,E0);else J.framebufferTexture2D(J.FRAMEBUFFER,o,n,$0,0);else throw Error("Unknown depthTexture format")}function XJ(T){let I=Z.get(T),d=T.isWebGLCubeRenderTarget===!0;if(I.__boundDepthTexture!==T.depthTexture){let r=T.depthTexture;if(I.__depthDisposeCallback)I.__depthDisposeCallback();if(r){let t=()=>{delete I.__boundDepthTexture,delete I.__depthDisposeCallback,r.removeEventListener("dispose",t)};r.addEventListener("dispose",t),I.__depthDisposeCallback=t}I.__boundDepthTexture=r}if(T.depthTexture&&!I.__autoAllocateDepthBuffer)if(d)for(let r=0;r<6;r++)YJ(I.__webglFramebuffer[r],T,r);else{let r=T.texture.mipmaps;if(r&&r.length>0)YJ(I.__webglFramebuffer[0],T,0);else YJ(I.__webglFramebuffer,T,0)}else if(d){I.__webglDepthbuffer=[];for(let r=0;r<6;r++)if($.bindFramebuffer(J.FRAMEBUFFER,I.__webglFramebuffer[r]),I.__webglDepthbuffer[r]===void 0)I.__webglDepthbuffer[r]=J.createRenderbuffer(),d0(I.__webglDepthbuffer[r],T,!1);else{let t=T.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,$0=I.__webglDepthbuffer[r];J.bindRenderbuffer(J.RENDERBUFFER,$0),J.framebufferRenderbuffer(J.FRAMEBUFFER,t,J.RENDERBUFFER,$0)}}else{let r=T.texture.mipmaps;if(r&&r.length>0)$.bindFramebuffer(J.FRAMEBUFFER,I.__webglFramebuffer[0]);else $.bindFramebuffer(J.FRAMEBUFFER,I.__webglFramebuffer);if(I.__webglDepthbuffer===void 0)I.__webglDepthbuffer=J.createRenderbuffer(),d0(I.__webglDepthbuffer,T,!1);else{let t=T.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,$0=I.__webglDepthbuffer;J.bindRenderbuffer(J.RENDERBUFFER,$0),J.framebufferRenderbuffer(J.FRAMEBUFFER,t,J.RENDERBUFFER,$0)}}$.bindFramebuffer(J.FRAMEBUFFER,null)}function u0(T,I,d){let r=Z.get(T);if(I!==void 0)j0(r.__webglFramebuffer,T,T.texture,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,0);if(d!==void 0)XJ(T)}function jJ(T){let I=T.texture,d=Z.get(T),r=Z.get(I);T.addEventListener("dispose",D);let t=T.textures,$0=T.isWebGLCubeRenderTarget===!0,E0=t.length>1;if(!E0){if(r.__webglTexture===void 0)r.__webglTexture=J.createTexture();r.__version=I.version,X.memory.textures++}if($0){d.__webglFramebuffer=[];for(let n=0;n<6;n++)if(I.mipmaps&&I.mipmaps.length>0){d.__webglFramebuffer[n]=[];for(let o=0;o<I.mipmaps.length;o++)d.__webglFramebuffer[n][o]=J.createFramebuffer()}else d.__webglFramebuffer[n]=J.createFramebuffer()}else{if(I.mipmaps&&I.mipmaps.length>0){d.__webglFramebuffer=[];for(let n=0;n<I.mipmaps.length;n++)d.__webglFramebuffer[n]=J.createFramebuffer()}else d.__webglFramebuffer=J.createFramebuffer();if(E0)for(let n=0,o=t.length;n<o;n++){let K0=Z.get(t[n]);if(K0.__webglTexture===void 0)K0.__webglTexture=J.createTexture(),X.memory.textures++}if(T.samples>0&&t0(T)===!1){d.__webglMultisampledFramebuffer=J.createFramebuffer(),d.__webglColorRenderbuffer=[],$.bindFramebuffer(J.FRAMEBUFFER,d.__webglMultisampledFramebuffer);for(let n=0;n<t.length;n++){let o=t[n];d.__webglColorRenderbuffer[n]=J.createRenderbuffer(),J.bindRenderbuffer(J.RENDERBUFFER,d.__webglColorRenderbuffer[n]);let K0=Y.convert(o.format,o.colorSpace),B0=Y.convert(o.type),W0=k(o.internalFormat,K0,B0,o.normalized,o.colorSpace,T.isXRRenderTarget===!0),F0=a0(T);J.renderbufferStorageMultisample(J.RENDERBUFFER,F0,W0,T.width,T.height),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+n,J.RENDERBUFFER,d.__webglColorRenderbuffer[n])}if(J.bindRenderbuffer(J.RENDERBUFFER,null),T.depthBuffer)d.__webglDepthRenderbuffer=J.createRenderbuffer(),d0(d.__webglDepthRenderbuffer,T,!0);$.bindFramebuffer(J.FRAMEBUFFER,null)}}if($0){$.bindTexture(J.TEXTURE_CUBE_MAP,r.__webglTexture),s(J.TEXTURE_CUBE_MAP,I);for(let n=0;n<6;n++)if(I.mipmaps&&I.mipmaps.length>0)for(let o=0;o<I.mipmaps.length;o++)j0(d.__webglFramebuffer[n][o],T,I,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+n,o);else j0(d.__webglFramebuffer[n],T,I,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);if(N(I))L(J.TEXTURE_CUBE_MAP);$.unbindTexture()}else if(E0){for(let n=0,o=t.length;n<o;n++){let K0=t[n],B0=Z.get(K0),W0=J.TEXTURE_2D;if(T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)W0=T.isWebGL3DRenderTarget?J.TEXTURE_3D:J.TEXTURE_2D_ARRAY;if($.bindTexture(W0,B0.__webglTexture),s(W0,K0),j0(d.__webglFramebuffer,T,K0,J.COLOR_ATTACHMENT0+n,W0,0),N(K0))L(W0)}$.unbindTexture()}else{let n=J.TEXTURE_2D;if(T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)n=T.isWebGL3DRenderTarget?J.TEXTURE_3D:J.TEXTURE_2D_ARRAY;if($.bindTexture(n,r.__webglTexture),s(n,I),I.mipmaps&&I.mipmaps.length>0)for(let o=0;o<I.mipmaps.length;o++)j0(d.__webglFramebuffer[o],T,I,J.COLOR_ATTACHMENT0,n,o);else j0(d.__webglFramebuffer,T,I,J.COLOR_ATTACHMENT0,n,0);if(N(I))L(n);$.unbindTexture()}if(T.depthBuffer)XJ(T)}function vJ(T){let I=T.textures;for(let d=0,r=I.length;d<r;d++){let t=I[d];if(N(t)){let $0=M(T),E0=Z.get(t).__webglTexture;$.bindTexture($0,E0),L($0),$.unbindTexture()}}}let CJ=[],b=[];function pJ(T){if(T.samples>0){if(t0(T)===!1){let{textures:I,width:d,height:r}=T,t=J.COLOR_BUFFER_BIT,$0=T.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,E0=Z.get(T),n=I.length>1;if(n)for(let K0=0;K0<I.length;K0++)$.bindFramebuffer(J.FRAMEBUFFER,E0.__webglMultisampledFramebuffer),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+K0,J.RENDERBUFFER,null),$.bindFramebuffer(J.FRAMEBUFFER,E0.__webglFramebuffer),J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0+K0,J.TEXTURE_2D,null,0);$.bindFramebuffer(J.READ_FRAMEBUFFER,E0.__webglMultisampledFramebuffer);let o=T.texture.mipmaps;if(o&&o.length>0)$.bindFramebuffer(J.DRAW_FRAMEBUFFER,E0.__webglFramebuffer[0]);else $.bindFramebuffer(J.DRAW_FRAMEBUFFER,E0.__webglFramebuffer);for(let K0=0;K0<I.length;K0++){if(T.resolveDepthBuffer){if(T.depthBuffer)t|=J.DEPTH_BUFFER_BIT;if(T.stencilBuffer&&T.resolveStencilBuffer)t|=J.STENCIL_BUFFER_BIT}if(n){J.framebufferRenderbuffer(J.READ_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.RENDERBUFFER,E0.__webglColorRenderbuffer[K0]);let B0=Z.get(I[K0]).__webglTexture;J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,B0,0)}if(J.blitFramebuffer(0,0,d,r,0,0,d,r,t,J.NEAREST),H===!0){if(CJ.length=0,b.length=0,CJ.push(J.COLOR_ATTACHMENT0+K0),T.depthBuffer&&T.resolveDepthBuffer===!1)CJ.push($0),b.push($0),J.invalidateFramebuffer(J.DRAW_FRAMEBUFFER,b);J.invalidateFramebuffer(J.READ_FRAMEBUFFER,CJ)}}if($.bindFramebuffer(J.READ_FRAMEBUFFER,null),$.bindFramebuffer(J.DRAW_FRAMEBUFFER,null),n)for(let K0=0;K0<I.length;K0++){$.bindFramebuffer(J.FRAMEBUFFER,E0.__webglMultisampledFramebuffer),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+K0,J.RENDERBUFFER,E0.__webglColorRenderbuffer[K0]);let B0=Z.get(I[K0]).__webglTexture;$.bindFramebuffer(J.FRAMEBUFFER,E0.__webglFramebuffer),J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0+K0,J.TEXTURE_2D,B0,0)}$.bindFramebuffer(J.DRAW_FRAMEBUFFER,E0.__webglMultisampledFramebuffer)}else if(T.depthBuffer&&T.resolveDepthBuffer===!1&&H){let I=T.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;J.invalidateFramebuffer(J.DRAW_FRAMEBUFFER,[I])}}}function a0(T){return Math.min(W.maxSamples,T.samples)}function t0(T){let I=Z.get(T);return T.samples>0&&Q.has("WEBGL_multisampled_render_to_texture")===!0&&I.__useRenderToTexture!==!1}function O0(T){let I=X.render.frame;if(G.get(T)!==I)G.set(T,I),T.update()}function qJ(T,I){let{colorSpace:d,format:r,type:t}=T;if(T.isCompressedTexture===!0||T.isVideoTexture===!0)return I;if(d!==uJ&&d!==_8)if(s0.getTransfer(d)===UJ){if(r!==_9||t!==D9)C0("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.")}else A0("WebGLTextures: Unsupported texture color space:",d);return I}function T0(T){if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement)U.width=T.naturalWidth||T.width,U.height=T.naturalHeight||T.height;else if(typeof VideoFrame<"u"&&T instanceof VideoFrame)U.width=T.displayWidth,U.height=T.displayHeight;else U.width=T.width,U.height=T.height;return U}this.allocateTextureUnit=g,this.resetTextureUnits=y,this.getTextureUnits=v,this.setTextureUnits=h,this.setTexture2D=c,this.setTexture2DArray=a,this.setTexture3D=Q0,this.setTextureCube=H0,this.rebindTextures=u0,this.setupRenderTarget=jJ,this.updateRenderTargetMipmap=vJ,this.updateMultisampleRenderTarget=pJ,this.setupDepthRenderbuffer=XJ,this.setupFrameBufferTexture=j0,this.useMultisampledRTT=t0,this.isReversedDepthBuffer=function(){return $.buffers.depth.getReversed()}}function s1(J,Q){function $(Z,W=_8){let Y,X=s0.getTransfer(W);if(Z===D9)return J.UNSIGNED_BYTE;if(Z===C$)return J.UNSIGNED_SHORT_4_4_4_4;if(Z===I$)return J.UNSIGNED_SHORT_5_5_5_1;if(Z===fY)return J.UNSIGNED_INT_5_9_9_9_REV;if(Z===gY)return J.UNSIGNED_INT_10F_11F_11F_REV;if(Z===xY)return J.BYTE;if(Z===bY)return J.SHORT;if(Z===d6)return J.UNSIGNED_SHORT;if(Z===V$)return J.INT;if(Z===K8)return J.UNSIGNED_INT;if(Z===tJ)return J.FLOAT;if(Z===fJ)return J.HALF_FLOAT;if(Z===pY)return J.ALPHA;if(Z===dY)return J.RGB;if(Z===_9)return J.RGBA;if(Z===z8)return J.DEPTH_COMPONENT;if(Z===w8)return J.DEPTH_STENCIL;if(Z===uY)return J.RED;if(Z===z$)return J.RED_INTEGER;if(Z===P8)return J.RG;if(Z===w$)return J.RG_INTEGER;if(Z===P$)return J.RGBA_INTEGER;if(Z===n7||Z===s7||Z===i7||Z===o7)if(X===UJ)if(Y=Q.get("WEBGL_compressed_texture_s3tc_srgb"),Y!==null){if(Z===n7)return Y.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(Z===s7)return Y.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(Z===i7)return Y.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(Z===o7)return Y.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(Y=Q.get("WEBGL_compressed_texture_s3tc"),Y!==null){if(Z===n7)return Y.COMPRESSED_RGB_S3TC_DXT1_EXT;if(Z===s7)return Y.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(Z===i7)return Y.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(Z===o7)return Y.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(Z===_$||Z===T$||Z===A$||Z===S$)if(Y=Q.get("WEBGL_compressed_texture_pvrtc"),Y!==null){if(Z===_$)return Y.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(Z===T$)return Y.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(Z===A$)return Y.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(Z===S$)return Y.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(Z===j$||Z===v$||Z===y$||Z===h$||Z===x$||Z===a7||Z===b$)if(Y=Q.get("WEBGL_compressed_texture_etc"),Y!==null){if(Z===j$||Z===v$)return X===UJ?Y.COMPRESSED_SRGB8_ETC2:Y.COMPRESSED_RGB8_ETC2;if(Z===y$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:Y.COMPRESSED_RGBA8_ETC2_EAC;if(Z===h$)return Y.COMPRESSED_R11_EAC;if(Z===x$)return Y.COMPRESSED_SIGNED_R11_EAC;if(Z===a7)return Y.COMPRESSED_RG11_EAC;if(Z===b$)return Y.COMPRESSED_SIGNED_RG11_EAC}else return null;if(Z===f$||Z===g$||Z===p$||Z===d$||Z===u$||Z===m$||Z===l$||Z===c$||Z===n$||Z===s$||Z===i$||Z===o$||Z===a$||Z===r$)if(Y=Q.get("WEBGL_compressed_texture_astc"),Y!==null){if(Z===f$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:Y.COMPRESSED_RGBA_ASTC_4x4_KHR;if(Z===g$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:Y.COMPRESSED_RGBA_ASTC_5x4_KHR;if(Z===p$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:Y.COMPRESSED_RGBA_ASTC_5x5_KHR;if(Z===d$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:Y.COMPRESSED_RGBA_ASTC_6x5_KHR;if(Z===u$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:Y.COMPRESSED_RGBA_ASTC_6x6_KHR;if(Z===m$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:Y.COMPRESSED_RGBA_ASTC_8x5_KHR;if(Z===l$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:Y.COMPRESSED_RGBA_ASTC_8x6_KHR;if(Z===c$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:Y.COMPRESSED_RGBA_ASTC_8x8_KHR;if(Z===n$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:Y.COMPRESSED_RGBA_ASTC_10x5_KHR;if(Z===s$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:Y.COMPRESSED_RGBA_ASTC_10x6_KHR;if(Z===i$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:Y.COMPRESSED_RGBA_ASTC_10x8_KHR;if(Z===o$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:Y.COMPRESSED_RGBA_ASTC_10x10_KHR;if(Z===a$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:Y.COMPRESSED_RGBA_ASTC_12x10_KHR;if(Z===r$)return X===UJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:Y.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(Z===t$||Z===e$||Z===JZ)if(Y=Q.get("EXT_texture_compression_bptc"),Y!==null){if(Z===t$)return X===UJ?Y.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:Y.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(Z===e$)return Y.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(Z===JZ)return Y.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(Z===QZ||Z===$Z||Z===r7||Z===ZZ)if(Y=Q.get("EXT_texture_compression_rgtc"),Y!==null){if(Z===QZ)return Y.COMPRESSED_RED_RGTC1_EXT;if(Z===$Z)return Y.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(Z===r7)return Y.COMPRESSED_RED_GREEN_RGTC2_EXT;if(Z===ZZ)return Y.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;if(Z===H6)return J.UNSIGNED_INT_24_8;return J[Z]!==void 0?J[Z]:null}return{convert:$}}var i1=`
4080
+ }`,eL=[new T(1,0,0),new T(-1,0,0),new T(0,1,0),new T(0,-1,0),new T(0,0,1),new T(0,0,-1)],JD=[new T(0,-1,0),new T(0,-1,0),new T(0,0,1),new T(0,0,-1),new T(0,-1,0),new T(0,-1,0)],m5=new y0,R$=new T,YH=new T;function QD(J,Q,$){let Z=new H8,W=new i,Y=new i,X=new FJ,K=new W$,H=new Y$,U={},G=$.maxTextureSize,F={[n9]:pJ,[pJ]:n9,[Y9]:Y9},E=new LJ({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new i},radius:{value:4}},vertexShader:rL,fragmentShader:tL}),O=E.clone();O.defines.HORIZONTAL_PASS=1;let R=new u0;R.setAttribute("position",new i0(new Float32Array([-1,-1,0.5,3,-1,0.5,-1,3,0.5]),3));let k=new a0(R,E),q=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=C7;let N=this.type;this.render=function(z,B,M){if(q.enabled===!1)return;if(q.autoUpdate===!1&&q.needsUpdate===!1)return;if(z.length===0)return;if(this.type===WX)O0("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=C7;let C=J.getRenderTarget(),j=J.getActiveCubeFace(),w=J.getActiveMipmapLevel(),v=J.state;if(v.setBlending(M9),v.buffers.depth.getReversed()===!0)v.buffers.color.setClear(0,0,0,0);else v.buffers.color.setClear(1,1,1,1);v.buffers.depth.setTest(!0),v.setScissorTest(!1);let b=N!==this.type;if(b)B.traverse(function(S){if(S.material)if(Array.isArray(S.material))S.material.forEach((h)=>h.needsUpdate=!0);else S.material.needsUpdate=!0});for(let S=0,h=z.length;S<h;S++){let x=z[S],p=x.shadow;if(p===void 0){O0("WebGLShadowMap:",x,"has no shadow.");continue}if(p.autoUpdate===!1&&p.needsUpdate===!1)continue;W.copy(p.mapSize);let c=p.getFrameExtents();if(W.multiply(c),Y.copy(p.mapSize),W.x>G||W.y>G){if(W.x>G)Y.x=Math.floor(G/c.x),W.x=Y.x*c.x,p.mapSize.x=Y.x;if(W.y>G)Y.y=Math.floor(G/c.y),W.y=Y.y*c.y,p.mapSize.y=Y.y}let o=J.state.buffers.depth.getReversed();if(p.camera._reversedDepth=o,p.map===null||b===!0){if(p.map!==null){if(p.map.depthTexture!==null)p.map.depthTexture.dispose(),p.map.depthTexture=null;p.map.dispose()}if(this.type===I6){if(x.isPointLight){O0("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}p.map=new PJ(W.x,W.y,{format:a8,type:wJ,minFilter:jJ,magFilter:jJ,generateMipmaps:!1}),p.map.texture.name=x.name+".shadowMap",p.map.depthTexture=new P8(W.x,W.y,F9),p.map.depthTexture.name=x.name+".shadowMapDepth",p.map.depthTexture.format=i8,p.map.depthTexture.compareFunction=null,p.map.depthTexture.minFilter=A9,p.map.depthTexture.magFilter=A9}else{if(x.isPointLight)p.map=new aW(W.x),p.map.depthTexture=new LW(W.x,z8);else p.map=new PJ(W.x,W.y),p.map.depthTexture=new P8(W.x,W.y,z8);if(p.map.depthTexture.name=x.name+".shadowMap",p.map.depthTexture.format=i8,this.type===C7)p.map.depthTexture.compareFunction=o?yQ:vQ,p.map.depthTexture.minFilter=jJ,p.map.depthTexture.magFilter=jJ;else p.map.depthTexture.compareFunction=null,p.map.depthTexture.minFilter=A9,p.map.depthTexture.magFilter=A9}p.camera.updateProjectionMatrix()}let W0=p.map.isWebGLCubeRenderTarget?6:1;for(let H0=0;H0<W0;H0++){if(p.map.isWebGLCubeRenderTarget)J.setRenderTarget(p.map,H0),J.clear();else{if(H0===0)J.setRenderTarget(p.map),J.clear();let J0=p.getViewport(H0);X.set(Y.x*J0.x,Y.y*J0.y,Y.x*J0.z,Y.y*J0.w),v.viewport(X)}if(x.isPointLight){let{camera:J0,matrix:c0}=p,d0=x.distance||J0.far;if(d0!==J0.far)J0.far=d0,J0.updateProjectionMatrix();R$.setFromMatrixPosition(x.matrixWorld),J0.position.copy(R$),YH.copy(J0.position),YH.add(eL[H0]),J0.up.copy(JD[H0]),J0.lookAt(YH),J0.updateMatrixWorld(),c0.makeTranslation(-R$.x,-R$.y,-R$.z),m5.multiplyMatrices(J0.projectionMatrix,J0.matrixWorldInverse),p._frustum.setFromProjectionMatrix(m5,J0.coordinateSystem,J0.reversedDepth)}else p.updateMatrices(x);Z=p.getFrustum(),V(B,M,p.camera,x,this.type)}if(p.isPointLightShadow!==!0&&this.type===I6)L(p,M);p.needsUpdate=!1}N=this.type,q.needsUpdate=!1,J.setRenderTarget(C,j,w)};function L(z,B){let M=Q.update(k);if(E.defines.VSM_SAMPLES!==z.blurSamples)E.defines.VSM_SAMPLES=z.blurSamples,O.defines.VSM_SAMPLES=z.blurSamples,E.needsUpdate=!0,O.needsUpdate=!0;if(z.mapPass===null)z.mapPass=new PJ(W.x,W.y,{format:a8,type:wJ});E.uniforms.shadow_pass.value=z.map.depthTexture,E.uniforms.resolution.value=z.mapSize,E.uniforms.radius.value=z.radius,J.setRenderTarget(z.mapPass),J.clear(),J.renderBufferDirect(B,null,M,E,k,null),O.uniforms.shadow_pass.value=z.mapPass.texture,O.uniforms.resolution.value=z.mapSize,O.uniforms.radius.value=z.radius,J.setRenderTarget(z.map),J.clear(),J.renderBufferDirect(B,null,M,O,k,null)}function D(z,B,M,C){let j=null,w=M.isPointLight===!0?z.customDistanceMaterial:z.customDepthMaterial;if(w!==void 0)j=w;else if(j=M.isPointLight===!0?H:K,J.localClippingEnabled&&B.clipShadows===!0&&Array.isArray(B.clippingPlanes)&&B.clippingPlanes.length!==0||B.displacementMap&&B.displacementScale!==0||B.alphaMap&&B.alphaTest>0||B.map&&B.alphaTest>0||B.alphaToCoverage===!0){let v=j.uuid,b=B.uuid,S=U[v];if(S===void 0)S={},U[v]=S;let h=S[b];if(h===void 0)h=j.clone(),S[b]=h,B.addEventListener("dispose",I);j=h}if(j.visible=B.visible,j.wireframe=B.wireframe,C===I6)j.side=B.shadowSide!==null?B.shadowSide:B.side;else j.side=B.shadowSide!==null?B.shadowSide:F[B.side];if(j.alphaMap=B.alphaMap,j.alphaTest=B.alphaToCoverage===!0?0.5:B.alphaTest,j.map=B.map,j.clipShadows=B.clipShadows,j.clippingPlanes=B.clippingPlanes,j.clipIntersection=B.clipIntersection,j.displacementMap=B.displacementMap,j.displacementScale=B.displacementScale,j.displacementBias=B.displacementBias,j.wireframeLinewidth=B.wireframeLinewidth,j.linewidth=B.linewidth,M.isPointLight===!0&&j.isMeshDistanceMaterial===!0){let v=J.properties.get(j);v.light=M}return j}function V(z,B,M,C,j){if(z.visible===!1)return;if(z.layers.test(B.layers)&&(z.isMesh||z.isLine||z.isPoints)){if((z.castShadow||z.receiveShadow&&j===I6)&&(!z.frustumCulled||Z.intersectsObject(z))){z.modelViewMatrix.multiplyMatrices(M.matrixWorldInverse,z.matrixWorld);let b=Q.update(z),S=z.material;if(Array.isArray(S)){let h=b.groups;for(let x=0,p=h.length;x<p;x++){let c=h[x],o=S[c.materialIndex];if(o&&o.visible){let W0=D(z,o,C,j);z.onBeforeShadow(J,z,B,M,b,W0,c),J.renderBufferDirect(M,null,b,W0,z,c),z.onAfterShadow(J,z,B,M,b,W0,c)}}}else if(S.visible){let h=D(z,S,C,j);z.onBeforeShadow(J,z,B,M,b,h,null),J.renderBufferDirect(M,null,b,h,z,null),z.onAfterShadow(J,z,B,M,b,h,null)}}}let v=z.children;for(let b=0,S=v.length;b<S;b++)V(v[b],B,M,C,j)}function I(z){z.target.removeEventListener("dispose",I);for(let M in U){let C=U[M],j=z.target.uuid;if(j in C)C[j].dispose(),delete C[j]}}}function $D(J,Q){function $(){let f=!1,q0=new FJ,a=null,G0=new FJ(0,0,0,0);return{setMask:function(S0){if(a!==S0&&!f)J.colorMask(S0,S0,S0,S0),a=S0},setLocked:function(S0){f=S0},setClear:function(S0,Y0,f0,e0,fJ){if(fJ===!0)S0*=e0,Y0*=e0,f0*=e0;if(q0.set(S0,Y0,f0,e0),G0.equals(q0)===!1)J.clearColor(S0,Y0,f0,e0),G0.copy(q0)},reset:function(){f=!1,a=null,G0.set(-1,0,0,0)}}}function Z(){let f=!1,q0=!1,a=null,G0=null,S0=null;return{setReversed:function(Y0){if(q0!==Y0){let f0=Q.get("EXT_clip_control");if(Y0)f0.clipControlEXT(f0.LOWER_LEFT_EXT,f0.ZERO_TO_ONE_EXT);else f0.clipControlEXT(f0.LOWER_LEFT_EXT,f0.NEGATIVE_ONE_TO_ONE_EXT);q0=Y0;let e0=S0;S0=null,this.setClear(e0)}},getReversed:function(){return q0},setTest:function(Y0){if(Y0)E0(J.DEPTH_TEST);else j0(J.DEPTH_TEST)},setMask:function(Y0){if(a!==Y0&&!f)J.depthMask(Y0),a=Y0},setFunc:function(Y0){if(q0)Y0=X5[Y0];if(G0!==Y0){switch(Y0){case zX:J.depthFunc(J.NEVER);break;case _X:J.depthFunc(J.ALWAYS);break;case wX:J.depthFunc(J.LESS);break;case CZ:J.depthFunc(J.LEQUAL);break;case PX:J.depthFunc(J.EQUAL);break;case TX:J.depthFunc(J.GEQUAL);break;case AX:J.depthFunc(J.GREATER);break;case SX:J.depthFunc(J.NOTEQUAL);break;default:J.depthFunc(J.LEQUAL)}G0=Y0}},setLocked:function(Y0){f=Y0},setClear:function(Y0){if(S0!==Y0){if(S0=Y0,q0)Y0=1-Y0;J.clearDepth(Y0)}},reset:function(){f=!1,a=null,G0=null,S0=null,q0=!1}}}function W(){let f=!1,q0=null,a=null,G0=null,S0=null,Y0=null,f0=null,e0=null,fJ=null;return{setTest:function(qJ){if(!f)if(qJ)E0(J.STENCIL_TEST);else j0(J.STENCIL_TEST)},setMask:function(qJ){if(q0!==qJ&&!f)J.stencilMask(qJ),q0=qJ},setFunc:function(qJ,e9,f9){if(a!==qJ||G0!==e9||S0!==f9)J.stencilFunc(qJ,e9,f9),a=qJ,G0=e9,S0=f9},setOp:function(qJ,e9,f9){if(Y0!==qJ||f0!==e9||e0!==f9)J.stencilOp(qJ,e9,f9),Y0=qJ,f0=e9,e0=f9},setLocked:function(qJ){f=qJ},setClear:function(qJ){if(fJ!==qJ)J.clearStencil(qJ),fJ=qJ},reset:function(){f=!1,q0=null,a=null,G0=null,S0=null,Y0=null,f0=null,e0=null,fJ=null}}}let Y=new $,X=new Z,K=new W,H=new WeakMap,U=new WeakMap,G={},F={},E={},O=new WeakMap,R=[],k=null,q=!1,N=null,L=null,D=null,V=null,I=null,z=null,B=null,M=new e(0,0,0),C=0,j=!1,w=null,v=null,b=null,S=null,h=null,x=J.getParameter(J.MAX_COMBINED_TEXTURE_IMAGE_UNITS),p=!1,c=0,o=J.getParameter(J.VERSION);if(o.indexOf("WebGL")!==-1)c=parseFloat(/^WebGL (\d)/.exec(o)[1]),p=c>=1;else if(o.indexOf("OpenGL ES")!==-1)c=parseFloat(/^OpenGL ES (\d)/.exec(o)[1]),p=c>=2;let W0=null,H0={},J0=J.getParameter(J.SCISSOR_BOX),c0=J.getParameter(J.VIEWPORT),d0=new FJ().fromArray(J0),s=new FJ().fromArray(c0);function F0(f,q0,a,G0){let S0=new Uint8Array(4),Y0=J.createTexture();J.bindTexture(f,Y0),J.texParameteri(f,J.TEXTURE_MIN_FILTER,J.NEAREST),J.texParameteri(f,J.TEXTURE_MAG_FILTER,J.NEAREST);for(let f0=0;f0<a;f0++)if(f===J.TEXTURE_3D||f===J.TEXTURE_2D_ARRAY)J.texImage3D(q0,0,J.RGBA,1,1,G0,0,J.RGBA,J.UNSIGNED_BYTE,S0);else J.texImage2D(q0+f0,0,J.RGBA,1,1,0,J.RGBA,J.UNSIGNED_BYTE,S0);return Y0}let z0={};z0[J.TEXTURE_2D]=F0(J.TEXTURE_2D,J.TEXTURE_2D,1),z0[J.TEXTURE_CUBE_MAP]=F0(J.TEXTURE_CUBE_MAP,J.TEXTURE_CUBE_MAP_POSITIVE_X,6),z0[J.TEXTURE_2D_ARRAY]=F0(J.TEXTURE_2D_ARRAY,J.TEXTURE_2D_ARRAY,1,1),z0[J.TEXTURE_3D]=F0(J.TEXTURE_3D,J.TEXTURE_3D,1,1),Y.setClear(0,0,0,1),X.setClear(1),K.setClear(0),E0(J.DEPTH_TEST),X.setFunc(CZ),C0(!1),m0(MZ),E0(J.CULL_FACE),$0(M9);function E0(f){if(G[f]!==!0)J.enable(f),G[f]=!0}function j0(f){if(G[f]!==!1)J.disable(f),G[f]=!1}function WJ(f,q0){if(E[f]!==q0){if(J.bindFramebuffer(f,q0),E[f]=q0,f===J.DRAW_FRAMEBUFFER)E[J.FRAMEBUFFER]=q0;if(f===J.FRAMEBUFFER)E[J.DRAW_FRAMEBUFFER]=q0;return!0}return!1}function x0(f,q0){let a=R,G0=!1;if(f){if(a=O.get(q0),a===void 0)a=[],O.set(q0,a);let S0=f.textures;if(a.length!==S0.length||a[0]!==J.COLOR_ATTACHMENT0){for(let Y0=0,f0=S0.length;Y0<f0;Y0++)a[Y0]=J.COLOR_ATTACHMENT0+Y0;a.length=S0.length,G0=!0}}else if(a[0]!==J.BACK)a[0]=J.BACK,G0=!0;if(G0)J.drawBuffers(a)}function n0(f){if(k!==f)return J.useProgram(f),k=f,!0;return!1}let Q0={[z6]:J.FUNC_ADD,[XX]:J.FUNC_SUBTRACT,[KX]:J.FUNC_REVERSE_SUBTRACT};Q0[HX]=J.MIN,Q0[UX]=J.MAX;let X0={[GX]:J.ZERO,[EX]:J.ONE,[FX]:J.SRC_COLOR,[OX]:J.SRC_ALPHA,[MX]:J.SRC_ALPHA_SATURATE,[DX]:J.DST_COLOR,[RX]:J.DST_ALPHA,[NX]:J.ONE_MINUS_SRC_COLOR,[qX]:J.ONE_MINUS_SRC_ALPHA,[kX]:J.ONE_MINUS_DST_COLOR,[LX]:J.ONE_MINUS_DST_ALPHA,[VX]:J.CONSTANT_COLOR,[BX]:J.ONE_MINUS_CONSTANT_COLOR,[CX]:J.CONSTANT_ALPHA,[IX]:J.ONE_MINUS_CONSTANT_ALPHA};function $0(f,q0,a,G0,S0,Y0,f0,e0,fJ,qJ){if(f===M9){if(q===!0)j0(J.BLEND),q=!1;return}if(q===!1)E0(J.BLEND),q=!0;if(f!==YX){if(f!==N||qJ!==j){if(L!==z6||I!==z6)J.blendEquation(J.FUNC_ADD),L=z6,I=z6;if(qJ)switch(f){case m8:J.blendFuncSeparate(J.ONE,J.ONE_MINUS_SRC_ALPHA,J.ONE,J.ONE_MINUS_SRC_ALPHA);break;case l8:J.blendFunc(J.ONE,J.ONE);break;case VZ:J.blendFuncSeparate(J.ZERO,J.ONE_MINUS_SRC_COLOR,J.ZERO,J.ONE);break;case BZ:J.blendFuncSeparate(J.DST_COLOR,J.ONE_MINUS_SRC_ALPHA,J.ZERO,J.ONE);break;default:v0("WebGLState: Invalid blending: ",f);break}else switch(f){case m8:J.blendFuncSeparate(J.SRC_ALPHA,J.ONE_MINUS_SRC_ALPHA,J.ONE,J.ONE_MINUS_SRC_ALPHA);break;case l8:J.blendFuncSeparate(J.SRC_ALPHA,J.ONE,J.ONE,J.ONE);break;case VZ:v0("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case BZ:v0("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:v0("WebGLState: Invalid blending: ",f);break}D=null,V=null,z=null,B=null,M.set(0,0,0),C=0,N=f,j=qJ}return}if(S0=S0||q0,Y0=Y0||a,f0=f0||G0,q0!==L||S0!==I)J.blendEquationSeparate(Q0[q0],Q0[S0]),L=q0,I=S0;if(a!==D||G0!==V||Y0!==z||f0!==B)J.blendFuncSeparate(X0[a],X0[G0],X0[Y0],X0[f0]),D=a,V=G0,z=Y0,B=f0;if(e0.equals(M)===!1||fJ!==C)J.blendColor(e0.r,e0.g,e0.b,fJ),M.copy(e0),C=fJ;N=f,j=!1}function _0(f,q0){f.side===Y9?j0(J.CULL_FACE):E0(J.CULL_FACE);let a=f.side===pJ;if(q0)a=!a;C0(a),f.blending===m8&&f.transparent===!1?$0(M9):$0(f.blending,f.blendEquation,f.blendSrc,f.blendDst,f.blendEquationAlpha,f.blendSrcAlpha,f.blendDstAlpha,f.blendColor,f.blendAlpha,f.premultipliedAlpha),X.setFunc(f.depthFunc),X.setTest(f.depthTest),X.setMask(f.depthWrite),Y.setMask(f.colorWrite);let G0=f.stencilWrite;if(K.setTest(G0),G0)K.setMask(f.stencilWriteMask),K.setFunc(f.stencilFunc,f.stencilRef,f.stencilFuncMask),K.setOp(f.stencilFail,f.stencilZFail,f.stencilZPass);YJ(f.polygonOffset,f.polygonOffsetFactor,f.polygonOffsetUnits),f.alphaToCoverage===!0?E0(J.SAMPLE_ALPHA_TO_COVERAGE):j0(J.SAMPLE_ALPHA_TO_COVERAGE)}function C0(f){if(w!==f){if(f)J.frontFace(J.CW);else J.frontFace(J.CCW);w=f}}function m0(f){if(f!==$X){if(E0(J.CULL_FACE),f!==v)if(f===MZ)J.cullFace(J.BACK);else if(f===ZX)J.cullFace(J.FRONT);else J.cullFace(J.FRONT_AND_BACK)}else j0(J.CULL_FACE);v=f}function y(f){if(f!==b){if(p)J.lineWidth(f);b=f}}function YJ(f,q0,a){if(f){if(E0(J.POLYGON_OFFSET_FILL),S!==q0||h!==a){if(S=q0,h=a,X.getReversed())q0=-q0;J.polygonOffset(q0,a)}}else j0(J.POLYGON_OFFSET_FILL)}function h0(f){if(f)E0(J.SCISSOR_TEST);else j0(J.SCISSOR_TEST)}function l0(f){if(f===void 0)f=J.TEXTURE0+x-1;if(W0!==f)J.activeTexture(f),W0=f}function U0(f,q0,a){if(a===void 0)if(W0===null)a=J.TEXTURE0+x-1;else a=W0;let G0=H0[a];if(G0===void 0)G0={type:void 0,texture:void 0},H0[a]=G0;if(G0.type!==f||G0.texture!==q0){if(W0!==a)J.activeTexture(a),W0=a;J.bindTexture(f,q0||z0[f]),G0.type=f,G0.texture=q0}}function NJ(){let f=H0[W0];if(f!==void 0&&f.type!==void 0)J.bindTexture(f.type,null),f.type=void 0,f.texture=void 0}function T0(){try{J.compressedTexImage2D(...arguments)}catch(f){v0("WebGLState:",f)}}function A(){try{J.compressedTexImage3D(...arguments)}catch(f){v0("WebGLState:",f)}}function _(){try{J.texSubImage2D(...arguments)}catch(f){v0("WebGLState:",f)}}function u(){try{J.texSubImage3D(...arguments)}catch(f){v0("WebGLState:",f)}}function r(){try{J.compressedTexSubImage2D(...arguments)}catch(f){v0("WebGLState:",f)}}function Z0(){try{J.compressedTexSubImage3D(...arguments)}catch(f){v0("WebGLState:",f)}}function K0(){try{J.texStorage2D(...arguments)}catch(f){v0("WebGLState:",f)}}function D0(){try{J.texStorage3D(...arguments)}catch(f){v0("WebGLState:",f)}}function n(){try{J.texImage2D(...arguments)}catch(f){v0("WebGLState:",f)}}function t(){try{J.texImage3D(...arguments)}catch(f){v0("WebGLState:",f)}}function R0(f){if(F[f]!==void 0)return F[f];else return J.getParameter(f)}function A0(f,q0){if(F[f]!==q0)J.pixelStorei(f,q0),F[f]=q0}function N0(f){if(d0.equals(f)===!1)J.scissor(f.x,f.y,f.z,f.w),d0.copy(f)}function k0(f){if(s.equals(f)===!1)J.viewport(f.x,f.y,f.z,f.w),s.copy(f)}function r0(f,q0){let a=U.get(q0);if(a===void 0)a=new WeakMap,U.set(q0,a);let G0=a.get(f);if(G0===void 0)G0=J.getUniformBlockIndex(q0,f.name),a.set(f,G0)}function $J(f,q0){let G0=U.get(q0).get(f);if(H.get(q0)!==G0)J.uniformBlockBinding(q0,G0,f.__bindingPointIndex),H.set(q0,G0)}function XJ(){J.disable(J.BLEND),J.disable(J.CULL_FACE),J.disable(J.DEPTH_TEST),J.disable(J.POLYGON_OFFSET_FILL),J.disable(J.SCISSOR_TEST),J.disable(J.STENCIL_TEST),J.disable(J.SAMPLE_ALPHA_TO_COVERAGE),J.blendEquation(J.FUNC_ADD),J.blendFunc(J.ONE,J.ZERO),J.blendFuncSeparate(J.ONE,J.ZERO,J.ONE,J.ZERO),J.blendColor(0,0,0,0),J.colorMask(!0,!0,!0,!0),J.clearColor(0,0,0,0),J.depthMask(!0),J.depthFunc(J.LESS),X.setReversed(!1),J.clearDepth(1),J.stencilMask(4294967295),J.stencilFunc(J.ALWAYS,0,4294967295),J.stencilOp(J.KEEP,J.KEEP,J.KEEP),J.clearStencil(0),J.cullFace(J.BACK),J.frontFace(J.CCW),J.polygonOffset(0,0),J.activeTexture(J.TEXTURE0),J.bindFramebuffer(J.FRAMEBUFFER,null),J.bindFramebuffer(J.DRAW_FRAMEBUFFER,null),J.bindFramebuffer(J.READ_FRAMEBUFFER,null),J.useProgram(null),J.lineWidth(1),J.scissor(0,0,J.canvas.width,J.canvas.height),J.viewport(0,0,J.canvas.width,J.canvas.height),J.pixelStorei(J.PACK_ALIGNMENT,4),J.pixelStorei(J.UNPACK_ALIGNMENT,4),J.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,!1),J.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),J.pixelStorei(J.UNPACK_COLORSPACE_CONVERSION_WEBGL,J.BROWSER_DEFAULT_WEBGL),J.pixelStorei(J.PACK_ROW_LENGTH,0),J.pixelStorei(J.PACK_SKIP_PIXELS,0),J.pixelStorei(J.PACK_SKIP_ROWS,0),J.pixelStorei(J.UNPACK_ROW_LENGTH,0),J.pixelStorei(J.UNPACK_IMAGE_HEIGHT,0),J.pixelStorei(J.UNPACK_SKIP_PIXELS,0),J.pixelStorei(J.UNPACK_SKIP_ROWS,0),J.pixelStorei(J.UNPACK_SKIP_IMAGES,0),G={},F={},W0=null,H0={},E={},O=new WeakMap,R=[],k=null,q=!1,N=null,L=null,D=null,V=null,I=null,z=null,B=null,M=new e(0,0,0),C=0,j=!1,w=null,v=null,b=null,S=null,h=null,d0.set(0,0,J.canvas.width,J.canvas.height),s.set(0,0,J.canvas.width,J.canvas.height),Y.reset(),X.reset(),K.reset()}return{buffers:{color:Y,depth:X,stencil:K},enable:E0,disable:j0,bindFramebuffer:WJ,drawBuffers:x0,useProgram:n0,setBlending:$0,setMaterial:_0,setFlipSided:C0,setCullFace:m0,setLineWidth:y,setPolygonOffset:YJ,setScissorTest:h0,activeTexture:l0,bindTexture:U0,unbindTexture:NJ,compressedTexImage2D:T0,compressedTexImage3D:A,texImage2D:n,texImage3D:t,pixelStorei:A0,getParameter:R0,updateUBOMapping:r0,uniformBlockBinding:$J,texStorage2D:K0,texStorage3D:D0,texSubImage2D:_,texSubImage3D:u,compressedTexSubImage2D:r,compressedTexSubImage3D:Z0,scissor:N0,viewport:k0,reset:XJ}}function ZD(J,Q,$,Z,W,Y,X){let K=Q.has("WEBGL_multisampled_render_to_texture")?Q.get("WEBGL_multisampled_render_to_texture"):null,H=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),U=new i,G=new WeakMap,F=new Set,E,O=new WeakMap,R=!1;try{R=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(A){}function k(A,_){return R?new OffscreenCanvas(A,_):k7("canvas")}function q(A,_,u){let r=1,Z0=T0(A);if(Z0.width>u||Z0.height>u)r=u/Math.max(Z0.width,Z0.height);if(r<1)if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap||typeof VideoFrame<"u"&&A instanceof VideoFrame){let K0=Math.floor(r*Z0.width),D0=Math.floor(r*Z0.height);if(E===void 0)E=k(K0,D0);let n=_?k(K0,D0):E;return n.width=K0,n.height=D0,n.getContext("2d").drawImage(A,0,0,K0,D0),O0("WebGLRenderer: Texture has been resized from ("+Z0.width+"x"+Z0.height+") to ("+K0+"x"+D0+")."),n}else{if("data"in A)O0("WebGLRenderer: Image in DataTexture is too big ("+Z0.width+"x"+Z0.height+").");return A}return A}function N(A){return A.generateMipmaps}function L(A){J.generateMipmap(A)}function D(A){if(A.isWebGLCubeRenderTarget)return J.TEXTURE_CUBE_MAP;if(A.isWebGL3DRenderTarget)return J.TEXTURE_3D;if(A.isWebGLArrayRenderTarget||A.isCompressedArrayTexture)return J.TEXTURE_2D_ARRAY;return J.TEXTURE_2D}function V(A,_,u,r,Z0,K0=!1){if(A!==null){if(J[A]!==void 0)return J[A];O0("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+A+"'")}let D0;if(r){if(D0=Q.get("EXT_texture_norm16"),!D0)O0("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension")}let n=_;if(_===J.RED){if(u===J.FLOAT)n=J.R32F;if(u===J.HALF_FLOAT)n=J.R16F;if(u===J.UNSIGNED_BYTE)n=J.R8;if(u===J.UNSIGNED_SHORT&&D0)n=D0.R16_EXT;if(u===J.SHORT&&D0)n=D0.R16_SNORM_EXT}if(_===J.RED_INTEGER){if(u===J.UNSIGNED_BYTE)n=J.R8UI;if(u===J.UNSIGNED_SHORT)n=J.R16UI;if(u===J.UNSIGNED_INT)n=J.R32UI;if(u===J.BYTE)n=J.R8I;if(u===J.SHORT)n=J.R16I;if(u===J.INT)n=J.R32I}if(_===J.RG){if(u===J.FLOAT)n=J.RG32F;if(u===J.HALF_FLOAT)n=J.RG16F;if(u===J.UNSIGNED_BYTE)n=J.RG8;if(u===J.UNSIGNED_SHORT&&D0)n=D0.RG16_EXT;if(u===J.SHORT&&D0)n=D0.RG16_SNORM_EXT}if(_===J.RG_INTEGER){if(u===J.UNSIGNED_BYTE)n=J.RG8UI;if(u===J.UNSIGNED_SHORT)n=J.RG16UI;if(u===J.UNSIGNED_INT)n=J.RG32UI;if(u===J.BYTE)n=J.RG8I;if(u===J.SHORT)n=J.RG16I;if(u===J.INT)n=J.RG32I}if(_===J.RGB_INTEGER){if(u===J.UNSIGNED_BYTE)n=J.RGB8UI;if(u===J.UNSIGNED_SHORT)n=J.RGB16UI;if(u===J.UNSIGNED_INT)n=J.RGB32UI;if(u===J.BYTE)n=J.RGB8I;if(u===J.SHORT)n=J.RGB16I;if(u===J.INT)n=J.RGB32I}if(_===J.RGBA_INTEGER){if(u===J.UNSIGNED_BYTE)n=J.RGBA8UI;if(u===J.UNSIGNED_SHORT)n=J.RGBA16UI;if(u===J.UNSIGNED_INT)n=J.RGBA32UI;if(u===J.BYTE)n=J.RGBA8I;if(u===J.SHORT)n=J.RGBA16I;if(u===J.INT)n=J.RGBA32I}if(_===J.RGB){if(u===J.UNSIGNED_SHORT&&D0)n=D0.RGB16_EXT;if(u===J.SHORT&&D0)n=D0.RGB16_SNORM_EXT;if(u===J.UNSIGNED_INT_5_9_9_9_REV)n=J.RGB9_E5;if(u===J.UNSIGNED_INT_10F_11F_11F_REV)n=J.R11F_G11F_B10F}if(_===J.RGBA){let t=K0?UW:t0.getTransfer(Z0);if(u===J.FLOAT)n=J.RGBA32F;if(u===J.HALF_FLOAT)n=J.RGBA16F;if(u===J.UNSIGNED_BYTE)n=t===OJ?J.SRGB8_ALPHA8:J.RGBA8;if(u===J.UNSIGNED_SHORT&&D0)n=D0.RGBA16_EXT;if(u===J.SHORT&&D0)n=D0.RGBA16_SNORM_EXT;if(u===J.UNSIGNED_SHORT_4_4_4_4)n=J.RGBA4;if(u===J.UNSIGNED_SHORT_5_5_5_1)n=J.RGB5_A1}if(n===J.R16F||n===J.R32F||n===J.RG16F||n===J.RG32F||n===J.RGBA16F||n===J.RGBA32F)Q.get("EXT_color_buffer_float");return n}function I(A,_){let u;if(A){if(_===null||_===z8||_===T6)u=J.DEPTH24_STENCIL8;else if(_===F9)u=J.DEPTH32F_STENCIL8;else if(_===S7)u=J.DEPTH24_STENCIL8,O0("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")}else if(_===null||_===z8||_===T6)u=J.DEPTH_COMPONENT24;else if(_===F9)u=J.DEPTH_COMPONENT32F;else if(_===S7)u=J.DEPTH_COMPONENT16;return u}function z(A,_){if(N(A)===!0||A.isFramebufferTexture&&A.minFilter!==A9&&A.minFilter!==jJ)return Math.log2(Math.max(_.width,_.height))+1;else if(A.mipmaps!==void 0&&A.mipmaps.length>0)return A.mipmaps.length;else if(A.isCompressedTexture&&Array.isArray(A.image))return _.mipmaps.length;else return 1}function B(A){let _=A.target;if(_.removeEventListener("dispose",B),C(_),_.isVideoTexture)G.delete(_);if(_.isHTMLTexture)F.delete(_)}function M(A){let _=A.target;_.removeEventListener("dispose",M),w(_)}function C(A){let _=Z.get(A);if(_.__webglInit===void 0)return;let u=A.source,r=O.get(u);if(r){let Z0=r[_.__cacheKey];if(Z0.usedTimes--,Z0.usedTimes===0)j(A);if(Object.keys(r).length===0)O.delete(u)}Z.remove(A)}function j(A){let _=Z.get(A);J.deleteTexture(_.__webglTexture);let u=A.source,r=O.get(u);delete r[_.__cacheKey],X.memory.textures--}function w(A){let _=Z.get(A);if(A.depthTexture)A.depthTexture.dispose(),Z.remove(A.depthTexture);if(A.isWebGLCubeRenderTarget)for(let r=0;r<6;r++){if(Array.isArray(_.__webglFramebuffer[r]))for(let Z0=0;Z0<_.__webglFramebuffer[r].length;Z0++)J.deleteFramebuffer(_.__webglFramebuffer[r][Z0]);else J.deleteFramebuffer(_.__webglFramebuffer[r]);if(_.__webglDepthbuffer)J.deleteRenderbuffer(_.__webglDepthbuffer[r])}else{if(Array.isArray(_.__webglFramebuffer))for(let r=0;r<_.__webglFramebuffer.length;r++)J.deleteFramebuffer(_.__webglFramebuffer[r]);else J.deleteFramebuffer(_.__webglFramebuffer);if(_.__webglDepthbuffer)J.deleteRenderbuffer(_.__webglDepthbuffer);if(_.__webglMultisampledFramebuffer)J.deleteFramebuffer(_.__webglMultisampledFramebuffer);if(_.__webglColorRenderbuffer){for(let r=0;r<_.__webglColorRenderbuffer.length;r++)if(_.__webglColorRenderbuffer[r])J.deleteRenderbuffer(_.__webglColorRenderbuffer[r])}if(_.__webglDepthRenderbuffer)J.deleteRenderbuffer(_.__webglDepthRenderbuffer)}let u=A.textures;for(let r=0,Z0=u.length;r<Z0;r++){let K0=Z.get(u[r]);if(K0.__webglTexture)J.deleteTexture(K0.__webglTexture),X.memory.textures--;Z.remove(u[r])}Z.remove(A)}let v=0;function b(){v=0}function S(){return v}function h(A){v=A}function x(){let A=v;if(A>=W.maxTextures)O0("WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+W.maxTextures);return v+=1,A}function p(A){let _=[];return _.push(A.wrapS),_.push(A.wrapT),_.push(A.wrapR||0),_.push(A.magFilter),_.push(A.minFilter),_.push(A.anisotropy),_.push(A.internalFormat),_.push(A.format),_.push(A.type),_.push(A.generateMipmaps),_.push(A.premultiplyAlpha),_.push(A.flipY),_.push(A.unpackAlignment),_.push(A.colorSpace),_.join()}function c(A,_){let u=Z.get(A);if(A.isVideoTexture)U0(A);if(A.isRenderTargetTexture===!1&&A.isExternalTexture!==!0&&A.version>0&&u.__version!==A.version){let r=A.image;if(r===null)O0("WebGLRenderer: Texture marked for update but no image data found.");else if(r.complete===!1)O0("WebGLRenderer: Texture marked for update but image is incomplete");else{j0(u,A,_);return}}else if(A.isExternalTexture)u.__webglTexture=A.sourceTexture?A.sourceTexture:null;$.bindTexture(J.TEXTURE_2D,u.__webglTexture,J.TEXTURE0+_)}function o(A,_){let u=Z.get(A);if(A.isRenderTargetTexture===!1&&A.version>0&&u.__version!==A.version){j0(u,A,_);return}else if(A.isExternalTexture)u.__webglTexture=A.sourceTexture?A.sourceTexture:null;$.bindTexture(J.TEXTURE_2D_ARRAY,u.__webglTexture,J.TEXTURE0+_)}function W0(A,_){let u=Z.get(A);if(A.isRenderTargetTexture===!1&&A.version>0&&u.__version!==A.version){j0(u,A,_);return}$.bindTexture(J.TEXTURE_3D,u.__webglTexture,J.TEXTURE0+_)}function H0(A,_){let u=Z.get(A);if(A.isCubeDepthTexture!==!0&&A.version>0&&u.__version!==A.version){WJ(u,A,_);return}$.bindTexture(J.TEXTURE_CUBE_MAP,u.__webglTexture,J.TEXTURE0+_)}let J0={[I8]:J.REPEAT,[w6]:J.CLAMP_TO_EDGE,[IQ]:J.MIRRORED_REPEAT},c0={[A9]:J.NEAREST,[zQ]:J.NEAREST_MIPMAP_NEAREST,[s8]:J.NEAREST_MIPMAP_LINEAR,[jJ]:J.LINEAR,[P6]:J.LINEAR_MIPMAP_NEAREST,[s9]:J.LINEAR_MIPMAP_LINEAR},d0={[mX]:J.NEVER,[iX]:J.ALWAYS,[lX]:J.LESS,[vQ]:J.LEQUAL,[cX]:J.EQUAL,[yQ]:J.GEQUAL,[nX]:J.GREATER,[sX]:J.NOTEQUAL};function s(A,_){if(_.type===F9&&Q.has("OES_texture_float_linear")===!1&&(_.magFilter===jJ||_.magFilter===P6||_.magFilter===s8||_.magFilter===s9||_.minFilter===jJ||_.minFilter===P6||_.minFilter===s8||_.minFilter===s9))O0("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.");if(J.texParameteri(A,J.TEXTURE_WRAP_S,J0[_.wrapS]),J.texParameteri(A,J.TEXTURE_WRAP_T,J0[_.wrapT]),A===J.TEXTURE_3D||A===J.TEXTURE_2D_ARRAY)J.texParameteri(A,J.TEXTURE_WRAP_R,J0[_.wrapR]);if(J.texParameteri(A,J.TEXTURE_MAG_FILTER,c0[_.magFilter]),J.texParameteri(A,J.TEXTURE_MIN_FILTER,c0[_.minFilter]),_.compareFunction)J.texParameteri(A,J.TEXTURE_COMPARE_MODE,J.COMPARE_REF_TO_TEXTURE),J.texParameteri(A,J.TEXTURE_COMPARE_FUNC,d0[_.compareFunction]);if(Q.has("EXT_texture_filter_anisotropic")===!0){if(_.magFilter===A9)return;if(_.minFilter!==s8&&_.minFilter!==s9)return;if(_.type===F9&&Q.has("OES_texture_float_linear")===!1)return;if(_.anisotropy>1||Z.get(_).__currentAnisotropy){let u=Q.get("EXT_texture_filter_anisotropic");J.texParameterf(A,u.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(_.anisotropy,W.getMaxAnisotropy())),Z.get(_).__currentAnisotropy=_.anisotropy}}}function F0(A,_){let u=!1;if(A.__webglInit===void 0)A.__webglInit=!0,_.addEventListener("dispose",B);let r=_.source,Z0=O.get(r);if(Z0===void 0)Z0={},O.set(r,Z0);let K0=p(_);if(K0!==A.__cacheKey){if(Z0[K0]===void 0)Z0[K0]={texture:J.createTexture(),usedTimes:0},X.memory.textures++,u=!0;Z0[K0].usedTimes++;let D0=Z0[A.__cacheKey];if(D0!==void 0){if(Z0[A.__cacheKey].usedTimes--,D0.usedTimes===0)j(_)}A.__cacheKey=K0,A.__webglTexture=Z0[K0].texture}return u}function z0(A,_,u){return Math.floor(Math.floor(A/u)/_)}function E0(A,_,u,r){let K0=A.updateRanges;if(K0.length===0)$.texSubImage2D(J.TEXTURE_2D,0,0,0,_.width,_.height,u,r,_.data);else{K0.sort((A0,N0)=>A0.start-N0.start);let D0=0;for(let A0=1;A0<K0.length;A0++){let N0=K0[D0],k0=K0[A0],r0=N0.start+N0.count,$J=z0(k0.start,_.width,4),XJ=z0(N0.start,_.width,4);if(k0.start<=r0+1&&$J===XJ&&z0(k0.start+k0.count-1,_.width,4)===$J)N0.count=Math.max(N0.count,k0.start+k0.count-N0.start);else++D0,K0[D0]=k0}K0.length=D0+1;let n=$.getParameter(J.UNPACK_ROW_LENGTH),t=$.getParameter(J.UNPACK_SKIP_PIXELS),R0=$.getParameter(J.UNPACK_SKIP_ROWS);$.pixelStorei(J.UNPACK_ROW_LENGTH,_.width);for(let A0=0,N0=K0.length;A0<N0;A0++){let k0=K0[A0],r0=Math.floor(k0.start/4),$J=Math.ceil(k0.count/4),XJ=r0%_.width,f=Math.floor(r0/_.width),q0=$J,a=1;$.pixelStorei(J.UNPACK_SKIP_PIXELS,XJ),$.pixelStorei(J.UNPACK_SKIP_ROWS,f),$.texSubImage2D(J.TEXTURE_2D,0,XJ,f,q0,1,u,r,_.data)}A.clearUpdateRanges(),$.pixelStorei(J.UNPACK_ROW_LENGTH,n),$.pixelStorei(J.UNPACK_SKIP_PIXELS,t),$.pixelStorei(J.UNPACK_SKIP_ROWS,R0)}}function j0(A,_,u){let r=J.TEXTURE_2D;if(_.isDataArrayTexture||_.isCompressedArrayTexture)r=J.TEXTURE_2D_ARRAY;if(_.isData3DTexture)r=J.TEXTURE_3D;let Z0=F0(A,_),K0=_.source;$.bindTexture(r,A.__webglTexture,J.TEXTURE0+u);let D0=Z.get(K0);if(K0.version!==D0.__version||Z0===!0){if($.activeTexture(J.TEXTURE0+u),(typeof ImageBitmap<"u"&&_.image instanceof ImageBitmap)===!1){let a=t0.getPrimaries(t0.workingColorSpace),G0=_.colorSpace===r8?null:t0.getPrimaries(_.colorSpace),S0=_.colorSpace===r8||a===G0?J.NONE:J.BROWSER_DEFAULT_WEBGL;$.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,_.flipY),$.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),$.pixelStorei(J.UNPACK_COLORSPACE_CONVERSION_WEBGL,S0)}$.pixelStorei(J.UNPACK_ALIGNMENT,_.unpackAlignment);let t=q(_.image,!1,W.maxTextureSize);t=NJ(_,t);let R0=Y.convert(_.format,_.colorSpace),A0=Y.convert(_.type),N0=V(_.internalFormat,R0,A0,_.normalized,_.colorSpace,_.isVideoTexture);s(r,_);let k0,r0=_.mipmaps,$J=_.isVideoTexture!==!0,XJ=D0.__version===void 0||Z0===!0,f=K0.dataReady,q0=z(_,t);if(_.isDepthTexture){if(N0=I(_.format===o8,_.type),XJ)if($J)$.texStorage2D(J.TEXTURE_2D,1,N0,t.width,t.height);else $.texImage2D(J.TEXTURE_2D,0,N0,t.width,t.height,0,R0,A0,null)}else if(_.isDataTexture)if(r0.length>0){if($J&&XJ)$.texStorage2D(J.TEXTURE_2D,q0,N0,r0[0].width,r0[0].height);for(let a=0,G0=r0.length;a<G0;a++)if(k0=r0[a],$J){if(f)$.texSubImage2D(J.TEXTURE_2D,a,0,0,k0.width,k0.height,R0,A0,k0.data)}else $.texImage2D(J.TEXTURE_2D,a,N0,k0.width,k0.height,0,R0,A0,k0.data);_.generateMipmaps=!1}else if($J){if(XJ)$.texStorage2D(J.TEXTURE_2D,q0,N0,t.width,t.height);if(f)E0(_,t,R0,A0)}else $.texImage2D(J.TEXTURE_2D,0,N0,t.width,t.height,0,R0,A0,t.data);else if(_.isCompressedTexture)if(_.isCompressedArrayTexture){if($J&&XJ)$.texStorage3D(J.TEXTURE_2D_ARRAY,q0,N0,r0[0].width,r0[0].height,t.depth);for(let a=0,G0=r0.length;a<G0;a++)if(k0=r0[a],_.format!==i9)if(R0!==null)if($J){if(f)if(_.layerUpdates.size>0){let S0=nW(k0.width,k0.height,_.format,_.type);for(let Y0 of _.layerUpdates){let f0=k0.data.subarray(Y0*S0/k0.data.BYTES_PER_ELEMENT,(Y0+1)*S0/k0.data.BYTES_PER_ELEMENT);$.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,a,0,0,Y0,k0.width,k0.height,1,R0,f0)}_.clearLayerUpdates()}else $.compressedTexSubImage3D(J.TEXTURE_2D_ARRAY,a,0,0,0,k0.width,k0.height,t.depth,R0,k0.data)}else $.compressedTexImage3D(J.TEXTURE_2D_ARRAY,a,N0,k0.width,k0.height,t.depth,0,k0.data,0,0);else O0("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if($J){if(f)$.texSubImage3D(J.TEXTURE_2D_ARRAY,a,0,0,0,k0.width,k0.height,t.depth,R0,A0,k0.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,a,N0,k0.width,k0.height,t.depth,0,R0,A0,k0.data)}else{if($J&&XJ)$.texStorage2D(J.TEXTURE_2D,q0,N0,r0[0].width,r0[0].height);for(let a=0,G0=r0.length;a<G0;a++)if(k0=r0[a],_.format!==i9)if(R0!==null)if($J){if(f)$.compressedTexSubImage2D(J.TEXTURE_2D,a,0,0,k0.width,k0.height,R0,k0.data)}else $.compressedTexImage2D(J.TEXTURE_2D,a,N0,k0.width,k0.height,0,k0.data);else O0("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else if($J){if(f)$.texSubImage2D(J.TEXTURE_2D,a,0,0,k0.width,k0.height,R0,A0,k0.data)}else $.texImage2D(J.TEXTURE_2D,a,N0,k0.width,k0.height,0,R0,A0,k0.data)}else if(_.isDataArrayTexture)if($J){if(XJ)$.texStorage3D(J.TEXTURE_2D_ARRAY,q0,N0,t.width,t.height,t.depth);if(f)if(_.layerUpdates.size>0){let a=nW(t.width,t.height,_.format,_.type);for(let G0 of _.layerUpdates){let S0=t.data.subarray(G0*a/t.data.BYTES_PER_ELEMENT,(G0+1)*a/t.data.BYTES_PER_ELEMENT);$.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,G0,t.width,t.height,1,R0,A0,S0)}_.clearLayerUpdates()}else $.texSubImage3D(J.TEXTURE_2D_ARRAY,0,0,0,0,t.width,t.height,t.depth,R0,A0,t.data)}else $.texImage3D(J.TEXTURE_2D_ARRAY,0,N0,t.width,t.height,t.depth,0,R0,A0,t.data);else if(_.isData3DTexture)if($J){if(XJ)$.texStorage3D(J.TEXTURE_3D,q0,N0,t.width,t.height,t.depth);if(f)$.texSubImage3D(J.TEXTURE_3D,0,0,0,0,t.width,t.height,t.depth,R0,A0,t.data)}else $.texImage3D(J.TEXTURE_3D,0,N0,t.width,t.height,t.depth,0,R0,A0,t.data);else if(_.isFramebufferTexture){if(XJ)if($J)$.texStorage2D(J.TEXTURE_2D,q0,N0,t.width,t.height);else{let{width:a,height:G0}=t;for(let S0=0;S0<q0;S0++)$.texImage2D(J.TEXTURE_2D,S0,N0,a,G0,0,R0,A0,null),a>>=1,G0>>=1}}else if(_.isHTMLTexture){if("texElementImage2D"in J){let a=J.canvas;if(!a.hasAttribute("layoutsubtree"))a.setAttribute("layoutsubtree","true");if(t.parentNode!==a){a.appendChild(t),F.add(_),a.onpaint=(e0)=>{let fJ=e0.changedElements;for(let qJ of F)if(fJ.includes(qJ.image))qJ.needsUpdate=!0},a.requestPaint();return}let G0=0,S0=J.RGBA,Y0=J.RGBA,f0=J.UNSIGNED_BYTE;J.texElementImage2D(J.TEXTURE_2D,G0,S0,Y0,f0,t),J.texParameteri(J.TEXTURE_2D,J.TEXTURE_MIN_FILTER,J.LINEAR),J.texParameteri(J.TEXTURE_2D,J.TEXTURE_WRAP_S,J.CLAMP_TO_EDGE),J.texParameteri(J.TEXTURE_2D,J.TEXTURE_WRAP_T,J.CLAMP_TO_EDGE)}}else if(r0.length>0){if($J&&XJ){let a=T0(r0[0]);$.texStorage2D(J.TEXTURE_2D,q0,N0,a.width,a.height)}for(let a=0,G0=r0.length;a<G0;a++)if(k0=r0[a],$J){if(f)$.texSubImage2D(J.TEXTURE_2D,a,0,0,R0,A0,k0)}else $.texImage2D(J.TEXTURE_2D,a,N0,R0,A0,k0);_.generateMipmaps=!1}else if($J){if(XJ){let a=T0(t);$.texStorage2D(J.TEXTURE_2D,q0,N0,a.width,a.height)}if(f)$.texSubImage2D(J.TEXTURE_2D,0,0,0,R0,A0,t)}else $.texImage2D(J.TEXTURE_2D,0,N0,R0,A0,t);if(N(_))L(r);if(D0.__version=K0.version,_.onUpdate)_.onUpdate(_)}A.__version=_.version}function WJ(A,_,u){if(_.image.length!==6)return;let r=F0(A,_),Z0=_.source;$.bindTexture(J.TEXTURE_CUBE_MAP,A.__webglTexture,J.TEXTURE0+u);let K0=Z.get(Z0);if(Z0.version!==K0.__version||r===!0){$.activeTexture(J.TEXTURE0+u);let D0=t0.getPrimaries(t0.workingColorSpace),n=_.colorSpace===r8?null:t0.getPrimaries(_.colorSpace),t=_.colorSpace===r8||D0===n?J.NONE:J.BROWSER_DEFAULT_WEBGL;$.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,_.flipY),$.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,_.premultiplyAlpha),$.pixelStorei(J.UNPACK_ALIGNMENT,_.unpackAlignment),$.pixelStorei(J.UNPACK_COLORSPACE_CONVERSION_WEBGL,t);let R0=_.isCompressedTexture||_.image[0].isCompressedTexture,A0=_.image[0]&&_.image[0].isDataTexture,N0=[];for(let Y0=0;Y0<6;Y0++){if(!R0&&!A0)N0[Y0]=q(_.image[Y0],!0,W.maxCubemapSize);else N0[Y0]=A0?_.image[Y0].image:_.image[Y0];N0[Y0]=NJ(_,N0[Y0])}let k0=N0[0],r0=Y.convert(_.format,_.colorSpace),$J=Y.convert(_.type),XJ=V(_.internalFormat,r0,$J,_.normalized,_.colorSpace),f=_.isVideoTexture!==!0,q0=K0.__version===void 0||r===!0,a=Z0.dataReady,G0=z(_,k0);s(J.TEXTURE_CUBE_MAP,_);let S0;if(R0){if(f&&q0)$.texStorage2D(J.TEXTURE_CUBE_MAP,G0,XJ,k0.width,k0.height);for(let Y0=0;Y0<6;Y0++){S0=N0[Y0].mipmaps;for(let f0=0;f0<S0.length;f0++){let e0=S0[f0];if(_.format!==i9)if(r0!==null)if(f){if(a)$.compressedTexSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,f0,0,0,e0.width,e0.height,r0,e0.data)}else $.compressedTexImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,f0,XJ,e0.width,e0.height,0,e0.data);else O0("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()");else if(f){if(a)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,f0,0,0,e0.width,e0.height,r0,$J,e0.data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,f0,XJ,e0.width,e0.height,0,r0,$J,e0.data)}}}else{if(S0=_.mipmaps,f&&q0){if(S0.length>0)G0++;let Y0=T0(N0[0]);$.texStorage2D(J.TEXTURE_CUBE_MAP,G0,XJ,Y0.width,Y0.height)}for(let Y0=0;Y0<6;Y0++)if(A0){if(f){if(a)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,0,0,0,N0[Y0].width,N0[Y0].height,r0,$J,N0[Y0].data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,0,XJ,N0[Y0].width,N0[Y0].height,0,r0,$J,N0[Y0].data);for(let f0=0;f0<S0.length;f0++){let fJ=S0[f0].image[Y0].image;if(f){if(a)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,f0+1,0,0,fJ.width,fJ.height,r0,$J,fJ.data)}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,f0+1,XJ,fJ.width,fJ.height,0,r0,$J,fJ.data)}}else{if(f){if(a)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,0,0,0,r0,$J,N0[Y0])}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,0,XJ,r0,$J,N0[Y0]);for(let f0=0;f0<S0.length;f0++){let e0=S0[f0];if(f){if(a)$.texSubImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,f0+1,0,0,r0,$J,e0.image[Y0])}else $.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+Y0,f0+1,XJ,r0,$J,e0.image[Y0])}}}if(N(_))L(J.TEXTURE_CUBE_MAP);if(K0.__version=Z0.version,_.onUpdate)_.onUpdate(_)}A.__version=_.version}function x0(A,_,u,r,Z0,K0){let D0=Y.convert(u.format,u.colorSpace),n=Y.convert(u.type),t=V(u.internalFormat,D0,n,u.normalized,u.colorSpace),R0=Z.get(_),A0=Z.get(u);if(A0.__renderTarget=_,!R0.__hasExternalTextures){let N0=Math.max(1,_.width>>K0),k0=Math.max(1,_.height>>K0);if(Z0===J.TEXTURE_3D||Z0===J.TEXTURE_2D_ARRAY)$.texImage3D(Z0,K0,t,N0,k0,_.depth,0,D0,n,null);else $.texImage2D(Z0,K0,t,N0,k0,0,D0,n,null)}if($.bindFramebuffer(J.FRAMEBUFFER,A),l0(_))K.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,r,Z0,A0.__webglTexture,0,h0(_));else if(Z0===J.TEXTURE_2D||Z0>=J.TEXTURE_CUBE_MAP_POSITIVE_X&&Z0<=J.TEXTURE_CUBE_MAP_NEGATIVE_Z)J.framebufferTexture2D(J.FRAMEBUFFER,r,Z0,A0.__webglTexture,K0);$.bindFramebuffer(J.FRAMEBUFFER,null)}function n0(A,_,u){if(J.bindRenderbuffer(J.RENDERBUFFER,A),_.depthBuffer){let r=_.depthTexture,Z0=r&&r.isDepthTexture?r.type:null,K0=I(_.stencilBuffer,Z0),D0=_.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;if(l0(_))K.renderbufferStorageMultisampleEXT(J.RENDERBUFFER,h0(_),K0,_.width,_.height);else if(u)J.renderbufferStorageMultisample(J.RENDERBUFFER,h0(_),K0,_.width,_.height);else J.renderbufferStorage(J.RENDERBUFFER,K0,_.width,_.height);J.framebufferRenderbuffer(J.FRAMEBUFFER,D0,J.RENDERBUFFER,A)}else{let r=_.textures;for(let Z0=0;Z0<r.length;Z0++){let K0=r[Z0],D0=Y.convert(K0.format,K0.colorSpace),n=Y.convert(K0.type),t=V(K0.internalFormat,D0,n,K0.normalized,K0.colorSpace);if(l0(_))K.renderbufferStorageMultisampleEXT(J.RENDERBUFFER,h0(_),t,_.width,_.height);else if(u)J.renderbufferStorageMultisample(J.RENDERBUFFER,h0(_),t,_.width,_.height);else J.renderbufferStorage(J.RENDERBUFFER,t,_.width,_.height)}}J.bindRenderbuffer(J.RENDERBUFFER,null)}function Q0(A,_,u){let r=_.isWebGLCubeRenderTarget===!0;if($.bindFramebuffer(J.FRAMEBUFFER,A),!(_.depthTexture&&_.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");let Z0=Z.get(_.depthTexture);if(Z0.__renderTarget=_,!Z0.__webglTexture||_.depthTexture.image.width!==_.width||_.depthTexture.image.height!==_.height)_.depthTexture.image.width=_.width,_.depthTexture.image.height=_.height,_.depthTexture.needsUpdate=!0;if(r){if(Z0.__webglInit===void 0)Z0.__webglInit=!0,_.depthTexture.addEventListener("dispose",B);if(Z0.__webglTexture===void 0){Z0.__webglTexture=J.createTexture(),$.bindTexture(J.TEXTURE_CUBE_MAP,Z0.__webglTexture),s(J.TEXTURE_CUBE_MAP,_.depthTexture);let R0=Y.convert(_.depthTexture.format),A0=Y.convert(_.depthTexture.type),N0;if(_.depthTexture.format===i8)N0=J.DEPTH_COMPONENT24;else if(_.depthTexture.format===o8)N0=J.DEPTH24_STENCIL8;for(let k0=0;k0<6;k0++)J.texImage2D(J.TEXTURE_CUBE_MAP_POSITIVE_X+k0,0,N0,_.width,_.height,0,R0,A0,null)}}else c(_.depthTexture,0);let K0=Z0.__webglTexture,D0=h0(_),n=r?J.TEXTURE_CUBE_MAP_POSITIVE_X+u:J.TEXTURE_2D,t=_.depthTexture.format===o8?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;if(_.depthTexture.format===i8)if(l0(_))K.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,t,n,K0,0,D0);else J.framebufferTexture2D(J.FRAMEBUFFER,t,n,K0,0);else if(_.depthTexture.format===o8)if(l0(_))K.framebufferTexture2DMultisampleEXT(J.FRAMEBUFFER,t,n,K0,0,D0);else J.framebufferTexture2D(J.FRAMEBUFFER,t,n,K0,0);else throw Error("Unknown depthTexture format")}function X0(A){let _=Z.get(A),u=A.isWebGLCubeRenderTarget===!0;if(_.__boundDepthTexture!==A.depthTexture){let r=A.depthTexture;if(_.__depthDisposeCallback)_.__depthDisposeCallback();if(r){let Z0=()=>{delete _.__boundDepthTexture,delete _.__depthDisposeCallback,r.removeEventListener("dispose",Z0)};r.addEventListener("dispose",Z0),_.__depthDisposeCallback=Z0}_.__boundDepthTexture=r}if(A.depthTexture&&!_.__autoAllocateDepthBuffer)if(u)for(let r=0;r<6;r++)Q0(_.__webglFramebuffer[r],A,r);else{let r=A.texture.mipmaps;if(r&&r.length>0)Q0(_.__webglFramebuffer[0],A,0);else Q0(_.__webglFramebuffer,A,0)}else if(u){_.__webglDepthbuffer=[];for(let r=0;r<6;r++)if($.bindFramebuffer(J.FRAMEBUFFER,_.__webglFramebuffer[r]),_.__webglDepthbuffer[r]===void 0)_.__webglDepthbuffer[r]=J.createRenderbuffer(),n0(_.__webglDepthbuffer[r],A,!1);else{let Z0=A.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,K0=_.__webglDepthbuffer[r];J.bindRenderbuffer(J.RENDERBUFFER,K0),J.framebufferRenderbuffer(J.FRAMEBUFFER,Z0,J.RENDERBUFFER,K0)}}else{let r=A.texture.mipmaps;if(r&&r.length>0)$.bindFramebuffer(J.FRAMEBUFFER,_.__webglFramebuffer[0]);else $.bindFramebuffer(J.FRAMEBUFFER,_.__webglFramebuffer);if(_.__webglDepthbuffer===void 0)_.__webglDepthbuffer=J.createRenderbuffer(),n0(_.__webglDepthbuffer,A,!1);else{let Z0=A.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,K0=_.__webglDepthbuffer;J.bindRenderbuffer(J.RENDERBUFFER,K0),J.framebufferRenderbuffer(J.FRAMEBUFFER,Z0,J.RENDERBUFFER,K0)}}$.bindFramebuffer(J.FRAMEBUFFER,null)}function $0(A,_,u){let r=Z.get(A);if(_!==void 0)x0(r.__webglFramebuffer,A,A.texture,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,0);if(u!==void 0)X0(A)}function _0(A){let _=A.texture,u=Z.get(A),r=Z.get(_);A.addEventListener("dispose",M);let Z0=A.textures,K0=A.isWebGLCubeRenderTarget===!0,D0=Z0.length>1;if(!D0){if(r.__webglTexture===void 0)r.__webglTexture=J.createTexture();r.__version=_.version,X.memory.textures++}if(K0){u.__webglFramebuffer=[];for(let n=0;n<6;n++)if(_.mipmaps&&_.mipmaps.length>0){u.__webglFramebuffer[n]=[];for(let t=0;t<_.mipmaps.length;t++)u.__webglFramebuffer[n][t]=J.createFramebuffer()}else u.__webglFramebuffer[n]=J.createFramebuffer()}else{if(_.mipmaps&&_.mipmaps.length>0){u.__webglFramebuffer=[];for(let n=0;n<_.mipmaps.length;n++)u.__webglFramebuffer[n]=J.createFramebuffer()}else u.__webglFramebuffer=J.createFramebuffer();if(D0)for(let n=0,t=Z0.length;n<t;n++){let R0=Z.get(Z0[n]);if(R0.__webglTexture===void 0)R0.__webglTexture=J.createTexture(),X.memory.textures++}if(A.samples>0&&l0(A)===!1){u.__webglMultisampledFramebuffer=J.createFramebuffer(),u.__webglColorRenderbuffer=[],$.bindFramebuffer(J.FRAMEBUFFER,u.__webglMultisampledFramebuffer);for(let n=0;n<Z0.length;n++){let t=Z0[n];u.__webglColorRenderbuffer[n]=J.createRenderbuffer(),J.bindRenderbuffer(J.RENDERBUFFER,u.__webglColorRenderbuffer[n]);let R0=Y.convert(t.format,t.colorSpace),A0=Y.convert(t.type),N0=V(t.internalFormat,R0,A0,t.normalized,t.colorSpace,A.isXRRenderTarget===!0),k0=h0(A);J.renderbufferStorageMultisample(J.RENDERBUFFER,k0,N0,A.width,A.height),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+n,J.RENDERBUFFER,u.__webglColorRenderbuffer[n])}if(J.bindRenderbuffer(J.RENDERBUFFER,null),A.depthBuffer)u.__webglDepthRenderbuffer=J.createRenderbuffer(),n0(u.__webglDepthRenderbuffer,A,!0);$.bindFramebuffer(J.FRAMEBUFFER,null)}}if(K0){$.bindTexture(J.TEXTURE_CUBE_MAP,r.__webglTexture),s(J.TEXTURE_CUBE_MAP,_);for(let n=0;n<6;n++)if(_.mipmaps&&_.mipmaps.length>0)for(let t=0;t<_.mipmaps.length;t++)x0(u.__webglFramebuffer[n][t],A,_,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+n,t);else x0(u.__webglFramebuffer[n],A,_,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);if(N(_))L(J.TEXTURE_CUBE_MAP);$.unbindTexture()}else if(D0){for(let n=0,t=Z0.length;n<t;n++){let R0=Z0[n],A0=Z.get(R0),N0=J.TEXTURE_2D;if(A.isWebGL3DRenderTarget||A.isWebGLArrayRenderTarget)N0=A.isWebGL3DRenderTarget?J.TEXTURE_3D:J.TEXTURE_2D_ARRAY;if($.bindTexture(N0,A0.__webglTexture),s(N0,R0),x0(u.__webglFramebuffer,A,R0,J.COLOR_ATTACHMENT0+n,N0,0),N(R0))L(N0)}$.unbindTexture()}else{let n=J.TEXTURE_2D;if(A.isWebGL3DRenderTarget||A.isWebGLArrayRenderTarget)n=A.isWebGL3DRenderTarget?J.TEXTURE_3D:J.TEXTURE_2D_ARRAY;if($.bindTexture(n,r.__webglTexture),s(n,_),_.mipmaps&&_.mipmaps.length>0)for(let t=0;t<_.mipmaps.length;t++)x0(u.__webglFramebuffer[t],A,_,J.COLOR_ATTACHMENT0,n,t);else x0(u.__webglFramebuffer,A,_,J.COLOR_ATTACHMENT0,n,0);if(N(_))L(n);$.unbindTexture()}if(A.depthBuffer)X0(A)}function C0(A){let _=A.textures;for(let u=0,r=_.length;u<r;u++){let Z0=_[u];if(N(Z0)){let K0=D(A),D0=Z.get(Z0).__webglTexture;$.bindTexture(K0,D0),L(K0),$.unbindTexture()}}}let m0=[],y=[];function YJ(A){if(A.samples>0){if(l0(A)===!1){let{textures:_,width:u,height:r}=A,Z0=J.COLOR_BUFFER_BIT,K0=A.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT,D0=Z.get(A),n=_.length>1;if(n)for(let R0=0;R0<_.length;R0++)$.bindFramebuffer(J.FRAMEBUFFER,D0.__webglMultisampledFramebuffer),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+R0,J.RENDERBUFFER,null),$.bindFramebuffer(J.FRAMEBUFFER,D0.__webglFramebuffer),J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0+R0,J.TEXTURE_2D,null,0);$.bindFramebuffer(J.READ_FRAMEBUFFER,D0.__webglMultisampledFramebuffer);let t=A.texture.mipmaps;if(t&&t.length>0)$.bindFramebuffer(J.DRAW_FRAMEBUFFER,D0.__webglFramebuffer[0]);else $.bindFramebuffer(J.DRAW_FRAMEBUFFER,D0.__webglFramebuffer);for(let R0=0;R0<_.length;R0++){if(A.resolveDepthBuffer){if(A.depthBuffer)Z0|=J.DEPTH_BUFFER_BIT;if(A.stencilBuffer&&A.resolveStencilBuffer)Z0|=J.STENCIL_BUFFER_BIT}if(n){J.framebufferRenderbuffer(J.READ_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.RENDERBUFFER,D0.__webglColorRenderbuffer[R0]);let A0=Z.get(_[R0]).__webglTexture;J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_2D,A0,0)}if(J.blitFramebuffer(0,0,u,r,0,0,u,r,Z0,J.NEAREST),H===!0){if(m0.length=0,y.length=0,m0.push(J.COLOR_ATTACHMENT0+R0),A.depthBuffer&&A.resolveDepthBuffer===!1)m0.push(K0),y.push(K0),J.invalidateFramebuffer(J.DRAW_FRAMEBUFFER,y);J.invalidateFramebuffer(J.READ_FRAMEBUFFER,m0)}}if($.bindFramebuffer(J.READ_FRAMEBUFFER,null),$.bindFramebuffer(J.DRAW_FRAMEBUFFER,null),n)for(let R0=0;R0<_.length;R0++){$.bindFramebuffer(J.FRAMEBUFFER,D0.__webglMultisampledFramebuffer),J.framebufferRenderbuffer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0+R0,J.RENDERBUFFER,D0.__webglColorRenderbuffer[R0]);let A0=Z.get(_[R0]).__webglTexture;$.bindFramebuffer(J.FRAMEBUFFER,D0.__webglFramebuffer),J.framebufferTexture2D(J.DRAW_FRAMEBUFFER,J.COLOR_ATTACHMENT0+R0,J.TEXTURE_2D,A0,0)}$.bindFramebuffer(J.DRAW_FRAMEBUFFER,D0.__webglMultisampledFramebuffer)}else if(A.depthBuffer&&A.resolveDepthBuffer===!1&&H){let _=A.stencilBuffer?J.DEPTH_STENCIL_ATTACHMENT:J.DEPTH_ATTACHMENT;J.invalidateFramebuffer(J.DRAW_FRAMEBUFFER,[_])}}}function h0(A){return Math.min(W.maxSamples,A.samples)}function l0(A){let _=Z.get(A);return A.samples>0&&Q.has("WEBGL_multisampled_render_to_texture")===!0&&_.__useRenderToTexture!==!1}function U0(A){let _=X.render.frame;if(G.get(A)!==_)G.set(A,_),A.update()}function NJ(A,_){let{colorSpace:u,format:r,type:Z0}=A;if(A.isCompressedTexture===!0||A.isVideoTexture===!0)return _;if(u!==eJ&&u!==r8)if(t0.getTransfer(u)===OJ){if(r!==i9||Z0!==S9)O0("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.")}else v0("WebGLTextures: Unsupported texture color space:",u);return _}function T0(A){if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement)U.width=A.naturalWidth||A.width,U.height=A.naturalHeight||A.height;else if(typeof VideoFrame<"u"&&A instanceof VideoFrame)U.width=A.displayWidth,U.height=A.displayHeight;else U.width=A.width,U.height=A.height;return U}this.allocateTextureUnit=x,this.resetTextureUnits=b,this.getTextureUnits=S,this.setTextureUnits=h,this.setTexture2D=c,this.setTexture2DArray=o,this.setTexture3D=W0,this.setTextureCube=H0,this.rebindTextures=$0,this.setupRenderTarget=_0,this.updateRenderTargetMipmap=C0,this.updateMultisampleRenderTarget=YJ,this.setupDepthRenderbuffer=X0,this.setupFrameBufferTexture=x0,this.useMultisampledRTT=l0,this.isReversedDepthBuffer=function(){return $.buffers.depth.getReversed()}}function QE(J,Q){function $(Z,W=r8){let Y,X=t0.getTransfer(W);if(Z===S9)return J.UNSIGNED_BYTE;if(Z===zZ)return J.UNSIGNED_SHORT_4_4_4_4;if(Z===_Z)return J.UNSIGNED_SHORT_5_5_5_1;if(Z===hX)return J.UNSIGNED_INT_5_9_9_9_REV;if(Z===fX)return J.UNSIGNED_INT_10F_11F_11F_REV;if(Z===xX)return J.BYTE;if(Z===bX)return J.SHORT;if(Z===S7)return J.UNSIGNED_SHORT;if(Z===IZ)return J.INT;if(Z===z8)return J.UNSIGNED_INT;if(Z===F9)return J.FLOAT;if(Z===wJ)return J.HALF_FLOAT;if(Z===gX)return J.ALPHA;if(Z===pX)return J.RGB;if(Z===i9)return J.RGBA;if(Z===i8)return J.DEPTH_COMPONENT;if(Z===o8)return J.DEPTH_STENCIL;if(Z===uX)return J.RED;if(Z===wZ)return J.RED_INTEGER;if(Z===a8)return J.RG;if(Z===PZ)return J.RG_INTEGER;if(Z===TZ)return J.RGBA_INTEGER;if(Z===_Q||Z===wQ||Z===PQ||Z===TQ)if(X===OJ)if(Y=Q.get("WEBGL_compressed_texture_s3tc_srgb"),Y!==null){if(Z===_Q)return Y.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(Z===wQ)return Y.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(Z===PQ)return Y.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(Z===TQ)return Y.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(Y=Q.get("WEBGL_compressed_texture_s3tc"),Y!==null){if(Z===_Q)return Y.COMPRESSED_RGB_S3TC_DXT1_EXT;if(Z===wQ)return Y.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(Z===PQ)return Y.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(Z===TQ)return Y.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(Z===AZ||Z===SZ||Z===jZ||Z===vZ)if(Y=Q.get("WEBGL_compressed_texture_pvrtc"),Y!==null){if(Z===AZ)return Y.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(Z===SZ)return Y.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(Z===jZ)return Y.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(Z===vZ)return Y.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(Z===yZ||Z===xZ||Z===bZ||Z===hZ||Z===fZ||Z===AQ||Z===gZ)if(Y=Q.get("WEBGL_compressed_texture_etc"),Y!==null){if(Z===yZ||Z===xZ)return X===OJ?Y.COMPRESSED_SRGB8_ETC2:Y.COMPRESSED_RGB8_ETC2;if(Z===bZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:Y.COMPRESSED_RGBA8_ETC2_EAC;if(Z===hZ)return Y.COMPRESSED_R11_EAC;if(Z===fZ)return Y.COMPRESSED_SIGNED_R11_EAC;if(Z===AQ)return Y.COMPRESSED_RG11_EAC;if(Z===gZ)return Y.COMPRESSED_SIGNED_RG11_EAC}else return null;if(Z===pZ||Z===uZ||Z===dZ||Z===mZ||Z===lZ||Z===cZ||Z===nZ||Z===sZ||Z===iZ||Z===oZ||Z===aZ||Z===rZ||Z===tZ||Z===eZ)if(Y=Q.get("WEBGL_compressed_texture_astc"),Y!==null){if(Z===pZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:Y.COMPRESSED_RGBA_ASTC_4x4_KHR;if(Z===uZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:Y.COMPRESSED_RGBA_ASTC_5x4_KHR;if(Z===dZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:Y.COMPRESSED_RGBA_ASTC_5x5_KHR;if(Z===mZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:Y.COMPRESSED_RGBA_ASTC_6x5_KHR;if(Z===lZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:Y.COMPRESSED_RGBA_ASTC_6x6_KHR;if(Z===cZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:Y.COMPRESSED_RGBA_ASTC_8x5_KHR;if(Z===nZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:Y.COMPRESSED_RGBA_ASTC_8x6_KHR;if(Z===sZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:Y.COMPRESSED_RGBA_ASTC_8x8_KHR;if(Z===iZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:Y.COMPRESSED_RGBA_ASTC_10x5_KHR;if(Z===oZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:Y.COMPRESSED_RGBA_ASTC_10x6_KHR;if(Z===aZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:Y.COMPRESSED_RGBA_ASTC_10x8_KHR;if(Z===rZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:Y.COMPRESSED_RGBA_ASTC_10x10_KHR;if(Z===tZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:Y.COMPRESSED_RGBA_ASTC_12x10_KHR;if(Z===eZ)return X===OJ?Y.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:Y.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(Z===JW||Z===QW||Z===$W)if(Y=Q.get("EXT_texture_compression_bptc"),Y!==null){if(Z===JW)return X===OJ?Y.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:Y.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(Z===QW)return Y.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(Z===$W)return Y.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(Z===ZW||Z===WW||Z===SQ||Z===YW)if(Y=Q.get("EXT_texture_compression_rgtc"),Y!==null){if(Z===ZW)return Y.COMPRESSED_RED_RGTC1_EXT;if(Z===WW)return Y.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(Z===SQ)return Y.COMPRESSED_RED_GREEN_RGTC2_EXT;if(Z===YW)return Y.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;if(Z===T6)return J.UNSIGNED_INT_24_8;return J[Z]!==void 0?J[Z]:null}return{convert:$}}var WD=`
4081
4081
  void main() {
4082
4082
 
4083
4083
  gl_Position = vec4( position, 1.0 );
4084
4084
 
4085
- }`,o1=`
4085
+ }`,YD=`
4086
4086
  uniform sampler2DArray depthColor;
4087
4087
  uniform float depthWidth;
4088
4088
  uniform float depthHeight;
@@ -4101,11 +4101,233 @@ void main() {
4101
4101
 
4102
4102
  }
4103
4103
 
4104
- }`;class dX{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(J,Q){if(this.texture===null){let $=new GQ(J.texture);if(J.depthNear!==Q.depthNear||J.depthFar!==Q.depthFar)this.depthNear=J.depthNear,this.depthFar=J.depthFar;this.texture=$}}getMesh(J){if(this.texture!==null){if(this.mesh===null){let Q=J.cameras[0].viewport,$=new SJ({vertexShader:i1,fragmentShader:o1,uniforms:{depthColor:{value:this.texture},depthWidth:{value:Q.z},depthHeight:{value:Q.w}}});this.mesh=new GJ(new M9(20,20),$)}}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class uX extends T9{constructor(J,Q){super();let $=this,Z=null,W=1,Y=null,X="local-floor",K=1,H=null,U=null,G=null,F=null,E=null,O=null,R=typeof XRWebGLBinding<"u",C=new dX,q={},N=Q.getContextAttributes(),L=null,M=null,k=[],_=[],P=new p0,V=null,D=new kJ;D.viewport=new QJ;let B=new kJ;B.viewport=new QJ;let A=[D,B],z=new _Z,S=null,y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(s){let Y0=k[s];if(Y0===void 0)Y0=new l6,k[s]=Y0;return Y0.getTargetRaySpace()},this.getControllerGrip=function(s){let Y0=k[s];if(Y0===void 0)Y0=new l6,k[s]=Y0;return Y0.getGripSpace()},this.getHand=function(s){let Y0=k[s];if(Y0===void 0)Y0=new l6,k[s]=Y0;return Y0.getHandSpace()};function v(s){let Y0=_.indexOf(s.inputSource);if(Y0===-1)return;let D0=k[Y0];if(D0!==void 0)D0.update(s.inputSource,s.frame,H||Y),D0.dispatchEvent({type:s.type,data:s.inputSource})}function h(){Z.removeEventListener("select",v),Z.removeEventListener("selectstart",v),Z.removeEventListener("selectend",v),Z.removeEventListener("squeeze",v),Z.removeEventListener("squeezestart",v),Z.removeEventListener("squeezeend",v),Z.removeEventListener("end",h),Z.removeEventListener("inputsourceschange",g);for(let s=0;s<k.length;s++){let Y0=_[s];if(Y0===null)continue;_[s]=null,k[s].disconnect(Y0)}S=null,y=null,C.reset();for(let s in q)delete q[s];J.setRenderTarget(L),E=null,F=null,G=null,Z=null,M=null,v0.stop(),$.isPresenting=!1,J.setPixelRatio(V),J.setSize(P.width,P.height,!1),$.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(s){if(W=s,$.isPresenting===!0)C0("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(s){if(X=s,$.isPresenting===!0)C0("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return H||Y},this.setReferenceSpace=function(s){H=s},this.getBaseLayer=function(){return F!==null?F:E},this.getBinding=function(){if(G===null&&R)G=new XRWebGLBinding(Z,Q);return G},this.getFrame=function(){return O},this.getSession=function(){return Z},this.setSession=async function(s){if(Z=s,Z!==null){if(L=J.getRenderTarget(),Z.addEventListener("select",v),Z.addEventListener("selectstart",v),Z.addEventListener("selectend",v),Z.addEventListener("squeeze",v),Z.addEventListener("squeezestart",v),Z.addEventListener("squeezeend",v),Z.addEventListener("end",h),Z.addEventListener("inputsourceschange",g),N.xrCompatible!==!0)await Q.makeXRCompatible();if(V=J.getPixelRatio(),J.getSize(P),!(R&&("createProjectionLayer"in XRWebGLBinding.prototype))){let D0={antialias:N.antialias,alpha:!0,depth:N.depth,stencil:N.stencil,framebufferScaleFactor:W};E=new XRWebGLLayer(Z,Q,D0),Z.updateRenderState({baseLayer:E}),J.setPixelRatio(1),J.setSize(E.framebufferWidth,E.framebufferHeight,!1),M=new nJ(E.framebufferWidth,E.framebufferHeight,{format:_9,type:D9,colorSpace:J.outputColorSpace,stencilBuffer:N.stencil,resolveDepthBuffer:E.ignoreDepthValues===!1,resolveStencilBuffer:E.ignoreDepthValues===!1})}else{let D0=null,G0=null,w0=null;if(N.depth)w0=N.stencil?Q.DEPTH24_STENCIL8:Q.DEPTH_COMPONENT24,D0=N.stencil?w8:z8,G0=N.stencil?H6:K8;let i0={colorFormat:Q.RGBA8,depthFormat:w0,scaleFactor:W};G=this.getBinding(),F=G.createProjectionLayer(i0),Z.updateRenderState({layers:[F]}),J.setPixelRatio(1),J.setSize(F.textureWidth,F.textureHeight,!1),M=new nJ(F.textureWidth,F.textureHeight,{format:_9,type:D9,depthTexture:new U8(F.textureWidth,F.textureHeight,G0,void 0,void 0,void 0,void 0,void 0,void 0,D0),stencilBuffer:N.stencil,colorSpace:J.outputColorSpace,samples:N.antialias?4:0,resolveDepthBuffer:F.ignoreDepthValues===!1,resolveStencilBuffer:F.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(K),H=null,Y=await Z.requestReferenceSpace(X),v0.setContext(Z),v0.start(),$.isPresenting=!0,$.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(Z!==null)return Z.environmentBlendMode},this.getDepthTexture=function(){return C.getDepthTexture()};function g(s){for(let Y0=0;Y0<s.removed.length;Y0++){let D0=s.removed[Y0],G0=_.indexOf(D0);if(G0>=0)_[G0]=null,k[G0].disconnect(D0)}for(let Y0=0;Y0<s.added.length;Y0++){let D0=s.added[Y0],G0=_.indexOf(D0);if(G0===-1){for(let i0=0;i0<k.length;i0++)if(i0>=_.length){_.push(D0),G0=i0;break}else if(_[i0]===null){_[i0]=D0,G0=i0;break}if(G0===-1)break}let w0=k[G0];if(w0)w0.connect(D0)}}let p=new j,c=new j;function a(s,Y0,D0){p.setFromMatrixPosition(Y0.matrixWorld),c.setFromMatrixPosition(D0.matrixWorld);let G0=p.distanceTo(c),w0=Y0.projectionMatrix.elements,i0=D0.projectionMatrix.elements,j0=w0[14]/(w0[10]-1),d0=w0[14]/(w0[10]+1),YJ=(w0[9]+1)/w0[5],XJ=(w0[9]-1)/w0[5],u0=(w0[8]-1)/w0[0],jJ=(i0[8]+1)/i0[0],vJ=j0*u0,CJ=j0*jJ,b=G0/(-u0+jJ),pJ=b*-u0;if(Y0.matrixWorld.decompose(s.position,s.quaternion,s.scale),s.translateX(pJ),s.translateZ(b),s.matrixWorld.compose(s.position,s.quaternion,s.scale),s.matrixWorldInverse.copy(s.matrixWorld).invert(),w0[10]===-1)s.projectionMatrix.copy(Y0.projectionMatrix),s.projectionMatrixInverse.copy(Y0.projectionMatrixInverse);else{let a0=j0+b,t0=d0+b,O0=vJ-pJ,qJ=CJ+(G0-pJ),T0=YJ*d0/t0*a0,T=XJ*d0/t0*a0;s.projectionMatrix.makePerspective(O0,qJ,T0,T,a0,t0),s.projectionMatrixInverse.copy(s.projectionMatrix).invert()}}function Q0(s,Y0){if(Y0===null)s.matrixWorld.copy(s.matrix);else s.matrixWorld.multiplyMatrices(Y0.matrixWorld,s.matrix);s.matrixWorldInverse.copy(s.matrixWorld).invert()}this.updateCamera=function(s){if(Z===null)return;let{near:Y0,far:D0}=s;if(C.texture!==null){if(C.depthNear>0)Y0=C.depthNear;if(C.depthFar>0)D0=C.depthFar}if(z.near=B.near=D.near=Y0,z.far=B.far=D.far=D0,S!==z.near||y!==z.far)Z.updateRenderState({depthNear:z.near,depthFar:z.far}),S=z.near,y=z.far;z.layers.mask=s.layers.mask|6,D.layers.mask=z.layers.mask&-5,B.layers.mask=z.layers.mask&-3;let G0=s.parent,w0=z.cameras;Q0(z,G0);for(let i0=0;i0<w0.length;i0++)Q0(w0[i0],G0);if(w0.length===2)a(z,D,B);else z.projectionMatrix.copy(D.projectionMatrix);H0(s,z,G0)};function H0(s,Y0,D0){if(D0===null)s.matrix.copy(Y0.matrixWorld);else s.matrix.copy(D0.matrixWorld),s.matrix.invert(),s.matrix.multiply(Y0.matrixWorld);if(s.matrix.decompose(s.position,s.quaternion,s.scale),s.updateMatrixWorld(!0),s.projectionMatrix.copy(Y0.projectionMatrix),s.projectionMatrixInverse.copy(Y0.projectionMatrixInverse),s.isPerspectiveCamera)s.fov=k8*2*Math.atan(1/s.projectionMatrix.elements[5]),s.zoom=1}this.getCamera=function(){return z},this.getFoveation=function(){if(F===null&&E===null)return;return K},this.setFoveation=function(s){if(K=s,F!==null)F.fixedFoveation=s;if(E!==null&&E.fixedFoveation!==void 0)E.fixedFoveation=s},this.hasDepthSensing=function(){return C.texture!==null},this.getDepthSensingMesh=function(){return C.getMesh(z)},this.getCameraTexture=function(s){return q[s]};let J0=null;function x0(s,Y0){if(U=Y0.getViewerPose(H||Y),O=Y0,U!==null){let D0=U.views;if(E!==null)J.setRenderTargetFramebuffer(M,E.framebuffer),J.setRenderTarget(M);let G0=!1;if(D0.length!==z.cameras.length)z.cameras.length=0,G0=!0;for(let d0=0;d0<D0.length;d0++){let YJ=D0[d0],XJ=null;if(E!==null)XJ=E.getViewport(YJ);else{let jJ=G.getViewSubImage(F,YJ);if(XJ=jJ.viewport,d0===0)J.setRenderTargetTextures(M,jJ.colorTexture,jJ.depthStencilTexture),J.setRenderTarget(M)}let u0=A[d0];if(u0===void 0)u0=new kJ,u0.layers.enable(d0),u0.viewport=new QJ,A[d0]=u0;if(u0.matrix.fromArray(YJ.transform.matrix),u0.matrix.decompose(u0.position,u0.quaternion,u0.scale),u0.projectionMatrix.fromArray(YJ.projectionMatrix),u0.projectionMatrixInverse.copy(u0.projectionMatrix).invert(),u0.viewport.set(XJ.x,XJ.y,XJ.width,XJ.height),d0===0)z.matrix.copy(u0.matrix),z.matrix.decompose(z.position,z.quaternion,z.scale);if(G0===!0)z.cameras.push(u0)}let w0=Z.enabledFeatures;if(w0&&w0.includes("depth-sensing")&&Z.depthUsage=="gpu-optimized"&&R){G=$.getBinding();let d0=G.getDepthInformation(D0[0]);if(d0&&d0.isValid&&d0.texture)C.init(d0,Z.renderState)}if(w0&&w0.includes("camera-access")&&R){J.state.unbindTexture(),G=$.getBinding();for(let d0=0;d0<D0.length;d0++){let YJ=D0[d0].camera;if(YJ){let XJ=q[YJ];if(!XJ)XJ=new GQ,q[YJ]=XJ;let u0=G.getCameraImage(YJ);XJ.sourceTexture=u0}}}}for(let D0=0;D0<k.length;D0++){let G0=_[D0],w0=k[D0];if(G0!==null&&w0!==void 0)w0.update(G0,Y0,H||Y)}if(J0)J0(s,Y0);if(Y0.detectedPlanes)$.dispatchEvent({type:"planesdetected",data:Y0});O=null}let v0=new AX;v0.setAnimationLoop(x0),this.setAnimationLoop=function(s){J0=s},this.dispose=function(){}}}var a1=new S0,mX=new h0;mX.set(-1,0,0,0,1,0,0,0,1);function r1(J,Q){function $(q,N){if(q.matrixAutoUpdate===!0)q.updateMatrix();N.value.copy(q.matrix)}function Z(q,N){if(N.color.getRGB(q.fogColor.value,LZ(J)),N.isFog)q.fogNear.value=N.near,q.fogFar.value=N.far;else if(N.isFogExp2)q.fogDensity.value=N.density}function W(q,N,L,M,k){if(N.isNodeMaterial)N.uniformsNeedUpdate=!1;else if(N.isMeshBasicMaterial)Y(q,N);else if(N.isMeshLambertMaterial){if(Y(q,N),N.envMap)q.envMapIntensity.value=N.envMapIntensity}else if(N.isMeshToonMaterial)Y(q,N),F(q,N);else if(N.isMeshPhongMaterial){if(Y(q,N),G(q,N),N.envMap)q.envMapIntensity.value=N.envMapIntensity}else if(N.isMeshStandardMaterial){if(Y(q,N),E(q,N),N.isMeshPhysicalMaterial)O(q,N,k)}else if(N.isMeshMatcapMaterial)Y(q,N),R(q,N);else if(N.isMeshDepthMaterial)Y(q,N);else if(N.isMeshDistanceMaterial)Y(q,N),C(q,N);else if(N.isMeshNormalMaterial)Y(q,N);else if(N.isLineBasicMaterial){if(X(q,N),N.isLineDashedMaterial)K(q,N)}else if(N.isPointsMaterial)H(q,N,L,M);else if(N.isSpriteMaterial)U(q,N);else if(N.isShadowMaterial)q.color.value.copy(N.color),q.opacity.value=N.opacity;else if(N.isShaderMaterial)N.uniformsNeedUpdate=!1}function Y(q,N){if(q.opacity.value=N.opacity,N.color)q.diffuse.value.copy(N.color);if(N.emissive)q.emissive.value.copy(N.emissive).multiplyScalar(N.emissiveIntensity);if(N.map)q.map.value=N.map,$(N.map,q.mapTransform);if(N.alphaMap)q.alphaMap.value=N.alphaMap,$(N.alphaMap,q.alphaMapTransform);if(N.bumpMap){if(q.bumpMap.value=N.bumpMap,$(N.bumpMap,q.bumpMapTransform),q.bumpScale.value=N.bumpScale,N.side===bJ)q.bumpScale.value*=-1}if(N.normalMap){if(q.normalMap.value=N.normalMap,$(N.normalMap,q.normalMapTransform),q.normalScale.value.copy(N.normalScale),N.side===bJ)q.normalScale.value.negate()}if(N.displacementMap)q.displacementMap.value=N.displacementMap,$(N.displacementMap,q.displacementMapTransform),q.displacementScale.value=N.displacementScale,q.displacementBias.value=N.displacementBias;if(N.emissiveMap)q.emissiveMap.value=N.emissiveMap,$(N.emissiveMap,q.emissiveMapTransform);if(N.specularMap)q.specularMap.value=N.specularMap,$(N.specularMap,q.specularMapTransform);if(N.alphaTest>0)q.alphaTest.value=N.alphaTest;let L=Q.get(N),M=L.envMap,k=L.envMapRotation;if(M){if(q.envMap.value=M,q.envMapRotation.value.setFromMatrix4(a1.makeRotationFromEuler(k)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1)q.envMapRotation.value.premultiply(mX);q.reflectivity.value=N.reflectivity,q.ior.value=N.ior,q.refractionRatio.value=N.refractionRatio}if(N.lightMap)q.lightMap.value=N.lightMap,q.lightMapIntensity.value=N.lightMapIntensity,$(N.lightMap,q.lightMapTransform);if(N.aoMap)q.aoMap.value=N.aoMap,q.aoMapIntensity.value=N.aoMapIntensity,$(N.aoMap,q.aoMapTransform)}function X(q,N){if(q.diffuse.value.copy(N.color),q.opacity.value=N.opacity,N.map)q.map.value=N.map,$(N.map,q.mapTransform)}function K(q,N){q.dashSize.value=N.dashSize,q.totalSize.value=N.dashSize+N.gapSize,q.scale.value=N.scale}function H(q,N,L,M){if(q.diffuse.value.copy(N.color),q.opacity.value=N.opacity,q.size.value=N.size*L,q.scale.value=M*0.5,N.map)q.map.value=N.map,$(N.map,q.uvTransform);if(N.alphaMap)q.alphaMap.value=N.alphaMap,$(N.alphaMap,q.alphaMapTransform);if(N.alphaTest>0)q.alphaTest.value=N.alphaTest}function U(q,N){if(q.diffuse.value.copy(N.color),q.opacity.value=N.opacity,q.rotation.value=N.rotation,N.map)q.map.value=N.map,$(N.map,q.mapTransform);if(N.alphaMap)q.alphaMap.value=N.alphaMap,$(N.alphaMap,q.alphaMapTransform);if(N.alphaTest>0)q.alphaTest.value=N.alphaTest}function G(q,N){q.specular.value.copy(N.specular),q.shininess.value=Math.max(N.shininess,0.0001)}function F(q,N){if(N.gradientMap)q.gradientMap.value=N.gradientMap}function E(q,N){if(q.metalness.value=N.metalness,N.metalnessMap)q.metalnessMap.value=N.metalnessMap,$(N.metalnessMap,q.metalnessMapTransform);if(q.roughness.value=N.roughness,N.roughnessMap)q.roughnessMap.value=N.roughnessMap,$(N.roughnessMap,q.roughnessMapTransform);if(N.envMap)q.envMapIntensity.value=N.envMapIntensity}function O(q,N,L){if(q.ior.value=N.ior,N.sheen>0){if(q.sheenColor.value.copy(N.sheenColor).multiplyScalar(N.sheen),q.sheenRoughness.value=N.sheenRoughness,N.sheenColorMap)q.sheenColorMap.value=N.sheenColorMap,$(N.sheenColorMap,q.sheenColorMapTransform);if(N.sheenRoughnessMap)q.sheenRoughnessMap.value=N.sheenRoughnessMap,$(N.sheenRoughnessMap,q.sheenRoughnessMapTransform)}if(N.clearcoat>0){if(q.clearcoat.value=N.clearcoat,q.clearcoatRoughness.value=N.clearcoatRoughness,N.clearcoatMap)q.clearcoatMap.value=N.clearcoatMap,$(N.clearcoatMap,q.clearcoatMapTransform);if(N.clearcoatRoughnessMap)q.clearcoatRoughnessMap.value=N.clearcoatRoughnessMap,$(N.clearcoatRoughnessMap,q.clearcoatRoughnessMapTransform);if(N.clearcoatNormalMap){if(q.clearcoatNormalMap.value=N.clearcoatNormalMap,$(N.clearcoatNormalMap,q.clearcoatNormalMapTransform),q.clearcoatNormalScale.value.copy(N.clearcoatNormalScale),N.side===bJ)q.clearcoatNormalScale.value.negate()}}if(N.dispersion>0)q.dispersion.value=N.dispersion;if(N.iridescence>0){if(q.iridescence.value=N.iridescence,q.iridescenceIOR.value=N.iridescenceIOR,q.iridescenceThicknessMinimum.value=N.iridescenceThicknessRange[0],q.iridescenceThicknessMaximum.value=N.iridescenceThicknessRange[1],N.iridescenceMap)q.iridescenceMap.value=N.iridescenceMap,$(N.iridescenceMap,q.iridescenceMapTransform);if(N.iridescenceThicknessMap)q.iridescenceThicknessMap.value=N.iridescenceThicknessMap,$(N.iridescenceThicknessMap,q.iridescenceThicknessMapTransform)}if(N.transmission>0){if(q.transmission.value=N.transmission,q.transmissionSamplerMap.value=L.texture,q.transmissionSamplerSize.value.set(L.width,L.height),N.transmissionMap)q.transmissionMap.value=N.transmissionMap,$(N.transmissionMap,q.transmissionMapTransform);if(q.thickness.value=N.thickness,N.thicknessMap)q.thicknessMap.value=N.thicknessMap,$(N.thicknessMap,q.thicknessMapTransform);q.attenuationDistance.value=N.attenuationDistance,q.attenuationColor.value.copy(N.attenuationColor)}if(N.anisotropy>0){if(q.anisotropyVector.value.set(N.anisotropy*Math.cos(N.anisotropyRotation),N.anisotropy*Math.sin(N.anisotropyRotation)),N.anisotropyMap)q.anisotropyMap.value=N.anisotropyMap,$(N.anisotropyMap,q.anisotropyMapTransform)}if(q.specularIntensity.value=N.specularIntensity,q.specularColor.value.copy(N.specularColor),N.specularColorMap)q.specularColorMap.value=N.specularColorMap,$(N.specularColorMap,q.specularColorMapTransform);if(N.specularIntensityMap)q.specularIntensityMap.value=N.specularIntensityMap,$(N.specularIntensityMap,q.specularIntensityMapTransform)}function R(q,N){if(N.matcap)q.matcap.value=N.matcap}function C(q,N){let L=Q.get(N).light;q.referencePosition.value.setFromMatrixPosition(L.matrixWorld),q.nearDistance.value=L.shadow.camera.near,q.farDistance.value=L.shadow.camera.far}return{refreshFogUniforms:Z,refreshMaterialUniforms:W}}function t1(J,Q,$,Z){let W={},Y={},X=[],K=J.getParameter(J.MAX_UNIFORM_BUFFER_BINDINGS);function H(L,M){let k=M.program;Z.uniformBlockBinding(L,k)}function U(L,M){let k=W[L.id];if(k===void 0)R(L),k=G(L),W[L.id]=k,L.addEventListener("dispose",q);let _=M.program;Z.updateUBOMapping(L,_);let P=Q.render.frame;if(Y[L.id]!==P)E(L),Y[L.id]=P}function G(L){let M=F();L.__bindingPointIndex=M;let k=J.createBuffer(),_=L.__size,P=L.usage;return J.bindBuffer(J.UNIFORM_BUFFER,k),J.bufferData(J.UNIFORM_BUFFER,_,P),J.bindBuffer(J.UNIFORM_BUFFER,null),J.bindBufferBase(J.UNIFORM_BUFFER,M,k),k}function F(){for(let L=0;L<K;L++)if(X.indexOf(L)===-1)return X.push(L),L;return A0("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function E(L){let M=W[L.id],k=L.uniforms,_=L.__cache;J.bindBuffer(J.UNIFORM_BUFFER,M);for(let P=0,V=k.length;P<V;P++){let D=Array.isArray(k[P])?k[P]:[k[P]];for(let B=0,A=D.length;B<A;B++){let z=D[B];if(O(z,P,B,_)===!0){let S=z.__offset,y=Array.isArray(z.value)?z.value:[z.value],v=0;for(let h=0;h<y.length;h++){let g=y[h],p=C(g);if(typeof g==="number"||typeof g==="boolean")z.__data[0]=g,J.bufferSubData(J.UNIFORM_BUFFER,S+v,z.__data);else if(g.isMatrix3)z.__data[0]=g.elements[0],z.__data[1]=g.elements[1],z.__data[2]=g.elements[2],z.__data[3]=0,z.__data[4]=g.elements[3],z.__data[5]=g.elements[4],z.__data[6]=g.elements[5],z.__data[7]=0,z.__data[8]=g.elements[6],z.__data[9]=g.elements[7],z.__data[10]=g.elements[8],z.__data[11]=0;else if(ArrayBuffer.isView(g))z.__data.set(new g.constructor(g.buffer,g.byteOffset,z.__data.length));else g.toArray(z.__data,v),v+=p.storage/Float32Array.BYTES_PER_ELEMENT}J.bufferSubData(J.UNIFORM_BUFFER,S,z.__data)}}}J.bindBuffer(J.UNIFORM_BUFFER,null)}function O(L,M,k,_){let P=L.value,V=M+"_"+k;if(_[V]===void 0){if(typeof P==="number"||typeof P==="boolean")_[V]=P;else if(ArrayBuffer.isView(P))_[V]=P.slice();else _[V]=P.clone();return!0}else{let D=_[V];if(typeof P==="number"||typeof P==="boolean"){if(D!==P)return _[V]=P,!0}else if(ArrayBuffer.isView(P))return!0;else if(D.equals(P)===!1)return D.copy(P),!0}return!1}function R(L){let M=L.uniforms,k=0,_=16;for(let V=0,D=M.length;V<D;V++){let B=Array.isArray(M[V])?M[V]:[M[V]];for(let A=0,z=B.length;A<z;A++){let S=B[A],y=Array.isArray(S.value)?S.value:[S.value];for(let v=0,h=y.length;v<h;v++){let g=y[v],p=C(g),c=k%_,a=c%p.boundary,Q0=c+a;if(k+=a,Q0!==0&&_-Q0<p.storage)k+=_-Q0;S.__data=new Float32Array(p.storage/Float32Array.BYTES_PER_ELEMENT),S.__offset=k,k+=p.storage}}}let P=k%_;if(P>0)k+=_-P;return L.__size=k,L.__cache={},this}function C(L){let M={boundary:0,storage:0};if(typeof L==="number"||typeof L==="boolean")M.boundary=4,M.storage=4;else if(L.isVector2)M.boundary=8,M.storage=8;else if(L.isVector3||L.isColor)M.boundary=16,M.storage=12;else if(L.isVector4)M.boundary=16,M.storage=16;else if(L.isMatrix3)M.boundary=48,M.storage=48;else if(L.isMatrix4)M.boundary=64,M.storage=64;else if(L.isTexture)C0("WebGLRenderer: Texture samplers can not be part of an uniforms group.");else if(ArrayBuffer.isView(L))M.boundary=16,M.storage=L.byteLength;else C0("WebGLRenderer: Unsupported uniform value type.",L);return M}function q(L){let M=L.target;M.removeEventListener("dispose",q);let k=X.indexOf(M.__bindingPointIndex);X.splice(k,1),J.deleteBuffer(W[M.id]),delete W[M.id],delete Y[M.id]}function N(){for(let L in W)J.deleteBuffer(W[L]);X=[],W={},Y={}}return{bind:H,update:U,dispose:N}}var e1=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,14942,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]),v9=null;function JF(){if(v9===null)v9=new O6(e1,16,16,P8,fJ),v9.name="DFG_LUT",v9.minFilter=BJ,v9.magFilter=BJ,v9.wrapS=X6,v9.wrapT=X6,v9.generateMipmaps=!1,v9.needsUpdate=!0;return v9}class lZ{constructor(J={}){let{canvas:Q=aY(),context:$=null,depth:Z=!0,stencil:W=!1,alpha:Y=!1,antialias:X=!1,premultipliedAlpha:K=!0,preserveDrawingBuffer:H=!1,powerPreference:U="default",failIfMajorPerformanceCaveat:G=!1,reversedDepthBuffer:F=!1,outputBufferType:E=D9}=J;this.isWebGLRenderer=!0;let O;if($!==null){if(typeof WebGLRenderingContext<"u"&&$ instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");O=$.getContextAttributes().alpha}else O=Y;let R=E,C=new Set([P$,w$,z$]),q=new Set([D9,K8,d6,H6,C$,I$]),N=new Uint32Array(4),L=new Int32Array(4),M=new j,k=null,_=null,P=[],V=[],D=null;this.domElement=Q,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=rJ,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let B=this,A=!1,z=null;this._outputColorSpace=H8;let S=0,y=0,v=null,h=-1,g=null,p=new QJ,c=new QJ,a=null,Q0=new R0(0),H0=0,J0=Q.width,x0=Q.height,v0=1,s=null,Y0=null,D0=new QJ(0,0,J0,x0),G0=new QJ(0,0,J0,x0),w0=!1,i0=new A8,j0=!1,d0=!1,YJ=new S0,XJ=new j,u0=new QJ,jJ={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},vJ=!1;function CJ(){return v===null?v0:1}let b=$;function pJ(w,f){return Q.getContext(w,f)}try{let w={alpha:!0,depth:Z,stencil:W,antialias:X,premultipliedAlpha:K,preserveDrawingBuffer:H,powerPreference:U,failIfMajorPerformanceCaveat:G};if("setAttribute"in Q)Q.setAttribute("data-engine",`three.js r${$Y}`);if(Q.addEventListener("webglcontextlost",V0,!1),Q.addEventListener("webglcontextrestored",e,!1),Q.addEventListener("webglcontextcreationerror",z0,!1),b===null){if(b=pJ("webgl2",w),b===null)if(pJ("webgl2"))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(w){throw A0("WebGLRenderer: "+w.message),w}let a0,t0,O0,qJ,T0,T,I,d,r,t,$0,E0,n,o,K0,B0,W0,F0,y0,g0,c0,x,X0;function i(){if(a0=new KE(b),a0.init(),c0=new s1(b,a0),t0=new e5(b,a0,J,c0),O0=new c1(b,a0),t0.reversedDepthBuffer&&F)O0.buffers.depth.setReversed(!0);qJ=new GE(b),T0=new S1,T=new n1(b,a0,O0,T0,t0,c0,qJ),I=new XE(B),d=new OU(b),x=new r5(b,d),r=new HE(b,d,qJ,x),t=new FE(b,r,d,x,qJ),F0=new EE(b,t0,T),K0=new JE(T0),$0=new A1(B,I,a0,t0,x,K0),E0=new r1(B,T0),n=new v1,o=new g1(a0),W0=new a5(B,I,O0,t,O,K),B0=new l1(B,t,t0),X0=new t1(b,qJ,t0,O0),y0=new t5(b,a0,qJ),g0=new UE(b,a0,qJ),qJ.programs=$0.programs,B.capabilities=t0,B.extensions=a0,B.properties=T0,B.renderLists=n,B.shadowMap=B0,B.state=O0,B.info=qJ}if(i(),R!==D9)D=new OE(R,Q.width,Q.height,Z,W);let Z0=new uX(B,b);this.xr=Z0,this.getContext=function(){return b},this.getContextAttributes=function(){return b.getContextAttributes()},this.forceContextLoss=function(){let w=a0.get("WEBGL_lose_context");if(w)w.loseContext()},this.forceContextRestore=function(){let w=a0.get("WEBGL_lose_context");if(w)w.restoreContext()},this.getPixelRatio=function(){return v0},this.setPixelRatio=function(w){if(w===void 0)return;v0=w,this.setSize(J0,x0,!1)},this.getSize=function(w){return w.set(J0,x0)},this.setSize=function(w,f,l=!0){if(Z0.isPresenting){C0("WebGLRenderer: Can't change size while VR device is presenting.");return}if(J0=w,x0=f,Q.width=Math.floor(w*v0),Q.height=Math.floor(f*v0),l===!0)Q.style.width=w+"px",Q.style.height=f+"px";if(D!==null)D.setSize(Q.width,Q.height);this.setViewport(0,0,w,f)},this.getDrawingBufferSize=function(w){return w.set(J0*v0,x0*v0).floor()},this.setDrawingBufferSize=function(w,f,l){J0=w,x0=f,v0=l,Q.width=Math.floor(w*l),Q.height=Math.floor(f*l),this.setViewport(0,0,w,f)},this.setEffects=function(w){if(R===D9){A0("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(w){for(let f=0;f<w.length;f++)if(w[f].isOutputPass===!0){C0("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}D.setEffects(w||[])},this.getCurrentViewport=function(w){return w.copy(p)},this.getViewport=function(w){return w.copy(D0)},this.setViewport=function(w,f,l,u){if(w.isVector4)D0.set(w.x,w.y,w.z,w.w);else D0.set(w,f,l,u);O0.viewport(p.copy(D0).multiplyScalar(v0).round())},this.getScissor=function(w){return w.copy(G0)},this.setScissor=function(w,f,l,u){if(w.isVector4)G0.set(w.x,w.y,w.z,w.w);else G0.set(w,f,l,u);O0.scissor(c.copy(G0).multiplyScalar(v0).round())},this.getScissorTest=function(){return w0},this.setScissorTest=function(w){O0.setScissorTest(w0=w)},this.setOpaqueSort=function(w){s=w},this.setTransparentSort=function(w){Y0=w},this.getClearColor=function(w){return w.copy(W0.getClearColor())},this.setClearColor=function(){W0.setClearColor(...arguments)},this.getClearAlpha=function(){return W0.getClearAlpha()},this.setClearAlpha=function(){W0.setClearAlpha(...arguments)},this.clear=function(w=!0,f=!0,l=!0){let u=0;if(w){let m=!1;if(v!==null){let q0=v.texture.format;m=C.has(q0)}if(m){let q0=v.texture.type,k0=q.has(q0),N0=W0.getClearColor(),I0=W0.getClearAlpha(),P0=N0.r,f0=N0.g,n0=N0.b;if(k0)N[0]=P0,N[1]=f0,N[2]=n0,N[3]=I0,b.clearBufferuiv(b.COLOR,0,N);else L[0]=P0,L[1]=f0,L[2]=n0,L[3]=I0,b.clearBufferiv(b.COLOR,0,L)}else u|=b.COLOR_BUFFER_BIT}if(f)u|=b.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0);if(l)u|=b.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295);if(u!==0)b.clear(u)},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(w){w.setRenderer(this),z=w},this.dispose=function(){Q.removeEventListener("webglcontextlost",V0,!1),Q.removeEventListener("webglcontextrestored",e,!1),Q.removeEventListener("webglcontextcreationerror",z0,!1),W0.dispose(),n.dispose(),o.dispose(),T0.dispose(),I.dispose(),t.dispose(),x.dispose(),X0.dispose(),$0.dispose(),Z0.dispose(),Z0.removeEventListener("sessionstart",GW),Z0.removeEventListener("sessionend",EW),q8.stop()};function V0(w){w.preventDefault(),x6("WebGLRenderer: Context Lost."),A=!0}function e(){x6("WebGLRenderer: Context Restored."),A=!1;let w=qJ.autoReset,f=B0.enabled,l=B0.autoUpdate,u=B0.needsUpdate,m=B0.type;i(),qJ.autoReset=w,B0.enabled=f,B0.autoUpdate=l,B0.needsUpdate=u,B0.type=m}function z0(w){A0("WebGLRenderer: A WebGL context could not be created. Reason: ",w.statusMessage)}function b0(w){let f=w.target;f.removeEventListener("dispose",b0),IJ(f)}function IJ(w){ZJ(w),T0.remove(w)}function ZJ(w){let f=T0.get(w).programs;if(f!==void 0){if(f.forEach(function(l){$0.releaseProgram(l)}),w.isShaderMaterial)$0.releaseShaderCache(w)}}this.renderBufferDirect=function(w,f,l,u,m,q0){if(f===null)f=jJ;let k0=m.isMesh&&m.matrixWorld.determinant()<0,N0=WH(w,f,l,u,m);O0.setMaterial(u,k0);let I0=l.index,P0=1;if(u.wireframe===!0){if(I0=r.getWireframeAttribute(l),I0===void 0)return;P0=2}let f0=l.drawRange,n0=l.attributes.position,_0=f0.start*P0,WJ=(f0.start+f0.count)*P0;if(q0!==null)_0=Math.max(_0,q0.start*P0),WJ=Math.min(WJ,(q0.start+q0.count)*P0);if(I0!==null)_0=Math.max(_0,0),WJ=Math.min(WJ,I0.count);else if(n0!==void 0&&n0!==null)_0=Math.max(_0,0),WJ=Math.min(WJ,n0.count);let DJ=WJ-_0;if(DJ<0||DJ===1/0)return;x.setup(m,u,N0,l,I0);let LJ,KJ=y0;if(I0!==null)LJ=d.get(I0),KJ=g0,KJ.setIndex(LJ);if(m.isMesh)if(u.wireframe===!0)O0.setLineWidth(u.wireframeLinewidth*CJ()),KJ.setMode(b.LINES);else KJ.setMode(b.TRIANGLES);else if(m.isLine){let yJ=u.linewidth;if(yJ===void 0)yJ=1;if(O0.setLineWidth(yJ*CJ()),m.isLineSegments)KJ.setMode(b.LINES);else if(m.isLineLoop)KJ.setMode(b.LINE_LOOP);else KJ.setMode(b.LINE_STRIP)}else if(m.isPoints)KJ.setMode(b.POINTS);else if(m.isSprite)KJ.setMode(b.TRIANGLES);if(m.isBatchedMesh)if(!a0.get("WEBGL_multi_draw")){let{_multiDrawStarts:yJ,_multiDrawCounts:M0,_multiDrawCount:iJ}=m,r0=I0?d.get(I0).bytesPerElement:1,Q9=T0.get(u).currentProgram.getUniforms();for(let V9=0;V9<iJ;V9++)Q9.setValue(b,"_gl_DrawID",V9),KJ.render(yJ[V9]/r0,M0[V9])}else KJ.renderMultiDraw(m._multiDrawStarts,m._multiDrawCounts,m._multiDrawCount);else if(m.isInstancedMesh)KJ.renderInstances(_0,DJ,m.count);else if(l.isInstancedBufferGeometry){let yJ=l._maxInstanceCount!==void 0?l._maxInstanceCount:1/0,M0=Math.min(l.instanceCount,yJ);KJ.renderInstances(_0,DJ,M0)}else KJ.render(_0,DJ)};function B9(w,f,l){if(w.transparent===!0&&w.side===cJ&&w.forceSinglePass===!1)w.side=bJ,w.needsUpdate=!0,F7(w,f,l),w.side=z9,w.needsUpdate=!0,F7(w,f,l),w.side=cJ;else F7(w,f,l)}this.compile=function(w,f,l=null){if(l===null)l=w;if(_=o.get(l),_.init(f),V.push(_),l.traverseVisible(function(m){if(m.isLight&&m.layers.test(f.layers)){if(_.pushLight(m),m.castShadow)_.pushShadow(m)}}),w!==l)w.traverseVisible(function(m){if(m.isLight&&m.layers.test(f.layers)){if(_.pushLight(m),m.castShadow)_.pushShadow(m)}});_.setupLights();let u=new Set;return w.traverse(function(m){if(!(m.isMesh||m.isPoints||m.isLine||m.isSprite))return;let q0=m.material;if(q0)if(Array.isArray(q0))for(let k0=0;k0<q0.length;k0++){let N0=q0[k0];B9(N0,l,m),u.add(N0)}else B9(q0,l,m),u.add(q0)}),_=V.pop(),u},this.compileAsync=function(w,f,l=null){let u=this.compile(w,f,l);return new Promise((m)=>{function q0(){if(u.forEach(function(k0){if(T0.get(k0).currentProgram.isReady())u.delete(k0)}),u.size===0){m(w);return}setTimeout(q0,10)}if(a0.get("KHR_parallel_shader_compile")!==null)q0();else setTimeout(q0,10)})};let G9=null;function $H(w){if(G9)G9(w)}function GW(){q8.stop()}function EW(){q8.start()}let q8=new AX;if(q8.setAnimationLoop($H),typeof self<"u")q8.setContext(self);this.setAnimationLoop=function(w){G9=w,Z0.setAnimationLoop(w),w===null?q8.stop():q8.start()},Z0.addEventListener("sessionstart",GW),Z0.addEventListener("sessionend",EW),this.render=function(w,f){if(f!==void 0&&f.isCamera!==!0){A0("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(A===!0)return;if(z!==null)z.renderStart(w,f);let l=Z0.enabled===!0&&Z0.isPresenting===!0,u=D!==null&&(v===null||l)&&D.begin(B,v);if(w.matrixWorldAutoUpdate===!0)w.updateMatrixWorld();if(f.parent===null&&f.matrixWorldAutoUpdate===!0)f.updateMatrixWorld();if(Z0.enabled===!0&&Z0.isPresenting===!0&&(D===null||D.isCompositing()===!1)){if(Z0.cameraAutoUpdate===!0)Z0.updateCamera(f);f=Z0.getCamera()}if(w.isScene===!0)w.onBeforeRender(B,w,f,v);if(_=o.get(w,V.length),_.init(f),_.state.textureUnits=T.getTextureUnits(),V.push(_),YJ.multiplyMatrices(f.projectionMatrix,f.matrixWorldInverse),i0.setFromProjectionMatrix(YJ,UZ,f.reversedDepth),d0=this.localClippingEnabled,j0=K0.init(this.clippingPlanes,d0),k=n.get(w,P.length),k.init(),P.push(k),Z0.enabled===!0&&Z0.isPresenting===!0){let k0=B.xr.getDepthSensingMesh();if(k0!==null)hQ(k0,f,-1/0,B.sortObjects)}if(hQ(w,f,0,B.sortObjects),k.finish(),B.sortObjects===!0)k.sort(s,Y0);if(vJ=Z0.enabled===!1||Z0.isPresenting===!1||Z0.hasDepthSensing()===!1,vJ)W0.addToRenderList(k,w);if(this.info.render.frame++,j0===!0)K0.beginShadows();let m=_.state.shadowsArray;if(B0.render(m,w,f),j0===!0)K0.endShadows();if(this.info.autoReset===!0)this.info.reset();if((u&&D.hasRenderPass())===!1){let{opaque:k0,transmissive:N0}=k;if(_.setupLights(),f.isArrayCamera){let I0=f.cameras;if(N0.length>0)for(let P0=0,f0=I0.length;P0<f0;P0++){let n0=I0[P0];NW(k0,N0,w,n0)}if(vJ)W0.render(w);for(let P0=0,f0=I0.length;P0<f0;P0++){let n0=I0[P0];FW(k,w,n0,n0.viewport)}}else{if(N0.length>0)NW(k0,N0,w,f);if(vJ)W0.render(w);FW(k,w,f)}}if(v!==null&&y===0)T.updateMultisampleRenderTarget(v),T.updateRenderTargetMipmap(v);if(u)D.end(B);if(w.isScene===!0)w.onAfterRender(B,w,f);if(x.resetDefaultState(),h=-1,g=null,V.pop(),V.length>0){if(_=V[V.length-1],T.setTextureUnits(_.state.textureUnits),j0===!0)K0.setGlobalState(B.clippingPlanes,_.state.camera)}else _=null;if(P.pop(),P.length>0)k=P[P.length-1];else k=null;if(z!==null)z.renderEnd()};function hQ(w,f,l,u){if(w.visible===!1)return;if(w.layers.test(f.layers)){if(w.isGroup)l=w.renderOrder;else if(w.isLOD){if(w.autoUpdate===!0)w.update(f)}else if(w.isLightProbeGrid)_.pushLightProbeGrid(w);else if(w.isLight){if(_.pushLight(w),w.castShadow)_.pushShadow(w)}else if(w.isSprite){if(!w.frustumCulled||i0.intersectsSprite(w)){if(u)u0.setFromMatrixPosition(w.matrixWorld).applyMatrix4(YJ);let k0=t.update(w),N0=w.material;if(N0.visible)k.push(w,k0,N0,l,u0.z,null)}}else if(w.isMesh||w.isLine||w.isPoints){if(!w.frustumCulled||i0.intersectsObject(w)){let k0=t.update(w),N0=w.material;if(u){if(w.boundingSphere!==void 0){if(w.boundingSphere===null)w.computeBoundingSphere();u0.copy(w.boundingSphere.center)}else{if(k0.boundingSphere===null)k0.computeBoundingSphere();u0.copy(k0.boundingSphere.center)}u0.applyMatrix4(w.matrixWorld).applyMatrix4(YJ)}if(Array.isArray(N0)){let I0=k0.groups;for(let P0=0,f0=I0.length;P0<f0;P0++){let n0=I0[P0],_0=N0[n0.materialIndex];if(_0&&_0.visible)k.push(w,k0,_0,l,u0.z,n0)}}else if(N0.visible)k.push(w,k0,N0,l,u0.z,null)}}}let q0=w.children;for(let k0=0,N0=q0.length;k0<N0;k0++)hQ(q0[k0],f,l,u)}function FW(w,f,l,u){let{opaque:m,transmissive:q0,transparent:k0}=w;if(_.setupLightsView(l),j0===!0)K0.setGlobalState(B.clippingPlanes,l);if(u)O0.viewport(p.copy(u));if(m.length>0)E7(m,f,l);if(q0.length>0)E7(q0,f,l);if(k0.length>0)E7(k0,f,l);O0.buffers.depth.setTest(!0),O0.buffers.depth.setMask(!0),O0.buffers.color.setMask(!0),O0.setPolygonOffset(!1)}function NW(w,f,l,u){if((l.isScene===!0?l.overrideMaterial:null)!==null)return;if(_.state.transmissionRenderTarget[u.id]===void 0){let _0=a0.has("EXT_color_buffer_half_float")||a0.has("EXT_color_buffer_float");_.state.transmissionRenderTarget[u.id]=new nJ(1,1,{generateMipmaps:!0,type:_0?fJ:D9,minFilter:P9,samples:Math.max(4,t0.samples),stencilBuffer:W,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:s0.workingColorSpace})}let q0=_.state.transmissionRenderTarget[u.id],k0=u.viewport||p;q0.setSize(k0.z*B.transmissionResolutionScale,k0.w*B.transmissionResolutionScale);let N0=B.getRenderTarget(),I0=B.getActiveCubeFace(),P0=B.getActiveMipmapLevel();if(B.setRenderTarget(q0),B.getClearColor(Q0),H0=B.getClearAlpha(),H0<1)B.setClearColor(16777215,0.5);if(B.clear(),vJ)W0.render(l);let f0=B.toneMapping;B.toneMapping=rJ;let n0=u.viewport;if(u.viewport!==void 0)u.viewport=void 0;if(_.setupLightsView(u),j0===!0)K0.setGlobalState(B.clippingPlanes,u);if(E7(w,l,u),T.updateMultisampleRenderTarget(q0),T.updateRenderTargetMipmap(q0),a0.has("WEBGL_multisampled_render_to_texture")===!1){let _0=!1;for(let WJ=0,DJ=f.length;WJ<DJ;WJ++){let LJ=f[WJ],{object:KJ,geometry:yJ,material:M0,group:iJ}=LJ;if(M0.side===cJ&&KJ.layers.test(u.layers)){let r0=M0.side;M0.side=bJ,M0.needsUpdate=!0,OW(KJ,l,u,yJ,M0,iJ),M0.side=r0,M0.needsUpdate=!0,_0=!0}}if(_0===!0)T.updateMultisampleRenderTarget(q0),T.updateRenderTargetMipmap(q0)}if(B.setRenderTarget(N0,I0,P0),B.setClearColor(Q0,H0),n0!==void 0)u.viewport=n0;B.toneMapping=f0}function E7(w,f,l){let u=f.isScene===!0?f.overrideMaterial:null;for(let m=0,q0=w.length;m<q0;m++){let k0=w[m],{object:N0,geometry:I0,group:P0}=k0,f0=k0.material;if(f0.allowOverride===!0&&u!==null)f0=u;if(N0.layers.test(l.layers))OW(N0,f,l,I0,f0,P0)}}function OW(w,f,l,u,m,q0){if(w.onBeforeRender(B,f,l,u,m,q0),w.modelViewMatrix.multiplyMatrices(l.matrixWorldInverse,w.matrixWorld),w.normalMatrix.getNormalMatrix(w.modelViewMatrix),m.onBeforeRender(B,f,l,u,w,q0),m.transparent===!0&&m.side===cJ&&m.forceSinglePass===!1)m.side=bJ,m.needsUpdate=!0,B.renderBufferDirect(l,f,u,m,w,q0),m.side=z9,m.needsUpdate=!0,B.renderBufferDirect(l,f,u,m,w,q0),m.side=cJ;else B.renderBufferDirect(l,f,u,m,w,q0);w.onAfterRender(B,f,l,u,m,q0)}function F7(w,f,l){if(f.isScene!==!0)f=jJ;let u=T0.get(w),m=_.state.lights,q0=_.state.shadowsArray,k0=m.state.version,N0=$0.getParameters(w,m.state,q0,f,l,_.state.lightProbeGridArray),I0=$0.getProgramCacheKey(N0),P0=u.programs;u.environment=w.isMeshStandardMaterial||w.isMeshLambertMaterial||w.isMeshPhongMaterial?f.environment:null,u.fog=f.fog;let f0=w.isMeshStandardMaterial||w.isMeshLambertMaterial&&!w.envMap||w.isMeshPhongMaterial&&!w.envMap;if(u.envMap=I.get(w.envMap||u.environment,f0),u.envMapRotation=u.environment!==null&&w.envMap===null?f.environmentRotation:w.envMapRotation,P0===void 0)w.addEventListener("dispose",b0),P0=new Map,u.programs=P0;let n0=P0.get(I0);if(n0!==void 0){if(u.currentProgram===n0&&u.lightsStateVersion===k0)return RW(w,N0),n0}else{if(N0.uniforms=$0.getUniforms(w),z!==null&&w.isNodeMaterial)z.build(w,l,N0);w.onBeforeCompile(N0,B),n0=$0.acquireProgram(N0,I0),P0.set(I0,n0),u.uniforms=N0.uniforms}let _0=u.uniforms;if(!w.isShaderMaterial&&!w.isRawShaderMaterial||w.clipping===!0)_0.clippingPlanes=K0.uniform;if(RW(w,N0),u.needsLights=XH(w),u.lightsStateVersion=k0,u.needsLights)_0.ambientLightColor.value=m.state.ambient,_0.lightProbe.value=m.state.probe,_0.directionalLights.value=m.state.directional,_0.directionalLightShadows.value=m.state.directionalShadow,_0.spotLights.value=m.state.spot,_0.spotLightShadows.value=m.state.spotShadow,_0.rectAreaLights.value=m.state.rectArea,_0.ltc_1.value=m.state.rectAreaLTC1,_0.ltc_2.value=m.state.rectAreaLTC2,_0.pointLights.value=m.state.point,_0.pointLightShadows.value=m.state.pointShadow,_0.hemisphereLights.value=m.state.hemi,_0.directionalShadowMatrix.value=m.state.directionalShadowMatrix,_0.spotLightMatrix.value=m.state.spotLightMatrix,_0.spotLightMap.value=m.state.spotLightMap,_0.pointShadowMatrix.value=m.state.pointShadowMatrix;return u.lightProbeGrid=_.state.lightProbeGridArray.length>0,u.currentProgram=n0,u.uniformsList=null,n0}function qW(w){if(w.uniformsList===null){let f=w.currentProgram.getUniforms();w.uniformsList=W7.seqWithValue(f.seq,w.uniforms)}return w.uniformsList}function RW(w,f){let l=T0.get(w);l.outputColorSpace=f.outputColorSpace,l.batching=f.batching,l.batchingColor=f.batchingColor,l.instancing=f.instancing,l.instancingColor=f.instancingColor,l.instancingMorph=f.instancingMorph,l.skinning=f.skinning,l.morphTargets=f.morphTargets,l.morphNormals=f.morphNormals,l.morphColors=f.morphColors,l.morphTargetsCount=f.morphTargetsCount,l.numClippingPlanes=f.numClippingPlanes,l.numIntersection=f.numClipIntersection,l.vertexAlphas=f.vertexAlphas,l.vertexTangents=f.vertexTangents,l.toneMapping=f.toneMapping}function ZH(w,f){if(w.length===0)return null;if(w.length===1)return w[0].texture!==null?w[0]:null;M.setFromMatrixPosition(f.matrixWorld);for(let l=0,u=w.length;l<u;l++){let m=w[l];if(m.texture!==null&&m.boundingBox.containsPoint(M))return m}return null}function WH(w,f,l,u,m){if(f.isScene!==!0)f=jJ;T.resetTextureUnits();let q0=f.fog,k0=u.isMeshStandardMaterial||u.isMeshLambertMaterial||u.isMeshPhongMaterial?f.environment:null,N0=v===null?B.outputColorSpace:v.isXRRenderTarget===!0?v.texture.colorSpace:s0.workingColorSpace,I0=u.isMeshStandardMaterial||u.isMeshLambertMaterial&&!u.envMap||u.isMeshPhongMaterial&&!u.envMap,P0=I.get(u.envMap||k0,I0),f0=u.vertexColors===!0&&!!l.attributes.color&&l.attributes.color.itemSize===4,n0=!!l.attributes.tangent&&(!!u.normalMap||u.anisotropy>0),_0=!!l.morphAttributes.position,WJ=!!l.morphAttributes.normal,DJ=!!l.morphAttributes.color,LJ=rJ;if(u.toneMapped){if(v===null||v.isXRRenderTarget===!0)LJ=B.toneMapping}let KJ=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,yJ=KJ!==void 0?KJ.length:0,M0=T0.get(u),iJ=_.state.lights;if(j0===!0){if(d0===!0||w!==g){let EJ=w===g&&u.id===h;K0.setState(u,w,EJ)}}let r0=!1;if(u.version===M0.__version){if(M0.needsLights&&M0.lightsStateVersion!==iJ.state.version)r0=!0;else if(M0.outputColorSpace!==N0)r0=!0;else if(m.isBatchedMesh&&M0.batching===!1)r0=!0;else if(!m.isBatchedMesh&&M0.batching===!0)r0=!0;else if(m.isBatchedMesh&&M0.batchingColor===!0&&m.colorTexture===null)r0=!0;else if(m.isBatchedMesh&&M0.batchingColor===!1&&m.colorTexture!==null)r0=!0;else if(m.isInstancedMesh&&M0.instancing===!1)r0=!0;else if(!m.isInstancedMesh&&M0.instancing===!0)r0=!0;else if(m.isSkinnedMesh&&M0.skinning===!1)r0=!0;else if(!m.isSkinnedMesh&&M0.skinning===!0)r0=!0;else if(m.isInstancedMesh&&M0.instancingColor===!0&&m.instanceColor===null)r0=!0;else if(m.isInstancedMesh&&M0.instancingColor===!1&&m.instanceColor!==null)r0=!0;else if(m.isInstancedMesh&&M0.instancingMorph===!0&&m.morphTexture===null)r0=!0;else if(m.isInstancedMesh&&M0.instancingMorph===!1&&m.morphTexture!==null)r0=!0;else if(M0.envMap!==P0)r0=!0;else if(u.fog===!0&&M0.fog!==q0)r0=!0;else if(M0.numClippingPlanes!==void 0&&(M0.numClippingPlanes!==K0.numPlanes||M0.numIntersection!==K0.numIntersection))r0=!0;else if(M0.vertexAlphas!==f0)r0=!0;else if(M0.vertexTangents!==n0)r0=!0;else if(M0.morphTargets!==_0)r0=!0;else if(M0.morphNormals!==WJ)r0=!0;else if(M0.morphColors!==DJ)r0=!0;else if(M0.toneMapping!==LJ)r0=!0;else if(M0.morphTargetsCount!==yJ)r0=!0;else if(!!M0.lightProbeGrid!==_.state.lightProbeGridArray.length>0)r0=!0}else r0=!0,M0.__version=u.version;let Q9=M0.currentProgram;if(r0===!0){if(Q9=F7(u,f,m),z&&u.isNodeMaterial)z.onUpdateProgram(u,Q9,M0)}let V9=!1,r9=!1,b8=!1,HJ=Q9.getUniforms(),MJ=M0.uniforms;if(O0.useProgram(Q9.program))V9=!0,r9=!0,b8=!0;if(u.id!==h)h=u.id,r9=!0;if(M0.needsLights){let EJ=ZH(_.state.lightProbeGridArray,m);if(M0.lightProbeGrid!==EJ)M0.lightProbeGrid=EJ,r9=!0}if(V9||g!==w){if(O0.buffers.depth.getReversed()&&w.reversedDepth!==!0)w._reversedDepth=!0,w.updateProjectionMatrix();HJ.setValue(b,"projectionMatrix",w.projectionMatrix),HJ.setValue(b,"viewMatrix",w.matrixWorldInverse);let e9=HJ.map.cameraPosition;if(e9!==void 0)e9.setValue(b,XJ.setFromMatrixPosition(w.matrixWorld));if(t0.logarithmicDepthBuffer)HJ.setValue(b,"logDepthBufFC",2/(Math.log(w.far+1)/Math.LN2));if(u.isMeshPhongMaterial||u.isMeshToonMaterial||u.isMeshLambertMaterial||u.isMeshBasicMaterial||u.isMeshStandardMaterial||u.isShaderMaterial)HJ.setValue(b,"isOrthographic",w.isOrthographicCamera===!0);if(g!==w)g=w,r9=!0,b8=!0}if(M0.needsLights){if(iJ.state.directionalShadowMap.length>0)HJ.setValue(b,"directionalShadowMap",iJ.state.directionalShadowMap,T);if(iJ.state.spotShadowMap.length>0)HJ.setValue(b,"spotShadowMap",iJ.state.spotShadowMap,T);if(iJ.state.pointShadowMap.length>0)HJ.setValue(b,"pointShadowMap",iJ.state.pointShadowMap,T)}if(m.isSkinnedMesh){HJ.setOptional(b,m,"bindMatrix"),HJ.setOptional(b,m,"bindMatrixInverse");let EJ=m.skeleton;if(EJ){if(EJ.boneTexture===null)EJ.computeBoneTexture();HJ.setValue(b,"boneTexture",EJ.boneTexture,T)}}if(m.isBatchedMesh){if(HJ.setOptional(b,m,"batchingTexture"),HJ.setValue(b,"batchingTexture",m._matricesTexture,T),HJ.setOptional(b,m,"batchingIdTexture"),HJ.setValue(b,"batchingIdTexture",m._indirectTexture,T),HJ.setOptional(b,m,"batchingColorTexture"),m._colorsTexture!==null)HJ.setValue(b,"batchingColorTexture",m._colorsTexture,T)}let t9=l.morphAttributes;if(t9.position!==void 0||t9.normal!==void 0||t9.color!==void 0)F0.update(m,l,Q9);if(r9||M0.receiveShadow!==m.receiveShadow)M0.receiveShadow=m.receiveShadow,HJ.setValue(b,"receiveShadow",m.receiveShadow);if((u.isMeshStandardMaterial||u.isMeshLambertMaterial||u.isMeshPhongMaterial)&&u.envMap===null&&f.environment!==null)MJ.envMapIntensity.value=f.environmentIntensity;if(MJ.dfgLUT!==void 0)MJ.dfgLUT.value=JF();if(r9){if(HJ.setValue(b,"toneMappingExposure",B.toneMappingExposure),M0.needsLights)YH(MJ,b8);if(q0&&u.fog===!0)E0.refreshFogUniforms(MJ,q0);if(E0.refreshMaterialUniforms(MJ,u,v0,x0,_.state.transmissionRenderTarget[w.id]),M0.needsLights&&M0.lightProbeGrid){let EJ=M0.lightProbeGrid;MJ.probesSH.value=EJ.texture,MJ.probesMin.value.copy(EJ.boundingBox.min),MJ.probesMax.value.copy(EJ.boundingBox.max),MJ.probesResolution.value.copy(EJ.resolution)}W7.upload(b,qW(M0),MJ,T)}if(u.isShaderMaterial&&u.uniformsNeedUpdate===!0)W7.upload(b,qW(M0),MJ,T),u.uniformsNeedUpdate=!1;if(u.isSpriteMaterial)HJ.setValue(b,"center",m.center);if(HJ.setValue(b,"modelViewMatrix",m.modelViewMatrix),HJ.setValue(b,"normalMatrix",m.normalMatrix),HJ.setValue(b,"modelMatrix",m.matrixWorld),u.uniformsGroups!==void 0){let EJ=u.uniformsGroups;for(let e9=0,f8=EJ.length;e9<f8;e9++){let LW=EJ[e9];X0.update(LW,Q9),X0.bind(LW,Q9)}}return Q9}function YH(w,f){w.ambientLightColor.needsUpdate=f,w.lightProbe.needsUpdate=f,w.directionalLights.needsUpdate=f,w.directionalLightShadows.needsUpdate=f,w.pointLights.needsUpdate=f,w.pointLightShadows.needsUpdate=f,w.spotLights.needsUpdate=f,w.spotLightShadows.needsUpdate=f,w.rectAreaLights.needsUpdate=f,w.hemisphereLights.needsUpdate=f}function XH(w){return w.isMeshLambertMaterial||w.isMeshToonMaterial||w.isMeshPhongMaterial||w.isMeshStandardMaterial||w.isShadowMaterial||w.isShaderMaterial&&w.lights===!0}this.getActiveCubeFace=function(){return S},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return v},this.setRenderTargetTextures=function(w,f,l){let u=T0.get(w);if(u.__autoAllocateDepthBuffer=w.resolveDepthBuffer===!1,u.__autoAllocateDepthBuffer===!1)u.__useRenderToTexture=!1;T0.get(w.texture).__webglTexture=f,T0.get(w.depthTexture).__webglTexture=u.__autoAllocateDepthBuffer?void 0:l,u.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(w,f){let l=T0.get(w);l.__webglFramebuffer=f,l.__useDefaultFramebuffer=f===void 0};let KH=b.createFramebuffer();this.setRenderTarget=function(w,f=0,l=0){v=w,S=f,y=l;let u=null,m=!1,q0=!1;if(w){let N0=T0.get(w);if(N0.__useDefaultFramebuffer!==void 0){O0.bindFramebuffer(b.FRAMEBUFFER,N0.__webglFramebuffer),p.copy(w.viewport),c.copy(w.scissor),a=w.scissorTest,O0.viewport(p),O0.scissor(c),O0.setScissorTest(a),h=-1;return}else if(N0.__webglFramebuffer===void 0)T.setupRenderTarget(w);else if(N0.__hasExternalTextures)T.rebindTextures(w,T0.get(w.texture).__webglTexture,T0.get(w.depthTexture).__webglTexture);else if(w.depthBuffer){let f0=w.depthTexture;if(N0.__boundDepthTexture!==f0){if(f0!==null&&T0.has(f0)&&(w.width!==f0.image.width||w.height!==f0.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");T.setupDepthRenderbuffer(w)}}let I0=w.texture;if(I0.isData3DTexture||I0.isDataArrayTexture||I0.isCompressedArrayTexture)q0=!0;let P0=T0.get(w).__webglFramebuffer;if(w.isWebGLCubeRenderTarget){if(Array.isArray(P0[f]))u=P0[f][l];else u=P0[f];m=!0}else if(w.samples>0&&T.useMultisampledRTT(w)===!1)u=T0.get(w).__webglMultisampledFramebuffer;else if(Array.isArray(P0))u=P0[l];else u=P0;p.copy(w.viewport),c.copy(w.scissor),a=w.scissorTest}else p.copy(D0).multiplyScalar(v0).floor(),c.copy(G0).multiplyScalar(v0).floor(),a=w0;if(l!==0)u=KH;if(O0.bindFramebuffer(b.FRAMEBUFFER,u))O0.drawBuffers(w,u);if(O0.viewport(p),O0.scissor(c),O0.setScissorTest(a),m){let N0=T0.get(w.texture);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_CUBE_MAP_POSITIVE_X+f,N0.__webglTexture,l)}else if(q0){let N0=f;for(let I0=0;I0<w.textures.length;I0++){let P0=T0.get(w.textures[I0]);b.framebufferTextureLayer(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0+I0,P0.__webglTexture,l,N0)}}else if(w!==null&&l!==0){let N0=T0.get(w.texture);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,N0.__webglTexture,l)}h=-1},this.readRenderTargetPixels=function(w,f,l,u,m,q0,k0,N0=0){if(!(w&&w.isWebGLRenderTarget)){A0("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let I0=T0.get(w).__webglFramebuffer;if(w.isWebGLCubeRenderTarget&&k0!==void 0)I0=I0[k0];if(I0){O0.bindFramebuffer(b.FRAMEBUFFER,I0);try{let P0=w.textures[N0],f0=P0.format,n0=P0.type;if(w.textures.length>1)b.readBuffer(b.COLOR_ATTACHMENT0+N0);if(!t0.textureFormatReadable(f0)){A0("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!t0.textureTypeReadable(n0)){A0("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}if(f>=0&&f<=w.width-u&&(l>=0&&l<=w.height-m))b.readPixels(f,l,u,m,c0.convert(f0),c0.convert(n0),q0)}finally{let P0=v!==null?T0.get(v).__webglFramebuffer:null;O0.bindFramebuffer(b.FRAMEBUFFER,P0)}}},this.readRenderTargetPixelsAsync=async function(w,f,l,u,m,q0,k0,N0=0){if(!(w&&w.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let I0=T0.get(w).__webglFramebuffer;if(w.isWebGLCubeRenderTarget&&k0!==void 0)I0=I0[k0];if(I0)if(f>=0&&f<=w.width-u&&(l>=0&&l<=w.height-m)){O0.bindFramebuffer(b.FRAMEBUFFER,I0);let P0=w.textures[N0],f0=P0.format,n0=P0.type;if(w.textures.length>1)b.readBuffer(b.COLOR_ATTACHMENT0+N0);if(!t0.textureFormatReadable(f0))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!t0.textureTypeReadable(n0))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let _0=b.createBuffer();b.bindBuffer(b.PIXEL_PACK_BUFFER,_0),b.bufferData(b.PIXEL_PACK_BUFFER,q0.byteLength,b.STREAM_READ),b.readPixels(f,l,u,m,c0.convert(f0),c0.convert(n0),0);let WJ=v!==null?T0.get(v).__webglFramebuffer:null;O0.bindFramebuffer(b.FRAMEBUFFER,WJ);let DJ=b.fenceSync(b.SYNC_GPU_COMMANDS_COMPLETE,0);return b.flush(),await tY(b,DJ,4),b.bindBuffer(b.PIXEL_PACK_BUFFER,_0),b.getBufferSubData(b.PIXEL_PACK_BUFFER,0,q0),b.deleteBuffer(_0),b.deleteSync(DJ),q0}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(w,f=null,l=0){let u=Math.pow(2,-l),m=Math.floor(w.image.width*u),q0=Math.floor(w.image.height*u),k0=f!==null?f.x:0,N0=f!==null?f.y:0;T.setTexture2D(w,0),b.copyTexSubImage2D(b.TEXTURE_2D,l,0,0,k0,N0,m,q0),O0.unbindTexture()};let HH=b.createFramebuffer(),UH=b.createFramebuffer();if(this.copyTextureToTexture=function(w,f,l=null,u=null,m=0,q0=0){let k0,N0,I0,P0,f0,n0,_0,WJ,DJ,LJ=w.isCompressedTexture?w.mipmaps[q0]:w.image;if(l!==null)k0=l.max.x-l.min.x,N0=l.max.y-l.min.y,I0=l.isBox3?l.max.z-l.min.z:1,P0=l.min.x,f0=l.min.y,n0=l.isBox3?l.min.z:0;else{let MJ=Math.pow(2,-m);if(k0=Math.floor(LJ.width*MJ),N0=Math.floor(LJ.height*MJ),w.isDataArrayTexture)I0=LJ.depth;else if(w.isData3DTexture)I0=Math.floor(LJ.depth*MJ);else I0=1;P0=0,f0=0,n0=0}if(u!==null)_0=u.x,WJ=u.y,DJ=u.z;else _0=0,WJ=0,DJ=0;let KJ=c0.convert(f.format),yJ=c0.convert(f.type),M0;if(f.isData3DTexture)T.setTexture3D(f,0),M0=b.TEXTURE_3D;else if(f.isDataArrayTexture||f.isCompressedArrayTexture)T.setTexture2DArray(f,0),M0=b.TEXTURE_2D_ARRAY;else T.setTexture2D(f,0),M0=b.TEXTURE_2D;O0.activeTexture(b.TEXTURE0),O0.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,f.flipY),O0.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL,f.premultiplyAlpha),O0.pixelStorei(b.UNPACK_ALIGNMENT,f.unpackAlignment);let iJ=O0.getParameter(b.UNPACK_ROW_LENGTH),r0=O0.getParameter(b.UNPACK_IMAGE_HEIGHT),Q9=O0.getParameter(b.UNPACK_SKIP_PIXELS),V9=O0.getParameter(b.UNPACK_SKIP_ROWS),r9=O0.getParameter(b.UNPACK_SKIP_IMAGES);O0.pixelStorei(b.UNPACK_ROW_LENGTH,LJ.width),O0.pixelStorei(b.UNPACK_IMAGE_HEIGHT,LJ.height),O0.pixelStorei(b.UNPACK_SKIP_PIXELS,P0),O0.pixelStorei(b.UNPACK_SKIP_ROWS,f0),O0.pixelStorei(b.UNPACK_SKIP_IMAGES,n0);let b8=w.isDataArrayTexture||w.isData3DTexture,HJ=f.isDataArrayTexture||f.isData3DTexture;if(w.isDepthTexture){let MJ=T0.get(w),t9=T0.get(f),EJ=T0.get(MJ.__renderTarget),e9=T0.get(t9.__renderTarget);O0.bindFramebuffer(b.READ_FRAMEBUFFER,EJ.__webglFramebuffer),O0.bindFramebuffer(b.DRAW_FRAMEBUFFER,e9.__webglFramebuffer);for(let f8=0;f8<I0;f8++){if(b8)b.framebufferTextureLayer(b.READ_FRAMEBUFFER,b.COLOR_ATTACHMENT0,T0.get(w).__webglTexture,m,n0+f8),b.framebufferTextureLayer(b.DRAW_FRAMEBUFFER,b.COLOR_ATTACHMENT0,T0.get(f).__webglTexture,q0,DJ+f8);b.blitFramebuffer(P0,f0,k0,N0,_0,WJ,k0,N0,b.DEPTH_BUFFER_BIT,b.NEAREST)}O0.bindFramebuffer(b.READ_FRAMEBUFFER,null),O0.bindFramebuffer(b.DRAW_FRAMEBUFFER,null)}else if(m!==0||w.isRenderTargetTexture||T0.has(w)){let MJ=T0.get(w),t9=T0.get(f);O0.bindFramebuffer(b.READ_FRAMEBUFFER,HH),O0.bindFramebuffer(b.DRAW_FRAMEBUFFER,UH);for(let EJ=0;EJ<I0;EJ++){if(b8)b.framebufferTextureLayer(b.READ_FRAMEBUFFER,b.COLOR_ATTACHMENT0,MJ.__webglTexture,m,n0+EJ);else b.framebufferTexture2D(b.READ_FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,MJ.__webglTexture,m);if(HJ)b.framebufferTextureLayer(b.DRAW_FRAMEBUFFER,b.COLOR_ATTACHMENT0,t9.__webglTexture,q0,DJ+EJ);else b.framebufferTexture2D(b.DRAW_FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,t9.__webglTexture,q0);if(m!==0)b.blitFramebuffer(P0,f0,k0,N0,_0,WJ,k0,N0,b.COLOR_BUFFER_BIT,b.NEAREST);else if(HJ)b.copyTexSubImage3D(M0,q0,_0,WJ,DJ+EJ,P0,f0,k0,N0);else b.copyTexSubImage2D(M0,q0,_0,WJ,P0,f0,k0,N0)}O0.bindFramebuffer(b.READ_FRAMEBUFFER,null),O0.bindFramebuffer(b.DRAW_FRAMEBUFFER,null)}else if(HJ)if(w.isDataTexture||w.isData3DTexture)b.texSubImage3D(M0,q0,_0,WJ,DJ,k0,N0,I0,KJ,yJ,LJ.data);else if(f.isCompressedArrayTexture)b.compressedTexSubImage3D(M0,q0,_0,WJ,DJ,k0,N0,I0,KJ,LJ.data);else b.texSubImage3D(M0,q0,_0,WJ,DJ,k0,N0,I0,KJ,yJ,LJ);else if(w.isDataTexture)b.texSubImage2D(b.TEXTURE_2D,q0,_0,WJ,k0,N0,KJ,yJ,LJ.data);else if(w.isCompressedTexture)b.compressedTexSubImage2D(b.TEXTURE_2D,q0,_0,WJ,LJ.width,LJ.height,KJ,LJ.data);else b.texSubImage2D(b.TEXTURE_2D,q0,_0,WJ,k0,N0,KJ,yJ,LJ);if(O0.pixelStorei(b.UNPACK_ROW_LENGTH,iJ),O0.pixelStorei(b.UNPACK_IMAGE_HEIGHT,r0),O0.pixelStorei(b.UNPACK_SKIP_PIXELS,Q9),O0.pixelStorei(b.UNPACK_SKIP_ROWS,V9),O0.pixelStorei(b.UNPACK_SKIP_IMAGES,r9),q0===0&&f.generateMipmaps)b.generateMipmap(M0);O0.unbindTexture()},this.initRenderTarget=function(w){if(T0.get(w).__webglFramebuffer===void 0)T.setupRenderTarget(w)},this.initTexture=function(w){if(w.isCubeTexture)T.setTextureCube(w,0);else if(w.isData3DTexture)T.setTexture3D(w,0);else if(w.isDataArrayTexture||w.isCompressedArrayTexture)T.setTexture2DArray(w,0);else T.setTexture2D(w,0);O0.unbindTexture()},this.resetState=function(){S=0,y=0,v=null,O0.reset(),x.reset()},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return UZ}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(J){this._outputColorSpace=J;let Q=this.getContext();Q.drawingBufferColorSpace=s0._getDrawingBufferColorSpace(J),Q.unpackColorSpace=s0._getUnpackColorSpace()}}function L0(J,Q){if(J==null||J.trim()==="")return Q;let $=Number(J);return Number.isFinite($)?$:Q}function OJ(J,Q){if(J==null||J.trim()==="")return[...Q];let $=J.trim().split(/\s+/).map(Number);return[Number.isFinite($[0])?$[0]:Q[0],Number.isFinite($[1])?$[1]:Q[1],Number.isFinite($[2])?$[2]:Q[2]]}function lX(J){if(J==null||J.trim()==="")return[1,1,1];let Q=J.trim().split(/\s+/).map(Number);if(Q.length===1&&Number.isFinite(Q[0]))return[Q[0],Q[0],Q[0]];return OJ(J,[1,1,1])}function C6(J,Q){if(J==null||J.trim()==="")return Q;let $=Number(J.trim().replace(/deg$/i,""));return Number.isFinite($)?$:Q}function cZ(J){return J*Math.PI/180}function cX(J){let Q=OJ(J,[0,0,0]);return[cZ(Q[0]),cZ(Q[1]),cZ(Q[2])]}function K9(J,Q){if(J==null||J.trim()==="")return Q;return J.trim()}function k9(J,Q){return L0(J,Q)}function zQ(J){return(Q)=>Math.pow(Q,J)}function wQ(J){return(Q)=>1-Math.pow(1-Q,J)}function PQ(J){return(Q)=>Q<0.5?Math.pow(2*Q,J)/2:1-Math.pow(2*(1-Q),J)/2}var X7=1.70158,_Q={linear:(J)=>J,none:(J)=>J,"power1.in":zQ(2),"power1.out":wQ(2),"power1.inOut":PQ(2),"power2.in":zQ(3),"power2.out":wQ(3),"power2.inOut":PQ(3),"power3.in":zQ(4),"power3.out":wQ(4),"power3.inOut":PQ(4),"power4.in":zQ(5),"power4.out":wQ(5),"power4.inOut":PQ(5),"sine.in":(J)=>1-Math.cos(J*Math.PI/2),"sine.out":(J)=>Math.sin(J*Math.PI/2),"sine.inOut":(J)=>-(Math.cos(Math.PI*J)-1)/2,"expo.in":(J)=>J===0?0:Math.pow(2,10*J-10),"expo.out":(J)=>J===1?1:1-Math.pow(2,-10*J),"expo.inOut":(J)=>J===0?0:J===1?1:J<0.5?Math.pow(2,20*J-10)/2:(2-Math.pow(2,-20*J+10))/2,"circ.in":(J)=>1-Math.sqrt(1-J*J),"circ.out":(J)=>Math.sqrt(1-(J-1)*(J-1)),"circ.inOut":(J)=>J<0.5?(1-Math.sqrt(1-4*J*J))/2:(Math.sqrt(1-Math.pow(-2*J+2,2))+1)/2,"back.in":(J)=>J*J*((X7+1)*J-X7),"back.out":(J)=>{let Q=J-1;return Q*Q*((X7+1)*Q+X7)+1},"back.inOut":(J)=>{let Q=X7*1.525;return J<0.5?Math.pow(2*J,2)*((Q+1)*2*J-Q)/2:(Math.pow(2*J-2,2)*((Q+1)*(2*J-2)+Q)+2)/2},"elastic.out":(J)=>J===0?0:J===1?1:Math.pow(2,-10*J)*Math.sin((J*10-0.75)*(2*Math.PI)/3)+1,"bounce.out":(J)=>{if(J<0.36363636363636365)return 7.5625*J*J;if(J<0.7272727272727273){let W=J-0.5454545454545454;return 7.5625*W*W+0.75}if(J<0.9090909090909091){let W=J-0.8181818181818182;return 7.5625*W*W+0.9375}let Z=J-0.9545454545454546;return 7.5625*Z*Z+0.984375}};function TQ(J,Q="power1.out"){if(J){let $=_Q[J.trim()];if($)return $}return _Q[Q]??_Q.linear}var mq=Object.keys(_Q);function h8(J,Q){let $=Q.duration??0;if($<=0)return J<Q.start?0:1;let Z=(J-Q.start)/$;return Q.ease(Math.min(1,Math.max(0,Z)))}function nZ(J,Q){return h8(J,Q)}function nX(J,Q,$){let Z=Math.max(0.000001,1-$);return Math.min(1,Math.max(0,(J-Q)/Z))}function sX(J,Q){return Math.max(0,J-Q.start)}function iX(J){return{start:J.start??0,duration:J.duration??void 0,ease:TQ(J.ease??null,J.defaultEase??"power1.out")}}function oX(J,Q,$){let Z=J.rotation[$.axis],W=$.rpm/60*Math.PI*2;return(Y)=>{J.rotation[$.axis]=Z+W*sX(Y,Q)}}function aX(J,Q,$){let Z=$.fromDeg*Math.PI/180,W=$.toDeg*Math.PI/180;return(Y)=>{let X=Z+(W-Z)*h8(Y,Q),K=$.center();J.position.x=K.x+$.radius*Math.sin(X),J.position.z=K.z+$.radius*Math.cos(X),J.position.y=K.y+$.height}}function rX(J,Q,$){let Z={x:J.position.x,y:J.position.y,z:J.position.z};return(W)=>{let Y=$.toward(),X=Y.x-Z.x,K=Y.y-Z.y,H=Y.z-Z.z,U=Math.sqrt(X*X+K*K+H*H)||1,G=$.distance*h8(W,Q);J.position.x=Z.x+X/U*G,J.position.y=Z.y+K/U*G,J.position.z=Z.z+H/U*G}}function tX(J,Q){let $={x:J.scale.x,y:J.scale.y,z:J.scale.z};return(Z)=>{let W=Z<Q.start?0:h8(Z,Q);J.scale.x=$.x*W,J.scale.y=$.y*W,J.scale.z=$.z*W}}function sZ(J,Q){return($)=>{J($<Q.start?0:h8($,Q))}}function eX(J,Q,$){let Z=$.from??{x:J.position.x,y:J.position.y,z:J.position.z};return(W)=>{let Y=h8(W,Q);J.position.x=Z.x+($.to.x-Z.x)*Y,J.position.y=Z.y+($.to.y-Z.y)*Y,J.position.z=Z.z+($.to.z-Z.z)*Y}}function JK(J,Q){return()=>{let $=Q.subject();J.position.x=$.x+Q.offset.x,J.position.y=$.y+Q.offset.y,J.position.z=$.z+Q.offset.z}}function QK(J,Q){return($)=>{let Z=$<Q.start?0:h8($,Q);J(1-Z,Z)}}function $K(J,Q,$){let Z=J.position.y,W=Math.PI*2/Math.max(0.0001,$.period);return(Y)=>{J.position.y=Z+$.amplitude*Math.sin(W*sX(Y,Q))}}var AQ=new j;function ZK(J,Q){if(!Q)return null;if(Q==="camera")return J.camera;if(Q.startsWith("#"))return J.objectsById.get(Q.slice(1))??null;return null}function iZ(J,Q){if(Q&&Q.startsWith("#")){let Z=J.objectsById.get(Q.slice(1));if(Z)return()=>{return Z.getWorldPosition(AQ),{x:AQ.x,y:AQ.y,z:AQ.z}}}let $=OJ(Q,[0,0,0]);return()=>({x:$[0],y:$[1],z:$[2]})}function ZF(J){let Q=[],$=new Set;return J.traverse((Z)=>{let W=Z.material,Y=Array.isArray(W)?W:W?[W]:[];for(let X of Y){if($.has(X))continue;$.add(X),Q.push({material:X,baseOpacity:X.opacity,baseTransparent:X.transparent})}}),(Z)=>{for(let W of Q)W.material.opacity=W.baseOpacity*Z,W.material.transparent=Z<1?!0:W.baseTransparent}}function WK(J){let Q=[];for(let $ of Array.from(J.host.querySelectorAll("sf-animate"))){let Z=($.getAttribute("verb")??"").toLowerCase(),W={orbit:4,dolly:1.5,"bounce-in":0.6,"fade-in":0.6,move:2,"crossfade-clip":0.5,"camera-path":8,variant:0.8},Y=$.getAttribute("duration"),X=iX({start:k9($.getAttribute("start"),0),duration:Y?k9(Y,0):W[Z]??null,ease:$.getAttribute("ease"),defaultEase:Z==="bounce-in"?"back.out":"power1.out"});if(Z==="variant"){Q.push({el:$,timing:X});continue}let K=ZK(J,$.getAttribute("target"));if(!K){let H=$.getAttribute("target")??"",U=H.startsWith("#")?document.querySelector(H):null;if(U&&(Z==="fade-in"||Z==="bounce-in")){let G=L0($.getAttribute("rise"),0);J.seekFns.push(sZ((F)=>{if(Z==="fade-in"){if(U.style.opacity=String(F),G!==0)U.style.transform=`translateY(${(1-F)*G}px)`}else U.style.opacity=F>0?"1":"0",U.style.transform=`scale(${F})`},X))}continue}if(Z==="turntable")J.seekFns.push(oX(K,X,{rpm:L0($.getAttribute("rpm"),6),axis:$.getAttribute("axis")??"y"}));else if(Z==="orbit"){let H=iZ(J,$.getAttribute("around")),U=H(),G=K.position.x-U.x,F=K.position.z-U.z,E=Math.sqrt(G*G+F*F),O=Math.atan2(G,F)*180/Math.PI,R=C6($.getAttribute("from"),O);J.seekFns.push(aX(K,X,{center:H,radius:L0($.getAttribute("radius"),E||5),fromDeg:R,toDeg:C6($.getAttribute("to"),R+360),height:L0($.getAttribute("height"),K.position.y-U.y)}))}else if(Z==="dolly")J.seekFns.push(rX(K,X,{toward:iZ(J,$.getAttribute("toward")),distance:L0($.getAttribute("distance"),1)}));else if(Z==="move"){let H=$.getAttribute("to");if(!H)continue;let U=OJ(H,[0,0,0]),G=$.getAttribute("from"),F=G?OJ(G,[0,0,0]):null;J.seekFns.push(eX(K,X,{from:F?{x:F[0],y:F[1],z:F[2]}:void 0,to:{x:U[0],y:U[1],z:U[2]}}))}else if(Z==="follow"){let H=iZ(J,$.getAttribute("subject")),U=$.getAttribute("offset"),G;if(U){let F=OJ(U,[0,2,5]);G={x:F[0],y:F[1],z:F[2]}}else{let F=H();G={x:K.position.x-F.x,y:K.position.y-F.y,z:K.position.z-F.z}}J.lateSeekFns.push(JK(K,{subject:H,offset:G}))}else if(Z==="camera-path"){let H=($.getAttribute("points")??"").split(",").map((O)=>OJ(O.trim(),[Number.NaN,Number.NaN,Number.NaN])).filter((O)=>O.every(Number.isFinite)).map((O)=>new j(O[0],O[1],O[2]));if(H.length<2)continue;let U=new FQ(H,!1,"centripetal"),G=($.getAttribute("look")??"ahead").toLowerCase(),F=new j,E=new j;J.lateSeekFns.push((O)=>{let R=nZ(O,X);if(U.getPointAt(Math.min(1,Math.max(0,R)),F),K.position.set(F.x,F.y,F.z),G==="ahead"){if(U.getPointAt(Math.min(1,Math.max(0,R)+0.02),E),E.distanceToSquared(F)<0.000000001)U.getPointAt(Math.max(0,R-0.02),E),E.lerpVectors(E,F,2);K.lookAt(E)}})}else if(Z==="crossfade-clip"){let H=J.actionsByObject.get(K),U=$.getAttribute("from"),G=$.getAttribute("to");if(!H||!U||!G)continue;let F=H.get(U),E=H.get(G);if(!F||!E)continue;J.seekFns.push(QK((O,R)=>{F.setEffectiveWeight(O),E.setEffectiveWeight(R)},X))}else if(Z==="bounce-in")J.seekFns.push(tX(K,X));else if(Z==="fade-in")J.seekFns.push(sZ(ZF(K),X));else if(Z==="float")J.seekFns.push($K(K,X,{amplitude:L0($.getAttribute("amplitude"),0.1),period:L0($.getAttribute("period"),4)}))}WF(J,Q)}function WF(J,Q){let $=new Map;for(let W of Q){let Y=`${W.el.getAttribute("target")??""}|${W.el.getAttribute("material")??"*"}`;($.get(Y)??$.set(Y,[]).get(Y)).push(W)}let Z=new R0;for(let W of $.values()){let Y=W[0],X=ZK(J,Y.el.getAttribute("target"));if(!X)continue;let K=Y.el.getAttribute("material"),H=[],U=new Set;if(X.traverse((E)=>{let O=E.material;for(let R of Array.isArray(O)?O:O?[O]:[]){if(U.has(R))continue;if(U.add(R),!(R instanceof X9))continue;if(K&&R.name!==K)continue;H.push(R)}}),H.length===0)continue;let G={color:H[0].color.clone(),roughness:H[0].roughness,metalness:H[0].metalness};J.seekFns.push(()=>{for(let E of H){if(E.color.copy(G.color),G.roughness!==null)E.roughness=G.roughness;if(G.metalness!==null)E.metalness=G.metalness}}),W.sort((E,O)=>E.timing.start-O.timing.start);let F=G;for(let{el:E,timing:O}of W){let R={color:E.getAttribute("color")?new R0(K9(E.getAttribute("color"),"#ffffff")):F.color.clone(),roughness:E.getAttribute("roughness")?L0(E.getAttribute("roughness"),0.5):F.roughness,metalness:E.getAttribute("metalness")?L0(E.getAttribute("metalness"),0):F.metalness},C=F;J.seekFns.push((q)=>{if(q<O.start)return;let N=nZ(q,O);Z.lerpColors(C.color,R.color,N);for(let L of H){if(L.color.copy(Z),R.roughness!==null&&C.roughness!==null)L.roughness=C.roughness+(R.roughness-C.roughness)*N;if(R.metalness!==null&&C.metalness!==null)L.metalness=C.metalness+(R.metalness-C.metalness)*N}}),F=R}}}function oZ(J,Q){if(Q===YZ)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),J;if(Q===U6||Q===u6){let $=J.getIndex();if($===null){let X=[],K=J.getAttribute("position");if(K!==void 0){for(let H=0;H<K.count;H++)X.push(H);J.setIndex(X),$=J.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),J}let Z=$.count-2,W=[];if(Q===U6)for(let X=1;X<=Z;X++)W.push($.getX(0)),W.push($.getX(X)),W.push($.getX(X+1));else for(let X=0;X<Z;X++)if(X%2===0)W.push($.getX(X)),W.push($.getX(X+1)),W.push($.getX(X+2));else W.push($.getX(X+2)),W.push($.getX(X+1)),W.push($.getX(X));if(W.length/3!==Z)console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let Y=J.clone();return Y.setIndex(W),Y.clearGroups(),Y}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",Q),J}function YK(J){let Q=new Map,$=new Map,Z=J.clone();return XK(J,Z,function(W,Y){Q.set(Y,W),$.set(W,Y)}),Z.traverse(function(W){if(!W.isSkinnedMesh)return;let Y=W,X=Q.get(W),K=X.skeleton.bones;Y.skeleton=X.skeleton.clone(),Y.bindMatrix.copy(X.bindMatrix),Y.skeleton.bones=K.map(function(H){return $.get(H)}),Y.bind(Y.skeleton,Y.bindMatrix)}),Z}function XK(J,Q,$){$(J,Q);for(let Z=0;Z<J.children.length;Z++)XK(J.children[Z],Q.children[Z],$)}class $W extends S9{constructor(J){super(J);this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(Q){return new OK(Q)}),this.register(function(Q){return new qK(Q)}),this.register(function(Q){return new IK(Q)}),this.register(function(Q){return new zK(Q)}),this.register(function(Q){return new wK(Q)}),this.register(function(Q){return new LK(Q)}),this.register(function(Q){return new DK(Q)}),this.register(function(Q){return new MK(Q)}),this.register(function(Q){return new kK(Q)}),this.register(function(Q){return new NK(Q)}),this.register(function(Q){return new BK(Q)}),this.register(function(Q){return new RK(Q)}),this.register(function(Q){return new CK(Q)}),this.register(function(Q){return new VK(Q)}),this.register(function(Q){return new EK(Q)}),this.register(function(Q){return new eZ(Q,o0.EXT_MESHOPT_COMPRESSION)}),this.register(function(Q){return new eZ(Q,o0.KHR_MESHOPT_COMPRESSION)}),this.register(function(Q){return new PK(Q)})}load(J,Q,$,Z){let W=this,Y;if(this.resourcePath!=="")Y=this.resourcePath;else if(this.path!==""){let H=F8.extractUrlBase(J);Y=F8.resolveURL(H,this.path)}else Y=F8.extractUrlBase(J);this.manager.itemStart(J);let X=function(H){if(Z)Z(H);else console.error(H);W.manager.itemError(J),W.manager.itemEnd(J)},K=new L6(this.manager);K.setPath(this.path),K.setResponseType("arraybuffer"),K.setRequestHeader(this.requestHeader),K.setWithCredentials(this.withCredentials),K.load(J,function(H){try{W.parse(H,Y,function(U){Q(U),W.manager.itemEnd(J)},X)}catch(U){X(U)}},$,X)}setDRACOLoader(J){return this.dracoLoader=J,this}setKTX2Loader(J){return this.ktx2Loader=J,this}setMeshoptDecoder(J){return this.meshoptDecoder=J,this}register(J){if(this.pluginCallbacks.indexOf(J)===-1)this.pluginCallbacks.push(J);return this}unregister(J){if(this.pluginCallbacks.indexOf(J)!==-1)this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(J),1);return this}parse(J,Q,$,Z){let W,Y={},X={},K=new TextDecoder;if(typeof J==="string")W=JSON.parse(J);else if(J instanceof ArrayBuffer)if(K.decode(new Uint8Array(J,0,4))===_K){try{Y[o0.KHR_BINARY_GLTF]=new TK(J)}catch(G){if(Z)Z(G);return}W=JSON.parse(Y[o0.KHR_BINARY_GLTF].content)}else W=JSON.parse(K.decode(J));else W=J;if(W.asset===void 0||W.asset.version[0]<2){if(Z)Z(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let H=new yK(W,{path:Q||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});H.fileLoader.setRequestHeader(this.requestHeader);for(let U=0;U<this.pluginCallbacks.length;U++){let G=this.pluginCallbacks[U](H);if(!G.name)console.error("THREE.GLTFLoader: Invalid plugin found: missing name");X[G.name]=G,Y[G.name]=!0}if(W.extensionsUsed)for(let U=0;U<W.extensionsUsed.length;++U){let G=W.extensionsUsed[U],F=W.extensionsRequired||[];switch(G){case o0.KHR_MATERIALS_UNLIT:Y[G]=new FK;break;case o0.KHR_DRACO_MESH_COMPRESSION:Y[G]=new AK(W,this.dracoLoader);break;case o0.KHR_TEXTURE_TRANSFORM:Y[G]=new SK;break;case o0.KHR_MESH_QUANTIZATION:Y[G]=new jK;break;default:if(F.indexOf(G)>=0&&X[G]===void 0)console.warn('THREE.GLTFLoader: Unknown extension "'+G+'".')}}H.setExtensions(Y),H.setPlugins(X),H.parse($,Z)}parseAsync(J,Q){let $=this;return new Promise(function(Z,W){$.parse(J,Q,Z,W)})}}function YF(){let J={};return{get:function(Q){return J[Q]},add:function(Q,$){J[Q]=$},remove:function(Q){delete J[Q]},removeAll:function(){J={}}}}function VJ(J,Q,$){let Z=J.json.materials[Q];if(Z.extensions&&Z.extensions[$])return Z.extensions[$];return null}var o0={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class EK{constructor(J){this.parser=J,this.name=o0.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let J=this.parser,Q=this.parser.json.nodes||[];for(let $=0,Z=Q.length;$<Z;$++){let W=Q[$];if(W.extensions&&W.extensions[this.name]&&W.extensions[this.name].light!==void 0)J._addNodeRef(this.cache,W.extensions[this.name].light)}}_loadLight(J){let Q=this.parser,$="light:"+J,Z=Q.cache.get($);if(Z)return Z;let W=Q.json,K=((W.extensions&&W.extensions[this.name]||{}).lights||[])[J],H,U=new R0(16777215);if(K.color!==void 0)U.setRGB(K.color[0],K.color[1],K.color[2],uJ);let G=K.range!==void 0?K.range:0;switch(K.type){case"directional":H=new j9(U),H.target.position.set(0,0,-1),H.add(H.target);break;case"point":H=new k6(U),H.distance=G;break;case"spot":H=new DQ(U),H.distance=G,K.spot=K.spot||{},K.spot.innerConeAngle=K.spot.innerConeAngle!==void 0?K.spot.innerConeAngle:0,K.spot.outerConeAngle=K.spot.outerConeAngle!==void 0?K.spot.outerConeAngle:Math.PI/4,H.angle=K.spot.outerConeAngle,H.penumbra=1-K.spot.innerConeAngle/K.spot.outerConeAngle,H.target.position.set(0,0,-1),H.add(H.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+K.type)}if(H.position.set(0,0,0),h9(H,K),K.intensity!==void 0)H.intensity=K.intensity;return H.name=Q.createUniqueName(K.name||"light_"+J),Z=Promise.resolve(H),Q.cache.add($,Z),Z}getDependency(J,Q){if(J!=="light")return;return this._loadLight(Q)}createNodeAttachment(J){let Q=this,$=this.parser,W=$.json.nodes[J],X=(W.extensions&&W.extensions[this.name]||{}).light;if(X===void 0)return null;return this._loadLight(X).then(function(K){return $._getNodeRef(Q.cache,X,K)})}}class FK{constructor(){this.name=o0.KHR_MATERIALS_UNLIT}getMaterialType(){return A9}extendParams(J,Q,$){let Z=[];J.color=new R0(1,1,1),J.opacity=1;let W=Q.pbrMetallicRoughness;if(W){if(Array.isArray(W.baseColorFactor)){let Y=W.baseColorFactor;J.color.setRGB(Y[0],Y[1],Y[2],uJ),J.opacity=Y[3]}if(W.baseColorTexture!==void 0)Z.push($.assignTexture(J,"map",W.baseColorTexture,H8))}return Promise.all(Z)}}class NK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(J,Q){let $=VJ(this.parser,J,this.name);if($===null)return Promise.resolve();if($.emissiveStrength!==void 0)Q.emissiveIntensity=$.emissiveStrength;return Promise.resolve()}}class OK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_CLEARCOAT}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if($.clearcoatFactor!==void 0)Q.clearcoat=$.clearcoatFactor;if($.clearcoatTexture!==void 0)Z.push(this.parser.assignTexture(Q,"clearcoatMap",$.clearcoatTexture));if($.clearcoatRoughnessFactor!==void 0)Q.clearcoatRoughness=$.clearcoatRoughnessFactor;if($.clearcoatRoughnessTexture!==void 0)Z.push(this.parser.assignTexture(Q,"clearcoatRoughnessMap",$.clearcoatRoughnessTexture));if($.clearcoatNormalTexture!==void 0){if(Z.push(this.parser.assignTexture(Q,"clearcoatNormalMap",$.clearcoatNormalTexture)),$.clearcoatNormalTexture.scale!==void 0){let W=$.clearcoatNormalTexture.scale;Q.clearcoatNormalScale=new p0(W,W)}}return Promise.all(Z)}}class qK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_DISPERSION}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(this.parser,J,this.name);if($===null)return Promise.resolve();return Q.dispersion=$.dispersion!==void 0?$.dispersion:0,Promise.resolve()}}class RK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_IRIDESCENCE}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if($.iridescenceFactor!==void 0)Q.iridescence=$.iridescenceFactor;if($.iridescenceTexture!==void 0)Z.push(this.parser.assignTexture(Q,"iridescenceMap",$.iridescenceTexture));if($.iridescenceIor!==void 0)Q.iridescenceIOR=$.iridescenceIor;if(Q.iridescenceThicknessRange===void 0)Q.iridescenceThicknessRange=[100,400];if($.iridescenceThicknessMinimum!==void 0)Q.iridescenceThicknessRange[0]=$.iridescenceThicknessMinimum;if($.iridescenceThicknessMaximum!==void 0)Q.iridescenceThicknessRange[1]=$.iridescenceThicknessMaximum;if($.iridescenceThicknessTexture!==void 0)Z.push(this.parser.assignTexture(Q,"iridescenceThicknessMap",$.iridescenceThicknessTexture));return Promise.all(Z)}}class LK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_SHEEN}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if(Q.sheenColor=new R0(0,0,0),Q.sheenRoughness=0,Q.sheen=1,$.sheenColorFactor!==void 0){let W=$.sheenColorFactor;Q.sheenColor.setRGB(W[0],W[1],W[2],uJ)}if($.sheenRoughnessFactor!==void 0)Q.sheenRoughness=$.sheenRoughnessFactor;if($.sheenColorTexture!==void 0)Z.push(this.parser.assignTexture(Q,"sheenColorMap",$.sheenColorTexture,H8));if($.sheenRoughnessTexture!==void 0)Z.push(this.parser.assignTexture(Q,"sheenRoughnessMap",$.sheenRoughnessTexture));return Promise.all(Z)}}class DK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_TRANSMISSION}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if($.transmissionFactor!==void 0)Q.transmission=$.transmissionFactor;if($.transmissionTexture!==void 0)Z.push(this.parser.assignTexture(Q,"transmissionMap",$.transmissionTexture));return Promise.all(Z)}}class MK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_VOLUME}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if(Q.thickness=$.thicknessFactor!==void 0?$.thicknessFactor:0,$.thicknessTexture!==void 0)Z.push(this.parser.assignTexture(Q,"thicknessMap",$.thicknessTexture));Q.attenuationDistance=$.attenuationDistance||1/0;let W=$.attenuationColor||[1,1,1];return Q.attenuationColor=new R0().setRGB(W[0],W[1],W[2],uJ),Promise.all(Z)}}class kK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_IOR}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(this.parser,J,this.name);if($===null)return Promise.resolve();if(Q.ior=$.ior!==void 0?$.ior:1.5,Q.ior===0)Q.ior=1000;return Promise.resolve()}}class BK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_SPECULAR}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if(Q.specularIntensity=$.specularFactor!==void 0?$.specularFactor:1,$.specularTexture!==void 0)Z.push(this.parser.assignTexture(Q,"specularIntensityMap",$.specularTexture));let W=$.specularColorFactor||[1,1,1];if(Q.specularColor=new R0().setRGB(W[0],W[1],W[2],uJ),$.specularColorTexture!==void 0)Z.push(this.parser.assignTexture(Q,"specularColorMap",$.specularColorTexture,H8));return Promise.all(Z)}}class VK{constructor(J){this.parser=J,this.name=o0.EXT_MATERIALS_BUMP}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if(Q.bumpScale=$.bumpFactor!==void 0?$.bumpFactor:1,$.bumpTexture!==void 0)Z.push(this.parser.assignTexture(Q,"bumpMap",$.bumpTexture));return Promise.all(Z)}}class CK{constructor(J){this.parser=J,this.name=o0.KHR_MATERIALS_ANISOTROPY}getMaterialType(J){return VJ(this.parser,J,this.name)!==null?lJ:null}extendMaterialParams(J,Q){let $=VJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if($.anisotropyStrength!==void 0)Q.anisotropy=$.anisotropyStrength;if($.anisotropyRotation!==void 0)Q.anisotropyRotation=$.anisotropyRotation;if($.anisotropyTexture!==void 0)Z.push(this.parser.assignTexture(Q,"anisotropyMap",$.anisotropyTexture));return Promise.all(Z)}}class IK{constructor(J){this.parser=J,this.name=o0.KHR_TEXTURE_BASISU}loadTexture(J){let Q=this.parser,$=Q.json,Z=$.textures[J];if(!Z.extensions||!Z.extensions[this.name])return null;let W=Z.extensions[this.name],Y=Q.options.ktx2Loader;if(!Y)if($.extensionsRequired&&$.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");else return null;return Q.loadTextureImage(J,W.source,Y)}}class zK{constructor(J){this.parser=J,this.name=o0.EXT_TEXTURE_WEBP}loadTexture(J){let Q=this.name,$=this.parser,Z=$.json,W=Z.textures[J];if(!W.extensions||!W.extensions[Q])return null;let Y=W.extensions[Q],X=Z.images[Y.source],K=$.textureLoader;if(X.uri){let H=$.options.manager.getHandler(X.uri);if(H!==null)K=H}return $.loadTextureImage(J,Y.source,K)}}class wK{constructor(J){this.parser=J,this.name=o0.EXT_TEXTURE_AVIF}loadTexture(J){let Q=this.name,$=this.parser,Z=$.json,W=Z.textures[J];if(!W.extensions||!W.extensions[Q])return null;let Y=W.extensions[Q],X=Z.images[Y.source],K=$.textureLoader;if(X.uri){let H=$.options.manager.getHandler(X.uri);if(H!==null)K=H}return $.loadTextureImage(J,Y.source,K)}}class eZ{constructor(J,Q){this.name=Q,this.parser=J}loadBufferView(J){let Q=this.parser.json,$=Q.bufferViews[J];if($.extensions&&$.extensions[this.name]){let Z=$.extensions[this.name],W=this.parser.getDependency("buffer",Z.buffer),Y=this.parser.options.meshoptDecoder;if(!Y||!Y.supported)if(Q.extensionsRequired&&Q.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");else return null;return W.then(function(X){let K=Z.byteOffset||0,H=Z.byteLength||0,U=Z.count,G=Z.byteStride,F=new Uint8Array(X,K,H);if(Y.decodeGltfBufferAsync)return Y.decodeGltfBufferAsync(U,G,F,Z.mode,Z.filter).then(function(E){return E.buffer});else return Y.ready.then(function(){let E=new ArrayBuffer(U*G);return Y.decodeGltfBuffer(new Uint8Array(E),U,G,F,Z.mode,Z.filter),E})})}else return null}}class PK{constructor(J){this.name=o0.EXT_MESH_GPU_INSTANCING,this.parser=J}createNodeMesh(J){let Q=this.parser.json,$=Q.nodes[J];if(!$.extensions||!$.extensions[this.name]||$.mesh===void 0)return null;let Z=Q.meshes[$.mesh];for(let H of Z.primitives)if(H.mode!==H9.TRIANGLES&&H.mode!==H9.TRIANGLE_STRIP&&H.mode!==H9.TRIANGLE_FAN&&H.mode!==void 0)return null;let Y=$.extensions[this.name].attributes,X=[],K={};for(let H in Y)X.push(this.parser.getDependency("accessor",Y[H]).then((U)=>{return K[H]=U,K[H]}));if(X.length<1)return null;return X.push(this.parser.createNodeMesh(J)),Promise.all(X).then((H)=>{let U=H.pop(),G=U.isGroup?U.children:[U],F=H[0].count,E=[];for(let O of G){let R=new S0,C=new j,q=new PJ,N=new j(1,1,1),L=new q6(O.geometry,O.material,F);for(let M=0;M<F;M++){if(K.TRANSLATION)C.fromBufferAttribute(K.TRANSLATION,M);if(K.ROTATION)q.fromBufferAttribute(K.ROTATION,M);if(K.SCALE)N.fromBufferAttribute(K.SCALE,M);L.setMatrixAt(M,R.compose(C,q,N))}for(let M in K)if(M==="_COLOR_0"){let k=K[M];L.instanceColor=new B8(k.array,k.itemSize,k.normalized)}else if(M!=="TRANSLATION"&&M!=="ROTATION"&&M!=="SCALE")O.geometry.setAttribute(M,K[M]);FJ.prototype.copy.call(L,O),this.parser.assignFinalMaterial(L),E.push(L)}if(U.isGroup)return U.clear(),U.add(...E),U;return E[0]})}}var _K="glTF",K7=12,KK={JSON:1313821514,BIN:5130562};class TK{constructor(J){this.name=o0.KHR_BINARY_GLTF,this.content=null,this.body=null;let Q=new DataView(J,0,K7),$=new TextDecoder;if(this.header={magic:$.decode(new Uint8Array(J.slice(0,4))),version:Q.getUint32(4,!0),length:Q.getUint32(8,!0)},this.header.magic!==_K)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");else if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");let Z=this.header.length-K7,W=new DataView(J,K7),Y=0;while(Y<Z){let X=W.getUint32(Y,!0);Y+=4;let K=W.getUint32(Y,!0);if(Y+=4,K===KK.JSON){let H=new Uint8Array(J,K7+Y,X);this.content=$.decode(H)}else if(K===KK.BIN){let H=K7+Y;this.body=J.slice(H,H+X)}Y+=X}if(this.content===null)throw Error("THREE.GLTFLoader: JSON content not found.")}}class AK{constructor(J,Q){if(!Q)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=o0.KHR_DRACO_MESH_COMPRESSION,this.json=J,this.dracoLoader=Q,this.dracoLoader.preload()}decodePrimitive(J,Q){let $=this.json,Z=this.dracoLoader,W=J.extensions[this.name].bufferView,Y=J.extensions[this.name].attributes,X={},K={},H={};for(let U in Y){let G=JW[U]||U.toLowerCase();X[G]=Y[U]}for(let U in J.attributes){let G=JW[U]||U.toLowerCase();if(Y[U]!==void 0){let F=$.accessors[J.attributes[U]],E=I6[F.componentType];H[G]=E.name,K[G]=F.normalized===!0}}return Q.getDependency("bufferView",W).then(function(U){return new Promise(function(G,F){Z.decodeDracoFile(U,function(E){for(let O in E.attributes){let R=E.attributes[O],C=K[O];if(C!==void 0)R.normalized=C}G(E)},X,H,uJ,F)})})}}class SK{constructor(){this.name=o0.KHR_TEXTURE_TRANSFORM}extendTexture(J,Q){if((Q.texCoord===void 0||Q.texCoord===J.channel)&&Q.offset===void 0&&Q.rotation===void 0&&Q.scale===void 0)return J;if(J=J.clone(),Q.texCoord!==void 0)J.channel=Q.texCoord;if(Q.offset!==void 0)J.offset.fromArray(Q.offset);if(Q.rotation!==void 0)J.rotation=Q.rotation;if(Q.scale!==void 0)J.repeat.fromArray(Q.scale);return J.needsUpdate=!0,J}}class jK{constructor(){this.name=o0.KHR_MESH_QUANTIZATION}}class ZW extends i9{constructor(J,Q,$,Z){super(J,Q,$,Z)}copySampleValue_(J){let Q=this.resultBuffer,$=this.sampleValues,Z=this.valueSize,W=J*Z*3+Z;for(let Y=0;Y!==Z;Y++)Q[Y]=$[W+Y];return Q}interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=X*2,H=X*3,U=Z-Q,G=($-Q)/U,F=G*G,E=F*G,O=J*H,R=O-H,C=-2*E+3*F,q=E-F,N=1-C,L=q-F+G;for(let M=0;M!==X;M++){let k=Y[R+M+X],_=Y[R+M+K]*U,P=Y[O+M+X],V=Y[O+M]*U;W[M]=N*k+L*_+C*P+q*V}return W}}var XF=new PJ;class vK extends ZW{interpolate_(J,Q,$,Z){let W=super.interpolate_(J,Q,$,Z);return XF.fromArray(W).normalize().toArray(W),W}}var H9={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},I6={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},HK={9728:L9,9729:BJ,9984:c7,9985:K6,9986:I8,9987:P9},UK={33071:X6,33648:l7,10497:X8},aZ={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},JW={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},O8={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},KF={CUBICSPLINE:void 0,LINEAR:t7,STEP:WZ},rZ={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function HF(J){if(J.DefaultMaterial===void 0)J.DefaultMaterial=new X9({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:z9});return J.DefaultMaterial}function x8(J,Q,$){for(let Z in $.extensions)if(J[Z]===void 0)Q.userData.gltfExtensions=Q.userData.gltfExtensions||{},Q.userData.gltfExtensions[Z]=$.extensions[Z]}function h9(J,Q){if(Q.extras!==void 0)if(typeof Q.extras==="object")Object.assign(J.userData,Q.extras);else console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+Q.extras)}function UF(J,Q,$){let Z=!1,W=!1,Y=!1;for(let U=0,G=Q.length;U<G;U++){let F=Q[U];if(F.POSITION!==void 0)Z=!0;if(F.NORMAL!==void 0)W=!0;if(F.COLOR_0!==void 0)Y=!0;if(Z&&W&&Y)break}if(!Z&&!W&&!Y)return Promise.resolve(J);let X=[],K=[],H=[];for(let U=0,G=Q.length;U<G;U++){let F=Q[U];if(Z){let E=F.POSITION!==void 0?$.getDependency("accessor",F.POSITION):J.attributes.position;X.push(E)}if(W){let E=F.NORMAL!==void 0?$.getDependency("accessor",F.NORMAL):J.attributes.normal;K.push(E)}if(Y){let E=F.COLOR_0!==void 0?$.getDependency("accessor",F.COLOR_0):J.attributes.color;H.push(E)}}return Promise.all([Promise.all(X),Promise.all(K),Promise.all(H)]).then(function(U){let G=U[0],F=U[1],E=U[2];if(Z)J.morphAttributes.position=G;if(W)J.morphAttributes.normal=F;if(Y)J.morphAttributes.color=E;return J.morphTargetsRelative=!0,J})}function GF(J,Q){if(J.updateMorphTargets(),Q.weights!==void 0)for(let $=0,Z=Q.weights.length;$<Z;$++)J.morphTargetInfluences[$]=Q.weights[$];if(Q.extras&&Array.isArray(Q.extras.targetNames)){let $=Q.extras.targetNames;if(J.morphTargetInfluences.length===$.length){J.morphTargetDictionary={};for(let Z=0,W=$.length;Z<W;Z++)J.morphTargetDictionary[$[Z]]=Z}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function EF(J){let Q,$=J.extensions&&J.extensions[o0.KHR_DRACO_MESH_COMPRESSION];if($)Q="draco:"+$.bufferView+":"+$.indices+":"+tZ($.attributes);else Q=J.indices+":"+tZ(J.attributes)+":"+J.mode;if(J.targets!==void 0)for(let Z=0,W=J.targets.length;Z<W;Z++)Q+=":"+tZ(J.targets[Z]);return Q}function tZ(J){let Q="",$=Object.keys(J).sort();for(let Z=0,W=$.length;Z<W;Z++)Q+=$[Z]+":"+J[$[Z]]+";";return Q}function QW(J){switch(J){case Int8Array:return 0.007874015748031496;case Uint8Array:return 0.00392156862745098;case Int16Array:return 0.00003051850947599719;case Uint16Array:return 0.000015259021896696422;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function FF(J){if(J.search(/\.jpe?g($|\?)/i)>0||J.search(/^data\:image\/jpeg/)===0)return"image/jpeg";if(J.search(/\.webp($|\?)/i)>0||J.search(/^data\:image\/webp/)===0)return"image/webp";if(J.search(/\.ktx2($|\?)/i)>0||J.search(/^data\:image\/ktx2/)===0)return"image/ktx2";return"image/png"}var NF=new S0;class yK{constructor(J={},Q={}){this.json=J,this.extensions={},this.plugins={},this.options=Q,this.cache=new YF,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let $=!1,Z=-1,W=!1,Y=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){let X=navigator.userAgent;$=/^((?!chrome|android).)*safari/i.test(X)===!0;let K=X.match(/Version\/(\d+)/);Z=$&&K?parseInt(K[1],10):-1,W=X.indexOf("Firefox")>-1,Y=W?X.match(/Firefox\/([0-9]+)\./)[1]:-1}if(typeof createImageBitmap>"u"||$&&Z<17||W&&Y<98)this.textureLoader=new D6(this.options.manager);else this.textureLoader=new MQ(this.options.manager);if(this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new L6(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials")this.fileLoader.setWithCredentials(!0)}setExtensions(J){this.extensions=J}setPlugins(J){this.plugins=J}parse(J,Q){let $=this,Z=this.json,W=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(Y){return Y._markDefs&&Y._markDefs()}),Promise.all(this._invokeAll(function(Y){return Y.beforeRoot&&Y.beforeRoot()})).then(function(){return Promise.all([$.getDependencies("scene"),$.getDependencies("animation"),$.getDependencies("camera")])}).then(function(Y){let X={scene:Y[0][Z.scene||0],scenes:Y[0],animations:Y[1],cameras:Y[2],asset:Z.asset,parser:$,userData:{}};return x8(W,X,Z),h9(X,Z),Promise.all($._invokeAll(function(K){return K.afterRoot&&K.afterRoot(X)})).then(function(){for(let K of X.scenes)K.updateMatrixWorld();J(X)})}).catch(Q)}_markDefs(){let J=this.json.nodes||[],Q=this.json.skins||[],$=this.json.meshes||[];for(let Z=0,W=Q.length;Z<W;Z++){let Y=Q[Z].joints;for(let X=0,K=Y.length;X<K;X++)J[Y[X]].isBone=!0}for(let Z=0,W=J.length;Z<W;Z++){let Y=J[Z];if(Y.mesh!==void 0){if(this._addNodeRef(this.meshCache,Y.mesh),Y.skin!==void 0)$[Y.mesh].isSkinnedMesh=!0}if(Y.camera!==void 0)this._addNodeRef(this.cameraCache,Y.camera)}}_addNodeRef(J,Q){if(Q===void 0)return;if(J.refs[Q]===void 0)J.refs[Q]=J.uses[Q]=0;J.refs[Q]++}_getNodeRef(J,Q,$){if(J.refs[Q]<=1)return $;let Z=$.clone(),W=(Y,X)=>{let K=this.associations.get(Y);if(K!=null)this.associations.set(X,K);for(let[H,U]of Y.children.entries())W(U,X.children[H])};return W($,Z),Z.name+="_instance_"+J.uses[Q]++,Z}_invokeOne(J){let Q=Object.values(this.plugins);Q.push(this);for(let $=0;$<Q.length;$++){let Z=J(Q[$]);if(Z)return Z}return null}_invokeAll(J){let Q=Object.values(this.plugins);Q.unshift(this);let $=[];for(let Z=0;Z<Q.length;Z++){let W=J(Q[Z]);if(W)$.push(W)}return $}getDependency(J,Q){let $=J+":"+Q,Z=this.cache.get($);if(!Z){switch(J){case"scene":Z=this.loadScene(Q);break;case"node":Z=this._invokeOne(function(W){return W.loadNode&&W.loadNode(Q)});break;case"mesh":Z=this._invokeOne(function(W){return W.loadMesh&&W.loadMesh(Q)});break;case"accessor":Z=this.loadAccessor(Q);break;case"bufferView":Z=this._invokeOne(function(W){return W.loadBufferView&&W.loadBufferView(Q)});break;case"buffer":Z=this.loadBuffer(Q);break;case"material":Z=this._invokeOne(function(W){return W.loadMaterial&&W.loadMaterial(Q)});break;case"texture":Z=this._invokeOne(function(W){return W.loadTexture&&W.loadTexture(Q)});break;case"skin":Z=this.loadSkin(Q);break;case"animation":Z=this._invokeOne(function(W){return W.loadAnimation&&W.loadAnimation(Q)});break;case"camera":Z=this.loadCamera(Q);break;default:if(Z=this._invokeOne(function(W){return W!=this&&W.getDependency&&W.getDependency(J,Q)}),!Z)throw Error("Unknown type: "+J);break}this.cache.add($,Z)}return Z}getDependencies(J){let Q=this.cache.get(J);if(!Q){let $=this,Z=this.json[J+(J==="mesh"?"es":"s")]||[];Q=Promise.all(Z.map(function(W,Y){return $.getDependency(J,Y)})),this.cache.add(J,Q)}return Q}loadBuffer(J){let Q=this.json.buffers[J],$=this.fileLoader;if(Q.type&&Q.type!=="arraybuffer")throw Error("THREE.GLTFLoader: "+Q.type+" buffer type is not supported.");if(Q.uri===void 0&&J===0)return Promise.resolve(this.extensions[o0.KHR_BINARY_GLTF].body);let Z=this.options;return new Promise(function(W,Y){$.load(F8.resolveURL(Q.uri,Z.path),W,void 0,function(){Y(Error('THREE.GLTFLoader: Failed to load buffer "'+Q.uri+'".'))})})}loadBufferView(J){let Q=this.json.bufferViews[J];return this.getDependency("buffer",Q.buffer).then(function($){let Z=Q.byteLength||0,W=Q.byteOffset||0;return $.slice(W,W+Z)})}loadAccessor(J){let Q=this,$=this.json,Z=this.json.accessors[J];if(Z.bufferView===void 0&&Z.sparse===void 0){let Y=aZ[Z.type],X=I6[Z.componentType],K=Z.normalized===!0,H=new X(Z.count*Y);return Promise.resolve(new JJ(H,Y,K))}let W=[];if(Z.bufferView!==void 0)W.push(this.getDependency("bufferView",Z.bufferView));else W.push(null);if(Z.sparse!==void 0)W.push(this.getDependency("bufferView",Z.sparse.indices.bufferView)),W.push(this.getDependency("bufferView",Z.sparse.values.bufferView));return Promise.all(W).then(function(Y){let X=Y[0],K=aZ[Z.type],H=I6[Z.componentType],U=H.BYTES_PER_ELEMENT,G=U*K,F=Z.byteOffset||0,E=Z.bufferView!==void 0?$.bufferViews[Z.bufferView].byteStride:void 0,O=Z.normalized===!0,R,C;if(E&&E!==G){let q=Math.floor(F/E),N="InterleavedBuffer:"+Z.bufferView+":"+Z.componentType+":"+q+":"+Z.count,L=Q.cache.get(N);if(!L)R=new H(X,q*E,Z.count*E/U),L=new c6(R,E/U),Q.cache.add(N,L);C=new F6(L,K,F%E/U,O)}else{if(X===null)R=new H(Z.count*K);else R=new H(X,F,Z.count*K);C=new JJ(R,K,O)}if(Z.sparse!==void 0){let q=aZ.SCALAR,N=I6[Z.sparse.indices.componentType],L=Z.sparse.indices.byteOffset||0,M=Z.sparse.values.byteOffset||0,k=new N(Y[1],L,Z.sparse.count*q),_=new H(Y[2],M,Z.sparse.count*K);if(X!==null)C=new JJ(C.array.slice(),C.itemSize,C.normalized);C.normalized=!1;for(let P=0,V=k.length;P<V;P++){let D=k[P];if(C.setX(D,_[P*K]),K>=2)C.setY(D,_[P*K+1]);if(K>=3)C.setZ(D,_[P*K+2]);if(K>=4)C.setW(D,_[P*K+3]);if(K>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}C.normalized=O}return C})}loadTexture(J){let Q=this.json,$=this.options,W=Q.textures[J].source,Y=Q.images[W],X=this.textureLoader;if(Y.uri){let K=$.manager.getHandler(Y.uri);if(K!==null)X=K}return this.loadTextureImage(J,W,X)}loadTextureImage(J,Q,$){let Z=this,W=this.json,Y=W.textures[J],X=W.images[Q],K=(X.uri||X.bufferView)+":"+Y.sampler;if(this.textureCache[K])return this.textureCache[K];let H=this.loadImageSource(Q,$).then(function(U){if(U.flipY=!1,U.name=Y.name||X.name||"",U.name===""&&typeof X.uri==="string"&&X.uri.startsWith("data:image/")===!1)U.name=X.uri;let F=(W.samplers||{})[Y.sampler]||{};return U.magFilter=HK[F.magFilter]||BJ,U.minFilter=HK[F.minFilter]||P9,U.wrapS=UK[F.wrapS]||X8,U.wrapT=UK[F.wrapT]||X8,U.generateMipmaps=!U.isCompressedTexture&&U.minFilter!==L9&&U.minFilter!==BJ,Z.associations.set(U,{textures:J}),U}).catch(function(){return null});return this.textureCache[K]=H,H}loadImageSource(J,Q){let $=this,Z=this.json,W=this.options;if(this.sourceCache[J]!==void 0)return this.sourceCache[J].then((G)=>G.clone());let Y=Z.images[J],X=self.URL||self.webkitURL,K=Y.uri||"",H=!1;if(Y.bufferView!==void 0)K=$.getDependency("bufferView",Y.bufferView).then(function(G){H=!0;let F=new Blob([G],{type:Y.mimeType});return K=X.createObjectURL(F),K});else if(Y.uri===void 0)throw Error("THREE.GLTFLoader: Image "+J+" is missing URI and bufferView");let U=Promise.resolve(K).then(function(G){return new Promise(function(F,E){let O=F;if(Q.isImageBitmapLoader===!0)O=function(R){let C=new wJ(R);C.needsUpdate=!0,F(C)};Q.load(F8.resolveURL(G,W.path),O,void 0,E)})}).then(function(G){if(H===!0)X.revokeObjectURL(K);return h9(G,Y),G.userData.mimeType=Y.mimeType||FF(Y.uri),G}).catch(function(G){throw console.error("THREE.GLTFLoader: Couldn't load texture",K),G});return this.sourceCache[J]=U,U}assignTexture(J,Q,$,Z){let W=this;return this.getDependency("texture",$.index).then(function(Y){if(!Y)return null;if($.texCoord!==void 0&&$.texCoord>0)Y=Y.clone(),Y.channel=$.texCoord;if(W.extensions[o0.KHR_TEXTURE_TRANSFORM]){let X=$.extensions!==void 0?$.extensions[o0.KHR_TEXTURE_TRANSFORM]:void 0;if(X){let K=W.associations.get(Y);Y=W.extensions[o0.KHR_TEXTURE_TRANSFORM].extendTexture(Y,X),W.associations.set(Y,K)}}if(Z!==void 0)Y.colorSpace=Z;return J[Q]=Y,Y})}assignFinalMaterial(J){let{geometry:Q,material:$}=J,Z=Q.attributes.tangent===void 0,W=Q.attributes.color!==void 0,Y=Q.attributes.normal===void 0;if(J.isPoints){let X="PointsMaterial:"+$.uuid,K=this.cache.get(X);if(!K)K=new o6,eJ.prototype.copy.call(K,$),K.color.copy($.color),K.map=$.map,K.sizeAttenuation=!1,this.cache.add(X,K);$=K}else if(J.isLine){let X="LineBasicMaterial:"+$.uuid,K=this.cache.get(X);if(!K)K=new i6,eJ.prototype.copy.call(K,$),K.color.copy($.color),K.map=$.map,this.cache.add(X,K);$=K}if(Z||W||Y){let X="ClonedMaterial:"+$.uuid+":";if(Z)X+="derivative-tangents:";if(W)X+="vertex-colors:";if(Y)X+="flat-shading:";let K=this.cache.get(X);if(!K){if(K=$.clone(),W)K.vertexColors=!0;if(Y)K.flatShading=!0;if(Z){if(K.normalScale)K.normalScale.y*=-1;if(K.clearcoatNormalScale)K.clearcoatNormalScale.y*=-1}this.cache.add(X,K),this.associations.set(K,this.associations.get($))}$=K}J.material=$}getMaterialType(){return X9}loadMaterial(J){let Q=this,$=this.json,Z=this.extensions,W=$.materials[J],Y,X={},K=W.extensions||{},H=[];if(K[o0.KHR_MATERIALS_UNLIT]){let G=Z[o0.KHR_MATERIALS_UNLIT];Y=G.getMaterialType(),H.push(G.extendParams(X,W,Q))}else{let G=W.pbrMetallicRoughness||{};if(X.color=new R0(1,1,1),X.opacity=1,Array.isArray(G.baseColorFactor)){let F=G.baseColorFactor;X.color.setRGB(F[0],F[1],F[2],uJ),X.opacity=F[3]}if(G.baseColorTexture!==void 0)H.push(Q.assignTexture(X,"map",G.baseColorTexture,H8));if(X.metalness=G.metallicFactor!==void 0?G.metallicFactor:1,X.roughness=G.roughnessFactor!==void 0?G.roughnessFactor:1,G.metallicRoughnessTexture!==void 0)H.push(Q.assignTexture(X,"metalnessMap",G.metallicRoughnessTexture)),H.push(Q.assignTexture(X,"roughnessMap",G.metallicRoughnessTexture));Y=this._invokeOne(function(F){return F.getMaterialType&&F.getMaterialType(J)}),H.push(Promise.all(this._invokeAll(function(F){return F.extendMaterialParams&&F.extendMaterialParams(J,X)})))}if(W.doubleSided===!0)X.side=cJ;let U=W.alphaMode||rZ.OPAQUE;if(U===rZ.BLEND)X.transparent=!0,X.depthWrite=!1;else if(X.transparent=!1,U===rZ.MASK)X.alphaTest=W.alphaCutoff!==void 0?W.alphaCutoff:0.5;if(W.normalTexture!==void 0&&Y!==A9){if(H.push(Q.assignTexture(X,"normalMap",W.normalTexture)),X.normalScale=new p0(1,1),W.normalTexture.scale!==void 0){let G=W.normalTexture.scale;X.normalScale.set(G,G)}}if(W.occlusionTexture!==void 0&&Y!==A9){if(H.push(Q.assignTexture(X,"aoMap",W.occlusionTexture)),W.occlusionTexture.strength!==void 0)X.aoMapIntensity=W.occlusionTexture.strength}if(W.emissiveFactor!==void 0&&Y!==A9){let G=W.emissiveFactor;X.emissive=new R0().setRGB(G[0],G[1],G[2],uJ)}if(W.emissiveTexture!==void 0&&Y!==A9)H.push(Q.assignTexture(X,"emissiveMap",W.emissiveTexture,H8));return Promise.all(H).then(function(){let G=new Y(X);if(W.name)G.name=W.name;if(h9(G,W),Q.associations.set(G,{materials:J}),W.extensions)x8(Z,G,W);return G})}createUniqueName(J){let Q=e0.sanitizeNodeName(J||"");if(Q in this.nodeNamesUsed)return Q+"_"+ ++this.nodeNamesUsed[Q];else return this.nodeNamesUsed[Q]=0,Q}loadGeometries(J){let Q=this,$=this.extensions,Z=this.primitiveCache;function W(X){return $[o0.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(X,Q).then(function(K){return GK(K,X,Q)})}let Y=[];for(let X=0,K=J.length;X<K;X++){let H=J[X],U=EF(H),G=Z[U];if(G)Y.push(G.promise);else{let F;if(H.extensions&&H.extensions[o0.KHR_DRACO_MESH_COMPRESSION])F=W(H);else F=GK(new RJ,H,Q);Z[U]={primitive:H,promise:F},Y.push(F)}}return Promise.all(Y)}loadMesh(J){let Q=this,$=this.json,Z=this.extensions,W=$.meshes[J],Y=W.primitives,X=[];for(let K=0,H=Y.length;K<H;K++){let U=Y[K].material===void 0?HF(this.cache):this.getDependency("material",Y[K].material);X.push(U)}return X.push(Q.loadGeometries(Y)),Promise.all(X).then(function(K){let H=K.slice(0,K.length-1),U=K[K.length-1],G=[];for(let E=0,O=U.length;E<O;E++){let R=U[E],C=Y[E],q,N=H[E];if(C.mode===H9.TRIANGLES||C.mode===H9.TRIANGLE_STRIP||C.mode===H9.TRIANGLE_FAN||C.mode===void 0){if(q=W.isSkinnedMesh===!0?new XQ(R,N):new GJ(R,N),q.isSkinnedMesh===!0)q.normalizeSkinWeights();if(C.mode===H9.TRIANGLE_STRIP)q.geometry=oZ(q.geometry,u6);else if(C.mode===H9.TRIANGLE_FAN)q.geometry=oZ(q.geometry,U6)}else if(C.mode===H9.LINES)q=new KQ(R,N);else if(C.mode===H9.LINE_STRIP)q=new R6(R,N);else if(C.mode===H9.LINE_LOOP)q=new HQ(R,N);else if(C.mode===H9.POINTS)q=new s9(R,N);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+C.mode);if(Object.keys(q.geometry.morphAttributes).length>0)GF(q,W);if(q.name=Q.createUniqueName(W.name||"mesh_"+J),h9(q,W),C.extensions)x8(Z,q,C);Q.assignFinalMaterial(q),G.push(q)}for(let E=0,O=G.length;E<O;E++)Q.associations.set(G[E],{meshes:J,primitives:E});if(G.length===1){if(W.extensions)x8(Z,G[0],W);return G[0]}let F=new W9;if(W.extensions)x8(Z,F,W);Q.associations.set(F,{meshes:J});for(let E=0,O=G.length;E<O;E++)F.add(G[E]);return F})}loadCamera(J){let Q,$=this.json.cameras[J],Z=$[$.type];if(!Z){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}if($.type==="perspective")Q=new kJ(E6.radToDeg(Z.yfov),Z.aspectRatio||1,Z.znear||1,Z.zfar||2000000);else if($.type==="orthographic")Q=new v8(-Z.xmag,Z.xmag,Z.ymag,-Z.ymag,Z.znear,Z.zfar);if($.name)Q.name=this.createUniqueName($.name);return h9(Q,$),Promise.resolve(Q)}loadSkin(J){let Q=this.json.skins[J],$=[];for(let Z=0,W=Q.joints.length;Z<W;Z++)$.push(this._loadNodeShallow(Q.joints[Z]));if(Q.inverseBindMatrices!==void 0)$.push(this.getDependency("accessor",Q.inverseBindMatrices));else $.push(null);return Promise.all($).then(function(Z){let W=Z.pop(),Y=Z,X=[],K=[];for(let H=0,U=Y.length;H<U;H++){let G=Y[H];if(G){X.push(G);let F=new S0;if(W!==null)F.fromArray(W.array,H*16);K.push(F)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',Q.joints[H])}return new s6(X,K)})}loadAnimation(J){let Q=this.json,$=this,Z=Q.animations[J],W=Z.name?Z.name:"animation_"+J,Y=[],X=[],K=[],H=[],U=[];for(let G=0,F=Z.channels.length;G<F;G++){let E=Z.channels[G],O=Z.samplers[E.sampler],R=E.target,C=R.node,q=Z.parameters!==void 0?Z.parameters[O.input]:O.input,N=Z.parameters!==void 0?Z.parameters[O.output]:O.output;if(R.node===void 0)continue;Y.push(this.getDependency("node",C)),X.push(this.getDependency("accessor",q)),K.push(this.getDependency("accessor",N)),H.push(O),U.push(R)}return Promise.all([Promise.all(Y),Promise.all(X),Promise.all(K),Promise.all(H),Promise.all(U)]).then(function(G){let F=G[0],E=G[1],O=G[2],R=G[3],C=G[4],q=[];for(let L=0,M=F.length;L<M;L++){let k=F[L],_=E[L],P=O[L],V=R[L],D=C[L];if(k===void 0)continue;if(k.updateMatrix)k.updateMatrix();let B=$._createAnimationTracks(k,_,P,V,D);if(B)for(let A=0;A<B.length;A++)q.push(B[A])}let N=new $6(W,void 0,q);return h9(N,Z),N})}createNodeMesh(J){let Q=this.json,$=this,Z=Q.nodes[J];if(Z.mesh===void 0)return null;return $.getDependency("mesh",Z.mesh).then(function(W){let Y=$._getNodeRef($.meshCache,Z.mesh,W);if(Z.weights!==void 0)Y.traverse(function(X){if(!X.isMesh)return;for(let K=0,H=Z.weights.length;K<H;K++)X.morphTargetInfluences[K]=Z.weights[K]});return Y})}loadNode(J){let Q=this.json,$=this,Z=Q.nodes[J],W=$._loadNodeShallow(J),Y=[],X=Z.children||[];for(let H=0,U=X.length;H<U;H++)Y.push($.getDependency("node",X[H]));let K=Z.skin===void 0?Promise.resolve(null):$.getDependency("skin",Z.skin);return Promise.all([W,Promise.all(Y),K]).then(function(H){let U=H[0],G=H[1],F=H[2];if(F!==null)U.traverse(function(E){if(!E.isSkinnedMesh)return;E.bind(F,NF)});for(let E=0,O=G.length;E<O;E++)U.add(G[E]);if(U.userData.pivot!==void 0&&G.length>0){let E=U.userData.pivot,O=G[0];U.pivot=new j().fromArray(E),U.position.x-=E[0],U.position.y-=E[1],U.position.z-=E[2],O.position.set(0,0,0),delete U.userData.pivot}return U})}_loadNodeShallow(J){let Q=this.json,$=this.extensions,Z=this;if(this.nodeCache[J]!==void 0)return this.nodeCache[J];let W=Q.nodes[J],Y=W.name?Z.createUniqueName(W.name):"",X=[],K=Z._invokeOne(function(H){return H.createNodeMesh&&H.createNodeMesh(J)});if(K)X.push(K);if(W.camera!==void 0)X.push(Z.getDependency("camera",W.camera).then(function(H){return Z._getNodeRef(Z.cameraCache,W.camera,H)}));return Z._invokeAll(function(H){return H.createNodeAttachment&&H.createNodeAttachment(J)}).forEach(function(H){X.push(H)}),this.nodeCache[J]=Promise.all(X).then(function(H){let U;if(W.isBone===!0)U=new n6;else if(H.length>1)U=new W9;else if(H.length===1)U=H[0];else U=new FJ;if(U!==H[0])for(let G=0,F=H.length;G<F;G++)U.add(H[G]);if(W.name)U.userData.name=W.name,U.name=Y;if(h9(U,W),W.extensions)x8($,U,W);if(W.matrix!==void 0){let G=new S0;G.fromArray(W.matrix),U.applyMatrix4(G)}else{if(W.translation!==void 0)U.position.fromArray(W.translation);if(W.rotation!==void 0)U.quaternion.fromArray(W.rotation);if(W.scale!==void 0)U.scale.fromArray(W.scale)}if(!Z.associations.has(U))Z.associations.set(U,{});else if(W.mesh!==void 0&&Z.meshCache.refs[W.mesh]>1){let G=Z.associations.get(U);Z.associations.set(U,{...G})}return Z.associations.get(U).nodes=J,U}),this.nodeCache[J]}loadScene(J){let Q=this.extensions,$=this.json.scenes[J],Z=this,W=new W9;if($.name)W.name=Z.createUniqueName($.name);if(h9(W,$),$.extensions)x8(Q,W,$);let Y=$.nodes||[],X=[];for(let K=0,H=Y.length;K<H;K++)X.push(Z.getDependency("node",Y[K]));return Promise.all(X).then(function(K){for(let U=0,G=K.length;U<G;U++){let F=K[U];if(F.parent!==null)W.add(YK(F));else W.add(F)}let H=(U)=>{let G=new Map;for(let[F,E]of Z.associations)if(F instanceof eJ||F instanceof wJ)G.set(F,E);return U.traverse((F)=>{let E=Z.associations.get(F);if(E!=null)G.set(F,E)}),G};return Z.associations=H(W),W})}_createAnimationTracks(J,Q,$,Z,W){let Y=[],X=J.name?J.name:J.uuid,K=[];function H(E){if(E.morphTargetInfluences)K.push(E.name?E.name:E.uuid)}if(O8[W.path]===O8.weights){if(H(J),J.isGroup)J.children.forEach(H)}else K.push(X);let U;switch(O8[W.path]){case O8.weights:U=c9;break;case O8.rotation:U=o9;break;case O8.translation:case O8.scale:U=n9;break;default:switch($.itemSize){case 1:U=c9;break;case 2:case 3:default:U=n9;break}break}let G=Z.interpolation!==void 0?KF[Z.interpolation]:t7,F=this._getArrayFromAccessor($);for(let E=0,O=K.length;E<O;E++){let R=new U(K[E]+"."+O8[W.path],Q.array,F,G);if(Z.interpolation==="CUBICSPLINE")this._createCubicSplineTrackInterpolant(R);Y.push(R)}return Y}_getArrayFromAccessor(J){let Q=J.array;if(J.normalized){let $=QW(Q.constructor),Z=new Float32Array(Q.length);for(let W=0,Y=Q.length;W<Y;W++)Z[W]=Q[W]*$;Q=Z}return Q}_createCubicSplineTrackInterpolant(J){J.createInterpolant=function($){return new(this instanceof o9?vK:ZW)(this.times,this.values,this.getValueSize()/3,$)},J.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function OF(J,Q,$){let Z=Q.attributes,W=new sJ;if(Z.POSITION!==void 0){let K=$.json.accessors[Z.POSITION],H=K.min,U=K.max;if(H!==void 0&&U!==void 0){if(W.set(new j(H[0],H[1],H[2]),new j(U[0],U[1],U[2])),K.normalized){let G=QW(I6[K.componentType]);W.min.multiplyScalar(G),W.max.multiplyScalar(G)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let Y=Q.targets;if(Y!==void 0){let K=new j,H=new j;for(let U=0,G=Y.length;U<G;U++){let F=Y[U];if(F.POSITION!==void 0){let E=$.json.accessors[F.POSITION],O=E.min,R=E.max;if(O!==void 0&&R!==void 0){if(H.setX(Math.max(Math.abs(O[0]),Math.abs(R[0]))),H.setY(Math.max(Math.abs(O[1]),Math.abs(R[1]))),H.setZ(Math.max(Math.abs(O[2]),Math.abs(R[2]))),E.normalized){let C=QW(I6[E.componentType]);H.multiplyScalar(C)}K.max(H)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}W.expandByVector(K)}J.boundingBox=W;let X=new mJ;W.getCenter(X.center),X.radius=W.min.distanceTo(W.max)/2,J.boundingSphere=X}function GK(J,Q,$){let Z=Q.attributes,W=[];function Y(X,K){return $.getDependency("accessor",X).then(function(H){J.setAttribute(K,H)})}for(let X in Z){let K=JW[X]||X.toLowerCase();if(K in J.attributes)continue;W.push(Y(Z[X],K))}if(Q.indices!==void 0&&!J.index){let X=$.getDependency("accessor",Q.indices).then(function(K){J.setIndex(K)});W.push(X)}if(s0.workingColorSpace!==uJ&&"COLOR_0"in Z)console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${s0.workingColorSpace}" not supported.`);return h9(J,Q),OF(J,Q,$),Promise.all(W).then(function(){return Q.targets!==void 0?UF(J,Q.targets,$):J})}class WW extends qQ{constructor(J){super(J);this.type=fJ}parse(J){let Y=function(V,D){switch(V){case 1:throw Error("THREE.HDRLoader: Read Error: "+(D||""));case 2:throw Error("THREE.HDRLoader: Write Error: "+(D||""));case 3:throw Error("THREE.HDRLoader: Bad File Format: "+(D||""));default:case 4:throw Error("THREE.HDRLoader: Memory Error: "+(D||""))}},G=function(V,D,B){D=!D?1024:D;let z=V.pos,S=-1,y=0,v="",h=String.fromCharCode.apply(null,new Uint16Array(V.subarray(z,z+128)));while(0>(S=h.indexOf(`
4105
- `))&&y<D&&z<V.byteLength)v+=h,y+=h.length,z+=128,h=String.fromCharCode.apply(null,new Uint16Array(V.subarray(z,z+128)));if(-1<S){if(B!==!1)V.pos+=y+S+1;return v+h.slice(0,S)}return!1},F=function(V){let D=/^#\?(\S+)/,B=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,A=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,z=/^\s*FORMAT=(\S+)\s*$/,S=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,y={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0},v,h;if(V.pos>=V.byteLength||!(v=G(V)))Y(1,"no header found");if(!(h=v.match(D)))Y(3,"bad initial token");y.valid|=1,y.programtype=h[1],y.string+=v+`
4106
- `;while(!0){if(v=G(V),v===!1)break;if(y.string+=v+`
4107
- `,v.charAt(0)==="#"){y.comments+=v+`
4108
- `;continue}if(h=v.match(B))y.gamma=parseFloat(h[1]);if(h=v.match(A))y.exposure=parseFloat(h[1]);if(h=v.match(z))y.valid|=2,y.format=h[1];if(h=v.match(S))y.valid|=4,y.height=parseInt(h[1],10),y.width=parseInt(h[2],10);if(y.valid&2&&y.valid&4)break}if(!(y.valid&2))Y(3,"missing format specifier");if(!(y.valid&4))Y(3,"missing image size specifier");return y},E=function(V,D,B){let A=D;if(A<8||A>32767||(V[0]!==2||V[1]!==2||V[2]&128))return new Uint8Array(V);if(A!==(V[2]<<8|V[3]))Y(3,"wrong scanline width");let z=new Uint8Array(4*D*B);if(!z.length)Y(4,"unable to allocate buffer space");let S=0,y=0,v=4*A,h=new Uint8Array(4),g=new Uint8Array(v),p=B;while(p>0&&y<V.byteLength){if(y+4>V.byteLength)Y(1);if(h[0]=V[y++],h[1]=V[y++],h[2]=V[y++],h[3]=V[y++],h[0]!=2||h[1]!=2||(h[2]<<8|h[3])!=A)Y(3,"bad rgbe scanline format");let c=0,a;while(c<v&&y<V.byteLength){a=V[y++];let H0=a>128;if(H0)a-=128;if(a===0||c+a>v)Y(3,"bad scanline data");if(H0){let J0=V[y++];for(let x0=0;x0<a;x0++)g[c++]=J0}else g.set(V.subarray(y,y+a),c),c+=a,y+=a}let Q0=A;for(let H0=0;H0<Q0;H0++){let J0=0;z[S]=g[H0+J0],J0+=A,z[S+1]=g[H0+J0],J0+=A,z[S+2]=g[H0+J0],J0+=A,z[S+3]=g[H0+J0],S+=4}p--}return z},O=function(V,D,B,A){let z=V[D+3],S=Math.pow(2,z-128)/255;B[A+0]=V[D+0]*S,B[A+1]=V[D+1]*S,B[A+2]=V[D+2]*S,B[A+3]=1},R=function(V,D,B,A){let z=V[D+3],S=Math.pow(2,z-128)/255;B[A+0]=T8.toHalfFloat(Math.min(V[D+0]*S,65504)),B[A+1]=T8.toHalfFloat(Math.min(V[D+1]*S,65504)),B[A+2]=T8.toHalfFloat(Math.min(V[D+2]*S,65504)),B[A+3]=T8.toHalfFloat(1)},C=new Uint8Array(J);C.pos=0;let q=F(C),N=q.width,L=q.height,M=E(C.subarray(C.pos),N,L),k,_,P;switch(this.type){case tJ:P=M.length/4;let V=new Float32Array(P*4);for(let B=0;B<P;B++)O(M,B*4,V,B*4);k=V,_=tJ;break;case fJ:P=M.length/4;let D=new Uint16Array(P*4);for(let B=0;B<P;B++)R(M,B*4,D,B*4);k=D,_=fJ;break;default:throw Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:N,height:L,data:k,header:q.string,gamma:q.gamma,exposure:q.exposure,type:_}}setDataType(J){return this.type=J,this}load(J,Q,$,Z){function W(Y,X){switch(Y.type){case tJ:case fJ:Y.colorSpace=uJ,Y.minFilter=BJ,Y.magFilter=BJ,Y.generateMipmaps=!1,Y.flipY=!0;break}if(Q)Q(Y,X)}return super.load(J,W,$,Z)}}var H7=new j;function U9(J,Q,$,Z,W,Y){let X=2*Math.PI*W/4,K=Math.max(Y-2*W,0),H=Math.PI/4;H7.copy(Q),H7[Z]=0,H7.normalize();let U=0.5*X/(X+K),G=1-H7.angleTo(J)/H;if(Math.sign(H7[$])===1)return G*U;else return K/(X+K)+U+U*(1-G)}class SQ extends Y9{constructor(J=1,Q=1,$=1,Z=2,W=0.1){let Y=Z*2+1;W=Math.min(J/2,Q/2,$/2,W);super(1,1,1,Y,Y,Y);if(this.type="RoundedBoxGeometry",this.parameters={width:J,height:Q,depth:$,segments:Z,radius:W},Y===1)return;let X=this.toNonIndexed();this.index=null,this.attributes.position=X.attributes.position,this.attributes.normal=X.attributes.normal,this.attributes.uv=X.attributes.uv;let K=new j,H=new j,U=new j(J,Q,$).divideScalar(2).subScalar(W),G=this.attributes.position.array,F=this.attributes.normal.array,E=this.attributes.uv.array,O=G.length/6,R=new j,C=0.5/Y;for(let q=0,N=0;q<G.length;q+=3,N+=2)switch(K.fromArray(G,q),H.copy(K),H.x-=Math.sign(H.x)*C,H.y-=Math.sign(H.y)*C,H.z-=Math.sign(H.z)*C,H.normalize(),G[q+0]=U.x*Math.sign(K.x)+H.x*W,G[q+1]=U.y*Math.sign(K.y)+H.y*W,G[q+2]=U.z*Math.sign(K.z)+H.z*W,F[q+0]=H.x,F[q+1]=H.y,F[q+2]=H.z,Math.floor(q/O)){case 0:R.set(1,0,0),E[N+0]=U9(R,H,"z","y",W,$),E[N+1]=1-U9(R,H,"y","z",W,Q);break;case 1:R.set(-1,0,0),E[N+0]=1-U9(R,H,"z","y",W,$),E[N+1]=1-U9(R,H,"y","z",W,Q);break;case 2:R.set(0,1,0),E[N+0]=1-U9(R,H,"x","z",W,J),E[N+1]=U9(R,H,"z","x",W,$);break;case 3:R.set(0,-1,0),E[N+0]=1-U9(R,H,"x","z",W,J),E[N+1]=1-U9(R,H,"z","x",W,$);break;case 4:R.set(0,0,1),E[N+0]=1-U9(R,H,"x","y",W,J),E[N+1]=1-U9(R,H,"y","x",W,Q);break;case 5:R.set(0,0,-1),E[N+0]=U9(R,H,"x","y",W,J),E[N+1]=1-U9(R,H,"y","x",W,Q);break}}static fromJSON(J){return new SQ(J.width,J.height,J.depth,J.segments,J.radius)}}class YW extends GJ{constructor(J,Q,$=!1,Z=!1,W=1e4){let Y=new RJ;super(Y,Q);this.isMarchingCubes=!0;let X=this,K=new Float32Array(36),H=new Float32Array(36),U=new Float32Array(36);this.enableUvs=$,this.enableColors=Z,this.init=function(N){this.resolution=N,this.isolation=80,this.size=N,this.size2=this.size*this.size,this.size3=this.size2*this.size,this.halfsize=this.size/2,this.delta=2/this.size,this.yd=this.size,this.zd=this.size2,this.field=new Float32Array(this.size3),this.normal_cache=new Float32Array(this.size3*3),this.palette=new Float32Array(this.size3*3),this.count=0;let L=W*3;this.positionArray=new Float32Array(L*3);let M=new JJ(this.positionArray,3);M.setUsage(G6),Y.setAttribute("position",M),this.normalArray=new Float32Array(L*3);let k=new JJ(this.normalArray,3);if(k.setUsage(G6),Y.setAttribute("normal",k),this.enableUvs){this.uvArray=new Float32Array(L*2);let _=new JJ(this.uvArray,2);_.setUsage(G6),Y.setAttribute("uv",_)}if(this.enableColors){this.colorArray=new Float32Array(L*3);let _=new JJ(this.colorArray,3);_.setUsage(G6),Y.setAttribute("color",_)}Y.boundingSphere=new mJ(new j,1)};function G(N,L,M){return N+(L-N)*M}function F(N,L,M,k,_,P,V,D,B,A){let z=(M-V)/(D-V),S=X.normal_cache;K[L+0]=k+z*X.delta,K[L+1]=_,K[L+2]=P,H[L+0]=G(S[N+0],S[N+3],z),H[L+1]=G(S[N+1],S[N+4],z),H[L+2]=G(S[N+2],S[N+5],z),U[L+0]=G(X.palette[B*3+0],X.palette[A*3+0],z),U[L+1]=G(X.palette[B*3+1],X.palette[A*3+1],z),U[L+2]=G(X.palette[B*3+2],X.palette[A*3+2],z)}function E(N,L,M,k,_,P,V,D,B,A){let z=(M-V)/(D-V),S=X.normal_cache;K[L+0]=k,K[L+1]=_+z*X.delta,K[L+2]=P;let y=N+X.yd*3;H[L+0]=G(S[N+0],S[y+0],z),H[L+1]=G(S[N+1],S[y+1],z),H[L+2]=G(S[N+2],S[y+2],z),U[L+0]=G(X.palette[B*3+0],X.palette[A*3+0],z),U[L+1]=G(X.palette[B*3+1],X.palette[A*3+1],z),U[L+2]=G(X.palette[B*3+2],X.palette[A*3+2],z)}function O(N,L,M,k,_,P,V,D,B,A){let z=(M-V)/(D-V),S=X.normal_cache;K[L+0]=k,K[L+1]=_,K[L+2]=P+z*X.delta;let y=N+X.zd*3;H[L+0]=G(S[N+0],S[y+0],z),H[L+1]=G(S[N+1],S[y+1],z),H[L+2]=G(S[N+2],S[y+2],z),U[L+0]=G(X.palette[B*3+0],X.palette[A*3+0],z),U[L+1]=G(X.palette[B*3+1],X.palette[A*3+1],z),U[L+2]=G(X.palette[B*3+2],X.palette[A*3+2],z)}function R(N){let L=N*3;if(X.normal_cache[L]===0)X.normal_cache[L+0]=X.field[N-1]-X.field[N+1],X.normal_cache[L+1]=X.field[N-X.yd]-X.field[N+X.yd],X.normal_cache[L+2]=X.field[N-X.zd]-X.field[N+X.zd]}function C(N,L,M,k,_){let P=k+1,V=k+X.yd,D=k+X.zd,B=P+X.yd,A=P+X.zd,z=k+X.yd+X.zd,S=P+X.yd+X.zd,y=0,v=X.field[k],h=X.field[P],g=X.field[V],p=X.field[B],c=X.field[D],a=X.field[A],Q0=X.field[z],H0=X.field[S];if(v<_)y|=1;if(h<_)y|=2;if(g<_)y|=8;if(p<_)y|=4;if(c<_)y|=16;if(a<_)y|=32;if(Q0<_)y|=128;if(H0<_)y|=64;let J0=qF[y];if(J0===0)return 0;let x0=X.delta,v0=N+x0,s=L+x0,Y0=M+x0;if(J0&1)R(k),R(P),F(k*3,0,_,N,L,M,v,h,k,P);if(J0&2)R(P),R(B),E(P*3,3,_,v0,L,M,h,p,P,B);if(J0&4)R(V),R(B),F(V*3,6,_,N,s,M,g,p,V,B);if(J0&8)R(k),R(V),E(k*3,9,_,N,L,M,v,g,k,V);if(J0&16)R(D),R(A),F(D*3,12,_,N,L,Y0,c,a,D,A);if(J0&32)R(A),R(S),E(A*3,15,_,v0,L,Y0,a,H0,A,S);if(J0&64)R(z),R(S),F(z*3,18,_,N,s,Y0,Q0,H0,z,S);if(J0&128)R(D),R(z),E(D*3,21,_,N,L,Y0,c,Q0,D,z);if(J0&256)R(k),R(D),O(k*3,24,_,N,L,M,v,c,k,D);if(J0&512)R(P),R(A),O(P*3,27,_,v0,L,M,h,a,P,A);if(J0&1024)R(B),R(S),O(B*3,30,_,v0,s,M,p,H0,B,S);if(J0&2048)R(V),R(z),O(V*3,33,_,N,s,M,g,Q0,V,z);y<<=4;let D0,G0,w0,i0=0,j0=0;while(jQ[y+j0]!=-1)D0=y+j0,G0=D0+1,w0=D0+2,q(K,H,U,3*jQ[D0],3*jQ[G0],3*jQ[w0]),j0+=3,i0++;return i0}function q(N,L,M,k,_,P){let V=X.count*3;if(X.positionArray[V+0]=N[k],X.positionArray[V+1]=N[k+1],X.positionArray[V+2]=N[k+2],X.positionArray[V+3]=N[_],X.positionArray[V+4]=N[_+1],X.positionArray[V+5]=N[_+2],X.positionArray[V+6]=N[P],X.positionArray[V+7]=N[P+1],X.positionArray[V+8]=N[P+2],X.material.flatShading===!0){let D=(L[k+0]+L[_+0]+L[P+0])/3,B=(L[k+1]+L[_+1]+L[P+1])/3,A=(L[k+2]+L[_+2]+L[P+2])/3;X.normalArray[V+0]=D,X.normalArray[V+1]=B,X.normalArray[V+2]=A,X.normalArray[V+3]=D,X.normalArray[V+4]=B,X.normalArray[V+5]=A,X.normalArray[V+6]=D,X.normalArray[V+7]=B,X.normalArray[V+8]=A}else X.normalArray[V+0]=L[k+0],X.normalArray[V+1]=L[k+1],X.normalArray[V+2]=L[k+2],X.normalArray[V+3]=L[_+0],X.normalArray[V+4]=L[_+1],X.normalArray[V+5]=L[_+2],X.normalArray[V+6]=L[P+0],X.normalArray[V+7]=L[P+1],X.normalArray[V+8]=L[P+2];if(X.enableUvs){let D=X.count*2;X.uvArray[D+0]=N[k+0],X.uvArray[D+1]=N[k+2],X.uvArray[D+2]=N[_+0],X.uvArray[D+3]=N[_+2],X.uvArray[D+4]=N[P+0],X.uvArray[D+5]=N[P+2]}if(X.enableColors)X.colorArray[V+0]=M[k+0],X.colorArray[V+1]=M[k+1],X.colorArray[V+2]=M[k+2],X.colorArray[V+3]=M[_+0],X.colorArray[V+4]=M[_+1],X.colorArray[V+5]=M[_+2],X.colorArray[V+6]=M[P+0],X.colorArray[V+7]=M[P+1],X.colorArray[V+8]=M[P+2];X.count+=3}this.addBall=function(N,L,M,k,_,P){let V=Math.sign(k);k=Math.abs(k);let D=!(P===void 0||P===null),B=new R0(N,L,M);if(D)try{B=P instanceof R0?P:Array.isArray(P)?new R0(Math.min(Math.abs(P[0]),1),Math.min(Math.abs(P[1]),1),Math.min(Math.abs(P[2]),1)):new R0(P)}catch(j0){B=new R0(N,L,M)}let A=this.size*Math.sqrt(k/_),z=M*this.size,S=L*this.size,y=N*this.size,v=Math.floor(z-A);if(v<1)v=1;let h=Math.floor(z+A);if(h>this.size-1)h=this.size-1;let g=Math.floor(S-A);if(g<1)g=1;let p=Math.floor(S+A);if(p>this.size-1)p=this.size-1;let c=Math.floor(y-A);if(c<1)c=1;let a=Math.floor(y+A);if(a>this.size-1)a=this.size-1;let Q0,H0,J0,x0,v0,s,Y0,D0,G0,w0,i0;for(J0=v;J0<h;J0++){v0=this.size2*J0,D0=J0/this.size-M,G0=D0*D0;for(H0=g;H0<p;H0++){x0=v0+this.size*H0,Y0=H0/this.size-L,w0=Y0*Y0;for(Q0=c;Q0<a;Q0++)if(s=Q0/this.size-N,i0=k/(0.000001+s*s+w0+G0)-_,i0>0){this.field[x0+Q0]+=i0*V;let j0=Math.sqrt((Q0-y)*(Q0-y)+(H0-S)*(H0-S)+(J0-z)*(J0-z))/A,d0=1-j0*j0*j0*(j0*(j0*6-15)+10);this.palette[(x0+Q0)*3+0]+=B.r*d0,this.palette[(x0+Q0)*3+1]+=B.g*d0,this.palette[(x0+Q0)*3+2]+=B.b*d0}}}},this.addPlaneX=function(N,L){let M=this.size,k=this.yd,_=this.zd,P=this.field,V,D,B,A,z,S,y,v=M*Math.sqrt(N/L);if(v>M)v=M;for(V=0;V<v;V++)if(S=V/M,A=S*S,z=N/(0.0001+A)-L,z>0)for(D=0;D<M;D++){y=V+D*k;for(B=0;B<M;B++)P[_*B+y]+=z}},this.addPlaneY=function(N,L){let M=this.size,k=this.yd,_=this.zd,P=this.field,V,D,B,A,z,S,y,v,h=M*Math.sqrt(N/L);if(h>M)h=M;for(D=0;D<h;D++)if(S=D/M,A=S*S,z=N/(0.0001+A)-L,z>0){y=D*k;for(V=0;V<M;V++){v=y+V;for(B=0;B<M;B++)P[_*B+v]+=z}}},this.addPlaneZ=function(N,L){let M=this.size,k=this.yd,_=this.zd,P=this.field,V,D,B,A,z,S,y,v,h=M*Math.sqrt(N/L);if(h>M)h=M;for(B=0;B<h;B++)if(S=B/M,A=S*S,z=N/(0.0001+A)-L,z>0){y=_*B;for(D=0;D<M;D++){v=y+D*k;for(V=0;V<M;V++)P[v+V]+=z}}},this.setCell=function(N,L,M,k){let _=this.size2*M+this.size*L+N;this.field[_]=k},this.getCell=function(N,L,M){let k=this.size2*M+this.size*L+N;return this.field[k]},this.blur=function(N=1){let L=this.field,M=L.slice(),k=this.size,_=this.size2;for(let P=0;P<k;P++)for(let V=0;V<k;V++)for(let D=0;D<k;D++){let B=_*D+k*V+P,A=M[B],z=1;for(let S=-1;S<=1;S+=2){let y=S+P;if(y<0||y>=k)continue;for(let v=-1;v<=1;v+=2){let h=v+V;if(h<0||h>=k)continue;for(let g=-1;g<=1;g+=2){let p=g+D;if(p<0||p>=k)continue;let c=_*p+k*h+y,a=M[c];z++,A+=N*(a-A)/z}}}L[B]=A}},this.reset=function(){for(let N=0;N<this.size3;N++)this.normal_cache[N*3]=0,this.field[N]=0,this.palette[N*3]=this.palette[N*3+1]=this.palette[N*3+2]=0},this.update=function(){this.count=0;let N=this.size-2;for(let L=1;L<N;L++){let M=this.size2*L,k=(L-this.halfsize)/this.halfsize;for(let _=1;_<N;_++){let P=M+this.size*_,V=(_-this.halfsize)/this.halfsize;for(let D=1;D<N;D++){let B=(D-this.halfsize)/this.halfsize,A=P+D;C(B,V,k,A,this.isolation)}}}if(this.geometry.setDrawRange(0,this.count),Y.getAttribute("position").needsUpdate=!0,Y.getAttribute("normal").needsUpdate=!0,this.enableUvs)Y.getAttribute("uv").needsUpdate=!0;if(this.enableColors)Y.getAttribute("color").needsUpdate=!0;if(this.count/3>W)console.warn("THREE.MarchingCubes: Geometry buffers too small for rendering. Please create an instance with a higher poly count.")},this.init(J)}}var qF=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]),jQ=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,-1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,-1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,-1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,-1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,6,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,-1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,6,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);function z6(J){let Q=J>>>0;return()=>{Q=Q+1831565813>>>0;let $=Q;return $=Math.imul($^$>>>15,$|1),$^=$+Math.imul($^$>>>7,$|61),(($^$>>>14)>>>0)/4294967296}}function RF(J,Q,$){let Z=z6(Q),W=[];for(let Y=0;Y<J;Y++)W.push({cx:0.38+Z()*0.24,cy:0.38+Z()*0.24,cz:0.38+Z()*0.24,rx:0.06+Z()*0.16,ry:0.06+Z()*0.16,rz:0.04+Z()*0.1,wx:0.3+Z()*0.7,wy:0.3+Z()*0.7,wz:0.3+Z()*0.7,px:Z()*Math.PI*2,py:Z()*Math.PI*2,pz:Z()*Math.PI*2,strength:$*(0.7+Z()*0.6)});return W}function LF(J,Q){return{x:J.cx+J.rx*Math.sin(Q*J.wx+J.px),y:J.cy+J.ry*Math.sin(Q*J.wy+J.py),z:J.cz+J.rz*Math.cos(Q*J.wz+J.pz)}}function hK(J,Q){let $=Math.max(1,Math.floor(L0(J.getAttribute("count"),5))),Z=Math.floor(L0(J.getAttribute("seed"),1)),W=Math.max(16,Math.floor(L0(J.getAttribute("resolution"),56))),Y=L0(J.getAttribute("speed"),0.7),X=L0(J.getAttribute("strength"),0.7),K=L0(J.getAttribute("scale"),2),H=new YW(W,Q,!0,!0,60000);H.isolation=L0(J.getAttribute("isolation"),60),H.position.set(...OJ(J.getAttribute("position"),[0,0,0])),H.scale.setScalar(K),H.frustumCulled=!1;let U=RF($,Z,X),G=(F)=>{let E=F*Y;H.reset();for(let O of U){let R=LF(O,E);H.addBall(R.x,R.y,R.z,O.strength,12)}H.update()};return G(0),{mesh:H,writer:G}}class XW extends GJ{constructor(J,Q={}){super(J);this.isWater=!0;let $=this,Z=Q.textureWidth!==void 0?Q.textureWidth:512,W=Q.textureHeight!==void 0?Q.textureHeight:512,Y=Q.clipBias!==void 0?Q.clipBias:0,X=Q.alpha!==void 0?Q.alpha:1,K=Q.time!==void 0?Q.time:0,H=Q.waterNormals!==void 0?Q.waterNormals:null,U=Q.sunDirection!==void 0?Q.sunDirection:new j(0.70707,0.70707,0),G=new R0(Q.sunColor!==void 0?Q.sunColor:16777215),F=new R0(Q.waterColor!==void 0?Q.waterColor:8355711),E=Q.eye!==void 0?Q.eye:new j(0,0,0),O=Q.distortionScale!==void 0?Q.distortionScale:20,R=Q.side!==void 0?Q.side:z9,C=Q.fog!==void 0?Q.fog:!1,q=new O9,N=new j,L=new j,M=new j,k=new S0,_=new j(0,0,-1),P=new QJ,V=new j,D=new j,B=new QJ,A=new S0,z=new kJ,S=new nJ(Z,W,{type:fJ}),y={name:"MirrorShader",uniforms:j8.merge([U0.fog,U0.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new S0},sunColor:{value:new R0(8355711)},sunDirection:{value:new j(0.70707,0.70707,0)},eye:{value:new j},waterColor:{value:new R0(5592405)}}]),vertexShader:`
4104
+ }`;class $E{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(J,Q){if(this.texture===null){let $=new dQ(J.texture);if(J.depthNear!==Q.depthNear||J.depthFar!==Q.depthFar)this.depthNear=J.depthNear,this.depthFar=J.depthFar;this.texture=$}}getMesh(J){if(this.texture!==null){if(this.mesh===null){let Q=J.cameras[0].viewport,$=new LJ({vertexShader:WD,fragmentShader:YD,uniforms:{depthColor:{value:this.texture},depthWidth:{value:Q.z},depthHeight:{value:Q.w}}});this.mesh=new a0(new C9(20,20),$)}}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class ZE extends V9{constructor(J,Q){super();let $=this,Z=null,W=1,Y=null,X="local-floor",K=1,H=null,U=null,G=null,F=null,E=null,O=null,R=typeof XRWebGLBinding<"u",k=new $E,q={},N=Q.getContextAttributes(),L=null,D=null,V=[],I=[],z=new i,B=null,M=new BJ;M.viewport=new FJ;let C=new BJ;C.viewport=new FJ;let j=[M,C],w=new pW,v=null,b=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(s){let F0=V[s];if(F0===void 0)F0=new b7,V[s]=F0;return F0.getTargetRaySpace()},this.getControllerGrip=function(s){let F0=V[s];if(F0===void 0)F0=new b7,V[s]=F0;return F0.getGripSpace()},this.getHand=function(s){let F0=V[s];if(F0===void 0)F0=new b7,V[s]=F0;return F0.getHandSpace()};function S(s){let F0=I.indexOf(s.inputSource);if(F0===-1)return;let z0=V[F0];if(z0!==void 0)z0.update(s.inputSource,s.frame,H||Y),z0.dispatchEvent({type:s.type,data:s.inputSource})}function h(){Z.removeEventListener("select",S),Z.removeEventListener("selectstart",S),Z.removeEventListener("selectend",S),Z.removeEventListener("squeeze",S),Z.removeEventListener("squeezestart",S),Z.removeEventListener("squeezeend",S),Z.removeEventListener("end",h),Z.removeEventListener("inputsourceschange",x);for(let s=0;s<V.length;s++){let F0=I[s];if(F0===null)continue;I[s]=null,V[s].disconnect(F0)}v=null,b=null,k.reset();for(let s in q)delete q[s];J.setRenderTarget(L),E=null,F=null,G=null,Z=null,D=null,d0.stop(),$.isPresenting=!1,J.setPixelRatio(B),J.setSize(z.width,z.height,!1),$.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(s){if(W=s,$.isPresenting===!0)O0("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(s){if(X=s,$.isPresenting===!0)O0("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return H||Y},this.setReferenceSpace=function(s){H=s},this.getBaseLayer=function(){return F!==null?F:E},this.getBinding=function(){if(G===null&&R)G=new XRWebGLBinding(Z,Q);return G},this.getFrame=function(){return O},this.getSession=function(){return Z},this.setSession=async function(s){if(Z=s,Z!==null){if(L=J.getRenderTarget(),Z.addEventListener("select",S),Z.addEventListener("selectstart",S),Z.addEventListener("selectend",S),Z.addEventListener("squeeze",S),Z.addEventListener("squeezestart",S),Z.addEventListener("squeezeend",S),Z.addEventListener("end",h),Z.addEventListener("inputsourceschange",x),N.xrCompatible!==!0)await Q.makeXRCompatible();if(B=J.getPixelRatio(),J.getSize(z),!(R&&("createProjectionLayer"in XRWebGLBinding.prototype))){let z0={antialias:N.antialias,alpha:!0,depth:N.depth,stencil:N.stencil,framebufferScaleFactor:W};E=new XRWebGLLayer(Z,Q,z0),Z.updateRenderState({baseLayer:E}),J.setPixelRatio(1),J.setSize(E.framebufferWidth,E.framebufferHeight,!1),D=new PJ(E.framebufferWidth,E.framebufferHeight,{format:i9,type:S9,colorSpace:J.outputColorSpace,stencilBuffer:N.stencil,resolveDepthBuffer:E.ignoreDepthValues===!1,resolveStencilBuffer:E.ignoreDepthValues===!1})}else{let z0=null,E0=null,j0=null;if(N.depth)j0=N.stencil?Q.DEPTH24_STENCIL8:Q.DEPTH_COMPONENT24,z0=N.stencil?o8:i8,E0=N.stencil?T6:z8;let WJ={colorFormat:Q.RGBA8,depthFormat:j0,scaleFactor:W};G=this.getBinding(),F=G.createProjectionLayer(WJ),Z.updateRenderState({layers:[F]}),J.setPixelRatio(1),J.setSize(F.textureWidth,F.textureHeight,!1),D=new PJ(F.textureWidth,F.textureHeight,{format:i9,type:S9,depthTexture:new P8(F.textureWidth,F.textureHeight,E0,void 0,void 0,void 0,void 0,void 0,void 0,z0),stencilBuffer:N.stencil,colorSpace:J.outputColorSpace,samples:N.antialias?4:0,resolveDepthBuffer:F.ignoreDepthValues===!1,resolveStencilBuffer:F.ignoreDepthValues===!1})}D.isXRRenderTarget=!0,this.setFoveation(K),H=null,Y=await Z.requestReferenceSpace(X),d0.setContext(Z),d0.start(),$.isPresenting=!0,$.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(Z!==null)return Z.environmentBlendMode},this.getDepthTexture=function(){return k.getDepthTexture()};function x(s){for(let F0=0;F0<s.removed.length;F0++){let z0=s.removed[F0],E0=I.indexOf(z0);if(E0>=0)I[E0]=null,V[E0].disconnect(z0)}for(let F0=0;F0<s.added.length;F0++){let z0=s.added[F0],E0=I.indexOf(z0);if(E0===-1){for(let WJ=0;WJ<V.length;WJ++)if(WJ>=I.length){I.push(z0),E0=WJ;break}else if(I[WJ]===null){I[WJ]=z0,E0=WJ;break}if(E0===-1)break}let j0=V[E0];if(j0)j0.connect(z0)}}let p=new T,c=new T;function o(s,F0,z0){p.setFromMatrixPosition(F0.matrixWorld),c.setFromMatrixPosition(z0.matrixWorld);let E0=p.distanceTo(c),j0=F0.projectionMatrix.elements,WJ=z0.projectionMatrix.elements,x0=j0[14]/(j0[10]-1),n0=j0[14]/(j0[10]+1),Q0=(j0[9]+1)/j0[5],X0=(j0[9]-1)/j0[5],$0=(j0[8]-1)/j0[0],_0=(WJ[8]+1)/WJ[0],C0=x0*$0,m0=x0*_0,y=E0/(-$0+_0),YJ=y*-$0;if(F0.matrixWorld.decompose(s.position,s.quaternion,s.scale),s.translateX(YJ),s.translateZ(y),s.matrixWorld.compose(s.position,s.quaternion,s.scale),s.matrixWorldInverse.copy(s.matrixWorld).invert(),j0[10]===-1)s.projectionMatrix.copy(F0.projectionMatrix),s.projectionMatrixInverse.copy(F0.projectionMatrixInverse);else{let h0=x0+y,l0=n0+y,U0=C0-YJ,NJ=m0+(E0-YJ),T0=Q0*n0/l0*h0,A=X0*n0/l0*h0;s.projectionMatrix.makePerspective(U0,NJ,T0,A,h0,l0),s.projectionMatrixInverse.copy(s.projectionMatrix).invert()}}function W0(s,F0){if(F0===null)s.matrixWorld.copy(s.matrix);else s.matrixWorld.multiplyMatrices(F0.matrixWorld,s.matrix);s.matrixWorldInverse.copy(s.matrixWorld).invert()}this.updateCamera=function(s){if(Z===null)return;let{near:F0,far:z0}=s;if(k.texture!==null){if(k.depthNear>0)F0=k.depthNear;if(k.depthFar>0)z0=k.depthFar}if(w.near=C.near=M.near=F0,w.far=C.far=M.far=z0,v!==w.near||b!==w.far)Z.updateRenderState({depthNear:w.near,depthFar:w.far}),v=w.near,b=w.far;w.layers.mask=s.layers.mask|6,M.layers.mask=w.layers.mask&-5,C.layers.mask=w.layers.mask&-3;let E0=s.parent,j0=w.cameras;W0(w,E0);for(let WJ=0;WJ<j0.length;WJ++)W0(j0[WJ],E0);if(j0.length===2)o(w,M,C);else w.projectionMatrix.copy(M.projectionMatrix);H0(s,w,E0)};function H0(s,F0,z0){if(z0===null)s.matrix.copy(F0.matrixWorld);else s.matrix.copy(z0.matrixWorld),s.matrix.invert(),s.matrix.multiply(F0.matrixWorld);if(s.matrix.decompose(s.position,s.quaternion,s.scale),s.updateMatrixWorld(!0),s.projectionMatrix.copy(F0.projectionMatrix),s.projectionMatrixInverse.copy(F0.projectionMatrixInverse),s.isPerspectiveCamera)s.fov=V6*2*Math.atan(1/s.projectionMatrix.elements[5]),s.zoom=1}this.getCamera=function(){return w},this.getFoveation=function(){if(F===null&&E===null)return;return K},this.setFoveation=function(s){if(K=s,F!==null)F.fixedFoveation=s;if(E!==null&&E.fixedFoveation!==void 0)E.fixedFoveation=s},this.hasDepthSensing=function(){return k.texture!==null},this.getDepthSensingMesh=function(){return k.getMesh(w)},this.getCameraTexture=function(s){return q[s]};let J0=null;function c0(s,F0){if(U=F0.getViewerPose(H||Y),O=F0,U!==null){let z0=U.views;if(E!==null)J.setRenderTargetFramebuffer(D,E.framebuffer),J.setRenderTarget(D);let E0=!1;if(z0.length!==w.cameras.length)w.cameras.length=0,E0=!0;for(let n0=0;n0<z0.length;n0++){let Q0=z0[n0],X0=null;if(E!==null)X0=E.getViewport(Q0);else{let _0=G.getViewSubImage(F,Q0);if(X0=_0.viewport,n0===0)J.setRenderTargetTextures(D,_0.colorTexture,_0.depthStencilTexture),J.setRenderTarget(D)}let $0=j[n0];if($0===void 0)$0=new BJ,$0.layers.enable(n0),$0.viewport=new FJ,j[n0]=$0;if($0.matrix.fromArray(Q0.transform.matrix),$0.matrix.decompose($0.position,$0.quaternion,$0.scale),$0.projectionMatrix.fromArray(Q0.projectionMatrix),$0.projectionMatrixInverse.copy($0.projectionMatrix).invert(),$0.viewport.set(X0.x,X0.y,X0.width,X0.height),n0===0)w.matrix.copy($0.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale);if(E0===!0)w.cameras.push($0)}let j0=Z.enabledFeatures;if(j0&&j0.includes("depth-sensing")&&Z.depthUsage=="gpu-optimized"&&R){G=$.getBinding();let n0=G.getDepthInformation(z0[0]);if(n0&&n0.isValid&&n0.texture)k.init(n0,Z.renderState)}if(j0&&j0.includes("camera-access")&&R){J.state.unbindTexture(),G=$.getBinding();for(let n0=0;n0<z0.length;n0++){let Q0=z0[n0].camera;if(Q0){let X0=q[Q0];if(!X0)X0=new dQ,q[Q0]=X0;let $0=G.getCameraImage(Q0);X0.sourceTexture=$0}}}}for(let z0=0;z0<V.length;z0++){let E0=I[z0],j0=V[z0];if(E0!==null&&j0!==void 0)j0.update(E0,F0,H||Y)}if(J0)J0(s,F0);if(F0.detectedPlanes)$.dispatchEvent({type:"planesdetected",data:F0});O=null}let d0=new l5;d0.setAnimationLoop(c0),this.setAnimationLoop=function(s){J0=s},this.dispose=function(){}}}var XD=new y0,WE=new o0;WE.set(-1,0,0,0,1,0,0,0,1);function KD(J,Q){function $(q,N){if(q.matrixAutoUpdate===!0)q.updateMatrix();N.value.copy(q.matrix)}function Z(q,N){if(N.color.getRGB(q.fogColor.value,FK(J)),N.isFog)q.fogNear.value=N.near,q.fogFar.value=N.far;else if(N.isFogExp2)q.fogDensity.value=N.density}function W(q,N,L,D,V){if(N.isNodeMaterial)N.uniformsNeedUpdate=!1;else if(N.isMeshBasicMaterial)Y(q,N);else if(N.isMeshLambertMaterial){if(Y(q,N),N.envMap)q.envMapIntensity.value=N.envMapIntensity}else if(N.isMeshToonMaterial)Y(q,N),F(q,N);else if(N.isMeshPhongMaterial){if(Y(q,N),G(q,N),N.envMap)q.envMapIntensity.value=N.envMapIntensity}else if(N.isMeshStandardMaterial){if(Y(q,N),E(q,N),N.isMeshPhysicalMaterial)O(q,N,V)}else if(N.isMeshMatcapMaterial)Y(q,N),R(q,N);else if(N.isMeshDepthMaterial)Y(q,N);else if(N.isMeshDistanceMaterial)Y(q,N),k(q,N);else if(N.isMeshNormalMaterial)Y(q,N);else if(N.isLineBasicMaterial){if(X(q,N),N.isLineDashedMaterial)K(q,N)}else if(N.isPointsMaterial)H(q,N,L,D);else if(N.isSpriteMaterial)U(q,N);else if(N.isShadowMaterial)q.color.value.copy(N.color),q.opacity.value=N.opacity;else if(N.isShaderMaterial)N.uniformsNeedUpdate=!1}function Y(q,N){if(q.opacity.value=N.opacity,N.color)q.diffuse.value.copy(N.color);if(N.emissive)q.emissive.value.copy(N.emissive).multiplyScalar(N.emissiveIntensity);if(N.map)q.map.value=N.map,$(N.map,q.mapTransform);if(N.alphaMap)q.alphaMap.value=N.alphaMap,$(N.alphaMap,q.alphaMapTransform);if(N.bumpMap){if(q.bumpMap.value=N.bumpMap,$(N.bumpMap,q.bumpMapTransform),q.bumpScale.value=N.bumpScale,N.side===pJ)q.bumpScale.value*=-1}if(N.normalMap){if(q.normalMap.value=N.normalMap,$(N.normalMap,q.normalMapTransform),q.normalScale.value.copy(N.normalScale),N.side===pJ)q.normalScale.value.negate()}if(N.displacementMap)q.displacementMap.value=N.displacementMap,$(N.displacementMap,q.displacementMapTransform),q.displacementScale.value=N.displacementScale,q.displacementBias.value=N.displacementBias;if(N.emissiveMap)q.emissiveMap.value=N.emissiveMap,$(N.emissiveMap,q.emissiveMapTransform);if(N.specularMap)q.specularMap.value=N.specularMap,$(N.specularMap,q.specularMapTransform);if(N.alphaTest>0)q.alphaTest.value=N.alphaTest;let L=Q.get(N),D=L.envMap,V=L.envMapRotation;if(D){if(q.envMap.value=D,q.envMapRotation.value.setFromMatrix4(XD.makeRotationFromEuler(V)).transpose(),D.isCubeTexture&&D.isRenderTargetTexture===!1)q.envMapRotation.value.premultiply(WE);q.reflectivity.value=N.reflectivity,q.ior.value=N.ior,q.refractionRatio.value=N.refractionRatio}if(N.lightMap)q.lightMap.value=N.lightMap,q.lightMapIntensity.value=N.lightMapIntensity,$(N.lightMap,q.lightMapTransform);if(N.aoMap)q.aoMap.value=N.aoMap,q.aoMapIntensity.value=N.aoMapIntensity,$(N.aoMap,q.aoMapTransform)}function X(q,N){if(q.diffuse.value.copy(N.color),q.opacity.value=N.opacity,N.map)q.map.value=N.map,$(N.map,q.mapTransform)}function K(q,N){q.dashSize.value=N.dashSize,q.totalSize.value=N.dashSize+N.gapSize,q.scale.value=N.scale}function H(q,N,L,D){if(q.diffuse.value.copy(N.color),q.opacity.value=N.opacity,q.size.value=N.size*L,q.scale.value=D*0.5,N.map)q.map.value=N.map,$(N.map,q.uvTransform);if(N.alphaMap)q.alphaMap.value=N.alphaMap,$(N.alphaMap,q.alphaMapTransform);if(N.alphaTest>0)q.alphaTest.value=N.alphaTest}function U(q,N){if(q.diffuse.value.copy(N.color),q.opacity.value=N.opacity,q.rotation.value=N.rotation,N.map)q.map.value=N.map,$(N.map,q.mapTransform);if(N.alphaMap)q.alphaMap.value=N.alphaMap,$(N.alphaMap,q.alphaMapTransform);if(N.alphaTest>0)q.alphaTest.value=N.alphaTest}function G(q,N){q.specular.value.copy(N.specular),q.shininess.value=Math.max(N.shininess,0.0001)}function F(q,N){if(N.gradientMap)q.gradientMap.value=N.gradientMap}function E(q,N){if(q.metalness.value=N.metalness,N.metalnessMap)q.metalnessMap.value=N.metalnessMap,$(N.metalnessMap,q.metalnessMapTransform);if(q.roughness.value=N.roughness,N.roughnessMap)q.roughnessMap.value=N.roughnessMap,$(N.roughnessMap,q.roughnessMapTransform);if(N.envMap)q.envMapIntensity.value=N.envMapIntensity}function O(q,N,L){if(q.ior.value=N.ior,N.sheen>0){if(q.sheenColor.value.copy(N.sheenColor).multiplyScalar(N.sheen),q.sheenRoughness.value=N.sheenRoughness,N.sheenColorMap)q.sheenColorMap.value=N.sheenColorMap,$(N.sheenColorMap,q.sheenColorMapTransform);if(N.sheenRoughnessMap)q.sheenRoughnessMap.value=N.sheenRoughnessMap,$(N.sheenRoughnessMap,q.sheenRoughnessMapTransform)}if(N.clearcoat>0){if(q.clearcoat.value=N.clearcoat,q.clearcoatRoughness.value=N.clearcoatRoughness,N.clearcoatMap)q.clearcoatMap.value=N.clearcoatMap,$(N.clearcoatMap,q.clearcoatMapTransform);if(N.clearcoatRoughnessMap)q.clearcoatRoughnessMap.value=N.clearcoatRoughnessMap,$(N.clearcoatRoughnessMap,q.clearcoatRoughnessMapTransform);if(N.clearcoatNormalMap){if(q.clearcoatNormalMap.value=N.clearcoatNormalMap,$(N.clearcoatNormalMap,q.clearcoatNormalMapTransform),q.clearcoatNormalScale.value.copy(N.clearcoatNormalScale),N.side===pJ)q.clearcoatNormalScale.value.negate()}}if(N.dispersion>0)q.dispersion.value=N.dispersion;if(N.iridescence>0){if(q.iridescence.value=N.iridescence,q.iridescenceIOR.value=N.iridescenceIOR,q.iridescenceThicknessMinimum.value=N.iridescenceThicknessRange[0],q.iridescenceThicknessMaximum.value=N.iridescenceThicknessRange[1],N.iridescenceMap)q.iridescenceMap.value=N.iridescenceMap,$(N.iridescenceMap,q.iridescenceMapTransform);if(N.iridescenceThicknessMap)q.iridescenceThicknessMap.value=N.iridescenceThicknessMap,$(N.iridescenceThicknessMap,q.iridescenceThicknessMapTransform)}if(N.transmission>0){if(q.transmission.value=N.transmission,q.transmissionSamplerMap.value=L.texture,q.transmissionSamplerSize.value.set(L.width,L.height),N.transmissionMap)q.transmissionMap.value=N.transmissionMap,$(N.transmissionMap,q.transmissionMapTransform);if(q.thickness.value=N.thickness,N.thicknessMap)q.thicknessMap.value=N.thicknessMap,$(N.thicknessMap,q.thicknessMapTransform);q.attenuationDistance.value=N.attenuationDistance,q.attenuationColor.value.copy(N.attenuationColor)}if(N.anisotropy>0){if(q.anisotropyVector.value.set(N.anisotropy*Math.cos(N.anisotropyRotation),N.anisotropy*Math.sin(N.anisotropyRotation)),N.anisotropyMap)q.anisotropyMap.value=N.anisotropyMap,$(N.anisotropyMap,q.anisotropyMapTransform)}if(q.specularIntensity.value=N.specularIntensity,q.specularColor.value.copy(N.specularColor),N.specularColorMap)q.specularColorMap.value=N.specularColorMap,$(N.specularColorMap,q.specularColorMapTransform);if(N.specularIntensityMap)q.specularIntensityMap.value=N.specularIntensityMap,$(N.specularIntensityMap,q.specularIntensityMapTransform)}function R(q,N){if(N.matcap)q.matcap.value=N.matcap}function k(q,N){let L=Q.get(N).light;q.referencePosition.value.setFromMatrixPosition(L.matrixWorld),q.nearDistance.value=L.shadow.camera.near,q.farDistance.value=L.shadow.camera.far}return{refreshFogUniforms:Z,refreshMaterialUniforms:W}}function HD(J,Q,$,Z){let W={},Y={},X=[],K=J.getParameter(J.MAX_UNIFORM_BUFFER_BINDINGS);function H(L,D){let V=D.program;Z.uniformBlockBinding(L,V)}function U(L,D){let V=W[L.id];if(V===void 0)R(L),V=G(L),W[L.id]=V,L.addEventListener("dispose",q);let I=D.program;Z.updateUBOMapping(L,I);let z=Q.render.frame;if(Y[L.id]!==z)E(L),Y[L.id]=z}function G(L){let D=F();L.__bindingPointIndex=D;let V=J.createBuffer(),I=L.__size,z=L.usage;return J.bindBuffer(J.UNIFORM_BUFFER,V),J.bufferData(J.UNIFORM_BUFFER,I,z),J.bindBuffer(J.UNIFORM_BUFFER,null),J.bindBufferBase(J.UNIFORM_BUFFER,D,V),V}function F(){for(let L=0;L<K;L++)if(X.indexOf(L)===-1)return X.push(L),L;return v0("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function E(L){let D=W[L.id],V=L.uniforms,I=L.__cache;J.bindBuffer(J.UNIFORM_BUFFER,D);for(let z=0,B=V.length;z<B;z++){let M=Array.isArray(V[z])?V[z]:[V[z]];for(let C=0,j=M.length;C<j;C++){let w=M[C];if(O(w,z,C,I)===!0){let v=w.__offset,b=Array.isArray(w.value)?w.value:[w.value],S=0;for(let h=0;h<b.length;h++){let x=b[h],p=k(x);if(typeof x==="number"||typeof x==="boolean")w.__data[0]=x,J.bufferSubData(J.UNIFORM_BUFFER,v+S,w.__data);else if(x.isMatrix3)w.__data[0]=x.elements[0],w.__data[1]=x.elements[1],w.__data[2]=x.elements[2],w.__data[3]=0,w.__data[4]=x.elements[3],w.__data[5]=x.elements[4],w.__data[6]=x.elements[5],w.__data[7]=0,w.__data[8]=x.elements[6],w.__data[9]=x.elements[7],w.__data[10]=x.elements[8],w.__data[11]=0;else if(ArrayBuffer.isView(x))w.__data.set(new x.constructor(x.buffer,x.byteOffset,w.__data.length));else x.toArray(w.__data,S),S+=p.storage/Float32Array.BYTES_PER_ELEMENT}J.bufferSubData(J.UNIFORM_BUFFER,v,w.__data)}}}J.bindBuffer(J.UNIFORM_BUFFER,null)}function O(L,D,V,I){let z=L.value,B=D+"_"+V;if(I[B]===void 0){if(typeof z==="number"||typeof z==="boolean")I[B]=z;else if(ArrayBuffer.isView(z))I[B]=z.slice();else I[B]=z.clone();return!0}else{let M=I[B];if(typeof z==="number"||typeof z==="boolean"){if(M!==z)return I[B]=z,!0}else if(ArrayBuffer.isView(z))return!0;else if(M.equals(z)===!1)return M.copy(z),!0}return!1}function R(L){let D=L.uniforms,V=0,I=16;for(let B=0,M=D.length;B<M;B++){let C=Array.isArray(D[B])?D[B]:[D[B]];for(let j=0,w=C.length;j<w;j++){let v=C[j],b=Array.isArray(v.value)?v.value:[v.value];for(let S=0,h=b.length;S<h;S++){let x=b[S],p=k(x),c=V%I,o=c%p.boundary,W0=c+o;if(V+=o,W0!==0&&I-W0<p.storage)V+=I-W0;v.__data=new Float32Array(p.storage/Float32Array.BYTES_PER_ELEMENT),v.__offset=V,V+=p.storage}}}let z=V%I;if(z>0)V+=I-z;return L.__size=V,L.__cache={},this}function k(L){let D={boundary:0,storage:0};if(typeof L==="number"||typeof L==="boolean")D.boundary=4,D.storage=4;else if(L.isVector2)D.boundary=8,D.storage=8;else if(L.isVector3||L.isColor)D.boundary=16,D.storage=12;else if(L.isVector4)D.boundary=16,D.storage=16;else if(L.isMatrix3)D.boundary=48,D.storage=48;else if(L.isMatrix4)D.boundary=64,D.storage=64;else if(L.isTexture)O0("WebGLRenderer: Texture samplers can not be part of an uniforms group.");else if(ArrayBuffer.isView(L))D.boundary=16,D.storage=L.byteLength;else O0("WebGLRenderer: Unsupported uniform value type.",L);return D}function q(L){let D=L.target;D.removeEventListener("dispose",q);let V=X.indexOf(D.__bindingPointIndex);X.splice(V,1),J.deleteBuffer(W[D.id]),delete W[D.id],delete Y[D.id]}function N(){for(let L in W)J.deleteBuffer(W[L]);X=[],W={},Y={}}return{bind:H,update:U,dispose:N}}var UD=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,14942,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]),F8=null;function GD(){if(F8===null)F8=new k9(UD,16,16,a8,wJ),F8.name="DFG_LUT",F8.minFilter=jJ,F8.magFilter=jJ,F8.wrapS=w6,F8.wrapT=w6,F8.generateMipmaps=!1,F8.needsUpdate=!0;return F8}class tW{constructor(J={}){let{canvas:Q=oX(),context:$=null,depth:Z=!0,stencil:W=!1,alpha:Y=!1,antialias:X=!1,premultipliedAlpha:K=!0,preserveDrawingBuffer:H=!1,powerPreference:U="default",failIfMajorPerformanceCaveat:G=!1,reversedDepthBuffer:F=!1,outputBufferType:E=S9}=J;this.isWebGLRenderer=!0;let O;if($!==null){if(typeof WebGLRenderingContext<"u"&&$ instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");O=$.getContextAttributes().alpha}else O=Y;let R=E,k=new Set([TZ,PZ,wZ]),q=new Set([S9,z8,S7,T6,zZ,_Z]),N=new Uint32Array(4),L=new Int32Array(4),D=new T,V=null,I=null,z=[],B=[],M=null;this.domElement=Q,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=E9,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let C=this,j=!1,w=null;this._outputColorSpace=_8;let v=0,b=0,S=null,h=-1,x=null,p=new FJ,c=new FJ,o=null,W0=new e(0),H0=0,J0=Q.width,c0=Q.height,d0=1,s=null,F0=null,z0=new FJ(0,0,J0,c0),E0=new FJ(0,0,J0,c0),j0=!1,WJ=new H8,x0=!1,n0=!1,Q0=new y0,X0=new T,$0=new FJ,_0={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},C0=!1;function m0(){return S===null?d0:1}let y=$;function YJ(P,g){return Q.getContext(P,g)}try{let P={alpha:!0,depth:Z,stencil:W,antialias:X,premultipliedAlpha:K,preserveDrawingBuffer:H,powerPreference:U,failIfMajorPerformanceCaveat:G};if("setAttribute"in Q)Q.setAttribute("data-engine",`three.js r${QX}`);if(Q.addEventListener("webglcontextlost",S0,!1),Q.addEventListener("webglcontextrestored",Y0,!1),Q.addEventListener("webglcontextcreationerror",f0,!1),y===null){if(y=YJ("webgl2",P),y===null)if(YJ("webgl2"))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(P){throw v0("WebGLRenderer: "+P.message),P}let h0,l0,U0,NJ,T0,A,_,u,r,Z0,K0,D0,n,t,R0,A0,N0,k0,r0,$J,XJ,f,q0;function a(){if(h0=new DR(y),h0.init(),XJ=new QE(y,h0),l0=new GR(y,h0,J,XJ),U0=new $D(y,h0),l0.reversedDepthBuffer&&F)U0.buffers.depth.setReversed(!0);NJ=new VR(y),T0=new dL,A=new ZD(y,h0,U0,T0,l0,XJ,NJ),_=new LR(C),u=new zN(y),f=new HR(y,u),r=new kR(y,u,NJ,f),Z0=new CR(y,r,u,f,NJ),k0=new BR(y,l0,A),R0=new ER(T0),K0=new uL(C,_,h0,l0,f,R0),D0=new KD(C,T0),n=new lL,t=new aL(h0),N0=new KR(C,_,U0,Z0,O,K),A0=new QD(C,Z0,l0),q0=new HD(y,NJ,l0,U0),r0=new UR(y,h0,NJ),$J=new MR(y,h0,NJ),NJ.programs=K0.programs,C.capabilities=l0,C.extensions=h0,C.properties=T0,C.renderLists=n,C.shadowMap=A0,C.state=U0,C.info=NJ}if(a(),R!==S9)M=new zR(R,Q.width,Q.height,Z,W);let G0=new ZE(C,y);this.xr=G0,this.getContext=function(){return y},this.getContextAttributes=function(){return y.getContextAttributes()},this.forceContextLoss=function(){let P=h0.get("WEBGL_lose_context");if(P)P.loseContext()},this.forceContextRestore=function(){let P=h0.get("WEBGL_lose_context");if(P)P.restoreContext()},this.getPixelRatio=function(){return d0},this.setPixelRatio=function(P){if(P===void 0)return;d0=P,this.setSize(J0,c0,!1)},this.getSize=function(P){return P.set(J0,c0)},this.setSize=function(P,g,l=!0){if(G0.isPresenting){O0("WebGLRenderer: Can't change size while VR device is presenting.");return}if(J0=P,c0=g,Q.width=Math.floor(P*d0),Q.height=Math.floor(g*d0),l===!0)Q.style.width=P+"px",Q.style.height=g+"px";if(M!==null)M.setSize(Q.width,Q.height);this.setViewport(0,0,P,g)},this.getDrawingBufferSize=function(P){return P.set(J0*d0,c0*d0).floor()},this.setDrawingBufferSize=function(P,g,l){J0=P,c0=g,d0=l,Q.width=Math.floor(P*l),Q.height=Math.floor(g*l),this.setViewport(0,0,P,g)},this.setEffects=function(P){if(R===S9){v0("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(P){for(let g=0;g<P.length;g++)if(P[g].isOutputPass===!0){O0("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}M.setEffects(P||[])},this.getCurrentViewport=function(P){return P.copy(p)},this.getViewport=function(P){return P.copy(z0)},this.setViewport=function(P,g,l,d){if(P.isVector4)z0.set(P.x,P.y,P.z,P.w);else z0.set(P,g,l,d);U0.viewport(p.copy(z0).multiplyScalar(d0).round())},this.getScissor=function(P){return P.copy(E0)},this.setScissor=function(P,g,l,d){if(P.isVector4)E0.set(P.x,P.y,P.z,P.w);else E0.set(P,g,l,d);U0.scissor(c.copy(E0).multiplyScalar(d0).round())},this.getScissorTest=function(){return j0},this.setScissorTest=function(P){U0.setScissorTest(j0=P)},this.setOpaqueSort=function(P){s=P},this.setTransparentSort=function(P){F0=P},this.getClearColor=function(P){return P.copy(N0.getClearColor())},this.setClearColor=function(){N0.setClearColor(...arguments)},this.getClearAlpha=function(){return N0.getClearAlpha()},this.setClearAlpha=function(){N0.setClearAlpha(...arguments)},this.clear=function(P=!0,g=!0,l=!0){let d=0;if(P){let m=!1;if(S!==null){let B0=S.texture.format;m=k.has(B0)}if(m){let B0=S.texture.type,P0=q.has(B0),M0=N0.getClearColor(),b0=N0.getClearAlpha(),g0=M0.r,JJ=M0.g,KJ=M0.b;if(P0)N[0]=g0,N[1]=JJ,N[2]=KJ,N[3]=b0,y.clearBufferuiv(y.COLOR,0,N);else L[0]=g0,L[1]=JJ,L[2]=KJ,L[3]=b0,y.clearBufferiv(y.COLOR,0,L)}else d|=y.COLOR_BUFFER_BIT}if(g)d|=y.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0);if(l)d|=y.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295);if(d!==0)y.clear(d)},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(P){P.setRenderer(this),w=P},this.dispose=function(){Q.removeEventListener("webglcontextlost",S0,!1),Q.removeEventListener("webglcontextrestored",Y0,!1),Q.removeEventListener("webglcontextcreationerror",f0,!1),N0.dispose(),n.dispose(),t.dispose(),T0.dispose(),_.dispose(),Z0.dispose(),f.dispose(),q0.dispose(),K0.dispose(),G0.dispose(),G0.removeEventListener("sessionstart",jH),G0.removeEventListener("sessionend",vH),X6.stop()};function S0(P){P.preventDefault(),M7("WebGLRenderer: Context Lost."),j=!0}function Y0(){M7("WebGLRenderer: Context Restored."),j=!1;let P=NJ.autoReset,g=A0.enabled,l=A0.autoUpdate,d=A0.needsUpdate,m=A0.type;a(),NJ.autoReset=P,A0.enabled=g,A0.autoUpdate=l,A0.needsUpdate=d,A0.type=m}function f0(P){v0("WebGLRenderer: A WebGL context could not be created. Reason: ",P.statusMessage)}function e0(P){let g=P.target;g.removeEventListener("dispose",e0),fJ(g)}function fJ(P){qJ(P),T0.remove(P)}function qJ(P){let g=T0.get(P).programs;if(g!==void 0){if(g.forEach(function(l){K0.releaseProgram(l)}),P.isShaderMaterial)K0.releaseShaderCache(P)}}this.renderBufferDirect=function(P,g,l,d,m,B0){if(g===null)g=_0;let P0=m.isMesh&&m.matrixWorld.determinant()<0,M0=B1(P,g,l,d,m);U0.setMaterial(d,P0);let b0=l.index,g0=1;if(d.wireframe===!0){if(b0=r.getWireframeAttribute(l),b0===void 0)return;g0=2}let JJ=l.drawRange,KJ=l.attributes.position,p0=JJ.start*g0,RJ=(JJ.start+JJ.count)*g0;if(B0!==null)p0=Math.max(p0,B0.start*g0),RJ=Math.min(RJ,(B0.start+B0.count)*g0);if(b0!==null)p0=Math.max(p0,0),RJ=Math.min(RJ,b0.count);else if(KJ!==void 0&&KJ!==null)p0=Math.max(p0,0),RJ=Math.min(RJ,KJ.count);let yJ=RJ-p0;if(yJ<0||yJ===1/0)return;f.setup(m,d,M0,l,b0);let TJ,DJ=r0;if(b0!==null)TJ=u.get(b0),DJ=$J,DJ.setIndex(TJ);if(m.isMesh)if(d.wireframe===!0)U0.setLineWidth(d.wireframeLinewidth*m0()),DJ.setMode(y.LINES);else DJ.setMode(y.TRIANGLES);else if(m.isLine){let oJ=d.linewidth;if(oJ===void 0)oJ=1;if(U0.setLineWidth(oJ*m0()),m.isLineSegments)DJ.setMode(y.LINES);else if(m.isLineLoop)DJ.setMode(y.LINE_LOOP);else DJ.setMode(y.LINE_STRIP)}else if(m.isPoints)DJ.setMode(y.POINTS);else if(m.isSprite)DJ.setMode(y.TRIANGLES);if(m.isBatchedMesh)if(!h0.get("WEBGL_multi_draw")){let{_multiDrawStarts:oJ,_multiDrawCounts:w0,_multiDrawCount:q9}=m,EJ=b0?u.get(b0).bytesPerElement:1,I9=T0.get(d).currentProgram.getUniforms();for(let J8=0;J8<q9;J8++)I9.setValue(y,"_gl_DrawID",J8),DJ.render(oJ[J8]/EJ,w0[J8])}else DJ.renderMultiDraw(m._multiDrawStarts,m._multiDrawCounts,m._multiDrawCount);else if(m.isInstancedMesh)DJ.renderInstances(p0,yJ,m.count);else if(l.isInstancedBufferGeometry){let oJ=l._maxInstanceCount!==void 0?l._maxInstanceCount:1/0,w0=Math.min(l.instanceCount,oJ);DJ.renderInstances(p0,yJ,w0)}else DJ.render(p0,yJ)};function e9(P,g,l){if(P.transparent===!0&&P.side===Y9&&P.forceSinglePass===!1)P.side=pJ,P.needsUpdate=!0,w$(P,g,l),P.side=n9,P.needsUpdate=!0,w$(P,g,l),P.side=Y9;else w$(P,g,l)}this.compile=function(P,g,l=null){if(l===null)l=P;if(I=t.get(l),I.init(g),B.push(I),l.traverseVisible(function(m){if(m.isLight&&m.layers.test(g.layers)){if(I.pushLight(m),m.castShadow)I.pushShadow(m)}}),P!==l)P.traverseVisible(function(m){if(m.isLight&&m.layers.test(g.layers)){if(I.pushLight(m),m.castShadow)I.pushShadow(m)}});I.setupLights();let d=new Set;return P.traverse(function(m){if(!(m.isMesh||m.isPoints||m.isLine||m.isSprite))return;let B0=m.material;if(B0)if(Array.isArray(B0))for(let P0=0;P0<B0.length;P0++){let M0=B0[P0];e9(M0,l,m),d.add(M0)}else e9(B0,l,m),d.add(B0)}),I=B.pop(),d},this.compileAsync=function(P,g,l=null){let d=this.compile(P,g,l);return new Promise((m)=>{function B0(){if(d.forEach(function(P0){if(T0.get(P0).currentProgram.isReady())d.delete(P0)}),d.size===0){m(P);return}setTimeout(B0,10)}if(h0.get("KHR_parallel_shader_compile")!==null)B0();else setTimeout(B0,10)})};let f9=null;function M1(P){if(f9)f9(P)}function jH(){X6.stop()}function vH(){X6.start()}let X6=new l5;if(X6.setAnimationLoop(M1),typeof self<"u")X6.setContext(self);this.setAnimationLoop=function(P){f9=P,G0.setAnimationLoop(P),P===null?X6.stop():X6.start()},G0.addEventListener("sessionstart",jH),G0.addEventListener("sessionend",vH),this.render=function(P,g){if(g!==void 0&&g.isCamera!==!0){v0("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(j===!0)return;if(w!==null)w.renderStart(P,g);let l=G0.enabled===!0&&G0.isPresenting===!0,d=M!==null&&(S===null||l)&&M.begin(C,S);if(P.matrixWorldAutoUpdate===!0)P.updateMatrixWorld();if(g.parent===null&&g.matrixWorldAutoUpdate===!0)g.updateMatrixWorld();if(G0.enabled===!0&&G0.isPresenting===!0&&(M===null||M.isCompositing()===!1)){if(G0.cameraAutoUpdate===!0)G0.updateCamera(g);g=G0.getCamera()}if(P.isScene===!0)P.onBeforeRender(C,P,g,S);if(I=t.get(P,B.length),I.init(g),I.state.textureUnits=A.getTextureUnits(),B.push(I),Q0.multiplyMatrices(g.projectionMatrix,g.matrixWorldInverse),WJ.setFromProjectionMatrix(Q0,EW,g.reversedDepth),n0=this.localClippingEnabled,x0=R0.init(this.clippingPlanes,n0),V=n.get(P,z.length),V.init(),z.push(V),G0.enabled===!0&&G0.isPresenting===!0){let P0=C.xr.getDepthSensingMesh();if(P0!==null)EY(P0,g,-1/0,C.sortObjects)}if(EY(P,g,0,C.sortObjects),V.finish(),C.sortObjects===!0)V.sort(s,F0);if(C0=G0.enabled===!1||G0.isPresenting===!1||G0.hasDepthSensing()===!1,C0)N0.addToRenderList(V,P);if(this.info.render.frame++,x0===!0)R0.beginShadows();let m=I.state.shadowsArray;if(A0.render(m,P,g),x0===!0)R0.endShadows();if(this.info.autoReset===!0)this.info.reset();if((d&&M.hasRenderPass())===!1){let{opaque:P0,transmissive:M0}=V;if(I.setupLights(),g.isArrayCamera){let b0=g.cameras;if(M0.length>0)for(let g0=0,JJ=b0.length;g0<JJ;g0++){let KJ=b0[g0];xH(P0,M0,P,KJ)}if(C0)N0.render(P);for(let g0=0,JJ=b0.length;g0<JJ;g0++){let KJ=b0[g0];yH(V,P,KJ,KJ.viewport)}}else{if(M0.length>0)xH(P0,M0,P,g);if(C0)N0.render(P);yH(V,P,g)}}if(S!==null&&b===0)A.updateMultisampleRenderTarget(S),A.updateRenderTargetMipmap(S);if(d)M.end(C);if(P.isScene===!0)P.onAfterRender(C,P,g);if(f.resetDefaultState(),h=-1,x=null,B.pop(),B.length>0){if(I=B[B.length-1],A.setTextureUnits(I.state.textureUnits),x0===!0)R0.setGlobalState(C.clippingPlanes,I.state.camera)}else I=null;if(z.pop(),z.length>0)V=z[z.length-1];else V=null;if(w!==null)w.renderEnd()};function EY(P,g,l,d){if(P.visible===!1)return;if(P.layers.test(g.layers)){if(P.isGroup)l=P.renderOrder;else if(P.isLOD){if(P.autoUpdate===!0)P.update(g)}else if(P.isLightProbeGrid)I.pushLightProbeGrid(P);else if(P.isLight){if(I.pushLight(P),P.castShadow)I.pushShadow(P)}else if(P.isSprite){if(!P.frustumCulled||WJ.intersectsSprite(P)){if(d)$0.setFromMatrixPosition(P.matrixWorld).applyMatrix4(Q0);let P0=Z0.update(P),M0=P.material;if(M0.visible)V.push(P,P0,M0,l,$0.z,null)}}else if(P.isMesh||P.isLine||P.isPoints){if(!P.frustumCulled||WJ.intersectsObject(P)){let P0=Z0.update(P),M0=P.material;if(d){if(P.boundingSphere!==void 0){if(P.boundingSphere===null)P.computeBoundingSphere();$0.copy(P.boundingSphere.center)}else{if(P0.boundingSphere===null)P0.computeBoundingSphere();$0.copy(P0.boundingSphere.center)}$0.applyMatrix4(P.matrixWorld).applyMatrix4(Q0)}if(Array.isArray(M0)){let b0=P0.groups;for(let g0=0,JJ=b0.length;g0<JJ;g0++){let KJ=b0[g0],p0=M0[KJ.materialIndex];if(p0&&p0.visible)V.push(P,P0,p0,l,$0.z,KJ)}}else if(M0.visible)V.push(P,P0,M0,l,$0.z,null)}}}let B0=P.children;for(let P0=0,M0=B0.length;P0<M0;P0++)EY(B0[P0],g,l,d)}function yH(P,g,l,d){let{opaque:m,transmissive:B0,transparent:P0}=P;if(I.setupLightsView(l),x0===!0)R0.setGlobalState(C.clippingPlanes,l);if(d)U0.viewport(p.copy(d));if(m.length>0)_$(m,g,l);if(B0.length>0)_$(B0,g,l);if(P0.length>0)_$(P0,g,l);U0.buffers.depth.setTest(!0),U0.buffers.depth.setMask(!0),U0.buffers.color.setMask(!0),U0.setPolygonOffset(!1)}function xH(P,g,l,d){if((l.isScene===!0?l.overrideMaterial:null)!==null)return;if(I.state.transmissionRenderTarget[d.id]===void 0){let p0=h0.has("EXT_color_buffer_half_float")||h0.has("EXT_color_buffer_float");I.state.transmissionRenderTarget[d.id]=new PJ(1,1,{generateMipmaps:!0,type:p0?wJ:S9,minFilter:s9,samples:Math.max(4,l0.samples),stencilBuffer:W,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:t0.workingColorSpace})}let B0=I.state.transmissionRenderTarget[d.id],P0=d.viewport||p;B0.setSize(P0.z*C.transmissionResolutionScale,P0.w*C.transmissionResolutionScale);let M0=C.getRenderTarget(),b0=C.getActiveCubeFace(),g0=C.getActiveMipmapLevel();if(C.setRenderTarget(B0),C.getClearColor(W0),H0=C.getClearAlpha(),H0<1)C.setClearColor(16777215,0.5);if(C.clear(),C0)N0.render(l);let JJ=C.toneMapping;C.toneMapping=E9;let KJ=d.viewport;if(d.viewport!==void 0)d.viewport=void 0;if(I.setupLightsView(d),x0===!0)R0.setGlobalState(C.clippingPlanes,d);if(_$(P,l,d),A.updateMultisampleRenderTarget(B0),A.updateRenderTargetMipmap(B0),h0.has("WEBGL_multisampled_render_to_texture")===!1){let p0=!1;for(let RJ=0,yJ=g.length;RJ<yJ;RJ++){let TJ=g[RJ],{object:DJ,geometry:oJ,material:w0,group:q9}=TJ;if(w0.side===Y9&&DJ.layers.test(d.layers)){let EJ=w0.side;w0.side=pJ,w0.needsUpdate=!0,bH(DJ,l,d,oJ,w0,q9),w0.side=EJ,w0.needsUpdate=!0,p0=!0}}if(p0===!0)A.updateMultisampleRenderTarget(B0),A.updateRenderTargetMipmap(B0)}if(C.setRenderTarget(M0,b0,g0),C.setClearColor(W0,H0),KJ!==void 0)d.viewport=KJ;C.toneMapping=JJ}function _$(P,g,l){let d=g.isScene===!0?g.overrideMaterial:null;for(let m=0,B0=P.length;m<B0;m++){let P0=P[m],{object:M0,geometry:b0,group:g0}=P0,JJ=P0.material;if(JJ.allowOverride===!0&&d!==null)JJ=d;if(M0.layers.test(l.layers))bH(M0,g,l,b0,JJ,g0)}}function bH(P,g,l,d,m,B0){if(P.onBeforeRender(C,g,l,d,m,B0),P.modelViewMatrix.multiplyMatrices(l.matrixWorldInverse,P.matrixWorld),P.normalMatrix.getNormalMatrix(P.modelViewMatrix),m.onBeforeRender(C,g,l,d,P,B0),m.transparent===!0&&m.side===Y9&&m.forceSinglePass===!1)m.side=pJ,m.needsUpdate=!0,C.renderBufferDirect(l,g,d,m,P,B0),m.side=n9,m.needsUpdate=!0,C.renderBufferDirect(l,g,d,m,P,B0),m.side=Y9;else C.renderBufferDirect(l,g,d,m,P,B0);P.onAfterRender(C,g,l,d,m,B0)}function w$(P,g,l){if(g.isScene!==!0)g=_0;let d=T0.get(P),m=I.state.lights,B0=I.state.shadowsArray,P0=m.state.version,M0=K0.getParameters(P,m.state,B0,g,l,I.state.lightProbeGridArray),b0=K0.getProgramCacheKey(M0),g0=d.programs;d.environment=P.isMeshStandardMaterial||P.isMeshLambertMaterial||P.isMeshPhongMaterial?g.environment:null,d.fog=g.fog;let JJ=P.isMeshStandardMaterial||P.isMeshLambertMaterial&&!P.envMap||P.isMeshPhongMaterial&&!P.envMap;if(d.envMap=_.get(P.envMap||d.environment,JJ),d.envMapRotation=d.environment!==null&&P.envMap===null?g.environmentRotation:P.envMapRotation,g0===void 0)P.addEventListener("dispose",e0),g0=new Map,d.programs=g0;let KJ=g0.get(b0);if(KJ!==void 0){if(d.currentProgram===KJ&&d.lightsStateVersion===P0)return fH(P,M0),KJ}else{if(M0.uniforms=K0.getUniforms(P),w!==null&&P.isNodeMaterial)w.build(P,l,M0);P.onBeforeCompile(M0,C),KJ=K0.acquireProgram(M0,b0),g0.set(b0,KJ),d.uniforms=M0.uniforms}let p0=d.uniforms;if(!P.isShaderMaterial&&!P.isRawShaderMaterial||P.clipping===!0)p0.clippingPlanes=R0.uniform;if(fH(P,M0),d.needsLights=I1(P),d.lightsStateVersion=P0,d.needsLights)p0.ambientLightColor.value=m.state.ambient,p0.lightProbe.value=m.state.probe,p0.directionalLights.value=m.state.directional,p0.directionalLightShadows.value=m.state.directionalShadow,p0.spotLights.value=m.state.spot,p0.spotLightShadows.value=m.state.spotShadow,p0.rectAreaLights.value=m.state.rectArea,p0.ltc_1.value=m.state.rectAreaLTC1,p0.ltc_2.value=m.state.rectAreaLTC2,p0.pointLights.value=m.state.point,p0.pointLightShadows.value=m.state.pointShadow,p0.hemisphereLights.value=m.state.hemi,p0.directionalShadowMatrix.value=m.state.directionalShadowMatrix,p0.spotLightMatrix.value=m.state.spotLightMatrix,p0.spotLightMap.value=m.state.spotLightMap,p0.pointShadowMatrix.value=m.state.pointShadowMatrix;return d.lightProbeGrid=I.state.lightProbeGridArray.length>0,d.currentProgram=KJ,d.uniformsList=null,KJ}function hH(P){if(P.uniformsList===null){let g=P.currentProgram.getUniforms();P.uniformsList=D$.seqWithValue(g.seq,P.uniforms)}return P.uniformsList}function fH(P,g){let l=T0.get(P);l.outputColorSpace=g.outputColorSpace,l.batching=g.batching,l.batchingColor=g.batchingColor,l.instancing=g.instancing,l.instancingColor=g.instancingColor,l.instancingMorph=g.instancingMorph,l.skinning=g.skinning,l.morphTargets=g.morphTargets,l.morphNormals=g.morphNormals,l.morphColors=g.morphColors,l.morphTargetsCount=g.morphTargetsCount,l.numClippingPlanes=g.numClippingPlanes,l.numIntersection=g.numClipIntersection,l.vertexAlphas=g.vertexAlphas,l.vertexTangents=g.vertexTangents,l.toneMapping=g.toneMapping}function V1(P,g){if(P.length===0)return null;if(P.length===1)return P[0].texture!==null?P[0]:null;D.setFromMatrixPosition(g.matrixWorld);for(let l=0,d=P.length;l<d;l++){let m=P[l];if(m.texture!==null&&m.boundingBox.containsPoint(D))return m}return null}function B1(P,g,l,d,m){if(g.isScene!==!0)g=_0;A.resetTextureUnits();let B0=g.fog,P0=d.isMeshStandardMaterial||d.isMeshLambertMaterial||d.isMeshPhongMaterial?g.environment:null,M0=S===null?C.outputColorSpace:S.isXRRenderTarget===!0?S.texture.colorSpace:t0.workingColorSpace,b0=d.isMeshStandardMaterial||d.isMeshLambertMaterial&&!d.envMap||d.isMeshPhongMaterial&&!d.envMap,g0=_.get(d.envMap||P0,b0),JJ=d.vertexColors===!0&&!!l.attributes.color&&l.attributes.color.itemSize===4,KJ=!!l.attributes.tangent&&(!!d.normalMap||d.anisotropy>0),p0=!!l.morphAttributes.position,RJ=!!l.morphAttributes.normal,yJ=!!l.morphAttributes.color,TJ=E9;if(d.toneMapped){if(S===null||S.isXRRenderTarget===!0)TJ=C.toneMapping}let DJ=l.morphAttributes.position||l.morphAttributes.normal||l.morphAttributes.color,oJ=DJ!==void 0?DJ.length:0,w0=T0.get(d),q9=I.state.lights;if(x0===!0){if(n0===!0||P!==x){let VJ=P===x&&d.id===h;R0.setState(d,P,VJ)}}let EJ=!1;if(d.version===w0.__version){if(w0.needsLights&&w0.lightsStateVersion!==q9.state.version)EJ=!0;else if(w0.outputColorSpace!==M0)EJ=!0;else if(m.isBatchedMesh&&w0.batching===!1)EJ=!0;else if(!m.isBatchedMesh&&w0.batching===!0)EJ=!0;else if(m.isBatchedMesh&&w0.batchingColor===!0&&m.colorTexture===null)EJ=!0;else if(m.isBatchedMesh&&w0.batchingColor===!1&&m.colorTexture!==null)EJ=!0;else if(m.isInstancedMesh&&w0.instancing===!1)EJ=!0;else if(!m.isInstancedMesh&&w0.instancing===!0)EJ=!0;else if(m.isSkinnedMesh&&w0.skinning===!1)EJ=!0;else if(!m.isSkinnedMesh&&w0.skinning===!0)EJ=!0;else if(m.isInstancedMesh&&w0.instancingColor===!0&&m.instanceColor===null)EJ=!0;else if(m.isInstancedMesh&&w0.instancingColor===!1&&m.instanceColor!==null)EJ=!0;else if(m.isInstancedMesh&&w0.instancingMorph===!0&&m.morphTexture===null)EJ=!0;else if(m.isInstancedMesh&&w0.instancingMorph===!1&&m.morphTexture!==null)EJ=!0;else if(w0.envMap!==g0)EJ=!0;else if(d.fog===!0&&w0.fog!==B0)EJ=!0;else if(w0.numClippingPlanes!==void 0&&(w0.numClippingPlanes!==R0.numPlanes||w0.numIntersection!==R0.numIntersection))EJ=!0;else if(w0.vertexAlphas!==JJ)EJ=!0;else if(w0.vertexTangents!==KJ)EJ=!0;else if(w0.morphTargets!==p0)EJ=!0;else if(w0.morphNormals!==RJ)EJ=!0;else if(w0.morphColors!==yJ)EJ=!0;else if(w0.toneMapping!==TJ)EJ=!0;else if(w0.morphTargetsCount!==oJ)EJ=!0;else if(!!w0.lightProbeGrid!==I.state.lightProbeGridArray.length>0)EJ=!0}else EJ=!0,w0.__version=d.version;let I9=w0.currentProgram;if(EJ===!0){if(I9=w$(d,g,m),w&&d.isNodeMaterial)w.onUpdateProgram(d,I9,w0)}let J8=!1,j8=!1,o6=!1,kJ=I9.getUniforms(),xJ=w0.uniforms;if(U0.useProgram(I9.program))J8=!0,j8=!0,o6=!0;if(d.id!==h)h=d.id,j8=!0;if(w0.needsLights){let VJ=V1(I.state.lightProbeGridArray,m);if(w0.lightProbeGrid!==VJ)w0.lightProbeGrid=VJ,j8=!0}if(J8||x!==P){if(U0.buffers.depth.getReversed()&&P.reversedDepth!==!0)P._reversedDepth=!0,P.updateProjectionMatrix();kJ.setValue(y,"projectionMatrix",P.projectionMatrix),kJ.setValue(y,"viewMatrix",P.matrixWorldInverse);let y8=kJ.map.cameraPosition;if(y8!==void 0)y8.setValue(y,X0.setFromMatrixPosition(P.matrixWorld));if(l0.logarithmicDepthBuffer)kJ.setValue(y,"logDepthBufFC",2/(Math.log(P.far+1)/Math.LN2));if(d.isMeshPhongMaterial||d.isMeshToonMaterial||d.isMeshLambertMaterial||d.isMeshBasicMaterial||d.isMeshStandardMaterial||d.isShaderMaterial)kJ.setValue(y,"isOrthographic",P.isOrthographicCamera===!0);if(x!==P)x=P,j8=!0,o6=!0}if(w0.needsLights){if(q9.state.directionalShadowMap.length>0)kJ.setValue(y,"directionalShadowMap",q9.state.directionalShadowMap,A);if(q9.state.spotShadowMap.length>0)kJ.setValue(y,"spotShadowMap",q9.state.spotShadowMap,A);if(q9.state.pointShadowMap.length>0)kJ.setValue(y,"pointShadowMap",q9.state.pointShadowMap,A)}if(m.isSkinnedMesh){kJ.setOptional(y,m,"bindMatrix"),kJ.setOptional(y,m,"bindMatrixInverse");let VJ=m.skeleton;if(VJ){if(VJ.boneTexture===null)VJ.computeBoneTexture();kJ.setValue(y,"boneTexture",VJ.boneTexture,A)}}if(m.isBatchedMesh){if(kJ.setOptional(y,m,"batchingTexture"),kJ.setValue(y,"batchingTexture",m._matricesTexture,A),kJ.setOptional(y,m,"batchingIdTexture"),kJ.setValue(y,"batchingIdTexture",m._indirectTexture,A),kJ.setOptional(y,m,"batchingColorTexture"),m._colorsTexture!==null)kJ.setValue(y,"batchingColorTexture",m._colorsTexture,A)}let v8=l.morphAttributes;if(v8.position!==void 0||v8.normal!==void 0||v8.color!==void 0)k0.update(m,l,I9);if(j8||w0.receiveShadow!==m.receiveShadow)w0.receiveShadow=m.receiveShadow,kJ.setValue(y,"receiveShadow",m.receiveShadow);if((d.isMeshStandardMaterial||d.isMeshLambertMaterial||d.isMeshPhongMaterial)&&d.envMap===null&&g.environment!==null)xJ.envMapIntensity.value=g.environmentIntensity;if(xJ.dfgLUT!==void 0)xJ.dfgLUT.value=GD();if(j8){if(kJ.setValue(y,"toneMappingExposure",C.toneMappingExposure),w0.needsLights)C1(xJ,o6);if(B0&&d.fog===!0)D0.refreshFogUniforms(xJ,B0);if(D0.refreshMaterialUniforms(xJ,d,d0,c0,I.state.transmissionRenderTarget[P.id]),w0.needsLights&&w0.lightProbeGrid){let VJ=w0.lightProbeGrid;xJ.probesSH.value=VJ.texture,xJ.probesMin.value.copy(VJ.boundingBox.min),xJ.probesMax.value.copy(VJ.boundingBox.max),xJ.probesResolution.value.copy(VJ.resolution)}D$.upload(y,hH(w0),xJ,A)}if(d.isShaderMaterial&&d.uniformsNeedUpdate===!0)D$.upload(y,hH(w0),xJ,A),d.uniformsNeedUpdate=!1;if(d.isSpriteMaterial)kJ.setValue(y,"center",m.center);if(kJ.setValue(y,"modelViewMatrix",m.modelViewMatrix),kJ.setValue(y,"normalMatrix",m.normalMatrix),kJ.setValue(y,"modelMatrix",m.matrixWorld),d.uniformsGroups!==void 0){let VJ=d.uniformsGroups;for(let y8=0,a6=VJ.length;y8<a6;y8++){let gH=VJ[y8];q0.update(gH,I9),q0.bind(gH,I9)}}return I9}function C1(P,g){P.ambientLightColor.needsUpdate=g,P.lightProbe.needsUpdate=g,P.directionalLights.needsUpdate=g,P.directionalLightShadows.needsUpdate=g,P.pointLights.needsUpdate=g,P.pointLightShadows.needsUpdate=g,P.spotLights.needsUpdate=g,P.spotLightShadows.needsUpdate=g,P.rectAreaLights.needsUpdate=g,P.hemisphereLights.needsUpdate=g}function I1(P){return P.isMeshLambertMaterial||P.isMeshToonMaterial||P.isMeshPhongMaterial||P.isMeshStandardMaterial||P.isShadowMaterial||P.isShaderMaterial&&P.lights===!0}this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return b},this.getRenderTarget=function(){return S},this.setRenderTargetTextures=function(P,g,l){let d=T0.get(P);if(d.__autoAllocateDepthBuffer=P.resolveDepthBuffer===!1,d.__autoAllocateDepthBuffer===!1)d.__useRenderToTexture=!1;T0.get(P.texture).__webglTexture=g,T0.get(P.depthTexture).__webglTexture=d.__autoAllocateDepthBuffer?void 0:l,d.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(P,g){let l=T0.get(P);l.__webglFramebuffer=g,l.__useDefaultFramebuffer=g===void 0};let z1=y.createFramebuffer();this.setRenderTarget=function(P,g=0,l=0){S=P,v=g,b=l;let d=null,m=!1,B0=!1;if(P){let M0=T0.get(P);if(M0.__useDefaultFramebuffer!==void 0){U0.bindFramebuffer(y.FRAMEBUFFER,M0.__webglFramebuffer),p.copy(P.viewport),c.copy(P.scissor),o=P.scissorTest,U0.viewport(p),U0.scissor(c),U0.setScissorTest(o),h=-1;return}else if(M0.__webglFramebuffer===void 0)A.setupRenderTarget(P);else if(M0.__hasExternalTextures)A.rebindTextures(P,T0.get(P.texture).__webglTexture,T0.get(P.depthTexture).__webglTexture);else if(P.depthBuffer){let JJ=P.depthTexture;if(M0.__boundDepthTexture!==JJ){if(JJ!==null&&T0.has(JJ)&&(P.width!==JJ.image.width||P.height!==JJ.image.height))throw Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");A.setupDepthRenderbuffer(P)}}let b0=P.texture;if(b0.isData3DTexture||b0.isDataArrayTexture||b0.isCompressedArrayTexture)B0=!0;let g0=T0.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget){if(Array.isArray(g0[g]))d=g0[g][l];else d=g0[g];m=!0}else if(P.samples>0&&A.useMultisampledRTT(P)===!1)d=T0.get(P).__webglMultisampledFramebuffer;else if(Array.isArray(g0))d=g0[l];else d=g0;p.copy(P.viewport),c.copy(P.scissor),o=P.scissorTest}else p.copy(z0).multiplyScalar(d0).floor(),c.copy(E0).multiplyScalar(d0).floor(),o=j0;if(l!==0)d=z1;if(U0.bindFramebuffer(y.FRAMEBUFFER,d))U0.drawBuffers(P,d);if(U0.viewport(p),U0.scissor(c),U0.setScissorTest(o),m){let M0=T0.get(P.texture);y.framebufferTexture2D(y.FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_CUBE_MAP_POSITIVE_X+g,M0.__webglTexture,l)}else if(B0){let M0=g;for(let b0=0;b0<P.textures.length;b0++){let g0=T0.get(P.textures[b0]);y.framebufferTextureLayer(y.FRAMEBUFFER,y.COLOR_ATTACHMENT0+b0,g0.__webglTexture,l,M0)}}else if(P!==null&&l!==0){let M0=T0.get(P.texture);y.framebufferTexture2D(y.FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_2D,M0.__webglTexture,l)}h=-1},this.readRenderTargetPixels=function(P,g,l,d,m,B0,P0,M0=0){if(!(P&&P.isWebGLRenderTarget)){v0("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let b0=T0.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&P0!==void 0)b0=b0[P0];if(b0){U0.bindFramebuffer(y.FRAMEBUFFER,b0);try{let g0=P.textures[M0],JJ=g0.format,KJ=g0.type;if(P.textures.length>1)y.readBuffer(y.COLOR_ATTACHMENT0+M0);if(!l0.textureFormatReadable(JJ)){v0("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!l0.textureTypeReadable(KJ)){v0("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}if(g>=0&&g<=P.width-d&&(l>=0&&l<=P.height-m))y.readPixels(g,l,d,m,XJ.convert(JJ),XJ.convert(KJ),B0)}finally{let g0=S!==null?T0.get(S).__webglFramebuffer:null;U0.bindFramebuffer(y.FRAMEBUFFER,g0)}}},this.readRenderTargetPixelsAsync=async function(P,g,l,d,m,B0,P0,M0=0){if(!(P&&P.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let b0=T0.get(P).__webglFramebuffer;if(P.isWebGLCubeRenderTarget&&P0!==void 0)b0=b0[P0];if(b0)if(g>=0&&g<=P.width-d&&(l>=0&&l<=P.height-m)){U0.bindFramebuffer(y.FRAMEBUFFER,b0);let g0=P.textures[M0],JJ=g0.format,KJ=g0.type;if(P.textures.length>1)y.readBuffer(y.COLOR_ATTACHMENT0+M0);if(!l0.textureFormatReadable(JJ))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!l0.textureTypeReadable(KJ))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");let p0=y.createBuffer();y.bindBuffer(y.PIXEL_PACK_BUFFER,p0),y.bufferData(y.PIXEL_PACK_BUFFER,B0.byteLength,y.STREAM_READ),y.readPixels(g,l,d,m,XJ.convert(JJ),XJ.convert(KJ),0);let RJ=S!==null?T0.get(S).__webglFramebuffer:null;U0.bindFramebuffer(y.FRAMEBUFFER,RJ);let yJ=y.fenceSync(y.SYNC_GPU_COMMANDS_COMPLETE,0);return y.flush(),await Y5(y,yJ,4),y.bindBuffer(y.PIXEL_PACK_BUFFER,p0),y.getBufferSubData(y.PIXEL_PACK_BUFFER,0,B0),y.deleteBuffer(p0),y.deleteSync(yJ),B0}else throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(P,g=null,l=0){let d=Math.pow(2,-l),m=Math.floor(P.image.width*d),B0=Math.floor(P.image.height*d),P0=g!==null?g.x:0,M0=g!==null?g.y:0;A.setTexture2D(P,0),y.copyTexSubImage2D(y.TEXTURE_2D,l,0,0,P0,M0,m,B0),U0.unbindTexture()};let _1=y.createFramebuffer(),w1=y.createFramebuffer();if(this.copyTextureToTexture=function(P,g,l=null,d=null,m=0,B0=0){let P0,M0,b0,g0,JJ,KJ,p0,RJ,yJ,TJ=P.isCompressedTexture?P.mipmaps[B0]:P.image;if(l!==null)P0=l.max.x-l.min.x,M0=l.max.y-l.min.y,b0=l.isBox3?l.max.z-l.min.z:1,g0=l.min.x,JJ=l.min.y,KJ=l.isBox3?l.min.z:0;else{let xJ=Math.pow(2,-m);if(P0=Math.floor(TJ.width*xJ),M0=Math.floor(TJ.height*xJ),P.isDataArrayTexture)b0=TJ.depth;else if(P.isData3DTexture)b0=Math.floor(TJ.depth*xJ);else b0=1;g0=0,JJ=0,KJ=0}if(d!==null)p0=d.x,RJ=d.y,yJ=d.z;else p0=0,RJ=0,yJ=0;let DJ=XJ.convert(g.format),oJ=XJ.convert(g.type),w0;if(g.isData3DTexture)A.setTexture3D(g,0),w0=y.TEXTURE_3D;else if(g.isDataArrayTexture||g.isCompressedArrayTexture)A.setTexture2DArray(g,0),w0=y.TEXTURE_2D_ARRAY;else A.setTexture2D(g,0),w0=y.TEXTURE_2D;U0.activeTexture(y.TEXTURE0),U0.pixelStorei(y.UNPACK_FLIP_Y_WEBGL,g.flipY),U0.pixelStorei(y.UNPACK_PREMULTIPLY_ALPHA_WEBGL,g.premultiplyAlpha),U0.pixelStorei(y.UNPACK_ALIGNMENT,g.unpackAlignment);let q9=U0.getParameter(y.UNPACK_ROW_LENGTH),EJ=U0.getParameter(y.UNPACK_IMAGE_HEIGHT),I9=U0.getParameter(y.UNPACK_SKIP_PIXELS),J8=U0.getParameter(y.UNPACK_SKIP_ROWS),j8=U0.getParameter(y.UNPACK_SKIP_IMAGES);U0.pixelStorei(y.UNPACK_ROW_LENGTH,TJ.width),U0.pixelStorei(y.UNPACK_IMAGE_HEIGHT,TJ.height),U0.pixelStorei(y.UNPACK_SKIP_PIXELS,g0),U0.pixelStorei(y.UNPACK_SKIP_ROWS,JJ),U0.pixelStorei(y.UNPACK_SKIP_IMAGES,KJ);let o6=P.isDataArrayTexture||P.isData3DTexture,kJ=g.isDataArrayTexture||g.isData3DTexture;if(P.isDepthTexture){let xJ=T0.get(P),v8=T0.get(g),VJ=T0.get(xJ.__renderTarget),y8=T0.get(v8.__renderTarget);U0.bindFramebuffer(y.READ_FRAMEBUFFER,VJ.__webglFramebuffer),U0.bindFramebuffer(y.DRAW_FRAMEBUFFER,y8.__webglFramebuffer);for(let a6=0;a6<b0;a6++){if(o6)y.framebufferTextureLayer(y.READ_FRAMEBUFFER,y.COLOR_ATTACHMENT0,T0.get(P).__webglTexture,m,KJ+a6),y.framebufferTextureLayer(y.DRAW_FRAMEBUFFER,y.COLOR_ATTACHMENT0,T0.get(g).__webglTexture,B0,yJ+a6);y.blitFramebuffer(g0,JJ,P0,M0,p0,RJ,P0,M0,y.DEPTH_BUFFER_BIT,y.NEAREST)}U0.bindFramebuffer(y.READ_FRAMEBUFFER,null),U0.bindFramebuffer(y.DRAW_FRAMEBUFFER,null)}else if(m!==0||P.isRenderTargetTexture||T0.has(P)){let xJ=T0.get(P),v8=T0.get(g);U0.bindFramebuffer(y.READ_FRAMEBUFFER,_1),U0.bindFramebuffer(y.DRAW_FRAMEBUFFER,w1);for(let VJ=0;VJ<b0;VJ++){if(o6)y.framebufferTextureLayer(y.READ_FRAMEBUFFER,y.COLOR_ATTACHMENT0,xJ.__webglTexture,m,KJ+VJ);else y.framebufferTexture2D(y.READ_FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_2D,xJ.__webglTexture,m);if(kJ)y.framebufferTextureLayer(y.DRAW_FRAMEBUFFER,y.COLOR_ATTACHMENT0,v8.__webglTexture,B0,yJ+VJ);else y.framebufferTexture2D(y.DRAW_FRAMEBUFFER,y.COLOR_ATTACHMENT0,y.TEXTURE_2D,v8.__webglTexture,B0);if(m!==0)y.blitFramebuffer(g0,JJ,P0,M0,p0,RJ,P0,M0,y.COLOR_BUFFER_BIT,y.NEAREST);else if(kJ)y.copyTexSubImage3D(w0,B0,p0,RJ,yJ+VJ,g0,JJ,P0,M0);else y.copyTexSubImage2D(w0,B0,p0,RJ,g0,JJ,P0,M0)}U0.bindFramebuffer(y.READ_FRAMEBUFFER,null),U0.bindFramebuffer(y.DRAW_FRAMEBUFFER,null)}else if(kJ)if(P.isDataTexture||P.isData3DTexture)y.texSubImage3D(w0,B0,p0,RJ,yJ,P0,M0,b0,DJ,oJ,TJ.data);else if(g.isCompressedArrayTexture)y.compressedTexSubImage3D(w0,B0,p0,RJ,yJ,P0,M0,b0,DJ,TJ.data);else y.texSubImage3D(w0,B0,p0,RJ,yJ,P0,M0,b0,DJ,oJ,TJ);else if(P.isDataTexture)y.texSubImage2D(y.TEXTURE_2D,B0,p0,RJ,P0,M0,DJ,oJ,TJ.data);else if(P.isCompressedTexture)y.compressedTexSubImage2D(y.TEXTURE_2D,B0,p0,RJ,TJ.width,TJ.height,DJ,TJ.data);else y.texSubImage2D(y.TEXTURE_2D,B0,p0,RJ,P0,M0,DJ,oJ,TJ);if(U0.pixelStorei(y.UNPACK_ROW_LENGTH,q9),U0.pixelStorei(y.UNPACK_IMAGE_HEIGHT,EJ),U0.pixelStorei(y.UNPACK_SKIP_PIXELS,I9),U0.pixelStorei(y.UNPACK_SKIP_ROWS,J8),U0.pixelStorei(y.UNPACK_SKIP_IMAGES,j8),B0===0&&g.generateMipmaps)y.generateMipmap(w0);U0.unbindTexture()},this.initRenderTarget=function(P){if(T0.get(P).__webglFramebuffer===void 0)A.setupRenderTarget(P)},this.initTexture=function(P){if(P.isCubeTexture)A.setTextureCube(P,0);else if(P.isData3DTexture)A.setTexture3D(P,0);else if(P.isDataArrayTexture||P.isCompressedArrayTexture)A.setTexture2DArray(P,0);else A.setTexture2D(P,0);U0.unbindTexture()},this.resetState=function(){v=0,b=0,S=null,U0.reset(),f.reset()},typeof __THREE_DEVTOOLS__<"u")__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return EW}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(J){this._outputColorSpace=J;let Q=this.getContext();Q.drawingBufferColorSpace=t0._getDrawingBufferColorSpace(J),Q.unpackColorSpace=t0._getUnpackColorSpace()}}function V0(J,Q){if(J==null||J.trim()==="")return Q;let $=Number(J);return Number.isFinite($)?$:Q}function CJ(J,Q){if(J==null||J.trim()==="")return[...Q];let $=J.trim().split(/\s+/).map(Number);return[Number.isFinite($[0])?$[0]:Q[0],Number.isFinite($[1])?$[1]:Q[1],Number.isFinite($[2])?$[2]:Q[2]]}function YE(J){if(J==null||J.trim()==="")return[1,1,1];let Q=J.trim().split(/\s+/).map(Number);if(Q.length===1&&Number.isFinite(Q[0]))return[Q[0],Q[0],Q[0]];return CJ(J,[1,1,1])}function a7(J,Q){if(J==null||J.trim()==="")return Q;let $=Number(J.trim().replace(/deg$/i,""));return Number.isFinite($)?$:Q}function HH(J){return J*Math.PI/180}function XE(J){let Q=CJ(J,[0,0,0]);return[HH(Q[0]),HH(Q[1]),HH(Q[2])]}function y9(J,Q){if(J==null||J.trim()==="")return Q;return J.trim()}function t9(J,Q){return V0(J,Q)}function JY(J){return(Q)=>Math.pow(Q,J)}function QY(J){return(Q)=>1-Math.pow(1-Q,J)}function $Y(J){return(Q)=>Q<0.5?Math.pow(2*Q,J)/2:1-Math.pow(2*(1-Q),J)/2}var k$=1.70158,ZY={linear:(J)=>J,none:(J)=>J,"power1.in":JY(2),"power1.out":QY(2),"power1.inOut":$Y(2),"power2.in":JY(3),"power2.out":QY(3),"power2.inOut":$Y(3),"power3.in":JY(4),"power3.out":QY(4),"power3.inOut":$Y(4),"power4.in":JY(5),"power4.out":QY(5),"power4.inOut":$Y(5),"sine.in":(J)=>1-Math.cos(J*Math.PI/2),"sine.out":(J)=>Math.sin(J*Math.PI/2),"sine.inOut":(J)=>-(Math.cos(Math.PI*J)-1)/2,"expo.in":(J)=>J===0?0:Math.pow(2,10*J-10),"expo.out":(J)=>J===1?1:1-Math.pow(2,-10*J),"expo.inOut":(J)=>J===0?0:J===1?1:J<0.5?Math.pow(2,20*J-10)/2:(2-Math.pow(2,-20*J+10))/2,"circ.in":(J)=>1-Math.sqrt(1-J*J),"circ.out":(J)=>Math.sqrt(1-(J-1)*(J-1)),"circ.inOut":(J)=>J<0.5?(1-Math.sqrt(1-4*J*J))/2:(Math.sqrt(1-Math.pow(-2*J+2,2))+1)/2,"back.in":(J)=>J*J*((k$+1)*J-k$),"back.out":(J)=>{let Q=J-1;return Q*Q*((k$+1)*Q+k$)+1},"back.inOut":(J)=>{let Q=k$*1.525;return J<0.5?Math.pow(2*J,2)*((Q+1)*2*J-Q)/2:(Math.pow(2*J-2,2)*((Q+1)*(2*J-2)+Q)+2)/2},"elastic.out":(J)=>J===0?0:J===1?1:Math.pow(2,-10*J)*Math.sin((J*10-0.75)*(2*Math.PI)/3)+1,"bounce.out":(J)=>{if(J<0.36363636363636365)return 7.5625*J*J;if(J<0.7272727272727273){let W=J-0.5454545454545454;return 7.5625*W*W+0.75}if(J<0.9090909090909091){let W=J-0.8181818181818182;return 7.5625*W*W+0.9375}let Z=J-0.9545454545454546;return 7.5625*Z*Z+0.984375}};function WY(J,Q="power1.out"){if(J){let $=ZY[J.trim()];if($)return $}return ZY[Q]??ZY.linear}var tD=Object.keys(ZY);function c6(J,Q){let $=Q.duration??0;if($<=0)return J<Q.start?0:1;let Z=(J-Q.start)/$;return Q.ease(Math.min(1,Math.max(0,Z)))}function UH(J,Q){return c6(J,Q)}function KE(J,Q,$){let Z=Math.max(0.000001,1-$);return Math.min(1,Math.max(0,(J-Q)/Z))}function HE(J,Q){return Math.max(0,J-Q.start)}function UE(J){return{start:J.start??0,duration:J.duration??void 0,ease:WY(J.ease??null,J.defaultEase??"power1.out")}}function GE(J,Q,$){let Z=J.rotation[$.axis],W=$.rpm/60*Math.PI*2;return(Y)=>{J.rotation[$.axis]=Z+W*HE(Y,Q)}}function EE(J,Q,$){let Z=$.fromDeg*Math.PI/180,W=$.toDeg*Math.PI/180;return(Y)=>{let X=Z+(W-Z)*c6(Y,Q),K=$.center();J.position.x=K.x+$.radius*Math.sin(X),J.position.z=K.z+$.radius*Math.cos(X),J.position.y=K.y+$.height}}function FE(J,Q,$){let Z={x:J.position.x,y:J.position.y,z:J.position.z};return(W)=>{let Y=$.toward(),X=Y.x-Z.x,K=Y.y-Z.y,H=Y.z-Z.z,U=Math.sqrt(X*X+K*K+H*H)||1,G=$.distance*c6(W,Q);J.position.x=Z.x+X/U*G,J.position.y=Z.y+K/U*G,J.position.z=Z.z+H/U*G}}function NE(J,Q){let $={x:J.scale.x,y:J.scale.y,z:J.scale.z};return(Z)=>{let W=Z<Q.start?0:c6(Z,Q);J.scale.x=$.x*W,J.scale.y=$.y*W,J.scale.z=$.z*W}}function GH(J,Q){return($)=>{J($<Q.start?0:c6($,Q))}}function OE(J,Q,$){let Z=$.from??{x:J.position.x,y:J.position.y,z:J.position.z};return(W)=>{let Y=c6(W,Q);J.position.x=Z.x+($.to.x-Z.x)*Y,J.position.y=Z.y+($.to.y-Z.y)*Y,J.position.z=Z.z+($.to.z-Z.z)*Y}}function qE(J,Q){return()=>{let $=Q.subject();J.position.x=$.x+Q.offset.x,J.position.y=$.y+Q.offset.y,J.position.z=$.z+Q.offset.z}}function RE(J,Q){return($)=>{let Z=$<Q.start?0:c6($,Q);J(1-Z,Z)}}function LE(J,Q,$){let Z=J.position.y,W=Math.PI*2/Math.max(0.0001,$.period);return(Y)=>{J.position.y=Z+$.amplitude*Math.sin(W*HE(Y,Q))}}var YY=new T;function DE(J,Q){if(!Q)return null;if(Q==="camera")return J.camera;if(Q.startsWith("#"))return J.objectsById.get(Q.slice(1))??null;return null}function EH(J,Q){if(Q&&Q.startsWith("#")){let Z=J.objectsById.get(Q.slice(1));if(Z)return()=>{return Z.getWorldPosition(YY),{x:YY.x,y:YY.y,z:YY.z}}}let $=CJ(Q,[0,0,0]);return()=>({x:$[0],y:$[1],z:$[2]})}function FD(J){let Q=[],$=new Set;return J.traverse((Z)=>{let W=Z.material,Y=Array.isArray(W)?W:W?[W]:[];for(let X of Y){if($.has(X))continue;$.add(X),Q.push({material:X,baseOpacity:X.opacity,baseTransparent:X.transparent})}}),(Z)=>{for(let W of Q)W.material.opacity=W.baseOpacity*Z,W.material.transparent=Z<1?!0:W.baseTransparent}}function kE(J){let Q=[];for(let $ of Array.from(J.host.querySelectorAll("sf-animate"))){let Z=($.getAttribute("verb")??"").toLowerCase(),W={orbit:4,dolly:1.5,"bounce-in":0.6,"fade-in":0.6,move:2,"crossfade-clip":0.5,"camera-path":8,variant:0.8},Y=$.getAttribute("duration"),X=UE({start:t9($.getAttribute("start"),0),duration:Y?t9(Y,0):W[Z]??null,ease:$.getAttribute("ease"),defaultEase:Z==="bounce-in"?"back.out":"power1.out"});if(Z==="variant"){Q.push({el:$,timing:X});continue}let K=DE(J,$.getAttribute("target"));if(!K){let H=$.getAttribute("target")??"",U=H.startsWith("#")?document.querySelector(H):null;if(U&&(Z==="fade-in"||Z==="bounce-in")){let G=V0($.getAttribute("rise"),0);J.seekFns.push(GH((F)=>{if(Z==="fade-in"){if(U.style.opacity=String(F),G!==0)U.style.transform=`translateY(${(1-F)*G}px)`}else U.style.opacity=F>0?"1":"0",U.style.transform=`scale(${F})`},X))}continue}if(Z==="turntable")J.seekFns.push(GE(K,X,{rpm:V0($.getAttribute("rpm"),6),axis:$.getAttribute("axis")??"y"}));else if(Z==="orbit"){let H=EH(J,$.getAttribute("around")),U=H(),G=K.position.x-U.x,F=K.position.z-U.z,E=Math.sqrt(G*G+F*F),O=Math.atan2(G,F)*180/Math.PI,R=a7($.getAttribute("from"),O);J.seekFns.push(EE(K,X,{center:H,radius:V0($.getAttribute("radius"),E||5),fromDeg:R,toDeg:a7($.getAttribute("to"),R+360),height:V0($.getAttribute("height"),K.position.y-U.y)}))}else if(Z==="dolly")J.seekFns.push(FE(K,X,{toward:EH(J,$.getAttribute("toward")),distance:V0($.getAttribute("distance"),1)}));else if(Z==="move"){let H=$.getAttribute("to");if(!H)continue;let U=CJ(H,[0,0,0]),G=$.getAttribute("from"),F=G?CJ(G,[0,0,0]):null;J.seekFns.push(OE(K,X,{from:F?{x:F[0],y:F[1],z:F[2]}:void 0,to:{x:U[0],y:U[1],z:U[2]}}))}else if(Z==="follow"){let H=EH(J,$.getAttribute("subject")),U=$.getAttribute("offset"),G;if(U){let F=CJ(U,[0,2,5]);G={x:F[0],y:F[1],z:F[2]}}else{let F=H();G={x:K.position.x-F.x,y:K.position.y-F.y,z:K.position.z-F.z}}J.lateSeekFns.push(qE(K,{subject:H,offset:G}))}else if(Z==="camera-path"){let H=($.getAttribute("points")??"").split(",").map((O)=>CJ(O.trim(),[Number.NaN,Number.NaN,Number.NaN])).filter((O)=>O.every(Number.isFinite)).map((O)=>new T(O[0],O[1],O[2]));if(H.length<2)continue;let U=new d7(H,!1,"centripetal"),G=($.getAttribute("look")??"ahead").toLowerCase(),F=new T,E=new T;J.lateSeekFns.push((O)=>{let R=UH(O,X);if(U.getPointAt(Math.min(1,Math.max(0,R)),F),K.position.set(F.x,F.y,F.z),G==="ahead"){if(U.getPointAt(Math.min(1,Math.max(0,R)+0.02),E),E.distanceToSquared(F)<0.000000001)U.getPointAt(Math.max(0,R-0.02),E),E.lerpVectors(E,F,2);K.lookAt(E)}})}else if(Z==="crossfade-clip"){let H=J.actionsByObject.get(K),U=$.getAttribute("from"),G=$.getAttribute("to");if(!H||!U||!G)continue;let F=H.get(U),E=H.get(G);if(!F||!E)continue;J.seekFns.push(RE((O,R)=>{F.setEffectiveWeight(O),E.setEffectiveWeight(R)},X))}else if(Z==="bounce-in")J.seekFns.push(NE(K,X));else if(Z==="fade-in")J.seekFns.push(GH(FD(K),X));else if(Z==="float")J.seekFns.push(LE(K,X,{amplitude:V0($.getAttribute("amplitude"),0.1),period:V0($.getAttribute("period"),4)}))}ND(J,Q)}function ND(J,Q){let $=new Map;for(let W of Q){let Y=`${W.el.getAttribute("target")??""}|${W.el.getAttribute("material")??"*"}`;($.get(Y)??$.set(Y,[]).get(Y)).push(W)}let Z=new e;for(let W of $.values()){let Y=W[0],X=DE(J,Y.el.getAttribute("target"));if(!X)continue;let K=Y.el.getAttribute("material"),H=[],U=new Set;if(X.traverse((E)=>{let O=E.material;for(let R of Array.isArray(O)?O:O?[O]:[]){if(U.has(R))continue;if(U.add(R),!(R instanceof sJ))continue;if(K&&R.name!==K)continue;H.push(R)}}),H.length===0)continue;let G={color:H[0].color.clone(),roughness:H[0].roughness,metalness:H[0].metalness};J.seekFns.push(()=>{for(let E of H){if(E.color.copy(G.color),G.roughness!==null)E.roughness=G.roughness;if(G.metalness!==null)E.metalness=G.metalness}}),W.sort((E,O)=>E.timing.start-O.timing.start);let F=G;for(let{el:E,timing:O}of W){let R={color:E.getAttribute("color")?new e(y9(E.getAttribute("color"),"#ffffff")):F.color.clone(),roughness:E.getAttribute("roughness")?V0(E.getAttribute("roughness"),0.5):F.roughness,metalness:E.getAttribute("metalness")?V0(E.getAttribute("metalness"),0):F.metalness},k=F;J.seekFns.push((q)=>{if(q<O.start)return;let N=UH(q,O);Z.lerpColors(k.color,R.color,N);for(let L of H){if(L.color.copy(Z),R.roughness!==null&&k.roughness!==null)L.roughness=k.roughness+(R.roughness-k.roughness)*N;if(R.metalness!==null&&k.metalness!==null)L.metalness=k.metalness+(R.metalness-k.metalness)*N}}),F=R}}}function FH(J,Q){if(Q===KW)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),J;if(Q===A6||Q===j7){let $=J.getIndex();if($===null){let X=[],K=J.getAttribute("position");if(K!==void 0){for(let H=0;H<K.count;H++)X.push(H);J.setIndex(X),$=J.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),J}let Z=$.count-2,W=[];if(Q===A6)for(let X=1;X<=Z;X++)W.push($.getX(0)),W.push($.getX(X)),W.push($.getX(X+1));else for(let X=0;X<Z;X++)if(X%2===0)W.push($.getX(X)),W.push($.getX(X+1)),W.push($.getX(X+2));else W.push($.getX(X+2)),W.push($.getX(X+1)),W.push($.getX(X));if(W.length/3!==Z)console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let Y=J.clone();return Y.setIndex(W),Y.clearGroups(),Y}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",Q),J}function ME(J){let Q=new Map,$=new Map,Z=J.clone();return VE(J,Z,function(W,Y){Q.set(Y,W),$.set(W,Y)}),Z.traverse(function(W){if(!W.isSkinnedMesh)return;let Y=W,X=Q.get(W),K=X.skeleton.bones;Y.skeleton=X.skeleton.clone(),Y.bindMatrix.copy(X.bindMatrix),Y.skeleton.bones=K.map(function(H){return $.get(H)}),Y.bind(Y.skeleton,Y.bindMatrix)}),Z}function VE(J,Q,$){$(J,Q);for(let Z=0;Z<J.children.length;Z++)VE(J.children[Z],Q.children[Z],$)}class kH extends nJ{constructor(J){super(J);this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(Q){return new TE(Q)}),this.register(function(Q){return new AE(Q)}),this.register(function(Q){return new gE(Q)}),this.register(function(Q){return new pE(Q)}),this.register(function(Q){return new uE(Q)}),this.register(function(Q){return new jE(Q)}),this.register(function(Q){return new vE(Q)}),this.register(function(Q){return new yE(Q)}),this.register(function(Q){return new xE(Q)}),this.register(function(Q){return new PE(Q)}),this.register(function(Q){return new bE(Q)}),this.register(function(Q){return new SE(Q)}),this.register(function(Q){return new fE(Q)}),this.register(function(Q){return new hE(Q)}),this.register(function(Q){return new _E(Q)}),this.register(function(Q){return new RH(Q,UJ.EXT_MESHOPT_COMPRESSION)}),this.register(function(Q){return new RH(Q,UJ.KHR_MESHOPT_COMPRESSION)}),this.register(function(Q){return new dE(Q)})}load(J,Q,$,Z){let W=this,Y;if(this.resourcePath!=="")Y=this.resourcePath;else if(this.path!==""){let H=c9.extractUrlBase(J);Y=c9.resolveURL(H,this.path)}else Y=c9.extractUrlBase(J);this.manager.itemStart(J);let X=function(H){if(Z)Z(H);else console.error(H);W.manager.itemError(J),W.manager.itemEnd(J)},K=new G9(this.manager);K.setPath(this.path),K.setResponseType("arraybuffer"),K.setRequestHeader(this.requestHeader),K.setWithCredentials(this.withCredentials),K.load(J,function(H){try{W.parse(H,Y,function(U){Q(U),W.manager.itemEnd(J)},X)}catch(U){X(U)}},$,X)}setDRACOLoader(J){return this.dracoLoader=J,this}setKTX2Loader(J){return this.ktx2Loader=J,this}setMeshoptDecoder(J){return this.meshoptDecoder=J,this}register(J){if(this.pluginCallbacks.indexOf(J)===-1)this.pluginCallbacks.push(J);return this}unregister(J){if(this.pluginCallbacks.indexOf(J)!==-1)this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(J),1);return this}parse(J,Q,$,Z){let W,Y={},X={},K=new TextDecoder;if(typeof J==="string")W=JSON.parse(J);else if(J instanceof ArrayBuffer)if(K.decode(new Uint8Array(J,0,4))===mE){try{Y[UJ.KHR_BINARY_GLTF]=new lE(J)}catch(G){if(Z)Z(G);return}W=JSON.parse(Y[UJ.KHR_BINARY_GLTF].content)}else W=JSON.parse(K.decode(J));else W=J;if(W.asset===void 0||W.asset.version[0]<2){if(Z)Z(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let H=new oE(W,{path:Q||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});H.fileLoader.setRequestHeader(this.requestHeader);for(let U=0;U<this.pluginCallbacks.length;U++){let G=this.pluginCallbacks[U](H);if(!G.name)console.error("THREE.GLTFLoader: Invalid plugin found: missing name");X[G.name]=G,Y[G.name]=!0}if(W.extensionsUsed)for(let U=0;U<W.extensionsUsed.length;++U){let G=W.extensionsUsed[U],F=W.extensionsRequired||[];switch(G){case UJ.KHR_MATERIALS_UNLIT:Y[G]=new wE;break;case UJ.KHR_DRACO_MESH_COMPRESSION:Y[G]=new cE(W,this.dracoLoader);break;case UJ.KHR_TEXTURE_TRANSFORM:Y[G]=new nE;break;case UJ.KHR_MESH_QUANTIZATION:Y[G]=new sE;break;default:if(F.indexOf(G)>=0&&X[G]===void 0)console.warn('THREE.GLTFLoader: Unknown extension "'+G+'".')}}H.setExtensions(Y),H.setPlugins(X),H.parse($,Z)}parseAsync(J,Q){let $=this;return new Promise(function(Z,W){$.parse(J,Q,Z,W)})}}function OD(){let J={};return{get:function(Q){return J[Q]},add:function(Q,$){J[Q]=$},remove:function(Q){delete J[Q]},removeAll:function(){J={}}}}function hJ(J,Q,$){let Z=J.json.materials[Q];if(Z.extensions&&Z.extensions[$])return Z.extensions[$];return null}var UJ={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class _E{constructor(J){this.parser=J,this.name=UJ.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let J=this.parser,Q=this.parser.json.nodes||[];for(let $=0,Z=Q.length;$<Z;$++){let W=Q[$];if(W.extensions&&W.extensions[this.name]&&W.extensions[this.name].light!==void 0)J._addNodeRef(this.cache,W.extensions[this.name].light)}}_loadLight(J){let Q=this.parser,$="light:"+J,Z=Q.cache.get($);if(Z)return Z;let W=Q.json,K=((W.extensions&&W.extensions[this.name]||{}).lights||[])[J],H,U=new e(16777215);if(K.color!==void 0)U.setRGB(K.color[0],K.color[1],K.color[2],eJ);let G=K.range!==void 0?K.range:0;switch(K.type){case"directional":H=new v9(U),H.target.position.set(0,0,-1),H.add(H.target);break;case"point":H=new E8(U),H.distance=G;break;case"spot":H=new n7(U),H.distance=G,K.spot=K.spot||{},K.spot.innerConeAngle=K.spot.innerConeAngle!==void 0?K.spot.innerConeAngle:0,K.spot.outerConeAngle=K.spot.outerConeAngle!==void 0?K.spot.outerConeAngle:Math.PI/4,H.angle=K.spot.outerConeAngle,H.penumbra=1-K.spot.innerConeAngle/K.spot.outerConeAngle,H.target.position.set(0,0,-1),H.add(H.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+K.type)}if(H.position.set(0,0,0),N8(H,K),K.intensity!==void 0)H.intensity=K.intensity;return H.name=Q.createUniqueName(K.name||"light_"+J),Z=Promise.resolve(H),Q.cache.add($,Z),Z}getDependency(J,Q){if(J!=="light")return;return this._loadLight(Q)}createNodeAttachment(J){let Q=this,$=this.parser,W=$.json.nodes[J],X=(W.extensions&&W.extensions[this.name]||{}).light;if(X===void 0)return null;return this._loadLight(X).then(function(K){return $._getNodeRef(Q.cache,X,K)})}}class wE{constructor(){this.name=UJ.KHR_MATERIALS_UNLIT}getMaterialType(){return cJ}extendParams(J,Q,$){let Z=[];J.color=new e(1,1,1),J.opacity=1;let W=Q.pbrMetallicRoughness;if(W){if(Array.isArray(W.baseColorFactor)){let Y=W.baseColorFactor;J.color.setRGB(Y[0],Y[1],Y[2],eJ),J.opacity=Y[3]}if(W.baseColorTexture!==void 0)Z.push($.assignTexture(J,"map",W.baseColorTexture,_8))}return Promise.all(Z)}}class PE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();if($.emissiveStrength!==void 0)Q.emissiveIntensity=$.emissiveStrength;return Promise.resolve()}}class TE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_CLEARCOAT}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?iJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if($.clearcoatFactor!==void 0)Q.clearcoat=$.clearcoatFactor;if($.clearcoatTexture!==void 0)Z.push(this.parser.assignTexture(Q,"clearcoatMap",$.clearcoatTexture));if($.clearcoatRoughnessFactor!==void 0)Q.clearcoatRoughness=$.clearcoatRoughnessFactor;if($.clearcoatRoughnessTexture!==void 0)Z.push(this.parser.assignTexture(Q,"clearcoatRoughnessMap",$.clearcoatRoughnessTexture));if($.clearcoatNormalTexture!==void 0){if(Z.push(this.parser.assignTexture(Q,"clearcoatNormalMap",$.clearcoatNormalTexture)),$.clearcoatNormalTexture.scale!==void 0){let W=$.clearcoatNormalTexture.scale;Q.clearcoatNormalScale=new i(W,W)}}return Promise.all(Z)}}class AE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_DISPERSION}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?iJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();return Q.dispersion=$.dispersion!==void 0?$.dispersion:0,Promise.resolve()}}class SE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_IRIDESCENCE}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?iJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if($.iridescenceFactor!==void 0)Q.iridescence=$.iridescenceFactor;if($.iridescenceTexture!==void 0)Z.push(this.parser.assignTexture(Q,"iridescenceMap",$.iridescenceTexture));if($.iridescenceIor!==void 0)Q.iridescenceIOR=$.iridescenceIor;if(Q.iridescenceThicknessRange===void 0)Q.iridescenceThicknessRange=[100,400];if($.iridescenceThicknessMinimum!==void 0)Q.iridescenceThicknessRange[0]=$.iridescenceThicknessMinimum;if($.iridescenceThicknessMaximum!==void 0)Q.iridescenceThicknessRange[1]=$.iridescenceThicknessMaximum;if($.iridescenceThicknessTexture!==void 0)Z.push(this.parser.assignTexture(Q,"iridescenceThicknessMap",$.iridescenceThicknessTexture));return Promise.all(Z)}}class jE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_SHEEN}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?iJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if(Q.sheenColor=new e(0,0,0),Q.sheenRoughness=0,Q.sheen=1,$.sheenColorFactor!==void 0){let W=$.sheenColorFactor;Q.sheenColor.setRGB(W[0],W[1],W[2],eJ)}if($.sheenRoughnessFactor!==void 0)Q.sheenRoughness=$.sheenRoughnessFactor;if($.sheenColorTexture!==void 0)Z.push(this.parser.assignTexture(Q,"sheenColorMap",$.sheenColorTexture,_8));if($.sheenRoughnessTexture!==void 0)Z.push(this.parser.assignTexture(Q,"sheenRoughnessMap",$.sheenRoughnessTexture));return Promise.all(Z)}}class vE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_TRANSMISSION}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?iJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if($.transmissionFactor!==void 0)Q.transmission=$.transmissionFactor;if($.transmissionTexture!==void 0)Z.push(this.parser.assignTexture(Q,"transmissionMap",$.transmissionTexture));return Promise.all(Z)}}class yE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_VOLUME}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?iJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if(Q.thickness=$.thicknessFactor!==void 0?$.thicknessFactor:0,$.thicknessTexture!==void 0)Z.push(this.parser.assignTexture(Q,"thicknessMap",$.thicknessTexture));Q.attenuationDistance=$.attenuationDistance||1/0;let W=$.attenuationColor||[1,1,1];return Q.attenuationColor=new e().setRGB(W[0],W[1],W[2],eJ),Promise.all(Z)}}class xE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_IOR}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?iJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();if(Q.ior=$.ior!==void 0?$.ior:1.5,Q.ior===0)Q.ior=1000;return Promise.resolve()}}class bE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_SPECULAR}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?iJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if(Q.specularIntensity=$.specularFactor!==void 0?$.specularFactor:1,$.specularTexture!==void 0)Z.push(this.parser.assignTexture(Q,"specularIntensityMap",$.specularTexture));let W=$.specularColorFactor||[1,1,1];if(Q.specularColor=new e().setRGB(W[0],W[1],W[2],eJ),$.specularColorTexture!==void 0)Z.push(this.parser.assignTexture(Q,"specularColorMap",$.specularColorTexture,_8));return Promise.all(Z)}}class hE{constructor(J){this.parser=J,this.name=UJ.EXT_MATERIALS_BUMP}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?iJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if(Q.bumpScale=$.bumpFactor!==void 0?$.bumpFactor:1,$.bumpTexture!==void 0)Z.push(this.parser.assignTexture(Q,"bumpMap",$.bumpTexture));return Promise.all(Z)}}class fE{constructor(J){this.parser=J,this.name=UJ.KHR_MATERIALS_ANISOTROPY}getMaterialType(J){return hJ(this.parser,J,this.name)!==null?iJ:null}extendMaterialParams(J,Q){let $=hJ(this.parser,J,this.name);if($===null)return Promise.resolve();let Z=[];if($.anisotropyStrength!==void 0)Q.anisotropy=$.anisotropyStrength;if($.anisotropyRotation!==void 0)Q.anisotropyRotation=$.anisotropyRotation;if($.anisotropyTexture!==void 0)Z.push(this.parser.assignTexture(Q,"anisotropyMap",$.anisotropyTexture));return Promise.all(Z)}}class gE{constructor(J){this.parser=J,this.name=UJ.KHR_TEXTURE_BASISU}loadTexture(J){let Q=this.parser,$=Q.json,Z=$.textures[J];if(!Z.extensions||!Z.extensions[this.name])return null;let W=Z.extensions[this.name],Y=Q.options.ktx2Loader;if(!Y)if($.extensionsRequired&&$.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");else return null;return Q.loadTextureImage(J,W.source,Y)}}class pE{constructor(J){this.parser=J,this.name=UJ.EXT_TEXTURE_WEBP}loadTexture(J){let Q=this.name,$=this.parser,Z=$.json,W=Z.textures[J];if(!W.extensions||!W.extensions[Q])return null;let Y=W.extensions[Q],X=Z.images[Y.source],K=$.textureLoader;if(X.uri){let H=$.options.manager.getHandler(X.uri);if(H!==null)K=H}return $.loadTextureImage(J,Y.source,K)}}class uE{constructor(J){this.parser=J,this.name=UJ.EXT_TEXTURE_AVIF}loadTexture(J){let Q=this.name,$=this.parser,Z=$.json,W=Z.textures[J];if(!W.extensions||!W.extensions[Q])return null;let Y=W.extensions[Q],X=Z.images[Y.source],K=$.textureLoader;if(X.uri){let H=$.options.manager.getHandler(X.uri);if(H!==null)K=H}return $.loadTextureImage(J,Y.source,K)}}class RH{constructor(J,Q){this.name=Q,this.parser=J}loadBufferView(J){let Q=this.parser.json,$=Q.bufferViews[J];if($.extensions&&$.extensions[this.name]){let Z=$.extensions[this.name],W=this.parser.getDependency("buffer",Z.buffer),Y=this.parser.options.meshoptDecoder;if(!Y||!Y.supported)if(Q.extensionsRequired&&Q.extensionsRequired.indexOf(this.name)>=0)throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");else return null;return W.then(function(X){let K=Z.byteOffset||0,H=Z.byteLength||0,U=Z.count,G=Z.byteStride,F=new Uint8Array(X,K,H);if(Y.decodeGltfBufferAsync)return Y.decodeGltfBufferAsync(U,G,F,Z.mode,Z.filter).then(function(E){return E.buffer});else return Y.ready.then(function(){let E=new ArrayBuffer(U*G);return Y.decodeGltfBuffer(new Uint8Array(E),U,G,F,Z.mode,Z.filter),E})})}else return null}}class dE{constructor(J){this.name=UJ.EXT_MESH_GPU_INSTANCING,this.parser=J}createNodeMesh(J){let Q=this.parser.json,$=Q.nodes[J];if(!$.extensions||!$.extensions[this.name]||$.mesh===void 0)return null;let Z=Q.meshes[$.mesh];for(let H of Z.primitives)if(H.mode!==x9.TRIANGLES&&H.mode!==x9.TRIANGLE_STRIP&&H.mode!==x9.TRIANGLE_FAN&&H.mode!==void 0)return null;let Y=$.extensions[this.name].attributes,X=[],K={};for(let H in Y)X.push(this.parser.getDependency("accessor",Y[H]).then((U)=>{return K[H]=U,K[H]}));if(X.length<1)return null;return X.push(this.parser.createNodeMesh(J)),Promise.all(X).then((H)=>{let U=H.pop(),G=U.isGroup?U.children:[U],F=H[0].count,E=[];for(let O of G){let R=new y0,k=new T,q=new IJ,N=new T(1,1,1),L=new K8(O.geometry,O.material,F);for(let D=0;D<F;D++){if(K.TRANSLATION)k.fromBufferAttribute(K.TRANSLATION,D);if(K.ROTATION)q.fromBufferAttribute(K.ROTATION,D);if(K.SCALE)N.fromBufferAttribute(K.SCALE,D);L.setMatrixAt(D,R.compose(k,q,N))}for(let D in K)if(D==="_COLOR_0"){let V=K[D];L.instanceColor=new l9(V.array,V.itemSize,V.normalized)}else if(D!=="TRANSLATION"&&D!=="ROTATION"&&D!=="SCALE")O.geometry.setAttribute(D,K[D]);HJ.prototype.copy.call(L,O),this.parser.assignFinalMaterial(L),E.push(L)}if(U.isGroup)return U.clear(),U.add(...E),U;return E[0]})}}var mE="glTF",M$=12,BE={JSON:1313821514,BIN:5130562};class lE{constructor(J){this.name=UJ.KHR_BINARY_GLTF,this.content=null,this.body=null;let Q=new DataView(J,0,M$),$=new TextDecoder;if(this.header={magic:$.decode(new Uint8Array(J.slice(0,4))),version:Q.getUint32(4,!0),length:Q.getUint32(8,!0)},this.header.magic!==mE)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");else if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");let Z=this.header.length-M$,W=new DataView(J,M$),Y=0;while(Y<Z){let X=W.getUint32(Y,!0);Y+=4;let K=W.getUint32(Y,!0);if(Y+=4,K===BE.JSON){let H=new Uint8Array(J,M$+Y,X);this.content=$.decode(H)}else if(K===BE.BIN){let H=M$+Y;this.body=J.slice(H,H+X)}Y+=X}if(this.content===null)throw Error("THREE.GLTFLoader: JSON content not found.")}}class cE{constructor(J,Q){if(!Q)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=UJ.KHR_DRACO_MESH_COMPRESSION,this.json=J,this.dracoLoader=Q,this.dracoLoader.preload()}decodePrimitive(J,Q){let $=this.json,Z=this.dracoLoader,W=J.extensions[this.name].bufferView,Y=J.extensions[this.name].attributes,X={},K={},H={};for(let U in Y){let G=LH[U]||U.toLowerCase();X[G]=Y[U]}for(let U in J.attributes){let G=LH[U]||U.toLowerCase();if(Y[U]!==void 0){let F=$.accessors[J.attributes[U]],E=r7[F.componentType];H[G]=E.name,K[G]=F.normalized===!0}}return Q.getDependency("bufferView",W).then(function(U){return new Promise(function(G,F){Z.decodeDracoFile(U,function(E){for(let O in E.attributes){let R=E.attributes[O],k=K[O];if(k!==void 0)R.normalized=k}G(E)},X,H,eJ,F)})})}}class nE{constructor(){this.name=UJ.KHR_TEXTURE_TRANSFORM}extendTexture(J,Q){if((Q.texCoord===void 0||Q.texCoord===J.channel)&&Q.offset===void 0&&Q.rotation===void 0&&Q.scale===void 0)return J;if(J=J.clone(),Q.texCoord!==void 0)J.channel=Q.texCoord;if(Q.offset!==void 0)J.offset.fromArray(Q.offset);if(Q.rotation!==void 0)J.rotation=Q.rotation;if(Q.scale!==void 0)J.repeat.fromArray(Q.scale);return J.needsUpdate=!0,J}}class sE{constructor(){this.name=UJ.KHR_MESH_QUANTIZATION}}class MH extends U8{constructor(J,Q,$,Z){super(J,Q,$,Z)}copySampleValue_(J){let Q=this.resultBuffer,$=this.sampleValues,Z=this.valueSize,W=J*Z*3+Z;for(let Y=0;Y!==Z;Y++)Q[Y]=$[W+Y];return Q}interpolate_(J,Q,$,Z){let W=this.resultBuffer,Y=this.sampleValues,X=this.valueSize,K=X*2,H=X*3,U=Z-Q,G=($-Q)/U,F=G*G,E=F*G,O=J*H,R=O-H,k=-2*E+3*F,q=E-F,N=1-k,L=q-F+G;for(let D=0;D!==X;D++){let V=Y[R+D+X],I=Y[R+D+K]*U,z=Y[O+D+X],B=Y[O+D]*U;W[D]=N*V+L*I+k*z+q*B}return W}}var qD=new IJ;class iE extends MH{interpolate_(J,Q,$,Z){let W=super.interpolate_(J,Q,$,Z);return qD.fromArray(W).normalize().toArray(W),W}}var x9={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},r7={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},CE={9728:A9,9729:jJ,9984:zQ,9985:P6,9986:s8,9987:s9},IE={33071:w6,33648:IQ,10497:I8},NH={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},LH={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Y6={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},RD={CUBICSPLINE:void 0,LINEAR:jQ,STEP:XW},OH={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function LD(J){if(J.DefaultMaterial===void 0)J.DefaultMaterial=new sJ({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:n9});return J.DefaultMaterial}function n6(J,Q,$){for(let Z in $.extensions)if(J[Z]===void 0)Q.userData.gltfExtensions=Q.userData.gltfExtensions||{},Q.userData.gltfExtensions[Z]=$.extensions[Z]}function N8(J,Q){if(Q.extras!==void 0)if(typeof Q.extras==="object")Object.assign(J.userData,Q.extras);else console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+Q.extras)}function DD(J,Q,$){let Z=!1,W=!1,Y=!1;for(let U=0,G=Q.length;U<G;U++){let F=Q[U];if(F.POSITION!==void 0)Z=!0;if(F.NORMAL!==void 0)W=!0;if(F.COLOR_0!==void 0)Y=!0;if(Z&&W&&Y)break}if(!Z&&!W&&!Y)return Promise.resolve(J);let X=[],K=[],H=[];for(let U=0,G=Q.length;U<G;U++){let F=Q[U];if(Z){let E=F.POSITION!==void 0?$.getDependency("accessor",F.POSITION):J.attributes.position;X.push(E)}if(W){let E=F.NORMAL!==void 0?$.getDependency("accessor",F.NORMAL):J.attributes.normal;K.push(E)}if(Y){let E=F.COLOR_0!==void 0?$.getDependency("accessor",F.COLOR_0):J.attributes.color;H.push(E)}}return Promise.all([Promise.all(X),Promise.all(K),Promise.all(H)]).then(function(U){let G=U[0],F=U[1],E=U[2];if(Z)J.morphAttributes.position=G;if(W)J.morphAttributes.normal=F;if(Y)J.morphAttributes.color=E;return J.morphTargetsRelative=!0,J})}function kD(J,Q){if(J.updateMorphTargets(),Q.weights!==void 0)for(let $=0,Z=Q.weights.length;$<Z;$++)J.morphTargetInfluences[$]=Q.weights[$];if(Q.extras&&Array.isArray(Q.extras.targetNames)){let $=Q.extras.targetNames;if(J.morphTargetInfluences.length===$.length){J.morphTargetDictionary={};for(let Z=0,W=$.length;Z<W;Z++)J.morphTargetDictionary[$[Z]]=Z}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function MD(J){let Q,$=J.extensions&&J.extensions[UJ.KHR_DRACO_MESH_COMPRESSION];if($)Q="draco:"+$.bufferView+":"+$.indices+":"+qH($.attributes);else Q=J.indices+":"+qH(J.attributes)+":"+J.mode;if(J.targets!==void 0)for(let Z=0,W=J.targets.length;Z<W;Z++)Q+=":"+qH(J.targets[Z]);return Q}function qH(J){let Q="",$=Object.keys(J).sort();for(let Z=0,W=$.length;Z<W;Z++)Q+=$[Z]+":"+J[$[Z]]+";";return Q}function DH(J){switch(J){case Int8Array:return 0.007874015748031496;case Uint8Array:return 0.00392156862745098;case Int16Array:return 0.00003051850947599719;case Uint16Array:return 0.000015259021896696422;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function VD(J){if(J.search(/\.jpe?g($|\?)/i)>0||J.search(/^data\:image\/jpeg/)===0)return"image/jpeg";if(J.search(/\.webp($|\?)/i)>0||J.search(/^data\:image\/webp/)===0)return"image/webp";if(J.search(/\.ktx2($|\?)/i)>0||J.search(/^data\:image\/ktx2/)===0)return"image/ktx2";return"image/png"}var BD=new y0;class oE{constructor(J={},Q={}){this.json=J,this.extensions={},this.plugins={},this.options=Q,this.cache=new OD,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let $=!1,Z=-1,W=!1,Y=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){let X=navigator.userAgent;$=/^((?!chrome|android).)*safari/i.test(X)===!0;let K=X.match(/Version\/(\d+)/);Z=$&&K?parseInt(K[1],10):-1,W=X.indexOf("Firefox")>-1,Y=W?X.match(/Firefox\/([0-9]+)\./)[1]:-1}if(typeof createImageBitmap>"u"||$&&Z<17||W&&Y<98)this.textureLoader=new u6(this.options.manager);else this.textureLoader=new F$(this.options.manager);if(this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new G9(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials")this.fileLoader.setWithCredentials(!0)}setExtensions(J){this.extensions=J}setPlugins(J){this.plugins=J}parse(J,Q){let $=this,Z=this.json,W=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(Y){return Y._markDefs&&Y._markDefs()}),Promise.all(this._invokeAll(function(Y){return Y.beforeRoot&&Y.beforeRoot()})).then(function(){return Promise.all([$.getDependencies("scene"),$.getDependencies("animation"),$.getDependencies("camera")])}).then(function(Y){let X={scene:Y[0][Z.scene||0],scenes:Y[0],animations:Y[1],cameras:Y[2],asset:Z.asset,parser:$,userData:{}};return n6(W,X,Z),N8(X,Z),Promise.all($._invokeAll(function(K){return K.afterRoot&&K.afterRoot(X)})).then(function(){for(let K of X.scenes)K.updateMatrixWorld();J(X)})}).catch(Q)}_markDefs(){let J=this.json.nodes||[],Q=this.json.skins||[],$=this.json.meshes||[];for(let Z=0,W=Q.length;Z<W;Z++){let Y=Q[Z].joints;for(let X=0,K=Y.length;X<K;X++)J[Y[X]].isBone=!0}for(let Z=0,W=J.length;Z<W;Z++){let Y=J[Z];if(Y.mesh!==void 0){if(this._addNodeRef(this.meshCache,Y.mesh),Y.skin!==void 0)$[Y.mesh].isSkinnedMesh=!0}if(Y.camera!==void 0)this._addNodeRef(this.cameraCache,Y.camera)}}_addNodeRef(J,Q){if(Q===void 0)return;if(J.refs[Q]===void 0)J.refs[Q]=J.uses[Q]=0;J.refs[Q]++}_getNodeRef(J,Q,$){if(J.refs[Q]<=1)return $;let Z=$.clone(),W=(Y,X)=>{let K=this.associations.get(Y);if(K!=null)this.associations.set(X,K);for(let[H,U]of Y.children.entries())W(U,X.children[H])};return W($,Z),Z.name+="_instance_"+J.uses[Q]++,Z}_invokeOne(J){let Q=Object.values(this.plugins);Q.push(this);for(let $=0;$<Q.length;$++){let Z=J(Q[$]);if(Z)return Z}return null}_invokeAll(J){let Q=Object.values(this.plugins);Q.unshift(this);let $=[];for(let Z=0;Z<Q.length;Z++){let W=J(Q[Z]);if(W)$.push(W)}return $}getDependency(J,Q){let $=J+":"+Q,Z=this.cache.get($);if(!Z){switch(J){case"scene":Z=this.loadScene(Q);break;case"node":Z=this._invokeOne(function(W){return W.loadNode&&W.loadNode(Q)});break;case"mesh":Z=this._invokeOne(function(W){return W.loadMesh&&W.loadMesh(Q)});break;case"accessor":Z=this.loadAccessor(Q);break;case"bufferView":Z=this._invokeOne(function(W){return W.loadBufferView&&W.loadBufferView(Q)});break;case"buffer":Z=this.loadBuffer(Q);break;case"material":Z=this._invokeOne(function(W){return W.loadMaterial&&W.loadMaterial(Q)});break;case"texture":Z=this._invokeOne(function(W){return W.loadTexture&&W.loadTexture(Q)});break;case"skin":Z=this.loadSkin(Q);break;case"animation":Z=this._invokeOne(function(W){return W.loadAnimation&&W.loadAnimation(Q)});break;case"camera":Z=this.loadCamera(Q);break;default:if(Z=this._invokeOne(function(W){return W!=this&&W.getDependency&&W.getDependency(J,Q)}),!Z)throw Error("Unknown type: "+J);break}this.cache.add($,Z)}return Z}getDependencies(J){let Q=this.cache.get(J);if(!Q){let $=this,Z=this.json[J+(J==="mesh"?"es":"s")]||[];Q=Promise.all(Z.map(function(W,Y){return $.getDependency(J,Y)})),this.cache.add(J,Q)}return Q}loadBuffer(J){let Q=this.json.buffers[J],$=this.fileLoader;if(Q.type&&Q.type!=="arraybuffer")throw Error("THREE.GLTFLoader: "+Q.type+" buffer type is not supported.");if(Q.uri===void 0&&J===0)return Promise.resolve(this.extensions[UJ.KHR_BINARY_GLTF].body);let Z=this.options;return new Promise(function(W,Y){$.load(c9.resolveURL(Q.uri,Z.path),W,void 0,function(){Y(Error('THREE.GLTFLoader: Failed to load buffer "'+Q.uri+'".'))})})}loadBufferView(J){let Q=this.json.bufferViews[J];return this.getDependency("buffer",Q.buffer).then(function($){let Z=Q.byteLength||0,W=Q.byteOffset||0;return $.slice(W,W+Z)})}loadAccessor(J){let Q=this,$=this.json,Z=this.json.accessors[J];if(Z.bufferView===void 0&&Z.sparse===void 0){let Y=NH[Z.type],X=r7[Z.componentType],K=Z.normalized===!0,H=new X(Z.count*Y);return Promise.resolve(new i0(H,Y,K))}let W=[];if(Z.bufferView!==void 0)W.push(this.getDependency("bufferView",Z.bufferView));else W.push(null);if(Z.sparse!==void 0)W.push(this.getDependency("bufferView",Z.sparse.indices.bufferView)),W.push(this.getDependency("bufferView",Z.sparse.values.bufferView));return Promise.all(W).then(function(Y){let X=Y[0],K=NH[Z.type],H=r7[Z.componentType],U=H.BYTES_PER_ELEMENT,G=U*K,F=Z.byteOffset||0,E=Z.bufferView!==void 0?$.bufferViews[Z.bufferView].byteStride:void 0,O=Z.normalized===!0,R,k;if(E&&E!==G){let q=Math.floor(F/E),N="InterleavedBuffer:"+Z.bufferView+":"+Z.componentType+":"+q+":"+Z.count,L=Q.cache.get(N);if(!L)R=new H(X,q*E,Z.count*E/U),L=new w8(R,E/U),Q.cache.add(N,L);k=new m9(L,K,F%E/U,O)}else{if(X===null)R=new H(Z.count*K);else R=new H(X,F,Z.count*K);k=new i0(R,K,O)}if(Z.sparse!==void 0){let q=NH.SCALAR,N=r7[Z.sparse.indices.componentType],L=Z.sparse.indices.byteOffset||0,D=Z.sparse.values.byteOffset||0,V=new N(Y[1],L,Z.sparse.count*q),I=new H(Y[2],D,Z.sparse.count*K);if(X!==null)k=new i0(k.array.slice(),k.itemSize,k.normalized);k.normalized=!1;for(let z=0,B=V.length;z<B;z++){let M=V[z];if(k.setX(M,I[z*K]),K>=2)k.setY(M,I[z*K+1]);if(K>=3)k.setZ(M,I[z*K+2]);if(K>=4)k.setW(M,I[z*K+3]);if(K>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}k.normalized=O}return k})}loadTexture(J){let Q=this.json,$=this.options,W=Q.textures[J].source,Y=Q.images[W],X=this.textureLoader;if(Y.uri){let K=$.manager.getHandler(Y.uri);if(K!==null)X=K}return this.loadTextureImage(J,W,X)}loadTextureImage(J,Q,$){let Z=this,W=this.json,Y=W.textures[J],X=W.images[Q],K=(X.uri||X.bufferView)+":"+Y.sampler;if(this.textureCache[K])return this.textureCache[K];let H=this.loadImageSource(Q,$).then(function(U){if(U.flipY=!1,U.name=Y.name||X.name||"",U.name===""&&typeof X.uri==="string"&&X.uri.startsWith("data:image/")===!1)U.name=X.uri;let F=(W.samplers||{})[Y.sampler]||{};return U.magFilter=CE[F.magFilter]||jJ,U.minFilter=CE[F.minFilter]||s9,U.wrapS=IE[F.wrapS]||I8,U.wrapT=IE[F.wrapT]||I8,U.generateMipmaps=!U.isCompressedTexture&&U.minFilter!==A9&&U.minFilter!==jJ,Z.associations.set(U,{textures:J}),U}).catch(function(){return null});return this.textureCache[K]=H,H}loadImageSource(J,Q){let $=this,Z=this.json,W=this.options;if(this.sourceCache[J]!==void 0)return this.sourceCache[J].then((G)=>G.clone());let Y=Z.images[J],X=self.URL||self.webkitURL,K=Y.uri||"",H=!1;if(Y.bufferView!==void 0)K=$.getDependency("bufferView",Y.bufferView).then(function(G){H=!0;let F=new Blob([G],{type:Y.mimeType});return K=X.createObjectURL(F),K});else if(Y.uri===void 0)throw Error("THREE.GLTFLoader: Image "+J+" is missing URI and bufferView");let U=Promise.resolve(K).then(function(G){return new Promise(function(F,E){let O=F;if(Q.isImageBitmapLoader===!0)O=function(R){let k=new MJ(R);k.needsUpdate=!0,F(k)};Q.load(c9.resolveURL(G,W.path),O,void 0,E)})}).then(function(G){if(H===!0)X.revokeObjectURL(K);return N8(G,Y),G.userData.mimeType=Y.mimeType||VD(Y.uri),G}).catch(function(G){throw console.error("THREE.GLTFLoader: Couldn't load texture",K),G});return this.sourceCache[J]=U,U}assignTexture(J,Q,$,Z){let W=this;return this.getDependency("texture",$.index).then(function(Y){if(!Y)return null;if($.texCoord!==void 0&&$.texCoord>0)Y=Y.clone(),Y.channel=$.texCoord;if(W.extensions[UJ.KHR_TEXTURE_TRANSFORM]){let X=$.extensions!==void 0?$.extensions[UJ.KHR_TEXTURE_TRANSFORM]:void 0;if(X){let K=W.associations.get(Y);Y=W.extensions[UJ.KHR_TEXTURE_TRANSFORM].extendTexture(Y,X),W.associations.set(Y,K)}}if(Z!==void 0)Y.colorSpace=Z;return J[Q]=Y,Y})}assignFinalMaterial(J){let{geometry:Q,material:$}=J,Z=Q.attributes.tangent===void 0,W=Q.attributes.color!==void 0,Y=Q.attributes.normal===void 0;if(J.isPoints){let X="PointsMaterial:"+$.uuid,K=this.cache.get(X);if(!K)K=new x6,vJ.prototype.copy.call(K,$),K.color.copy($.color),K.map=$.map,K.sizeAttenuation=!1,this.cache.add(X,K);$=K}else if(J.isLine){let X="LineBasicMaterial:"+$.uuid,K=this.cache.get(X);if(!K)K=new uJ,vJ.prototype.copy.call(K,$),K.color.copy($.color),K.map=$.map,this.cache.add(X,K);$=K}if(Z||W||Y){let X="ClonedMaterial:"+$.uuid+":";if(Z)X+="derivative-tangents:";if(W)X+="vertex-colors:";if(Y)X+="flat-shading:";let K=this.cache.get(X);if(!K){if(K=$.clone(),W)K.vertexColors=!0;if(Y)K.flatShading=!0;if(Z){if(K.normalScale)K.normalScale.y*=-1;if(K.clearcoatNormalScale)K.clearcoatNormalScale.y*=-1}this.cache.add(X,K),this.associations.set(K,this.associations.get($))}$=K}J.material=$}getMaterialType(){return sJ}loadMaterial(J){let Q=this,$=this.json,Z=this.extensions,W=$.materials[J],Y,X={},K=W.extensions||{},H=[];if(K[UJ.KHR_MATERIALS_UNLIT]){let G=Z[UJ.KHR_MATERIALS_UNLIT];Y=G.getMaterialType(),H.push(G.extendParams(X,W,Q))}else{let G=W.pbrMetallicRoughness||{};if(X.color=new e(1,1,1),X.opacity=1,Array.isArray(G.baseColorFactor)){let F=G.baseColorFactor;X.color.setRGB(F[0],F[1],F[2],eJ),X.opacity=F[3]}if(G.baseColorTexture!==void 0)H.push(Q.assignTexture(X,"map",G.baseColorTexture,_8));if(X.metalness=G.metallicFactor!==void 0?G.metallicFactor:1,X.roughness=G.roughnessFactor!==void 0?G.roughnessFactor:1,G.metallicRoughnessTexture!==void 0)H.push(Q.assignTexture(X,"metalnessMap",G.metallicRoughnessTexture)),H.push(Q.assignTexture(X,"roughnessMap",G.metallicRoughnessTexture));Y=this._invokeOne(function(F){return F.getMaterialType&&F.getMaterialType(J)}),H.push(Promise.all(this._invokeAll(function(F){return F.extendMaterialParams&&F.extendMaterialParams(J,X)})))}if(W.doubleSided===!0)X.side=Y9;let U=W.alphaMode||OH.OPAQUE;if(U===OH.BLEND)X.transparent=!0,X.depthWrite=!1;else if(X.transparent=!1,U===OH.MASK)X.alphaTest=W.alphaCutoff!==void 0?W.alphaCutoff:0.5;if(W.normalTexture!==void 0&&Y!==cJ){if(H.push(Q.assignTexture(X,"normalMap",W.normalTexture)),X.normalScale=new i(1,1),W.normalTexture.scale!==void 0){let G=W.normalTexture.scale;X.normalScale.set(G,G)}}if(W.occlusionTexture!==void 0&&Y!==cJ){if(H.push(Q.assignTexture(X,"aoMap",W.occlusionTexture)),W.occlusionTexture.strength!==void 0)X.aoMapIntensity=W.occlusionTexture.strength}if(W.emissiveFactor!==void 0&&Y!==cJ){let G=W.emissiveFactor;X.emissive=new e().setRGB(G[0],G[1],G[2],eJ)}if(W.emissiveTexture!==void 0&&Y!==cJ)H.push(Q.assignTexture(X,"emissiveMap",W.emissiveTexture,_8));return Promise.all(H).then(function(){let G=new Y(X);if(W.name)G.name=W.name;if(N8(G,W),Q.associations.set(G,{materials:J}),W.extensions)n6(Z,G,W);return G})}createUniqueName(J){let Q=GJ.sanitizeNodeName(J||"");if(Q in this.nodeNamesUsed)return Q+"_"+ ++this.nodeNamesUsed[Q];else return this.nodeNamesUsed[Q]=0,Q}loadGeometries(J){let Q=this,$=this.extensions,Z=this.primitiveCache;function W(X){return $[UJ.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(X,Q).then(function(K){return zE(K,X,Q)})}let Y=[];for(let X=0,K=J.length;X<K;X++){let H=J[X],U=MD(H),G=Z[U];if(G)Y.push(G.promise);else{let F;if(H.extensions&&H.extensions[UJ.KHR_DRACO_MESH_COMPRESSION])F=W(H);else F=zE(new u0,H,Q);Z[U]={primitive:H,promise:F},Y.push(F)}}return Promise.all(Y)}loadMesh(J){let Q=this,$=this.json,Z=this.extensions,W=$.meshes[J],Y=W.primitives,X=[];for(let K=0,H=Y.length;K<H;K++){let U=Y[K].material===void 0?LD(this.cache):this.getDependency("material",Y[K].material);X.push(U)}return X.push(Q.loadGeometries(Y)),Promise.all(X).then(function(K){let H=K.slice(0,K.length-1),U=K[K.length-1],G=[];for(let E=0,O=U.length;E<O;E++){let R=U[E],k=Y[E],q,N=H[E];if(k.mode===x9.TRIANGLES||k.mode===x9.TRIANGLE_STRIP||k.mode===x9.TRIANGLE_FAN||k.mode===void 0){if(q=W.isSkinnedMesh===!0?new h7(R,N):new a0(R,N),q.isSkinnedMesh===!0)q.normalizeSkinWeights();if(k.mode===x9.TRIANGLE_STRIP)q.geometry=FH(q.geometry,j7);else if(k.mode===x9.TRIANGLE_FAN)q.geometry=FH(q.geometry,A6)}else if(k.mode===x9.LINES)q=new N9(R,N);else if(k.mode===x9.LINE_STRIP)q=new T9(R,N);else if(k.mode===x9.LINE_LOOP)q=new f7(R,N);else if(k.mode===x9.POINTS)q=new o9(R,N);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+k.mode);if(Object.keys(q.geometry.morphAttributes).length>0)kD(q,W);if(q.name=Q.createUniqueName(W.name||"mesh_"+J),N8(q,W),k.extensions)n6(Z,q,k);Q.assignFinalMaterial(q),G.push(q)}for(let E=0,O=G.length;E<O;E++)Q.associations.set(G[E],{meshes:J,primitives:E});if(G.length===1){if(W.extensions)n6(Z,G[0],W);return G[0]}let F=new U9;if(W.extensions)n6(Z,F,W);Q.associations.set(F,{meshes:J});for(let E=0,O=G.length;E<O;E++)F.add(G[E]);return F})}loadCamera(J){let Q,$=this.json.cameras[J],Z=$[$.type];if(!Z){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}if($.type==="perspective")Q=new BJ(j6.radToDeg(Z.yfov),Z.aspectRatio||1,Z.znear||1,Z.zfar||2000000);else if($.type==="orthographic")Q=new a9(-Z.xmag,Z.xmag,Z.ymag,-Z.ymag,Z.znear,Z.zfar);if($.name)Q.name=this.createUniqueName($.name);return N8(Q,$),Promise.resolve(Q)}loadSkin(J){let Q=this.json.skins[J],$=[];for(let Z=0,W=Q.joints.length;Z<W;Z++)$.push(this._loadNodeShallow(Q.joints[Z]));if(Q.inverseBindMatrices!==void 0)$.push(this.getDependency("accessor",Q.inverseBindMatrices));else $.push(null);return Promise.all($).then(function(Z){let W=Z.pop(),Y=Z,X=[],K=[];for(let H=0,U=Y.length;H<U;H++){let G=Y[H];if(G){X.push(G);let F=new y0;if(W!==null)F.fromArray(W.array,H*16);K.push(F)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',Q.joints[H])}return new y6(X,K)})}loadAnimation(J){let Q=this.json,$=this,Z=Q.animations[J],W=Z.name?Z.name:"animation_"+J,Y=[],X=[],K=[],H=[],U=[];for(let G=0,F=Z.channels.length;G<F;G++){let E=Z.channels[G],O=Z.samplers[E.sampler],R=E.target,k=R.node,q=Z.parameters!==void 0?Z.parameters[O.input]:O.input,N=Z.parameters!==void 0?Z.parameters[O.output]:O.output;if(R.node===void 0)continue;Y.push(this.getDependency("node",k)),X.push(this.getDependency("accessor",q)),K.push(this.getDependency("accessor",N)),H.push(O),U.push(R)}return Promise.all([Promise.all(Y),Promise.all(X),Promise.all(K),Promise.all(H),Promise.all(U)]).then(function(G){let F=G[0],E=G[1],O=G[2],R=G[3],k=G[4],q=[];for(let L=0,D=F.length;L<D;L++){let V=F[L],I=E[L],z=O[L],B=R[L],M=k[L];if(V===void 0)continue;if(V.updateMatrix)V.updateMatrix();let C=$._createAnimationTracks(V,I,z,B,M);if(C)for(let j=0;j<C.length;j++)q.push(C[j])}let N=new C8(W,void 0,q);return N8(N,Z),N})}createNodeMesh(J){let Q=this.json,$=this,Z=Q.nodes[J];if(Z.mesh===void 0)return null;return $.getDependency("mesh",Z.mesh).then(function(W){let Y=$._getNodeRef($.meshCache,Z.mesh,W);if(Z.weights!==void 0)Y.traverse(function(X){if(!X.isMesh)return;for(let K=0,H=Z.weights.length;K<H;K++)X.morphTargetInfluences[K]=Z.weights[K]});return Y})}loadNode(J){let Q=this.json,$=this,Z=Q.nodes[J],W=$._loadNodeShallow(J),Y=[],X=Z.children||[];for(let H=0,U=X.length;H<U;H++)Y.push($.getDependency("node",X[H]));let K=Z.skin===void 0?Promise.resolve(null):$.getDependency("skin",Z.skin);return Promise.all([W,Promise.all(Y),K]).then(function(H){let U=H[0],G=H[1],F=H[2];if(F!==null)U.traverse(function(E){if(!E.isSkinnedMesh)return;E.bind(F,BD)});for(let E=0,O=G.length;E<O;E++)U.add(G[E]);if(U.userData.pivot!==void 0&&G.length>0){let E=U.userData.pivot,O=G[0];U.pivot=new T().fromArray(E),U.position.x-=E[0],U.position.y-=E[1],U.position.z-=E[2],O.position.set(0,0,0),delete U.userData.pivot}return U})}_loadNodeShallow(J){let Q=this.json,$=this.extensions,Z=this;if(this.nodeCache[J]!==void 0)return this.nodeCache[J];let W=Q.nodes[J],Y=W.name?Z.createUniqueName(W.name):"",X=[],K=Z._invokeOne(function(H){return H.createNodeMesh&&H.createNodeMesh(J)});if(K)X.push(K);if(W.camera!==void 0)X.push(Z.getDependency("camera",W.camera).then(function(H){return Z._getNodeRef(Z.cameraCache,W.camera,H)}));return Z._invokeAll(function(H){return H.createNodeAttachment&&H.createNodeAttachment(J)}).forEach(function(H){X.push(H)}),this.nodeCache[J]=Promise.all(X).then(function(H){let U;if(W.isBone===!0)U=new v6;else if(H.length>1)U=new U9;else if(H.length===1)U=H[0];else U=new HJ;if(U!==H[0])for(let G=0,F=H.length;G<F;G++)U.add(H[G]);if(W.name)U.userData.name=W.name,U.name=Y;if(N8(U,W),W.extensions)n6($,U,W);if(W.matrix!==void 0){let G=new y0;G.fromArray(W.matrix),U.applyMatrix4(G)}else{if(W.translation!==void 0)U.position.fromArray(W.translation);if(W.rotation!==void 0)U.quaternion.fromArray(W.rotation);if(W.scale!==void 0)U.scale.fromArray(W.scale)}if(!Z.associations.has(U))Z.associations.set(U,{});else if(W.mesh!==void 0&&Z.meshCache.refs[W.mesh]>1){let G=Z.associations.get(U);Z.associations.set(U,{...G})}return Z.associations.get(U).nodes=J,U}),this.nodeCache[J]}loadScene(J){let Q=this.extensions,$=this.json.scenes[J],Z=this,W=new U9;if($.name)W.name=Z.createUniqueName($.name);if(N8(W,$),$.extensions)n6(Q,W,$);let Y=$.nodes||[],X=[];for(let K=0,H=Y.length;K<H;K++)X.push(Z.getDependency("node",Y[K]));return Promise.all(X).then(function(K){for(let U=0,G=K.length;U<G;U++){let F=K[U];if(F.parent!==null)W.add(ME(F));else W.add(F)}let H=(U)=>{let G=new Map;for(let[F,E]of Z.associations)if(F instanceof vJ||F instanceof MJ)G.set(F,E);return U.traverse((F)=>{let E=Z.associations.get(F);if(E!=null)G.set(F,E)}),G};return Z.associations=H(W),W})}_createAnimationTracks(J,Q,$,Z,W){let Y=[],X=J.name?J.name:J.uuid,K=[];function H(E){if(E.morphTargetInfluences)K.push(E.name?E.name:E.uuid)}if(Y6[W.path]===Y6.weights){if(H(J),J.isGroup)J.children.forEach(H)}else K.push(X);let U;switch(Y6[W.path]){case Y6.weights:U=Y8;break;case Y6.rotation:U=G8;break;case Y6.translation:case Y6.scale:U=X8;break;default:switch($.itemSize){case 1:U=Y8;break;case 2:case 3:default:U=X8;break}break}let G=Z.interpolation!==void 0?RD[Z.interpolation]:jQ,F=this._getArrayFromAccessor($);for(let E=0,O=K.length;E<O;E++){let R=new U(K[E]+"."+Y6[W.path],Q.array,F,G);if(Z.interpolation==="CUBICSPLINE")this._createCubicSplineTrackInterpolant(R);Y.push(R)}return Y}_getArrayFromAccessor(J){let Q=J.array;if(J.normalized){let $=DH(Q.constructor),Z=new Float32Array(Q.length);for(let W=0,Y=Q.length;W<Y;W++)Z[W]=Q[W]*$;Q=Z}return Q}_createCubicSplineTrackInterpolant(J){J.createInterpolant=function($){return new(this instanceof G8?iE:MH)(this.times,this.values,this.getValueSize()/3,$)},J.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function CD(J,Q,$){let Z=Q.attributes,W=new SJ;if(Z.POSITION!==void 0){let K=$.json.accessors[Z.POSITION],H=K.min,U=K.max;if(H!==void 0&&U!==void 0){if(W.set(new T(H[0],H[1],H[2]),new T(U[0],U[1],U[2])),K.normalized){let G=DH(r7[K.componentType]);W.min.multiplyScalar(G),W.max.multiplyScalar(G)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let Y=Q.targets;if(Y!==void 0){let K=new T,H=new T;for(let U=0,G=Y.length;U<G;U++){let F=Y[U];if(F.POSITION!==void 0){let E=$.json.accessors[F.POSITION],O=E.min,R=E.max;if(O!==void 0&&R!==void 0){if(H.setX(Math.max(Math.abs(O[0]),Math.abs(R[0]))),H.setY(Math.max(Math.abs(O[1]),Math.abs(R[1]))),H.setZ(Math.max(Math.abs(O[2]),Math.abs(R[2]))),E.normalized){let k=DH(r7[E.componentType]);H.multiplyScalar(k)}K.max(H)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}W.expandByVector(K)}J.boundingBox=W;let X=new _J;W.getCenter(X.center),X.radius=W.min.distanceTo(W.max)/2,J.boundingSphere=X}function zE(J,Q,$){let Z=Q.attributes,W=[];function Y(X,K){return $.getDependency("accessor",X).then(function(H){J.setAttribute(K,H)})}for(let X in Z){let K=LH[X]||X.toLowerCase();if(K in J.attributes)continue;W.push(Y(Z[X],K))}if(Q.indices!==void 0&&!J.index){let X=$.getDependency("accessor",Q.indices).then(function(K){J.setIndex(K)});W.push(X)}if(t0.workingColorSpace!==eJ&&"COLOR_0"in Z)console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${t0.workingColorSpace}" not supported.`);return N8(J,Q),CD(J,Q,$),Promise.all(W).then(function(){return Q.targets!==void 0?DD(J,Q.targets,$):J})}class VH extends U${constructor(J){super(J);this.type=wJ}parse(J){let Y=function(B,M){switch(B){case 1:throw Error("THREE.HDRLoader: Read Error: "+(M||""));case 2:throw Error("THREE.HDRLoader: Write Error: "+(M||""));case 3:throw Error("THREE.HDRLoader: Bad File Format: "+(M||""));default:case 4:throw Error("THREE.HDRLoader: Memory Error: "+(M||""))}},G=function(B,M,C){M=!M?1024:M;let w=B.pos,v=-1,b=0,S="",h=String.fromCharCode.apply(null,new Uint16Array(B.subarray(w,w+128)));while(0>(v=h.indexOf(`
4105
+ `))&&b<M&&w<B.byteLength)S+=h,b+=h.length,w+=128,h=String.fromCharCode.apply(null,new Uint16Array(B.subarray(w,w+128)));if(-1<v){if(C!==!1)B.pos+=b+v+1;return S+h.slice(0,v)}return!1},F=function(B){let M=/^#\?(\S+)/,C=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,j=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,w=/^\s*FORMAT=(\S+)\s*$/,v=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,b={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0},S,h;if(B.pos>=B.byteLength||!(S=G(B)))Y(1,"no header found");if(!(h=S.match(M)))Y(3,"bad initial token");b.valid|=1,b.programtype=h[1],b.string+=S+`
4106
+ `;while(!0){if(S=G(B),S===!1)break;if(b.string+=S+`
4107
+ `,S.charAt(0)==="#"){b.comments+=S+`
4108
+ `;continue}if(h=S.match(C))b.gamma=parseFloat(h[1]);if(h=S.match(j))b.exposure=parseFloat(h[1]);if(h=S.match(w))b.valid|=2,b.format=h[1];if(h=S.match(v))b.valid|=4,b.height=parseInt(h[1],10),b.width=parseInt(h[2],10);if(b.valid&2&&b.valid&4)break}if(!(b.valid&2))Y(3,"missing format specifier");if(!(b.valid&4))Y(3,"missing image size specifier");return b},E=function(B,M,C){let j=M;if(j<8||j>32767||(B[0]!==2||B[1]!==2||B[2]&128))return new Uint8Array(B);if(j!==(B[2]<<8|B[3]))Y(3,"wrong scanline width");let w=new Uint8Array(4*M*C);if(!w.length)Y(4,"unable to allocate buffer space");let v=0,b=0,S=4*j,h=new Uint8Array(4),x=new Uint8Array(S),p=C;while(p>0&&b<B.byteLength){if(b+4>B.byteLength)Y(1);if(h[0]=B[b++],h[1]=B[b++],h[2]=B[b++],h[3]=B[b++],h[0]!=2||h[1]!=2||(h[2]<<8|h[3])!=j)Y(3,"bad rgbe scanline format");let c=0,o;while(c<S&&b<B.byteLength){o=B[b++];let H0=o>128;if(H0)o-=128;if(o===0||c+o>S)Y(3,"bad scanline data");if(H0){let J0=B[b++];for(let c0=0;c0<o;c0++)x[c++]=J0}else x.set(B.subarray(b,b+o),c),c+=o,b+=o}let W0=j;for(let H0=0;H0<W0;H0++){let J0=0;w[v]=x[H0+J0],J0+=j,w[v+1]=x[H0+J0],J0+=j,w[v+2]=x[H0+J0],J0+=j,w[v+3]=x[H0+J0],v+=4}p--}return w},O=function(B,M,C,j){let w=B[M+3],v=Math.pow(2,w-128)/255;C[j+0]=B[M+0]*v,C[j+1]=B[M+1]*v,C[j+2]=B[M+2]*v,C[j+3]=1},R=function(B,M,C,j){let w=B[M+3],v=Math.pow(2,w-128)/255;C[j+0]=e8.toHalfFloat(Math.min(B[M+0]*v,65504)),C[j+1]=e8.toHalfFloat(Math.min(B[M+1]*v,65504)),C[j+2]=e8.toHalfFloat(Math.min(B[M+2]*v,65504)),C[j+3]=e8.toHalfFloat(1)},k=new Uint8Array(J);k.pos=0;let q=F(k),N=q.width,L=q.height,D=E(k.subarray(k.pos),N,L),V,I,z;switch(this.type){case F9:z=D.length/4;let B=new Float32Array(z*4);for(let C=0;C<z;C++)O(D,C*4,B,C*4);V=B,I=F9;break;case wJ:z=D.length/4;let M=new Uint16Array(z*4);for(let C=0;C<z;C++)R(D,C*4,M,C*4);V=M,I=wJ;break;default:throw Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:N,height:L,data:V,header:q.string,gamma:q.gamma,exposure:q.exposure,type:I}}setDataType(J){return this.type=J,this}load(J,Q,$,Z){function W(Y,X){switch(Y.type){case F9:case wJ:Y.colorSpace=eJ,Y.minFilter=jJ,Y.magFilter=jJ,Y.generateMipmaps=!1,Y.flipY=!0;break}if(Q)Q(Y,X)}return super.load(J,W,$,Z)}}var V$=new T;function b9(J,Q,$,Z,W,Y){let X=2*Math.PI*W/4,K=Math.max(Y-2*W,0),H=Math.PI/4;V$.copy(Q),V$[Z]=0,V$.normalize();let U=0.5*X/(X+K),G=1-V$.angleTo(J)/H;if(Math.sign(V$[$])===1)return G*U;else return K/(X+K)+U+U*(1-G)}class XY extends J9{constructor(J=1,Q=1,$=1,Z=2,W=0.1){let Y=Z*2+1;W=Math.min(J/2,Q/2,$/2,W);super(1,1,1,Y,Y,Y);if(this.type="RoundedBoxGeometry",this.parameters={width:J,height:Q,depth:$,segments:Z,radius:W},Y===1)return;let X=this.toNonIndexed();this.index=null,this.attributes.position=X.attributes.position,this.attributes.normal=X.attributes.normal,this.attributes.uv=X.attributes.uv;let K=new T,H=new T,U=new T(J,Q,$).divideScalar(2).subScalar(W),G=this.attributes.position.array,F=this.attributes.normal.array,E=this.attributes.uv.array,O=G.length/6,R=new T,k=0.5/Y;for(let q=0,N=0;q<G.length;q+=3,N+=2)switch(K.fromArray(G,q),H.copy(K),H.x-=Math.sign(H.x)*k,H.y-=Math.sign(H.y)*k,H.z-=Math.sign(H.z)*k,H.normalize(),G[q+0]=U.x*Math.sign(K.x)+H.x*W,G[q+1]=U.y*Math.sign(K.y)+H.y*W,G[q+2]=U.z*Math.sign(K.z)+H.z*W,F[q+0]=H.x,F[q+1]=H.y,F[q+2]=H.z,Math.floor(q/O)){case 0:R.set(1,0,0),E[N+0]=b9(R,H,"z","y",W,$),E[N+1]=1-b9(R,H,"y","z",W,Q);break;case 1:R.set(-1,0,0),E[N+0]=1-b9(R,H,"z","y",W,$),E[N+1]=1-b9(R,H,"y","z",W,Q);break;case 2:R.set(0,1,0),E[N+0]=1-b9(R,H,"x","z",W,J),E[N+1]=b9(R,H,"z","x",W,$);break;case 3:R.set(0,-1,0),E[N+0]=1-b9(R,H,"x","z",W,J),E[N+1]=1-b9(R,H,"z","x",W,$);break;case 4:R.set(0,0,1),E[N+0]=1-b9(R,H,"x","y",W,J),E[N+1]=1-b9(R,H,"y","x",W,Q);break;case 5:R.set(0,0,-1),E[N+0]=b9(R,H,"x","y",W,J),E[N+1]=1-b9(R,H,"y","x",W,Q);break}}static fromJSON(J){return new XY(J.width,J.height,J.depth,J.segments,J.radius)}}class BH extends t8{constructor(){super();this.name="RoomEnvironment",this.position.y=-3.5;let J=new J9;J.deleteAttribute("uv");let Q=new sJ({side:pJ}),$=new sJ,Z=new E8(16777215,900,28,2);Z.position.set(0.418,16.199,0.3),this.add(Z);let W=new a0(J,Q);W.position.set(-0.757,13.219,0.717),W.scale.set(31.713,28.305,28.591),this.add(W);let Y=new K8(J,$,6),X=new HJ;X.position.set(-10.906,2.009,1.846),X.rotation.set(0,-0.195,0),X.scale.set(2.328,7.905,4.651),X.updateMatrix(),Y.setMatrixAt(0,X.matrix),X.position.set(-5.607,-0.754,-0.758),X.rotation.set(0,0.994,0),X.scale.set(1.97,1.534,3.955),X.updateMatrix(),Y.setMatrixAt(1,X.matrix),X.position.set(6.167,0.857,7.803),X.rotation.set(0,0.561,0),X.scale.set(3.927,6.285,3.687),X.updateMatrix(),Y.setMatrixAt(2,X.matrix),X.position.set(-2.017,0.018,6.124),X.rotation.set(0,0.333,0),X.scale.set(2.002,4.566,2.064),X.updateMatrix(),Y.setMatrixAt(3,X.matrix),X.position.set(2.291,-0.756,-2.621),X.rotation.set(0,-0.286,0),X.scale.set(1.546,1.552,1.496),X.updateMatrix(),Y.setMatrixAt(4,X.matrix),X.position.set(-2.193,-0.369,-5.547),X.rotation.set(0,0.516,0),X.scale.set(3.875,3.487,2.986),X.updateMatrix(),Y.setMatrixAt(5,X.matrix),this.add(Y);let K=new a0(J,t7(50));K.position.set(-16.116,14.37,8.208),K.scale.set(0.1,2.428,2.739),this.add(K);let H=new a0(J,t7(50));H.position.set(-16.109,18.021,-8.207),H.scale.set(0.1,2.425,2.751),this.add(H);let U=new a0(J,t7(17));U.position.set(14.904,12.198,-1.832),U.scale.set(0.15,4.265,6.331),this.add(U);let G=new a0(J,t7(43));G.position.set(-0.462,8.89,14.52),G.scale.set(4.38,5.441,0.088),this.add(G);let F=new a0(J,t7(20));F.position.set(3.235,11.486,-12.541),F.scale.set(2.5,2,0.1),this.add(F);let E=new a0(J,t7(100));E.position.set(0,20,0),E.scale.set(1,0.1,1),this.add(E)}dispose(){let J=new Set;this.traverse((Q)=>{if(Q.isMesh)J.add(Q.geometry),J.add(Q.material)});for(let Q of J)Q.dispose()}}function t7(J){return new l7({color:0,emissive:16777215,emissiveIntensity:J})}var e7={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
4109
+
4110
+ varying vec2 vUv;
4111
+
4112
+ void main() {
4113
+
4114
+ vUv = uv;
4115
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
4116
+
4117
+ }`,fragmentShader:`
4118
+
4119
+ uniform float opacity;
4120
+
4121
+ uniform sampler2D tDiffuse;
4122
+
4123
+ varying vec2 vUv;
4124
+
4125
+ void main() {
4126
+
4127
+ vec4 texel = texture2D( tDiffuse, vUv );
4128
+ gl_FragColor = opacity * texel;
4129
+
4130
+
4131
+ }`};class h9{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}var ID=new a9(-1,1,1,-1,0,1);class aE extends u0{constructor(){super();this.setAttribute("position",new I0([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new I0([0,2,0,0,2,0],2))}}var zD=new aE;class s6{constructor(J){this._mesh=new a0(zD,J)}dispose(){this._mesh.geometry.dispose()}render(J){J.render(this._mesh,ID)}get material(){return this._mesh.material}set material(J){this._mesh.material=J}}class B$ extends h9{constructor(J,Q="tDiffuse"){super();if(this.textureID=Q,this.uniforms=null,this.material=null,J instanceof LJ)this.uniforms=J.uniforms,this.material=J;else if(J)this.uniforms=X9.clone(J.uniforms),this.material=new LJ({name:J.name!==void 0?J.name:"unspecified",defines:Object.assign({},J.defines),uniforms:this.uniforms,vertexShader:J.vertexShader,fragmentShader:J.fragmentShader});this._fsQuad=new s6(this.material)}render(J,Q,$){if(this.uniforms[this.textureID])this.uniforms[this.textureID].value=$.texture;if(this._fsQuad.material=this.material,this.renderToScreen)J.setRenderTarget(null),this._fsQuad.render(J);else{if(J.setRenderTarget(Q),this.clear)J.clear(J.autoClearColor,J.autoClearDepth,J.autoClearStencil);this._fsQuad.render(J)}}dispose(){this.material.dispose(),this._fsQuad.dispose()}}class KY extends h9{constructor(J,Q){super();this.scene=J,this.camera=Q,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(J,Q,$){let Z=J.getContext(),W=J.state;W.buffers.color.setMask(!1),W.buffers.depth.setMask(!1),W.buffers.color.setLocked(!0),W.buffers.depth.setLocked(!0);let Y,X;if(this.inverse)Y=0,X=1;else Y=1,X=0;if(W.buffers.stencil.setTest(!0),W.buffers.stencil.setOp(Z.REPLACE,Z.REPLACE,Z.REPLACE),W.buffers.stencil.setFunc(Z.ALWAYS,Y,4294967295),W.buffers.stencil.setClear(X),W.buffers.stencil.setLocked(!0),J.setRenderTarget($),this.clear)J.clear();if(J.render(this.scene,this.camera),J.setRenderTarget(Q),this.clear)J.clear();J.render(this.scene,this.camera),W.buffers.color.setLocked(!1),W.buffers.depth.setLocked(!1),W.buffers.color.setMask(!0),W.buffers.depth.setMask(!0),W.buffers.stencil.setLocked(!1),W.buffers.stencil.setFunc(Z.EQUAL,1,4294967295),W.buffers.stencil.setOp(Z.KEEP,Z.KEEP,Z.KEEP),W.buffers.stencil.setLocked(!0)}}class CH extends h9{constructor(){super();this.needsSwap=!1}render(J){J.state.buffers.stencil.setLocked(!1),J.state.buffers.stencil.setTest(!1)}}class IH{constructor(J,Q){if(this.renderer=J,this._pixelRatio=J.getPixelRatio(),Q===void 0){let $=J.getSize(new i);this._width=$.width,this._height=$.height,Q=new PJ(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:wJ}),Q.texture.name="EffectComposer.rt1"}else this._width=Q.width,this._height=Q.height;this.renderTarget1=Q,this.renderTarget2=Q.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new B$(e7),this.copyPass.material.blending=M9,this.timer=new s7}swapBuffers(){let J=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=J}addPass(J){this.passes.push(J),J.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(J,Q){this.passes.splice(Q,0,J),J.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(J){let Q=this.passes.indexOf(J);if(Q!==-1)this.passes.splice(Q,1)}isLastEnabledPass(J){for(let Q=J+1;Q<this.passes.length;Q++)if(this.passes[Q].enabled)return!1;return!0}render(J){if(this.timer.update(),J===void 0)J=this.timer.getDelta();let Q=this.renderer.getRenderTarget(),$=!1;for(let Z=0,W=this.passes.length;Z<W;Z++){let Y=this.passes[Z];if(Y.enabled===!1)continue;if(Y.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(Z),Y.render(this.renderer,this.writeBuffer,this.readBuffer,J,$),Y.needsSwap){if($){let X=this.renderer.getContext(),K=this.renderer.state.buffers.stencil;K.setFunc(X.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,J),K.setFunc(X.EQUAL,1,4294967295)}this.swapBuffers()}if(KY!==void 0){if(Y instanceof KY)$=!0;else if(Y instanceof CH)$=!1}}this.renderer.setRenderTarget(Q)}reset(J){if(J===void 0){let Q=this.renderer.getSize(new i);this._pixelRatio=this.renderer.getPixelRatio(),this._width=Q.width,this._height=Q.height,J=this.renderTarget1.clone(),J.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=J,this.renderTarget2=J.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(J,Q){this._width=J,this._height=Q;let $=this._width*this._pixelRatio,Z=this._height*this._pixelRatio;this.renderTarget1.setSize($,Z),this.renderTarget2.setSize($,Z);for(let W=0;W<this.passes.length;W++)this.passes[W].setSize($,Z)}setPixelRatio(J){this._pixelRatio=J,this.setSize(this._width,this._height)}dispose(){this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.copyPass.dispose()}}class zH extends h9{constructor(J,Q,$=null,Z=null,W=null){super();this.scene=J,this.camera=Q,this.overrideMaterial=$,this.clearColor=Z,this.clearAlpha=W,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this.isRenderPass=!0,this._oldClearColor=new e}render(J,Q,$){let Z=J.autoClear;J.autoClear=!1;let W,Y;if(this.overrideMaterial!==null)Y=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial;if(this.clearColor!==null)J.getClearColor(this._oldClearColor),J.setClearColor(this.clearColor,J.getClearAlpha());if(this.clearAlpha!==null)W=J.getClearAlpha(),J.setClearAlpha(this.clearAlpha);if(this.clearDepth==!0)J.clearDepth();if(J.setRenderTarget(this.renderToScreen?null:$),this.clear===!0)J.clear(J.autoClearColor,J.autoClearDepth,J.autoClearStencil);if(J.render(this.scene,this.camera),this.clearColor!==null)J.setClearColor(this._oldClearColor);if(this.clearAlpha!==null)J.setClearAlpha(W);if(this.overrideMaterial!==null)this.scene.overrideMaterial=Y;J.autoClear=Z}}var rE={name:"LuminosityHighPassShader",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new e(0)},defaultOpacity:{value:0}},vertexShader:`
4132
+
4133
+ varying vec2 vUv;
4134
+
4135
+ void main() {
4136
+
4137
+ vUv = uv;
4138
+
4139
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
4140
+
4141
+ }`,fragmentShader:`
4142
+
4143
+ uniform sampler2D tDiffuse;
4144
+ uniform vec3 defaultColor;
4145
+ uniform float defaultOpacity;
4146
+ uniform float luminosityThreshold;
4147
+ uniform float smoothWidth;
4148
+
4149
+ varying vec2 vUv;
4150
+
4151
+ void main() {
4152
+
4153
+ vec4 texel = texture2D( tDiffuse, vUv );
4154
+
4155
+ float v = luminance( texel.xyz );
4156
+
4157
+ vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );
4158
+
4159
+ float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );
4160
+
4161
+ gl_FragColor = mix( outputColor, texel, alpha );
4162
+
4163
+ }`};class i6 extends h9{constructor(J,Q=1,$,Z){super();this.strength=Q,this.radius=$,this.threshold=Z,this.resolution=J!==void 0?new i(J.x,J.y):new i(256,256),this.clearColor=new e(0,0,0),this.needsSwap=!1,this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let W=Math.round(this.resolution.x/2),Y=Math.round(this.resolution.y/2);this.renderTargetBright=new PJ(W,Y,{type:wJ}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let U=0;U<this.nMips;U++){let G=new PJ(W,Y,{type:wJ});G.texture.name="UnrealBloomPass.h"+U,G.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(G);let F=new PJ(W,Y,{type:wJ});F.texture.name="UnrealBloomPass.v"+U,F.texture.generateMipmaps=!1,this.renderTargetsVertical.push(F),W=Math.round(W/2),Y=Math.round(Y/2)}let X=rE;this.highPassUniforms=X9.clone(X.uniforms),this.highPassUniforms.luminosityThreshold.value=Z,this.highPassUniforms.smoothWidth.value=0.01,this.materialHighPassFilter=new LJ({uniforms:this.highPassUniforms,vertexShader:X.vertexShader,fragmentShader:X.fragmentShader}),this.separableBlurMaterials=[];let K=[6,10,14,18,22];W=Math.round(this.resolution.x/2),Y=Math.round(this.resolution.y/2);for(let U=0;U<this.nMips;U++)this.separableBlurMaterials.push(this._getSeparableBlurMaterial(K[U])),this.separableBlurMaterials[U].uniforms.invSize.value=new i(1/W,1/Y),W=Math.round(W/2),Y=Math.round(Y/2);this.compositeMaterial=this._getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=Q,this.compositeMaterial.uniforms.bloomRadius.value=0.1;let H=[1,0.8,0.6,0.4,0.2];this.compositeMaterial.uniforms.bloomFactors.value=H,this.bloomTintColors=[new T(1,1,1),new T(1,1,1),new T(1,1,1),new T(1,1,1),new T(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,this.copyUniforms=X9.clone(e7.uniforms),this.blendMaterial=new LJ({uniforms:this.copyUniforms,vertexShader:e7.vertexShader,fragmentShader:e7.fragmentShader,premultipliedAlpha:!0,blending:l8,depthTest:!1,depthWrite:!1,transparent:!0}),this._oldClearColor=new e,this._oldClearAlpha=1,this._basic=new cJ,this._fsQuad=new s6(null)}dispose(){for(let J=0;J<this.renderTargetsHorizontal.length;J++)this.renderTargetsHorizontal[J].dispose();for(let J=0;J<this.renderTargetsVertical.length;J++)this.renderTargetsVertical[J].dispose();this.renderTargetBright.dispose();for(let J=0;J<this.separableBlurMaterials.length;J++)this.separableBlurMaterials[J].dispose();this.compositeMaterial.dispose(),this.blendMaterial.dispose(),this._basic.dispose(),this._fsQuad.dispose()}setSize(J,Q){let $=Math.round(J/2),Z=Math.round(Q/2);this.renderTargetBright.setSize($,Z);for(let W=0;W<this.nMips;W++)this.renderTargetsHorizontal[W].setSize($,Z),this.renderTargetsVertical[W].setSize($,Z),this.separableBlurMaterials[W].uniforms.invSize.value=new i(1/$,1/Z),$=Math.round($/2),Z=Math.round(Z/2)}render(J,Q,$,Z,W){J.getClearColor(this._oldClearColor),this._oldClearAlpha=J.getClearAlpha();let Y=J.autoClear;if(J.autoClear=!1,J.setClearColor(this.clearColor,0),W)J.state.buffers.stencil.setTest(!1);if(this.renderToScreen)this._fsQuad.material=this._basic,this._basic.map=$.texture,J.setRenderTarget(null),J.clear(),this._fsQuad.render(J);this.highPassUniforms.tDiffuse.value=$.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this._fsQuad.material=this.materialHighPassFilter,J.setRenderTarget(this.renderTargetBright),J.clear(),this._fsQuad.render(J);let X=this.renderTargetBright;for(let K=0;K<this.nMips;K++)this._fsQuad.material=this.separableBlurMaterials[K],this.separableBlurMaterials[K].uniforms.colorTexture.value=X.texture,this.separableBlurMaterials[K].uniforms.direction.value=i6.BlurDirectionX,J.setRenderTarget(this.renderTargetsHorizontal[K]),J.clear(),this._fsQuad.render(J),this.separableBlurMaterials[K].uniforms.colorTexture.value=this.renderTargetsHorizontal[K].texture,this.separableBlurMaterials[K].uniforms.direction.value=i6.BlurDirectionY,J.setRenderTarget(this.renderTargetsVertical[K]),J.clear(),this._fsQuad.render(J),X=this.renderTargetsVertical[K];if(this._fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,J.setRenderTarget(this.renderTargetsHorizontal[0]),J.clear(),this._fsQuad.render(J),this._fsQuad.material=this.blendMaterial,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,W)J.state.buffers.stencil.setTest(!0);if(this.renderToScreen)J.setRenderTarget(null),this._fsQuad.render(J);else J.setRenderTarget($),this._fsQuad.render(J);J.setClearColor(this._oldClearColor,this._oldClearAlpha),J.autoClear=Y}_getSeparableBlurMaterial(J){let Q=[],$=J/3;for(let Z=0;Z<J;Z++)Q.push(0.39894*Math.exp(-0.5*Z*Z/($*$))/$);return new LJ({defines:{KERNEL_RADIUS:J},uniforms:{colorTexture:{value:null},invSize:{value:new i(0.5,0.5)},direction:{value:new i(0.5,0.5)},gaussianCoefficients:{value:Q}},vertexShader:`
4164
+
4165
+ varying vec2 vUv;
4166
+
4167
+ void main() {
4168
+
4169
+ vUv = uv;
4170
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
4171
+
4172
+ }`,fragmentShader:`
4173
+
4174
+ #include <common>
4175
+
4176
+ varying vec2 vUv;
4177
+
4178
+ uniform sampler2D colorTexture;
4179
+ uniform vec2 invSize;
4180
+ uniform vec2 direction;
4181
+ uniform float gaussianCoefficients[KERNEL_RADIUS];
4182
+
4183
+ void main() {
4184
+
4185
+ float weightSum = gaussianCoefficients[0];
4186
+ vec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;
4187
+
4188
+ for ( int i = 1; i < KERNEL_RADIUS; i ++ ) {
4189
+
4190
+ float x = float( i );
4191
+ float w = gaussianCoefficients[i];
4192
+ vec2 uvOffset = direction * invSize * x;
4193
+ vec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;
4194
+ vec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;
4195
+ diffuseSum += ( sample1 + sample2 ) * w;
4196
+
4197
+ }
4198
+
4199
+ gl_FragColor = vec4( diffuseSum, 1.0 );
4200
+
4201
+ }`})}_getCompositeMaterial(J){return new LJ({defines:{NUM_MIPS:J},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`
4202
+
4203
+ varying vec2 vUv;
4204
+
4205
+ void main() {
4206
+
4207
+ vUv = uv;
4208
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
4209
+
4210
+ }`,fragmentShader:`
4211
+
4212
+ varying vec2 vUv;
4213
+
4214
+ uniform sampler2D blurTexture1;
4215
+ uniform sampler2D blurTexture2;
4216
+ uniform sampler2D blurTexture3;
4217
+ uniform sampler2D blurTexture4;
4218
+ uniform sampler2D blurTexture5;
4219
+ uniform float bloomStrength;
4220
+ uniform float bloomRadius;
4221
+ uniform float bloomFactors[NUM_MIPS];
4222
+ uniform vec3 bloomTintColors[NUM_MIPS];
4223
+
4224
+ float lerpBloomFactor( const in float factor ) {
4225
+
4226
+ float mirrorFactor = 1.2 - factor;
4227
+ return mix( factor, mirrorFactor, bloomRadius );
4228
+
4229
+ }
4230
+
4231
+ void main() {
4232
+
4233
+ // 3.0 for backwards compatibility with previous alpha-based intensity
4234
+ vec3 bloom = 3.0 * bloomStrength * (
4235
+ lerpBloomFactor( bloomFactors[ 0 ] ) * bloomTintColors[ 0 ] * texture2D( blurTexture1, vUv ).rgb +
4236
+ lerpBloomFactor( bloomFactors[ 1 ] ) * bloomTintColors[ 1 ] * texture2D( blurTexture2, vUv ).rgb +
4237
+ lerpBloomFactor( bloomFactors[ 2 ] ) * bloomTintColors[ 2 ] * texture2D( blurTexture3, vUv ).rgb +
4238
+ lerpBloomFactor( bloomFactors[ 3 ] ) * bloomTintColors[ 3 ] * texture2D( blurTexture4, vUv ).rgb +
4239
+ lerpBloomFactor( bloomFactors[ 4 ] ) * bloomTintColors[ 4 ] * texture2D( blurTexture5, vUv ).rgb
4240
+ );
4241
+
4242
+ float bloomAlpha = max( bloom.r, max( bloom.g, bloom.b ) );
4243
+ gl_FragColor = vec4( bloom, bloomAlpha );
4244
+
4245
+ }`})}}i6.BlurDirectionX=new i(1,0);i6.BlurDirectionY=new i(0,1);var C$={name:"OutputShader",uniforms:{tDiffuse:{value:null},toneMappingExposure:{value:1}},vertexShader:`
4246
+ precision highp float;
4247
+
4248
+ uniform mat4 modelViewMatrix;
4249
+ uniform mat4 projectionMatrix;
4250
+
4251
+ attribute vec3 position;
4252
+ attribute vec2 uv;
4253
+
4254
+ varying vec2 vUv;
4255
+
4256
+ void main() {
4257
+
4258
+ vUv = uv;
4259
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
4260
+
4261
+ }`,fragmentShader:`
4262
+
4263
+ precision highp float;
4264
+
4265
+ uniform sampler2D tDiffuse;
4266
+
4267
+ #include <tonemapping_pars_fragment>
4268
+ #include <colorspace_pars_fragment>
4269
+
4270
+ varying vec2 vUv;
4271
+
4272
+ void main() {
4273
+
4274
+ gl_FragColor = texture2D( tDiffuse, vUv );
4275
+
4276
+ // tone mapping
4277
+
4278
+ #ifdef LINEAR_TONE_MAPPING
4279
+
4280
+ gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
4281
+
4282
+ #elif defined( REINHARD_TONE_MAPPING )
4283
+
4284
+ gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
4285
+
4286
+ #elif defined( CINEON_TONE_MAPPING )
4287
+
4288
+ gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
4289
+
4290
+ #elif defined( ACES_FILMIC_TONE_MAPPING )
4291
+
4292
+ gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
4293
+
4294
+ #elif defined( AGX_TONE_MAPPING )
4295
+
4296
+ gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
4297
+
4298
+ #elif defined( NEUTRAL_TONE_MAPPING )
4299
+
4300
+ gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
4301
+
4302
+ #elif defined( CUSTOM_TONE_MAPPING )
4303
+
4304
+ gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
4305
+
4306
+ #endif
4307
+
4308
+ // color space
4309
+
4310
+ #ifdef SRGB_TRANSFER
4311
+
4312
+ gl_FragColor = sRGBTransferOETF( gl_FragColor );
4313
+
4314
+ #endif
4315
+
4316
+ }`};class _H extends h9{constructor(){super();this.isOutputPass=!0,this.uniforms=X9.clone(C$.uniforms),this.material=new p6({name:C$.name,uniforms:this.uniforms,vertexShader:C$.vertexShader,fragmentShader:C$.fragmentShader}),this._fsQuad=new s6(this.material),this._outputColorSpace=null,this._toneMapping=null}render(J,Q,$){if(this.uniforms.tDiffuse.value=$.texture,this.uniforms.toneMappingExposure.value=J.toneMappingExposure,this._outputColorSpace!==J.outputColorSpace||this._toneMapping!==J.toneMapping){if(this._outputColorSpace=J.outputColorSpace,this._toneMapping=J.toneMapping,this.material.defines={},t0.getTransfer(this._outputColorSpace)===OJ)this.material.defines.SRGB_TRANSFER="";if(this._toneMapping===I7)this.material.defines.LINEAR_TONE_MAPPING="";else if(this._toneMapping===z7)this.material.defines.REINHARD_TONE_MAPPING="";else if(this._toneMapping===_7)this.material.defines.CINEON_TONE_MAPPING="";else if(this._toneMapping===c8)this.material.defines.ACES_FILMIC_TONE_MAPPING="";else if(this._toneMapping===P7)this.material.defines.AGX_TONE_MAPPING="";else if(this._toneMapping===T7)this.material.defines.NEUTRAL_TONE_MAPPING="";else if(this._toneMapping===w7)this.material.defines.CUSTOM_TONE_MAPPING="";this.material.needsUpdate=!0}if(this.renderToScreen===!0)J.setRenderTarget(null),this._fsQuad.render(J);else{if(J.setRenderTarget(Q),this.clear)J.clear(J.autoClearColor,J.autoClearDepth,J.autoClearStencil);this._fsQuad.render(J)}}dispose(){this.material.dispose(),this._fsQuad.dispose()}}var _D={uniforms:{tDiffuse:{value:null},offset:{value:1.1},darkness:{value:1}},vertexShader:`
4317
+ varying vec2 vUv;
4318
+ void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); }
4319
+ `,fragmentShader:`
4320
+ uniform sampler2D tDiffuse;
4321
+ uniform float offset;
4322
+ uniform float darkness;
4323
+ varying vec2 vUv;
4324
+ void main() {
4325
+ vec4 color = texture2D(tDiffuse, vUv);
4326
+ vec2 uv = (vUv - 0.5) * offset;
4327
+ float vig = clamp(1.0 - dot(uv, uv), 0.0, 1.0);
4328
+ gl_FragColor = vec4(color.rgb * mix(1.0, vig, darkness), color.a);
4329
+ }
4330
+ `};function tE(J,Q,$,Z){let W=(Z.bloom??0)>0,Y=(Z.vignette??0)>0;if(!W&&!Y)return null;let X=new IH(J);if(X.setSize(Z.width,Z.height),X.addPass(new zH(Q,$)),W)X.addPass(new i6(new i(Z.width,Z.height),Z.bloom??0.6,Z.bloomRadius??0.6,Z.bloomThreshold??0.85));if(Y){let K=new B$(_D);K.uniforms.darkness.value=Z.vignette,X.addPass(K)}return X.addPass(new _H),{render:()=>X.render(0),setSize:(K,H)=>X.setSize(K,H)}}class wH extends a0{constructor(J,Q,$=!1,Z=!1,W=1e4){let Y=new u0;super(Y,Q);this.isMarchingCubes=!0;let X=this,K=new Float32Array(36),H=new Float32Array(36),U=new Float32Array(36);this.enableUvs=$,this.enableColors=Z,this.init=function(N){this.resolution=N,this.isolation=80,this.size=N,this.size2=this.size*this.size,this.size3=this.size2*this.size,this.halfsize=this.size/2,this.delta=2/this.size,this.yd=this.size,this.zd=this.size2,this.field=new Float32Array(this.size3),this.normal_cache=new Float32Array(this.size3*3),this.palette=new Float32Array(this.size3*3),this.count=0;let L=W*3;this.positionArray=new Float32Array(L*3);let D=new i0(this.positionArray,3);D.setUsage(S6),Y.setAttribute("position",D),this.normalArray=new Float32Array(L*3);let V=new i0(this.normalArray,3);if(V.setUsage(S6),Y.setAttribute("normal",V),this.enableUvs){this.uvArray=new Float32Array(L*2);let I=new i0(this.uvArray,2);I.setUsage(S6),Y.setAttribute("uv",I)}if(this.enableColors){this.colorArray=new Float32Array(L*3);let I=new i0(this.colorArray,3);I.setUsage(S6),Y.setAttribute("color",I)}Y.boundingSphere=new _J(new T,1)};function G(N,L,D){return N+(L-N)*D}function F(N,L,D,V,I,z,B,M,C,j){let w=(D-B)/(M-B),v=X.normal_cache;K[L+0]=V+w*X.delta,K[L+1]=I,K[L+2]=z,H[L+0]=G(v[N+0],v[N+3],w),H[L+1]=G(v[N+1],v[N+4],w),H[L+2]=G(v[N+2],v[N+5],w),U[L+0]=G(X.palette[C*3+0],X.palette[j*3+0],w),U[L+1]=G(X.palette[C*3+1],X.palette[j*3+1],w),U[L+2]=G(X.palette[C*3+2],X.palette[j*3+2],w)}function E(N,L,D,V,I,z,B,M,C,j){let w=(D-B)/(M-B),v=X.normal_cache;K[L+0]=V,K[L+1]=I+w*X.delta,K[L+2]=z;let b=N+X.yd*3;H[L+0]=G(v[N+0],v[b+0],w),H[L+1]=G(v[N+1],v[b+1],w),H[L+2]=G(v[N+2],v[b+2],w),U[L+0]=G(X.palette[C*3+0],X.palette[j*3+0],w),U[L+1]=G(X.palette[C*3+1],X.palette[j*3+1],w),U[L+2]=G(X.palette[C*3+2],X.palette[j*3+2],w)}function O(N,L,D,V,I,z,B,M,C,j){let w=(D-B)/(M-B),v=X.normal_cache;K[L+0]=V,K[L+1]=I,K[L+2]=z+w*X.delta;let b=N+X.zd*3;H[L+0]=G(v[N+0],v[b+0],w),H[L+1]=G(v[N+1],v[b+1],w),H[L+2]=G(v[N+2],v[b+2],w),U[L+0]=G(X.palette[C*3+0],X.palette[j*3+0],w),U[L+1]=G(X.palette[C*3+1],X.palette[j*3+1],w),U[L+2]=G(X.palette[C*3+2],X.palette[j*3+2],w)}function R(N){let L=N*3;if(X.normal_cache[L]===0)X.normal_cache[L+0]=X.field[N-1]-X.field[N+1],X.normal_cache[L+1]=X.field[N-X.yd]-X.field[N+X.yd],X.normal_cache[L+2]=X.field[N-X.zd]-X.field[N+X.zd]}function k(N,L,D,V,I){let z=V+1,B=V+X.yd,M=V+X.zd,C=z+X.yd,j=z+X.zd,w=V+X.yd+X.zd,v=z+X.yd+X.zd,b=0,S=X.field[V],h=X.field[z],x=X.field[B],p=X.field[C],c=X.field[M],o=X.field[j],W0=X.field[w],H0=X.field[v];if(S<I)b|=1;if(h<I)b|=2;if(x<I)b|=8;if(p<I)b|=4;if(c<I)b|=16;if(o<I)b|=32;if(W0<I)b|=128;if(H0<I)b|=64;let J0=wD[b];if(J0===0)return 0;let c0=X.delta,d0=N+c0,s=L+c0,F0=D+c0;if(J0&1)R(V),R(z),F(V*3,0,I,N,L,D,S,h,V,z);if(J0&2)R(z),R(C),E(z*3,3,I,d0,L,D,h,p,z,C);if(J0&4)R(B),R(C),F(B*3,6,I,N,s,D,x,p,B,C);if(J0&8)R(V),R(B),E(V*3,9,I,N,L,D,S,x,V,B);if(J0&16)R(M),R(j),F(M*3,12,I,N,L,F0,c,o,M,j);if(J0&32)R(j),R(v),E(j*3,15,I,d0,L,F0,o,H0,j,v);if(J0&64)R(w),R(v),F(w*3,18,I,N,s,F0,W0,H0,w,v);if(J0&128)R(M),R(w),E(M*3,21,I,N,L,F0,c,W0,M,w);if(J0&256)R(V),R(M),O(V*3,24,I,N,L,D,S,c,V,M);if(J0&512)R(z),R(j),O(z*3,27,I,d0,L,D,h,o,z,j);if(J0&1024)R(C),R(v),O(C*3,30,I,d0,s,D,p,H0,C,v);if(J0&2048)R(B),R(w),O(B*3,33,I,N,s,D,x,W0,B,w);b<<=4;let z0,E0,j0,WJ=0,x0=0;while(HY[b+x0]!=-1)z0=b+x0,E0=z0+1,j0=z0+2,q(K,H,U,3*HY[z0],3*HY[E0],3*HY[j0]),x0+=3,WJ++;return WJ}function q(N,L,D,V,I,z){let B=X.count*3;if(X.positionArray[B+0]=N[V],X.positionArray[B+1]=N[V+1],X.positionArray[B+2]=N[V+2],X.positionArray[B+3]=N[I],X.positionArray[B+4]=N[I+1],X.positionArray[B+5]=N[I+2],X.positionArray[B+6]=N[z],X.positionArray[B+7]=N[z+1],X.positionArray[B+8]=N[z+2],X.material.flatShading===!0){let M=(L[V+0]+L[I+0]+L[z+0])/3,C=(L[V+1]+L[I+1]+L[z+1])/3,j=(L[V+2]+L[I+2]+L[z+2])/3;X.normalArray[B+0]=M,X.normalArray[B+1]=C,X.normalArray[B+2]=j,X.normalArray[B+3]=M,X.normalArray[B+4]=C,X.normalArray[B+5]=j,X.normalArray[B+6]=M,X.normalArray[B+7]=C,X.normalArray[B+8]=j}else X.normalArray[B+0]=L[V+0],X.normalArray[B+1]=L[V+1],X.normalArray[B+2]=L[V+2],X.normalArray[B+3]=L[I+0],X.normalArray[B+4]=L[I+1],X.normalArray[B+5]=L[I+2],X.normalArray[B+6]=L[z+0],X.normalArray[B+7]=L[z+1],X.normalArray[B+8]=L[z+2];if(X.enableUvs){let M=X.count*2;X.uvArray[M+0]=N[V+0],X.uvArray[M+1]=N[V+2],X.uvArray[M+2]=N[I+0],X.uvArray[M+3]=N[I+2],X.uvArray[M+4]=N[z+0],X.uvArray[M+5]=N[z+2]}if(X.enableColors)X.colorArray[B+0]=D[V+0],X.colorArray[B+1]=D[V+1],X.colorArray[B+2]=D[V+2],X.colorArray[B+3]=D[I+0],X.colorArray[B+4]=D[I+1],X.colorArray[B+5]=D[I+2],X.colorArray[B+6]=D[z+0],X.colorArray[B+7]=D[z+1],X.colorArray[B+8]=D[z+2];X.count+=3}this.addBall=function(N,L,D,V,I,z){let B=Math.sign(V);V=Math.abs(V);let M=!(z===void 0||z===null),C=new e(N,L,D);if(M)try{C=z instanceof e?z:Array.isArray(z)?new e(Math.min(Math.abs(z[0]),1),Math.min(Math.abs(z[1]),1),Math.min(Math.abs(z[2]),1)):new e(z)}catch(x0){C=new e(N,L,D)}let j=this.size*Math.sqrt(V/I),w=D*this.size,v=L*this.size,b=N*this.size,S=Math.floor(w-j);if(S<1)S=1;let h=Math.floor(w+j);if(h>this.size-1)h=this.size-1;let x=Math.floor(v-j);if(x<1)x=1;let p=Math.floor(v+j);if(p>this.size-1)p=this.size-1;let c=Math.floor(b-j);if(c<1)c=1;let o=Math.floor(b+j);if(o>this.size-1)o=this.size-1;let W0,H0,J0,c0,d0,s,F0,z0,E0,j0,WJ;for(J0=S;J0<h;J0++){d0=this.size2*J0,z0=J0/this.size-D,E0=z0*z0;for(H0=x;H0<p;H0++){c0=d0+this.size*H0,F0=H0/this.size-L,j0=F0*F0;for(W0=c;W0<o;W0++)if(s=W0/this.size-N,WJ=V/(0.000001+s*s+j0+E0)-I,WJ>0){this.field[c0+W0]+=WJ*B;let x0=Math.sqrt((W0-b)*(W0-b)+(H0-v)*(H0-v)+(J0-w)*(J0-w))/j,n0=1-x0*x0*x0*(x0*(x0*6-15)+10);this.palette[(c0+W0)*3+0]+=C.r*n0,this.palette[(c0+W0)*3+1]+=C.g*n0,this.palette[(c0+W0)*3+2]+=C.b*n0}}}},this.addPlaneX=function(N,L){let D=this.size,V=this.yd,I=this.zd,z=this.field,B,M,C,j,w,v,b,S=D*Math.sqrt(N/L);if(S>D)S=D;for(B=0;B<S;B++)if(v=B/D,j=v*v,w=N/(0.0001+j)-L,w>0)for(M=0;M<D;M++){b=B+M*V;for(C=0;C<D;C++)z[I*C+b]+=w}},this.addPlaneY=function(N,L){let D=this.size,V=this.yd,I=this.zd,z=this.field,B,M,C,j,w,v,b,S,h=D*Math.sqrt(N/L);if(h>D)h=D;for(M=0;M<h;M++)if(v=M/D,j=v*v,w=N/(0.0001+j)-L,w>0){b=M*V;for(B=0;B<D;B++){S=b+B;for(C=0;C<D;C++)z[I*C+S]+=w}}},this.addPlaneZ=function(N,L){let D=this.size,V=this.yd,I=this.zd,z=this.field,B,M,C,j,w,v,b,S,h=D*Math.sqrt(N/L);if(h>D)h=D;for(C=0;C<h;C++)if(v=C/D,j=v*v,w=N/(0.0001+j)-L,w>0){b=I*C;for(M=0;M<D;M++){S=b+M*V;for(B=0;B<D;B++)z[S+B]+=w}}},this.setCell=function(N,L,D,V){let I=this.size2*D+this.size*L+N;this.field[I]=V},this.getCell=function(N,L,D){let V=this.size2*D+this.size*L+N;return this.field[V]},this.blur=function(N=1){let L=this.field,D=L.slice(),V=this.size,I=this.size2;for(let z=0;z<V;z++)for(let B=0;B<V;B++)for(let M=0;M<V;M++){let C=I*M+V*B+z,j=D[C],w=1;for(let v=-1;v<=1;v+=2){let b=v+z;if(b<0||b>=V)continue;for(let S=-1;S<=1;S+=2){let h=S+B;if(h<0||h>=V)continue;for(let x=-1;x<=1;x+=2){let p=x+M;if(p<0||p>=V)continue;let c=I*p+V*h+b,o=D[c];w++,j+=N*(o-j)/w}}}L[C]=j}},this.reset=function(){for(let N=0;N<this.size3;N++)this.normal_cache[N*3]=0,this.field[N]=0,this.palette[N*3]=this.palette[N*3+1]=this.palette[N*3+2]=0},this.update=function(){this.count=0;let N=this.size-2;for(let L=1;L<N;L++){let D=this.size2*L,V=(L-this.halfsize)/this.halfsize;for(let I=1;I<N;I++){let z=D+this.size*I,B=(I-this.halfsize)/this.halfsize;for(let M=1;M<N;M++){let C=(M-this.halfsize)/this.halfsize,j=z+M;k(C,B,V,j,this.isolation)}}}if(this.geometry.setDrawRange(0,this.count),Y.getAttribute("position").needsUpdate=!0,Y.getAttribute("normal").needsUpdate=!0,this.enableUvs)Y.getAttribute("uv").needsUpdate=!0;if(this.enableColors)Y.getAttribute("color").needsUpdate=!0;if(this.count/3>W)console.warn("THREE.MarchingCubes: Geometry buffers too small for rendering. Please create an instance with a higher poly count.")},this.init(J)}}var wD=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]),HY=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,-1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,-1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,-1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,-1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,6,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,-1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,6,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);function JQ(J){let Q=J>>>0;return()=>{Q=Q+1831565813>>>0;let $=Q;return $=Math.imul($^$>>>15,$|1),$^=$+Math.imul($^$>>>7,$|61),(($^$>>>14)>>>0)/4294967296}}function PD(J,Q,$){let Z=JQ(Q),W=[];for(let Y=0;Y<J;Y++)W.push({cx:0.38+Z()*0.24,cy:0.38+Z()*0.24,cz:0.38+Z()*0.24,rx:0.06+Z()*0.16,ry:0.06+Z()*0.16,rz:0.04+Z()*0.1,wx:0.3+Z()*0.7,wy:0.3+Z()*0.7,wz:0.3+Z()*0.7,px:Z()*Math.PI*2,py:Z()*Math.PI*2,pz:Z()*Math.PI*2,strength:$*(0.7+Z()*0.6)});return W}function TD(J,Q){return{x:J.cx+J.rx*Math.sin(Q*J.wx+J.px),y:J.cy+J.ry*Math.sin(Q*J.wy+J.py),z:J.cz+J.rz*Math.cos(Q*J.wz+J.pz)}}function eE(J,Q){let $=Math.max(1,Math.floor(V0(J.getAttribute("count"),5))),Z=Math.floor(V0(J.getAttribute("seed"),1)),W=Math.max(16,Math.floor(V0(J.getAttribute("resolution"),56))),Y=V0(J.getAttribute("speed"),0.7),X=V0(J.getAttribute("strength"),0.7),K=V0(J.getAttribute("scale"),2),H=new wH(W,Q,!0,!0,60000);H.isolation=V0(J.getAttribute("isolation"),60),H.position.set(...CJ(J.getAttribute("position"),[0,0,0])),H.scale.setScalar(K),H.frustumCulled=!1;let U=PD($,Z,X),G=(F)=>{let E=F*Y;H.reset();for(let O of U){let R=TD(O,E);H.addBall(R.x,R.y,R.z,O.strength,12)}H.update()};return G(0),{mesh:H,writer:G}}class PH extends a0{constructor(J,Q={}){super(J);this.isWater=!0;let $=this,Z=Q.textureWidth!==void 0?Q.textureWidth:512,W=Q.textureHeight!==void 0?Q.textureHeight:512,Y=Q.clipBias!==void 0?Q.clipBias:0,X=Q.alpha!==void 0?Q.alpha:1,K=Q.time!==void 0?Q.time:0,H=Q.waterNormals!==void 0?Q.waterNormals:null,U=Q.sunDirection!==void 0?Q.sunDirection:new T(0.70707,0.70707,0),G=new e(Q.sunColor!==void 0?Q.sunColor:16777215),F=new e(Q.waterColor!==void 0?Q.waterColor:8355711),E=Q.eye!==void 0?Q.eye:new T(0,0,0),O=Q.distortionScale!==void 0?Q.distortionScale:20,R=Q.side!==void 0?Q.side:n9,k=Q.fog!==void 0?Q.fog:!1,q=new _9,N=new T,L=new T,D=new T,V=new y0,I=new T(0,0,-1),z=new FJ,B=new T,M=new T,C=new FJ,j=new y0,w=new BJ,v=new PJ(Z,W,{type:wJ}),b={name:"MirrorShader",uniforms:X9.merge([L0.fog,L0.lights,{normalSampler:{value:null},mirrorSampler:{value:null},alpha:{value:1},time:{value:0},size:{value:1},distortionScale:{value:20},textureMatrix:{value:new y0},sunColor:{value:new e(8355711)},sunDirection:{value:new T(0.70707,0.70707,0)},eye:{value:new T},waterColor:{value:new e(5592405)}}]),vertexShader:`
4109
4331
  uniform mat4 textureMatrix;
4110
4332
  uniform float time;
4111
4333
 
@@ -4201,7 +4423,7 @@ void main() {
4201
4423
  #include <tonemapping_fragment>
4202
4424
  #include <colorspace_fragment>
4203
4425
  #include <fog_fragment>
4204
- }`},v=new SJ({name:y.name,uniforms:j8.clone(y.uniforms),vertexShader:y.vertexShader,fragmentShader:y.fragmentShader,lights:!0,side:R,fog:C});v.uniforms.mirrorSampler.value=S.texture,v.uniforms.textureMatrix.value=A,v.uniforms.alpha.value=X,v.uniforms.time.value=K,v.uniforms.normalSampler.value=H,v.uniforms.sunColor.value=G,v.uniforms.waterColor.value=F,v.uniforms.sunDirection.value=U,v.uniforms.distortionScale.value=O,v.uniforms.eye.value=E,$.material=v,$.onBeforeRender=function(h,g,p){if(L.setFromMatrixPosition($.matrixWorld),M.setFromMatrixPosition(p.matrixWorld),k.extractRotation($.matrixWorld),N.set(0,0,1),N.applyMatrix4(k),V.subVectors(L,M),V.dot(N)>0)return;V.reflect(N).negate(),V.add(L),k.extractRotation(p.matrixWorld),_.set(0,0,-1),_.applyMatrix4(k),_.add(M),D.subVectors(L,_),D.reflect(N).negate(),D.add(L),z.position.copy(V),z.up.set(0,1,0),z.up.applyMatrix4(k),z.up.reflect(N),z.lookAt(D),z.far=p.far,z.updateMatrixWorld(),z.projectionMatrix.copy(p.projectionMatrix),A.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1),A.multiply(z.projectionMatrix),A.multiply(z.matrixWorldInverse),q.setFromNormalAndCoplanarPoint(N,L),q.applyMatrix4(z.matrixWorldInverse),P.set(q.normal.x,q.normal.y,q.normal.z,q.constant);let c=z.projectionMatrix;B.x=(Math.sign(P.x)+c.elements[8])/c.elements[0],B.y=(Math.sign(P.y)+c.elements[9])/c.elements[5],B.z=-1,B.w=(1+c.elements[10])/c.elements[14],P.multiplyScalar(2/P.dot(B)),c.elements[2]=P.x,c.elements[6]=P.y,c.elements[10]=P.z+1-Y,c.elements[14]=P.w,E.setFromMatrixPosition(p.matrixWorld);let a=h.getRenderTarget(),Q0=h.xr.enabled,H0=h.shadowMap.autoUpdate;if($.visible=!1,h.xr.enabled=!1,h.shadowMap.autoUpdate=!1,h.setRenderTarget(S),h.state.buffers.depth.setMask(!0),h.autoClear===!1)h.clear();h.render(g,z),$.visible=!0,h.xr.enabled=Q0,h.shadowMap.autoUpdate=H0,h.setRenderTarget(a);let J0=p.viewport;if(J0!==void 0)h.state.viewport(J0)}}}function xK(J){let Q=L0(J.getAttribute("size"),2000),$=L0(J.getAttribute("speed"),1),Z=J.getAttribute("normals")??"assets/waternormals.jpg",W=new D6,Y,X=new Promise((G)=>{Y=G}),K=new XW(new M9(Q,Q),{textureWidth:512,textureHeight:512,waterNormals:W.load(Z,(G)=>{G.wrapS=G.wrapT=X8,Y(G)}),sunDirection:new j(...OJ(J.getAttribute("sun-direction"),[0.7,0.6,0.3])),sunColor:new R0(K9(J.getAttribute("sun-color"),"#ffffff")),waterColor:new R0(K9(J.getAttribute("color"),"#001e0f")),distortionScale:L0(J.getAttribute("distortion-scale"),3.7),alpha:L0(J.getAttribute("alpha"),1),clipBias:0});K.rotation.x=-Math.PI/2,K.position.set(...OJ(J.getAttribute("position"),[0,0,0]));let H=K.material.uniforms;return{water:K,timeProxy:{get value(){return H.time.value/($||1)},set value(G){H.time.value=G*$}},pending:X,setSunDirection:(G)=>{H.sunDirection.value.copy(G).normalize()}}}class U7 extends GJ{constructor(){let J=U7.SkyShader,Q=new SJ({name:J.name,uniforms:j8.clone(J.uniforms),vertexShader:J.vertexShader,fragmentShader:J.fragmentShader,side:bJ,depthWrite:!1});super(new Y9(1,1,1),Q);this.isSky=!0}}U7.SkyShader={name:"SkyShader",uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:0.005},mieDirectionalG:{value:0.8},sunPosition:{value:new j},up:{value:new j(0,1,0)},cloudScale:{value:0.0002},cloudSpeed:{value:0.0001},cloudCoverage:{value:0.4},cloudDensity:{value:0.4},cloudElevation:{value:0.5},showSunDisc:{value:1},time:{value:0}},vertexShader:`
4426
+ }`},S=new LJ({name:b.name,uniforms:X9.clone(b.uniforms),vertexShader:b.vertexShader,fragmentShader:b.fragmentShader,lights:!0,side:R,fog:k});S.uniforms.mirrorSampler.value=v.texture,S.uniforms.textureMatrix.value=j,S.uniforms.alpha.value=X,S.uniforms.time.value=K,S.uniforms.normalSampler.value=H,S.uniforms.sunColor.value=G,S.uniforms.waterColor.value=F,S.uniforms.sunDirection.value=U,S.uniforms.distortionScale.value=O,S.uniforms.eye.value=E,$.material=S,$.onBeforeRender=function(h,x,p){if(L.setFromMatrixPosition($.matrixWorld),D.setFromMatrixPosition(p.matrixWorld),V.extractRotation($.matrixWorld),N.set(0,0,1),N.applyMatrix4(V),B.subVectors(L,D),B.dot(N)>0)return;B.reflect(N).negate(),B.add(L),V.extractRotation(p.matrixWorld),I.set(0,0,-1),I.applyMatrix4(V),I.add(D),M.subVectors(L,I),M.reflect(N).negate(),M.add(L),w.position.copy(B),w.up.set(0,1,0),w.up.applyMatrix4(V),w.up.reflect(N),w.lookAt(M),w.far=p.far,w.updateMatrixWorld(),w.projectionMatrix.copy(p.projectionMatrix),j.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1),j.multiply(w.projectionMatrix),j.multiply(w.matrixWorldInverse),q.setFromNormalAndCoplanarPoint(N,L),q.applyMatrix4(w.matrixWorldInverse),z.set(q.normal.x,q.normal.y,q.normal.z,q.constant);let c=w.projectionMatrix;C.x=(Math.sign(z.x)+c.elements[8])/c.elements[0],C.y=(Math.sign(z.y)+c.elements[9])/c.elements[5],C.z=-1,C.w=(1+c.elements[10])/c.elements[14],z.multiplyScalar(2/z.dot(C)),c.elements[2]=z.x,c.elements[6]=z.y,c.elements[10]=z.z+1-Y,c.elements[14]=z.w,E.setFromMatrixPosition(p.matrixWorld);let o=h.getRenderTarget(),W0=h.xr.enabled,H0=h.shadowMap.autoUpdate;if($.visible=!1,h.xr.enabled=!1,h.shadowMap.autoUpdate=!1,h.setRenderTarget(v),h.state.buffers.depth.setMask(!0),h.autoClear===!1)h.clear();h.render(x,w),$.visible=!0,h.xr.enabled=W0,h.shadowMap.autoUpdate=H0,h.setRenderTarget(o);let J0=p.viewport;if(J0!==void 0)h.state.viewport(J0)}}}function J1(J){let Q=V0(J.getAttribute("size"),2000),$=V0(J.getAttribute("speed"),1),Z=J.getAttribute("normals")??"assets/waternormals.jpg",W=new u6,Y,X=new Promise((G)=>{Y=G}),K=new PH(new C9(Q,Q),{textureWidth:512,textureHeight:512,waterNormals:W.load(Z,(G)=>{G.wrapS=G.wrapT=I8,Y(G)}),sunDirection:new T(...CJ(J.getAttribute("sun-direction"),[0.7,0.6,0.3])),sunColor:new e(y9(J.getAttribute("sun-color"),"#ffffff")),waterColor:new e(y9(J.getAttribute("color"),"#001e0f")),distortionScale:V0(J.getAttribute("distortion-scale"),3.7),alpha:V0(J.getAttribute("alpha"),1),clipBias:0});K.rotation.x=-Math.PI/2,K.position.set(...CJ(J.getAttribute("position"),[0,0,0]));let H=K.material.uniforms;return{water:K,timeProxy:{get value(){return H.time.value/($||1)},set value(G){H.time.value=G*$}},pending:X,setSunDirection:(G)=>{H.sunDirection.value.copy(G).normalize()}}}class I$ extends a0{constructor(){let J=I$.SkyShader,Q=new LJ({name:J.name,uniforms:X9.clone(J.uniforms),vertexShader:J.vertexShader,fragmentShader:J.fragmentShader,side:pJ,depthWrite:!1});super(new J9(1,1,1),Q);this.isSky=!0}}I$.SkyShader={name:"SkyShader",uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:0.005},mieDirectionalG:{value:0.8},sunPosition:{value:new T},up:{value:new T(0,1,0)},cloudScale:{value:0.0002},cloudSpeed:{value:0.0001},cloudCoverage:{value:0.4},cloudDensity:{value:0.4},cloudElevation:{value:0.5},showSunDisc:{value:1},time:{value:0}},vertexShader:`
4205
4427
  uniform vec3 sunPosition;
4206
4428
  uniform float rayleigh;
4207
4429
  uniform float turbidity;
@@ -4421,7 +4643,7 @@ void main() {
4421
4643
  #include <tonemapping_fragment>
4422
4644
  #include <colorspace_fragment>
4423
4645
 
4424
- }`};function bK(J){let Q=new U7;Q.scale.setScalar(L0(J.getAttribute("scale"),2000));let $=Q.material.uniforms;$.turbidity.value=L0(J.getAttribute("turbidity"),10),$.rayleigh.value=L0(J.getAttribute("rayleigh"),2),$.mieCoefficient.value=L0(J.getAttribute("mie-coefficient"),0.005),$.mieDirectionalG.value=L0(J.getAttribute("mie-directional-g"),0.8);let Z=L0(J.getAttribute("elevation"),15),W=L0(J.getAttribute("azimuth"),180),Y=E6.degToRad(90-Z),X=E6.degToRad(W),K=new j().setFromSphericalCoords(1,Y,X);return $.sunPosition.value.copy(K),{sky:Q,sunDirection:K}}function DF(J,Q,$,Z){let W=J.split("|").map((q)=>q.trim()),Y=document.createElement("canvas"),X=Y.getContext("2d",{willReadFrequently:!0});X.font=Q;let K=W.map((q)=>X.measureText(q)),H=(K[0].fontBoundingBoxAscent??90)+(K[0].fontBoundingBoxDescent??30),U=Math.max(...K.map((q)=>q.width)),G=H*0.25;Y.width=Math.min(2048,Math.ceil(U+G*2)),Y.height=Math.ceil(H*W.length+G*2),X.font=Q,X.fillStyle="#fff",X.textAlign="center",X.textBaseline="middle";for(let q=0;q<W.length;q++)X.fillText(W[q],Y.width/2,G+H*(q+0.5),Y.width-G);let F=X.getImageData(0,0,Y.width,Y.height).data,E=0.18,O=Math.max(1,Math.floor(Math.sqrt(Y.width*Y.height*E/($*2)))),R=[];for(let q=0;q<Y.height;q+=O)for(let N=0;N<Y.width;N+=O)if(F[(q*Y.width+N)*4+3]>128)R.push({x:N/Y.width,y:q/Y.height});let C=[];if(R.length===0)return{points:C,aspect:1};for(let q=0;q<$;q++){let N=R[Math.floor(Z()*R.length)],L=O/Y.width;C.push({x:N.x+(Z()-0.5)*L,y:N.y+(Z()-0.5)*L})}return{points:C,aspect:Y.height/Y.width}}var fK=new j,gK=new PJ,pK=new j,dK=new S0;function uK(J){let Q=Math.max(1,Math.floor(L0(J.getAttribute("count"),1500))),$=Math.floor(L0(J.getAttribute("seed"),1)),Z=L0(J.getAttribute("size"),0.12),W=L0(J.getAttribute("width"),12),Y=k9(J.getAttribute("start"),0.5),X=k9(J.getAttribute("duration"),3.5),K=Math.min(0.95,Math.max(0,L0(J.getAttribute("stagger"),0.5))),H=TQ(J.getAttribute("ease"),"power3.inOut"),U=(J.getAttribute("mode")??"gather").toLowerCase()==="disperse",G=OJ(J.getAttribute("position"),[0,0,0]),F=OJ(J.getAttribute("scatter"),[W*1.6,W*0.8,W]),E=(J.getAttribute("palette")??"#fafafa,#e4e4e7,#ef4444,#18181b").split(",").map((A)=>new R0(A.trim())),O=z6($),{points:R,aspect:C}=DF(J.getAttribute("text")??"STEREOFRAME",J.getAttribute("font")??"900 140px sans-serif",Q,O),q=new M9(1,0.72),N=new X9({roughness:0.92,metalness:0,side:cJ}),L=new q6(q,N,Q);L.position.set(G[0],G[1],G[2]),L.frustumCulled=!1;let M=new Float32Array(Q*3),k=new Float32Array(Q*3),_=[],P=[],V=new Float32Array(Q*2),D=new Float32Array(Q);for(let A=0;A<Q;A++){let z=R[A%Math.max(1,R.length)]??{x:0.5,y:0.5};M[A*3]=(O()-0.5)*F[0],M[A*3+1]=(O()-0.5)*F[1],M[A*3+2]=(O()-0.5)*F[2],k[A*3]=(z.x-0.5)*W,k[A*3+1]=(0.5-z.y)*W*C,k[A*3+2]=(O()-0.5)*0.05,_.push(new PJ().setFromAxisAngle(new j(O()-0.5,O()-0.5,O()-0.5).normalize(),O()*Math.PI*2)),P.push(new PJ().setFromAxisAngle(new j(0,0,1),(O()-0.5)*0.35)),V[A*2]=Z*(0.7+O()*0.7),V[A*2+1]=Z*(0.7+O()*0.7),D[A]=O()*K,L.setColorAt(A,E[Math.floor(O()*E.length)])}if(L.instanceColor)L.instanceColor.needsUpdate=!0;let B=(A)=>{let z=X>0?(A-Y)/X:A<Y?0:1;if(z=Math.min(1,Math.max(0,z)),U)z=1-z;for(let S=0;S<Q;S++){let y=H(nX(z,D[S],K));fK.set(M[S*3]+(k[S*3]-M[S*3])*y,M[S*3+1]+(k[S*3+1]-M[S*3+1])*y,M[S*3+2]+(k[S*3+2]-M[S*3+2])*y),gK.slerpQuaternions(_[S],P[S],y),pK.set(V[S*2],V[S*2+1],1),dK.compose(fK,gK,pK),L.setMatrixAt(S,dK)}L.instanceMatrix.needsUpdate=!0};return B(0),{mesh:L,writer:B}}var MF=`
4646
+ }`};function Q1(J){let Q=new I$;Q.scale.setScalar(V0(J.getAttribute("scale"),2000));let $=Q.material.uniforms;$.turbidity.value=V0(J.getAttribute("turbidity"),10),$.rayleigh.value=V0(J.getAttribute("rayleigh"),2),$.mieCoefficient.value=V0(J.getAttribute("mie-coefficient"),0.005),$.mieDirectionalG.value=V0(J.getAttribute("mie-directional-g"),0.8);let Z=V0(J.getAttribute("elevation"),15),W=V0(J.getAttribute("azimuth"),180),Y=j6.degToRad(90-Z),X=j6.degToRad(W),K=new T().setFromSphericalCoords(1,Y,X);return $.sunPosition.value.copy(K),{sky:Q,sunDirection:K}}function AD(J,Q,$,Z){let W=J.split("|").map((q)=>q.trim()),Y=document.createElement("canvas"),X=Y.getContext("2d",{willReadFrequently:!0});X.font=Q;let K=W.map((q)=>X.measureText(q)),H=(K[0].fontBoundingBoxAscent??90)+(K[0].fontBoundingBoxDescent??30),U=Math.max(...K.map((q)=>q.width)),G=H*0.25;Y.width=Math.min(2048,Math.ceil(U+G*2)),Y.height=Math.ceil(H*W.length+G*2),X.font=Q,X.fillStyle="#fff",X.textAlign="center",X.textBaseline="middle";for(let q=0;q<W.length;q++)X.fillText(W[q],Y.width/2,G+H*(q+0.5),Y.width-G);let F=X.getImageData(0,0,Y.width,Y.height).data,E=0.18,O=Math.max(1,Math.floor(Math.sqrt(Y.width*Y.height*E/($*2)))),R=[];for(let q=0;q<Y.height;q+=O)for(let N=0;N<Y.width;N+=O)if(F[(q*Y.width+N)*4+3]>128)R.push({x:N/Y.width,y:q/Y.height});let k=[];if(R.length===0)return{points:k,aspect:1};for(let q=0;q<$;q++){let N=R[Math.floor(Z()*R.length)],L=O/Y.width;k.push({x:N.x+(Z()-0.5)*L,y:N.y+(Z()-0.5)*L})}return{points:k,aspect:Y.height/Y.width}}var $1=new T,Z1=new IJ,W1=new T,Y1=new y0;function X1(J){let Q=Math.max(1,Math.floor(V0(J.getAttribute("count"),1500))),$=Math.floor(V0(J.getAttribute("seed"),1)),Z=V0(J.getAttribute("size"),0.12),W=V0(J.getAttribute("width"),12),Y=t9(J.getAttribute("start"),0.5),X=t9(J.getAttribute("duration"),3.5),K=Math.min(0.95,Math.max(0,V0(J.getAttribute("stagger"),0.5))),H=WY(J.getAttribute("ease"),"power3.inOut"),U=(J.getAttribute("mode")??"gather").toLowerCase()==="disperse",G=CJ(J.getAttribute("position"),[0,0,0]),F=CJ(J.getAttribute("scatter"),[W*1.6,W*0.8,W]),E=(J.getAttribute("palette")??"#fafafa,#e4e4e7,#ef4444,#18181b").split(",").map((j)=>new e(j.trim())),O=JQ($),{points:R,aspect:k}=AD(J.getAttribute("text")??"STEREOFRAME",J.getAttribute("font")??"900 140px sans-serif",Q,O),q=new C9(1,0.72),N=new sJ({roughness:0.92,metalness:0,side:Y9}),L=new K8(q,N,Q);L.position.set(G[0],G[1],G[2]),L.frustumCulled=!1;let D=new Float32Array(Q*3),V=new Float32Array(Q*3),I=[],z=[],B=new Float32Array(Q*2),M=new Float32Array(Q);for(let j=0;j<Q;j++){let w=R[j%Math.max(1,R.length)]??{x:0.5,y:0.5};D[j*3]=(O()-0.5)*F[0],D[j*3+1]=(O()-0.5)*F[1],D[j*3+2]=(O()-0.5)*F[2],V[j*3]=(w.x-0.5)*W,V[j*3+1]=(0.5-w.y)*W*k,V[j*3+2]=(O()-0.5)*0.05,I.push(new IJ().setFromAxisAngle(new T(O()-0.5,O()-0.5,O()-0.5).normalize(),O()*Math.PI*2)),z.push(new IJ().setFromAxisAngle(new T(0,0,1),(O()-0.5)*0.35)),B[j*2]=Z*(0.7+O()*0.7),B[j*2+1]=Z*(0.7+O()*0.7),M[j]=O()*K,L.setColorAt(j,E[Math.floor(O()*E.length)])}if(L.instanceColor)L.instanceColor.needsUpdate=!0;let C=(j)=>{let w=X>0?(j-Y)/X:j<Y?0:1;if(w=Math.min(1,Math.max(0,w)),U)w=1-w;for(let v=0;v<Q;v++){let b=H(KE(w,M[v],K));$1.set(D[v*3]+(V[v*3]-D[v*3])*b,D[v*3+1]+(V[v*3+1]-D[v*3+1])*b,D[v*3+2]+(V[v*3+2]-D[v*3+2])*b),Z1.slerpQuaternions(I[v],z[v],b),W1.set(B[v*2],B[v*2+1],1),Y1.compose($1,Z1,W1),L.setMatrixAt(v,Y1)}L.instanceMatrix.needsUpdate=!0};return C(0),{mesh:L,writer:C}}var SD=`
4425
4647
  uniform vec3 uColor;
4426
4648
  uniform float uOpacity;
4427
4649
  varying float vFade;
@@ -4431,7 +4653,7 @@ void main() {
4431
4653
  if (alpha < 0.003) discard;
4432
4654
  gl_FragColor = vec4(uColor, alpha);
4433
4655
  }
4434
- `,kF=`
4656
+ `,jD=`
4435
4657
  attribute vec3 aVel;
4436
4658
  attribute float aBirth;
4437
4659
  attribute float aLife;
@@ -4448,7 +4670,7 @@ void main() {
4448
4670
  gl_PointSize = uSize * (300.0 / max(0.1, -mv.z));
4449
4671
  gl_Position = projectionMatrix * mv;
4450
4672
  }
4451
- `,BF=`
4673
+ `,vD=`
4452
4674
  attribute vec3 aWobble; // x: phase, y: fall speed, z: sway amplitude
4453
4675
  uniform float uTime;
4454
4676
  uniform float uSize;
@@ -4464,7 +4686,7 @@ void main() {
4464
4686
  gl_PointSize = uSize * (300.0 / max(0.1, -mv.z));
4465
4687
  gl_Position = projectionMatrix * mv;
4466
4688
  }
4467
- `,VF=`
4689
+ `,yD=`
4468
4690
  attribute vec3 aFreq;
4469
4691
  attribute vec3 aPhase;
4470
4692
  uniform float uTime;
@@ -4482,8 +4704,8 @@ void main() {
4482
4704
  gl_PointSize = uSize * (300.0 / max(0.1, -mv.z));
4483
4705
  gl_Position = projectionMatrix * mv;
4484
4706
  }
4485
- `;function mK(J){let Q=(J.getAttribute("preset")??"fountain").toLowerCase(),$=Math.max(1,Math.floor(L0(J.getAttribute("count"),500))),Z=Math.floor(L0(J.getAttribute("seed"),1)),W=L0(J.getAttribute("size"),0.08),Y=L0(J.getAttribute("opacity"),0.9),X=new R0(K9(J.getAttribute("color"),"#ffffff")),K=OJ(J.getAttribute("area"),[6,4,6]),H=z6(Z),U=new RJ,G=new Float32Array($*3),F={value:0},E={uTime:F,uSize:{value:W},uColor:{value:X},uOpacity:{value:Y}},O,R=f6;if(Q==="snow"){let N=new Float32Array($*3);for(let L=0;L<$;L++)G[L*3]=(H()-0.5)*K[0],G[L*3+1]=H()*K[1],G[L*3+2]=(H()-0.5)*K[2],N[L*3]=H()*Math.PI*2,N[L*3+1]=0.4+H()*0.8,N[L*3+2]=0.05+H()*0.25;U.setAttribute("aWobble",new JJ(N,3)),E.uArea={value:{x:K[0],y:K[1],z:K[2]}},O=BF,R=V8}else if(Q==="dust"){let N=new Float32Array($*3),L=new Float32Array($*3);for(let M=0;M<$;M++){G[M*3]=(H()-0.5)*K[0],G[M*3+1]=(H()-0.5)*K[1],G[M*3+2]=(H()-0.5)*K[2];for(let k=0;k<3;k++)N[M*3+k]=0.1+H()*0.5,L[M*3+k]=H()*Math.PI*2}U.setAttribute("aFreq",new JJ(N,3)),U.setAttribute("aPhase",new JJ(L,3)),E.uAmp={value:L0(J.getAttribute("amplitude"),0.4)},O=VF}else{let N=L0(J.getAttribute("speed"),3),L=L0(J.getAttribute("spread"),25),M=L0(J.getAttribute("life"),2.5),k=new Float32Array($*3),_=new Float32Array($),P=new Float32Array($),V=L*Math.PI/180;for(let D=0;D<$;D++){G[D*3]=(H()-0.5)*0.05,G[D*3+1]=0,G[D*3+2]=(H()-0.5)*0.05;let B=H()*Math.PI*2,A=H()*V,z=N*(0.7+H()*0.6);k[D*3]=Math.sin(A)*Math.sin(B)*z,k[D*3+1]=Math.cos(A)*z,k[D*3+2]=Math.sin(A)*Math.cos(B)*z,P[D]=M*(0.6+H()*0.8),_[D]=H()*P[D]}U.setAttribute("aVel",new JJ(k,3)),U.setAttribute("aBirth",new JJ(_,1)),U.setAttribute("aLife",new JJ(P,1)),E.uGravity={value:L0(J.getAttribute("gravity"),4)},O=kF}U.setAttribute("position",new JJ(G,3));let C=new SJ({uniforms:E,vertexShader:O,fragmentShader:MF,transparent:!0,depthWrite:!1,blending:R}),q=new s9(U,C);return q.frustumCulled=!1,q.position.set(...OJ(J.getAttribute("position"),[0,0,0])),{points:q,timeUniform:F}}function CF(J){let Q=J.closest("[data-composition-id]"),$=L0(J.getAttribute("width")??Q?.dataset.width??null,1920),Z=L0(J.getAttribute("height")??Q?.dataset.height??null,1080);return{width:$,height:Z}}function lK(J,Q){J.position.set(...OJ(Q.getAttribute("position"),[0,0,0])),J.rotation.set(...cX(Q.getAttribute("rotation"))),J.scale.set(...lX(Q.getAttribute("scale")))}function IF(J){let Q=(J.getAttribute("geometry")??"box").toLowerCase(),$=(J.getAttribute("args")??"").trim().split(/\s+/).filter(Boolean).map(Number),Z=(W,Y)=>Number.isFinite($[W])?$[W]:Y;switch(Q){case"sphere":return new t6(Z(0,1),48,24);case"plane":return new M9(Z(0,1),Z(1,1));case"cylinder":return new a6(Z(0,1),Z(1,1),Z(2,1),48);case"torus":return new e6(Z(0,1),Z(1,0.4),24,96);case"icosahedron":return new r6(Z(0,1),Math.max(0,Math.floor(Z(1,2))));case"rounded-box":return new SQ(Z(0,1),Z(1,1),Z(2,1),4,Z(3,0.08));case"box":default:return new Y9(Z(0,1),Z(1,1),Z(2,1))}}function cK(J){let Q=(J.getAttribute("material")??"standard").toLowerCase(),$=new R0(K9(J.getAttribute("color"),"#ffffff")),Z=L0(J.getAttribute("metalness"),0),W=new R0(K9(J.getAttribute("emissive"),"#000000")),Y=L0(J.getAttribute("emissive-intensity"),1),X=L0(J.getAttribute("env-map-intensity"),1);if(Q==="glass"||Q==="physical"){let K=Q==="glass";return new lJ({color:$,metalness:Z,roughness:L0(J.getAttribute("roughness"),K?0.08:0.5),transmission:L0(J.getAttribute("transmission"),K?1:0),thickness:L0(J.getAttribute("thickness"),K?0.4:0),ior:L0(J.getAttribute("ior"),1.5),clearcoat:L0(J.getAttribute("clearcoat"),K?1:0),clearcoatRoughness:L0(J.getAttribute("clearcoat-roughness"),0.1),dispersion:L0(J.getAttribute("dispersion"),0),emissive:W,emissiveIntensity:Y,envMapIntensity:X})}return new X9({color:$,metalness:Z,roughness:L0(J.getAttribute("roughness"),0.5),emissive:W,emissiveIntensity:Y,envMapIntensity:X})}function zF(J){let Q=new GJ(IF(J),cK(J));return lK(Q,J),Q}function wF(J,Q){let $=(J.getAttribute("preset")??"").toLowerCase();if($==="studio"){Q.add(new J7(16777215,0.35));let K=new j9(16777215,2.6);K.position.set(3,5,4),Q.add(K);let H=new j9(12571903,1.1);H.position.set(-4,2.5,-3),Q.add(H);return}if($==="soft"){Q.add(new M6(16777215,3358799,1.6));let K=new j9(16777215,1);K.position.set(2,3,4),Q.add(K);return}if($==="sunset"){Q.add(new M6(16767411,2761272,1));let K=new j9(16756848,2.4);K.position.set(-5,1.5,3),Q.add(K);return}let Z=(J.getAttribute("type")??"directional").toLowerCase(),W=new R0(K9(J.getAttribute("color"),"#ffffff")),Y=L0(J.getAttribute("intensity"),1),X;if(Z==="ambient")X=new J7(W,Y);else if(Z==="hemisphere")X=new M6(W,2236979,Y);else if(Z==="point")X=new k6(W,Y);else X=new j9(W,Y);if("position"in X&&J.getAttribute("position"))X.position.set(...OJ(J.getAttribute("position"),[0,1,0]));Q.add(X)}function KW(J){let Q=L0(J.getAttribute("duration"),0);if(Q>0)return Q;let $=J.closest("[data-composition-id]"),Z=L0($?.dataset.duration??null,0);return Z>0?Z:5}function nK(J){let{width:Q,height:$}=CF(J),Z={start:L0(J.getAttribute("start"),0),duration:KW(J),transition:(J.getAttribute("transition")??"cut").toLowerCase()==="crossfade"?"crossfade":"cut",transitionDuration:L0(J.getAttribute("transition-duration"),0.6)},W=document.createElement("canvas");W.width=Q,W.height=$,J.prepend(W);let Y=J.getAttribute("background")??"",X=Y==="transparent"||Y==="",K=new lZ({canvas:W,antialias:!1,alpha:!0});K.setSize(Q,$,!1),K.setPixelRatio(1);let H=(J.getAttribute("tone-mapping")??"aces").toLowerCase();K.toneMapping=H==="none"?rJ:g6,K.toneMappingExposure=L0(J.getAttribute("exposure"),1);let U=new ZQ;if(!X&&Y!=="environment")U.background=new R0(K9(Y,"#000000"));let G=new kJ(C6(null,35),Q/$,0.05,200);G.position.set(0,1,5);let F=[],E=new Map,O=new Map,R=[],C=[],q=null,N=null,L=[0,0,0],M=null,k=[],_=[],P=new $W,V=new WW,D=J.getAttribute("environment");if(D){let A=new Y7(K);C.push(V.loadAsync(D).then((z)=>{let S=A.fromEquirectangular(z).texture;if(U.environment=S,Y==="environment")U.background=S;z.dispose(),A.dispose()}))}for(let A of Array.from(J.children)){let z=A.tagName.toLowerCase();if(z==="sf-camera"){G.fov=C6(A.getAttribute("fov"),35),G.far=L0(A.getAttribute("far"),200),G.position.set(...OJ(A.getAttribute("position"),[0,1,5])),G.updateProjectionMatrix();let S=A.getAttribute("look-at");if(L=OJ(A.getAttribute("look-at-offset"),[0,0,0]),S&&S.startsWith("#"))N=S.slice(1);else if(S)q={point:OJ(S,[0,0,0])}}else if(z==="sf-mesh"){let S=zF(A);if(U.add(S),A.id)E.set(A.id,S)}else if(z==="sf-model"){let S=new W9;if(lK(S,A),U.add(S),A.id)E.set(A.id,S);let y=A.getAttribute("src"),v=A.getAttribute("clip");if(y)C.push(P.loadAsync(y).then((h)=>{if(S.add(h.scene),h.animations.length>0){let g=new kQ(h.scene),p=new Map,c=v??h.animations[0].name;for(let a of h.animations){let Q0=g.clipAction(a);Q0.setEffectiveTimeScale(1),Q0.setEffectiveWeight(a.name===c?1:0),Q0.play(),p.set(a.name,Q0)}O.set(S,p),F.push(g)}}))}else if(z==="sf-light")wF(A,U);else if(z==="sf-particles"){let{points:S,timeUniform:y}=mK(A);if(U.add(S),A.id)E.set(A.id,S);R.push(y)}else if(z==="sf-sky"){let{sky:S,sunDirection:y}=bK(A);if(U.add(S),A.id)E.set(A.id,S);M=y}else if(z==="sf-ocean"){let S=xK(A);if(U.add(S.water),A.id)E.set(A.id,S.water);R.push(S.timeProxy),C.push(S.pending),k.push(S)}else if(z==="sf-swarm"){let S=uK(A);if(U.add(S.mesh),A.id)E.set(A.id,S.mesh);_.push(S.writer)}else if(z==="sf-metaball"){let S=hK(A,cK(A));if(U.add(S.mesh),A.id)E.set(A.id,S.mesh);_.push(S.writer)}}if(M)for(let A of k)A.setSunDirection(M);let B=Promise.all(C).then(async()=>{if(N){let A=E.get(N);if(A)q={object:A,offset:L}}try{await K.compileAsync(U,G)}catch{K.compile(U,G)}});return{host:J,width:Q,height:$,canvas:W,shot:Z,renderer:K,scene:U,camera:G,mixers:F,get lookAt(){return q},objectsById:E,actionsByObject:O,seekFns:_,lateSeekFns:[],timeUniforms:R,ready:B}}function vQ(J,Q){let $=Q.start+Q.duration,Z=J>=Q.start&&J<$,W=Math.min(Math.max(J-Q.start,0),Q.duration),Y=1;if(Z&&Q.transition==="crossfade"&&Q.transitionDuration>0)Y=Math.min(1,(J-Q.start)/Q.transitionDuration);return{visible:Z,localT:W,opacity:Y}}var yQ=new sJ,sK=new A8,iK=new S0,PF=new j,HW=null;function _F(J){if(!HW){let Y=document.createElement("canvas");Y.width=64,Y.height=36,HW={canvas:Y,ctx:Y.getContext("2d",{willReadFrequently:!0})}}let{canvas:Q,ctx:$}=HW;$.fillStyle="#000",$.fillRect(0,0,Q.width,Q.height),$.drawImage(J,0,0,Q.width,Q.height);let Z=$.getImageData(0,0,Q.width,Q.height).data,W=0;for(let Y=0;Y<Z.length;Y+=4)W+=(Z[Y]+Z[Y+1]+Z[Y+2])/3;return W/(Z.length/4)/255}function UW(J){return Number.isFinite(J.x)&&Number.isFinite(J.y)&&Number.isFinite(J.z)}function oK(J,Q){return J.map(($)=>{let Z=vQ(Q,$.shot),W=0,Y=0,X=0,K=!UW($.camera.position);$.scene.traverse((G)=>{if(!UW(G.position)||!UW(G.scale))K=!0;if(G instanceof a9)X++;if(G instanceof GJ||G instanceof s9){W++;let F=G.material,E=Array.isArray(F)?F[0]?.type:F?.type;if(E==="MeshStandardMaterial"||E==="MeshPhysicalMaterial")Y++}}),$.camera.updateMatrixWorld(),iK.multiplyMatrices($.camera.projectionMatrix,$.camera.matrixWorldInverse),sK.setFromProjectionMatrix(iK);let H=0,U=0;for(let G of $.scene.children){let F=!1;if(G.traverse((E)=>{if(E instanceof GJ||E instanceof s9)F=!0}),!F)continue;if(H++,yQ.setFromObject(G),yQ.isEmpty())continue;if(sK.intersectsBox(yQ))U++;else if(yQ.getCenter(PF).length()>1e7)U++}return{shot:$.shot,visible:Z.visible,meshCount:W,litMeshCount:Y,lightCount:X,hasEnvironment:$.scene.environment!==null,hasNaN:K,frustumCoverage:H>0?U/H:null,meanLuminance:Z.visible?_F($.canvas):null}})}function aK(J){let Q=5381;for(let $ of J){if($.canvas.style.display==="none")continue;let Z=$.canvas.toDataURL("image/png");for(let W=0;W<Z.length;W++)Q=(Q<<5)+Q+Z.charCodeAt(W)|0}return String(Q>>>0)}var G7=new j;function rK(){return document.querySelector("[data-composition-id]")===null}function tK(){let J=!1,$=window.__hf;try{Object.defineProperty(window,"__hf",{configurable:!0,enumerable:!0,get:()=>J?$:void 0,set:(Z)=>{$=Z}})}catch{J=!0}return{open:()=>{J=!0}}}function TF(J,Q){let $=Math.max(0,Number(Q)||0);for(let W of J.seekFns)W($);for(let W of J.lateSeekFns)W($);for(let W of J.mixers)W.setTime($);for(let W of J.timeUniforms)W.value=$;let Z=J.lookAt;if(Z)if("object"in Z)Z.object.getWorldPosition(G7),G7.x+=Z.offset[0],G7.y+=Z.offset[1],G7.z+=Z.offset[2],J.camera.lookAt(G7);else J.camera.lookAt(Z.point[0],Z.point[1],Z.point[2]);J.renderer.render(J.scene,J.camera)}function AF(){let J=Array.from(document.querySelectorAll(".clip[data-start]")).map((Q)=>({el:Q,start:k9(Q.dataset.start??null,0),duration:k9(Q.dataset.duration??null,Number.POSITIVE_INFINITY)}));return(Q)=>{for(let $ of J){let Z=Q>=$.start&&Q<$.start+$.duration;$.el.style.visibility=Z?"visible":"hidden"}}}function eK(J,Q){let $=!1,Z=typeof window.__hfThreeTime==="number"?window.__hfThreeTime:0,W=Q.standalone?AF():null,Y=(H)=>{if(Z=H,!$)return;W?.(H);for(let U of J){let G=vQ(H,U.shot);if(U.canvas.style.display=G.visible?"":"none",U.canvas.style.opacity=G.opacity>=1?"":String(G.opacity),G.visible)TF(U,G.localT)}};if(!Q.standalone)window.addEventListener("hf-seek",(H)=>{let U=H.detail,G=U&&typeof U.time==="number"?U.time:typeof window.__hfThreeTime==="number"?window.__hfThreeTime:0;Y(G)});let X=J[0],K={version:"0.2.0",ready:!1,duration:Q.duration,width:X?.width??1920,height:X?.height??1080,scenes:J,seek:Y,diagnostics:(H)=>{return Y(H),oK(J,H)},fingerprint:(H)=>{return Y(H),aK(J)}};return window.__stereoframe=K,{markReady:()=>{$=!0,K.ready=!0,Y(typeof window.__hfThreeTime==="number"?window.__hfThreeTime:Z)}}}function JH(J){let Q=performance.now(),$=()=>{let Z=(performance.now()-Q)/1000%Math.max(0.001,J);window.__stereoframe?.seek(Z),requestAnimationFrame($)};requestAnimationFrame($)}var SF=`
4707
+ `;function K1(J){let Q=(J.getAttribute("preset")??"fountain").toLowerCase(),$=Math.max(1,Math.floor(V0(J.getAttribute("count"),500))),Z=Math.floor(V0(J.getAttribute("seed"),1)),W=V0(J.getAttribute("size"),0.08),Y=V0(J.getAttribute("opacity"),0.9),X=new e(y9(J.getAttribute("color"),"#ffffff")),K=CJ(J.getAttribute("area"),[6,4,6]),H=JQ(Z),U=new u0,G=new Float32Array($*3),F={value:0},E={uTime:F,uSize:{value:W},uColor:{value:X},uOpacity:{value:Y}},O,R=l8;if(Q==="snow"){let N=new Float32Array($*3);for(let L=0;L<$;L++)G[L*3]=(H()-0.5)*K[0],G[L*3+1]=H()*K[1],G[L*3+2]=(H()-0.5)*K[2],N[L*3]=H()*Math.PI*2,N[L*3+1]=0.4+H()*0.8,N[L*3+2]=0.05+H()*0.25;U.setAttribute("aWobble",new i0(N,3)),E.uArea={value:{x:K[0],y:K[1],z:K[2]}},O=vD,R=m8}else if(Q==="dust"){let N=new Float32Array($*3),L=new Float32Array($*3);for(let D=0;D<$;D++){G[D*3]=(H()-0.5)*K[0],G[D*3+1]=(H()-0.5)*K[1],G[D*3+2]=(H()-0.5)*K[2];for(let V=0;V<3;V++)N[D*3+V]=0.1+H()*0.5,L[D*3+V]=H()*Math.PI*2}U.setAttribute("aFreq",new i0(N,3)),U.setAttribute("aPhase",new i0(L,3)),E.uAmp={value:V0(J.getAttribute("amplitude"),0.4)},O=yD}else{let N=V0(J.getAttribute("speed"),3),L=V0(J.getAttribute("spread"),25),D=V0(J.getAttribute("life"),2.5),V=new Float32Array($*3),I=new Float32Array($),z=new Float32Array($),B=L*Math.PI/180;for(let M=0;M<$;M++){G[M*3]=(H()-0.5)*0.05,G[M*3+1]=0,G[M*3+2]=(H()-0.5)*0.05;let C=H()*Math.PI*2,j=H()*B,w=N*(0.7+H()*0.6);V[M*3]=Math.sin(j)*Math.sin(C)*w,V[M*3+1]=Math.cos(j)*w,V[M*3+2]=Math.sin(j)*Math.cos(C)*w,z[M]=D*(0.6+H()*0.8),I[M]=H()*z[M]}U.setAttribute("aVel",new i0(V,3)),U.setAttribute("aBirth",new i0(I,1)),U.setAttribute("aLife",new i0(z,1)),E.uGravity={value:V0(J.getAttribute("gravity"),4)},O=jD}U.setAttribute("position",new i0(G,3));let k=new LJ({uniforms:E,vertexShader:O,fragmentShader:SD,transparent:!0,depthWrite:!1,blending:R}),q=new o9(U,k);return q.frustumCulled=!1,q.position.set(...CJ(J.getAttribute("position"),[0,0,0])),{points:q,timeUniform:F}}function xD(J){let Q=J.closest("[data-composition-id]"),$=V0(J.getAttribute("width")??Q?.dataset.width??null,1920),Z=V0(J.getAttribute("height")??Q?.dataset.height??null,1080);return{width:$,height:Z}}function H1(J,Q){J.position.set(...CJ(Q.getAttribute("position"),[0,0,0])),J.rotation.set(...XE(Q.getAttribute("rotation"))),J.scale.set(...YE(Q.getAttribute("scale")))}function bD(J){let Q=(J.getAttribute("geometry")??"box").toLowerCase(),$=(J.getAttribute("args")??"").trim().split(/\s+/).filter(Boolean).map(Number),Z=(W,Y)=>Number.isFinite($[W])?$[W]:Y;switch(Q){case"sphere":return new $6(Z(0,1),48,24);case"plane":return new C9(Z(0,1),Z(1,1));case"cylinder":return new Q6(Z(0,1),Z(1,1),Z(2,1),48);case"torus":return new f6(Z(0,1),Z(1,0.4),24,96);case"icosahedron":return new h6(Z(0,1),Math.max(0,Math.floor(Z(1,2))));case"rounded-box":return new XY(Z(0,1),Z(1,1),Z(2,1),4,Z(3,0.08));case"box":default:return new J9(Z(0,1),Z(1,1),Z(2,1))}}function U1(J){let Q=(J.getAttribute("material")??"standard").toLowerCase(),$=new e(y9(J.getAttribute("color"),"#ffffff")),Z=V0(J.getAttribute("metalness"),0),W=new e(y9(J.getAttribute("emissive"),"#000000")),Y=V0(J.getAttribute("emissive-intensity"),1),X=V0(J.getAttribute("env-map-intensity"),1);if(Q==="glass"||Q==="physical"){let K=Q==="glass";return new iJ({color:$,metalness:Z,roughness:V0(J.getAttribute("roughness"),K?0.08:0.5),transmission:V0(J.getAttribute("transmission"),K?1:0),thickness:V0(J.getAttribute("thickness"),K?0.4:0),ior:V0(J.getAttribute("ior"),1.5),clearcoat:V0(J.getAttribute("clearcoat"),K?1:0),clearcoatRoughness:V0(J.getAttribute("clearcoat-roughness"),0.1),dispersion:V0(J.getAttribute("dispersion"),0),emissive:W,emissiveIntensity:Y,envMapIntensity:X})}return new sJ({color:$,metalness:Z,roughness:V0(J.getAttribute("roughness"),0.5),emissive:W,emissiveIntensity:Y,envMapIntensity:X})}function hD(J){let Q=new a0(bD(J),U1(J));return H1(Q,J),Q}function fD(J,Q){let $=(J.getAttribute("preset")??"").toLowerCase();if($==="studio"){Q.add(new d6(16777215,0.35));let K=new v9(16777215,2.6);K.position.set(3,5,4),Q.add(K);let H=new v9(12571903,1.1);H.position.set(-4,2.5,-3),Q.add(H);return}if($==="soft"){Q.add(new Z6(16777215,3358799,1.6));let K=new v9(16777215,1);K.position.set(2,3,4),Q.add(K);return}if($==="sunset"){Q.add(new Z6(16767411,2761272,1));let K=new v9(16756848,2.4);K.position.set(-5,1.5,3),Q.add(K);return}let Z=(J.getAttribute("type")??"directional").toLowerCase(),W=new e(y9(J.getAttribute("color"),"#ffffff")),Y=V0(J.getAttribute("intensity"),1),X;if(Z==="ambient")X=new d6(W,Y);else if(Z==="hemisphere")X=new Z6(W,2236979,Y);else if(Z==="point")X=new E8(W,Y);else X=new v9(W,Y);if("position"in X&&J.getAttribute("position"))X.position.set(...CJ(J.getAttribute("position"),[0,1,0]));Q.add(X)}function TH(J){let Q=V0(J.getAttribute("duration"),0);if(Q>0)return Q;let $=J.closest("[data-composition-id]"),Z=V0($?.dataset.duration??null,0);return Z>0?Z:5}function G1(J){let{width:Q,height:$}=xD(J),Z={start:V0(J.getAttribute("start"),0),duration:TH(J),transition:(J.getAttribute("transition")??"cut").toLowerCase()==="crossfade"?"crossfade":"cut",transitionDuration:V0(J.getAttribute("transition-duration"),0.6)},W=Math.max(1,Math.min(4,Math.round(V0(J.getAttribute("samples"),2)))),Y=Q*W,X=$*W,K=document.createElement("canvas");K.width=Y,K.height=X,K.style.width=`${Q}px`,K.style.height=`${$}px`,J.prepend(K);let H=J.getAttribute("background")??"",U=H==="transparent"||H==="",G=new tW({canvas:K,antialias:!1,alpha:!0});G.setSize(Y,X,!1),G.setPixelRatio(1);let F=(J.getAttribute("tone-mapping")??"aces").toLowerCase();G.toneMapping=F==="none"?E9:c8,G.toneMappingExposure=V0(J.getAttribute("exposure"),1);let E=new t8;if(!U&&H!=="environment")E.background=new e(y9(H,"#000000"));let O=new BJ(a7(null,35),Q/$,0.05,200);O.position.set(0,1,5);let R=[],k=new Map,q=new Map,N=[],L=[],D=null,V=null,I=[0,0,0],z=null,B=[],M=[],C=new kH,j=new VH,w=J.getAttribute("environment");if(w==="room"||w==="studio"){let S=new l6(G);E.environment=S.fromScene(new BH,0.04).texture,S.dispose()}else if(w){let S=new l6(G);L.push(j.loadAsync(w).then((h)=>{let x=S.fromEquirectangular(h).texture;if(E.environment=x,H==="environment")E.background=x;h.dispose(),S.dispose()}))}for(let S of Array.from(J.children)){let h=S.tagName.toLowerCase();if(h==="sf-camera"){O.fov=a7(S.getAttribute("fov"),35),O.far=V0(S.getAttribute("far"),200),O.position.set(...CJ(S.getAttribute("position"),[0,1,5])),O.updateProjectionMatrix();let x=S.getAttribute("look-at");if(I=CJ(S.getAttribute("look-at-offset"),[0,0,0]),x&&x.startsWith("#"))V=x.slice(1);else if(x)D={point:CJ(x,[0,0,0])}}else if(h==="sf-mesh"){let x=hD(S);if(E.add(x),S.id)k.set(S.id,x)}else if(h==="sf-model"){let x=new U9;if(H1(x,S),E.add(x),S.id)k.set(S.id,x);let p=S.getAttribute("src"),c=S.getAttribute("clip");if(p)L.push(C.loadAsync(p).then((o)=>{if(x.add(o.scene),o.animations.length>0){let W0=new O$(o.scene),H0=new Map,J0=c??o.animations[0].name;for(let c0 of o.animations){let d0=W0.clipAction(c0);d0.setEffectiveTimeScale(1),d0.setEffectiveWeight(c0.name===J0?1:0),d0.play(),H0.set(c0.name,d0)}q.set(x,H0),R.push(W0)}}))}else if(h==="sf-light")fD(S,E);else if(h==="sf-particles"){let{points:x,timeUniform:p}=K1(S);if(E.add(x),S.id)k.set(S.id,x);N.push(p)}else if(h==="sf-sky"){let{sky:x,sunDirection:p}=Q1(S);if(E.add(x),S.id)k.set(S.id,x);z=p}else if(h==="sf-ocean"){let x=J1(S);if(E.add(x.water),S.id)k.set(S.id,x.water);N.push(x.timeProxy),L.push(x.pending),B.push(x)}else if(h==="sf-swarm"){let x=X1(S);if(E.add(x.mesh),S.id)k.set(S.id,x.mesh);M.push(x.writer)}else if(h==="sf-metaball"){let x=eE(S,U1(S));if(E.add(x.mesh),S.id)k.set(S.id,x.mesh);M.push(x.writer)}}if(z)for(let S of B)S.setSunDirection(z);let v=Promise.all(L).then(async()=>{if(V){let S=k.get(V);if(S)D={object:S,offset:I}}try{await G.compileAsync(E,O)}catch{G.compile(E,O)}}),b=tE(G,E,O,{width:Y,height:X,bloom:V0(J.getAttribute("bloom"),0),bloomThreshold:V0(J.getAttribute("bloom-threshold"),0.85),bloomRadius:V0(J.getAttribute("bloom-radius"),0.6),vignette:V0(J.getAttribute("vignette"),0)});return{host:J,width:Q,height:$,canvas:K,post:b,shot:Z,renderer:G,scene:E,camera:O,mixers:R,get lookAt(){return D},objectsById:k,actionsByObject:q,seekFns:M,lateSeekFns:[],timeUniforms:N,ready:v}}function UY(J,Q){let $=Q.start+Q.duration,Z=J>=Q.start&&J<$,W=Math.min(Math.max(J-Q.start,0),Q.duration),Y=1;if(Z&&Q.transition==="crossfade"&&Q.transitionDuration>0)Y=Math.min(1,(J-Q.start)/Q.transitionDuration);return{visible:Z,localT:W,opacity:Y}}var GY=new SJ,E1=new H8,F1=new y0,gD=new T,AH=null;function pD(J){if(!AH){let Y=document.createElement("canvas");Y.width=64,Y.height=36,AH={canvas:Y,ctx:Y.getContext("2d",{willReadFrequently:!0})}}let{canvas:Q,ctx:$}=AH;$.fillStyle="#000",$.fillRect(0,0,Q.width,Q.height),$.drawImage(J,0,0,Q.width,Q.height);let Z=$.getImageData(0,0,Q.width,Q.height).data,W=0;for(let Y=0;Y<Z.length;Y+=4)W+=(Z[Y]+Z[Y+1]+Z[Y+2])/3;return W/(Z.length/4)/255}function SH(J){return Number.isFinite(J.x)&&Number.isFinite(J.y)&&Number.isFinite(J.z)}function N1(J,Q){return J.map(($)=>{let Z=UY(Q,$.shot),W=0,Y=0,X=0,K=!SH($.camera.position);$.scene.traverse((G)=>{if(!SH(G.position)||!SH(G.scale))K=!0;if(G instanceof j9)X++;if(G instanceof a0||G instanceof o9){W++;let F=G.material,E=Array.isArray(F)?F[0]?.type:F?.type;if(E==="MeshStandardMaterial"||E==="MeshPhysicalMaterial")Y++}}),$.camera.updateMatrixWorld(),F1.multiplyMatrices($.camera.projectionMatrix,$.camera.matrixWorldInverse),E1.setFromProjectionMatrix(F1);let H=0,U=0;for(let G of $.scene.children){let F=!1;if(G.traverse((E)=>{if(E instanceof a0||E instanceof o9)F=!0}),!F)continue;if(H++,GY.setFromObject(G),GY.isEmpty())continue;if(E1.intersectsBox(GY))U++;else if(GY.getCenter(gD).length()>1e7)U++}return{shot:$.shot,visible:Z.visible,meshCount:W,litMeshCount:Y,lightCount:X,hasEnvironment:$.scene.environment!==null,hasNaN:K,frustumCoverage:H>0?U/H:null,meanLuminance:Z.visible?pD($.canvas):null}})}function O1(J){let Q=5381;for(let $ of J){if($.canvas.style.display==="none")continue;let Z=$.canvas.toDataURL("image/png");for(let W=0;W<Z.length;W++)Q=(Q<<5)+Q+Z.charCodeAt(W)|0}return String(Q>>>0)}var z$=new T;function q1(){return document.querySelector("[data-composition-id]")===null}function R1(){let J=!1,$=window.__hf;try{Object.defineProperty(window,"__hf",{configurable:!0,enumerable:!0,get:()=>J?$:void 0,set:(Z)=>{$=Z}})}catch{J=!0}return{open:()=>{J=!0}}}function uD(J,Q){let $=Math.max(0,Number(Q)||0);for(let W of J.seekFns)W($);for(let W of J.lateSeekFns)W($);for(let W of J.mixers)W.setTime($);for(let W of J.timeUniforms)W.value=$;let Z=J.lookAt;if(Z)if("object"in Z)Z.object.getWorldPosition(z$),z$.x+=Z.offset[0],z$.y+=Z.offset[1],z$.z+=Z.offset[2],J.camera.lookAt(z$);else J.camera.lookAt(Z.point[0],Z.point[1],Z.point[2]);if(J.post)J.post.render();else J.renderer.render(J.scene,J.camera)}function dD(){let J=Array.from(document.querySelectorAll(".clip[data-start]")).map((Q)=>({el:Q,start:t9(Q.dataset.start??null,0),duration:t9(Q.dataset.duration??null,Number.POSITIVE_INFINITY)}));return(Q)=>{for(let $ of J){let Z=Q>=$.start&&Q<$.start+$.duration;$.el.style.visibility=Z?"visible":"hidden"}}}function L1(J,Q){let $=!1,Z=typeof window.__hfThreeTime==="number"?window.__hfThreeTime:0,W=Q.standalone?dD():null,Y=(H)=>{if(Z=H,!$)return;W?.(H);for(let U of J){let G=UY(H,U.shot);if(U.canvas.style.display=G.visible?"":"none",U.canvas.style.opacity=G.opacity>=1?"":String(G.opacity),G.visible)uD(U,G.localT)}};if(!Q.standalone)window.addEventListener("hf-seek",(H)=>{let U=H.detail,G=U&&typeof U.time==="number"?U.time:typeof window.__hfThreeTime==="number"?window.__hfThreeTime:0;Y(G)});let X=J[0],K={version:"0.2.0",ready:!1,duration:Q.duration,width:X?.width??1920,height:X?.height??1080,scenes:J,seek:Y,diagnostics:(H)=>{return Y(H),N1(J,H)},fingerprint:(H)=>{return Y(H),O1(J)}};return window.__stereoframe=K,{markReady:()=>{$=!0,K.ready=!0,Y(typeof window.__hfThreeTime==="number"?window.__hfThreeTime:Z)}}}function D1(J){let Q=performance.now(),$=()=>{let Z=(performance.now()-Q)/1000%Math.max(0.001,J);window.__stereoframe?.seek(Z),requestAnimationFrame($)};requestAnimationFrame($)}var mD=`
4486
4708
  sf-scene { display: block; line-height: 0; }
4487
4709
  sf-scene > canvas { display: block; }
4488
4710
  sf-camera, sf-model, sf-mesh, sf-light, sf-env, sf-animate, sf-particles, sf-sky, sf-ocean, sf-swarm, sf-metaball { display: none; }
4489
- `;function jF(){if(document.getElementById("__stereoframe-styles"))return;let J=document.createElement("style");J.id="__stereoframe-styles",J.textContent=SF,document.head.appendChild(J)}function vF(J){let Q=0;for(let $ of J){let Z=k9($.getAttribute("start"),0);Q=Math.max(Q,Z+KW($))}if(Q<=0)return console.warn('[stereoframe] no duration found; add duration="<seconds>" to <sf-scene>. Using 5s.'),5;return Q}async function QH(){jF();let J=Array.from(document.querySelectorAll("sf-scene"));if(J.length===0)return;let Q=rK(),$=Q?null:tK(),Z=vF(J),W=J.map(nK),Y=eK(W,{duration:Z,standalone:Q});await Promise.all(W.map((X)=>X.ready));for(let X of W)WK(X);if(yF(W),Y.markReady(),$?.open(),Q&&new URLSearchParams(location.search).has("sf-preview"))JH(Z)}function yF(J){let Q=J[0];if(!Q)return;let $={scene:Q.scene,camera:Q.camera,renderer:Q.renderer,objects:Q.objectsById,scenes:J,onSeek:(Z)=>{Q.seekFns.push(Z)}};for(let Z of Array.from(document.querySelectorAll('script[type="stereoframe"]')))try{Function("sf",Z.textContent??"")($)}catch(W){console.error("[stereoframe] escape-hatch script failed:",W)}}await QH();export{QH as boot};
4711
+ `;function lD(){if(document.getElementById("__stereoframe-styles"))return;let J=document.createElement("style");J.id="__stereoframe-styles",J.textContent=mD,document.head.appendChild(J)}function cD(J){let Q=0;for(let $ of J){let Z=t9($.getAttribute("start"),0);Q=Math.max(Q,Z+TH($))}if(Q<=0)return console.warn('[stereoframe] no duration found; add duration="<seconds>" to <sf-scene>. Using 5s.'),5;return Q}async function k1(){lD();let J=Array.from(document.querySelectorAll("sf-scene"));if(J.length===0)return;let Q=q1(),$=Q?null:R1(),Z=cD(J),W=J.map(G1),Y=L1(W,{duration:Z,standalone:Q});await Promise.all(W.map((X)=>X.ready));for(let X of W)kE(X);if(nD(W),Y.markReady(),$?.open(),Q&&new URLSearchParams(location.search).has("sf-preview"))D1(Z)}function nD(J){let Q=J[0];if(!Q)return;let $={THREE:eW,scene:Q.scene,camera:Q.camera,renderer:Q.renderer,width:Q.width,height:Q.height,objects:Q.objectsById,scenes:J,onSeek:(Z)=>{Q.seekFns.push(Z)}};for(let Z of Array.from(document.querySelectorAll('script[type="stereoframe"]')))try{Function("sf",Z.textContent??"")($)}catch(W){console.error("[stereoframe] escape-hatch script failed:",W)}}await k1();export{k1 as boot};