three-cad-viewer 1.7.12 → 1.8.1

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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2010-2022 Three.js Authors
3
+ * Copyright 2010-2023 Three.js Authors
4
4
  * SPDX-License-Identifier: MIT
5
5
  */
6
- const t={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},e={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3};class n{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const n=this._listeners;return void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const n=this._listeners[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const n=e.slice(0);for(let e=0,i=n.length;e<i;e++)n[e].call(this,t);t.target=null}}}const i=[];for(let t=0;t<256;t++)i[t]=(t<16?"0":"")+t.toString(16);let r=1234567;const s=Math.PI/180,o=180/Math.PI;function a(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(i[255&t]+i[t>>8&255]+i[t>>16&255]+i[t>>24&255]+"-"+i[255&e]+i[e>>8&255]+"-"+i[e>>16&15|64]+i[e>>24&255]+"-"+i[63&n|128]+i[n>>8&255]+"-"+i[n>>16&255]+i[n>>24&255]+i[255&r]+i[r>>8&255]+i[r>>16&255]+i[r>>24&255]).toLowerCase()}function l(t,e,n){return Math.max(e,Math.min(n,t))}function h(t,e){return(t%e+e)%e}function c(t,e,n){return(1-n)*t+n*e}function d(t){return 0==(t&t-1)&&0!==t}function u(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function p(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}var m=Object.freeze({__proto__:null,DEG2RAD:s,RAD2DEG:o,generateUUID:a,clamp:l,euclideanModulo:h,mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:c,damp:function(t,e,n,i){return c(t,e,1-Math.exp(-n*i))},pingpong:function(t,e=1){return e-Math.abs(h(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(r=t);let e=r+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*s},radToDeg:function(t){return t*o},isPowerOfTwo:d,ceilPowerOfTwo:u,floorPowerOfTwo:p,setQuaternionFromProperEuler:function(t,e,n,i,r){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),h=s((e+i)/2),c=o((e+i)/2),d=s((e-i)/2),u=o((e-i)/2),p=s((i-e)/2),m=o((i-e)/2);switch(r){case"XYX":t.set(a*c,l*d,l*u,a*h);break;case"YZY":t.set(l*u,a*c,l*d,a*h);break;case"ZXZ":t.set(l*d,l*u,a*c,a*h);break;case"XZX":t.set(a*c,l*m,l*p,a*h);break;case"YXY":t.set(l*p,a*c,l*m,a*h);break;case"ZYZ":t.set(l*m,l*p,a*c,a*h);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:function(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}},denormalize:function(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}});class f{constructor(t=0,e=0){this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this)}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this)}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*n-s*i+t.x,this.y=r*i+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}f.prototype.isVector2=!0;class g{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,i,r,s,o,a,l){const h=this.elements;return h[0]=t,h[1]=i,h[2]=o,h[3]=e,h[4]=r,h[5]=a,h[6]=n,h[7]=s,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],o=n[3],a=n[6],l=n[1],h=n[4],c=n[7],d=n[2],u=n[5],p=n[8],m=i[0],f=i[3],g=i[6],v=i[1],y=i[4],x=i[7],_=i[2],w=i[5],b=i[8];return r[0]=s*m+o*v+a*_,r[3]=s*f+o*y+a*w,r[6]=s*g+o*x+a*b,r[1]=l*m+h*v+c*_,r[4]=l*f+h*y+c*w,r[7]=l*g+h*x+c*b,r[2]=d*m+u*v+p*_,r[5]=d*f+u*y+p*w,r[8]=d*g+u*x+p*b,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],o=t[5],a=t[6],l=t[7],h=t[8];return e*s*h-e*o*l-n*r*h+n*o*a+i*r*l-i*s*a}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],o=t[5],a=t[6],l=t[7],h=t[8],c=h*s-o*l,d=o*a-h*r,u=l*r-s*a,p=e*c+n*d+i*u;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return t[0]=c*m,t[1]=(i*l-h*n)*m,t[2]=(o*n-i*s)*m,t[3]=d*m,t[4]=(h*e-i*a)*m,t[5]=(i*r-o*e)*m,t[6]=u*m,t[7]=(n*a-l*e)*m,t[8]=(s*e-n*r)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,s,o){const a=Math.cos(r),l=Math.sin(r);return this.set(n*a,n*l,-n*(a*s+l*o)+s+t,-i*l,i*a,-i*(-l*s+a*o)+o+e,0,0,1),this}scale(t,e){const n=this.elements;return n[0]*=t,n[3]*=t,n[6]*=t,n[1]*=e,n[4]*=e,n[7]*=e,this}rotate(t){const e=Math.cos(t),n=Math.sin(t),i=this.elements,r=i[0],s=i[3],o=i[6],a=i[1],l=i[4],h=i[7];return i[0]=e*r+n*a,i[3]=e*s+n*l,i[6]=e*o+n*h,i[1]=-n*r+e*a,i[4]=-n*s+e*l,i[7]=-n*o+e*h,this}translate(t,e){const n=this.elements;return n[0]+=t*n[2],n[3]+=t*n[5],n[6]+=t*n[8],n[1]+=e*n[2],n[4]+=e*n[5],n[7]+=e*n[8],this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<9;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}function v(t){for(let e=t.length-1;e>=0;--e)if(t[e]>65535)return!0;return!1}g.prototype.isMatrix3=!0;const y={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function x(t,e){return new y[t](e)}function _(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function w(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function b(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const M={srgb:{"srgb-linear":w},"srgb-linear":{srgb:b}},S={legacyMode:!0,get workingColorSpace(){return"srgb-linear"},set workingColorSpace(t){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(t,e,n){if(this.legacyMode||e===n||!e||!n)return t;if(M[e]&&void 0!==M[e][n]){const i=M[e][n];return t.r=i(t.r),t.g=i(t.g),t.b=i(t.b),t}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}},E={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},T={r:0,g:0,b:0},A={h:0,s:0,l:0},L={h:0,s:0,l:0};function C(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}function k(t,e){return e.r=t.r,e.g=t.g,e.b=t.b,e}class R{constructor(t,e,n){return void 0===e&&void 0===n?this.set(t):this.setRGB(t,e,n)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e="srgb"){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,S.toWorkingColorSpace(this,e),this}setRGB(t,e,n,i="srgb-linear"){return this.r=t,this.g=e,this.b=n,S.toWorkingColorSpace(this,i),this}setHSL(t,e,n,i="srgb-linear"){if(t=h(t,1),e=l(e,0,1),n=l(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=C(r,i,t+1/3),this.g=C(r,i,t),this.b=C(r,i,t-1/3)}return S.toWorkingColorSpace(this,i),this}setStyle(t,e="srgb"){function n(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(t)){let t;const r=i[1],s=i[2];switch(r){case"rgb":case"rgba":if(t=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(255,parseInt(t[1],10))/255,this.g=Math.min(255,parseInt(t[2],10))/255,this.b=Math.min(255,parseInt(t[3],10))/255,S.toWorkingColorSpace(this,e),n(t[4]),this;if(t=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return this.r=Math.min(100,parseInt(t[1],10))/100,this.g=Math.min(100,parseInt(t[2],10))/100,this.b=Math.min(100,parseInt(t[3],10))/100,S.toWorkingColorSpace(this,e),n(t[4]),this;break;case"hsl":case"hsla":if(t=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s)){const i=parseFloat(t[1])/360,r=parseInt(t[2],10)/100,s=parseInt(t[3],10)/100;return n(t[4]),this.setHSL(i,r,s,e)}}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const t=i[1],n=t.length;if(3===n)return this.r=parseInt(t.charAt(0)+t.charAt(0),16)/255,this.g=parseInt(t.charAt(1)+t.charAt(1),16)/255,this.b=parseInt(t.charAt(2)+t.charAt(2),16)/255,S.toWorkingColorSpace(this,e),this;if(6===n)return this.r=parseInt(t.charAt(0)+t.charAt(1),16)/255,this.g=parseInt(t.charAt(2)+t.charAt(3),16)/255,this.b=parseInt(t.charAt(4)+t.charAt(5),16)/255,S.toWorkingColorSpace(this,e),this}return t&&t.length>0?this.setColorName(t,e):this}setColorName(t,e="srgb"){const n=E[t.toLowerCase()];return void 0!==n?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=w(t.r),this.g=w(t.g),this.b=w(t.b),this}copyLinearToSRGB(t){return this.r=b(t.r),this.g=b(t.g),this.b=b(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t="srgb"){return S.fromWorkingColorSpace(k(this,T),t),l(255*T.r,0,255)<<16^l(255*T.g,0,255)<<8^l(255*T.b,0,255)<<0}getHexString(t="srgb"){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e="srgb-linear"){S.fromWorkingColorSpace(k(this,T),e);const n=T.r,i=T.g,r=T.b,s=Math.max(n,i,r),o=Math.min(n,i,r);let a,l;const h=(o+s)/2;if(o===s)a=0,l=0;else{const t=s-o;switch(l=h<=.5?t/(s+o):t/(2-s-o),s){case n:a=(i-r)/t+(i<r?6:0);break;case i:a=(r-n)/t+2;break;case r:a=(n-i)/t+4}a/=6}return t.h=a,t.s=l,t.l=h,t}getRGB(t,e="srgb-linear"){return S.fromWorkingColorSpace(k(this,T),e),t.r=T.r,t.g=T.g,t.b=T.b,t}getStyle(t="srgb"){return S.fromWorkingColorSpace(k(this,T),t),"srgb"!==t?`color(${t} ${T.r} ${T.g} ${T.b})`:`rgb(${255*T.r|0},${255*T.g|0},${255*T.b|0})`}offsetHSL(t,e,n){return this.getHSL(A),A.h+=t,A.s+=e,A.l+=n,this.setHSL(A.h,A.s,A.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(A),t.getHSL(L);const n=c(A.h,L.h,e),i=c(A.s,L.s,e),r=c(A.l,L.l,e);return this.setHSL(n,i,r),this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),!0===t.normalized&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}let P;R.NAMES=E,R.prototype.isColor=!0,R.prototype.r=1,R.prototype.g=1,R.prototype.b=1;class D{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===P&&(P=_("canvas")),P.width=t.width,P.height=t.height;const n=P.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=P}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=_("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t<r.length;t++)r[t]=255*w(r[t]/255);return n.putImageData(i,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*w(e[t]/255)):e[t]=w(e[t]);return{data:e,width:t.width,height:t.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}class I{constructor(t=null){this.uuid=a(),this.data=t,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let t;if(Array.isArray(i)){t=[];for(let e=0,n=i.length;e<n;e++)i[e].isDataTexture?t.push(N(i[e].image)):t.push(N(i[e]))}else t=N(i);n.url=t}return e||(t.images[this.uuid]=n),n}}function N(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?D.getDataURL(t):t.data?{data:Array.prototype.slice.call(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}I.prototype.isSource=!0;let B=0;class z extends n{constructor(t=z.DEFAULT_IMAGE,e=z.DEFAULT_MAPPING,n=1001,i=1001,r=1006,s=1008,o=1023,l=1009,h=1,c=3e3){super(),Object.defineProperty(this,"id",{value:B++}),this.uuid=a(),this.name="",this.source=new I(t),this.mipmaps=[],this.mapping=e,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=h,this.format=o,this.internalFormat=null,this.type=l,this.offset=new f(0,0),this.repeat=new f(1,1),this.center=new f(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new g,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,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,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case 1e3:t.x=t.x-Math.floor(t.x);break;case 1001:t.x=t.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case 1e3:t.y=t.y-Math.floor(t.y);break;case 1001:t.y=t.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}}z.DEFAULT_IMAGE=null,z.DEFAULT_MAPPING=300,z.prototype.isTexture=!0;class O{constructor(t=0,e=0,n=0,i=1){this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*e+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*e+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*e+s[7]*n+s[11]*i+s[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const s=.01,o=.1,a=t.elements,l=a[0],h=a[4],c=a[8],d=a[1],u=a[5],p=a[9],m=a[2],f=a[6],g=a[10];if(Math.abs(h-d)<s&&Math.abs(c-m)<s&&Math.abs(p-f)<s){if(Math.abs(h+d)<o&&Math.abs(c+m)<o&&Math.abs(p+f)<o&&Math.abs(l+u+g-3)<o)return this.set(1,0,0,0),this;e=Math.PI;const t=(l+1)/2,a=(u+1)/2,v=(g+1)/2,y=(h+d)/4,x=(c+m)/4,_=(p+f)/4;return t>a&&t>v?t<s?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(t),i=y/n,r=x/n):a>v?a<s?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(a),n=y/i,r=_/i):v<s?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(v),n=x/r,i=_/r),this.set(n,i,r,e),this}let v=Math.sqrt((f-p)*(f-p)+(c-m)*(c-m)+(d-h)*(d-h));return Math.abs(v)<.001&&(v=1),this.x=(f-p)/v,this.y=(c-m)/v,this.z=(d-h)/v,this.w=Math.acos((l+u+g-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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}}O.prototype.isVector4=!0;class H extends n{constructor(t,e,n={}){super(),this.width=t,this.height=e,this.depth=1,this.scissor=new O(0,0,t,e),this.scissorTest=!1,this.viewport=new O(0,0,t,e);const i={width:t,height:e,depth:1};this.texture=new z(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.internalFormat=void 0!==n.internalFormat?n.internalFormat:null,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:1006,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0!==n.stencilBuffer&&n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null,this.samples=void 0!==n.samples?n.samples:0}setSize(t,e,n=1){this.width===t&&this.height===e&&this.depth===n||(this.width=t,this.height=e,this.depth=n,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0,this.texture.image=Object.assign({},t.texture.image),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}H.prototype.isWebGLRenderTarget=!0;class U extends z{constructor(t=null,e=1,n=1,i=1){super(null),this.image={data:t,width:e,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}U.prototype.isDataArrayTexture=!0;class F extends H{constructor(t,e,n){super(t,e),this.depth=n,this.texture=new U(null,t,e,n),this.texture.isRenderTargetTexture=!0}}F.prototype.isWebGLArrayRenderTarget=!0;class G extends z{constructor(t=null,e=1,n=1,i=1){super(null),this.image={data:t,width:e,height:n,depth:i},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}G.prototype.isData3DTexture=!0;class V extends H{constructor(t,e,n){super(t,e),this.depth=n,this.texture=new G(null,t,e,n),this.texture.isRenderTargetTexture=!0}}V.prototype.isWebGL3DRenderTarget=!0;class W extends H{constructor(t,e,n,i={}){super(t,e,i);const r=this.texture;this.texture=[];for(let t=0;t<n;t++)this.texture[t]=r.clone(),this.texture[t].isRenderTargetTexture=!0}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let i=0,r=this.texture.length;i<r;i++)this.texture[i].image.width=t,this.texture[i].image.height=e,this.texture[i].image.depth=n;this.dispose()}return this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e),this}copy(t){this.dispose(),this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.depthTexture=t.depthTexture,this.texture.length=0;for(let e=0,n=t.texture.length;e<n;e++)this.texture[e]=t.texture[e].clone();return this}}W.prototype.isWebGLMultipleRenderTargets=!0;class j{constructor(t=0,e=0,n=0,i=1){this._x=t,this._y=e,this._z=n,this._w=i}static slerp(t,e,n,i){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),n.slerpQuaternions(t,e,i)}static slerpFlat(t,e,n,i,r,s,o){let a=n[i+0],l=n[i+1],h=n[i+2],c=n[i+3];const d=r[s+0],u=r[s+1],p=r[s+2],m=r[s+3];if(0===o)return t[e+0]=a,t[e+1]=l,t[e+2]=h,void(t[e+3]=c);if(1===o)return t[e+0]=d,t[e+1]=u,t[e+2]=p,void(t[e+3]=m);if(c!==m||a!==d||l!==u||h!==p){let t=1-o;const e=a*d+l*u+h*p+c*m,n=e>=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,e*n);t=Math.sin(t*s)/r,o=Math.sin(o*s)/r}const r=o*n;if(a=a*t+d*r,l=l*t+u*r,h=h*t+p*r,c=c*t+m*r,t===1-o){const t=1/Math.sqrt(a*a+l*l+h*h+c*c);a*=t,l*=t,h*=t,c*=t}}t[e]=a,t[e+1]=l,t[e+2]=h,t[e+3]=c}static multiplyQuaternionsFlat(t,e,n,i,r,s){const o=n[i],a=n[i+1],l=n[i+2],h=n[i+3],c=r[s],d=r[s+1],u=r[s+2],p=r[s+3];return t[e]=o*p+h*c+a*u-l*d,t[e+1]=a*p+h*d+l*c-o*u,t[e+2]=l*p+h*u+o*d-a*c,t[e+3]=h*p-o*c-a*d-l*u,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){if(!t||!t.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const n=t._x,i=t._y,r=t._z,s=t._order,o=Math.cos,a=Math.sin,l=o(n/2),h=o(i/2),c=o(r/2),d=a(n/2),u=a(i/2),p=a(r/2);switch(s){case"XYZ":this._x=d*h*c+l*u*p,this._y=l*u*c-d*h*p,this._z=l*h*p+d*u*c,this._w=l*h*c-d*u*p;break;case"YXZ":this._x=d*h*c+l*u*p,this._y=l*u*c-d*h*p,this._z=l*h*p-d*u*c,this._w=l*h*c+d*u*p;break;case"ZXY":this._x=d*h*c-l*u*p,this._y=l*u*c+d*h*p,this._z=l*h*p+d*u*c,this._w=l*h*c-d*u*p;break;case"ZYX":this._x=d*h*c-l*u*p,this._y=l*u*c+d*h*p,this._z=l*h*p-d*u*c,this._w=l*h*c+d*u*p;break;case"YZX":this._x=d*h*c+l*u*p,this._y=l*u*c+d*h*p,this._z=l*h*p-d*u*c,this._w=l*h*c-d*u*p;break;case"XZY":this._x=d*h*c-l*u*p,this._y=l*u*c-d*h*p,this._z=l*h*p+d*u*c,this._w=l*h*c+d*u*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],s=e[1],o=e[5],a=e[9],l=e[2],h=e[6],c=e[10],d=n+o+c;if(d>0){const t=.5/Math.sqrt(d+1);this._w=.25/t,this._x=(h-a)*t,this._y=(r-l)*t,this._z=(s-i)*t}else if(n>o&&n>c){const t=2*Math.sqrt(1+n-o-c);this._w=(h-a)/t,this._x=.25*t,this._y=(i+s)/t,this._z=(r+l)/t}else if(o>c){const t=2*Math.sqrt(1+o-n-c);this._w=(r-l)/t,this._x=(i+s)/t,this._y=.25*t,this._z=(a+h)/t}else{const t=2*Math.sqrt(1+c-n-o);this._w=(s-i)/t,this._x=(r+l)/t,this._y=(a+h)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(l(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t,e){return void 0!==e?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(t,e)):this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,s=t._w,o=e._x,a=e._y,l=e._z,h=e._w;return this._x=n*h+s*o+i*l-r*a,this._y=i*h+s*a+r*o-n*l,this._z=r*h+s*l+n*a-i*o,this._w=s*h-n*o-i*a-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,s=this._w;let o=s*t._w+n*t._x+i*t._y+r*t._z;if(o<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,o=-o):this.copy(t),o>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const a=1-o*o;if(a<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(a),h=Math.atan2(l,o),c=Math.sin((1-e)*h)/l,d=Math.sin(e*h)/l;return this._w=s*c+this._w*d,this._x=n*c+this._x*d,this._y=i*c+this._y*d,this._z=r*c+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=Math.random(),e=Math.sqrt(1-t),n=Math.sqrt(t),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(i),n*Math.sin(r),n*Math.cos(r),e*Math.sin(i))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}j.prototype.isQuaternion=!0;class q{constructor(t=0,e=0,n=0){this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t,e){return void 0!==e?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(t,e)):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t,e){return void 0!==e?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(t,e)):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this)}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(t,e)):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this)}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return t&&t.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(X.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(X.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,s=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,s=t.y,o=t.z,a=t.w,l=a*e+s*i-o*n,h=a*n+o*e-r*i,c=a*i+r*n-s*e,d=-r*e-s*n-o*i;return this.x=l*a+d*-r+h*-o-c*-s,this.y=h*a+d*-s+c*-r-l*-o,this.z=c*a+d*-o+l*-s-h*-r,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t,e){return void 0!==e?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(t,e)):this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,s=e.x,o=e.y,a=e.z;return this.x=i*a-r*o,this.y=r*s-n*a,this.z=n*o-i*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Z.copy(this).projectOnVector(t),this.sub(Z)}reflect(t){return this.sub(Z.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(l(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,n=Math.sqrt(1-t**2);return this.x=n*Math.cos(e),this.y=n*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}q.prototype.isVector3=!0;const Z=new q,X=new j;class Y{constructor(t=new q(1/0,1/0,1/0),e=new q(-1/0,-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){let e=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,o=-1/0;for(let a=0,l=t.length;a<l;a+=3){const l=t[a],h=t[a+1],c=t[a+2];l<e&&(e=l),h<n&&(n=h),c<i&&(i=c),l>r&&(r=l),h>s&&(s=h),c>o&&(o=c)}return this.min.set(e,n,i),this.max.set(r,s,o),this}setFromBufferAttribute(t){let e=1/0,n=1/0,i=1/0,r=-1/0,s=-1/0,o=-1/0;for(let a=0,l=t.count;a<l;a++){const l=t.getX(a),h=t.getY(a),c=t.getZ(a);l<e&&(e=l),h<n&&(n=h),c<i&&(i=c),l>r&&(r=l),h>s&&(s=h),c>o&&(o=c)}return this.min.set(e,n,i),this.max.set(r,s,o),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=$.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=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(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const n=t.geometry;if(void 0!==n)if(e&&null!=n.attributes&&void 0!==n.attributes.position){const e=n.attributes.position;for(let n=0,i=e.count;n<i;n++)$.fromBufferAttribute(e,n).applyMatrix4(t.matrixWorld),this.expandByPoint($)}else null===n.boundingBox&&n.computeBoundingBox(),K.copy(n.boundingBox),K.applyMatrix4(t.matrixWorld),this.union(K);const i=t.children;for(let t=0,n=i.length;t<n;t++)this.expandByObject(i[t],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,$),$.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(st),ot.subVectors(this.max,st),Q.subVectors(t.a,st),tt.subVectors(t.b,st),et.subVectors(t.c,st),nt.subVectors(tt,Q),it.subVectors(et,tt),rt.subVectors(Q,et);let e=[0,-nt.z,nt.y,0,-it.z,it.y,0,-rt.z,rt.y,nt.z,0,-nt.x,it.z,0,-it.x,rt.z,0,-rt.x,-nt.y,nt.x,0,-it.y,it.x,0,-rt.y,rt.x,0];return!!ht(e,Q,tt,et,ot)&&(e=[1,0,0,0,1,0,0,0,1],!!ht(e,Q,tt,et,ot)&&(at.crossVectors(nt,it),e=[at.x,at.y,at.z],ht(e,Q,tt,et,ot)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return $.copy(t).clamp(this.min,this.max).sub(t).length()}getBoundingSphere(t){return this.getCenter(t.center),t.radius=.5*this.getSize($).length(),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(J[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),J[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),J[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),J[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),J[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),J[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),J[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),J[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(J)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}Y.prototype.isBox3=!0;const J=[new q,new q,new q,new q,new q,new q,new q,new q],$=new q,K=new Y,Q=new q,tt=new q,et=new q,nt=new q,it=new q,rt=new q,st=new q,ot=new q,at=new q,lt=new q;function ht(t,e,n,i,r){for(let s=0,o=t.length-3;s<=o;s+=3){lt.fromArray(t,s);const o=r.x*Math.abs(lt.x)+r.y*Math.abs(lt.y)+r.z*Math.abs(lt.z),a=e.dot(lt),l=n.dot(lt),h=i.dot(lt);if(Math.max(-Math.max(a,l,h),Math.min(a,l,h))>o)return!1}return!0}const ct=new Y,dt=new q,ut=new q,pt=new q;class mt{constructor(t=new q,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):ct.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;e<r;e++)i=Math.max(i,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){pt.subVectors(t,this.center);const e=pt.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.add(pt.multiplyScalar(n/t)),this.radius+=n}return this}union(t){return!0===this.center.equals(t.center)?ut.set(0,0,1).multiplyScalar(t.radius):ut.subVectors(t.center,this.center).normalize().multiplyScalar(t.radius),this.expandByPoint(dt.copy(t.center).add(ut)),this.expandByPoint(dt.copy(t.center).sub(ut)),this}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const ft=new q,gt=new q,vt=new q,yt=new q,xt=new q,_t=new q,wt=new q;class bt{constructor(t=new q,e=new q(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.direction).multiplyScalar(t).add(this.origin)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,ft)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.direction).multiplyScalar(n).add(this.origin)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=ft.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(ft.copy(this.direction).multiplyScalar(e).add(this.origin),ft.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){gt.copy(t).add(e).multiplyScalar(.5),vt.copy(e).sub(t).normalize(),yt.copy(this.origin).sub(gt);const r=.5*t.distanceTo(e),s=-this.direction.dot(vt),o=yt.dot(this.direction),a=-yt.dot(vt),l=yt.lengthSq(),h=Math.abs(1-s*s);let c,d,u,p;if(h>0)if(c=s*a-o,d=s*o-a,p=r*h,c>=0)if(d>=-p)if(d<=p){const t=1/h;c*=t,d*=t,u=c*(c+s*d+2*o)+d*(s*c+d+2*a)+l}else d=r,c=Math.max(0,-(s*d+o)),u=-c*c+d*(d+2*a)+l;else d=-r,c=Math.max(0,-(s*d+o)),u=-c*c+d*(d+2*a)+l;else d<=-p?(c=Math.max(0,-(-s*r+o)),d=c>0?-r:Math.min(Math.max(-r,-a),r),u=-c*c+d*(d+2*a)+l):d<=p?(c=0,d=Math.min(Math.max(-r,-a),r),u=d*(d+2*a)+l):(c=Math.max(0,-(s*r+o)),d=c>0?r:Math.min(Math.max(-r,-a),r),u=-c*c+d*(d+2*a)+l);else d=s>0?-r:r,c=Math.max(0,-(s*d+o)),u=-c*c+d*(d+2*a)+l;return n&&n.copy(this.direction).multiplyScalar(c).add(this.origin),i&&i.copy(vt).multiplyScalar(d).add(gt),u}intersectSphere(t,e){ft.subVectors(t.center,this.origin);const n=ft.dot(this.direction),i=ft.dot(ft)-n*n,r=t.radius*t.radius;if(i>r)return null;const s=Math.sqrt(r-i),o=n-s,a=n+s;return o<0&&a<0?null:o<0?this.at(a,e):this.at(o,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,s,o,a;const l=1/this.direction.x,h=1/this.direction.y,c=1/this.direction.z,d=this.origin;return l>=0?(n=(t.min.x-d.x)*l,i=(t.max.x-d.x)*l):(n=(t.max.x-d.x)*l,i=(t.min.x-d.x)*l),h>=0?(r=(t.min.y-d.y)*h,s=(t.max.y-d.y)*h):(r=(t.max.y-d.y)*h,s=(t.min.y-d.y)*h),n>s||r>i?null:((r>n||n!=n)&&(n=r),(s<i||i!=i)&&(i=s),c>=0?(o=(t.min.z-d.z)*c,a=(t.max.z-d.z)*c):(o=(t.max.z-d.z)*c,a=(t.min.z-d.z)*c),n>a||o>i?null:((o>n||n!=n)&&(n=o),(a<i||i!=i)&&(i=a),i<0?null:this.at(n>=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,ft)}intersectTriangle(t,e,n,i,r){xt.subVectors(e,t),_t.subVectors(n,t),wt.crossVectors(xt,_t);let s,o=this.direction.dot(wt);if(o>0){if(i)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}yt.subVectors(this.origin,t);const a=s*this.direction.dot(_t.crossVectors(yt,_t));if(a<0)return null;const l=s*this.direction.dot(xt.cross(yt));if(l<0)return null;if(a+l>o)return null;const h=-s*yt.dot(wt);return h<0?null:this.at(h/o,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Mt{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(t,e,n,i,r,s,o,a,l,h,c,d,u,p,m,f){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=o,g[13]=a,g[2]=l,g[6]=h,g[10]=c,g[14]=d,g[3]=u,g[7]=p,g[11]=m,g[15]=f,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 Mt).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/St.setFromMatrixColumn(t,0).length(),r=1/St.setFromMatrixColumn(t,1).length(),s=1/St.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){t&&t.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const e=this.elements,n=t.x,i=t.y,r=t.z,s=Math.cos(n),o=Math.sin(n),a=Math.cos(i),l=Math.sin(i),h=Math.cos(r),c=Math.sin(r);if("XYZ"===t.order){const t=s*h,n=s*c,i=o*h,r=o*c;e[0]=a*h,e[4]=-a*c,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-o*a,e[2]=r-t*l,e[6]=i+n*l,e[10]=s*a}else if("YXZ"===t.order){const t=a*h,n=a*c,i=l*h,r=l*c;e[0]=t+r*o,e[4]=i*o-n,e[8]=s*l,e[1]=s*c,e[5]=s*h,e[9]=-o,e[2]=n*o-i,e[6]=r+t*o,e[10]=s*a}else if("ZXY"===t.order){const t=a*h,n=a*c,i=l*h,r=l*c;e[0]=t-r*o,e[4]=-s*c,e[8]=i+n*o,e[1]=n+i*o,e[5]=s*h,e[9]=r-t*o,e[2]=-s*l,e[6]=o,e[10]=s*a}else if("ZYX"===t.order){const t=s*h,n=s*c,i=o*h,r=o*c;e[0]=a*h,e[4]=i*l-n,e[8]=t*l+r,e[1]=a*c,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=o*a,e[10]=s*a}else if("YZX"===t.order){const t=s*a,n=s*l,i=o*a,r=o*l;e[0]=a*h,e[4]=r-t*c,e[8]=i*c+n,e[1]=c,e[5]=s*h,e[9]=-o*h,e[2]=-l*h,e[6]=n*c+i,e[10]=t-r*c}else if("XZY"===t.order){const t=s*a,n=s*l,i=o*a,r=o*l;e[0]=a*h,e[4]=-c,e[8]=l*h,e[1]=t*c+r,e[5]=s*h,e[9]=n*c-i,e[2]=i*c-n,e[6]=o*h,e[10]=r*c+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Tt,t,At)}lookAt(t,e,n){const i=this.elements;return kt.subVectors(t,e),0===kt.lengthSq()&&(kt.z=1),kt.normalize(),Lt.crossVectors(n,kt),0===Lt.lengthSq()&&(1===Math.abs(n.z)?kt.x+=1e-4:kt.z+=1e-4,kt.normalize(),Lt.crossVectors(n,kt)),Lt.normalize(),Ct.crossVectors(kt,Lt),i[0]=Lt.x,i[4]=Ct.x,i[8]=kt.x,i[1]=Lt.y,i[5]=Ct.y,i[9]=kt.y,i[2]=Lt.z,i[6]=Ct.z,i[10]=kt.z,this}multiply(t,e){return void 0!==e?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(t,e)):this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],o=n[4],a=n[8],l=n[12],h=n[1],c=n[5],d=n[9],u=n[13],p=n[2],m=n[6],f=n[10],g=n[14],v=n[3],y=n[7],x=n[11],_=n[15],w=i[0],b=i[4],M=i[8],S=i[12],E=i[1],T=i[5],A=i[9],L=i[13],C=i[2],k=i[6],R=i[10],P=i[14],D=i[3],I=i[7],N=i[11],B=i[15];return r[0]=s*w+o*E+a*C+l*D,r[4]=s*b+o*T+a*k+l*I,r[8]=s*M+o*A+a*R+l*N,r[12]=s*S+o*L+a*P+l*B,r[1]=h*w+c*E+d*C+u*D,r[5]=h*b+c*T+d*k+u*I,r[9]=h*M+c*A+d*R+u*N,r[13]=h*S+c*L+d*P+u*B,r[2]=p*w+m*E+f*C+g*D,r[6]=p*b+m*T+f*k+g*I,r[10]=p*M+m*A+f*R+g*N,r[14]=p*S+m*L+f*P+g*B,r[3]=v*w+y*E+x*C+_*D,r[7]=v*b+y*T+x*k+_*I,r[11]=v*M+y*A+x*R+_*N,r[15]=v*S+y*L+x*P+_*B,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],s=t[1],o=t[5],a=t[9],l=t[13],h=t[2],c=t[6],d=t[10],u=t[14];return t[3]*(+r*a*c-i*l*c-r*o*d+n*l*d+i*o*u-n*a*u)+t[7]*(+e*a*u-e*l*d+r*s*d-i*s*u+i*l*h-r*a*h)+t[11]*(+e*l*c-e*o*u-r*s*c+n*s*u+r*o*h-n*l*h)+t[15]*(-i*o*h-e*a*c+e*o*d+i*s*c-n*s*d+n*a*h)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],o=t[5],a=t[6],l=t[7],h=t[8],c=t[9],d=t[10],u=t[11],p=t[12],m=t[13],f=t[14],g=t[15],v=c*f*l-m*d*l+m*a*u-o*f*u-c*a*g+o*d*g,y=p*d*l-h*f*l-p*a*u+s*f*u+h*a*g-s*d*g,x=h*m*l-p*c*l+p*o*u-s*m*u-h*o*g+s*c*g,_=p*c*a-h*m*a-p*o*d+s*m*d+h*o*f-s*c*f,w=e*v+n*y+i*x+r*_;if(0===w)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/w;return t[0]=v*b,t[1]=(m*d*r-c*f*r-m*i*u+n*f*u+c*i*g-n*d*g)*b,t[2]=(o*f*r-m*a*r+m*i*l-n*f*l-o*i*g+n*a*g)*b,t[3]=(c*a*r-o*d*r-c*i*l+n*d*l+o*i*u-n*a*u)*b,t[4]=y*b,t[5]=(h*f*r-p*d*r+p*i*u-e*f*u-h*i*g+e*d*g)*b,t[6]=(p*a*r-s*f*r-p*i*l+e*f*l+s*i*g-e*a*g)*b,t[7]=(s*d*r-h*a*r+h*i*l-e*d*l-s*i*u+e*a*u)*b,t[8]=x*b,t[9]=(p*c*r-h*m*r-p*n*u+e*m*u+h*n*g-e*c*g)*b,t[10]=(s*m*r-p*o*r+p*n*l-e*m*l-s*n*g+e*o*g)*b,t[11]=(h*o*r-s*c*r-h*n*l+e*c*l+s*n*u-e*o*u)*b,t[12]=_*b,t[13]=(h*m*i-p*c*i+p*n*d-e*m*d-h*n*f+e*c*f)*b,t[14]=(p*o*i-s*m*i-p*n*a+e*m*a+s*n*f-e*o*f)*b,t[15]=(s*c*i-h*o*i+h*n*a-e*c*a-s*n*d+e*o*d)*b,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,s=t.x,o=t.y,a=t.z,l=r*s,h=r*o;return this.set(l*s+n,l*o-i*a,l*a+i*o,0,l*o+i*a,h*o+n,h*a-i*s,0,l*a-i*o,h*a+i*s,r*a*a+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,s){return this.set(1,n,r,0,t,1,s,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,s=e._y,o=e._z,a=e._w,l=r+r,h=s+s,c=o+o,d=r*l,u=r*h,p=r*c,m=s*h,f=s*c,g=o*c,v=a*l,y=a*h,x=a*c,_=n.x,w=n.y,b=n.z;return i[0]=(1-(m+g))*_,i[1]=(u+x)*_,i[2]=(p-y)*_,i[3]=0,i[4]=(u-x)*w,i[5]=(1-(d+g))*w,i[6]=(f+v)*w,i[7]=0,i[8]=(p+y)*b,i[9]=(f-v)*b,i[10]=(1-(d+m))*b,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=St.set(i[0],i[1],i[2]).length();const s=St.set(i[4],i[5],i[6]).length(),o=St.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],Et.copy(this);const a=1/r,l=1/s,h=1/o;return Et.elements[0]*=a,Et.elements[1]*=a,Et.elements[2]*=a,Et.elements[4]*=l,Et.elements[5]*=l,Et.elements[6]*=l,Et.elements[8]*=h,Et.elements[9]*=h,Et.elements[10]*=h,e.setFromRotationMatrix(Et),n.x=r,n.y=s,n.z=o,this}makePerspective(t,e,n,i,r,s){void 0===s&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const o=this.elements,a=2*r/(e-t),l=2*r/(n-i),h=(e+t)/(e-t),c=(n+i)/(n-i),d=-(s+r)/(s-r),u=-2*s*r/(s-r);return o[0]=a,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=l,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=u,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,n,i,r,s){const o=this.elements,a=1/(e-t),l=1/(n-i),h=1/(s-r),c=(e+t)*a,d=(n+i)*l,u=(s+r)*h;return o[0]=2*a,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=-2*h,o[14]=-u,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}Mt.prototype.isMatrix4=!0;const St=new q,Et=new Mt,Tt=new q(0,0,0),At=new q(1,1,1),Lt=new q,Ct=new q,kt=new q,Rt=new Mt,Pt=new j;class Dt{constructor(t=0,e=0,n=0,i=Dt.DefaultOrder){this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,r=i[0],s=i[4],o=i[8],a=i[1],h=i[5],c=i[9],d=i[2],u=i[6],p=i[10];switch(e){case"XYZ":this._y=Math.asin(l(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,p),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(u,h),this._z=0);break;case"YXZ":this._x=Math.asin(-l(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(a,h)):(this._y=Math.atan2(-d,r),this._z=0);break;case"ZXY":this._x=Math.asin(l(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-s,h)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-l(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(u,p),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-s,h));break;case"YZX":this._z=Math.asin(l(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,h),this._y=Math.atan2(-d,r)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-l(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(u,h),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-c,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Rt.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Rt,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Pt.setFromEuler(this),this.setFromQuaternion(Pt,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}}Dt.prototype.isEuler=!0,Dt.DefaultOrder="XYZ",Dt.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class It{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}isEnabled(t){return 0!=(this.mask&(1<<t|0))}}let Nt=0;const Bt=new q,zt=new j,Ot=new Mt,Ht=new q,Ut=new q,Ft=new q,Gt=new j,Vt=new q(1,0,0),Wt=new q(0,1,0),jt=new q(0,0,1),qt={type:"added"},Zt={type:"removed"};class Xt extends n{constructor(){super(),Object.defineProperty(this,"id",{value:Nt++}),this.uuid=a(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Xt.DefaultUp.clone();const t=new q,e=new Dt,n=new j,i=new q(1,1,1);e._onChange((function(){n.setFromEuler(e,!1)})),n._onChange((function(){e.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Mt},normalMatrix:{value:new g}}),this.matrix=new Mt,this.matrixWorld=new Mt,this.matrixAutoUpdate=Xt.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new It,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return zt.setFromAxisAngle(t,e),this.quaternion.multiply(zt),this}rotateOnWorldAxis(t,e){return zt.setFromAxisAngle(t,e),this.quaternion.premultiply(zt),this}rotateX(t){return this.rotateOnAxis(Vt,t)}rotateY(t){return this.rotateOnAxis(Wt,t)}rotateZ(t){return this.rotateOnAxis(jt,t)}translateOnAxis(t,e){return Bt.copy(t).applyQuaternion(this.quaternion),this.position.add(Bt.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(Vt,t)}translateY(t){return this.translateOnAxis(Wt,t)}translateZ(t){return this.translateOnAxis(jt,t)}localToWorld(t){return t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return t.applyMatrix4(Ot.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Ht.copy(t):Ht.set(t,e,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Ut.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ot.lookAt(Ut,Ht,this.up):Ot.lookAt(Ht,Ut,this.up),this.quaternion.setFromRotationMatrix(Ot),i&&(Ot.extractRotation(i.matrixWorld),zt.setFromRotationMatrix(Ot),this.quaternion.premultiply(zt.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(qt)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Zt)),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(Zt)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),Ot.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Ot.multiply(t.parent.matrixWorld)),t.applyMatrix4(Ot),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ut,t,Ft),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ut,Gt,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){const n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,n=t.length;e<n;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){const e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const i={};function r(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),"{}"!==JSON.stringify(this.userData)&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,i=n.length;e<i;e++){const i=n[e];r(t.shapes,i)}else r(t.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,i=this.material.length;n<i;n++)e.push(r(t.materials,this.material[n]));i.material=e}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(let e=0;e<this.children.length;e++)i.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];i.animations.push(r(t.animations,n))}}if(e){const e=s(t.geometries),i=s(t.materials),r=s(t.textures),o=s(t.images),a=s(t.shapes),l=s(t.skeletons),h=s(t.animations),c=s(t.nodes);e.length>0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),h.length>0&&(n.animations=h),c.length>0&&(n.nodes=c)}return n.object=i,n;function s(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const n=t.children[e];this.add(n.clone())}return this}}Xt.DefaultUp=new q(0,1,0),Xt.DefaultMatrixAutoUpdate=!0,Xt.prototype.isObject3D=!0;const Yt=new q,Jt=new q,$t=new q,Kt=new q,Qt=new q,te=new q,ee=new q,ne=new q,ie=new q,re=new q;class se{constructor(t=new q,e=new q,n=new q){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),Yt.subVectors(t,e),i.cross(Yt);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){Yt.subVectors(i,e),Jt.subVectors(n,e),$t.subVectors(t,e);const s=Yt.dot(Yt),o=Yt.dot(Jt),a=Yt.dot($t),l=Jt.dot(Jt),h=Jt.dot($t),c=s*l-o*o;if(0===c)return r.set(-2,-1,-1);const d=1/c,u=(l*a-o*h)*d,p=(s*h-o*a)*d;return r.set(1-u-p,p,u)}static containsPoint(t,e,n,i){return this.getBarycoord(t,e,n,i,Kt),Kt.x>=0&&Kt.y>=0&&Kt.x+Kt.y<=1}static getUV(t,e,n,i,r,s,o,a){return this.getBarycoord(t,e,n,i,Kt),a.set(0,0),a.addScaledVector(r,Kt.x),a.addScaledVector(s,Kt.y),a.addScaledVector(o,Kt.z),a}static isFrontFacing(t,e,n,i){return Yt.subVectors(n,e),Jt.subVectors(t,e),Yt.cross(Jt).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Yt.subVectors(this.c,this.b),Jt.subVectors(this.a,this.b),.5*Yt.cross(Jt).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return se.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return se.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return se.getUV(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return se.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return se.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let s,o;Qt.subVectors(i,n),te.subVectors(r,n),ne.subVectors(t,n);const a=Qt.dot(ne),l=te.dot(ne);if(a<=0&&l<=0)return e.copy(n);ie.subVectors(t,i);const h=Qt.dot(ie),c=te.dot(ie);if(h>=0&&c<=h)return e.copy(i);const d=a*c-h*l;if(d<=0&&a>=0&&h<=0)return s=a/(a-h),e.copy(n).addScaledVector(Qt,s);re.subVectors(t,r);const u=Qt.dot(re),p=te.dot(re);if(p>=0&&u<=p)return e.copy(r);const m=u*l-a*p;if(m<=0&&l>=0&&p<=0)return o=l/(l-p),e.copy(n).addScaledVector(te,o);const f=h*p-u*c;if(f<=0&&c-h>=0&&u-p>=0)return ee.subVectors(r,i),o=(c-h)/(c-h+(u-p)),e.copy(i).addScaledVector(ee,o);const g=1/(f+m+d);return s=m*g,o=d*g,e.copy(n).addScaledVector(Qt,s).addScaledVector(te,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let oe=0;class ae extends n{constructor(){super(),Object.defineProperty(this,"id",{value:oe++}),this.uuid=a(),this.name="",this.type="Material",this.fog=!0,this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,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.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if("shading"===e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.")}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(n.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=this.flatShading),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.fog=t.fog,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}ae.prototype.isMaterial=!0,ae.fromType=function(){return null};class le extends ae{constructor(t){super(),this.type="MeshBasicMaterial",this.color=new R(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.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}le.prototype.isMeshBasicMaterial=!0;const he=new q,ce=new f;class de{constructor(t,e,n){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=!0===n,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}copyColorsArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),r=new R),e[n++]=r.r,e[n++]=r.g,e[n++]=r.b}return this}copyVector2sArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),r=new f),e[n++]=r.x,e[n++]=r.y}return this}copyVector3sArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),r=new q),e[n++]=r.x,e[n++]=r.y,e[n++]=r.z}return this}copyVector4sArray(t){const e=this.array;let n=0;for(let i=0,r=t.length;i<r;i++){let r=t[i];void 0===r&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),r=new O),e[n++]=r.x,e[n++]=r.y,e[n++]=r.z,e[n++]=r.w}return this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)ce.fromBufferAttribute(this,e),ce.applyMatrix3(t),this.setXY(e,ce.x,ce.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)he.fromBufferAttribute(this,e),he.applyMatrix3(t),this.setXYZ(e,he.x,he.y,he.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)he.fromBufferAttribute(this,e),he.applyMatrix4(t),this.setXYZ(e,he.x,he.y,he.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)he.fromBufferAttribute(this,e),he.applyNormalMatrix(t),this.setXYZ(e,he.x,he.y,he.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)he.fromBufferAttribute(this,e),he.transformDirection(t),this.setXYZ(e,he.x,he.y,he.z);return this}set(t,e=0){return this.array.set(t,e),this}getX(t){return this.array[t*this.itemSize]}setX(t,e){return this.array[t*this.itemSize]=e,this}getY(t){return this.array[t*this.itemSize+1]}setY(t,e){return this.array[t*this.itemSize+1]=e,this}getZ(t){return this.array[t*this.itemSize+2]}setZ(t,e){return this.array[t*this.itemSize+2]=e,this}getW(t){return this.array[t*this.itemSize+3]}setW(t,e){return this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),35044!==this.usage&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}}de.prototype.isBufferAttribute=!0;class ue extends de{constructor(t,e,n){super(new Int8Array(t),e,n)}}class pe extends de{constructor(t,e,n){super(new Uint8Array(t),e,n)}}class me extends de{constructor(t,e,n){super(new Uint8ClampedArray(t),e,n)}}class fe extends de{constructor(t,e,n){super(new Int16Array(t),e,n)}}class ge extends de{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class ve extends de{constructor(t,e,n){super(new Int32Array(t),e,n)}}class ye extends de{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class xe extends de{constructor(t,e,n){super(new Uint16Array(t),e,n)}}xe.prototype.isFloat16BufferAttribute=!0;class _e extends de{constructor(t,e,n){super(new Float32Array(t),e,n)}}class we extends de{constructor(t,e,n){super(new Float64Array(t),e,n)}}let be=0;const Me=new Mt,Se=new Xt,Ee=new q,Te=new Y,Ae=new Y,Le=new q;class Ce extends n{constructor(){super(),Object.defineProperty(this,"id",{value:be++}),this.uuid=a(),this.name="",this.type="BufferGeometry",this.index=null,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(t){return Array.isArray(t)?this.index=new(v(t)?ye:ge)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new g).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Me.makeRotationFromQuaternion(t),this.applyMatrix4(Me),this}rotateX(t){return Me.makeRotationX(t),this.applyMatrix4(Me),this}rotateY(t){return Me.makeRotationY(t),this.applyMatrix4(Me),this}rotateZ(t){return Me.makeRotationZ(t),this.applyMatrix4(Me),this}translate(t,e,n){return Me.makeTranslation(t,e,n),this.applyMatrix4(Me),this}scale(t,e,n){return Me.makeScale(t,e,n),this.applyMatrix4(Me),this}lookAt(t){return Se.lookAt(t),Se.updateMatrix(),this.applyMatrix4(Se.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ee).negate(),this.translate(Ee.x,Ee.y,Ee.z),this}setFromPoints(t){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];e.push(i.x,i.y,i.z||0)}return this.setAttribute("position",new _e(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Y);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new q(-1/0,-1/0,-1/0),new q(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];Te.setFromBufferAttribute(n),this.morphTargetsRelative?(Le.addVectors(this.boundingBox.min,Te.min),this.boundingBox.expandByPoint(Le),Le.addVectors(this.boundingBox.max,Te.max),this.boundingBox.expandByPoint(Le)):(this.boundingBox.expandByPoint(Te.min),this.boundingBox.expandByPoint(Te.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new mt);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new q,1/0);if(t){const n=this.boundingSphere.center;if(Te.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];Ae.setFromBufferAttribute(n),this.morphTargetsRelative?(Le.addVectors(Te.min,Ae.min),Te.expandByPoint(Le),Le.addVectors(Te.max,Ae.max),Te.expandByPoint(Le)):(Te.expandByPoint(Ae.min),Te.expandByPoint(Ae.max))}Te.getCenter(n);let i=0;for(let e=0,r=t.count;e<r;e++)Le.fromBufferAttribute(t,e),i=Math.max(i,n.distanceToSquared(Le));if(e)for(let r=0,s=e.length;r<s;r++){const s=e[r],o=this.morphTargetsRelative;for(let e=0,r=s.count;e<r;e++)Le.fromBufferAttribute(s,e),o&&(Ee.fromBufferAttribute(t,e),Le.add(Ee)),i=Math.max(i,n.distanceToSquared(Le))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.array,i=e.position.array,r=e.normal.array,s=e.uv.array,o=i.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new de(new Float32Array(4*o),4));const a=this.getAttribute("tangent").array,l=[],h=[];for(let t=0;t<o;t++)l[t]=new q,h[t]=new q;const c=new q,d=new q,u=new q,p=new f,m=new f,g=new f,v=new q,y=new q;function x(t,e,n){c.fromArray(i,3*t),d.fromArray(i,3*e),u.fromArray(i,3*n),p.fromArray(s,2*t),m.fromArray(s,2*e),g.fromArray(s,2*n),d.sub(c),u.sub(c),m.sub(p),g.sub(p);const r=1/(m.x*g.y-g.x*m.y);isFinite(r)&&(v.copy(d).multiplyScalar(g.y).addScaledVector(u,-m.y).multiplyScalar(r),y.copy(u).multiplyScalar(m.x).addScaledVector(d,-g.x).multiplyScalar(r),l[t].add(v),l[e].add(v),l[n].add(v),h[t].add(y),h[e].add(y),h[n].add(y))}let _=this.groups;0===_.length&&(_=[{start:0,count:n.length}]);for(let t=0,e=_.length;t<e;++t){const e=_[t],i=e.start;for(let t=i,r=i+e.count;t<r;t+=3)x(n[t+0],n[t+1],n[t+2])}const w=new q,b=new q,M=new q,S=new q;function E(t){M.fromArray(r,3*t),S.copy(M);const e=l[t];w.copy(e),w.sub(M.multiplyScalar(M.dot(e))).normalize(),b.crossVectors(S,e);const n=b.dot(h[t])<0?-1:1;a[4*t]=w.x,a[4*t+1]=w.y,a[4*t+2]=w.z,a[4*t+3]=n}for(let t=0,e=_.length;t<e;++t){const e=_[t],i=e.start;for(let t=i,r=i+e.count;t<r;t+=3)E(n[t+0]),E(n[t+1]),E(n[t+2])}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let n=this.getAttribute("normal");if(void 0===n)n=new de(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const i=new q,r=new q,s=new q,o=new q,a=new q,l=new q,h=new q,c=new q;if(t)for(let d=0,u=t.count;d<u;d+=3){const u=t.getX(d+0),p=t.getX(d+1),m=t.getX(d+2);i.fromBufferAttribute(e,u),r.fromBufferAttribute(e,p),s.fromBufferAttribute(e,m),h.subVectors(s,r),c.subVectors(i,r),h.cross(c),o.fromBufferAttribute(n,u),a.fromBufferAttribute(n,p),l.fromBufferAttribute(n,m),o.add(h),a.add(h),l.add(h),n.setXYZ(u,o.x,o.y,o.z),n.setXYZ(p,a.x,a.y,a.z),n.setXYZ(m,l.x,l.y,l.z)}else for(let t=0,o=e.count;t<o;t+=3)i.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),s.fromBufferAttribute(e,t+2),h.subVectors(s,r),c.subVectors(i,r),h.cross(c),n.setXYZ(t+0,h.x,h.y,h.z),n.setXYZ(t+1,h.x,h.y,h.z),n.setXYZ(t+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}merge(t,e){if(!t||!t.isBufferGeometry)return void console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",t);void 0===e&&(e=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const n=this.attributes;for(const i in n){if(void 0===t.attributes[i])continue;const r=n[i].array,s=t.attributes[i],o=s.array,a=s.itemSize*e,l=Math.min(o.length,r.length-a);for(let t=0,e=a;t<l;t++,e++)r[e]=o[t]}return this}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)Le.fromBufferAttribute(t,e),Le.normalize(),t.setXYZ(e,Le.x,Le.y,Le.z)}toNonIndexed(){function t(t,e){const n=t.array,i=t.itemSize,r=t.normalized,s=new n.constructor(e.length*i);let o=0,a=0;for(let r=0,l=e.length;r<l;r++){o=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*i;for(let t=0;t<i;t++)s[a++]=n[o++]}return new de(s,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Ce,n=this.index.array,i=this.attributes;for(const r in i){const s=t(i[r],n);e.setAttribute(r,s)}const r=this.morphAttributes;for(const i in r){const s=[],o=r[i];for(let e=0,i=o.length;e<i;e++){const i=t(o[e],n);s.push(i)}e.morphAttributes[i]=s}e.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let t=0,n=s.length;t<n;t++){const n=s[t];e.addGroup(n.start,n.count,n.materialIndex)}return e}toJSON(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const e in n){const i=n[e];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],s=[];for(let e=0,i=n.length;e<i;e++){const i=n[e];s.push(i.toJSON(t.data))}s.length>0&&(i[e]=s,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const i=t.attributes;for(const t in i){const n=i[t];this.setAttribute(t,n.clone(e))}const r=t.morphAttributes;for(const t in r){const n=[],i=r[t];for(let t=0,r=i.length;t<r;t++)n.push(i[t].clone(e));this.morphAttributes[t]=n}this.morphTargetsRelative=t.morphTargetsRelative;const s=t.groups;for(let t=0,e=s.length;t<e;t++){const e=s[t];this.addGroup(e.start,e.count,e.materialIndex)}const o=t.boundingBox;null!==o&&(this.boundingBox=o.clone());const a=t.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,void 0!==t.parameters&&(this.parameters=Object.assign({},t.parameters)),this}dispose(){this.dispatchEvent({type:"dispose"})}}Ce.prototype.isBufferGeometry=!0;const ke=new Mt,Re=new bt,Pe=new mt,De=new q,Ie=new q,Ne=new q,Be=new q,ze=new q,Oe=new q,He=new q,Ue=new q,Fe=new q,Ge=new f,Ve=new f,We=new f,je=new q,qe=new q;class Ze extends Xt{constructor(t=new Ce,e=new le){super(),this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0===i)return;if(null===n.boundingSphere&&n.computeBoundingSphere(),Pe.copy(n.boundingSphere),Pe.applyMatrix4(r),!1===t.ray.intersectsSphere(Pe))return;if(ke.copy(r).invert(),Re.copy(t.ray).applyMatrix4(ke),null!==n.boundingBox&&!1===Re.intersectsBox(n.boundingBox))return;let s;if(n.isBufferGeometry){const r=n.index,o=n.attributes.position,a=n.morphAttributes.position,l=n.morphTargetsRelative,h=n.attributes.uv,c=n.attributes.uv2,d=n.groups,u=n.drawRange;if(null!==r)if(Array.isArray(i))for(let n=0,p=d.length;n<p;n++){const p=d[n],m=i[p.materialIndex];for(let n=Math.max(p.start,u.start),i=Math.min(r.count,Math.min(p.start+p.count,u.start+u.count));n<i;n+=3){const i=r.getX(n),d=r.getX(n+1),u=r.getX(n+2);s=Xe(this,m,t,Re,o,a,l,h,c,i,d,u),s&&(s.faceIndex=Math.floor(n/3),s.face.materialIndex=p.materialIndex,e.push(s))}}else{for(let n=Math.max(0,u.start),d=Math.min(r.count,u.start+u.count);n<d;n+=3){const d=r.getX(n),u=r.getX(n+1),p=r.getX(n+2);s=Xe(this,i,t,Re,o,a,l,h,c,d,u,p),s&&(s.faceIndex=Math.floor(n/3),e.push(s))}}else if(void 0!==o)if(Array.isArray(i))for(let n=0,r=d.length;n<r;n++){const r=d[n],p=i[r.materialIndex];for(let n=Math.max(r.start,u.start),i=Math.min(o.count,Math.min(r.start+r.count,u.start+u.count));n<i;n+=3){s=Xe(this,p,t,Re,o,a,l,h,c,n,n+1,n+2),s&&(s.faceIndex=Math.floor(n/3),s.face.materialIndex=r.materialIndex,e.push(s))}}else{for(let n=Math.max(0,u.start),r=Math.min(o.count,u.start+u.count);n<r;n+=3){s=Xe(this,i,t,Re,o,a,l,h,c,n,n+1,n+2),s&&(s.faceIndex=Math.floor(n/3),e.push(s))}}}else n.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}function Xe(t,e,n,i,r,s,o,a,l,h,c,d){De.fromBufferAttribute(r,h),Ie.fromBufferAttribute(r,c),Ne.fromBufferAttribute(r,d);const u=t.morphTargetInfluences;if(s&&u){He.set(0,0,0),Ue.set(0,0,0),Fe.set(0,0,0);for(let t=0,e=s.length;t<e;t++){const e=u[t],n=s[t];0!==e&&(Be.fromBufferAttribute(n,h),ze.fromBufferAttribute(n,c),Oe.fromBufferAttribute(n,d),o?(He.addScaledVector(Be,e),Ue.addScaledVector(ze,e),Fe.addScaledVector(Oe,e)):(He.addScaledVector(Be.sub(De),e),Ue.addScaledVector(ze.sub(Ie),e),Fe.addScaledVector(Oe.sub(Ne),e)))}De.add(He),Ie.add(Ue),Ne.add(Fe)}t.isSkinnedMesh&&(t.boneTransform(h,De),t.boneTransform(c,Ie),t.boneTransform(d,Ne));const p=function(t,e,n,i,r,s,o,a){let l;if(l=1===e.side?i.intersectTriangle(o,s,r,!0,a):i.intersectTriangle(r,s,o,2!==e.side,a),null===l)return null;qe.copy(a),qe.applyMatrix4(t.matrixWorld);const h=n.ray.origin.distanceTo(qe);return h<n.near||h>n.far?null:{distance:h,point:qe.clone(),object:t}}(t,e,n,i,De,Ie,Ne,je);if(p){a&&(Ge.fromBufferAttribute(a,h),Ve.fromBufferAttribute(a,c),We.fromBufferAttribute(a,d),p.uv=se.getUV(je,De,Ie,Ne,Ge,Ve,We,new f)),l&&(Ge.fromBufferAttribute(l,h),Ve.fromBufferAttribute(l,c),We.fromBufferAttribute(l,d),p.uv2=se.getUV(je,De,Ie,Ne,Ge,Ve,We,new f));const t={a:h,b:c,c:d,normal:new q,materialIndex:0};se.getNormal(De,Ie,Ne,t.normal),p.face=t}return p}Ze.prototype.isMesh=!0;class Ye extends Ce{constructor(t=1,e=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const o=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const a=[],l=[],h=[],c=[];let d=0,u=0;function p(t,e,n,i,r,s,p,m,f,g,v){const y=s/f,x=p/g,_=s/2,w=p/2,b=m/2,M=f+1,S=g+1;let E=0,T=0;const A=new q;for(let s=0;s<S;s++){const o=s*x-w;for(let a=0;a<M;a++){const d=a*y-_;A[t]=d*i,A[e]=o*r,A[n]=b,l.push(A.x,A.y,A.z),A[t]=0,A[e]=0,A[n]=m>0?1:-1,h.push(A.x,A.y,A.z),c.push(a/f),c.push(1-s/g),E+=1}}for(let t=0;t<g;t++)for(let e=0;e<f;e++){const n=d+e+M*t,i=d+e+M*(t+1),r=d+(e+1)+M*(t+1),s=d+(e+1)+M*t;a.push(n,i,s),a.push(i,r,s),T+=6}o.addGroup(u,T,v),u+=T,d+=E}p("z","y","x",-1,-1,n,e,t,s,r,0),p("z","y","x",1,-1,n,e,-t,s,r,1),p("x","z","y",1,1,t,n,e,i,s,2),p("x","z","y",1,-1,t,n,-e,i,s,3),p("x","y","z",1,-1,t,e,n,i,r,4),p("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(a),this.setAttribute("position",new _e(l,3)),this.setAttribute("normal",new _e(h,3)),this.setAttribute("uv",new _e(c,2))}static fromJSON(t){return new Ye(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Je(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function $e(t){const e={};for(let n=0;n<t.length;n++){const i=Je(t[n]);for(const t in i)e[t]=i[t]}return e}const Ke={clone:Je,merge:$e};class Qe extends ae{constructor(t){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&(void 0!==t.attributes&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(t))}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Je(t.uniforms),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?e.uniforms[n]={type:"t",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?e.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?e.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?e.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[n]={type:"m4",value:i.toArray()}:e.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}Qe.prototype.isShaderMaterial=!0;class tn extends Xt{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new Mt,this.projectionMatrix=new Mt,this.projectionMatrixInverse=new Mt}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}tn.prototype.isCamera=!0;class en extends tn{constructor(t=50,e=1,n=.1,i=2e3){super(),this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*o*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*s*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*o*Math.atan(Math.tan(.5*s*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,n,i,r,s){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*s*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const o=this.view;if(null!==this.view&&this.view.enabled){const t=o.fullWidth,s=o.fullHeight;r+=o.offsetX*i/t,e-=o.offsetY*n/s,i*=o.width/t,n*=o.height/s}const a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}en.prototype.isPerspectiveCamera=!0;class nn extends Xt{constructor(t,e,n){if(super(),this.type="CubeCamera",!0!==n.isWebGLCubeRenderTarget)return void console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");this.renderTarget=n;const i=new en(90,1,t,e);i.layers=this.layers,i.up.set(0,-1,0),i.lookAt(new q(1,0,0)),this.add(i);const r=new en(90,1,t,e);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new q(-1,0,0)),this.add(r);const s=new en(90,1,t,e);s.layers=this.layers,s.up.set(0,0,1),s.lookAt(new q(0,1,0)),this.add(s);const o=new en(90,1,t,e);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(new q(0,-1,0)),this.add(o);const a=new en(90,1,t,e);a.layers=this.layers,a.up.set(0,-1,0),a.lookAt(new q(0,0,1)),this.add(a);const l=new en(90,1,t,e);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new q(0,0,-1)),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,[i,r,s,o,a,l]=this.children,h=t.getRenderTarget(),c=t.outputEncoding,d=t.toneMapping,u=t.xr.enabled;t.outputEncoding=3e3,t.toneMapping=0,t.xr.enabled=!1;const p=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0),t.render(e,i),t.setRenderTarget(n,1),t.render(e,r),t.setRenderTarget(n,2),t.render(e,s),t.setRenderTarget(n,3),t.render(e,o),t.setRenderTarget(n,4),t.render(e,a),n.texture.generateMipmaps=p,t.setRenderTarget(n,5),t.render(e,l),t.setRenderTarget(h),t.outputEncoding=c,t.toneMapping=d,t.xr.enabled=u,n.texture.needsPMREMUpdate=!0}}class rn extends z{constructor(t,e,n,i,r,s,o,a,l,h){super(t=void 0!==t?t:[],e=void 0!==e?e:301,n,i,r,s,o,a,l,h),this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}rn.prototype.isCubeTexture=!0;class sn extends H{constructor(t,e={}){super(t,t,e);const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new rn(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:1006}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new Ye(5,5,5),r=new Qe({name:"CubemapFromEquirect",uniforms:Je(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const s=new Ze(i,r),o=e.minFilter;1008===e.minFilter&&(e.minFilter=1006);return new nn(1,10,this).update(t,s),e.minFilter=o,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,n,i){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,n,i);t.setRenderTarget(r)}}sn.prototype.isWebGLCubeRenderTarget=!0;const on=new q,an=new q,ln=new g;class hn{constructor(t=new q(1,0,0),e=0){this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=on.subVectors(n,e).cross(an.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(this.normal).multiplyScalar(-this.distanceToPoint(t)).add(t)}intersectLine(t,e){const n=t.delta(on),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(n).multiplyScalar(r).add(t.start)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||ln.getNormalMatrix(t),i=this.coplanarPoint(on).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}hn.prototype.isPlane=!0;const cn=new mt,dn=new q;class un{constructor(t=new hn,e=new hn,n=new hn,i=new hn,r=new hn,s=new hn){this.planes=[t,e,n,i,r,s]}set(t,e,n,i,r,s){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(s),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t){const e=this.planes,n=t.elements,i=n[0],r=n[1],s=n[2],o=n[3],a=n[4],l=n[5],h=n[6],c=n[7],d=n[8],u=n[9],p=n[10],m=n[11],f=n[12],g=n[13],v=n[14],y=n[15];return e[0].setComponents(o-i,c-a,m-d,y-f).normalize(),e[1].setComponents(o+i,c+a,m+d,y+f).normalize(),e[2].setComponents(o+r,c+l,m+u,y+g).normalize(),e[3].setComponents(o-r,c-l,m-u,y-g).normalize(),e[4].setComponents(o-s,c-h,m-p,y-v).normalize(),e[5].setComponents(o+s,c+h,m+p,y+v).normalize(),this}intersectsObject(t){const e=t.geometry;return null===e.boundingSphere&&e.computeBoundingSphere(),cn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld),this.intersectsSphere(cn)}intersectsSprite(t){return cn.center.set(0,0,0),cn.radius=.7071067811865476,cn.applyMatrix4(t.matrixWorld),this.intersectsSphere(cn)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(n)<i)return!1}return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const i=e[n];if(dn.x=i.normal.x>0?t.max.x:t.min.x,dn.y=i.normal.y>0?t.max.y:t.min.y,dn.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(dn)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function pn(){let t=null,e=!1,n=null,i=null;function r(e,s){n(e,s),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function mn(t,e){const n=e.isWebGL2,i=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=i.get(e);n&&(t.deleteBuffer(n.buffer),i.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=i.get(e);return void((!t||t.version<e.version)&&i.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const s=i.get(e);void 0===s?i.set(e,function(e,i){const r=e.array,s=e.usage,o=t.createBuffer();let a;if(t.bindBuffer(i,o),t.bufferData(i,r,s),e.onUploadCallback(),r instanceof Float32Array)a=5126;else if(r instanceof Uint16Array)if(e.isFloat16BufferAttribute){if(!n)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");a=5131}else a=5123;else if(r instanceof Int16Array)a=5122;else if(r instanceof Uint32Array)a=5125;else if(r instanceof Int32Array)a=5124;else if(r instanceof Int8Array)a=5120;else if(r instanceof Uint8Array)a=5121;else{if(!(r instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);a=5121}return{buffer:o,type:a,bytesPerElement:r.BYTES_PER_ELEMENT,version:e.version}}(e,r)):s.version<e.version&&(!function(e,i,r){const s=i.array,o=i.updateRange;t.bindBuffer(r,e),-1===o.count?t.bufferSubData(r,0,s):(n?t.bufferSubData(r,o.offset*s.BYTES_PER_ELEMENT,s,o.offset,o.count):t.bufferSubData(r,o.offset*s.BYTES_PER_ELEMENT,s.subarray(o.offset,o.offset+o.count)),o.count=-1)}(s.buffer,e,r),s.version=e.version)}}}class fn extends Ce{constructor(t=1,e=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};const r=t/2,s=e/2,o=Math.floor(n),a=Math.floor(i),l=o+1,h=a+1,c=t/o,d=e/a,u=[],p=[],m=[],f=[];for(let t=0;t<h;t++){const e=t*d-s;for(let n=0;n<l;n++){const i=n*c-r;p.push(i,-e,0),m.push(0,0,1),f.push(n/o),f.push(1-t/a)}}for(let t=0;t<a;t++)for(let e=0;e<o;e++){const n=e+l*t,i=e+l*(t+1),r=e+1+l*(t+1),s=e+1+l*t;u.push(n,i,s),u.push(i,r,s)}this.setIndex(u),this.setAttribute("position",new _e(p,3)),this.setAttribute("normal",new _e(m,3)),this.setAttribute("uv",new _e(f,2))}static fromJSON(t){return new fn(t.width,t.height,t.widthSegments,t.heightSegments)}}const gn={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 1.0 ) + 0.5;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\t#ifdef USE_TANGENT\n\t\tclearcoatNormal = normalize( vTBN * clearcoatMapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );\n\t#endif\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n\tuniform mat3 uv2Transform;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tgl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n\t#endif\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}"},vn={common:{diffuse:{value:new R(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new g},uv2Transform:{value:new g},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new f(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new R(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new R(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new g}},sprite:{diffuse:{value:new R(16777215)},opacity:{value:1},center:{value:new f(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new g}}},yn={basic:{uniforms:$e([vn.common,vn.specularmap,vn.envmap,vn.aomap,vn.lightmap,vn.fog]),vertexShader:gn.meshbasic_vert,fragmentShader:gn.meshbasic_frag},lambert:{uniforms:$e([vn.common,vn.specularmap,vn.envmap,vn.aomap,vn.lightmap,vn.emissivemap,vn.fog,vn.lights,{emissive:{value:new R(0)}}]),vertexShader:gn.meshlambert_vert,fragmentShader:gn.meshlambert_frag},phong:{uniforms:$e([vn.common,vn.specularmap,vn.envmap,vn.aomap,vn.lightmap,vn.emissivemap,vn.bumpmap,vn.normalmap,vn.displacementmap,vn.fog,vn.lights,{emissive:{value:new R(0)},specular:{value:new R(1118481)},shininess:{value:30}}]),vertexShader:gn.meshphong_vert,fragmentShader:gn.meshphong_frag},standard:{uniforms:$e([vn.common,vn.envmap,vn.aomap,vn.lightmap,vn.emissivemap,vn.bumpmap,vn.normalmap,vn.displacementmap,vn.roughnessmap,vn.metalnessmap,vn.fog,vn.lights,{emissive:{value:new R(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:gn.meshphysical_vert,fragmentShader:gn.meshphysical_frag},toon:{uniforms:$e([vn.common,vn.aomap,vn.lightmap,vn.emissivemap,vn.bumpmap,vn.normalmap,vn.displacementmap,vn.gradientmap,vn.fog,vn.lights,{emissive:{value:new R(0)}}]),vertexShader:gn.meshtoon_vert,fragmentShader:gn.meshtoon_frag},matcap:{uniforms:$e([vn.common,vn.bumpmap,vn.normalmap,vn.displacementmap,vn.fog,{matcap:{value:null}}]),vertexShader:gn.meshmatcap_vert,fragmentShader:gn.meshmatcap_frag},points:{uniforms:$e([vn.points,vn.fog]),vertexShader:gn.points_vert,fragmentShader:gn.points_frag},dashed:{uniforms:$e([vn.common,vn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:gn.linedashed_vert,fragmentShader:gn.linedashed_frag},depth:{uniforms:$e([vn.common,vn.displacementmap]),vertexShader:gn.depth_vert,fragmentShader:gn.depth_frag},normal:{uniforms:$e([vn.common,vn.bumpmap,vn.normalmap,vn.displacementmap,{opacity:{value:1}}]),vertexShader:gn.meshnormal_vert,fragmentShader:gn.meshnormal_frag},sprite:{uniforms:$e([vn.sprite,vn.fog]),vertexShader:gn.sprite_vert,fragmentShader:gn.sprite_frag},background:{uniforms:{uvTransform:{value:new g},t2D:{value:null}},vertexShader:gn.background_vert,fragmentShader:gn.background_frag},cube:{uniforms:$e([vn.envmap,{opacity:{value:1}}]),vertexShader:gn.cube_vert,fragmentShader:gn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:gn.equirect_vert,fragmentShader:gn.equirect_frag},distanceRGBA:{uniforms:$e([vn.common,vn.displacementmap,{referencePosition:{value:new q},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:gn.distanceRGBA_vert,fragmentShader:gn.distanceRGBA_frag},shadow:{uniforms:$e([vn.lights,vn.fog,{color:{value:new R(0)},opacity:{value:1}}]),vertexShader:gn.shadow_vert,fragmentShader:gn.shadow_frag}};function xn(t,e,n,i,r,s){const o=new R(0);let a,l,h=!0===r?0:1,c=null,d=0,u=null;function p(t,e){n.buffers.color.setClear(t.r,t.g,t.b,e,s)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),h=e,p(o,h)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,p(o,h)},render:function(n,r){let s=!1,m=!0===r.isScene?r.background:null;m&&m.isTexture&&(m=e.get(m));const f=t.xr,g=f.getSession&&f.getSession();g&&"additive"===g.environmentBlendMode&&(m=null),null===m?p(o,h):m&&m.isColor&&(p(m,1),s=!0),(t.autoClear||s)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),m&&(m.isCubeTexture||306===m.mapping)?(void 0===l&&(l=new Ze(new Ye(1,1,1),new Qe({name:"BackgroundCubeMaterial",uniforms:Je(yn.cube.uniforms),vertexShader:yn.cube.vertexShader,fragmentShader:yn.cube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l)),l.material.uniforms.envMap.value=m,l.material.uniforms.flipEnvMap.value=m.isCubeTexture&&!1===m.isRenderTargetTexture?-1:1,c===m&&d===m.version&&u===t.toneMapping||(l.material.needsUpdate=!0,c=m,d=m.version,u=t.toneMapping),n.unshift(l,l.geometry,l.material,0,0,null)):m&&m.isTexture&&(void 0===a&&(a=new Ze(new fn(2,2),new Qe({name:"BackgroundMaterial",uniforms:Je(yn.background.uniforms),vertexShader:yn.background.vertexShader,fragmentShader:yn.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(a)),a.material.uniforms.t2D.value=m,!0===m.matrixAutoUpdate&&m.updateMatrix(),a.material.uniforms.uvTransform.value.copy(m.matrix),c===m&&d===m.version&&u===t.toneMapping||(a.material.needsUpdate=!0,c=m,d=m.version,u=t.toneMapping),n.unshift(a,a.geometry,a.material,0,0,null))}}}function _n(t,e,n,i){const r=t.getParameter(34921),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||null!==s,a={},l=p(null);let h=l,c=!1;function d(e){return i.isWebGL2?t.bindVertexArray(e):s.bindVertexArrayOES(e)}function u(e){return i.isWebGL2?t.deleteVertexArray(e):s.deleteVertexArrayOES(e)}function p(t){const e=[],n=[],i=[];for(let t=0;t<r;t++)e[t]=0,n[t]=0,i[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:i,object:t,attributes:{},index:null}}function m(){const t=h.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function f(t){g(t,0)}function g(n,r){const s=h.newAttributes,o=h.enabledAttributes,a=h.attributeDivisors;if(s[n]=1,0===o[n]&&(t.enableVertexAttribArray(n),o[n]=1),a[n]!==r){(i.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](n,r),a[n]=r}}function v(){const e=h.newAttributes,n=h.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==e[i]&&(t.disableVertexAttribArray(i),n[i]=0)}function y(e,n,r,s,o,a){!0!==i.isWebGL2||5124!==r&&5125!==r?t.vertexAttribPointer(e,n,r,s,o,a):t.vertexAttribIPointer(e,n,r,o,a)}function x(){_(),c=!0,h!==l&&(h=l,d(h.object))}function _(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(r,l,u,x,_){let w=!1;if(o){const e=function(e,n,r){const o=!0===r.wireframe;let l=a[e.id];void 0===l&&(l={},a[e.id]=l);let h=l[n.id];void 0===h&&(h={},l[n.id]=h);let c=h[o];void 0===c&&(c=p(i.isWebGL2?t.createVertexArray():s.createVertexArrayOES()),h[o]=c);return c}(x,u,l);h!==e&&(h=e,d(h.object)),w=function(t,e){const n=h.attributes,i=t.attributes;let r=0;for(const t in i){const e=n[t],s=i[t];if(void 0===e)return!0;if(e.attribute!==s)return!0;if(e.data!==s.data)return!0;r++}return h.attributesNum!==r||h.index!==e}(x,_),w&&function(t,e){const n={},i=t.attributes;let r=0;for(const t in i){const e=i[t],s={};s.attribute=e,e.data&&(s.data=e.data),n[t]=s,r++}h.attributes=n,h.attributesNum=r,h.index=e}(x,_)}else{const t=!0===l.wireframe;h.geometry===x.id&&h.program===u.id&&h.wireframe===t||(h.geometry=x.id,h.program=u.id,h.wireframe=t,w=!0)}!0===r.isInstancedMesh&&(w=!0),null!==_&&n.update(_,34963),(w||c)&&(c=!1,function(r,s,o,a){if(!1===i.isWebGL2&&(r.isInstancedMesh||a.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;m();const l=a.attributes,h=o.getAttributes(),c=s.defaultAttributeValues;for(const e in h){const i=h[e];if(i.location>=0){let s=l[e];if(void 0===s&&("instanceMatrix"===e&&r.instanceMatrix&&(s=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(s=r.instanceColor)),void 0!==s){const e=s.normalized,o=s.itemSize,l=n.get(s);if(void 0===l)continue;const h=l.buffer,c=l.type,d=l.bytesPerElement;if(s.isInterleavedBufferAttribute){const n=s.data,l=n.stride,u=s.offset;if(n.isInstancedInterleavedBuffer){for(let t=0;t<i.locationSize;t++)g(i.location+t,n.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=n.meshPerAttribute*n.count)}else for(let t=0;t<i.locationSize;t++)f(i.location+t);t.bindBuffer(34962,h);for(let t=0;t<i.locationSize;t++)y(i.location+t,o/i.locationSize,c,e,l*d,(u+o/i.locationSize*t)*d)}else{if(s.isInstancedBufferAttribute){for(let t=0;t<i.locationSize;t++)g(i.location+t,s.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=s.meshPerAttribute*s.count)}else for(let t=0;t<i.locationSize;t++)f(i.location+t);t.bindBuffer(34962,h);for(let t=0;t<i.locationSize;t++)y(i.location+t,o/i.locationSize,c,e,o*d,o/i.locationSize*t*d)}}else if(void 0!==c){const n=c[e];if(void 0!==n)switch(n.length){case 2:t.vertexAttrib2fv(i.location,n);break;case 3:t.vertexAttrib3fv(i.location,n);break;case 4:t.vertexAttrib4fv(i.location,n);break;default:t.vertexAttrib1fv(i.location,n)}}}}v()}(r,l,u,x),null!==_&&t.bindBuffer(34963,n.get(_).buffer))},reset:x,resetDefaultState:_,dispose:function(){x();for(const t in a){const e=a[t];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete a[t]}},releaseStatesOfGeometry:function(t){if(void 0===a[t.id])return;const e=a[t.id];for(const t in e){const n=e[t];for(const t in n)u(n[t].object),delete n[t];delete e[t]}delete a[t.id]},releaseStatesOfProgram:function(t){for(const e in a){const n=a[e];if(void 0===n[t.id])continue;const i=n[t.id];for(const t in i)u(i[t].object),delete i[t];delete n[t.id]}},initAttributes:m,enableAttribute:f,disableUnusedAttributes:v}}function wn(t,e,n,i){const r=i.isWebGL2;let s;this.setMode=function(t){s=t},this.render=function(e,i){t.drawArrays(s,e,i),n.update(i,s,1)},this.renderInstances=function(i,o,a){if(0===a)return;let l,h;if(r)l=t,h="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),h="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[h](s,i,o,a),n.update(o,s,a)}}function bn(t,e,n){let i;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&t instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&t instanceof WebGL2ComputeRenderingContext;let o=void 0!==n.precision?n.precision:"highp";const a=r(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=s||e.has("WEBGL_draw_buffers"),h=!0===n.logarithmicDepthBuffer,c=t.getParameter(34930),d=t.getParameter(35660),u=t.getParameter(3379),p=t.getParameter(34076),m=t.getParameter(34921),f=t.getParameter(36347),g=t.getParameter(36348),v=t.getParameter(36349),y=d>0,x=s||e.has("OES_texture_float");return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:h,maxTextures:c,maxVertexTextures:d,maxTextureSize:u,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:f,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:y&&x,maxSamples:s?t.getParameter(36183):0}}function Mn(t){const e=this;let n=null,i=0,r=!1,s=!1;const o=new hn,a=new g,l={value:null,needsUpdate:!1};function h(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function c(t,n,i,r){const s=null!==t?t.length:0;let h=null;if(0!==s){if(h=l.value,!0!==r||null===h){const e=i+4*s,r=n.matrixWorldInverse;a.getNormalMatrix(r),(null===h||h.length<e)&&(h=new Float32Array(e));for(let e=0,n=i;e!==s;++e,n+=4)o.copy(t[e]).applyMatrix4(r,a),o.normal.toArray(h,n),h[n+3]=o.constant}l.value=h,l.needsUpdate=!0}return e.numPlanes=s,e.numIntersection=0,h}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e,s){const o=0!==t.length||e||0!==i||r;return r=e,n=c(t,s,0),i=t.length,o},this.beginShadows=function(){s=!0,c(null)},this.endShadows=function(){s=!1,h()},this.setState=function(e,o,a){const d=e.clippingPlanes,u=e.clipIntersection,p=e.clipShadows,m=t.get(e);if(!r||null===d||0===d.length||s&&!p)s?c(null):h();else{const t=s?0:i,e=4*t;let r=m.clippingState||null;l.value=r,r=c(d,o,e,a);for(let t=0;t!==e;++t)r[t]=n[t];m.clippingState=r,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=t}}}function Sn(t){let e=new WeakMap;function n(t,e){return 303===e?t.mapping=301:304===e&&(t.mapping=302),t}function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture&&!1===r.isRenderTargetTexture){const s=r.mapping;if(303===s||304===s){if(e.has(r)){return n(e.get(r).texture,r.mapping)}{const s=r.image;if(s&&s.height>0){const o=new sn(s.height/2);return o.fromEquirectangularTexture(t,r),e.set(r,o),r.addEventListener("dispose",i),n(o.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}yn.physical={uniforms:$e([yn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new f(1,1)},clearcoatNormalMap:{value:null},sheen:{value:0},sheenColor:{value:new R(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new f},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new R(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new R(1,1,1)},specularColorMap:{value:null}}]),vertexShader:gn.meshphysical_vert,fragmentShader:gn.meshphysical_frag};class En extends tn{constructor(t=-1,e=1,n=1,i=-1,r=.1,s=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,s=n+t,o=i+e,a=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,o-=e*this.view.offsetY,a=o-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}En.prototype.isOrthographicCamera=!0;const Tn=[.125,.215,.35,.446,.526,.582],An=new En,Ln=new R;let Cn=null;const kn=(1+Math.sqrt(5))/2,Rn=1/kn,Pn=[new q(1,1,1),new q(-1,1,1),new q(1,1,-1),new q(-1,1,-1),new q(0,kn,Rn),new q(0,kn,-Rn),new q(Rn,0,kn),new q(-Rn,0,kn),new q(kn,Rn,0),new q(-kn,Rn,0)];class Dn{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){Cn=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=zn(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Bn(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(Cn),t.scissorTest=!1,Nn(t,0,0,t.width,t.height)}_fromTexture(t,e){301===t.mapping||302===t.mapping?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),Cn=this._renderer.getRenderTarget();const n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize-32,n={magFilter:1006,minFilter:1006,generateMipmaps:!1,type:1016,format:1023,encoding:3e3,depthBuffer:!1},i=In(t,e,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=In(t,e,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){const e=[],n=[],i=[];let r=t;const s=t-4+1+Tn.length;for(let o=0;o<s;o++){const s=Math.pow(2,r);n.push(s);let a=1/s;o>t-4?a=Tn[o-t+4-1]:0===o&&(a=0),i.push(a);const l=1/(s-1),h=-l/2,c=1+l/2,d=[h,h,c,h,c,c,h,h,c,c,h,c],u=6,p=6,m=3,f=2,g=1,v=new Float32Array(m*p*u),y=new Float32Array(f*p*u),x=new Float32Array(g*p*u);for(let t=0;t<u;t++){const e=t%3*2/3-1,n=t>2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];v.set(i,m*p*t),y.set(d,f*p*t);const r=[t,t,t,t,t,t];x.set(r,g*p*t)}const _=new Ce;_.setAttribute("position",new de(v,m)),_.setAttribute("uv",new de(y,f)),_.setAttribute("faceIndex",new de(x,g)),e.push(_),r>4&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(t,e,n){const i=new Float32Array(20),r=new q(0,1,0);return new Qe({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:On(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}(i,t,e)}return i}_compileMaterial(t){const e=new Ze(this._lodPlanes[0],t);this._renderer.compile(e,An)}_sceneToCubeUV(t,e,n,i){const r=new en(90,1,e,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],a=this._renderer,l=a.autoClear,h=a.toneMapping;a.getClearColor(Ln),a.toneMapping=0,a.autoClear=!1;const c=new le({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),d=new Ze(new Ye,c);let u=!1;const p=t.background;p?p.isColor&&(c.color.copy(p),t.background=null,u=!0):(c.color.copy(Ln),u=!0);for(let e=0;e<6;e++){const n=e%3;0===n?(r.up.set(0,s[e],0),r.lookAt(o[e],0,0)):1===n?(r.up.set(0,0,s[e]),r.lookAt(0,o[e],0)):(r.up.set(0,s[e],0),r.lookAt(0,0,o[e]));const l=this._cubeSize;Nn(i,n*l,e>2?l:0,l,l),a.setRenderTarget(i),u&&a.render(d,r),a.render(t,r)}d.geometry.dispose(),d.material.dispose(),a.toneMapping=h,a.autoClear=l,t.background=p}_textureToCubeUV(t,e){const n=this._renderer,i=301===t.mapping||302===t.mapping;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=zn()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Bn());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new Ze(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const o=this._cubeSize;Nn(e,0,0,3*o,2*o),n.setRenderTarget(e),n.render(s,An)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let e=1;e<this._lodPlanes.length;e++){const n=Math.sqrt(this._sigmas[e]*this._sigmas[e]-this._sigmas[e-1]*this._sigmas[e-1]),i=Pn[(e-1)%Pn.length];this._blur(t,e-1,e,n,i)}e.autoClear=n}_blur(t,e,n,i,r){const s=this._pingPongRenderTarget;this._halfBlur(t,s,e,n,i,"latitudinal",r),this._halfBlur(s,t,n,n,i,"longitudinal",r)}_halfBlur(t,e,n,i,r,s,o){const a=this._renderer,l=this._blurMaterial;"latitudinal"!==s&&"longitudinal"!==s&&console.error("blur direction must be either latitudinal or longitudinal!");const h=new Ze(this._lodPlanes[i],l),c=l.uniforms,d=this._sizeLods[n]-1,u=isFinite(r)?Math.PI/(2*d):2*Math.PI/39,p=r/u,m=isFinite(r)?1+Math.floor(3*p):20;m>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const f=[];let g=0;for(let t=0;t<20;++t){const e=t/p,n=Math.exp(-e*e/2);f.push(n),0===t?g+=n:t<m&&(g+=2*n)}for(let t=0;t<f.length;t++)f[t]=f[t]/g;c.envMap.value=t.texture,c.samples.value=m,c.weights.value=f,c.latitudinal.value="latitudinal"===s,o&&(c.poleAxis.value=o);const{_lodMax:v}=this;c.dTheta.value=u,c.mipInt.value=v-n;const y=this._sizeLods[i];Nn(e,3*y*(i>v-4?i-v+4:0),4*(this._cubeSize-y),3*y,2*y),a.setRenderTarget(e),a.render(h,An)}}function In(t,e,n){const i=new H(t,e,n);return i.texture.mapping=306,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Nn(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function Bn(){return new Qe({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:On(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function zn(){return new Qe({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:On(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function On(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Hn(t){let e=new WeakMap,n=null;function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,o=303===s||304===s,a=301===s||302===s;if(o||a){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let i=e.get(r);return null===n&&(n=new Dn(t)),i=o?n.fromEquirectangular(r,i):n.fromCubemap(r,i),e.set(r,i),i.texture}if(e.has(r))return e.get(r).texture;{const s=r.image;if(o&&s&&s.height>0||a&&s&&function(t){let e=0;const n=6;for(let i=0;i<n;i++)void 0!==t[i]&&e++;return e===n}(s)){null===n&&(n=new Dn(t));const s=o?n.fromEquirectangular(r):n.fromCubemap(r);return e.set(r,s),r.addEventListener("dispose",i),s.texture}return null}}}return r},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function Un(t){const e={};function n(n){if(void 0!==e[n])return e[n];let i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i}return{has:function(t){return null!==n(t)},init:function(t){t.isWebGL2?n("EXT_color_buffer_float"):(n("WEBGL_depth_texture"),n("OES_texture_float"),n("OES_texture_half_float"),n("OES_texture_half_float_linear"),n("OES_standard_derivatives"),n("OES_element_index_uint"),n("OES_vertex_array_object"),n("ANGLE_instanced_arrays")),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture")},get:function(t){const e=n(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function Fn(t,e,n,i){const r={},s=new WeakMap;function o(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const t in a.attributes)e.remove(a.attributes[t]);a.removeEventListener("dispose",o),delete r[a.id];const l=s.get(a);l&&(e.remove(l),s.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t){const n=[],i=t.index,r=t.attributes.position;let o=0;if(null!==i){const t=i.array;o=i.version;for(let e=0,i=t.length;e<i;e+=3){const i=t[e+0],r=t[e+1],s=t[e+2];n.push(i,r,r,s,s,i)}}else{const t=r.array;o=r.version;for(let e=0,i=t.length/3-1;e<i;e+=3){const t=e+0,i=e+1,r=e+2;n.push(t,i,i,r,r,t)}}const a=new(v(n)?ye:ge)(n,1);a.version=o;const l=s.get(t);l&&e.remove(l),s.set(t,a)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",o),r[e.id]=!0,n.memory.geometries++),e},update:function(t){const n=t.attributes;for(const t in n)e.update(n[t],34962);const i=t.morphAttributes;for(const t in i){const n=i[t];for(let t=0,i=n.length;t<i;t++)e.update(n[t],34962)}},getWireframeAttribute:function(t){const e=s.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&a(t)}else a(t);return s.get(t)}}}function Gn(t,e,n,i){const r=i.isWebGL2;let s,o,a;this.setMode=function(t){s=t},this.setIndex=function(t){o=t.type,a=t.bytesPerElement},this.render=function(e,i){t.drawElements(s,i,o,e*a),n.update(i,s,1)},this.renderInstances=function(i,l,h){if(0===h)return;let c,d;if(r)c=t,d="drawElementsInstanced";else if(c=e.get("ANGLE_instanced_arrays"),d="drawElementsInstancedANGLE",null===c)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");c[d](s,l,o,i*a,h),n.update(l,s,h)}}function Vn(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,n,i){switch(e.calls++,n){case 4:e.triangles+=i*(t/3);break;case 1:e.lines+=i*(t/2);break;case 3:e.lines+=i*(t-1);break;case 2:e.lines+=i*t;break;case 0:e.points+=i*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function Wn(t,e){return t[0]-e[0]}function jn(t,e){return Math.abs(e[1])-Math.abs(t[1])}function qn(t,e){let n=1;const i=e.isInterleavedBufferAttribute?e.data.array:e.array;i instanceof Int8Array?n=127:i instanceof Int16Array?n=32767:i instanceof Int32Array?n=2147483647:console.error("THREE.WebGLMorphtargets: Unsupported morph attribute data type: ",i),t.divideScalar(n)}function Zn(t,e,n){const i={},r=new Float32Array(8),s=new WeakMap,o=new O,a=[];for(let t=0;t<8;t++)a[t]=[t,0];return{update:function(l,h,c,d){const u=l.morphTargetInfluences;if(!0===e.isWebGL2){const i=h.morphAttributes.position||h.morphAttributes.normal||h.morphAttributes.color,r=void 0!==i?i.length:0;let a=s.get(h);if(void 0===a||a.count!==r){void 0!==a&&a.texture.dispose();const t=void 0!==h.morphAttributes.position,n=void 0!==h.morphAttributes.normal,i=void 0!==h.morphAttributes.color,l=h.morphAttributes.position||[],c=h.morphAttributes.normal||[],d=h.morphAttributes.color||[];let u=0;!0===t&&(u=1),!0===n&&(u=2),!0===i&&(u=3);let p=h.attributes.position.count*u,m=1;p>e.maxTextureSize&&(m=Math.ceil(p/e.maxTextureSize),p=e.maxTextureSize);const g=new Float32Array(p*m*4*r),v=new U(g,p,m,r);v.type=1015,v.needsUpdate=!0;const y=4*u;for(let e=0;e<r;e++){const r=l[e],s=c[e],a=d[e],h=p*m*4*e;for(let e=0;e<r.count;e++){const l=e*y;!0===t&&(o.fromBufferAttribute(r,e),!0===r.normalized&&qn(o,r),g[h+l+0]=o.x,g[h+l+1]=o.y,g[h+l+2]=o.z,g[h+l+3]=0),!0===n&&(o.fromBufferAttribute(s,e),!0===s.normalized&&qn(o,s),g[h+l+4]=o.x,g[h+l+5]=o.y,g[h+l+6]=o.z,g[h+l+7]=0),!0===i&&(o.fromBufferAttribute(a,e),!0===a.normalized&&qn(o,a),g[h+l+8]=o.x,g[h+l+9]=o.y,g[h+l+10]=o.z,g[h+l+11]=4===a.itemSize?o.w:1)}}a={count:r,texture:v,size:new f(p,m)},s.set(h,a),h.addEventListener("dispose",(function t(){v.dispose(),s.delete(h),h.removeEventListener("dispose",t)}))}let l=0;for(let t=0;t<u.length;t++)l+=u[t];const c=h.morphTargetsRelative?1:1-l;d.getUniforms().setValue(t,"morphTargetBaseInfluence",c),d.getUniforms().setValue(t,"morphTargetInfluences",u),d.getUniforms().setValue(t,"morphTargetsTexture",a.texture,n),d.getUniforms().setValue(t,"morphTargetsTextureSize",a.size)}else{const e=void 0===u?0:u.length;let n=i[h.id];if(void 0===n||n.length!==e){n=[];for(let t=0;t<e;t++)n[t]=[t,0];i[h.id]=n}for(let t=0;t<e;t++){const e=n[t];e[0]=t,e[1]=u[t]}n.sort(jn);for(let t=0;t<8;t++)t<e&&n[t][1]?(a[t][0]=n[t][0],a[t][1]=n[t][1]):(a[t][0]=Number.MAX_SAFE_INTEGER,a[t][1]=0);a.sort(Wn);const s=h.morphAttributes.position,o=h.morphAttributes.normal;let l=0;for(let t=0;t<8;t++){const e=a[t],n=e[0],i=e[1];n!==Number.MAX_SAFE_INTEGER&&i?(s&&h.getAttribute("morphTarget"+t)!==s[n]&&h.setAttribute("morphTarget"+t,s[n]),o&&h.getAttribute("morphNormal"+t)!==o[n]&&h.setAttribute("morphNormal"+t,o[n]),r[t]=i,l+=i):(s&&!0===h.hasAttribute("morphTarget"+t)&&h.deleteAttribute("morphTarget"+t),o&&!0===h.hasAttribute("morphNormal"+t)&&h.deleteAttribute("morphNormal"+t),r[t]=0)}const c=h.morphTargetsRelative?1:1-l;d.getUniforms().setValue(t,"morphTargetBaseInfluence",c),d.getUniforms().setValue(t,"morphTargetInfluences",r)}}}}function Xn(t,e,n,i){let r=new WeakMap;function s(t){const e=t.target;e.removeEventListener("dispose",s),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(t){const o=i.render.frame,a=t.geometry,l=e.get(t,a);return r.get(l)!==o&&(e.update(l),r.set(l,o)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",s)&&t.addEventListener("dispose",s),n.update(t.instanceMatrix,34962),null!==t.instanceColor&&n.update(t.instanceColor,34962)),l},dispose:function(){r=new WeakMap}}}const Yn=new z,Jn=new U,$n=new G,Kn=new rn,Qn=[],ti=[],ei=new Float32Array(16),ni=new Float32Array(9),ii=new Float32Array(4);function ri(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let s=Qn[r];if(void 0===s&&(s=new Float32Array(r),Qn[r]=s),0!==e){i.toArray(s,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(s,r)}return s}function si(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function oi(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function ai(t,e){let n=ti[e];void 0===n&&(n=new Int32Array(e),ti[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function li(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function hi(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(si(n,e))return;t.uniform2fv(this.addr,e),oi(n,e)}}function ci(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(si(n,e))return;t.uniform3fv(this.addr,e),oi(n,e)}}function di(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(si(n,e))return;t.uniform4fv(this.addr,e),oi(n,e)}}function ui(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(si(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),oi(n,e)}else{if(si(n,i))return;ii.set(i),t.uniformMatrix2fv(this.addr,!1,ii),oi(n,i)}}function pi(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(si(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),oi(n,e)}else{if(si(n,i))return;ni.set(i),t.uniformMatrix3fv(this.addr,!1,ni),oi(n,i)}}function mi(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(si(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),oi(n,e)}else{if(si(n,i))return;ei.set(i),t.uniformMatrix4fv(this.addr,!1,ei),oi(n,i)}}function fi(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function gi(t,e){const n=this.cache;si(n,e)||(t.uniform2iv(this.addr,e),oi(n,e))}function vi(t,e){const n=this.cache;si(n,e)||(t.uniform3iv(this.addr,e),oi(n,e))}function yi(t,e){const n=this.cache;si(n,e)||(t.uniform4iv(this.addr,e),oi(n,e))}function xi(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function _i(t,e){const n=this.cache;si(n,e)||(t.uniform2uiv(this.addr,e),oi(n,e))}function wi(t,e){const n=this.cache;si(n,e)||(t.uniform3uiv(this.addr,e),oi(n,e))}function bi(t,e){const n=this.cache;si(n,e)||(t.uniform4uiv(this.addr,e),oi(n,e))}function Mi(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2D(e||Yn,r)}function Si(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||$n,r)}function Ei(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||Kn,r)}function Ti(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||Jn,r)}function Ai(t,e){t.uniform1fv(this.addr,e)}function Li(t,e){const n=ri(e,this.size,2);t.uniform2fv(this.addr,n)}function Ci(t,e){const n=ri(e,this.size,3);t.uniform3fv(this.addr,n)}function ki(t,e){const n=ri(e,this.size,4);t.uniform4fv(this.addr,n)}function Ri(t,e){const n=ri(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Pi(t,e){const n=ri(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function Di(t,e){const n=ri(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Ii(t,e){t.uniform1iv(this.addr,e)}function Ni(t,e){t.uniform2iv(this.addr,e)}function Bi(t,e){t.uniform3iv(this.addr,e)}function zi(t,e){t.uniform4iv(this.addr,e)}function Oi(t,e){t.uniform1uiv(this.addr,e)}function Hi(t,e){t.uniform2uiv(this.addr,e)}function Ui(t,e){t.uniform3uiv(this.addr,e)}function Fi(t,e){t.uniform4uiv(this.addr,e)}function Gi(t,e,n){const i=e.length,r=ai(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.setTexture2D(e[t]||Yn,r[t])}function Vi(t,e,n){const i=e.length,r=ai(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.setTexture3D(e[t]||$n,r[t])}function Wi(t,e,n){const i=e.length,r=ai(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.setTextureCube(e[t]||Kn,r[t])}function ji(t,e,n){const i=e.length,r=ai(n,i);t.uniform1iv(this.addr,r);for(let t=0;t!==i;++t)n.setTexture2DArray(e[t]||Jn,r[t])}function qi(t,e,n){this.id=t,this.addr=n,this.cache=[],this.setValue=function(t){switch(t){case 5126:return li;case 35664:return hi;case 35665:return ci;case 35666:return di;case 35674:return ui;case 35675:return pi;case 35676:return mi;case 5124:case 35670:return fi;case 35667:case 35671:return gi;case 35668:case 35672:return vi;case 35669:case 35673:return yi;case 5125:return xi;case 36294:return _i;case 36295:return wi;case 36296:return bi;case 35678:case 36198:case 36298:case 36306:case 35682:return Mi;case 35679:case 36299:case 36307:return Si;case 35680:case 36300:case 36308:case 36293:return Ei;case 36289:case 36303:case 36311:case 36292:return Ti}}(e.type)}function Zi(t,e,n){this.id=t,this.addr=n,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Ai;case 35664:return Li;case 35665:return Ci;case 35666:return ki;case 35674:return Ri;case 35675:return Pi;case 35676:return Di;case 5124:case 35670:return Ii;case 35667:case 35671:return Ni;case 35668:case 35672:return Bi;case 35669:case 35673:return zi;case 5125:return Oi;case 36294:return Hi;case 36295:return Ui;case 36296:return Fi;case 35678:case 36198:case 36298:case 36306:case 35682:return Gi;case 35679:case 36299:case 36307:return Vi;case 35680:case 36300:case 36308:case 36293:return Wi;case 36289:case 36303:case 36311:case 36292:return ji}}(e.type)}function Xi(t){this.id=t,this.seq=[],this.map={}}Zi.prototype.updateCache=function(t){const e=this.cache;t instanceof Float32Array&&e.length!==t.length&&(this.cache=new Float32Array(t.length)),oi(e,t)},Xi.prototype.setValue=function(t,e,n){const i=this.seq;for(let r=0,s=i.length;r!==s;++r){const s=i[r];s.setValue(t,e[s.id],n)}};const Yi=/(\w+)(\])?(\[|\.)?/g;function Ji(t,e){t.seq.push(e),t.map[e.id]=e}function $i(t,e,n){const i=t.name,r=i.length;for(Yi.lastIndex=0;;){const s=Yi.exec(i),o=Yi.lastIndex;let a=s[1];const l="]"===s[2],h=s[3];if(l&&(a|=0),void 0===h||"["===h&&o+2===r){Ji(n,void 0===h?new qi(a,t,e):new Zi(a,t,e));break}{let t=n.map[a];void 0===t&&(t=new Xi(a),Ji(n,t)),n=t}}}function Ki(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,35718);for(let i=0;i<n;++i){const n=t.getActiveUniform(e,i);$i(n,t.getUniformLocation(e,n.name),this)}}function Qi(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}Ki.prototype.setValue=function(t,e,n,i){const r=this.map[e];void 0!==r&&r.setValue(t,n,i)},Ki.prototype.setOptional=function(t,e,n){const i=e[n];void 0!==i&&this.setValue(t,n,i)},Ki.upload=function(t,e,n,i){for(let r=0,s=e.length;r!==s;++r){const s=e[r],o=n[s.id];!1!==o.needsUpdate&&s.setValue(t,o.value,i)}},Ki.seqWithValue=function(t,e){const n=[];for(let i=0,r=t.length;i!==r;++i){const r=t[i];r.id in e&&n.push(r)}return n};let tr=0;function er(t,e,n){const i=t.getShaderParameter(e,35713),r=t.getShaderInfoLog(e).trim();if(i&&""===r)return"";const s=parseInt(/ERROR: 0:(\d+)/.exec(r)[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(t,e){const n=t.split("\n"),i=[],r=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let t=r;t<s;t++)i.push(t+1+": "+n[t]);return i.join("\n")}(t.getShaderSource(e),s)}function nr(t,e){const n=function(t){switch(t){case 3e3:return["Linear","( value )"];case 3001:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function ir(t,e){let n;switch(e){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function rr(t){return""!==t}function sr(t,e){return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function or(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const ar=/^[ \t]*#include +<([\w\d./]+)>/gm;function lr(t){return t.replace(ar,hr)}function hr(t,e){const n=gn[e];if(void 0===n)throw new Error("Can not resolve #include <"+e+">");return lr(n)}const cr=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,dr=/#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 ur(t){return t.replace(dr,mr).replace(cr,pr)}function pr(t,e,n,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),mr(t,e,n,i)}function mr(t,e,n,i){let r="";for(let t=parseInt(e);t<parseInt(n);t++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function fr(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function gr(t,e,n,i){const r=t.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(n),h=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case 301:case 302:e="ENVMAP_TYPE_CUBE";break;case 306:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),c=function(t){let e="ENVMAP_MODE_REFLECTION";t.envMap&&302===t.envMapMode&&(e="ENVMAP_MODE_REFRACTION");return e}(n),d=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(n),u=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const n=Math.log2(e/32+1)+3,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),p=n.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUVHeight||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(rr).join("\n")}(n),m=function(t){const e=[];for(const n in t){const i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}(s),f=r.createProgram();let g,v,y=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=[m].filter(rr).join("\n"),g.length>0&&(g+="\n"),v=[p,m].filter(rr).join("\n"),v.length>0&&(v+="\n")):(g=[fr(n),"#define SHADER_NAME "+n.shaderName,m,n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define MAX_BONES "+n.maxBones,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.displacementMap&&n.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.useVertexTexture?"#define BONE_TEXTURE":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","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","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(rr).join("\n"),v=[p,fr(n),"#define SHADER_NAME "+n.shaderName,m,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+h:"",n.envMap?"#define "+c:"",n.envMap?"#define "+d:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMap&&n.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",n.normalMap&&n.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",n.specularColorMap?"#define USE_SPECULARCOLORMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEENCOLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.vertexTangents?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUvs?"#define USE_UV":"",n.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?gn.tonemapping_pars_fragment:"",0!==n.toneMapping?ir("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",gn.encodings_pars_fragment,nr("linearToOutputTexel",n.outputEncoding),n.depthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(rr).join("\n")),o=lr(o),o=sr(o,n),o=or(o,n),a=lr(a),a=sr(a,n),a=or(a,n),o=ur(o),a=ur(a),n.isWebGL2&&!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in","300 es"===n.glslVersion?"":"layout(location = 0) out highp vec4 pc_fragColor;","300 es"===n.glslVersion?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+v);const x=y+v+a,_=Qi(r,35633,y+g+o),w=Qi(r,35632,x);if(r.attachShader(f,_),r.attachShader(f,w),void 0!==n.index0AttributeName?r.bindAttribLocation(f,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(f,0,"position"),r.linkProgram(f),t.debug.checkShaderErrors){const t=r.getProgramInfoLog(f).trim(),e=r.getShaderInfoLog(_).trim(),n=r.getShaderInfoLog(w).trim();let i=!0,s=!0;if(!1===r.getProgramParameter(f,35714)){i=!1;const e=er(r,_,"vertex"),n=er(r,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(f,35715)+"\n\nProgram Info Log: "+t+"\n"+e+"\n"+n)}else""!==t?console.warn("THREE.WebGLProgram: Program Info Log:",t):""!==e&&""!==n||(s=!1);s&&(this.diagnostics={runnable:i,programLog:t,vertexShader:{log:e,prefix:g},fragmentShader:{log:n,prefix:v}})}let b,M;return r.deleteShader(_),r.deleteShader(w),this.getUniforms=function(){return void 0===b&&(b=new Ki(r,f)),b},this.getAttributes=function(){return void 0===M&&(M=function(t,e){const n={},i=t.getProgramParameter(e,35721);for(let r=0;r<i;r++){const i=t.getActiveAttrib(e,r),s=i.name;let o=1;35674===i.type&&(o=2),35675===i.type&&(o=3),35676===i.type&&(o=4),n[s]={type:i.type,location:t.getAttribLocation(e,s),locationSize:o}}return n}(r,f)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(f),this.program=void 0},this.name=n.shaderName,this.id=tr++,this.cacheKey=e,this.usedTimes=1,this.program=f,this.vertexShader=_,this.fragmentShader=w,this}let vr=0;class yr{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),r=this._getShaderStage(n),s=this._getShaderCacheForMaterial(t);return!1===s.has(i)&&(s.add(i),i.usedTimes++),!1===s.has(r)&&(s.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const t of e)t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;return!1===e.has(t)&&e.set(t,new Set),e.get(t)}_getShaderStage(t){const e=this.shaderCache;if(!1===e.has(t)){const n=new xr(t);e.set(t,n)}return e.get(t)}}class xr{constructor(t){this.id=vr++,this.code=t,this.usedTimes=0}}function _r(t,e,n,i,r,s,o){const a=new It,l=new yr,h=[],c=r.isWebGL2,d=r.logarithmicDepthBuffer,u=r.floatVertexTextures,p=r.maxVertexUniforms,m=r.vertexTextures;let f=r.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};return{getParameters:function(s,a,h,v,y){const x=v.fog,_=y.geometry,w=s.isMeshStandardMaterial?v.environment:null,b=(s.isMeshStandardMaterial?n:e).get(s.envMap||w),M=b&&306===b.mapping?b.image.height:null,S=g[s.type],E=y.isSkinnedMesh?function(t){const e=t.skeleton.bones;if(u)return 1024;{const t=p,n=Math.floor((t-20)/4),i=Math.min(n,e.length);return i<e.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+e.length+" bones. This GPU supports "+i+"."),0):i}}(y):0;null!==s.precision&&(f=r.getMaxPrecision(s.precision),f!==s.precision&&console.warn("THREE.WebGLProgram.getParameters:",s.precision,"not supported, using",f,"instead."));const T=_.morphAttributes.position||_.morphAttributes.normal||_.morphAttributes.color,A=void 0!==T?T.length:0;let L,C,k,R,P=0;if(void 0!==_.morphAttributes.position&&(P=1),void 0!==_.morphAttributes.normal&&(P=2),void 0!==_.morphAttributes.color&&(P=3),S){const t=yn[S];L=t.vertexShader,C=t.fragmentShader}else L=s.vertexShader,C=s.fragmentShader,l.update(s),k=l.getVertexShaderID(s),R=l.getFragmentShaderID(s);const D=t.getRenderTarget(),I=s.alphaTest>0,N=s.clearcoat>0;return{isWebGL2:c,shaderID:S,shaderName:s.type,vertexShader:L,fragmentShader:C,defines:s.defines,customVertexShaderID:k,customFragmentShaderID:R,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:f,instancing:!0===y.isInstancedMesh,instancingColor:!0===y.isInstancedMesh&&null!==y.instanceColor,supportsVertexTextures:m,outputEncoding:null===D?t.outputEncoding:!0===D.isXRRenderTarget?D.texture.encoding:3e3,map:!!s.map,matcap:!!s.matcap,envMap:!!b,envMapMode:b&&b.mapping,envMapCubeUVHeight:M,lightMap:!!s.lightMap,aoMap:!!s.aoMap,emissiveMap:!!s.emissiveMap,bumpMap:!!s.bumpMap,normalMap:!!s.normalMap,objectSpaceNormalMap:1===s.normalMapType,tangentSpaceNormalMap:0===s.normalMapType,decodeVideoTexture:!!s.map&&!0===s.map.isVideoTexture&&3001===s.map.encoding,clearcoat:N,clearcoatMap:N&&!!s.clearcoatMap,clearcoatRoughnessMap:N&&!!s.clearcoatRoughnessMap,clearcoatNormalMap:N&&!!s.clearcoatNormalMap,displacementMap:!!s.displacementMap,roughnessMap:!!s.roughnessMap,metalnessMap:!!s.metalnessMap,specularMap:!!s.specularMap,specularIntensityMap:!!s.specularIntensityMap,specularColorMap:!!s.specularColorMap,opaque:!1===s.transparent&&1===s.blending,alphaMap:!!s.alphaMap,alphaTest:I,gradientMap:!!s.gradientMap,sheen:s.sheen>0,sheenColorMap:!!s.sheenColorMap,sheenRoughnessMap:!!s.sheenRoughnessMap,transmission:s.transmission>0,transmissionMap:!!s.transmissionMap,thicknessMap:!!s.thicknessMap,combine:s.combine,vertexTangents:!!s.normalMap&&!!_.attributes.tangent,vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!_.attributes.color&&4===_.attributes.color.itemSize,vertexUvs:!!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatMap||s.clearcoatRoughnessMap||s.clearcoatNormalMap||s.displacementMap||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheenColorMap||s.sheenRoughnessMap),uvsVertexOnly:!(s.map||s.bumpMap||s.normalMap||s.specularMap||s.alphaMap||s.emissiveMap||s.roughnessMap||s.metalnessMap||s.clearcoatNormalMap||s.transmission>0||s.transmissionMap||s.thicknessMap||s.specularIntensityMap||s.specularColorMap||s.sheen>0||s.sheenColorMap||s.sheenRoughnessMap||!s.displacementMap),fog:!!x,useFog:s.fog,fogExp2:x&&x.isFogExp2,flatShading:!!s.flatShading,sizeAttenuation:s.sizeAttenuation,logarithmicDepthBuffer:d,skinning:!0===y.isSkinnedMesh&&E>0,maxBones:E,useVertexTexture:u,morphTargets:void 0!==_.morphAttributes.position,morphNormals:void 0!==_.morphAttributes.normal,morphColors:void 0!==_.morphAttributes.color,morphTargetsCount:A,morphTextureStride:P,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:s.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.length>0,shadowMapType:t.shadowMap.type,toneMapping:s.toneMapped?t.toneMapping:0,physicallyCorrectLights:t.physicallyCorrectLights,premultipliedAlpha:s.premultipliedAlpha,doubleSided:2===s.side,flipSided:1===s.side,depthPacking:void 0!==s.depthPacking&&s.depthPacking,index0AttributeName:s.index0AttributeName,extensionDerivatives:s.extensions&&s.extensions.derivatives,extensionFragDepth:s.extensions&&s.extensions.fragDepth,extensionDrawBuffers:s.extensions&&s.extensions.drawBuffers,extensionShaderTextureLOD:s.extensions&&s.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||i.has("EXT_shader_texture_lod"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(!function(t,e){t.push(e.precision),t.push(e.outputEncoding),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.combine),t.push(e.vertexUvs),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.maxBones),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection)}(n,e),function(t,e){a.disableAll(),e.isWebGL2&&a.enable(0);e.supportsVertexTextures&&a.enable(1);e.instancing&&a.enable(2);e.instancingColor&&a.enable(3);e.map&&a.enable(4);e.matcap&&a.enable(5);e.envMap&&a.enable(6);e.lightMap&&a.enable(7);e.aoMap&&a.enable(8);e.emissiveMap&&a.enable(9);e.bumpMap&&a.enable(10);e.normalMap&&a.enable(11);e.objectSpaceNormalMap&&a.enable(12);e.tangentSpaceNormalMap&&a.enable(13);e.clearcoat&&a.enable(14);e.clearcoatMap&&a.enable(15);e.clearcoatRoughnessMap&&a.enable(16);e.clearcoatNormalMap&&a.enable(17);e.displacementMap&&a.enable(18);e.specularMap&&a.enable(19);e.roughnessMap&&a.enable(20);e.metalnessMap&&a.enable(21);e.gradientMap&&a.enable(22);e.alphaMap&&a.enable(23);e.alphaTest&&a.enable(24);e.vertexColors&&a.enable(25);e.vertexAlphas&&a.enable(26);e.vertexUvs&&a.enable(27);e.vertexTangents&&a.enable(28);e.uvsVertexOnly&&a.enable(29);e.fog&&a.enable(30);t.push(a.mask),a.disableAll(),e.useFog&&a.enable(0);e.flatShading&&a.enable(1);e.logarithmicDepthBuffer&&a.enable(2);e.skinning&&a.enable(3);e.useVertexTexture&&a.enable(4);e.morphTargets&&a.enable(5);e.morphNormals&&a.enable(6);e.morphColors&&a.enable(7);e.premultipliedAlpha&&a.enable(8);e.shadowMapEnabled&&a.enable(9);e.physicallyCorrectLights&&a.enable(10);e.doubleSided&&a.enable(11);e.flipSided&&a.enable(12);e.depthPacking&&a.enable(13);e.dithering&&a.enable(14);e.specularIntensityMap&&a.enable(15);e.specularColorMap&&a.enable(16);e.transmission&&a.enable(17);e.transmissionMap&&a.enable(18);e.thicknessMap&&a.enable(19);e.sheen&&a.enable(20);e.sheenColorMap&&a.enable(21);e.sheenRoughnessMap&&a.enable(22);e.decodeVideoTexture&&a.enable(23);e.opaque&&a.enable(24);t.push(a.mask)}(n,e),n.push(t.outputEncoding)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=g[t.type];let n;if(e){const t=yn[e];n=Ke.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,e=h.length;t<e;t++){const e=h[t];if(e.cacheKey===n){i=e,++i.usedTimes;break}}return void 0===i&&(i=new gr(t,n,e,s),h.push(i)),i},releaseProgram:function(t){if(0==--t.usedTimes){const e=h.indexOf(t);h[e]=h[h.length-1],h.pop(),t.destroy()}},releaseShaderCache:function(t){l.remove(t)},programs:h,dispose:function(){l.dispose()}}}function wr(){let t=new WeakMap;return{get:function(e){let n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,i){t.get(e)[n]=i},dispose:function(){t=new WeakMap}}}function br(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Mr(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Sr(){const t=[];let e=0;const n=[],i=[],r=[];function s(n,i,r,s,o,a){let l=t[e];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:s,renderOrder:n.renderOrder,z:o,group:a},t[e]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=s,l.renderOrder=n.renderOrder,l.z=o,l.group=a),e++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){e=0,n.length=0,i.length=0,r.length=0},push:function(t,e,o,a,l,h){const c=s(t,e,o,a,l,h);o.transmission>0?i.push(c):!0===o.transparent?r.push(c):n.push(c)},unshift:function(t,e,o,a,l,h){const c=s(t,e,o,a,l,h);o.transmission>0?i.unshift(c):!0===o.transparent?r.unshift(c):n.unshift(c)},finish:function(){for(let n=e,i=t.length;n<i;n++){const e=t[n];if(null===e.id)break;e.id=null,e.object=null,e.geometry=null,e.material=null,e.group=null}},sort:function(t,e){n.length>1&&n.sort(t||br),i.length>1&&i.sort(e||Mr),r.length>1&&r.sort(e||Mr)}}}function Er(){let t=new WeakMap;return{get:function(e,n){let i;return!1===t.has(e)?(i=new Sr,t.set(e,[i])):n>=t.get(e).length?(i=new Sr,t.get(e).push(i)):i=t.get(e)[n],i},dispose:function(){t=new WeakMap}}}function Tr(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new q,color:new R};break;case"SpotLight":n={position:new q,direction:new q,color:new R,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new q,color:new R,distance:0,decay:0};break;case"HemisphereLight":n={direction:new q,skyColor:new R,groundColor:new R};break;case"RectAreaLight":n={color:new R,position:new q,halfWidth:new q,halfHeight:new q}}return t[e.id]=n,n}}}let Ar=0;function Lr(t,e){return(e.castShadow?1:0)-(t.castShadow?1:0)}function Cr(t,e){const n=new Tr,i=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new f};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new f,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let t=0;t<9;t++)r.probe.push(new q);const s=new q,o=new Mt,a=new Mt;return{setup:function(s,o){let a=0,l=0,h=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let c=0,d=0,u=0,p=0,m=0,f=0,g=0,v=0;s.sort(Lr);const y=!0!==o?Math.PI:1;for(let t=0,e=s.length;t<e;t++){const e=s[t],o=e.color,x=e.intensity,_=e.distance,w=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)a+=o.r*x*y,l+=o.g*x*y,h+=o.b*x*y;else if(e.isLightProbe)for(let t=0;t<9;t++)r.probe[t].addScaledVector(e.sh.coefficients[t],x);else if(e.isDirectionalLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*y),e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,r.directionalShadow[c]=n,r.directionalShadowMap[c]=w,r.directionalShadowMatrix[c]=e.shadow.matrix,f++}r.directional[c]=t,c++}else if(e.isSpotLight){const t=n.get(e);if(t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(o).multiplyScalar(x*y),t.distance=_,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,r.spotShadow[u]=n,r.spotShadowMap[u]=w,r.spotShadowMatrix[u]=e.shadow.matrix,v++}r.spot[u]=t,u++}else if(e.isRectAreaLight){const t=n.get(e);t.color.copy(o).multiplyScalar(x),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),r.rectArea[p]=t,p++}else if(e.isPointLight){const t=n.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*y),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,n=i.get(e);n.shadowBias=t.bias,n.shadowNormalBias=t.normalBias,n.shadowRadius=t.radius,n.shadowMapSize=t.mapSize,n.shadowCameraNear=t.camera.near,n.shadowCameraFar=t.camera.far,r.pointShadow[d]=n,r.pointShadowMap[d]=w,r.pointShadowMatrix[d]=e.shadow.matrix,g++}r.point[d]=t,d++}else if(e.isHemisphereLight){const t=n.get(e);t.skyColor.copy(e.color).multiplyScalar(x*y),t.groundColor.copy(e.groundColor).multiplyScalar(x*y),r.hemi[m]=t,m++}}p>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=vn.LTC_FLOAT_1,r.rectAreaLTC2=vn.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=vn.LTC_HALF_1,r.rectAreaLTC2=vn.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=a,r.ambient[1]=l,r.ambient[2]=h;const x=r.hash;x.directionalLength===c&&x.pointLength===d&&x.spotLength===u&&x.rectAreaLength===p&&x.hemiLength===m&&x.numDirectionalShadows===f&&x.numPointShadows===g&&x.numSpotShadows===v||(r.directional.length=c,r.spot.length=u,r.rectArea.length=p,r.point.length=d,r.hemi.length=m,r.directionalShadow.length=f,r.directionalShadowMap.length=f,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=v,r.spotShadowMap.length=v,r.directionalShadowMatrix.length=f,r.pointShadowMatrix.length=g,r.spotShadowMatrix.length=v,x.directionalLength=c,x.pointLength=d,x.spotLength=u,x.rectAreaLength=p,x.hemiLength=m,x.numDirectionalShadows=f,x.numPointShadows=g,x.numSpotShadows=v,r.version=Ar++)},setupView:function(t,e){let n=0,i=0,l=0,h=0,c=0;const d=e.matrixWorldInverse;for(let e=0,u=t.length;e<u;e++){const u=t[e];if(u.isDirectionalLight){const t=r.directional[n];t.direction.setFromMatrixPosition(u.matrixWorld),s.setFromMatrixPosition(u.target.matrixWorld),t.direction.sub(s),t.direction.transformDirection(d),n++}else if(u.isSpotLight){const t=r.spot[l];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),t.direction.setFromMatrixPosition(u.matrixWorld),s.setFromMatrixPosition(u.target.matrixWorld),t.direction.sub(s),t.direction.transformDirection(d),l++}else if(u.isRectAreaLight){const t=r.rectArea[h];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),a.identity(),o.copy(u.matrixWorld),o.premultiply(d),a.extractRotation(o),t.halfWidth.set(.5*u.width,0,0),t.halfHeight.set(0,.5*u.height,0),t.halfWidth.applyMatrix4(a),t.halfHeight.applyMatrix4(a),h++}else if(u.isPointLight){const t=r.point[i];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),i++}else if(u.isHemisphereLight){const t=r.hemi[c];t.direction.setFromMatrixPosition(u.matrixWorld),t.direction.transformDirection(d),t.direction.normalize(),c++}}},state:r}}function kr(t,e){const n=new Cr(t,e),i=[],r=[];return{init:function(){i.length=0,r.length=0},state:{lightsArray:i,shadowsArray:r,lights:n},setupLights:function(t){n.setup(i,t)},setupLightsView:function(t){n.setupView(i,t)},pushLight:function(t){i.push(t)},pushShadow:function(t){r.push(t)}}}function Rr(t,e){let n=new WeakMap;return{get:function(i,r=0){let s;return!1===n.has(i)?(s=new kr(t,e),n.set(i,[s])):r>=n.get(i).length?(s=new kr(t,e),n.get(i).push(s)):s=n.get(i)[r],s},dispose:function(){n=new WeakMap}}}class Pr extends ae{constructor(t){super(),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.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}Pr.prototype.isMeshDepthMaterial=!0;class Dr extends ae{constructor(t){super(),this.type="MeshDistanceMaterial",this.referencePosition=new q,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(t)}copy(t){return super.copy(t),this.referencePosition.copy(t.referencePosition),this.nearDistance=t.nearDistance,this.farDistance=t.farDistance,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}Dr.prototype.isMeshDistanceMaterial=!0;function Ir(t,e,n){let i=new un;const r=new f,s=new f,o=new O,a=new Pr({depthPacking:3201}),l=new Dr,h={},c=n.maxTextureSize,d={0:1,1:0,2:2},u=new Qe({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new f},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=u.clone();p.defines.HORIZONTAL_PASS=1;const m=new Ce;m.setAttribute("position",new de(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new Ze(m,u),v=this;function y(n,i){const r=e.update(g);u.defines.VSM_SAMPLES!==n.blurSamples&&(u.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,u.needsUpdate=!0,p.needsUpdate=!0),u.uniforms.shadow_pass.value=n.map.texture,u.uniforms.resolution.value=n.mapSize,u.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,r,u,g,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,r,p,g,null)}function x(e,n,i,r,s,o){let c=null;const u=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(c=void 0!==u?u:!0===i.isPointLight?l:a,t.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0){const t=c.uuid,e=n.uuid;let i=h[t];void 0===i&&(i={},h[t]=i);let r=i[e];void 0===r&&(r=c.clone(),i[e]=r),c=r}return c.visible=n.visible,c.wireframe=n.wireframe,c.side=3===o?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:d[n.side],c.alphaMap=n.alphaMap,c.alphaTest=n.alphaTest,c.clipShadows=n.clipShadows,c.clippingPlanes=n.clippingPlanes,c.clipIntersection=n.clipIntersection,c.displacementMap=n.displacementMap,c.displacementScale=n.displacementScale,c.displacementBias=n.displacementBias,c.wireframeLinewidth=n.wireframeLinewidth,c.linewidth=n.linewidth,!0===i.isPointLight&&!0===c.isMeshDistanceMaterial&&(c.referencePosition.setFromMatrixPosition(i.matrixWorld),c.nearDistance=r,c.farDistance=s),c}function _(n,r,s,o,a){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===a)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=e.update(n),r=n.material;if(Array.isArray(r)){const e=i.groups;for(let l=0,h=e.length;l<h;l++){const h=e[l],c=r[h.materialIndex];if(c&&c.visible){const e=x(n,c,o,s.near,s.far,a);t.renderBufferDirect(s,null,i,e,n,h)}}}else if(r.visible){const e=x(n,r,o,s.near,s.far,a);t.renderBufferDirect(s,null,i,e,n,null)}}const l=n.children;for(let t=0,e=l.length;t<e;t++)_(l[t],r,s,o,a)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1,this.render=function(e,n,a){if(!1===v.enabled)return;if(!1===v.autoUpdate&&!1===v.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),h=t.getActiveCubeFace(),d=t.getActiveMipmapLevel(),u=t.state;u.setBlending(0),u.buffers.color.setClear(1,1,1,1),u.buffers.depth.setTest(!0),u.setScissorTest(!1);for(let l=0,h=e.length;l<h;l++){const h=e[l],d=h.shadow;if(void 0===d){console.warn("THREE.WebGLShadowMap:",h,"has no shadow.");continue}if(!1===d.autoUpdate&&!1===d.needsUpdate)continue;r.copy(d.mapSize);const p=d.getFrameExtents();if(r.multiply(p),s.copy(d.mapSize),(r.x>c||r.y>c)&&(r.x>c&&(s.x=Math.floor(c/p.x),r.x=s.x*p.x,d.mapSize.x=s.x),r.y>c&&(s.y=Math.floor(c/p.y),r.y=s.y*p.y,d.mapSize.y=s.y)),null!==d.map||d.isPointLightShadow||3!==this.type||(d.map=new H(r.x,r.y),d.map.texture.name=h.name+".shadowMap",d.mapPass=new H(r.x,r.y),d.camera.updateProjectionMatrix()),null===d.map){const t={minFilter:1003,magFilter:1003,format:1023};d.map=new H(r.x,r.y,t),d.map.texture.name=h.name+".shadowMap",d.camera.updateProjectionMatrix()}t.setRenderTarget(d.map),t.clear();const m=d.getViewportCount();for(let t=0;t<m;t++){const e=d.getViewport(t);o.set(s.x*e.x,s.y*e.y,s.x*e.z,s.y*e.w),u.viewport(o),d.updateMatrices(h,t),i=d.getFrustum(),_(n,a,d.camera,h,this.type)}d.isPointLightShadow||3!==this.type||y(d,a),d.needsUpdate=!1}v.needsUpdate=!1,t.setRenderTarget(l,h,d)}}function Nr(t,e,n){const i=n.isWebGL2;const r=new function(){let e=!1;const n=new O;let i=null;const r=new O(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,s,o,a){!0===a&&(e*=o,i*=o,s*=o),n.set(e,i,s,o),!1===r.equals(n)&&(t.clearColor(e,i,s,o),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}},s=new function(){let e=!1,n=null,i=null,r=null;return{setTest:function(t){t?H(2929):U(2929)},setMask:function(i){n===i||e||(t.depthMask(i),n=i)},setFunc:function(e){if(i!==e){if(e)switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:default:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517)}else t.depthFunc(515);i=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,n=null,i=null,r=null}}},o=new function(){let e=!1,n=null,i=null,r=null,s=null,o=null,a=null,l=null,h=null;return{setTest:function(t){e||(t?H(2960):U(2960))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,o){i===e&&r===n&&s===o||(t.stencilFunc(e,n,o),i=e,r=n,s=o)},setOp:function(e,n,i){o===e&&a===n&&l===i||(t.stencilOp(e,n,i),o=e,a=n,l=i)},setLocked:function(t){e=t},setClear:function(e){h!==e&&(t.clearStencil(e),h=e)},reset:function(){e=!1,n=null,i=null,r=null,s=null,o=null,a=null,l=null,h=null}}};let a={},l={},h=new WeakMap,c=[],d=null,u=!1,p=null,m=null,f=null,g=null,v=null,y=null,x=null,_=!1,w=null,b=null,M=null,S=null,E=null;const T=t.getParameter(35661);let A=!1,L=0;const C=t.getParameter(7938);-1!==C.indexOf("WebGL")?(L=parseFloat(/^WebGL (\d)/.exec(C)[1]),A=L>=1):-1!==C.indexOf("OpenGL ES")&&(L=parseFloat(/^OpenGL ES (\d)/.exec(C)[1]),A=L>=2);let k=null,R={};const P=t.getParameter(3088),D=t.getParameter(2978),I=(new O).fromArray(P),N=(new O).fromArray(D);function B(e,n,i){const r=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<i;e++)t.texImage2D(n+e,0,6408,1,1,0,6408,5121,r);return s}const z={};function H(e){!0!==a[e]&&(t.enable(e),a[e]=!0)}function U(e){!1!==a[e]&&(t.disable(e),a[e]=!1)}z[3553]=B(3553,3553,1),z[34067]=B(34067,34069,6),r.setClear(0,0,0,1),s.setClear(1),o.setClear(0),H(2929),s.setFunc(3),W(!1),j(1),H(2884),V(0);const F={100:32774,101:32778,102:32779};if(i)F[103]=32775,F[104]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(F[103]=t.MIN_EXT,F[104]=t.MAX_EXT)}const G={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function V(e,n,i,r,s,o,a,l){if(0!==e){if(!1===u&&(H(3042),u=!0),5===e)s=s||n,o=o||i,a=a||r,n===m&&s===v||(t.blendEquationSeparate(F[n],F[s]),m=n,v=s),i===f&&r===g&&o===y&&a===x||(t.blendFuncSeparate(G[i],G[r],G[o],G[a]),f=i,g=r,y=o,x=a),p=e,_=null;else if(e!==p||l!==_){if(100===m&&100===v||(t.blendEquation(32774),m=100,v=100),l)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,769,0,1);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFuncSeparate(0,769,0,1);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}f=null,g=null,y=null,x=null,p=e,_=l}}else!0===u&&(U(3042),u=!1)}function W(e){w!==e&&(e?t.frontFace(2304):t.frontFace(2305),w=e)}function j(e){0!==e?(H(2884),e!==b&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):U(2884),b=e}function q(e,n,i){e?(H(32823),S===n&&E===i||(t.polygonOffset(n,i),S=n,E=i)):U(32823)}function Z(e){void 0===e&&(e=33984+T-1),k!==e&&(t.activeTexture(e),k=e)}return{buffers:{color:r,depth:s,stencil:o},enable:H,disable:U,bindFramebuffer:function(e,n){return l[e]!==n&&(t.bindFramebuffer(e,n),l[e]=n,i&&(36009===e&&(l[36160]=n),36160===e&&(l[36009]=n)),!0)},drawBuffers:function(i,r){let s=c,o=!1;if(i)if(s=h.get(r),void 0===s&&(s=[],h.set(r,s)),i.isWebGLMultipleRenderTargets){const t=i.texture;if(s.length!==t.length||36064!==s[0]){for(let e=0,n=t.length;e<n;e++)s[e]=36064+e;s.length=t.length,o=!0}}else 36064!==s[0]&&(s[0]=36064,o=!0);else 1029!==s[0]&&(s[0]=1029,o=!0);o&&(n.isWebGL2?t.drawBuffers(s):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(s))},useProgram:function(e){return d!==e&&(t.useProgram(e),d=e,!0)},setBlending:V,setMaterial:function(t,e){2===t.side?U(2884):H(2884);let n=1===t.side;e&&(n=!n),W(n),1===t.blending&&!1===t.transparent?V(0):V(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),s.setFunc(t.depthFunc),s.setTest(t.depthTest),s.setMask(t.depthWrite),r.setMask(t.colorWrite);const i=t.stencilWrite;o.setTest(i),i&&(o.setMask(t.stencilWriteMask),o.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),o.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),q(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?H(32926):U(32926)},setFlipSided:W,setCullFace:j,setLineWidth:function(e){e!==M&&(A&&t.lineWidth(e),M=e)},setPolygonOffset:q,setScissorTest:function(t){t?H(3089):U(3089)},activeTexture:Z,bindTexture:function(e,n){null===k&&Z();let i=R[k];void 0===i&&(i={type:void 0,texture:void 0},R[k]=i),i.type===e&&i.texture===n||(t.bindTexture(e,n||z[e]),i.type=e,i.texture=n)},unbindTexture:function(){const e=R[k];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage2D:function(){try{t.texStorage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage3D:function(){try{t.texStorage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage2D:function(){try{t.texSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage3D:function(){try{t.texSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===I.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),I.copy(e))},viewport:function(e){!1===N.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),N.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.disable(32926),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.bindFramebuffer(36160,null),!0===i&&(t.bindFramebuffer(36009,null),t.bindFramebuffer(36008,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),a={},k=null,R={},l={},h=new WeakMap,c=[],d=null,u=!1,p=null,m=null,f=null,g=null,v=null,y=null,x=null,_=!1,w=null,b=null,M=null,S=null,E=null,I.set(0,0,t.canvas.width,t.canvas.height),N.set(0,0,t.canvas.width,t.canvas.height),r.reset(),s.reset(),o.reset()}}}function Br(t,e,n,i,r,s,o){const a=r.isWebGL2,l=r.maxTextures,h=r.maxCubemapSize,c=r.maxTextureSize,u=r.maxSamples,m=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,f=/OculusBrowser/g.test(navigator.userAgent),g=new WeakMap;let v;const y=new WeakMap;let x=!1;try{x="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function w(t,e){return x?new OffscreenCanvas(t,e):_("canvas")}function b(t,e,n,i){let r=1;if((t.width>i||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const i=e?p:Math.floor,s=i(r*t.width),o=i(r*t.height);void 0===v&&(v=w(s,o));const a=n?w(s,o):v;a.width=s,a.height=o;return a.getContext("2d").drawImage(t,0,0,s,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+s+"x"+o+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function M(t){return d(t.width)&&d(t.height)}function S(t,e){return t.generateMipmaps&&e&&1003!==t.minFilter&&1006!==t.minFilter}function E(e){t.generateMipmap(e)}function T(n,i,r,s,o=!1){if(!1===a)return i;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let l=i;return 6403===i&&(5126===r&&(l=33326),5131===r&&(l=33325),5121===r&&(l=33321)),33319===i&&(5126===r&&(l=33328),5131===r&&(l=33327),5121===r&&(l=33323)),6408===i&&(5126===r&&(l=34836),5131===r&&(l=34842),5121===r&&(l=3001===s&&!1===o?35907:32856),32819===r&&(l=32854),32820===r&&(l=32855)),33325!==l&&33326!==l&&33327!==l&&33328!==l&&34842!==l&&34836!==l||e.get("EXT_color_buffer_float"),l}function A(t,e,n){return!0===S(t,n)||t.isFramebufferTexture&&1003!==t.minFilter&&1006!==t.minFilter?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function L(t){return 1003===t||1004===t||1005===t?9728:9729}function C(t){const e=t.target;e.removeEventListener("dispose",C),function(t){const e=i.get(t);if(void 0===e.__webglInit)return;const n=t.source,r=y.get(n);if(r){const i=r[e.__cacheKey];i.usedTimes--,0===i.usedTimes&&R(t),0===Object.keys(r).length&&y.delete(n)}i.remove(t)}(e),e.isVideoTexture&&g.delete(e)}function k(e){const n=e.target;n.removeEventListener("dispose",k),function(e){const n=e.texture,r=i.get(e),s=i.get(n);void 0!==s.__webglTexture&&(t.deleteTexture(s.__webglTexture),o.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(r.__webglFramebuffer[e]),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer[e]);else t.deleteFramebuffer(r.__webglFramebuffer),r.__webglDepthbuffer&&t.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&t.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer&&t.deleteRenderbuffer(r.__webglColorRenderbuffer),r.__webglDepthRenderbuffer&&t.deleteRenderbuffer(r.__webglDepthRenderbuffer);if(e.isWebGLMultipleRenderTargets)for(let e=0,r=n.length;e<r;e++){const r=i.get(n[e]);r.__webglTexture&&(t.deleteTexture(r.__webglTexture),o.memory.textures--),i.remove(n[e])}i.remove(n),i.remove(e)}(n)}function R(e){const n=i.get(e);t.deleteTexture(n.__webglTexture);const r=e.source;delete y.get(r)[n.__cacheKey],o.memory.textures--}let P=0;function I(t,e){const r=i.get(t);if(t.isVideoTexture&&function(t){const e=o.render.frame;g.get(t)!==e&&(g.set(t,e),t.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&r.__version!==t.version){const n=t.image;if(null===n)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==n.complete)return void H(r,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+e),n.bindTexture(3553,r.__webglTexture)}const N={1e3:10497,1001:33071,1002:33648},B={1003:9728,1004:9984,1005:9986,1006:9729,1007:9985,1008:9987};function z(n,s,o){if(o?(t.texParameteri(n,10242,N[s.wrapS]),t.texParameteri(n,10243,N[s.wrapT]),32879!==n&&35866!==n||t.texParameteri(n,32882,N[s.wrapR]),t.texParameteri(n,10240,B[s.magFilter]),t.texParameteri(n,10241,B[s.minFilter])):(t.texParameteri(n,10242,33071),t.texParameteri(n,10243,33071),32879!==n&&35866!==n||t.texParameteri(n,32882,33071),1001===s.wrapS&&1001===s.wrapT||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,10240,L(s.magFilter)),t.texParameteri(n,10241,L(s.minFilter)),1003!==s.minFilter&&1006!==s.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const o=e.get("EXT_texture_filter_anisotropic");if(1015===s.type&&!1===e.has("OES_texture_float_linear"))return;if(!1===a&&1016===s.type&&!1===e.has("OES_texture_half_float_linear"))return;(s.anisotropy>1||i.get(s).__currentAnisotropy)&&(t.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy)}}function O(e,n){let i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",C));const r=n.source;let s=y.get(r);void 0===s&&(s={},y.set(r,s));const a=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.encoding),e.join()}(n);if(a!==e.__cacheKey){void 0===s[a]&&(s[a]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,i=!0),s[a].usedTimes++;const r=s[e.__cacheKey];void 0!==r&&(s[e.__cacheKey].usedTimes--,0===r.usedTimes&&R(n)),e.__cacheKey=a,e.__webglTexture=s[a].texture}return i}function H(e,i,r){let o=3553;i.isDataArrayTexture&&(o=35866),i.isData3DTexture&&(o=32879);const l=O(e,i),h=i.source;if(n.activeTexture(33984+r),n.bindTexture(o,e.__webglTexture),h.version!==h.__currentVersion||!0===l){t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),t.pixelStorei(37443,0);const r=function(t){return!a&&(1001!==t.wrapS||1001!==t.wrapT||1003!==t.minFilter&&1006!==t.minFilter)}(i)&&!1===M(i.image);let l=b(i.image,r,!1,c);l=j(i,l);const d=M(l)||a,u=s.convert(i.format,i.encoding);let p,m=s.convert(i.type),f=T(i.internalFormat,u,m,i.encoding,i.isVideoTexture);z(o,i,d);const g=i.mipmaps,v=a&&!0!==i.isVideoTexture,y=void 0===e.__version,x=A(i,l,d);if(i.isDepthTexture)f=6402,a?f=1015===i.type?36012:1014===i.type?33190:1020===i.type?35056:33189:1015===i.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===i.format&&6402===f&&1012!==i.type&&1014!==i.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=1012,m=s.convert(i.type)),1027===i.format&&6402===f&&(f=34041,1020!==i.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=1020,m=s.convert(i.type))),v&&y?n.texStorage2D(3553,1,f,l.width,l.height):n.texImage2D(3553,0,f,l.width,l.height,0,u,m,null);else if(i.isDataTexture)if(g.length>0&&d){v&&y&&n.texStorage2D(3553,x,f,g[0].width,g[0].height);for(let t=0,e=g.length;t<e;t++)p=g[t],v?n.texSubImage2D(3553,t,0,0,p.width,p.height,u,m,p.data):n.texImage2D(3553,t,f,p.width,p.height,0,u,m,p.data);i.generateMipmaps=!1}else v?(y&&n.texStorage2D(3553,x,f,l.width,l.height),n.texSubImage2D(3553,0,0,0,l.width,l.height,u,m,l.data)):n.texImage2D(3553,0,f,l.width,l.height,0,u,m,l.data);else if(i.isCompressedTexture){v&&y&&n.texStorage2D(3553,x,f,g[0].width,g[0].height);for(let t=0,e=g.length;t<e;t++)p=g[t],1023!==i.format?null!==u?v?n.compressedTexSubImage2D(3553,t,0,0,p.width,p.height,u,p.data):n.compressedTexImage2D(3553,t,f,p.width,p.height,0,p.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):v?n.texSubImage2D(3553,t,0,0,p.width,p.height,u,m,p.data):n.texImage2D(3553,t,f,p.width,p.height,0,u,m,p.data)}else if(i.isDataArrayTexture)v?(y&&n.texStorage3D(35866,x,f,l.width,l.height,l.depth),n.texSubImage3D(35866,0,0,0,0,l.width,l.height,l.depth,u,m,l.data)):n.texImage3D(35866,0,f,l.width,l.height,l.depth,0,u,m,l.data);else if(i.isData3DTexture)v?(y&&n.texStorage3D(32879,x,f,l.width,l.height,l.depth),n.texSubImage3D(32879,0,0,0,0,l.width,l.height,l.depth,u,m,l.data)):n.texImage3D(32879,0,f,l.width,l.height,l.depth,0,u,m,l.data);else if(i.isFramebufferTexture)v&&y?n.texStorage2D(3553,x,f,l.width,l.height):n.texImage2D(3553,0,f,l.width,l.height,0,u,m,null);else if(g.length>0&&d){v&&y&&n.texStorage2D(3553,x,f,g[0].width,g[0].height);for(let t=0,e=g.length;t<e;t++)p=g[t],v?n.texSubImage2D(3553,t,0,0,u,m,p):n.texImage2D(3553,t,f,u,m,p);i.generateMipmaps=!1}else v?(y&&n.texStorage2D(3553,x,f,l.width,l.height),n.texSubImage2D(3553,0,0,0,u,m,l)):n.texImage2D(3553,0,f,u,m,l);S(i,d)&&E(o),h.__currentVersion=h.version,i.onUpdate&&i.onUpdate(i)}e.__version=i.version}function U(e,r,o,a,l){const h=s.convert(o.format,o.encoding),c=s.convert(o.type),d=T(o.internalFormat,h,c,o.encoding);i.get(r).__hasExternalTextures||(32879===l||35866===l?n.texImage3D(l,0,d,r.width,r.height,r.depth,0,h,c,null):n.texImage2D(l,0,d,r.width,r.height,0,h,c,null)),n.bindFramebuffer(36160,e),W(r)?m.framebufferTexture2DMultisampleEXT(36160,a,l,i.get(o).__webglTexture,0,V(r)):t.framebufferTexture2D(36160,a,l,i.get(o).__webglTexture,0),n.bindFramebuffer(36160,null)}function F(e,n,i){if(t.bindRenderbuffer(36161,e),n.depthBuffer&&!n.stencilBuffer){let r=33189;if(i||W(n)){const e=n.depthTexture;e&&e.isDepthTexture&&(1015===e.type?r=36012:1014===e.type&&(r=33190));const i=V(n);W(n)?m.renderbufferStorageMultisampleEXT(36161,i,r,n.width,n.height):t.renderbufferStorageMultisample(36161,i,r,n.width,n.height)}else t.renderbufferStorage(36161,r,n.width,n.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(n.depthBuffer&&n.stencilBuffer){const r=V(n);i&&!1===W(n)?t.renderbufferStorageMultisample(36161,r,35056,n.width,n.height):W(n)?m.renderbufferStorageMultisampleEXT(36161,r,35056,n.width,n.height):t.renderbufferStorage(36161,34041,n.width,n.height),t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===n.isWebGLMultipleRenderTargets?n.texture[0]:n.texture,r=s.convert(e.format,e.encoding),o=s.convert(e.type),a=T(e.internalFormat,r,o,e.encoding),l=V(n);i&&!1===W(n)?t.renderbufferStorageMultisample(36161,l,a,n.width,n.height):W(n)?m.renderbufferStorageMultisampleEXT(36161,l,a,n.width,n.height):t.renderbufferStorage(36161,a,n.width,n.height)}t.bindRenderbuffer(36161,null)}function G(e){const r=i.get(e),s=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture&&!r.__autoAllocateDepthBuffer){if(s)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(36160,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");i.get(r.depthTexture).__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),I(r.depthTexture,0);const s=i.get(r.depthTexture).__webglTexture,o=V(r);if(1026===r.depthTexture.format)W(r)?m.framebufferTexture2DMultisampleEXT(36160,36096,3553,s,0,o):t.framebufferTexture2D(36160,36096,3553,s,0);else{if(1027!==r.depthTexture.format)throw new Error("Unknown depthTexture format");W(r)?m.framebufferTexture2DMultisampleEXT(36160,33306,3553,s,0,o):t.framebufferTexture2D(36160,33306,3553,s,0)}}(r.__webglFramebuffer,e)}else if(s){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)n.bindFramebuffer(36160,r.__webglFramebuffer[i]),r.__webglDepthbuffer[i]=t.createRenderbuffer(),F(r.__webglDepthbuffer[i],e,!1)}else n.bindFramebuffer(36160,r.__webglFramebuffer),r.__webglDepthbuffer=t.createRenderbuffer(),F(r.__webglDepthbuffer,e,!1);n.bindFramebuffer(36160,null)}function V(t){return Math.min(u,t.samples)}function W(t){const n=i.get(t);return a&&t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function j(t,n){const i=t.encoding,r=t.format,s=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||1035===t.format||3e3!==i&&(3001===i?!1===a?!0===e.has("EXT_sRGB")&&1023===r?(t.format=1035,t.minFilter=1006,t.generateMipmaps=!1):n=D.sRGBToLinear(n):1023===r&&1009===s||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",i)),n}this.allocateTextureUnit=function(){const t=P;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),P+=1,t},this.resetTextureUnits=function(){P=0},this.setTexture2D=I,this.setTexture2DArray=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?H(r,t,e):(n.activeTexture(33984+e),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(t,e){const r=i.get(t);t.version>0&&r.__version!==t.version?H(r,t,e):(n.activeTexture(33984+e),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=function(e,r){const o=i.get(e);e.version>0&&o.__version!==e.version?function(e,i,r){if(6!==i.image.length)return;const o=O(e,i),l=i.source;if(n.activeTexture(33984+r),n.bindTexture(34067,e.__webglTexture),l.version!==l.__currentVersion||!0===o){t.pixelStorei(37440,i.flipY),t.pixelStorei(37441,i.premultiplyAlpha),t.pixelStorei(3317,i.unpackAlignment),t.pixelStorei(37443,0);const r=i.isCompressedTexture||i.image[0].isCompressedTexture,o=i.image[0]&&i.image[0].isDataTexture,c=[];for(let t=0;t<6;t++)c[t]=r||o?o?i.image[t].image:i.image[t]:b(i.image[t],!1,!0,h),c[t]=j(i,c[t]);const d=c[0],u=M(d)||a,p=s.convert(i.format,i.encoding),m=s.convert(i.type),f=T(i.internalFormat,p,m,i.encoding),g=a&&!0!==i.isVideoTexture,v=void 0===e.__version;let y,x=A(i,d,u);if(z(34067,i,u),r){g&&v&&n.texStorage2D(34067,x,f,d.width,d.height);for(let t=0;t<6;t++){y=c[t].mipmaps;for(let e=0;e<y.length;e++){const r=y[e];1023!==i.format?null!==p?g?n.compressedTexSubImage2D(34069+t,e,0,0,r.width,r.height,p,r.data):n.compressedTexImage2D(34069+t,e,f,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):g?n.texSubImage2D(34069+t,e,0,0,r.width,r.height,p,m,r.data):n.texImage2D(34069+t,e,f,r.width,r.height,0,p,m,r.data)}}}else{y=i.mipmaps,g&&v&&(y.length>0&&x++,n.texStorage2D(34067,x,f,c[0].width,c[0].height));for(let t=0;t<6;t++)if(o){g?n.texSubImage2D(34069+t,0,0,0,c[t].width,c[t].height,p,m,c[t].data):n.texImage2D(34069+t,0,f,c[t].width,c[t].height,0,p,m,c[t].data);for(let e=0;e<y.length;e++){const i=y[e].image[t].image;g?n.texSubImage2D(34069+t,e+1,0,0,i.width,i.height,p,m,i.data):n.texImage2D(34069+t,e+1,f,i.width,i.height,0,p,m,i.data)}}else{g?n.texSubImage2D(34069+t,0,0,0,p,m,c[t]):n.texImage2D(34069+t,0,f,p,m,c[t]);for(let e=0;e<y.length;e++){const i=y[e];g?n.texSubImage2D(34069+t,e+1,0,0,p,m,i.image[t]):n.texImage2D(34069+t,e+1,f,p,m,i.image[t])}}}S(i,u)&&E(34067),l.__currentVersion=l.version,i.onUpdate&&i.onUpdate(i)}e.__version=i.version}(o,e,r):(n.activeTexture(33984+r),n.bindTexture(34067,o.__webglTexture))},this.rebindTextures=function(t,e,n){const r=i.get(t);void 0!==e&&U(r.__webglFramebuffer,t,t.texture,36064,3553),void 0!==n&&G(t)},this.setupRenderTarget=function(e){const l=e.texture,h=i.get(e),c=i.get(l);e.addEventListener("dispose",k),!0!==e.isWebGLMultipleRenderTargets&&(void 0===c.__webglTexture&&(c.__webglTexture=t.createTexture()),c.__version=l.version,o.memory.textures++);const d=!0===e.isWebGLCubeRenderTarget,u=!0===e.isWebGLMultipleRenderTargets,p=M(e)||a;if(d){h.__webglFramebuffer=[];for(let e=0;e<6;e++)h.__webglFramebuffer[e]=t.createFramebuffer()}else if(h.__webglFramebuffer=t.createFramebuffer(),u)if(r.drawBuffers){const n=e.texture;for(let e=0,r=n.length;e<r;e++){const r=i.get(n[e]);void 0===r.__webglTexture&&(r.__webglTexture=t.createTexture(),o.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(a&&e.samples>0&&!1===W(e)){h.__webglMultisampledFramebuffer=t.createFramebuffer(),h.__webglColorRenderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,h.__webglColorRenderbuffer);const i=s.convert(l.format,l.encoding),r=s.convert(l.type),o=T(l.internalFormat,i,r,l.encoding),a=V(e);t.renderbufferStorageMultisample(36161,a,o,e.width,e.height),n.bindFramebuffer(36160,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064,36161,h.__webglColorRenderbuffer),t.bindRenderbuffer(36161,null),e.depthBuffer&&(h.__webglDepthRenderbuffer=t.createRenderbuffer(),F(h.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(36160,null)}if(d){n.bindTexture(34067,c.__webglTexture),z(34067,l,p);for(let t=0;t<6;t++)U(h.__webglFramebuffer[t],e,l,36064,34069+t);S(l,p)&&E(34067),n.unbindTexture()}else if(u){const t=e.texture;for(let r=0,s=t.length;r<s;r++){const s=t[r],o=i.get(s);n.bindTexture(3553,o.__webglTexture),z(3553,s,p),U(h.__webglFramebuffer,e,s,36064+r,3553),S(s,p)&&E(3553)}n.unbindTexture()}else{let t=3553;(e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(a?t=e.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),n.bindTexture(t,c.__webglTexture),z(t,l,p),U(h.__webglFramebuffer,e,l,36064,t),S(l,p)&&E(t),n.unbindTexture()}e.depthBuffer&&G(e)},this.updateRenderTargetMipmap=function(t){const e=M(t)||a,r=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture];for(let s=0,o=r.length;s<o;s++){const o=r[s];if(S(o,e)){const e=t.isWebGLCubeRenderTarget?34067:3553,r=i.get(o).__webglTexture;n.bindTexture(e,r),E(e),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(a&&e.samples>0&&!1===W(e)){const r=e.width,s=e.height;let o=16384;const a=[36064],l=e.stencilBuffer?33306:36096;e.depthBuffer&&a.push(l);const h=i.get(e),c=void 0!==h.__ignoreDepthValues&&h.__ignoreDepthValues;!1===c&&(e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024)),n.bindFramebuffer(36008,h.__webglMultisampledFramebuffer),n.bindFramebuffer(36009,h.__webglFramebuffer),!0===c&&(t.invalidateFramebuffer(36008,[l]),t.invalidateFramebuffer(36009,[l])),t.blitFramebuffer(0,0,r,s,0,0,r,s,o,9728),f&&t.invalidateFramebuffer(36008,a),n.bindFramebuffer(36008,null),n.bindFramebuffer(36009,h.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=G,this.setupFrameBufferTexture=U,this.useMultisampledRTT=W}function zr(t,e,n){const i=n.isWebGL2;return{convert:function(t,n=null){let r;if(1009===t)return 5121;if(1017===t)return 32819;if(1018===t)return 32820;if(1010===t)return 5120;if(1011===t)return 5122;if(1012===t)return 5123;if(1013===t)return 5124;if(1014===t)return 5125;if(1015===t)return 5126;if(1016===t)return i?5131:(r=e.get("OES_texture_half_float"),null!==r?r.HALF_FLOAT_OES:null);if(1021===t)return 6406;if(1023===t)return 6408;if(1024===t)return 6409;if(1025===t)return 6410;if(1026===t)return 6402;if(1027===t)return 34041;if(1028===t)return 6403;if(1022===t)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(1035===t)return r=e.get("EXT_sRGB"),null!==r?r.SRGB_ALPHA_EXT:null;if(1029===t)return 36244;if(1030===t)return 33319;if(1031===t)return 33320;if(1033===t)return 36249;if(33776===t||33777===t||33778===t||33779===t)if(3001===n){if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(33776===t)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===t)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===t)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===t)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=e.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(33776===t)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===t)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===t)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===t)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===t||35841===t||35842===t||35843===t){if(r=e.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(35840===t)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===t)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===t)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===t)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===t)return r=e.get("WEBGL_compressed_texture_etc1"),null!==r?r.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===t||37496===t){if(r=e.get("WEBGL_compressed_texture_etc"),null===r)return null;if(37492===t)return 3001===n?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(37496===t)return 3001===n?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(37808===t||37809===t||37810===t||37811===t||37812===t||37813===t||37814===t||37815===t||37816===t||37817===t||37818===t||37819===t||37820===t||37821===t){if(r=e.get("WEBGL_compressed_texture_astc"),null===r)return null;if(37808===t)return 3001===n?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===t)return 3001===n?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===t)return 3001===n?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===t)return 3001===n?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===t)return 3001===n?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===t)return 3001===n?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===t)return 3001===n?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===t)return 3001===n?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===t)return 3001===n?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===t)return 3001===n?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===t)return 3001===n?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===t)return 3001===n?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===t)return 3001===n?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===t)return 3001===n?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===t){if(r=e.get("EXT_texture_compression_bptc"),null===r)return null;if(36492===t)return 3001===n?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT}return 1020===t?i?34042:(r=e.get("WEBGL_depth_texture"),null!==r?r.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class Or extends en{constructor(t=[]){super(),this.cameras=t}}Or.prototype.isArrayCamera=!0;class Hr extends Xt{constructor(){super(),this.type="Group"}}Hr.prototype.isGroup=!0;const Ur={type:"move"};class Fr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Hr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Hr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new q,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new q),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Hr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new q,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new q),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,n){let i=null,r=null,s=null;const o=this._targetRay,a=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState)if(null!==o&&(i=e.getPose(t.targetRaySpace,n),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Ur))),l&&t.hand){s=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,n);if(void 0===l.joints[i.jointName]){const t=new Hr;t.matrixAutoUpdate=!1,t.visible=!1,l.joints[i.jointName]=t,l.add(t)}const r=l.joints[i.jointName];null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.jointRadius=t.radius),r.visible=null!==t}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],o=i.position.distanceTo(r.position),a=.02,h=.005;l.inputState.pinching&&o>a+h?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&o<=a-h&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==a&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));return null!==o&&(o.visible=null!==i),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==s),this}}class Gr extends z{constructor(t,e,n,i,r,s,o,a,l,h){if(1026!==(h=void 0!==h?h:1026)&&1027!==h)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&1026===h&&(n=1012),void 0===n&&1027===h&&(n=1020),super(null,i,r,s,o,a,h,n,l),this.image={width:t,height:e},this.magFilter=void 0!==o?o:1003,this.minFilter=void 0!==a?a:1003,this.flipY=!1,this.generateMipmaps=!1}}Gr.prototype.isDepthTexture=!0;class Vr extends n{constructor(t,e){super();const n=this;let i=null,r=1,s=null,o="local-floor",a=null,l=null,h=null,c=null,d=null;const u=e.getContextAttributes();let p=null,m=null;const f=[],g=new Map,v=new en;v.layers.enable(1),v.viewport=new O;const y=new en;y.layers.enable(2),y.viewport=new O;const x=[v,y],_=new Or;_.layers.enable(1),_.layers.enable(2);let w=null,b=null;function M(t){const e=g.get(t.inputSource);e&&e.dispatchEvent({type:t.type,data:t.inputSource})}function S(){g.forEach((function(t,e){t.disconnect(e)})),g.clear(),w=null,b=null,t.setRenderTarget(p),c=null,h=null,l=null,i=null,m=null,k.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}function E(t){const e=i.inputSources;for(let t=0;t<f.length;t++)g.set(e[t],f[t]);for(let e=0;e<t.removed.length;e++){const n=t.removed[e],i=g.get(n);i&&(i.dispatchEvent({type:"disconnected",data:n}),g.delete(n))}for(let e=0;e<t.added.length;e++){const n=t.added[e],i=g.get(n);i&&i.dispatchEvent({type:"connected",data:n})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=f[t];return void 0===e&&(e=new Fr,f[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=f[t];return void 0===e&&(e=new Fr,f[t]=e),e.getGripSpace()},this.getHand=function(t){let e=f[t];return void 0===e&&(e=new Fr,f[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){o=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return s},this.getBaseLayer=function(){return null!==h?h:c},this.getBinding=function(){return l},this.getFrame=function(){return d},this.getSession=function(){return i},this.setSession=async function(a){if(i=a,null!==i){if(p=t.getRenderTarget(),i.addEventListener("select",M),i.addEventListener("selectstart",M),i.addEventListener("selectend",M),i.addEventListener("squeeze",M),i.addEventListener("squeezestart",M),i.addEventListener("squeezeend",M),i.addEventListener("end",S),i.addEventListener("inputsourceschange",E),!0!==u.xrCompatible&&await e.makeXRCompatible(),void 0===i.renderState.layers||!1===t.capabilities.isWebGL2){const n={antialias:void 0!==i.renderState.layers||u.antialias,alpha:u.alpha,depth:u.depth,stencil:u.stencil,framebufferScaleFactor:r};c=new XRWebGLLayer(i,e,n),i.updateRenderState({baseLayer:c}),m=new H(c.framebufferWidth,c.framebufferHeight,{format:1023,type:1009,encoding:t.outputEncoding})}else{let n=null,s=null,o=null;u.depth&&(o=u.stencil?35056:33190,n=u.stencil?1027:1026,s=u.stencil?1020:1012);const a={colorFormat:3001===t.outputEncoding?35907:32856,depthFormat:o,scaleFactor:r};l=new XRWebGLBinding(i,e),h=l.createProjectionLayer(a),i.updateRenderState({layers:[h]}),m=new H(h.textureWidth,h.textureHeight,{format:1023,type:1009,depthTexture:new Gr(h.textureWidth,h.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:u.stencil,encoding:t.outputEncoding,samples:u.antialias?4:0});t.properties.get(m).__ignoreDepthValues=h.ignoreDepthValues}m.isXRRenderTarget=!0,this.setFoveation(1),s=await i.requestReferenceSpace(o),k.setContext(i),k.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}};const T=new q,A=new q;function L(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===i)return;_.near=y.near=v.near=t.near,_.far=y.far=v.far=t.far,w===_.near&&b===_.far||(i.updateRenderState({depthNear:_.near,depthFar:_.far}),w=_.near,b=_.far);const e=t.parent,n=_.cameras;L(_,e);for(let t=0;t<n.length;t++)L(n[t],e);_.matrixWorld.decompose(_.position,_.quaternion,_.scale),t.position.copy(_.position),t.quaternion.copy(_.quaternion),t.scale.copy(_.scale),t.matrix.copy(_.matrix),t.matrixWorld.copy(_.matrixWorld);const r=t.children;for(let t=0,e=r.length;t<e;t++)r[t].updateMatrixWorld(!0);2===n.length?function(t,e,n){T.setFromMatrixPosition(e.matrixWorld),A.setFromMatrixPosition(n.matrixWorld);const i=T.distanceTo(A),r=e.projectionMatrix.elements,s=n.projectionMatrix.elements,o=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],h=(r[9]-1)/r[5],c=(r[8]-1)/r[0],d=(s[8]+1)/s[0],u=o*c,p=o*d,m=i/(-c+d),f=m*-c;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(f),t.translateZ(m),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=o+m,v=a+m,y=u-f,x=p+(i-f),_=l*a/v*g,w=h*a/v*g;t.projectionMatrix.makePerspective(y,x,_,w,g,v)}(_,v,y):_.projectionMatrix.copy(v.projectionMatrix)},this.getCamera=function(){return _},this.getFoveation=function(){return null!==h?h.fixedFoveation:null!==c?c.fixedFoveation:void 0},this.setFoveation=function(t){null!==h&&(h.fixedFoveation=t),null!==c&&void 0!==c.fixedFoveation&&(c.fixedFoveation=t)};let C=null;const k=new pn;k.setAnimationLoop((function(e,n){if(a=n.getViewerPose(s),d=n,null!==a){const e=a.views;null!==c&&(t.setRenderTargetFramebuffer(m,c.framebuffer),t.setRenderTarget(m));let n=!1;e.length!==_.cameras.length&&(_.cameras.length=0,n=!0);for(let i=0;i<e.length;i++){const r=e[i];let s=null;if(null!==c)s=c.getViewport(r);else{const e=l.getViewSubImage(h,r);s=e.viewport,0===i&&(t.setRenderTargetTextures(m,e.colorTexture,h.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(m))}const o=x[i];o.matrix.fromArray(r.transform.matrix),o.projectionMatrix.fromArray(r.projectionMatrix),o.viewport.set(s.x,s.y,s.width,s.height),0===i&&_.matrix.copy(o.matrix),!0===n&&_.cameras.push(o)}}const r=i.inputSources;for(let t=0;t<f.length;t++){const e=f[t],i=r[t];e.update(i,n,s)}C&&C(e,n),d=null})),this.setAnimationLoop=function(t){C=t},this.dispose=function(){}}}function Wr(t,e){function n(n,i){n.opacity.value=i.opacity,i.color&&n.diffuse.value.copy(i.color),i.emissive&&n.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(n.map.value=i.map),i.alphaMap&&(n.alphaMap.value=i.alphaMap),i.bumpMap&&(n.bumpMap.value=i.bumpMap,n.bumpScale.value=i.bumpScale,1===i.side&&(n.bumpScale.value*=-1)),i.displacementMap&&(n.displacementMap.value=i.displacementMap,n.displacementScale.value=i.displacementScale,n.displacementBias.value=i.displacementBias),i.emissiveMap&&(n.emissiveMap.value=i.emissiveMap),i.normalMap&&(n.normalMap.value=i.normalMap,n.normalScale.value.copy(i.normalScale),1===i.side&&n.normalScale.value.negate()),i.specularMap&&(n.specularMap.value=i.specularMap),i.alphaTest>0&&(n.alphaTest.value=i.alphaTest);const r=e.get(i).envMap;if(r&&(n.envMap.value=r,n.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,n.reflectivity.value=i.reflectivity,n.ior.value=i.ior,n.refractionRatio.value=i.refractionRatio),i.lightMap){n.lightMap.value=i.lightMap;const e=!0!==t.physicallyCorrectLights?Math.PI:1;n.lightMapIntensity.value=i.lightMapIntensity*e}let s,o;i.aoMap&&(n.aoMap.value=i.aoMap,n.aoMapIntensity.value=i.aoMapIntensity),i.map?s=i.map:i.specularMap?s=i.specularMap:i.displacementMap?s=i.displacementMap:i.normalMap?s=i.normalMap:i.bumpMap?s=i.bumpMap:i.roughnessMap?s=i.roughnessMap:i.metalnessMap?s=i.metalnessMap:i.alphaMap?s=i.alphaMap:i.emissiveMap?s=i.emissiveMap:i.clearcoatMap?s=i.clearcoatMap:i.clearcoatNormalMap?s=i.clearcoatNormalMap:i.clearcoatRoughnessMap?s=i.clearcoatRoughnessMap:i.specularIntensityMap?s=i.specularIntensityMap:i.specularColorMap?s=i.specularColorMap:i.transmissionMap?s=i.transmissionMap:i.thicknessMap?s=i.thicknessMap:i.sheenColorMap?s=i.sheenColorMap:i.sheenRoughnessMap&&(s=i.sheenRoughnessMap),void 0!==s&&(s.isWebGLRenderTarget&&(s=s.texture),!0===s.matrixAutoUpdate&&s.updateMatrix(),n.uvTransform.value.copy(s.matrix)),i.aoMap?o=i.aoMap:i.lightMap&&(o=i.lightMap),void 0!==o&&(o.isWebGLRenderTarget&&(o=o.texture),!0===o.matrixAutoUpdate&&o.updateMatrix(),n.uv2Transform.value.copy(o.matrix))}return{refreshFogUniforms:function(t,e){t.fogColor.value.copy(e.color),e.isFog?(t.fogNear.value=e.near,t.fogFar.value=e.far):e.isFogExp2&&(t.fogDensity.value=e.density)},refreshMaterialUniforms:function(t,i,r,s,o){i.isMeshBasicMaterial||i.isMeshLambertMaterial?n(t,i):i.isMeshToonMaterial?(n(t,i),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,i)):i.isMeshPhongMaterial?(n(t,i),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,i)):i.isMeshStandardMaterial?(n(t,i),function(t,n){t.roughness.value=n.roughness,t.metalness.value=n.metalness,n.roughnessMap&&(t.roughnessMap.value=n.roughnessMap);n.metalnessMap&&(t.metalnessMap.value=n.metalnessMap);e.get(n).envMap&&(t.envMapIntensity.value=n.envMapIntensity)}(t,i),i.isMeshPhysicalMaterial&&function(t,e,n){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap));e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap),e.clearcoatNormalMap&&(t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),t.clearcoatNormalMap.value=e.clearcoatNormalMap,1===e.side&&t.clearcoatNormalScale.value.negate()));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap);e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap)}(t,i,o)):i.isMeshMatcapMaterial?(n(t,i),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,i)):i.isMeshDepthMaterial?n(t,i):i.isMeshDistanceMaterial?(n(t,i),function(t,e){t.referencePosition.value.copy(e.referencePosition),t.nearDistance.value=e.nearDistance,t.farDistance.value=e.farDistance}(t,i)):i.isMeshNormalMaterial?n(t,i):i.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity}(t,i),i.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,i)):i.isPointsMaterial?function(t,e,n,i){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*i,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let r;e.map?r=e.map:e.alphaMap&&(r=e.alphaMap);void 0!==r&&(!0===r.matrixAutoUpdate&&r.updateMatrix(),t.uvTransform.value.copy(r.matrix))}(t,i,r,s):i.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map);e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest);let n;e.map?n=e.map:e.alphaMap&&(n=e.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),t.uvTransform.value.copy(n.matrix))}(t,i):i.isShadowMaterial?(t.color.value.copy(i.color),t.opacity.value=i.opacity):i.isShaderMaterial&&(i.uniformsNeedUpdate=!1)}}}function jr(t={}){const e=void 0!==t.canvas?t.canvas:function(){const t=_("canvas");return t.style.display="block",t}(),n=void 0!==t.context?t.context:null,i=void 0===t.depth||t.depth,r=void 0===t.stencil||t.stencil,s=void 0!==t.antialias&&t.antialias,o=void 0===t.premultipliedAlpha||t.premultipliedAlpha,a=void 0!==t.preserveDrawingBuffer&&t.preserveDrawingBuffer,l=void 0!==t.powerPreference?t.powerPreference:"default",h=void 0!==t.failIfMajorPerformanceCaveat&&t.failIfMajorPerformanceCaveat;let c;c=void 0!==t.context?n.getContextAttributes().alpha:void 0!==t.alpha&&t.alpha;let d=null,u=null;const m=[],g=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=3e3,this.physicallyCorrectLights=!1,this.toneMapping=0,this.toneMappingExposure=1;const v=this;let y=!1,x=0,w=0,b=null,M=-1,S=null;const E=new O,T=new O;let A=null,L=e.width,C=e.height,k=1,R=null,P=null;const D=new O(0,0,L,C),I=new O(0,0,L,C);let N=!1;const B=new un;let z=!1,U=!1,F=null;const G=new Mt,V=new f,W=new q,j={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Z(){return null===b?k:1}let X,Y,J,$,K,Q,tt,et,nt,it,rt,st,ot,at,lt,ht,ct,dt,ut,pt,mt,ft,gt,vt=n;function yt(t,n){for(let i=0;i<t.length;i++){const r=t[i],s=e.getContext(r,n);if(null!==s)return s}return null}try{const t={alpha:!0,depth:i,stencil:r,antialias:s,premultipliedAlpha:o,preserveDrawingBuffer:a,powerPreference:l,failIfMajorPerformanceCaveat:h};if("setAttribute"in e&&e.setAttribute("data-engine","three.js r139"),e.addEventListener("webglcontextlost",wt,!1),e.addEventListener("webglcontextrestored",bt,!1),null===vt){const e=["webgl2","webgl","experimental-webgl"];if(!0===v.isWebGL1Renderer&&e.shift(),vt=yt(e,t),null===vt)throw yt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===vt.getShaderPrecisionFormat&&(vt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function xt(){X=new Un(vt),Y=new bn(vt,X,t),X.init(Y),ft=new zr(vt,X,Y),J=new Nr(vt,X,Y),$=new Vn(vt),K=new wr,Q=new Br(vt,X,J,K,Y,ft,$),tt=new Sn(v),et=new Hn(v),nt=new mn(vt,Y),gt=new _n(vt,X,nt,Y),it=new Fn(vt,nt,$,gt),rt=new Xn(vt,it,nt,$),ut=new Zn(vt,Y,Q),ht=new Mn(K),st=new _r(v,tt,et,X,Y,gt,ht),ot=new Wr(v,K),at=new Er,lt=new Rr(X,Y),dt=new xn(v,tt,J,rt,c,o),ct=new Ir(v,rt,Y),pt=new wn(vt,X,$,Y),mt=new Gn(vt,X,$,Y),$.programs=st.programs,v.capabilities=Y,v.extensions=X,v.properties=K,v.renderLists=at,v.shadowMap=ct,v.state=J,v.info=$}xt();const _t=new Vr(v,vt);function wt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),y=!0}function bt(){console.log("THREE.WebGLRenderer: Context Restored."),y=!1;const t=$.autoReset,e=ct.enabled,n=ct.autoUpdate,i=ct.needsUpdate,r=ct.type;xt(),$.autoReset=t,ct.enabled=e,ct.autoUpdate=n,ct.needsUpdate=i,ct.type=r}function St(t){const e=t.target;e.removeEventListener("dispose",St),function(t){(function(t){const e=K.get(t).programs;void 0!==e&&(e.forEach((function(t){st.releaseProgram(t)})),t.isShaderMaterial&&st.releaseShaderCache(t))})(t),K.remove(t)}(e)}this.xr=_t,this.getContext=function(){return vt},this.getContextAttributes=function(){return vt.getContextAttributes()},this.forceContextLoss=function(){const t=X.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=X.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return k},this.setPixelRatio=function(t){void 0!==t&&(k=t,this.setSize(L,C,!1))},this.getSize=function(t){return t.set(L,C)},this.setSize=function(t,n,i){_t.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(L=t,C=n,e.width=Math.floor(t*k),e.height=Math.floor(n*k),!1!==i&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return t.set(L*k,C*k).floor()},this.setDrawingBufferSize=function(t,n,i){L=t,C=n,k=i,e.width=Math.floor(t*i),e.height=Math.floor(n*i),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return t.copy(E)},this.getViewport=function(t){return t.copy(D)},this.setViewport=function(t,e,n,i){t.isVector4?D.set(t.x,t.y,t.z,t.w):D.set(t,e,n,i),J.viewport(E.copy(D).multiplyScalar(k).floor())},this.getScissor=function(t){return t.copy(I)},this.setScissor=function(t,e,n,i){t.isVector4?I.set(t.x,t.y,t.z,t.w):I.set(t,e,n,i),J.scissor(T.copy(I).multiplyScalar(k).floor())},this.getScissorTest=function(){return N},this.setScissorTest=function(t){J.setScissorTest(N=t)},this.setOpaqueSort=function(t){R=t},this.setTransparentSort=function(t){P=t},this.getClearColor=function(t){return t.copy(dt.getClearColor())},this.setClearColor=function(){dt.setClearColor.apply(dt,arguments)},this.getClearAlpha=function(){return dt.getClearAlpha()},this.setClearAlpha=function(){dt.setClearAlpha.apply(dt,arguments)},this.clear=function(t=!0,e=!0,n=!0){let i=0;t&&(i|=16384),e&&(i|=256),n&&(i|=1024),vt.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",wt,!1),e.removeEventListener("webglcontextrestored",bt,!1),at.dispose(),lt.dispose(),K.dispose(),tt.dispose(),et.dispose(),rt.dispose(),gt.dispose(),st.dispose(),_t.dispose(),_t.removeEventListener("sessionstart",Tt),_t.removeEventListener("sessionend",At),F&&(F.dispose(),F=null),Lt.stop()},this.renderBufferDirect=function(t,e,n,i,r,s){null===e&&(e=j);const o=r.isMesh&&r.matrixWorld.determinant()<0,a=function(t,e,n,i,r){!0!==e.isScene&&(e=j);Q.resetTextureUnits();const s=e.fog,o=i.isMeshStandardMaterial?e.environment:null,a=null===b?v.outputEncoding:!0===b.isXRRenderTarget?b.texture.encoding:3e3,l=(i.isMeshStandardMaterial?et:tt).get(i.envMap||o),h=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,c=!!i.normalMap&&!!n.attributes.tangent,d=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,m=!!n.morphAttributes.color,f=i.toneMapped?v.toneMapping:0,g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,y=void 0!==g?g.length:0,x=K.get(i),_=u.state.lights;if(!0===z&&(!0===U||t!==S)){const e=t===S&&i.id===M;ht.setState(i,t,e)}let w=!1;i.version===x.__version?x.needsLights&&x.lightsStateVersion!==_.state.version||x.outputEncoding!==a||r.isInstancedMesh&&!1===x.instancing?w=!0:r.isInstancedMesh||!0!==x.instancing?r.isSkinnedMesh&&!1===x.skinning?w=!0:r.isSkinnedMesh||!0!==x.skinning?x.envMap!==l||i.fog&&x.fog!==s?w=!0:void 0===x.numClippingPlanes||x.numClippingPlanes===ht.numPlanes&&x.numIntersection===ht.numIntersection?(x.vertexAlphas!==h||x.vertexTangents!==c||x.morphTargets!==d||x.morphNormals!==p||x.morphColors!==m||x.toneMapping!==f||!0===Y.isWebGL2&&x.morphTargetsCount!==y)&&(w=!0):w=!0:w=!0:w=!0:(w=!0,x.__version=i.version);let E=x.currentProgram;!0===w&&(E=Dt(i,e,r));let T=!1,A=!1,L=!1;const R=E.getUniforms(),P=x.uniforms;J.useProgram(E.program)&&(T=!0,A=!0,L=!0);i.id!==M&&(M=i.id,A=!0);if(T||S!==t){if(R.setValue(vt,"projectionMatrix",t.projectionMatrix),Y.logarithmicDepthBuffer&&R.setValue(vt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),S!==t&&(S=t,A=!0,L=!0),i.isShaderMaterial||i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshStandardMaterial||i.envMap){const e=R.map.cameraPosition;void 0!==e&&e.setValue(vt,W.setFromMatrixPosition(t.matrixWorld))}(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&R.setValue(vt,"isOrthographic",!0===t.isOrthographicCamera),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial||i.isShadowMaterial||r.isSkinnedMesh)&&R.setValue(vt,"viewMatrix",t.matrixWorldInverse)}if(r.isSkinnedMesh){R.setOptional(vt,r,"bindMatrix"),R.setOptional(vt,r,"bindMatrixInverse");const t=r.skeleton;t&&(Y.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),R.setValue(vt,"boneTexture",t.boneTexture,Q),R.setValue(vt,"boneTextureSize",t.boneTextureSize)):R.setOptional(vt,t,"boneMatrices"))}const D=n.morphAttributes;(void 0!==D.position||void 0!==D.normal||void 0!==D.color&&!0===Y.isWebGL2)&&ut.update(r,n,i,E);(A||x.receiveShadow!==r.receiveShadow)&&(x.receiveShadow=r.receiveShadow,R.setValue(vt,"receiveShadow",r.receiveShadow));A&&(R.setValue(vt,"toneMappingExposure",v.toneMappingExposure),x.needsLights&&(N=L,(I=P).ambientLightColor.needsUpdate=N,I.lightProbe.needsUpdate=N,I.directionalLights.needsUpdate=N,I.directionalLightShadows.needsUpdate=N,I.pointLights.needsUpdate=N,I.pointLightShadows.needsUpdate=N,I.spotLights.needsUpdate=N,I.spotLightShadows.needsUpdate=N,I.rectAreaLights.needsUpdate=N,I.hemisphereLights.needsUpdate=N),s&&i.fog&&ot.refreshFogUniforms(P,s),ot.refreshMaterialUniforms(P,i,k,C,F),Ki.upload(vt,x.uniformsList,P,Q));var I,N;i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Ki.upload(vt,x.uniformsList,P,Q),i.uniformsNeedUpdate=!1);i.isSpriteMaterial&&R.setValue(vt,"center",r.center);return R.setValue(vt,"modelViewMatrix",r.modelViewMatrix),R.setValue(vt,"normalMatrix",r.normalMatrix),R.setValue(vt,"modelMatrix",r.matrixWorld),E}(t,e,n,i,r);J.setMaterial(i,o);let l=n.index;const h=n.attributes.position;if(null===l){if(void 0===h||0===h.count)return}else if(0===l.count)return;let c,d=1;!0===i.wireframe&&(l=it.getWireframeAttribute(n),d=2),gt.setup(r,i,a,n,l);let p=pt;null!==l&&(c=nt.get(l),p=mt,p.setIndex(c));const m=null!==l?l.count:h.count,f=n.drawRange.start*d,g=n.drawRange.count*d,y=null!==s?s.start*d:0,x=null!==s?s.count*d:1/0,_=Math.max(f,y),w=Math.min(m,f+g,y+x)-1,E=Math.max(0,w-_+1);if(0!==E){if(r.isMesh)!0===i.wireframe?(J.setLineWidth(i.wireframeLinewidth*Z()),p.setMode(1)):p.setMode(4);else if(r.isLine){let t=i.linewidth;void 0===t&&(t=1),J.setLineWidth(t*Z()),r.isLineSegments?p.setMode(1):r.isLineLoop?p.setMode(2):p.setMode(3)}else r.isPoints?p.setMode(0):r.isSprite&&p.setMode(4);if(r.isInstancedMesh)p.renderInstances(_,E,r.count);else if(n.isInstancedBufferGeometry){const t=Math.min(n.instanceCount,n._maxInstanceCount);p.renderInstances(_,E,t)}else p.render(_,E)}},this.compile=function(t,e){u=lt.get(t),u.init(),g.push(u),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(u.pushLight(t),t.castShadow&&u.pushShadow(t))})),u.setupLights(v.physicallyCorrectLights),t.traverse((function(e){const n=e.material;if(n)if(Array.isArray(n))for(let i=0;i<n.length;i++){Dt(n[i],t,e)}else Dt(n,t,e)})),g.pop(),u=null};let Et=null;function Tt(){Lt.stop()}function At(){Lt.start()}const Lt=new pn;function Ct(t,e,n,i){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)u.pushLight(t),t.castShadow&&u.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||B.intersectsSprite(t)){i&&W.setFromMatrixPosition(t.matrixWorld).applyMatrix4(G);const e=rt.update(t),r=t.material;r.visible&&d.push(t,e,r,n,W.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==$.render.frame&&(t.skeleton.update(),t.skeleton.frame=$.render.frame),!t.frustumCulled||B.intersectsObject(t))){i&&W.setFromMatrixPosition(t.matrixWorld).applyMatrix4(G);const e=rt.update(t),r=t.material;if(Array.isArray(r)){const i=e.groups;for(let s=0,o=i.length;s<o;s++){const o=i[s],a=r[o.materialIndex];a&&a.visible&&d.push(t,e,a,n,W.z,o)}}else r.visible&&d.push(t,e,r,n,W.z,null)}const r=t.children;for(let t=0,s=r.length;t<s;t++)Ct(r[t],e,n,i)}function kt(t,e,n,i){const r=t.opaque,o=t.transmissive,a=t.transparent;u.setupLightsView(n),o.length>0&&function(t,e,n){const i=Y.isWebGL2;null===F&&(F=new H(1,1,{generateMipmaps:!0,type:null!==ft.convert(1016)?1016:1009,minFilter:1008,samples:i&&!0===s?4:0}));v.getDrawingBufferSize(V),i?F.setSize(V.x,V.y):F.setSize(p(V.x),p(V.y));const r=v.getRenderTarget();v.setRenderTarget(F),v.clear();const o=v.toneMapping;v.toneMapping=0,Rt(t,e,n),v.toneMapping=o,Q.updateMultisampleRenderTarget(F),Q.updateRenderTargetMipmap(F),v.setRenderTarget(r)}(r,e,n),i&&J.viewport(E.copy(i)),r.length>0&&Rt(r,e,n),o.length>0&&Rt(o,e,n),a.length>0&&Rt(a,e,n),J.buffers.depth.setTest(!0),J.buffers.depth.setMask(!0),J.buffers.color.setMask(!0),J.setPolygonOffset(!1)}function Rt(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r<s;r++){const s=t[r],o=s.object,a=s.geometry,l=null===i?s.material:i,h=s.group;o.layers.test(n.layers)&&Pt(o,e,n,a,l,h)}}function Pt(t,e,n,i,r,s){t.onBeforeRender(v,e,n,i,r,s),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(v,e,n,i,t,s),!0===r.transparent&&2===r.side?(r.side=1,r.needsUpdate=!0,v.renderBufferDirect(n,e,i,r,t,s),r.side=0,r.needsUpdate=!0,v.renderBufferDirect(n,e,i,r,t,s),r.side=2):v.renderBufferDirect(n,e,i,r,t,s),t.onAfterRender(v,e,n,i,r,s)}function Dt(t,e,n){!0!==e.isScene&&(e=j);const i=K.get(t),r=u.state.lights,s=u.state.shadowsArray,o=r.state.version,a=st.getParameters(t,r.state,s,e,n),l=st.getProgramCacheKey(a);let h=i.programs;i.environment=t.isMeshStandardMaterial?e.environment:null,i.fog=e.fog,i.envMap=(t.isMeshStandardMaterial?et:tt).get(t.envMap||i.environment),void 0===h&&(t.addEventListener("dispose",St),h=new Map,i.programs=h);let c=h.get(l);if(void 0!==c){if(i.currentProgram===c&&i.lightsStateVersion===o)return It(t,a),c}else a.uniforms=st.getUniforms(t),t.onBuild(n,a,v),t.onBeforeCompile(a,v),c=st.acquireProgram(a,l),h.set(l,c),i.uniforms=a.uniforms;const d=i.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(d.clippingPlanes=ht.uniform),It(t,a),i.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),i.lightsStateVersion=o,i.needsLights&&(d.ambientLightColor.value=r.state.ambient,d.lightProbe.value=r.state.probe,d.directionalLights.value=r.state.directional,d.directionalLightShadows.value=r.state.directionalShadow,d.spotLights.value=r.state.spot,d.spotLightShadows.value=r.state.spotShadow,d.rectAreaLights.value=r.state.rectArea,d.ltc_1.value=r.state.rectAreaLTC1,d.ltc_2.value=r.state.rectAreaLTC2,d.pointLights.value=r.state.point,d.pointLightShadows.value=r.state.pointShadow,d.hemisphereLights.value=r.state.hemi,d.directionalShadowMap.value=r.state.directionalShadowMap,d.directionalShadowMatrix.value=r.state.directionalShadowMatrix,d.spotShadowMap.value=r.state.spotShadowMap,d.spotShadowMatrix.value=r.state.spotShadowMatrix,d.pointShadowMap.value=r.state.pointShadowMap,d.pointShadowMatrix.value=r.state.pointShadowMatrix);const p=c.getUniforms(),m=Ki.seqWithValue(p.seq,d);return i.currentProgram=c,i.uniformsList=m,c}function It(t,e){const n=K.get(t);n.outputEncoding=e.outputEncoding,n.instancing=e.instancing,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.morphColors=e.morphColors,n.morphTargetsCount=e.morphTargetsCount,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents,n.toneMapping=e.toneMapping}Lt.setAnimationLoop((function(t){Et&&Et(t)})),"undefined"!=typeof self&&Lt.setContext(self),this.setAnimationLoop=function(t){Et=t,_t.setAnimationLoop(t),null===t?Lt.stop():Lt.start()},_t.addEventListener("sessionstart",Tt),_t.addEventListener("sessionend",At),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===y)return;!0===t.autoUpdate&&t.updateMatrixWorld(),null===e.parent&&e.updateMatrixWorld(),!0===_t.enabled&&!0===_t.isPresenting&&(!0===_t.cameraAutoUpdate&&_t.updateCamera(e),e=_t.getCamera()),!0===t.isScene&&t.onBeforeRender(v,t,e,b),u=lt.get(t,g.length),u.init(),g.push(u),G.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),B.setFromProjectionMatrix(G),U=this.localClippingEnabled,z=ht.init(this.clippingPlanes,U,e),d=at.get(t,m.length),d.init(),m.push(d),Ct(t,e,0,v.sortObjects),d.finish(),!0===v.sortObjects&&d.sort(R,P),!0===z&&ht.beginShadows();const n=u.state.shadowsArray;if(ct.render(n,t,e),!0===z&&ht.endShadows(),!0===this.info.autoReset&&this.info.reset(),dt.render(d,t),u.setupLights(v.physicallyCorrectLights),e.isArrayCamera){const n=e.cameras;for(let e=0,i=n.length;e<i;e++){const i=n[e];kt(d,t,i,i.viewport)}}else kt(d,t,e);null!==b&&(Q.updateMultisampleRenderTarget(b),Q.updateRenderTargetMipmap(b)),!0===t.isScene&&t.onAfterRender(v,t,e),gt.resetDefaultState(),M=-1,S=null,g.pop(),u=g.length>0?g[g.length-1]:null,m.pop(),d=m.length>0?m[m.length-1]:null},this.getActiveCubeFace=function(){return x},this.getActiveMipmapLevel=function(){return w},this.getRenderTarget=function(){return b},this.setRenderTargetTextures=function(t,e,n){K.get(t.texture).__webglTexture=e,K.get(t.depthTexture).__webglTexture=n;const i=K.get(t);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===X.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const n=K.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,n=0){b=t,x=e,w=n;let i=!0;if(t){const e=K.get(t);void 0!==e.__useDefaultFramebuffer?(J.bindFramebuffer(36160,null),i=!1):void 0===e.__webglFramebuffer?Q.setupRenderTarget(t):e.__hasExternalTextures&&Q.rebindTextures(t,K.get(t.texture).__webglTexture,K.get(t.depthTexture).__webglTexture)}let r=null,s=!1,o=!1;if(t){const n=t.texture;(n.isData3DTexture||n.isDataArrayTexture)&&(o=!0);const i=K.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=i[e],s=!0):r=Y.isWebGL2&&t.samples>0&&!1===Q.useMultisampledRTT(t)?K.get(t).__webglMultisampledFramebuffer:i,E.copy(t.viewport),T.copy(t.scissor),A=t.scissorTest}else E.copy(D).multiplyScalar(k).floor(),T.copy(I).multiplyScalar(k).floor(),A=N;if(J.bindFramebuffer(36160,r)&&Y.drawBuffers&&i&&J.drawBuffers(t,r),J.viewport(E),J.scissor(T),J.setScissorTest(A),s){const i=K.get(t.texture);vt.framebufferTexture2D(36160,36064,34069+e,i.__webglTexture,n)}else if(o){const i=K.get(t.texture),r=e||0;vt.framebufferTextureLayer(36160,36064,i.__webglTexture,n||0,r)}M=-1},this.readRenderTargetPixels=function(t,e,n,i,r,s,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=K.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){J.bindFramebuffer(36160,a);try{const o=t.texture,a=o.format,l=o.type;if(1023!==a&&ft.convert(a)!==vt.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const h=1016===l&&(X.has("EXT_color_buffer_half_float")||Y.isWebGL2&&X.has("EXT_color_buffer_float"));if(!(1009===l||ft.convert(l)===vt.getParameter(35738)||1015===l&&(Y.isWebGL2||X.has("OES_texture_float")||X.has("WEBGL_color_buffer_float"))||h))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&vt.readPixels(e,n,i,r,ft.convert(a),ft.convert(l),s)}finally{const t=null!==b?K.get(b).__webglFramebuffer:null;J.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){if(!0!==e.isFramebufferTexture)return void console.error("THREE.WebGLRenderer: copyFramebufferToTexture() can only be used with FramebufferTexture.");const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),s=Math.floor(e.image.height*i);Q.setTexture2D(e,0),vt.copyTexSubImage2D(3553,n,0,0,t.x,t.y,r,s),J.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i=0){const r=e.image.width,s=e.image.height,o=ft.convert(n.format),a=ft.convert(n.type);Q.setTexture2D(n,0),vt.pixelStorei(37440,n.flipY),vt.pixelStorei(37441,n.premultiplyAlpha),vt.pixelStorei(3317,n.unpackAlignment),e.isDataTexture?vt.texSubImage2D(3553,i,t.x,t.y,r,s,o,a,e.image.data):e.isCompressedTexture?vt.compressedTexSubImage2D(3553,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,o,e.mipmaps[0].data):vt.texSubImage2D(3553,i,t.x,t.y,o,a,e.image),0===i&&n.generateMipmaps&&vt.generateMipmap(3553),J.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,i,r=0){if(v.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const s=t.max.x-t.min.x+1,o=t.max.y-t.min.y+1,a=t.max.z-t.min.z+1,l=ft.convert(i.format),h=ft.convert(i.type);let c;if(i.isData3DTexture)Q.setTexture3D(i,0),c=32879;else{if(!i.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Q.setTexture2DArray(i,0),c=35866}vt.pixelStorei(37440,i.flipY),vt.pixelStorei(37441,i.premultiplyAlpha),vt.pixelStorei(3317,i.unpackAlignment);const d=vt.getParameter(3314),u=vt.getParameter(32878),p=vt.getParameter(3316),m=vt.getParameter(3315),f=vt.getParameter(32877),g=n.isCompressedTexture?n.mipmaps[0]:n.image;vt.pixelStorei(3314,g.width),vt.pixelStorei(32878,g.height),vt.pixelStorei(3316,t.min.x),vt.pixelStorei(3315,t.min.y),vt.pixelStorei(32877,t.min.z),n.isDataTexture||n.isData3DTexture?vt.texSubImage3D(c,r,e.x,e.y,e.z,s,o,a,l,h,g.data):n.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),vt.compressedTexSubImage3D(c,r,e.x,e.y,e.z,s,o,a,l,g.data)):vt.texSubImage3D(c,r,e.x,e.y,e.z,s,o,a,l,h,g),vt.pixelStorei(3314,d),vt.pixelStorei(32878,u),vt.pixelStorei(3316,p),vt.pixelStorei(3315,m),vt.pixelStorei(32877,f),0===r&&i.generateMipmaps&&vt.generateMipmap(c),J.unbindTexture()},this.initTexture=function(t){Q.setTexture2D(t,0),J.unbindTexture()},this.resetState=function(){x=0,w=0,b=null,J.reset(),gt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}jr.prototype.isWebGLRenderer=!0;class qr extends jr{}qr.prototype.isWebGL1Renderer=!0;class Zr{constructor(t,e=25e-5){this.name="",this.color=new R(t),this.density=e}clone(){return new Zr(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}Zr.prototype.isFogExp2=!0;class Xr{constructor(t,e=1,n=1e3){this.name="",this.color=new R(t),this.near=e,this.far=n}clone(){return new Xr(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}Xr.prototype.isFog=!0;class Yr extends Xt{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),e}}Yr.prototype.isScene=!0;class Jr{constructor(t,e){this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=35044,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=a()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[n+i];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=a()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=a()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}Jr.prototype.isInterleavedBuffer=!0;const $r=new q;class Kr{constructor(t,e,n,i=!1){this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=!0===i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)$r.fromBufferAttribute(this,e),$r.applyMatrix4(t),this.setXYZ(e,$r.x,$r.y,$r.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)$r.fromBufferAttribute(this,e),$r.applyNormalMatrix(t),this.setXYZ(e,$r.x,$r.y,$r.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)$r.fromBufferAttribute(this,e),$r.transformDirection(t),this.setXYZ(e,$r.x,$r.y,$r.z);return this}setX(t,e){return this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){return this.data.array[t*this.data.stride+this.offset]}getY(t){return this.data.array[t*this.data.stride+this.offset+1]}getZ(t){return this.data.array[t*this.data.stride+this.offset+2]}getW(t){return this.data.array[t*this.data.stride+this.offset+3]}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,i){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return new de(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Kr(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}Kr.prototype.isInterleavedBufferAttribute=!0;class Qr extends ae{constructor(t){super(),this.type="SpriteMaterial",this.color=new R(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this}}let ts;Qr.prototype.isSpriteMaterial=!0;const es=new q,ns=new q,is=new q,rs=new f,ss=new f,os=new Mt,as=new q,ls=new q,hs=new q,cs=new f,ds=new f,us=new f;class ps extends Xt{constructor(t){if(super(),this.type="Sprite",void 0===ts){ts=new Ce;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new Jr(t,5);ts.setIndex([0,1,2,0,2,3]),ts.setAttribute("position",new Kr(e,3,0,!1)),ts.setAttribute("uv",new Kr(e,2,3,!1))}this.geometry=ts,this.material=void 0!==t?t:new Qr,this.center=new f(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),ns.setFromMatrixScale(this.matrixWorld),os.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),is.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&ns.multiplyScalar(-is.z);const n=this.material.rotation;let i,r;0!==n&&(r=Math.cos(n),i=Math.sin(n));const s=this.center;ms(as.set(-.5,-.5,0),is,s,ns,i,r),ms(ls.set(.5,-.5,0),is,s,ns,i,r),ms(hs.set(.5,.5,0),is,s,ns,i,r),cs.set(0,0),ds.set(1,0),us.set(1,1);let o=t.ray.intersectTriangle(as,ls,hs,!1,es);if(null===o&&(ms(ls.set(-.5,.5,0),is,s,ns,i,r),ds.set(0,1),o=t.ray.intersectTriangle(as,hs,ls,!1,es),null===o))return;const a=t.ray.origin.distanceTo(es);a<t.near||a>t.far||e.push({distance:a,point:es.clone(),uv:se.getUV(es,as,ls,hs,cs,ds,us,new f),face:null,object:this})}copy(t){return super.copy(t),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function ms(t,e,n,i,r,s){rs.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(ss.x=s*rs.x-r*rs.y,ss.y=r*rs.x+s*rs.y):ss.copy(rs),t.copy(e),t.x+=ss.x,t.y+=ss.y,t.applyMatrix4(os)}ps.prototype.isSprite=!0;const fs=new q,gs=new q;class vs extends Xt{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let t=0,n=e.length;t<n;t++){const n=e[t];this.addLevel(n.object.clone(),n.distance)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0){e=Math.abs(e);const n=this.levels;let i;for(i=0;i<n.length&&!(e<n[i].distance);i++);return n.splice(i,0,{distance:e,object:t}),this.add(t),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const e=this.levels;if(e.length>0){let n,i;for(n=1,i=e.length;n<i&&!(t<e[n].distance);n++);return e[n-1].object}return null}raycast(t,e){if(this.levels.length>0){fs.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(fs);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){fs.setFromMatrixPosition(t.matrixWorld),gs.setFromMatrixPosition(this.matrixWorld);const n=fs.distanceTo(gs)/t.zoom;let i,r;for(e[0].object.visible=!0,i=1,r=e.length;i<r&&n>=e[i].distance;i++)e[i-1].object.visible=!1,e[i].object.visible=!0;for(this._currentLevel=i-1;i<r;i++)e[i].object.visible=!1}}toJSON(t){const e=super.toJSON(t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];const n=this.levels;for(let t=0,i=n.length;t<i;t++){const i=n[t];e.object.levels.push({object:i.object.uuid,distance:i.distance})}return e}}const ys=new q,xs=new O,_s=new O,ws=new q,bs=new Mt;class Ms extends Ze{constructor(t,e){super(t,e),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Mt,this.bindMatrixInverse=new Mt}copy(t){return super.copy(t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new O,e=this.geometry.attributes.skinWeight;for(let n=0,i=e.count;n<i;n++){t.fromBufferAttribute(e,n);const i=1/t.manhattanLength();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(t,e){const n=this.skeleton,i=this.geometry;xs.fromBufferAttribute(i.attributes.skinIndex,t),_s.fromBufferAttribute(i.attributes.skinWeight,t),ys.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const i=_s.getComponent(t);if(0!==i){const r=xs.getComponent(t);bs.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),e.addScaledVector(ws.copy(ys).applyMatrix4(bs),i)}}return e.applyMatrix4(this.bindMatrixInverse)}}Ms.prototype.isSkinnedMesh=!0;class Ss extends Xt{constructor(){super(),this.type="Bone"}}Ss.prototype.isBone=!0;class Es extends z{constructor(t=null,e=1,n=1,i,r,s,o,a,l=1003,h=1003,c,d){super(null,s,o,a,l,h,i,r,c,d),this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}Es.prototype.isDataTexture=!0;const Ts=new Mt,As=new Mt;class Ls{constructor(t=[],e=[]){this.uuid=a(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new Mt)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new Mt;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let i=0,r=t.length;i<r;i++){const r=t[i]?t[i].matrixWorld:As;Ts.multiplyMatrices(r,e[i]),Ts.toArray(n,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new Ls(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=u(t),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const n=new Es(e,t,t,1023,1015);return n.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=n,this.boneTextureSize=t,this}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){const n=this.bones[e];if(n.name===t)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,i=t.bones.length;n<i;n++){const i=t.bones[n];let r=e[i];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),r=new Ss),this.bones.push(r),this.boneInverses.push((new Mt).fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){const t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let i=0,r=e.length;i<r;i++){const r=e[i];t.bones.push(r.uuid);const s=n[i];t.boneInverses.push(s.toArray())}return t}}class Cs extends de{constructor(t,e,n,i=1){"number"==typeof n&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(t,e,n),this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}Cs.prototype.isInstancedBufferAttribute=!0;const ks=new Mt,Rs=new Mt,Ps=[],Ds=new Ze;class Is extends Ze{constructor(t,e,n){super(t,e),this.instanceMatrix=new Cs(new Float32Array(16*n),16),this.instanceColor=null,this.count=n,this.frustumCulled=!1}copy(t){return super.copy(t),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}raycast(t,e){const n=this.matrixWorld,i=this.count;if(Ds.geometry=this.geometry,Ds.material=this.material,void 0!==Ds.material)for(let r=0;r<i;r++){this.getMatrixAt(r,ks),Rs.multiplyMatrices(n,ks),Ds.matrixWorld=Rs,Ds.raycast(t,Ps);for(let t=0,n=Ps.length;t<n;t++){const n=Ps[t];n.instanceId=r,n.object=this,e.push(n)}Ps.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new Cs(new Float32Array(3*this.instanceMatrix.count),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}Is.prototype.isInstancedMesh=!0;class Ns extends ae{constructor(t){super(),this.type="LineBasicMaterial",this.color=new R(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this}}Ns.prototype.isLineBasicMaterial=!0;const Bs=new q,zs=new q,Os=new Mt,Hs=new bt,Us=new mt;class Fs extends Xt{constructor(t=new Ce,e=new Ns){super(),this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,i=e.count;t<i;t++)Bs.fromBufferAttribute(e,t-1),zs.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=Bs.distanceTo(zs);t.setAttribute("lineDistance",new _e(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Us.copy(n.boundingSphere),Us.applyMatrix4(i),Us.radius+=r,!1===t.ray.intersectsSphere(Us))return;Os.copy(i).invert(),Hs.copy(t.ray).applyMatrix4(Os);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,l=new q,h=new q,c=new q,d=new q,u=this.isLineSegments?2:1;if(n.isBufferGeometry){const i=n.index,r=n.attributes.position;if(null!==i){for(let n=Math.max(0,s.start),o=Math.min(i.count,s.start+s.count)-1;n<o;n+=u){const s=i.getX(n),o=i.getX(n+1);l.fromBufferAttribute(r,s),h.fromBufferAttribute(r,o);if(Hs.distanceSqToSegment(l,h,d,c)>a)continue;d.applyMatrix4(this.matrixWorld);const u=t.ray.origin.distanceTo(d);u<t.near||u>t.far||e.push({distance:u,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else{for(let n=Math.max(0,s.start),i=Math.min(r.count,s.start+s.count)-1;n<i;n+=u){l.fromBufferAttribute(r,n),h.fromBufferAttribute(r,n+1);if(Hs.distanceSqToSegment(l,h,d,c)>a)continue;d.applyMatrix4(this.matrixWorld);const i=t.ray.origin.distanceTo(d);i<t.near||i>t.far||e.push({distance:i,point:c.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}}else n.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}Fs.prototype.isLine=!0;const Gs=new q,Vs=new q;class Ws extends Fs{constructor(t,e){super(t,e),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,i=e.count;t<i;t+=2)Gs.fromBufferAttribute(e,t),Vs.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+Gs.distanceTo(Vs);t.setAttribute("lineDistance",new _e(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}Ws.prototype.isLineSegments=!0;class js extends Fs{constructor(t,e){super(t,e),this.type="LineLoop"}}js.prototype.isLineLoop=!0;class qs extends ae{constructor(t){super(),this.type="PointsMaterial",this.color=new R(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this}}qs.prototype.isPointsMaterial=!0;const Zs=new Mt,Xs=new bt,Ys=new mt,Js=new q;class $s extends Xt{constructor(t=new Ce,e=new qs){super(),this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Ys.copy(n.boundingSphere),Ys.applyMatrix4(i),Ys.radius+=r,!1===t.ray.intersectsSphere(Ys))return;Zs.copy(i).invert(),Xs.copy(t.ray).applyMatrix4(Zs);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o;if(n.isBufferGeometry){const r=n.index,o=n.attributes.position;if(null!==r){for(let n=Math.max(0,s.start),l=Math.min(r.count,s.start+s.count);n<l;n++){const s=r.getX(n);Js.fromBufferAttribute(o,s),Ks(Js,s,a,i,t,e,this)}}else{for(let n=Math.max(0,s.start),r=Math.min(o.count,s.start+s.count);n<r;n++)Js.fromBufferAttribute(o,n),Ks(Js,n,a,i,t,e,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const e=t.morphAttributes,n=Object.keys(e);if(n.length>0){const t=e[n[0]];if(void 0!==t){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,n=t.length;e<n;e++){const n=t[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[n]=e}}}}else{const e=t.morphTargets;void 0!==e&&e.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function Ks(t,e,n,i,r,s,o){const a=Xs.distanceSqToPoint(t);if(a<n){const n=new q;Xs.closestPointToPoint(t,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:e,face:null,object:o})}}$s.prototype.isPoints=!0;class Qs extends z{constructor(t,e,n,i,r,s,o,a,l){super(t,e,n,i,r,s,o,a,l),this.minFilter=void 0!==s?s:1006,this.magFilter=void 0!==r?r:1006,this.generateMipmaps=!1;const h=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){h.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}Qs.prototype.isVideoTexture=!0;class to extends z{constructor(t,e,n){super({width:t,height:e}),this.format=n,this.magFilter=1003,this.minFilter=1003,this.generateMipmaps=!1,this.needsUpdate=!0}}to.prototype.isFramebufferTexture=!0;class eo extends z{constructor(t,e,n,i,r,s,o,a,l,h,c,d){super(null,s,o,a,l,h,i,r,c,d),this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}eo.prototype.isCompressedTexture=!0;class no extends z{constructor(t,e,n,i,r,s,o,a,l){super(t,e,n,i,r,s,o,a,l),this.needsUpdate=!0}}no.prototype.isCanvasTexture=!0;class io{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let s=1;s<=t;s++)n=this.getPoint(s/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let i=0;const r=n.length;let s;s=e||t*n[r-1];let o,a=0,l=r-1;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),o=n[i]-s,o<0)a=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const h=n[i];return(i+(s-h)/(n[i+1]-h))/(r-1)}getTangent(t,e){const n=1e-4;let i=t-n,r=t+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),o=this.getPoint(r),a=e||(s.isVector2?new f:new q);return a.copy(o).sub(s).normalize(),a}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new q,i=[],r=[],s=[],o=new q,a=new Mt;for(let e=0;e<=t;e++){const n=e/t;i[e]=this.getTangentAt(n,new q)}r[0]=new q,s[0]=new q;let h=Number.MAX_VALUE;const c=Math.abs(i[0].x),d=Math.abs(i[0].y),u=Math.abs(i[0].z);c<=h&&(h=c,n.set(1,0,0)),d<=h&&(h=d,n.set(0,1,0)),u<=h&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),s[0].crossVectors(i[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),s[e]=s[e-1].clone(),o.crossVectors(i[e-1],i[e]),o.length()>Number.EPSILON){o.normalize();const t=Math.acos(l(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(a.makeRotationAxis(o,t))}s[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(l(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(o.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(a.makeRotationAxis(i[n],e*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class ro extends io{constructor(t=0,e=0,n=1,i=1,r=0,s=2*Math.PI,o=!1,a=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(t,e){const n=e||new f,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=s?0:i),!0!==this.aClockwise||s||(r===i?r=-i:r-=i);const o=this.aStartAngle+t*r;let a=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=a-this.aX,i=l-this.aY;a=n*t-i*e+this.aX,l=n*e+i*t+this.aY}return n.set(a,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}ro.prototype.isEllipseCurve=!0;class so extends ro{constructor(t,e,n,i,r,s){super(t,e,n,n,i,r,s),this.type="ArcCurve"}}function oo(){let t=0,e=0,n=0,i=0;function r(r,s,o,a){t=r,e=o,n=-3*r+3*s-2*o-a,i=2*r-2*s+o+a}return{initCatmullRom:function(t,e,n,i,s){r(e,n,s*(n-t),s*(i-e))},initNonuniformCatmullRom:function(t,e,n,i,s,o,a){let l=(e-t)/s-(n-t)/(s+o)+(n-e)/o,h=(n-e)/o-(i-e)/(o+a)+(i-n)/a;l*=o,h*=o,r(e,n,l,h)},calc:function(r){const s=r*r;return t+e*r+n*s+i*(s*r)}}}so.prototype.isArcCurve=!0;const ao=new q,lo=new oo,ho=new oo,co=new oo;class uo extends io{constructor(t=[],e=!1,n="centripetal",i=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=i}getPoint(t,e=new q){const n=e,i=this.points,r=i.length,s=(r-(this.closed?0:1))*t;let o,a,l=Math.floor(s),h=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===h&&l===r-1&&(l=r-2,h=1),this.closed||l>0?o=i[(l-1)%r]:(ao.subVectors(i[0],i[1]).add(i[0]),o=ao);const c=i[l%r],d=i[(l+1)%r];if(this.closed||l+2<r?a=i[(l+2)%r]:(ao.subVectors(i[r-1],i[r-2]).add(i[r-1]),a=ao),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(o.distanceToSquared(c),t),n=Math.pow(c.distanceToSquared(d),t),i=Math.pow(d.distanceToSquared(a),t);n<1e-4&&(n=1),e<1e-4&&(e=n),i<1e-4&&(i=n),lo.initNonuniformCatmullRom(o.x,c.x,d.x,a.x,e,n,i),ho.initNonuniformCatmullRom(o.y,c.y,d.y,a.y,e,n,i),co.initNonuniformCatmullRom(o.z,c.z,d.z,a.z,e,n,i)}else"catmullrom"===this.curveType&&(lo.initCatmullRom(o.x,c.x,d.x,a.x,this.tension),ho.initCatmullRom(o.y,c.y,d.y,a.y,this.tension),co.initCatmullRom(o.z,c.z,d.z,a.z,this.tension));return n.set(lo.calc(h),ho.calc(h),co.calc(h)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new q).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function po(t,e,n,i,r){const s=.5*(i-e),o=.5*(r-n),a=t*t;return(2*n-2*i+s+o)*(t*a)+(-3*n+3*i-2*s-o)*a+s*t+n}function mo(t,e,n,i){return function(t,e){const n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,i)}function fo(t,e,n,i,r){return function(t,e){const n=1-t;return n*n*n*e}(t,e)+function(t,e){const n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,i)+function(t,e){return t*t*t*e}(t,r)}uo.prototype.isCatmullRomCurve3=!0;class go extends io{constructor(t=new f,e=new f,n=new f,i=new f){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new f){const n=e,i=this.v0,r=this.v1,s=this.v2,o=this.v3;return n.set(fo(t,i.x,r.x,s.x,o.x),fo(t,i.y,r.y,s.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}go.prototype.isCubicBezierCurve=!0;class vo extends io{constructor(t=new q,e=new q,n=new q,i=new q){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new q){const n=e,i=this.v0,r=this.v1,s=this.v2,o=this.v3;return n.set(fo(t,i.x,r.x,s.x,o.x),fo(t,i.y,r.y,s.y,o.y),fo(t,i.z,r.z,s.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}vo.prototype.isCubicBezierCurve3=!0;class yo extends io{constructor(t=new f,e=new f){super(),this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new f){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e){const n=e||new f;return n.copy(this.v2).sub(this.v1).normalize(),n}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}yo.prototype.isLineCurve=!0;class xo extends io{constructor(t=new q,e=new q){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=e}getPoint(t,e=new q){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class _o extends io{constructor(t=new f,e=new f,n=new f){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new f){const n=e,i=this.v0,r=this.v1,s=this.v2;return n.set(mo(t,i.x,r.x,s.x),mo(t,i.y,r.y,s.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}_o.prototype.isQuadraticBezierCurve=!0;class wo extends io{constructor(t=new q,e=new q,n=new q){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new q){const n=e,i=this.v0,r=this.v1,s=this.v2;return n.set(mo(t,i.x,r.x,s.x),mo(t,i.y,r.y,s.y),mo(t,i.z,r.z,s.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}wo.prototype.isQuadraticBezierCurve3=!0;class bo extends io{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,e=new f){const n=e,i=this.points,r=(i.length-1)*t,s=Math.floor(r),o=r-s,a=i[0===s?s:s-1],l=i[s],h=i[s>i.length-2?i.length-1:s+1],c=i[s>i.length-3?i.length-1:s+2];return n.set(po(o,a.x,l.x,h.x,c.x),po(o,a.y,l.y,h.y,c.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new f).fromArray(n))}return this}}bo.prototype.isSplineCurve=!0;var Mo=Object.freeze({__proto__:null,ArcCurve:so,CatmullRomCurve3:uo,CubicBezierCurve:go,CubicBezierCurve3:vo,EllipseCurve:ro,LineCurve:yo,LineCurve3:xo,QuadraticBezierCurve:_o,QuadraticBezierCurve3:wo,SplineCurve:bo});class So extends io{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new yo(e,t))}getPoint(t,e){const n=t*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const t=i[r]-n,s=this.curves[r],o=s.getLength(),a=0===o?0:1-t/o;return s.getPointAt(a,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const s=r[i],o=s.isEllipseCurve?2*t:s.isLineCurve||s.isLineCurve3?1:s.isSplineCurve?t*s.points.length:t,a=s.getPoints(o);for(let t=0;t<a.length;t++){const i=a[t];n&&n.equals(i)||(e.push(i),n=i)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push((new Mo[n.type]).fromJSON(n))}return this}}class Eo extends So{constructor(t){super(),this.type="Path",this.currentPoint=new f,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new yo(this.currentPoint.clone(),new f(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,i){const r=new _o(this.currentPoint.clone(),new f(t,e),new f(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(t,e,n,i,r,s){const o=new go(this.currentPoint.clone(),new f(t,e),new f(n,i),new f(r,s));return this.curves.push(o),this.currentPoint.set(r,s),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new bo(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,i,r,s){const o=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(t+o,e+a,n,i,r,s),this}absarc(t,e,n,i,r,s){return this.absellipse(t,e,n,n,i,r,s),this}ellipse(t,e,n,i,r,s,o,a){const l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(t+l,e+h,n,i,r,s,o,a),this}absellipse(t,e,n,i,r,s,o,a){const l=new ro(t,e,n,i,r,s,o,a);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const h=l.getPoint(1);return this.currentPoint.copy(h),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class To extends Ce{constructor(t=[new f(0,.5),new f(.5,0),new f(0,-.5)],e=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e),i=l(i,0,2*Math.PI);const r=[],s=[],o=[],a=[],h=[],c=1/e,d=new q,u=new f,p=new q,m=new q,g=new q;let v=0,y=0;for(let e=0;e<=t.length-1;e++)switch(e){case 0:v=t[e+1].x-t[e].x,y=t[e+1].y-t[e].y,p.x=1*y,p.y=-v,p.z=0*y,g.copy(p),p.normalize(),a.push(p.x,p.y,p.z);break;case t.length-1:a.push(g.x,g.y,g.z);break;default:v=t[e+1].x-t[e].x,y=t[e+1].y-t[e].y,p.x=1*y,p.y=-v,p.z=0*y,m.copy(p),p.x+=g.x,p.y+=g.y,p.z+=g.z,p.normalize(),a.push(p.x,p.y,p.z),g.copy(m)}for(let r=0;r<=e;r++){const l=n+r*c*i,p=Math.sin(l),m=Math.cos(l);for(let n=0;n<=t.length-1;n++){d.x=t[n].x*p,d.y=t[n].y,d.z=t[n].x*m,s.push(d.x,d.y,d.z),u.x=r/e,u.y=n/(t.length-1),o.push(u.x,u.y);const i=a[3*n+0]*p,l=a[3*n+1],c=a[3*n+0]*m;h.push(i,l,c)}}for(let n=0;n<e;n++)for(let e=0;e<t.length-1;e++){const i=e+n*t.length,s=i,o=i+t.length,a=i+t.length+1,l=i+1;r.push(s,o,l),r.push(a,l,o)}this.setIndex(r),this.setAttribute("position",new _e(s,3)),this.setAttribute("uv",new _e(o,2)),this.setAttribute("normal",new _e(h,3))}static fromJSON(t){return new To(t.points,t.segments,t.phiStart,t.phiLength)}}class Ao extends To{constructor(t=1,e=1,n=4,i=8){const r=new Eo;r.absarc(0,-e/2,t,1.5*Math.PI,0),r.absarc(0,e/2,t,0,.5*Math.PI),super(r.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:t,height:e,capSegments:n,radialSegments:i}}static fromJSON(t){return new Ao(t.radius,t.length,t.capSegments,t.radialSegments)}}class Lo extends Ce{constructor(t=1,e=8,n=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},e=Math.max(3,e);const r=[],s=[],o=[],a=[],l=new q,h=new f;s.push(0,0,0),o.push(0,0,1),a.push(.5,.5);for(let r=0,c=3;r<=e;r++,c+=3){const d=n+r/e*i;l.x=t*Math.cos(d),l.y=t*Math.sin(d),s.push(l.x,l.y,l.z),o.push(0,0,1),h.x=(s[c]/t+1)/2,h.y=(s[c+1]/t+1)/2,a.push(h.x,h.y)}for(let t=1;t<=e;t++)r.push(t,t+1,0);this.setIndex(r),this.setAttribute("position",new _e(s,3)),this.setAttribute("normal",new _e(o,3)),this.setAttribute("uv",new _e(a,2))}static fromJSON(t){return new Lo(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class Co extends Ce{constructor(t=1,e=1,n=1,i=8,r=1,s=!1,o=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a};const l=this;i=Math.floor(i),r=Math.floor(r);const h=[],c=[],d=[],u=[];let p=0;const m=[],g=n/2;let v=0;function y(n){const r=p,s=new f,m=new q;let y=0;const x=!0===n?t:e,_=!0===n?1:-1;for(let t=1;t<=i;t++)c.push(0,g*_,0),d.push(0,_,0),u.push(.5,.5),p++;const w=p;for(let t=0;t<=i;t++){const e=t/i*a+o,n=Math.cos(e),r=Math.sin(e);m.x=x*r,m.y=g*_,m.z=x*n,c.push(m.x,m.y,m.z),d.push(0,_,0),s.x=.5*n+.5,s.y=.5*r*_+.5,u.push(s.x,s.y),p++}for(let t=0;t<i;t++){const e=r+t,i=w+t;!0===n?h.push(i,i+1,e):h.push(i+1,i,e),y+=3}l.addGroup(v,y,!0===n?1:2),v+=y}!function(){const s=new q,f=new q;let y=0;const x=(e-t)/n;for(let l=0;l<=r;l++){const h=[],v=l/r,y=v*(e-t)+t;for(let t=0;t<=i;t++){const e=t/i,r=e*a+o,l=Math.sin(r),m=Math.cos(r);f.x=y*l,f.y=-v*n+g,f.z=y*m,c.push(f.x,f.y,f.z),s.set(l,x,m).normalize(),d.push(s.x,s.y,s.z),u.push(e,1-v),h.push(p++)}m.push(h)}for(let t=0;t<i;t++)for(let e=0;e<r;e++){const n=m[e][t],i=m[e+1][t],r=m[e+1][t+1],s=m[e][t+1];h.push(n,i,s),h.push(i,r,s),y+=6}l.addGroup(v,y,0),v+=y}(),!1===s&&(t>0&&y(!0),e>0&&y(!1)),this.setIndex(h),this.setAttribute("position",new _e(c,3)),this.setAttribute("normal",new _e(d,3)),this.setAttribute("uv",new _e(u,2))}static fromJSON(t){return new Co(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ko extends Co{constructor(t=1,e=1,n=8,i=1,r=!1,s=0,o=2*Math.PI){super(0,t,e,n,i,r,s,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:o}}static fromJSON(t){return new ko(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Ro extends Ce{constructor(t=[],e=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const r=[],s=[];function o(t,e,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const o=t.clone().lerp(n,i/r),a=e.clone().lerp(n,i/r),l=r-i;for(let t=0;t<=l;t++)s[i][t]=0===t&&i===r?o:o.clone().lerp(a,t/l)}for(let t=0;t<r;t++)for(let e=0;e<2*(r-t)-1;e++){const n=Math.floor(e/2);e%2==0?(a(s[t][n+1]),a(s[t+1][n]),a(s[t][n])):(a(s[t][n+1]),a(s[t+1][n+1]),a(s[t+1][n]))}}function a(t){r.push(t.x,t.y,t.z)}function l(e,n){const i=3*e;n.x=t[i+0],n.y=t[i+1],n.z=t[i+2]}function h(t,e,n,i){i<0&&1===t.x&&(s[e]=t.x-1),0===n.x&&0===n.z&&(s[e]=i/2/Math.PI+.5)}function c(t){return Math.atan2(t.z,-t.x)}!function(t){const n=new q,i=new q,r=new q;for(let s=0;s<e.length;s+=3)l(e[s+0],n),l(e[s+1],i),l(e[s+2],r),o(n,i,r,t)}(i),function(t){const e=new q;for(let n=0;n<r.length;n+=3)e.x=r[n+0],e.y=r[n+1],e.z=r[n+2],e.normalize().multiplyScalar(t),r[n+0]=e.x,r[n+1]=e.y,r[n+2]=e.z}(n),function(){const t=new q;for(let n=0;n<r.length;n+=3){t.x=r[n+0],t.y=r[n+1],t.z=r[n+2];const i=c(t)/2/Math.PI+.5,o=(e=t,Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5);s.push(i,1-o)}var e;(function(){const t=new q,e=new q,n=new q,i=new q,o=new f,a=new f,l=new f;for(let d=0,u=0;d<r.length;d+=9,u+=6){t.set(r[d+0],r[d+1],r[d+2]),e.set(r[d+3],r[d+4],r[d+5]),n.set(r[d+6],r[d+7],r[d+8]),o.set(s[u+0],s[u+1]),a.set(s[u+2],s[u+3]),l.set(s[u+4],s[u+5]),i.copy(t).add(e).add(n).divideScalar(3);const p=c(i);h(o,u+0,t,p),h(a,u+2,e,p),h(l,u+4,n,p)}})(),function(){for(let t=0;t<s.length;t+=6){const e=s[t+0],n=s[t+2],i=s[t+4],r=Math.max(e,n,i),o=Math.min(e,n,i);r>.9&&o<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),i<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new _e(r,3)),this.setAttribute("normal",new _e(r.slice(),3)),this.setAttribute("uv",new _e(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(t){return new Ro(t.vertices,t.indices,t.radius,t.details)}}class Po extends Ro{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,i=1/n;super([-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,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[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],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Po(t.radius,t.detail)}}const Do=new q,Io=new q,No=new q,Bo=new se;class zo extends Ce{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const n=4,i=Math.pow(10,n),r=Math.cos(s*e),o=t.getIndex(),a=t.getAttribute("position"),l=o?o.count:a.count,h=[0,0,0],c=["a","b","c"],d=new Array(3),u={},p=[];for(let t=0;t<l;t+=3){o?(h[0]=o.getX(t),h[1]=o.getX(t+1),h[2]=o.getX(t+2)):(h[0]=t,h[1]=t+1,h[2]=t+2);const{a:e,b:n,c:s}=Bo;if(e.fromBufferAttribute(a,h[0]),n.fromBufferAttribute(a,h[1]),s.fromBufferAttribute(a,h[2]),Bo.getNormal(No),d[0]=`${Math.round(e.x*i)},${Math.round(e.y*i)},${Math.round(e.z*i)}`,d[1]=`${Math.round(n.x*i)},${Math.round(n.y*i)},${Math.round(n.z*i)}`,d[2]=`${Math.round(s.x*i)},${Math.round(s.y*i)},${Math.round(s.z*i)}`,d[0]!==d[1]&&d[1]!==d[2]&&d[2]!==d[0])for(let t=0;t<3;t++){const e=(t+1)%3,n=d[t],i=d[e],s=Bo[c[t]],o=Bo[c[e]],a=`${n}_${i}`,l=`${i}_${n}`;l in u&&u[l]?(No.dot(u[l].normal)<=r&&(p.push(s.x,s.y,s.z),p.push(o.x,o.y,o.z)),u[l]=null):a in u||(u[a]={index0:h[t],index1:h[e],normal:No.clone()})}}for(const t in u)if(u[t]){const{index0:e,index1:n}=u[t];Do.fromBufferAttribute(a,e),Io.fromBufferAttribute(a,n),p.push(Do.x,Do.y,Do.z),p.push(Io.x,Io.y,Io.z)}this.setAttribute("position",new _e(p,3))}}}class Oo extends Eo{constructor(t){super(t),this.uuid=a(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push((new Eo).fromJSON(n))}return this}}const Ho=function(t,e,n=2){const i=e&&e.length,r=i?e[0]*n:t.length;let s=Uo(t,0,r,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,h,c,d,u,p;if(i&&(s=function(t,e,n,i){const r=[];let s,o,a,l,h;for(s=0,o=e.length;s<o;s++)a=e[s]*i,l=s<o-1?e[s+1]*i:t.length,h=Uo(t,a,l,i,!1),h===h.next&&(h.steiner=!0),r.push($o(h));for(r.sort(Zo),s=0;s<r.length;s++)Xo(r[s],n),n=Fo(n,n.next);return n}(t,e,s,n)),t.length>80*n){a=h=t[0],l=c=t[1];for(let e=n;e<r;e+=n)d=t[e],u=t[e+1],d<a&&(a=d),u<l&&(l=u),d>h&&(h=d),u>c&&(c=u);p=Math.max(h-a,c-l),p=0!==p?1/p:0}return Go(s,o,n,a,l,p),o};function Uo(t,e,n,i,r){let s,o;if(r===function(t,e,n,i){let r=0;for(let s=e,o=n-i;s<n;s+=i)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}(t,e,n,i)>0)for(s=e;s<n;s+=i)o=aa(s,t[s],t[s+1],o);else for(s=n-i;s>=e;s-=i)o=aa(s,t[s],t[s+1],o);return o&&ea(o,o.next)&&(la(o),o=o.next),o}function Fo(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!ea(i,i.next)&&0!==ta(i.prev,i,i.next))i=i.next;else{if(la(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function Go(t,e,n,i,r,s,o){if(!t)return;!o&&s&&function(t,e,n,i){let r=t;do{null===r.z&&(r.z=Jo(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,n,i,r,s,o,a,l,h=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,i=n,a=0,e=0;e<h&&(a++,i=i.nextZ,i);e++);for(l=h;a>0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;n=i}s.nextZ=null,h*=2}while(o>1)}(r)}(t,i,r,s);let a,l,h=t;for(;t.prev!==t.next;)if(a=t.prev,l=t.next,s?Wo(t,i,r,s):Vo(t))e.push(a.i/n),e.push(t.i/n),e.push(l.i/n),la(t),t=l.next,h=l.next;else if((t=l)===h){o?1===o?Go(t=jo(Fo(t),e,n),e,n,i,r,s,2):2===o&&qo(t,e,n,i,r,s):Go(Fo(t),e,n,i,r,s,1);break}}function Vo(t){const e=t.prev,n=t,i=t.next;if(ta(e,n,i)>=0)return!1;let r=t.next.next;for(;r!==t.prev;){if(Ko(e.x,e.y,n.x,n.y,i.x,i.y,r.x,r.y)&&ta(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Wo(t,e,n,i){const r=t.prev,s=t,o=t.next;if(ta(r,s,o)>=0)return!1;const a=r.x<s.x?r.x<o.x?r.x:o.x:s.x<o.x?s.x:o.x,l=r.y<s.y?r.y<o.y?r.y:o.y:s.y<o.y?s.y:o.y,h=r.x>s.x?r.x>o.x?r.x:o.x:s.x>o.x?s.x:o.x,c=r.y>s.y?r.y>o.y?r.y:o.y:s.y>o.y?s.y:o.y,d=Jo(a,l,e,n,i),u=Jo(h,c,e,n,i);let p=t.prevZ,m=t.nextZ;for(;p&&p.z>=d&&m&&m.z<=u;){if(p!==t.prev&&p!==t.next&&Ko(r.x,r.y,s.x,s.y,o.x,o.y,p.x,p.y)&&ta(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,m!==t.prev&&m!==t.next&&Ko(r.x,r.y,s.x,s.y,o.x,o.y,m.x,m.y)&&ta(m.prev,m,m.next)>=0)return!1;m=m.nextZ}for(;p&&p.z>=d;){if(p!==t.prev&&p!==t.next&&Ko(r.x,r.y,s.x,s.y,o.x,o.y,p.x,p.y)&&ta(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;m&&m.z<=u;){if(m!==t.prev&&m!==t.next&&Ko(r.x,r.y,s.x,s.y,o.x,o.y,m.x,m.y)&&ta(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function jo(t,e,n){let i=t;do{const r=i.prev,s=i.next.next;!ea(r,s)&&na(r,i,i.next,s)&&sa(r,s)&&sa(s,r)&&(e.push(r.i/n),e.push(i.i/n),e.push(s.i/n),la(i),la(i.next),i=t=s),i=i.next}while(i!==t);return Fo(i)}function qo(t,e,n,i,r,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&Qo(o,t)){let a=oa(o,t);return o=Fo(o,o.next),a=Fo(a,a.next),Go(o,e,n,i,r,s),void Go(a,e,n,i,r,s)}t=t.next}o=o.next}while(o!==t)}function Zo(t,e){return t.x-e.x}function Xo(t,e){if(e=function(t,e){let n=e;const i=t.x,r=t.y;let s,o=-1/0;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const t=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=i&&t>o){if(o=t,t===i){if(r===n.y)return n;if(r===n.next.y)return n.next}s=n.x<n.next.x?n:n.next}}n=n.next}while(n!==e);if(!s)return null;if(i===o)return s;const a=s,l=s.x,h=s.y;let c,d=1/0;n=s;do{i>=n.x&&n.x>=l&&i!==n.x&&Ko(r<h?i:o,r,l,h,r<h?o:i,r,n.x,n.y)&&(c=Math.abs(r-n.y)/(i-n.x),sa(n,t)&&(c<d||c===d&&(n.x>s.x||n.x===s.x&&Yo(s,n)))&&(s=n,d=c)),n=n.next}while(n!==a);return s}(t,e),e){const n=oa(e,t);Fo(e,e.next),Fo(n,n.next)}}function Yo(t,e){return ta(t.prev,t,e.prev)<0&&ta(e.next,t,t.next)<0}function Jo(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*r)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*r)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function $o(t){let e=t,n=t;do{(e.x<n.x||e.x===n.x&&e.y<n.y)&&(n=e),e=e.next}while(e!==t);return n}function Ko(t,e,n,i,r,s,o,a){return(r-o)*(e-a)-(t-o)*(s-a)>=0&&(t-o)*(i-a)-(n-o)*(e-a)>=0&&(n-o)*(s-a)-(r-o)*(i-a)>=0}function Qo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&na(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(sa(t,e)&&sa(e,t)&&function(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)&&(ta(t.prev,t,e.prev)||ta(t,e.prev,e))||ea(t,e)&&ta(t.prev,t,t.next)>0&&ta(e.prev,e,e.next)>0)}function ta(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function ea(t,e){return t.x===e.x&&t.y===e.y}function na(t,e,n,i){const r=ra(ta(t,e,n)),s=ra(ta(t,e,i)),o=ra(ta(n,i,t)),a=ra(ta(n,i,e));return r!==s&&o!==a||(!(0!==r||!ia(t,n,e))||(!(0!==s||!ia(t,i,e))||(!(0!==o||!ia(n,t,i))||!(0!==a||!ia(n,e,i)))))}function ia(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function ra(t){return t>0?1:t<0?-1:0}function sa(t,e){return ta(t.prev,t,t.next)<0?ta(t,e,t.next)>=0&&ta(t,t.prev,e)>=0:ta(t,e,t.prev)<0||ta(t,t.next,e)<0}function oa(t,e){const n=new ha(t.i,t.x,t.y),i=new ha(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function aa(t,e,n,i){const r=new ha(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function la(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function ha(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class ca{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;r<e;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*n}static isClockWise(t){return ca.area(t)<0}static triangulateShape(t,e){const n=[],i=[],r=[];da(t),ua(n,t);let s=t.length;e.forEach(da);for(let t=0;t<e.length;t++)i.push(s),s+=e[t].length,ua(n,e[t]);const o=Ho(n,i);for(let t=0;t<o.length;t+=3)r.push(o.slice(t,t+3));return r}}function da(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function ua(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class pa extends Ce{constructor(t=new Oo([new f(.5,.5),new f(-.5,.5),new f(-.5,-.5),new f(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,i=[],r=[];for(let e=0,n=t.length;e<n;e++){s(t[e])}function s(t){const s=[],o=void 0!==e.curveSegments?e.curveSegments:12,a=void 0!==e.steps?e.steps:1;let l=void 0!==e.depth?e.depth:1,h=void 0===e.bevelEnabled||e.bevelEnabled,c=void 0!==e.bevelThickness?e.bevelThickness:.2,d=void 0!==e.bevelSize?e.bevelSize:c-.1,u=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const m=e.extrudePath,g=void 0!==e.UVGenerator?e.UVGenerator:ma;void 0!==e.amount&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),l=e.amount);let v,y,x,_,w,b=!1;m&&(v=m.getSpacedPoints(a),b=!0,h=!1,y=m.computeFrenetFrames(a,!1),x=new q,_=new q,w=new q),h||(p=0,c=0,d=0,u=0);const M=t.extractPoints(o);let S=M.shape;const E=M.holes;if(!ca.isClockWise(S)){S=S.reverse();for(let t=0,e=E.length;t<e;t++){const e=E[t];ca.isClockWise(e)&&(E[t]=e.reverse())}}const T=ca.triangulateShape(S,E),A=S;for(let t=0,e=E.length;t<e;t++){const e=E[t];S=S.concat(e)}function L(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().multiplyScalar(n).add(t)}const C=S.length,k=T.length;function R(t,e,n){let i,r,s;const o=t.x-e.x,a=t.y-e.y,l=n.x-t.x,h=n.y-t.y,c=o*o+a*a,d=o*h-a*l;if(Math.abs(d)>Number.EPSILON){const d=Math.sqrt(c),u=Math.sqrt(l*l+h*h),p=e.x-a/d,m=e.y+o/d,g=((n.x-h/u-p)*h-(n.y+l/u-m)*l)/(o*h-a*l);i=p+o*g-t.x,r=m+a*g-t.y;const v=i*i+r*r;if(v<=2)return new f(i,r);s=Math.sqrt(v/2)}else{let t=!1;o>Number.EPSILON?l>Number.EPSILON&&(t=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(h)&&(t=!0),t?(i=-a,r=o,s=Math.sqrt(c)):(i=o,r=a,s=Math.sqrt(c/2))}return new f(i/s,r/s)}const P=[];for(let t=0,e=A.length,n=e-1,i=t+1;t<e;t++,n++,i++)n===e&&(n=0),i===e&&(i=0),P[t]=R(A[t],A[n],A[i]);const D=[];let I,N=P.concat();for(let t=0,e=E.length;t<e;t++){const e=E[t];I=[];for(let t=0,n=e.length,i=n-1,r=t+1;t<n;t++,i++,r++)i===n&&(i=0),r===n&&(r=0),I[t]=R(e[t],e[i],e[r]);D.push(I),N=N.concat(I)}for(let t=0;t<p;t++){const e=t/p,n=c*Math.cos(e*Math.PI/2),i=d*Math.sin(e*Math.PI/2)+u;for(let t=0,e=A.length;t<e;t++){const e=L(A[t],P[t],i);O(e.x,e.y,-n)}for(let t=0,e=E.length;t<e;t++){const e=E[t];I=D[t];for(let t=0,r=e.length;t<r;t++){const r=L(e[t],I[t],i);O(r.x,r.y,-n)}}}const B=d+u;for(let t=0;t<C;t++){const e=h?L(S[t],N[t],B):S[t];b?(_.copy(y.normals[0]).multiplyScalar(e.x),x.copy(y.binormals[0]).multiplyScalar(e.y),w.copy(v[0]).add(_).add(x),O(w.x,w.y,w.z)):O(e.x,e.y,0)}for(let t=1;t<=a;t++)for(let e=0;e<C;e++){const n=h?L(S[e],N[e],B):S[e];b?(_.copy(y.normals[t]).multiplyScalar(n.x),x.copy(y.binormals[t]).multiplyScalar(n.y),w.copy(v[t]).add(_).add(x),O(w.x,w.y,w.z)):O(n.x,n.y,l/a*t)}for(let t=p-1;t>=0;t--){const e=t/p,n=c*Math.cos(e*Math.PI/2),i=d*Math.sin(e*Math.PI/2)+u;for(let t=0,e=A.length;t<e;t++){const e=L(A[t],P[t],i);O(e.x,e.y,l+n)}for(let t=0,e=E.length;t<e;t++){const e=E[t];I=D[t];for(let t=0,r=e.length;t<r;t++){const r=L(e[t],I[t],i);b?O(r.x,r.y+v[a-1].y,v[a-1].x+n):O(r.x,r.y,l+n)}}}function z(t,e){let n=t.length;for(;--n>=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=a+2*p;t<n;t++){const n=C*t,s=C*(t+1);U(e+i+n,e+r+n,e+r+s,e+i+s)}}}function O(t,e,n){s.push(t),s.push(e),s.push(n)}function H(t,e,r){F(t),F(e),F(r);const s=i.length/3,o=g.generateTopUV(n,i,s-3,s-2,s-1);G(o[0]),G(o[1]),G(o[2])}function U(t,e,r,s){F(t),F(e),F(s),F(e),F(r),F(s);const o=i.length/3,a=g.generateSideWallUV(n,i,o-6,o-3,o-2,o-1);G(a[0]),G(a[1]),G(a[3]),G(a[1]),G(a[2]),G(a[3])}function F(t){i.push(s[3*t+0]),i.push(s[3*t+1]),i.push(s[3*t+2])}function G(t){r.push(t.x),r.push(t.y)}!function(){const t=i.length/3;if(h){let t=0,e=C*t;for(let t=0;t<k;t++){const n=T[t];H(n[2]+e,n[1]+e,n[0]+e)}t=a+2*p,e=C*t;for(let t=0;t<k;t++){const n=T[t];H(n[0]+e,n[1]+e,n[2]+e)}}else{for(let t=0;t<k;t++){const e=T[t];H(e[2],e[1],e[0])}for(let t=0;t<k;t++){const e=T[t];H(e[0]+C*a,e[1]+C*a,e[2]+C*a)}}n.addGroup(t,i.length/3-t,0)}(),function(){const t=i.length/3;let e=0;z(A,e),e+=A.length;for(let t=0,n=E.length;t<n;t++){const n=E[t];z(n,e),e+=n.length}n.addGroup(t,i.length/3-t,1)}()}this.setAttribute("position",new _e(i,3)),this.setAttribute("uv",new _e(r,2)),this.computeVertexNormals()}toJSON(){const t=super.toJSON();return function(t,e,n){if(n.shapes=[],Array.isArray(t))for(let e=0,i=t.length;e<i;e++){const i=t[e];n.shapes.push(i.uuid)}else n.shapes.push(t.uuid);void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON());return n}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}const i=t.options.extrudePath;return void 0!==i&&(t.options.extrudePath=(new Mo[i.type]).fromJSON(i)),new pa(n,t.options)}}const ma={generateTopUV:function(t,e,n,i,r){const s=e[3*n],o=e[3*n+1],a=e[3*i],l=e[3*i+1],h=e[3*r],c=e[3*r+1];return[new f(s,o),new f(a,l),new f(h,c)]},generateSideWallUV:function(t,e,n,i,r,s){const o=e[3*n],a=e[3*n+1],l=e[3*n+2],h=e[3*i],c=e[3*i+1],d=e[3*i+2],u=e[3*r],p=e[3*r+1],m=e[3*r+2],g=e[3*s],v=e[3*s+1],y=e[3*s+2];return Math.abs(a-c)<Math.abs(o-h)?[new f(o,1-l),new f(h,1-d),new f(u,1-m),new f(g,1-y)]:[new f(a,1-l),new f(c,1-d),new f(p,1-m),new f(v,1-y)]}};class fa extends Ro{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[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],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new fa(t.radius,t.detail)}}class ga extends Ro{constructor(t=1,e=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new ga(t.radius,t.detail)}}class va extends Ce{constructor(t=.5,e=1,n=8,i=1,r=0,s=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:s},n=Math.max(3,n);const o=[],a=[],l=[],h=[];let c=t;const d=(e-t)/(i=Math.max(1,i)),u=new q,p=new f;for(let t=0;t<=i;t++){for(let t=0;t<=n;t++){const i=r+t/n*s;u.x=c*Math.cos(i),u.y=c*Math.sin(i),a.push(u.x,u.y,u.z),l.push(0,0,1),p.x=(u.x/e+1)/2,p.y=(u.y/e+1)/2,h.push(p.x,p.y)}c+=d}for(let t=0;t<i;t++){const e=t*(n+1);for(let t=0;t<n;t++){const i=t+e,r=i,s=i+n+1,a=i+n+2,l=i+1;o.push(r,s,l),o.push(s,a,l)}}this.setIndex(o),this.setAttribute("position",new _e(a,3)),this.setAttribute("normal",new _e(l,3)),this.setAttribute("uv",new _e(h,2))}static fromJSON(t){return new va(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class ya extends Ce{constructor(t=new Oo([new f(0,.5),new f(-.5,-.5),new f(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],i=[],r=[],s=[];let o=0,a=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(o,a,e),o+=a,a=0;function l(t){const o=i.length/3,l=t.extractPoints(e);let h=l.shape;const c=l.holes;!1===ca.isClockWise(h)&&(h=h.reverse());for(let t=0,e=c.length;t<e;t++){const e=c[t];!0===ca.isClockWise(e)&&(c[t]=e.reverse())}const d=ca.triangulateShape(h,c);for(let t=0,e=c.length;t<e;t++){const e=c[t];h=h.concat(e)}for(let t=0,e=h.length;t<e;t++){const e=h[t];i.push(e.x,e.y,0),r.push(0,0,1),s.push(e.x,e.y)}for(let t=0,e=d.length;t<e;t++){const e=d[t],i=e[0]+o,r=e[1]+o,s=e[2]+o;n.push(i,r,s),a+=3}}this.setIndex(n),this.setAttribute("position",new _e(i,3)),this.setAttribute("normal",new _e(r,3)),this.setAttribute("uv",new _e(s,2))}toJSON(){const t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,i=t.length;n<i;n++){const i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}return new ya(n,t.curveSegments)}}class xa extends Ce{constructor(t=1,e=32,n=16,i=0,r=2*Math.PI,s=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:s,thetaLength:o},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const a=Math.min(s+o,Math.PI);let l=0;const h=[],c=new q,d=new q,u=[],p=[],m=[],f=[];for(let u=0;u<=n;u++){const g=[],v=u/n;let y=0;0==u&&0==s?y=.5/e:u==n&&a==Math.PI&&(y=-.5/e);for(let n=0;n<=e;n++){const a=n/e;c.x=-t*Math.cos(i+a*r)*Math.sin(s+v*o),c.y=t*Math.cos(s+v*o),c.z=t*Math.sin(i+a*r)*Math.sin(s+v*o),p.push(c.x,c.y,c.z),d.copy(c).normalize(),m.push(d.x,d.y,d.z),f.push(a+y,1-v),g.push(l++)}h.push(g)}for(let t=0;t<n;t++)for(let i=0;i<e;i++){const e=h[t][i+1],r=h[t][i],o=h[t+1][i],l=h[t+1][i+1];(0!==t||s>0)&&u.push(e,r,l),(t!==n-1||a<Math.PI)&&u.push(r,o,l)}this.setIndex(u),this.setAttribute("position",new _e(p,3)),this.setAttribute("normal",new _e(m,3)),this.setAttribute("uv",new _e(f,2))}static fromJSON(t){return new xa(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class _a extends Ro{constructor(t=1,e=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new _a(t.radius,t.detail)}}class wa extends Ce{constructor(t=1,e=.4,n=8,i=6,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const s=[],o=[],a=[],l=[],h=new q,c=new q,d=new q;for(let s=0;s<=n;s++)for(let u=0;u<=i;u++){const p=u/i*r,m=s/n*Math.PI*2;c.x=(t+e*Math.cos(m))*Math.cos(p),c.y=(t+e*Math.cos(m))*Math.sin(p),c.z=e*Math.sin(m),o.push(c.x,c.y,c.z),h.x=t*Math.cos(p),h.y=t*Math.sin(p),d.subVectors(c,h).normalize(),a.push(d.x,d.y,d.z),l.push(u/i),l.push(s/n)}for(let t=1;t<=n;t++)for(let e=1;e<=i;e++){const n=(i+1)*t+e-1,r=(i+1)*(t-1)+e-1,o=(i+1)*(t-1)+e,a=(i+1)*t+e;s.push(n,r,a),s.push(r,o,a)}this.setIndex(s),this.setAttribute("position",new _e(o,3)),this.setAttribute("normal",new _e(a,3)),this.setAttribute("uv",new _e(l,2))}static fromJSON(t){return new wa(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class ba extends Ce{constructor(t=1,e=.4,n=64,i=8,r=2,s=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:r,q:s},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],l=[],h=[],c=new q,d=new q,u=new q,p=new q,m=new q,f=new q,g=new q;for(let o=0;o<=n;++o){const y=o/n*r*Math.PI*2;v(y,r,s,t,u),v(y+.01,r,s,t,p),f.subVectors(p,u),g.addVectors(p,u),m.crossVectors(f,g),g.crossVectors(m,f),m.normalize(),g.normalize();for(let t=0;t<=i;++t){const r=t/i*Math.PI*2,s=-e*Math.cos(r),p=e*Math.sin(r);c.x=u.x+(s*g.x+p*m.x),c.y=u.y+(s*g.y+p*m.y),c.z=u.z+(s*g.z+p*m.z),a.push(c.x,c.y,c.z),d.subVectors(c,u).normalize(),l.push(d.x,d.y,d.z),h.push(o/n),h.push(t/i)}}for(let t=1;t<=n;t++)for(let e=1;e<=i;e++){const n=(i+1)*(t-1)+(e-1),r=(i+1)*t+(e-1),s=(i+1)*t+e,a=(i+1)*(t-1)+e;o.push(n,r,a),o.push(r,s,a)}function v(t,e,n,i,r){const s=Math.cos(t),o=Math.sin(t),a=n/e*t,l=Math.cos(a);r.x=i*(2+l)*.5*s,r.y=i*(2+l)*o*.5,r.z=i*Math.sin(a)*.5}this.setIndex(o),this.setAttribute("position",new _e(a,3)),this.setAttribute("normal",new _e(l,3)),this.setAttribute("uv",new _e(h,2))}static fromJSON(t){return new ba(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class Ma extends Ce{constructor(t=new wo(new q(-1,-1,0),new q(-1,1,0),new q(1,1,0)),e=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r};const s=t.computeFrenetFrames(e,r);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;const o=new q,a=new q,l=new f;let h=new q;const c=[],d=[],u=[],p=[];function m(r){h=t.getPointAt(r/e,h);const l=s.normals[r],u=s.binormals[r];for(let t=0;t<=i;t++){const e=t/i*Math.PI*2,r=Math.sin(e),s=-Math.cos(e);a.x=s*l.x+r*u.x,a.y=s*l.y+r*u.y,a.z=s*l.z+r*u.z,a.normalize(),d.push(a.x,a.y,a.z),o.x=h.x+n*a.x,o.y=h.y+n*a.y,o.z=h.z+n*a.z,c.push(o.x,o.y,o.z)}}!function(){for(let t=0;t<e;t++)m(t);m(!1===r?e:0),function(){for(let t=0;t<=e;t++)for(let n=0;n<=i;n++)l.x=t/e,l.y=n/i,u.push(l.x,l.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=i;e++){const n=(i+1)*(t-1)+(e-1),r=(i+1)*t+(e-1),s=(i+1)*t+e,o=(i+1)*(t-1)+e;p.push(n,r,o),p.push(r,s,o)}}()}(),this.setIndex(p),this.setAttribute("position",new _e(c,3)),this.setAttribute("normal",new _e(d,3)),this.setAttribute("uv",new _e(u,2))}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new Ma((new Mo[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class Sa extends Ce{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},null!==t){const e=[],n=new Set,i=new q,r=new q;if(null!==t.index){const s=t.attributes.position,o=t.index;let a=t.groups;0===a.length&&(a=[{start:0,count:o.count,materialIndex:0}]);for(let t=0,l=a.length;t<l;++t){const l=a[t],h=l.start;for(let t=h,a=h+l.count;t<a;t+=3)for(let a=0;a<3;a++){const l=o.getX(t+a),h=o.getX(t+(a+1)%3);i.fromBufferAttribute(s,l),r.fromBufferAttribute(s,h),!0===Ea(i,r,n)&&(e.push(i.x,i.y,i.z),e.push(r.x,r.y,r.z))}}}else{const s=t.attributes.position;for(let t=0,o=s.count/3;t<o;t++)for(let o=0;o<3;o++){const a=3*t+o,l=3*t+(o+1)%3;i.fromBufferAttribute(s,a),r.fromBufferAttribute(s,l),!0===Ea(i,r,n)&&(e.push(i.x,i.y,i.z),e.push(r.x,r.y,r.z))}}this.setAttribute("position",new _e(e,3))}}}function Ea(t,e,n){const i=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return!0!==n.has(i)&&!0!==n.has(r)&&(n.add(i),n.add(r),!0)}var Ta=Object.freeze({__proto__:null,BoxGeometry:Ye,BoxBufferGeometry:Ye,CapsuleGeometry:Ao,CapsuleBufferGeometry:Ao,CircleGeometry:Lo,CircleBufferGeometry:Lo,ConeGeometry:ko,ConeBufferGeometry:ko,CylinderGeometry:Co,CylinderBufferGeometry:Co,DodecahedronGeometry:Po,DodecahedronBufferGeometry:Po,EdgesGeometry:zo,ExtrudeGeometry:pa,ExtrudeBufferGeometry:pa,IcosahedronGeometry:fa,IcosahedronBufferGeometry:fa,LatheGeometry:To,LatheBufferGeometry:To,OctahedronGeometry:ga,OctahedronBufferGeometry:ga,PlaneGeometry:fn,PlaneBufferGeometry:fn,PolyhedronGeometry:Ro,PolyhedronBufferGeometry:Ro,RingGeometry:va,RingBufferGeometry:va,ShapeGeometry:ya,ShapeBufferGeometry:ya,SphereGeometry:xa,SphereBufferGeometry:xa,TetrahedronGeometry:_a,TetrahedronBufferGeometry:_a,TorusGeometry:wa,TorusBufferGeometry:wa,TorusKnotGeometry:ba,TorusKnotBufferGeometry:ba,TubeGeometry:Ma,TubeBufferGeometry:Ma,WireframeGeometry:Sa});class Aa extends ae{constructor(t){super(),this.type="ShadowMaterial",this.color=new R(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}Aa.prototype.isShadowMaterial=!0;class La extends Qe{constructor(t){super(t),this.type="RawShaderMaterial"}}La.prototype.isRawShaderMaterial=!0;class Ca extends ae{constructor(t){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new R(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 R(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new f(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}Ca.prototype.isMeshStandardMaterial=!0;class ka extends Ca{constructor(t){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new f(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return l(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.sheenColor=new R(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new R(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new R(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._transmission=0,this.setValues(t)}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}ka.prototype.isMeshPhysicalMaterial=!0;class Ra extends ae{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new R(16777215),this.specular=new R(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new R(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new f(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this}}Ra.prototype.isMeshPhongMaterial=!0;class Pa extends ae{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new R(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new R(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new f(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.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Pa.prototype.isMeshToonMaterial=!0;class Da extends ae{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new f(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}Da.prototype.isMeshNormalMaterial=!0;class Ia extends ae{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new R(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new R(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this}}Ia.prototype.isMeshLambertMaterial=!0;class Na extends ae{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new R(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new f(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this}}Na.prototype.isMeshMatcapMaterial=!0;class Ba extends Ns{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}Ba.prototype.isLineDashedMaterial=!0;const za={ShadowMaterial:Aa,SpriteMaterial:Qr,RawShaderMaterial:La,ShaderMaterial:Qe,PointsMaterial:qs,MeshPhysicalMaterial:ka,MeshStandardMaterial:Ca,MeshPhongMaterial:Ra,MeshToonMaterial:Pa,MeshNormalMaterial:Da,MeshLambertMaterial:Ia,MeshDepthMaterial:Pr,MeshDistanceMaterial:Dr,MeshBasicMaterial:le,MeshMatcapMaterial:Na,LineDashedMaterial:Ba,LineBasicMaterial:Ns,Material:ae};ae.fromType=function(t){return new za[t]};const Oa={arraySlice:function(t,e,n){return Oa.isTypedArray(t)?new t.constructor(t.subarray(e,void 0!==n?n:t.length)):t.slice(e,n)},convertArray:function(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)},isTypedArray:function(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)},getKeyframeOrder:function(t){const e=t.length,n=new Array(e);for(let t=0;t!==e;++t)n[t]=t;return n.sort((function(e,n){return t[e]-t[n]})),n},sortedArray:function(t,e,n){const i=t.length,r=new t.constructor(i);for(let s=0,o=0;o!==i;++s){const i=n[s]*e;for(let n=0;n!==e;++n)r[o++]=t[i+n]}return r},flattenJSON:function(t,e,n,i){let r=1,s=t[0];for(;void 0!==s&&void 0===s[i];)s=t[r++];if(void 0===s)return;let o=s[i];if(void 0!==o)if(Array.isArray(o))do{o=s[i],void 0!==o&&(e.push(s.time),n.push.apply(n,o)),s=t[r++]}while(void 0!==s);else if(void 0!==o.toArray)do{o=s[i],void 0!==o&&(e.push(s.time),o.toArray(n,n.length)),s=t[r++]}while(void 0!==s);else do{o=s[i],void 0!==o&&(e.push(s.time),n.push(o)),s=t[r++]}while(void 0!==s)},subclip:function(t,e,n,i,r=30){const s=t.clone();s.name=e;const o=[];for(let t=0;t<s.tracks.length;++t){const e=s.tracks[t],a=e.getValueSize(),l=[],h=[];for(let t=0;t<e.times.length;++t){const s=e.times[t]*r;if(!(s<n||s>=i)){l.push(e.times[t]);for(let n=0;n<a;++n)h.push(e.values[t*a+n])}}0!==l.length&&(e.times=Oa.convertArray(l,e.times.constructor),e.values=Oa.convertArray(h,e.values.constructor),o.push(e))}s.tracks=o;let a=1/0;for(let t=0;t<s.tracks.length;++t)a>s.tracks[t].times[0]&&(a=s.tracks[t].times[0]);for(let t=0;t<s.tracks.length;++t)s.tracks[t].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(t,e=0,n=t,i=30){i<=0&&(i=30);const r=n.tracks.length,s=e/i;for(let e=0;e<r;++e){const i=n.tracks[e],r=i.ValueTypeName;if("bool"===r||"string"===r)continue;const o=t.tracks.find((function(t){return t.name===i.name&&t.ValueTypeName===r}));if(void 0===o)continue;let a=0;const l=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=l/3);let h=0;const c=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=c/3);const d=i.times.length-1;let u;if(s<=i.times[0]){const t=a,e=l-a;u=Oa.arraySlice(i.values,t,e)}else if(s>=i.times[d]){const t=d*l+a,e=t+l-a;u=Oa.arraySlice(i.values,t,e)}else{const t=i.createInterpolant(),e=a,n=l-a;t.evaluate(s),u=Oa.arraySlice(t.resultBuffer,e,n)}if("quaternion"===r){(new j).fromArray(u).normalize().conjugate().toArray(u)}const p=o.times.length;for(let t=0;t<p;++t){const e=t*c+h;if("quaternion"===r)j.multiplyQuaternionsFlat(o.values,e,u,0,o.values,e);else{const t=c-2*h;for(let n=0;n<t;++n)o.values[e+n]-=u[n]}}}return t.blendMode=2501,t}};class Ha{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{let s;n:{i:if(!(t<i)){for(let s=n+2;;){if(void 0===i){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,t,r)}if(n===s)break;if(r=i,i=e[++n],t<i)break e}s=e.length;break n}if(t>=r)break t;{const o=e[1];t<o&&(n=2,r=o);for(let s=n-2;;){if(void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(n===s)break;if(i=r,r=e[--n-1],t>=r)break e}s=n,n=0}}for(;n<s;){const i=n+s>>>1;t<e[i]?s=i:n=i+1}if(i=e[n],r=e[n-1],void 0===r)return this._cachedIndex=0,this.beforeStart_(0,t,i);if(void 0===i)return n=e.length,this._cachedIndex=n,this.afterEnd_(n-1,r,t)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i;for(let t=0;t!==i;++t)e[t]=n[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}Ha.prototype.beforeStart_=Ha.prototype.copySampleValue_,Ha.prototype.afterEnd_=Ha.prototype.copySampleValue_;class Ua extends Ha{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(t,e,n){const i=this.parameterPositions;let r=t-2,s=t+1,o=i[r],a=i[s];if(void 0===o)switch(this.getSettings_().endingStart){case 2401:r=t,o=2*e-n;break;case 2402:r=i.length-2,o=e+i[r]-i[r+1];break;default:r=t,o=n}if(void 0===a)switch(this.getSettings_().endingEnd){case 2401:s=t,a=2*n-e;break;case 2402:s=1,a=n+i[1]-i[0];break;default:s=t-1,a=e}const l=.5*(n-e),h=this.valueSize;this._weightPrev=l/(e-o),this._weightNext=l/(a-n),this._offsetPrev=r*h,this._offsetNext=s*h}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,h=this._offsetPrev,c=this._offsetNext,d=this._weightPrev,u=this._weightNext,p=(n-e)/(i-e),m=p*p,f=m*p,g=-d*f+2*d*m-d*p,v=(1+d)*f+(-1.5-2*d)*m+(-.5+d)*p+1,y=(-1-u)*f+(1.5+u)*m+.5*p,x=u*f-u*m;for(let t=0;t!==o;++t)r[t]=g*s[h+t]+v*s[l+t]+y*s[a+t]+x*s[c+t];return r}}class Fa extends Ha{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,h=(n-e)/(i-e),c=1-h;for(let t=0;t!==o;++t)r[t]=s[l+t]*c+s[a+t]*h;return r}}class Ga extends Ha{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class Va{constructor(t,e,n,i){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Oa.convertArray(e,this.TimeBufferType),this.values=Oa.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:Oa.convertArray(t.times,Array),values:Oa.convertArray(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new Ga(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Fa(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Ua(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case 2300:e=this.InterpolantFactoryMethodDiscrete;break;case 2301:e=this.InterpolantFactoryMethodLinear;break;case 2302:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){const n=this.times,i=n.length;let r=0,s=i-1;for(;r!==i&&n[r]<t;)++r;for(;-1!==s&&n[s]>e;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=Oa.arraySlice(n,r,s),this.values=Oa.arraySlice(this.values,r*t,s*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let e=0;e!==r;e++){const i=n[e];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==s&&s>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,s),t=!1;break}s=i}if(void 0!==i&&Oa.isTypedArray(i))for(let e=0,n=i.length;e!==n;++e){const n=i[e];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,n),t=!1;break}}return t}optimize(){const t=Oa.arraySlice(this.times),e=Oa.arraySlice(this.values),n=this.getValueSize(),i=2302===this.getInterpolation(),r=t.length-1;let s=1;for(let o=1;o<r;++o){let r=!1;const a=t[o];if(a!==t[o+1]&&(1!==o||a!==t[0]))if(i)r=!0;else{const t=o*n,i=t-n,s=t+n;for(let o=0;o!==n;++o){const n=e[t+o];if(n!==e[i+o]||n!==e[s+o]){r=!0;break}}}if(r){if(o!==s){t[s]=t[o];const i=o*n,r=s*n;for(let t=0;t!==n;++t)e[r+t]=e[i+t]}++s}}if(r>0){t[s]=t[r];for(let t=r*n,i=s*n,o=0;o!==n;++o)e[i+o]=e[t+o];++s}return s!==t.length?(this.times=Oa.arraySlice(t,0,s),this.values=Oa.arraySlice(e,0,s*n)):(this.times=t,this.values=e),this}clone(){const t=Oa.arraySlice(this.times,0),e=Oa.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}Va.prototype.TimeBufferType=Float32Array,Va.prototype.ValueBufferType=Float32Array,Va.prototype.DefaultInterpolation=2301;class Wa extends Va{}Wa.prototype.ValueTypeName="bool",Wa.prototype.ValueBufferType=Array,Wa.prototype.DefaultInterpolation=2300,Wa.prototype.InterpolantFactoryMethodLinear=void 0,Wa.prototype.InterpolantFactoryMethodSmooth=void 0;class ja extends Va{}ja.prototype.ValueTypeName="color";class qa extends Va{}qa.prototype.ValueTypeName="number";class Za extends Ha{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-e)/(i-e);let l=t*o;for(let t=l+o;l!==t;l+=4)j.slerpFlat(r,0,s,l-o,s,l,a);return r}}class Xa extends Va{InterpolantFactoryMethodLinear(t){return new Za(this.times,this.values,this.getValueSize(),t)}}Xa.prototype.ValueTypeName="quaternion",Xa.prototype.DefaultInterpolation=2301,Xa.prototype.InterpolantFactoryMethodSmooth=void 0;class Ya extends Va{}Ya.prototype.ValueTypeName="string",Ya.prototype.ValueBufferType=Array,Ya.prototype.DefaultInterpolation=2300,Ya.prototype.InterpolantFactoryMethodLinear=void 0,Ya.prototype.InterpolantFactoryMethodSmooth=void 0;class Ja extends Va{}Ja.prototype.ValueTypeName="vector";class $a{constructor(t,e=-1,n,i=2500){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=a(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let t=0,r=n.length;t!==r;++t)e.push(Ka(n[t]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,i=n.length;t!==i;++t)e.push(Va.toJSON(n[t]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,s=[];for(let t=0;t<r;t++){let o=[],a=[];o.push((t+r-1)%r,t,(t+1)%r),a.push(0,1,0);const l=Oa.getKeyframeOrder(o);o=Oa.sortedArray(o,1,l),a=Oa.sortedArray(a,1,l),i||0!==o[0]||(o.push(r),a.push(a[0])),s.push(new qa(".morphTargetInfluences["+e[t].name+"]",o,a).scale(1/n))}return new this(t,-1,s)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const e=t;n=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,n=t.length;e<n;e++){const n=t[e],s=n.name.match(r);if(s&&s.length>1){const t=s[1];let e=i[t];e||(i[t]=e=[]),e.push(n)}}const s=[];for(const t in i)s.push(this.CreateFromMorphTargetSequence(t,i[t],e,n));return s}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,i,r){if(0!==n.length){const s=[],o=[];Oa.flattenJSON(n,s,o,i),0!==s.length&&r.push(new t(e,s,o))}},i=[],r=t.name||"default",s=t.fps||30,o=t.blendMode;let a=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const r=l[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let n=0;n<r[e].morphTargets.length;n++)t[r[e].morphTargets[n]]=-1;for(const n in t){const t=[],s=[];for(let i=0;i!==r[e].morphTargets.length;++i){const i=r[e];t.push(i.time),s.push(i.morphTarget===n?1:0)}i.push(new qa(".morphTargetInfluence["+n+"]",t,s))}a=t.length*s}else{const s=".bones["+e[t].name+"]";n(Ja,s+".position",r,"pos",i),n(Xa,s+".quaternion",r,"rot",i),n(Ja,s+".scale",r,"scl",i)}}if(0===i.length)return null;return new this(r,a,i,o)}resetDuration(){let t=0;for(let e=0,n=this.tracks.length;e!==n;++e){const n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Ka(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return qa;case"vector":case"vector2":case"vector3":case"vector4":return Ja;case"color":return ja;case"quaternion":return Xa;case"bool":case"boolean":return Wa;case"string":return Ya}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],n=[];Oa.flattenJSON(t.keys,e,n,"value"),t.times=e,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const Qa={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class tl{constructor(t,e,n){const i=this;let r,s=!1,o=0,a=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){a++,!1===s&&void 0!==i.onStart&&i.onStart(t,o,a),s=!0},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,a),o===a&&(s=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=l.length;e<n;e+=2){const n=l[e],i=l[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return i}return null}}}const el=new tl;class nl{constructor(t){this.manager=void 0!==t?t:el,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise((function(i,r){n.load(t,i,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}const il={};class rl extends nl{constructor(t){super(t)}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=Qa.get(t);if(void 0!==r)return this.manager.itemStart(t),setTimeout((()=>{e&&e(r),this.manager.itemEnd(t)}),0),r;if(void 0!==il[t])return void il[t].push({onLoad:e,onProgress:n,onError:i});il[t]=[],il[t].push({onLoad:e,onProgress:n,onError:i});const s=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,a=this.responseType;fetch(s).then((e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const n=il[t],i=e.body.getReader(),r=e.headers.get("Content-Length"),s=r?parseInt(r):0,o=0!==s;let a=0;const l=new ReadableStream({start(t){!function e(){i.read().then((({done:i,value:r})=>{if(i)t.close();else{a+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:o,loaded:a,total:s});for(let t=0,e=n.length;t<e;t++){const e=n[t];e.onProgress&&e.onProgress(i)}t.enqueue(r),e()}}))}()}});return new Response(l)}throw Error(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`)})).then((t=>{switch(a){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,o)));case"json":return t.json();default:if(void 0===o)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(o),n=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(n);return t.arrayBuffer().then((t=>i.decode(t)))}}})).then((e=>{Qa.add(t,e);const n=il[t];delete il[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onLoad&&i.onLoad(e)}})).catch((e=>{const n=il[t];if(void 0===n)throw this.manager.itemError(t),e;delete il[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}this.manager.itemError(t)})).finally((()=>{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class sl extends nl{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Qa.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s;const o=_("img");function a(){h(),Qa.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){h(),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}function h(){o.removeEventListener("load",a,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",a,!1),o.addEventListener("error",l,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(t),o.src=t,o}}class ol extends nl{constructor(t){super(t)}load(t,e,n,i){const r=new rn,s=new sl(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let o=0;function a(n){s.load(t[n],(function(t){r.images[n]=t,o++,6===o&&(r.needsUpdate=!0,e&&e(r))}),void 0,i)}for(let e=0;e<t.length;++e)a(e);return r}}class al extends nl{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new Es,o=new rl(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(t,(function(t){const n=r.parse(t);n&&(void 0!==n.image?s.image=n.image:void 0!==n.data&&(s.image.width=n.width,s.image.height=n.height,s.image.data=n.data),s.wrapS=void 0!==n.wrapS?n.wrapS:1001,s.wrapT=void 0!==n.wrapT?n.wrapT:1001,s.magFilter=void 0!==n.magFilter?n.magFilter:1006,s.minFilter=void 0!==n.minFilter?n.minFilter:1006,s.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.encoding&&(s.encoding=n.encoding),void 0!==n.flipY&&(s.flipY=n.flipY),void 0!==n.format&&(s.format=n.format),void 0!==n.type&&(s.type=n.type),void 0!==n.mipmaps&&(s.mipmaps=n.mipmaps,s.minFilter=1008),1===n.mipmapCount&&(s.minFilter=1006),void 0!==n.generateMipmaps&&(s.generateMipmaps=n.generateMipmaps),s.needsUpdate=!0,e&&e(s,n))}),n,i),s}}class ll extends nl{constructor(t){super(t)}load(t,e,n,i){const r=new z,s=new sl(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(t,(function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}class hl extends Xt{constructor(t,e=1){super(),this.type="Light",this.color=new R(t),this.intensity=e}dispose(){}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}hl.prototype.isLight=!0;class cl extends hl{constructor(t,e,n){super(t,n),this.type="HemisphereLight",this.position.copy(Xt.DefaultUp),this.updateMatrix(),this.groundColor=new R(e)}copy(t){return hl.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}cl.prototype.isHemisphereLight=!0;const dl=new Mt,ul=new q,pl=new q;class ml{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new f(512,512),this.map=null,this.mapPass=null,this.matrix=new Mt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new un,this._frameExtents=new f(1,1),this._viewportCount=1,this._viewports=[new O(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;ul.setFromMatrixPosition(t.matrixWorld),e.position.copy(ul),pl.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(pl),e.updateMatrixWorld(),dl.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(dl),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(e.projectionMatrix),n.multiply(e.matrixWorldInverse)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class fl extends ml{constructor(){super(new en(50,1,.5,500)),this.focus=1}updateMatrices(t){const e=this.camera,n=2*o*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}fl.prototype.isSpotLightShadow=!0;class gl extends hl{constructor(t,e,n=0,i=Math.PI/3,r=0,s=1){super(t,e),this.type="SpotLight",this.position.copy(Xt.DefaultUp),this.updateMatrix(),this.target=new Xt,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.shadow=new fl}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}gl.prototype.isSpotLight=!0;const vl=new Mt,yl=new q,xl=new q;class _l extends ml{constructor(){super(new en(90,1,.5,500)),this._frameExtents=new f(4,2),this._viewportCount=6,this._viewports=[new O(2,1,1,1),new O(0,1,1,1),new O(3,1,1,1),new O(1,1,1,1),new O(3,0,1,1),new O(1,0,1,1)],this._cubeDirections=[new q(1,0,0),new q(-1,0,0),new q(0,0,1),new q(0,0,-1),new q(0,1,0),new q(0,-1,0)],this._cubeUps=[new q(0,1,0),new q(0,1,0),new q(0,1,0),new q(0,1,0),new q(0,0,1),new q(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,i=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),yl.setFromMatrixPosition(t.matrixWorld),n.position.copy(yl),xl.copy(n.position),xl.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(xl),n.updateMatrixWorld(),i.makeTranslation(-yl.x,-yl.y,-yl.z),vl.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(vl)}}_l.prototype.isPointLightShadow=!0;class wl extends hl{constructor(t,e,n=0,i=1){super(t,e),this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new _l}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}wl.prototype.isPointLight=!0;class bl extends ml{constructor(){super(new En(-5,5,5,-5,.5,500))}}bl.prototype.isDirectionalLightShadow=!0;class Ml extends hl{constructor(t,e){super(t,e),this.type="DirectionalLight",this.position.copy(Xt.DefaultUp),this.updateMatrix(),this.target=new Xt,this.shadow=new bl}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Ml.prototype.isDirectionalLight=!0;class Sl extends hl{constructor(t,e){super(t,e),this.type="AmbientLight"}}Sl.prototype.isAmbientLight=!0;class El extends hl{constructor(t,e,n=10,i=10){super(t,e),this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}El.prototype.isRectAreaLight=!0;class Tl{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new q)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,i=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.282095),e.addScaledVector(s[1],.488603*i),e.addScaledVector(s[2],.488603*r),e.addScaledVector(s[3],.488603*n),e.addScaledVector(s[4],n*i*1.092548),e.addScaledVector(s[5],i*r*1.092548),e.addScaledVector(s[6],.315392*(3*r*r-1)),e.addScaledVector(s[7],n*r*1.092548),e.addScaledVector(s[8],.546274*(n*n-i*i)),e}getIrradianceAt(t,e){const n=t.x,i=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.886227),e.addScaledVector(s[1],1.023328*i),e.addScaledVector(s[2],1.023328*r),e.addScaledVector(s[3],1.023328*n),e.addScaledVector(s[4],.858086*n*i),e.addScaledVector(s[5],.858086*i*r),e.addScaledVector(s[6],.743125*r*r-.247708),e.addScaledVector(s[7],.858086*n*r),e.addScaledVector(s[8],.429043*(n*n-i*i)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(t,e+3*i);return this}toArray(t=[],e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(t,e+3*i);return t}static getBasisAt(t,e){const n=t.x,i=t.y,r=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-i*i)}}Tl.prototype.isSphericalHarmonics3=!0;class Al extends hl{constructor(t=new Tl,e=1){super(void 0,e),this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}Al.prototype.isLightProbe=!0;class Ll extends nl{constructor(t){super(t),this.textures={}}load(t,e,n,i){const r=this,s=new rl(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e=this.textures;function n(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}const i=ae.fromType(t.type);if(void 0!==t.uuid&&(i.uuid=t.uuid),void 0!==t.name&&(i.name=t.name),void 0!==t.color&&void 0!==i.color&&i.color.setHex(t.color),void 0!==t.roughness&&(i.roughness=t.roughness),void 0!==t.metalness&&(i.metalness=t.metalness),void 0!==t.sheen&&(i.sheen=t.sheen),void 0!==t.sheenColor&&(i.sheenColor=(new R).setHex(t.sheenColor)),void 0!==t.sheenRoughness&&(i.sheenRoughness=t.sheenRoughness),void 0!==t.emissive&&void 0!==i.emissive&&i.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==i.specular&&i.specular.setHex(t.specular),void 0!==t.specularIntensity&&(i.specularIntensity=t.specularIntensity),void 0!==t.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(t.specularColor),void 0!==t.shininess&&(i.shininess=t.shininess),void 0!==t.clearcoat&&(i.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(i.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.transmission&&(i.transmission=t.transmission),void 0!==t.thickness&&(i.thickness=t.thickness),void 0!==t.attenuationDistance&&(i.attenuationDistance=t.attenuationDistance),void 0!==t.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(t.attenuationColor),void 0!==t.fog&&(i.fog=t.fog),void 0!==t.flatShading&&(i.flatShading=t.flatShading),void 0!==t.blending&&(i.blending=t.blending),void 0!==t.combine&&(i.combine=t.combine),void 0!==t.side&&(i.side=t.side),void 0!==t.shadowSide&&(i.shadowSide=t.shadowSide),void 0!==t.opacity&&(i.opacity=t.opacity),void 0!==t.transparent&&(i.transparent=t.transparent),void 0!==t.alphaTest&&(i.alphaTest=t.alphaTest),void 0!==t.depthTest&&(i.depthTest=t.depthTest),void 0!==t.depthWrite&&(i.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(i.colorWrite=t.colorWrite),void 0!==t.stencilWrite&&(i.stencilWrite=t.stencilWrite),void 0!==t.stencilWriteMask&&(i.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(i.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(i.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(i.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(i.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(i.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(i.stencilZPass=t.stencilZPass),void 0!==t.wireframe&&(i.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(i.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(i.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(i.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(i.rotation=t.rotation),1!==t.linewidth&&(i.linewidth=t.linewidth),void 0!==t.dashSize&&(i.dashSize=t.dashSize),void 0!==t.gapSize&&(i.gapSize=t.gapSize),void 0!==t.scale&&(i.scale=t.scale),void 0!==t.polygonOffset&&(i.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(i.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(i.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.dithering&&(i.dithering=t.dithering),void 0!==t.alphaToCoverage&&(i.alphaToCoverage=t.alphaToCoverage),void 0!==t.premultipliedAlpha&&(i.premultipliedAlpha=t.premultipliedAlpha),void 0!==t.visible&&(i.visible=t.visible),void 0!==t.toneMapped&&(i.toneMapped=t.toneMapped),void 0!==t.userData&&(i.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?i.vertexColors=t.vertexColors>0:i.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const e in t.uniforms){const r=t.uniforms[e];switch(i.uniforms[e]={},r.type){case"t":i.uniforms[e].value=n(r.value);break;case"c":i.uniforms[e].value=(new R).setHex(r.value);break;case"v2":i.uniforms[e].value=(new f).fromArray(r.value);break;case"v3":i.uniforms[e].value=(new q).fromArray(r.value);break;case"v4":i.uniforms[e].value=(new O).fromArray(r.value);break;case"m3":i.uniforms[e].value=(new g).fromArray(r.value);break;case"m4":i.uniforms[e].value=(new Mt).fromArray(r.value);break;default:i.uniforms[e].value=r.value}}if(void 0!==t.defines&&(i.defines=t.defines),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.extensions)for(const e in t.extensions)i.extensions[e]=t.extensions[e];if(void 0!==t.shading&&(i.flatShading=1===t.shading),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=n(t.map)),void 0!==t.matcap&&(i.matcap=n(t.matcap)),void 0!==t.alphaMap&&(i.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(i.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(i.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),i.normalScale=(new f).fromArray(e)}return void 0!==t.displacementMap&&(i.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=n(t.specularMap)),void 0!==t.specularIntensityMap&&(i.specularIntensityMap=n(t.specularIntensityMap)),void 0!==t.specularColorMap&&(i.specularColorMap=n(t.specularColorMap)),void 0!==t.envMap&&(i.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(i.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(i.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(i.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(i.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(i.clearcoatNormalScale=(new f).fromArray(t.clearcoatNormalScale)),void 0!==t.transmissionMap&&(i.transmissionMap=n(t.transmissionMap)),void 0!==t.thicknessMap&&(i.thicknessMap=n(t.thicknessMap)),void 0!==t.sheenColorMap&&(i.sheenColorMap=n(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(i.sheenRoughnessMap=n(t.sheenRoughnessMap)),i}setTextures(t){return this.textures=t,this}}class Cl{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let n=0,i=t.length;n<i;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch(t){return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}class kl extends Ce{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}clone(){return(new this.constructor).copy(this)}toJSON(){const t=super.toJSON(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}kl.prototype.isInstancedBufferGeometry=!0;class Rl extends nl{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new rl(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e={},n={};function i(t,i){if(void 0!==e[i])return e[i];const r=t.interleavedBuffers[i],s=function(t,e){if(void 0!==n[e])return n[e];const i=t.arrayBuffers[e],r=new Uint32Array(i).buffer;return n[e]=r,r}(t,r.buffer),o=x(r.type,s),a=new Jr(o,r.stride);return a.uuid=r.uuid,e[i]=a,a}const r=t.isInstancedBufferGeometry?new kl:new Ce,s=t.data.index;if(void 0!==s){const t=x(s.type,s.array);r.setIndex(new de(t,1))}const o=t.data.attributes;for(const e in o){const n=o[e];let s;if(n.isInterleavedBufferAttribute){const e=i(t.data,n.data);s=new Kr(e,n.itemSize,n.offset,n.normalized)}else{const t=x(n.type,n.array);s=new(n.isInstancedBufferAttribute?Cs:de)(t,n.itemSize,n.normalized)}void 0!==n.name&&(s.name=n.name),void 0!==n.usage&&s.setUsage(n.usage),void 0!==n.updateRange&&(s.updateRange.offset=n.updateRange.offset,s.updateRange.count=n.updateRange.count),r.setAttribute(e,s)}const a=t.data.morphAttributes;if(a)for(const e in a){const n=a[e],s=[];for(let e=0,r=n.length;e<r;e++){const r=n[e];let o;if(r.isInterleavedBufferAttribute){const e=i(t.data,r.data);o=new Kr(e,r.itemSize,r.offset,r.normalized)}else{const t=x(r.type,r.array);o=new de(t,r.itemSize,r.normalized)}void 0!==r.name&&(o.name=r.name),s.push(o)}r.morphAttributes[e]=s}t.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);const l=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==l)for(let t=0,e=l.length;t!==e;++t){const e=l[t];r.addGroup(e.start,e.count,e.materialIndex)}const h=t.data.boundingSphere;if(void 0!==h){const t=new q;void 0!==h.center&&t.fromArray(h.center),r.boundingSphere=new mt(t,h.radius)}return t.name&&(r.name=t.name),t.userData&&(r.userData=t.userData),r}}const Pl={UVMapping:300,CubeReflectionMapping:301,CubeRefractionMapping:302,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,CubeUVReflectionMapping:306},Dl={RepeatWrapping:1e3,ClampToEdgeWrapping:1001,MirroredRepeatWrapping:1002},Il={NearestFilter:1003,NearestMipmapNearestFilter:1004,NearestMipmapLinearFilter:1005,LinearFilter:1006,LinearMipmapNearestFilter:1007,LinearMipmapLinearFilter:1008};class Nl extends nl{constructor(t){super(t),"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Qa.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s;const o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader,fetch(t,o).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){Qa.add(t,n),e&&e(n),r.manager.itemEnd(t)})).catch((function(e){i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)})),r.manager.itemStart(t)}}let Bl;Nl.prototype.isImageBitmapLoader=!0;const zl={getContext:function(){return void 0===Bl&&(Bl=new(window.AudioContext||window.webkitAudioContext)),Bl},setContext:function(t){Bl=t}};class Ol extends nl{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new rl(this.manager);s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){try{const t=n.slice(0);zl.getContext().decodeAudioData(t,(function(t){e(t)}))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}}class Hl extends Al{constructor(t,e,n=1){super(void 0,n);const i=(new R).set(t),r=(new R).set(e),s=new q(i.r,i.g,i.b),o=new q(r.r,r.g,r.b),a=Math.sqrt(Math.PI),l=a*Math.sqrt(.75);this.sh.coefficients[0].copy(s).add(o).multiplyScalar(a),this.sh.coefficients[1].copy(s).sub(o).multiplyScalar(l)}}Hl.prototype.isHemisphereLightProbe=!0;class Ul extends Al{constructor(t,e=1){super(void 0,e);const n=(new R).set(t);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}Ul.prototype.isAmbientLightProbe=!0;const Fl=new Mt,Gl=new Mt,Vl=new Mt;class Wl{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=jl(),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 t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=jl();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function jl(){return("undefined"==typeof performance?Date:performance).now()}const ql=new q,Zl=new j,Xl=new q,Yl=new q;class Jl extends Xt{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.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(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);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(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}const $l=new q,Kl=new j,Ql=new q,th=new q;class eh{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}}class nh{constructor(t,e,n){let i,r,s;switch(this.binding=t,this.valueSize=n,e){case"quaternion":i=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,i=this.valueSize,r=t*i+i;let s=this.cumulativeWeight;if(0===s){for(let t=0;t!==i;++t)n[r+t]=n[t];s=e}else{s+=e;const t=e/s;this._mixBufferRegion(n,r,0,t,i)}this.cumulativeWeight=s}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,i,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,i=t*e+e,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(n,i,t,1-r,e)}s>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(n[t]!==n[t+e]){o.setValue(n,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let t=n,r=i;t!==r;++t)e[t]=e[i+t%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,i,r){if(i>=.5)for(let i=0;i!==r;++i)t[e+i]=t[n+i]}_slerp(t,e,n,i){j.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const s=this._workIndex*r;j.multiplyQuaternionsFlat(t,s,t,e,t,n),j.slerpFlat(t,e,t,e,t,s,i)}_lerp(t,e,n,i,r){const s=1-i;for(let o=0;o!==r;++o){const r=e+o;t[r]=t[r]*s+t[n+o]*i}}_lerpAdditive(t,e,n,i,r){for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]+t[n+s]*i}}}const ih=new RegExp("[\\[\\]\\.:\\/]","g"),rh="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",sh=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),oh=/(WCOD+)?/.source.replace("WCOD",rh),ah=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),lh=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),hh=new RegExp("^"+sh+oh+ah+lh+"$"),ch=["material","materials","bones"];class dh{constructor(t,e,n){this.path=e,this.parsedPath=n||dh.parseTrackName(e),this.node=dh.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new dh.Composite(t,e,n):new dh(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(ih,"")}static parseTrackName(t){const e=hh.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==ch.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let i=0;i<t.length;i++){const r=t[i];if(r.name===e||r.uuid===e)return r;const s=n(r.children);if(s)return s}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,n=e.objectName,i=e.propertyName;let r=e.propertyIndex;if(t||(t=dh.findNode(this.rootNode,e.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(n){let i=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===i){i=e;break}break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==i){if(void 0===t[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[i]}}const s=t[i];if(void 0===s){const n=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",t)}let o=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?o=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}a=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(a=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}dh.Composite=class{constructor(t,e,n){const i=n||dh.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},dh.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},dh.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},dh.prototype.GetterByBindingType=[dh.prototype._getValue_direct,dh.prototype._getValue_array,dh.prototype._getValue_arrayElement,dh.prototype._getValue_toArray],dh.prototype.SetterByBindingTypeAndVersioning=[[dh.prototype._setValue_direct,dh.prototype._setValue_direct_setNeedsUpdate,dh.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[dh.prototype._setValue_array,dh.prototype._setValue_array_setNeedsUpdate,dh.prototype._setValue_array_setMatrixWorldNeedsUpdate],[dh.prototype._setValue_arrayElement,dh.prototype._setValue_arrayElement_setNeedsUpdate,dh.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[dh.prototype._setValue_fromArray,dh.prototype._setValue_fromArray_setNeedsUpdate,dh.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class uh{constructor(){this.uuid=a(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let e=0,n=arguments.length;e!==n;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,s=r.length;let o,a=t.length,l=this.nCachedObjects_;for(let h=0,c=arguments.length;h!==c;++h){const c=arguments[h],d=c.uuid;let u=e[d];if(void 0===u){u=a++,e[d]=u,t.push(c);for(let t=0,e=s;t!==e;++t)r[t].push(new dh(c,n[t],i[t]))}else if(u<l){o=t[u];const a=--l,h=t[a];e[h.uuid]=u,t[u]=h,e[d]=a,t[a]=c;for(let t=0,e=s;t!==e;++t){const e=r[t],s=e[a];let o=e[u];e[u]=s,void 0===o&&(o=new dh(c,n[t],i[t])),e[a]=o}}else t[u]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let s=0,o=arguments.length;s!==o;++s){const o=arguments[s],a=o.uuid,l=e[a];if(void 0!==l&&l>=r){const s=r++,h=t[s];e[h.uuid]=l,t[l]=h,e[a]=s,t[s]=o;for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[s],r=e[l];e[l]=i,e[s]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=t.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,l=e[a];if(void 0!==l)if(delete e[a],l<r){const o=--r,a=t[o],h=--s,c=t[h];e[a.uuid]=l,t[l]=a,e[c.uuid]=o,t[o]=c,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[o],r=e[h];e[l]=i,e[o]=r,e.pop()}}else{const r=--s,o=t[r];r>0&&(e[o.uuid]=l),t[l]=o,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,o=this._parsedPaths,a=this._objects,l=a.length,h=this.nCachedObjects_,c=new Array(l);i=r.length,n[t]=i,s.push(t),o.push(e),r.push(c);for(let n=h,i=a.length;n!==i;++n){const i=a[n];c[n]=new dh(i,t,e)}return c}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o];e[t[o]]=n,s[n]=a,s.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}uh.prototype.isAnimationObjectGroup=!0;class ph{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const r=e.tracks,s=r.length,o=new Array(s),a={endingStart:2400,endingEnd:2400};for(let t=0;t!==s;++t){const e=r[t].createInterpolant(null);o[t]=e,e.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),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&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,n){if(t.fadeOut(e),this.fadeIn(e),n){const n=this._clip.duration,i=t._clip.duration,r=i/n,s=n/i;t.warp(1,r,e),this.warp(s,1,e)}return this}crossFadeTo(t,e,n){return t.crossFadeFrom(this,e,n)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,n){const i=this._mixer,r=i.time,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,a[1]=r+n,l[0]=t/s,l[1]=e/s,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,n,i){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const i=(t-r)*n;if(i<0||0===n)return;this._startTime=null,e=n*i}e*=this._updateTimeScale(t);const s=this._updateTime(e),o=this._updateWeight(t);if(o>0){const t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulateAdditive(o);else for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulate(i,o)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,r=this._loopCount;const s=2202===n;if(0===t)return-1===r?i:s&&1==(1&r)?e-i:i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else{if(!(i<0)){this.time=i;break t}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const o=this.repetitions-r;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===o){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&1==(1&r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=2401,i.endingEnd=2401):(i.endingStart=t?this.zeroSlopeAtStart?2401:2400:2402,i.endingEnd=e?this.zeroSlopeAtEnd?2401:2400:2402)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=r,a[0]=e,o[1]=r+t,a[1]=n,this}}class mh extends n{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,s=t._propertyBindings,o=t._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let h=l[a];void 0===h&&(h={},l[a]=h);for(let t=0;t!==r;++t){const r=i[t],l=r.name;let c=h[l];if(void 0!==c)++c.referenceCount,s[t]=c;else{if(c=s[t],void 0!==c){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,a,l));continue}const i=e&&e._propertyBindings[t].binding.parsedPath;c=new nh(dh.create(n,l,i),r.ValueTypeName,r.getValueSize()),++c.referenceCount,this._addInactiveBinding(c,a,l),s[t]=c}o[t].resultBuffer=c.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,n=t._clip.uuid,i=this._actionsByClip[n];this._bindAction(t,i&&i.knownActions[0]),this._addInactiveAction(t,n,e)}const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,n){const i=this._actions,r=this._actionsByClip;let s=r[e];if(void 0===s)s={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=s;else{const e=s.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=i.length,i.push(t),s.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,s=this._actionsByClip,o=s[r],a=o.knownActions,l=a[a.length-1],h=t._byClipCacheIndex;l._byClipCacheIndex=h,a[h]=l,a.pop(),t._byClipCacheIndex=null;delete o.actionByRoot[(t._localRoot||this._root).uuid],0===a.length&&delete s[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(t){const e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackAction(t){const e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_addInactiveBinding(t,e,n){const i=this._bindingsByRootAndName,r=this._bindings;let s=i[e];void 0===s&&(s={},i[e]=s),s[n]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,s=this._bindingsByRootAndName,o=s[i],a=e[e.length-1],l=t._cacheIndex;a._cacheIndex=l,e[l]=a,e.pop(),delete o[r],0===Object.keys(o).length&&delete s[i]}_lendBinding(t){const e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackBinding(t){const e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return void 0===n&&(n=new Fa(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r}clipAction(t,e,n){const i=e||this._root,r=i.uuid;let s="string"==typeof t?$a.findByName(i,t):t;const o=null!==s?s.uuid:t,a=this._actionsByClip[o];let l=null;if(void 0===n&&(n=null!==s?s.blendMode:2500),void 0!==a){const t=a.actionByRoot[r];if(void 0!==t&&t.blendMode===n)return t;l=a.knownActions[0],null===s&&(s=l._clip)}if(null===s)return null;const h=new ph(this,s,e,n);return this._bindAction(h,l),this._addInactiveAction(h,o,r),h}existingAction(t,e){const n=e||this._root,i=n.uuid,r="string"==typeof t?$a.findByName(n,t):t,s=r?r.uuid:t,o=this._actionsByClip[s];return void 0!==o&&o.actionByRoot[i]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),s=this._accuIndex^=1;for(let o=0;o!==n;++o){e[o]._update(i,t,r,s)}const o=this._bindings,a=this._nActiveBindings;for(let t=0;t!==a;++t)o[t].apply(s);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){const t=r.knownActions;for(let n=0,i=t.length;n!==i;++n){const i=t[n];this._deactivateAction(i);const r=i._cacheIndex,s=e[e.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,s._cacheIndex=r,e[r]=s,e.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const t in n){const i=n[t].actionByRoot[e];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}const i=this._bindingsByRootAndName[e];if(void 0!==i)for(const t in i){const e=i[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}mh.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class fh{constructor(t){"string"==typeof t&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new fh(void 0===this.value.clone?this.value:this.value.clone())}}class gh extends Jr{constructor(t,e,n=1){super(t,e),this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}gh.prototype.isInstancedInterleavedBuffer=!0;class vh{constructor(t,e,n,i,r){this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}vh.prototype.isGLBufferAttribute=!0;class yh{constructor(t,e,n=0,i=1/0){this.ray=new bt(t,e),this.near=n,this.far=i,this.camera=null,this.layers=new It,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}intersectObject(t,e=!0,n=[]){return _h(t,this,n,e),n.sort(xh),n}intersectObjects(t,e=!0,n=[]){for(let i=0,r=t.length;i<r;i++)_h(t[i],this,n,e);return n.sort(xh),n}}function xh(t,e){return t.distance-e.distance}function _h(t,e,n,i){if(t.layers.test(e.layers)&&t.raycast(e,n),!0===i){const i=t.children;for(let t=0,r=i.length;t<r;t++)_h(i[t],e,n,!0)}}class wh{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){const t=1e-6;return this.phi=Math.max(t,Math.min(Math.PI-t,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(l(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}const bh=new f;class Mh{constructor(t=new f(1/0,1/0),e=new f(-1/0,-1/0)){this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=bh.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return bh.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}Mh.prototype.isBox2=!0;const Sh=new q,Eh=new q;class Th{constructor(t=new q,e=new q){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Sh.subVectors(t,this.start),Eh.subVectors(this.end,this.start);const n=Eh.dot(Eh);let i=Eh.dot(Sh)/n;return e&&(i=l(i,0,1)),i}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const Ah=new q;const Lh=new q,Ch=new Mt,kh=new Mt;class Rh extends Ws{constructor(t){const e=Ph(t),n=new Ce,i=[],r=[],s=new R(0,0,1),o=new R(0,1,0);for(let t=0;t<e.length;t++){const n=e[t];n.parent&&n.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(s.r,s.g,s.b),r.push(o.r,o.g,o.b))}n.setAttribute("position",new _e(i,3)),n.setAttribute("color",new _e(r,3));super(n,new Ns({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,n=this.geometry,i=n.getAttribute("position");kh.copy(this.root.matrixWorld).invert();for(let t=0,n=0;t<e.length;t++){const r=e[t];r.parent&&r.parent.isBone&&(Ch.multiplyMatrices(kh,r.matrixWorld),Lh.setFromMatrixPosition(Ch),i.setXYZ(n,Lh.x,Lh.y,Lh.z),Ch.multiplyMatrices(kh,r.parent.matrixWorld),Lh.setFromMatrixPosition(Ch),i.setXYZ(n+1,Lh.x,Lh.y,Lh.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}function Ph(t){const e=[];!0===t.isBone&&e.push(t);for(let n=0;n<t.children.length;n++)e.push.apply(e,Ph(t.children[n]));return e}const Dh=new q,Ih=new R,Nh=new R;class Bh extends Ws{constructor(t=10,e=10,n=4473924,i=8947848){n=new R(n),i=new R(i);const r=e/2,s=t/e,o=t/2,a=[],l=[];for(let t=0,h=0,c=-o;t<=e;t++,c+=s){a.push(-o,0,c,o,0,c),a.push(c,0,-o,c,0,o);const e=t===r?n:i;e.toArray(l,h),h+=3,e.toArray(l,h),h+=3,e.toArray(l,h),h+=3,e.toArray(l,h),h+=3}const h=new Ce;h.setAttribute("position",new _e(a,3)),h.setAttribute("color",new _e(l,3));super(h,new Ns({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}const zh=new q,Oh=new q,Hh=new q;const Uh=new q,Fh=new tn;function Gh(t,e,n,i,r,s,o){Uh.set(r,s,o).unproject(i);const a=e[t];if(void 0!==a){const t=n.getAttribute("position");for(let e=0,n=a.length;e<n;e++)t.setXYZ(a[e],Uh.x,Uh.y,Uh.z)}}const Vh=new Y;class Wh extends Ws{constructor(t,e=16776960){const n=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]),i=new Float32Array(24),r=new Ce;r.setIndex(new de(n,1)),r.setAttribute("position",new de(i,3)),super(r,new Ns({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Vh.setFromObject(this.object),Vh.isEmpty())return;const e=Vh.min,n=Vh.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=e.x,r[4]=n.y,r[5]=n.z,r[6]=e.x,r[7]=e.y,r[8]=n.z,r[9]=n.x,r[10]=e.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=e.z,r[15]=e.x,r[16]=n.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=n.x,r[22]=e.y,r[23]=e.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t){return Ws.prototype.copy.call(this,t),this.object=t.object,this}}const jh=new q;let qh,Zh;class Xh extends Ws{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],n=new Ce;n.setAttribute("position",new _e(e,3)),n.setAttribute("color",new _e([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(n,new Ns({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,n){const i=new R,r=this.geometry.attributes.color.array;return i.set(t),i.toArray(r,0),i.toArray(r,3),i.set(e),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}const Yh=new ArrayBuffer(4),Jh=new Float32Array(Yh),$h=new Uint32Array(Yh),Kh=new Uint32Array(512),Qh=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(Kh[t]=0,Kh[256|t]=32768,Qh[t]=24,Qh[256|t]=24):e<-14?(Kh[t]=1024>>-e-14,Kh[256|t]=1024>>-e-14|32768,Qh[t]=-e-1,Qh[256|t]=-e-1):e<=15?(Kh[t]=e+15<<10,Kh[256|t]=e+15<<10|32768,Qh[t]=13,Qh[256|t]=13):e<128?(Kh[t]=31744,Kh[256|t]=64512,Qh[t]=24,Qh[256|t]=24):(Kh[t]=31744,Kh[256|t]=64512,Qh[t]=13,Qh[256|t]=13)}const tc=new Uint32Array(2048),ec=new Uint32Array(64),nc=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,n=0;for(;0==(8388608&e);)e<<=1,n-=8388608;e&=-8388609,n+=947912704,tc[t]=e|n}for(let t=1024;t<2048;++t)tc[t]=939524096+(t-1024<<13);for(let t=1;t<31;++t)ec[t]=t<<23;ec[31]=1199570944,ec[32]=2147483648;for(let t=33;t<63;++t)ec[t]=2147483648+(t-32<<23);ec[63]=3347054592;for(let t=1;t<64;++t)32!==t&&(nc[t]=1024);io.create=function(t,e){return console.log("THREE.Curve.create() has been deprecated"),t.prototype=Object.create(io.prototype),t.prototype.constructor=t,t.prototype.getPoint=e,t},Eo.prototype.fromPoints=function(t){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(t)};Bh.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},Rh.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};nl.prototype.extractUrlBase=function(t){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),Cl.extractUrlBase(t)},nl.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};Mh.prototype.center=function(t){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(t)},Mh.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Mh.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Mh.prototype.size=function(t){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(t)},Y.prototype.center=function(t){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(t)},Y.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},Y.prototype.isIntersectionBox=function(t){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},Y.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},Y.prototype.size=function(t){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(t)},Dt.prototype.toVector3=function(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")},mt.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},un.prototype.setFromMatrix=function(t){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(t)},Th.prototype.center=function(t){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(t)},g.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},g.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},g.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},g.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),t.applyMatrix3(this)},g.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},g.prototype.getInverse=function(t){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},Mt.prototype.extractPosition=function(t){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(t)},Mt.prototype.flattenToArrayOffset=function(t,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(t,e)},Mt.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),(new q).setFromMatrixColumn(this,3)},Mt.prototype.setRotationFromQuaternion=function(t){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(t)},Mt.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},Mt.prototype.multiplyVector3=function(t){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Mt.prototype.multiplyVector4=function(t){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Mt.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},Mt.prototype.rotateAxis=function(t){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),t.transformDirection(this)},Mt.prototype.crossVector=function(t){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Mt.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},Mt.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},Mt.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},Mt.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},Mt.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},Mt.prototype.applyToBufferAttribute=function(t){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),t.applyMatrix4(this)},Mt.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},Mt.prototype.makeFrustum=function(t,e,n,i,r,s){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(t,e,i,n,r,s)},Mt.prototype.getInverse=function(t){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(t).invert()},hn.prototype.isIntersectionLine=function(t){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(t)},j.prototype.multiplyVector3=function(t){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),t.applyQuaternion(this)},j.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},bt.prototype.isIntersectionBox=function(t){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(t)},bt.prototype.isIntersectionPlane=function(t){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(t)},bt.prototype.isIntersectionSphere=function(t){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(t)},se.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},se.prototype.barycoordFromPoint=function(t,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(t,e)},se.prototype.midpoint=function(t){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(t)},se.prototypenormal=function(t){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(t)},se.prototype.plane=function(t){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(t)},se.barycoordFromPoint=function(t,e,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),se.getBarycoord(t,e,n,i,r)},se.normal=function(t,e,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),se.getNormal(t,e,n,i)},Oo.prototype.extractAllPoints=function(t){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(t)},Oo.prototype.extrude=function(t){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new pa(this,t)},Oo.prototype.makeGeometry=function(t){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new ya(this,t)},f.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},f.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},f.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},q.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},q.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},q.prototype.getPositionFromMatrix=function(t){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(t)},q.prototype.getScaleFromMatrix=function(t){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(t)},q.prototype.getColumnFromMatrix=function(t,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,t)},q.prototype.applyProjection=function(t){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(t)},q.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},q.prototype.distanceToManhattan=function(t){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(t)},q.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},O.prototype.fromAttribute=function(t,e,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(t,e,n)},O.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Xt.prototype.getChildByName=function(t){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(t)},Xt.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},Xt.prototype.translate=function(t,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,t)},Xt.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},Xt.prototype.applyMatrix=function(t){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Xt.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(t){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=t}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Ze.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(Ze.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),0},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),Ms.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},en.prototype.setLens=function(t,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),void 0!==e&&(this.filmGauge=e),this.setFocalLength(t)},Object.defineProperties(hl.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(t){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=t}},shadowCameraLeft:{set:function(t){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=t}},shadowCameraRight:{set:function(t){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=t}},shadowCameraTop:{set:function(t){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=t}},shadowCameraBottom:{set:function(t){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=t}},shadowCameraNear:{set:function(t){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=t}},shadowCameraFar:{set:function(t){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=t}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(t){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=t}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(t){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=t}},shadowMapHeight:{set:function(t){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=t}}}),Object.defineProperties(de.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),35048===this.usage},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(35048)}}}),de.prototype.setDynamic=function(t){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?35048:35044),this},de.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},de.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Ce.prototype.addIndex=function(t){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(t)},Ce.prototype.addAttribute=function(t,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),e&&e.isBufferAttribute||e&&e.isInterleavedBufferAttribute?"index"===t?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(t,e):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(t,new de(arguments[1],arguments[2])))},Ce.prototype.addDrawCall=function(t,e,n){void 0!==n&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(t,e)},Ce.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},Ce.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},Ce.prototype.removeAttribute=function(t){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(t)},Ce.prototype.applyMatrix=function(t){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(t)},Object.defineProperties(Ce.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),Jr.prototype.setDynamic=function(t){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(!0===t?35048:35044),this},Jr.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},pa.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},pa.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},pa.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},Yr.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},fh.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(ae.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new R}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(t){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===t}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(t){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=t}},vertexTangents:{get:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")},set:function(){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}}),Object.defineProperties(Qe.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(t){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=t}}}),jr.prototype.clearTarget=function(t,e,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(t),this.clear(e,n,i)},jr.prototype.animate=function(t){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(t)},jr.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},jr.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},jr.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},jr.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},jr.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},jr.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},jr.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},jr.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},jr.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},jr.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},jr.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},jr.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},jr.prototype.enableScissorTest=function(t){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(t)},jr.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},jr.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},jr.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},jr.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},jr.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},jr.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},jr.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},jr.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},jr.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},jr.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(jr.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=t}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(t){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=t}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(t){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=!0===t?3001:3e3}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}},gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}}),Object.defineProperties(Ir.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});Object.defineProperties(H.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=t}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(t){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=t}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=t}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(t){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=t}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(t){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=t}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(t){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=t}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(t){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=t}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(t){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=t}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(t){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=t}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(t){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=t}}}),Jl.prototype.load=function(t){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return(new Ol).load(t,(function(t){e.setBuffer(t)})),this},eh.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},nn.prototype.updateCubeMap=function(t,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(t,e)},nn.prototype.clear=function(t,e,n,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(t,e,n,i)},D.crossOrigin=void 0,D.loadTexture=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const r=new ll;r.setCrossOrigin(this.crossOrigin);const s=r.load(t,n,void 0,i);return e&&(s.mapping=e),s},D.loadTextureCube=function(t,e,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const r=new ol;r.setCrossOrigin(this.crossOrigin);const s=r.load(t,n,void 0,i);return e&&(s.mapping=e),s},D.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},D.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const ic={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"139"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="139");var rc=Object.freeze({__proto__:null,ACESFilmicToneMapping:4,AddEquation:100,AddOperation:2,AdditiveAnimationBlendMode:2501,AdditiveBlending:2,AlphaFormat:1021,AlwaysDepth:1,AlwaysStencilFunc:519,AmbientLight:Sl,AmbientLightProbe:Ul,AnimationClip:$a,AnimationLoader:class extends nl{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new rl(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e=[];for(let n=0;n<t.length;n++){const i=$a.parse(t[n]);e.push(i)}return e}},AnimationMixer:mh,AnimationObjectGroup:uh,AnimationUtils:Oa,ArcCurve:so,ArrayCamera:Or,ArrowHelper:class extends Xt{constructor(t=new q(0,0,1),e=new q(0,0,0),n=1,i=16776960,r=.2*n,s=.2*r){super(),this.type="ArrowHelper",void 0===qh&&(qh=new Ce,qh.setAttribute("position",new _e([0,0,0,0,1,0],3)),Zh=new Co(0,.5,1,5,1),Zh.translate(0,-.5,0)),this.position.copy(e),this.line=new Fs(qh,new Ns({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Ze(Zh,new le({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,r,s)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{jh.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(jh,e)}}setLength(t,e=.2*t,n=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}},Audio:Jl,AudioAnalyser:eh,AudioContext:zl,AudioListener:class extends Xt{constructor(){super(),this.type="AudioListener",this.context=zl.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Wl}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(ql,Zl,Xl),Yl.set(0,0,-1).applyQuaternion(Zl),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(ql.x,t),e.positionY.linearRampToValueAtTime(ql.y,t),e.positionZ.linearRampToValueAtTime(ql.z,t),e.forwardX.linearRampToValueAtTime(Yl.x,t),e.forwardY.linearRampToValueAtTime(Yl.y,t),e.forwardZ.linearRampToValueAtTime(Yl.z,t),e.upX.linearRampToValueAtTime(n.x,t),e.upY.linearRampToValueAtTime(n.y,t),e.upZ.linearRampToValueAtTime(n.z,t)}else e.setPosition(ql.x,ql.y,ql.z),e.setOrientation(Yl.x,Yl.y,Yl.z,n.x,n.y,n.z)}},AudioLoader:Ol,AxesHelper:Xh,AxisHelper:class extends Xh{constructor(t){console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),super(t)}},BackSide:1,BasicDepthPacking:3200,BasicShadowMap:0,BinaryTextureLoader:class extends al{constructor(t){console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),super(t)}},Bone:Ss,BooleanKeyframeTrack:Wa,BoundingBoxHelper:class extends Wh{constructor(t,e){console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),super(t,e)}},Box2:Mh,Box3:Y,Box3Helper:class extends Ws{constructor(t,e=16776960){const n=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]),i=new Ce;i.setIndex(new de(n,1)),i.setAttribute("position",new _e([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new Ns({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}},BoxBufferGeometry:Ye,BoxGeometry:Ye,BoxHelper:Wh,BufferAttribute:de,BufferGeometry:Ce,BufferGeometryLoader:Rl,ByteType:1010,Cache:Qa,Camera:tn,CameraHelper:class extends Ws{constructor(t){const e=new Ce,n=new Ns({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={},o=new R(16755200),a=new R(16711680),l=new R(43775),h=new R(16777215),c=new R(3355443);function d(t,e,n){u(t,n),u(e,n)}function u(t,e){i.push(0,0,0),r.push(e.r,e.g,e.b),void 0===s[t]&&(s[t]=[]),s[t].push(i.length/3-1)}d("n1","n2",o),d("n2","n4",o),d("n4","n3",o),d("n3","n1",o),d("f1","f2",o),d("f2","f4",o),d("f4","f3",o),d("f3","f1",o),d("n1","f1",o),d("n2","f2",o),d("n3","f3",o),d("n4","f4",o),d("p","n1",a),d("p","n2",a),d("p","n3",a),d("p","n4",a),d("u1","u2",l),d("u2","u3",l),d("u3","u1",l),d("c","t",h),d("p","c",c),d("cn1","cn2",c),d("cn3","cn4",c),d("cf1","cf2",c),d("cf3","cf4",c),e.setAttribute("position",new _e(i,3)),e.setAttribute("color",new _e(r,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){const t=this.geometry,e=this.pointMap;Fh.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Gh("c",e,t,Fh,0,0,-1),Gh("t",e,t,Fh,0,0,1),Gh("n1",e,t,Fh,-1,-1,-1),Gh("n2",e,t,Fh,1,-1,-1),Gh("n3",e,t,Fh,-1,1,-1),Gh("n4",e,t,Fh,1,1,-1),Gh("f1",e,t,Fh,-1,-1,1),Gh("f2",e,t,Fh,1,-1,1),Gh("f3",e,t,Fh,-1,1,1),Gh("f4",e,t,Fh,1,1,1),Gh("u1",e,t,Fh,.7,1.1,-1),Gh("u2",e,t,Fh,-.7,1.1,-1),Gh("u3",e,t,Fh,0,2,-1),Gh("cf1",e,t,Fh,-1,0,1),Gh("cf2",e,t,Fh,1,0,1),Gh("cf3",e,t,Fh,0,-1,1),Gh("cf4",e,t,Fh,0,1,1),Gh("cn1",e,t,Fh,-1,0,-1),Gh("cn2",e,t,Fh,1,0,-1),Gh("cn3",e,t,Fh,0,-1,-1),Gh("cn4",e,t,Fh,0,1,-1),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},CanvasRenderer:function(){console.error("THREE.CanvasRenderer has been removed")},CanvasTexture:no,CapsuleBufferGeometry:Ao,CapsuleGeometry:Ao,CatmullRomCurve3:uo,CineonToneMapping:3,CircleBufferGeometry:Lo,CircleGeometry:Lo,ClampToEdgeWrapping:1001,Clock:Wl,Color:R,ColorKeyframeTrack:ja,ColorManagement:S,CompressedTexture:eo,CompressedTextureLoader:class extends nl{constructor(t){super(t)}load(t,e,n,i){const r=this,s=[],o=new eo,a=new rl(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(r.withCredentials);let l=0;function h(h){a.load(t[h],(function(t){const n=r.parse(t,!0);s[h]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(o.minFilter=1006),o.image=s,o.format=n.format,o.needsUpdate=!0,e&&e(o))}),n,i)}if(Array.isArray(t))for(let e=0,n=t.length;e<n;++e)h(e);else a.load(t,(function(t){const n=r.parse(t,!0);if(n.isCubemap){const t=n.mipmaps.length/n.mipmapCount;for(let e=0;e<t;e++){s[e]={mipmaps:[]};for(let t=0;t<n.mipmapCount;t++)s[e].mipmaps.push(n.mipmaps[e*n.mipmapCount+t]),s[e].format=n.format,s[e].width=n.width,s[e].height=n.height}o.image=s}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=1006),o.format=n.format,o.needsUpdate=!0,e&&e(o)}),n,i);return o}},ConeBufferGeometry:ko,ConeGeometry:ko,CubeCamera:nn,CubeReflectionMapping:301,CubeRefractionMapping:302,CubeTexture:rn,CubeTextureLoader:ol,CubeUVReflectionMapping:306,CubicBezierCurve:go,CubicBezierCurve3:vo,CubicInterpolant:Ua,CullFaceBack:1,CullFaceFront:2,CullFaceFrontBack:3,CullFaceNone:0,Curve:io,CurvePath:So,CustomBlending:5,CustomToneMapping:5,CylinderBufferGeometry:Co,CylinderGeometry:Co,Cylindrical:class{constructor(t=1,e=0,n=0){return this.radius=t,this.theta=e,this.y=n,this}set(t,e,n){return this.radius=t,this.theta=e,this.y=n,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}clone(){return(new this.constructor).copy(this)}},Data3DTexture:G,DataArrayTexture:U,DataTexture:Es,DataTexture2DArray:class extends U{constructor(t,e,n,i){console.warn("THREE.DataTexture2DArray has been renamed to DataArrayTexture."),super(t,e,n,i)}},DataTexture3D:class extends G{constructor(t,e,n,i){console.warn("THREE.DataTexture3D has been renamed to Data3DTexture."),super(t,e,n,i)}},DataTextureLoader:al,DataUtils:class{static toHalfFloat(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=l(t,-65504,65504),Jh[0]=t;const e=$h[0],n=e>>23&511;return Kh[n]+((8388607&e)>>Qh[n])}static fromHalfFloat(t){const e=t>>10;return $h[0]=tc[nc[e]+(1023&t)]+ec[e],Jh[0]}},DecrementStencilOp:7683,DecrementWrapStencilOp:34056,DefaultLoadingManager:el,DepthFormat:1026,DepthStencilFormat:1027,DepthTexture:Gr,DirectionalLight:Ml,DirectionalLightHelper:class extends Xt{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,void 0===e&&(e=1);let i=new Ce;i.setAttribute("position",new _e([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const r=new Ns({fog:!1,toneMapped:!1});this.lightPlane=new Fs(i,r),this.add(this.lightPlane),i=new Ce,i.setAttribute("position",new _e([0,0,0,0,0,1],3)),this.targetLine=new Fs(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){zh.setFromMatrixPosition(this.light.matrixWorld),Oh.setFromMatrixPosition(this.light.target.matrixWorld),Hh.subVectors(Oh,zh),this.lightPlane.lookAt(Oh),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Oh),this.targetLine.scale.z=Hh.length()}},DiscreteInterpolant:Ga,DodecahedronBufferGeometry:Po,DodecahedronGeometry:Po,DoubleSide:2,DstAlphaFactor:206,DstColorFactor:208,DynamicBufferAttribute:class extends de{constructor(t,e){console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),super(t,e),this.setUsage(35048)}},DynamicCopyUsage:35050,DynamicDrawUsage:35048,DynamicReadUsage:35049,EdgesGeometry:zo,EdgesHelper:class extends Ws{constructor(t,e){console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),super(new zo(t.geometry),new Ns({color:void 0!==e?e:16777215}))}},EllipseCurve:ro,EqualDepth:4,EqualStencilFunc:514,EquirectangularReflectionMapping:303,EquirectangularRefractionMapping:304,Euler:Dt,EventDispatcher:n,ExtrudeBufferGeometry:pa,ExtrudeGeometry:pa,FaceColors:1,FileLoader:rl,FlatShading:1,Float16BufferAttribute:xe,Float32Attribute:class extends _e{constructor(t,e){console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),super(t,e)}},Float32BufferAttribute:_e,Float64Attribute:class extends we{constructor(t,e){console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),super(t,e)}},Float64BufferAttribute:we,FloatType:1015,Fog:Xr,FogExp2:Zr,Font:function(){console.error("THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js")},FontLoader:function(){console.error("THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js")},FramebufferTexture:to,FrontSide:0,Frustum:un,GLBufferAttribute:vh,GLSL1:"100",GLSL3:"300 es",GreaterDepth:6,GreaterEqualDepth:5,GreaterEqualStencilFunc:518,GreaterStencilFunc:516,GridHelper:Bh,Group:Hr,HalfFloatType:1016,HemisphereLight:cl,HemisphereLightHelper:class extends Xt{constructor(t,e,n){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;const i=new ga(e);i.rotateY(.5*Math.PI),this.material=new le({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),s=new Float32Array(3*r.count);i.setAttribute("color",new de(s,3)),this.add(new Ze(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");Ih.copy(this.light.color),Nh.copy(this.light.groundColor);for(let t=0,n=e.count;t<n;t++){const i=t<n/2?Ih:Nh;e.setXYZ(t,i.r,i.g,i.b)}e.needsUpdate=!0}t.lookAt(Dh.setFromMatrixPosition(this.light.matrixWorld).negate())}},HemisphereLightProbe:Hl,IcosahedronBufferGeometry:fa,IcosahedronGeometry:fa,ImageBitmapLoader:Nl,ImageLoader:sl,ImageUtils:D,ImmediateRenderObject:function(){console.error("THREE.ImmediateRenderObject has been removed.")},IncrementStencilOp:7682,IncrementWrapStencilOp:34055,InstancedBufferAttribute:Cs,InstancedBufferGeometry:kl,InstancedInterleavedBuffer:gh,InstancedMesh:Is,Int16Attribute:class extends fe{constructor(t,e){console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),super(t,e)}},Int16BufferAttribute:fe,Int32Attribute:class extends ve{constructor(t,e){console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),super(t,e)}},Int32BufferAttribute:ve,Int8Attribute:class extends ue{constructor(t,e){console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),super(t,e)}},Int8BufferAttribute:ue,IntType:1013,InterleavedBuffer:Jr,InterleavedBufferAttribute:Kr,Interpolant:Ha,InterpolateDiscrete:2300,InterpolateLinear:2301,InterpolateSmooth:2302,InvertStencilOp:5386,JSONLoader:function(){console.error("THREE.JSONLoader has been removed.")},KeepStencilOp:7680,KeyframeTrack:Va,LOD:vs,LatheBufferGeometry:To,LatheGeometry:To,Layers:It,LensFlare:function(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")},LessDepth:2,LessEqualDepth:3,LessEqualStencilFunc:515,LessStencilFunc:513,Light:hl,LightProbe:Al,Line:Fs,Line3:Th,LineBasicMaterial:Ns,LineCurve:yo,LineCurve3:xo,LineDashedMaterial:Ba,LineLoop:js,LinePieces:1,LineSegments:Ws,LineStrip:0,LinearEncoding:3e3,LinearFilter:1006,LinearInterpolant:Fa,LinearMipMapLinearFilter:1008,LinearMipMapNearestFilter:1007,LinearMipmapLinearFilter:1008,LinearMipmapNearestFilter:1007,LinearSRGBColorSpace:"srgb-linear",LinearToneMapping:1,Loader:nl,LoaderUtils:Cl,LoadingManager:tl,LoopOnce:2200,LoopPingPong:2202,LoopRepeat:2201,LuminanceAlphaFormat:1025,LuminanceFormat:1024,MOUSE:t,Material:ae,MaterialLoader:Ll,Math:m,MathUtils:m,Matrix3:g,Matrix4:Mt,MaxEquation:104,Mesh:Ze,MeshBasicMaterial:le,MeshDepthMaterial:Pr,MeshDistanceMaterial:Dr,MeshFaceMaterial:function(t){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),t},MeshLambertMaterial:Ia,MeshMatcapMaterial:Na,MeshNormalMaterial:Da,MeshPhongMaterial:Ra,MeshPhysicalMaterial:ka,MeshStandardMaterial:Ca,MeshToonMaterial:Pa,MinEquation:103,MirroredRepeatWrapping:1002,MixOperation:1,MultiMaterial:function(t=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),t.isMultiMaterial=!0,t.materials=t,t.clone=function(){return t.slice()},t},MultiplyBlending:4,MultiplyOperation:0,NearestFilter:1003,NearestMipMapLinearFilter:1005,NearestMipMapNearestFilter:1004,NearestMipmapLinearFilter:1005,NearestMipmapNearestFilter:1004,NeverDepth:0,NeverStencilFunc:512,NoBlending:0,NoColorSpace:"",NoColors:0,NoToneMapping:0,NormalAnimationBlendMode:2500,NormalBlending:1,NotEqualDepth:7,NotEqualStencilFunc:517,NumberKeyframeTrack:qa,Object3D:Xt,ObjectLoader:class extends nl{constructor(t){super(t)}load(t,e,n,i){const r=this,s=""===this.path?Cl.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||s;const o=new rl(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){let s=null;try{s=JSON.parse(n)}catch(e){return void 0!==i&&i(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}const o=s.metadata;void 0!==o&&void 0!==o.type&&"geometry"!==o.type.toLowerCase()?r.parse(s,e):console.error("THREE.ObjectLoader: Can't load "+t)}),n,i)}async loadAsync(t,e){const n=""===this.path?Cl.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||n;const i=new rl(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials);const r=await i.loadAsync(t,e),s=JSON.parse(r),o=s.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+t);return await this.parseAsync(s)}parse(t,e){const n=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,i),s=this.parseImages(t.images,(function(){void 0!==e&&e(l)})),o=this.parseTextures(t.textures,s),a=this.parseMaterials(t.materials,o),l=this.parseObject(t.object,r,a,o,n),h=this.parseSkeletons(t.skeletons,l);if(this.bindSkeletons(l,h),void 0!==e){let t=!1;for(const e in s)if(s[e]instanceof HTMLImageElement){t=!0;break}!1===t&&e(l)}return l}async parseAsync(t){const e=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,n),r=await this.parseImagesAsync(t.images),s=this.parseTextures(t.textures,r),o=this.parseMaterials(t.materials,s),a=this.parseObject(t.object,i,o,s,e),l=this.parseSkeletons(t.skeletons,a);return this.bindSkeletons(a,l),a}parseShapes(t){const e={};if(void 0!==t)for(let n=0,i=t.length;n<i;n++){const i=(new Oo).fromJSON(t[n]);e[i.uuid]=i}return e}parseSkeletons(t,e){const n={},i={};if(e.traverse((function(t){t.isBone&&(i[t.uuid]=t)})),void 0!==t)for(let e=0,r=t.length;e<r;e++){const r=(new Ls).fromJSON(t[e],i);n[r.uuid]=r}return n}parseGeometries(t,e){const n={};if(void 0!==t){const i=new Rl;for(let r=0,s=t.length;r<s;r++){let s;const o=t[r];switch(o.type){case"BufferGeometry":case"InstancedBufferGeometry":s=i.parse(o);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:o.type in Ta?s=Ta[o.type].fromJSON(o,e):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${o.type}"`)}s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),!0===s.isBufferGeometry&&void 0!==o.userData&&(s.userData=o.userData),n[o.uuid]=s}}return n}parseMaterials(t,e){const n={},i={};if(void 0!==t){const r=new Ll;r.setTextures(e);for(let e=0,s=t.length;e<s;e++){const s=t[e];if("MultiMaterial"===s.type){const t=[];for(let e=0;e<s.materials.length;e++){const i=s.materials[e];void 0===n[i.uuid]&&(n[i.uuid]=r.parse(i)),t.push(n[i.uuid])}i[s.uuid]=t}else void 0===n[s.uuid]&&(n[s.uuid]=r.parse(s)),i[s.uuid]=n[s.uuid]}}return i}parseAnimations(t){const e={};if(void 0!==t)for(let n=0;n<t.length;n++){const i=t[n],r=$a.parse(i);e[r.uuid]=r}return e}parseImages(t,e){const n=this,i={};let r;function s(t){if("string"==typeof t){const e=t;return function(t){return n.manager.itemStart(t),r.load(t,(function(){n.manager.itemEnd(t)}),void 0,(function(){n.manager.itemError(t),n.manager.itemEnd(t)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:n.resourcePath+e)}return t.data?{data:x(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){const n=new tl(e);r=new sl(n),r.setCrossOrigin(this.crossOrigin);for(let e=0,n=t.length;e<n;e++){const n=t[e],r=n.url;if(Array.isArray(r)){const t=[];for(let e=0,n=r.length;e<n;e++){const n=s(r[e]);null!==n&&(n instanceof HTMLImageElement?t.push(n):t.push(new Es(n.data,n.width,n.height)))}i[n.uuid]=new I(t)}else{const t=s(n.url);i[n.uuid]=new I(t)}}}return i}async parseImagesAsync(t){const e=this,n={};let i;async function r(t){if("string"==typeof t){const n=t,r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(n)?n:e.resourcePath+n;return await i.loadAsync(r)}return t.data?{data:x(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){i=new sl(this.manager),i.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.url;if(Array.isArray(s)){const t=[];for(let e=0,n=s.length;e<n;e++){const n=s[e],i=await r(n);null!==i&&(i instanceof HTMLImageElement?t.push(i):t.push(new Es(i.data,i.width,i.height)))}n[i.uuid]=new I(t)}else{const t=await r(i.url);n[i.uuid]=new I(t)}}}return n}parseTextures(t,e){function n(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}const i={};if(void 0!==t)for(let r=0,s=t.length;r<s;r++){const s=t[r];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===e[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);const o=e[s.image],a=o.data;let l;Array.isArray(a)?(l=new rn,6===a.length&&(l.needsUpdate=!0)):(l=a&&a.data?new Es:new z,a&&(l.needsUpdate=!0)),l.source=o,l.uuid=s.uuid,void 0!==s.name&&(l.name=s.name),void 0!==s.mapping&&(l.mapping=n(s.mapping,Pl)),void 0!==s.offset&&l.offset.fromArray(s.offset),void 0!==s.repeat&&l.repeat.fromArray(s.repeat),void 0!==s.center&&l.center.fromArray(s.center),void 0!==s.rotation&&(l.rotation=s.rotation),void 0!==s.wrap&&(l.wrapS=n(s.wrap[0],Dl),l.wrapT=n(s.wrap[1],Dl)),void 0!==s.format&&(l.format=s.format),void 0!==s.type&&(l.type=s.type),void 0!==s.encoding&&(l.encoding=s.encoding),void 0!==s.minFilter&&(l.minFilter=n(s.minFilter,Il)),void 0!==s.magFilter&&(l.magFilter=n(s.magFilter,Il)),void 0!==s.anisotropy&&(l.anisotropy=s.anisotropy),void 0!==s.flipY&&(l.flipY=s.flipY),void 0!==s.premultiplyAlpha&&(l.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(l.unpackAlignment=s.unpackAlignment),void 0!==s.userData&&(l.userData=s.userData),i[s.uuid]=l}return i}parseObject(t,e,n,i,r){let s,o,a;function l(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function h(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let i=0,r=t.length;i<r;i++){const r=t[i];void 0===n[r]&&console.warn("THREE.ObjectLoader: Undefined material",r),e.push(n[r])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}function c(t){return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined texture",t),i[t]}switch(t.type){case"Scene":s=new Yr,void 0!==t.background&&(Number.isInteger(t.background)?s.background=new R(t.background):s.background=c(t.background)),void 0!==t.environment&&(s.environment=c(t.environment)),void 0!==t.fog&&("Fog"===t.fog.type?s.fog=new Xr(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(s.fog=new Zr(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":s=new en(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(s.focus=t.focus),void 0!==t.zoom&&(s.zoom=t.zoom),void 0!==t.filmGauge&&(s.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(s.filmOffset=t.filmOffset),void 0!==t.view&&(s.view=Object.assign({},t.view));break;case"OrthographicCamera":s=new En(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(s.zoom=t.zoom),void 0!==t.view&&(s.view=Object.assign({},t.view));break;case"AmbientLight":s=new Sl(t.color,t.intensity);break;case"DirectionalLight":s=new Ml(t.color,t.intensity);break;case"PointLight":s=new wl(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":s=new El(t.color,t.intensity,t.width,t.height);break;case"SpotLight":s=new gl(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":s=new cl(t.color,t.groundColor,t.intensity);break;case"LightProbe":s=(new Al).fromJSON(t);break;case"SkinnedMesh":o=l(t.geometry),a=h(t.material),s=new Ms(o,a),void 0!==t.bindMode&&(s.bindMode=t.bindMode),void 0!==t.bindMatrix&&s.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(s.skeleton=t.skeleton);break;case"Mesh":o=l(t.geometry),a=h(t.material),s=new Ze(o,a);break;case"InstancedMesh":o=l(t.geometry),a=h(t.material);const e=t.count,n=t.instanceMatrix,i=t.instanceColor;s=new Is(o,a,e),s.instanceMatrix=new Cs(new Float32Array(n.array),16),void 0!==i&&(s.instanceColor=new Cs(new Float32Array(i.array),i.itemSize));break;case"LOD":s=new vs;break;case"Line":s=new Fs(l(t.geometry),h(t.material));break;case"LineLoop":s=new js(l(t.geometry),h(t.material));break;case"LineSegments":s=new Ws(l(t.geometry),h(t.material));break;case"PointCloud":case"Points":s=new $s(l(t.geometry),h(t.material));break;case"Sprite":s=new ps(h(t.material));break;case"Group":s=new Hr;break;case"Bone":s=new Ss;break;default:s=new Xt}if(s.uuid=t.uuid,void 0!==t.name&&(s.name=t.name),void 0!==t.matrix?(s.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(s.matrixAutoUpdate=t.matrixAutoUpdate),s.matrixAutoUpdate&&s.matrix.decompose(s.position,s.quaternion,s.scale)):(void 0!==t.position&&s.position.fromArray(t.position),void 0!==t.rotation&&s.rotation.fromArray(t.rotation),void 0!==t.quaternion&&s.quaternion.fromArray(t.quaternion),void 0!==t.scale&&s.scale.fromArray(t.scale)),void 0!==t.castShadow&&(s.castShadow=t.castShadow),void 0!==t.receiveShadow&&(s.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(s.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(s.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(s.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&s.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(s.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(s.visible=t.visible),void 0!==t.frustumCulled&&(s.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(s.renderOrder=t.renderOrder),void 0!==t.userData&&(s.userData=t.userData),void 0!==t.layers&&(s.layers.mask=t.layers),void 0!==t.children){const o=t.children;for(let t=0;t<o.length;t++)s.add(this.parseObject(o[t],e,n,i,r))}if(void 0!==t.animations){const e=t.animations;for(let t=0;t<e.length;t++){const n=e[t];s.animations.push(r[n])}}if("LOD"===t.type){void 0!==t.autoUpdate&&(s.autoUpdate=t.autoUpdate);const e=t.levels;for(let t=0;t<e.length;t++){const n=e[t],i=s.getObjectByProperty("uuid",n.object);void 0!==i&&s.addLevel(i,n.distance)}}return s}bindSkeletons(t,e){0!==Object.keys(e).length&&t.traverse((function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){const n=e[t.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(n,t.bindMatrix)}}))}setTexturePath(t){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(t)}},ObjectSpaceNormalMap:1,OctahedronBufferGeometry:ga,OctahedronGeometry:ga,OneFactor:201,OneMinusDstAlphaFactor:207,OneMinusDstColorFactor:209,OneMinusSrcAlphaFactor:205,OneMinusSrcColorFactor:203,OrthographicCamera:En,PCFShadowMap:1,PCFSoftShadowMap:2,PMREMGenerator:Dn,ParametricGeometry:class extends Ce{constructor(){console.error("THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js"),super()}},Particle:class extends ps{constructor(t){console.warn("THREE.Particle has been renamed to THREE.Sprite."),super(t)}},ParticleBasicMaterial:class extends qs{constructor(t){console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),super(t)}},ParticleSystem:class extends $s{constructor(t,e){console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),super(t,e)}},ParticleSystemMaterial:class extends qs{constructor(t){console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),super(t)}},Path:Eo,PerspectiveCamera:en,Plane:hn,PlaneBufferGeometry:fn,PlaneGeometry:fn,PlaneHelper:class extends Fs{constructor(t,e=1,n=16776960){const i=n,r=new Ce;r.setAttribute("position",new _e([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,0,1,0,0,0],3)),r.computeBoundingSphere(),super(r,new Ns({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const s=new Ce;s.setAttribute("position",new _e([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),s.computeBoundingSphere(),this.add(new Ze(s,new le({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){let e=-this.plane.constant;Math.abs(e)<1e-8&&(e=1e-8),this.scale.set(.5*this.size,.5*this.size,e),this.children[0].material.side=e<0?1:0,this.lookAt(this.plane.normal),super.updateMatrixWorld(t)}},PointCloud:class extends $s{constructor(t,e){console.warn("THREE.PointCloud has been renamed to THREE.Points."),super(t,e)}},PointCloudMaterial:class extends qs{constructor(t){console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),super(t)}},PointLight:wl,PointLightHelper:class extends Ze{constructor(t,e,n){super(new xa(e,4,2),new le({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.light.updateMatrixWorld(),this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}},Points:$s,PointsMaterial:qs,PolarGridHelper:class extends Ws{constructor(t=10,e=16,n=8,i=64,r=4473924,s=8947848){r=new R(r),s=new R(s);const o=[],a=[];for(let n=0;n<=e;n++){const i=n/e*(2*Math.PI),l=Math.sin(i)*t,h=Math.cos(i)*t;o.push(0,0,0),o.push(l,0,h);const c=1&n?r:s;a.push(c.r,c.g,c.b),a.push(c.r,c.g,c.b)}for(let e=0;e<=n;e++){const l=1&e?r:s,h=t-t/n*e;for(let t=0;t<i;t++){let e=t/i*(2*Math.PI),n=Math.sin(e)*h,r=Math.cos(e)*h;o.push(n,0,r),a.push(l.r,l.g,l.b),e=(t+1)/i*(2*Math.PI),n=Math.sin(e)*h,r=Math.cos(e)*h,o.push(n,0,r),a.push(l.r,l.g,l.b)}}const l=new Ce;l.setAttribute("position",new _e(o,3)),l.setAttribute("color",new _e(a,3));super(l,new Ns({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}},PolyhedronBufferGeometry:Ro,PolyhedronGeometry:Ro,PositionalAudio:class extends Jl{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose($l,Kl,Ql),th.set(0,0,1).applyQuaternion(Kl);const e=this.panner;if(e.positionX){const t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime($l.x,t),e.positionY.linearRampToValueAtTime($l.y,t),e.positionZ.linearRampToValueAtTime($l.z,t),e.orientationX.linearRampToValueAtTime(th.x,t),e.orientationY.linearRampToValueAtTime(th.y,t),e.orientationZ.linearRampToValueAtTime(th.z,t)}else e.setPosition($l.x,$l.y,$l.z),e.setOrientation(th.x,th.y,th.z)}},PropertyBinding:dh,PropertyMixer:nh,QuadraticBezierCurve:_o,QuadraticBezierCurve3:wo,Quaternion:j,QuaternionKeyframeTrack:Xa,QuaternionLinearInterpolant:Za,REVISION:"139",RGBADepthPacking:3201,RGBAFormat:1023,RGBAIntegerFormat:1033,RGBA_ASTC_10x10_Format:37819,RGBA_ASTC_10x5_Format:37816,RGBA_ASTC_10x6_Format:37817,RGBA_ASTC_10x8_Format:37818,RGBA_ASTC_12x10_Format:37820,RGBA_ASTC_12x12_Format:37821,RGBA_ASTC_4x4_Format:37808,RGBA_ASTC_5x4_Format:37809,RGBA_ASTC_5x5_Format:37810,RGBA_ASTC_6x5_Format:37811,RGBA_ASTC_6x6_Format:37812,RGBA_ASTC_8x5_Format:37813,RGBA_ASTC_8x6_Format:37814,RGBA_ASTC_8x8_Format:37815,RGBA_BPTC_Format:36492,RGBA_ETC2_EAC_Format:37496,RGBA_PVRTC_2BPPV1_Format:35843,RGBA_PVRTC_4BPPV1_Format:35842,RGBA_S3TC_DXT1_Format:33777,RGBA_S3TC_DXT3_Format:33778,RGBA_S3TC_DXT5_Format:33779,RGBFormat:1022,RGB_ETC1_Format:36196,RGB_ETC2_Format:37492,RGB_PVRTC_2BPPV1_Format:35841,RGB_PVRTC_4BPPV1_Format:35840,RGB_S3TC_DXT1_Format:33776,RGFormat:1030,RGIntegerFormat:1031,RawShaderMaterial:La,Ray:bt,Raycaster:yh,RectAreaLight:El,RedFormat:1028,RedIntegerFormat:1029,ReinhardToneMapping:2,RepeatWrapping:1e3,ReplaceStencilOp:7681,ReverseSubtractEquation:102,RingBufferGeometry:va,RingGeometry:va,SRGBColorSpace:"srgb",Scene:Yr,SceneUtils:ic,ShaderChunk:gn,ShaderLib:yn,ShaderMaterial:Qe,ShadowMaterial:Aa,Shape:Oo,ShapeBufferGeometry:ya,ShapeGeometry:ya,ShapePath:class{constructor(){this.type="ShapePath",this.color=new R,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new Eo,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,i){return this.currentPath.quadraticCurveTo(t,e,n,i),this}bezierCurveTo(t,e,n,i,r,s){return this.currentPath.bezierCurveTo(t,e,n,i,r,s),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t,e){function n(t){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n],r=new Oo;r.curves=i.curves,e.push(r)}return e}function i(t,e){const n=e.length;let i=!1;for(let r=n-1,s=0;s<n;r=s++){let n=e[r],o=e[s],a=o.x-n.x,l=o.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=e[s],a=-a,o=e[r],l=-l),t.y<n.y||t.y>o.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-a*(t.y-n.y);if(0===e)return!0;if(e<0)continue;i=!i}}else{if(t.y!==n.y)continue;if(o.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=o.x)return!0}}return i}const r=ca.isClockWise,s=this.subPaths;if(0===s.length)return[];if(!0===e)return n(s);let o,a,l;const h=[];if(1===s.length)return a=s[0],l=new Oo,l.curves=a.curves,h.push(l),h;let c=!r(s[0].getPoints());c=t?!c:c;const d=[],u=[];let p,m,f=[],g=0;u[g]=void 0,f[g]=[];for(let e=0,n=s.length;e<n;e++)a=s[e],p=a.getPoints(),o=r(p),o=t?!o:o,o?(!c&&u[g]&&g++,u[g]={s:new Oo,p:p},u[g].s.curves=a.curves,c&&g++,f[g]=[]):f[g].push({h:a,p:p[0]});if(!u[0])return n(s);if(u.length>1){let t=!1,e=0;for(let t=0,e=u.length;t<e;t++)d[t]=[];for(let n=0,r=u.length;n<r;n++){const r=f[n];for(let s=0;s<r.length;s++){const o=r[s];let a=!0;for(let r=0;r<u.length;r++)i(o.p,u[r].p)&&(n!==r&&e++,a?(a=!1,d[r].push(o)):t=!0);a&&d[n].push(o)}}e>0&&!1===t&&(f=d)}for(let t=0,e=u.length;t<e;t++){l=u[t].s,h.push(l),m=f[t];for(let t=0,e=m.length;t<e;t++)l.holes.push(m[t].h)}return h}},ShapeUtils:ca,ShortType:1011,Skeleton:Ls,SkeletonHelper:Rh,SkinnedMesh:Ms,SmoothShading:2,Source:I,Sphere:mt,SphereBufferGeometry:xa,SphereGeometry:xa,Spherical:wh,SphericalHarmonics3:Tl,SplineCurve:bo,SpotLight:gl,SpotLightHelper:class extends Xt{constructor(t,e){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e;const n=new Ce,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let t=0,e=1,n=32;t<n;t++,e++){const r=t/n*Math.PI*2,s=e/n*Math.PI*2;i.push(Math.cos(r),Math.sin(r),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new _e(i,3));const r=new Ns({fog:!1,toneMapped:!1});this.cone=new Ws(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),Ah.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Ah),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},Sprite:ps,SpriteMaterial:Qr,SrcAlphaFactor:204,SrcAlphaSaturateFactor:210,SrcColorFactor:202,StaticCopyUsage:35046,StaticDrawUsage:35044,StaticReadUsage:35045,StereoCamera:class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new en,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new en,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,Vl.copy(t.projectionMatrix);const n=e.eyeSep/2,i=n*e.near/e.focus,r=e.near*Math.tan(s*e.fov*.5)/e.zoom;let o,a;Gl.elements[12]=-n,Fl.elements[12]=n,o=-r*e.aspect+i,a=r*e.aspect+i,Vl.elements[0]=2*e.near/(a-o),Vl.elements[8]=(a+o)/(a-o),this.cameraL.projectionMatrix.copy(Vl),o=-r*e.aspect-i,a=r*e.aspect-i,Vl.elements[0]=2*e.near/(a-o),Vl.elements[8]=(a+o)/(a-o),this.cameraR.projectionMatrix.copy(Vl)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Gl),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Fl)}},StreamCopyUsage:35042,StreamDrawUsage:35040,StreamReadUsage:35041,StringKeyframeTrack:Ya,SubtractEquation:101,SubtractiveBlending:3,TOUCH:e,TangentSpaceNormalMap:0,TetrahedronBufferGeometry:_a,TetrahedronGeometry:_a,TextGeometry:class extends Ce{constructor(){console.error("THREE.TextGeometry has been moved to /examples/jsm/geometries/TextGeometry.js"),super()}},Texture:z,TextureLoader:ll,TorusBufferGeometry:wa,TorusGeometry:wa,TorusKnotBufferGeometry:ba,TorusKnotGeometry:ba,Triangle:se,TriangleFanDrawMode:2,TriangleStripDrawMode:1,TrianglesDrawMode:0,TubeBufferGeometry:Ma,TubeGeometry:Ma,UVMapping:300,Uint16Attribute:class extends ge{constructor(t,e){console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),super(t,e)}},Uint16BufferAttribute:ge,Uint32Attribute:class extends ye{constructor(t,e){console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),super(t,e)}},Uint32BufferAttribute:ye,Uint8Attribute:class extends pe{constructor(t,e){console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),super(t,e)}},Uint8BufferAttribute:pe,Uint8ClampedAttribute:class extends me{constructor(t,e){console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),super(t,e)}},Uint8ClampedBufferAttribute:me,Uniform:fh,UniformsLib:vn,UniformsUtils:Ke,UnsignedByteType:1009,UnsignedInt248Type:1020,UnsignedIntType:1014,UnsignedShort4444Type:1017,UnsignedShort5551Type:1018,UnsignedShortType:1012,VSMShadowMap:3,Vector2:f,Vector3:q,Vector4:O,VectorKeyframeTrack:Ja,Vertex:class extends q{constructor(t,e,n){console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),super(t,e,n)}},VertexColors:2,VideoTexture:Qs,WebGL1Renderer:qr,WebGL3DRenderTarget:V,WebGLArrayRenderTarget:F,WebGLCubeRenderTarget:sn,WebGLMultipleRenderTargets:W,WebGLMultisampleRenderTarget:class extends H{constructor(t,e,n){console.error('THREE.WebGLMultisampleRenderTarget has been removed. Use a normal render target and set the "samples" property to greater 0 to enable multisampling.'),super(t,e,n),this.samples=4}},WebGLRenderTarget:H,WebGLRenderTargetCube:class extends sn{constructor(t,e,n){console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),super(t,n)}},WebGLRenderer:jr,WebGLUtils:zr,WireframeGeometry:Sa,WireframeHelper:class extends Ws{constructor(t,e){console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),super(new Sa(t.geometry),new Ns({color:void 0!==e?e:16777215}))}},WrapAroundEnding:2402,XHRLoader:class extends rl{constructor(t){console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),super(t)}},ZeroCurvatureEnding:2400,ZeroFactor:200,ZeroSlopeEnding:2401,ZeroStencilOp:0,_SRGBAFormat:1035,sRGBEncoding:3001});const sc={bottom:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="8.0" y="-24.0" width="16.0" height="16.0" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" />\n<path d="M2.0,-2.0 L2.0,-18.0 L8.0,-24.0 L8.0,-8.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-2.0 L8.0,-8.0 L24.0,-8.0 L18.0,-2.0 Z" fill="rgb(83,160,227)" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-18.0 L8.0,-24.0 L24.0,-24.0 L18.0,-18.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M18.0,-2.0 L18.0,-18.0 L24.0,-24.0 L24.0,-8.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<rect x="2.0" y="-18.0" width="16.0" height="16.0" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="8.0" y="-24.0" width="16.0" height="16.0" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" />\n<path d="M2.0,-2.0 L2.0,-18.0 L8.0,-24.0 L8.0,-8.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-2.0 L8.0,-8.0 L24.0,-8.0 L18.0,-2.0 Z" fill="rgb(48, 142, 225)" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-18.0 L8.0,-24.0 L24.0,-24.0 L18.0,-18.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M18.0,-2.0 L18.0,-18.0 L24.0,-24.0 L24.0,-8.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<rect x="2.0" y="-18.0" width="16.0" height="16.0" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" />\n</svg>\n'},front:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="8.0" y="-24.0" width="16.0" height="16.0" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" />\n<path d="M2.0,-2.0 L2.0,-18.0 L8.0,-24.0 L8.0,-8.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-2.0 L8.0,-8.0 L24.0,-8.0 L18.0,-2.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-18.0 L8.0,-24.0 L24.0,-24.0 L18.0,-18.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M18.0,-2.0 L18.0,-18.0 L24.0,-24.0 L24.0,-8.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<rect x="2.0" y="-18.0" width="16.0" height="16.0" fill="rgb(83,160,227)" stroke="#444" stroke-width="1.2" stroke-linejoin="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="8.0" y="-24.0" width="16.0" height="16.0" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" />\n<path d="M2.0,-2.0 L2.0,-18.0 L8.0,-24.0 L8.0,-8.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-2.0 L8.0,-8.0 L24.0,-8.0 L18.0,-2.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-18.0 L8.0,-24.0 L24.0,-24.0 L18.0,-18.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M18.0,-2.0 L18.0,-18.0 L24.0,-24.0 L24.0,-8.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<rect x="2.0" y="-18.0" width="16.0" height="16.0" fill="rgb(48, 142, 225)" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" />\n</svg>\n'},help:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<path d="M23.0,-13.0 A10.0,10.0,0,1,0,22.998476951563912,-12.825475935627155" stroke="#444" stroke-width="1.25" fill="none" stroke-linecap="round" />\n<text x="7.0" y="-6.0" font-size="20.0" fill="rgb(83,160,227)" font-family="sans-serif" font-weight="bold" dy="0em">?</text>\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<path d="M23.0,-13.0 A10.0,10.0,0,1,0,22.998476951563912,-12.825475935627155" stroke="#ddd" stroke-width="1.25" fill="none" stroke-linecap="round" />\n<text x="7.0" y="-6.0" font-size="20.0" fill="rgb(48, 142, 225)" font-family="sans-serif" font-weight="bold" dy="0em">?</text>\n</svg>\n'},iso:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<path d="M22.0,-7.5 L22.0,-18.5 L13.0,-13.0 L13.0,-2.0 Z" fill="rgb(83,160,227)" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M13.0,-13.0 L13.0,-2.0 L4.0,-7.5 L4.0,-18.5 Z" fill="rgb(83,160,227)" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M22.0,-18.5 L13.0,-24.0 L4.0,-18.5 L13.0,-13.0 Z" fill="rgb(83,160,227)" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<path d="M22.0,-7.5 L22.0,-18.5 L13.0,-13.0 L13.0,-2.0 Z" fill="rgb(48, 142, 225)" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M13.0,-13.0 L13.0,-2.0 L4.0,-7.5 L4.0,-18.5 Z" fill="rgb(48, 142, 225)" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M22.0,-18.5 L13.0,-24.0 L4.0,-18.5 L13.0,-13.0 Z" fill="rgb(48, 142, 225)" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n</svg>\n'},left:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="8.0" y="-24.0" width="16.0" height="16.0" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" />\n<path d="M2.0,-2.0 L2.0,-18.0 L8.0,-24.0 L8.0,-8.0 Z" fill="rgb(83,160,227)" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-2.0 L8.0,-8.0 L24.0,-8.0 L18.0,-2.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-18.0 L8.0,-24.0 L24.0,-24.0 L18.0,-18.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M18.0,-2.0 L18.0,-18.0 L24.0,-24.0 L24.0,-8.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<rect x="2.0" y="-18.0" width="16.0" height="16.0" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="8.0" y="-24.0" width="16.0" height="16.0" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" />\n<path d="M2.0,-2.0 L2.0,-18.0 L8.0,-24.0 L8.0,-8.0 Z" fill="rgb(48, 142, 225)" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-2.0 L8.0,-8.0 L24.0,-8.0 L18.0,-2.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-18.0 L8.0,-24.0 L24.0,-24.0 L18.0,-18.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M18.0,-2.0 L18.0,-18.0 L24.0,-24.0 L24.0,-8.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<rect x="2.0" y="-18.0" width="16.0" height="16.0" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" />\n</svg>\n'},mesh:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25.2" height="16.2" viewBox="0 -16.2 25.2 16.2">\n<path d="M6.0,-2.0 L2.0,-6.066666666666666 L2.0,-10.133333333333333 L6.0,-14.2 L14.6,-14.2 L10.6,-10.133333333333333 L10.6,-6.066666666666666 L14.6,-2.0 Z" fill="rgb(83,160,227)" stroke="#444" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="square" />\n<path d="M14.6,-2.0 L10.6,-6.066666666666666 L10.6,-10.133333333333333 L14.6,-14.2 L23.2,-14.2 L19.2,-10.133333333333333 L19.2,-6.066666666666666 L23.2,-2.0 Z" fill="rgb(83,160,227)" stroke="#444" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="square" />\n<path d="M2.0,-6.066666666666666 L2.0,-10.133333333333333 L10.6,-10.133333333333333 L19.2,-10.133333333333333 L19.2,-6.066666666666666 Z" fill="none" stroke="#444" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="square" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25.2" height="16.2" viewBox="0 -16.2 25.2 16.2">\n<path d="M6.0,-2.0 L2.0,-6.066666666666666 L2.0,-10.133333333333333 L6.0,-14.2 L14.6,-14.2 L10.6,-10.133333333333333 L10.6,-6.066666666666666 L14.6,-2.0 Z" fill="rgb(48, 142, 225)" stroke="#ddd" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="square" />\n<path d="M14.6,-2.0 L10.6,-6.066666666666666 L10.6,-10.133333333333333 L14.6,-14.2 L23.2,-14.2 L19.2,-10.133333333333333 L19.2,-6.066666666666666 L23.2,-2.0 Z" fill="rgb(48, 142, 225)" stroke="#ddd" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="square" />\n<path d="M2.0,-6.066666666666666 L2.0,-10.133333333333333 L10.6,-10.133333333333333 L19.2,-10.133333333333333 L19.2,-6.066666666666666 Z" fill="none" stroke="#ddd" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="square" />\n</svg>\n'},mesh_empty:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25.2" height="16.2" viewBox="0 -16.2 25.2 16.2">\n<path d="M6.0,-2.0 L2.0,-6.066666666666666 L2.0,-10.133333333333333 L6.0,-14.2 L14.6,-14.2 L10.6,-10.133333333333333 L10.6,-6.066666666666666 L14.6,-2.0 Z" fill="#ddd" stroke="#ddd" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="square" />\n<path d="M14.6,-2.0 L10.6,-6.066666666666666 L10.6,-10.133333333333333 L14.6,-14.2 L23.2,-14.2 L19.2,-10.133333333333333 L19.2,-6.066666666666666 L23.2,-2.0 Z" fill="#ddd" stroke="#ddd" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="square" />\n<path d="M2.0,-6.066666666666666 L2.0,-10.133333333333333 L10.6,-10.133333333333333 L19.2,-10.133333333333333 L19.2,-6.066666666666666 Z" fill="none" stroke="#ddd" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="square" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25.2" height="16.2" viewBox="0 -16.2 25.2 16.2">\n<path d="M6.0,-2.0 L2.0,-6.066666666666666 L2.0,-10.133333333333333 L6.0,-14.2 L14.6,-14.2 L10.6,-10.133333333333333 L10.6,-6.066666666666666 L14.6,-2.0 Z" fill="#666" stroke="#666" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="square" />\n<path d="M14.6,-2.0 L10.6,-6.066666666666666 L10.6,-10.133333333333333 L14.6,-14.2 L23.2,-14.2 L19.2,-10.133333333333333 L19.2,-6.066666666666666 L23.2,-2.0 Z" fill="#666" stroke="#666" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="square" />\n<path d="M2.0,-6.066666666666666 L2.0,-10.133333333333333 L10.6,-10.133333333333333 L19.2,-10.133333333333333 L19.2,-6.066666666666666 Z" fill="none" stroke="#666" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="square" />\n</svg>\n'},mesh_mix:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25.2" height="16.2" viewBox="0 -16.2 25.2 16.2">\n<path d="M6.0,-14.2 L12.6,-14.2 L8.6,-10.133333333333333 L8.6,-6.066666666666666 L12.6,-2.0 L6.0,-2.0 L2.0,-6.066666666666666 L2.0,-10.133333333333333 Z" fill="rgb(83,160,227)" stroke="rgb(83,160,227)" stroke-width="1.25" stroke-linejoin="square" stroke-linecap="round" />\n<path d="M16.6,-14.2 L23.2,-14.2 L19.2,-10.133333333333333 L19.2,-6.066666666666666 L23.2,-2.0 L16.6,-2.0 L12.6,-6.066666666666666 L12.6,-10.133333333333333 Z" fill="rgb(83,160,227)" stroke="rgb(83,160,227)" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M10.6,-10.133333333333333 L2.0,-10.133333333333333 L2.0,-6.066666666666666 L10.6,-6.066666666666666" fill="none" stroke="#444" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M14.6,-14.2 L6.0,-14.2 L2.0,-10.133333333333333 L2.0,-6.066666666666666 L6.0,-2.0 L14.6,-2.0" fill="none" stroke="#444" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25.2" height="16.2" viewBox="0 -16.2 25.2 16.2">\n<path d="M6.0,-14.2 L12.6,-14.2 L8.6,-10.133333333333333 L8.6,-6.066666666666666 L12.6,-2.0 L6.0,-2.0 L2.0,-6.066666666666666 L2.0,-10.133333333333333 Z" fill="rgb(48, 142, 225)" stroke="rgb(48, 142, 225)" stroke-width="1.25" stroke-linejoin="square" stroke-linecap="round" />\n<path d="M16.6,-14.2 L23.2,-14.2 L19.2,-10.133333333333333 L19.2,-6.066666666666666 L23.2,-2.0 L16.6,-2.0 L12.6,-6.066666666666666 L12.6,-10.133333333333333 Z" fill="rgb(48, 142, 225)" stroke="rgb(48, 142, 225)" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M10.6,-10.133333333333333 L2.0,-10.133333333333333 L2.0,-6.066666666666666 L10.6,-6.066666666666666" fill="none" stroke="#ddd" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M14.6,-14.2 L6.0,-14.2 L2.0,-10.133333333333333 L2.0,-6.066666666666666 L6.0,-2.0 L14.6,-2.0" fill="none" stroke="#ddd" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="round" />\n</svg>\n'},mesh_no:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25.2" height="16.2" viewBox="0 -16.2 25.2 16.2">\n<path d="M6.0,-2.0 L2.0,-6.066666666666666 L2.0,-10.133333333333333 L6.0,-14.2 L14.6,-14.2 L10.6,-10.133333333333333 L10.6,-6.066666666666666 L14.6,-2.0 Z" fill="rgb(83,160,227)" stroke="rgb(83,160,227)" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="square" />\n<path d="M14.6,-2.0 L10.6,-6.066666666666666 L10.6,-10.133333333333333 L14.6,-14.2 L23.2,-14.2 L19.2,-10.133333333333333 L19.2,-6.066666666666666 L23.2,-2.0 Z" fill="rgb(83,160,227)" stroke="rgb(83,160,227)" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="square" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25.2" height="16.2" viewBox="0 -16.2 25.2 16.2">\n<path d="M6.0,-2.0 L2.0,-6.066666666666666 L2.0,-10.133333333333333 L6.0,-14.2 L14.6,-14.2 L10.6,-10.133333333333333 L10.6,-6.066666666666666 L14.6,-2.0 Z" fill="rgb(48, 142, 225)" stroke="rgb(48, 142, 225)" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="square" />\n<path d="M14.6,-2.0 L10.6,-6.066666666666666 L10.6,-10.133333333333333 L14.6,-14.2 L23.2,-14.2 L19.2,-10.133333333333333 L19.2,-6.066666666666666 L23.2,-2.0 Z" fill="rgb(48, 142, 225)" stroke="rgb(48, 142, 225)" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="square" />\n</svg>\n'},pause:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="5.2" y="-22.0" width="5.6" height="18.0" fill="rgb(83,160,227)" stroke="#444" stroke-width="1.5" stroke-linejoin="round" />\n<rect x="15.2" y="-22.0" width="5.6" height="18.0" fill="rgb(83,160,227)" stroke="#444" stroke-width="1.5" stroke-linejoin="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="5.2" y="-22.0" width="5.6" height="18.0" fill="rgb(48, 142, 225)" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" />\n<rect x="15.2" y="-22.0" width="5.6" height="18.0" fill="rgb(48, 142, 225)" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" />\n</svg>\n'},pin:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="10.0" y="-23.0" width="6.0" height="11.0" fill="rgb(83,160,227)" stroke="#444" stroke-width="1.25" stroke-linejoin="round" />\n<path d="M13.0,-3.0 L13.0,-10.0 Z" fill="none" stroke="#444" stroke-width="2.25" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M17.330127018922195,-21.5 A5.0,5.0,0,0,0,8.669872981077805,-21.5" stroke="#444" stroke-width="1.25" fill="rgb(83,160,227)" stroke-linecap="round" />\n<path d="M21.66025403784439,-10.2 A10.0,10.0,0,0,0,4.339745962155613,-10.2" stroke="#444" stroke-width="1.25" fill="rgb(83,160,227)" stroke-linecap="round" />\n<path d="M4.5,-10.2 L21.5,-10.2 Z" fill="none" stroke="#444" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M8.8,-21.4 L17.2,-21.4 Z" fill="none" stroke="#444" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="10.0" y="-23.0" width="6.0" height="11.0" fill="rgb(48, 142, 225)" stroke="#ddd" stroke-width="1.25" stroke-linejoin="round" />\n<path d="M13.0,-3.0 L13.0,-10.0 Z" fill="none" stroke="#ddd" stroke-width="2.25" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M17.330127018922195,-21.5 A5.0,5.0,0,0,0,8.669872981077805,-21.5" stroke="#ddd" stroke-width="1.25" fill="rgb(48, 142, 225)" stroke-linecap="round" />\n<path d="M21.66025403784439,-10.2 A10.0,10.0,0,0,0,4.339745962155613,-10.2" stroke="#ddd" stroke-width="1.25" fill="rgb(48, 142, 225)" stroke-linecap="round" />\n<path d="M4.5,-10.2 L21.5,-10.2 Z" fill="none" stroke="#ddd" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M8.8,-21.4 L17.2,-21.4 Z" fill="none" stroke="#ddd" stroke-width="1.25" stroke-linejoin="round" stroke-linecap="round" />\n</svg>\n'},plane:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<path d="M2.0,-5.0 L4.4,-13.0 L24.0,-13.0 L21.0,-5.0 Z" fill="none" stroke="#444" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M13.0,-9.5 L13.0,-19.5 Z" fill="none" stroke="rgb(83,160,227)" stroke-width="2.25" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M11.0,-17.5 L13.0,-19.5 L15.0,-17.5 Z" fill="none" stroke="rgb(83,160,227)" stroke-width="2.25" stroke-linejoin="round" stroke-linecap="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<path d="M2.0,-5.0 L4.4,-13.0 L24.0,-13.0 L21.0,-5.0 Z" fill="none" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M13.0,-9.5 L13.0,-19.5 Z" fill="none" stroke="rgb(48, 142, 225)" stroke-width="2.25" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M11.0,-17.5 L13.0,-19.5 L15.0,-17.5 Z" fill="none" stroke="rgb(48, 142, 225)" stroke-width="2.25" stroke-linejoin="round" stroke-linecap="round" />\n</svg>\n'},play:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<path d="M5.0,-4.0 L5.0,-22.0 L21.0,-13.0 Z" fill="rgb(83,160,227)" stroke="#444" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<path d="M5.0,-4.0 L5.0,-22.0 L21.0,-13.0 Z" fill="rgb(48, 142, 225)" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n</svg>\n'},rear:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="8.0" y="-24.0" width="16.0" height="16.0" fill="rgb(83,160,227)" stroke="#444" stroke-width="1.2" stroke-linejoin="round" />\n<path d="M2.0,-2.0 L2.0,-18.0 L8.0,-24.0 L8.0,-8.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-2.0 L8.0,-8.0 L24.0,-8.0 L18.0,-2.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-18.0 L8.0,-24.0 L24.0,-24.0 L18.0,-18.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M18.0,-2.0 L18.0,-18.0 L24.0,-24.0 L24.0,-8.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<rect x="2.0" y="-18.0" width="16.0" height="16.0" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="8.0" y="-24.0" width="16.0" height="16.0" fill="rgb(48, 142, 225)" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" />\n<path d="M2.0,-2.0 L2.0,-18.0 L8.0,-24.0 L8.0,-8.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-2.0 L8.0,-8.0 L24.0,-8.0 L18.0,-2.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-18.0 L8.0,-24.0 L24.0,-24.0 L18.0,-18.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M18.0,-2.0 L18.0,-18.0 L24.0,-24.0 L24.0,-8.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<rect x="2.0" y="-18.0" width="16.0" height="16.0" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" />\n</svg>\n'},reset:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<path d="M18.0,-21.660254037844386 A10.0,10.0,0,1,0,23.0,-12.999999999999998" stroke="#444" stroke-width="1.5" fill="none" stroke-linecap="round" />\n<path d="M16.0,-18.196152422706632 A6.0,6.0,0,1,0,19.0,-12.999999999999998" stroke="#444" stroke-width="1.5" fill="none" stroke-linecap="round" />\n<path d="M17.0,-13.0 L21.0,-17.0 L25.0,-13.0" fill="none" stroke="#444" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<path d="M18.0,-21.660254037844386 A10.0,10.0,0,1,0,23.0,-12.999999999999998" stroke="#ddd" stroke-width="1.5" fill="none" stroke-linecap="round" />\n<path d="M16.0,-18.196152422706632 A6.0,6.0,0,1,0,19.0,-12.999999999999998" stroke="#ddd" stroke-width="1.5" fill="none" stroke-linecap="round" />\n<path d="M17.0,-13.0 L21.0,-17.0 L25.0,-13.0" fill="none" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n</svg>\n'},resize:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="2.0" y="-24.0" width="22.0" height="22.0" fill="none" stroke="#444" stroke-width="1.5" stroke-linejoin="round" />\n<path d="M6.0,-6.0 L10.0,-10.0 Z" fill="none" stroke="#444" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M20.0,-20.0 L16.0,-16.0 Z" fill="none" stroke="#444" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M20.0,-6.0 L16.0,-10.0 Z" fill="none" stroke="#444" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M6.0,-20.0 L10.0,-16.0 Z" fill="none" stroke="#444" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M6.0,-6.0 L6.0,-10.0 Z" fill="none" stroke="#444" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M6.0,-6.0 L10.0,-6.0 Z" fill="none" stroke="#444" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M20.0,-20.0 L20.0,-16.0 Z" fill="none" stroke="#444" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M20.0,-20.0 L16.0,-20.0 Z" fill="none" stroke="#444" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M6.0,-20.0 L6.0,-16.0 Z" fill="none" stroke="#444" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M6.0,-20.0 L10.0,-20.0 Z" fill="none" stroke="#444" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M20.0,-6.0 L20.0,-10.0 Z" fill="none" stroke="#444" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M20.0,-6.0 L16.0,-6.0 Z" fill="none" stroke="#444" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="2.0" y="-24.0" width="22.0" height="22.0" fill="none" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" />\n<path d="M6.0,-6.0 L10.0,-10.0 Z" fill="none" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M20.0,-20.0 L16.0,-16.0 Z" fill="none" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M20.0,-6.0 L16.0,-10.0 Z" fill="none" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M6.0,-20.0 L10.0,-16.0 Z" fill="none" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M6.0,-6.0 L6.0,-10.0 Z" fill="none" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M6.0,-6.0 L10.0,-6.0 Z" fill="none" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M20.0,-20.0 L20.0,-16.0 Z" fill="none" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M20.0,-20.0 L16.0,-20.0 Z" fill="none" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M6.0,-20.0 L6.0,-16.0 Z" fill="none" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M6.0,-20.0 L10.0,-20.0 Z" fill="none" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M20.0,-6.0 L20.0,-10.0 Z" fill="none" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M20.0,-6.0 L16.0,-6.0 Z" fill="none" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" stroke-linecap="round" />\n</svg>\n'},right:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="8.0" y="-24.0" width="16.0" height="16.0" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" />\n<path d="M2.0,-2.0 L2.0,-18.0 L8.0,-24.0 L8.0,-8.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-2.0 L8.0,-8.0 L24.0,-8.0 L18.0,-2.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-18.0 L8.0,-24.0 L24.0,-24.0 L18.0,-18.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M18.0,-2.0 L18.0,-18.0 L24.0,-24.0 L24.0,-8.0 Z" fill="rgb(83,160,227)" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<rect x="2.0" y="-18.0" width="16.0" height="16.0" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="8.0" y="-24.0" width="16.0" height="16.0" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" />\n<path d="M2.0,-2.0 L2.0,-18.0 L8.0,-24.0 L8.0,-8.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-2.0 L8.0,-8.0 L24.0,-8.0 L18.0,-2.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-18.0 L8.0,-24.0 L24.0,-24.0 L18.0,-18.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M18.0,-2.0 L18.0,-18.0 L24.0,-24.0 L24.0,-8.0 Z" fill="rgb(48, 142, 225)" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<rect x="2.0" y="-18.0" width="16.0" height="16.0" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" />\n</svg>\n'},shape:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25.2" height="16.2" viewBox="0 -16.2 25.2 16.2">\n<ellipse cx="12.6" cy="-8.1" rx="5.04" ry="5.04" fill="rgb(83,160,227)" stroke="none" stroke-width="1.25" />\n<ellipse cx="12.6" cy="-8.1" rx="2.1" ry="2.1" fill="#444" stroke="#444" stroke-width="1.25" />\n<path d="M21.77986928011505,-8.399999999999999 A10.6,10.6,0,0,0,3.42013071988495,-8.399999999999999" stroke="#444" stroke-width="1.25" fill="none" stroke-linecap="round" />\n<path d="M3.42013071988495,-7.800000000000001 A10.6,10.6,0,0,0,21.77986928011505,-7.800000000000001" stroke="#444" stroke-width="1.25" fill="none" stroke-linecap="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25.2" height="16.2" viewBox="0 -16.2 25.2 16.2">\n<ellipse cx="12.6" cy="-8.1" rx="5.04" ry="5.04" fill="rgb(48, 142, 225)" stroke="none" stroke-width="1.25" />\n<ellipse cx="12.6" cy="-8.1" rx="2.1" ry="2.1" fill="#ddd" stroke="#ddd" stroke-width="1.25" />\n<path d="M21.77986928011505,-8.399999999999999 A10.6,10.6,0,0,0,3.42013071988495,-8.399999999999999" stroke="#ddd" stroke-width="1.25" fill="none" stroke-linecap="round" />\n<path d="M3.42013071988495,-7.800000000000001 A10.6,10.6,0,0,0,21.77986928011505,-7.800000000000001" stroke="#ddd" stroke-width="1.25" fill="none" stroke-linecap="round" />\n</svg>\n'},shape_empty:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25.2" height="16.2" viewBox="0 -16.2 25.2 16.2">\n<ellipse cx="12.6" cy="-8.1" rx="5.04" ry="5.04" fill="#ddd" stroke="none" stroke-width="1.25" />\n<path d="M21.77986928011505,-8.399999999999999 A10.6,10.6,0,0,0,3.42013071988495,-8.399999999999999" stroke="#ddd" stroke-width="1.25" fill="none" stroke-linecap="round" />\n<path d="M3.42013071988495,-7.800000000000001 A10.6,10.6,0,0,0,21.77986928011505,-7.800000000000001" stroke="#ddd" stroke-width="1.25" fill="none" stroke-linecap="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25.2" height="16.2" viewBox="0 -16.2 25.2 16.2">\n<ellipse cx="12.6" cy="-8.1" rx="5.04" ry="5.04" fill="#666" stroke="none" stroke-width="1.25" />\n<path d="M21.77986928011505,-8.399999999999999 A10.6,10.6,0,0,0,3.42013071988495,-8.399999999999999" stroke="#666" stroke-width="1.25" fill="none" stroke-linecap="round" />\n<path d="M3.42013071988495,-7.800000000000001 A10.6,10.6,0,0,0,21.77986928011505,-7.800000000000001" stroke="#666" stroke-width="1.25" fill="none" stroke-linecap="round" />\n</svg>\n'},shape_mix:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25.2" height="16.2" viewBox="0 -16.2 25.2 16.2">\n<path d="M12.6,-13.14 A5.04,5.04,0,0,0,12.599999999999998,-3.0599999999999996" stroke="none" stroke-width="1.25" fill="rgb(83,160,227)" stroke-linecap="round" />\n<path d="M12.6,-10.2 A2.1,2.1,0,0,0,12.6,-6.0" stroke="#444" stroke-width="1.25" fill="#444" stroke-linecap="round" />\n<path d="M21.77986928011505,-8.399999999999999 A10.6,10.6,0,0,0,15.69914007006101,-13.236830413208175" stroke="#444" stroke-width="1.25" fill="none" stroke-linecap="round" />\n<path d="M15.69914007006101,-2.9631695867918246 A10.6,10.6,0,0,0,21.77986928011505,-7.800000000000001" stroke="#444" stroke-width="1.25" fill="none" stroke-linecap="round" />\n<path d="M12.6,-13.7 A10.6,10.6,0,0,0,3.42013071988495,-8.399999999999999" stroke="#444" stroke-width="1.25" fill="none" stroke-linecap="round" />\n<path d="M3.42013071988495,-7.800000000000001 A10.6,10.6,0,0,0,12.6,-2.5" stroke="#444" stroke-width="1.25" fill="none" stroke-linecap="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25.2" height="16.2" viewBox="0 -16.2 25.2 16.2">\n<path d="M12.6,-13.14 A5.04,5.04,0,0,0,12.599999999999998,-3.0599999999999996" stroke="none" stroke-width="1.25" fill="rgb(48, 142, 225)" stroke-linecap="round" />\n<path d="M12.6,-10.2 A2.1,2.1,0,0,0,12.6,-6.0" stroke="#ddd" stroke-width="1.25" fill="#ddd" stroke-linecap="round" />\n<path d="M21.77986928011505,-8.399999999999999 A10.6,10.6,0,0,0,15.69914007006101,-13.236830413208175" stroke="#ddd" stroke-width="1.25" fill="none" stroke-linecap="round" />\n<path d="M15.69914007006101,-2.9631695867918246 A10.6,10.6,0,0,0,21.77986928011505,-7.800000000000001" stroke="#ddd" stroke-width="1.25" fill="none" stroke-linecap="round" />\n<path d="M12.6,-13.7 A10.6,10.6,0,0,0,3.42013071988495,-8.399999999999999" stroke="#ddd" stroke-width="1.25" fill="none" stroke-linecap="round" />\n<path d="M3.42013071988495,-7.800000000000001 A10.6,10.6,0,0,0,12.6,-2.5" stroke="#ddd" stroke-width="1.25" fill="none" stroke-linecap="round" />\n</svg>\n'},shape_no:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25.2" height="16.2" viewBox="0 -16.2 25.2 16.2">\n<path d="M21.77986928011505,-8.399999999999999 A10.6,10.6,0,0,0,3.42013071988495,-8.399999999999999" stroke="#444" stroke-width="1.25" fill="none" stroke-linecap="round" />\n<path d="M3.42013071988495,-7.800000000000001 A10.6,10.6,0,0,0,21.77986928011505,-7.800000000000001" stroke="#444" stroke-width="1.25" fill="none" stroke-linecap="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25.2" height="16.2" viewBox="0 -16.2 25.2 16.2">\n<path d="M21.77986928011505,-8.399999999999999 A10.6,10.6,0,0,0,3.42013071988495,-8.399999999999999" stroke="#ddd" stroke-width="1.25" fill="none" stroke-linecap="round" />\n<path d="M3.42013071988495,-7.800000000000001 A10.6,10.6,0,0,0,21.77986928011505,-7.800000000000001" stroke="#ddd" stroke-width="1.25" fill="none" stroke-linecap="round" />\n</svg>\n'},stop:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="4.0" y="-22.0" width="18.0" height="18.0" fill="rgb(83,160,227)" stroke="#444" stroke-width="1.5" stroke-linejoin="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="4.0" y="-22.0" width="18.0" height="18.0" fill="rgb(48, 142, 225)" stroke="#ddd" stroke-width="1.5" stroke-linejoin="round" />\n</svg>\n'},top:{light:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="8.0" y="-24.0" width="16.0" height="16.0" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" />\n<path d="M2.0,-2.0 L2.0,-18.0 L8.0,-24.0 L8.0,-8.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-2.0 L8.0,-8.0 L24.0,-8.0 L18.0,-2.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-18.0 L8.0,-24.0 L24.0,-24.0 L18.0,-18.0 Z" fill="rgb(83,160,227)" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M18.0,-2.0 L18.0,-18.0 L24.0,-24.0 L24.0,-8.0 Z" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<rect x="2.0" y="-18.0" width="16.0" height="16.0" fill="none" stroke="#444" stroke-width="1.2" stroke-linejoin="round" />\n</svg>\n',dark:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="26.0" height="26.0" viewBox="0 -26.0 26.0 26.0">\n<rect x="8.0" y="-24.0" width="16.0" height="16.0" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" />\n<path d="M2.0,-2.0 L2.0,-18.0 L8.0,-24.0 L8.0,-8.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-2.0 L8.0,-8.0 L24.0,-8.0 L18.0,-2.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M2.0,-18.0 L8.0,-24.0 L24.0,-24.0 L18.0,-18.0 Z" fill="rgb(48, 142, 225)" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<path d="M18.0,-2.0 L18.0,-18.0 L24.0,-24.0 L24.0,-8.0 Z" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" stroke-linecap="round" />\n<rect x="2.0" y="-18.0" width="16.0" height="16.0" fill="none" stroke="#ddd" stroke-width="1.2" stroke-linejoin="round" />\n</svg>\n'}};function oc(t,e){return`url(data:image/svg+xml;utf8,${escape(sc[e][t])});`}function ac(t){return`${t}px`}const lc=["reset","resize","help","iso","front","rear","top","bottom","left","right","pin","plane","play","pause","stop"];class hc{constructor(t,e,n,i){this.index=t,this.display=i,this.slider=i.container.getElementsByClassName(`tcv_sld_value_plane${t}`)[0],this.slider.min=e,this.slider.max=n,this.input=i.container.getElementsByClassName(`tcv_inp_value_plane${t}`)[0],this.input.value=n,this.slider.oninput=this.sliderChange,this.input.addEventListener("change",this.inputChange)}_notify=(t,e=!0)=>{const n={};n["clip_slider_"+(this.index-1)]=parseFloat(t),this.display.viewer.checkChanges(n,e)};sliderChange=t=>{const e=t.target.value;this.input.value=Math.round(1e3*e)/1e3,this.display.refreshPlane(this.index,this.input.value),this._notify(e)};inputChange=t=>{const e=Math.max(Math.min(t.target.value,this.slider.max),this.slider.min);this.slider.value=e,this.display.refreshPlane(this.index,this.input.value),this._notify(e)};setSlider(t){const e=Math.abs(Math.round(Math.log10(2*t)));this.slider.min=-t,this.slider.max=t,this.slider.step=Math.pow(10,-(3-e)),this.slider.value=t,this.input.value=Math.round(1e3*this.slider.max)/1e3,this.display.refreshPlane(this.index,this.input.value)}getValue(){return parseFloat(this.input.value)}setValue(t,e=!0){const n=Math.max(Math.min(t,this.slider.max),this.slider.min);this.input.value=n,this.slider.value=t,this.display.refreshPlane(this.index,this.input.value),this._notify(t,e)}}class cc{constructor(t,e){var n;this.container=t,this.container.innerHTML=`\n<div class="tcv_cad_viewer">\n <div class="tcv_cad_toolbar tcv_round">\n <span class="tcv_tooltip" data-tooltip="Show coordinate axis">\n <input class='tcv_axes tcv_check' id='tcv_axes_${n=this.container.id}' type="checkbox" />\n <label for='tcv_axes_${n}' class="tcv_label">Axes</label>\n </span>\n <div class="tcv_grid-dropdown">\n <input class='tcv_grid tcv_check' id='tcv_grid_${n}' type="checkbox" />\n <label for='tcv_grid_${n}' class="tcv_label">Grid</label>\n <div class="tcv_grid-content tcv_dropdown-content">\n <div class="tcv_tooltip" data-tooltip="Show xy grid">\n <input class='tcv_grid-xy tcv_check tcv_dropdown-entry' id='tcv_grid-xy_${n}' type="checkbox">\n <label for='tcv_grid-xy_${n}' class="tcv_label tcv_dropdown-entry">xy</label>\n </div>\n <div class="tcv_tooltip" data-tooltip="Show xz grid">\n <input class='tcv_grid-xz tcv_check tcv_dropdown-entry' id='tcv_grid-xz_${n}' type="checkbox">\n <label for='tcv_grid-xz_${n}' class="tcv_label tcv_dropdown-entry">xz</label>\n </div>\n <div class="tcv_tooltip" data-tooltip="Show yz grid">\n <input class='tcv_grid-yz tcv_check tcv_dropdown-entry' id='tcv_grid-yz_${n}' type="checkbox">\n <label for='tcv_grid-yz_${n}' class="tcv_label tcv_dropdown-entry">yz</label>\n </div>\n </div>\n </div>\n <span class="tcv_tooltip" data-tooltip="Move center of axis and grid to (0,0,0)">\n <input class='tcv_axes0 tcv_check' id='tcv_axes0_${n}' type="checkbox" /><label for='tcv_axes0_${n}'\n class="tcv_label">@0</label>\n </span>\n <span class="tcv_tooltip" data-tooltip="Toggle camera between orthographic and perspective view">\n <input class='tcv_ortho tcv_check' id='tcv_ortho_${n}' type="checkbox" /><label for='tcv_ortho_${n}'\n class="tcv_label">Ortho</label>\n </span>\n <span class="tcv_tooltip" data-tooltip="Reset view">\n <input class='tcv_reset tcv_btn' type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Fit view">\n <input class='tcv_resize tcv_btn' type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Switch to iso view">\n <input class='tcv_iso tcv_btn' type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Switch to front view">\n <input class='tcv_front tcv_btn' type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Switch to back view">\n <input class='tcv_rear tcv_btn' type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Switch to top view">\n <input class='tcv_top tcv_btn' type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Switch to bottom view">\n <input class='tcv_bottom tcv_btn' type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Switch to left view">\n <input class='tcv_left tcv_btn' type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Switch to right view">\n <input class='tcv_right tcv_btn' type="button" />\n </span>\n <div class="tcv_more-dropdown">\n <button class="tcv_more-btn">More<span class="tcv_more_icon">▼</span></button>\n <span class="tcv_more-wrapper tcv_more-content tcv_dropdown-content">\n <span class="tcv_more_check" class="tcv_tooltip" data-tooltip="Toggle transparent objects">\n <input class='tcv_transparent tcv_check tcv_dropdown-entry' id='tcv_transparent_${n}' type="checkbox" />\n <label for='tcv_transparent_${n}' class="tcv_label tcv_dropdown-entry">Transparent</label>\n </span class="tcv_more_check">\n <span class="tcv_more_check" class="tcv_tooltip" data-tooltip="Toggle black edges">\n <input class='tcv_black_edges tcv_check tcv_dropdown-entry' id='tcv_black_edges_${n}' type="checkbox" />\n <label for='tcv_black_edges_${n}' class="tcv_label tcv_dropdown-entry">Black edges</label>\n </span class="tcv_more_check">\n <span class="tcv_more_check" class="tcv_explode_widget tcv_tooltip"\n data-tooltip="Explode assembly (@0 determines explosion center)">\n <input class='tcv_explode tcv_check tcv_dropdown-entry' id='tcv_explode_${n}' type="checkbox" />\n <label for='tcv_explode_${n}' class="tcv_label tcv_dropdown-entry">Explode</label>\n </span class="tcv_more_check">\n </span>\n </div>\n\n <span class="tcv_align_right">\n <span class="tcv_tooltip" data-tooltip="Toggle help">\n <input class='tcv_help tcv_btn' type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Pin view as PNG image">\n <input class='tcv_pin tcv_btn' type="button" />\n </span>\n </span>\n </div>\n\n <div class="tcv_cad_body">\n <div class="tcv_cad_navigation">\n <div class="tcv_cad_tree tcv_round">\n <div class="tcv_tabnav">\n <input class='tcv_tab_tree tcv_tab tcv_tab-left tcv_tab-selected' value="Tree" type="button" />\n <input class='tcv_tab_clip tcv_tab tcv_tab-right tcv_tab-unselected' value="Clipping"\n type="button" />\n </div>\n <div class="tcv_cad_tree_toggles">\n <span class="tcv_tooltip" data-tooltip="Collpase nodes with a single leaf">\n <input class='tcv_collapse_singles tcv_btn tcv_small_btn' value="1" type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Expand root node only">\n <input class='tcv_expand_root tcv_btn tcv_small_btn' value="R" type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Collpase tree">\n <input class='tcv_collapse_all tcv_btn tcv_small_btn' value="C" type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Expand tree">\n <input class='tcv_expand tcv_btn tcv_small_btn' value="E" type="button" />\n </span>\n </div>\n <div class="tcv_box_content tcv_mac-scrollbar tcv_scroller">\n <div class="tcv_cad_tree_container"></div>\n <div class="tcv_cad_clip_container">\n <div class="tcv_slider_group">\n <div>\n <span class="tcv_tooltip" data-tooltip="Set red clipping plane to view direction">\n <input class='tcv_btn_norm_plane1 tcv_btn tcv_plane' type="button" />\n </span>\n <span class="tcv_lbl_norm_plane1 tcv_label">N1 = (n/a, n/a, n/a)</span>\n </div>\n <div>\n <input type="range" min="1" max="100" value="50"\n class="tcv_sld_value_plane1 tcv_clip_slider">\n <input value=50 class="tcv_inp_value_plane1 tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_slider_group">\n <div>\n <span class="tooltip" data-tooltip="Set green clipping plane to view direction">\n <input class='tcv_btn_norm_plane2 tcv_btn tcv_plane' type="button" />\n </span>\n <span class="tcv_lbl_norm_plane2 tcv_label">N2 = (n/a, n/a, n/a)</span>\n </div>\n <div>\n <input type="range" min="1" max="100" value="50"\n class="tcv_sld_value_plane2 tcv_clip_slider">\n <input value=50 class="tcv_inp_value_plane2 tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_slider_group">\n <div>\n <span class="tooltip" data-tooltip="Set blue clipping plane to view direction">\n <input class='tcv_btn_norm_plane3 tcv_btn tcv_plane' type="button" />\n </span>\n <span class="tcv_lbl_norm_plane3 tcv_label">N3 = (n/a, n/a, n/a)</span>\n </div>\n <div>\n <input type="range" min="1" max="100" value="50"\n class="tcv_sld_value_plane3 tcv_clip_slider">\n <input value=50 class="tcv_inp_value_plane3 tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_clip_checks">\n <span class="tcv_tooltip" data-tooltip="Use intersection clipping">\n <span class="tcv_label">Intersection</span><input\n class='tcv_clip_intersection tcv_check' type="checkbox" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Show clipping planes">\n <span class="tcv_label">Planes</span><input\n class='tcv_clip_plane_helpers tcv_axes0 tcv_check' type="checkbox" />\n </span>\n </div>\n </div>\n </div>\n </div>\n <div class="tcv_cad_info_wrapper">\n <div class="tcv_toggle_info_wrapper">\n <span class="tooltip" data-tooltip="Open/close info box">\n <input class='tcv_toggle_info tcv_btn tcv_small_info_btn' value="<" type="button" />\n </span>\n </div>\n <div class="tcv_cad_info tcv_round">\n <div class="tcv_box_content tcv_mac-scrollbar tcv_scroller">\n <div class="tcv_cad_info_container"></div>\n </div>\n </div>\n </div>\n </div>\n\n <div class="tcv_cad_view">\n <div class="tcv_cad_animation tcv_round">\n <span class="tcv_animation_label">E</span>\n <span><input type="range" min="0" max="1000" value="0"\n class="tcv_animation_slider tcv_clip_slider"></span>\n <span class="tcv_tooltip" data-tooltip="Play animation"><input class='tcv_play tcv_btn'\n type="button" /></span>\n <span class="tcv_tooltip" data-tooltip="Pause animation"><input class='tcv_pause tcv_btn'\n type="button" /></span>\n <span class="tcv_tooltip" data-tooltip="Stop and reset animation"><input class='tcv_stop tcv_btn'\n type="button" /></span>\n </div>\n\n <div class="tcv_cad_help tcv_round">\n <table class="tcv_cad_help_layout">\n <tr>\n <td></td>\n <td><b>Mouse Navigation</b></td>\n </tr>\n <tr>\n <td>Rotate</td>\n <td>&lt;left mouse button&gt;</td>\n </tr>\n <tr>\n <td>Rotate up / down</td>\n <td>&lt;Ctrl&gt; + &lt;left mouse button&gt;</td>\n </tr>\n <tr>\n <td>Rotate left / right</td>\n <td>&lt;Meta&gt; + &lt;left mouse button&gt;</td>\n </tr>\n <tr>\n <td>Pan</td>\n <td>&lt;Shift&gt; + &lt;left mouse button&gt; or &lt;right mouse button&gt;</td>\n </tr>\n <tr>\n <td>Zoom</td>\n <td>&lt;mouse wheel&gt; or &lt;middle mouse button&gt;</td>\n </tr>\n\n <tr>\n <td></td>\n <td><b>Mouse Selection</b></td>\n </tr>\n <tr>\n <td>Pick element</td>\n <td>&lt;left mouse button&gt; double click</td>\n </tr>\n <tr>\n <td></td>\n <td>Click on navigation tree label</td>\n </tr>\n <tr>\n <td></td>\n <td>(Shows axis-aligned bounding box, AABB)</td>\n </tr>\n <tr>\n <td>Hide element</td>\n <td>&lt;Meta&gt; + &lt;left mouse button&gt; double click</td>\n </tr>\n <tr>\n <td></td>\n <td>&lt;Meta&gt; + click on navigation tree label</td>\n </tr> <tr>\n <td>Isolate element</td>\n <td>&lt;Shift&gt; + &lt;left mouse button&gt; double click</td>\n </tr>\n <tr>\n <td></td>\n <td>&lt;Shift&gt; + click on navigation tree label</td>\n </tr>\n <tr>\n <td></td>\n <td><b>CAD Object Tree</b></td>\n </tr>\n <tr>\n <td>Collapse single leafs</td>\n <td>Button '1' (all nodes with one leaf only)</td>\n </tr>\n <tr>\n <td>Expand root only</td>\n <td>Button 'R'</td>\n </tr>\n <tr>\n <td>Collapse all nodes</td>\n <td>Button 'C'</td>\n </tr>\n <tr>\n <td>Expand all nodes</td>\n <td>Button 'E'</td>\n </tr>\n </table>\n </div>\n </div>\n </div>\n</div>\n`;const i=e.cadWidth+(e.glass?0:e.treeWidth);this.handleMoreButton(i),this.cadBody=this._getElement("tcv_cad_body"),this.cadTool=this._getElement("tcv_cad_toolbar"),this.cadView=this._getElement("tcv_cad_view"),this.cadTree=this._getElement("tcv_cad_tree_container"),this.cadTreeToggles=this._getElement("tcv_cad_tree_toggles"),this.cadClip=this._getElement("tcv_cad_clip_container"),this.tabTree=this._getElement("tcv_tab_tree"),this.tabClip=this._getElement("tcv_tab_clip"),this.cadInfo=this._getElement("tcv_cad_info_container"),this.cadAnim=this._getElement("tcv_cad_animation"),this.cadHelp=this._getElement("tcv_cad_help"),this.planeLabels=[];for(var r=1;r<4;r++)this.planeLabels.push(this._getElement(`tcv_lbl_norm_plane${r}`));var s;for(var o of(this.viewer=null,this.glass=e.glass,this.tools=e.tools,this.cadWidth=e.cadWidth,this.height=e.height,this.treeWidth=e.treeWidth,this._events=[],this.setSizes(e),this.activeTab="tree",this.cadTree.style.display="block",this.cadClip.style.display="none",this.clipSliders=null,this.lastPlaneState=!1,"dark"===e.theme||"browser"==e.theme&&window.matchMedia("(prefers-color-scheme: dark)").matches?(document.documentElement.setAttribute("data-theme","dark"),s="dark"):(document.documentElement.setAttribute("data-theme","light"),s="light"),lc)){var a=this.container.getElementsByClassName(`tcv_${o}`);for(r=0;r<a.length;r++){a[r].setAttribute("style",`background-image: ${oc(s,o)}`)}}this.showPinning(e.pinning)}_setupCheckEvent(t,e,n){const i=this._getElement(t);i.addEventListener("change",e),null!=n&&(i.checked=n),this._events.push(["change",t,e])}_setupClickEvent(t,e,n){this._getElement(t).addEventListener("click",e),this._events.push(["click",t,e])}_getElement(t){return this.container.getElementsByClassName(t)[0]}dispose(){var t,e,n;for(var i of this._events){[t,e,n]=i;this._getElement(e).removeEventListener(t,n)}this.cadTree.innerHTML="",this.cadView.removeChild(this.cadView.children[2]),this.container.innerHTML=""}handleMoreButton(t){const e=this._getElement("tcv_more-btn"),n=this._getElement("tcv_more-wrapper");t<970?(e.classList.remove("tcv_none"),n.classList.add("tcv_dropdown-content"),n.classList.add("tcv_more-content")):(e.classList.add("tcv_none"),n.classList.remove("tcv_dropdown-content"),n.classList.remove("tcv_more-content"))}setSizes(t,e=2/3){if(t.cadWidth&&(this.cadWidth=t.cadWidth,this.cadView.style.width=ac(t.cadWidth)),t.height&&(this.height=t.height,this.cadView.style.height=ac(t.height)),t.treeWidth&&(this.treeWidth=t.treeWidth,this.cadTree.parentElement.parentElement.style.width=ac(t.treeWidth),this.cadInfo.parentElement.parentElement.style.width=ac(t.treeWidth)),!t.glass){const n=Math.round(t.height*e);this.cadTree.parentElement.parentElement.style.height=ac(n),this.cadInfo.parentElement.parentElement.style.height=ac(t.height-n-4)}t.tools&&!t.glass?(this.cadTool.style.width=ac(t.treeWidth+t.cadWidth+4),this.cadBody.style.width=ac(t.treeWidth+t.cadWidth+4)):(this.cadTool.style.width=ac(t.cadWidth+2),this.cadBody.style.width=ac(t.cadWidth+2)),this.cadBody.style.height=ac(t.height+4)}setupUI(t){this.viewer=t,this._setupCheckEvent("tcv_axes",this.setAxes,t.axes),this._setupCheckEvent("tcv_grid",this.setGrid,t.grid),this._setupCheckEvent("tcv_grid-xy",this.setGrid,t.grid),this._setupCheckEvent("tcv_grid-xz",this.setGrid,t.grid),this._setupCheckEvent("tcv_grid-yz",this.setGrid,t.grid),this._setupCheckEvent("tcv_axes0",this.setAxes0,t.axes0),this._setupCheckEvent("tcv_ortho",this.setOrtho,t.ortho),this._setupCheckEvent("tcv_transparent",this.setTransparent,t.transparent),this._setupCheckEvent("tcv_black_edges",this.setBlackEdges,t.blackEdges),this._setupCheckEvent("tcv_explode",this.setExplode),this._setupClickEvent("tcv_reset",this.reset),this._setupClickEvent("tcv_resize",this.resize);["tcv_front","tcv_rear","tcv_top","tcv_bottom","tcv_left","tcv_right","tcv_iso"].forEach((t=>{this._setupClickEvent(t,this.setView)})),this._setupClickEvent("tcv_expand_root",this.handleCollapseNodes),this._setupClickEvent("tcv_collapse_singles",this.handleCollapseNodes),this._setupClickEvent("tcv_collapse_all",this.handleCollapseNodes),this._setupClickEvent("tcv_expand",this.handleCollapseNodes),this._setupClickEvent("tcv_toggle_info",this.toggleInfo),this._setupClickEvent("tcv_pin",this.pinAsPng),this._setupClickEvent("tcv_help",this.toggleHelp),this.help_shown=!0,this.info_shown=!this.glass;["tcv_tab_tree","tcv_tab_clip"].forEach((t=>{this._setupClickEvent(t,this.selectTab)})),this.clipSliders=[];for(var e=1;e<4;e++)this.clipSliders.push(new hc(e,0,100,this));for(this._setupCheckEvent("tcv_clip_plane_helpers",this.setClipPlaneHelpers,!1),this._setupCheckEvent("tcv_clip_intersection",this.setClipIntersection,!1),e=1;e<4;e++)this._setupClickEvent(`tcv_btn_norm_plane${e}`,this.setClipNormalFromPosition,!1);this._setupClickEvent("tcv_play",this.controlAnimation,!1),this._setupClickEvent("tcv_pause",this.controlAnimation,!1),this._setupClickEvent("tcv_stop",this.controlAnimation,!1),this.animationSlider=this.container.getElementsByClassName("tcv_animation_slider")[0],this.animationSlider.value=0,this.animationSlider.addEventListener("input",this.animationChange),this.showAnimationControl(!1),this.showHelp(!1)}updateUI(t,e,n,i,r,s,o){this.checkElement("tcv_axes",t),this.checkElement("tcv_axes0",e),this.checkElement("tcv_ortho",n),this.checkElement("tcv_transparent",i),this.checkElement("tcv_black_edges",r),this.showTools(s),this.glassMode(o)}checkElement(t,e){this._getElement(t).checked=e}addCadView(t){this.cadView.appendChild(t)}clearCadTree(){this.cadTree.innerHTML=""}addCadTree(t){this.cadTree.appendChild(t)}setAxes=t=>{const e=!!t.target.checked;this.viewer.setAxes(e)};setAxesCheck=t=>{this.checkElement("tcv_axes",t)};setGrid=t=>{const e=t.target.className.split(" ")[0].slice(4);this.viewer.setGrid(e)};setGridCheck=t=>{this.checkElement("tcv_grid",t)};setAxes0=t=>{const e=!!t.target.checked;this.viewer.setAxes0(e)};setAxes0Check=t=>{this.checkElement("tcv_axes0",t)};setOrtho=t=>{const e=!!t.target.checked;this.viewer.switchCamera(e)};setOrthoCheck=t=>{this.checkElement("tcv_ortho",t)};setTransparent=t=>{const e=!!t.target.checked;this.viewer.setTransparent(e)};setTransparentCheck=t=>{this.checkElement("tcv_transparent",t)};setBlackEdges=t=>{const e=!!t.target.checked;this.viewer.setBlackEdges(e)};setBlackEdgesCheck=t=>{this.checkElement("tcv_black_edges",t)};setExplode=t=>{!!t.target.checked?(this.viewer.hasAnimation()&&this.viewer.backupAnimation(),this.viewer.explode()):this.viewer.hasAnimation()&&(this.controlAnimationByName("stop"),this.viewer.clearAnimation(),this.viewer.restoreAnimation())};setExplodeCheck=t=>{this.checkElement("tcv_explode",t)};showExplode=t=>{this._getElement("tcv_explode_widget").style.display=t?"inline-block":"none"};setClipPlaneHelpers=t=>{const e=!!t.target.checked;this.setClipPlaneHelpersCheck(e),this.viewer.setClipPlaneHelpers(e)};setClipPlaneHelpersCheck=t=>{this.checkElement("tcv_clip_plane_helpers",t),this.lastPlaneState=t};showTools=t=>{this.tools=t,this.viewer&&(this.viewer.tools=t);var e=this._getElement("tcv_cad_toolbar"),n=this._getElement("tcv_cad_navigation");for(var i of[n,e])t?(i.style.height="36px",i.style.display="block"):(i.style.height="0px",i.style.display="none")};setClipIntersection=t=>{const e=!!t.target.checked;this.viewer.setClipIntersection(e)};setClipIntersectionCheck=t=>{this._getElement("tcv_clip_intersection").checked=t};reset=()=>{this.viewer.reset(),this.clearHighlights()};resize=()=>{this.viewer.resize()};clearHighlights(){["tcv_front","tcv_rear","tcv_top","tcv_bottom","tcv_left","tcv_right","tcv_iso"].forEach((t=>{this._getElement(t).classList.remove("tcv_btn_highlight")}))}highlightButton(t){this.clearHighlights(),this._getElement(`tcv_${t}`).classList.add("tcv_btn_highlight"),this.viewer.keepHighlight=!0}setView=t=>{const e=t.target.className.split(" ")[0].slice(4);this.viewer.presetCamera(e),this.highlightButton(e)};showPinning(t){this._getElement("tcv_pin").style.display=t?"inline-block":"none"}pinAsPng=t=>{this.viewer.pinAsPng()};setNormalLabel=(t,e)=>{this.planeLabels[t].innerHTML=`N=(${e[0].toFixed(2)}, ${e[1].toFixed(2)}, ${e[2].toFixed(2)})`};setClipNormalFromPosition=t=>{const e=parseInt(t.target.classList[0].slice(-1));this.viewer.setClipNormalFromPosition(e-1)};selectTab=t=>{const e=t.target.className.split(" ")[0];this.selectTabByName(e.slice(8))};selectTabByName(t){if(["clip","tree"].includes(t)){if("tree"===t&&"tree"!==this.activeTab){this.cadTree.style.display="block",this.cadTreeToggles.style.display="block",this.cadClip.style.display="none",this.viewer.nestedGroup.setBackVisible(!1),this.viewer.setLocalClipping(!1);var e=this.viewer.getClipPlaneHelpers();this.viewer.setClipPlaneHelpers(!1),this.lastPlaneState=e}else"clip"===t&&"clip"!==this.activeTab&&(this.cadTree.style.display="none",this.cadTreeToggles.style.display="none",this.cadClip.style.display="block",this.viewer.nestedGroup.setBackVisible(!0),this.viewer.setLocalClipping(!0),this.viewer.setClipPlaneHelpers(this.lastPlaneState));this.activeTab=t,this.viewer.checkChanges({tab:t}),"tree"==t?(this.tabTree.classList.add("tcv_tab-selected"),this.tabTree.classList.remove("tcv_tab-unselected"),this.tabClip.classList.remove("tcv_tab-selected"),this.tabClip.classList.add("tcv_tab-unselected")):(this.tabTree.classList.remove("tcv_tab-selected"),this.tabTree.classList.add("tcv_tab-unselected"),this.tabClip.classList.add("tcv_tab-selected"),this.tabClip.classList.remove("tcv_tab-unselected"))}}handleCollapseNodes=t=>{this.collapseNodes(t.target.value)};collapseNodes(t){"1"===t?(this.viewer.treeview.expandNodes(),this.viewer.treeview.collapseNodes(1)):"R"===t?(this.viewer.treeview.expandNodes(),this.viewer.treeview.collapseNodes(3)):"C"===t?this.viewer.treeview.collapseNodes(2):"E"===t&&this.viewer.treeview.expandNodes()}setSliderLimits(t){for(var e=0;e<3;e++)this.clipSliders[e].setSlider(t)}refreshPlane(t,e){this.viewer.refreshPlane(t-1,parseFloat(e))}showAnimationControl=t=>{this.cadAnim.style.display=t?"block":"none"};controlAnimationByName(t){this.viewer.controlAnimation(t);var e=this.viewer.animation.getRelativeTime();this.animationSlider.value=1e3*e,"play"==t?this.viewer.bboxNeedsUpdate=!0:"stop"==t?(this.viewer.bboxNeedsUpdate=!1,null!=this.viewer.lastBbox&&(this.viewer.lastBbox.needsUpdate=!0)):this.viewer.bboxNeedsUpdate=!this.viewer.bboxNeedsUpdate}controlAnimation=t=>{const e=t.target.className.split(" ")[0].slice(4);this.controlAnimationByName(e)};animationChange=t=>{this.viewer.animation.setRelativeTime(t.target.valueAsNumber/1e3),null!=this.viewer.lastBbox&&(this.viewer.lastBbox.needsUpdate=!0)};setAnimationLabel(t){this._getElement("tcv_animation_label").innerHTML=t}resetAnimationSlider(){this.animationSlider.value=0}showHelp=t=>{this.cadHelp.style.display=t?"block":"none",this.help_shown=t};toggleHelp=()=>{this.showHelp(!this.help_shown)};showInfo=t=>{this.cadInfo.parentNode.parentNode.style.display=t?"block":"none",this._getElement("tcv_toggle_info").value=t?"▲ i":"▼ i",this.info_shown=t};toggleInfo=()=>{this.showInfo(!this.info_shown)};autoCollapse(){this.cadWidth<600&&this.glass&&(console.info("Small view, collapsing tree"),this.collapseNodes("C"))}glassMode(t){t?(this._getElement("tcv_cad_tree").classList.add("tcv_cad_tree_glass"),this._getElement("tcv_cad_tree").style.height=null,this._getElement("tcv_cad_tree").style["max-height"]=ac(Math.round(2*this.height/3)-18),this._getElement("tcv_cad_info").classList.add("tcv_cad_info_glass"),this._getElement("tcv_cad_view").classList.add("tcv_cad_view_glass"),this._getElement("tcv_toggle_info_wrapper").style.display="block",this.showInfo(!1),this.glass=!0,this.autoCollapse()):(this._getElement("tcv_cad_tree").classList.remove("tcv_cad_tree_glass"),this._getElement("tcv_cad_tree").style["max-height"]=null,this._getElement("tcv_cad_tree").style.height=ac(Math.round(2*this.height/3)),this._getElement("tcv_cad_info").classList.remove("tcv_cad_info_glass"),this._getElement("tcv_cad_view").classList.remove("tcv_cad_view_glass"),this._getElement("tcv_toggle_info_wrapper").style.display="none",this.showInfo(!0),this.glass=!1),this.viewer&&(this.viewer.glass=!1);const e={cadWidth:this.cadWidth,glass:this.glass,height:this.height,tools:this.tools,treeWidth:t?0:this.treeWidth};this.setSizes(e);const n=this.cadWidth+(this.glass?0:this.treeWidth);this.handleMoreButton(n)}}const dc=new Y,uc=new q;class pc extends kl{constructor(){super(),this.type="LineSegmentsGeometry";this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new _e([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new _e([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(t){const e=this.attributes.instanceStart,n=this.attributes.instanceEnd;return void 0!==e&&(e.applyMatrix4(t),n.applyMatrix4(t),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new gh(e,6,1);return this.setAttribute("instanceStart",new Kr(n,3,0)),this.setAttribute("instanceEnd",new Kr(n,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const n=new gh(e,6,1);return this.setAttribute("instanceColorStart",new Kr(n,3,0)),this.setAttribute("instanceColorEnd",new Kr(n,3,3)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new Sa(t.geometry)),this}fromLineSegments(t){const e=t.geometry;if(!e.isGeometry)return e.isBufferGeometry&&this.setPositions(e.attributes.position.array),this;console.error("THREE.LineSegmentsGeometry no longer supports Geometry. Use THREE.BufferGeometry instead.")}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Y);const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;void 0!==t&&void 0!==e&&(this.boundingBox.setFromBufferAttribute(t),dc.setFromBufferAttribute(e),this.boundingBox.union(dc))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new mt),null===this.boundingBox&&this.computeBoundingBox();const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){const n=this.boundingSphere.center;this.boundingBox.getCenter(n);let i=0;for(let r=0,s=t.count;r<s;r++)uc.fromBufferAttribute(t,r),i=Math.max(i,n.distanceToSquared(uc)),uc.fromBufferAttribute(e,r),i=Math.max(i,n.distanceToSquared(uc));this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}}pc.prototype.isLineSegmentsGeometry=!0,vn.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new f(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},yn.line={uniforms:Ke.merge([vn.common,vn.fog,vn.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};class mc extends Qe{constructor(t){super({type:"LineMaterial",uniforms:Ke.clone(yn.line.uniforms),vertexShader:yn.line.vertexShader,fragmentShader:yn.line.fragmentShader,clipping:!0}),Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){!0===t?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set(t){Boolean(t)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===t?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(t){Boolean(t)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===t?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(t)}}mc.prototype.isLineMaterial=!0;const fc=new q,gc=new q,vc=new O,yc=new O,xc=new O,_c=new q,wc=new Mt,bc=new Th,Mc=new q,Sc=new Y,Ec=new mt,Tc=new O;let Ac,Lc,Cc,kc;function Rc(t,e,n){return Tc.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),Tc.multiplyScalar(1/Tc.w),Tc.x=kc/n.width,Tc.y=kc/n.height,Tc.applyMatrix4(t.projectionMatrixInverse),Tc.multiplyScalar(1/Tc.w),Math.abs(Math.max(Tc.x,Tc.y))}class Pc extends Ze{constructor(t=new pc,e=new mc({color:16777215*Math.random()})){super(t,e),this.type="LineSegments2"}computeLineDistances(){const t=this.geometry,e=t.attributes.instanceStart,n=t.attributes.instanceEnd,i=new Float32Array(2*e.count);for(let t=0,r=0,s=e.count;t<s;t++,r+=2)fc.fromBufferAttribute(e,t),gc.fromBufferAttribute(n,t),i[r]=0===r?0:i[r-1],i[r+1]=i[r]+fc.distanceTo(gc);const r=new gh(i,2,1);return t.setAttribute("instanceDistanceStart",new Kr(r,1,0)),t.setAttribute("instanceDistanceEnd",new Kr(r,1,1)),this}raycast(t,e){const n=this.material.worldUnits,i=t.camera;null!==i||n||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const r=void 0!==t.params.Line2&&t.params.Line2.threshold||0;Ac=t.ray;const s=this.matrixWorld,o=this.geometry,a=this.material;let l,h;if(kc=a.linewidth+r,Lc=o.attributes.instanceStart,Cc=o.attributes.instanceEnd,null===o.boundingSphere&&o.computeBoundingSphere(),Ec.copy(o.boundingSphere).applyMatrix4(s),n)l=.5*kc;else{l=Rc(i,Math.max(i.near,Ec.distanceToPoint(Ac.origin)),a.resolution)}if(Ec.radius+=l,!1!==Ac.intersectsSphere(Ec)){if(null===o.boundingBox&&o.computeBoundingBox(),Sc.copy(o.boundingBox).applyMatrix4(s),n)h=.5*kc;else{h=Rc(i,Math.max(i.near,Sc.distanceToPoint(Ac.origin)),a.resolution)}Sc.expandByScalar(h),!1!==Ac.intersectsBox(Sc)&&(n?function(t,e){for(let n=0,i=Lc.count;n<i;n++){bc.start.fromBufferAttribute(Lc,n),bc.end.fromBufferAttribute(Cc,n);const i=new q,r=new q;Ac.distanceSqToSegment(bc.start,bc.end,r,i),r.distanceTo(i)<.5*kc&&e.push({point:r,pointOnLine:i,distance:Ac.origin.distanceTo(r),object:t,face:null,faceIndex:n,uv:null,uv2:null})}}(this,e):function(t,e,n){const i=e.projectionMatrix,r=t.material.resolution,s=t.matrixWorld,o=t.geometry,a=o.attributes.instanceStart,l=o.attributes.instanceEnd,h=-e.near;Ac.at(1,xc),xc.w=1,xc.applyMatrix4(e.matrixWorldInverse),xc.applyMatrix4(i),xc.multiplyScalar(1/xc.w),xc.x*=r.x/2,xc.y*=r.y/2,xc.z=0,_c.copy(xc),wc.multiplyMatrices(e.matrixWorldInverse,s);for(let e=0,o=a.count;e<o;e++){if(vc.fromBufferAttribute(a,e),yc.fromBufferAttribute(l,e),vc.w=1,yc.w=1,vc.applyMatrix4(wc),yc.applyMatrix4(wc),vc.z>h&&yc.z>h)continue;if(vc.z>h){const t=vc.z-yc.z,e=(vc.z-h)/t;vc.lerp(yc,e)}else if(yc.z>h){const t=yc.z-vc.z,e=(yc.z-h)/t;yc.lerp(vc,e)}vc.applyMatrix4(i),yc.applyMatrix4(i),vc.multiplyScalar(1/vc.w),yc.multiplyScalar(1/yc.w),vc.x*=r.x/2,vc.y*=r.y/2,yc.x*=r.x/2,yc.y*=r.y/2,bc.start.copy(vc),bc.start.z=0,bc.end.copy(yc),bc.end.z=0;const o=bc.closestPointToPointParameter(_c,!0);bc.at(o,Mc);const c=m.lerp(vc.z,yc.z,o),d=c>=-1&&c<=1,u=_c.distanceTo(Mc)<.5*kc;if(d&&u){bc.start.fromBufferAttribute(a,e),bc.end.fromBufferAttribute(l,e),bc.start.applyMatrix4(s),bc.end.applyMatrix4(s);const i=new q,r=new q;Ac.distanceSqToSegment(bc.start,bc.end,r,i),n.push({point:r,pointOnLine:i,distance:Ac.origin.distanceTo(r),object:t,face:null,faceIndex:e,uv:null,uv2:null})}}}(this,i,e))}}}Pc.prototype.isLineSegments2=!0;class Dc extends pc{toJSON(){return kl.prototype.toJSON.call(this)}}const Ic=new q,Nc=new q,Bc=new g;class zc extends Ws{constructor(t,e=1,n=16711680){const i=new Ce,r=t.geometry.attributes.normal.count,s=new _e(2*r*3,3);i.setAttribute("position",s),super(i,new Ns({color:n,toneMapped:!1})),this.object=t,this.size=e,this.type="VertexNormalsHelper",this.matrixAutoUpdate=!1,this.update()}update(){this.object.updateMatrixWorld(!0),Bc.getNormalMatrix(this.object.matrixWorld);const t=this.object.matrixWorld,e=this.geometry.attributes.position,n=this.object.geometry;if(n&&n.isGeometry)console.error("THREE.VertexNormalsHelper no longer supports Geometry. Use BufferGeometry instead.");else{if(n&&n.isBufferGeometry){const i=n.attributes.position,r=n.attributes.normal;let s=0;for(let n=0,o=i.count;n<o;n++)Ic.fromBufferAttribute(i,n).applyMatrix4(t),Nc.fromBufferAttribute(r,n),Nc.applyMatrix3(Bc).normalize().multiplyScalar(this.size).add(Ic),e.setXYZ(s,Ic.x,Ic.y,Ic.z),s+=1,e.setXYZ(s,Nc.x,Nc.y,Nc.z),s+=1}e.needsUpdate=!0}}}class Oc extends Y{constructor(){super()}expandByObject(t,e=!1){if(t.updateWorldMatrix(!1,!1),"ObjectGroup"==t.constructor.name)return this.expandByObject(t.children[0],e),this;const n=t.geometry;if(void 0!==n)if(e&&null!=n.attributes&&void 0!==n.attributes.position)if(t.type.startsWith("LineSegment")){var i=n.clone();i.applyMatrix4(t.matrixWorld),i.boundingBox=null,i.computeBoundingBox(),Fc.copy(i.boundingBox),this.union(Fc)}else{const e=n.attributes.position;for(let n=0,i=e.count;n<i;n++)Uc.fromBufferAttribute(e,n).applyMatrix4(t.matrixWorld),this.expandByPoint(Uc)}else null===n.boundingBox&&n.computeBoundingBox(),Fc.copy(n.boundingBox),Fc.applyMatrix4(t.matrixWorld),this.union(Fc);const r=t.children;for(let t=0,n=r.length;t<n;t++)this.expandByObject(r[t],e);return this}max_dist_from_center(){return Math.max(...this.min.toArray().concat(this.max.toArray()).map((t=>Math.abs(t))))}boundingSphere(){return this.getBoundingSphere(Vc),Vc}center(){return this.getCenter(Uc),Uc.toArray()}}class Hc extends Ws{constructor(t,e=16776960){const n=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]),i=new Float32Array(24),r=new Ce;r.setIndex(new de(n,1)),r.setAttribute("position",new de(i,3)),super(r,new Ns({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(void 0!==this.object&&Gc.setFromObject(this.object,!0),Gc.isEmpty())return;const t=Gc.min,e=Gc.max,n=this.geometry.attributes.position,i=n.array;i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=t.x,i[4]=e.y,i[5]=e.z,i[6]=t.x,i[7]=t.y,i[8]=e.z,i[9]=e.x,i[10]=t.y,i[11]=e.z,i[12]=e.x,i[13]=e.y,i[14]=t.z,i[15]=t.x,i[16]=e.y,i[17]=t.z,i[18]=t.x,i[19]=t.y,i[20]=t.z,i[21]=e.x,i[22]=t.y,i[23]=t.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}}const Uc=new q,Fc=new Oc,Gc=new Oc,Vc=new mt;class Wc extends Hr{constructor(t,e,n,i){super(),this.opacity=t,this.alpha=null==e?1:e,this.edge_color=n,this.renderback=i,this.types={front:null,back:null,edges:null,vertrices:null}}addType(t,e){this.add(t),this.types[e]=t}setTransparent(t){for(var e of(this.types.back&&(this.types.back.material.opacity=t?this.opacity*this.alpha:this.alpha,this.types.front.material.opacity=t?this.opacity*this.alpha:this.alpha),this.children))e.material.depthWrite=!(this.alpha<1)&&!t,e.material.depthTest=!0,e.material.needsUpdate=!0}setBlackEdges(t){if(this.types.edges){const e=t?0:this.edge_color;this.types.edges.material.color=new R(e),this.types.edges.material.needsUpdate=!0}}setEdgeColor(t){this.types.edges&&(this.edge_color=t,this.types.edges.material.color=new R(t),this.types.edges.material.needsUpdate=!0)}setOpacity(t){(this.types.front||this.types.back)&&(this.opacity=t,this.types.back.material.opacity=this.opacity,this.types.front.material.opacity=this.opacity,this.types.back.material.needsUpdate=!0,this.types.front.material.needsUpdate=!0)}setShapeVisible(t){this.types.front.material.visible=t,this.types.back&&this.renderback&&(this.types.back.material.visible=t)}setEdgesVisible(t){this.types.edges&&(this.types.edges.material.visible=t),this.types.vertices&&(this.types.vertices.material.visible=t)}setBackVisible(t){this.types.back&&this.types.front.material.visible&&(this.types.back.material.visible=this.renderback||t)}setClipIntersection(t){for(var e of this.children)e.material.clipIntersection=t,e.material.clipIntersection=t,e.material.clipIntersection=t}setClipPlanes(t){this.types.back&&(this.types.back.material.clippingPlanes=t),this.types.front&&(this.types.front.material.clippingPlanes=t),this.types.edges&&(this.types.edges.material.clippingPlanes=t),this.types.vertices&&(this.types.vertices.material.clippingPlanes=t),this.updateMaterials(!0)}setPolygonOffset(t){this.types.back&&(this.types.back.material.polygonOffsetUnits=t)}updateMaterials(t){this.types.back&&(this.types.back.material.needsUpdate=t),this.types.front&&(this.types.front.material.needsUpdate=t),this.types.edges&&(this.types.edges.material.needsUpdate=t),this.types.vertices&&(this.types.vertices.material.needsUpdate=t)}}class jc{constructor(t,e,n,i,r,s,o,a){this.shapes=t,this.width=e,this.height=n,this.edgeColor=i,this.transparent=r,this.defaultOpacity=s,this.normalLen=o,this.blackEdges=!1,this.backVisible=!1,this.bb_max=a,this.delim="|",this.rootGroup=null,this.bbox=null,this.bsphere=null,this.groups={},this.clipPlanes=null}_dump(t){if(null==t&&(t=""),this.parts)for(var e of this.parts)this._dump(e,t+" ")}_renderEdges(t,e,n,i){var r=t instanceof Float32Array?t:new Float32Array(t.flat(2));const s=new Dc;s.setPositions(r);const o=new mc({linewidth:e,transparent:!0,depthWrite:!this.transparent,depthTest:!this.transparent,clipIntersection:!1});if(Array.isArray(n)){var a=n.map((t=>[new R(t).toArray(),new R(t).toArray()])).flat(2);s.setColors(a),o.vertexColors="VertexColors"}else o.color=new R(null==n?this.edgeColor:n);o.visible=1==i,o.resolution.set(this.width,this.height);var l=new Pc(s,o);return l.renderOrder=999,l}renderEdges(t,e,n,i,r,s){var o=new Wc(this.defaultOpacity,1,null==n?this.edgeColor:n),a=this._renderEdges(t,e,n,s);return r&&(a.name=r),o.addType(a,"edges"),i=i+this.delim+r,this.groups[i.replaceAll(this.delim,"/")]=o,o.name=i,o}renderVertices(t,e,n,i,r,s){var o=new Wc(this.defaultOpacity,1,null==n?this.edgeColor:n);const a=null==n?this.edgeColor:n,l=t instanceof Float32Array?t:new Float32Array(t.flat()),h=new Ce;h.setAttribute("position",new _e(l,3));const c=new qs({color:a,sizeAttenuation:!1,size:e,transparent:!0,clipIntersection:!1,visible:1==s});var d=new $s(h,c);return r&&(d.name=r),o.addType(d,"vertices"),i=i+this.delim+r,this.groups[i.replaceAll(this.delim,"/")]=o,o.name=i,o}renderShape(t,e,n,i,r,s,o){const a=t.vertices instanceof Float32Array?t.vertices:new Float32Array(t.vertices.flat()),l=t.normals instanceof Float32Array?t.normals:new Float32Array(t.normals.flat()),h=t.triangles instanceof Uint32Array?t.triangles:new Uint32Array(t.triangles.flat());var c=new Wc(this.defaultOpacity,n,this.edgeColor,i);r=r+this.delim+s,this.groups[r.replaceAll(this.delim,"/")]=c,c.name=r,null==n?n=1:n<1&&(this.transparent=!0);var d=new Ce;d.setAttribute("position",new de(a,3)),d.setAttribute("normal",new de(l,3)),d.setIndex(new de(h,1));const u=new Ca({color:e,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,transparent:!0,opacity:this.transparent?this.defaultOpacity*n:n,depthWrite:!this.transparent,depthTest:!0,clipIntersection:!1,side:0,visible:1==o[0]}),p=new le({color:new R(this.edgeColor),side:1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,transparent:!0,opacity:this.transparent?this.defaultOpacity*n:n,depthWrite:!this.transparent,depthTest:!0,clipIntersection:!1,visible:1==o[0]&&(i||this.backVisible)}),m=new Ze(d,u);m.name=s;const f=new Ze(d,p);if(f.name=s,n<1&&(f.renderOrder=999,m.renderOrder=999),c.addType(f,"back"),c.addType(m,"front"),this.normalLen>0){const t=new zc(m,this.normalLen,16711935);c.add(t)}const g=t.edges;if(g.length>0){var v=this._renderEdges(g,1,null,o[1]);v.name=s,c.addType(v,"edges")}return c}renderLoop(t,e,n){const i=t=>{var i;switch(t.type){case"edges":i=this.renderEdges(t.shape,t.width,t.color,e,t.name,n[t.id][1]);break;case"vertices":i=this.renderVertices(t.shape,t.size,t.color,e,t.name,n[t.id][1]);break;default:i=this.renderShape(t.shape,t.color,t.alpha,null!=t.renderback&&t.renderback,e,t.name,n[t.id])}return null!=t.loc&&(i.position.set(...t.loc[0]),i.quaternion.set(...t.loc[1])),i};var r=new Hr;for(var s of(null==t.loc&&(t.loc=[[0,0,0],[0,0,0,1]]),r.position.set(...t.loc[0]),r.quaternion.set(...t.loc[1]),e=e+this.delim+t.name,this.groups[e.replaceAll(this.delim,"/")]=r,r.name=e,t.parts))if(s.parts)r.add(this.renderLoop(s,e,n));else{const t=i(s);this.groups[s.id]=t,r.add(t)}return r}render(t){return this.rootGroup=this.renderLoop(this.shapes,"",t),this.rootGroup}boundingBox(){return null==this.bbox&&(this.bbox=new Oc,this.bbox.setFromObject(this.rootGroup,!0)),this.bbox}_traverse(t,e){for(var n in this.groups)for(var i of this.groups[n].children)i instanceof Wc&&i[t](e)}setTransparent(t){this.transparent=t,this._traverse("setTransparent",t)}setBlackEdges(t){this.blackEdges=t,this._traverse("setBlackEdges",t)}setBackVisible(t){this.backVisible=t,this._traverse("setBackVisible",t)}setEdgeColor(t){this.edge_color=t,this._traverse("setEdgeColor",t)}setOpacity(t){this.opacity=t,this._traverse("setOpacity",t)}setClipIntersection(t){this._traverse("setClipIntersection",t)}setClipPlanes(t){this.clipPlanes=t,this._traverse("setClipPlanes",t)}setPolygonOffset(t){this._traverse("setPolygonOffset",t)}updateMaterials(){this._traverse("updateMaterials",!0)}}class qc{constructor(t,e,n,i,r,s){void 0===n&&(n=10),this.display=t,this.bbox=e,this.grid=r,this.allGrid=r[0]|r[1]|r[2],this.gridHelper=[];var[o,a,l]=this.niceBounds(1.1*-e.max_dist_from_center(),1.1*e.max_dist_from_center(),2*n);this.size=a-o,this.ticks=l;for(var h=0;h<3;h++)this.gridHelper.push(new Bh(this.size,this.size/this.ticks,8947848,13421772));this.gridHelper[0].rotateX(Math.PI/2),this.gridHelper[1].rotateY(Math.PI/2),this.gridHelper[2].rotateZ(Math.PI/2),this.setCenter(i,s),this.setVisible()}niceNumber(t,e){var n=Math.floor(Math.log10(t)),i=t/10**n;return(e?i<1.5?1:i<3?2:i<7?5:10:i<=1?1:i<=2?2:i<=5?5:10)*10**n}niceBounds(t,e,n){var i,r;n||(n=10);var s=e-t;return 0==s?i=0:(r=this.niceNumber(s),i=this.niceNumber(r/(n-1),!0),t=Math.floor(t/i)*i,e=Math.ceil(e/i)*i),[t,e,i]}computeGrid(){this.allGrid=this.grid[0]|this.grid[1]|this.grid[2],this.display.checkElement("tcv_grid",this.allGrid),this.display.checkElement("tcv_grid-xy",this.grid[0]),this.display.checkElement("tcv_grid-xz",this.grid[1]),this.display.checkElement("tcv_grid-yz",this.grid[2]),this.setVisible()}setGrid(t){switch(t){case"grid":this.allGrid=!this.allGrid,this.grid[0]=this.allGrid,this.grid[1]=this.allGrid,this.grid[2]=this.allGrid;break;case"grid-xy":this.grid[0]=!this.grid[0];break;case"grid-xz":this.grid[1]=!this.grid[1];break;case"grid-yz":this.grid[2]=!this.grid[2]}this.computeGrid()}setGrids(t,e,n){this.grid[0]=t,this.grid[1]=e,this.grid[2]=n,this.computeGrid()}setCenter(t,e){if(t){for(var n=0;n<3;n++)this.gridHelper[n].position.set(0,0,0);this.gridHelper[0].position.z=-this.size/2,this.gridHelper[1].position.y=(e?1:-1)*this.size/2,this.gridHelper[2].position.x=-this.size/2}else{const t=this.bbox.center();for(n=0;n<3;n++)this.gridHelper[n].position.set(...t);this.gridHelper[0].position.z=-this.size/2+t[2],this.gridHelper[1].position.y=(e?1:-1)*this.size/2+t[1],this.gridHelper[2].position.x=-this.size/2+t[0]}}setVisible(){for(var t=0;t<3;t++)this.gridHelper[t].visible=this.grid[t]}}class Zc extends Pc{constructor(t,e,n,i,r,s,o,a){const l=new Float32Array([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e]),h="dark"===a?[1,69/255,0,1,69/255,0,50/255,205/255,50/255,50/255,205/255,50/255,59/255,158/255,1,59/255,158/255,1]:[1,0,0,1,0,0,0,.7,0,0,.7,0,0,0,1,0,0,1],c=new Dc;c.setPositions(l),c.setColors(new Float32Array(h));const d=new mc({vertexColors:!0,toneMapped:!1,linewidth:n,transparent:!0});d.resolution.set(i,r),super(c,d),this.center=t,this.type="AxesHelper",this.visible=o,this.setCenter(s)}dispose(){this.geometry.dispose(),this.material.dispose()}setCenter(t){t?this.position.set(0,0,0):this.position.set(...this.center)}setVisible(t){this.visible=t}}function Xc(t){if(Array.isArray(t))return t.map((t=>Xc(t)));if("object"==typeof t){var e={};for(var[n,i]of Object.entries(t))e[n]=Xc(i);return e}return t}function Yc(t,e,n=1e-9){if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&t.every(((t,n)=>Yc(t,e[n])));if("object"==typeof t&&"object"==typeof e){var i=Object.keys(t),r=Object.keys(e);return!(i.length!=r.length||!i.every((t=>Object.prototype.hasOwnProperty.call(e,t))))&&i.every((n=>Yc(t[n],e[n])))}return Number(t)===t&&Number(e)===e?Math.abs(t-e)<n:t===e}function Jc(t,e){t&&(e(t),t.children&&t.children.length>0&&t.children.forEach((t=>{Jc(t,e)})))}class $c{constructor(t,e,n,i){this.width=t,this.height=e,this.cad_camera=n,this.theme=i,this.camera=null,this.scene=null,this.renderer=null}create(){const t=2.7;this.scene=new Yr,this.camera=new En(-this.width,this.width,this.height,-this.height,1,1e3),this.camera.up=this.cad_camera.up,this.camera.lookAt(new q(0,0,0));const e=new Zc([0,0,0],60,t,this.width,this.height,!0,!0,this.theme);this.scene.add(e);const n="dark"===this.theme?[[1,69/255,0],[50/255,205/255,50/255],[59/255,158/255,1]]:[[1,0,0],[0,.7,0],[0,0,1]];this.cones=[];for(var i=0;i<3;i++){var r=new Co(0,3*t,6*t,20,1);const e=new le({color:new R(...n[i]),toneMapped:!1}),s=new Ze(r,e);s.matrixAutoUpdate=!1,this.cones.push(s)}this.cones[0].geometry.rotateZ(-Math.PI/2),this.cones[0].geometry.translate(60,0,0),this.cones[1].geometry.translate(0,60,0),this.cones[2].geometry.rotateX(Math.PI/2),this.cones[2].geometry.translate(0,0,60),this.scene.add(...this.cones);const s=new xa(3*t,20,20),o=new le({color:10526880}),a=new Ze(s,o);this.scene.add(a),this.scene.background=null}dispose(){Jc(this.scene,(t=>{t.geometry?.dispose(),t.material?.dispose()})),this.scene=null,this.camera=null}render(t){t.setViewport(0,0,this.width,this.height),t.render(this.scene,this.camera)}update(t,e){this.camera.position.copy(t),this.camera.position.setLength(300),this.camera.rotation.copy(e)}}function Kc(t,e,n){var i=document.createElement(t);if(void 0!==e)for(var r in e)i.classList.add(e[r]);if(void 0!==n)for(var s in n)i[s]=n[s];return i}const Qc=0,td=1,ed=2,nd=3;class id{constructor(t,e,n,i,r){this.states=t,this.tree=e,this.objectHandler=n,this.pickHandler=i,this.theme=r,this.lastSelection=null,this.setupIcons(r),this.treeModel=this.toModel(e)}setupIcons(t){var e={};e[Qc]=oc(t,"shape_no"),e[td]=oc(t,"shape"),e[ed]=oc(t,"shape_mix"),e[nd]=oc(t,"shape_empty");var n={};n[Qc]=oc(t,"mesh_no"),n[td]=oc(t,"mesh"),n[ed]=oc(t,"mesh_mix"),n[nd]=oc(t,"mesh_empty"),this.icons=[e,n]}toModel(t){var e={id:t.id,type:t.type,name:t.name,color:t.color,imgs:[],states:[]},n=0;if("node"===t.type){for(n in this.icons)e.states.push(td);for(n in e.children=[],t.children)e.children.push(this.toModel(t.children[n]))}else if("leaf"===t.type){var i=this.states[t.id];for(n in this.icons)e.states.push(i[n])}else console.error(`Error, unknown type '${t.type}'`);return e}toHtml(t){var e,n=0,i=Kc("li",[`node${t.id.replaceAll(" ","_")}`]),r=Kc("span",["tcv_tree_label"]);r.innerHTML=t.name,r.id=t.id,r.addEventListener("mousedown",(e=>{e.preventDefault(),e.stopPropagation();const n=e.target.id.split("/"),i=n.slice(0,-1).join("/"),r=n[n.length-1];this.pickHandler(i,r,e.metaKey,e.shiftKey,t.type,!0)}),!1);var s=Kc("span",["tcv_node_entry"],{id:t.id});if("node"===t.type){var o=Kc("span",["tcv_node_entry_wrap"]);for(n in o.appendChild(Kc("span",["tcv_t-caret","tcv_t-caret-down"])),this.icons)(e=Kc("input",["tcv_icon"],{type:"button",style:`background-image: ${this.getIcon(n,1)}`})).setAttribute("icon_id",n),e.addEventListener("click",(e=>{this.handleClick(t.type,t.id,e.srcElement.getAttribute("icon_id"))})),s.appendChild(e),t.imgs.push(e);s.appendChild(r),o.appendChild(s),i.append(o);var a=Kc("ul",["tcv_nested","tcv_active"]);for(var l in t.children)a.appendChild(this.toHtml(t.children[l]));i.appendChild(a)}else{for(n in this.icons)(e=Kc("input",["tcv_icon"],{type:"button",style:`background-image: ${this.getIcon(n,t.states[n])}`})).setAttribute("icon_id",n),0==n&&e.classList.add("tcv_indent"),t.states[n]!=nd&&e.addEventListener("click",(e=>{this.handleClick(t.type,t.id,e.srcElement.getAttribute("icon_id"))})),s.appendChild(e),t.imgs.push(e);s.appendChild(r),i.appendChild(s)}return i}_labelVisible(t){const e=this.container.parentElement.parentElement,n=e.getBoundingClientRect().height,i=e.scrollTop,r=t.offsetTop-134;return r-i<n-12&&r>i}_openToTop(t){for(var e=t.parentElement.parentElement.parentElement.parentElement;"LI"==e.tagName;)this.toggleTreeNode(e,!1),e=e.parentElement.parentElement}removeLabelHighlight(){this.lastSelection?.classList.remove("tcv_node_selected"),this.lastSelection=null}highlightLabel(t){const e=t!=this.lastSelection;this.removeLabelHighlight(),e&&(0==t.offsetTop&&this._openToTop(t),t.classList.add("tcv_node_selected"),this.lastSelection=t,this._labelVisible(t)||(null==t.scrollIntoViewIfNeeded?t.scrollIntoView({block:"nearest"}):t.scrollIntoViewIfNeeded()))}selectNode(t){const e=this.container.getElementsByClassName(`node${t.replaceAll(" ","_")}`)[0];if(null!=e){const t=e.getElementsByClassName("tcv_tree_label")[0];this.highlightLabel(t)}}toggleTreeNode(t,e){null==e?(t.querySelector(".tcv_nested").classList.toggle("tcv_active"),t.getElementsByClassName("tcv_t-caret")[0].classList.toggle("tcv_t-caret-down")):e?(t.querySelector(".tcv_nested").classList.remove("tcv_active"),t.getElementsByClassName("tcv_t-caret")[0].classList.remove("tcv_t-caret-down")):(t.querySelector(".tcv_nested").classList.add("tcv_active"),t.getElementsByClassName("tcv_t-caret")[0].classList.add("tcv_t-caret-down"))}render(t){this.container=Kc("ul",["tcv_toplevel"]);var e=new MutationObserver((i=>{this.container.contains(n)&&(1===this.tree.children.length&&"leaf"===this.tree.children[0].type?this.expandNodes():t>0&&t<4&&this.collapseNodes(t),e.disconnect())}));e.observe(this.container,{attributes:!1,childList:!0,characterData:!1,subtree:!1});const n=this.toHtml(this.treeModel);for(var i in this.container.appendChild(n),this.icons)this.updateNodes(this.treeModel,i);for(var r=this.container.getElementsByClassName("tcv_t-caret"),s=0;s<r.length;s++)r[s].addEventListener("click",(t=>{this.toggleTreeNode(t.target.parentElement.parentElement,null)}));return this.container}getNode(t,e){if(t.id==e)return t;for(var n in t.children){var i=this.getNode(t.children[n],e);if(null!=i)return i}return null}updateState(t,e,n){t.states[e]!=nd&&(this.states[t.id][e]=n,t.states[e]=n,this.setIcon(t.imgs[e],e,n))}propagateChange(t,e,n){for(var i in t.children){var r=t.children[i];"leaf"==r.type?this.updateState(r,e,n):this.propagateChange(r,e,n)}}updateNodes(t,e){var n=0;if("node"===t.type){var i=[];for(var r in t.children)i.push(this.updateNodes(t.children[r],e));var s=i.filter((t=>3!=t));n=0==s.length?3:s.reduce(((t,e)=>t==e?t:ed),s[0]),t.states[e]=n,this.setIcon(t.imgs[e],e,n)}else n=t.states[e];return n}_toggleNodes(t,e){var n=i=>{if("node"==i.type){if((1==t||3==t)&&(1===i.children.length||3==t)&&i!==this.tree&&"leaf"===i.children[0].type||2==t){var r=this.container.getElementsByClassName(`node${i.id.replaceAll(" ","_")}`)[0];null!=r&&this.toggleTreeNode(r,e)}for(var s of i.children)n(s)}};n(this.tree)}collapseNodes(t){this._toggleNodes(t,!0)}expandNodes(){this._toggleNodes(2,!1)}getIcon(t,e){return this.icons[t][e]}setIcon(t,e,n){t.setAttribute("style",`background-image: ${this.getIcon(e,n)}`)}hideAll(){[0,1].forEach((t=>this.setState("node",this.treeModel.id,t,0)))}showAll(){[0,1].forEach((t=>this.setState("node",this.treeModel.id,t,1)))}setState(t,e,n,i){this.handleStateChange(t,e,n,i)}handleClick(t,e,n){this.handleStateChange(t,e,n,null)}handleStateChange(t,e,n,i){var r,s=this.getNode(this.treeModel,e);r=null==i?s.states[n]==td?Qc:td:i?td:Qc,"leaf"==t?(this.updateState(s,n,r),this.updateNodes(this.treeModel,n),this.objectHandler(this.states)):"node"==t?(this.propagateChange(s,n,r),this.updateNodes(this.treeModel,n),this.objectHandler(this.states)):console.error(`Error, unknown type '${t}'`)}}class rd{constructor(t,e){this.prefix=t,this.timeit=e,this.start=performance.now(),e&&console.info(`three-cad-viewer: Timer ${t}:start`)}split(t){if(this.timeit){const e=performance.now();console.info(`three-cad-viewer: Timer ${this.prefix}:${t} ${(e-this.start).toFixed(1)} ms`)}}stop(){if(this.timeit){const t=performance.now();console.info(`three-cad-viewer: Timer ${this.prefix}:stop ${(t-this.start).toFixed(1)} ms`)}}}class sd extends Fs{constructor(t,e,n,i=1,r=16776960){const s=r,o=new Ce;o.setAttribute("position",new _e([-1,-1,1,-1,1,1,1,1,1,1,-1,1,-1,-1,1],3)),o.computeBoundingSphere(),super(o,new Ns({color:s,toneMapped:!1})),this.type="PlaneHelper",this.index=t,this.plane=e,this.size=i,this.center=n;const a=new Ce;a.setAttribute("position",new _e([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),a.computeBoundingSphere(),this.planeMesh=new Ze(a,new le({color:s,opacity:.05,transparent:!0,depthWrite:!1,toneMapped:!1})),this.add(this.planeMesh)}updateMatrixWorld(t){let e=-this.plane.constant;Math.abs(e)<1e-8&&(e=1e-8),this.scale.set(.5*this.size,.5*this.size,e),this.children[0].material.side=2,this.lookAt(this.plane.normal),super.updateMatrixWorld(t)}}class od{constructor(t,e,n,i,r){this.distance=n,this.uiCallback=i;const s=[new q(-1,0,0),new q(0,-1,0),new q(0,0,-1)];this.clipPlanes=[];for(var o=0;o<3;o++)this.clipPlanes.push(new hn(s[o],n)),this.uiCallback(o,s[o].toArray());this.planeHelpers=new Hr,this.planeHelpers.add(new sd(0,this.clipPlanes[0],t,e,"light"===r?16711680:16729344)),this.planeHelpers.add(new sd(1,this.clipPlanes[1],t,e,"light"===r?65280:3329330)),this.planeHelpers.add(new sd(2,this.clipPlanes[2],t,e,"light"===r?255:3907327)),this.planeHelpers.visible=!1}setConstant(t,e){this.clipPlanes[t].constant=e}setNormal=(t,e)=>{this.clipPlanes[t].normal=e,this.uiCallback(t,e.toArray())}}const ad=["t","tx","ty","tz","q","rx","ry","rz"];class ld{constructor(t){this.delim=t,this.tracks=[],this.mixer=null,this.clip=null,this.clipAction=null,this.clock=new Wl,this.duration=0,this._backup=[],this.root=null,this.duration=null,this.speed=null,this.repeat=null}addTrack(t,e,n,i,r){var s;if(t=t.replaceAll("/",this.delim),-1!==ad.indexOf(n))if(i.length==r.length)if(n.startsWith("t")){const o=e.position;switch(n){case"t":s=r.map((t=>o.clone().add(new q(...t)).toArray()));break;case"tx":s=r.map((t=>o.add(new q(t,0,0)).toArray()));break;case"ty":s=r.map((t=>o.add(new q(0,t,0)).toArray()));break;case"tz":s=r.map((t=>o.add(new q(0,0,t)).toArray()));break;default:return void console.error(`action ${n} is not supported`)}this.tracks.push(new Ja(t+".position",i,s.flat()))}else{const o=e.quaternion;if(n.startsWith("r")){s=r.map((t=>function(t,e){switch(t){case"x":t=new q(1,0,0);break;case"y":t=new q(0,1,0);break;case"z":t=new q(0,0,1)}var n=new j;return n.setFromAxisAngle(t,e/180*Math.PI),n}(n.slice(1),t))).map((t=>o.clone().multiply(t).toArray()))}else{if("q"!=n)return void console.error(`action ${n} is not supported`);s=r.map((t=>o.clone().multiply(t).toArray()))}this.tracks.push(new Xa(t+".quaternion",i,s.flat()))}else console.error("times and values arrays need have the same lenght");else console.error(`Unknown action: "${n}" not in ${ad}`)}backup(){this._backup={tracks:this.tracks,root:this.root,duration:this.duration,speed:this.speed,repeat:this.repeat}}restore(){return this.tracks=this._backup.tracks,{duration:this._backup.duration,speed:this._backup.speed,repeat:this._backup.repeat}}cleanBackup(){this._backup=[]}hasTracks(){return null!=this.tracks&&this.tracks.length>0}hasBackup(){return null!=this._backup&&Object.keys(this._backup).length>0}animate(t,e,n,i=!0){return this.root=t,this.duration=e,this.speed=n,this.repeat=i,this.clip=new $a("track",e,this.tracks),this.mixer=new mh(t),this.mixer.timeScale=n,this.clipAction=this.mixer.clipAction(this.clip),this.clipAction.setLoop(i?2201:2202),this.clipAction}setRelativeTime(t){this.clipAction.play(),this.clipAction.paused=!0;var e=this.duration*t;this.clipAction.time=e}getRelativeTime(){return this.clipAction.time/this.duration}dispose(){this.mixer=null,this.clipAction=null,this.clip=null,this.tracks=[],this.root=null}update(){this.mixer&&this.mixer.update(this.clock.getDelta())}}class hd{constructor(t){this.html=t,this.clear()}clear(){this.html.value="",this.number=0,this.chunks=[]}dispose(){this.clear(),this.html.innerHTML=""}addText(t){this.addHtml(`<pre style="white-space: nowrap;">${t}</pre>`)}addHtml(t){this.chunks.unshift([this.number,t]),this.number+=1,this.render()}render(){var t="<table class='tcv_info_table'>";for(var e of this.chunks)t+="<tr class='tcv_info_row'>",t+=`<td><pre class="tcv_info_num">[${e[0]}]</pre></td>`,t+=`<td>${e[1]}</td>`,t+="</tr>";t+="</table>",this.html.innerHTML=t}versionMsg(t,e){this.addHtml(`<b>Versions</b>\n <table>\n <tr class="tcv_small_table"><td>CadQuery:</td> <td>${t}</td> </tr>\n <tr class="tcv_small_table"><td>Jupyter CadQuery:</td><td>${e}</td> </tr>\n </table>`)}readyMsg(t,e){var n=`<div class="tcv_info_header">Ready</div>\n <table class="small_table">\n <tr class="tcv_small_table_row" ><td>Tick size</td> <td>${t} mm</td> </tr>\n <tr class="tcv_small_table_row" ><td>Control</td><td>${e}</td></tr>\n <tr class="tcv_small_table_row" ><td>Axes</td>\n <td>\n <span class="tcv_info_red"><b>X</b></span>,\n <span class="tcv_info_green"><b>Y</b></span>,\n <span class="tcv_info_blue"><b>Z</b></span>\n </td> \n </tr>\n </table>`;this.addHtml(n)}bbInfo(t,e,n){var i=`\n <table class="tcv_small_table">\n <tr class="tcv_small_table_row">\n <td><b>Path:</b></td>\n <td>${t}</td>\n </tr>\n <tr class="tcv_small_table_row">\n <td><b>Name:</b></td>\n <td>${e}</td>\n </tr>\n </table>\n `;i+='\n <div class="tcv_info_header">Bounding box:</div>\n <table class="tcv_small_table">\n <tr class="tcv_small_table_row">\n <th></th>\n <th>min</th>\n <th>max</th>\n <th>center</th>\n </tr>\n ';var r=new q;n.getCenter(r),["x","y","z"].forEach((t=>{i+=`\n <tr class="tcv_small_table_row">\n <th>${t}</th>\n <td align='right'>${n.min[t].toFixed(3)}</td>\n <td align='right'>${n.max[t].toFixed(3)}</td>\n <td align='right'>${r[t].toFixed(3)}</td>\n </tr>\n `})),i+="</table>",this.addHtml(i)}centerInfo(t){var e=`<div>Camera target set to AABB center:</div><div class='tcv_info_line'>{ x: ${t[0].toFixed(2)}, y: ${t[1].toFixed(2)}, z: ${t[2].toFixed(2)} }</div>`;this.addHtml(e)}}var cd=function(n,i){void 0===i&&console.warn('THREE.CameraControls: The second parameter "domElement" is now mandatory.'),i===document&&console.error('THREE.CameraControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=n,this.domElement=i,this.enabled=!0,this.target=new q,this.trackball=!1,this.holroyd=!0,this.radius=.9,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:t.ROTATE,MIDDLE:t.DOLLY,RIGHT:t.PAN},this.touches={ONE:e.ROTATE,TWO:e.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.quaternion0=this.object.quaternion.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return p.phi},this.getAzimuthalAngle=function(){return p.theta},this.saveState=function(){o.target0.copy(o.target),o.position0.copy(o.object.position),o.quaternion0.copy(o.object.quaternion),o.zoom0=o.object.zoom},this.reset=function(){o.target.copy(o.target0),o.object.position.copy(o.position0),o.object.quaternion.copy(o.quaternion0),o.object.zoom=o.zoom0,o.object.updateProjectionMatrix(),o.dispatchEvent(a),o.update(),d=c.NONE},this.update=function(){var t=new q,e=(new j).setFromUnitVectors(n.up,new q(0,1,0)),i=e.clone().invert(),r=new q,s=new j,l=new j,h=new q;const f=new q;return function(){var n,x=o.object.position;if(t.copy(x).sub(o.target),o.trackball&&!o.holroyd)m.theta&&(h.set(0,1,0).applyQuaternion(o.object.quaternion),n=o.enableDamping?o.dampingFactor:1,l.setFromAxisAngle(h,m.theta*n),o.object.quaternion.premultiply(l),t.applyQuaternion(l)),m.phi&&(h.set(1,0,0).applyQuaternion(o.object.quaternion),n=o.enableDamping?o.dampingFactor:1,l.setFromAxisAngle(h,m.phi*n),o.object.quaternion.premultiply(l),t.applyQuaternion(l)),t.multiplyScalar(g),t.clampLength(o.minDistance,o.maxDistance);else if(o.trackball&&o.holroyd){f.crossVectors(b,M);var _=Math.atan(f.length()/b.dot(M));_&&(f.normalize(),f.applyQuaternion(o.object.quaternion),_*=-2*(n=o.enableDamping?o.dampingFactor:1),l.setFromAxisAngle(f,_),o.object.quaternion.premultiply(l),t.applyQuaternion(l)),t.multiplyScalar(g),t.clampLength(o.minDistance,o.maxDistance),b.set(0,0,0),M.set(0,0,0)}else t.applyQuaternion(e),o.autoRotate&&d===c.NONE&&D(2*Math.PI/60/60*o.autoRotateSpeed),p.setFromVector3(t),o.enableDamping?(p.theta+=m.theta*o.dampingFactor,p.phi+=m.phi*o.dampingFactor):(p.theta+=m.theta,p.phi+=m.phi),p.theta=Math.max(o.minAzimuthAngle,Math.min(o.maxAzimuthAngle,p.theta)),p.phi=Math.max(o.minPolarAngle,Math.min(o.maxPolarAngle,p.phi)),p.makeSafe(),p.radius*=g,p.radius=Math.max(o.minDistance,Math.min(o.maxDistance,p.radius)),t.setFromSpherical(p),t.applyQuaternion(i);return!0===o.enableDamping?o.target.addScaledVector(v,o.dampingFactor):o.target.add(v),x.copy(o.target).add(t),!1===o.trackball&&o.object.lookAt(o.target),!0===o.enableDamping?(m.theta*=1-o.dampingFactor,m.phi*=1-o.dampingFactor,v.multiplyScalar(1-o.dampingFactor)):(m.set(0,0,0),v.set(0,0,0)),g=1,!!(y||r.distanceToSquared(o.object.position)>u||8*(1-s.dot(o.object.quaternion))>u)&&(o.dispatchEvent(a),r.copy(o.object.position),s.copy(o.object.quaternion),y=!1,!0)}}();const r={x:new q(1,0,0),y:new q(0,1,0),z:new q(0,0,1)};function s(t,e){if(o.trackball){const n=r[t],i=(new j).setFromAxisAngle(n,e);o.object.quaternion.premultiply(i),o.object.position.sub(o.target).applyQuaternion(i).add(o.target)}else console.log("not supported for orbit controls")}this.rotateX=function(t){s("x",t)},this.rotateY=function(t){s("y",t)},this.rotateZ=function(t){s("z",t)},this.rotateLeft=function(t){this.trackball?console.log("not supported for trackball controls"):D(t)},this.rotateUp=function(t){this.trackball?console.log("not supported for trackball controls"):I(t)},this.dispose=function(){o.domElement.removeEventListener("contextmenu",at,!1),o.domElement.removeEventListener("mousedown",Q,!1),o.domElement.removeEventListener("wheel",nt,!1),o.domElement.removeEventListener("touchstart",rt,!1),o.domElement.removeEventListener("touchend",ot,!1),o.domElement.removeEventListener("touchmove",st,!1),document.removeEventListener("mousemove",tt,!1),document.removeEventListener("mouseup",et,!1),o.domElement.removeEventListener("keydown",it,!1)};var o=this,a={type:"change"},l={type:"start"},h={type:"end"},c={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},d=c.NONE,u=1e-6,p=new wh,m=new wh,g=1,v=new q,y=!1,x=new f,_=new f,w=new f,b=new q,M=new q,S=new f,E=new f,T=new f,A=new f,L=new f,C=new f,k=!0,R=!0;function P(){return Math.pow(.95,o.zoomSpeed)}function D(t){k&&(m.theta-=t)}function I(t){R&&(m.phi-=t)}var N,B,z=(N=new q,function(t,e){N.setFromMatrixColumn(e,0),N.multiplyScalar(-t),v.add(N)}),O=function(){var t=new q;return function(e,n){!0===o.screenSpacePanning?t.setFromMatrixColumn(n,1):(t.setFromMatrixColumn(n,0),t.crossVectors(o.object.up,t)),t.multiplyScalar(e),v.add(t)}}(),H=(B=new q,function(t,e){var n=o.domElement;if(o.object.isPerspectiveCamera){var i=o.object.position;B.copy(i).sub(o.target);var r=B.length();r*=Math.tan(o.object.fov/2*Math.PI/180),z(2*t*r/n.clientHeight,o.object.matrix),O(2*e*r/n.clientHeight,o.object.matrix)}else o.object.isOrthographicCamera?(z(t*(o.object.right-o.object.left)/o.object.zoom/n.clientWidth,o.object.matrix),O(e*(o.object.top-o.object.bottom)/o.object.zoom/n.clientHeight,o.object.matrix)):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - pan disabled."),o.enablePan=!1)});function U(t){o.object.isPerspectiveCamera?g/=t:o.object.isOrthographicCamera?(o.object.zoom=Math.max(o.minZoom,Math.min(o.maxZoom,o.object.zoom*t)),o.object.updateProjectionMatrix(),y=!0):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - dolly/zoom disabled."),o.enableZoom=!1)}function F(t){o.object.isPerspectiveCamera?g*=t:o.object.isOrthographicCamera?(o.object.zoom=Math.max(o.minZoom,Math.min(o.maxZoom,o.object.zoom/t)),o.object.updateProjectionMatrix(),y=!0):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - dolly/zoom disabled."),o.enableZoom=!1)}const G=function(){const t=new q,e=o.radius*o.radius;return function(n){const i=o.domElement.getBoundingClientRect(),r=(n.x-i.x)/(i.width/2)-1,s=1-(n.y-i.y)/(i.height/2);return function(n,i){var r=(n*=o.rotateSpeed)*n+(i*=o.rotateSpeed)*i;r<=e/2?t.set(n,i,Math.sqrt(e-r)):t.set(n,i,e/(2*Math.sqrt(r)))}(k?r:0,R?s:0),t}}();function V(t){x.set(t.clientX,t.clientY)}function W(t){S.set(t.clientX,t.clientY)}function Z(t){if(1==t.touches.length)x.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),n=.5*(t.touches[0].pageY+t.touches[1].pageY);x.set(e,n)}}function X(t){if(1==t.touches.length)S.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),n=.5*(t.touches[0].pageY+t.touches[1].pageY);S.set(e,n)}}function Y(t){var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY,i=Math.sqrt(e*e+n*n);A.set(0,i)}function J(t){if(1==t.touches.length)_.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),n=.5*(t.touches[0].pageY+t.touches[1].pageY);_.set(e,n)}if(o.trackball&&o.holroyd)b=G(x).clone(),M=G(_).clone();else{w.subVectors(_,x).multiplyScalar(o.rotateSpeed);var i=o.domElement;D(2*Math.PI*w.x/i.clientHeight),I(2*Math.PI*w.y/i.clientHeight)}x.copy(_)}function $(t){if(1==t.touches.length)E.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),n=.5*(t.touches[0].pageY+t.touches[1].pageY);E.set(e,n)}T.subVectors(E,S).multiplyScalar(o.panSpeed),H(T.x,T.y),S.copy(E)}function K(t){var e=t.touches[0].pageX-t.touches[1].pageX,n=t.touches[0].pageY-t.touches[1].pageY,i=Math.sqrt(e*e+n*n);L.set(0,i),C.set(0,Math.pow(L.y/A.y,o.zoomSpeed)),U(C.y),A.copy(L)}function Q(e){if(!1!==o.enabled){var n;switch(e.preventDefault(),e.stopPropagation(),o.domElement.focus?o.domElement.focus():window.focus(),e.button){case 0:n=o.mouseButtons.LEFT;break;case 1:n=o.mouseButtons.MIDDLE;break;case 2:n=o.mouseButtons.RIGHT;break;default:n=-1}switch(n){case t.DOLLY:if(!1===o.enableZoom)return;!function(t){A.set(t.clientX,t.clientY)}(e),d=c.DOLLY;break;case t.ROTATE:if(e.shiftKey){if(!1===o.enablePan)return;W(e),d=c.PAN}else{if(!1===o.enableRotate)return;e.ctrlKey&&(k=!1),e.metaKey&&(R=!1),V(e),d=c.ROTATE}break;case t.PAN:if(e.ctrlKey||e.metaKey||e.shiftKey){if(!1===o.enableRotate)return;V(e),d=c.ROTATE}else{if(!1===o.enablePan)return;W(e),d=c.PAN}break;default:d=c.NONE}d!==c.NONE&&(document.addEventListener("mousemove",tt,!1),document.addEventListener("mouseup",et,!1),o.dispatchEvent(l))}}function tt(t){if(!1!==o.enabled)switch(t.preventDefault(),t.stopPropagation(),d){case c.ROTATE:if(!1===o.enableRotate)return;!function(t){if(_.set(t.clientX,t.clientY),o.trackball&&o.holroyd)b=G(x).clone(),M=G(_).clone();else{var e=o.domElement;w.subVectors(_,x).multiplyScalar(o.rotateSpeed),D(2*Math.PI*w.x/e.clientHeight),I(2*Math.PI*w.y/e.clientHeight)}x.copy(_),o.update()}(t);break;case c.DOLLY:if(!1===o.enableZoom)return;!function(t){L.set(t.clientX,t.clientY),C.subVectors(L,A),C.y>0?U(P()):C.y<0&&F(P()),A.copy(L),o.update()}(t);break;case c.PAN:if(!1===o.enablePan)return;!function(t){E.set(t.clientX,t.clientY),T.subVectors(E,S).multiplyScalar(o.panSpeed),H(T.x,T.y),S.copy(E),o.update()}(t)}}function et(t){!1!==o.enabled&&(document.removeEventListener("mousemove",tt,!1),document.removeEventListener("mouseup",et,!1),k=!0,R=!0,o.dispatchEvent(h),d=c.NONE)}function nt(t){!1===o.enabled||!1===o.enableZoom||d!==c.NONE&&d!==c.ROTATE||(t.preventDefault(),t.stopPropagation(),o.dispatchEvent(l),function(t){t.deltaY<0?F(P()):t.deltaY>0&&U(P()),o.update()}(t),o.dispatchEvent(h))}function it(t){!1!==o.enabled&&!1!==o.enableKeys&&!1!==o.enablePan&&function(t){var e=!1;switch(t.keyCode){case o.keys.UP:H(0,o.keyPanSpeed),e=!0;break;case o.keys.BOTTOM:H(0,-o.keyPanSpeed),e=!0;break;case o.keys.LEFT:H(o.keyPanSpeed,0),e=!0;break;case o.keys.RIGHT:H(-o.keyPanSpeed,0),e=!0}e&&(t.preventDefault(),o.update())}(t)}function rt(t){if(!1!==o.enabled){switch(t.preventDefault(),t.touches.length){case 1:switch(o.touches.ONE){case e.ROTATE:if(!1===o.enableRotate)return;Z(t),d=c.TOUCH_ROTATE;break;case e.PAN:if(!1===o.enablePan)return;X(t),d=c.TOUCH_PAN;break;default:d=c.NONE}break;case 2:switch(o.touches.TWO){case e.DOLLY_PAN:if(!1===o.enableZoom&&!1===o.enablePan)return;!function(t){o.enableZoom&&Y(t),o.enablePan&&X(t)}(t),d=c.TOUCH_DOLLY_PAN;break;case e.DOLLY_ROTATE:if(!1===o.enableZoom&&!1===o.enableRotate)return;!function(t){o.enableZoom&&Y(t),o.enableRotate&&Z(t)}(t),d=c.TOUCH_DOLLY_ROTATE;break;default:d=c.NONE}break;default:d=c.NONE}d!==c.NONE&&o.dispatchEvent(l)}}function st(t){if(!1!==o.enabled)switch(t.preventDefault(),t.stopPropagation(),d){case c.TOUCH_ROTATE:if(!1===o.enableRotate)return;J(t),o.update();break;case c.TOUCH_PAN:if(!1===o.enablePan)return;$(t),o.update();break;case c.TOUCH_DOLLY_PAN:if(!1===o.enableZoom&&!1===o.enablePan)return;!function(t){o.enableZoom&&K(t),o.enablePan&&$(t)}(t),o.update();break;case c.TOUCH_DOLLY_ROTATE:if(!1===o.enableZoom&&!1===o.enableRotate)return;!function(t){o.enableZoom&&K(t),o.enableRotate&&J(t)}(t),o.update();break;default:d=c.NONE}}function ot(t){!1!==o.enabled&&(o.dispatchEvent(h),d=c.NONE)}function at(t){!1!==o.enabled&&t.preventDefault()}o.domElement.addEventListener("contextmenu",at,!1),o.domElement.addEventListener("mousedown",Q,!1),o.domElement.addEventListener("wheel",nt,!1),o.domElement.addEventListener("touchstart",rt,!1),o.domElement.addEventListener("touchend",ot,!1),o.domElement.addEventListener("touchmove",st,!1),o.domElement.addEventListener("keydown",it,!1),-1===o.domElement.tabIndex&&(o.domElement.tabIndex=0),this.object.lookAt(o.target),this.update(),this.saveState()};(cd.prototype=Object.create(n.prototype)).constructor=cd;var dd=function(n,i){cd.call(this,n,i),this.mouseButtons.LEFT=t.ROTATE,this.mouseButtons.RIGHT=t.PAN,this.touches.ONE=e.ROTATE,this.touches.TWO=e.DOLLY_PAN};(dd.prototype=Object.create(n.prototype)).constructor=dd;var ud=function(n,i){cd.call(this,n,i),this.mouseButtons.LEFT=t.PAN,this.mouseButtons.RIGHT=t.ROTATE,this.touches.ONE=e.PAN,this.touches.TWO=e.DOLLY_ROTATE};(ud.prototype=Object.create(n.prototype)).constructor=ud;var pd=function(n,i){cd.call(this,n,i),this.trackball=!0,this.screenSpacePanning=!0,this.autoRotate=!1,this.mouseButtons.LEFT=t.ROTATE,this.mouseButtons.RIGHT=t.PAN,this.touches.ONE=e.ROTATE,this.touches.TWO=e.DOLLY_PAN};(pd.prototype=Object.create(n.prototype)).constructor=pd;class md{constructor(t,e,n,i,r=1,s=1,o=1){switch(this.type=t,this.camera=e,this.target=n,this.target0=n.slice(),this.domElement=i,this.rotateSpeed=r,this.zoomSpeed=s,this.panSpeed=o,t){case"orbit":this.initOrbitControls();break;case"trackball":this.initTrackballControls()}this.controls.target=new q(...this.target),this.controls.rotateSpeed=this.rotateSpeed,this.controls.zoomSpeed=this.zoomSpeed,this.controls.panSpeed=this.panSpeed,this.currentUpdateCallback=null,this.saveState(),this.update()}dispose(){this.controls.dispose(),this.controls=null}saveState(){this.controls.saveState()}initTrackballControls(t=!0){this.controls=new cd(this.camera,this.domElement),this.controls.trackball=!0,this.setHolroydTrackball(t)}initOrbitControls(){this.controls=new cd(this.camera,this.domElement)}addChangeListener(t){null==this.currentUpdateCallback&&(this.currentUpdateCallback=t,this.controls.addEventListener("change",t))}removeChangeListener(){null!=this.currentUpdateCallback&&(this.controls.removeEventListener("change",this.currentUpdateCallback),this.currentUpdateCallback=null)}update(){this.controls.update()}reset(){this.controls.reset()}setCamera(t){this.controls.object=t}setHolroydTrackball(t){this.controls.holroyd=t}getTarget(){return this.controls.target}getZoom0(){return this.controls.zoom0}setTarget(t){this.controls.target.copy(t)}setZoomSpeed(t){this.controls.zoomSpeed=t}setPanSpeed(t){this.controls.panSpeed=t}setRotateSpeed(t){this.controls.rotateSpeed=t}getResetLocation=()=>({target0:this.controls.target0.clone(),position0:this.controls.position0.clone(),quaternion0:this.controls.quaternion0.clone(),zoom0:this.controls.zoom0});setResetLocation=(t,e,n,i)=>{this.controls.target0.copy(t),this.controls.position0.copy(e),this.controls.quaternion0.copy(n),this.controls.zoom0=i};rotateUp(t){this.controls.rotateUp(-t/180*Math.PI),this.update()}rotateLeft(t){this.controls.rotateLeft(t/180*Math.PI),this.update()}rotateX(t){this.controls.rotateX(t/180*Math.PI),this.update()}rotateY(t){this.controls.rotateY(t/180*Math.PI),this.update()}rotateZ(t){this.controls.rotateZ(t/180*Math.PI),this.update()}}const fd={y_up:{iso:{pos:new q(1,1,1),z_rot:0},front:{pos:new q(0,0,1),z_rot:0},rear:{pos:new q(0,0,-1),z_rot:0},left:{pos:new q(-1,0,0),z_rot:0},right:{pos:new q(1,0,0),z_rot:0},top:{pos:new q(0,1,0),z_rot:0},bottom:{pos:new q(0,-1,0),z_rot:0}},z_up:{iso:{pos:new q(1,-1,1),z_rot:0},front:{pos:new q(0,-1,0),z_rot:0},rear:{pos:new q(0,1,0),z_rot:0},left:{pos:new q(-1,0,0),z_rot:0},right:{pos:new q(1,0,0),z_rot:0},top:{pos:new q(0,0,1),z_rot:-Math.PI/2},bottom:{pos:new q(0,0,-1),z_rot:-Math.PI/2}},legacy:{iso:{pos:new q(1,1,1),z_rot:0},front:{pos:new q(1,0,0),z_rot:0},rear:{pos:new q(-1,0,0),z_rot:0},left:{pos:new q(0,1,0),z_rot:0},right:{pos:new q(0,-1,0),z_rot:0},top:{pos:new q(0,0,1),z_rot:0},bottom:{pos:new q(0,0,-1),z_rot:0}}},gd={y_up:[0,1,0],z_up:[0,0,1],legacy:[0,0,1]};class vd{constructor(t,e,n,i,r,s){this.target=new q(...i),this.ortho=r,this.up={Y:"y_up",Z:"z_up",L:"legacy"}[s],this.yaxis=new q(0,1,0),this.zaxis=new q(0,0,1);const o=t/e;this.camera_distance=5*n;var a=2*Math.atan(.2)/Math.PI*180;this.pCamera=new en(a,o,.1,100*n),this.pCamera.up.set(...gd[this.up]),this.pCamera.lookAt(this.target);const l=this.projectSize(n,o);this.oCamera=new En(-l[0],l[0],l[1],-l[1],.1,100*n),this.oCamera.up.set(...gd[this.up]),this.oCamera.lookAt(this.target),this.camera=r?this.oCamera:this.pCamera,this.camera.up.set(...gd[this.up])}dispose(){this.oCamera=null,this.pCamera=null}getCamera(){return this.camera}lookAtTarget(){this.camera.lookAt(this.target)}updateProjectionMatrix(){this.camera.updateProjectionMatrix()}switchCamera(t){var e=this.getPosition().clone();const n=this.getZoom(),i=this.getQuaternion().clone();t?(this.camera=this.oCamera,this.ortho=!0):(this.camera=this.pCamera,this.ortho=!1),this.setPosition(e,!1),this.setZoom(n),this.setQuaternion(i),this.updateProjectionMatrix()}projectSize(t,e){var n,i;return e<1?i=(n=t)/e:n=(i=t)*e,[n,i]}setupCamera(t,e=null,n=null,i=null){if(null!=e){var r=t?e.clone().normalize().multiplyScalar(this.camera_distance).add(this.target):e;this.camera.position.set(...r.toArray())}null!=n&&this.camera.quaternion.set(...n.toArray()),null!=i&&this.setZoom(i),this.updateProjectionMatrix()}presetCamera(t,e=null){if(null==e&&(e=this.camera.zoom),this.setupCamera(!0,fd[this.up][t].pos,null,e),this.lookAtTarget(),0!=fd[this.up][t].z_rot){var n=new j;n.setFromAxisAngle(new q(0,0,1),fd[this.up][t].z_rot),n.multiply(this.getQuaternion()),this.setQuaternion(n)}}getZoom(){if(this.ortho)return this.camera.zoom;var t=this.camera.position.clone().sub(this.target);return this.camera_distance/t.length()}setZoom(t){this.ortho?this.camera.zoom=t:this.camera.position.sub(this.target).setLength(this.camera_distance/t).add(this.target),this.updateProjectionMatrix()}getPosition(){return this.camera.position}setPosition(t,e){const n=this;Array.isArray(t)&&3===t.length?n.setupCamera(e,new q(...t)):t instanceof q?n.setupCamera(e,t):console.error("wrong type for position",t)}getQuaternion(){return this.camera.quaternion}setQuaternion(t){const e=this;Array.isArray(t)&&4===t.length?e.setupCamera(null,null,new j(...t)):t instanceof j?e.setupCamera(null,null,t):console.error("wrong type for quaternion",t),this.updateProjectionMatrix()}getRotation(){return this.camera.rotation}changeDimensions(t,e,n){const i=e/n,r=this.projectSize(t,i);this.oCamera&&(this.oCamera.left=-r[0],this.oCamera.right=r[0],this.oCamera.top=r[1],this.oCamera.bottom=-r[1]),this.pCamera&&(this.pCamera.aspect=i),this.camera&&this.camera.updateProjectionMatrix()}}class yd{constructor(t,e,n,i=null,r=!0){this.notifyCallback=n,this.pinAsPngCallback=i,this.updateMarker=r,this.hasAnimationLoop=!1,this.setDisplayDefaults(e),this.display=new cc(t,{theme:this.theme,cadWidth:this.cadWidth,treeWidth:this.treeWidth,height:this.height,pinning:this.pinning,glass:this.glass,tools:this.tools}),window.THREE=rc,this.nestedGroup=null,this.mapping=null,this.tree=null,this.bbox=null,this.bb_max=0,this.scene=null,this.gridHelper=null,this.axesHelper=null,this.camera=null,this.controls=null,this.orientationMarker=null,this.treeview=null,this.ready=!1,this.mixer=null,this.animation=new ld("|"),this.continueAnimation=!0,this.clipNormals=[[-1,0,0],[0,-1,0],[0,0,-1]],this.camera_distance=0,this.raycaster=new yh,this.mouse=new f,this.renderer=new jr({alpha:!this.dark,antialias:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(this.cadWidth,this.height),this.renderer.setClearColor(16777215,0),this.renderer.autoClear=!1,this.lastNotification={},this.lastBbox=null,this.bboxNeedsUpdate=!1,this.keepHighlight=!1,this.renderer.domElement.addEventListener("dblclick",this.pick,!1),this.renderer.domElement.addEventListener("contextmenu",(t=>t.stopPropagation())),this.display.addCadView(this.renderer.domElement),console.debug("three-cad-viewer: WebGL Renderer created"),this.display.setupUI(this)}version(){return"1.7.12"}setDisplayDefaults(t){for(var e in this.theme="browser",this.cadWidth=800,this.treeWidth=250,this.height=600,this.pinning=!1,this.glass=!1,this.tools=!0,t)null==this[e]?console.warn(`Unknown option "${e}" to create a viewer - ignored`):this[e]=t[e]}setRenderDefaults(t){for(var e in this.ambientIntensity=.5,this.directIntensity=.3,this.defaultOpacity=.5,this.edgeColor=7368816,this.normalLen=0,t)void 0===this[e]?console.warn(`Unknown option "${e}" to create a viewer - ignored`):this[e]=t[e]}setViewerDefaults(t){for(var e in this.axes=!1,this.axes0=!1,this.grid=[!1,!1,!1],this.ortho=!0,this.transparent=!1,this.blackEdges=!1,this.collapse=0,this.clipIntersection=!1,this.clipPlaneHelpers=!1,this.clipNormal0=[-1,0,0],this.clipNormal1=[0,-1,0],this.clipNormal2=[0,0,-1],this.clipSlider0=-1,this.clipSlider1=-1,this.clipSlider2=-1,this.control="orbit",this.up="Z",this.ticks=10,this.position=null,this.quaternion=null,this.target=null,this.zoom=1,this.panSpeed=.5,this.rotateSpeed=1,this.zoomSpeed=.5,this.timeit=!1,t)void 0===this[e]?console.warn(`Unknown option ${e} to add shapes - ignored`):this[e]=t[e]}dumpOptions(){console.log("Display:"),console.log("- cadWidth",this.cadWidth),console.log("- control",this.control),console.log("- height",this.height),console.log("- pinning",this.pinning),console.log("- theme",this.theme),console.log("- treeHeight",this.treeHeight),console.log("- treeWidth",this.treeWidth),console.log("Render:"),console.log("- ambientIntensity",this.ambientIntensity),console.log("- defaultOpacity",this.defaultOpacity),console.log("- directIntensity",this.directIntensity),console.log("- edgeColor",this.edgeColor),console.log("- normalLen",this.normalLen),console.log("View:"),console.log("- axes",this.axes),console.log("- axes0",this.axes0),console.log("- blackEdges",this.blackEdges),console.log("- clipIntersection",this.clipIntersection),console.log("- clipPlaneHelpers",this.clipPlaneHelpers),console.log("- clipNormal0",this.clipNormal0),console.log("- clipNormal1",this.clipNormal1),console.log("- clipNormal2",this.clipNormal2),console.log("- clipSlider0",this.clipSlider0),console.log("- clipSlider1",this.clipSlider1),console.log("- clipSlider2",this.clipSlider2),console.log("- grid",this.grid),console.log("- ortho",this.ortho),console.log("- panSpeed",this.panSpeed),console.log("- position",this.position),console.log("- quaternion",this.quaternion),console.log("- rotateSpeed",this.rotateSpeed),console.log("- ticks",this.ticks),console.log("- timeit",this.timeit),console.log("- tools",this.tools),console.log("- glass",this.glass),console.log("- transparent",this.transparent),console.log("- zoom",this.zoom),console.log("- zoom0",this.controls.getZoom0()),console.log("- zoomSpeed",this.zoomSpeed)}_renderTessellatedShapes(t,e){const n=new jc(t,this.cadWidth,this.height,this.edgeColor,this.transparent,this.defaultOpacity,this.normalLen);return n.render(e),n}_getTree(t,e){const n=(t,i)=>{const r=`${i}/${t.name}`;var s={name:t.name,id:r};if(t.parts)for(var o of(s.type="node",s.children=[],t.parts))s.children.push(n(o,r));else s.type="leaf",s.states=e[r];return s};return n(t,"")}renderTessellatedShapes(t,e,n){return this.setRenderDefaults(n),[this._renderTessellatedShapes(t,e),this._getTree(t,e)]}addAnimationTrack(t,e,n,i){this.animation.addTrack(t,this.nestedGroup.groups[t],e,n,i)}initAnimation(t,e,n="A",i=!0){null!=this.animation&&0!=this.animation.tracks.lenght?(console.debug("three-cad-viewer: Animation initialized"),this.hasAnimationLoop||this.toggleAnimationLoop(!0),this.display.showAnimationControl(!0),this.clipAction=this.animation.animate(this.nestedGroup.rootGroup,t,e,i),this.display.setAnimationLabel(n),this.display.resetAnimationSlider()):console.error("Animation does not have tracks")}hasAnimation(){return!!this.animation.clipAction}clearAnimation(){this.animation&&this.animation.dispose(),this.display.showAnimationControl(!1),this.toggleAnimationLoop(!1)}checkChanges=(t,e=!0)=>{var n={};Object.keys(t).forEach((e=>{if(!Yc(this.lastNotification[e],t[e])){var i=Xc(t[e]);n[e]={new:i,old:null==this.lastNotification[e]?null:Xc(this.lastNotification[e])},this.lastNotification[e]=i}})),Object.keys(n).includes("position")&&(this.keepHighlight?this.keepHighlight=!1:this.display.clearHighlights()),e&&this.notifyCallback&&Object.keys(n).length&&this.notifyCallback(n)};update=(t,e=!0)=>{this.ready&&(this.renderer.clear(),this.renderer.setViewport(0,0,this.cadWidth,this.height),this.renderer.render(this.scene,this.camera.getCamera()),null!=this.lastBbox&&(this.lastBbox.needsUpdate||this.bboxNeedsUpdate)&&(console.log("updated bbox"),this.lastBbox.bbox.update(),this.lastBbox.needsUpdate=!1),t&&(this.renderer.clearDepth(),this.orientationMarker.update(this.camera.getPosition().clone().sub(this.controls.getTarget()),this.camera.getRotation()),this.orientationMarker.render(this.renderer)),this.animation&&this.animation.update(),this.checkChanges({zoom:this.camera.getZoom(),position:this.camera.getPosition().toArray(),quaternion:this.camera.getQuaternion().toArray(),target:this.controls.getTarget().toArray()},e))};animate=()=>{this.continueAnimation?(requestAnimationFrame(this.animate),this.controls.update(),this.update(!0,!0)):console.debug("three-cad-viewer: Animation loop stopped")};toggleAnimationLoop(t){t?(this.continueAnimation=!0,this.hasAnimationLoop=!0,this.controls.removeChangeListener(),console.debug("three-cad-viewer: Change listener removed"),this.animate(),console.debug("three-cad-viewer: Animation loop started")):(this.hasAnimationLoop&&console.debug("three-cad-viewer: Turning animation loop off"),this.continueAnimation=!1,this.hasAnimationLoop=!1,this.controls.addChangeListener((()=>this.update(!0,!0))),console.debug("three-cad-viewer: Change listener registered"),setTimeout((()=>this.update(!0,!0)),50))}dispose(){this.clear(),null!=this.orientationMarker&&this.orientationMarker.dispose(),null!=this.renderer&&(this.renderer.renderLists.dispose(),this.renderer.getContext("webgl2").getExtension("WEBGL_lose_context").loseContext(),console.debug("three-cad-viewer: WebGL context disposed"),this.renderer=null),null!=this.display&&(this.display.dispose(),this.display=null)}clear(){null!=this.scene&&(this.continueAnimation=!1,this.hasAnimationLoop||(this.controls.removeChangeListener(),console.debug("three-cad-viewer: Change listener removed")),this.hasAnimationLoop=!1,this.display.showAnimationControl(!1),null!=this.animation&&this.animation.dispose(),this.display.setExplodeCheck(!1),this.renderer.clear(),Jc(this.scene,(t=>{t.geometry?.dispose(),t.material?.dispose()})),this.scene=null,this.display.clearCadTree(),this.info.dispose(),this.camera.dispose(),this.controls.dispose(),this.scene=null,this.ready=!1)}render(t,e,n,i){this.setViewerDefaults(i),this.animation.cleanBackup();const r=new rd("viewer",this.timeit);this.states=n,this.scene=new Yr,this.lastBbox=null,this.nestedGroup=t,this.scene.add(this.nestedGroup.render(n)),this.nestedGroup.setTransparent(this.transparent),this.nestedGroup.setBlackEdges(this.blackEdges),this.nestedGroup.setPolygonOffset(2),r.split("rendered nested group"),this.bbox=this.nestedGroup.boundingBox();const s=new q;this.bbox.getCenter(s),this.bb_max=this.bbox.max_dist_from_center(),this.bb_radius=Math.max(this.bbox.boundingSphere().radius,s.length()),r.split("bounding box"),this.info=new hd(this.display.cadInfo),this.camera=new vd(this.cadWidth,this.height,this.bb_radius,null==i.target?this.bbox.center():i.target,this.ortho,i.up),this.controls=new md(this.control,this.camera.getCamera(),null==i.target?this.bbox.center():i.target,this.renderer.domElement,this.rotateSpeed,this.zoomSpeed,this.panSpeed),this.controls.enableKeys=!1,this.controls.controls.screenSpacePanning=!0,null==i.position&&null==i.quaternion?(this.presetCamera("iso",this.zoom),this.display.highlightButton("iso")):null!=i.position?(this.setCamera(!1,i.position,i.quaternion,this.zoom),null==i.quaternion&&this.camera.lookAtTarget()):(this.info.addHtml("<b>quaternion needs position to be provided, falling back to ISO view</b>"),this.presetCamera("iso",this.zoom)),this.controls.update(),this.controls.saveState();const o=new Sl(16777215,this.ambientIntensity);for(var a of(this.scene.add(o),[-this.bb_max,this.bb_max]))for(var l of[-this.bb_max,this.bb_max])for(var h of[-this.bb_max,this.bb_max]){const t=new Ml(16777215,this.directIntensity);t.position.set(10*a,10*l,10*h),this.scene.add(t)}this.gridHelper=new qc(this.display,this.bbox,this.ticks,this.axes0,this.grid,"Z"==i.up),this.gridHelper.computeGrid();for(var c=0;c<3;c++)this.scene.add(this.gridHelper.gridHelper[c]);this.gridSize=this.gridHelper.size,this.axesHelper=new Zc(this.bbox.center(),this.gridSize/2,2,this.cadWidth,this.height,this.axes0,this.axes,this.theme),this.scene.add(this.axesHelper),this.clipping=new od(this.bbox.center,this.gridSize,this.gridSize/2,((t,e)=>this.display.setNormalLabel(t,e)),this.theme),this.display.setSliderLimits(this.gridSize/2),this.clipSlider0=this.gridSize/2,this.clipSlider1=this.gridSize/2,this.clipSlider2=this.gridSize/2,this.setClipSlider(0,this.clipSlider0,!0),this.setClipSlider(1,this.clipSlider1,!0),this.setClipSlider(2,this.clipSlider2,!0),this.setClipNormal(0,i.clipNormal0,!1),this.setClipNormal(1,i.clipNormal1,!1),this.setClipNormal(2,i.clipNormal2,!1),this.setClipIntersection(i.clipIntersection,!1),this.setClipPlaneHelpersCheck(i.clipPlaneHelpers),this.scene.add(this.clipping.planeHelpers),this.nestedGroup.setClipPlanes(this.clipping.clipPlanes),this.setLocalClipping(!1),this.orientationMarker=new $c(80,80,this.camera.getCamera(),this.theme),this.orientationMarker.create();const d="dark"===this.theme||"browser"===this.theme&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";this.tree=e,this.treeview=new id(Xc(this.states),this.tree,this.setObjects,this.handlePick,d),this.display.addCadTree(this.treeview.render(i.collapse)),this.display.selectTabByName("tree"),r.split("scene done"),this.display.updateUI(this.axes,this.axes0,this.ortho,this.transparent,this.blackEdges,this.tools,this.glass),this.display.autoCollapse(),1===this.treeview.tree.children.length&&this.treeview.expandNodes(),this.toggleAnimationLoop(this.hasAnimationLoop),this.ready=!0,this.info.readyMsg(this.gridHelper.ticks,this.control),this.notifyCallback&&this.notifyCallback({tab:{old:null,new:this.display.activeTab},target:{old:null,new:this.controls.target},target0:{old:null,new:this.controls.target0},clip_normal_0:{old:null,new:this.clipNormal0},clip_normal_1:{old:null,new:this.clipNormal1},clip_normal_2:{old:null,new:this.clipNormal2}}),r.stop()}setCamera=(t,e,n=null,i=null,r=!0)=>{this.camera.setupCamera(t,new q(...e),null!=n?new j(...n):null,i,r),this.update(!0,r)};presetCamera=(t,e=null,n=!0)=>{this.camera.presetCamera(t,e,n),this.update(!0,n)};getCameraType(){return this.camera.ortho?"ortho":"perspective"}switchCamera(t,e=!0){this.ortho=t,this.camera.switchCamera(t,e),this.controls.setCamera(this.camera.getCamera()),this.display.setOrthoCheck(t),this.checkChanges({ortho:t},e),this.update(!0,e)}recenterCamera(t=!0){const e=this.camera.getCamera(),n=new q,i=this.bbox.center();n.fromArray(i);const r=new q,s=this.controls.target;r.fromArray(s),this.camera.camera_distance=5*this.bb_radius,e.position.sub(r).add(n),this.controls.controls.target=n;let o=new q;e.getWorldDirection(o);let a=n.clone().add(o.normalize().multiplyScalar(-this.camera.camera_distance));e.position.set(a.x,a.y,a.z),this.update(!0,t)}resize=()=>{this.camera.setZoom(this.controls.getZoom0()),this.camera.updateProjectionMatrix(),this.update(!0)};reset=()=>{this.controls.reset(),this.update(!0)};setLocalClipping(t){this.renderer.localClippingEnabled=t,this.update(this.updateMarker)}setObjects=(t,e=!0)=>{for(var n in this.states){var i=this.states[n],r=t[n],s=this.nestedGroup.groups[n];i[0]!=r[0]&&(s.setShapeVisible(1===r[0]),this.states[n][0]=r[0]),i[1]!=r[1]&&(s.setEdgesVisible(1===r[1]),this.states[n][1]=r[1])}this.checkChanges({states:t},e),this.update(this.updateMarker)};setBoundingBox=t=>{const e=this.nestedGroup.groups[t];null!=e&&(null!=this.lastBbox&&this.scene.remove(this.lastBbox.bbox),null==this.lastBbox||null!=this.lastBbox&&t!=this.lastBbox.id?(this.lastBbox={id:t,bbox:new Hc(e,16711935),needsUpdate:!1},this.scene.add(this.lastBbox.bbox)):this.lastBbox=null,this.update(!1,!1,!1))};refreshPlane=(t,e)=>{this.clipping.setConstant(t,e),this.update(this.updateMarker)};backupAnimation(){this.animation.hasTracks()&&(this.backupTracks=this.animation.backup())}restoreAnimation(){if(this.animation.hasBackup()){var t=this.animation.restore();this.initAnimation(t.duration,t.speed,"A",t.repeat)}}controlAnimation=t=>{switch(t){case"play":this.clipAction.paused&&(this.clipAction.paused=!1),this.clipAction.play();break;case"pause":this.clipAction.paused=!this.clipAction.paused;break;case"stop":this.clipAction.stop()}};setState=(t,e,n="leaf",i=!0)=>{[0,1].forEach((i=>this.treeview.handleStateChange(n,t,i,e[i]))),this.update(this.updateMarker,i)};removeLastBbox(){null!=this.lastBbox&&(this.scene.remove(this.lastBbox.bbox),this.lastBbox=null,this.treeview.removeLabelHighlight())}handlePick=(t,e,n,i,r="leaf",s=!0)=>{const o=`${t}/${e}`,a=this.nestedGroup.groups[o],l=(new Oc).setFromObject(a,!0);if(null==this.lastBbox||this.lastBbox.id!==o||n||i)if(s&&this.treeview.selectNode(o),this.checkChanges({lastPick:{path:t,name:e,boundingBox:l,boundingSphere:l.boundingSphere()}}),this.animation.clipAction?.isRunning()&&(this.bboxNeedsUpdate=!0),n)this.setState(o,[0,0],r);else if(i){this.removeLastBbox(),this.treeview.hideAll(),this.setState(o,[1,1],r);const t=l.center();this.controls.setTarget(new q(...t)),this.info.centerInfo(t)}else this.info.bbInfo(t,e,l),this.setBoundingBox(o);else this.removeLastBbox();this.update(!0)};pick=t=>{const e=this.renderer.domElement.getBoundingClientRect(),n=e.x+window.pageXOffset,i=e.y+window.pageYOffset;this.mouse.x=(t.pageX-n)/this.cadWidth*2-1,this.mouse.y=-(t.pageY-i)/this.height*2+1,this.raycaster.setFromCamera(this.mouse,this.camera.getCamera());const r=this.raycaster.intersectObjects(this.scene.children.slice(0,1),!0);var s=null;for(var o of r)if(o.object.material.visible){s={path:o.object.parent.parent.name.replaceAll("|","/"),name:o.object.name,boundingBox:o.object.geometry.boundingBox,boundingSphere:o.object.geometry.boundingSphere,objectGroup:o.object.parent};break}null!=s&&this.handlePick(s.path,s.name,t.metaKey,t.shiftKey)};getAxes(){return this.axes}setAxes=(t,e=!0)=>{this.axes=t,this.axesHelper.setVisible(t),this.display.setAxesCheck(t),this.checkChanges({axes:t},e),this.update(this.updateMarker)};setGrid=(t,e=!0)=>{this.gridHelper.setGrid(t),this.checkChanges({grid:this.gridHelper.grid},e),this.update(this.updateMarker)};getGrids(){return this.grid}setGrids=(t,e=!0)=>{this.gridHelper.setGrids(...t),this.grid=this.gridHelper.grid,this.checkChanges({grid:this.gridHelper.grid},e),this.update(this.updateMarker)};getAxes0(){return this.axes0}setAxes0=(t,e=!0)=>{this.axes0=t,this.gridHelper.setCenter(t,"Z"==this.up),this.display.setAxes0Check(t),this.axesHelper.setCenter(t),this.checkChanges({axes0:t},e),this.update(this.updateMarker)};getTransparent(){return this.transparent}setTransparent=(t,e=!0)=>{this.transparent=t,this.nestedGroup.setTransparent(t),this.display.setTransparentCheck(t),this.checkChanges({transparent:t},e),this.update(this.updateMarker)};getBlackEdges(){return this.blackEdges}setBlackEdges=(t,e=!0)=>{this.blackEdges=t,this.nestedGroup.setBlackEdges(t),this.display.setBlackEdgesCheck(t),this.checkChanges({black_edges:t},e),this.update(this.updateMarker)};getOrtho(){return this.camera.ortho}setOrtho(t,e=!0){this.switchCamera(t,e)}getCameraZoom(){return this.camera.getZoom()}setCameraZoom(t,e=!0){this.camera.setZoom(t),this.controls.update(),this.update(!0,e)}getCameraPosition(){return this.camera.getPosition().toArray()}setCameraPosition(t,e=!1,n=!0){this.camera.setPosition(t,e),this.controls.update(),this.update(!0,n)}getCameraQuaternion(){return this.camera.getQuaternion().toArray()}setCameraQuaternion(t,e=!0){this.camera.setQuaternion(t),this.controls.update(),this.update(!0,e)}getCameraTarget(){return this.controls.getTarget().toArray()}setCameraTarget(t,e=!0){this.camera.getCamera().lookAt(new q(...t)),this.controls.setTarget(new q(...t)),this.controls.update(),this.update(!0,e)}getCameraLocationSettings(){return{position:this.getCameraPosition(),quaternion:this.getCameraQuaternion(),target:this.getCameraTarget(),zoom:this.getCameraZoom()}}setCameraLocationSettings(t=null,e=null,n=null,i=null,r=!0){null!=t&&this.camera.setPosition(t,!1),null!=e&&"trackball"===this.control&&this.camera.setQuaternion(e),null!=n&&this.controls.setTarget(new q(...n)),null!=i&&this.camera.setZoom(i),this.controls.update(),this.update(!0,r)}getEdgeColor(){return this.edgeColor}setEdgeColor=(t,e=!0)=>{this.edgeColor=t,this.nestedGroup.setEdgeColor(t),this.update(this.updateMarker,e)};getOpacity(){return this.defaultOpacity}setOpacity=(t,e=!0)=>{this.defaultOpacity=t,this.nestedGroup.setOpacity(t),this.update(this.updateMarker,e)};getTools(){return this.tools}showTools=(t,e=!0)=>{this.tools=t,this.display.showTools(t),this.update(this.updateMarker,e)};getAmbientLight(){return this.ambientIntensity}setAmbientLight=(t,e=!0)=>{for(var n of(this.ambientIntensity=t,this.scene.children))n instanceof Sl&&(n.intensity=t);this.update(this.updateMarker,e)};getDirectLight(){return this.directIntensity}setDirectLight=(t,e=!0)=>{for(var n of(this.directIntensity=t,this.scene.children))n instanceof Ml&&(n.intensity=t);this.update(this.updateMarker,e)};getStates(){return this.states}setStates=(t,e=!0)=>{for(var n in t)t[n][0]==this.states[n][0]&&t[n][1]==this.states[n][1]||this.setState(n,t[n],"leaf",e)};getZoomSpeed(){return this.zoomSpeed}setZoomSpeed=(t,e=!0)=>{this.zoomSpeed=t,this.controls.setZoomSpeed(t),this.checkChanges({grid:this.gridHelper.grid},e)};getPanSpeed(){return this.panSpeed}setPanSpeed=(t,e=!0)=>{this.panSpeed=t,this.controls.setPanSpeed(t),this.checkChanges({grid:this.gridHelper.grid},e)};getRotateSpeed(){return this.rotateSpeed}setRotateSpeed=(t,e=!0)=>{this.rotateSpeed=t,this.controls.setRotateSpeed(t),this.checkChanges({grid:this.gridHelper.grid},e)};getClipIntersection(){return this.clipIntersection}setClipIntersection=(t,e=!0)=>{null!=t&&(this.clipIntersection=t,this.nestedGroup.setClipIntersection(t),this.display.setClipIntersectionCheck(t),this.checkChanges({clip_intersection:t},e),this.update(this.updateMarker))};getClipPlaneHelpers(){return this.clipPlaneHelpers}setClipPlaneHelpersCheck(t){null!=t&&this.display.setClipPlaneHelpersCheck(t)}setClipPlaneHelpers=(t,e=!0)=>{null!=t&&(this.clipPlaneHelpers=t,this.clipping.planeHelpers.visible=t,this.display.setClipPlaneHelpersCheck(t),this.checkChanges({clip_planes:t},e),this.update(this.updateMarker))};getClipNormal(t){return this.clipNormals[t]}setClipNormal(t,e,n=!0){if(null!=e){this.clipNormals[t]=e,this.clipping.setNormal(t,new q(...e));var i={};i[`clip_normal_${t}`]=e,this.checkChanges(i,n),this.nestedGroup.setClipPlanes(this.clipping.clipPlanes),this.update(this.updateMarker)}}setClipNormalFromPosition=(t,e=!0)=>{const n=this.camera.getPosition().clone().sub(this.controls.getTarget()).normalize().negate().toArray();this.setClipNormal(t,n,e)};getClipSlider=t=>this.display.clipSliders[t].getValue();setClipSlider=(t,e,n=!0)=>{-1!=e&&null!=e&&this.display.clipSliders[t].setValue(e,n)};getResetLocation=()=>{const t=this.controls.getResetLocation();return{target0:t.target0.toArray(),position0:t.position0.toArray(),quaternion0:t.quaternion0.toArray(),zoom0:t.zoom0}};setResetLocation=(t,e,n,i,r=!0)=>{var s=this.getResetLocation();this.controls.setResetLocation(new q(...t),new q(...e),new O(...n),i),r&&this.notifyCallback&&this.notifyCallback({target0:{old:s.target0,new:t},position0:{old:s.position0,new:e},quaternion0:{old:s.quaternion0,new:n},zoom0:{old:s.zoom0,new:i}})};pinAsPng=()=>{const t=this.display.cadView.children[2];this.renderer.setViewport(0,0,this.cadWidth,this.height),this.renderer.render(this.scene,this.camera.getCamera()),t.toBlob((t=>{let e=new FileReader;const n=this;e.addEventListener("load",(function(){var t=document.createElement("img");if(t.width=n.cadWidth,t.height=n.height,t.src=e.result,null==n.pinAsPngCallback){for(var i of n.display.container.children)n.display.container.removeChild(i);n.display.container.appendChild(t)}else n.pinAsPngCallback(t)}),!1),e.readAsDataURL(t)}))};explode(t=2,e=1,n=2.5){this.clearAnimation();const i=this.getAxes0();var r=new q,s=new q,o=null,a=null,l=null;i||(new Y).setFromObject(this.nestedGroup.rootGroup).getCenter(r);for(var h in this.nestedGroup.groups){var c=this.nestedGroup.groups[h],d=new Y;c instanceof Wc&&d.expandByObject(c),d.isEmpty()||(d.getCenter(s),o=s.sub(r),a=c.parent.worldToLocal(o.clone()),(l=c.parent.worldToLocal(o.clone().multiplyScalar(n))).sub(a),this.addAnimationTrack(h,"t",[0,t],[[0,0,0],l.toArray()]))}this.initAnimation(t,e,"E",!1)}trimUI(t,e){var n=e?"inline-block":"none";for(var i of t){var r;["axes","axes0","grid","ortho","more","help"].includes(i)&&("more"!=i?((r=this.display._getElement(`tcv_${i}`)).style.display=n,"help"!==i&&(r.nextElementSibling.style.display=n)):(r=this.display._getElement(`tcv_${i}-dropdown`)).style.display=n)}}resizeCadView(t,e,n,i=!1){this.cadWidth=t,this.height=n,this.renderer.setSize(t,n),this.display.setSizes({treeWidth:e,cadWidth:t,height:n}),this.display.cadView.children[2].style.width=`${t}px`,this.display.cadView.children[2].style.height=`${n}px`,this.display.glassMode(i);const r=t+(i?0:e);this.display.handleMoreButton(r),this.camera.changeDimensions(this.bb_radius,t,n),this.update(!0)}}export{cc as Display,rd as Timer,yd as Viewer};
6
+ const t="151",e={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},i={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},n=1,s=2,r=3,a=0,o=1,l=100,c=0,h=1,d=2,u=0,p=1,m=2,f=3,g=4,v=5,_=300,y=301,x=302,A=303,w=304,b=306,M=1e3,S=1001,E=1002,C=1003,T=1004,L=1005,k=1006,I=1007,P=1008,R=1009,B=1012,D=1014,U=1015,N=1016,O=1020,z=1023,F=1026,G=1027,H=33776,V=33777,W=33778,j=33779,Q=35840,q=35841,Z=35842,X=35843,Y=37492,J=37496,K=37808,$=37809,tt=37810,et=37811,it=37812,nt=37813,st=37814,rt=37815,at=37816,ot=37817,lt=37818,ct=37819,ht=37820,dt=37821,ut=36492,pt=36284,mt=36285,ft=36286,gt=2201,vt=2202,_t=2300,yt=2301,xt=2302,At=2400,wt=2401,bt=2402,Mt=2500,St=2501,Et=3e3,Ct=3001,Tt="srgb",Lt="srgb-linear",kt="display-p3",It=7680,Pt=35044,Rt="300 es",Bt=1035;class Dt{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){if(void 0===this._listeners)return!1;const i=this._listeners;return void 0!==i[t]&&-1!==i[t].indexOf(e)}removeEventListener(t,e){if(void 0===this._listeners)return;const i=this._listeners[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){if(void 0===this._listeners)return;const e=this._listeners[t.type];if(void 0!==e){t.target=this;const i=e.slice(0);for(let e=0,n=i.length;e<n;e++)i[e].call(this,t);t.target=null}}}const Ut=["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"];let Nt=1234567;const Ot=Math.PI/180,zt=180/Math.PI;function Ft(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(Ut[255&t]+Ut[t>>8&255]+Ut[t>>16&255]+Ut[t>>24&255]+"-"+Ut[255&e]+Ut[e>>8&255]+"-"+Ut[e>>16&15|64]+Ut[e>>24&255]+"-"+Ut[63&i|128]+Ut[i>>8&255]+"-"+Ut[i>>16&255]+Ut[i>>24&255]+Ut[255&n]+Ut[n>>8&255]+Ut[n>>16&255]+Ut[n>>24&255]).toLowerCase()}function Gt(t,e,i){return Math.max(e,Math.min(i,t))}function Ht(t,e){return(t%e+e)%e}function Vt(t,e,i){return(1-i)*t+i*e}function Wt(t){return 0==(t&t-1)&&0!==t}function jt(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Qt(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function qt(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Zt(t,e){switch(e.constructor){case Float32Array:return t;case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const Xt={DEG2RAD:Ot,RAD2DEG:zt,generateUUID:Ft,clamp:Gt,euclideanModulo:Ht,mapLinear:function(t,e,i,n,s){return n+(t-e)*(s-n)/(i-e)},inverseLerp:function(t,e,i){return t!==e?(i-t)/(e-t):0},lerp:Vt,damp:function(t,e,i,n){return Vt(t,e,1-Math.exp(-i*n))},pingpong:function(t,e=1){return e-Math.abs(Ht(t,2*e)-e)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(Nt=t);let e=Nt+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*Ot},radToDeg:function(t){return t*zt},isPowerOfTwo:Wt,ceilPowerOfTwo:jt,floorPowerOfTwo:Qt,setQuaternionFromProperEuler:function(t,e,i,n,s){const r=Math.cos,a=Math.sin,o=r(i/2),l=a(i/2),c=r((e+n)/2),h=a((e+n)/2),d=r((e-n)/2),u=a((e-n)/2),p=r((n-e)/2),m=a((n-e)/2);switch(s){case"XYX":t.set(o*h,l*d,l*u,o*c);break;case"YZY":t.set(l*u,o*h,l*d,o*c);break;case"ZXZ":t.set(l*d,l*u,o*h,o*c);break;case"XZX":t.set(o*h,l*m,l*p,o*c);break;case"YXY":t.set(l*p,o*h,l*m,o*c);break;case"ZYZ":t.set(l*m,l*p,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}},normalize:Zt,denormalize:qt};class Yt{constructor(t=0,e=0){Yt.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.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(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(Gt(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),s=this.x-t.x,r=this.y-t.y;return this.x=s*i-r*n+t.x,this.y=s*n+r*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Jt{constructor(){Jt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(t,e,i,n,s,r,a,o,l){const c=this.elements;return c[0]=t,c[1]=n,c[2]=a,c[3]=e,c[4]=s,c[5]=o,c[6]=i,c[7]=r,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,s=this.elements,r=i[0],a=i[3],o=i[6],l=i[1],c=i[4],h=i[7],d=i[2],u=i[5],p=i[8],m=n[0],f=n[3],g=n[6],v=n[1],_=n[4],y=n[7],x=n[2],A=n[5],w=n[8];return s[0]=r*m+a*v+o*x,s[3]=r*f+a*_+o*A,s[6]=r*g+a*y+o*w,s[1]=l*m+c*v+h*x,s[4]=l*f+c*_+h*A,s[7]=l*g+c*y+h*w,s[2]=d*m+u*v+p*x,s[5]=d*f+u*_+p*A,s[8]=d*g+u*y+p*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],c=t[8];return e*r*c-e*a*l-i*s*c+i*a*o+n*s*l-n*r*o}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=c*r-a*l,d=a*o-c*s,u=l*s-r*o,p=e*h+i*d+n*u;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return t[0]=h*m,t[1]=(n*l-c*i)*m,t[2]=(a*i-n*r)*m,t[3]=d*m,t[4]=(c*e-n*o)*m,t[5]=(n*s-a*e)*m,t[6]=u*m,t[7]=(i*o-l*e)*m,t[8]=(r*e-i*s)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,s,r,a){const o=Math.cos(s),l=Math.sin(s);return this.set(i*o,i*l,-i*(o*r+l*a)+r+t,-n*l,n*o,-n*(-l*r+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(Kt.makeScale(t,e)),this}rotate(t){return this.premultiply(Kt.makeRotation(-t)),this}translate(t,e){return this.premultiply(Kt.makeTranslation(t,e)),this}makeTranslation(t,e){return this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const Kt=new Jt;function $t(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const te={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function ee(t,e){return new te[t](e)}function ie(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function ne(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function se(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const re=(new Jt).fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),ae=(new Jt).fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);const oe={[Lt]:t=>t,[Tt]:t=>t.convertSRGBToLinear(),[kt]:function(t){return t.convertSRGBToLinear().applyMatrix3(ae)}},le={[Lt]:t=>t,[Tt]:t=>t.convertLinearToSRGB(),[kt]:function(t){return t.applyMatrix3(re).convertLinearToSRGB()}},ce={enabled:!1,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(t){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!t},get workingColorSpace(){return Lt},set workingColorSpace(t){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(t,e,i){if(!1===this.enabled||e===i||!e||!i)return t;const n=oe[e],s=le[i];if(void 0===n||void 0===s)throw new Error(`Unsupported color space conversion, "${e}" to "${i}".`);return s(n(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)}};let he;class de{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===he&&(he=ie("canvas")),he.width=t.width,he.height=t.height;const i=he.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=he}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=ie("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const n=i.getImageData(0,0,t.width,t.height),s=n.data;for(let t=0;t<s.length;t++)s[t]=255*ne(s[t]/255);return i.putImageData(n,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*ne(e[t]/255)):e[t]=ne(e[t]);return{data:e,width:t.width,height:t.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}class ue{constructor(t=null){this.isSource=!0,this.uuid=Ft(),this.data=t,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let t;if(Array.isArray(n)){t=[];for(let e=0,i=n.length;e<i;e++)n[e].isDataTexture?t.push(pe(n[e].image)):t.push(pe(n[e]))}else t=pe(n);i.url=t}return e||(t.images[this.uuid]=i),i}}function pe(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?de.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let me=0;class fe extends Dt{constructor(t=fe.DEFAULT_IMAGE,e=fe.DEFAULT_MAPPING,i=1001,n=1001,s=1006,r=1008,a=1023,o=1009,l=fe.DEFAULT_ANISOTROPY,c=Et){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:me++}),this.uuid=Ft(),this.name="",this.source=new ue(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=n,this.magFilter=s,this.minFilter=r,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=o,this.offset=new Yt(0,0),this.repeat=new Yt(1,1),this.center=new Yt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Jt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.encoding=t.encoding,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).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,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==_)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case M:t.x=t.x-Math.floor(t.x);break;case S:t.x=t.x<0?0:1;break;case E:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case M:t.y=t.y-Math.floor(t.y);break;case S:t.y=t.y<0?0:1;break;case E:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}}fe.DEFAULT_IMAGE=null,fe.DEFAULT_MAPPING=_,fe.DEFAULT_ANISOTROPY=1;class ge{constructor(t=0,e=0,i=0,n=1){ge.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,s=this.w,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n+r[12]*s,this.y=r[1]*e+r[5]*i+r[9]*n+r[13]*s,this.z=r[2]*e+r[6]*i+r[10]*n+r[14]*s,this.w=r[3]*e+r[7]*i+r[11]*n+r[15]*s,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,n,s;const r=.01,a=.1,o=t.elements,l=o[0],c=o[4],h=o[8],d=o[1],u=o[5],p=o[9],m=o[2],f=o[6],g=o[10];if(Math.abs(c-d)<r&&Math.abs(h-m)<r&&Math.abs(p-f)<r){if(Math.abs(c+d)<a&&Math.abs(h+m)<a&&Math.abs(p+f)<a&&Math.abs(l+u+g-3)<a)return this.set(1,0,0,0),this;e=Math.PI;const t=(l+1)/2,o=(u+1)/2,v=(g+1)/2,_=(c+d)/4,y=(h+m)/4,x=(p+f)/4;return t>o&&t>v?t<r?(i=0,n=.707106781,s=.707106781):(i=Math.sqrt(t),n=_/i,s=y/i):o>v?o<r?(i=.707106781,n=0,s=.707106781):(n=Math.sqrt(o),i=_/n,s=x/n):v<r?(i=.707106781,n=.707106781,s=0):(s=Math.sqrt(v),i=y/s,n=x/s),this.set(i,n,s,e),this}let v=Math.sqrt((f-p)*(f-p)+(h-m)*(h-m)+(d-c)*(d-c));return Math.abs(v)<.001&&(v=1),this.x=(f-p)/v,this.y=(h-m)/v,this.z=(d-c)/v,this.w=Math.acos((l+u+g-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),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 ve extends Dt{constructor(t=1,e=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new ge(0,0,t,e),this.scissorTest=!1,this.viewport=new ge(0,0,t,e);const n={width:t,height:e,depth:1};this.texture=new fe(n,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=void 0!==i.generateMipmaps&&i.generateMipmaps,this.texture.internalFormat=void 0!==i.internalFormat?i.internalFormat:null,this.texture.minFilter=void 0!==i.minFilter?i.minFilter:k,this.depthBuffer=void 0===i.depthBuffer||i.depthBuffer,this.stencilBuffer=void 0!==i.stencilBuffer&&i.stencilBuffer,this.depthTexture=void 0!==i.depthTexture?i.depthTexture:null,this.samples=void 0!==i.samples?i.samples:0}setSize(t,e,i=1){this.width===t&&this.height===e&&this.depth===i||(this.width=t,this.height=e,this.depth=i,this.texture.image.width=t,this.texture.image.height=e,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.copy(t.viewport),this.texture=t.texture.clone(),this.texture.isRenderTargetTexture=!0;const e=Object.assign({},t.texture.image);return this.texture.source=new ue(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class _e extends fe{constructor(t=null,e=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:n},this.magFilter=C,this.minFilter=C,this.wrapR=S,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class ye extends fe{constructor(t=null,e=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:i,depth:n},this.magFilter=C,this.minFilter=C,this.wrapR=S,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class xe{constructor(t=0,e=0,i=0,n=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=n}static slerpFlat(t,e,i,n,s,r,a){let o=i[n+0],l=i[n+1],c=i[n+2],h=i[n+3];const d=s[r+0],u=s[r+1],p=s[r+2],m=s[r+3];if(0===a)return t[e+0]=o,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(1===a)return t[e+0]=d,t[e+1]=u,t[e+2]=p,void(t[e+3]=m);if(h!==m||o!==d||l!==u||c!==p){let t=1-a;const e=o*d+l*u+c*p+h*m,i=e>=0?1:-1,n=1-e*e;if(n>Number.EPSILON){const s=Math.sqrt(n),r=Math.atan2(s,e*i);t=Math.sin(t*r)/s,a=Math.sin(a*r)/s}const s=a*i;if(o=o*t+d*s,l=l*t+u*s,c=c*t+p*s,h=h*t+m*s,t===1-a){const t=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=t,l*=t,c*=t,h*=t}}t[e]=o,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,i,n,s,r){const a=i[n],o=i[n+1],l=i[n+2],c=i[n+3],h=s[r],d=s[r+1],u=s[r+2],p=s[r+3];return t[e]=a*p+c*h+o*u-l*d,t[e+1]=o*p+c*d+l*h-a*u,t[e+2]=l*p+c*u+a*d-o*h,t[e+3]=c*p-a*h-o*d-l*u,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e){const i=t._x,n=t._y,s=t._z,r=t._order,a=Math.cos,o=Math.sin,l=a(i/2),c=a(n/2),h=a(s/2),d=o(i/2),u=o(n/2),p=o(s/2);switch(r){case"XYZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"YXZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"ZXY":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"ZYX":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"YZX":this._x=d*c*h+l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h-d*u*p;break;case"XZY":this._x=d*c*h-l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h+d*u*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+r)}return!1!==e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],s=e[8],r=e[1],a=e[5],o=e[9],l=e[2],c=e[6],h=e[10],d=i+a+h;if(d>0){const t=.5/Math.sqrt(d+1);this._w=.25/t,this._x=(c-o)*t,this._y=(s-l)*t,this._z=(r-n)*t}else if(i>a&&i>h){const t=2*Math.sqrt(1+i-a-h);this._w=(c-o)/t,this._x=.25*t,this._y=(n+r)/t,this._z=(s+l)/t}else if(a>h){const t=2*Math.sqrt(1+a-i-h);this._w=(s-l)/t,this._x=(n+r)/t,this._y=.25*t,this._z=(o+c)/t}else{const t=2*Math.sqrt(1+h-i-a);this._w=(r-n)/t,this._x=(s+l)/t,this._y=(o+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Gt(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),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(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._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 t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,s=t._z,r=t._w,a=e._x,o=e._y,l=e._z,c=e._w;return this._x=i*c+r*a+n*l-s*o,this._y=n*c+r*o+s*a-i*l,this._z=s*c+r*l+i*o-n*a,this._w=r*c-i*a-n*o-s*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,n=this._y,s=this._z,r=this._w;let a=r*t._w+i*t._x+n*t._y+s*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=r,this._x=i,this._y=n,this._z=s,this;const o=1-a*a;if(o<=Number.EPSILON){const t=1-e;return this._w=t*r+e*this._w,this._x=t*i+e*this._x,this._y=t*n+e*this._y,this._z=t*s+e*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(o),c=Math.atan2(l,a),h=Math.sin((1-e)*c)/l,d=Math.sin(e*c)/l;return this._w=r*h+this._w*d,this._x=i*h+this._x*d,this._y=n*h+this._y*d,this._z=s*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=Math.random(),e=Math.sqrt(1-t),i=Math.sqrt(t),n=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(e*Math.cos(n),i*Math.sin(s),i*Math.cos(s),e*Math.sin(n))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Ae{constructor(t=0,e=0,i=0){Ae.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(be.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(be.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6]*n,this.y=s[1]*e+s[4]*i+s[7]*n,this.z=s[2]*e+s[5]*i+s[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,s=t.elements,r=1/(s[3]*e+s[7]*i+s[11]*n+s[15]);return this.x=(s[0]*e+s[4]*i+s[8]*n+s[12])*r,this.y=(s[1]*e+s[5]*i+s[9]*n+s[13])*r,this.z=(s[2]*e+s[6]*i+s[10]*n+s[14])*r,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,s=t.x,r=t.y,a=t.z,o=t.w,l=o*e+r*n-a*i,c=o*i+a*e-s*n,h=o*n+s*i-r*e,d=-s*e-r*i-a*n;return this.x=l*o+d*-s+c*-a-h*-r,this.y=c*o+d*-r+h*-s-l*-a,this.z=h*o+d*-a+l*-r-c*-s,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n,this.y=s[1]*e+s[5]*i+s[9]*n,this.z=s[2]*e+s[6]*i+s[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(t,Math.min(e,i)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.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(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,s=t.z,r=e.x,a=e.y,o=e.z;return this.x=n*o-s*a,this.y=s*r-i*o,this.z=i*a-n*r,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return we.copy(this).projectOnVector(t),this.sub(we)}reflect(t){return this.sub(we.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(Gt(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,i=Math.sqrt(1-t**2);return this.x=i*Math.cos(e),this.y=i*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const we=new Ae,be=new xe;class Me{constructor(t=new Ae(1/0,1/0,1/0),e=new Ae(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(Ee.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(Ee.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=Ee.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=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(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){if(t.updateWorldMatrix(!1,!1),void 0!==t.boundingBox)null===t.boundingBox&&t.computeBoundingBox(),Ce.copy(t.boundingBox),Ce.applyMatrix4(t.matrixWorld),this.union(Ce);else{const i=t.geometry;if(void 0!==i)if(e&&void 0!==i.attributes&&void 0!==i.attributes.position){const e=i.attributes.position;for(let i=0,n=e.count;i<n;i++)Ee.fromBufferAttribute(e,i).applyMatrix4(t.matrixWorld),this.expandByPoint(Ee)}else null===i.boundingBox&&i.computeBoundingBox(),Ce.copy(i.boundingBox),Ce.applyMatrix4(t.matrixWorld),this.union(Ce)}const i=t.children;for(let t=0,n=i.length;t<n;t++)this.expandByObject(i[t],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Ee),Ee.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Be),De.subVectors(this.max,Be),Te.subVectors(t.a,Be),Le.subVectors(t.b,Be),ke.subVectors(t.c,Be),Ie.subVectors(Le,Te),Pe.subVectors(ke,Le),Re.subVectors(Te,ke);let e=[0,-Ie.z,Ie.y,0,-Pe.z,Pe.y,0,-Re.z,Re.y,Ie.z,0,-Ie.x,Pe.z,0,-Pe.x,Re.z,0,-Re.x,-Ie.y,Ie.x,0,-Pe.y,Pe.x,0,-Re.y,Re.x,0];return!!Oe(e,Te,Le,ke,De)&&(e=[1,0,0,0,1,0,0,0,1],!!Oe(e,Te,Le,ke,De)&&(Ue.crossVectors(Ie,Pe),e=[Ue.x,Ue.y,Ue.z],Oe(e,Te,Le,ke,De)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Ee).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(Ee).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Se[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Se[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Se[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Se[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Se[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Se[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Se[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Se[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Se)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Se=[new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae,new Ae],Ee=new Ae,Ce=new Me,Te=new Ae,Le=new Ae,ke=new Ae,Ie=new Ae,Pe=new Ae,Re=new Ae,Be=new Ae,De=new Ae,Ue=new Ae,Ne=new Ae;function Oe(t,e,i,n,s){for(let r=0,a=t.length-3;r<=a;r+=3){Ne.fromArray(t,r);const a=s.x*Math.abs(Ne.x)+s.y*Math.abs(Ne.y)+s.z*Math.abs(Ne.z),o=e.dot(Ne),l=i.dot(Ne),c=n.dot(Ne);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>a)return!1}return!0}const ze=new Me,Fe=new Ae,Ge=new Ae;class He{constructor(t=new Ae,e=-1){this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):ze.setFromPoints(t).getCenter(i);let n=0;for(let e=0,s=t.length;e<s;e++)n=Math.max(n,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(n),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;Fe.subVectors(t,this.center);const e=Fe.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.addScaledVector(Fe,i/t),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(Ge.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Fe.copy(t.center).add(Ge)),this.expandByPoint(Fe.copy(t.center).sub(Ge))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Ve=new Ae,We=new Ae,je=new Ae,Qe=new Ae,qe=new Ae,Ze=new Ae,Xe=new Ae;class Ye{constructor(t=new Ae,e=new Ae(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Ve)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Ve.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Ve.copy(this.origin).addScaledVector(this.direction,e),Ve.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){We.copy(t).add(e).multiplyScalar(.5),je.copy(e).sub(t).normalize(),Qe.copy(this.origin).sub(We);const s=.5*t.distanceTo(e),r=-this.direction.dot(je),a=Qe.dot(this.direction),o=-Qe.dot(je),l=Qe.lengthSq(),c=Math.abs(1-r*r);let h,d,u,p;if(c>0)if(h=r*o-a,d=r*a-o,p=s*c,h>=0)if(d>=-p)if(d<=p){const t=1/c;h*=t,d*=t,u=h*(h+r*d+2*a)+d*(r*h+d+2*o)+l}else d=s,h=Math.max(0,-(r*d+a)),u=-h*h+d*(d+2*o)+l;else d=-s,h=Math.max(0,-(r*d+a)),u=-h*h+d*(d+2*o)+l;else d<=-p?(h=Math.max(0,-(-r*s+a)),d=h>0?-s:Math.min(Math.max(-s,-o),s),u=-h*h+d*(d+2*o)+l):d<=p?(h=0,d=Math.min(Math.max(-s,-o),s),u=d*(d+2*o)+l):(h=Math.max(0,-(r*s+a)),d=h>0?s:Math.min(Math.max(-s,-o),s),u=-h*h+d*(d+2*o)+l);else d=r>0?-s:s,h=Math.max(0,-(r*d+a)),u=-h*h+d*(d+2*o)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,h),n&&n.copy(We).addScaledVector(je,d),u}intersectSphere(t,e){Ve.subVectors(t.center,this.origin);const i=Ve.dot(this.direction),n=Ve.dot(Ve)-i*i,s=t.radius*t.radius;if(n>s)return null;const r=Math.sqrt(s-n),a=i-r,o=i+r;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,n,s,r,a,o;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(i=(t.min.x-d.x)*l,n=(t.max.x-d.x)*l):(i=(t.max.x-d.x)*l,n=(t.min.x-d.x)*l),c>=0?(s=(t.min.y-d.y)*c,r=(t.max.y-d.y)*c):(s=(t.max.y-d.y)*c,r=(t.min.y-d.y)*c),i>r||s>n?null:((s>i||isNaN(i))&&(i=s),(r<n||isNaN(n))&&(n=r),h>=0?(a=(t.min.z-d.z)*h,o=(t.max.z-d.z)*h):(a=(t.max.z-d.z)*h,o=(t.min.z-d.z)*h),i>o||a>n?null:((a>i||i!=i)&&(i=a),(o<n||n!=n)&&(n=o),n<0?null:this.at(i>=0?i:n,e)))}intersectsBox(t){return null!==this.intersectBox(t,Ve)}intersectTriangle(t,e,i,n,s){qe.subVectors(e,t),Ze.subVectors(i,t),Xe.crossVectors(qe,Ze);let r,a=this.direction.dot(Xe);if(a>0){if(n)return null;r=1}else{if(!(a<0))return null;r=-1,a=-a}Qe.subVectors(this.origin,t);const o=r*this.direction.dot(Ze.crossVectors(Qe,Ze));if(o<0)return null;const l=r*this.direction.dot(qe.cross(Qe));if(l<0)return null;if(o+l>a)return null;const c=-r*Qe.dot(Xe);return c<0?null:this.at(c/a,s)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Je{constructor(){Je.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(t,e,i,n,s,r,a,o,l,c,h,d,u,p,m,f){const g=this.elements;return g[0]=t,g[4]=e,g[8]=i,g[12]=n,g[1]=s,g[5]=r,g[9]=a,g[13]=o,g[2]=l,g[6]=c,g[10]=h,g[14]=d,g[3]=u,g[7]=p,g[11]=m,g[15]=f,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 Je).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,n=1/Ke.setFromMatrixColumn(t,0).length(),s=1/Ke.setFromMatrixColumn(t,1).length(),r=1/Ke.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*s,e[5]=i[5]*s,e[6]=i[6]*s,e[7]=0,e[8]=i[8]*r,e[9]=i[9]*r,e[10]=i[10]*r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,n=t.y,s=t.z,r=Math.cos(i),a=Math.sin(i),o=Math.cos(n),l=Math.sin(n),c=Math.cos(s),h=Math.sin(s);if("XYZ"===t.order){const t=r*c,i=r*h,n=a*c,s=a*h;e[0]=o*c,e[4]=-o*h,e[8]=l,e[1]=i+n*l,e[5]=t-s*l,e[9]=-a*o,e[2]=s-t*l,e[6]=n+i*l,e[10]=r*o}else if("YXZ"===t.order){const t=o*c,i=o*h,n=l*c,s=l*h;e[0]=t+s*a,e[4]=n*a-i,e[8]=r*l,e[1]=r*h,e[5]=r*c,e[9]=-a,e[2]=i*a-n,e[6]=s+t*a,e[10]=r*o}else if("ZXY"===t.order){const t=o*c,i=o*h,n=l*c,s=l*h;e[0]=t-s*a,e[4]=-r*h,e[8]=n+i*a,e[1]=i+n*a,e[5]=r*c,e[9]=s-t*a,e[2]=-r*l,e[6]=a,e[10]=r*o}else if("ZYX"===t.order){const t=r*c,i=r*h,n=a*c,s=a*h;e[0]=o*c,e[4]=n*l-i,e[8]=t*l+s,e[1]=o*h,e[5]=s*l+t,e[9]=i*l-n,e[2]=-l,e[6]=a*o,e[10]=r*o}else if("YZX"===t.order){const t=r*o,i=r*l,n=a*o,s=a*l;e[0]=o*c,e[4]=s-t*h,e[8]=n*h+i,e[1]=h,e[5]=r*c,e[9]=-a*c,e[2]=-l*c,e[6]=i*h+n,e[10]=t-s*h}else if("XZY"===t.order){const t=r*o,i=r*l,n=a*o,s=a*l;e[0]=o*c,e[4]=-h,e[8]=l*c,e[1]=t*h+s,e[5]=r*c,e[9]=i*h-n,e[2]=n*h-i,e[6]=a*c,e[10]=s*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(ti,t,ei)}lookAt(t,e,i){const n=this.elements;return si.subVectors(t,e),0===si.lengthSq()&&(si.z=1),si.normalize(),ii.crossVectors(i,si),0===ii.lengthSq()&&(1===Math.abs(i.z)?si.x+=1e-4:si.z+=1e-4,si.normalize(),ii.crossVectors(i,si)),ii.normalize(),ni.crossVectors(si,ii),n[0]=ii.x,n[4]=ni.x,n[8]=si.x,n[1]=ii.y,n[5]=ni.y,n[9]=si.y,n[2]=ii.z,n[6]=ni.z,n[10]=si.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,s=this.elements,r=i[0],a=i[4],o=i[8],l=i[12],c=i[1],h=i[5],d=i[9],u=i[13],p=i[2],m=i[6],f=i[10],g=i[14],v=i[3],_=i[7],y=i[11],x=i[15],A=n[0],w=n[4],b=n[8],M=n[12],S=n[1],E=n[5],C=n[9],T=n[13],L=n[2],k=n[6],I=n[10],P=n[14],R=n[3],B=n[7],D=n[11],U=n[15];return s[0]=r*A+a*S+o*L+l*R,s[4]=r*w+a*E+o*k+l*B,s[8]=r*b+a*C+o*I+l*D,s[12]=r*M+a*T+o*P+l*U,s[1]=c*A+h*S+d*L+u*R,s[5]=c*w+h*E+d*k+u*B,s[9]=c*b+h*C+d*I+u*D,s[13]=c*M+h*T+d*P+u*U,s[2]=p*A+m*S+f*L+g*R,s[6]=p*w+m*E+f*k+g*B,s[10]=p*b+m*C+f*I+g*D,s[14]=p*M+m*T+f*P+g*U,s[3]=v*A+_*S+y*L+x*R,s[7]=v*w+_*E+y*k+x*B,s[11]=v*b+_*C+y*I+x*D,s[15]=v*M+_*T+y*P+x*U,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],s=t[12],r=t[1],a=t[5],o=t[9],l=t[13],c=t[2],h=t[6],d=t[10],u=t[14];return t[3]*(+s*o*h-n*l*h-s*a*d+i*l*d+n*a*u-i*o*u)+t[7]*(+e*o*u-e*l*d+s*r*d-n*r*u+n*l*c-s*o*c)+t[11]*(+e*l*h-e*a*u-s*r*h+i*r*u+s*a*c-i*l*c)+t[15]*(-n*a*c-e*o*h+e*a*d+n*r*h-i*r*d+i*o*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],s=t[3],r=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=t[9],d=t[10],u=t[11],p=t[12],m=t[13],f=t[14],g=t[15],v=h*f*l-m*d*l+m*o*u-a*f*u-h*o*g+a*d*g,_=p*d*l-c*f*l-p*o*u+r*f*u+c*o*g-r*d*g,y=c*m*l-p*h*l+p*a*u-r*m*u-c*a*g+r*h*g,x=p*h*o-c*m*o-p*a*d+r*m*d+c*a*f-r*h*f,A=e*v+i*_+n*y+s*x;if(0===A)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/A;return t[0]=v*w,t[1]=(m*d*s-h*f*s-m*n*u+i*f*u+h*n*g-i*d*g)*w,t[2]=(a*f*s-m*o*s+m*n*l-i*f*l-a*n*g+i*o*g)*w,t[3]=(h*o*s-a*d*s-h*n*l+i*d*l+a*n*u-i*o*u)*w,t[4]=_*w,t[5]=(c*f*s-p*d*s+p*n*u-e*f*u-c*n*g+e*d*g)*w,t[6]=(p*o*s-r*f*s-p*n*l+e*f*l+r*n*g-e*o*g)*w,t[7]=(r*d*s-c*o*s+c*n*l-e*d*l-r*n*u+e*o*u)*w,t[8]=y*w,t[9]=(p*h*s-c*m*s-p*i*u+e*m*u+c*i*g-e*h*g)*w,t[10]=(r*m*s-p*a*s+p*i*l-e*m*l-r*i*g+e*a*g)*w,t[11]=(c*a*s-r*h*s-c*i*l+e*h*l+r*i*u-e*a*u)*w,t[12]=x*w,t[13]=(c*m*n-p*h*n+p*i*d-e*m*d-c*i*f+e*h*f)*w,t[14]=(p*a*n-r*m*n-p*i*o+e*m*o+r*i*f-e*a*f)*w,t[15]=(r*h*n-c*a*n+c*i*o-e*h*o-r*i*d+e*a*d)*w,this}scale(t){const e=this.elements,i=t.x,n=t.y,s=t.z;return e[0]*=i,e[4]*=n,e[8]*=s,e[1]*=i,e[5]*=n,e[9]*=s,e[2]*=i,e[6]*=n,e[10]*=s,e[3]*=i,e[7]*=n,e[11]*=s,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),s=1-i,r=t.x,a=t.y,o=t.z,l=s*r,c=s*a;return this.set(l*r+i,l*a-n*o,l*o+n*a,0,l*a+n*o,c*a+i,c*o-n*r,0,l*o-n*a,c*o+n*r,s*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,s,r){return this.set(1,i,s,0,t,1,r,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,s=e._x,r=e._y,a=e._z,o=e._w,l=s+s,c=r+r,h=a+a,d=s*l,u=s*c,p=s*h,m=r*c,f=r*h,g=a*h,v=o*l,_=o*c,y=o*h,x=i.x,A=i.y,w=i.z;return n[0]=(1-(m+g))*x,n[1]=(u+y)*x,n[2]=(p-_)*x,n[3]=0,n[4]=(u-y)*A,n[5]=(1-(d+g))*A,n[6]=(f+v)*A,n[7]=0,n[8]=(p+_)*w,n[9]=(f-v)*w,n[10]=(1-(d+m))*w,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;let s=Ke.set(n[0],n[1],n[2]).length();const r=Ke.set(n[4],n[5],n[6]).length(),a=Ke.set(n[8],n[9],n[10]).length();this.determinant()<0&&(s=-s),t.x=n[12],t.y=n[13],t.z=n[14],$e.copy(this);const o=1/s,l=1/r,c=1/a;return $e.elements[0]*=o,$e.elements[1]*=o,$e.elements[2]*=o,$e.elements[4]*=l,$e.elements[5]*=l,$e.elements[6]*=l,$e.elements[8]*=c,$e.elements[9]*=c,$e.elements[10]*=c,e.setFromRotationMatrix($e),i.x=s,i.y=r,i.z=a,this}makePerspective(t,e,i,n,s,r){const a=this.elements,o=2*s/(e-t),l=2*s/(i-n),c=(e+t)/(e-t),h=(i+n)/(i-n),d=-(r+s)/(r-s),u=-2*r*s/(r-s);return a[0]=o,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=l,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=u,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,i,n,s,r){const a=this.elements,o=1/(e-t),l=1/(i-n),c=1/(r-s),h=(e+t)*o,d=(i+n)*l,u=(r+s)*c;return a[0]=2*o,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-u,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}const Ke=new Ae,$e=new Je,ti=new Ae(0,0,0),ei=new Ae(1,1,1),ii=new Ae,ni=new Ae,si=new Ae,ri=new Je,ai=new xe;class oi{constructor(t=0,e=0,i=0,n=oi.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const n=t.elements,s=n[0],r=n[4],a=n[8],o=n[1],l=n[5],c=n[9],h=n[2],d=n[6],u=n[10];switch(e){case"XYZ":this._y=Math.asin(Gt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,u),this._z=Math.atan2(-r,s)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Gt(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,u),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(Gt(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,u),this._z=Math.atan2(-r,l)):(this._y=0,this._z=Math.atan2(o,s));break;case"ZYX":this._y=Math.asin(-Gt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,u),this._z=Math.atan2(o,s)):(this._x=0,this._z=Math.atan2(-r,l));break;case"YZX":this._z=Math.asin(Gt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,u));break;case"XZY":this._z=Math.asin(-Gt(r,-1,1)),Math.abs(r)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-c,u),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return ri.makeRotationFromQuaternion(t),this.setFromRotationMatrix(ri,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return ai.setFromEuler(this),this.setFromQuaternion(ai,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}oi.DEFAULT_ORDER="XYZ";class li{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return 0!=(this.mask&t.mask)}isEnabled(t){return 0!=(this.mask&(1<<t|0))}}let ci=0;const hi=new Ae,di=new xe,ui=new Je,pi=new Ae,mi=new Ae,fi=new Ae,gi=new xe,vi=new Ae(1,0,0),_i=new Ae(0,1,0),yi=new Ae(0,0,1),xi={type:"added"},Ai={type:"removed"};class wi extends Dt{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ci++}),this.uuid=Ft(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=wi.DEFAULT_UP.clone();const t=new Ae,e=new oi,i=new xe,n=new Ae(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new Je},normalMatrix:{value:new Jt}}),this.matrix=new Je,this.matrixWorld=new Je,this.matrixAutoUpdate=wi.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=wi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new li,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return di.setFromAxisAngle(t,e),this.quaternion.multiply(di),this}rotateOnWorldAxis(t,e){return di.setFromAxisAngle(t,e),this.quaternion.premultiply(di),this}rotateX(t){return this.rotateOnAxis(vi,t)}rotateY(t){return this.rotateOnAxis(_i,t)}rotateZ(t){return this.rotateOnAxis(yi,t)}translateOnAxis(t,e){return hi.copy(t).applyQuaternion(this.quaternion),this.position.add(hi.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(vi,t)}translateY(t){return this.translateOnAxis(_i,t)}translateZ(t){return this.translateOnAxis(yi,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(ui.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?pi.copy(t):pi.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),mi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?ui.lookAt(mi,pi,this.up):ui.lookAt(pi,mi,this.up),this.quaternion.setFromRotationMatrix(ui),n&&(ui.extractRotation(n.matrixWorld),di.setFromRotationMatrix(ui),this.quaternion.premultiply(di.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(null!==t.parent&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(xi)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Ai)),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){for(let t=0;t<this.children.length;t++){const e=this.children[t];e.parent=null,e.dispatchEvent(Ai)}return this.children.length=0,this}attach(t){return this.updateWorldMatrix(!0,!1),ui.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),ui.multiply(t.parent.matrixWorld)),t.applyMatrix4(ui),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}}getObjectsByProperty(t,e){let i=[];this[t]===e&&i.push(this);for(let n=0,s=this.children.length;n<s;n++){const s=this.children[n].getObjectsByProperty(t,e);s.length>0&&(i=i.concat(s))}return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mi,t,fi),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mi,gi,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++){const n=e[i];!0!==n.matrixWorldAutoUpdate&&!0!==t||n.updateMatrixWorld(t)}}updateWorldMatrix(t,e){const i=this.parent;if(!0===t&&null!==i&&!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++){const i=t[e];!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!1,!0)}}}toJSON(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const n={};function s(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=s(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++){const n=i[e];s(t.shapes,n)}else s(t.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(s(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,n=this.material.length;i<n;i++)e.push(s(t.materials,this.material[i]));n.material=e}else n.material=s(t.materials,this.material);if(this.children.length>0){n.children=[];for(let e=0;e<this.children.length;e++)n.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];n.animations.push(s(t.animations,i))}}if(e){const e=r(t.geometries),n=r(t.materials),s=r(t.textures),a=r(t.images),o=r(t.shapes),l=r(t.skeletons),c=r(t.animations),h=r(t.nodes);e.length>0&&(i.geometries=e),n.length>0&&(i.materials=n),s.length>0&&(i.textures=s),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),l.length>0&&(i.skeletons=l),c.length>0&&(i.animations=c),h.length>0&&(i.nodes=h)}return i.object=n,i;function r(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const i=t.children[e];this.add(i.clone())}return this}}wi.DEFAULT_UP=new Ae(0,1,0),wi.DEFAULT_MATRIX_AUTO_UPDATE=!0,wi.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const bi=new Ae,Mi=new Ae,Si=new Ae,Ei=new Ae,Ci=new Ae,Ti=new Ae,Li=new Ae,ki=new Ae,Ii=new Ae,Pi=new Ae;let Ri=!1;class Bi{constructor(t=new Ae,e=new Ae,i=new Ae){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,n){n.subVectors(i,e),bi.subVectors(t,e),n.cross(bi);const s=n.lengthSq();return s>0?n.multiplyScalar(1/Math.sqrt(s)):n.set(0,0,0)}static getBarycoord(t,e,i,n,s){bi.subVectors(n,e),Mi.subVectors(i,e),Si.subVectors(t,e);const r=bi.dot(bi),a=bi.dot(Mi),o=bi.dot(Si),l=Mi.dot(Mi),c=Mi.dot(Si),h=r*l-a*a;if(0===h)return s.set(-2,-1,-1);const d=1/h,u=(l*o-a*c)*d,p=(r*c-a*o)*d;return s.set(1-u-p,p,u)}static containsPoint(t,e,i,n){return this.getBarycoord(t,e,i,n,Ei),Ei.x>=0&&Ei.y>=0&&Ei.x+Ei.y<=1}static getUV(t,e,i,n,s,r,a,o){return!1===Ri&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Ri=!0),this.getInterpolation(t,e,i,n,s,r,a,o)}static getInterpolation(t,e,i,n,s,r,a,o){return this.getBarycoord(t,e,i,n,Ei),o.setScalar(0),o.addScaledVector(s,Ei.x),o.addScaledVector(r,Ei.y),o.addScaledVector(a,Ei.z),o}static isFrontFacing(t,e,i,n){return bi.subVectors(i,e),Mi.subVectors(t,e),bi.cross(Mi).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}setFromAttributeAndIndices(t,e,i,n){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return bi.subVectors(this.c,this.b),Mi.subVectors(this.a,this.b),.5*bi.cross(Mi).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Bi.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Bi.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,i,n,s){return!1===Ri&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Ri=!0),Bi.getInterpolation(t,this.a,this.b,this.c,e,i,n,s)}getInterpolation(t,e,i,n,s){return Bi.getInterpolation(t,this.a,this.b,this.c,e,i,n,s)}containsPoint(t){return Bi.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Bi.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,n=this.b,s=this.c;let r,a;Ci.subVectors(n,i),Ti.subVectors(s,i),ki.subVectors(t,i);const o=Ci.dot(ki),l=Ti.dot(ki);if(o<=0&&l<=0)return e.copy(i);Ii.subVectors(t,n);const c=Ci.dot(Ii),h=Ti.dot(Ii);if(c>=0&&h<=c)return e.copy(n);const d=o*h-c*l;if(d<=0&&o>=0&&c<=0)return r=o/(o-c),e.copy(i).addScaledVector(Ci,r);Pi.subVectors(t,s);const u=Ci.dot(Pi),p=Ti.dot(Pi);if(p>=0&&u<=p)return e.copy(s);const m=u*l-o*p;if(m<=0&&l>=0&&p<=0)return a=l/(l-p),e.copy(i).addScaledVector(Ti,a);const f=c*p-u*h;if(f<=0&&h-c>=0&&u-p>=0)return Li.subVectors(s,n),a=(h-c)/(h-c+(u-p)),e.copy(n).addScaledVector(Li,a);const g=1/(f+m+d);return r=m*g,a=d*g,e.copy(i).addScaledVector(Ci,r).addScaledVector(Ti,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}let Di=0;class Ui extends Dt{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Di++}),this.uuid=Ft(),this.name="",this.type="Material",this.blending=1,this.side=a,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=l,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=It,this.stencilZFail=It,this.stencilZPass=It,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.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i:console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function n(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),this.side!==a&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaToCoverage&&(i.alphaToCoverage=this.alphaToCoverage),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=this.premultipliedAlpha),!0===this.forceSinglePass&&(i.forceSinglePass=this.forceSinglePass),!0===this.wireframe&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=this.flatShading),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),e){const e=n(t.textures),s=n(t.images);e.length>0&&(i.textures=e),s.length>0&&(i.images=s)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let n=0;n!==t;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}const Ni={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},Oi={h:0,s:0,l:0},zi={h:0,s:0,l:0};function Fi(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}class Gi{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,void 0===e&&void 0===i?this.set(t):this.setRGB(t,e,i)}set(t){return t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t),this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Tt){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,ce.toWorkingColorSpace(this,e),this}setRGB(t,e,i,n=ce.workingColorSpace){return this.r=t,this.g=e,this.b=i,ce.toWorkingColorSpace(this,n),this}setHSL(t,e,i,n=ce.workingColorSpace){if(t=Ht(t,1),e=Gt(e,0,1),i=Gt(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,s=2*i-n;this.r=Fi(s,n,t+1/3),this.g=Fi(s,n,t),this.b=Fi(s,n,t-1/3)}return ce.toWorkingColorSpace(this,n),this}setStyle(t,e=Tt){function i(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(t)){let s;const r=n[1],a=n[2];switch(r){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,ce.toWorkingColorSpace(this,e),i(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,ce.toWorkingColorSpace(this,e),i(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){const t=parseFloat(s[1])/360,n=parseFloat(s[2])/100,r=parseFloat(s[3])/100;return i(s[4]),this.setHSL(t,n,r,e)}break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const i=n[1],s=i.length;if(3===s)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,e);if(6===s)return this.setHex(parseInt(i,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Tt){const i=Ni[t.toLowerCase()];return void 0!==i?this.setHex(i,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=ne(t.r),this.g=ne(t.g),this.b=ne(t.b),this}copyLinearToSRGB(t){return this.r=se(t.r),this.g=se(t.g),this.b=se(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Tt){return ce.fromWorkingColorSpace(Hi.copy(this),t),Gt(255*Hi.r,0,255)<<16^Gt(255*Hi.g,0,255)<<8^Gt(255*Hi.b,0,255)<<0}getHexString(t=Tt){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=ce.workingColorSpace){ce.fromWorkingColorSpace(Hi.copy(this),e);const i=Hi.r,n=Hi.g,s=Hi.b,r=Math.max(i,n,s),a=Math.min(i,n,s);let o,l;const c=(a+r)/2;if(a===r)o=0,l=0;else{const t=r-a;switch(l=c<=.5?t/(r+a):t/(2-r-a),r){case i:o=(n-s)/t+(n<s?6:0);break;case n:o=(s-i)/t+2;break;case s:o=(i-n)/t+4}o/=6}return t.h=o,t.s=l,t.l=c,t}getRGB(t,e=ce.workingColorSpace){return ce.fromWorkingColorSpace(Hi.copy(this),e),t.r=Hi.r,t.g=Hi.g,t.b=Hi.b,t}getStyle(t=Tt){ce.fromWorkingColorSpace(Hi.copy(this),t);const e=Hi.r,i=Hi.g,n=Hi.b;return t!==Tt?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${255*e|0},${255*i|0},${255*n|0})`}offsetHSL(t,e,i){return this.getHSL(Oi),Oi.h+=t,Oi.s+=e,Oi.l+=i,this.setHSL(Oi.h,Oi.s,Oi.l),this}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(Oi),t.getHSL(zi);const i=Vt(Oi.h,zi.h,e),n=Vt(Oi.s,zi.s,e),s=Vt(Oi.l,zi.l,e);return this.setHSL(i,n,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,i=this.g,n=this.b,s=t.elements;return this.r=s[0]*e+s[3]*i+s[6]*n,this.g=s[1]*e+s[4]*i+s[7]*n,this.b=s[2]*e+s[5]*i+s[8]*n,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Hi=new Gi;Gi.NAMES=Ni;class Vi extends Ui{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Gi(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.combine=c,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const Wi=ji();function ji(){const t=new ArrayBuffer(4),e=new Float32Array(t),i=new Uint32Array(t),n=new Uint32Array(512),s=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(n[t]=0,n[256|t]=32768,s[t]=24,s[256|t]=24):e<-14?(n[t]=1024>>-e-14,n[256|t]=1024>>-e-14|32768,s[t]=-e-1,s[256|t]=-e-1):e<=15?(n[t]=e+15<<10,n[256|t]=e+15<<10|32768,s[t]=13,s[256|t]=13):e<128?(n[t]=31744,n[256|t]=64512,s[t]=24,s[256|t]=24):(n[t]=31744,n[256|t]=64512,s[t]=13,s[256|t]=13)}const r=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,i=0;for(;0==(8388608&e);)e<<=1,i-=8388608;e&=-8388609,i+=947912704,r[t]=e|i}for(let t=1024;t<2048;++t)r[t]=939524096+(t-1024<<13);for(let t=1;t<31;++t)a[t]=t<<23;a[31]=1199570944,a[32]=2147483648;for(let t=33;t<63;++t)a[t]=2147483648+(t-32<<23);a[63]=3347054592;for(let t=1;t<64;++t)32!==t&&(o[t]=1024);return{floatView:e,uint32View:i,baseTable:n,shiftTable:s,mantissaTable:r,exponentTable:a,offsetTable:o}}function Qi(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=Gt(t,-65504,65504),Wi.floatView[0]=t;const e=Wi.uint32View[0],i=e>>23&511;return Wi.baseTable[i]+((8388607&e)>>Wi.shiftTable[i])}function qi(t){const e=t>>10;return Wi.uint32View[0]=Wi.mantissaTable[Wi.offsetTable[e]+(1023&t)]+Wi.exponentTable[e],Wi.floatView[0]}const Zi={toHalfFloat:Qi,fromHalfFloat:qi},Xi=new Ae,Yi=new Yt;class Ji{constructor(t,e,i=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=Pt,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,s=this.itemSize;n<s;n++)this.array[t+n]=e.array[i+n];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)Yi.fromBufferAttribute(this,e),Yi.applyMatrix3(t),this.setXY(e,Yi.x,Yi.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)Xi.fromBufferAttribute(this,e),Xi.applyMatrix3(t),this.setXYZ(e,Xi.x,Xi.y,Xi.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)Xi.fromBufferAttribute(this,e),Xi.applyMatrix4(t),this.setXYZ(e,Xi.x,Xi.y,Xi.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Xi.fromBufferAttribute(this,e),Xi.applyNormalMatrix(t),this.setXYZ(e,Xi.x,Xi.y,Xi.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Xi.fromBufferAttribute(this,e),Xi.transformDirection(t),this.setXYZ(e,Xi.x,Xi.y,Xi.z);return this}set(t,e=0){return this.array.set(t,e),this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=qt(e,this.array)),e}setX(t,e){return this.normalized&&(e=Zt(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=qt(e,this.array)),e}setY(t,e){return this.normalized&&(e=Zt(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=qt(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Zt(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=qt(e,this.array)),e}setW(t,e){return this.normalized&&(e=Zt(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=Zt(e,this.array),i=Zt(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=Zt(e,this.array),i=Zt(i,this.array),n=Zt(n,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this}setXYZW(t,e,i,n,s){return t*=this.itemSize,this.normalized&&(e=Zt(e,this.array),i=Zt(i,this.array),n=Zt(n,this.array),s=Zt(s,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==Pt&&(t.usage=this.usage),0===this.updateRange.offset&&-1===this.updateRange.count||(t.updateRange=this.updateRange),t}copyColorsArray(){console.error("THREE.BufferAttribute: copyColorsArray() was removed in r144.")}copyVector2sArray(){console.error("THREE.BufferAttribute: copyVector2sArray() was removed in r144.")}copyVector3sArray(){console.error("THREE.BufferAttribute: copyVector3sArray() was removed in r144.")}copyVector4sArray(){console.error("THREE.BufferAttribute: copyVector4sArray() was removed in r144.")}}class Ki extends Ji{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class $i extends Ji{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class tn extends Ji{constructor(t,e,i){super(new Float32Array(t),e,i)}}let en=0;const nn=new Je,sn=new wi,rn=new Ae,an=new Me,on=new Me,ln=new Ae;class cn extends Dt{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:en++}),this.uuid=Ft(),this.name="",this.type="BufferGeometry",this.index=null,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(t){return Array.isArray(t)?this.index=new($t(t)?$i:Ki)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new Jt).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return nn.makeRotationFromQuaternion(t),this.applyMatrix4(nn),this}rotateX(t){return nn.makeRotationX(t),this.applyMatrix4(nn),this}rotateY(t){return nn.makeRotationY(t),this.applyMatrix4(nn),this}rotateZ(t){return nn.makeRotationZ(t),this.applyMatrix4(nn),this}translate(t,e,i){return nn.makeTranslation(t,e,i),this.applyMatrix4(nn),this}scale(t,e,i){return nn.makeScale(t,e,i),this.applyMatrix4(nn),this}lookAt(t){return sn.lookAt(t),sn.updateMatrix(),this.applyMatrix4(sn.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(rn).negate(),this.translate(rn.x,rn.y,rn.z),this}setFromPoints(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new tn(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Me);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingBox.set(new Ae(-1/0,-1/0,-1/0),new Ae(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];an.setFromBufferAttribute(i),this.morphTargetsRelative?(ln.addVectors(this.boundingBox.min,an.min),this.boundingBox.expandByPoint(ln),ln.addVectors(this.boundingBox.max,an.max),this.boundingBox.expandByPoint(ln)):(this.boundingBox.expandByPoint(an.min),this.boundingBox.expandByPoint(an.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new He);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),void this.boundingSphere.set(new Ae,1/0);if(t){const i=this.boundingSphere.center;if(an.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];on.setFromBufferAttribute(i),this.morphTargetsRelative?(ln.addVectors(an.min,on.min),an.expandByPoint(ln),ln.addVectors(an.max,on.max),an.expandByPoint(ln)):(an.expandByPoint(on.min),an.expandByPoint(on.max))}an.getCenter(i);let n=0;for(let e=0,s=t.count;e<s;e++)ln.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(ln));if(e)for(let s=0,r=e.length;s<r;s++){const r=e[s],a=this.morphTargetsRelative;for(let e=0,s=r.count;e<s;e++)ln.fromBufferAttribute(r,e),a&&(rn.fromBufferAttribute(t,e),ln.add(rn)),n=Math.max(n,i.distanceToSquared(ln))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const i=t.array,n=e.position.array,s=e.normal.array,r=e.uv.array,a=n.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new Ji(new Float32Array(4*a),4));const o=this.getAttribute("tangent").array,l=[],c=[];for(let t=0;t<a;t++)l[t]=new Ae,c[t]=new Ae;const h=new Ae,d=new Ae,u=new Ae,p=new Yt,m=new Yt,f=new Yt,g=new Ae,v=new Ae;function _(t,e,i){h.fromArray(n,3*t),d.fromArray(n,3*e),u.fromArray(n,3*i),p.fromArray(r,2*t),m.fromArray(r,2*e),f.fromArray(r,2*i),d.sub(h),u.sub(h),m.sub(p),f.sub(p);const s=1/(m.x*f.y-f.x*m.y);isFinite(s)&&(g.copy(d).multiplyScalar(f.y).addScaledVector(u,-m.y).multiplyScalar(s),v.copy(u).multiplyScalar(m.x).addScaledVector(d,-f.x).multiplyScalar(s),l[t].add(g),l[e].add(g),l[i].add(g),c[t].add(v),c[e].add(v),c[i].add(v))}let y=this.groups;0===y.length&&(y=[{start:0,count:i.length}]);for(let t=0,e=y.length;t<e;++t){const e=y[t],n=e.start;for(let t=n,s=n+e.count;t<s;t+=3)_(i[t+0],i[t+1],i[t+2])}const x=new Ae,A=new Ae,w=new Ae,b=new Ae;function M(t){w.fromArray(s,3*t),b.copy(w);const e=l[t];x.copy(e),x.sub(w.multiplyScalar(w.dot(e))).normalize(),A.crossVectors(b,e);const i=A.dot(c[t])<0?-1:1;o[4*t]=x.x,o[4*t+1]=x.y,o[4*t+2]=x.z,o[4*t+3]=i}for(let t=0,e=y.length;t<e;++t){const e=y[t],n=e.start;for(let t=n,s=n+e.count;t<s;t+=3)M(i[t+0]),M(i[t+1]),M(i[t+2])}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new Ji(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const n=new Ae,s=new Ae,r=new Ae,a=new Ae,o=new Ae,l=new Ae,c=new Ae,h=new Ae;if(t)for(let d=0,u=t.count;d<u;d+=3){const u=t.getX(d+0),p=t.getX(d+1),m=t.getX(d+2);n.fromBufferAttribute(e,u),s.fromBufferAttribute(e,p),r.fromBufferAttribute(e,m),c.subVectors(r,s),h.subVectors(n,s),c.cross(h),a.fromBufferAttribute(i,u),o.fromBufferAttribute(i,p),l.fromBufferAttribute(i,m),a.add(c),o.add(c),l.add(c),i.setXYZ(u,a.x,a.y,a.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(m,l.x,l.y,l.z)}else for(let t=0,a=e.count;t<a;t+=3)n.fromBufferAttribute(e,t+0),s.fromBufferAttribute(e,t+1),r.fromBufferAttribute(e,t+2),c.subVectors(r,s),h.subVectors(n,s),c.cross(h),i.setXYZ(t+0,c.x,c.y,c.z),i.setXYZ(t+1,c.x,c.y,c.z),i.setXYZ(t+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}merge(){return console.error("THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeGeometries() instead."),this}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)ln.fromBufferAttribute(t,e),ln.normalize(),t.setXYZ(e,ln.x,ln.y,ln.z)}toNonIndexed(){function t(t,e){const i=t.array,n=t.itemSize,s=t.normalized,r=new i.constructor(e.length*n);let a=0,o=0;for(let s=0,l=e.length;s<l;s++){a=t.isInterleavedBufferAttribute?e[s]*t.data.stride+t.offset:e[s]*n;for(let t=0;t<n;t++)r[o++]=i[a++]}return new Ji(r,n,s)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new cn,i=this.index.array,n=this.attributes;for(const s in n){const r=t(n[s],i);e.setAttribute(s,r)}const s=this.morphAttributes;for(const n in s){const r=[],a=s[n];for(let e=0,n=a.length;e<n;e++){const n=t(a[e],i);r.push(n)}e.morphAttributes[n]=r}e.morphTargetsRelative=this.morphTargetsRelative;const r=this.groups;for(let t=0,i=r.length;t<i;t++){const i=r[t];e.addGroup(i.start,i.count,i.materialIndex)}return e}toJSON(){const t={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const n=i[e];t.data.attributes[e]=n.toJSON(t.data)}const n={};let s=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],r=[];for(let e=0,n=i.length;e<n;e++){const n=i[e];r.push(n.toJSON(t.data))}r.length>0&&(n[e]=r,s=!0)}s&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const r=this.groups;r.length>0&&(t.data.groups=JSON.parse(JSON.stringify(r)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone(e));const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const s=t.morphAttributes;for(const t in s){const i=[],n=s[t];for(let t=0,s=n.length;t<s;t++)i.push(n[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;const r=t.groups;for(let t=0,e=r.length;t<e;t++){const e=r[t];this.addGroup(e.start,e.count,e.materialIndex)}const a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const hn=new Je,dn=new Ye,un=new He,pn=new Ae,mn=new Ae,fn=new Ae,gn=new Ae,vn=new Ae,_n=new Ae,yn=new Yt,xn=new Yt,An=new Yt,wn=new Ae,bn=new Ae,Mn=new Ae,Sn=new Ae,En=new Ae;class Cn extends wi{constructor(t=new cn,e=new Vi){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){const e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}getVertexPosition(t,e){const i=this.geometry,n=i.attributes.position,s=i.morphAttributes.position,r=i.morphTargetsRelative;e.fromBufferAttribute(n,t);const a=this.morphTargetInfluences;if(s&&a){_n.set(0,0,0);for(let i=0,n=s.length;i<n;i++){const n=a[i],o=s[i];0!==n&&(vn.fromBufferAttribute(o,t),r?_n.addScaledVector(vn,n):_n.addScaledVector(vn.sub(e),n))}e.add(_n)}return this.isSkinnedMesh&&this.applyBoneTransform(t,e),e}raycast(t,e){const i=this.geometry,n=this.material,s=this.matrixWorld;if(void 0===n)return;if(null===i.boundingSphere&&i.computeBoundingSphere(),un.copy(i.boundingSphere),un.applyMatrix4(s),dn.copy(t.ray).recast(t.near),!1===un.containsPoint(dn.origin)){if(null===dn.intersectSphere(un,pn))return;if(dn.origin.distanceToSquared(pn)>(t.far-t.near)**2)return}if(hn.copy(s).invert(),dn.copy(t.ray).applyMatrix4(hn),null!==i.boundingBox&&!1===dn.intersectsBox(i.boundingBox))return;let r;const a=i.index,o=i.attributes.position,l=i.attributes.uv,c=i.attributes.uv2,h=i.attributes.normal,d=i.groups,u=i.drawRange;if(null!==a)if(Array.isArray(n))for(let i=0,s=d.length;i<s;i++){const s=d[i],o=n[s.materialIndex];for(let i=Math.max(s.start,u.start),n=Math.min(a.count,Math.min(s.start+s.count,u.start+u.count));i<n;i+=3){const n=a.getX(i),d=a.getX(i+1),u=a.getX(i+2);r=Tn(this,o,t,dn,l,c,h,n,d,u),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=s.materialIndex,e.push(r))}}else{for(let i=Math.max(0,u.start),s=Math.min(a.count,u.start+u.count);i<s;i+=3){const s=a.getX(i),o=a.getX(i+1),d=a.getX(i+2);r=Tn(this,n,t,dn,l,c,h,s,o,d),r&&(r.faceIndex=Math.floor(i/3),e.push(r))}}else if(void 0!==o)if(Array.isArray(n))for(let i=0,s=d.length;i<s;i++){const s=d[i],a=n[s.materialIndex];for(let i=Math.max(s.start,u.start),n=Math.min(o.count,Math.min(s.start+s.count,u.start+u.count));i<n;i+=3){r=Tn(this,a,t,dn,l,c,h,i,i+1,i+2),r&&(r.faceIndex=Math.floor(i/3),r.face.materialIndex=s.materialIndex,e.push(r))}}else{for(let i=Math.max(0,u.start),s=Math.min(o.count,u.start+u.count);i<s;i+=3){r=Tn(this,n,t,dn,l,c,h,i,i+1,i+2),r&&(r.faceIndex=Math.floor(i/3),e.push(r))}}}}function Tn(t,e,i,n,s,r,l,c,h,d){t.getVertexPosition(c,mn),t.getVertexPosition(h,fn),t.getVertexPosition(d,gn);const u=function(t,e,i,n,s,r,l,c){let h;if(h=e.side===o?n.intersectTriangle(l,r,s,!0,c):n.intersectTriangle(s,r,l,e.side===a,c),null===h)return null;En.copy(c),En.applyMatrix4(t.matrixWorld);const d=i.ray.origin.distanceTo(En);return d<i.near||d>i.far?null:{distance:d,point:En.clone(),object:t}}(t,e,i,n,mn,fn,gn,Sn);if(u){s&&(yn.fromBufferAttribute(s,c),xn.fromBufferAttribute(s,h),An.fromBufferAttribute(s,d),u.uv=Bi.getInterpolation(Sn,mn,fn,gn,yn,xn,An,new Yt)),r&&(yn.fromBufferAttribute(r,c),xn.fromBufferAttribute(r,h),An.fromBufferAttribute(r,d),u.uv2=Bi.getInterpolation(Sn,mn,fn,gn,yn,xn,An,new Yt)),l&&(wn.fromBufferAttribute(l,c),bn.fromBufferAttribute(l,h),Mn.fromBufferAttribute(l,d),u.normal=Bi.getInterpolation(Sn,mn,fn,gn,wn,bn,Mn,new Ae),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const t={a:c,b:h,c:d,normal:new Ae,materialIndex:0};Bi.getNormal(mn,fn,gn,t.normal),u.face=t}return u}class Ln extends cn{constructor(t=1,e=1,i=1,n=1,s=1,r=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:s,depthSegments:r};const a=this;n=Math.floor(n),s=Math.floor(s),r=Math.floor(r);const o=[],l=[],c=[],h=[];let d=0,u=0;function p(t,e,i,n,s,r,p,m,f,g,v){const _=r/f,y=p/g,x=r/2,A=p/2,w=m/2,b=f+1,M=g+1;let S=0,E=0;const C=new Ae;for(let r=0;r<M;r++){const a=r*y-A;for(let o=0;o<b;o++){const d=o*_-x;C[t]=d*n,C[e]=a*s,C[i]=w,l.push(C.x,C.y,C.z),C[t]=0,C[e]=0,C[i]=m>0?1:-1,c.push(C.x,C.y,C.z),h.push(o/f),h.push(1-r/g),S+=1}}for(let t=0;t<g;t++)for(let e=0;e<f;e++){const i=d+e+b*t,n=d+e+b*(t+1),s=d+(e+1)+b*(t+1),r=d+(e+1)+b*t;o.push(i,n,r),o.push(n,s,r),E+=6}a.addGroup(u,E,v),u+=E,d+=S}p("z","y","x",-1,-1,i,e,t,r,s,0),p("z","y","x",1,-1,i,e,-t,r,s,1),p("x","z","y",1,1,t,i,e,n,r,2),p("x","z","y",1,-1,t,i,-e,n,r,3),p("x","y","z",1,-1,t,e,i,n,s,4),p("x","y","z",-1,-1,t,e,-i,n,s,5),this.setIndex(o),this.setAttribute("position",new tn(l,3)),this.setAttribute("normal",new tn(c,3)),this.setAttribute("uv",new tn(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Ln(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function kn(t){const e={};for(const i in t){e[i]={};for(const n in t[i]){const s=t[i][n];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[i][n]=null):e[i][n]=s.clone():Array.isArray(s)?e[i][n]=s.slice():e[i][n]=s}}return e}function In(t){const e={};for(let i=0;i<t.length;i++){const n=kn(t[i]);for(const t in n)e[t]=n[t]}return e}function Pn(t){return null===t.getRenderTarget()&&t.outputEncoding===Ct?Tt:Lt}const Rn={clone:kn,merge:In};class Bn extends Ui{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=kn(t.uniforms),this.uniformsGroups=function(t){const e=[];for(let i=0;i<t.length;i++)e.push(t[i].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const n=this.uniforms[i].value;n&&n.isTexture?e.uniforms[i]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?e.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[i]={type:"m4",value:n.toArray()}:e.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader;const i={};for(const t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}class Dn extends wi{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Je,this.projectionMatrix=new Je,this.projectionMatrixInverse=new Je}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(-e[8],-e[9],-e[10]).normalize()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}class Un extends Dn{constructor(t=50,e=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*zt*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*Ot*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*zt*Math.atan(Math.tan(.5*Ot*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,i,n,s,r){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=s,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*Ot*this.fov)/this.zoom,i=2*e,n=this.aspect*i,s=-.5*n;const r=this.view;if(null!==this.view&&this.view.enabled){const t=r.fullWidth,a=r.fullHeight;s+=r.offsetX*n/t,e-=r.offsetY*i/a,n*=r.width/t,i*=r.height/a}const a=this.filmOffset;0!==a&&(s+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+n,e,e-i,t,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const Nn=-90;class On extends wi{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i;const n=new Un(Nn,1,t,e);n.layers=this.layers,n.up.set(0,1,0),n.lookAt(1,0,0),this.add(n);const s=new Un(Nn,1,t,e);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(-1,0,0),this.add(s);const r=new Un(Nn,1,t,e);r.layers=this.layers,r.up.set(0,0,-1),r.lookAt(0,1,0),this.add(r);const a=new Un(Nn,1,t,e);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const o=new Un(Nn,1,t,e);o.layers=this.layers,o.up.set(0,1,0),o.lookAt(0,0,1),this.add(o);const l=new Un(Nn,1,t,e);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,-1),this.add(l)}update(t,e){null===this.parent&&this.updateMatrixWorld();const i=this.renderTarget,[n,s,r,a,o,l]=this.children,c=t.getRenderTarget(),h=t.toneMapping,d=t.xr.enabled;t.toneMapping=u,t.xr.enabled=!1;const p=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0),t.render(e,n),t.setRenderTarget(i,1),t.render(e,s),t.setRenderTarget(i,2),t.render(e,r),t.setRenderTarget(i,3),t.render(e,a),t.setRenderTarget(i,4),t.render(e,o),i.texture.generateMipmaps=p,t.setRenderTarget(i,5),t.render(e,l),t.setRenderTarget(c),t.toneMapping=h,t.xr.enabled=d,i.texture.needsPMREMUpdate=!0}}class zn extends fe{constructor(t,e,i,n,s,r,a,o,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:y,i,n,s,r,a,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class Fn extends ve{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const i={width:t,height:t,depth:1},n=[i,i,i,i,i,i];this.texture=new zn(n,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:k}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.encoding=e.encoding,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},n=new Ln(5,5,5),s=new Bn({name:"CubemapFromEquirect",uniforms:kn(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:o,blending:0});s.uniforms.tEquirect.value=e;const r=new Cn(n,s),a=e.minFilter;e.minFilter===P&&(e.minFilter=k);return new On(1,10,this).update(t,r),e.minFilter=a,r.geometry.dispose(),r.material.dispose(),this}clear(t,e,i,n){const s=t.getRenderTarget();for(let s=0;s<6;s++)t.setRenderTarget(this,s),t.clear(e,i,n);t.setRenderTarget(s)}}const Gn=new Ae,Hn=new Ae,Vn=new Jt;class Wn{constructor(t=new Ae(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const n=Gn.subVectors(i,e).cross(Hn.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const i=t.delta(Gn),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const s=-(t.start.dot(this.normal)+this.constant)/n;return s<0||s>1?null:e.copy(t.start).addScaledVector(i,s)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||Vn.getNormalMatrix(t),n=this.coplanarPoint(Gn).applyMatrix4(t),s=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(s),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const jn=new He,Qn=new Ae;class qn{constructor(t=new Wn,e=new Wn,i=new Wn,n=new Wn,s=new Wn,r=new Wn){this.planes=[t,e,i,n,s,r]}set(t,e,i,n,s,r){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(n),a[4].copy(s),a[5].copy(r),this}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t){const e=this.planes,i=t.elements,n=i[0],s=i[1],r=i[2],a=i[3],o=i[4],l=i[5],c=i[6],h=i[7],d=i[8],u=i[9],p=i[10],m=i[11],f=i[12],g=i[13],v=i[14],_=i[15];return e[0].setComponents(a-n,h-o,m-d,_-f).normalize(),e[1].setComponents(a+n,h+o,m+d,_+f).normalize(),e[2].setComponents(a+s,h+l,m+u,_+g).normalize(),e[3].setComponents(a-s,h-l,m-u,_-g).normalize(),e[4].setComponents(a-r,h-c,m-p,_-v).normalize(),e[5].setComponents(a+r,h+c,m+p,_+v).normalize(),this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),jn.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),jn.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(jn)}intersectsSprite(t){return jn.center.set(0,0,0),jn.radius=.7071067811865476,jn.applyMatrix4(t.matrixWorld),this.intersectsSphere(jn)}intersectsSphere(t){const e=this.planes,i=t.center,n=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(i)<n)return!1}return!0}intersectsBox(t){const e=this.planes;for(let i=0;i<6;i++){const n=e[i];if(Qn.x=n.normal.x>0?t.max.x:t.min.x,Qn.y=n.normal.y>0?t.max.y:t.min.y,Qn.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(Qn)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function Zn(){let t=null,e=!1,i=null,n=null;function s(e,r){i(e,r),n=t.requestAnimationFrame(s)}return{start:function(){!0!==e&&null!==i&&(n=t.requestAnimationFrame(s),e=!0)},stop:function(){t.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function Xn(t,e){const i=e.isWebGL2,n=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),n.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const i=n.get(e);i&&(t.deleteBuffer(i.buffer),n.delete(e))},update:function(e,s){if(e.isGLBufferAttribute){const t=n.get(e);return void((!t||t.version<e.version)&&n.set(e,{buffer:e.buffer,type:e.type,bytesPerElement:e.elementSize,version:e.version}))}e.isInterleavedBufferAttribute&&(e=e.data);const r=n.get(e);void 0===r?n.set(e,function(e,n){const s=e.array,r=e.usage,a=t.createBuffer();let o;if(t.bindBuffer(n,a),t.bufferData(n,s,r),e.onUploadCallback(),s instanceof Float32Array)o=5126;else if(s instanceof Uint16Array)if(e.isFloat16BufferAttribute){if(!i)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");o=5131}else o=5123;else if(s instanceof Int16Array)o=5122;else if(s instanceof Uint32Array)o=5125;else if(s instanceof Int32Array)o=5124;else if(s instanceof Int8Array)o=5120;else if(s instanceof Uint8Array)o=5121;else{if(!(s instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+s);o=5121}return{buffer:a,type:o,bytesPerElement:s.BYTES_PER_ELEMENT,version:e.version}}(e,s)):r.version<e.version&&(!function(e,n,s){const r=n.array,a=n.updateRange;t.bindBuffer(s,e),-1===a.count?t.bufferSubData(s,0,r):(i?t.bufferSubData(s,a.offset*r.BYTES_PER_ELEMENT,r,a.offset,a.count):t.bufferSubData(s,a.offset*r.BYTES_PER_ELEMENT,r.subarray(a.offset,a.offset+a.count)),a.count=-1),n.onUploadCallback()}(r.buffer,e,s),r.version=e.version)}}}class Yn extends cn{constructor(t=1,e=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};const s=t/2,r=e/2,a=Math.floor(i),o=Math.floor(n),l=a+1,c=o+1,h=t/a,d=e/o,u=[],p=[],m=[],f=[];for(let t=0;t<c;t++){const e=t*d-r;for(let i=0;i<l;i++){const n=i*h-s;p.push(n,-e,0),m.push(0,0,1),f.push(i/a),f.push(1-t/o)}}for(let t=0;t<o;t++)for(let e=0;e<a;e++){const i=e+l*t,n=e+l*(t+1),s=e+1+l*(t+1),r=e+1+l*t;u.push(i,n,r),u.push(n,s,r)}this.setIndex(u),this.setAttribute("position",new tn(p,3)),this.setAttribute("normal",new tn(m,3)),this.setAttribute("uv",new tn(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Yn(t.width,t.height,t.widthSegments,t.heightSegments)}}const Jn={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\t return vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat R21 = R12;\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#if defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_NORMALMAP_TANGENTSPACE\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal, vNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",output_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, vec2 fullSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\t\n\t\tvec2 lodFudge = pow( 1.95, lod ) / fullSize;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec2 fullSize = vec2( textureSize( sampler, 0 ) );\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), fullSize, floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), fullSize, ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif",uv_pars_fragment:"#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_UV2\n\tattribute vec2 uv2;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",depth_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n}"},Kn={common:{diffuse:{value:new Gi(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Jt},alphaMap:{value:null},alphaMapTransform:{value:new Jt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Jt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Jt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Jt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Jt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Jt},normalScale:{value:new Yt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Jt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Jt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Jt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Jt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Gi(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Gi(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Jt}},sprite:{diffuse:{value:new Gi(16777215)},opacity:{value:1},center:{value:new Yt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Jt},alphaMap:{value:null},alphaTest:{value:0}}},$n={basic:{uniforms:In([Kn.common,Kn.specularmap,Kn.envmap,Kn.aomap,Kn.lightmap,Kn.fog]),vertexShader:Jn.meshbasic_vert,fragmentShader:Jn.meshbasic_frag},lambert:{uniforms:In([Kn.common,Kn.specularmap,Kn.envmap,Kn.aomap,Kn.lightmap,Kn.emissivemap,Kn.bumpmap,Kn.normalmap,Kn.displacementmap,Kn.fog,Kn.lights,{emissive:{value:new Gi(0)}}]),vertexShader:Jn.meshlambert_vert,fragmentShader:Jn.meshlambert_frag},phong:{uniforms:In([Kn.common,Kn.specularmap,Kn.envmap,Kn.aomap,Kn.lightmap,Kn.emissivemap,Kn.bumpmap,Kn.normalmap,Kn.displacementmap,Kn.fog,Kn.lights,{emissive:{value:new Gi(0)},specular:{value:new Gi(1118481)},shininess:{value:30}}]),vertexShader:Jn.meshphong_vert,fragmentShader:Jn.meshphong_frag},standard:{uniforms:In([Kn.common,Kn.envmap,Kn.aomap,Kn.lightmap,Kn.emissivemap,Kn.bumpmap,Kn.normalmap,Kn.displacementmap,Kn.roughnessmap,Kn.metalnessmap,Kn.fog,Kn.lights,{emissive:{value:new Gi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Jn.meshphysical_vert,fragmentShader:Jn.meshphysical_frag},toon:{uniforms:In([Kn.common,Kn.aomap,Kn.lightmap,Kn.emissivemap,Kn.bumpmap,Kn.normalmap,Kn.displacementmap,Kn.gradientmap,Kn.fog,Kn.lights,{emissive:{value:new Gi(0)}}]),vertexShader:Jn.meshtoon_vert,fragmentShader:Jn.meshtoon_frag},matcap:{uniforms:In([Kn.common,Kn.bumpmap,Kn.normalmap,Kn.displacementmap,Kn.fog,{matcap:{value:null}}]),vertexShader:Jn.meshmatcap_vert,fragmentShader:Jn.meshmatcap_frag},points:{uniforms:In([Kn.points,Kn.fog]),vertexShader:Jn.points_vert,fragmentShader:Jn.points_frag},dashed:{uniforms:In([Kn.common,Kn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Jn.linedashed_vert,fragmentShader:Jn.linedashed_frag},depth:{uniforms:In([Kn.common,Kn.displacementmap]),vertexShader:Jn.depth_vert,fragmentShader:Jn.depth_frag},normal:{uniforms:In([Kn.common,Kn.bumpmap,Kn.normalmap,Kn.displacementmap,{opacity:{value:1}}]),vertexShader:Jn.meshnormal_vert,fragmentShader:Jn.meshnormal_frag},sprite:{uniforms:In([Kn.sprite,Kn.fog]),vertexShader:Jn.sprite_vert,fragmentShader:Jn.sprite_frag},background:{uniforms:{uvTransform:{value:new Jt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Jn.background_vert,fragmentShader:Jn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Jn.backgroundCube_vert,fragmentShader:Jn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Jn.cube_vert,fragmentShader:Jn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Jn.equirect_vert,fragmentShader:Jn.equirect_frag},distanceRGBA:{uniforms:In([Kn.common,Kn.displacementmap,{referencePosition:{value:new Ae},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Jn.distanceRGBA_vert,fragmentShader:Jn.distanceRGBA_frag},shadow:{uniforms:In([Kn.lights,Kn.fog,{color:{value:new Gi(0)},opacity:{value:1}}]),vertexShader:Jn.shadow_vert,fragmentShader:Jn.shadow_frag}};$n.physical={uniforms:In([$n.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Jt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Jt},clearcoatNormalScale:{value:new Yt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Jt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Jt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Jt},sheen:{value:0},sheenColor:{value:new Gi(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Jt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Jt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Jt},transmissionSamplerSize:{value:new Yt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Jt},attenuationDistance:{value:0},attenuationColor:{value:new Gi(0)},specularColor:{value:new Gi(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Jt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Jt}}]),vertexShader:Jn.meshphysical_vert,fragmentShader:Jn.meshphysical_frag};const ts={r:0,b:0,g:0};function es(t,e,i,n,s,r,l){const c=new Gi(0);let h,d,u=!0===r?0:1,p=null,m=0,f=null;function g(e,i){e.getRGB(ts,Pn(t)),n.buffers.color.setClear(ts.r,ts.g,ts.b,i,l)}return{getClearColor:function(){return c},setClearColor:function(t,e=1){c.set(t),u=e,g(c,u)},getClearAlpha:function(){return u},setClearAlpha:function(t){u=t,g(c,u)},render:function(n,r){let l=!1,v=!0===r.isScene?r.background:null;if(v&&v.isTexture){v=(r.backgroundBlurriness>0?i:e).get(v)}const _=t.xr,y=_.getSession&&_.getSession();y&&"additive"===y.environmentBlendMode&&(v=null),null===v?g(c,u):v&&v.isColor&&(g(v,1),l=!0),(t.autoClear||l)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),v&&(v.isCubeTexture||v.mapping===b)?(void 0===d&&(d=new Cn(new Ln(1,1,1),new Bn({name:"BackgroundCubeMaterial",uniforms:kn($n.backgroundCube.uniforms),vertexShader:$n.backgroundCube.vertexShader,fragmentShader:$n.backgroundCube.fragmentShader,side:o,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),s.update(d)),d.material.uniforms.envMap.value=v,d.material.uniforms.flipEnvMap.value=v.isCubeTexture&&!1===v.isRenderTargetTexture?-1:1,d.material.uniforms.backgroundBlurriness.value=r.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=r.backgroundIntensity,d.material.toneMapped=v.encoding!==Ct,p===v&&m===v.version&&f===t.toneMapping||(d.material.needsUpdate=!0,p=v,m=v.version,f=t.toneMapping),d.layers.enableAll(),n.unshift(d,d.geometry,d.material,0,0,null)):v&&v.isTexture&&(void 0===h&&(h=new Cn(new Yn(2,2),new Bn({name:"BackgroundMaterial",uniforms:kn($n.background.uniforms),vertexShader:$n.background.vertexShader,fragmentShader:$n.background.fragmentShader,side:a,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),s.update(h)),h.material.uniforms.t2D.value=v,h.material.uniforms.backgroundIntensity.value=r.backgroundIntensity,h.material.toneMapped=v.encoding!==Ct,!0===v.matrixAutoUpdate&&v.updateMatrix(),h.material.uniforms.uvTransform.value.copy(v.matrix),p===v&&m===v.version&&f===t.toneMapping||(h.material.needsUpdate=!0,p=v,m=v.version,f=t.toneMapping),h.layers.enableAll(),n.unshift(h,h.geometry,h.material,0,0,null))}}}function is(t,e,i,n){const s=t.getParameter(34921),r=n.isWebGL2?null:e.get("OES_vertex_array_object"),a=n.isWebGL2||null!==r,o={},l=p(null);let c=l,h=!1;function d(e){return n.isWebGL2?t.bindVertexArray(e):r.bindVertexArrayOES(e)}function u(e){return n.isWebGL2?t.deleteVertexArray(e):r.deleteVertexArrayOES(e)}function p(t){const e=[],i=[],n=[];for(let t=0;t<s;t++)e[t]=0,i[t]=0,n[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:n,object:t,attributes:{},index:null}}function m(){const t=c.newAttributes;for(let e=0,i=t.length;e<i;e++)t[e]=0}function f(t){g(t,0)}function g(i,s){const r=c.newAttributes,a=c.enabledAttributes,o=c.attributeDivisors;if(r[i]=1,0===a[i]&&(t.enableVertexAttribArray(i),a[i]=1),o[i]!==s){(n.isWebGL2?t:e.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](i,s),o[i]=s}}function v(){const e=c.newAttributes,i=c.enabledAttributes;for(let n=0,s=i.length;n<s;n++)i[n]!==e[n]&&(t.disableVertexAttribArray(n),i[n]=0)}function _(e,i,s,r,a,o){!0!==n.isWebGL2||5124!==s&&5125!==s?t.vertexAttribPointer(e,i,s,r,a,o):t.vertexAttribIPointer(e,i,s,a,o)}function y(){x(),h=!0,c!==l&&(c=l,d(c.object))}function x(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function(s,l,u,y,x){let A=!1;if(a){const e=function(e,i,s){const a=!0===s.wireframe;let l=o[e.id];void 0===l&&(l={},o[e.id]=l);let c=l[i.id];void 0===c&&(c={},l[i.id]=c);let h=c[a];void 0===h&&(h=p(n.isWebGL2?t.createVertexArray():r.createVertexArrayOES()),c[a]=h);return h}(y,u,l);c!==e&&(c=e,d(c.object)),A=function(t,e,i,n){const s=c.attributes,r=e.attributes;let a=0;const o=i.getAttributes();for(const e in o){if(o[e].location>=0){const i=s[e];let n=r[e];if(void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor)),void 0===i)return!0;if(i.attribute!==n)return!0;if(n&&i.data!==n.data)return!0;a++}}return c.attributesNum!==a||c.index!==n}(s,y,u,x),A&&function(t,e,i,n){const s={},r=e.attributes;let a=0;const o=i.getAttributes();for(const e in o){if(o[e].location>=0){let i=r[e];void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor));const n={};n.attribute=i,i&&i.data&&(n.data=i.data),s[e]=n,a++}}c.attributes=s,c.attributesNum=a,c.index=n}(s,y,u,x)}else{const t=!0===l.wireframe;c.geometry===y.id&&c.program===u.id&&c.wireframe===t||(c.geometry=y.id,c.program=u.id,c.wireframe=t,A=!0)}null!==x&&i.update(x,34963),(A||h)&&(h=!1,function(s,r,a,o){if(!1===n.isWebGL2&&(s.isInstancedMesh||o.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;m();const l=o.attributes,c=a.getAttributes(),h=r.defaultAttributeValues;for(const e in c){const n=c[e];if(n.location>=0){let r=l[e];if(void 0===r&&("instanceMatrix"===e&&s.instanceMatrix&&(r=s.instanceMatrix),"instanceColor"===e&&s.instanceColor&&(r=s.instanceColor)),void 0!==r){const e=r.normalized,a=r.itemSize,l=i.get(r);if(void 0===l)continue;const c=l.buffer,h=l.type,d=l.bytesPerElement;if(r.isInterleavedBufferAttribute){const i=r.data,l=i.stride,u=r.offset;if(i.isInstancedInterleavedBuffer){for(let t=0;t<n.locationSize;t++)g(n.location+t,i.meshPerAttribute);!0!==s.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=i.meshPerAttribute*i.count)}else for(let t=0;t<n.locationSize;t++)f(n.location+t);t.bindBuffer(34962,c);for(let t=0;t<n.locationSize;t++)_(n.location+t,a/n.locationSize,h,e,l*d,(u+a/n.locationSize*t)*d)}else{if(r.isInstancedBufferAttribute){for(let t=0;t<n.locationSize;t++)g(n.location+t,r.meshPerAttribute);!0!==s.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=r.meshPerAttribute*r.count)}else for(let t=0;t<n.locationSize;t++)f(n.location+t);t.bindBuffer(34962,c);for(let t=0;t<n.locationSize;t++)_(n.location+t,a/n.locationSize,h,e,a*d,a/n.locationSize*t*d)}}else if(void 0!==h){const i=h[e];if(void 0!==i)switch(i.length){case 2:t.vertexAttrib2fv(n.location,i);break;case 3:t.vertexAttrib3fv(n.location,i);break;case 4:t.vertexAttrib4fv(n.location,i);break;default:t.vertexAttrib1fv(n.location,i)}}}}v()}(s,l,u,y),null!==x&&t.bindBuffer(34963,i.get(x).buffer))},reset:y,resetDefaultState:x,dispose:function(){y();for(const t in o){const e=o[t];for(const t in e){const i=e[t];for(const t in i)u(i[t].object),delete i[t];delete e[t]}delete o[t]}},releaseStatesOfGeometry:function(t){if(void 0===o[t.id])return;const e=o[t.id];for(const t in e){const i=e[t];for(const t in i)u(i[t].object),delete i[t];delete e[t]}delete o[t.id]},releaseStatesOfProgram:function(t){for(const e in o){const i=o[e];if(void 0===i[t.id])continue;const n=i[t.id];for(const t in n)u(n[t].object),delete n[t];delete i[t.id]}},initAttributes:m,enableAttribute:f,disableUnusedAttributes:v}}function ns(t,e,i,n){const s=n.isWebGL2;let r;this.setMode=function(t){r=t},this.render=function(e,n){t.drawArrays(r,e,n),i.update(n,r,1)},this.renderInstances=function(n,a,o){if(0===o)return;let l,c;if(s)l=t,c="drawArraysInstanced";else if(l=e.get("ANGLE_instanced_arrays"),c="drawArraysInstancedANGLE",null===l)return void console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");l[c](r,n,a,o),i.update(a,r,o)}}function ss(t,e,i){let n;function s(e){if("highp"===e){if(t.getShaderPrecisionFormat(35633,36338).precision>0&&t.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(35633,36337).precision>0&&t.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const r="undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name;let a=void 0!==i.precision?i.precision:"highp";const o=s(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=r||e.has("WEBGL_draw_buffers"),c=!0===i.logarithmicDepthBuffer,h=t.getParameter(34930),d=t.getParameter(35660),u=t.getParameter(3379),p=t.getParameter(34076),m=t.getParameter(34921),f=t.getParameter(36347),g=t.getParameter(36348),v=t.getParameter(36349),_=d>0,y=r||e.has("OES_texture_float");return{isWebGL2:r,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===e.has("EXT_texture_filter_anisotropic")){const i=e.get("EXT_texture_filter_anisotropic");n=t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:s,precision:a,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:d,maxTextureSize:u,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:f,maxVaryings:g,maxFragmentUniforms:v,vertexTextures:_,floatFragmentTextures:y,floatVertexTextures:_&&y,maxSamples:r?t.getParameter(36183):0}}function rs(t){const e=this;let i=null,n=0,s=!1,r=!1;const a=new Wn,o=new Jt,l={value:null,needsUpdate:!1};function c(t,i,n,s){const r=null!==t?t.length:0;let c=null;if(0!==r){if(c=l.value,!0!==s||null===c){const e=n+4*r,s=i.matrixWorldInverse;o.getNormalMatrix(s),(null===c||c.length<e)&&(c=new Float32Array(e));for(let e=0,i=n;e!==r;++e,i+=4)a.copy(t[e]).applyMatrix4(s,o),a.normal.toArray(c,i),c[i+3]=a.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=r,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e){const i=0!==t.length||e||0!==n||s;return s=e,n=t.length,i},this.beginShadows=function(){r=!0,c(null)},this.endShadows=function(){r=!1},this.setGlobalState=function(t,e){i=c(t,e,0)},this.setState=function(a,o,h){const d=a.clippingPlanes,u=a.clipIntersection,p=a.clipShadows,m=t.get(a);if(!s||null===d||0===d.length||r&&!p)r?c(null):function(){l.value!==i&&(l.value=i,l.needsUpdate=n>0);e.numPlanes=n,e.numIntersection=0}();else{const t=r?0:n,e=4*t;let s=m.clippingState||null;l.value=s,s=c(d,o,e,h);for(let t=0;t!==e;++t)s[t]=i[t];m.clippingState=s,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=t}}}function as(t){let e=new WeakMap;function i(t,e){return e===A?t.mapping=y:e===w&&(t.mapping=x),t}function n(t){const i=t.target;i.removeEventListener("dispose",n);const s=e.get(i);void 0!==s&&(e.delete(i),s.dispose())}return{get:function(s){if(s&&s.isTexture&&!1===s.isRenderTargetTexture){const r=s.mapping;if(r===A||r===w){if(e.has(s)){return i(e.get(s).texture,s.mapping)}{const r=s.image;if(r&&r.height>0){const a=new Fn(r.height/2);return a.fromEquirectangularTexture(t,s),e.set(s,a),s.addEventListener("dispose",n),i(a.texture,s.mapping)}return null}}}return s},dispose:function(){e=new WeakMap}}}class os extends Dn{constructor(t=-1,e=1,i=1,n=-1,s=.1,r=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=s,this.far=r,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,i,n,s,r){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=s,this.view.height=r,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;let s=i-t,r=i+t,a=n+e,o=n-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=t*this.view.offsetX,r=s+t*this.view.width,a-=e*this.view.offsetY,o=a-e*this.view.height}this.projectionMatrix.makeOrthographic(s,r,a,o,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}const ls=[.125,.215,.35,.446,.526,.582],cs=20,hs=new os,ds=new Gi;let us=null;const ps=(1+Math.sqrt(5))/2,ms=1/ps,fs=[new Ae(1,1,1),new Ae(-1,1,1),new Ae(1,1,-1),new Ae(-1,1,-1),new Ae(0,ps,ms),new Ae(0,ps,-ms),new Ae(ms,0,ps),new Ae(-ms,0,ps),new Ae(ps,ms,0),new Ae(-ps,ms,0)];class gs{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,i=.1,n=100){us=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(t,i,n,s),e>0&&this._blur(s,0,0,e),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=xs(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=ys(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(us),t.scissorTest=!1,_s(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===y||t.mapping===x?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),us=this._renderer.getRenderTarget();const i=e||this._allocateTargets();return this._textureToCubeUV(t,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,i={magFilter:k,minFilter:k,generateMipmaps:!1,type:N,format:z,encoding:Et,depthBuffer:!1},n=vs(t,e,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=vs(t,e,i);const{_lodMax:n}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){const e=[],i=[],n=[];let s=t;const r=t-4+1+ls.length;for(let a=0;a<r;a++){const r=Math.pow(2,s);i.push(r);let o=1/r;a>t-4?o=ls[a-t+4-1]:0===a&&(o=0),n.push(o);const l=1/(r-2),c=-l,h=1+l,d=[c,c,h,c,h,h,c,c,h,h,c,h],u=6,p=6,m=3,f=2,g=1,v=new Float32Array(m*p*u),_=new Float32Array(f*p*u),y=new Float32Array(g*p*u);for(let t=0;t<u;t++){const e=t%3*2/3-1,i=t>2?0:-1,n=[e,i,0,e+2/3,i,0,e+2/3,i+1,0,e,i,0,e+2/3,i+1,0,e,i+1,0];v.set(n,m*p*t),_.set(d,f*p*t);const s=[t,t,t,t,t,t];y.set(s,g*p*t)}const x=new cn;x.setAttribute("position",new Ji(v,m)),x.setAttribute("uv",new Ji(_,f)),x.setAttribute("faceIndex",new Ji(y,g)),e.push(x),s>4&&s--}return{lodPlanes:e,sizeLods:i,sigmas:n}}(n)),this._blurMaterial=function(t,e,i){const n=new Float32Array(cs),s=new Ae(0,1,0),r=new Bn({name:"SphericalGaussianBlur",defines:{n:cs,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:As(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});return r}(n,t,e)}return n}_compileMaterial(t){const e=new Cn(this._lodPlanes[0],t);this._renderer.compile(e,hs)}_sceneToCubeUV(t,e,i,n){const s=new Un(90,1,e,i),r=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],l=this._renderer,c=l.autoClear,h=l.toneMapping;l.getClearColor(ds),l.toneMapping=u,l.autoClear=!1;const d=new Vi({name:"PMREM.Background",side:o,depthWrite:!1,depthTest:!1}),p=new Cn(new Ln,d);let m=!1;const f=t.background;f?f.isColor&&(d.color.copy(f),t.background=null,m=!0):(d.color.copy(ds),m=!0);for(let e=0;e<6;e++){const i=e%3;0===i?(s.up.set(0,r[e],0),s.lookAt(a[e],0,0)):1===i?(s.up.set(0,0,r[e]),s.lookAt(0,a[e],0)):(s.up.set(0,r[e],0),s.lookAt(0,0,a[e]));const o=this._cubeSize;_s(n,i*o,e>2?o:0,o,o),l.setRenderTarget(n),m&&l.render(p,s),l.render(t,s)}p.geometry.dispose(),p.material.dispose(),l.toneMapping=h,l.autoClear=c,t.background=f}_textureToCubeUV(t,e){const i=this._renderer,n=t.mapping===y||t.mapping===x;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=xs()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=ys());const s=n?this._cubemapMaterial:this._equirectMaterial,r=new Cn(this._lodPlanes[0],s);s.uniforms.envMap.value=t;const a=this._cubeSize;_s(e,0,0,3*a,2*a),i.setRenderTarget(e),i.render(r,hs)}_applyPMREM(t){const e=this._renderer,i=e.autoClear;e.autoClear=!1;for(let e=1;e<this._lodPlanes.length;e++){const i=Math.sqrt(this._sigmas[e]*this._sigmas[e]-this._sigmas[e-1]*this._sigmas[e-1]),n=fs[(e-1)%fs.length];this._blur(t,e-1,e,i,n)}e.autoClear=i}_blur(t,e,i,n,s){const r=this._pingPongRenderTarget;this._halfBlur(t,r,e,i,n,"latitudinal",s),this._halfBlur(r,t,i,i,n,"longitudinal",s)}_halfBlur(t,e,i,n,s,r,a){const o=this._renderer,l=this._blurMaterial;"latitudinal"!==r&&"longitudinal"!==r&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new Cn(this._lodPlanes[n],l),h=l.uniforms,d=this._sizeLods[i]-1,u=isFinite(s)?Math.PI/(2*d):2*Math.PI/39,p=s/u,m=isFinite(s)?1+Math.floor(3*p):cs;m>cs&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const f=[];let g=0;for(let t=0;t<cs;++t){const e=t/p,i=Math.exp(-e*e/2);f.push(i),0===t?g+=i:t<m&&(g+=2*i)}for(let t=0;t<f.length;t++)f[t]=f[t]/g;h.envMap.value=t.texture,h.samples.value=m,h.weights.value=f,h.latitudinal.value="latitudinal"===r,a&&(h.poleAxis.value=a);const{_lodMax:v}=this;h.dTheta.value=u,h.mipInt.value=v-i;const _=this._sizeLods[n];_s(e,3*_*(n>v-4?n-v+4:0),4*(this._cubeSize-_),3*_,2*_),o.setRenderTarget(e),o.render(c,hs)}}function vs(t,e,i){const n=new ve(t,e,i);return n.texture.mapping=b,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function _s(t,e,i,n,s){t.viewport.set(e,i,n,s),t.scissor.set(e,i,n,s)}function ys(){return new Bn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:As(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function xs(){return new Bn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:As(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function As(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function ws(t){let e=new WeakMap,i=null;function n(t){const i=t.target;i.removeEventListener("dispose",n);const s=e.get(i);void 0!==s&&(e.delete(i),s.dispose())}return{get:function(s){if(s&&s.isTexture){const r=s.mapping,a=r===A||r===w,o=r===y||r===x;if(a||o){if(s.isRenderTargetTexture&&!0===s.needsPMREMUpdate){s.needsPMREMUpdate=!1;let n=e.get(s);return null===i&&(i=new gs(t)),n=a?i.fromEquirectangular(s,n):i.fromCubemap(s,n),e.set(s,n),n.texture}if(e.has(s))return e.get(s).texture;{const r=s.image;if(a&&r&&r.height>0||o&&r&&function(t){let e=0;const i=6;for(let n=0;n<i;n++)void 0!==t[n]&&e++;return e===i}(r)){null===i&&(i=new gs(t));const r=a?i.fromEquirectangular(s):i.fromCubemap(s);return e.set(s,r),s.addEventListener("dispose",n),r.texture}return null}}}return s},dispose:function(){e=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function bs(t){const e={};function i(i){if(void 0!==e[i])return e[i];let n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return e[i]=n,n}return{has:function(t){return null!==i(t)},init:function(t){t.isWebGL2?i("EXT_color_buffer_float"):(i("WEBGL_depth_texture"),i("OES_texture_float"),i("OES_texture_half_float"),i("OES_texture_half_float_linear"),i("OES_standard_derivatives"),i("OES_element_index_uint"),i("OES_vertex_array_object"),i("ANGLE_instanced_arrays")),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture")},get:function(t){const e=i(t);return null===e&&console.warn("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function Ms(t,e,i,n){const s={},r=new WeakMap;function a(t){const o=t.target;null!==o.index&&e.remove(o.index);for(const t in o.attributes)e.remove(o.attributes[t]);o.removeEventListener("dispose",a),delete s[o.id];const l=r.get(o);l&&(e.remove(l),r.delete(o)),n.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,i.memory.geometries--}function o(t){const i=[],n=t.index,s=t.attributes.position;let a=0;if(null!==n){const t=n.array;a=n.version;for(let e=0,n=t.length;e<n;e+=3){const n=t[e+0],s=t[e+1],r=t[e+2];i.push(n,s,s,r,r,n)}}else{const t=s.array;a=s.version;for(let e=0,n=t.length/3-1;e<n;e+=3){const t=e+0,n=e+1,s=e+2;i.push(t,n,n,s,s,t)}}const o=new($t(i)?$i:Ki)(i,1);o.version=a;const l=r.get(t);l&&e.remove(l),r.set(t,o)}return{get:function(t,e){return!0===s[e.id]||(e.addEventListener("dispose",a),s[e.id]=!0,i.memory.geometries++),e},update:function(t){const i=t.attributes;for(const t in i)e.update(i[t],34962);const n=t.morphAttributes;for(const t in n){const i=n[t];for(let t=0,n=i.length;t<n;t++)e.update(i[t],34962)}},getWireframeAttribute:function(t){const e=r.get(t);if(e){const i=t.index;null!==i&&e.version<i.version&&o(t)}else o(t);return r.get(t)}}}function Ss(t,e,i,n){const s=n.isWebGL2;let r,a,o;this.setMode=function(t){r=t},this.setIndex=function(t){a=t.type,o=t.bytesPerElement},this.render=function(e,n){t.drawElements(r,n,a,e*o),i.update(n,r,1)},this.renderInstances=function(n,l,c){if(0===c)return;let h,d;if(s)h=t,d="drawElementsInstanced";else if(h=e.get("ANGLE_instanced_arrays"),d="drawElementsInstancedANGLE",null===h)return void console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");h[d](r,l,a,n*o,c),i.update(l,r,c)}}function Es(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.frame++,e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(t,i,n){switch(e.calls++,i){case 4:e.triangles+=n*(t/3);break;case 1:e.lines+=n*(t/2);break;case 3:e.lines+=n*(t-1);break;case 2:e.lines+=n*t;break;case 0:e.points+=n*t;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function Cs(t,e){return t[0]-e[0]}function Ts(t,e){return Math.abs(e[1])-Math.abs(t[1])}function Ls(t,e,i){const n={},s=new Float32Array(8),r=new WeakMap,a=new ge,o=[];for(let t=0;t<8;t++)o[t]=[t,0];return{update:function(l,c,h){const d=l.morphTargetInfluences;if(!0===e.isWebGL2){const n=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,s=void 0!==n?n.length:0;let o=r.get(c);if(void 0===o||o.count!==s){void 0!==o&&o.texture.dispose();const t=void 0!==c.morphAttributes.position,i=void 0!==c.morphAttributes.normal,n=void 0!==c.morphAttributes.color,l=c.morphAttributes.position||[],h=c.morphAttributes.normal||[],d=c.morphAttributes.color||[];let u=0;!0===t&&(u=1),!0===i&&(u=2),!0===n&&(u=3);let p=c.attributes.position.count*u,m=1;p>e.maxTextureSize&&(m=Math.ceil(p/e.maxTextureSize),p=e.maxTextureSize);const f=new Float32Array(p*m*4*s),g=new _e(f,p,m,s);g.type=U,g.needsUpdate=!0;const v=4*u;for(let e=0;e<s;e++){const s=l[e],r=h[e],o=d[e],c=p*m*4*e;for(let e=0;e<s.count;e++){const l=e*v;!0===t&&(a.fromBufferAttribute(s,e),f[c+l+0]=a.x,f[c+l+1]=a.y,f[c+l+2]=a.z,f[c+l+3]=0),!0===i&&(a.fromBufferAttribute(r,e),f[c+l+4]=a.x,f[c+l+5]=a.y,f[c+l+6]=a.z,f[c+l+7]=0),!0===n&&(a.fromBufferAttribute(o,e),f[c+l+8]=a.x,f[c+l+9]=a.y,f[c+l+10]=a.z,f[c+l+11]=4===o.itemSize?a.w:1)}}o={count:s,texture:g,size:new Yt(p,m)},r.set(c,o),c.addEventListener("dispose",(function t(){g.dispose(),r.delete(c),c.removeEventListener("dispose",t)}))}let l=0;for(let t=0;t<d.length;t++)l+=d[t];const u=c.morphTargetsRelative?1:1-l;h.getUniforms().setValue(t,"morphTargetBaseInfluence",u),h.getUniforms().setValue(t,"morphTargetInfluences",d),h.getUniforms().setValue(t,"morphTargetsTexture",o.texture,i),h.getUniforms().setValue(t,"morphTargetsTextureSize",o.size)}else{const e=void 0===d?0:d.length;let i=n[c.id];if(void 0===i||i.length!==e){i=[];for(let t=0;t<e;t++)i[t]=[t,0];n[c.id]=i}for(let t=0;t<e;t++){const e=i[t];e[0]=t,e[1]=d[t]}i.sort(Ts);for(let t=0;t<8;t++)t<e&&i[t][1]?(o[t][0]=i[t][0],o[t][1]=i[t][1]):(o[t][0]=Number.MAX_SAFE_INTEGER,o[t][1]=0);o.sort(Cs);const r=c.morphAttributes.position,a=c.morphAttributes.normal;let l=0;for(let t=0;t<8;t++){const e=o[t],i=e[0],n=e[1];i!==Number.MAX_SAFE_INTEGER&&n?(r&&c.getAttribute("morphTarget"+t)!==r[i]&&c.setAttribute("morphTarget"+t,r[i]),a&&c.getAttribute("morphNormal"+t)!==a[i]&&c.setAttribute("morphNormal"+t,a[i]),s[t]=n,l+=n):(r&&!0===c.hasAttribute("morphTarget"+t)&&c.deleteAttribute("morphTarget"+t),a&&!0===c.hasAttribute("morphNormal"+t)&&c.deleteAttribute("morphNormal"+t),s[t]=0)}const u=c.morphTargetsRelative?1:1-l;h.getUniforms().setValue(t,"morphTargetBaseInfluence",u),h.getUniforms().setValue(t,"morphTargetInfluences",s)}}}}function ks(t,e,i,n){let s=new WeakMap;function r(t){const e=t.target;e.removeEventListener("dispose",r),i.remove(e.instanceMatrix),null!==e.instanceColor&&i.remove(e.instanceColor)}return{update:function(t){const a=n.render.frame,o=t.geometry,l=e.get(t,o);return s.get(l)!==a&&(e.update(l),s.set(l,a)),t.isInstancedMesh&&(!1===t.hasEventListener("dispose",r)&&t.addEventListener("dispose",r),i.update(t.instanceMatrix,34962),null!==t.instanceColor&&i.update(t.instanceColor,34962)),l},dispose:function(){s=new WeakMap}}}const Is=new fe,Ps=new _e,Rs=new ye,Bs=new zn,Ds=[],Us=[],Ns=new Float32Array(16),Os=new Float32Array(9),zs=new Float32Array(4);function Fs(t,e,i){const n=t[0];if(n<=0||n>0)return t;const s=e*i;let r=Ds[s];if(void 0===r&&(r=new Float32Array(s),Ds[s]=r),0!==e){n.toArray(r,0);for(let n=1,s=0;n!==e;++n)s+=i,t[n].toArray(r,s)}return r}function Gs(t,e){if(t.length!==e.length)return!1;for(let i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function Hs(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function Vs(t,e){let i=Us[e];void 0===i&&(i=new Int32Array(e),Us[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function Ws(t,e){const i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function js(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Gs(i,e))return;t.uniform2fv(this.addr,e),Hs(i,e)}}function Qs(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(void 0!==e.r)i[0]===e.r&&i[1]===e.g&&i[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(Gs(i,e))return;t.uniform3fv(this.addr,e),Hs(i,e)}}function qs(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Gs(i,e))return;t.uniform4fv(this.addr,e),Hs(i,e)}}function Zs(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Gs(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),Hs(i,e)}else{if(Gs(i,n))return;zs.set(n),t.uniformMatrix2fv(this.addr,!1,zs),Hs(i,n)}}function Xs(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Gs(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),Hs(i,e)}else{if(Gs(i,n))return;Os.set(n),t.uniformMatrix3fv(this.addr,!1,Os),Hs(i,n)}}function Ys(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Gs(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),Hs(i,e)}else{if(Gs(i,n))return;Ns.set(n),t.uniformMatrix4fv(this.addr,!1,Ns),Hs(i,n)}}function Js(t,e){const i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function Ks(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2i(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Gs(i,e))return;t.uniform2iv(this.addr,e),Hs(i,e)}}function $s(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3i(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else{if(Gs(i,e))return;t.uniform3iv(this.addr,e),Hs(i,e)}}function tr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Gs(i,e))return;t.uniform4iv(this.addr,e),Hs(i,e)}}function er(t,e){const i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function ir(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2ui(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Gs(i,e))return;t.uniform2uiv(this.addr,e),Hs(i,e)}}function nr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3ui(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else{if(Gs(i,e))return;t.uniform3uiv(this.addr,e),Hs(i,e)}}function sr(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Gs(i,e))return;t.uniform4uiv(this.addr,e),Hs(i,e)}}function rr(t,e,i){const n=this.cache,s=i.allocateTextureUnit();n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),i.setTexture2D(e||Is,s)}function ar(t,e,i){const n=this.cache,s=i.allocateTextureUnit();n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),i.setTexture3D(e||Rs,s)}function or(t,e,i){const n=this.cache,s=i.allocateTextureUnit();n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),i.setTextureCube(e||Bs,s)}function lr(t,e,i){const n=this.cache,s=i.allocateTextureUnit();n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),i.setTexture2DArray(e||Ps,s)}function cr(t,e){t.uniform1fv(this.addr,e)}function hr(t,e){const i=Fs(e,this.size,2);t.uniform2fv(this.addr,i)}function dr(t,e){const i=Fs(e,this.size,3);t.uniform3fv(this.addr,i)}function ur(t,e){const i=Fs(e,this.size,4);t.uniform4fv(this.addr,i)}function pr(t,e){const i=Fs(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function mr(t,e){const i=Fs(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function fr(t,e){const i=Fs(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function gr(t,e){t.uniform1iv(this.addr,e)}function vr(t,e){t.uniform2iv(this.addr,e)}function _r(t,e){t.uniform3iv(this.addr,e)}function yr(t,e){t.uniform4iv(this.addr,e)}function xr(t,e){t.uniform1uiv(this.addr,e)}function Ar(t,e){t.uniform2uiv(this.addr,e)}function wr(t,e){t.uniform3uiv(this.addr,e)}function br(t,e){t.uniform4uiv(this.addr,e)}function Mr(t,e,i){const n=this.cache,s=e.length,r=Vs(i,s);Gs(n,r)||(t.uniform1iv(this.addr,r),Hs(n,r));for(let t=0;t!==s;++t)i.setTexture2D(e[t]||Is,r[t])}function Sr(t,e,i){const n=this.cache,s=e.length,r=Vs(i,s);Gs(n,r)||(t.uniform1iv(this.addr,r),Hs(n,r));for(let t=0;t!==s;++t)i.setTexture3D(e[t]||Rs,r[t])}function Er(t,e,i){const n=this.cache,s=e.length,r=Vs(i,s);Gs(n,r)||(t.uniform1iv(this.addr,r),Hs(n,r));for(let t=0;t!==s;++t)i.setTextureCube(e[t]||Bs,r[t])}function Cr(t,e,i){const n=this.cache,s=e.length,r=Vs(i,s);Gs(n,r)||(t.uniform1iv(this.addr,r),Hs(n,r));for(let t=0;t!==s;++t)i.setTexture2DArray(e[t]||Ps,r[t])}class Tr{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.setValue=function(t){switch(t){case 5126:return Ws;case 35664:return js;case 35665:return Qs;case 35666:return qs;case 35674:return Zs;case 35675:return Xs;case 35676:return Ys;case 5124:case 35670:return Js;case 35667:case 35671:return Ks;case 35668:case 35672:return $s;case 35669:case 35673:return tr;case 5125:return er;case 36294:return ir;case 36295:return nr;case 36296:return sr;case 35678:case 36198:case 36298:case 36306:case 35682:return rr;case 35679:case 36299:case 36307:return ar;case 35680:case 36300:case 36308:case 36293:return or;case 36289:case 36303:case 36311:case 36292:return lr}}(e.type)}}class Lr{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.size=e.size,this.setValue=function(t){switch(t){case 5126:return cr;case 35664:return hr;case 35665:return dr;case 35666:return ur;case 35674:return pr;case 35675:return mr;case 35676:return fr;case 5124:case 35670:return gr;case 35667:case 35671:return vr;case 35668:case 35672:return _r;case 35669:case 35673:return yr;case 5125:return xr;case 36294:return Ar;case 36295:return wr;case 36296:return br;case 35678:case 36198:case 36298:case 36306:case 35682:return Mr;case 35679:case 36299:case 36307:return Sr;case 35680:case 36300:case 36308:case 36293:return Er;case 36289:case 36303:case 36311:case 36292:return Cr}}(e.type)}}class kr{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,i){const n=this.seq;for(let s=0,r=n.length;s!==r;++s){const r=n[s];r.setValue(t,e[r.id],i)}}}const Ir=/(\w+)(\])?(\[|\.)?/g;function Pr(t,e){t.seq.push(e),t.map[e.id]=e}function Rr(t,e,i){const n=t.name,s=n.length;for(Ir.lastIndex=0;;){const r=Ir.exec(n),a=Ir.lastIndex;let o=r[1];const l="]"===r[2],c=r[3];if(l&&(o|=0),void 0===c||"["===c&&a+2===s){Pr(i,void 0===c?new Tr(o,t,e):new Lr(o,t,e));break}{let t=i.map[o];void 0===t&&(t=new kr(o),Pr(i,t)),i=t}}}class Br{constructor(t,e){this.seq=[],this.map={};const i=t.getProgramParameter(e,35718);for(let n=0;n<i;++n){const i=t.getActiveUniform(e,n);Rr(i,t.getUniformLocation(e,i.name),this)}}setValue(t,e,i,n){const s=this.map[e];void 0!==s&&s.setValue(t,i,n)}setOptional(t,e,i){const n=e[i];void 0!==n&&this.setValue(t,i,n)}static upload(t,e,i,n){for(let s=0,r=e.length;s!==r;++s){const r=e[s],a=i[r.id];!1!==a.needsUpdate&&r.setValue(t,a.value,n)}}static seqWithValue(t,e){const i=[];for(let n=0,s=t.length;n!==s;++n){const s=t[n];s.id in e&&i.push(s)}return i}}function Dr(t,e,i){const n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}let Ur=0;function Nr(t,e,i){const n=t.getShaderParameter(e,35713),s=t.getShaderInfoLog(e).trim();if(n&&""===s)return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const n=parseInt(r[1]);return i.toUpperCase()+"\n\n"+s+"\n\n"+function(t,e){const i=t.split("\n"),n=[],s=Math.max(e-6,0),r=Math.min(e+6,i.length);for(let t=s;t<r;t++){const s=t+1;n.push(`${s===e?">":" "} ${s}: ${i[t]}`)}return n.join("\n")}(t.getShaderSource(e),n)}return s}function Or(t,e){const i=function(t){switch(t){case Et:return["Linear","( value )"];case Ct:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",t),["Linear","( value )"]}}(e);return"vec4 "+t+"( vec4 value ) { return LinearTo"+i[0]+i[1]+"; }"}function zr(t,e){let i;switch(e){case p:i="Linear";break;case m:i="Reinhard";break;case f:i="OptimizedCineon";break;case g:i="ACESFilmic";break;case v:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),i="Linear"}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function Fr(t){return""!==t}function Gr(t,e){const i=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,i).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Hr(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Vr=/^[ \t]*#include +<([\w\d./]+)>/gm;function Wr(t){return t.replace(Vr,jr)}function jr(t,e){const i=Jn[e];if(void 0===i)throw new Error("Can not resolve #include <"+e+">");return Wr(i)}const Qr=/#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 qr(t){return t.replace(Qr,Zr)}function Zr(t,e,i,n){let s="";for(let t=parseInt(e);t<parseInt(i);t++)s+=n.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return s}function Xr(t){let e="precision "+t.precision+" float;\nprecision "+t.precision+" int;";return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function Yr(t,e,i,a){const o=t.getContext(),l=i.defines;let p=i.vertexShader,m=i.fragmentShader;const f=function(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===n?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===s?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===r&&(e="SHADOWMAP_TYPE_VSM"),e}(i),g=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case y:case x:e="ENVMAP_TYPE_CUBE";break;case b:e="ENVMAP_TYPE_CUBE_UV"}return e}(i),v=function(t){let e="ENVMAP_MODE_REFLECTION";t.envMap&&t.envMapMode===x&&(e="ENVMAP_MODE_REFRACTION");return e}(i),_=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case c:e="ENVMAP_BLENDING_MULTIPLY";break;case h:e="ENVMAP_BLENDING_MIX";break;case d:e="ENVMAP_BLENDING_ADD"}return e}(i),A=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const i=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:n,maxMip:i}}(i),w=i.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUVHeight||t.bumpMap||t.normalMapTangentSpace||t.clearcoatNormalMap||t.flatShading||"physical"===t.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Fr).join("\n")}(i),M=function(t){const e=[];for(const i in t){const n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(l),S=o.createProgram();let E,C,T=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?(E=[M].filter(Fr).join("\n"),E.length>0&&(E+="\n"),C=[w,M].filter(Fr).join("\n"),C.length>0&&(C+="\n")):(E=[Xr(i),"#define SHADER_NAME "+i.shaderName,M,i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+v:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.displacementMap?"#define USE_DISPLACEMENTMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.mapUv?"#define MAP_UV "+i.mapUv:"",i.alphaMapUv?"#define ALPHAMAP_UV "+i.alphaMapUv:"",i.lightMapUv?"#define LIGHTMAP_UV "+i.lightMapUv:"",i.aoMapUv?"#define AOMAP_UV "+i.aoMapUv:"",i.emissiveMapUv?"#define EMISSIVEMAP_UV "+i.emissiveMapUv:"",i.bumpMapUv?"#define BUMPMAP_UV "+i.bumpMapUv:"",i.normalMapUv?"#define NORMALMAP_UV "+i.normalMapUv:"",i.displacementMapUv?"#define DISPLACEMENTMAP_UV "+i.displacementMapUv:"",i.metalnessMapUv?"#define METALNESSMAP_UV "+i.metalnessMapUv:"",i.roughnessMapUv?"#define ROUGHNESSMAP_UV "+i.roughnessMapUv:"",i.clearcoatMapUv?"#define CLEARCOATMAP_UV "+i.clearcoatMapUv:"",i.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+i.clearcoatNormalMapUv:"",i.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+i.clearcoatRoughnessMapUv:"",i.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+i.iridescenceMapUv:"",i.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+i.iridescenceThicknessMapUv:"",i.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+i.sheenColorMapUv:"",i.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+i.sheenRoughnessMapUv:"",i.specularMapUv?"#define SPECULARMAP_UV "+i.specularMapUv:"",i.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+i.specularColorMapUv:"",i.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+i.specularIntensityMapUv:"",i.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+i.transmissionMapUv:"",i.thicknessMapUv?"#define THICKNESSMAP_UV "+i.thicknessMapUv:"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs2?"#define USE_UV2":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors&&i.isWebGL2?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0&&i.isWebGL2?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+f:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","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","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Fr).join("\n"),C=[w,Xr(i),"#define SHADER_NAME "+i.shaderName,M,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+g:"",i.envMap?"#define "+v:"",i.envMap?"#define "+_:"",A?"#define CUBEUV_TEXEL_WIDTH "+A.texelWidth:"",A?"#define CUBEUV_TEXEL_HEIGHT "+A.texelHeight:"",A?"#define CUBEUV_MAX_MIP "+A.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.vertexTangents?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUvs2?"#define USE_UV2":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+f:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.useLegacyLights?"#define LEGACY_LIGHTS":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",i.toneMapping!==u?"#define TONE_MAPPING":"",i.toneMapping!==u?Jn.tonemapping_pars_fragment:"",i.toneMapping!==u?zr("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",Jn.encodings_pars_fragment,Or("linearToOutputTexel",i.outputEncoding),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Fr).join("\n")),p=Wr(p),p=Gr(p,i),p=Hr(p,i),m=Wr(m),m=Gr(m,i),m=Hr(m,i),p=qr(p),m=qr(m),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(T="#version 300 es\n",E=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+E,C=["#define varying in",i.glslVersion===Rt?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===Rt?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+C);const L=T+C+m,k=Dr(o,35633,T+E+p),I=Dr(o,35632,L);if(o.attachShader(S,k),o.attachShader(S,I),void 0!==i.index0AttributeName?o.bindAttribLocation(S,0,i.index0AttributeName):!0===i.morphTargets&&o.bindAttribLocation(S,0,"position"),o.linkProgram(S),t.debug.checkShaderErrors){const e=o.getProgramInfoLog(S).trim(),i=o.getShaderInfoLog(k).trim(),n=o.getShaderInfoLog(I).trim();let s=!0,r=!0;if(!1===o.getProgramParameter(S,35714))if(s=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(o,S,k,I);else{const t=Nr(o,k,"vertex"),i=Nr(o,I,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(S,35715)+"\n\nProgram Info Log: "+e+"\n"+t+"\n"+i)}else""!==e?console.warn("THREE.WebGLProgram: Program Info Log:",e):""!==i&&""!==n||(r=!1);r&&(this.diagnostics={runnable:s,programLog:e,vertexShader:{log:i,prefix:E},fragmentShader:{log:n,prefix:C}})}let P,R;return o.deleteShader(k),o.deleteShader(I),this.getUniforms=function(){return void 0===P&&(P=new Br(o,S)),P},this.getAttributes=function(){return void 0===R&&(R=function(t,e){const i={},n=t.getProgramParameter(e,35721);for(let s=0;s<n;s++){const n=t.getActiveAttrib(e,s),r=n.name;let a=1;35674===n.type&&(a=2),35675===n.type&&(a=3),35676===n.type&&(a=4),i[r]={type:n.type,location:t.getAttribLocation(e,r),locationSize:a}}return i}(o,S)),R},this.destroy=function(){a.releaseStatesOfProgram(this),o.deleteProgram(S),this.program=void 0},this.name=i.shaderName,this.id=Ur++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=k,this.fragmentShader=I,this}let Jr=0;class Kr{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,i=t.fragmentShader,n=this._getShaderStage(e),s=this._getShaderStage(i),r=this._getShaderCacheForMaterial(t);return!1===r.has(n)&&(r.add(n),n.usedTimes++),!1===r.has(s)&&(r.add(s),s.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const t of e)t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let i=e.get(t);return void 0===i&&(i=new Set,e.set(t,i)),i}_getShaderStage(t){const e=this.shaderCache;let i=e.get(t);return void 0===i&&(i=new $r(t),e.set(t,i)),i}}class $r{constructor(t){this.id=Jr++,this.code=t,this.usedTimes=0}}function ta(t,e,i,n,s,r,a){const l=new li,c=new Kr,h=[],d=s.isWebGL2,p=s.logarithmicDepthBuffer,m=s.vertexTextures;let f=s.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function v(t){return 1===t?"uv2":"uv"}return{getParameters:function(r,l,h,_,y){const x=_.fog,A=y.geometry,w=r.isMeshStandardMaterial?_.environment:null,M=(r.isMeshStandardMaterial?i:e).get(r.envMap||w),S=M&&M.mapping===b?M.image.height:null,E=g[r.type];null!==r.precision&&(f=s.getMaxPrecision(r.precision),f!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",f,"instead."));const C=A.morphAttributes.position||A.morphAttributes.normal||A.morphAttributes.color,T=void 0!==C?C.length:0;let L,k,I,P,R=0;if(void 0!==A.morphAttributes.position&&(R=1),void 0!==A.morphAttributes.normal&&(R=2),void 0!==A.morphAttributes.color&&(R=3),E){const t=$n[E];L=t.vertexShader,k=t.fragmentShader}else L=r.vertexShader,k=r.fragmentShader,c.update(r),I=c.getVertexShaderID(r),P=c.getFragmentShaderID(r);const B=t.getRenderTarget(),D=!0===y.isInstancedMesh,U=!!r.map,N=!!r.matcap,O=!!M,z=!!r.aoMap,F=!!r.lightMap,G=!!r.bumpMap,H=!!r.normalMap,V=!!r.displacementMap,W=!!r.emissiveMap,j=!!r.metalnessMap,Q=!!r.roughnessMap,q=r.clearcoat>0,Z=r.iridescence>0,X=r.sheen>0,Y=r.transmission>0,J=q&&!!r.clearcoatMap,K=q&&!!r.clearcoatNormalMap,$=q&&!!r.clearcoatRoughnessMap,tt=Z&&!!r.iridescenceMap,et=Z&&!!r.iridescenceThicknessMap,it=X&&!!r.sheenColorMap,nt=X&&!!r.sheenRoughnessMap,st=!!r.specularMap,rt=!!r.specularColorMap,at=!!r.specularIntensityMap,ot=Y&&!!r.transmissionMap,lt=Y&&!!r.thicknessMap,ct=!!r.gradientMap,ht=!!r.alphaMap,dt=r.alphaTest>0,ut=!!r.extensions,pt=!!A.attributes.uv2;return{isWebGL2:d,shaderID:E,shaderName:r.type,vertexShader:L,fragmentShader:k,defines:r.defines,customVertexShaderID:I,customFragmentShaderID:P,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:f,instancing:D,instancingColor:D&&null!==y.instanceColor,supportsVertexTextures:m,outputEncoding:null===B?t.outputEncoding:!0===B.isXRRenderTarget?B.texture.encoding:Et,map:U,matcap:N,envMap:O,envMapMode:O&&M.mapping,envMapCubeUVHeight:S,aoMap:z,lightMap:F,bumpMap:G,normalMap:H,displacementMap:m&&V,emissiveMap:W,normalMapObjectSpace:H&&1===r.normalMapType,normalMapTangentSpace:H&&0===r.normalMapType,decodeVideoTexture:U&&!0===r.map.isVideoTexture&&r.map.encoding===Ct,metalnessMap:j,roughnessMap:Q,clearcoat:q,clearcoatMap:J,clearcoatNormalMap:K,clearcoatRoughnessMap:$,iridescence:Z,iridescenceMap:tt,iridescenceThicknessMap:et,sheen:X,sheenColorMap:it,sheenRoughnessMap:nt,specularMap:st,specularColorMap:rt,specularIntensityMap:at,transmission:Y,transmissionMap:ot,thicknessMap:lt,gradientMap:ct,opaque:!1===r.transparent&&1===r.blending,alphaMap:ht,alphaTest:dt,combine:r.combine,mapUv:U&&v(r.map.channel),aoMapUv:z&&v(r.aoMap.channel),lightMapUv:F&&v(r.lightMap.channel),bumpMapUv:G&&v(r.bumpMap.channel),normalMapUv:H&&v(r.normalMap.channel),displacementMapUv:V&&v(r.displacementMap.channel),emissiveMapUv:W&&v(r.emissiveMap.channel),metalnessMapUv:j&&v(r.metalnessMap.channel),roughnessMapUv:Q&&v(r.roughnessMap.channel),clearcoatMapUv:J&&v(r.clearcoatMap.channel),clearcoatNormalMapUv:K&&v(r.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:$&&v(r.clearcoatRoughnessMap.channel),iridescenceMapUv:tt&&v(r.iridescenceMap.channel),iridescenceThicknessMapUv:et&&v(r.iridescenceThicknessMap.channel),sheenColorMapUv:it&&v(r.sheenColorMap.channel),sheenRoughnessMapUv:nt&&v(r.sheenRoughnessMap.channel),specularMapUv:st&&v(r.specularMap.channel),specularColorMapUv:rt&&v(r.specularColorMap.channel),specularIntensityMapUv:at&&v(r.specularIntensityMap.channel),transmissionMapUv:ot&&v(r.transmissionMap.channel),thicknessMapUv:lt&&v(r.thicknessMap.channel),alphaMapUv:ht&&v(r.alphaMap.channel),vertexTangents:H&&!!A.attributes.tangent,vertexColors:r.vertexColors,vertexAlphas:!0===r.vertexColors&&!!A.attributes.color&&4===A.attributes.color.itemSize,vertexUvs2:pt,pointsUvs:!0===y.isPoints&&!!A.attributes.uv&&(U||ht),fog:!!x,useFog:!0===r.fog,fogExp2:x&&x.isFogExp2,flatShading:!0===r.flatShading,sizeAttenuation:!0===r.sizeAttenuation,logarithmicDepthBuffer:p,skinning:!0===y.isSkinnedMesh,morphTargets:void 0!==A.morphAttributes.position,morphNormals:void 0!==A.morphAttributes.normal,morphColors:void 0!==A.morphAttributes.color,morphTargetsCount:T,morphTextureStride:R,numDirLights:l.directional.length,numPointLights:l.point.length,numSpotLights:l.spot.length,numSpotLightMaps:l.spotLightMap.length,numRectAreaLights:l.rectArea.length,numHemiLights:l.hemi.length,numDirLightShadows:l.directionalShadowMap.length,numPointLightShadows:l.pointShadowMap.length,numSpotLightShadows:l.spotShadowMap.length,numSpotLightShadowsWithMaps:l.numSpotLightShadowsWithMaps,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.length>0,shadowMapType:t.shadowMap.type,toneMapping:r.toneMapped?t.toneMapping:u,useLegacyLights:t.useLegacyLights,premultipliedAlpha:r.premultipliedAlpha,doubleSided:2===r.side,flipSided:r.side===o,useDepthPacking:r.depthPacking>=0,depthPacking:r.depthPacking||0,index0AttributeName:r.index0AttributeName,extensionDerivatives:ut&&!0===r.extensions.derivatives,extensionFragDepth:ut&&!0===r.extensions.fragDepth,extensionDrawBuffers:ut&&!0===r.extensions.drawBuffers,extensionShaderTextureLOD:ut&&!0===r.extensions.shaderTextureLOD,rendererExtensionFragDepth:d||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:d||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:d||n.has("EXT_shader_texture_lod"),customProgramCacheKey:r.customProgramCacheKey()}},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.customVertexShaderID),i.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(!function(t,e){t.push(e.precision),t.push(e.outputEncoding),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(i,e),function(t,e){l.disableAll(),e.isWebGL2&&l.enable(0);e.supportsVertexTextures&&l.enable(1);e.instancing&&l.enable(2);e.instancingColor&&l.enable(3);e.matcap&&l.enable(4);e.envMap&&l.enable(5);e.normalMapObjectSpace&&l.enable(6);e.normalMapTangentSpace&&l.enable(7);e.clearcoat&&l.enable(8);e.iridescence&&l.enable(9);e.alphaTest&&l.enable(10);e.vertexColors&&l.enable(11);e.vertexAlphas&&l.enable(12);e.vertexUvs2&&l.enable(13);e.vertexTangents&&l.enable(14);t.push(l.mask),l.disableAll(),e.fog&&l.enable(0);e.useFog&&l.enable(1);e.flatShading&&l.enable(2);e.logarithmicDepthBuffer&&l.enable(3);e.skinning&&l.enable(4);e.morphTargets&&l.enable(5);e.morphNormals&&l.enable(6);e.morphColors&&l.enable(7);e.premultipliedAlpha&&l.enable(8);e.shadowMapEnabled&&l.enable(9);e.useLegacyLights&&l.enable(10);e.doubleSided&&l.enable(11);e.flipSided&&l.enable(12);e.useDepthPacking&&l.enable(13);e.dithering&&l.enable(14);e.transmission&&l.enable(15);e.sheen&&l.enable(16);e.decodeVideoTexture&&l.enable(17);e.opaque&&l.enable(18);e.pointsUvs&&l.enable(19);t.push(l.mask)}(i,e),i.push(t.outputEncoding)),i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=g[t.type];let i;if(e){const t=$n[e];i=Rn.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n;for(let t=0,e=h.length;t<e;t++){const e=h[t];if(e.cacheKey===i){n=e,++n.usedTimes;break}}return void 0===n&&(n=new Yr(t,i,e,r),h.push(n)),n},releaseProgram:function(t){if(0==--t.usedTimes){const e=h.indexOf(t);h[e]=h[h.length-1],h.pop(),t.destroy()}},releaseShaderCache:function(t){c.remove(t)},programs:h,dispose:function(){c.dispose()}}}function ea(){let t=new WeakMap;return{get:function(e){let i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i},remove:function(e){t.delete(e)},update:function(e,i,n){t.get(e)[i]=n},dispose:function(){t=new WeakMap}}}function ia(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function na(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function sa(){const t=[];let e=0;const i=[],n=[],s=[];function r(i,n,s,r,a,o){let l=t[e];return void 0===l?(l={id:i.id,object:i,geometry:n,material:s,groupOrder:r,renderOrder:i.renderOrder,z:a,group:o},t[e]=l):(l.id=i.id,l.object=i,l.geometry=n,l.material=s,l.groupOrder=r,l.renderOrder=i.renderOrder,l.z=a,l.group=o),e++,l}return{opaque:i,transmissive:n,transparent:s,init:function(){e=0,i.length=0,n.length=0,s.length=0},push:function(t,e,a,o,l,c){const h=r(t,e,a,o,l,c);a.transmission>0?n.push(h):!0===a.transparent?s.push(h):i.push(h)},unshift:function(t,e,a,o,l,c){const h=r(t,e,a,o,l,c);a.transmission>0?n.unshift(h):!0===a.transparent?s.unshift(h):i.unshift(h)},finish:function(){for(let i=e,n=t.length;i<n;i++){const e=t[i];if(null===e.id)break;e.id=null,e.object=null,e.geometry=null,e.material=null,e.group=null}},sort:function(t,e){i.length>1&&i.sort(t||ia),n.length>1&&n.sort(e||na),s.length>1&&s.sort(e||na)}}}function ra(){let t=new WeakMap;return{get:function(e,i){const n=t.get(e);let s;return void 0===n?(s=new sa,t.set(e,[s])):i>=n.length?(s=new sa,n.push(s)):s=n[i],s},dispose:function(){t=new WeakMap}}}function aa(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":i={direction:new Ae,color:new Gi};break;case"SpotLight":i={position:new Ae,direction:new Ae,color:new Gi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new Ae,color:new Gi,distance:0,decay:0};break;case"HemisphereLight":i={direction:new Ae,skyColor:new Gi,groundColor:new Gi};break;case"RectAreaLight":i={color:new Gi,position:new Ae,halfWidth:new Ae,halfHeight:new Ae}}return t[e.id]=i,i}}}let oa=0;function la(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function ca(t,e){const i=new aa,n=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Yt};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Yt,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}}(),s={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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};for(let t=0;t<9;t++)s.probe.push(new Ae);const r=new Ae,a=new Je,o=new Je;return{setup:function(r,a){let o=0,l=0,c=0;for(let t=0;t<9;t++)s.probe[t].set(0,0,0);let h=0,d=0,u=0,p=0,m=0,f=0,g=0,v=0,_=0,y=0;r.sort(la);const x=!0===a?Math.PI:1;for(let t=0,e=r.length;t<e;t++){const e=r[t],a=e.color,A=e.intensity,w=e.distance,b=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)o+=a.r*A*x,l+=a.g*A*x,c+=a.b*A*x;else if(e.isLightProbe)for(let t=0;t<9;t++)s.probe[t].addScaledVector(e.sh.coefficients[t],A);else if(e.isDirectionalLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*x),e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,s.directionalShadow[h]=i,s.directionalShadowMap[h]=b,s.directionalShadowMatrix[h]=e.shadow.matrix,f++}s.directional[h]=t,h++}else if(e.isSpotLight){const t=i.get(e);t.position.setFromMatrixPosition(e.matrixWorld),t.color.copy(a).multiplyScalar(A*x),t.distance=w,t.coneCos=Math.cos(e.angle),t.penumbraCos=Math.cos(e.angle*(1-e.penumbra)),t.decay=e.decay,s.spot[u]=t;const r=e.shadow;if(e.map&&(s.spotLightMap[_]=e.map,_++,r.updateMatrices(e),e.castShadow&&y++),s.spotLightMatrix[u]=r.matrix,e.castShadow){const t=n.get(e);t.shadowBias=r.bias,t.shadowNormalBias=r.normalBias,t.shadowRadius=r.radius,t.shadowMapSize=r.mapSize,s.spotShadow[u]=t,s.spotShadowMap[u]=b,v++}u++}else if(e.isRectAreaLight){const t=i.get(e);t.color.copy(a).multiplyScalar(A),t.halfWidth.set(.5*e.width,0,0),t.halfHeight.set(0,.5*e.height,0),s.rectArea[p]=t,p++}else if(e.isPointLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*x),t.distance=e.distance,t.decay=e.decay,e.castShadow){const t=e.shadow,i=n.get(e);i.shadowBias=t.bias,i.shadowNormalBias=t.normalBias,i.shadowRadius=t.radius,i.shadowMapSize=t.mapSize,i.shadowCameraNear=t.camera.near,i.shadowCameraFar=t.camera.far,s.pointShadow[d]=i,s.pointShadowMap[d]=b,s.pointShadowMatrix[d]=e.shadow.matrix,g++}s.point[d]=t,d++}else if(e.isHemisphereLight){const t=i.get(e);t.skyColor.copy(e.color).multiplyScalar(A*x),t.groundColor.copy(e.groundColor).multiplyScalar(A*x),s.hemi[m]=t,m++}}p>0&&(e.isWebGL2||!0===t.has("OES_texture_float_linear")?(s.rectAreaLTC1=Kn.LTC_FLOAT_1,s.rectAreaLTC2=Kn.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(s.rectAreaLTC1=Kn.LTC_HALF_1,s.rectAreaLTC2=Kn.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=o,s.ambient[1]=l,s.ambient[2]=c;const A=s.hash;A.directionalLength===h&&A.pointLength===d&&A.spotLength===u&&A.rectAreaLength===p&&A.hemiLength===m&&A.numDirectionalShadows===f&&A.numPointShadows===g&&A.numSpotShadows===v&&A.numSpotMaps===_||(s.directional.length=h,s.spot.length=u,s.rectArea.length=p,s.point.length=d,s.hemi.length=m,s.directionalShadow.length=f,s.directionalShadowMap.length=f,s.pointShadow.length=g,s.pointShadowMap.length=g,s.spotShadow.length=v,s.spotShadowMap.length=v,s.directionalShadowMatrix.length=f,s.pointShadowMatrix.length=g,s.spotLightMatrix.length=v+_-y,s.spotLightMap.length=_,s.numSpotLightShadowsWithMaps=y,A.directionalLength=h,A.pointLength=d,A.spotLength=u,A.rectAreaLength=p,A.hemiLength=m,A.numDirectionalShadows=f,A.numPointShadows=g,A.numSpotShadows=v,A.numSpotMaps=_,s.version=oa++)},setupView:function(t,e){let i=0,n=0,l=0,c=0,h=0;const d=e.matrixWorldInverse;for(let e=0,u=t.length;e<u;e++){const u=t[e];if(u.isDirectionalLight){const t=s.directional[i];t.direction.setFromMatrixPosition(u.matrixWorld),r.setFromMatrixPosition(u.target.matrixWorld),t.direction.sub(r),t.direction.transformDirection(d),i++}else if(u.isSpotLight){const t=s.spot[l];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),t.direction.setFromMatrixPosition(u.matrixWorld),r.setFromMatrixPosition(u.target.matrixWorld),t.direction.sub(r),t.direction.transformDirection(d),l++}else if(u.isRectAreaLight){const t=s.rectArea[c];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),o.identity(),a.copy(u.matrixWorld),a.premultiply(d),o.extractRotation(a),t.halfWidth.set(.5*u.width,0,0),t.halfHeight.set(0,.5*u.height,0),t.halfWidth.applyMatrix4(o),t.halfHeight.applyMatrix4(o),c++}else if(u.isPointLight){const t=s.point[n];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),n++}else if(u.isHemisphereLight){const t=s.hemi[h];t.direction.setFromMatrixPosition(u.matrixWorld),t.direction.transformDirection(d),h++}}},state:s}}function ha(t,e){const i=new ca(t,e),n=[],s=[];return{init:function(){n.length=0,s.length=0},state:{lightsArray:n,shadowsArray:s,lights:i},setupLights:function(t){i.setup(n,t)},setupLightsView:function(t){i.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){s.push(t)}}}function da(t,e){let i=new WeakMap;return{get:function(n,s=0){const r=i.get(n);let a;return void 0===r?(a=new ha(t,e),i.set(n,[a])):s>=r.length?(a=new ha(t,e),r.push(a)):a=r[s],a},dispose:function(){i=new WeakMap}}}class ua extends Ui{constructor(t){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(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class pa extends Ui{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}function ma(t,e,i){let s=new qn;const l=new Yt,c=new Yt,h=new ge,d=new ua({depthPacking:3201}),u=new pa,p={},m=i.maxTextureSize,f={[a]:o,[o]:a,2:2},g=new Bn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Yt},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),v=g.clone();v.defines.HORIZONTAL_PASS=1;const _=new cn;_.setAttribute("position",new Ji(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new Cn(_,g),x=this;function A(i,n){const s=e.update(y);g.defines.VSM_SAMPLES!==i.blurSamples&&(g.defines.VSM_SAMPLES=i.blurSamples,v.defines.VSM_SAMPLES=i.blurSamples,g.needsUpdate=!0,v.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new ve(l.x,l.y)),g.uniforms.shadow_pass.value=i.map.texture,g.uniforms.resolution.value=i.mapSize,g.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,s,g,y,null),v.uniforms.shadow_pass.value=i.mapPass.texture,v.uniforms.resolution.value=i.mapSize,v.uniforms.radius.value=i.radius,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,s,v,y,null)}function w(e,i,n,s){let a=null;const o=!0===n.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==o)a=o;else if(a=!0===n.isPointLight?u:d,t.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0||i.map&&i.alphaTest>0){const t=a.uuid,e=i.uuid;let n=p[t];void 0===n&&(n={},p[t]=n);let s=n[e];void 0===s&&(s=a.clone(),n[e]=s),a=s}if(a.visible=i.visible,a.wireframe=i.wireframe,a.side=s===r?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:f[i.side],a.alphaMap=i.alphaMap,a.alphaTest=i.alphaTest,a.map=i.map,a.clipShadows=i.clipShadows,a.clippingPlanes=i.clippingPlanes,a.clipIntersection=i.clipIntersection,a.displacementMap=i.displacementMap,a.displacementScale=i.displacementScale,a.displacementBias=i.displacementBias,a.wireframeLinewidth=i.wireframeLinewidth,a.linewidth=i.linewidth,!0===n.isPointLight&&!0===a.isMeshDistanceMaterial){t.properties.get(a).light=n}return a}function b(i,n,a,o,l){if(!1===i.visible)return;if(i.layers.test(n.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&l===r)&&(!i.frustumCulled||s.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,i.matrixWorld);const n=e.update(i),s=i.material;if(Array.isArray(s)){const e=n.groups;for(let r=0,c=e.length;r<c;r++){const c=e[r],h=s[c.materialIndex];if(h&&h.visible){const e=w(i,h,o,l);t.renderBufferDirect(a,null,n,e,i,c)}}}else if(s.visible){const e=w(i,s,o,l);t.renderBufferDirect(a,null,n,e,i,null)}}const c=i.children;for(let t=0,e=c.length;t<e;t++)b(c[t],n,a,o,l)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=n,this.render=function(e,i,n){if(!1===x.enabled)return;if(!1===x.autoUpdate&&!1===x.needsUpdate)return;if(0===e.length)return;const a=t.getRenderTarget(),o=t.getActiveCubeFace(),d=t.getActiveMipmapLevel(),u=t.state;u.setBlending(0),u.buffers.color.setClear(1,1,1,1),u.buffers.depth.setTest(!0),u.setScissorTest(!1);for(let a=0,o=e.length;a<o;a++){const o=e[a],d=o.shadow;if(void 0===d){console.warn("THREE.WebGLShadowMap:",o,"has no shadow.");continue}if(!1===d.autoUpdate&&!1===d.needsUpdate)continue;l.copy(d.mapSize);const p=d.getFrameExtents();if(l.multiply(p),c.copy(d.mapSize),(l.x>m||l.y>m)&&(l.x>m&&(c.x=Math.floor(m/p.x),l.x=c.x*p.x,d.mapSize.x=c.x),l.y>m&&(c.y=Math.floor(m/p.y),l.y=c.y*p.y,d.mapSize.y=c.y)),null===d.map){const t=this.type!==r?{minFilter:C,magFilter:C}:{};d.map=new ve(l.x,l.y,t),d.map.texture.name=o.name+".shadowMap",d.camera.updateProjectionMatrix()}t.setRenderTarget(d.map),t.clear();const f=d.getViewportCount();for(let t=0;t<f;t++){const e=d.getViewport(t);h.set(c.x*e.x,c.y*e.y,c.x*e.z,c.y*e.w),u.viewport(h),d.updateMatrices(o,t),s=d.getFrustum(),b(i,n,d.camera,o,this.type)}!0!==d.isPointLightShadow&&this.type===r&&A(d,n),d.needsUpdate=!1}x.needsUpdate=!1,t.setRenderTarget(a,o,d)}}function fa(t,e,i){const n=i.isWebGL2;const s=new function(){let e=!1;const i=new ge;let n=null;const s=new ge(0,0,0,0);return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,r,a,o){!0===o&&(e*=a,n*=a,r*=a),i.set(e,n,r,a),!1===s.equals(i)&&(t.clearColor(e,n,r,a),s.copy(i))},reset:function(){e=!1,n=null,s.set(-1,0,0,0)}}},r=new function(){let e=!1,i=null,n=null,s=null;return{setTest:function(t){t?H(2929):V(2929)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){switch(e){case 0:t.depthFunc(512);break;case 1:t.depthFunc(519);break;case 2:t.depthFunc(513);break;case 3:default:t.depthFunc(515);break;case 4:t.depthFunc(514);break;case 5:t.depthFunc(518);break;case 6:t.depthFunc(516);break;case 7:t.depthFunc(517)}n=e}},setLocked:function(t){e=t},setClear:function(e){s!==e&&(t.clearDepth(e),s=e)},reset:function(){e=!1,i=null,n=null,s=null}}},a=new function(){let e=!1,i=null,n=null,s=null,r=null,a=null,o=null,l=null,c=null;return{setTest:function(t){e||(t?H(2960):V(2960))},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,a){n===e&&s===i&&r===a||(t.stencilFunc(e,i,a),n=e,s=i,r=a)},setOp:function(e,i,n){a===e&&o===i&&l===n||(t.stencilOp(e,i,n),a=e,o=i,l=n)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,i=null,n=null,s=null,r=null,a=null,o=null,l=null,c=null}}},c=new WeakMap,h=new WeakMap;let d={},u={},p=new WeakMap,m=[],f=null,g=!1,v=null,_=null,y=null,x=null,A=null,w=null,b=null,M=!1,S=null,E=null,C=null,T=null,L=null;const k=t.getParameter(35661);let I=!1,P=0;const R=t.getParameter(7938);-1!==R.indexOf("WebGL")?(P=parseFloat(/^WebGL (\d)/.exec(R)[1]),I=P>=1):-1!==R.indexOf("OpenGL ES")&&(P=parseFloat(/^OpenGL ES (\d)/.exec(R)[1]),I=P>=2);let B=null,D={};const U=t.getParameter(3088),N=t.getParameter(2978),O=(new ge).fromArray(U),z=(new ge).fromArray(N);function F(e,i,n){const s=new Uint8Array(4),r=t.createTexture();t.bindTexture(e,r),t.texParameteri(e,10241,9728),t.texParameteri(e,10240,9728);for(let e=0;e<n;e++)t.texImage2D(i+e,0,6408,1,1,0,6408,5121,s);return r}const G={};function H(e){!0!==d[e]&&(t.enable(e),d[e]=!0)}function V(e){!1!==d[e]&&(t.disable(e),d[e]=!1)}G[3553]=F(3553,3553,1),G[34067]=F(34067,34069,6),s.setClear(0,0,0,1),r.setClear(1),a.setClear(0),H(2929),r.setFunc(3),q(!1),Z(1),H(2884),Q(0);const W={[l]:32774,101:32778,102:32779};if(n)W[103]=32775,W[104]=32776;else{const t=e.get("EXT_blend_minmax");null!==t&&(W[103]=t.MIN_EXT,W[104]=t.MAX_EXT)}const j={200:0,201:1,202:768,204:770,210:776,208:774,206:772,203:769,205:771,209:775,207:773};function Q(e,i,n,s,r,a,o,c){if(0!==e){if(!1===g&&(H(3042),g=!0),5===e)r=r||i,a=a||n,o=o||s,i===_&&r===A||(t.blendEquationSeparate(W[i],W[r]),_=i,A=r),n===y&&s===x&&a===w&&o===b||(t.blendFuncSeparate(j[n],j[s],j[a],j[o]),y=n,x=s,w=a,b=o),v=e,M=!1;else if(e!==v||c!==M){if(_===l&&A===l||(t.blendEquation(32774),_=l,A=l),c)switch(e){case 1:t.blendFuncSeparate(1,771,1,771);break;case 2:t.blendFunc(1,1);break;case 3:t.blendFuncSeparate(0,769,0,1);break;case 4:t.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(770,771,1,771);break;case 2:t.blendFunc(770,1);break;case 3:t.blendFuncSeparate(0,769,0,1);break;case 4:t.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}y=null,x=null,w=null,b=null,v=e,M=c}}else!0===g&&(V(3042),g=!1)}function q(e){S!==e&&(e?t.frontFace(2304):t.frontFace(2305),S=e)}function Z(e){0!==e?(H(2884),e!==E&&(1===e?t.cullFace(1029):2===e?t.cullFace(1028):t.cullFace(1032))):V(2884),E=e}function X(e,i,n){e?(H(32823),T===i&&L===n||(t.polygonOffset(i,n),T=i,L=n)):V(32823)}return{buffers:{color:s,depth:r,stencil:a},enable:H,disable:V,bindFramebuffer:function(e,i){return u[e]!==i&&(t.bindFramebuffer(e,i),u[e]=i,n&&(36009===e&&(u[36160]=i),36160===e&&(u[36009]=i)),!0)},drawBuffers:function(n,s){let r=m,a=!1;if(n)if(r=p.get(s),void 0===r&&(r=[],p.set(s,r)),n.isWebGLMultipleRenderTargets){const t=n.texture;if(r.length!==t.length||36064!==r[0]){for(let e=0,i=t.length;e<i;e++)r[e]=36064+e;r.length=t.length,a=!0}}else 36064!==r[0]&&(r[0]=36064,a=!0);else 1029!==r[0]&&(r[0]=1029,a=!0);a&&(i.isWebGL2?t.drawBuffers(r):e.get("WEBGL_draw_buffers").drawBuffersWEBGL(r))},useProgram:function(e){return f!==e&&(t.useProgram(e),f=e,!0)},setBlending:Q,setMaterial:function(t,e){2===t.side?V(2884):H(2884);let i=t.side===o;e&&(i=!i),q(i),1===t.blending&&!1===t.transparent?Q(0):Q(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.premultipliedAlpha),r.setFunc(t.depthFunc),r.setTest(t.depthTest),r.setMask(t.depthWrite),s.setMask(t.colorWrite);const n=t.stencilWrite;a.setTest(n),n&&(a.setMask(t.stencilWriteMask),a.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),a.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),X(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?H(32926):V(32926)},setFlipSided:q,setCullFace:Z,setLineWidth:function(e){e!==C&&(I&&t.lineWidth(e),C=e)},setPolygonOffset:X,setScissorTest:function(t){t?H(3089):V(3089)},activeTexture:function(e){void 0===e&&(e=33984+k-1),B!==e&&(t.activeTexture(e),B=e)},bindTexture:function(e,i,n){void 0===n&&(n=null===B?33984+k-1:B);let s=D[n];void 0===s&&(s={type:void 0,texture:void 0},D[n]=s),s.type===e&&s.texture===i||(B!==n&&(t.activeTexture(n),B=n),t.bindTexture(e,i||G[e]),s.type=e,s.texture=i)},unbindTexture:function(){const e=D[B];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexImage3D:function(){try{t.compressedTexImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},updateUBOMapping:function(e,i){let n=h.get(i);void 0===n&&(n=new WeakMap,h.set(i,n));let s=n.get(e);void 0===s&&(s=t.getUniformBlockIndex(i,e.name),n.set(e,s))},uniformBlockBinding:function(e,i){const n=h.get(i).get(e);c.get(i)!==n&&(t.uniformBlockBinding(i,n,e.__bindingPointIndex),c.set(i,n))},texStorage2D:function(){try{t.texStorage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage3D:function(){try{t.texStorage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage2D:function(){try{t.texSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage3D:function(){try{t.texSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage3D:function(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===O.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),O.copy(e))},viewport:function(e){!1===z.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),z.copy(e))},reset:function(){t.disable(3042),t.disable(2884),t.disable(2929),t.disable(32823),t.disable(3089),t.disable(2960),t.disable(32926),t.blendEquation(32774),t.blendFunc(1,0),t.blendFuncSeparate(1,0,1,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(513),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(519,0,4294967295),t.stencilOp(7680,7680,7680),t.clearStencil(0),t.cullFace(1029),t.frontFace(2305),t.polygonOffset(0,0),t.activeTexture(33984),t.bindFramebuffer(36160,null),!0===n&&(t.bindFramebuffer(36009,null),t.bindFramebuffer(36008,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),d={},B=null,D={},u={},p=new WeakMap,m=[],f=null,g=!1,v=null,_=null,y=null,x=null,A=null,w=null,b=null,M=!1,S=null,E=null,C=null,T=null,L=null,O.set(0,0,t.canvas.width,t.canvas.height),z.set(0,0,t.canvas.width,t.canvas.height),s.reset(),r.reset(),a.reset()}}}function ga(t,e,i,n,s,r,a){const o=s.isWebGL2,l=s.maxTextures,c=s.maxCubemapSize,h=s.maxTextureSize,d=s.maxSamples,u=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,p="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),m=new WeakMap;let f;const g=new WeakMap;let v=!1;try{v="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function _(t,e){return v?new OffscreenCanvas(t,e):ie("canvas")}function y(t,e,i,n){let s=1;if((t.width>n||t.height>n)&&(s=n/Math.max(t.width,t.height)),s<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const n=e?Qt:Math.floor,r=n(s*t.width),a=n(s*t.height);void 0===f&&(f=_(r,a));const o=i?_(r,a):f;o.width=r,o.height=a;return o.getContext("2d").drawImage(t,0,0,r,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+r+"x"+a+")."),o}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function x(t){return Wt(t.width)&&Wt(t.height)}function A(t,e){return t.generateMipmaps&&e&&t.minFilter!==C&&t.minFilter!==k}function w(e){t.generateMipmap(e)}function b(i,n,s,r,a=!1){if(!1===o)return n;if(null!==i){if(void 0!==t[i])return t[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let l=n;return 6403===n&&(5126===s&&(l=33326),5131===s&&(l=33325),5121===s&&(l=33321)),33319===n&&(5126===s&&(l=33328),5131===s&&(l=33327),5121===s&&(l=33323)),6408===n&&(5126===s&&(l=34836),5131===s&&(l=34842),5121===s&&(l=r===Ct&&!1===a?35907:32856),32819===s&&(l=32854),32820===s&&(l=32855)),33325!==l&&33326!==l&&33327!==l&&33328!==l&&34842!==l&&34836!==l||e.get("EXT_color_buffer_float"),l}function H(t,e,i){return!0===A(t,i)||t.isFramebufferTexture&&t.minFilter!==C&&t.minFilter!==k?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function V(t){return t===C||t===T||t===L?9728:9729}function W(t){const e=t.target;e.removeEventListener("dispose",W),function(t){const e=n.get(t);if(void 0===e.__webglInit)return;const i=t.source,s=g.get(i);if(s){const n=s[e.__cacheKey];n.usedTimes--,0===n.usedTimes&&Q(t),0===Object.keys(s).length&&g.delete(i)}n.remove(t)}(e),e.isVideoTexture&&m.delete(e)}function j(e){const i=e.target;i.removeEventListener("dispose",j),function(e){const i=e.texture,s=n.get(e),r=n.get(i);void 0!==r.__webglTexture&&(t.deleteTexture(r.__webglTexture),a.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++)t.deleteFramebuffer(s.__webglFramebuffer[e]),s.__webglDepthbuffer&&t.deleteRenderbuffer(s.__webglDepthbuffer[e]);else{if(t.deleteFramebuffer(s.__webglFramebuffer),s.__webglDepthbuffer&&t.deleteRenderbuffer(s.__webglDepthbuffer),s.__webglMultisampledFramebuffer&&t.deleteFramebuffer(s.__webglMultisampledFramebuffer),s.__webglColorRenderbuffer)for(let e=0;e<s.__webglColorRenderbuffer.length;e++)s.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(s.__webglColorRenderbuffer[e]);s.__webglDepthRenderbuffer&&t.deleteRenderbuffer(s.__webglDepthRenderbuffer)}if(e.isWebGLMultipleRenderTargets)for(let e=0,s=i.length;e<s;e++){const s=n.get(i[e]);s.__webglTexture&&(t.deleteTexture(s.__webglTexture),a.memory.textures--),n.remove(i[e])}n.remove(i),n.remove(e)}(i)}function Q(e){const i=n.get(e);t.deleteTexture(i.__webglTexture);const s=e.source;delete g.get(s)[i.__cacheKey],a.memory.textures--}let q=0;function Z(t,e){const s=n.get(t);if(t.isVideoTexture&&function(t){const e=a.render.frame;m.get(t)!==e&&(m.set(t,e),t.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&s.__version!==t.version){const i=t.image;if(null===i)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==i.complete)return void $(s,t,e);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.bindTexture(3553,s.__webglTexture,33984+e)}const X={[M]:10497,[S]:33071,[E]:33648},Y={[C]:9728,[T]:9984,[L]:9986,[k]:9729,[I]:9985,[P]:9987};function J(i,r,a){if(a?(t.texParameteri(i,10242,X[r.wrapS]),t.texParameteri(i,10243,X[r.wrapT]),32879!==i&&35866!==i||t.texParameteri(i,32882,X[r.wrapR]),t.texParameteri(i,10240,Y[r.magFilter]),t.texParameteri(i,10241,Y[r.minFilter])):(t.texParameteri(i,10242,33071),t.texParameteri(i,10243,33071),32879!==i&&35866!==i||t.texParameteri(i,32882,33071),r.wrapS===S&&r.wrapT===S||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(i,10240,V(r.magFilter)),t.texParameteri(i,10241,V(r.minFilter)),r.minFilter!==C&&r.minFilter!==k&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),!0===e.has("EXT_texture_filter_anisotropic")){const a=e.get("EXT_texture_filter_anisotropic");if(r.magFilter===C)return;if(r.minFilter!==L&&r.minFilter!==P)return;if(r.type===U&&!1===e.has("OES_texture_float_linear"))return;if(!1===o&&r.type===N&&!1===e.has("OES_texture_half_float_linear"))return;(r.anisotropy>1||n.get(r).__currentAnisotropy)&&(t.texParameterf(i,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(r.anisotropy,s.getMaxAnisotropy())),n.get(r).__currentAnisotropy=r.anisotropy)}}function K(e,i){let n=!1;void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",W));const s=i.source;let r=g.get(s);void 0===r&&(r={},g.set(s,r));const o=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.encoding),e.join()}(i);if(o!==e.__cacheKey){void 0===r[o]&&(r[o]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,n=!0),r[o].usedTimes++;const s=r[e.__cacheKey];void 0!==s&&(r[e.__cacheKey].usedTimes--,0===s.usedTimes&&Q(i)),e.__cacheKey=o,e.__webglTexture=r[o].texture}return n}function $(e,s,a){let l=3553;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=35866),s.isData3DTexture&&(l=32879);const c=K(e,s),d=s.source;i.bindTexture(l,e.__webglTexture,33984+a);const u=n.get(d);if(d.version!==u.__version||!0===c){i.activeTexture(33984+a),t.pixelStorei(37440,s.flipY),t.pixelStorei(37441,s.premultiplyAlpha),t.pixelStorei(3317,s.unpackAlignment),t.pixelStorei(37443,0);const e=function(t){return!o&&(t.wrapS!==S||t.wrapT!==S||t.minFilter!==C&&t.minFilter!==k)}(s)&&!1===x(s.image);let n=y(s.image,e,!1,h);n=rt(s,n);const p=x(n)||o,m=r.convert(s.format,s.encoding);let f,g=r.convert(s.type),v=b(s.internalFormat,m,g,s.encoding,s.isVideoTexture);J(l,s,p);const _=s.mipmaps,M=o&&!0!==s.isVideoTexture,E=void 0===u.__version||!0===c,T=H(s,n,p);if(s.isDepthTexture)v=6402,o?v=s.type===U?36012:s.type===D?33190:s.type===O?35056:33189:s.type===U&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),s.format===F&&6402===v&&s.type!==B&&s.type!==D&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),s.type=D,g=r.convert(s.type)),s.format===G&&6402===v&&(v=34041,s.type!==O&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),s.type=O,g=r.convert(s.type))),E&&(M?i.texStorage2D(3553,1,v,n.width,n.height):i.texImage2D(3553,0,v,n.width,n.height,0,m,g,null));else if(s.isDataTexture)if(_.length>0&&p){M&&E&&i.texStorage2D(3553,T,v,_[0].width,_[0].height);for(let t=0,e=_.length;t<e;t++)f=_[t],M?i.texSubImage2D(3553,t,0,0,f.width,f.height,m,g,f.data):i.texImage2D(3553,t,v,f.width,f.height,0,m,g,f.data);s.generateMipmaps=!1}else M?(E&&i.texStorage2D(3553,T,v,n.width,n.height),i.texSubImage2D(3553,0,0,0,n.width,n.height,m,g,n.data)):i.texImage2D(3553,0,v,n.width,n.height,0,m,g,n.data);else if(s.isCompressedTexture)if(s.isCompressedArrayTexture){M&&E&&i.texStorage3D(35866,T,v,_[0].width,_[0].height,n.depth);for(let t=0,e=_.length;t<e;t++)f=_[t],s.format!==z?null!==m?M?i.compressedTexSubImage3D(35866,t,0,0,0,f.width,f.height,n.depth,m,f.data,0,0):i.compressedTexImage3D(35866,t,v,f.width,f.height,n.depth,0,f.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):M?i.texSubImage3D(35866,t,0,0,0,f.width,f.height,n.depth,m,g,f.data):i.texImage3D(35866,t,v,f.width,f.height,n.depth,0,m,g,f.data)}else{M&&E&&i.texStorage2D(3553,T,v,_[0].width,_[0].height);for(let t=0,e=_.length;t<e;t++)f=_[t],s.format!==z?null!==m?M?i.compressedTexSubImage2D(3553,t,0,0,f.width,f.height,m,f.data):i.compressedTexImage2D(3553,t,v,f.width,f.height,0,f.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):M?i.texSubImage2D(3553,t,0,0,f.width,f.height,m,g,f.data):i.texImage2D(3553,t,v,f.width,f.height,0,m,g,f.data)}else if(s.isDataArrayTexture)M?(E&&i.texStorage3D(35866,T,v,n.width,n.height,n.depth),i.texSubImage3D(35866,0,0,0,0,n.width,n.height,n.depth,m,g,n.data)):i.texImage3D(35866,0,v,n.width,n.height,n.depth,0,m,g,n.data);else if(s.isData3DTexture)M?(E&&i.texStorage3D(32879,T,v,n.width,n.height,n.depth),i.texSubImage3D(32879,0,0,0,0,n.width,n.height,n.depth,m,g,n.data)):i.texImage3D(32879,0,v,n.width,n.height,n.depth,0,m,g,n.data);else if(s.isFramebufferTexture){if(E)if(M)i.texStorage2D(3553,T,v,n.width,n.height);else{let t=n.width,e=n.height;for(let n=0;n<T;n++)i.texImage2D(3553,n,v,t,e,0,m,g,null),t>>=1,e>>=1}}else if(_.length>0&&p){M&&E&&i.texStorage2D(3553,T,v,_[0].width,_[0].height);for(let t=0,e=_.length;t<e;t++)f=_[t],M?i.texSubImage2D(3553,t,0,0,m,g,f):i.texImage2D(3553,t,v,m,g,f);s.generateMipmaps=!1}else M?(E&&i.texStorage2D(3553,T,v,n.width,n.height),i.texSubImage2D(3553,0,0,0,m,g,n)):i.texImage2D(3553,0,v,m,g,n);A(s,p)&&w(l),u.__version=d.version,s.onUpdate&&s.onUpdate(s)}e.__version=s.version}function tt(e,s,a,o,l){const c=r.convert(a.format,a.encoding),h=r.convert(a.type),d=b(a.internalFormat,c,h,a.encoding);n.get(s).__hasExternalTextures||(32879===l||35866===l?i.texImage3D(l,0,d,s.width,s.height,s.depth,0,c,h,null):i.texImage2D(l,0,d,s.width,s.height,0,c,h,null)),i.bindFramebuffer(36160,e),st(s)?u.framebufferTexture2DMultisampleEXT(36160,o,l,n.get(a).__webglTexture,0,nt(s)):(3553===l||l>=34069&&l<=34074)&&t.framebufferTexture2D(36160,o,l,n.get(a).__webglTexture,0),i.bindFramebuffer(36160,null)}function et(e,i,n){if(t.bindRenderbuffer(36161,e),i.depthBuffer&&!i.stencilBuffer){let s=33189;if(n||st(i)){const e=i.depthTexture;e&&e.isDepthTexture&&(e.type===U?s=36012:e.type===D&&(s=33190));const n=nt(i);st(i)?u.renderbufferStorageMultisampleEXT(36161,n,s,i.width,i.height):t.renderbufferStorageMultisample(36161,n,s,i.width,i.height)}else t.renderbufferStorage(36161,s,i.width,i.height);t.framebufferRenderbuffer(36160,36096,36161,e)}else if(i.depthBuffer&&i.stencilBuffer){const s=nt(i);n&&!1===st(i)?t.renderbufferStorageMultisample(36161,s,35056,i.width,i.height):st(i)?u.renderbufferStorageMultisampleEXT(36161,s,35056,i.width,i.height):t.renderbufferStorage(36161,34041,i.width,i.height),t.framebufferRenderbuffer(36160,33306,36161,e)}else{const e=!0===i.isWebGLMultipleRenderTargets?i.texture:[i.texture];for(let s=0;s<e.length;s++){const a=e[s],o=r.convert(a.format,a.encoding),l=r.convert(a.type),c=b(a.internalFormat,o,l,a.encoding),h=nt(i);n&&!1===st(i)?t.renderbufferStorageMultisample(36161,h,c,i.width,i.height):st(i)?u.renderbufferStorageMultisampleEXT(36161,h,c,i.width,i.height):t.renderbufferStorage(36161,c,i.width,i.height)}}t.bindRenderbuffer(36161,null)}function it(e){const s=n.get(e),r=!0===e.isWebGLCubeRenderTarget;if(e.depthTexture&&!s.__autoAllocateDepthBuffer){if(r)throw new Error("target.depthTexture not supported in Cube render targets");!function(e,s){if(s&&s.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(36160,e),!s.depthTexture||!s.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(s.depthTexture).__webglTexture&&s.depthTexture.image.width===s.width&&s.depthTexture.image.height===s.height||(s.depthTexture.image.width=s.width,s.depthTexture.image.height=s.height,s.depthTexture.needsUpdate=!0),Z(s.depthTexture,0);const r=n.get(s.depthTexture).__webglTexture,a=nt(s);if(s.depthTexture.format===F)st(s)?u.framebufferTexture2DMultisampleEXT(36160,36096,3553,r,0,a):t.framebufferTexture2D(36160,36096,3553,r,0);else{if(s.depthTexture.format!==G)throw new Error("Unknown depthTexture format");st(s)?u.framebufferTexture2DMultisampleEXT(36160,33306,3553,r,0,a):t.framebufferTexture2D(36160,33306,3553,r,0)}}(s.__webglFramebuffer,e)}else if(r){s.__webglDepthbuffer=[];for(let n=0;n<6;n++)i.bindFramebuffer(36160,s.__webglFramebuffer[n]),s.__webglDepthbuffer[n]=t.createRenderbuffer(),et(s.__webglDepthbuffer[n],e,!1)}else i.bindFramebuffer(36160,s.__webglFramebuffer),s.__webglDepthbuffer=t.createRenderbuffer(),et(s.__webglDepthbuffer,e,!1);i.bindFramebuffer(36160,null)}function nt(t){return Math.min(d,t.samples)}function st(t){const i=n.get(t);return o&&t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function rt(t,i){const n=t.encoding,s=t.format,r=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||t.format===Bt||n!==Et&&(n===Ct?!1===o?!0===e.has("EXT_sRGB")&&s===z?(t.format=Bt,t.minFilter=k,t.generateMipmaps=!1):i=de.sRGBToLinear(i):s===z&&r===R||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",n)),i}this.allocateTextureUnit=function(){const t=q;return t>=l&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+l),q+=1,t},this.resetTextureUnits=function(){q=0},this.setTexture2D=Z,this.setTexture2DArray=function(t,e){const s=n.get(t);t.version>0&&s.__version!==t.version?$(s,t,e):i.bindTexture(35866,s.__webglTexture,33984+e)},this.setTexture3D=function(t,e){const s=n.get(t);t.version>0&&s.__version!==t.version?$(s,t,e):i.bindTexture(32879,s.__webglTexture,33984+e)},this.setTextureCube=function(e,s){const a=n.get(e);e.version>0&&a.__version!==e.version?function(e,s,a){if(6!==s.image.length)return;const l=K(e,s),h=s.source;i.bindTexture(34067,e.__webglTexture,33984+a);const d=n.get(h);if(h.version!==d.__version||!0===l){i.activeTexture(33984+a),t.pixelStorei(37440,s.flipY),t.pixelStorei(37441,s.premultiplyAlpha),t.pixelStorei(3317,s.unpackAlignment),t.pixelStorei(37443,0);const e=s.isCompressedTexture||s.image[0].isCompressedTexture,n=s.image[0]&&s.image[0].isDataTexture,u=[];for(let t=0;t<6;t++)u[t]=e||n?n?s.image[t].image:s.image[t]:y(s.image[t],!1,!0,c),u[t]=rt(s,u[t]);const p=u[0],m=x(p)||o,f=r.convert(s.format,s.encoding),g=r.convert(s.type),v=b(s.internalFormat,f,g,s.encoding),_=o&&!0!==s.isVideoTexture,M=void 0===d.__version||!0===l;let S,E=H(s,p,m);if(J(34067,s,m),e){_&&M&&i.texStorage2D(34067,E,v,p.width,p.height);for(let t=0;t<6;t++){S=u[t].mipmaps;for(let e=0;e<S.length;e++){const n=S[e];s.format!==z?null!==f?_?i.compressedTexSubImage2D(34069+t,e,0,0,n.width,n.height,f,n.data):i.compressedTexImage2D(34069+t,e,v,n.width,n.height,0,n.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):_?i.texSubImage2D(34069+t,e,0,0,n.width,n.height,f,g,n.data):i.texImage2D(34069+t,e,v,n.width,n.height,0,f,g,n.data)}}}else{S=s.mipmaps,_&&M&&(S.length>0&&E++,i.texStorage2D(34067,E,v,u[0].width,u[0].height));for(let t=0;t<6;t++)if(n){_?i.texSubImage2D(34069+t,0,0,0,u[t].width,u[t].height,f,g,u[t].data):i.texImage2D(34069+t,0,v,u[t].width,u[t].height,0,f,g,u[t].data);for(let e=0;e<S.length;e++){const n=S[e].image[t].image;_?i.texSubImage2D(34069+t,e+1,0,0,n.width,n.height,f,g,n.data):i.texImage2D(34069+t,e+1,v,n.width,n.height,0,f,g,n.data)}}else{_?i.texSubImage2D(34069+t,0,0,0,f,g,u[t]):i.texImage2D(34069+t,0,v,f,g,u[t]);for(let e=0;e<S.length;e++){const n=S[e];_?i.texSubImage2D(34069+t,e+1,0,0,f,g,n.image[t]):i.texImage2D(34069+t,e+1,v,f,g,n.image[t])}}}A(s,m)&&w(34067),d.__version=h.version,s.onUpdate&&s.onUpdate(s)}e.__version=s.version}(a,e,s):i.bindTexture(34067,a.__webglTexture,33984+s)},this.rebindTextures=function(t,e,i){const s=n.get(t);void 0!==e&&tt(s.__webglFramebuffer,t,t.texture,36064,3553),void 0!==i&&it(t)},this.setupRenderTarget=function(e){const l=e.texture,c=n.get(e),h=n.get(l);e.addEventListener("dispose",j),!0!==e.isWebGLMultipleRenderTargets&&(void 0===h.__webglTexture&&(h.__webglTexture=t.createTexture()),h.__version=l.version,a.memory.textures++);const d=!0===e.isWebGLCubeRenderTarget,u=!0===e.isWebGLMultipleRenderTargets,p=x(e)||o;if(d){c.__webglFramebuffer=[];for(let e=0;e<6;e++)c.__webglFramebuffer[e]=t.createFramebuffer()}else{if(c.__webglFramebuffer=t.createFramebuffer(),u)if(s.drawBuffers){const i=e.texture;for(let e=0,s=i.length;e<s;e++){const s=n.get(i[e]);void 0===s.__webglTexture&&(s.__webglTexture=t.createTexture(),a.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(o&&e.samples>0&&!1===st(e)){const n=u?l:[l];c.__webglMultisampledFramebuffer=t.createFramebuffer(),c.__webglColorRenderbuffer=[],i.bindFramebuffer(36160,c.__webglMultisampledFramebuffer);for(let i=0;i<n.length;i++){const s=n[i];c.__webglColorRenderbuffer[i]=t.createRenderbuffer(),t.bindRenderbuffer(36161,c.__webglColorRenderbuffer[i]);const a=r.convert(s.format,s.encoding),o=r.convert(s.type),l=b(s.internalFormat,a,o,s.encoding,!0===e.isXRRenderTarget),h=nt(e);t.renderbufferStorageMultisample(36161,h,l,e.width,e.height),t.framebufferRenderbuffer(36160,36064+i,36161,c.__webglColorRenderbuffer[i])}t.bindRenderbuffer(36161,null),e.depthBuffer&&(c.__webglDepthRenderbuffer=t.createRenderbuffer(),et(c.__webglDepthRenderbuffer,e,!0)),i.bindFramebuffer(36160,null)}}if(d){i.bindTexture(34067,h.__webglTexture),J(34067,l,p);for(let t=0;t<6;t++)tt(c.__webglFramebuffer[t],e,l,36064,34069+t);A(l,p)&&w(34067),i.unbindTexture()}else if(u){const t=e.texture;for(let s=0,r=t.length;s<r;s++){const r=t[s],a=n.get(r);i.bindTexture(3553,a.__webglTexture),J(3553,r,p),tt(c.__webglFramebuffer,e,r,36064+s,3553),A(r,p)&&w(3553)}i.unbindTexture()}else{let t=3553;(e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(o?t=e.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),i.bindTexture(t,h.__webglTexture),J(t,l,p),tt(c.__webglFramebuffer,e,l,36064,t),A(l,p)&&w(t),i.unbindTexture()}e.depthBuffer&&it(e)},this.updateRenderTargetMipmap=function(t){const e=x(t)||o,s=!0===t.isWebGLMultipleRenderTargets?t.texture:[t.texture];for(let r=0,a=s.length;r<a;r++){const a=s[r];if(A(a,e)){const e=t.isWebGLCubeRenderTarget?34067:3553,s=n.get(a).__webglTexture;i.bindTexture(e,s),w(e),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(o&&e.samples>0&&!1===st(e)){const s=e.isWebGLMultipleRenderTargets?e.texture:[e.texture],r=e.width,a=e.height;let o=16384;const l=[],c=e.stencilBuffer?33306:36096,h=n.get(e),d=!0===e.isWebGLMultipleRenderTargets;if(d)for(let e=0;e<s.length;e++)i.bindFramebuffer(36160,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064+e,36161,null),i.bindFramebuffer(36160,h.__webglFramebuffer),t.framebufferTexture2D(36009,36064+e,3553,null,0);i.bindFramebuffer(36008,h.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,h.__webglFramebuffer);for(let i=0;i<s.length;i++){l.push(36064+i),e.depthBuffer&&l.push(c);const u=void 0!==h.__ignoreDepthValues&&h.__ignoreDepthValues;if(!1===u&&(e.depthBuffer&&(o|=256),e.stencilBuffer&&(o|=1024)),d&&t.framebufferRenderbuffer(36008,36064,36161,h.__webglColorRenderbuffer[i]),!0===u&&(t.invalidateFramebuffer(36008,[c]),t.invalidateFramebuffer(36009,[c])),d){const e=n.get(s[i]).__webglTexture;t.framebufferTexture2D(36009,36064,3553,e,0)}t.blitFramebuffer(0,0,r,a,0,0,r,a,o,9728),p&&t.invalidateFramebuffer(36008,l)}if(i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,null),d)for(let e=0;e<s.length;e++){i.bindFramebuffer(36160,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(36160,36064+e,36161,h.__webglColorRenderbuffer[e]);const r=n.get(s[e]).__webglTexture;i.bindFramebuffer(36160,h.__webglFramebuffer),t.framebufferTexture2D(36009,36064+e,3553,r,0)}i.bindFramebuffer(36009,h.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=it,this.setupFrameBufferTexture=tt,this.useMultisampledRTT=st}function va(t,e,i){const n=i.isWebGL2;return{convert:function(i,s=null){let r;if(i===R)return 5121;if(1017===i)return 32819;if(1018===i)return 32820;if(1010===i)return 5120;if(1011===i)return 5122;if(i===B)return 5123;if(1013===i)return 5124;if(i===D)return 5125;if(i===U)return 5126;if(i===N)return n?5131:(r=e.get("OES_texture_half_float"),null!==r?r.HALF_FLOAT_OES:null);if(1021===i)return 6406;if(i===z)return 6408;if(1024===i)return 6409;if(1025===i)return 6410;if(i===F)return 6402;if(i===G)return 34041;if(i===Bt)return r=e.get("EXT_sRGB"),null!==r?r.SRGB_ALPHA_EXT:null;if(1028===i)return 6403;if(1029===i)return 36244;if(1030===i)return 33319;if(1031===i)return 33320;if(1033===i)return 36249;if(i===H||i===V||i===W||i===j)if(s===Ct){if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(i===H)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===V)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===W)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===j)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=e.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(i===H)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===V)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===W)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===j)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(i===Q||i===q||i===Z||i===X){if(r=e.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(i===Q)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===q)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Z)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===X)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===i)return r=e.get("WEBGL_compressed_texture_etc1"),null!==r?r.COMPRESSED_RGB_ETC1_WEBGL:null;if(i===Y||i===J){if(r=e.get("WEBGL_compressed_texture_etc"),null===r)return null;if(i===Y)return s===Ct?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(i===J)return s===Ct?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(i===K||i===$||i===tt||i===et||i===it||i===nt||i===st||i===rt||i===at||i===ot||i===lt||i===ct||i===ht||i===dt){if(r=e.get("WEBGL_compressed_texture_astc"),null===r)return null;if(i===K)return s===Ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===$)return s===Ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===tt)return s===Ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===et)return s===Ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===it)return s===Ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===nt)return s===Ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===st)return s===Ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===rt)return s===Ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===at)return s===Ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===ot)return s===Ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===lt)return s===Ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===ct)return s===Ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===ht)return s===Ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===dt)return s===Ct?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(i===ut){if(r=e.get("EXT_texture_compression_bptc"),null===r)return null;if(i===ut)return s===Ct?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT}if(36283===i||i===pt||i===mt||i===ft){if(r=e.get("EXT_texture_compression_rgtc"),null===r)return null;if(i===ut)return r.COMPRESSED_RED_RGTC1_EXT;if(i===pt)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===mt)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===ft)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return i===O?n?34042:(r=e.get("WEBGL_depth_texture"),null!==r?r.UNSIGNED_INT_24_8_WEBGL:null):void 0!==t[i]?t[i]:null}}}class _a extends Un{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class ya extends wi{constructor(){super(),this.isGroup=!0,this.type="Group"}}const xa={type:"move"};class Aa{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new ya,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new ya,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Ae,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Ae),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new ya,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Ae,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Ae),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let n=null,s=null,r=null;const a=this._targetRay,o=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(l&&t.hand){r=!0;for(const n of t.hand.values()){const t=e.getJointPose(n,i),s=this._getHandJoint(l,n);null!==t&&(s.matrix.fromArray(t.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.jointRadius=t.radius),s.visible=null!==t}const n=l.joints["index-finger-tip"],s=l.joints["thumb-tip"],a=n.position.distanceTo(s.position),o=.02,c=.005;l.inputState.pinching&&a>o+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&a<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(s=e.getPose(t.gripSpace,i),null!==s&&(o.matrix.fromArray(s.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),s.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(s.linearVelocity)):o.hasLinearVelocity=!1,s.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(s.angularVelocity)):o.hasAngularVelocity=!1));null!==a&&(n=e.getPose(t.targetRaySpace,i),null===n&&null!==s&&(n=s),null!==n&&(a.matrix.fromArray(n.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),n.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(n.linearVelocity)):a.hasLinearVelocity=!1,n.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(n.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(xa)))}return null!==a&&(a.visible=null!==n),null!==o&&(o.visible=null!==s),null!==l&&(l.visible=null!==r),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const i=new ya;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}class wa extends fe{constructor(t,e,i,n,s,r,a,o,l,c){if((c=void 0!==c?c:F)!==F&&c!==G)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&c===F&&(i=D),void 0===i&&c===G&&(i=O),super(null,n,s,r,a,o,c,i,l),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=void 0!==a?a:C,this.minFilter=void 0!==o?o:C,this.flipY=!1,this.generateMipmaps=!1}}class ba extends Dt{constructor(t,e){super();const i=this;let n=null,s=1,r=null,a="local-floor",o=1,l=null,c=null,h=null,d=null,u=null,p=null;const m=e.getContextAttributes();let f=null,g=null;const v=[],_=[],y=new Set,x=new Map,A=new Un;A.layers.enable(1),A.viewport=new ge;const w=new Un;w.layers.enable(2),w.viewport=new ge;const b=[A,w],M=new _a;M.layers.enable(1),M.layers.enable(2);let S=null,E=null;function C(t){const e=_.indexOf(t.inputSource);if(-1===e)return;const i=v[e];void 0!==i&&i.dispatchEvent({type:t.type,data:t.inputSource})}function T(){n.removeEventListener("select",C),n.removeEventListener("selectstart",C),n.removeEventListener("selectend",C),n.removeEventListener("squeeze",C),n.removeEventListener("squeezestart",C),n.removeEventListener("squeezeend",C),n.removeEventListener("end",T),n.removeEventListener("inputsourceschange",L);for(let t=0;t<v.length;t++){const e=_[t];null!==e&&(_[t]=null,v[t].disconnect(e))}S=null,E=null,t.setRenderTarget(f),u=null,d=null,h=null,n=null,g=null,U.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}function L(t){for(let e=0;e<t.removed.length;e++){const i=t.removed[e],n=_.indexOf(i);n>=0&&(_[n]=null,v[n].disconnect(i))}for(let e=0;e<t.added.length;e++){const i=t.added[e];let n=_.indexOf(i);if(-1===n){for(let t=0;t<v.length;t++){if(t>=_.length){_.push(i),n=t;break}if(null===_[t]){_[t]=i,n=t;break}}if(-1===n)break}const s=v[n];s&&s.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=v[t];return void 0===e&&(e=new Aa,v[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=v[t];return void 0===e&&(e=new Aa,v[t]=e),e.getGripSpace()},this.getHand=function(t){let e=v[t];return void 0===e&&(e=new Aa,v[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){s=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){a=t,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||r},this.setReferenceSpace=function(t){l=t},this.getBaseLayer=function(){return null!==d?d:u},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return n},this.setSession=async function(c){if(n=c,null!==n){if(f=t.getRenderTarget(),n.addEventListener("select",C),n.addEventListener("selectstart",C),n.addEventListener("selectend",C),n.addEventListener("squeeze",C),n.addEventListener("squeezestart",C),n.addEventListener("squeezeend",C),n.addEventListener("end",T),n.addEventListener("inputsourceschange",L),!0!==m.xrCompatible&&await e.makeXRCompatible(),void 0===n.renderState.layers||!1===t.capabilities.isWebGL2){const i={antialias:void 0!==n.renderState.layers||m.antialias,alpha:m.alpha,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:s};u=new XRWebGLLayer(n,e,i),n.updateRenderState({baseLayer:u}),g=new ve(u.framebufferWidth,u.framebufferHeight,{format:z,type:R,encoding:t.outputEncoding,stencilBuffer:m.stencil})}else{let i=null,r=null,a=null;m.depth&&(a=m.stencil?35056:33190,i=m.stencil?G:F,r=m.stencil?O:D);const o={colorFormat:32856,depthFormat:a,scaleFactor:s};h=new XRWebGLBinding(n,e),d=h.createProjectionLayer(o),n.updateRenderState({layers:[d]}),g=new ve(d.textureWidth,d.textureHeight,{format:z,type:R,depthTexture:new wa(d.textureWidth,d.textureHeight,r,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:m.stencil,encoding:t.outputEncoding,samples:m.antialias?4:0});t.properties.get(g).__ignoreDepthValues=d.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(o),l=null,r=await n.requestReferenceSpace(a),U.setContext(n),U.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};const k=new Ae,I=new Ae;function P(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===n)return;M.near=w.near=A.near=t.near,M.far=w.far=A.far=t.far,S===M.near&&E===M.far||(n.updateRenderState({depthNear:M.near,depthFar:M.far}),S=M.near,E=M.far);const e=t.parent,i=M.cameras;P(M,e);for(let t=0;t<i.length;t++)P(i[t],e);2===i.length?function(t,e,i){k.setFromMatrixPosition(e.matrixWorld),I.setFromMatrixPosition(i.matrixWorld);const n=k.distanceTo(I),s=e.projectionMatrix.elements,r=i.projectionMatrix.elements,a=s[14]/(s[10]-1),o=s[14]/(s[10]+1),l=(s[9]+1)/s[5],c=(s[9]-1)/s[5],h=(s[8]-1)/s[0],d=(r[8]+1)/r[0],u=a*h,p=a*d,m=n/(-h+d),f=m*-h;e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(f),t.translateZ(m),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();const g=a+m,v=o+m,_=u-f,y=p+(n-f),x=l*o/v*g,A=c*o/v*g;t.projectionMatrix.makePerspective(_,y,x,A,g,v),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}(M,A,w):M.projectionMatrix.copy(A.projectionMatrix),function(t,e,i){null===i?t.matrix.copy(e.matrixWorld):(t.matrix.copy(i.matrixWorld),t.matrix.invert(),t.matrix.multiply(e.matrixWorld));t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0);const n=t.children;for(let t=0,e=n.length;t<e;t++)n[t].updateMatrixWorld(!0);t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*zt*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}(t,M,e)},this.getCamera=function(){return M},this.getFoveation=function(){if(null!==d||null!==u)return o},this.setFoveation=function(t){o=t,null!==d&&(d.fixedFoveation=t),null!==u&&void 0!==u.fixedFoveation&&(u.fixedFoveation=t)},this.getPlanes=function(){return y};let B=null;const U=new Zn;U.setAnimationLoop((function(e,n){if(c=n.getViewerPose(l||r),p=n,null!==c){const e=c.views;null!==u&&(t.setRenderTargetFramebuffer(g,u.framebuffer),t.setRenderTarget(g));let i=!1;e.length!==M.cameras.length&&(M.cameras.length=0,i=!0);for(let n=0;n<e.length;n++){const s=e[n];let r=null;if(null!==u)r=u.getViewport(s);else{const e=h.getViewSubImage(d,s);r=e.viewport,0===n&&(t.setRenderTargetTextures(g,e.colorTexture,d.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(g))}let a=b[n];void 0===a&&(a=new Un,a.layers.enable(n),a.viewport=new ge,b[n]=a),a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale),a.projectionMatrix.fromArray(s.projectionMatrix),a.projectionMatrixInverse.copy(a.projectionMatrix).invert(),a.viewport.set(r.x,r.y,r.width,r.height),0===n&&(M.matrix.copy(a.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),!0===i&&M.cameras.push(a)}}for(let t=0;t<v.length;t++){const e=_[t],i=v[t];null!==e&&void 0!==i&&i.update(e,n,l||r)}if(B&&B(e,n),n.detectedPlanes){i.dispatchEvent({type:"planesdetected",data:n.detectedPlanes});let t=null;for(const e of y)n.detectedPlanes.has(e)||(null===t&&(t=[]),t.push(e));if(null!==t)for(const e of t)y.delete(e),x.delete(e),i.dispatchEvent({type:"planeremoved",data:e});for(const t of n.detectedPlanes)if(y.has(t)){const e=x.get(t);t.lastChangedTime>e&&(x.set(t,t.lastChangedTime),i.dispatchEvent({type:"planechanged",data:t}))}else y.add(t),x.set(t,n.lastChangedTime),i.dispatchEvent({type:"planeadded",data:t})}p=null})),this.setAnimationLoop=function(t){B=t},this.dispose=function(){}}}function Ma(t,e){function i(t,e){!0===t.matrixAutoUpdate&&t.updateMatrix(),e.value.copy(t.matrix)}function n(n,s){n.opacity.value=s.opacity,s.color&&n.diffuse.value.copy(s.color),s.emissive&&n.emissive.value.copy(s.emissive).multiplyScalar(s.emissiveIntensity),s.map&&(n.map.value=s.map,i(s.map,n.mapTransform)),s.alphaMap&&(n.alphaMap.value=s.alphaMap,i(s.alphaMap,n.alphaMapTransform)),s.bumpMap&&(n.bumpMap.value=s.bumpMap,i(s.bumpMap,n.bumpMapTransform),n.bumpScale.value=s.bumpScale,s.side===o&&(n.bumpScale.value*=-1)),s.normalMap&&(n.normalMap.value=s.normalMap,i(s.normalMap,n.normalMapTransform),n.normalScale.value.copy(s.normalScale),s.side===o&&n.normalScale.value.negate()),s.displacementMap&&(n.displacementMap.value=s.displacementMap,i(s.displacementMap,n.displacementMapTransform),n.displacementScale.value=s.displacementScale,n.displacementBias.value=s.displacementBias),s.emissiveMap&&(n.emissiveMap.value=s.emissiveMap,i(s.emissiveMap,n.emissiveMapTransform)),s.specularMap&&(n.specularMap.value=s.specularMap,i(s.specularMap,n.specularMapTransform)),s.alphaTest>0&&(n.alphaTest.value=s.alphaTest);const r=e.get(s).envMap;if(r&&(n.envMap.value=r,n.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,n.reflectivity.value=s.reflectivity,n.ior.value=s.ior,n.refractionRatio.value=s.refractionRatio),s.lightMap){n.lightMap.value=s.lightMap;const e=!0===t.useLegacyLights?Math.PI:1;n.lightMapIntensity.value=s.lightMapIntensity*e,i(s.lightMap,n.lightMapTransform)}s.aoMap&&(n.aoMap.value=s.aoMap,n.aoMapIntensity.value=s.aoMapIntensity,i(s.aoMap,n.aoMapTransform))}return{refreshFogUniforms:function(e,i){i.color.getRGB(e.fogColor.value,Pn(t)),i.isFog?(e.fogNear.value=i.near,e.fogFar.value=i.far):i.isFogExp2&&(e.fogDensity.value=i.density)},refreshMaterialUniforms:function(t,s,r,a,l){s.isMeshBasicMaterial||s.isMeshLambertMaterial?n(t,s):s.isMeshToonMaterial?(n(t,s),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,s)):s.isMeshPhongMaterial?(n(t,s),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,s)):s.isMeshStandardMaterial?(n(t,s),function(t,n){t.metalness.value=n.metalness,n.metalnessMap&&(t.metalnessMap.value=n.metalnessMap,i(n.metalnessMap,t.metalnessMapTransform));t.roughness.value=n.roughness,n.roughnessMap&&(t.roughnessMap.value=n.roughnessMap,i(n.roughnessMap,t.roughnessMapTransform));const s=e.get(n).envMap;s&&(t.envMapIntensity.value=n.envMapIntensity)}(t,s),s.isMeshPhysicalMaterial&&function(t,e,n){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,i(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,i(e.sheenRoughnessMap,t.sheenRoughnessMapTransform)));e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,i(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,i(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,i(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),e.side===o&&t.clearcoatNormalScale.value.negate()));e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,i(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,i(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform)));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,i(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,i(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,i(e.specularColorMap,t.specularColorMapTransform));e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,i(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,s,l)):s.isMeshMatcapMaterial?(n(t,s),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,s)):s.isMeshDepthMaterial?n(t,s):s.isMeshDistanceMaterial?(n(t,s),function(t,i){const n=e.get(i).light;t.referencePosition.value.setFromMatrixPosition(n.matrixWorld),t.nearDistance.value=n.shadow.camera.near,t.farDistance.value=n.shadow.camera.far}(t,s)):s.isMeshNormalMaterial?n(t,s):s.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,i(e.map,t.mapTransform))}(t,s),s.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,s)):s.isPointsMaterial?function(t,e,n,s){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*s,e.map&&(t.map.value=e.map,i(e.map,t.uvTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,s,r,a):s.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,i(e.map,t.mapTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap);e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,s):s.isShadowMaterial?(t.color.value.copy(s.color),t.opacity.value=s.opacity):s.isShaderMaterial&&(s.uniformsNeedUpdate=!1)}}}function Sa(t,e,i,n){let s={},r={},a=[];const o=i.isWebGL2?t.getParameter(35375):0;function l(t,e,i){const n=t.value;if(void 0===i[e]){if("number"==typeof n)i[e]=n;else{const t=Array.isArray(n)?n:[n],s=[];for(let e=0;e<t.length;e++)s.push(t[e].clone());i[e]=s}return!0}if("number"==typeof n){if(i[e]!==n)return i[e]=n,!0}else{const t=Array.isArray(i[e])?i[e]:[i[e]],s=Array.isArray(n)?n:[n];for(let e=0;e<t.length;e++){const i=t[e];if(!1===i.equals(s[e]))return i.copy(s[e]),!0}}return!1}function c(t){const e={boundary:0,storage:0};return"number"==typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.storage=64):t.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",t),e}function h(e){const i=e.target;i.removeEventListener("dispose",h);const n=a.indexOf(i.__bindingPointIndex);a.splice(n,1),t.deleteBuffer(s[i.id]),delete s[i.id],delete r[i.id]}return{bind:function(t,e){const i=e.program;n.uniformBlockBinding(t,i)},update:function(i,d){let u=s[i.id];void 0===u&&(!function(t){const e=t.uniforms;let i=0;const n=16;let s=0;for(let t=0,r=e.length;t<r;t++){const r=e[t],a={boundary:0,storage:0},o=Array.isArray(r.value)?r.value:[r.value];for(let t=0,e=o.length;t<e;t++){const e=c(o[t]);a.boundary+=e.boundary,a.storage+=e.storage}if(r.__data=new Float32Array(a.storage/Float32Array.BYTES_PER_ELEMENT),r.__offset=i,t>0){s=i%n;0!==s&&n-s-a.boundary<0&&(i+=n-s,r.__offset=i)}i+=a.storage}s=i%n,s>0&&(i+=n-s);t.__size=i,t.__cache={}}(i),u=function(e){const i=function(){for(let t=0;t<o;t++)if(-1===a.indexOf(t))return a.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();e.__bindingPointIndex=i;const n=t.createBuffer(),s=e.__size,r=e.usage;return t.bindBuffer(35345,n),t.bufferData(35345,s,r),t.bindBuffer(35345,null),t.bindBufferBase(35345,i,n),n}(i),s[i.id]=u,i.addEventListener("dispose",h));const p=d.program;n.updateUBOMapping(i,p);const m=e.render.frame;r[i.id]!==m&&(!function(e){const i=s[e.id],n=e.uniforms,r=e.__cache;t.bindBuffer(35345,i);for(let e=0,i=n.length;e<i;e++){const i=n[e];if(!0===l(i,e,r)){const e=i.__offset,n=Array.isArray(i.value)?i.value:[i.value];let s=0;for(let r=0;r<n.length;r++){const a=n[r],o=c(a);"number"==typeof a?(i.__data[0]=a,t.bufferSubData(35345,e+s,i.__data)):a.isMatrix3?(i.__data[0]=a.elements[0],i.__data[1]=a.elements[1],i.__data[2]=a.elements[2],i.__data[3]=a.elements[0],i.__data[4]=a.elements[3],i.__data[5]=a.elements[4],i.__data[6]=a.elements[5],i.__data[7]=a.elements[0],i.__data[8]=a.elements[6],i.__data[9]=a.elements[7],i.__data[10]=a.elements[8],i.__data[11]=a.elements[0]):(a.toArray(i.__data,s),s+=o.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(35345,e,i.__data)}}t.bindBuffer(35345,null)}(i),r[i.id]=m)},dispose:function(){for(const e in s)t.deleteBuffer(s[e]);a=[],s={},r={}}}}function Ea(){const t=ie("canvas");return t.style.display="block",t}class Ca{constructor(e={}){const{canvas:i=Ea(),context:n=null,depth:s=!0,stencil:r=!0,alpha:l=!1,antialias:c=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:d=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:m=!1}=e;let f;this.isWebGLRenderer=!0,f=null!==n?n.getContextAttributes().alpha:l;let g=null,v=null;const _=[],y=[];this.domElement=i,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=Et,this.useLegacyLights=!0,this.toneMapping=u,this.toneMappingExposure=1;const x=this;let A=!1,w=0,b=0,M=null,S=-1,E=null;const C=new ge,T=new ge;let L=null,k=i.width,I=i.height,B=1,D=null,O=null;const F=new ge(0,0,k,I),G=new ge(0,0,k,I);let H=!1;const V=new qn;let W=!1,j=!1,Q=null;const q=new Je,Z=new Ae,X={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Y(){return null===M?B:1}let J,K,$,tt,et,it,nt,st,rt,at,ot,lt,ct,ht,dt,ut,pt,mt,ft,gt,vt,_t,yt,xt,At=n;function wt(t,e){for(let n=0;n<t.length;n++){const s=t[n],r=i.getContext(s,e);if(null!==r)return r}return null}try{const e={alpha:!0,depth:s,stencil:r,antialias:c,premultipliedAlpha:h,preserveDrawingBuffer:d,powerPreference:p,failIfMajorPerformanceCaveat:m};if("setAttribute"in i&&i.setAttribute("data-engine",`three.js r${t}`),i.addEventListener("webglcontextlost",St,!1),i.addEventListener("webglcontextrestored",Ct,!1),i.addEventListener("webglcontextcreationerror",Tt,!1),null===At){const t=["webgl2","webgl","experimental-webgl"];if(!0===x.isWebGL1Renderer&&t.shift(),At=wt(t,e),null===At)throw wt(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}void 0===At.getShaderPrecisionFormat&&(At.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function bt(){J=new bs(At),K=new ss(At,J,e),J.init(K),_t=new va(At,J,K),$=new fa(At,J,K),tt=new Es,et=new ea,it=new ga(At,J,$,et,K,_t,tt),nt=new as(x),st=new ws(x),rt=new Xn(At,K),yt=new is(At,J,rt,K),at=new Ms(At,rt,tt,yt),ot=new ks(At,at,rt,tt),ft=new Ls(At,K,it),ut=new rs(et),lt=new ta(x,nt,st,J,K,yt,ut),ct=new Ma(x,et),ht=new ra,dt=new da(J,K),mt=new es(x,nt,st,$,ot,f,h),pt=new ma(x,ot,K),xt=new Sa(At,tt,K,$),gt=new ns(At,J,tt,K),vt=new Ss(At,J,tt,K),tt.programs=lt.programs,x.capabilities=K,x.extensions=J,x.properties=et,x.renderLists=ht,x.shadowMap=pt,x.state=$,x.info=tt}bt();const Mt=new ba(x,At);function St(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),A=!0}function Ct(){console.log("THREE.WebGLRenderer: Context Restored."),A=!1;const t=tt.autoReset,e=pt.enabled,i=pt.autoUpdate,n=pt.needsUpdate,s=pt.type;bt(),tt.autoReset=t,pt.enabled=e,pt.autoUpdate=i,pt.needsUpdate=n,pt.type=s}function Tt(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function Lt(t){const e=t.target;e.removeEventListener("dispose",Lt),function(t){(function(t){const e=et.get(t).programs;void 0!==e&&(e.forEach((function(t){lt.releaseProgram(t)})),t.isShaderMaterial&&lt.releaseShaderCache(t))})(t),et.remove(t)}(e)}this.xr=Mt,this.getContext=function(){return At},this.getContextAttributes=function(){return At.getContextAttributes()},this.forceContextLoss=function(){const t=J.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=J.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return B},this.setPixelRatio=function(t){void 0!==t&&(B=t,this.setSize(k,I,!1))},this.getSize=function(t){return t.set(k,I)},this.setSize=function(t,e,n=!0){Mt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(k=t,I=e,i.width=Math.floor(t*B),i.height=Math.floor(e*B),!0===n&&(i.style.width=t+"px",i.style.height=e+"px"),this.setViewport(0,0,t,e))},this.getDrawingBufferSize=function(t){return t.set(k*B,I*B).floor()},this.setDrawingBufferSize=function(t,e,n){k=t,I=e,B=n,i.width=Math.floor(t*n),i.height=Math.floor(e*n),this.setViewport(0,0,t,e)},this.getCurrentViewport=function(t){return t.copy(C)},this.getViewport=function(t){return t.copy(F)},this.setViewport=function(t,e,i,n){t.isVector4?F.set(t.x,t.y,t.z,t.w):F.set(t,e,i,n),$.viewport(C.copy(F).multiplyScalar(B).floor())},this.getScissor=function(t){return t.copy(G)},this.setScissor=function(t,e,i,n){t.isVector4?G.set(t.x,t.y,t.z,t.w):G.set(t,e,i,n),$.scissor(T.copy(G).multiplyScalar(B).floor())},this.getScissorTest=function(){return H},this.setScissorTest=function(t){$.setScissorTest(H=t)},this.setOpaqueSort=function(t){D=t},this.setTransparentSort=function(t){O=t},this.getClearColor=function(t){return t.copy(mt.getClearColor())},this.setClearColor=function(){mt.setClearColor.apply(mt,arguments)},this.getClearAlpha=function(){return mt.getClearAlpha()},this.setClearAlpha=function(){mt.setClearAlpha.apply(mt,arguments)},this.clear=function(t=!0,e=!0,i=!0){let n=0;t&&(n|=16384),e&&(n|=256),i&&(n|=1024),At.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){i.removeEventListener("webglcontextlost",St,!1),i.removeEventListener("webglcontextrestored",Ct,!1),i.removeEventListener("webglcontextcreationerror",Tt,!1),ht.dispose(),dt.dispose(),et.dispose(),nt.dispose(),st.dispose(),ot.dispose(),yt.dispose(),xt.dispose(),lt.dispose(),Mt.dispose(),Mt.removeEventListener("sessionstart",It),Mt.removeEventListener("sessionend",Pt),Q&&(Q.dispose(),Q=null),Rt.stop()},this.renderBufferDirect=function(t,e,i,n,s,r){null===e&&(e=X);const a=s.isMesh&&s.matrixWorld.determinant()<0,o=function(t,e,i,n,s){!0!==e.isScene&&(e=X);it.resetTextureUnits();const r=e.fog,a=n.isMeshStandardMaterial?e.environment:null,o=null===M?x.outputEncoding:!0===M.isXRRenderTarget?M.texture.encoding:Et,l=(n.isMeshStandardMaterial?st:nt).get(n.envMap||a),c=!0===n.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,h=!!n.normalMap&&!!i.attributes.tangent,d=!!i.morphAttributes.position,p=!!i.morphAttributes.normal,m=!!i.morphAttributes.color,f=n.toneMapped?x.toneMapping:u,g=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,_=void 0!==g?g.length:0,y=et.get(n),A=v.state.lights;if(!0===W&&(!0===j||t!==E)){const e=t===E&&n.id===S;ut.setState(n,t,e)}let w=!1;n.version===y.__version?y.needsLights&&y.lightsStateVersion!==A.state.version||y.outputEncoding!==o||s.isInstancedMesh&&!1===y.instancing?w=!0:s.isInstancedMesh||!0!==y.instancing?s.isSkinnedMesh&&!1===y.skinning?w=!0:s.isSkinnedMesh||!0!==y.skinning?y.envMap!==l||!0===n.fog&&y.fog!==r?w=!0:void 0===y.numClippingPlanes||y.numClippingPlanes===ut.numPlanes&&y.numIntersection===ut.numIntersection?(y.vertexAlphas!==c||y.vertexTangents!==h||y.morphTargets!==d||y.morphNormals!==p||y.morphColors!==m||y.toneMapping!==f||!0===K.isWebGL2&&y.morphTargetsCount!==_)&&(w=!0):w=!0:w=!0:w=!0:(w=!0,y.__version=n.version);let b=y.currentProgram;!0===w&&(b=Ot(n,e,s));let C=!1,T=!1,L=!1;const k=b.getUniforms(),P=y.uniforms;$.useProgram(b.program)&&(C=!0,T=!0,L=!0);n.id!==S&&(S=n.id,T=!0);if(C||E!==t){if(k.setValue(At,"projectionMatrix",t.projectionMatrix),K.logarithmicDepthBuffer&&k.setValue(At,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),E!==t&&(E=t,T=!0,L=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshStandardMaterial||n.envMap){const e=k.map.cameraPosition;void 0!==e&&e.setValue(At,Z.setFromMatrixPosition(t.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&k.setValue(At,"isOrthographic",!0===t.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.isShadowMaterial||s.isSkinnedMesh)&&k.setValue(At,"viewMatrix",t.matrixWorldInverse)}if(s.isSkinnedMesh){k.setOptional(At,s,"bindMatrix"),k.setOptional(At,s,"bindMatrixInverse");const t=s.skeleton;t&&(K.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),k.setValue(At,"boneTexture",t.boneTexture,it),k.setValue(At,"boneTextureSize",t.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const R=i.morphAttributes;(void 0!==R.position||void 0!==R.normal||void 0!==R.color&&!0===K.isWebGL2)&&ft.update(s,i,b);(T||y.receiveShadow!==s.receiveShadow)&&(y.receiveShadow=s.receiveShadow,k.setValue(At,"receiveShadow",s.receiveShadow));n.isMeshGouraudMaterial&&null!==n.envMap&&(P.envMap.value=l,P.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1);T&&(k.setValue(At,"toneMappingExposure",x.toneMappingExposure),y.needsLights&&(U=L,(D=P).ambientLightColor.needsUpdate=U,D.lightProbe.needsUpdate=U,D.directionalLights.needsUpdate=U,D.directionalLightShadows.needsUpdate=U,D.pointLights.needsUpdate=U,D.pointLightShadows.needsUpdate=U,D.spotLights.needsUpdate=U,D.spotLightShadows.needsUpdate=U,D.rectAreaLights.needsUpdate=U,D.hemisphereLights.needsUpdate=U),r&&!0===n.fog&&ct.refreshFogUniforms(P,r),ct.refreshMaterialUniforms(P,n,B,I,Q),Br.upload(At,y.uniformsList,P,it));var D,U;n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(Br.upload(At,y.uniformsList,P,it),n.uniformsNeedUpdate=!1);n.isSpriteMaterial&&k.setValue(At,"center",s.center);if(k.setValue(At,"modelViewMatrix",s.modelViewMatrix),k.setValue(At,"normalMatrix",s.normalMatrix),k.setValue(At,"modelMatrix",s.matrixWorld),n.isShaderMaterial||n.isRawShaderMaterial){const t=n.uniformsGroups;for(let e=0,i=t.length;e<i;e++)if(K.isWebGL2){const i=t[e];xt.update(i,b),xt.bind(i,b)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return b}(t,e,i,n,s);$.setMaterial(n,a);let l=i.index,c=1;!0===n.wireframe&&(l=at.getWireframeAttribute(i),c=2);const h=i.drawRange,d=i.attributes.position;let p=h.start*c,m=(h.start+h.count)*c;null!==r&&(p=Math.max(p,r.start*c),m=Math.min(m,(r.start+r.count)*c)),null!==l?(p=Math.max(p,0),m=Math.min(m,l.count)):null!=d&&(p=Math.max(p,0),m=Math.min(m,d.count));const f=m-p;if(f<0||f===1/0)return;let g;yt.setup(s,n,o,i,l);let _=gt;if(null!==l&&(g=rt.get(l),_=vt,_.setIndex(g)),s.isMesh)!0===n.wireframe?($.setLineWidth(n.wireframeLinewidth*Y()),_.setMode(1)):_.setMode(4);else if(s.isLine){let t=n.linewidth;void 0===t&&(t=1),$.setLineWidth(t*Y()),s.isLineSegments?_.setMode(1):s.isLineLoop?_.setMode(2):_.setMode(3)}else s.isPoints?_.setMode(0):s.isSprite&&_.setMode(4);if(s.isInstancedMesh)_.renderInstances(p,f,s.count);else if(i.isInstancedBufferGeometry){const t=void 0!==i._maxInstanceCount?i._maxInstanceCount:1/0,e=Math.min(i.instanceCount,t);_.renderInstances(p,f,e)}else _.render(p,f)},this.compile=function(t,e){function i(t,e,i){!0===t.transparent&&2===t.side&&!1===t.forceSinglePass?(t.side=o,t.needsUpdate=!0,Ot(t,e,i),t.side=a,t.needsUpdate=!0,Ot(t,e,i),t.side=2):Ot(t,e,i)}v=dt.get(t),v.init(),y.push(v),t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(v.pushLight(t),t.castShadow&&v.pushShadow(t))})),v.setupLights(x.useLegacyLights),t.traverse((function(e){const n=e.material;if(n)if(Array.isArray(n))for(let s=0;s<n.length;s++){i(n[s],t,e)}else i(n,t,e)})),y.pop(),v=null};let kt=null;function It(){Rt.stop()}function Pt(){Rt.start()}const Rt=new Zn;function Bt(t,e,i,n){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)i=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)v.pushLight(t),t.castShadow&&v.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||V.intersectsSprite(t)){n&&Z.setFromMatrixPosition(t.matrixWorld).applyMatrix4(q);const e=ot.update(t),s=t.material;s.visible&&g.push(t,e,s,i,Z.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(t.isSkinnedMesh&&t.skeleton.frame!==tt.render.frame&&(t.skeleton.update(),t.skeleton.frame=tt.render.frame),!t.frustumCulled||V.intersectsObject(t))){n&&Z.setFromMatrixPosition(t.matrixWorld).applyMatrix4(q);const e=ot.update(t),s=t.material;if(Array.isArray(s)){const n=e.groups;for(let r=0,a=n.length;r<a;r++){const a=n[r],o=s[a.materialIndex];o&&o.visible&&g.push(t,e,o,i,Z.z,a)}}else s.visible&&g.push(t,e,s,i,Z.z,null)}const s=t.children;for(let t=0,r=s.length;t<r;t++)Bt(s[t],e,i,n)}function Dt(t,e,i,n){const s=t.opaque,r=t.transmissive,a=t.transparent;v.setupLightsView(i),!0===W&&ut.setGlobalState(x.clippingPlanes,i),r.length>0&&function(t,e,i,n){if(null===Q){const t=K.isWebGL2;Q=new ve(1024,1024,{generateMipmaps:!0,type:J.has("EXT_color_buffer_half_float")?N:R,minFilter:P,samples:t&&!0===c?4:0})}const s=x.getRenderTarget();x.setRenderTarget(Q),x.clear();const r=x.toneMapping;x.toneMapping=u,Ut(t,i,n),it.updateMultisampleRenderTarget(Q),it.updateRenderTargetMipmap(Q);let a=!1;for(let t=0,s=e.length;t<s;t++){const s=e[t],r=s.object,l=s.geometry,c=s.material,h=s.group;if(2===c.side&&r.layers.test(n.layers)){const t=c.side;c.side=o,c.needsUpdate=!0,Nt(r,i,n,l,c,h),c.side=t,c.needsUpdate=!0,a=!0}}!0===a&&(it.updateMultisampleRenderTarget(Q),it.updateRenderTargetMipmap(Q));x.setRenderTarget(s),x.toneMapping=r}(s,r,e,i),n&&$.viewport(C.copy(n)),s.length>0&&Ut(s,e,i),r.length>0&&Ut(r,e,i),a.length>0&&Ut(a,e,i),$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),$.setPolygonOffset(!1)}function Ut(t,e,i){const n=!0===e.isScene?e.overrideMaterial:null;for(let s=0,r=t.length;s<r;s++){const r=t[s],a=r.object,o=r.geometry,l=null===n?r.material:n,c=r.group;a.layers.test(i.layers)&&Nt(a,e,i,o,l,c)}}function Nt(t,e,i,n,s,r){t.onBeforeRender(x,e,i,n,s,r),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),s.onBeforeRender(x,e,i,n,t,r),!0===s.transparent&&2===s.side&&!1===s.forceSinglePass?(s.side=o,s.needsUpdate=!0,x.renderBufferDirect(i,e,n,s,t,r),s.side=a,s.needsUpdate=!0,x.renderBufferDirect(i,e,n,s,t,r),s.side=2):x.renderBufferDirect(i,e,n,s,t,r),t.onAfterRender(x,e,i,n,s,r)}function Ot(t,e,i){!0!==e.isScene&&(e=X);const n=et.get(t),s=v.state.lights,r=v.state.shadowsArray,a=s.state.version,o=lt.getParameters(t,s.state,r,e,i),l=lt.getProgramCacheKey(o);let c=n.programs;n.environment=t.isMeshStandardMaterial?e.environment:null,n.fog=e.fog,n.envMap=(t.isMeshStandardMaterial?st:nt).get(t.envMap||n.environment),void 0===c&&(t.addEventListener("dispose",Lt),c=new Map,n.programs=c);let h=c.get(l);if(void 0!==h){if(n.currentProgram===h&&n.lightsStateVersion===a)return zt(t,o),h}else o.uniforms=lt.getUniforms(t),t.onBuild(i,o,x),t.onBeforeCompile(o,x),h=lt.acquireProgram(o,l),c.set(l,h),n.uniforms=o.uniforms;const d=n.uniforms;(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(d.clippingPlanes=ut.uniform),zt(t,o),n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),n.lightsStateVersion=a,n.needsLights&&(d.ambientLightColor.value=s.state.ambient,d.lightProbe.value=s.state.probe,d.directionalLights.value=s.state.directional,d.directionalLightShadows.value=s.state.directionalShadow,d.spotLights.value=s.state.spot,d.spotLightShadows.value=s.state.spotShadow,d.rectAreaLights.value=s.state.rectArea,d.ltc_1.value=s.state.rectAreaLTC1,d.ltc_2.value=s.state.rectAreaLTC2,d.pointLights.value=s.state.point,d.pointLightShadows.value=s.state.pointShadow,d.hemisphereLights.value=s.state.hemi,d.directionalShadowMap.value=s.state.directionalShadowMap,d.directionalShadowMatrix.value=s.state.directionalShadowMatrix,d.spotShadowMap.value=s.state.spotShadowMap,d.spotLightMatrix.value=s.state.spotLightMatrix,d.spotLightMap.value=s.state.spotLightMap,d.pointShadowMap.value=s.state.pointShadowMap,d.pointShadowMatrix.value=s.state.pointShadowMatrix);const u=h.getUniforms(),p=Br.seqWithValue(u.seq,d);return n.currentProgram=h,n.uniformsList=p,h}function zt(t,e){const i=et.get(t);i.outputEncoding=e.outputEncoding,i.instancing=e.instancing,i.skinning=e.skinning,i.morphTargets=e.morphTargets,i.morphNormals=e.morphNormals,i.morphColors=e.morphColors,i.morphTargetsCount=e.morphTargetsCount,i.numClippingPlanes=e.numClippingPlanes,i.numIntersection=e.numClipIntersection,i.vertexAlphas=e.vertexAlphas,i.vertexTangents=e.vertexTangents,i.toneMapping=e.toneMapping}Rt.setAnimationLoop((function(t){kt&&kt(t)})),"undefined"!=typeof self&&Rt.setContext(self),this.setAnimationLoop=function(t){kt=t,Mt.setAnimationLoop(t),null===t?Rt.stop():Rt.start()},Mt.addEventListener("sessionstart",It),Mt.addEventListener("sessionend",Pt),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===A)return;!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===Mt.enabled&&!0===Mt.isPresenting&&(!0===Mt.cameraAutoUpdate&&Mt.updateCamera(e),e=Mt.getCamera()),!0===t.isScene&&t.onBeforeRender(x,t,e,M),v=dt.get(t,y.length),v.init(),y.push(v),q.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),V.setFromProjectionMatrix(q),j=this.localClippingEnabled,W=ut.init(this.clippingPlanes,j),g=ht.get(t,_.length),g.init(),_.push(g),Bt(t,e,0,x.sortObjects),g.finish(),!0===x.sortObjects&&g.sort(D,O),!0===W&&ut.beginShadows();const i=v.state.shadowsArray;if(pt.render(i,t,e),!0===W&&ut.endShadows(),!0===this.info.autoReset&&this.info.reset(),mt.render(g,t),v.setupLights(x.useLegacyLights),e.isArrayCamera){const i=e.cameras;for(let e=0,n=i.length;e<n;e++){const n=i[e];Dt(g,t,n,n.viewport)}}else Dt(g,t,e);null!==M&&(it.updateMultisampleRenderTarget(M),it.updateRenderTargetMipmap(M)),!0===t.isScene&&t.onAfterRender(x,t,e),yt.resetDefaultState(),S=-1,E=null,y.pop(),v=y.length>0?y[y.length-1]:null,_.pop(),g=_.length>0?_[_.length-1]:null},this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return b},this.getRenderTarget=function(){return M},this.setRenderTargetTextures=function(t,e,i){et.get(t.texture).__webglTexture=e,et.get(t.depthTexture).__webglTexture=i;const n=et.get(t);n.__hasExternalTextures=!0,n.__hasExternalTextures&&(n.__autoAllocateDepthBuffer=void 0===i,n.__autoAllocateDepthBuffer||!0===J.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),n.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const i=et.get(t);i.__webglFramebuffer=e,i.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,i=0){M=t,w=e,b=i;let n=!0,s=null,r=!1,a=!1;if(t){const i=et.get(t);void 0!==i.__useDefaultFramebuffer?($.bindFramebuffer(36160,null),n=!1):void 0===i.__webglFramebuffer?it.setupRenderTarget(t):i.__hasExternalTextures&&it.rebindTextures(t,et.get(t.texture).__webglTexture,et.get(t.depthTexture).__webglTexture);const o=t.texture;(o.isData3DTexture||o.isDataArrayTexture||o.isCompressedArrayTexture)&&(a=!0);const l=et.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(s=l[e],r=!0):s=K.isWebGL2&&t.samples>0&&!1===it.useMultisampledRTT(t)?et.get(t).__webglMultisampledFramebuffer:l,C.copy(t.viewport),T.copy(t.scissor),L=t.scissorTest}else C.copy(F).multiplyScalar(B).floor(),T.copy(G).multiplyScalar(B).floor(),L=H;if($.bindFramebuffer(36160,s)&&K.drawBuffers&&n&&$.drawBuffers(t,s),$.viewport(C),$.scissor(T),$.setScissorTest(L),r){const n=et.get(t.texture);At.framebufferTexture2D(36160,36064,34069+e,n.__webglTexture,i)}else if(a){const n=et.get(t.texture),s=e||0;At.framebufferTextureLayer(36160,36064,n.__webglTexture,i||0,s)}S=-1},this.readRenderTargetPixels=function(t,e,i,n,s,r,a){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=et.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){$.bindFramebuffer(36160,o);try{const a=t.texture,o=a.format,l=a.type;if(o!==z&&_t.convert(o)!==At.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===N&&(J.has("EXT_color_buffer_half_float")||K.isWebGL2&&J.has("EXT_color_buffer_float"));if(!(l===R||_t.convert(l)===At.getParameter(35738)||l===U&&(K.isWebGL2||J.has("OES_texture_float")||J.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-n&&i>=0&&i<=t.height-s&&At.readPixels(e,i,n,s,_t.convert(o),_t.convert(l),r)}finally{const t=null!==M?et.get(M).__webglFramebuffer:null;$.bindFramebuffer(36160,t)}}},this.copyFramebufferToTexture=function(t,e,i=0){const n=Math.pow(2,-i),s=Math.floor(e.image.width*n),r=Math.floor(e.image.height*n);it.setTexture2D(e,0),At.copyTexSubImage2D(3553,i,0,0,t.x,t.y,s,r),$.unbindTexture()},this.copyTextureToTexture=function(t,e,i,n=0){const s=e.image.width,r=e.image.height,a=_t.convert(i.format),o=_t.convert(i.type);it.setTexture2D(i,0),At.pixelStorei(37440,i.flipY),At.pixelStorei(37441,i.premultiplyAlpha),At.pixelStorei(3317,i.unpackAlignment),e.isDataTexture?At.texSubImage2D(3553,n,t.x,t.y,s,r,a,o,e.image.data):e.isCompressedTexture?At.compressedTexSubImage2D(3553,n,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,a,e.mipmaps[0].data):At.texSubImage2D(3553,n,t.x,t.y,a,o,e.image),0===n&&i.generateMipmaps&&At.generateMipmap(3553),$.unbindTexture()},this.copyTextureToTexture3D=function(t,e,i,n,s=0){if(x.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const r=t.max.x-t.min.x+1,a=t.max.y-t.min.y+1,o=t.max.z-t.min.z+1,l=_t.convert(n.format),c=_t.convert(n.type);let h;if(n.isData3DTexture)it.setTexture3D(n,0),h=32879;else{if(!n.isDataArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");it.setTexture2DArray(n,0),h=35866}At.pixelStorei(37440,n.flipY),At.pixelStorei(37441,n.premultiplyAlpha),At.pixelStorei(3317,n.unpackAlignment);const d=At.getParameter(3314),u=At.getParameter(32878),p=At.getParameter(3316),m=At.getParameter(3315),f=At.getParameter(32877),g=i.isCompressedTexture?i.mipmaps[0]:i.image;At.pixelStorei(3314,g.width),At.pixelStorei(32878,g.height),At.pixelStorei(3316,t.min.x),At.pixelStorei(3315,t.min.y),At.pixelStorei(32877,t.min.z),i.isDataTexture||i.isData3DTexture?At.texSubImage3D(h,s,e.x,e.y,e.z,r,a,o,l,c,g.data):i.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),At.compressedTexSubImage3D(h,s,e.x,e.y,e.z,r,a,o,l,g.data)):At.texSubImage3D(h,s,e.x,e.y,e.z,r,a,o,l,c,g),At.pixelStorei(3314,d),At.pixelStorei(32878,u),At.pixelStorei(3316,p),At.pixelStorei(3315,m),At.pixelStorei(32877,f),0===s&&n.generateMipmaps&&At.generateMipmap(h),$.unbindTexture()},this.initTexture=function(t){t.isCubeTexture?it.setTextureCube(t,0):t.isData3DTexture?it.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?it.setTexture2DArray(t,0):it.setTexture2D(t,0),$.unbindTexture()},this.resetState=function(){w=0,b=0,M=null,$.reset(),yt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(t){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!t}}class Ta extends Ca{}Ta.prototype.isWebGL1Renderer=!0;class La{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new Gi(t),this.density=e}clone(){return new La(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class ka{constructor(t,e=1,i=1e3){this.isFog=!0,this.name="",this.color=new Gi(t),this.near=e,this.far=i}clone(){return new ka(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class Ia extends wi{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(t){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=t}}class Pa{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=Pt,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Ft()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let n=0,s=this.stride;n<s;n++)this.array[t+n]=e.array[i+n];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Ft()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(e,this.stride);return i.setUsage(this.usage),i}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Ft()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Ra=new Ae;class Ba{constructor(t,e,i,n=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=n}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,i=this.data.count;e<i;e++)Ra.fromBufferAttribute(this,e),Ra.applyMatrix4(t),this.setXYZ(e,Ra.x,Ra.y,Ra.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Ra.fromBufferAttribute(this,e),Ra.applyNormalMatrix(t),this.setXYZ(e,Ra.x,Ra.y,Ra.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Ra.fromBufferAttribute(this,e),Ra.transformDirection(t),this.setXYZ(e,Ra.x,Ra.y,Ra.z);return this}setX(t,e){return this.normalized&&(e=Zt(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=Zt(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=Zt(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=Zt(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=qt(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=qt(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=qt(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=qt(e,this.array)),e}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=Zt(e,this.array),i=Zt(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this}setXYZ(t,e,i,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=Zt(e,this.array),i=Zt(i,this.array),n=Zt(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this}setXYZW(t,e,i,n,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=Zt(e,this.array),i=Zt(i,this.array),n=Zt(n,this.array),s=Zt(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this.data.array[t+3]=s,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return new Ji(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new Ba(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Da extends Ui{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Gi(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}let Ua;const Na=new Ae,Oa=new Ae,za=new Ae,Fa=new Yt,Ga=new Yt,Ha=new Je,Va=new Ae,Wa=new Ae,ja=new Ae,Qa=new Yt,qa=new Yt,Za=new Yt;class Xa extends wi{constructor(t){if(super(),this.isSprite=!0,this.type="Sprite",void 0===Ua){Ua=new cn;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new Pa(t,5);Ua.setIndex([0,1,2,0,2,3]),Ua.setAttribute("position",new Ba(e,3,0,!1)),Ua.setAttribute("uv",new Ba(e,2,3,!1))}this.geometry=Ua,this.material=void 0!==t?t:new Da,this.center=new Yt(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Oa.setFromMatrixScale(this.matrixWorld),Ha.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),za.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Oa.multiplyScalar(-za.z);const i=this.material.rotation;let n,s;0!==i&&(s=Math.cos(i),n=Math.sin(i));const r=this.center;Ya(Va.set(-.5,-.5,0),za,r,Oa,n,s),Ya(Wa.set(.5,-.5,0),za,r,Oa,n,s),Ya(ja.set(.5,.5,0),za,r,Oa,n,s),Qa.set(0,0),qa.set(1,0),Za.set(1,1);let a=t.ray.intersectTriangle(Va,Wa,ja,!1,Na);if(null===a&&(Ya(Wa.set(-.5,.5,0),za,r,Oa,n,s),qa.set(0,1),a=t.ray.intersectTriangle(Va,ja,Wa,!1,Na),null===a))return;const o=t.ray.origin.distanceTo(Na);o<t.near||o>t.far||e.push({distance:o,point:Na.clone(),uv:Bi.getInterpolation(Na,Va,Wa,ja,Qa,qa,Za,new Yt),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function Ya(t,e,i,n,s,r){Fa.subVectors(t,i).addScalar(.5).multiply(n),void 0!==s?(Ga.x=r*Fa.x-s*Fa.y,Ga.y=s*Fa.x+r*Fa.y):Ga.copy(Fa),t.copy(e),t.x+=Ga.x,t.y+=Ga.y,t.applyMatrix4(Ha)}const Ja=new Ae,Ka=new Ae;class $a extends wi{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let t=0,i=e.length;t<i;t++){const i=e[t];this.addLevel(i.object.clone(),i.distance,i.hysteresis)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0,i=0){e=Math.abs(e);const n=this.levels;let s;for(s=0;s<n.length&&!(e<n[s].distance);s++);return n.splice(s,0,{distance:e,hysteresis:i,object:t}),this.add(t),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const e=this.levels;if(e.length>0){let i,n;for(i=1,n=e.length;i<n;i++){let n=e[i].distance;if(e[i].object.visible&&(n-=n*e[i].hysteresis),t<n)break}return e[i-1].object}return null}raycast(t,e){if(this.levels.length>0){Ja.setFromMatrixPosition(this.matrixWorld);const i=t.ray.origin.distanceTo(Ja);this.getObjectForDistance(i).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Ja.setFromMatrixPosition(t.matrixWorld),Ka.setFromMatrixPosition(this.matrixWorld);const i=Ja.distanceTo(Ka)/t.zoom;let n,s;for(e[0].object.visible=!0,n=1,s=e.length;n<s;n++){let t=e[n].distance;if(e[n].object.visible&&(t-=t*e[n].hysteresis),!(i>=t))break;e[n-1].object.visible=!1,e[n].object.visible=!0}for(this._currentLevel=n-1;n<s;n++)e[n].object.visible=!1}}toJSON(t){const e=super.toJSON(t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];const i=this.levels;for(let t=0,n=i.length;t<n;t++){const n=i[t];e.object.levels.push({object:n.object.uuid,distance:n.distance,hysteresis:n.hysteresis})}return e}}const to=new Ae,eo=new ge,io=new ge,no=new Ae,so=new Je,ro=new Ae;class ao extends Cn{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Je,this.bindMatrixInverse=new Je,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;null===this.boundingBox&&(this.boundingBox=new Me),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)ro.fromBufferAttribute(e,t),this.applyBoneTransform(t,ro),this.boundingBox.expandByPoint(ro)}computeBoundingSphere(){const t=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new He),this.boundingSphere.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)ro.fromBufferAttribute(e,t),this.applyBoneTransform(t,ro),this.boundingSphere.expandByPoint(ro)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new ge,e=this.geometry.attributes.skinWeight;for(let i=0,n=e.count;i<n;i++){t.fromBufferAttribute(e,i);const n=1/t.manhattanLength();n!==1/0?t.multiplyScalar(n):t.set(1,0,0,0),e.setXYZW(i,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){const i=this.skeleton,n=this.geometry;eo.fromBufferAttribute(n.attributes.skinIndex,t),io.fromBufferAttribute(n.attributes.skinWeight,t),to.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const n=io.getComponent(t);if(0!==n){const s=eo.getComponent(t);so.multiplyMatrices(i.bones[s].matrixWorld,i.boneInverses[s]),e.addScaledVector(no.copy(to).applyMatrix4(so),n)}}return e.applyMatrix4(this.bindMatrixInverse)}boneTransform(t,e){return console.warn("THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151."),this.applyBoneTransform(t,e)}}class oo extends wi{constructor(){super(),this.isBone=!0,this.type="Bone"}}class lo extends fe{constructor(t=null,e=1,i=1,n,s,r,a,o,l=1003,c=1003,h,d){super(null,r,a,o,l,c,n,s,h,d),this.isDataTexture=!0,this.image={data:t,width:e,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const co=new Je,ho=new Je;class uo{constructor(t=[],e=[]){this.uuid=Ft(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new Je)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new Je;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,i=this.boneMatrices,n=this.boneTexture;for(let n=0,s=t.length;n<s;n++){const s=t[n]?t[n].matrixWorld:ho;co.multiplyMatrices(s,e[n]),co.toArray(i,16*n)}null!==n&&(n.needsUpdate=!0)}clone(){return new uo(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=jt(t),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const i=new lo(e,t,t,z,U);return i.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=i,this.boneTextureSize=t,this}getBoneByName(t){for(let e=0,i=this.bones.length;e<i;e++){const i=this.bones[e];if(i.name===t)return i}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let i=0,n=t.bones.length;i<n;i++){const n=t.bones[i];let s=e[n];void 0===s&&(console.warn("THREE.Skeleton: No bone found with UUID:",n),s=new oo),this.bones.push(s),this.boneInverses.push((new Je).fromArray(t.boneInverses[i]))}return this.init(),this}toJSON(){const t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,i=this.boneInverses;for(let n=0,s=e.length;n<s;n++){const s=e[n];t.bones.push(s.uuid);const r=i[n];t.boneInverses.push(r.toArray())}return t}}class po extends Ji{constructor(t,e,i,n=1){super(t,e,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const mo=new Je,fo=new Je,go=[],vo=new Me,_o=new Je,yo=new Cn,xo=new He;class Ao extends Cn{constructor(t,e,i){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new po(new Float32Array(16*i),16),this.instanceColor=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let t=0;t<i;t++)this.setMatrixAt(t,_o)}computeBoundingBox(){const t=this.geometry,e=this.count;null===this.boundingBox&&(this.boundingBox=new Me),null===t.boundingBox&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,mo),vo.copy(t.boundingBox).applyMatrix4(mo),this.boundingBox.union(vo)}computeBoundingSphere(){const t=this.geometry,e=this.count;null===this.boundingSphere&&(this.boundingSphere=new He),null===t.boundingSphere&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,mo),xo.copy(t.boundingSphere).applyMatrix4(mo),this.boundingSphere.union(xo)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}raycast(t,e){const i=this.matrixWorld,n=this.count;if(yo.geometry=this.geometry,yo.material=this.material,void 0!==yo.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),xo.copy(this.boundingSphere),xo.applyMatrix4(i),!1!==t.ray.intersectsSphere(xo)))for(let s=0;s<n;s++){this.getMatrixAt(s,mo),fo.multiplyMatrices(i,mo),yo.matrixWorld=fo,yo.raycast(t,go);for(let t=0,i=go.length;t<i;t++){const i=go[t];i.instanceId=s,i.object=this,e.push(i)}go.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new po(new Float32Array(3*this.instanceMatrix.count),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}class wo extends Ui{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Gi(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const bo=new Ae,Mo=new Ae,So=new Je,Eo=new Ye,Co=new He;class To extends wi{constructor(t=new cn,e=new wo){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,i=[0];for(let t=1,n=e.count;t<n;t++)bo.fromBufferAttribute(e,t-1),Mo.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=bo.distanceTo(Mo);t.setAttribute("lineDistance",new tn(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const i=this.geometry,n=this.matrixWorld,s=t.params.Line.threshold,r=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),Co.copy(i.boundingSphere),Co.applyMatrix4(n),Co.radius+=s,!1===t.ray.intersectsSphere(Co))return;So.copy(n).invert(),Eo.copy(t.ray).applyMatrix4(So);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=new Ae,c=new Ae,h=new Ae,d=new Ae,u=this.isLineSegments?2:1,p=i.index,m=i.attributes.position;if(null!==p){for(let i=Math.max(0,r.start),n=Math.min(p.count,r.start+r.count)-1;i<n;i+=u){const n=p.getX(i),s=p.getX(i+1);l.fromBufferAttribute(m,n),c.fromBufferAttribute(m,s);if(Eo.distanceSqToSegment(l,c,d,h)>o)continue;d.applyMatrix4(this.matrixWorld);const r=t.ray.origin.distanceTo(d);r<t.near||r>t.far||e.push({distance:r,point:h.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}else{for(let i=Math.max(0,r.start),n=Math.min(m.count,r.start+r.count)-1;i<n;i+=u){l.fromBufferAttribute(m,i),c.fromBufferAttribute(m,i+1);if(Eo.distanceSqToSegment(l,c,d,h)>o)continue;d.applyMatrix4(this.matrixWorld);const n=t.ray.origin.distanceTo(d);n<t.near||n>t.far||e.push({distance:n,point:h.clone().applyMatrix4(this.matrixWorld),index:i,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){const e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}const Lo=new Ae,ko=new Ae;class Io extends To{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,i=[];for(let t=0,n=e.count;t<n;t+=2)Lo.fromBufferAttribute(e,t),ko.fromBufferAttribute(e,t+1),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+Lo.distanceTo(ko);t.setAttribute("lineDistance",new tn(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Po extends To{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class Ro extends Ui{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Gi(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const Bo=new Je,Do=new Ye,Uo=new He,No=new Ae;class Oo extends wi{constructor(t=new cn,e=new Ro){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=t.material,this.geometry=t.geometry,this}raycast(t,e){const i=this.geometry,n=this.matrixWorld,s=t.params.Points.threshold,r=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),Uo.copy(i.boundingSphere),Uo.applyMatrix4(n),Uo.radius+=s,!1===t.ray.intersectsSphere(Uo))return;Bo.copy(n).invert(),Do.copy(t.ray).applyMatrix4(Bo);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=i.index,c=i.attributes.position;if(null!==l){for(let i=Math.max(0,r.start),s=Math.min(l.count,r.start+r.count);i<s;i++){const s=l.getX(i);No.fromBufferAttribute(c,s),zo(No,s,o,n,t,e,this)}}else{for(let i=Math.max(0,r.start),s=Math.min(c.count,r.start+r.count);i<s;i++)No.fromBufferAttribute(c,i),zo(No,i,o,n,t,e,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){const e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function zo(t,e,i,n,s,r,a){const o=Do.distanceSqToPoint(t);if(o<i){const i=new Ae;Do.closestPointToPoint(t,i),i.applyMatrix4(n);const l=s.ray.origin.distanceTo(i);if(l<s.near||l>s.far)return;r.push({distance:l,distanceToRay:Math.sqrt(o),point:i,index:e,face:null,object:a})}}class Fo extends fe{constructor(t,e,i,n,s,r,a,o,l,c,h,d){super(null,r,a,o,l,c,n,s,h,d),this.isCompressedTexture=!0,this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class Go{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,n=this.getPoint(0),s=0;e.push(0);for(let r=1;r<=t;r++)i=this.getPoint(r/t),s+=i.distanceTo(n),e.push(s),n=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const i=this.getLengths();let n=0;const s=i.length;let r;r=e||t*i[s-1];let a,o=0,l=s-1;for(;o<=l;)if(n=Math.floor(o+(l-o)/2),a=i[n]-r,a<0)o=n+1;else{if(!(a>0)){l=n;break}l=n-1}if(n=l,i[n]===r)return n/(s-1);const c=i[n];return(n+(r-c)/(i[n+1]-c))/(s-1)}getTangent(t,e){const i=1e-4;let n=t-i,s=t+i;n<0&&(n=0),s>1&&(s=1);const r=this.getPoint(n),a=this.getPoint(s),o=e||(r.isVector2?new Yt:new Ae);return o.copy(a).sub(r).normalize(),o}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e){const i=new Ae,n=[],s=[],r=[],a=new Ae,o=new Je;for(let e=0;e<=t;e++){const i=e/t;n[e]=this.getTangentAt(i,new Ae)}s[0]=new Ae,r[0]=new Ae;let l=Number.MAX_VALUE;const c=Math.abs(n[0].x),h=Math.abs(n[0].y),d=Math.abs(n[0].z);c<=l&&(l=c,i.set(1,0,0)),h<=l&&(l=h,i.set(0,1,0)),d<=l&&i.set(0,0,1),a.crossVectors(n[0],i).normalize(),s[0].crossVectors(n[0],a),r[0].crossVectors(n[0],s[0]);for(let e=1;e<=t;e++){if(s[e]=s[e-1].clone(),r[e]=r[e-1].clone(),a.crossVectors(n[e-1],n[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(Gt(n[e-1].dot(n[e]),-1,1));s[e].applyMatrix4(o.makeRotationAxis(a,t))}r[e].crossVectors(n[e],s[e])}if(!0===e){let e=Math.acos(Gt(s[0].dot(s[t]),-1,1));e/=t,n[0].dot(a.crossVectors(s[0],s[t]))>0&&(e=-e);for(let i=1;i<=t;i++)s[i].applyMatrix4(o.makeRotationAxis(n[i],e*i)),r[i].crossVectors(n[i],s[i])}return{tangents:n,normals:s,binormals:r}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Ho extends Go{constructor(t=0,e=0,i=1,n=1,s=0,r=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=s,this.aEndAngle=r,this.aClockwise=a,this.aRotation=o}getPoint(t,e){const i=e||new Yt,n=2*Math.PI;let s=this.aEndAngle-this.aStartAngle;const r=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=n;for(;s>n;)s-=n;s<Number.EPSILON&&(s=r?0:n),!0!==this.aClockwise||r||(s===n?s=-n:s-=n);const a=this.aStartAngle+t*s;let o=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),i=o-this.aX,n=l-this.aY;o=i*t-n*e+this.aX,l=i*e+n*t+this.aY}return i.set(o,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}class Vo extends Ho{constructor(t,e,i,n,s,r){super(t,e,i,i,n,s,r),this.isArcCurve=!0,this.type="ArcCurve"}}function Wo(){let t=0,e=0,i=0,n=0;function s(s,r,a,o){t=s,e=a,i=-3*s+3*r-2*a-o,n=2*s-2*r+a+o}return{initCatmullRom:function(t,e,i,n,r){s(e,i,r*(i-t),r*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,r,a,o){let l=(e-t)/r-(i-t)/(r+a)+(i-e)/a,c=(i-e)/a-(n-e)/(a+o)+(n-i)/o;l*=a,c*=a,s(e,i,l,c)},calc:function(s){const r=s*s;return t+e*s+i*r+n*(r*s)}}}const jo=new Ae,Qo=new Wo,qo=new Wo,Zo=new Wo;class Xo extends Go{constructor(t=[],e=!1,i="centripetal",n=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}getPoint(t,e=new Ae){const i=e,n=this.points,s=n.length,r=(s-(this.closed?0:1))*t;let a,o,l=Math.floor(r),c=r-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/s)+1)*s:0===c&&l===s-1&&(l=s-2,c=1),this.closed||l>0?a=n[(l-1)%s]:(jo.subVectors(n[0],n[1]).add(n[0]),a=jo);const h=n[l%s],d=n[(l+1)%s];if(this.closed||l+2<s?o=n[(l+2)%s]:(jo.subVectors(n[s-1],n[s-2]).add(n[s-1]),o=jo),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(a.distanceToSquared(h),t),i=Math.pow(h.distanceToSquared(d),t),n=Math.pow(d.distanceToSquared(o),t);i<1e-4&&(i=1),e<1e-4&&(e=i),n<1e-4&&(n=i),Qo.initNonuniformCatmullRom(a.x,h.x,d.x,o.x,e,i,n),qo.initNonuniformCatmullRom(a.y,h.y,d.y,o.y,e,i,n),Zo.initNonuniformCatmullRom(a.z,h.z,d.z,o.z,e,i,n)}else"catmullrom"===this.curveType&&(Qo.initCatmullRom(a.x,h.x,d.x,o.x,this.tension),qo.initCatmullRom(a.y,h.y,d.y,o.y,this.tension),Zo.initCatmullRom(a.z,h.z,d.z,o.z,this.tension));return i.set(Qo.calc(c),qo.calc(c),Zo.calc(c)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new Ae).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Yo(t,e,i,n,s){const r=.5*(n-e),a=.5*(s-i),o=t*t;return(2*i-2*n+r+a)*(t*o)+(-3*i+3*n-2*r-a)*o+r*t+i}function Jo(t,e,i,n){return function(t,e){const i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function Ko(t,e,i,n,s){return function(t,e){const i=1-t;return i*i*i*e}(t,e)+function(t,e){const i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,s)}class $o extends Go{constructor(t=new Yt,e=new Yt,i=new Yt,n=new Yt){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new Yt){const i=e,n=this.v0,s=this.v1,r=this.v2,a=this.v3;return i.set(Ko(t,n.x,s.x,r.x,a.x),Ko(t,n.y,s.y,r.y,a.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class tl extends Go{constructor(t=new Ae,e=new Ae,i=new Ae,n=new Ae){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new Ae){const i=e,n=this.v0,s=this.v1,r=this.v2,a=this.v3;return i.set(Ko(t,n.x,s.x,r.x,a.x),Ko(t,n.y,s.y,r.y,a.y),Ko(t,n.z,s.z,r.z,a.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class el extends Go{constructor(t=new Yt,e=new Yt){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Yt){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Yt){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class il extends Go{constructor(t=new Ae,e=new Ae){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new Ae){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Ae){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class nl extends Go{constructor(t=new Yt,e=new Yt,i=new Yt){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new Yt){const i=e,n=this.v0,s=this.v1,r=this.v2;return i.set(Jo(t,n.x,s.x,r.x),Jo(t,n.y,s.y,r.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class sl extends Go{constructor(t=new Ae,e=new Ae,i=new Ae){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new Ae){const i=e,n=this.v0,s=this.v1,r=this.v2;return i.set(Jo(t,n.x,s.x,r.x),Jo(t,n.y,s.y,r.y),Jo(t,n.z,s.z,r.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class rl extends Go{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new Yt){const i=e,n=this.points,s=(n.length-1)*t,r=Math.floor(s),a=s-r,o=n[0===r?r:r-1],l=n[r],c=n[r>n.length-2?n.length-1:r+1],h=n[r>n.length-3?n.length-1:r+2];return i.set(Yo(a,o.x,l.x,c.x,h.x),Yo(a,o.y,l.y,c.y,h.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new Yt).fromArray(i))}return this}}var al=Object.freeze({__proto__:null,ArcCurve:Vo,CatmullRomCurve3:Xo,CubicBezierCurve:$o,CubicBezierCurve3:tl,EllipseCurve:Ho,LineCurve:el,LineCurve3:il,QuadraticBezierCurve:nl,QuadraticBezierCurve3:sl,SplineCurve:rl});class ol extends Go{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);t.equals(e)||this.curves.push(new el(e,t))}getPoint(t,e){const i=t*this.getLength(),n=this.getCurveLengths();let s=0;for(;s<n.length;){if(n[s]>=i){const t=n[s]-i,r=this.curves[s],a=r.getLength(),o=0===a?0:1-t/a;return r.getPointAt(o,e)}s++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let i;for(let n=0,s=this.curves;n<s.length;n++){const r=s[n],a=r.isEllipseCurve?2*t:r.isLineCurve||r.isLineCurve3?1:r.isSplineCurve?t*r.points.length:t,o=r.getPoints(a);for(let t=0;t<o.length;t++){const n=o[t];i&&i.equals(n)||(e.push(n),i=n)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push((new al[i.type]).fromJSON(i))}return this}}class ll extends ol{constructor(t){super(),this.type="Path",this.currentPoint=new Yt,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const i=new el(this.currentPoint.clone(),new Yt(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,n){const s=new nl(this.currentPoint.clone(),new Yt(t,e),new Yt(i,n));return this.curves.push(s),this.currentPoint.set(i,n),this}bezierCurveTo(t,e,i,n,s,r){const a=new $o(this.currentPoint.clone(),new Yt(t,e),new Yt(i,n),new Yt(s,r));return this.curves.push(a),this.currentPoint.set(s,r),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),i=new rl(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,n,s,r){const a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+a,e+o,i,n,s,r),this}absarc(t,e,i,n,s,r){return this.absellipse(t,e,i,i,n,s,r),this}ellipse(t,e,i,n,s,r,a,o){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,i,n,s,r,a,o),this}absellipse(t,e,i,n,s,r,a,o){const l=new Ho(t,e,i,n,s,r,a,o);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class cl extends cn{constructor(t=[new Yt(0,-.5),new Yt(.5,0),new Yt(0,.5)],e=12,i=0,n=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:i,phiLength:n},e=Math.floor(e),n=Gt(n,0,2*Math.PI);const s=[],r=[],a=[],o=[],l=[],c=1/e,h=new Ae,d=new Yt,u=new Ae,p=new Ae,m=new Ae;let f=0,g=0;for(let e=0;e<=t.length-1;e++)switch(e){case 0:f=t[e+1].x-t[e].x,g=t[e+1].y-t[e].y,u.x=1*g,u.y=-f,u.z=0*g,m.copy(u),u.normalize(),o.push(u.x,u.y,u.z);break;case t.length-1:o.push(m.x,m.y,m.z);break;default:f=t[e+1].x-t[e].x,g=t[e+1].y-t[e].y,u.x=1*g,u.y=-f,u.z=0*g,p.copy(u),u.x+=m.x,u.y+=m.y,u.z+=m.z,u.normalize(),o.push(u.x,u.y,u.z),m.copy(p)}for(let s=0;s<=e;s++){const u=i+s*c*n,p=Math.sin(u),m=Math.cos(u);for(let i=0;i<=t.length-1;i++){h.x=t[i].x*p,h.y=t[i].y,h.z=t[i].x*m,r.push(h.x,h.y,h.z),d.x=s/e,d.y=i/(t.length-1),a.push(d.x,d.y);const n=o[3*i+0]*p,c=o[3*i+1],u=o[3*i+0]*m;l.push(n,c,u)}}for(let i=0;i<e;i++)for(let e=0;e<t.length-1;e++){const n=e+i*t.length,r=n,a=n+t.length,o=n+t.length+1,l=n+1;s.push(r,a,l),s.push(o,l,a)}this.setIndex(s),this.setAttribute("position",new tn(r,3)),this.setAttribute("uv",new tn(a,2)),this.setAttribute("normal",new tn(l,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new cl(t.points,t.segments,t.phiStart,t.phiLength)}}class hl extends cl{constructor(t=1,e=1,i=4,n=8){const s=new ll;s.absarc(0,-e/2,t,1.5*Math.PI,0),s.absarc(0,e/2,t,0,.5*Math.PI),super(s.getPoints(i),n),this.type="CapsuleGeometry",this.parameters={radius:t,height:e,capSegments:i,radialSegments:n}}static fromJSON(t){return new hl(t.radius,t.length,t.capSegments,t.radialSegments)}}class dl extends cn{constructor(t=1,e=32,i=0,n=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:i,thetaLength:n},e=Math.max(3,e);const s=[],r=[],a=[],o=[],l=new Ae,c=new Yt;r.push(0,0,0),a.push(0,0,1),o.push(.5,.5);for(let s=0,h=3;s<=e;s++,h+=3){const d=i+s/e*n;l.x=t*Math.cos(d),l.y=t*Math.sin(d),r.push(l.x,l.y,l.z),a.push(0,0,1),c.x=(r[h]/t+1)/2,c.y=(r[h+1]/t+1)/2,o.push(c.x,c.y)}for(let t=1;t<=e;t++)s.push(t,t+1,0);this.setIndex(s),this.setAttribute("position",new tn(r,3)),this.setAttribute("normal",new tn(a,3)),this.setAttribute("uv",new tn(o,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new dl(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class ul extends cn{constructor(t=1,e=1,i=1,n=32,s=1,r=!1,a=0,o=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:i,radialSegments:n,heightSegments:s,openEnded:r,thetaStart:a,thetaLength:o};const l=this;n=Math.floor(n),s=Math.floor(s);const c=[],h=[],d=[],u=[];let p=0;const m=[],f=i/2;let g=0;function v(i){const s=p,r=new Yt,m=new Ae;let v=0;const _=!0===i?t:e,y=!0===i?1:-1;for(let t=1;t<=n;t++)h.push(0,f*y,0),d.push(0,y,0),u.push(.5,.5),p++;const x=p;for(let t=0;t<=n;t++){const e=t/n*o+a,i=Math.cos(e),s=Math.sin(e);m.x=_*s,m.y=f*y,m.z=_*i,h.push(m.x,m.y,m.z),d.push(0,y,0),r.x=.5*i+.5,r.y=.5*s*y+.5,u.push(r.x,r.y),p++}for(let t=0;t<n;t++){const e=s+t,n=x+t;!0===i?c.push(n,n+1,e):c.push(n+1,n,e),v+=3}l.addGroup(g,v,!0===i?1:2),g+=v}!function(){const r=new Ae,v=new Ae;let _=0;const y=(e-t)/i;for(let l=0;l<=s;l++){const c=[],g=l/s,_=g*(e-t)+t;for(let t=0;t<=n;t++){const e=t/n,s=e*o+a,l=Math.sin(s),m=Math.cos(s);v.x=_*l,v.y=-g*i+f,v.z=_*m,h.push(v.x,v.y,v.z),r.set(l,y,m).normalize(),d.push(r.x,r.y,r.z),u.push(e,1-g),c.push(p++)}m.push(c)}for(let t=0;t<n;t++)for(let e=0;e<s;e++){const i=m[e][t],n=m[e+1][t],s=m[e+1][t+1],r=m[e][t+1];c.push(i,n,r),c.push(n,s,r),_+=6}l.addGroup(g,_,0),g+=_}(),!1===r&&(t>0&&v(!0),e>0&&v(!1)),this.setIndex(c),this.setAttribute("position",new tn(h,3)),this.setAttribute("normal",new tn(d,3)),this.setAttribute("uv",new tn(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ul(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class pl extends ul{constructor(t=1,e=1,i=32,n=1,s=!1,r=0,a=2*Math.PI){super(0,t,e,i,n,s,r,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:i,heightSegments:n,openEnded:s,thetaStart:r,thetaLength:a}}static fromJSON(t){return new pl(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ml extends cn{constructor(t=[],e=[],i=1,n=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:i,detail:n};const s=[],r=[];function a(t,e,i,n){const s=n+1,r=[];for(let n=0;n<=s;n++){r[n]=[];const a=t.clone().lerp(i,n/s),o=e.clone().lerp(i,n/s),l=s-n;for(let t=0;t<=l;t++)r[n][t]=0===t&&n===s?a:a.clone().lerp(o,t/l)}for(let t=0;t<s;t++)for(let e=0;e<2*(s-t)-1;e++){const i=Math.floor(e/2);e%2==0?(o(r[t][i+1]),o(r[t+1][i]),o(r[t][i])):(o(r[t][i+1]),o(r[t+1][i+1]),o(r[t+1][i]))}}function o(t){s.push(t.x,t.y,t.z)}function l(e,i){const n=3*e;i.x=t[n+0],i.y=t[n+1],i.z=t[n+2]}function c(t,e,i,n){n<0&&1===t.x&&(r[e]=t.x-1),0===i.x&&0===i.z&&(r[e]=n/2/Math.PI+.5)}function h(t){return Math.atan2(t.z,-t.x)}!function(t){const i=new Ae,n=new Ae,s=new Ae;for(let r=0;r<e.length;r+=3)l(e[r+0],i),l(e[r+1],n),l(e[r+2],s),a(i,n,s,t)}(n),function(t){const e=new Ae;for(let i=0;i<s.length;i+=3)e.x=s[i+0],e.y=s[i+1],e.z=s[i+2],e.normalize().multiplyScalar(t),s[i+0]=e.x,s[i+1]=e.y,s[i+2]=e.z}(i),function(){const t=new Ae;for(let i=0;i<s.length;i+=3){t.x=s[i+0],t.y=s[i+1],t.z=s[i+2];const n=h(t)/2/Math.PI+.5,a=(e=t,Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5);r.push(n,1-a)}var e;(function(){const t=new Ae,e=new Ae,i=new Ae,n=new Ae,a=new Yt,o=new Yt,l=new Yt;for(let d=0,u=0;d<s.length;d+=9,u+=6){t.set(s[d+0],s[d+1],s[d+2]),e.set(s[d+3],s[d+4],s[d+5]),i.set(s[d+6],s[d+7],s[d+8]),a.set(r[u+0],r[u+1]),o.set(r[u+2],r[u+3]),l.set(r[u+4],r[u+5]),n.copy(t).add(e).add(i).divideScalar(3);const p=h(n);c(a,u+0,t,p),c(o,u+2,e,p),c(l,u+4,i,p)}})(),function(){for(let t=0;t<r.length;t+=6){const e=r[t+0],i=r[t+2],n=r[t+4],s=Math.max(e,i,n),a=Math.min(e,i,n);s>.9&&a<.1&&(e<.2&&(r[t+0]+=1),i<.2&&(r[t+2]+=1),n<.2&&(r[t+4]+=1))}}()}(),this.setAttribute("position",new tn(s,3)),this.setAttribute("normal",new tn(s.slice(),3)),this.setAttribute("uv",new tn(r,2)),0===n?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ml(t.vertices,t.indices,t.radius,t.details)}}class fl extends ml{constructor(t=1,e=0){const i=(1+Math.sqrt(5))/2,n=1/i;super([-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,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n],[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],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new fl(t.radius,t.detail)}}const gl=new Ae,vl=new Ae,_l=new Ae,yl=new Bi;class xl extends cn{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const i=4,n=Math.pow(10,i),s=Math.cos(Ot*e),r=t.getIndex(),a=t.getAttribute("position"),o=r?r.count:a.count,l=[0,0,0],c=["a","b","c"],h=new Array(3),d={},u=[];for(let t=0;t<o;t+=3){r?(l[0]=r.getX(t),l[1]=r.getX(t+1),l[2]=r.getX(t+2)):(l[0]=t,l[1]=t+1,l[2]=t+2);const{a:e,b:i,c:o}=yl;if(e.fromBufferAttribute(a,l[0]),i.fromBufferAttribute(a,l[1]),o.fromBufferAttribute(a,l[2]),yl.getNormal(_l),h[0]=`${Math.round(e.x*n)},${Math.round(e.y*n)},${Math.round(e.z*n)}`,h[1]=`${Math.round(i.x*n)},${Math.round(i.y*n)},${Math.round(i.z*n)}`,h[2]=`${Math.round(o.x*n)},${Math.round(o.y*n)},${Math.round(o.z*n)}`,h[0]!==h[1]&&h[1]!==h[2]&&h[2]!==h[0])for(let t=0;t<3;t++){const e=(t+1)%3,i=h[t],n=h[e],r=yl[c[t]],a=yl[c[e]],o=`${i}_${n}`,p=`${n}_${i}`;p in d&&d[p]?(_l.dot(d[p].normal)<=s&&(u.push(r.x,r.y,r.z),u.push(a.x,a.y,a.z)),d[p]=null):o in d||(d[o]={index0:l[t],index1:l[e],normal:_l.clone()})}}for(const t in d)if(d[t]){const{index0:e,index1:i}=d[t];gl.fromBufferAttribute(a,e),vl.fromBufferAttribute(a,i),u.push(gl.x,gl.y,gl.z),u.push(vl.x,vl.y,vl.z)}this.setAttribute("position",new tn(u,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}class Al extends ll{constructor(t){super(t),this.uuid=Ft(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push((new ll).fromJSON(i))}return this}}const wl=function(t,e,i=2){const n=e&&e.length,s=n?e[0]*i:t.length;let r=bl(t,0,s,i,!0);const a=[];if(!r||r.next===r.prev)return a;let o,l,c,h,d,u,p;if(n&&(r=function(t,e,i,n){const s=[];let r,a,o,l,c;for(r=0,a=e.length;r<a;r++)o=e[r]*n,l=r<a-1?e[r+1]*n:t.length,c=bl(t,o,l,n,!1),c===c.next&&(c.steiner=!0),s.push(Bl(c));for(s.sort(kl),r=0;r<s.length;r++)i=Il(s[r],i);return i}(t,e,r,i)),t.length>80*i){o=c=t[0],l=h=t[1];for(let e=i;e<s;e+=i)d=t[e],u=t[e+1],d<o&&(o=d),u<l&&(l=u),d>c&&(c=d),u>h&&(h=u);p=Math.max(c-o,h-l),p=0!==p?32767/p:0}return Sl(r,a,i,o,l,p,0),a};function bl(t,e,i,n,s){let r,a;if(s===function(t,e,i,n){let s=0;for(let r=e,a=i-n;r<i;r+=n)s+=(t[a]-t[r])*(t[r+1]+t[a+1]),a=r;return s}(t,e,i,n)>0)for(r=e;r<i;r+=n)a=Wl(r,t[r],t[r+1],a);else for(r=i-n;r>=e;r-=n)a=Wl(r,t[r],t[r+1],a);return a&&Ol(a,a.next)&&(jl(a),a=a.next),a}function Ml(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!Ol(n,n.next)&&0!==Nl(n.prev,n,n.next))n=n.next;else{if(jl(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function Sl(t,e,i,n,s,r,a){if(!t)return;!a&&r&&function(t,e,i,n){let s=t;do{0===s.z&&(s.z=Rl(s.x,s.y,e,i,n)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next}while(s!==t);s.prevZ.nextZ=null,s.prevZ=null,function(t){let e,i,n,s,r,a,o,l,c=1;do{for(i=t,t=null,r=null,a=0;i;){for(a++,n=i,o=0,e=0;e<c&&(o++,n=n.nextZ,n);e++);for(l=c;o>0||l>0&&n;)0!==o&&(0===l||!n||i.z<=n.z)?(s=i,i=i.nextZ,o--):(s=n,n=n.nextZ,l--),r?r.nextZ=s:t=s,s.prevZ=r,r=s;i=n}r.nextZ=null,c*=2}while(a>1)}(s)}(t,n,s,r);let o,l,c=t;for(;t.prev!==t.next;)if(o=t.prev,l=t.next,r?Cl(t,n,s,r):El(t))e.push(o.i/i|0),e.push(t.i/i|0),e.push(l.i/i|0),jl(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?Sl(t=Tl(Ml(t),e,i),e,i,n,s,r,2):2===a&&Ll(t,e,i,n,s,r):Sl(Ml(t),e,i,n,s,r,1);break}}function El(t){const e=t.prev,i=t,n=t.next;if(Nl(e,i,n)>=0)return!1;const s=e.x,r=i.x,a=n.x,o=e.y,l=i.y,c=n.y,h=s<r?s<a?s:a:r<a?r:a,d=o<l?o<c?o:c:l<c?l:c,u=s>r?s>a?s:a:r>a?r:a,p=o>l?o>c?o:c:l>c?l:c;let m=n.next;for(;m!==e;){if(m.x>=h&&m.x<=u&&m.y>=d&&m.y<=p&&Dl(s,o,r,l,a,c,m.x,m.y)&&Nl(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Cl(t,e,i,n){const s=t.prev,r=t,a=t.next;if(Nl(s,r,a)>=0)return!1;const o=s.x,l=r.x,c=a.x,h=s.y,d=r.y,u=a.y,p=o<l?o<c?o:c:l<c?l:c,m=h<d?h<u?h:u:d<u?d:u,f=o>l?o>c?o:c:l>c?l:c,g=h>d?h>u?h:u:d>u?d:u,v=Rl(p,m,e,i,n),_=Rl(f,g,e,i,n);let y=t.prevZ,x=t.nextZ;for(;y&&y.z>=v&&x&&x.z<=_;){if(y.x>=p&&y.x<=f&&y.y>=m&&y.y<=g&&y!==s&&y!==a&&Dl(o,h,l,d,c,u,y.x,y.y)&&Nl(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,x.x>=p&&x.x<=f&&x.y>=m&&x.y<=g&&x!==s&&x!==a&&Dl(o,h,l,d,c,u,x.x,x.y)&&Nl(x.prev,x,x.next)>=0)return!1;x=x.nextZ}for(;y&&y.z>=v;){if(y.x>=p&&y.x<=f&&y.y>=m&&y.y<=g&&y!==s&&y!==a&&Dl(o,h,l,d,c,u,y.x,y.y)&&Nl(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;x&&x.z<=_;){if(x.x>=p&&x.x<=f&&x.y>=m&&x.y<=g&&x!==s&&x!==a&&Dl(o,h,l,d,c,u,x.x,x.y)&&Nl(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Tl(t,e,i){let n=t;do{const s=n.prev,r=n.next.next;!Ol(s,r)&&zl(s,n,n.next,r)&&Hl(s,r)&&Hl(r,s)&&(e.push(s.i/i|0),e.push(n.i/i|0),e.push(r.i/i|0),jl(n),jl(n.next),n=t=r),n=n.next}while(n!==t);return Ml(n)}function Ll(t,e,i,n,s,r){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Ul(a,t)){let o=Vl(a,t);return a=Ml(a,a.next),o=Ml(o,o.next),Sl(a,e,i,n,s,r,0),void Sl(o,e,i,n,s,r,0)}t=t.next}a=a.next}while(a!==t)}function kl(t,e){return t.x-e.x}function Il(t,e){const i=function(t,e){let i,n=e,s=-1/0;const r=t.x,a=t.y;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){const t=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(t<=r&&t>s&&(s=t,i=n.x<n.next.x?n:n.next,t===r))return i}n=n.next}while(n!==e);if(!i)return null;const o=i,l=i.x,c=i.y;let h,d=1/0;n=i;do{r>=n.x&&n.x>=l&&r!==n.x&&Dl(a<c?r:s,a,l,c,a<c?s:r,a,n.x,n.y)&&(h=Math.abs(a-n.y)/(r-n.x),Hl(n,t)&&(h<d||h===d&&(n.x>i.x||n.x===i.x&&Pl(i,n)))&&(i=n,d=h)),n=n.next}while(n!==o);return i}(t,e);if(!i)return e;const n=Vl(i,t);return Ml(n,n.next),Ml(i,i.next)}function Pl(t,e){return Nl(t.prev,t,e.prev)<0&&Nl(e.next,t,t.next)<0}function Rl(t,e,i,n,s){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*s|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*s|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Bl(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Dl(t,e,i,n,s,r,a,o){return(s-a)*(e-o)>=(t-a)*(r-o)&&(t-a)*(n-o)>=(i-a)*(e-o)&&(i-a)*(r-o)>=(s-a)*(n-o)}function Ul(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&zl(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Hl(t,e)&&Hl(e,t)&&function(t,e){let i=t,n=!1;const s=(t.x+e.x)/2,r=(t.y+e.y)/2;do{i.y>r!=i.next.y>r&&i.next.y!==i.y&&s<(i.next.x-i.x)*(r-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(Nl(t.prev,t,e.prev)||Nl(t,e.prev,e))||Ol(t,e)&&Nl(t.prev,t,t.next)>0&&Nl(e.prev,e,e.next)>0)}function Nl(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Ol(t,e){return t.x===e.x&&t.y===e.y}function zl(t,e,i,n){const s=Gl(Nl(t,e,i)),r=Gl(Nl(t,e,n)),a=Gl(Nl(i,n,t)),o=Gl(Nl(i,n,e));return s!==r&&a!==o||(!(0!==s||!Fl(t,i,e))||(!(0!==r||!Fl(t,n,e))||(!(0!==a||!Fl(i,t,n))||!(0!==o||!Fl(i,e,n)))))}function Fl(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Gl(t){return t>0?1:t<0?-1:0}function Hl(t,e){return Nl(t.prev,t,t.next)<0?Nl(t,e,t.next)>=0&&Nl(t,t.prev,e)>=0:Nl(t,e,t.prev)<0||Nl(t,t.next,e)<0}function Vl(t,e){const i=new Ql(t.i,t.x,t.y),n=new Ql(e.i,e.x,e.y),s=t.next,r=e.prev;return t.next=e,e.prev=t,i.next=s,s.prev=i,n.next=i,i.prev=n,r.next=n,n.prev=r,n}function Wl(t,e,i,n){const s=new Ql(t,e,i);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function jl(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Ql(t,e,i){this.i=t,this.x=e,this.y=i,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}class ql{static area(t){const e=t.length;let i=0;for(let n=e-1,s=0;s<e;n=s++)i+=t[n].x*t[s].y-t[s].x*t[n].y;return.5*i}static isClockWise(t){return ql.area(t)<0}static triangulateShape(t,e){const i=[],n=[],s=[];Zl(t),Xl(i,t);let r=t.length;e.forEach(Zl);for(let t=0;t<e.length;t++)n.push(r),r+=e[t].length,Xl(i,e[t]);const a=wl(i,n);for(let t=0;t<a.length;t+=3)s.push(a.slice(t,t+3));return s}}function Zl(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Xl(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}class Yl extends cn{constructor(t=new Al([new Yt(.5,.5),new Yt(-.5,.5),new Yt(-.5,-.5),new Yt(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const i=this,n=[],s=[];for(let e=0,i=t.length;e<i;e++){r(t[e])}function r(t){const r=[],a=void 0!==e.curveSegments?e.curveSegments:12,o=void 0!==e.steps?e.steps:1,l=void 0!==e.depth?e.depth:1;let c=void 0===e.bevelEnabled||e.bevelEnabled,h=void 0!==e.bevelThickness?e.bevelThickness:.2,d=void 0!==e.bevelSize?e.bevelSize:h-.1,u=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const m=e.extrudePath,f=void 0!==e.UVGenerator?e.UVGenerator:Jl;let g,v,_,y,x,A=!1;m&&(g=m.getSpacedPoints(o),A=!0,c=!1,v=m.computeFrenetFrames(o,!1),_=new Ae,y=new Ae,x=new Ae),c||(p=0,h=0,d=0,u=0);const w=t.extractPoints(a);let b=w.shape;const M=w.holes;if(!ql.isClockWise(b)){b=b.reverse();for(let t=0,e=M.length;t<e;t++){const e=M[t];ql.isClockWise(e)&&(M[t]=e.reverse())}}const S=ql.triangulateShape(b,M),E=b;for(let t=0,e=M.length;t<e;t++){const e=M[t];b=b.concat(e)}function C(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().addScaledVector(e,i)}const T=b.length,L=S.length;function k(t,e,i){let n,s,r;const a=t.x-e.x,o=t.y-e.y,l=i.x-t.x,c=i.y-t.y,h=a*a+o*o,d=a*c-o*l;if(Math.abs(d)>Number.EPSILON){const d=Math.sqrt(h),u=Math.sqrt(l*l+c*c),p=e.x-o/d,m=e.y+a/d,f=((i.x-c/u-p)*c-(i.y+l/u-m)*l)/(a*c-o*l);n=p+a*f-t.x,s=m+o*f-t.y;const g=n*n+s*s;if(g<=2)return new Yt(n,s);r=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?l>Number.EPSILON&&(t=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(c)&&(t=!0),t?(n=-o,s=a,r=Math.sqrt(h)):(n=a,s=o,r=Math.sqrt(h/2))}return new Yt(n/r,s/r)}const I=[];for(let t=0,e=E.length,i=e-1,n=t+1;t<e;t++,i++,n++)i===e&&(i=0),n===e&&(n=0),I[t]=k(E[t],E[i],E[n]);const P=[];let R,B=I.concat();for(let t=0,e=M.length;t<e;t++){const e=M[t];R=[];for(let t=0,i=e.length,n=i-1,s=t+1;t<i;t++,n++,s++)n===i&&(n=0),s===i&&(s=0),R[t]=k(e[t],e[n],e[s]);P.push(R),B=B.concat(R)}for(let t=0;t<p;t++){const e=t/p,i=h*Math.cos(e*Math.PI/2),n=d*Math.sin(e*Math.PI/2)+u;for(let t=0,e=E.length;t<e;t++){const e=C(E[t],I[t],n);N(e.x,e.y,-i)}for(let t=0,e=M.length;t<e;t++){const e=M[t];R=P[t];for(let t=0,s=e.length;t<s;t++){const s=C(e[t],R[t],n);N(s.x,s.y,-i)}}}const D=d+u;for(let t=0;t<T;t++){const e=c?C(b[t],B[t],D):b[t];A?(y.copy(v.normals[0]).multiplyScalar(e.x),_.copy(v.binormals[0]).multiplyScalar(e.y),x.copy(g[0]).add(y).add(_),N(x.x,x.y,x.z)):N(e.x,e.y,0)}for(let t=1;t<=o;t++)for(let e=0;e<T;e++){const i=c?C(b[e],B[e],D):b[e];A?(y.copy(v.normals[t]).multiplyScalar(i.x),_.copy(v.binormals[t]).multiplyScalar(i.y),x.copy(g[t]).add(y).add(_),N(x.x,x.y,x.z)):N(i.x,i.y,l/o*t)}for(let t=p-1;t>=0;t--){const e=t/p,i=h*Math.cos(e*Math.PI/2),n=d*Math.sin(e*Math.PI/2)+u;for(let t=0,e=E.length;t<e;t++){const e=C(E[t],I[t],n);N(e.x,e.y,l+i)}for(let t=0,e=M.length;t<e;t++){const e=M[t];R=P[t];for(let t=0,s=e.length;t<s;t++){const s=C(e[t],R[t],n);A?N(s.x,s.y+g[o-1].y,g[o-1].x+i):N(s.x,s.y,l+i)}}}function U(t,e){let i=t.length;for(;--i>=0;){const n=i;let s=i-1;s<0&&(s=t.length-1);for(let t=0,i=o+2*p;t<i;t++){const i=T*t,r=T*(t+1);z(e+n+i,e+s+i,e+s+r,e+n+r)}}}function N(t,e,i){r.push(t),r.push(e),r.push(i)}function O(t,e,s){F(t),F(e),F(s);const r=n.length/3,a=f.generateTopUV(i,n,r-3,r-2,r-1);G(a[0]),G(a[1]),G(a[2])}function z(t,e,s,r){F(t),F(e),F(r),F(e),F(s),F(r);const a=n.length/3,o=f.generateSideWallUV(i,n,a-6,a-3,a-2,a-1);G(o[0]),G(o[1]),G(o[3]),G(o[1]),G(o[2]),G(o[3])}function F(t){n.push(r[3*t+0]),n.push(r[3*t+1]),n.push(r[3*t+2])}function G(t){s.push(t.x),s.push(t.y)}!function(){const t=n.length/3;if(c){let t=0,e=T*t;for(let t=0;t<L;t++){const i=S[t];O(i[2]+e,i[1]+e,i[0]+e)}t=o+2*p,e=T*t;for(let t=0;t<L;t++){const i=S[t];O(i[0]+e,i[1]+e,i[2]+e)}}else{for(let t=0;t<L;t++){const e=S[t];O(e[2],e[1],e[0])}for(let t=0;t<L;t++){const e=S[t];O(e[0]+T*o,e[1]+T*o,e[2]+T*o)}}i.addGroup(t,n.length/3-t,0)}(),function(){const t=n.length/3;let e=0;U(E,e),e+=E.length;for(let t=0,i=M.length;t<i;t++){const i=M[t];U(i,e),e+=i.length}i.addGroup(t,n.length/3-t,1)}()}this.setAttribute("position",new tn(n,3)),this.setAttribute("uv",new tn(s,2)),this.computeVertexNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return function(t,e,i){if(i.shapes=[],Array.isArray(t))for(let e=0,n=t.length;e<n;e++){const n=t[e];i.shapes.push(n.uuid)}else i.shapes.push(t.uuid);i.options=Object.assign({},e),void 0!==e.extrudePath&&(i.options.extrudePath=e.extrudePath.toJSON());return i}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const i=[];for(let n=0,s=t.shapes.length;n<s;n++){const s=e[t.shapes[n]];i.push(s)}const n=t.options.extrudePath;return void 0!==n&&(t.options.extrudePath=(new al[n.type]).fromJSON(n)),new Yl(i,t.options)}}const Jl={generateTopUV:function(t,e,i,n,s){const r=e[3*i],a=e[3*i+1],o=e[3*n],l=e[3*n+1],c=e[3*s],h=e[3*s+1];return[new Yt(r,a),new Yt(o,l),new Yt(c,h)]},generateSideWallUV:function(t,e,i,n,s,r){const a=e[3*i],o=e[3*i+1],l=e[3*i+2],c=e[3*n],h=e[3*n+1],d=e[3*n+2],u=e[3*s],p=e[3*s+1],m=e[3*s+2],f=e[3*r],g=e[3*r+1],v=e[3*r+2];return Math.abs(o-h)<Math.abs(a-c)?[new Yt(a,1-l),new Yt(c,1-d),new Yt(u,1-m),new Yt(f,1-v)]:[new Yt(o,1-l),new Yt(h,1-d),new Yt(p,1-m),new Yt(g,1-v)]}};class Kl extends ml{constructor(t=1,e=0){const i=(1+Math.sqrt(5))/2;super([-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],[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],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Kl(t.radius,t.detail)}}class $l extends ml{constructor(t=1,e=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new $l(t.radius,t.detail)}}class tc extends cn{constructor(t=.5,e=1,i=32,n=1,s=0,r=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:i,phiSegments:n,thetaStart:s,thetaLength:r},i=Math.max(3,i);const a=[],o=[],l=[],c=[];let h=t;const d=(e-t)/(n=Math.max(1,n)),u=new Ae,p=new Yt;for(let t=0;t<=n;t++){for(let t=0;t<=i;t++){const n=s+t/i*r;u.x=h*Math.cos(n),u.y=h*Math.sin(n),o.push(u.x,u.y,u.z),l.push(0,0,1),p.x=(u.x/e+1)/2,p.y=(u.y/e+1)/2,c.push(p.x,p.y)}h+=d}for(let t=0;t<n;t++){const e=t*(i+1);for(let t=0;t<i;t++){const n=t+e,s=n,r=n+i+1,o=n+i+2,l=n+1;a.push(s,r,l),a.push(r,o,l)}}this.setIndex(a),this.setAttribute("position",new tn(o,3)),this.setAttribute("normal",new tn(l,3)),this.setAttribute("uv",new tn(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new tc(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class ec extends cn{constructor(t=new Al([new Yt(0,.5),new Yt(-.5,-.5),new Yt(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const i=[],n=[],s=[],r=[];let a=0,o=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(a,o,e),a+=o,o=0;function l(t){const a=n.length/3,l=t.extractPoints(e);let c=l.shape;const h=l.holes;!1===ql.isClockWise(c)&&(c=c.reverse());for(let t=0,e=h.length;t<e;t++){const e=h[t];!0===ql.isClockWise(e)&&(h[t]=e.reverse())}const d=ql.triangulateShape(c,h);for(let t=0,e=h.length;t<e;t++){const e=h[t];c=c.concat(e)}for(let t=0,e=c.length;t<e;t++){const e=c[t];n.push(e.x,e.y,0),s.push(0,0,1),r.push(e.x,e.y)}for(let t=0,e=d.length;t<e;t++){const e=d[t],n=e[0]+a,s=e[1]+a,r=e[2]+a;i.push(n,s,r),o+=3}}this.setIndex(i),this.setAttribute("position",new tn(n,3)),this.setAttribute("normal",new tn(s,3)),this.setAttribute("uv",new tn(r,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let i=0,n=t.length;i<n;i++){const n=t[i];e.shapes.push(n.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){const i=[];for(let n=0,s=t.shapes.length;n<s;n++){const s=e[t.shapes[n]];i.push(s)}return new ec(i,t.curveSegments)}}class ic extends cn{constructor(t=1,e=32,i=16,n=0,s=2*Math.PI,r=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:s,thetaStart:r,thetaLength:a},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));const o=Math.min(r+a,Math.PI);let l=0;const c=[],h=new Ae,d=new Ae,u=[],p=[],m=[],f=[];for(let u=0;u<=i;u++){const g=[],v=u/i;let _=0;0===u&&0===r?_=.5/e:u===i&&o===Math.PI&&(_=-.5/e);for(let i=0;i<=e;i++){const o=i/e;h.x=-t*Math.cos(n+o*s)*Math.sin(r+v*a),h.y=t*Math.cos(r+v*a),h.z=t*Math.sin(n+o*s)*Math.sin(r+v*a),p.push(h.x,h.y,h.z),d.copy(h).normalize(),m.push(d.x,d.y,d.z),f.push(o+_,1-v),g.push(l++)}c.push(g)}for(let t=0;t<i;t++)for(let n=0;n<e;n++){const e=c[t][n+1],s=c[t][n],a=c[t+1][n],l=c[t+1][n+1];(0!==t||r>0)&&u.push(e,s,l),(t!==i-1||o<Math.PI)&&u.push(s,a,l)}this.setIndex(u),this.setAttribute("position",new tn(p,3)),this.setAttribute("normal",new tn(m,3)),this.setAttribute("uv",new tn(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ic(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class nc extends ml{constructor(t=1,e=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new nc(t.radius,t.detail)}}class sc extends cn{constructor(t=1,e=.4,i=12,n=48,s=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:i,tubularSegments:n,arc:s},i=Math.floor(i),n=Math.floor(n);const r=[],a=[],o=[],l=[],c=new Ae,h=new Ae,d=new Ae;for(let r=0;r<=i;r++)for(let u=0;u<=n;u++){const p=u/n*s,m=r/i*Math.PI*2;h.x=(t+e*Math.cos(m))*Math.cos(p),h.y=(t+e*Math.cos(m))*Math.sin(p),h.z=e*Math.sin(m),a.push(h.x,h.y,h.z),c.x=t*Math.cos(p),c.y=t*Math.sin(p),d.subVectors(h,c).normalize(),o.push(d.x,d.y,d.z),l.push(u/n),l.push(r/i)}for(let t=1;t<=i;t++)for(let e=1;e<=n;e++){const i=(n+1)*t+e-1,s=(n+1)*(t-1)+e-1,a=(n+1)*(t-1)+e,o=(n+1)*t+e;r.push(i,s,o),r.push(s,a,o)}this.setIndex(r),this.setAttribute("position",new tn(a,3)),this.setAttribute("normal",new tn(o,3)),this.setAttribute("uv",new tn(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new sc(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class rc extends cn{constructor(t=1,e=.4,i=64,n=8,s=2,r=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:i,radialSegments:n,p:s,q:r},i=Math.floor(i),n=Math.floor(n);const a=[],o=[],l=[],c=[],h=new Ae,d=new Ae,u=new Ae,p=new Ae,m=new Ae,f=new Ae,g=new Ae;for(let a=0;a<=i;++a){const _=a/i*s*Math.PI*2;v(_,s,r,t,u),v(_+.01,s,r,t,p),f.subVectors(p,u),g.addVectors(p,u),m.crossVectors(f,g),g.crossVectors(m,f),m.normalize(),g.normalize();for(let t=0;t<=n;++t){const s=t/n*Math.PI*2,r=-e*Math.cos(s),p=e*Math.sin(s);h.x=u.x+(r*g.x+p*m.x),h.y=u.y+(r*g.y+p*m.y),h.z=u.z+(r*g.z+p*m.z),o.push(h.x,h.y,h.z),d.subVectors(h,u).normalize(),l.push(d.x,d.y,d.z),c.push(a/i),c.push(t/n)}}for(let t=1;t<=i;t++)for(let e=1;e<=n;e++){const i=(n+1)*(t-1)+(e-1),s=(n+1)*t+(e-1),r=(n+1)*t+e,o=(n+1)*(t-1)+e;a.push(i,s,o),a.push(s,r,o)}function v(t,e,i,n,s){const r=Math.cos(t),a=Math.sin(t),o=i/e*t,l=Math.cos(o);s.x=n*(2+l)*.5*r,s.y=n*(2+l)*a*.5,s.z=n*Math.sin(o)*.5}this.setIndex(a),this.setAttribute("position",new tn(o,3)),this.setAttribute("normal",new tn(l,3)),this.setAttribute("uv",new tn(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new rc(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class ac extends cn{constructor(t=new sl(new Ae(-1,-1,0),new Ae(-1,1,0),new Ae(1,1,0)),e=64,i=1,n=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:i,radialSegments:n,closed:s};const r=t.computeFrenetFrames(e,s);this.tangents=r.tangents,this.normals=r.normals,this.binormals=r.binormals;const a=new Ae,o=new Ae,l=new Yt;let c=new Ae;const h=[],d=[],u=[],p=[];function m(s){c=t.getPointAt(s/e,c);const l=r.normals[s],u=r.binormals[s];for(let t=0;t<=n;t++){const e=t/n*Math.PI*2,s=Math.sin(e),r=-Math.cos(e);o.x=r*l.x+s*u.x,o.y=r*l.y+s*u.y,o.z=r*l.z+s*u.z,o.normalize(),d.push(o.x,o.y,o.z),a.x=c.x+i*o.x,a.y=c.y+i*o.y,a.z=c.z+i*o.z,h.push(a.x,a.y,a.z)}}!function(){for(let t=0;t<e;t++)m(t);m(!1===s?e:0),function(){for(let t=0;t<=e;t++)for(let i=0;i<=n;i++)l.x=t/e,l.y=i/n,u.push(l.x,l.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=n;e++){const i=(n+1)*(t-1)+(e-1),s=(n+1)*t+(e-1),r=(n+1)*t+e,a=(n+1)*(t-1)+e;p.push(i,s,a),p.push(s,r,a)}}()}(),this.setIndex(p),this.setAttribute("position",new tn(h,3)),this.setAttribute("normal",new tn(d,3)),this.setAttribute("uv",new tn(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new ac((new al[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class oc extends cn{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},null!==t){const e=[],i=new Set,n=new Ae,s=new Ae;if(null!==t.index){const r=t.attributes.position,a=t.index;let o=t.groups;0===o.length&&(o=[{start:0,count:a.count,materialIndex:0}]);for(let t=0,l=o.length;t<l;++t){const l=o[t],c=l.start;for(let t=c,o=c+l.count;t<o;t+=3)for(let o=0;o<3;o++){const l=a.getX(t+o),c=a.getX(t+(o+1)%3);n.fromBufferAttribute(r,l),s.fromBufferAttribute(r,c),!0===lc(n,s,i)&&(e.push(n.x,n.y,n.z),e.push(s.x,s.y,s.z))}}}else{const r=t.attributes.position;for(let t=0,a=r.count/3;t<a;t++)for(let a=0;a<3;a++){const o=3*t+a,l=3*t+(a+1)%3;n.fromBufferAttribute(r,o),s.fromBufferAttribute(r,l),!0===lc(n,s,i)&&(e.push(n.x,n.y,n.z),e.push(s.x,s.y,s.z))}}this.setAttribute("position",new tn(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}function lc(t,e,i){const n=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,s=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return!0!==i.has(n)&&!0!==i.has(s)&&(i.add(n),i.add(s),!0)}var cc=Object.freeze({__proto__:null,BoxGeometry:Ln,CapsuleGeometry:hl,CircleGeometry:dl,ConeGeometry:pl,CylinderGeometry:ul,DodecahedronGeometry:fl,EdgesGeometry:xl,ExtrudeGeometry:Yl,IcosahedronGeometry:Kl,LatheGeometry:cl,OctahedronGeometry:$l,PlaneGeometry:Yn,PolyhedronGeometry:ml,RingGeometry:tc,ShapeGeometry:ec,SphereGeometry:ic,TetrahedronGeometry:nc,TorusGeometry:sc,TorusKnotGeometry:rc,TubeGeometry:ac,WireframeGeometry:oc});class hc extends Ui{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Gi(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}}class dc extends Bn{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class uc extends Ui{constructor(t){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Gi(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 Gi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Yt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class pc extends uc{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Yt(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Gt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Gi(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 Gi(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Gi(1,1,1),this.specularColorMap=null,this._sheen=0,this._clearcoat=0,this._iridescence=0,this._transmission=0,this.setValues(t)}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class mc extends Ui{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Gi(16777215),this.specular=new Gi(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Gi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Yt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=c,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class fc extends Ui{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Gi(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Gi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Yt(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(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class gc extends Ui{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Yt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class vc extends Ui{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Gi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Gi(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Yt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=c,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class _c extends Ui{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Gi(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Yt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}}class yc extends wo{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function xc(t,e,i){return wc(t)?new t.constructor(t.subarray(e,void 0!==i?i:t.length)):t.slice(e,i)}function Ac(t,e,i){return!t||!i&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)}function wc(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function bc(t){const e=t.length,i=new Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort((function(e,i){return t[e]-t[i]})),i}function Mc(t,e,i){const n=t.length,s=new t.constructor(n);for(let r=0,a=0;a!==n;++r){const n=i[r]*e;for(let i=0;i!==e;++i)s[a++]=t[n+i]}return s}function Sc(t,e,i,n){let s=1,r=t[0];for(;void 0!==r&&void 0===r[n];)r=t[s++];if(void 0===r)return;let a=r[n];if(void 0!==a)if(Array.isArray(a))do{a=r[n],void 0!==a&&(e.push(r.time),i.push.apply(i,a)),r=t[s++]}while(void 0!==r);else if(void 0!==a.toArray)do{a=r[n],void 0!==a&&(e.push(r.time),a.toArray(i,i.length)),r=t[s++]}while(void 0!==r);else do{a=r[n],void 0!==a&&(e.push(r.time),i.push(a)),r=t[s++]}while(void 0!==r)}const Ec={arraySlice:xc,convertArray:Ac,isTypedArray:wc,getKeyframeOrder:bc,sortedArray:Mc,flattenJSON:Sc,subclip:function(t,e,i,n,s=30){const r=t.clone();r.name=e;const a=[];for(let t=0;t<r.tracks.length;++t){const e=r.tracks[t],o=e.getValueSize(),l=[],c=[];for(let t=0;t<e.times.length;++t){const r=e.times[t]*s;if(!(r<i||r>=n)){l.push(e.times[t]);for(let i=0;i<o;++i)c.push(e.values[t*o+i])}}0!==l.length&&(e.times=Ac(l,e.times.constructor),e.values=Ac(c,e.values.constructor),a.push(e))}r.tracks=a;let o=1/0;for(let t=0;t<r.tracks.length;++t)o>r.tracks[t].times[0]&&(o=r.tracks[t].times[0]);for(let t=0;t<r.tracks.length;++t)r.tracks[t].shift(-1*o);return r.resetDuration(),r},makeClipAdditive:function(t,e=0,i=t,n=30){n<=0&&(n=30);const s=i.tracks.length,r=e/n;for(let e=0;e<s;++e){const n=i.tracks[e],s=n.ValueTypeName;if("bool"===s||"string"===s)continue;const a=t.tracks.find((function(t){return t.name===n.name&&t.ValueTypeName===s}));if(void 0===a)continue;let o=0;const l=n.getValueSize();n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(o=l/3);let c=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=h/3);const d=n.times.length-1;let u;if(r<=n.times[0]){const t=o,e=l-o;u=xc(n.values,t,e)}else if(r>=n.times[d]){const t=d*l+o,e=t+l-o;u=xc(n.values,t,e)}else{const t=n.createInterpolant(),e=o,i=l-o;t.evaluate(r),u=xc(t.resultBuffer,e,i)}if("quaternion"===s){(new xe).fromArray(u).normalize().conjugate().toArray(u)}const p=a.times.length;for(let t=0;t<p;++t){const e=t*h+c;if("quaternion"===s)xe.multiplyQuaternionsFlat(a.values,e,u,0,a.values,e);else{const t=h-2*c;for(let i=0;i<t;++i)a.values[e+i]-=u[i]}}}return t.blendMode=St,t}};class Cc{constructor(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let i=this._cachedIndex,n=e[i],s=e[i-1];t:{e:{let r;i:{n:if(!(t<n)){for(let r=i+2;;){if(void 0===n){if(t<s)break n;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===r)break;if(s=n,n=e[++i],t<n)break e}r=e.length;break i}if(t>=s)break t;{const a=e[1];t<a&&(i=2,s=a);for(let r=i-2;;){if(void 0===s)return this._cachedIndex=0,this.copySampleValue_(0);if(i===r)break;if(n=s,s=e[--i-1],t>=s)break e}r=i,i=0}}for(;i<r;){const n=i+r>>>1;t<e[n]?r=n:i=n+1}if(n=e[i],s=e[i-1],void 0===s)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===n)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,n)}return this.interpolate_(i,s,t,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,s=t*n;for(let t=0;t!==n;++t)e[t]=i[s+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Tc extends Cc{constructor(t,e,i,n){super(t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:At,endingEnd:At}}intervalChanged_(t,e,i){const n=this.parameterPositions;let s=t-2,r=t+1,a=n[s],o=n[r];if(void 0===a)switch(this.getSettings_().endingStart){case wt:s=t,a=2*e-i;break;case bt:s=n.length-2,a=e+n[s]-n[s+1];break;default:s=t,a=i}if(void 0===o)switch(this.getSettings_().endingEnd){case wt:r=t,o=2*i-e;break;case bt:r=1,o=i+n[1]-n[0];break;default:r=t-1,o=e}const l=.5*(i-e),c=this.valueSize;this._weightPrev=l/(e-a),this._weightNext=l/(o-i),this._offsetPrev=s*c,this._offsetNext=r*c}interpolate_(t,e,i,n){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=t*a,l=o-a,c=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,u=this._weightNext,p=(i-e)/(n-e),m=p*p,f=m*p,g=-d*f+2*d*m-d*p,v=(1+d)*f+(-1.5-2*d)*m+(-.5+d)*p+1,_=(-1-u)*f+(1.5+u)*m+.5*p,y=u*f-u*m;for(let t=0;t!==a;++t)s[t]=g*r[c+t]+v*r[l+t]+_*r[o+t]+y*r[h+t];return s}}class Lc extends Cc{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=t*a,l=o-a,c=(i-e)/(n-e),h=1-c;for(let t=0;t!==a;++t)s[t]=r[l+t]*h+r[o+t]*c;return s}}class kc extends Cc{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t){return this.copySampleValue_(t-1)}}class Ic{constructor(t,e,i,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Ac(e,this.TimeBufferType),this.values=Ac(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Ac(t.times,Array),values:Ac(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new kc(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Lc(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Tc(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case _t:e=this.InterpolantFactoryMethodDiscrete;break;case yt:e=this.InterpolantFactoryMethodLinear;break;case xt:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return _t;case this.InterpolantFactoryMethodLinear:return yt;case this.InterpolantFactoryMethodSmooth:return xt}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]*=t}return this}trim(t,e){const i=this.times,n=i.length;let s=0,r=n-1;for(;s!==n&&i[s]<t;)++s;for(;-1!==r&&i[r]>e;)--r;if(++r,0!==s||r!==n){s>=r&&(r=Math.max(r,1),s=r-1);const t=this.getValueSize();this.times=xc(i,s,r),this.values=xc(this.values,s*t,r*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const i=this.times,n=this.values,s=i.length;0===s&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let r=null;for(let e=0;e!==s;e++){const n=i[e];if("number"==typeof n&&isNaN(n)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,n),t=!1;break}if(null!==r&&r>n){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,n,r),t=!1;break}r=n}if(void 0!==n&&wc(n))for(let e=0,i=n.length;e!==i;++e){const i=n[e];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){const t=xc(this.times),e=xc(this.values),i=this.getValueSize(),n=this.getInterpolation()===xt,s=t.length-1;let r=1;for(let a=1;a<s;++a){let s=!1;const o=t[a];if(o!==t[a+1]&&(1!==a||o!==t[0]))if(n)s=!0;else{const t=a*i,n=t-i,r=t+i;for(let a=0;a!==i;++a){const i=e[t+a];if(i!==e[n+a]||i!==e[r+a]){s=!0;break}}}if(s){if(a!==r){t[r]=t[a];const n=a*i,s=r*i;for(let t=0;t!==i;++t)e[s+t]=e[n+t]}++r}}if(s>0){t[r]=t[s];for(let t=s*i,n=r*i,a=0;a!==i;++a)e[n+a]=e[t+a];++r}return r!==t.length?(this.times=xc(t,0,r),this.values=xc(e,0,r*i)):(this.times=t,this.values=e),this}clone(){const t=xc(this.times,0),e=xc(this.values,0),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}Ic.prototype.TimeBufferType=Float32Array,Ic.prototype.ValueBufferType=Float32Array,Ic.prototype.DefaultInterpolation=yt;class Pc extends Ic{}Pc.prototype.ValueTypeName="bool",Pc.prototype.ValueBufferType=Array,Pc.prototype.DefaultInterpolation=_t,Pc.prototype.InterpolantFactoryMethodLinear=void 0,Pc.prototype.InterpolantFactoryMethodSmooth=void 0;class Rc extends Ic{}Rc.prototype.ValueTypeName="color";class Bc extends Ic{}Bc.prototype.ValueTypeName="number";class Dc extends Cc{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const s=this.resultBuffer,r=this.sampleValues,a=this.valueSize,o=(i-e)/(n-e);let l=t*a;for(let t=l+a;l!==t;l+=4)xe.slerpFlat(s,0,r,l-a,r,l,o);return s}}class Uc extends Ic{InterpolantFactoryMethodLinear(t){return new Dc(this.times,this.values,this.getValueSize(),t)}}Uc.prototype.ValueTypeName="quaternion",Uc.prototype.DefaultInterpolation=yt,Uc.prototype.InterpolantFactoryMethodSmooth=void 0;class Nc extends Ic{}Nc.prototype.ValueTypeName="string",Nc.prototype.ValueBufferType=Array,Nc.prototype.DefaultInterpolation=_t,Nc.prototype.InterpolantFactoryMethodLinear=void 0,Nc.prototype.InterpolantFactoryMethodSmooth=void 0;class Oc extends Ic{}Oc.prototype.ValueTypeName="vector";class zc{constructor(t,e=-1,i,n=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=n,this.uuid=Ft(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],i=t.tracks,n=1/(t.fps||1);for(let t=0,s=i.length;t!==s;++t)e.push(Fc(i[t]).scale(n));const s=new this(t.name,t.duration,e,t.blendMode);return s.uuid=t.uuid,s}static toJSON(t){const e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,n=i.length;t!==n;++t)e.push(Ic.toJSON(i[t]));return n}static CreateFromMorphTargetSequence(t,e,i,n){const s=e.length,r=[];for(let t=0;t<s;t++){let a=[],o=[];a.push((t+s-1)%s,t,(t+1)%s),o.push(0,1,0);const l=bc(a);a=Mc(a,1,l),o=Mc(o,1,l),n||0!==a[0]||(a.push(s),o.push(o[0])),r.push(new Bc(".morphTargetInfluences["+e[t].name+"]",a,o).scale(1/i))}return new this(t,-1,r)}static findByName(t,e){let i=t;if(!Array.isArray(t)){const e=t;i=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<i.length;t++)if(i[t].name===e)return i[t];return null}static CreateClipsFromMorphTargetSequences(t,e,i){const n={},s=/^([\w-]*?)([\d]+)$/;for(let e=0,i=t.length;e<i;e++){const i=t[e],r=i.name.match(s);if(r&&r.length>1){const t=r[1];let e=n[t];e||(n[t]=e=[]),e.push(i)}}const r=[];for(const t in n)r.push(this.CreateFromMorphTargetSequence(t,n[t],e,i));return r}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(t,e,i,n,s){if(0!==i.length){const r=[],a=[];Sc(i,r,a,n),0!==r.length&&s.push(new t(e,r,a))}},n=[],s=t.name||"default",r=t.fps||30,a=t.blendMode;let o=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const s=l[t].keys;if(s&&0!==s.length)if(s[0].morphTargets){const t={};let e;for(e=0;e<s.length;e++)if(s[e].morphTargets)for(let i=0;i<s[e].morphTargets.length;i++)t[s[e].morphTargets[i]]=-1;for(const i in t){const t=[],r=[];for(let n=0;n!==s[e].morphTargets.length;++n){const n=s[e];t.push(n.time),r.push(n.morphTarget===i?1:0)}n.push(new Bc(".morphTargetInfluence["+i+"]",t,r))}o=t.length*r}else{const r=".bones["+e[t].name+"]";i(Oc,r+".position",s,"pos",n),i(Uc,r+".quaternion",s,"rot",n),i(Oc,r+".scale",s,"scl",n)}}if(0===n.length)return null;return new this(s,o,n,a)}resetDuration(){let t=0;for(let e=0,i=this.tracks.length;e!==i;++e){const i=this.tracks[e];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Fc(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Bc;case"vector":case"vector2":case"vector3":case"vector4":return Oc;case"color":return Rc;case"quaternion":return Uc;case"bool":case"boolean":return Pc;case"string":return Nc}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],i=[];Sc(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const Gc={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Hc{constructor(t,e,i){const n=this;let s,r=!1,a=0,o=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,!1===r&&void 0!==n.onStart&&n.onStart(t,a,o),r=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,o),a===o&&(r=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=l.length;e<i;e+=2){const i=l[e],n=l[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null}}}const Vc=new Hc;class Wc{constructor(t){this.manager=void 0!==t?t:Vc,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const i=this;return new Promise((function(n,s){i.load(t,n,e,s)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}const jc={};class Qc extends Error{constructor(t,e){super(t),this.response=e}}class qc extends Wc{constructor(t){super(t)}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const s=Gc.get(t);if(void 0!==s)return this.manager.itemStart(t),setTimeout((()=>{e&&e(s),this.manager.itemEnd(t)}),0),s;if(void 0!==jc[t])return void jc[t].push({onLoad:e,onProgress:i,onError:n});jc[t]=[],jc[t].push({onLoad:e,onProgress:i,onError:n});const r=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(r).then((e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const i=jc[t],n=e.body.getReader(),s=e.headers.get("Content-Length")||e.headers.get("X-File-Size"),r=s?parseInt(s):0,a=0!==r;let o=0;const l=new ReadableStream({start(t){!function e(){n.read().then((({done:n,value:s})=>{if(n)t.close();else{o+=s.byteLength;const n=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:r});for(let t=0,e=i.length;t<e;t++){const e=i[t];e.onProgress&&e.onProgress(n)}t.enqueue(s),e()}}))}()}});return new Response(l)}throw new Qc(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)})).then((t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,a)));case"json":return t.json();default:if(void 0===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),i=e&&e[1]?e[1].toLowerCase():void 0,n=new TextDecoder(i);return t.arrayBuffer().then((t=>n.decode(t)))}}})).then((e=>{Gc.add(t,e);const i=jc[t];delete jc[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onLoad&&n.onLoad(e)}})).catch((e=>{const i=jc[t];if(void 0===i)throw this.manager.itemError(t),e;delete jc[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}this.manager.itemError(t)})).finally((()=>{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Zc extends Wc{constructor(t){super(t)}load(t,e,i,n){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const s=this,r=Gc.get(t);if(void 0!==r)return s.manager.itemStart(t),setTimeout((function(){e&&e(r),s.manager.itemEnd(t)}),0),r;const a=ie("img");function o(){c(),Gc.add(t,this),e&&e(this),s.manager.itemEnd(t)}function l(e){c(),n&&n(e),s.manager.itemError(t),s.manager.itemEnd(t)}function c(){a.removeEventListener("load",o,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",l,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(t),a.src=t,a}}class Xc extends Wc{constructor(t){super(t)}load(t,e,i,n){const s=new zn,r=new Zc(this.manager);r.setCrossOrigin(this.crossOrigin),r.setPath(this.path);let a=0;function o(i){r.load(t[i],(function(t){s.images[i]=t,a++,6===a&&(s.needsUpdate=!0,e&&e(s))}),void 0,n)}for(let e=0;e<t.length;++e)o(e);return s}}class Yc extends wi{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new Gi(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}class Jc extends Yc{constructor(t,e,i){super(t,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(wi.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Gi(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}}const Kc=new Je,$c=new Ae,th=new Ae;class eh{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Yt(512,512),this.map=null,this.mapPass=null,this.matrix=new Je,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new qn,this._frameExtents=new Yt(1,1),this._viewportCount=1,this._viewports=[new ge(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,i=this.matrix;$c.setFromMatrixPosition(t.matrixWorld),e.position.copy($c),th.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(th),e.updateMatrixWorld(),Kc.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Kc),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(Kc)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class ih extends eh{constructor(){super(new Un(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){const e=this.camera,i=2*zt*t.angle*this.focus,n=this.mapSize.width/this.mapSize.height,s=t.distance||e.far;i===e.fov&&n===e.aspect&&s===e.far||(e.fov=i,e.aspect=n,e.far=s,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class nh extends Yc{constructor(t,e,i=0,n=Math.PI/3,s=0,r=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(wi.DEFAULT_UP),this.updateMatrix(),this.target=new wi,this.distance=i,this.angle=n,this.penumbra=s,this.decay=r,this.map=null,this.shadow=new ih}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}const sh=new Je,rh=new Ae,ah=new Ae;class oh extends eh{constructor(){super(new Un(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Yt(4,2),this._viewportCount=6,this._viewports=[new ge(2,1,1,1),new ge(0,1,1,1),new ge(3,1,1,1),new ge(1,1,1,1),new ge(3,0,1,1),new ge(1,0,1,1)],this._cubeDirections=[new Ae(1,0,0),new Ae(-1,0,0),new Ae(0,0,1),new Ae(0,0,-1),new Ae(0,1,0),new Ae(0,-1,0)],this._cubeUps=[new Ae(0,1,0),new Ae(0,1,0),new Ae(0,1,0),new Ae(0,1,0),new Ae(0,0,1),new Ae(0,0,-1)]}updateMatrices(t,e=0){const i=this.camera,n=this.matrix,s=t.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),rh.setFromMatrixPosition(t.matrixWorld),i.position.copy(rh),ah.copy(i.position),ah.add(this._cubeDirections[e]),i.up.copy(this._cubeUps[e]),i.lookAt(ah),i.updateMatrixWorld(),n.makeTranslation(-rh.x,-rh.y,-rh.z),sh.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(sh)}}class lh extends Yc{constructor(t,e,i=0,n=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=n,this.shadow=new oh}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class ch extends eh{constructor(){super(new os(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class hh extends Yc{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(wi.DEFAULT_UP),this.updateMatrix(),this.target=new wi,this.shadow=new ch}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class dh extends Yc{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class uh extends Yc{constructor(t,e,i=10,n=10){super(t,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=n}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}class ph{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new Ae)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const i=t.x,n=t.y,s=t.z,r=this.coefficients;return e.copy(r[0]).multiplyScalar(.282095),e.addScaledVector(r[1],.488603*n),e.addScaledVector(r[2],.488603*s),e.addScaledVector(r[3],.488603*i),e.addScaledVector(r[4],i*n*1.092548),e.addScaledVector(r[5],n*s*1.092548),e.addScaledVector(r[6],.315392*(3*s*s-1)),e.addScaledVector(r[7],i*s*1.092548),e.addScaledVector(r[8],.546274*(i*i-n*n)),e}getIrradianceAt(t,e){const i=t.x,n=t.y,s=t.z,r=this.coefficients;return e.copy(r[0]).multiplyScalar(.886227),e.addScaledVector(r[1],1.023328*n),e.addScaledVector(r[2],1.023328*s),e.addScaledVector(r[3],1.023328*i),e.addScaledVector(r[4],.858086*i*n),e.addScaledVector(r[5],.858086*n*s),e.addScaledVector(r[6],.743125*s*s-.247708),e.addScaledVector(r[7],.858086*i*s),e.addScaledVector(r[8],.429043*(i*i-n*n)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(t.coefficients[i],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let i=0;i<9;i++)this.coefficients[i].lerp(t.coefficients[i],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const i=this.coefficients;for(let n=0;n<9;n++)i[n].fromArray(t,e+3*n);return this}toArray(t=[],e=0){const i=this.coefficients;for(let n=0;n<9;n++)i[n].toArray(t,e+3*n);return t}static getBasisAt(t,e){const i=t.x,n=t.y,s=t.z;e[0]=.282095,e[1]=.488603*n,e[2]=.488603*s,e[3]=.488603*i,e[4]=1.092548*i*n,e[5]=1.092548*n*s,e[6]=.315392*(3*s*s-1),e[7]=1.092548*i*s,e[8]=.546274*(i*i-n*n)}}class mh extends Yc{constructor(t=new ph,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}class fh extends Wc{constructor(t){super(t),this.textures={}}load(t,e,i,n){const s=this,r=new qc(s.manager);r.setPath(s.path),r.setRequestHeader(s.requestHeader),r.setWithCredentials(s.withCredentials),r.load(t,(function(i){try{e(s.parse(JSON.parse(i)))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){const e=this.textures;function i(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}const n=fh.createMaterialFromType(t.type);if(void 0!==t.uuid&&(n.uuid=t.uuid),void 0!==t.name&&(n.name=t.name),void 0!==t.color&&void 0!==n.color&&n.color.setHex(t.color),void 0!==t.roughness&&(n.roughness=t.roughness),void 0!==t.metalness&&(n.metalness=t.metalness),void 0!==t.sheen&&(n.sheen=t.sheen),void 0!==t.sheenColor&&(n.sheenColor=(new Gi).setHex(t.sheenColor)),void 0!==t.sheenRoughness&&(n.sheenRoughness=t.sheenRoughness),void 0!==t.emissive&&void 0!==n.emissive&&n.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==n.specular&&n.specular.setHex(t.specular),void 0!==t.specularIntensity&&(n.specularIntensity=t.specularIntensity),void 0!==t.specularColor&&void 0!==n.specularColor&&n.specularColor.setHex(t.specularColor),void 0!==t.shininess&&(n.shininess=t.shininess),void 0!==t.clearcoat&&(n.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(n.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.iridescence&&(n.iridescence=t.iridescence),void 0!==t.iridescenceIOR&&(n.iridescenceIOR=t.iridescenceIOR),void 0!==t.iridescenceThicknessRange&&(n.iridescenceThicknessRange=t.iridescenceThicknessRange),void 0!==t.transmission&&(n.transmission=t.transmission),void 0!==t.thickness&&(n.thickness=t.thickness),void 0!==t.attenuationDistance&&(n.attenuationDistance=t.attenuationDistance),void 0!==t.attenuationColor&&void 0!==n.attenuationColor&&n.attenuationColor.setHex(t.attenuationColor),void 0!==t.fog&&(n.fog=t.fog),void 0!==t.flatShading&&(n.flatShading=t.flatShading),void 0!==t.blending&&(n.blending=t.blending),void 0!==t.combine&&(n.combine=t.combine),void 0!==t.side&&(n.side=t.side),void 0!==t.shadowSide&&(n.shadowSide=t.shadowSide),void 0!==t.opacity&&(n.opacity=t.opacity),void 0!==t.transparent&&(n.transparent=t.transparent),void 0!==t.alphaTest&&(n.alphaTest=t.alphaTest),void 0!==t.depthTest&&(n.depthTest=t.depthTest),void 0!==t.depthWrite&&(n.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(n.colorWrite=t.colorWrite),void 0!==t.stencilWrite&&(n.stencilWrite=t.stencilWrite),void 0!==t.stencilWriteMask&&(n.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(n.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(n.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(n.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(n.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(n.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(n.stencilZPass=t.stencilZPass),void 0!==t.wireframe&&(n.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(n.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(n.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(n.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(n.rotation=t.rotation),1!==t.linewidth&&(n.linewidth=t.linewidth),void 0!==t.dashSize&&(n.dashSize=t.dashSize),void 0!==t.gapSize&&(n.gapSize=t.gapSize),void 0!==t.scale&&(n.scale=t.scale),void 0!==t.polygonOffset&&(n.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(n.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(n.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.dithering&&(n.dithering=t.dithering),void 0!==t.alphaToCoverage&&(n.alphaToCoverage=t.alphaToCoverage),void 0!==t.premultipliedAlpha&&(n.premultipliedAlpha=t.premultipliedAlpha),void 0!==t.forceSinglePass&&(n.forceSinglePass=t.forceSinglePass),void 0!==t.visible&&(n.visible=t.visible),void 0!==t.toneMapped&&(n.toneMapped=t.toneMapped),void 0!==t.userData&&(n.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?n.vertexColors=t.vertexColors>0:n.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const e in t.uniforms){const s=t.uniforms[e];switch(n.uniforms[e]={},s.type){case"t":n.uniforms[e].value=i(s.value);break;case"c":n.uniforms[e].value=(new Gi).setHex(s.value);break;case"v2":n.uniforms[e].value=(new Yt).fromArray(s.value);break;case"v3":n.uniforms[e].value=(new Ae).fromArray(s.value);break;case"v4":n.uniforms[e].value=(new ge).fromArray(s.value);break;case"m3":n.uniforms[e].value=(new Jt).fromArray(s.value);break;case"m4":n.uniforms[e].value=(new Je).fromArray(s.value);break;default:n.uniforms[e].value=s.value}}if(void 0!==t.defines&&(n.defines=t.defines),void 0!==t.vertexShader&&(n.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(n.fragmentShader=t.fragmentShader),void 0!==t.glslVersion&&(n.glslVersion=t.glslVersion),void 0!==t.extensions)for(const e in t.extensions)n.extensions[e]=t.extensions[e];if(void 0!==t.size&&(n.size=t.size),void 0!==t.sizeAttenuation&&(n.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(n.map=i(t.map)),void 0!==t.matcap&&(n.matcap=i(t.matcap)),void 0!==t.alphaMap&&(n.alphaMap=i(t.alphaMap)),void 0!==t.bumpMap&&(n.bumpMap=i(t.bumpMap)),void 0!==t.bumpScale&&(n.bumpScale=t.bumpScale),void 0!==t.normalMap&&(n.normalMap=i(t.normalMap)),void 0!==t.normalMapType&&(n.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),n.normalScale=(new Yt).fromArray(e)}return void 0!==t.displacementMap&&(n.displacementMap=i(t.displacementMap)),void 0!==t.displacementScale&&(n.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(n.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(n.roughnessMap=i(t.roughnessMap)),void 0!==t.metalnessMap&&(n.metalnessMap=i(t.metalnessMap)),void 0!==t.emissiveMap&&(n.emissiveMap=i(t.emissiveMap)),void 0!==t.emissiveIntensity&&(n.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(n.specularMap=i(t.specularMap)),void 0!==t.specularIntensityMap&&(n.specularIntensityMap=i(t.specularIntensityMap)),void 0!==t.specularColorMap&&(n.specularColorMap=i(t.specularColorMap)),void 0!==t.envMap&&(n.envMap=i(t.envMap)),void 0!==t.envMapIntensity&&(n.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(n.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(n.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(n.lightMap=i(t.lightMap)),void 0!==t.lightMapIntensity&&(n.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(n.aoMap=i(t.aoMap)),void 0!==t.aoMapIntensity&&(n.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(n.gradientMap=i(t.gradientMap)),void 0!==t.clearcoatMap&&(n.clearcoatMap=i(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(n.clearcoatRoughnessMap=i(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(n.clearcoatNormalMap=i(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(n.clearcoatNormalScale=(new Yt).fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(n.iridescenceMap=i(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(n.iridescenceThicknessMap=i(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(n.transmissionMap=i(t.transmissionMap)),void 0!==t.thicknessMap&&(n.thicknessMap=i(t.thicknessMap)),void 0!==t.sheenColorMap&&(n.sheenColorMap=i(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(n.sheenRoughnessMap=i(t.sheenRoughnessMap)),n}setTextures(t){return this.textures=t,this}static createMaterialFromType(t){return new{ShadowMaterial:hc,SpriteMaterial:Da,RawShaderMaterial:dc,ShaderMaterial:Bn,PointsMaterial:Ro,MeshPhysicalMaterial:pc,MeshStandardMaterial:uc,MeshPhongMaterial:mc,MeshToonMaterial:fc,MeshNormalMaterial:gc,MeshLambertMaterial:vc,MeshDepthMaterial:ua,MeshDistanceMaterial:pa,MeshBasicMaterial:Vi,MeshMatcapMaterial:_c,LineDashedMaterial:yc,LineBasicMaterial:wo,Material:Ui}[t]}}class gh{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let i=0,n=t.length;i<n;i++)e+=String.fromCharCode(t[i]);try{return decodeURIComponent(escape(e))}catch(t){return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}class vh extends cn{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){const t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class _h extends Wc{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new qc(s.manager);r.setPath(s.path),r.setRequestHeader(s.requestHeader),r.setWithCredentials(s.withCredentials),r.load(t,(function(i){try{e(s.parse(JSON.parse(i)))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){const e={},i={};function n(t,n){if(void 0!==e[n])return e[n];const s=t.interleavedBuffers[n],r=function(t,e){if(void 0!==i[e])return i[e];const n=t.arrayBuffers,s=n[e],r=new Uint32Array(s).buffer;return i[e]=r,r}(t,s.buffer),a=ee(s.type,r),o=new Pa(a,s.stride);return o.uuid=s.uuid,e[n]=o,o}const s=t.isInstancedBufferGeometry?new vh:new cn,r=t.data.index;if(void 0!==r){const t=ee(r.type,r.array);s.setIndex(new Ji(t,1))}const a=t.data.attributes;for(const e in a){const i=a[e];let r;if(i.isInterleavedBufferAttribute){const e=n(t.data,i.data);r=new Ba(e,i.itemSize,i.offset,i.normalized)}else{const t=ee(i.type,i.array);r=new(i.isInstancedBufferAttribute?po:Ji)(t,i.itemSize,i.normalized)}void 0!==i.name&&(r.name=i.name),void 0!==i.usage&&r.setUsage(i.usage),void 0!==i.updateRange&&(r.updateRange.offset=i.updateRange.offset,r.updateRange.count=i.updateRange.count),s.setAttribute(e,r)}const o=t.data.morphAttributes;if(o)for(const e in o){const i=o[e],r=[];for(let e=0,s=i.length;e<s;e++){const s=i[e];let a;if(s.isInterleavedBufferAttribute){const e=n(t.data,s.data);a=new Ba(e,s.itemSize,s.offset,s.normalized)}else{const t=ee(s.type,s.array);a=new Ji(t,s.itemSize,s.normalized)}void 0!==s.name&&(a.name=s.name),r.push(a)}s.morphAttributes[e]=r}t.data.morphTargetsRelative&&(s.morphTargetsRelative=!0);const l=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==l)for(let t=0,e=l.length;t!==e;++t){const e=l[t];s.addGroup(e.start,e.count,e.materialIndex)}const c=t.data.boundingSphere;if(void 0!==c){const t=new Ae;void 0!==c.center&&t.fromArray(c.center),s.boundingSphere=new He(t,c.radius)}return t.name&&(s.name=t.name),t.userData&&(s.userData=t.userData),s}}const yh={UVMapping:_,CubeReflectionMapping:y,CubeRefractionMapping:x,EquirectangularReflectionMapping:A,EquirectangularRefractionMapping:w,CubeUVReflectionMapping:b},xh={RepeatWrapping:M,ClampToEdgeWrapping:S,MirroredRepeatWrapping:E},Ah={NearestFilter:C,NearestMipmapNearestFilter:T,NearestMipmapLinearFilter:L,LinearFilter:k,LinearMipmapNearestFilter:I,LinearMipmapLinearFilter:P};let wh;class bh{static getContext(){return void 0===wh&&(wh=new(window.AudioContext||window.webkitAudioContext)),wh}static setContext(t){wh=t}}const Mh=new Je,Sh=new Je,Eh=new Je;class Ch{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Th(),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 t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=Th();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function Th(){return("undefined"==typeof performance?Date:performance).now()}const Lh=new Ae,kh=new xe,Ih=new Ae,Ph=new Ae;class Rh extends wi{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.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(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);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(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){if(this.detune=t,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}const Bh=new Ae,Dh=new xe,Uh=new Ae,Nh=new Ae;class Oh{constructor(t,e,i){let n,s,r;switch(this.binding=t,this.valueSize=i,e){case"quaternion":n=this._slerp,s=this._slerpAdditive,r=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":n=this._select,s=this._select,r=this._setAdditiveIdentityOther,this.buffer=new Array(5*i);break;default:n=this._lerp,s=this._lerpAdditive,r=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=s,this._setIdentity=r,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const i=this.buffer,n=this.valueSize,s=t*n+n;let r=this.cumulativeWeight;if(0===r){for(let t=0;t!==n;++t)i[s+t]=i[t];r=e}else{r+=e;const t=e/r;this._mixBufferRegion(i,s,0,t,n)}this.cumulativeWeight=r}accumulateAdditive(t){const e=this.buffer,i=this.valueSize,n=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,n,0,t,i),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,i=this.buffer,n=t*e+e,s=this.cumulativeWeight,r=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const t=e*this._origIndex;this._mixBufferRegion(i,n,t,1-s,e)}r>0&&this._mixBufferRegionAdditive(i,n,this._addIndex*e,1,e);for(let t=e,s=e+e;t!==s;++t)if(i[t]!==i[t+e]){a.setValue(i,n);break}}saveOriginalState(){const t=this.binding,e=this.buffer,i=this.valueSize,n=i*this._origIndex;t.getValue(e,n);for(let t=i,s=n;t!==s;++t)e[t]=e[n+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i<e;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[e+i]=this.buffer[t+i]}_select(t,e,i,n,s){if(n>=.5)for(let n=0;n!==s;++n)t[e+n]=t[i+n]}_slerp(t,e,i,n){xe.slerpFlat(t,e,t,e,t,i,n)}_slerpAdditive(t,e,i,n,s){const r=this._workIndex*s;xe.multiplyQuaternionsFlat(t,r,t,e,t,i),xe.slerpFlat(t,e,t,e,t,r,n)}_lerp(t,e,i,n,s){const r=1-n;for(let a=0;a!==s;++a){const s=e+a;t[s]=t[s]*r+t[i+a]*n}}_lerpAdditive(t,e,i,n,s){for(let r=0;r!==s;++r){const s=e+r;t[s]=t[s]+t[i+r]*n}}}const zh="\\[\\]\\.:\\/",Fh=new RegExp("["+zh+"]","g"),Gh="[^"+zh+"]",Hh="[^"+zh.replace("\\.","")+"]",Vh=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Gh)+/(WCOD+)?/.source.replace("WCOD",Hh)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Gh)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Gh)+"$"),Wh=["material","materials","bones","map"];class jh{constructor(t,e,i){this.path=e,this.parsedPath=i||jh.parseTrackName(e),this.node=jh.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new jh.Composite(t,e,i):new jh(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Fh,"")}static parseTrackName(t){const e=Vh.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){const t=i.nodeName.substring(n+1);-1!==Wh.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){const i=function(t){for(let n=0;n<t.length;n++){const s=t[n];if(s.name===e||s.uuid===e)return s;const r=i(s.children);if(r)return r}return null},n=i(t.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)t[e++]=i[n]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,i=e.objectName,n=e.propertyName;let s=e.propertyIndex;if(t||(t=jh.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(i){let n=e.objectIndex;switch(i){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===n){n=e;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==n){if(void 0===t[n])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[n]}}const r=t[n];if(void 0===r){const i=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+i+"."+n+" but it wasn't found.",t)}let a=this.Versioning.None;this.targetObject=t,void 0!==t.needsUpdate?a=this.Versioning.NeedsUpdate:void 0!==t.matrixWorldNeedsUpdate&&(a=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==s){if("morphTargetInfluences"===n){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[s]&&(s=t.morphTargetDictionary[s])}o=this.BindingType.ArrayElement,this.resolvedProperty=r,this.propertyIndex=s}else void 0!==r.fromArray&&void 0!==r.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=r):Array.isArray(r)?(o=this.BindingType.EntireArray,this.resolvedProperty=r):this.propertyName=n;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}jh.Composite=class{constructor(t,e,i){const n=i||jh.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}getValue(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)}setValue(t,e){const i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,s=i.length;n!==s;++n)i[n].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},jh.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},jh.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},jh.prototype.GetterByBindingType=[jh.prototype._getValue_direct,jh.prototype._getValue_array,jh.prototype._getValue_arrayElement,jh.prototype._getValue_toArray],jh.prototype.SetterByBindingTypeAndVersioning=[[jh.prototype._setValue_direct,jh.prototype._setValue_direct_setNeedsUpdate,jh.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[jh.prototype._setValue_array,jh.prototype._setValue_array_setNeedsUpdate,jh.prototype._setValue_array_setMatrixWorldNeedsUpdate],[jh.prototype._setValue_arrayElement,jh.prototype._setValue_arrayElement_setNeedsUpdate,jh.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[jh.prototype._setValue_fromArray,jh.prototype._setValue_fromArray_setNeedsUpdate,jh.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Qh{constructor(t,e,i=null,n=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=n;const s=e.tracks,r=s.length,a=new Array(r),o={endingStart:At,endingEnd:At};for(let t=0;t!==r;++t){const e=s[t].createInterpolant(null);a[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=gt,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&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i){if(t.fadeOut(e),this.fadeIn(e),i){const i=this._clip.duration,n=t._clip.duration,s=n/i,r=i/n;t.warp(1,s,e),this.warp(r,1,e)}return this}crossFadeTo(t,e,i){return t.crossFadeFrom(this,e,i)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){const n=this._mixer,s=n.time,r=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,o[1]=s+i,l[0]=t/r,l[1]=e/r,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,n){if(!this.enabled)return void this._updateWeight(t);const s=this._startTime;if(null!==s){const n=(t-s)*i;n<0||0===i?e=0:(this._startTime=null,e=i*n)}e*=this._updateTimeScale(t);const r=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;if(this.blendMode===St)for(let i=0,n=t.length;i!==n;++i)t[i].evaluate(r),e[i].accumulateAdditive(a);else for(let i=0,s=t.length;i!==s;++i)t[i].evaluate(r),e[i].accumulate(n,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const i=this._weightInterpolant;if(null!==i){const n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const i=this._timeScaleInterpolant;if(null!==i){e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,i=this.loop;let n=this.time+t,s=this._loopCount;const r=i===vt;if(0===t)return-1===s?n:r&&1==(1&s)?e-n:n;if(2200===i){-1===s&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(n>=e)n=e;else{if(!(n<0)){this.time=n;break t}n=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===s&&(t>=0?(s=0,this._setEndings(!0,0===this.repetitions,r)):this._setEndings(0===this.repetitions,!0,r)),n>=e||n<0){const i=Math.floor(n/e);n-=e*i,s+=Math.abs(i);const a=this.repetitions-s;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=t>0?e:0,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){const e=t<0;this._setEndings(e,!e,r)}else this._setEndings(!1,!1,r);this._loopCount=s,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=n;if(r&&1==(1&s))return e-n}return n}_setEndings(t,e,i){const n=this._interpolantSettings;i?(n.endingStart=wt,n.endingEnd=wt):(n.endingStart=t?this.zeroSlopeAtStart?wt:At:bt,n.endingEnd=e?this.zeroSlopeAtEnd?wt:At:bt)}_scheduleFading(t,e,i){const n=this._mixer,s=n.time;let r=this._weightInterpolant;null===r&&(r=n._lendControlInterpolant(),this._weightInterpolant=r);const a=r.parameterPositions,o=r.sampleValues;return a[0]=s,o[0]=e,a[1]=s+t,o[1]=i,this}}const qh=new Float32Array(1);class Zh extends Dt{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const i=t._localRoot||this._root,n=t._clip.tracks,s=n.length,r=t._propertyBindings,a=t._interpolants,o=i.uuid,l=this._bindingsByRootAndName;let c=l[o];void 0===c&&(c={},l[o]=c);for(let t=0;t!==s;++t){const s=n[t],l=s.name;let h=c[l];if(void 0!==h)++h.referenceCount,r[t]=h;else{if(h=r[t],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,o,l));continue}const n=e&&e._propertyBindings[t].binding.parsedPath;h=new Oh(jh.create(i,l,n),s.ValueTypeName,s.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,o,l),r[t]=h}a[t].resultBuffer=h.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,i){const n=this._actions,s=this._actionsByClip;let r=s[e];if(void 0===r)r={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,s[e]=r;else{const e=r.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=n.length,n.push(t),r.actionByRoot[i]=t}_removeInactiveAction(t){const e=this._actions,i=e[e.length-1],n=t._cacheIndex;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=null;const s=t._clip.uuid,r=this._actionsByClip,a=r[s],o=a.knownActions,l=o[o.length-1],c=t._byClipCacheIndex;l._byClipCacheIndex=c,o[c]=l,o.pop(),t._byClipCacheIndex=null;delete a.actionByRoot[(t._localRoot||this._root).uuid],0===o.length&&delete r[s],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0==--i.referenceCount&&this._removeInactiveBinding(i)}}_lendAction(t){const e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_takeBackAction(t){const e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_addInactiveBinding(t,e,i){const n=this._bindingsByRootAndName,s=this._bindings;let r=n[e];void 0===r&&(r={},n[e]=r),r[i]=t,t._cacheIndex=s.length,s.push(t)}_removeInactiveBinding(t){const e=this._bindings,i=t.binding,n=i.rootNode.uuid,s=i.path,r=this._bindingsByRootAndName,a=r[n],o=e[e.length-1],l=t._cacheIndex;o._cacheIndex=l,e[l]=o,e.pop(),delete a[s],0===Object.keys(a).length&&delete r[n]}_lendBinding(t){const e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_takeBackBinding(t){const e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,s=e[n];t._cacheIndex=n,e[n]=t,s._cacheIndex=i,e[i]=s}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let i=t[e];return void 0===i&&(i=new Lc(new Float32Array(2),new Float32Array(2),1,qh),i.__cacheIndex=e,t[e]=i),i}_takeBackControlInterpolant(t){const e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,s=e[n];t.__cacheIndex=n,e[n]=t,s.__cacheIndex=i,e[i]=s}clipAction(t,e,i){const n=e||this._root,s=n.uuid;let r="string"==typeof t?zc.findByName(n,t):t;const a=null!==r?r.uuid:t,o=this._actionsByClip[a];let l=null;if(void 0===i&&(i=null!==r?r.blendMode:Mt),void 0!==o){const t=o.actionByRoot[s];if(void 0!==t&&t.blendMode===i)return t;l=o.knownActions[0],null===r&&(r=l._clip)}if(null===r)return null;const c=new Qh(this,r,e,i);return this._bindAction(c,l),this._addInactiveAction(c,a,s),c}existingAction(t,e){const i=e||this._root,n=i.uuid,s="string"==typeof t?zc.findByName(i,t):t,r=s?s.uuid:t,a=this._actionsByClip[r];return void 0!==a&&a.actionByRoot[n]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,i=this._nActiveActions,n=this.time+=t,s=Math.sign(t),r=this._accuIndex^=1;for(let a=0;a!==i;++a){e[a]._update(n,t,s,r)}const a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(r);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,i=t.uuid,n=this._actionsByClip,s=n[i];if(void 0!==s){const t=s.knownActions;for(let i=0,n=t.length;i!==n;++i){const n=t[i];this._deactivateAction(n);const s=n._cacheIndex,r=e[e.length-1];n._cacheIndex=null,n._byClipCacheIndex=null,r._cacheIndex=s,e[s]=r,e.pop(),this._removeInactiveBindingsForAction(n)}delete n[i]}}uncacheRoot(t){const e=t.uuid,i=this._actionsByClip;for(const t in i){const n=i[t].actionByRoot[e];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}const n=this._bindingsByRootAndName[e];if(void 0!==n)for(const t in n){const e=n[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class Xh{constructor(t){this.value=t}clone(){return new Xh(void 0===this.value.clone?this.value:this.value.clone())}}let Yh=0;class Jh extends Pa{constructor(t,e,i=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}class Kh{constructor(t,e,i=0,n=1/0){this.ray=new Ye(t,e),this.near=i,this.far=n,this.camera=null,this.layers=new li,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}intersectObject(t,e=!0,i=[]){return td(t,this,i,e),i.sort($h),i}intersectObjects(t,e=!0,i=[]){for(let n=0,s=t.length;n<s;n++)td(t[n],this,i,e);return i.sort($h),i}}function $h(t,e){return t.distance-e.distance}function td(t,e,i,n){if(t.layers.test(e.layers)&&t.raycast(e,i),!0===n){const n=t.children;for(let t=0,s=n.length;t<s;t++)td(n[t],e,i,!0)}}class ed{constructor(t=1,e=0,i=0){return this.radius=t,this.phi=e,this.theta=i,this}set(t,e,i){return this.radius=t,this.phi=e,this.theta=i,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){const t=1e-6;return this.phi=Math.max(t,Math.min(Math.PI-t,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,i){return this.radius=Math.sqrt(t*t+e*e+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,i),this.phi=Math.acos(Gt(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}const id=new Yt;const nd=new Ae,sd=new Ae;class rd{constructor(t=new Ae,e=new Ae){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){nd.subVectors(t,this.start),sd.subVectors(this.end,this.start);const i=sd.dot(sd);let n=sd.dot(nd)/i;return e&&(n=Gt(n,0,1)),n}closestPointToPoint(t,e,i){const n=this.closestPointToPointParameter(t,e);return this.delta(i).multiplyScalar(n).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const ad=new Ae;const od=new Ae,ld=new Je,cd=new Je;function hd(t){const e=[];!0===t.isBone&&e.push(t);for(let i=0;i<t.children.length;i++)e.push.apply(e,hd(t.children[i]));return e}const dd=new Ae,ud=new Gi,pd=new Gi;class md extends Io{constructor(t=10,e=10,i=4473924,n=8947848){i=new Gi(i),n=new Gi(n);const s=e/2,r=t/e,a=t/2,o=[],l=[];for(let t=0,c=0,h=-a;t<=e;t++,h+=r){o.push(-a,0,h,a,0,h),o.push(h,0,-a,h,0,a);const e=t===s?i:n;e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3}const c=new cn;c.setAttribute("position",new tn(o,3)),c.setAttribute("color",new tn(l,3));super(c,new wo({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const fd=new Ae,gd=new Ae,vd=new Ae;const _d=new Ae,yd=new Dn;function xd(t,e,i,n,s,r,a){_d.set(s,r,a).unproject(n);const o=e[t];if(void 0!==o){const t=i.getAttribute("position");for(let e=0,i=o.length;e<i;e++)t.setXYZ(o[e],_d.x,_d.y,_d.z)}}const Ad=new Me;const wd=new Ae;let bd,Md;class Sd{constructor(){this.type="ShapePath",this.color=new Gi,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new ll,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,i,n){return this.currentPath.quadraticCurveTo(t,e,i,n),this}bezierCurveTo(t,e,i,n,s,r){return this.currentPath.bezierCurveTo(t,e,i,n,s,r),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(t,e){const i=e.length;let n=!1;for(let s=i-1,r=0;r<i;s=r++){let i=e[s],a=e[r],o=a.x-i.x,l=a.y-i.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(i=e[r],o=-o,a=e[s],l=-l),t.y<i.y||t.y>a.y)continue;if(t.y===i.y){if(t.x===i.x)return!0}else{const e=l*(t.x-i.x)-o*(t.y-i.y);if(0===e)return!0;if(e<0)continue;n=!n}}else{if(t.y!==i.y)continue;if(a.x<=t.x&&t.x<=i.x||i.x<=t.x&&t.x<=a.x)return!0}}return n}const i=ql.isClockWise,n=this.subPaths;if(0===n.length)return[];let s,r,a;const o=[];if(1===n.length)return r=n[0],a=new Al,a.curves=r.curves,o.push(a),o;let l=!i(n[0].getPoints());l=t?!l:l;const c=[],h=[];let d,u,p=[],m=0;h[m]=void 0,p[m]=[];for(let e=0,a=n.length;e<a;e++)r=n[e],d=r.getPoints(),s=i(d),s=t?!s:s,s?(!l&&h[m]&&m++,h[m]={s:new Al,p:d},h[m].s.curves=r.curves,l&&m++,p[m]=[]):p[m].push({h:r,p:d[0]});if(!h[0])return function(t){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i],s=new Al;s.curves=n.curves,e.push(s)}return e}(n);if(h.length>1){let t=!1,i=0;for(let t=0,e=h.length;t<e;t++)c[t]=[];for(let n=0,s=h.length;n<s;n++){const s=p[n];for(let r=0;r<s.length;r++){const a=s[r];let o=!0;for(let s=0;s<h.length;s++)e(a.p,h[s].p)&&(n!==s&&i++,o?(o=!1,c[s].push(a)):t=!0);o&&c[n].push(a)}}i>0&&!1===t&&(p=c)}for(let t=0,e=h.length;t<e;t++){a=h[t].s,o.push(a),u=p[t];for(let t=0,e=u.length;t<e;t++)a.holes.push(u[t].h)}return o}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:t}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=t);var Ed=Object.freeze({__proto__:null,ACESFilmicToneMapping:g,AddEquation:l,AddOperation:d,AdditiveAnimationBlendMode:St,AdditiveBlending:2,AlphaFormat:1021,AlwaysDepth:1,AlwaysStencilFunc:519,AmbientLight:dh,AmbientLightProbe:class extends mh{constructor(t,e=1){super(void 0,e),this.isAmbientLightProbe=!0;const i=(new Gi).set(t);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}},AnimationAction:Qh,AnimationClip:zc,AnimationLoader:class extends Wc{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new qc(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,(function(i){try{e(s.parse(JSON.parse(i)))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}parse(t){const e=[];for(let i=0;i<t.length;i++){const n=zc.parse(t[i]);e.push(n)}return e}},AnimationMixer:Zh,AnimationObjectGroup:class{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Ft(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let e=0,i=arguments.length;e!==i;++e)t[arguments[e].uuid]=e;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const t=this._objects,e=this._indicesByUUID,i=this._paths,n=this._parsedPaths,s=this._bindings,r=s.length;let a,o=t.length,l=this.nCachedObjects_;for(let c=0,h=arguments.length;c!==h;++c){const h=arguments[c],d=h.uuid;let u=e[d];if(void 0===u){u=o++,e[d]=u,t.push(h);for(let t=0,e=r;t!==e;++t)s[t].push(new jh(h,i[t],n[t]))}else if(u<l){a=t[u];const o=--l,c=t[o];e[c.uuid]=u,t[u]=c,e[d]=o,t[o]=h;for(let t=0,e=r;t!==e;++t){const e=s[t],r=e[o];let a=e[u];e[u]=r,void 0===a&&(a=new jh(h,i[t],n[t])),e[o]=a}}else t[u]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,n=i.length;let s=this.nCachedObjects_;for(let r=0,a=arguments.length;r!==a;++r){const a=arguments[r],o=a.uuid,l=e[o];if(void 0!==l&&l>=s){const r=s++,c=t[r];e[c.uuid]=l,t[l]=c,e[o]=r,t[r]=a;for(let t=0,e=n;t!==e;++t){const e=i[t],n=e[r],s=e[l];e[l]=n,e[r]=s}}}this.nCachedObjects_=s}uncache(){const t=this._objects,e=this._indicesByUUID,i=this._bindings,n=i.length;let s=this.nCachedObjects_,r=t.length;for(let a=0,o=arguments.length;a!==o;++a){const o=arguments[a].uuid,l=e[o];if(void 0!==l)if(delete e[o],l<s){const a=--s,o=t[a],c=--r,h=t[c];e[o.uuid]=l,t[l]=o,e[h.uuid]=a,t[a]=h,t.pop();for(let t=0,e=n;t!==e;++t){const e=i[t],n=e[a],s=e[c];e[l]=n,e[a]=s,e.pop()}}else{const s=--r,a=t[s];s>0&&(e[a.uuid]=l),t[l]=a,t.pop();for(let t=0,e=n;t!==e;++t){const e=i[t];e[l]=e[s],e.pop()}}}this.nCachedObjects_=s}subscribe_(t,e){const i=this._bindingsIndicesByPath;let n=i[t];const s=this._bindings;if(void 0!==n)return s[n];const r=this._paths,a=this._parsedPaths,o=this._objects,l=o.length,c=this.nCachedObjects_,h=new Array(l);n=s.length,i[t]=n,r.push(t),a.push(e),s.push(h);for(let i=c,n=o.length;i!==n;++i){const n=o[i];h[i]=new jh(n,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,i=e[t];if(void 0!==i){const n=this._paths,s=this._parsedPaths,r=this._bindings,a=r.length-1,o=r[a];e[t[a]]=i,r[i]=o,r.pop(),s[i]=s[a],s.pop(),n[i]=n[a],n.pop()}}},AnimationUtils:Ec,ArcCurve:Vo,ArrayCamera:_a,ArrowHelper:class extends wi{constructor(t=new Ae(0,0,1),e=new Ae(0,0,0),i=1,n=16776960,s=.2*i,r=.2*s){super(),this.type="ArrowHelper",void 0===bd&&(bd=new cn,bd.setAttribute("position",new tn([0,0,0,0,1,0],3)),Md=new ul(0,.5,1,5,1),Md.translate(0,-.5,0)),this.position.copy(e),this.line=new To(bd,new wo({color:n,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Cn(Md,new Vi({color:n,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(i,s,r)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{wd.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(wd,e)}}setLength(t,e=.2*t,i=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}},Audio:Rh,AudioAnalyser:class{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let i=0;i<e.length;i++)t+=e[i];return t/e.length}},AudioContext:bh,AudioListener:class extends wi{constructor(){super(),this.type="AudioListener",this.context=bh.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Ch}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Lh,kh,Ih),Ph.set(0,0,-1).applyQuaternion(kh),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Lh.x,t),e.positionY.linearRampToValueAtTime(Lh.y,t),e.positionZ.linearRampToValueAtTime(Lh.z,t),e.forwardX.linearRampToValueAtTime(Ph.x,t),e.forwardY.linearRampToValueAtTime(Ph.y,t),e.forwardZ.linearRampToValueAtTime(Ph.z,t),e.upX.linearRampToValueAtTime(i.x,t),e.upY.linearRampToValueAtTime(i.y,t),e.upZ.linearRampToValueAtTime(i.z,t)}else e.setPosition(Lh.x,Lh.y,Lh.z),e.setOrientation(Ph.x,Ph.y,Ph.z,i.x,i.y,i.z)}},AudioLoader:class extends Wc{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new qc(this.manager);r.setResponseType("arraybuffer"),r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,(function(i){try{const t=i.slice(0);bh.getContext().decodeAudioData(t,(function(t){e(t)}))}catch(e){n?n(e):console.error(e),s.manager.itemError(t)}}),i,n)}},AxesHelper:class extends Io{constructor(t=1){const e=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],i=new cn;i.setAttribute("position",new tn(e,3)),i.setAttribute("color",new tn([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(i,new wo({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,i){const n=new Gi,s=this.geometry.attributes.color.array;return n.set(t),n.toArray(s,0),n.toArray(s,3),n.set(e),n.toArray(s,6),n.toArray(s,9),n.set(i),n.toArray(s,12),n.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}},BackSide:o,BasicDepthPacking:3200,BasicShadowMap:0,Bone:oo,BooleanKeyframeTrack:Pc,Box2:class{constructor(t=new Yt(1/0,1/0),e=new Yt(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=id.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,id).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},Box3:Me,Box3Helper:class extends Io{constructor(t,e=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new cn;n.setIndex(new Ji(i,1)),n.setAttribute("position",new tn([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(n,new wo({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}},BoxBufferGeometry:class extends Ln{constructor(t,e,i,n,s,r){console.warn("THREE.BoxBufferGeometry has been renamed to THREE.BoxGeometry."),super(t,e,i,n,s,r)}},BoxGeometry:Ln,BoxHelper:class extends Io{constructor(t,e=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),s=new cn;s.setIndex(new Ji(i,1)),s.setAttribute("position",new Ji(n,3)),super(s,new wo({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&Ad.setFromObject(this.object),Ad.isEmpty())return;const e=Ad.min,i=Ad.max,n=this.geometry.attributes.position,s=n.array;s[0]=i.x,s[1]=i.y,s[2]=i.z,s[3]=e.x,s[4]=i.y,s[5]=i.z,s[6]=e.x,s[7]=e.y,s[8]=i.z,s[9]=i.x,s[10]=e.y,s[11]=i.z,s[12]=i.x,s[13]=i.y,s[14]=e.z,s[15]=e.x,s[16]=i.y,s[17]=e.z,s[18]=e.x,s[19]=e.y,s[20]=e.z,s[21]=i.x,s[22]=e.y,s[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t,e){return super.copy(t,e),this.object=t.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}},BufferAttribute:Ji,BufferGeometry:cn,BufferGeometryLoader:_h,ByteType:1010,Cache:Gc,Camera:Dn,CameraHelper:class extends Io{constructor(t){const e=new cn,i=new wo({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],s=[],r={};function a(t,e){o(t),o(e)}function o(t){n.push(0,0,0),s.push(0,0,0),void 0===r[t]&&(r[t]=[]),r[t].push(n.length/3-1)}a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4"),e.setAttribute("position",new tn(n,3)),e.setAttribute("color",new tn(s,3)),super(e,i),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=r,this.update();const l=new Gi(16755200),c=new Gi(16711680),h=new Gi(43775),d=new Gi(16777215),u=new Gi(3355443);this.setColors(l,c,h,d,u)}setColors(t,e,i,n,s){const r=this.geometry.getAttribute("color");r.setXYZ(0,t.r,t.g,t.b),r.setXYZ(1,t.r,t.g,t.b),r.setXYZ(2,t.r,t.g,t.b),r.setXYZ(3,t.r,t.g,t.b),r.setXYZ(4,t.r,t.g,t.b),r.setXYZ(5,t.r,t.g,t.b),r.setXYZ(6,t.r,t.g,t.b),r.setXYZ(7,t.r,t.g,t.b),r.setXYZ(8,t.r,t.g,t.b),r.setXYZ(9,t.r,t.g,t.b),r.setXYZ(10,t.r,t.g,t.b),r.setXYZ(11,t.r,t.g,t.b),r.setXYZ(12,t.r,t.g,t.b),r.setXYZ(13,t.r,t.g,t.b),r.setXYZ(14,t.r,t.g,t.b),r.setXYZ(15,t.r,t.g,t.b),r.setXYZ(16,t.r,t.g,t.b),r.setXYZ(17,t.r,t.g,t.b),r.setXYZ(18,t.r,t.g,t.b),r.setXYZ(19,t.r,t.g,t.b),r.setXYZ(20,t.r,t.g,t.b),r.setXYZ(21,t.r,t.g,t.b),r.setXYZ(22,t.r,t.g,t.b),r.setXYZ(23,t.r,t.g,t.b),r.setXYZ(24,e.r,e.g,e.b),r.setXYZ(25,e.r,e.g,e.b),r.setXYZ(26,e.r,e.g,e.b),r.setXYZ(27,e.r,e.g,e.b),r.setXYZ(28,e.r,e.g,e.b),r.setXYZ(29,e.r,e.g,e.b),r.setXYZ(30,e.r,e.g,e.b),r.setXYZ(31,e.r,e.g,e.b),r.setXYZ(32,i.r,i.g,i.b),r.setXYZ(33,i.r,i.g,i.b),r.setXYZ(34,i.r,i.g,i.b),r.setXYZ(35,i.r,i.g,i.b),r.setXYZ(36,i.r,i.g,i.b),r.setXYZ(37,i.r,i.g,i.b),r.setXYZ(38,n.r,n.g,n.b),r.setXYZ(39,n.r,n.g,n.b),r.setXYZ(40,s.r,s.g,s.b),r.setXYZ(41,s.r,s.g,s.b),r.setXYZ(42,s.r,s.g,s.b),r.setXYZ(43,s.r,s.g,s.b),r.setXYZ(44,s.r,s.g,s.b),r.setXYZ(45,s.r,s.g,s.b),r.setXYZ(46,s.r,s.g,s.b),r.setXYZ(47,s.r,s.g,s.b),r.setXYZ(48,s.r,s.g,s.b),r.setXYZ(49,s.r,s.g,s.b),r.needsUpdate=!0}update(){const t=this.geometry,e=this.pointMap;yd.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),xd("c",e,t,yd,0,0,-1),xd("t",e,t,yd,0,0,1),xd("n1",e,t,yd,-1,-1,-1),xd("n2",e,t,yd,1,-1,-1),xd("n3",e,t,yd,-1,1,-1),xd("n4",e,t,yd,1,1,-1),xd("f1",e,t,yd,-1,-1,1),xd("f2",e,t,yd,1,-1,1),xd("f3",e,t,yd,-1,1,1),xd("f4",e,t,yd,1,1,1),xd("u1",e,t,yd,.7,1.1,-1),xd("u2",e,t,yd,-.7,1.1,-1),xd("u3",e,t,yd,0,2,-1),xd("cf1",e,t,yd,-1,0,1),xd("cf2",e,t,yd,1,0,1),xd("cf3",e,t,yd,0,-1,1),xd("cf4",e,t,yd,0,1,1),xd("cn1",e,t,yd,-1,0,-1),xd("cn2",e,t,yd,1,0,-1),xd("cn3",e,t,yd,0,-1,-1),xd("cn4",e,t,yd,0,1,-1),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},CanvasTexture:class extends fe{constructor(t,e,i,n,s,r,a,o,l){super(t,e,i,n,s,r,a,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}},CapsuleBufferGeometry:class extends hl{constructor(t,e,i,n){console.warn("THREE.CapsuleBufferGeometry has been renamed to THREE.CapsuleGeometry."),super(t,e,i,n)}},CapsuleGeometry:hl,CatmullRomCurve3:Xo,CineonToneMapping:f,CircleBufferGeometry:class extends dl{constructor(t,e,i,n){console.warn("THREE.CircleBufferGeometry has been renamed to THREE.CircleGeometry."),super(t,e,i,n)}},CircleGeometry:dl,ClampToEdgeWrapping:S,Clock:Ch,Color:Gi,ColorKeyframeTrack:Rc,ColorManagement:ce,CompressedArrayTexture:class extends Fo{constructor(t,e,i,n,s,r){super(t,e,i,s,r),this.isCompressedArrayTexture=!0,this.image.depth=n,this.wrapR=S}},CompressedTexture:Fo,CompressedTextureLoader:class extends Wc{constructor(t){super(t)}load(t,e,i,n){const s=this,r=[],a=new Fo,o=new qc(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(s.withCredentials);let l=0;function c(c){o.load(t[c],(function(t){const i=s.parse(t,!0);r[c]={width:i.width,height:i.height,format:i.format,mipmaps:i.mipmaps},l+=1,6===l&&(1===i.mipmapCount&&(a.minFilter=k),a.image=r,a.format=i.format,a.needsUpdate=!0,e&&e(a))}),i,n)}if(Array.isArray(t))for(let e=0,i=t.length;e<i;++e)c(e);else o.load(t,(function(t){const i=s.parse(t,!0);if(i.isCubemap){const t=i.mipmaps.length/i.mipmapCount;for(let e=0;e<t;e++){r[e]={mipmaps:[]};for(let t=0;t<i.mipmapCount;t++)r[e].mipmaps.push(i.mipmaps[e*i.mipmapCount+t]),r[e].format=i.format,r[e].width=i.width,r[e].height=i.height}a.image=r}else a.image.width=i.width,a.image.height=i.height,a.mipmaps=i.mipmaps;1===i.mipmapCount&&(a.minFilter=k),a.format=i.format,a.needsUpdate=!0,e&&e(a)}),i,n);return a}},ConeBufferGeometry:class extends pl{constructor(t,e,i,n,s,r,a){console.warn("THREE.ConeBufferGeometry has been renamed to THREE.ConeGeometry."),super(t,e,i,n,s,r,a)}},ConeGeometry:pl,CubeCamera:On,CubeReflectionMapping:y,CubeRefractionMapping:x,CubeTexture:zn,CubeTextureLoader:Xc,CubeUVReflectionMapping:b,CubicBezierCurve:$o,CubicBezierCurve3:tl,CubicInterpolant:Tc,CullFaceBack:1,CullFaceFront:2,CullFaceFrontBack:3,CullFaceNone:0,Curve:Go,CurvePath:ol,CustomBlending:5,CustomToneMapping:v,CylinderBufferGeometry:class extends ul{constructor(t,e,i,n,s,r,a,o){console.warn("THREE.CylinderBufferGeometry has been renamed to THREE.CylinderGeometry."),super(t,e,i,n,s,r,a,o)}},CylinderGeometry:ul,Cylindrical:class{constructor(t=1,e=0,i=0){return this.radius=t,this.theta=e,this.y=i,this}set(t,e,i){return this.radius=t,this.theta=e,this.y=i,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,i){return this.radius=Math.sqrt(t*t+i*i),this.theta=Math.atan2(t,i),this.y=e,this}clone(){return(new this.constructor).copy(this)}},Data3DTexture:ye,DataArrayTexture:_e,DataTexture:lo,DataTextureLoader:class extends Wc{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new lo,a=new qc(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(t,(function(t){const i=s.parse(t);i&&(void 0!==i.image?r.image=i.image:void 0!==i.data&&(r.image.width=i.width,r.image.height=i.height,r.image.data=i.data),r.wrapS=void 0!==i.wrapS?i.wrapS:S,r.wrapT=void 0!==i.wrapT?i.wrapT:S,r.magFilter=void 0!==i.magFilter?i.magFilter:k,r.minFilter=void 0!==i.minFilter?i.minFilter:k,r.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.encoding&&(r.encoding=i.encoding),void 0!==i.flipY&&(r.flipY=i.flipY),void 0!==i.format&&(r.format=i.format),void 0!==i.type&&(r.type=i.type),void 0!==i.mipmaps&&(r.mipmaps=i.mipmaps,r.minFilter=P),1===i.mipmapCount&&(r.minFilter=k),void 0!==i.generateMipmaps&&(r.generateMipmaps=i.generateMipmaps),r.needsUpdate=!0,e&&e(r,i))}),i,n),r}},DataUtils:Zi,DecrementStencilOp:7683,DecrementWrapStencilOp:34056,DefaultLoadingManager:Vc,DepthFormat:F,DepthStencilFormat:G,DepthTexture:wa,DirectionalLight:hh,DirectionalLightHelper:class extends wi{constructor(t,e,i){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",void 0===e&&(e=1);let n=new cn;n.setAttribute("position",new tn([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const s=new wo({fog:!1,toneMapped:!1});this.lightPlane=new To(n,s),this.add(this.lightPlane),n=new cn,n.setAttribute("position",new tn([0,0,0,0,0,1],3)),this.targetLine=new To(n,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),fd.setFromMatrixPosition(this.light.matrixWorld),gd.setFromMatrixPosition(this.light.target.matrixWorld),vd.subVectors(gd,fd),this.lightPlane.lookAt(gd),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(gd),this.targetLine.scale.z=vd.length()}},DiscreteInterpolant:kc,DisplayP3ColorSpace:kt,DodecahedronBufferGeometry:class extends fl{constructor(t,e){console.warn("THREE.DodecahedronBufferGeometry has been renamed to THREE.DodecahedronGeometry."),super(t,e)}},DodecahedronGeometry:fl,DoubleSide:2,DstAlphaFactor:206,DstColorFactor:208,DynamicCopyUsage:35050,DynamicDrawUsage:35048,DynamicReadUsage:35049,EdgesGeometry:xl,EllipseCurve:Ho,EqualDepth:4,EqualStencilFunc:514,EquirectangularReflectionMapping:A,EquirectangularRefractionMapping:w,Euler:oi,EventDispatcher:Dt,ExtrudeBufferGeometry:class extends Yl{constructor(t,e){console.warn("THREE.ExtrudeBufferGeometry has been renamed to THREE.ExtrudeGeometry."),super(t,e)}},ExtrudeGeometry:Yl,FileLoader:qc,Float16BufferAttribute:class extends Ji{constructor(t,e,i){super(new Uint16Array(t),e,i),this.isFloat16BufferAttribute=!0}getX(t){let e=qi(this.array[t*this.itemSize]);return this.normalized&&(e=qt(e,this.array)),e}setX(t,e){return this.normalized&&(e=Zt(e,this.array)),this.array[t*this.itemSize]=Qi(e),this}getY(t){let e=qi(this.array[t*this.itemSize+1]);return this.normalized&&(e=qt(e,this.array)),e}setY(t,e){return this.normalized&&(e=Zt(e,this.array)),this.array[t*this.itemSize+1]=Qi(e),this}getZ(t){let e=qi(this.array[t*this.itemSize+2]);return this.normalized&&(e=qt(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Zt(e,this.array)),this.array[t*this.itemSize+2]=Qi(e),this}getW(t){let e=qi(this.array[t*this.itemSize+3]);return this.normalized&&(e=qt(e,this.array)),e}setW(t,e){return this.normalized&&(e=Zt(e,this.array)),this.array[t*this.itemSize+3]=Qi(e),this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=Zt(e,this.array),i=Zt(i,this.array)),this.array[t+0]=Qi(e),this.array[t+1]=Qi(i),this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=Zt(e,this.array),i=Zt(i,this.array),n=Zt(n,this.array)),this.array[t+0]=Qi(e),this.array[t+1]=Qi(i),this.array[t+2]=Qi(n),this}setXYZW(t,e,i,n,s){return t*=this.itemSize,this.normalized&&(e=Zt(e,this.array),i=Zt(i,this.array),n=Zt(n,this.array),s=Zt(s,this.array)),this.array[t+0]=Qi(e),this.array[t+1]=Qi(i),this.array[t+2]=Qi(n),this.array[t+3]=Qi(s),this}},Float32BufferAttribute:tn,Float64BufferAttribute:class extends Ji{constructor(t,e,i){super(new Float64Array(t),e,i)}},FloatType:U,Fog:ka,FogExp2:La,FramebufferTexture:class extends fe{constructor(t,e,i){super({width:t,height:e}),this.isFramebufferTexture=!0,this.format=i,this.magFilter=C,this.minFilter=C,this.generateMipmaps=!1,this.needsUpdate=!0}},FrontSide:a,Frustum:qn,GLBufferAttribute:class{constructor(t,e,i,n,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=e,this.itemSize=i,this.elementSize=n,this.count=s,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}},GLSL1:"100",GLSL3:Rt,GreaterDepth:6,GreaterEqualDepth:5,GreaterEqualStencilFunc:518,GreaterStencilFunc:516,GridHelper:md,Group:ya,HalfFloatType:N,HemisphereLight:Jc,HemisphereLightHelper:class extends wi{constructor(t,e,i){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const n=new $l(e);n.rotateY(.5*Math.PI),this.material=new Vi({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const s=n.getAttribute("position"),r=new Float32Array(3*s.count);n.setAttribute("color",new Ji(r,3)),this.add(new Cn(n,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");ud.copy(this.light.color),pd.copy(this.light.groundColor);for(let t=0,i=e.count;t<i;t++){const n=t<i/2?ud:pd;e.setXYZ(t,n.r,n.g,n.b)}e.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),t.lookAt(dd.setFromMatrixPosition(this.light.matrixWorld).negate())}},HemisphereLightProbe:class extends mh{constructor(t,e,i=1){super(void 0,i),this.isHemisphereLightProbe=!0;const n=(new Gi).set(t),s=(new Gi).set(e),r=new Ae(n.r,n.g,n.b),a=new Ae(s.r,s.g,s.b),o=Math.sqrt(Math.PI),l=o*Math.sqrt(.75);this.sh.coefficients[0].copy(r).add(a).multiplyScalar(o),this.sh.coefficients[1].copy(r).sub(a).multiplyScalar(l)}},IcosahedronBufferGeometry:class extends Kl{constructor(t,e){console.warn("THREE.IcosahedronBufferGeometry has been renamed to THREE.IcosahedronGeometry."),super(t,e)}},IcosahedronGeometry:Kl,ImageBitmapLoader:class extends Wc{constructor(t){super(t),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const s=this,r=Gc.get(t);if(void 0!==r)return s.manager.itemStart(t),setTimeout((function(){e&&e(r),s.manager.itemEnd(t)}),0),r;const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,fetch(t,a).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(s.options,{colorSpaceConversion:"none"}))})).then((function(i){Gc.add(t,i),e&&e(i),s.manager.itemEnd(t)})).catch((function(e){n&&n(e),s.manager.itemError(t),s.manager.itemEnd(t)})),s.manager.itemStart(t)}},ImageLoader:Zc,ImageUtils:de,IncrementStencilOp:7682,IncrementWrapStencilOp:34055,InstancedBufferAttribute:po,InstancedBufferGeometry:vh,InstancedInterleavedBuffer:Jh,InstancedMesh:Ao,Int16BufferAttribute:class extends Ji{constructor(t,e,i){super(new Int16Array(t),e,i)}},Int32BufferAttribute:class extends Ji{constructor(t,e,i){super(new Int32Array(t),e,i)}},Int8BufferAttribute:class extends Ji{constructor(t,e,i){super(new Int8Array(t),e,i)}},IntType:1013,InterleavedBuffer:Pa,InterleavedBufferAttribute:Ba,Interpolant:Cc,InterpolateDiscrete:_t,InterpolateLinear:yt,InterpolateSmooth:xt,InvertStencilOp:5386,KeepStencilOp:It,KeyframeTrack:Ic,LOD:$a,LatheBufferGeometry:class extends cl{constructor(t,e,i,n){console.warn("THREE.LatheBufferGeometry has been renamed to THREE.LatheGeometry."),super(t,e,i,n)}},LatheGeometry:cl,Layers:li,LessDepth:2,LessEqualDepth:3,LessEqualStencilFunc:515,LessStencilFunc:513,Light:Yc,LightProbe:mh,Line:To,Line3:rd,LineBasicMaterial:wo,LineCurve:el,LineCurve3:il,LineDashedMaterial:yc,LineLoop:Po,LineSegments:Io,LinearEncoding:Et,LinearFilter:k,LinearInterpolant:Lc,LinearMipMapLinearFilter:1008,LinearMipMapNearestFilter:1007,LinearMipmapLinearFilter:P,LinearMipmapNearestFilter:I,LinearSRGBColorSpace:Lt,LinearToneMapping:p,Loader:Wc,LoaderUtils:gh,LoadingManager:Hc,LoopOnce:2200,LoopPingPong:vt,LoopRepeat:gt,LuminanceAlphaFormat:1025,LuminanceFormat:1024,MOUSE:e,Material:Ui,MaterialLoader:fh,MathUtils:Xt,Matrix3:Jt,Matrix4:Je,MaxEquation:104,Mesh:Cn,MeshBasicMaterial:Vi,MeshDepthMaterial:ua,MeshDistanceMaterial:pa,MeshLambertMaterial:vc,MeshMatcapMaterial:_c,MeshNormalMaterial:gc,MeshPhongMaterial:mc,MeshPhysicalMaterial:pc,MeshStandardMaterial:uc,MeshToonMaterial:fc,MinEquation:103,MirroredRepeatWrapping:E,MixOperation:h,MultiplyBlending:4,MultiplyOperation:c,NearestFilter:C,NearestMipMapLinearFilter:1005,NearestMipMapNearestFilter:1004,NearestMipmapLinearFilter:L,NearestMipmapNearestFilter:T,NeverDepth:0,NeverStencilFunc:512,NoBlending:0,NoColorSpace:"",NoToneMapping:u,NormalAnimationBlendMode:Mt,NormalBlending:1,NotEqualDepth:7,NotEqualStencilFunc:517,NumberKeyframeTrack:Bc,Object3D:wi,ObjectLoader:class extends Wc{constructor(t){super(t)}load(t,e,i,n){const s=this,r=""===this.path?gh.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||r;const a=new qc(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(i){let r=null;try{r=JSON.parse(i)}catch(e){return void 0!==n&&n(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}const a=r.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())return void 0!==n&&n(new Error("THREE.ObjectLoader: Can't load "+t)),void console.error("THREE.ObjectLoader: Can't load "+t);s.parse(r,e)}),i,n)}async loadAsync(t,e){const i=""===this.path?gh.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||i;const n=new qc(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials);const s=await n.loadAsync(t,e),r=JSON.parse(s),a=r.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+t);return await this.parseAsync(r)}parse(t,e){const i=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),s=this.parseGeometries(t.geometries,n),r=this.parseImages(t.images,(function(){void 0!==e&&e(l)})),a=this.parseTextures(t.textures,r),o=this.parseMaterials(t.materials,a),l=this.parseObject(t.object,s,o,a,i),c=this.parseSkeletons(t.skeletons,l);if(this.bindSkeletons(l,c),void 0!==e){let t=!1;for(const e in r)if(r[e].data instanceof HTMLImageElement){t=!0;break}!1===t&&e(l)}return l}async parseAsync(t){const e=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),n=this.parseGeometries(t.geometries,i),s=await this.parseImagesAsync(t.images),r=this.parseTextures(t.textures,s),a=this.parseMaterials(t.materials,r),o=this.parseObject(t.object,n,a,r,e),l=this.parseSkeletons(t.skeletons,o);return this.bindSkeletons(o,l),o}parseShapes(t){const e={};if(void 0!==t)for(let i=0,n=t.length;i<n;i++){const n=(new Al).fromJSON(t[i]);e[n.uuid]=n}return e}parseSkeletons(t,e){const i={},n={};if(e.traverse((function(t){t.isBone&&(n[t.uuid]=t)})),void 0!==t)for(let e=0,s=t.length;e<s;e++){const s=(new uo).fromJSON(t[e],n);i[s.uuid]=s}return i}parseGeometries(t,e){const i={};if(void 0!==t){const n=new _h;for(let s=0,r=t.length;s<r;s++){let r;const a=t[s];switch(a.type){case"BufferGeometry":case"InstancedBufferGeometry":r=n.parse(a);break;default:a.type in cc?r=cc[a.type].fromJSON(a,e):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${a.type}"`)}r.uuid=a.uuid,void 0!==a.name&&(r.name=a.name),void 0!==a.userData&&(r.userData=a.userData),i[a.uuid]=r}}return i}parseMaterials(t,e){const i={},n={};if(void 0!==t){const s=new fh;s.setTextures(e);for(let e=0,r=t.length;e<r;e++){const r=t[e];void 0===i[r.uuid]&&(i[r.uuid]=s.parse(r)),n[r.uuid]=i[r.uuid]}}return n}parseAnimations(t){const e={};if(void 0!==t)for(let i=0;i<t.length;i++){const n=t[i],s=zc.parse(n);e[s.uuid]=s}return e}parseImages(t,e){const i=this,n={};let s;function r(t){if("string"==typeof t){const e=t;return function(t){return i.manager.itemStart(t),s.load(t,(function(){i.manager.itemEnd(t)}),void 0,(function(){i.manager.itemError(t),i.manager.itemEnd(t)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:i.resourcePath+e)}return t.data?{data:ee(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){const i=new Hc(e);s=new Zc(i),s.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.url;if(Array.isArray(s)){const t=[];for(let e=0,i=s.length;e<i;e++){const i=r(s[e]);null!==i&&(i instanceof HTMLImageElement?t.push(i):t.push(new lo(i.data,i.width,i.height)))}n[i.uuid]=new ue(t)}else{const t=r(i.url);n[i.uuid]=new ue(t)}}}return n}async parseImagesAsync(t){const e=this,i={};let n;async function s(t){if("string"==typeof t){const i=t,s=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(i)?i:e.resourcePath+i;return await n.loadAsync(s)}return t.data?{data:ee(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){n=new Zc(this.manager),n.setCrossOrigin(this.crossOrigin);for(let e=0,n=t.length;e<n;e++){const n=t[e],r=n.url;if(Array.isArray(r)){const t=[];for(let e=0,i=r.length;e<i;e++){const i=r[e],n=await s(i);null!==n&&(n instanceof HTMLImageElement?t.push(n):t.push(new lo(n.data,n.width,n.height)))}i[n.uuid]=new ue(t)}else{const t=await s(n.url);i[n.uuid]=new ue(t)}}}return i}parseTextures(t,e){function i(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}const n={};if(void 0!==t)for(let s=0,r=t.length;s<r;s++){const r=t[s];void 0===r.image&&console.warn('THREE.ObjectLoader: No "image" specified for',r.uuid),void 0===e[r.image]&&console.warn("THREE.ObjectLoader: Undefined image",r.image);const a=e[r.image],o=a.data;let l;Array.isArray(o)?(l=new zn,6===o.length&&(l.needsUpdate=!0)):(l=o&&o.data?new lo:new fe,o&&(l.needsUpdate=!0)),l.source=a,l.uuid=r.uuid,void 0!==r.name&&(l.name=r.name),void 0!==r.mapping&&(l.mapping=i(r.mapping,yh)),void 0!==r.channel&&(l.channel=r.channel),void 0!==r.offset&&l.offset.fromArray(r.offset),void 0!==r.repeat&&l.repeat.fromArray(r.repeat),void 0!==r.center&&l.center.fromArray(r.center),void 0!==r.rotation&&(l.rotation=r.rotation),void 0!==r.wrap&&(l.wrapS=i(r.wrap[0],xh),l.wrapT=i(r.wrap[1],xh)),void 0!==r.format&&(l.format=r.format),void 0!==r.internalFormat&&(l.internalFormat=r.internalFormat),void 0!==r.type&&(l.type=r.type),void 0!==r.encoding&&(l.encoding=r.encoding),void 0!==r.minFilter&&(l.minFilter=i(r.minFilter,Ah)),void 0!==r.magFilter&&(l.magFilter=i(r.magFilter,Ah)),void 0!==r.anisotropy&&(l.anisotropy=r.anisotropy),void 0!==r.flipY&&(l.flipY=r.flipY),void 0!==r.generateMipmaps&&(l.generateMipmaps=r.generateMipmaps),void 0!==r.premultiplyAlpha&&(l.premultiplyAlpha=r.premultiplyAlpha),void 0!==r.unpackAlignment&&(l.unpackAlignment=r.unpackAlignment),void 0!==r.userData&&(l.userData=r.userData),n[r.uuid]=l}return n}parseObject(t,e,i,n,s){let r,a,o;function l(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function c(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let n=0,s=t.length;n<s;n++){const s=t[n];void 0===i[s]&&console.warn("THREE.ObjectLoader: Undefined material",s),e.push(i[s])}return e}return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),i[t]}}function h(t){return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined texture",t),n[t]}switch(t.type){case"Scene":r=new Ia,void 0!==t.background&&(Number.isInteger(t.background)?r.background=new Gi(t.background):r.background=h(t.background)),void 0!==t.environment&&(r.environment=h(t.environment)),void 0!==t.fog&&("Fog"===t.fog.type?r.fog=new ka(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(r.fog=new La(t.fog.color,t.fog.density))),void 0!==t.backgroundBlurriness&&(r.backgroundBlurriness=t.backgroundBlurriness),void 0!==t.backgroundIntensity&&(r.backgroundIntensity=t.backgroundIntensity);break;case"PerspectiveCamera":r=new Un(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(r.focus=t.focus),void 0!==t.zoom&&(r.zoom=t.zoom),void 0!==t.filmGauge&&(r.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(r.filmOffset=t.filmOffset),void 0!==t.view&&(r.view=Object.assign({},t.view));break;case"OrthographicCamera":r=new os(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(r.zoom=t.zoom),void 0!==t.view&&(r.view=Object.assign({},t.view));break;case"AmbientLight":r=new dh(t.color,t.intensity);break;case"DirectionalLight":r=new hh(t.color,t.intensity);break;case"PointLight":r=new lh(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":r=new uh(t.color,t.intensity,t.width,t.height);break;case"SpotLight":r=new nh(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":r=new Jc(t.color,t.groundColor,t.intensity);break;case"LightProbe":r=(new mh).fromJSON(t);break;case"SkinnedMesh":a=l(t.geometry),o=c(t.material),r=new ao(a,o),void 0!==t.bindMode&&(r.bindMode=t.bindMode),void 0!==t.bindMatrix&&r.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(r.skeleton=t.skeleton);break;case"Mesh":a=l(t.geometry),o=c(t.material),r=new Cn(a,o);break;case"InstancedMesh":a=l(t.geometry),o=c(t.material);const e=t.count,i=t.instanceMatrix,n=t.instanceColor;r=new Ao(a,o,e),r.instanceMatrix=new po(new Float32Array(i.array),16),void 0!==n&&(r.instanceColor=new po(new Float32Array(n.array),n.itemSize));break;case"LOD":r=new $a;break;case"Line":r=new To(l(t.geometry),c(t.material));break;case"LineLoop":r=new Po(l(t.geometry),c(t.material));break;case"LineSegments":r=new Io(l(t.geometry),c(t.material));break;case"PointCloud":case"Points":r=new Oo(l(t.geometry),c(t.material));break;case"Sprite":r=new Xa(c(t.material));break;case"Group":r=new ya;break;case"Bone":r=new oo;break;default:r=new wi}if(r.uuid=t.uuid,void 0!==t.name&&(r.name=t.name),void 0!==t.matrix?(r.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(r.matrixAutoUpdate=t.matrixAutoUpdate),r.matrixAutoUpdate&&r.matrix.decompose(r.position,r.quaternion,r.scale)):(void 0!==t.position&&r.position.fromArray(t.position),void 0!==t.rotation&&r.rotation.fromArray(t.rotation),void 0!==t.quaternion&&r.quaternion.fromArray(t.quaternion),void 0!==t.scale&&r.scale.fromArray(t.scale)),void 0!==t.up&&r.up.fromArray(t.up),void 0!==t.castShadow&&(r.castShadow=t.castShadow),void 0!==t.receiveShadow&&(r.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(r.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(r.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(r.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&r.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(r.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.frustumCulled&&(r.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(r.renderOrder=t.renderOrder),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.layers&&(r.layers.mask=t.layers),void 0!==t.children){const a=t.children;for(let t=0;t<a.length;t++)r.add(this.parseObject(a[t],e,i,n,s))}if(void 0!==t.animations){const e=t.animations;for(let t=0;t<e.length;t++){const i=e[t];r.animations.push(s[i])}}if("LOD"===t.type){void 0!==t.autoUpdate&&(r.autoUpdate=t.autoUpdate);const e=t.levels;for(let t=0;t<e.length;t++){const i=e[t],n=r.getObjectByProperty("uuid",i.object);void 0!==n&&r.addLevel(n,i.distance,i.hysteresis)}}return r}bindSkeletons(t,e){0!==Object.keys(e).length&&t.traverse((function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){const i=e[t.skeleton];void 0===i?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(i,t.bindMatrix)}}))}},ObjectSpaceNormalMap:1,OctahedronBufferGeometry:class extends $l{constructor(t,e){console.warn("THREE.OctahedronBufferGeometry has been renamed to THREE.OctahedronGeometry."),super(t,e)}},OctahedronGeometry:$l,OneFactor:201,OneMinusDstAlphaFactor:207,OneMinusDstColorFactor:209,OneMinusSrcAlphaFactor:205,OneMinusSrcColorFactor:203,OrthographicCamera:os,PCFShadowMap:n,PCFSoftShadowMap:s,PMREMGenerator:gs,Path:ll,PerspectiveCamera:Un,Plane:Wn,PlaneBufferGeometry:class extends Yn{constructor(t,e,i,n){console.warn("THREE.PlaneBufferGeometry has been renamed to THREE.PlaneGeometry."),super(t,e,i,n)}},PlaneGeometry:Yn,PlaneHelper:class extends To{constructor(t,e=1,i=16776960){const n=i,s=new cn;s.setAttribute("position",new tn([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),s.computeBoundingSphere(),super(s,new wo({color:n,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const r=new cn;r.setAttribute("position",new tn([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),r.computeBoundingSphere(),this.add(new Cn(r,new Vi({color:n,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}},PointLight:lh,PointLightHelper:class extends Cn{constructor(t,e,i){super(new ic(e,4,2),new Vi({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}},Points:Oo,PointsMaterial:Ro,PolarGridHelper:class extends Io{constructor(t=10,e=16,i=8,n=64,s=4473924,r=8947848){s=new Gi(s),r=new Gi(r);const a=[],o=[];if(e>1)for(let i=0;i<e;i++){const n=i/e*(2*Math.PI),l=Math.sin(n)*t,c=Math.cos(n)*t;a.push(0,0,0),a.push(l,0,c);const h=1&i?s:r;o.push(h.r,h.g,h.b),o.push(h.r,h.g,h.b)}for(let e=0;e<i;e++){const l=1&e?s:r,c=t-t/i*e;for(let t=0;t<n;t++){let e=t/n*(2*Math.PI),i=Math.sin(e)*c,s=Math.cos(e)*c;a.push(i,0,s),o.push(l.r,l.g,l.b),e=(t+1)/n*(2*Math.PI),i=Math.sin(e)*c,s=Math.cos(e)*c,a.push(i,0,s),o.push(l.r,l.g,l.b)}}const l=new cn;l.setAttribute("position",new tn(a,3)),l.setAttribute("color",new tn(o,3));super(l,new wo({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}},PolyhedronBufferGeometry:class extends ml{constructor(t,e,i,n){console.warn("THREE.PolyhedronBufferGeometry has been renamed to THREE.PolyhedronGeometry."),super(t,e,i,n)}},PolyhedronGeometry:ml,PositionalAudio:class extends Rh{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,i){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=i,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(Bh,Dh,Uh),Nh.set(0,0,1).applyQuaternion(Dh);const e=this.panner;if(e.positionX){const t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(Bh.x,t),e.positionY.linearRampToValueAtTime(Bh.y,t),e.positionZ.linearRampToValueAtTime(Bh.z,t),e.orientationX.linearRampToValueAtTime(Nh.x,t),e.orientationY.linearRampToValueAtTime(Nh.y,t),e.orientationZ.linearRampToValueAtTime(Nh.z,t)}else e.setPosition(Bh.x,Bh.y,Bh.z),e.setOrientation(Nh.x,Nh.y,Nh.z)}},PropertyBinding:jh,PropertyMixer:Oh,QuadraticBezierCurve:nl,QuadraticBezierCurve3:sl,Quaternion:xe,QuaternionKeyframeTrack:Uc,QuaternionLinearInterpolant:Dc,RED_GREEN_RGTC2_Format:mt,RED_RGTC1_Format:36283,REVISION:t,RGBADepthPacking:3201,RGBAFormat:z,RGBAIntegerFormat:1033,RGBA_ASTC_10x10_Format:ct,RGBA_ASTC_10x5_Format:at,RGBA_ASTC_10x6_Format:ot,RGBA_ASTC_10x8_Format:lt,RGBA_ASTC_12x10_Format:ht,RGBA_ASTC_12x12_Format:dt,RGBA_ASTC_4x4_Format:K,RGBA_ASTC_5x4_Format:$,RGBA_ASTC_5x5_Format:tt,RGBA_ASTC_6x5_Format:et,RGBA_ASTC_6x6_Format:it,RGBA_ASTC_8x5_Format:nt,RGBA_ASTC_8x6_Format:st,RGBA_ASTC_8x8_Format:rt,RGBA_BPTC_Format:ut,RGBA_ETC2_EAC_Format:J,RGBA_PVRTC_2BPPV1_Format:X,RGBA_PVRTC_4BPPV1_Format:Z,RGBA_S3TC_DXT1_Format:V,RGBA_S3TC_DXT3_Format:W,RGBA_S3TC_DXT5_Format:j,RGB_ETC1_Format:36196,RGB_ETC2_Format:Y,RGB_PVRTC_2BPPV1_Format:q,RGB_PVRTC_4BPPV1_Format:Q,RGB_S3TC_DXT1_Format:H,RGFormat:1030,RGIntegerFormat:1031,RawShaderMaterial:dc,Ray:Ye,Raycaster:Kh,RectAreaLight:uh,RedFormat:1028,RedIntegerFormat:1029,ReinhardToneMapping:m,RepeatWrapping:M,ReplaceStencilOp:7681,ReverseSubtractEquation:102,RingBufferGeometry:class extends tc{constructor(t,e,i,n,s,r){console.warn("THREE.RingBufferGeometry has been renamed to THREE.RingGeometry."),super(t,e,i,n,s,r)}},RingGeometry:tc,SIGNED_RED_GREEN_RGTC2_Format:ft,SIGNED_RED_RGTC1_Format:pt,SRGBColorSpace:Tt,Scene:Ia,ShaderChunk:Jn,ShaderLib:$n,ShaderMaterial:Bn,ShadowMaterial:hc,Shape:Al,ShapeBufferGeometry:class extends ec{constructor(t,e){console.warn("THREE.ShapeBufferGeometry has been renamed to THREE.ShapeGeometry."),super(t,e)}},ShapeGeometry:ec,ShapePath:Sd,ShapeUtils:ql,ShortType:1011,Skeleton:uo,SkeletonHelper:class extends Io{constructor(t){const e=hd(t),i=new cn,n=[],s=[],r=new Gi(0,0,1),a=new Gi(0,1,0);for(let t=0;t<e.length;t++){const i=e[t];i.parent&&i.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),s.push(r.r,r.g,r.b),s.push(a.r,a.g,a.b))}i.setAttribute("position",new tn(n,3)),i.setAttribute("color",new tn(s,3));super(i,new wo({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,i=this.geometry,n=i.getAttribute("position");cd.copy(this.root.matrixWorld).invert();for(let t=0,i=0;t<e.length;t++){const s=e[t];s.parent&&s.parent.isBone&&(ld.multiplyMatrices(cd,s.matrixWorld),od.setFromMatrixPosition(ld),n.setXYZ(i,od.x,od.y,od.z),ld.multiplyMatrices(cd,s.parent.matrixWorld),od.setFromMatrixPosition(ld),n.setXYZ(i+1,od.x,od.y,od.z),i+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose()}},SkinnedMesh:ao,Source:ue,Sphere:He,SphereBufferGeometry:class extends ic{constructor(t,e,i,n,s,r,a){console.warn("THREE.SphereBufferGeometry has been renamed to THREE.SphereGeometry."),super(t,e,i,n,s,r,a)}},SphereGeometry:ic,Spherical:ed,SphericalHarmonics3:ph,SplineCurve:rl,SpotLight:nh,SpotLightHelper:class extends wi{constructor(t,e){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const i=new cn,n=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let t=0,e=1,i=32;t<i;t++,e++){const s=t/i*Math.PI*2,r=e/i*Math.PI*2;n.push(Math.cos(s),Math.sin(s),1,Math.cos(r),Math.sin(r),1)}i.setAttribute("position",new tn(n,3));const s=new wo({fog:!1,toneMapped:!1});this.cone=new Io(i,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1);const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),ad.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(ad),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},Sprite:Xa,SpriteMaterial:Da,SrcAlphaFactor:204,SrcAlphaSaturateFactor:210,SrcColorFactor:202,StaticCopyUsage:35046,StaticDrawUsage:Pt,StaticReadUsage:35045,StereoCamera:class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Un,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Un,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,Eh.copy(t.projectionMatrix);const i=e.eyeSep/2,n=i*e.near/e.focus,s=e.near*Math.tan(Ot*e.fov*.5)/e.zoom;let r,a;Sh.elements[12]=-i,Mh.elements[12]=i,r=-s*e.aspect+n,a=s*e.aspect+n,Eh.elements[0]=2*e.near/(a-r),Eh.elements[8]=(a+r)/(a-r),this.cameraL.projectionMatrix.copy(Eh),r=-s*e.aspect-n,a=s*e.aspect-n,Eh.elements[0]=2*e.near/(a-r),Eh.elements[8]=(a+r)/(a-r),this.cameraR.projectionMatrix.copy(Eh)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Sh),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Mh)}},StreamCopyUsage:35042,StreamDrawUsage:35040,StreamReadUsage:35041,StringKeyframeTrack:Nc,SubtractEquation:101,SubtractiveBlending:3,TOUCH:i,TangentSpaceNormalMap:0,TetrahedronBufferGeometry:class extends nc{constructor(t,e){console.warn("THREE.TetrahedronBufferGeometry has been renamed to THREE.TetrahedronGeometry."),super(t,e)}},TetrahedronGeometry:nc,Texture:fe,TextureLoader:class extends Wc{constructor(t){super(t)}load(t,e,i,n){const s=new fe,r=new Zc(this.manager);return r.setCrossOrigin(this.crossOrigin),r.setPath(this.path),r.load(t,(function(t){s.image=t,s.needsUpdate=!0,void 0!==e&&e(s)}),i,n),s}},TorusBufferGeometry:class extends sc{constructor(t,e,i,n,s){console.warn("THREE.TorusBufferGeometry has been renamed to THREE.TorusGeometry."),super(t,e,i,n,s)}},TorusGeometry:sc,TorusKnotBufferGeometry:class extends rc{constructor(t,e,i,n,s,r){console.warn("THREE.TorusKnotBufferGeometry has been renamed to THREE.TorusKnotGeometry."),super(t,e,i,n,s,r)}},TorusKnotGeometry:rc,Triangle:Bi,TriangleFanDrawMode:2,TriangleStripDrawMode:1,TrianglesDrawMode:0,TubeBufferGeometry:class extends ac{constructor(t,e,i,n,s){console.warn("THREE.TubeBufferGeometry has been renamed to THREE.TubeGeometry."),super(t,e,i,n,s)}},TubeGeometry:ac,TwoPassDoubleSide:2,UVMapping:_,Uint16BufferAttribute:Ki,Uint32BufferAttribute:$i,Uint8BufferAttribute:class extends Ji{constructor(t,e,i){super(new Uint8Array(t),e,i)}},Uint8ClampedBufferAttribute:class extends Ji{constructor(t,e,i){super(new Uint8ClampedArray(t),e,i)}},Uniform:Xh,UniformsGroup:class extends Dt{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:Yh++}),this.name="",this.usage=Pt,this.uniforms=[]}add(t){return this.uniforms.push(t),this}remove(t){const e=this.uniforms.indexOf(t);return-1!==e&&this.uniforms.splice(e,1),this}setName(t){return this.name=t,this}setUsage(t){return this.usage=t,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(t){this.name=t.name,this.usage=t.usage;const e=t.uniforms;this.uniforms.length=0;for(let t=0,i=e.length;t<i;t++)this.uniforms.push(e[t].clone());return this}clone(){return(new this.constructor).copy(this)}},UniformsLib:Kn,UniformsUtils:Rn,UnsignedByteType:R,UnsignedInt248Type:O,UnsignedIntType:D,UnsignedShort4444Type:1017,UnsignedShort5551Type:1018,UnsignedShortType:B,VSMShadowMap:r,Vector2:Yt,Vector3:Ae,Vector4:ge,VectorKeyframeTrack:Oc,VideoTexture:class extends fe{constructor(t,e,i,n,s,r,a,o,l){super(t,e,i,n,s,r,a,o,l),this.isVideoTexture=!0,this.minFilter=void 0!==r?r:k,this.magFilter=void 0!==s?s:k,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}},WebGL1Renderer:Ta,WebGL3DRenderTarget:class extends ve{constructor(t=1,e=1,i=1){super(t,e),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new ye(null,t,e,i),this.texture.isRenderTargetTexture=!0}},WebGLArrayRenderTarget:class extends ve{constructor(t=1,e=1,i=1){super(t,e),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new _e(null,t,e,i),this.texture.isRenderTargetTexture=!0}},WebGLCubeRenderTarget:Fn,WebGLMultipleRenderTargets:class extends ve{constructor(t=1,e=1,i=1,n={}){super(t,e,n),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let t=0;t<i;t++)this.texture[t]=s.clone(),this.texture[t].isRenderTargetTexture=!0}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let n=0,s=this.texture.length;n<s;n++)this.texture[n].image.width=t,this.texture[n].image.height=e,this.texture[n].image.depth=i;this.dispose()}return this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e),this}copy(t){this.dispose(),this.width=t.width,this.height=t.height,this.depth=t.depth,this.viewport.set(0,0,this.width,this.height),this.scissor.set(0,0,this.width,this.height),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.texture.length=0;for(let e=0,i=t.texture.length;e<i;e++)this.texture[e]=t.texture[e].clone(),this.texture[e].isRenderTargetTexture=!0;return this}},WebGLRenderTarget:ve,WebGLRenderer:Ca,WebGLUtils:va,WireframeGeometry:oc,WrapAroundEnding:bt,ZeroCurvatureEnding:At,ZeroFactor:200,ZeroSlopeEnding:wt,ZeroStencilOp:0,_SRGBAFormat:Bt,sRGBEncoding:Ct});const Cd={bottom:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' /%3e%3c/svg%3e"},front:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' /%3e%3c/svg%3e"},help:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M23.0%2c-13.0 A10.0%2c10.0%2c0%2c1%2c0%2c22.998476951563912%2c-12.825475935627155' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3ctext x='7.0' y='-6.0' font-size='20.0' fill='rgb(83%2c160%2c227)' font-family='sans-serif' font-weight='bold' dy='0em'%3e%3f%3c/text%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M23.0%2c-13.0 A10.0%2c10.0%2c0%2c1%2c0%2c22.998476951563912%2c-12.825475935627155' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3ctext x='7.0' y='-6.0' font-size='20.0' fill='rgb(48%2c 142%2c 225)' font-family='sans-serif' font-weight='bold' dy='0em'%3e%3f%3c/text%3e%3c/svg%3e"},iso:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M22.0%2c-7.5 L22.0%2c-18.5 L13.0%2c-13.0 L13.0%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M13.0%2c-13.0 L13.0%2c-2.0 L4.0%2c-7.5 L4.0%2c-18.5 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M22.0%2c-18.5 L13.0%2c-24.0 L4.0%2c-18.5 L13.0%2c-13.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M22.0%2c-7.5 L22.0%2c-18.5 L13.0%2c-13.0 L13.0%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M13.0%2c-13.0 L13.0%2c-2.0 L4.0%2c-7.5 L4.0%2c-18.5 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M22.0%2c-18.5 L13.0%2c-24.0 L4.0%2c-18.5 L13.0%2c-13.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3c/svg%3e"},left:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' /%3e%3c/svg%3e"},mesh:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' /%3e%3c/svg%3e"},mesh_empty:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='%23ddd' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='%23ddd' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='%23666' stroke='%23666' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='%23666' stroke='%23666' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23666' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' /%3e%3c/svg%3e"},mesh_mix:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-14.2 L12.6%2c-14.2 L8.6%2c-10.133333333333333 L8.6%2c-6.066666666666666 L12.6%2c-2.0 L6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='square' stroke-linecap='round' /%3e%3cpath d='M16.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 L16.6%2c-2.0 L12.6%2c-6.066666666666666 L12.6%2c-10.133333333333333 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M10.6%2c-10.133333333333333 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L10.6%2c-6.066666666666666' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M14.6%2c-14.2 L6.0%2c-14.2 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L6.0%2c-2.0 L14.6%2c-2.0' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-14.2 L12.6%2c-14.2 L8.6%2c-10.133333333333333 L8.6%2c-6.066666666666666 L12.6%2c-2.0 L6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='square' stroke-linecap='round' /%3e%3cpath d='M16.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 L16.6%2c-2.0 L12.6%2c-6.066666666666666 L12.6%2c-10.133333333333333 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M10.6%2c-10.133333333333333 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L10.6%2c-6.066666666666666' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M14.6%2c-14.2 L6.0%2c-14.2 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L6.0%2c-2.0 L14.6%2c-2.0' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' /%3e%3c/svg%3e"},mesh_no:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' /%3e%3c/svg%3e"},pause:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='5.2' y='-22.0' width='5.6' height='18.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' /%3e%3crect x='15.2' y='-22.0' width='5.6' height='18.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='5.2' y='-22.0' width='5.6' height='18.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' /%3e%3crect x='15.2' y='-22.0' width='5.6' height='18.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' /%3e%3c/svg%3e"},pin:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='10.0' y='-23.0' width='6.0' height='11.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' /%3e%3cpath d='M13.0%2c-3.0 L13.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M17.330127018922195%2c-21.5 A5.0%2c5.0%2c0%2c0%2c0%2c8.669872981077805%2c-21.5' stroke='%23444' stroke-width='1.25' fill='rgb(83%2c160%2c227)' stroke-linecap='round' /%3e%3cpath d='M21.66025403784439%2c-10.2 A10.0%2c10.0%2c0%2c0%2c0%2c4.339745962155613%2c-10.2' stroke='%23444' stroke-width='1.25' fill='rgb(83%2c160%2c227)' stroke-linecap='round' /%3e%3cpath d='M4.5%2c-10.2 L21.5%2c-10.2 Z' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M8.8%2c-21.4 L17.2%2c-21.4 Z' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='10.0' y='-23.0' width='6.0' height='11.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' /%3e%3cpath d='M13.0%2c-3.0 L13.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M17.330127018922195%2c-21.5 A5.0%2c5.0%2c0%2c0%2c0%2c8.669872981077805%2c-21.5' stroke='%23ddd' stroke-width='1.25' fill='rgb(48%2c 142%2c 225)' stroke-linecap='round' /%3e%3cpath d='M21.66025403784439%2c-10.2 A10.0%2c10.0%2c0%2c0%2c0%2c4.339745962155613%2c-10.2' stroke='%23ddd' stroke-width='1.25' fill='rgb(48%2c 142%2c 225)' stroke-linecap='round' /%3e%3cpath d='M4.5%2c-10.2 L21.5%2c-10.2 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M8.8%2c-21.4 L17.2%2c-21.4 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' /%3e%3c/svg%3e"},plane:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.0%2c-5.0 L4.4%2c-13.0 L24.0%2c-13.0 L21.0%2c-5.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M13.0%2c-9.5 L13.0%2c-19.5 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M11.0%2c-17.5 L13.0%2c-19.5 L15.0%2c-17.5 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.0%2c-5.0 L4.4%2c-13.0 L24.0%2c-13.0 L21.0%2c-5.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M13.0%2c-9.5 L13.0%2c-19.5 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M11.0%2c-17.5 L13.0%2c-19.5 L15.0%2c-17.5 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' /%3e%3c/svg%3e"},play:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M5.0%2c-4.0 L5.0%2c-22.0 L21.0%2c-13.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M5.0%2c-4.0 L5.0%2c-22.0 L21.0%2c-13.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3c/svg%3e"},rear:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' /%3e%3c/svg%3e"},reset:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M18.0%2c-21.660254037844386 A10.0%2c10.0%2c0%2c1%2c0%2c23.0%2c-12.999999999999998' stroke='%23444' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M16.0%2c-18.196152422706632 A6.0%2c6.0%2c0%2c1%2c0%2c19.0%2c-12.999999999999998' stroke='%23444' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M17.0%2c-13.0 L21.0%2c-17.0 L25.0%2c-13.0' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M18.0%2c-21.660254037844386 A10.0%2c10.0%2c0%2c1%2c0%2c23.0%2c-12.999999999999998' stroke='%23ddd' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M16.0%2c-18.196152422706632 A6.0%2c6.0%2c0%2c1%2c0%2c19.0%2c-12.999999999999998' stroke='%23ddd' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M17.0%2c-13.0 L21.0%2c-17.0 L25.0%2c-13.0' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3c/svg%3e"},resize:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='2.0' y='-24.0' width='22.0' height='22.0' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M6.0%2c-6.0 L6.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-6.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M20.0%2c-20.0 L20.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-20.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M6.0%2c-20.0 L6.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-20.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M20.0%2c-6.0 L20.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-6.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='2.0' y='-24.0' width='22.0' height='22.0' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M6.0%2c-6.0 L6.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-6.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M20.0%2c-20.0 L20.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-20.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M6.0%2c-20.0 L6.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-20.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M20.0%2c-6.0 L20.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-6.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' /%3e%3c/svg%3e"},right:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' /%3e%3c/svg%3e"},shape:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='rgb(83%2c160%2c227)' stroke='none' stroke-width='1.25' /%3e%3cellipse cx='12.6' cy='-8.1' rx='2.1' ry='2.1' fill='%23444' stroke='%23444' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='rgb(48%2c 142%2c 225)' stroke='none' stroke-width='1.25' /%3e%3cellipse cx='12.6' cy='-8.1' rx='2.1' ry='2.1' fill='%23ddd' stroke='%23ddd' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},shape_empty:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='%23ddd' stroke='none' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='%23666' stroke='none' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23666' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23666' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},shape_mix:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M12.6%2c-13.14 A5.04%2c5.04%2c0%2c0%2c0%2c12.599999999999998%2c-3.0599999999999996' stroke='none' stroke-width='1.25' fill='rgb(83%2c160%2c227)' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-10.2 A2.1%2c2.1%2c0%2c0%2c0%2c12.6%2c-6.0' stroke='%23444' stroke-width='1.25' fill='%23444' stroke-linecap='round' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c15.69914007006101%2c-13.236830413208175' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M15.69914007006101%2c-2.9631695867918246 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-13.7 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c12.6%2c-2.5' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M12.6%2c-13.14 A5.04%2c5.04%2c0%2c0%2c0%2c12.599999999999998%2c-3.0599999999999996' stroke='none' stroke-width='1.25' fill='rgb(48%2c 142%2c 225)' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-10.2 A2.1%2c2.1%2c0%2c0%2c0%2c12.6%2c-6.0' stroke='%23ddd' stroke-width='1.25' fill='%23ddd' stroke-linecap='round' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c15.69914007006101%2c-13.236830413208175' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M15.69914007006101%2c-2.9631695867918246 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-13.7 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c12.6%2c-2.5' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},shape_no:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},stop:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='4.0' y='-22.0' width='18.0' height='18.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='4.0' y='-22.0' width='18.0' height='18.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' /%3e%3c/svg%3e"},top:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' /%3e%3c/svg%3e"}};function Td(t,e){return`url("${Cd[e][t]}")`}function Ld(t){return`${t}px`}const kd=["reset","resize","help","iso","front","rear","top","bottom","left","right","pin","plane","play","pause","stop"];class Id{constructor(t,e,i,n){t.startsWith("plane")?(this.index=parseInt(t.substring(5)),this.type="plane"):(this.index=void 0,this.type=t),this.display=n,this.slider=n.container.getElementsByClassName(`tcv_sld_value_${t}`)[0],this.slider.min=e,this.slider.max=i,this.input=n.container.getElementsByClassName(`tcv_inp_value_${t}`)[0],this.input.value=i,this.slider.oninput=this.sliderChange,this.input.addEventListener("change",this.inputChange)}_notify=(t,e=!0)=>{const i={};i["clip_slider_"+(this.index-1)]=parseFloat(t),this.display.viewer.checkChanges(i,e)};_handle(t,e,i){"plane"==t?this.display.refreshPlane(e,i):"ambientlight"===t?this.display.viewer.ready&&this.display.viewer.setAmbientLight(i/100):"pointlight"===t?this.display.viewer.ready&&this.display.viewer.setDirectLight(i/100):"metalness"===t?this.display.viewer.ready&&this.display.viewer.setMetalness(i/100):"roughness"===t&&this.display.viewer.ready&&this.display.viewer.setRoughness(i/100)}sliderChange=t=>{const e=t.target.value;this.input.value=Math.round(1e3*e)/1e3,this._handle(this.type,this.index,this.input.value),this._notify(e)};inputChange=t=>{const e=Math.max(Math.min(t.target.value,this.slider.max),this.slider.min);this.slider.value=e,this._handle(this.type,this.index,this.input.value),this._notify(e)};setSlider(t){const e=Math.abs(Math.round(Math.log10(2*t)));this.slider.min=-t,this.slider.max=t,this.slider.step=Math.pow(10,-(3-e)),this.slider.value=t,this.input.value=Math.round(1e3*this.slider.max)/1e3,this.display.refreshPlane(this.index,this.input.value)}getValue(){return parseFloat(this.input.value)}setValue(t,e=!0){const i=Math.max(Math.min(t,this.slider.max),this.slider.min);this.input.value=i,this.slider.value=t,this._handle(this.type,this.index,this.input.value),this._notify(t,e)}}class Pd{constructor(t,e){this.container=t,this.container.innerHTML=function(t){return`\n<div class="tcv_cad_viewer">\n <div class="tcv_cad_toolbar tcv_round">\n <span class="tcv_tooltip" data-tooltip="Show coordinate axis">\n <input class='tcv_axes tcv_check' id='tcv_axes_${t}' type="checkbox" />\n <label for='tcv_axes_${t}' class="tcv_label">Axes</label>\n </span>\n <div class="tcv_grid-dropdown">\n <input class='tcv_grid tcv_check' id='tcv_grid_${t}' type="checkbox" />\n <label for='tcv_grid_${t}' class="tcv_label">Grid</label>\n <div class="tcv_grid-content tcv_dropdown-content">\n <div class="tcv_tooltip" data-tooltip="Show xy grid">\n <input class='tcv_grid-xy tcv_check tcv_dropdown-entry' id='tcv_grid-xy_${t}' type="checkbox">\n <label for='tcv_grid-xy_${t}' class="tcv_label tcv_dropdown-entry">xy</label>\n </div>\n <div class="tcv_tooltip" data-tooltip="Show xz grid">\n <input class='tcv_grid-xz tcv_check tcv_dropdown-entry' id='tcv_grid-xz_${t}' type="checkbox">\n <label for='tcv_grid-xz_${t}' class="tcv_label tcv_dropdown-entry">xz</label>\n </div>\n <div class="tcv_tooltip" data-tooltip="Show yz grid">\n <input class='tcv_grid-yz tcv_check tcv_dropdown-entry' id='tcv_grid-yz_${t}' type="checkbox">\n <label for='tcv_grid-yz_${t}' class="tcv_label tcv_dropdown-entry">yz</label>\n </div>\n </div>\n </div>\n <span class="tcv_tooltip" data-tooltip="Move center of axis and grid to (0,0,0)">\n <input class='tcv_axes0 tcv_check' id='tcv_axes0_${t}' type="checkbox" /><label for='tcv_axes0_${t}'\n class="tcv_label">@0</label>\n </span>\n <span class="tcv_tooltip" data-tooltip="Toggle camera between orthographic and perspective view">\n <input class='tcv_ortho tcv_check' id='tcv_ortho_${t}' type="checkbox" /><label for='tcv_ortho_${t}'\n class="tcv_label">Ortho</label>\n </span>\n <span class="tcv_tooltip" data-tooltip="Reset view">\n <input class='tcv_reset tcv_btn' type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Fit view">\n <input class='tcv_resize tcv_btn' type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Switch to iso view">\n <input class='tcv_iso tcv_btn' type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Switch to front view">\n <input class='tcv_front tcv_btn' type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Switch to back view">\n <input class='tcv_rear tcv_btn' type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Switch to top view">\n <input class='tcv_top tcv_btn' type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Switch to bottom view">\n <input class='tcv_bottom tcv_btn' type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Switch to left view">\n <input class='tcv_left tcv_btn' type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Switch to right view">\n <input class='tcv_right tcv_btn' type="button" />\n </span>\n <div class="tcv_more-dropdown">\n <button class="tcv_more-btn">More<span class="tcv_more_icon">▼</span></button>\n <span class="tcv_more-wrapper tcv_more-content tcv_dropdown-content">\n <span class="tcv_more_check" class="tcv_tooltip" data-tooltip="Toggle transparent objects">\n <input class='tcv_transparent tcv_check tcv_dropdown-entry' id='tcv_transparent_${t}' type="checkbox" />\n <label for='tcv_transparent_${t}' class="tcv_label tcv_dropdown-entry">Transparent</label>\n </span class="tcv_more_check">\n <span class="tcv_more_check" class="tcv_tooltip" data-tooltip="Toggle black edges">\n <input class='tcv_black_edges tcv_check tcv_dropdown-entry' id='tcv_black_edges_${t}' type="checkbox" />\n <label for='tcv_black_edges_${t}' class="tcv_label tcv_dropdown-entry">Black edges</label>\n </span class="tcv_more_check">\n <span class="tcv_more_check" class="tcv_explode_widget tcv_tooltip"\n data-tooltip="Explode assembly (@0 determines explosion center)">\n <input class='tcv_explode tcv_check tcv_dropdown-entry' id='tcv_explode_${t}' type="checkbox" />\n <label for='tcv_explode_${t}' class="tcv_label tcv_dropdown-entry">Explode</label>\n </span class="tcv_more_check">\n </span>\n </div>\n\n <span class="tcv_align_right">\n <span class="tcv_tooltip" data-tooltip="Toggle help">\n <input class='tcv_help tcv_btn' type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Pin view as PNG image">\n <input class='tcv_pin tcv_btn' type="button" />\n </span>\n </span>\n </div>\n\n <div class="tcv_cad_body">\n <div class="tcv_cad_navigation">\n <div class="tcv_cad_tree tcv_round">\n <div class="tcv_tabnav">\n <input class='tcv_tab_tree tcv_tab tcv_tab-left tcv_tab-selected' value="Tree" type="button" />\n <input class='tcv_tab_clip tcv_tab tcv_tab-right tcv_tab-unselected' value="Clipping" type="button" />\n <input class='tcv_tab_material tcv_tab tcv_tab-right tcv_tab-unselected' value="Material" type="button" />\n </div>\n <div class="tcv_cad_tree_toggles">\n <span class="tcv_tooltip" data-tooltip="Collpase nodes with a single leaf">\n <input class='tcv_collapse_singles tcv_btn tcv_small_btn' value="1" type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Expand root node only">\n <input class='tcv_expand_root tcv_btn tcv_small_btn' value="R" type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Collpase tree">\n <input class='tcv_collapse_all tcv_btn tcv_small_btn' value="C" type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Expand tree">\n <input class='tcv_expand tcv_btn tcv_small_btn' value="E" type="button" />\n </span>\n </div>\n <div class="tcv_box_content tcv_mac-scrollbar tcv_scroller">\n <div class="tcv_cad_tree_container"></div>\n <div class="tcv_cad_clip_container">\n <div class="tcv_slider_group">\n <div>\n <span class="tcv_tooltip" data-tooltip="Set red clipping plane to view direction">\n <input class='tcv_btn_norm_plane1 tcv_btn tcv_plane' type="button" />\n </span>\n <span class="tcv_lbl_norm_plane1 tcv_label">N1 = (n/a, n/a, n/a)</span>\n </div>\n <div>\n <input type="range" min="1" max="100" value="50"\n class="tcv_sld_value_plane1 tcv_clip_slider">\n <input value=50 class="tcv_inp_value_plane1 tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_slider_group">\n <div>\n <span class="tooltip" data-tooltip="Set green clipping plane to view direction">\n <input class='tcv_btn_norm_plane2 tcv_btn tcv_plane' type="button" />\n </span>\n <span class="tcv_lbl_norm_plane2 tcv_label">N2 = (n/a, n/a, n/a)</span>\n </div>\n <div>\n <input type="range" min="1" max="100" value="50"\n class="tcv_sld_value_plane2 tcv_clip_slider">\n <input value=50 class="tcv_inp_value_plane2 tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_slider_group">\n <div>\n <span class="tooltip" data-tooltip="Set blue clipping plane to view direction">\n <input class='tcv_btn_norm_plane3 tcv_btn tcv_plane' type="button" />\n </span>\n <span class="tcv_lbl_norm_plane3 tcv_label">N3 = (n/a, n/a, n/a)</span>\n </div>\n <div>\n <input type="range" min="1" max="100" value="50"\n class="tcv_sld_value_plane3 tcv_clip_slider">\n <input value=50 class="tcv_inp_value_plane3 tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_clip_checks">\n <span class="tcv_tooltip" data-tooltip="Use intersection clipping">\n <span class="tcv_label">Intersection</span><input\n class='tcv_clip_intersection tcv_check' type="checkbox" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Show clipping planes">\n <span class="tcv_label">Planes</span><input\n class='tcv_clip_plane_helpers tcv_axes0 tcv_check' type="checkbox" />\n </span>\n </div>\n </div>\n <div class="tcv_cad_material_container">\n <div class="tcv_material_ambientlight tcv_label tcv_clip_checks">\n Ambient light intensity (in %)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="20" value="1"\n class="tcv_sld_value_ambientlight tcv_clip_slider">\n <input value=1 class="tcv_inp_value_ambientlight tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_pointlight tcv_label">\n Point light intensity (in %)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="40" value="1"\n class="tcv_sld_value_pointlight tcv_clip_slider">\n <input value=1 class="tcv_inp_value_pointlight tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_metalness tcv_label">\n Metalness (in %)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="100" value="40"\n class="tcv_sld_value_metalness tcv_clip_slider">\n <input value=40 class="tcv_inp_value_metalness tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_roughness tcv_label">\n Roughness (in %)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="100" value="40"\n class="tcv_sld_value_roughness tcv_clip_slider">\n <input value=40 class="tcv_inp_value_roughness tcv_clip_input"></input>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class="tcv_cad_info_wrapper">\n <div class="tcv_toggle_info_wrapper">\n <span class="tooltip" data-tooltip="Open/close info box">\n <input class='tcv_toggle_info tcv_btn tcv_small_info_btn' value="<" type="button" />\n </span>\n </div>\n <div class="tcv_cad_info tcv_round">\n <div class="tcv_box_content tcv_mac-scrollbar tcv_scroller">\n <div class="tcv_cad_info_container"></div>\n </div>\n </div>\n </div>\n </div>\n\n <div class="tcv_cad_view">\n <div class="tcv_cad_animation tcv_round">\n <span class="tcv_animation_label">E</span>\n <span><input type="range" min="0" max="1000" value="0"\n class="tcv_animation_slider tcv_clip_slider"></span>\n <span class="tcv_tooltip" data-tooltip="Play animation"><input class='tcv_play tcv_btn'\n type="button" /></span>\n <span class="tcv_tooltip" data-tooltip="Pause animation"><input class='tcv_pause tcv_btn'\n type="button" /></span>\n <span class="tcv_tooltip" data-tooltip="Stop and reset animation"><input class='tcv_stop tcv_btn'\n type="button" /></span>\n </div>\n\n <div class="tcv_cad_help tcv_round">\n <table class="tcv_cad_help_layout">\n <tr>\n <td></td>\n <td><b>Mouse Navigation</b></td>\n </tr>\n <tr>\n <td>Rotate</td>\n <td>&lt;left mouse button&gt;</td>\n </tr>\n <tr>\n <td>Rotate up / down</td>\n <td>&lt;Ctrl&gt; + &lt;left mouse button&gt;</td>\n </tr>\n <tr>\n <td>Rotate left / right</td>\n <td>&lt;Meta&gt; + &lt;left mouse button&gt;</td>\n </tr>\n <tr>\n <td>Pan</td>\n <td>&lt;Shift&gt; + &lt;left mouse button&gt; or &lt;right mouse button&gt;</td>\n </tr>\n <tr>\n <td>Zoom</td>\n <td>&lt;mouse wheel&gt; or &lt;middle mouse button&gt;</td>\n </tr>\n\n <tr>\n <td></td>\n <td><b>Mouse Selection</b></td>\n </tr>\n <tr>\n <td>Pick element</td>\n <td>&lt;left mouse button&gt; double click</td>\n </tr>\n <tr>\n <td></td>\n <td>Click on navigation tree label</td>\n </tr>\n <tr>\n <td></td>\n <td>(Shows axis-aligned bounding box, AABB)</td>\n </tr>\n <tr>\n <td>Hide element</td>\n <td>&lt;Meta&gt; + &lt;left mouse button&gt; double click</td>\n </tr>\n <tr>\n <td></td>\n <td>&lt;Meta&gt; + click on navigation tree label</td>\n </tr> <tr>\n <td>Isolate element</td>\n <td>&lt;Shift&gt; + &lt;left mouse button&gt; double click</td>\n </tr>\n <tr>\n <td></td>\n <td>&lt;Shift&gt; + click on navigation tree label</td>\n </tr>\n <tr>\n <td></td>\n <td><b>CAD Object Tree</b></td>\n </tr>\n <tr>\n <td>Collapse single leafs</td>\n <td>Button '1' (all nodes with one leaf only)</td>\n </tr>\n <tr>\n <td>Expand root only</td>\n <td>Button 'R'</td>\n </tr>\n <tr>\n <td>Collapse all nodes</td>\n <td>Button 'C'</td>\n </tr>\n <tr>\n <td>Expand all nodes</td>\n <td>Button 'E'</td>\n </tr>\n </table>\n </div>\n </div>\n </div>\n</div>\n`}(this.container.id);const i=e.cadWidth+(e.glass?0:e.treeWidth);this.handleMoreButton(i),this.cadBody=this._getElement("tcv_cad_body"),this.cadTool=this._getElement("tcv_cad_toolbar"),this.cadView=this._getElement("tcv_cad_view"),this.cadTree=this._getElement("tcv_cad_tree_container"),this.cadTreeToggles=this._getElement("tcv_cad_tree_toggles"),this.cadClip=this._getElement("tcv_cad_clip_container"),this.cadMaterial=this._getElement("tcv_cad_material_container"),this.tabTree=this._getElement("tcv_tab_tree"),this.tabClip=this._getElement("tcv_tab_clip"),this.tabMaterial=this._getElement("tcv_tab_material"),this.cadInfo=this._getElement("tcv_cad_info_container"),this.cadAnim=this._getElement("tcv_cad_animation"),this.cadHelp=this._getElement("tcv_cad_help"),this.planeLabels=[];for(var n=1;n<4;n++)this.planeLabels.push(this._getElement(`tcv_lbl_norm_plane${n}`));var s;for(var r of(this.viewer=null,this.glass=e.glass,this.tools=e.tools,this.cadWidth=e.cadWidth,this.height=e.height,this.treeWidth=e.treeWidth,this._events=[],this.setSizes(e),this.activeTab="tree",this.cadTree.style.display="block",this.cadClip.style.display="none",this.cadMaterial.style.display="none",this.clipSliders=null,this.lastPlaneState=!1,"dark"===e.theme||"browser"==e.theme&&window.matchMedia("(prefers-color-scheme: dark)").matches?(document.documentElement.setAttribute("data-theme","dark"),s="dark"):(document.documentElement.setAttribute("data-theme","light"),s="light"),kd)){var a=this.container.getElementsByClassName(`tcv_${r}`);for(n=0;n<a.length;n++){a[n].setAttribute("style",`background-image: ${Td(s,r)}`)}}this.showPinning(e.pinning)}_setupCheckEvent(t,e,i){const n=this._getElement(t);n.addEventListener("change",e),null!=i&&(n.checked=i),this._events.push(["change",t,e])}_setupClickEvent(t,e,i){this._getElement(t).addEventListener("click",e),this._events.push(["click",t,e])}_getElement(t){return this.container.getElementsByClassName(t)[0]}dispose(){var t,e,i;for(var n of this._events){[t,e,i]=n;this._getElement(e).removeEventListener(t,i)}this.cadTree.innerHTML="",this.cadView.removeChild(this.cadView.children[2]),this.container.innerHTML=""}handleMoreButton(t){const e=this._getElement("tcv_more-btn"),i=this._getElement("tcv_more-wrapper");t<970?(e.classList.remove("tcv_none"),i.classList.add("tcv_dropdown-content"),i.classList.add("tcv_more-content")):(e.classList.add("tcv_none"),i.classList.remove("tcv_dropdown-content"),i.classList.remove("tcv_more-content"))}setSizes(t,e=2/3){if(t.cadWidth&&(this.cadWidth=t.cadWidth,this.cadView.style.width=Ld(t.cadWidth)),t.height&&(this.height=t.height,this.cadView.style.height=Ld(t.height)),t.treeWidth&&(this.treeWidth=t.treeWidth,this.cadTree.parentElement.parentElement.style.width=Ld(t.treeWidth),this.cadInfo.parentElement.parentElement.style.width=Ld(t.treeWidth)),!t.glass){const i=Math.round(t.height*e);this.cadTree.parentElement.parentElement.style.height=Ld(i),this.cadInfo.parentElement.parentElement.style.height=Ld(t.height-i-4)}t.tools&&!t.glass?(this.cadTool.style.width=Ld(t.treeWidth+t.cadWidth+4),this.cadBody.style.width=Ld(t.treeWidth+t.cadWidth+4)):(this.cadTool.style.width=Ld(t.cadWidth+2),this.cadBody.style.width=Ld(t.cadWidth+2)),this.cadBody.style.height=Ld(t.height+4)}setupUI(t){this.viewer=t,this._setupCheckEvent("tcv_axes",this.setAxes,t.axes),this._setupCheckEvent("tcv_grid",this.setGrid,t.grid),this._setupCheckEvent("tcv_grid-xy",this.setGrid,t.grid),this._setupCheckEvent("tcv_grid-xz",this.setGrid,t.grid),this._setupCheckEvent("tcv_grid-yz",this.setGrid,t.grid),this._setupCheckEvent("tcv_axes0",this.setAxes0,t.axes0),this._setupCheckEvent("tcv_ortho",this.setOrtho,t.ortho),this._setupCheckEvent("tcv_transparent",this.setTransparent,t.transparent),this._setupCheckEvent("tcv_black_edges",this.setBlackEdges,t.blackEdges),this._setupCheckEvent("tcv_explode",this.setExplode),this._setupClickEvent("tcv_reset",this.reset),this._setupClickEvent("tcv_resize",this.resize);["tcv_front","tcv_rear","tcv_top","tcv_bottom","tcv_left","tcv_right","tcv_iso"].forEach((t=>{this._setupClickEvent(t,this.setView)})),this._setupClickEvent("tcv_expand_root",this.handleCollapseNodes),this._setupClickEvent("tcv_collapse_singles",this.handleCollapseNodes),this._setupClickEvent("tcv_collapse_all",this.handleCollapseNodes),this._setupClickEvent("tcv_expand",this.handleCollapseNodes),this._setupClickEvent("tcv_toggle_info",this.toggleInfo),this._setupClickEvent("tcv_pin",this.pinAsPng),this._setupClickEvent("tcv_help",this.toggleHelp),this.help_shown=!0,this.info_shown=!this.glass;["tcv_tab_tree","tcv_tab_clip","tcv_tab_material"].forEach((t=>{this._setupClickEvent(t,this.selectTab)})),this.clipSliders=[];for(var e=1;e<4;e++)this.clipSliders.push(new Id(`plane${e}`,0,100,this));for(this.ambientlightSlider=new Id("ambientlight",0,100,this),this.directionallightSlider=new Id("pointlight",0,100,this),this.metalnessSlider=new Id("metalness",0,100,this),this.roughnessSlider=new Id("roughness",0,100,this),this._setupCheckEvent("tcv_clip_plane_helpers",this.setClipPlaneHelpers,!1),this._setupCheckEvent("tcv_clip_intersection",this.setClipIntersection,!1),e=1;e<4;e++)this._setupClickEvent(`tcv_btn_norm_plane${e}`,this.setClipNormalFromPosition,!1);this._setupClickEvent("tcv_play",this.controlAnimation,!1),this._setupClickEvent("tcv_pause",this.controlAnimation,!1),this._setupClickEvent("tcv_stop",this.controlAnimation,!1),this.animationSlider=this.container.getElementsByClassName("tcv_animation_slider")[0],this.animationSlider.value=0,this.animationSlider.addEventListener("input",this.animationChange),this.showAnimationControl(!1),this.showHelp(!1)}updateUI(t,e,i,n,s,r,a){this.checkElement("tcv_axes",t),this.checkElement("tcv_axes0",e),this.checkElement("tcv_ortho",i),this.checkElement("tcv_transparent",n),this.checkElement("tcv_black_edges",s),this.showTools(r),this.glassMode(a)}checkElement(t,e){this._getElement(t).checked=e}addCadView(t){this.cadView.appendChild(t)}clearCadTree(){this.cadTree.innerHTML=""}addCadTree(t){this.cadTree.appendChild(t)}setAxes=t=>{const e=!!t.target.checked;this.viewer.setAxes(e)};setAxesCheck=t=>{this.checkElement("tcv_axes",t)};setGrid=t=>{const e=t.target.className.split(" ")[0].slice(4);this.viewer.setGrid(e)};setGridCheck=t=>{this.checkElement("tcv_grid",t)};setAxes0=t=>{const e=!!t.target.checked;this.viewer.setAxes0(e)};setAxes0Check=t=>{this.checkElement("tcv_axes0",t)};setOrtho=t=>{const e=!!t.target.checked;this.viewer.switchCamera(e)};setOrthoCheck=t=>{this.checkElement("tcv_ortho",t)};setTransparent=t=>{const e=!!t.target.checked;this.viewer.setTransparent(e)};setTransparentCheck=t=>{this.checkElement("tcv_transparent",t)};setBlackEdges=t=>{const e=!!t.target.checked;this.viewer.setBlackEdges(e)};setBlackEdgesCheck=t=>{this.checkElement("tcv_black_edges",t)};setExplode=t=>{!!t.target.checked?(this.viewer.hasAnimation()&&this.viewer.backupAnimation(),this.viewer.explode()):this.viewer.hasAnimation()&&(this.controlAnimationByName("stop"),this.viewer.clearAnimation(),this.viewer.restoreAnimation())};setExplodeCheck=t=>{this.checkElement("tcv_explode",t)};showExplode=t=>{this._getElement("tcv_explode_widget").style.display=t?"inline-block":"none"};setClipPlaneHelpers=t=>{const e=!!t.target.checked;this.setClipPlaneHelpersCheck(e),this.viewer.setClipPlaneHelpers(e)};setClipPlaneHelpersCheck=t=>{this.checkElement("tcv_clip_plane_helpers",t),this.lastPlaneState=t};showTools=t=>{this.tools=t,this.viewer&&(this.viewer.tools=t);var e=this._getElement("tcv_cad_toolbar"),i=this._getElement("tcv_cad_navigation");for(var n of[i,e])t?(n.style.height="36px",n.style.display="block"):(n.style.height="0px",n.style.display="none")};setClipIntersection=t=>{const e=!!t.target.checked;this.viewer.setClipIntersection(e)};setClipIntersectionCheck=t=>{this._getElement("tcv_clip_intersection").checked=t};reset=()=>{this.viewer.reset(),this.clearHighlights()};resize=()=>{this.viewer.resize()};clearHighlights(){["tcv_front","tcv_rear","tcv_top","tcv_bottom","tcv_left","tcv_right","tcv_iso"].forEach((t=>{this._getElement(t).classList.remove("tcv_btn_highlight")}))}highlightButton(t){this.clearHighlights(),this._getElement(`tcv_${t}`).classList.add("tcv_btn_highlight"),this.viewer.keepHighlight=!0}setView=t=>{const e=t.target.className.split(" ")[0].slice(4);this.viewer.presetCamera(e),this.highlightButton(e)};showPinning(t){this._getElement("tcv_pin").style.display=t?"inline-block":"none"}pinAsPng=t=>{this.viewer.pinAsPng()};setNormalLabel=(t,e)=>{this.planeLabels[t].innerHTML=`N=(${e[0].toFixed(2)}, ${e[1].toFixed(2)}, ${e[2].toFixed(2)})`};setClipNormalFromPosition=t=>{const e=parseInt(t.target.classList[0].slice(-1));this.viewer.setClipNormalFromPosition(e-1)};selectTab=t=>{const e=t.target.className.split(" ")[0];this.selectTabByName(e.slice(8))};selectTabByName(t){if(["clip","tree","material"].includes(t)){if("tree"===t&&"tree"!==this.activeTab){this.cadTree.style.display="block",this.cadTreeToggles.style.display="block",this.cadClip.style.display="none",this.cadMaterial.style.display="none",this.viewer.nestedGroup.setBackVisible(!1),this.viewer.setLocalClipping(!1);var e=this.viewer.getClipPlaneHelpers();this.viewer.setClipPlaneHelpers(!1),this.lastPlaneState=e}else"clip"===t&&"clip"!==this.activeTab?(this.cadTree.style.display="none",this.cadTreeToggles.style.display="none",this.cadClip.style.display="block",this.cadMaterial.style.display="none",this.viewer.nestedGroup.setBackVisible(!0),this.viewer.setLocalClipping(!0),this.viewer.setClipPlaneHelpers(this.lastPlaneState)):"material"===t&&"material"!==this.activeTab&&(this.cadTree.style.display="none",this.cadTreeToggles.style.display="none",this.cadClip.style.display="none",this.cadMaterial.style.display="block",this.viewer.nestedGroup.setBackVisible(!1),this.viewer.setLocalClipping(!1),this.viewer.setClipPlaneHelpers(!1));this.activeTab=t,this.viewer.checkChanges({tab:t}),"tree"==t?(this.tabTree.classList.add("tcv_tab-selected"),this.tabTree.classList.remove("tcv_tab-unselected"),this.tabClip.classList.remove("tcv_tab-selected"),this.tabClip.classList.add("tcv_tab-unselected"),this.tabMaterial.classList.remove("tcv_tab-selected"),this.tabMaterial.classList.add("tcv_tab-unselected")):"clip"==t?(this.tabTree.classList.remove("tcv_tab-selected"),this.tabTree.classList.add("tcv_tab-unselected"),this.tabClip.classList.add("tcv_tab-selected"),this.tabClip.classList.remove("tcv_tab-unselected"),this.tabMaterial.classList.remove("tcv_tab-selected"),this.tabMaterial.classList.add("tcv_tab-unselected")):(this.tabTree.classList.add("tcv_tab-unselected"),this.tabTree.classList.remove("tcv_tab-selected"),this.tabClip.classList.add("tcv_tab-unselected"),this.tabClip.classList.remove("tcv_tab-selected"),this.tabMaterial.classList.add("tcv_tab-selected"),this.tabMaterial.classList.remove("tcv_tab-unselected"))}}handleCollapseNodes=t=>{this.collapseNodes(t.target.value)};collapseNodes(t){"1"===t?(this.viewer.treeview.expandNodes(),this.viewer.treeview.collapseNodes(1)):"R"===t?(this.viewer.treeview.expandNodes(),this.viewer.treeview.collapseNodes(3)):"C"===t?this.viewer.treeview.collapseNodes(2):"E"===t&&this.viewer.treeview.expandNodes()}setSliderLimits(t){for(var e=0;e<3;e++)this.clipSliders[e].setSlider(t)}refreshPlane(t,e){this.viewer.refreshPlane(t-1,parseFloat(e))}showAnimationControl=t=>{this.cadAnim.style.display=t?"block":"none"};controlAnimationByName(t){this.viewer.controlAnimation(t);var e=this.viewer.animation.getRelativeTime();this.animationSlider.value=1e3*e,"play"==t?this.viewer.bboxNeedsUpdate=!0:"stop"==t?(this.viewer.bboxNeedsUpdate=!1,null!=this.viewer.lastBbox&&(this.viewer.lastBbox.needsUpdate=!0)):this.viewer.bboxNeedsUpdate=!this.viewer.bboxNeedsUpdate}controlAnimation=t=>{const e=t.target.className.split(" ")[0].slice(4);this.controlAnimationByName(e)};animationChange=t=>{this.viewer.animation.setRelativeTime(t.target.valueAsNumber/1e3),null!=this.viewer.lastBbox&&(this.viewer.lastBbox.needsUpdate=!0)};setAnimationLabel(t){this._getElement("tcv_animation_label").innerHTML=t}resetAnimationSlider(){this.animationSlider.value=0}showHelp=t=>{this.cadHelp.style.display=t?"block":"none",this.help_shown=t};toggleHelp=()=>{this.showHelp(!this.help_shown)};showInfo=t=>{this.cadInfo.parentNode.parentNode.style.display=t?"block":"none",this._getElement("tcv_toggle_info").value=t?"▲ i":"▼ i",this.info_shown=t};toggleInfo=()=>{this.showInfo(!this.info_shown)};autoCollapse(){this.cadWidth<600&&this.glass&&(console.info("Small view, collapsing tree"),this.collapseNodes("C"))}glassMode(t){t?(this._getElement("tcv_cad_tree").classList.add("tcv_cad_tree_glass"),this._getElement("tcv_cad_tree").style.height=null,this._getElement("tcv_cad_tree").style["max-height"]=Ld(Math.round(2*this.height/3)-18),this._getElement("tcv_cad_info").classList.add("tcv_cad_info_glass"),this._getElement("tcv_cad_view").classList.add("tcv_cad_view_glass"),this._getElement("tcv_toggle_info_wrapper").style.display="block",this.showInfo(!1),this.glass=!0,this.autoCollapse()):(this._getElement("tcv_cad_tree").classList.remove("tcv_cad_tree_glass"),this._getElement("tcv_cad_tree").style["max-height"]=null,this._getElement("tcv_cad_tree").style.height=Ld(Math.round(2*this.height/3)),this._getElement("tcv_cad_info").classList.remove("tcv_cad_info_glass"),this._getElement("tcv_cad_view").classList.remove("tcv_cad_view_glass"),this._getElement("tcv_toggle_info_wrapper").style.display="none",this.showInfo(!0),this.glass=!1),this.viewer&&(this.viewer.glass=!1);const e={cadWidth:this.cadWidth,glass:this.glass,height:this.height,tools:this.tools,treeWidth:t?0:this.treeWidth};this.setSizes(e);const i=this.cadWidth+(this.glass?0:this.treeWidth);this.handleMoreButton(i)}}const Rd=new Me,Bd=new Ae;class Dd extends vh{constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";this.setIndex([0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5]),this.setAttribute("position",new tn([-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],3)),this.setAttribute("uv",new tn([-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],2))}applyMatrix4(t){const e=this.attributes.instanceStart,i=this.attributes.instanceEnd;return void 0!==e&&(e.applyMatrix4(t),i.applyMatrix4(t),e.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}setPositions(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const i=new Jh(e,6,1);return this.setAttribute("instanceStart",new Ba(i,3,0)),this.setAttribute("instanceEnd",new Ba(i,3,3)),this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(t){let e;t instanceof Float32Array?e=t:Array.isArray(t)&&(e=new Float32Array(t));const i=new Jh(e,6,1);return this.setAttribute("instanceColorStart",new Ba(i,3,0)),this.setAttribute("instanceColorEnd",new Ba(i,3,3)),this}fromWireframeGeometry(t){return this.setPositions(t.attributes.position.array),this}fromEdgesGeometry(t){return this.setPositions(t.attributes.position.array),this}fromMesh(t){return this.fromWireframeGeometry(new oc(t.geometry)),this}fromLineSegments(t){const e=t.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Me);const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;void 0!==t&&void 0!==e&&(this.boundingBox.setFromBufferAttribute(t),Rd.setFromBufferAttribute(e),this.boundingBox.union(Rd))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new He),null===this.boundingBox&&this.computeBoundingBox();const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;if(void 0!==t&&void 0!==e){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let n=0;for(let s=0,r=t.count;s<r;s++)Bd.fromBufferAttribute(t,s),n=Math.max(n,i.distanceToSquared(Bd)),Bd.fromBufferAttribute(e,s),n=Math.max(n,i.distanceToSquared(Bd));this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}applyMatrix(t){return console.warn("THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4()."),this.applyMatrix4(t)}}Kn.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Yt(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},$n.line={uniforms:Rn.merge([Kn.common,Kn.fog,Kn.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// get the offset direction as perpendicular to the view vector\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 offset;\n\t\t\t\tif ( position.y < 0.5 ) {\n\n\t\t\t\t\toffset = normalize( cross( start.xyz, worldDir ) );\n\n\t\t\t\t} else {\n\n\t\t\t\t\toffset = normalize( cross( end.xyz, worldDir ) );\n\n\t\t\t\t}\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\tfloat forwardOffset = dot( worldDir, vec3( 0.0, 0.0, 1.0 ) );\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// extend the line bounds to encompass endcaps\n\t\t\t\t\tstart.xyz += - worldDir * linewidth * 0.5;\n\t\t\t\t\tend.xyz += worldDir * linewidth * 0.5;\n\n\t\t\t\t\t// shift the position of the quad so it hugs the forward edge of the line\n\t\t\t\t\toffset.xy -= dir * forwardOffset;\n\t\t\t\t\toffset.z += 0.5;\n\n\t\t\t\t#endif\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\toffset.xy += dir * 2.0 * forwardOffset;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth * 0.5;\n\n\t\t\t\t// set the world position\n\t\t\t\tworldPos = ( position.y < 0.5 ) ? start : end;\n\t\t\t\tworldPos.xyz += offset;\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <encodings_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};class Ud extends Bn{constructor(t){super({type:"LineMaterial",uniforms:Rn.clone($n.line.uniforms),vertexShader:$n.line.vertexShader,fragmentShader:$n.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,Object.defineProperties(this,{color:{enumerable:!0,get:function(){return this.uniforms.diffuse.value},set:function(t){this.uniforms.diffuse.value=t}},worldUnits:{enumerable:!0,get:function(){return"WORLD_UNITS"in this.defines},set:function(t){!0===t?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}},linewidth:{enumerable:!0,get:function(){return this.uniforms.linewidth.value},set:function(t){this.uniforms.linewidth.value=t}},dashed:{enumerable:!0,get:function(){return Boolean("USE_DASH"in this.defines)},set(t){Boolean(t)!==Boolean("USE_DASH"in this.defines)&&(this.needsUpdate=!0),!0===t?this.defines.USE_DASH="":delete this.defines.USE_DASH}},dashScale:{enumerable:!0,get:function(){return this.uniforms.dashScale.value},set:function(t){this.uniforms.dashScale.value=t}},dashSize:{enumerable:!0,get:function(){return this.uniforms.dashSize.value},set:function(t){this.uniforms.dashSize.value=t}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},gapSize:{enumerable:!0,get:function(){return this.uniforms.gapSize.value},set:function(t){this.uniforms.gapSize.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},alphaToCoverage:{enumerable:!0,get:function(){return Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)},set:function(t){Boolean(t)!==Boolean("USE_ALPHA_TO_COVERAGE"in this.defines)&&(this.needsUpdate=!0),!0===t?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1)}}}),this.setValues(t)}}const Nd=new Ae,Od=new Ae,zd=new ge,Fd=new ge,Gd=new ge,Hd=new Ae,Vd=new Je,Wd=new rd,jd=new Ae,Qd=new Me,qd=new He,Zd=new ge;let Xd,Yd;function Jd(t,e,i){return Zd.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),Zd.multiplyScalar(1/Zd.w),Zd.x=Yd/i.width,Zd.y=Yd/i.height,Zd.applyMatrix4(t.projectionMatrixInverse),Zd.multiplyScalar(1/Zd.w),Math.abs(Math.max(Zd.x,Zd.y))}class Kd extends Cn{constructor(t=new Dd,e=new Ud({color:16777215*Math.random()})){super(t,e),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const t=this.geometry,e=t.attributes.instanceStart,i=t.attributes.instanceEnd,n=new Float32Array(2*e.count);for(let t=0,s=0,r=e.count;t<r;t++,s+=2)Nd.fromBufferAttribute(e,t),Od.fromBufferAttribute(i,t),n[s]=0===s?0:n[s-1],n[s+1]=n[s]+Nd.distanceTo(Od);const s=new Jh(n,2,1);return t.setAttribute("instanceDistanceStart",new Ba(s,1,0)),t.setAttribute("instanceDistanceEnd",new Ba(s,1,1)),this}raycast(t,e){const i=this.material.worldUnits,n=t.camera;null!==n||i||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=void 0!==t.params.Line2&&t.params.Line2.threshold||0;Xd=t.ray;const r=this.matrixWorld,a=this.geometry,o=this.material;let l,c;if(Yd=o.linewidth+s,null===a.boundingSphere&&a.computeBoundingSphere(),qd.copy(a.boundingSphere).applyMatrix4(r),i)l=.5*Yd;else{l=Jd(n,Math.max(n.near,qd.distanceToPoint(Xd.origin)),o.resolution)}if(qd.radius+=l,!1!==Xd.intersectsSphere(qd)){if(null===a.boundingBox&&a.computeBoundingBox(),Qd.copy(a.boundingBox).applyMatrix4(r),i)c=.5*Yd;else{c=Jd(n,Math.max(n.near,Qd.distanceToPoint(Xd.origin)),o.resolution)}Qd.expandByScalar(c),!1!==Xd.intersectsBox(Qd)&&(i?function(t,e){const i=t.matrixWorld,n=t.geometry,s=n.attributes.instanceStart,r=n.attributes.instanceEnd;for(let a=0,o=Math.min(n.instanceCount,s.count);a<o;a++){Wd.start.fromBufferAttribute(s,a),Wd.end.fromBufferAttribute(r,a),Wd.applyMatrix4(i);const n=new Ae,o=new Ae;Xd.distanceSqToSegment(Wd.start,Wd.end,o,n),o.distanceTo(n)<.5*Yd&&e.push({point:o,pointOnLine:n,distance:Xd.origin.distanceTo(o),object:t,face:null,faceIndex:a,uv:null,uv2:null})}}(this,e):function(t,e,i){const n=e.projectionMatrix,s=t.material.resolution,r=t.matrixWorld,a=t.geometry,o=a.attributes.instanceStart,l=a.attributes.instanceEnd,c=Math.min(a.instanceCount,o.count),h=-e.near;Xd.at(1,Gd),Gd.w=1,Gd.applyMatrix4(e.matrixWorldInverse),Gd.applyMatrix4(n),Gd.multiplyScalar(1/Gd.w),Gd.x*=s.x/2,Gd.y*=s.y/2,Gd.z=0,Hd.copy(Gd),Vd.multiplyMatrices(e.matrixWorldInverse,r);for(let e=0,a=c;e<a;e++){if(zd.fromBufferAttribute(o,e),Fd.fromBufferAttribute(l,e),zd.w=1,Fd.w=1,zd.applyMatrix4(Vd),Fd.applyMatrix4(Vd),zd.z>h&&Fd.z>h)continue;if(zd.z>h){const t=zd.z-Fd.z,e=(zd.z-h)/t;zd.lerp(Fd,e)}else if(Fd.z>h){const t=Fd.z-zd.z,e=(Fd.z-h)/t;Fd.lerp(zd,e)}zd.applyMatrix4(n),Fd.applyMatrix4(n),zd.multiplyScalar(1/zd.w),Fd.multiplyScalar(1/Fd.w),zd.x*=s.x/2,zd.y*=s.y/2,Fd.x*=s.x/2,Fd.y*=s.y/2,Wd.start.copy(zd),Wd.start.z=0,Wd.end.copy(Fd),Wd.end.z=0;const a=Wd.closestPointToPointParameter(Hd,!0);Wd.at(a,jd);const c=Xt.lerp(zd.z,Fd.z,a),d=c>=-1&&c<=1,u=Hd.distanceTo(jd)<.5*Yd;if(d&&u){Wd.start.fromBufferAttribute(o,e),Wd.end.fromBufferAttribute(l,e),Wd.start.applyMatrix4(r),Wd.end.applyMatrix4(r);const n=new Ae,s=new Ae;Xd.distanceSqToSegment(Wd.start,Wd.end,s,n),i.push({point:s,pointOnLine:n,distance:Xd.origin.distanceTo(s),object:t,face:null,faceIndex:e,uv:null,uv2:null})}}}(this,n,e))}}}class $d extends Dd{toJSON(){return vh.prototype.toJSON.call(this)}}const tu=new Ae,eu=new Ae,iu=new Jt;class nu extends Io{constructor(t,e=1,i=16711680){const n=new cn,s=t.geometry.attributes.normal.count,r=new tn(2*s*3,3);n.setAttribute("position",r),super(n,new wo({color:i,toneMapped:!1})),this.object=t,this.size=e,this.type="VertexNormalsHelper",this.matrixAutoUpdate=!1,this.update()}update(){this.object.updateMatrixWorld(!0),iu.getNormalMatrix(this.object.matrixWorld);const t=this.object.matrixWorld,e=this.geometry.attributes.position,i=this.object.geometry;if(i){const n=i.attributes.position,s=i.attributes.normal;let r=0;for(let i=0,a=n.count;i<a;i++)tu.fromBufferAttribute(n,i).applyMatrix4(t),eu.fromBufferAttribute(s,i),eu.applyMatrix3(iu).normalize().multiplyScalar(this.size).add(tu),e.setXYZ(r,tu.x,tu.y,tu.z),r+=1,e.setXYZ(r,eu.x,eu.y,eu.z),r+=1}e.needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}class su extends Me{constructor(){super()}expandByObject(t,e=!1){if(t.updateWorldMatrix(!1,!1),"ObjectGroup"==t.constructor.name)return this.expandByObject(t.children[0],e),this;const i=t.geometry;if(void 0!==i)if(e&&null!=i.attributes&&void 0!==i.attributes.position)if(t.type.startsWith("LineSegment")){var n=i.clone();n.applyMatrix4(t.matrixWorld),n.boundingBox=null,n.computeBoundingBox(),ou.copy(n.boundingBox),this.union(ou)}else{const e=i.attributes.position;for(let i=0,n=e.count;i<n;i++)au.fromBufferAttribute(e,i).applyMatrix4(t.matrixWorld),this.expandByPoint(au)}else null===i.boundingBox&&i.computeBoundingBox(),ou.copy(i.boundingBox),ou.applyMatrix4(t.matrixWorld),this.union(ou);const s=t.children;for(let t=0,i=s.length;t<i;t++)this.expandByObject(s[t],e);return this}max_dist_from_center(){return Math.max(...this.min.toArray().concat(this.max.toArray()).map((t=>Math.abs(t))))}boundingSphere(){return this.getBoundingSphere(cu),cu}center(){return this.getCenter(au),au.toArray()}}class ru extends Io{constructor(t,e=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),s=new cn;s.setIndex(new Ji(i,1)),s.setAttribute("position",new Ji(n,3)),super(s,new wo({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(void 0!==this.object&&lu.setFromObject(this.object,!0),lu.isEmpty())return;const t=lu.min,e=lu.max,i=this.geometry.attributes.position,n=i.array;n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=t.x,n[4]=e.y,n[5]=e.z,n[6]=t.x,n[7]=t.y,n[8]=e.z,n[9]=e.x,n[10]=t.y,n[11]=e.z,n[12]=e.x,n[13]=e.y,n[14]=t.z,n[15]=t.x,n[16]=e.y,n[17]=t.z,n[18]=t.x,n[19]=t.y,n[20]=t.z,n[21]=e.x,n[22]=t.y,n[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}}const au=new Ae,ou=new su,lu=new su,cu=new He;var hu="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAAAXNSR0IArs4c6QAAAGJlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAABJKGAAcAAAASAAAAUKABAAMAAAABAAEAAKACAAQAAAABAAACAKADAAQAAAABAAACAAAAAABBU0NJSQAAAFNjcmVlbnNob3Q9HQL9AAAB1mlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczpleGlmPSJodHRwOi8vbnMuYWRvYmUuY29tL2V4aWYvMS4wLyI+CiAgICAgICAgIDxleGlmOlBpeGVsWURpbWVuc2lvbj41MTI8L2V4aWY6UGl4ZWxZRGltZW5zaW9uPgogICAgICAgICA8ZXhpZjpQaXhlbFhEaW1lbnNpb24+NTEyPC9leGlmOlBpeGVsWERpbWVuc2lvbj4KICAgICAgICAgPGV4aWY6VXNlckNvbW1lbnQ+U2NyZWVuc2hvdDwvZXhpZjpVc2VyQ29tbWVudD4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CpXxqwAAABW+SURBVHgB7dZBEQAgDANBwL/nwmDjtg6y6SN73i1HgAABAgQIpAROKq2wBAgQIECAwBcwADwCAQIECBAIChgAwdJFJkCAAAECBoAfIECAAAECQQEDIFi6yAQIECBAwADwAwQIECBAIChgAARLF5kAAQIECBgAfoAAAQIECAQFDIBg6SITIECAAAEDwA8QIECAAIGggAEQLF1kAgQIECBgAPgBAgQIECAQFDAAgqWLTIAAAQIEDAA/QIAAAQIEggIGQLB0kQkQIECAgAHgBwgQIECAQFDAAAiWLjIBAgQIEDAA/AABAgQIEAgKGADB0kUmQIAAAQIGgB8gQIAAAQJBAQMgWLrIBAgQIEDAAPADBAgQIEAgKGAABEsXmQABAgQIGAB+gAABAgQIBAUMgGDpIhMgQIAAAQPADxAgQIAAgaCAARAsXWQCBAgQIGAA+AECBAgQIBAUMACCpYtMgAABAgQMAD9AgAABAgSCAgZAsHSRCRAgQICAAeAHCBAgQIBAUMAACJYuMgECBAgQMAD8AAECBAgQCAoYAMHSRSZAgAABAgaAHyBAgAABAkEBAyBYusgECBAgQMAA8AMECBAgQCAoYAAESxeZAAECBAgYAH6AAAECBAgEBQyAYOkiEyBAgAABA8APECBAgACBoIABECxdZAIECBAgYAD4AQIECBAgEBQwAIKli0yAAAECBAwAP0CAAAECBIICBkCwdJEJECBAgIAB4AcIECBAgEBQwAAIli4yAQIECBAwAPwAAQIECBAIChgAwdJFJkCAAAECBoAfIECAAAECQQEDIFi6yAQIECBAwADwAwQIECBAIChgAARLF5kAAQIECBgAfoAAAQIECAQFDIBg6SITIECAAAEDwA8QIECAAIGggAEQLF1kAgQIECBgAPgBAgQIECAQFDAAgqWLTIAAAQIEDAA/QIAAAQIEggIGQLB0kQkQIECAgAHgBwgQIECAQFDAAAiWLjIBAgQIEDAA/AABAgQIEAgKGADB0kUmQIAAAQIGgB8gQIAAAQJBAQMgWLrIBAgQIEDAAPADBAgQIEAgKGAABEsXmQABAgQIGAB+gAABAgQIBAUMgGDpIhMgQIAAAQPADxAgQIAAgaCAARAsXWQCBAgQIGAA+AECBAgQIBAUMACCpYtMgAABAgQMAD9AgAABAgSCAgZAsHSRCRAgQICAAeAHCBAgQIBAUMAACJYuMgECBAgQMAD8AAECBAgQCAoYAMHSRSZAgAABAgaAHyBAgAABAkEBAyBYusgECBAgQMAA8AMECBAgQCAoYAAESxeZAAECBAgYAH6AAAECBAgEBQyAYOkiEyBAgAABA8APECBAgACBoIABECxdZAIECBAgYAD4AQIECBAgEBQwAIKli0yAAAECBAwAP0CAAAECBIICBkCwdJEJECBAgIAB4AcIECBAgEBQwAAIli4yAQIECBAwAPwAAQIECBAIChgAwdJFJkCAAAECBoAfIECAAAECQQEDIFi6yAQIECBAwADwAwQIECBAIChgAARLF5kAAQIECBgAfoAAAQIECAQFDIBg6SITIECAAAEDwA8QIECAAIGggAEQLF1kAgQIECBgAPgBAgQIECAQFDAAgqWLTIAAAQIEDAA/QIAAAQIEggIGQLB0kQkQIECAgAHgBwgQIECAQFDAAAiWLjIBAgQIEDAA/AABAgQIEAgKGADB0kUmQIAAAQIGgB8gQIAAAQJBAQMgWLrIBAgQIEDAAPADBAgQIEAgKGAABEsXmQABAgQIGAB+gAABAgQIBAUMgGDpIhMgQIAAAQPADxAgQIAAgaCAARAsXWQCBAgQIGAA+AECBAgQIBAUMACCpYtMgAABAgQMAD9AgAABAgSCAgZAsHSRCRAgQICAAeAHCBAgQIBAUMAACJYuMgECBAgQMAD8AAECBAgQCAoYAMHSRSZAgAABAgaAHyBAgAABAkEBAyBYusgECBAgQMAA8AMECBAgQCAoYAAESxeZAAECBAgYAH6AAAECBAgEBQyAYOkiEyBAgAABA8APECBAgACBoIABECxdZAIECBAgYAD4AQIECBAgEBQwAIKli0yAAAECBAwAP0CAAAECBIICBkCwdJEJECBAgIAB4AcIECBAgEBQwAAIli4yAQIECBAwAPwAAQIECBAIChgAwdJFJkCAAAECBoAfIECAAAECQQEDIFi6yAQIECBAwADwAwQIECBAIChgAARLF5kAAQIECBgAfoAAAQIECAQFDIBg6SITIECAAAEDwA8QIECAAIGggAEQLF1kAgQIECBgAPgBAgQIECAQFDAAgqWLTIAAAQIEDAA/QIAAAQIEggIGQLB0kQkQIECAgAHgBwgQIECAQFDAAAiWLjIBAgQIEDAA/AABAgQIEAgKGADB0kUmQIAAAQIGgB8gQIAAAQJBAQMgWLrIBAgQIEDAAPADBAgQIEAgKGAABEsXmQABAgQIGAB+gAABAgQIBAUMgGDpIhMgQIAAAQPADxAgQIAAgaCAARAsXWQCBAgQIGAA+AECBAgQIBAUMACCpYtMgAABAgQMAD9AgAABAgSCAgZAsHSRCRAgQICAAeAHCBAgQIBAUMAACJYuMgECBAgQMAD8AAECBAgQCAoYAMHSRSZAgAABAgaAHyBAgAABAkEBAyBYusgECBAgQMAA8AMECBAgQCAoYAAESxeZAAECBAgYAH6AAAECBAgEBQyAYOkiEyBAgAABA8APECBAgACBoIABECxdZAIECBAgYAD4AQIECBAgEBQwAIKli0yAAAECBAwAP0CAAAECBIICBkCwdJEJECBAgIAB4AcIECBAgEBQwAAIli4yAQIECBAwAPwAAQIECBAIChgAwdJFJkCAAAECBoAfIECAAAECQQEDIFi6yAQIECBAwADwAwQIECBAIChgAARLF5kAAQIECBgAfoAAAQIECAQFDIBg6SITIECAAAEDwA8QIECAAIGggAEQLF1kAgQIECBgAPgBAgQIECAQFDAAgqWLTIAAAQIEDAA/QIAAAQIEggIGQLB0kQkQIECAgAHgBwgQIECAQFDAAAiWLjIBAgQIEDAA/AABAgQIEAgKGADB0kUmQIAAAQIGgB8gQIAAAQJBAQMgWLrIBAgQIEDAAPADBAgQIEAgKGAABEsXmQABAgQIGAB+gAABAgQIBAUMgGDpIhMgQIAAAQPADxAgQIAAgaCAARAsXWQCBAgQIGAA+AECBAgQIBAUMACCpYtMgAABAgQMAD9AgAABAgSCAgZAsHSRCRAgQICAAeAHCBAgQIBAUMAACJYuMgECBAgQMAD8AAECBAgQCAoYAMHSRSZAgAABAgaAHyBAgAABAkEBAyBYusgECBAgQMAA8AMECBAgQCAoYAAESxeZAAECBAgYAH6AAAECBAgEBQyAYOkiEyBAgAABA8APECBAgACBoIABECxdZAIECBAgYAD4AQIECBAgEBQwAIKli0yAAAECBAwAP0CAAAECBIICBkCwdJEJECBAgIAB4AcIECBAgEBQwAAIli4yAQIECBAwAPwAAQIECBAIChgAwdJFJkCAAAECBoAfIECAAAECQQEDIFi6yAQIECBAwADwAwQIECBAIChgAARLF5kAAQIECBgAfoAAAQIECAQFDIBg6SITIECAAAEDwA8QIECAAIGggAEQLF1kAgQIECBgAPgBAgQIECAQFDAAgqWLTIAAAQIEDAA/QIAAAQIEggIGQLB0kQkQIECAgAHgBwgQIECAQFDAAAiWLjIBAgQIEDAA/AABAgQIEAgKGADB0kUmQIAAAQIGgB8gQIAAAQJBAQMgWLrIBAgQIEDAAPADBAgQIEAgKGAABEsXmQABAgQIGAB+gAABAgQIBAUMgGDpIhMgQIAAAQPADxAgQIAAgaCAARAsXWQCBAgQIGAA+AECBAgQIBAUMACCpYtMgAABAgQMAD9AgAABAgSCAgZAsHSRCRAgQICAAeAHCBAgQIBAUMAACJYuMgECBAgQMAD8AAECBAgQCAoYAMHSRSZAgAABAgaAHyBAgAABAkEBAyBYusgECBAgQMAA8AMECBAgQCAoYAAESxeZAAECBAgYAH6AAAECBAgEBQyAYOkiEyBAgAABA8APECBAgACBoIABECxdZAIECBAgYAD4AQIECBAgEBQwAIKli0yAAAECBAwAP0CAAAECBIICBkCwdJEJECBAgIAB4AcIECBAgEBQwAAIli4yAQIECBAwAPwAAQIECBAIChgAwdJFJkCAAAECBoAfIECAAAECQQEDIFi6yAQIECBAwADwAwQIECBAIChgAARLF5kAAQIECBgAfoAAAQIECAQFDIBg6SITIECAAAEDwA8QIECAAIGggAEQLF1kAgQIECBgAPgBAgQIECAQFDAAgqWLTIAAAQIEDAA/QIAAAQIEggIGQLB0kQkQIECAgAHgBwgQIECAQFDAAAiWLjIBAgQIEDAA/AABAgQIEAgKGADB0kUmQIAAAQIGgB8gQIAAAQJBAQMgWLrIBAgQIEDAAPADBAgQIEAgKGAABEsXmQABAgQIGAB+gAABAgQIBAUMgGDpIhMgQIAAAQPADxAgQIAAgaCAARAsXWQCBAgQIGAA+AECBAgQIBAUMACCpYtMgAABAgQMAD9AgAABAgSCAgZAsHSRCRAgQICAAeAHCBAgQIBAUMAACJYuMgECBAgQMAD8AAECBAgQCAoYAMHSRSZAgAABAgaAHyBAgAABAkEBAyBYusgECBAgQMAA8AMECBAgQCAoYAAESxeZAAECBAgYAH6AAAECBAgEBQyAYOkiEyBAgAABA8APECBAgACBoIABECxdZAIECBAgYAD4AQIECBAgEBQwAIKli0yAAAECBAwAP0CAAAECBIICBkCwdJEJECBAgIAB4AcIECBAgEBQwAAIli4yAQIECBAwAPwAAQIECBAIChgAwdJFJkCAAAECBoAfIECAAAECQQEDIFi6yAQIECBAwADwAwQIECBAIChgAARLF5kAAQIECBgAfoAAAQIECAQFDIBg6SITIECAAAEDwA8QIECAAIGggAEQLF1kAgQIECBgAPgBAgQIECAQFDAAgqWLTIAAAQIEDAA/QIAAAQIEggIGQLB0kQkQIECAgAHgBwgQIECAQFDAAAiWLjIBAgQIEDAA/AABAgQIEAgKGADB0kUmQIAAAQIGgB8gQIAAAQJBAQMgWLrIBAgQIEDAAPADBAgQIEAgKGAABEsXmQABAgQIGAB+gAABAgQIBAUMgGDpIhMgQIAAAQPADxAgQIAAgaCAARAsXWQCBAgQIGAA+AECBAgQIBAUMACCpYtMgAABAgQMAD9AgAABAgSCAgZAsHSRCRAgQICAAeAHCBAgQIBAUMAACJYuMgECBAgQMAD8AAECBAgQCAoYAMHSRSZAgAABAgaAHyBAgAABAkEBAyBYusgECBAgQMAA8AMECBAgQCAoYAAESxeZAAECBAgYAH6AAAECBAgEBQyAYOkiEyBAgAABA8APECBAgACBoIABECxdZAIECBAgYAD4AQIECBAgEBQwAIKli0yAAAECBAwAP0CAAAECBIICBkCwdJEJECBAgIAB4AcIECBAgEBQwAAIli4yAQIECBAwAPwAAQIECBAIChgAwdJFJkCAAAECBoAfIECAAAECQQEDIFi6yAQIECBAwADwAwQIECBAIChgAARLF5kAAQIECBgAfoAAAQIECAQFDIBg6SITIECAAAEDwA8QIECAAIGggAEQLF1kAgQIECBgAPgBAgQIECAQFDAAgqWLTIAAAQIEDAA/QIAAAQIEggIGQLB0kQkQIECAgAHgBwgQIECAQFDAAAiWLjIBAgQIEDAA/AABAgQIEAgKGADB0kUmQIAAAQIGgB8gQIAAAQJBAQMgWLrIBAgQIEDAAPADBAgQIEAgKGAABEsXmQABAgQIGAB+gAABAgQIBAUMgGDpIhMgQIAAAQPADxAgQIAAgaCAARAsXWQCBAgQIGAA+AECBAgQIBAUMACCpYtMgAABAgQMAD9AgAABAgSCAgZAsHSRCRAgQICAAeAHCBAgQIBAUMAACJYuMgECBAgQMAD8AAECBAgQCAoYAMHSRSZAgAABAgaAHyBAgAABAkEBAyBYusgECBAgQMAA8AMECBAgQCAoYAAESxeZAAECBAgYAH6AAAECBAgEBQyAYOkiEyBAgAABA8APECBAgACBoIABECxdZAIECBAgYAD4AQIECBAgEBQwAIKli0yAAAECBAwAP0CAAAECBIICBkCwdJEJECBAgIAB4AcIECBAgEBQwAAIli4yAQIECBAwAPwAAQIECBAIChgAwdJFJkCAAAECBoAfIECAAAECQQEDIFi6yAQIECBAwADwAwQIECBAIChgAARLF5kAAQIECBgAfoAAAQIECAQFDIBg6SITIECAAAEDwA8QIECAAIGggAEQLF1kAgQIECBgAPgBAgQIECAQFDAAgqWLTIAAAQIEDAA/QIAAAQIEggIGQLB0kQkQIECAgAHgBwgQIECAQFDAAAiWLjIBAgQIEDAA/AABAgQIEAgKGADB0kUmQIAAAQIGgB8gQIAAAQJBAQMgWLrIBAgQIEDAAPADBAgQIEAgKGAABEsXmQABAgQIGAB+gAABAgQIBAUMgGDpIhMgQIAAAQPADxAgQIAAgaCAARAsXWQCBAgQIGAA+AECBAgQIBAUMACCpYtMgAABAgQMAD9AgAABAgSCAgZAsHSRCRAgQICAAeAHCBAgQIBAUMAACJYuMgECBAgQMAD8AAECBAgQCAoYAMHSRSZAgAABAgaAHyBAgAABAkEBAyBYusgECBAgQMAA8AMECBAgQCAoYAAESxeZAAECBAgYAH6AAAECBAgEBQyAYOkiEyBAgAABA8APECBAgACBoIABECxdZAIECBAgYAD4AQIECBAgEBQwAIKli0yAAAECBAwAP0CAAAECBIICBkCwdJEJECBAgIAB4AcIECBAgEBQwAAIli4yAQIECBAwAPwAAQIECBAIChgAwdJFJkCAAAECBoAfIECAAAECQQEDIFi6yAQIECBAwADwAwQIECBAIChgAARLF5kAAQIECBgAfoAAAQIECAQFDIBg6SITIECAAAEDwA8QIECAAIGggAEQLF1kAgQIECBgAPgBAgQIECAQFDAAgqWLTIAAAQIEDAA/QIAAAQIEggIGQLB0kQkQIECAgAHgBwgQIECAQFDAAAiWLjIBAgQIEDAA/AABAgQIEAgKGADB0kUmQIAAAQIGgB8gQIAAAQJBAQMgWLrIBAgQIEDAAPADBAgQIEAgKGAABEsXmQABAgQIGAB+gAABAgQIBAUMgGDpIhMgQIAAAQPADxAgQIAAgaCAARAsXWQCBAgQIGAA+AECBAgQIBAUMACCpYtMgAABAgQMAD9AgAABAgSCAgZAsHSRCRAgQIDABY45B/xGDmh0AAAAAElFTkSuQmCC";const du=(new Xc).load([hu,hu,hu,hu,hu,hu]);du.needsUpdate=!0;class uu extends ya{constructor(t,e,i,n){super(),this.opacity=t,this.alpha=null==e?1:e,this.edge_color=i,this.renderback=n,this.types={front:null,back:null,edges:null,vertrices:null}}addType(t,e){this.add(t),this.types[e]=t}setMetalness(t){for(var e of this.children)e.material.metalness=t,e.material.needsUpdate=!0}setRoughness(t){for(var e of this.children)e.material.roughness=t,e.material.needsUpdate=!0}setTransparent(t){for(var e of(this.types.back&&(this.types.back.material.opacity=t?this.opacity*this.alpha:this.alpha,this.types.front.material.opacity=t?this.opacity*this.alpha:this.alpha),this.children))e.material.depthWrite=!(this.alpha<1)&&!t,e.material.depthTest=!0,e.material.needsUpdate=!0}setBlackEdges(t){if(this.types.edges){const e=t?0:this.edge_color;this.types.edges.material.color=new Gi(e),this.types.edges.material.needsUpdate=!0}}setEdgeColor(t){this.types.edges&&(this.edge_color=t,this.types.edges.material.color=new Gi(t),this.types.edges.material.needsUpdate=!0)}setOpacity(t){(this.types.front||this.types.back)&&(this.opacity=t,this.types.back.material.opacity=this.opacity,this.types.front.material.opacity=this.opacity,this.types.back.material.needsUpdate=!0,this.types.front.material.needsUpdate=!0)}setShapeVisible(t){this.types.front.material.visible=t,this.types.back&&this.renderback&&(this.types.back.material.visible=t)}setEdgesVisible(t){this.types.edges&&(this.types.edges.material.visible=t),this.types.vertices&&(this.types.vertices.material.visible=t)}setBackVisible(t){this.types.back&&this.types.front.material.visible&&(this.types.back.material.visible=this.renderback||t)}setClipIntersection(t){for(var e of this.children)e.material.clipIntersection=t,e.material.clipIntersection=t,e.material.clipIntersection=t}setClipPlanes(t){this.types.back&&(this.types.back.material.clippingPlanes=t),this.types.front&&(this.types.front.material.clippingPlanes=t),this.types.edges&&(this.types.edges.material.clippingPlanes=t),this.types.vertices&&(this.types.vertices.material.clippingPlanes=t),this.updateMaterials(!0)}setPolygonOffset(t){this.types.back&&(this.types.back.material.polygonOffsetUnits=t)}updateMaterials(t){this.types.back&&(this.types.back.material.needsUpdate=t),this.types.front&&(this.types.front.material.needsUpdate=t),this.types.edges&&(this.types.edges.material.needsUpdate=t),this.types.vertices&&(this.types.vertices.material.needsUpdate=t)}}class pu{constructor(t,e,i,n,s,r,a,o,l,c){this.shapes=t,this.width=e,this.height=i,this.edgeColor=n,this.transparent=s,this.metalness=a,this.roughness=o,this.defaultOpacity=r,this.normalLen=l,this.blackEdges=!1,this.backVisible=!1,this.bb_max=c,this.delim="|",this.rootGroup=null,this.bbox=null,this.bsphere=null,this.groups={},this.clipPlanes=null}_dump(t){if(null==t&&(t=""),this.parts)for(var e of this.parts)this._dump(e,t+" ")}_renderEdges(t,e,i,n){var s=t instanceof Float32Array?t:new Float32Array(t.flat(2));const r=new $d;r.setPositions(s);const a=new Ud({linewidth:e,transparent:!0,depthWrite:!this.transparent,depthTest:!this.transparent,clipIntersection:!1});if(Array.isArray(i)){var o=i.map((t=>[new Gi(t).toArray(),new Gi(t).toArray()])).flat(2);r.setColors(o),a.vertexColors="VertexColors"}else a.color=new Gi(null==i?this.edgeColor:i);a.visible=1==n,a.resolution.set(this.width,this.height);var l=new Kd(r,a);return l.renderOrder=999,l}renderEdges(t,e,i,n,s,r){var a=new uu(this.defaultOpacity,1,null==i?this.edgeColor:i),o=this._renderEdges(t,e,i,r);return s&&(o.name=s),a.addType(o,"edges"),n=n+this.delim+s,this.groups[n.replaceAll(this.delim,"/")]=a,a.name=n,a}renderVertices(t,e,i,n,s,r){var a=new uu(this.defaultOpacity,1,null==i?this.edgeColor:i);const o=null==i?this.edgeColor:i,l=t instanceof Float32Array?t:new Float32Array(t.flat()),c=new cn;c.setAttribute("position",new tn(l,3));const h=new Ro({color:o,sizeAttenuation:!1,size:e,transparent:!0,clipIntersection:!1,visible:1==r});var d=new Oo(c,h);return s&&(d.name=s),a.addType(d,"vertices"),n=n+this.delim+s,this.groups[n.replaceAll(this.delim,"/")]=a,a.name=n,a}renderShape(t,e,i,n,s,r,l){const c=t.vertices instanceof Float32Array?t.vertices:new Float32Array(t.vertices.flat()),h=t.normals instanceof Float32Array?t.normals:new Float32Array(t.normals.flat()),d=t.triangles instanceof Uint32Array?t.triangles:new Uint32Array(t.triangles.flat());var u=new uu(this.defaultOpacity,i,this.edgeColor,n);s=s+this.delim+r,this.groups[s.replaceAll(this.delim,"/")]=u,u.name=s,null==i?i=1:i<1&&(this.transparent=!0);var p=new cn;p.setAttribute("position",new Ji(c,3)),p.setAttribute("normal",new Ji(h,3)),p.setIndex(new Ji(d,1));const m=new uc({color:e,metalness:this.metalness,roughness:this.roughness,envMap:du,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,transparent:!0,opacity:this.transparent?this.defaultOpacity*i:i,depthWrite:!this.transparent,depthTest:!0,clipIntersection:!1,side:a,visible:1==l[0]}),f=new Vi({color:new Gi(this.edgeColor),side:o,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,transparent:!0,opacity:this.transparent?this.defaultOpacity*i:i,depthWrite:!this.transparent,depthTest:!0,clipIntersection:!1,visible:1==l[0]&&(n||this.backVisible)}),g=new Cn(p,m);g.name=r;const v=new Cn(p,f);if(v.name=r,i<1&&(v.renderOrder=999,g.renderOrder=999),u.addType(v,"back"),u.addType(g,"front"),this.normalLen>0){const t=new nu(g,this.normalLen,16711935);u.add(t)}const _=t.edges;if(_.length>0){var y=this._renderEdges(_,1,null,l[1]);y.name=r,u.addType(y,"edges")}return u}renderLoop(t,e,i){const n=t=>{var n;switch(t.type){case"edges":n=this.renderEdges(t.shape,t.width,t.color,e,t.name,i[t.id][1]);break;case"vertices":n=this.renderVertices(t.shape,t.size,t.color,e,t.name,i[t.id][1]);break;default:n=this.renderShape(t.shape,t.color,t.alpha,null!=t.renderback&&t.renderback,e,t.name,i[t.id])}return null!=t.loc&&(n.position.set(...t.loc[0]),n.quaternion.set(...t.loc[1])),n};var s=new ya;for(var r of(null==t.loc&&(t.loc=[[0,0,0],[0,0,0,1]]),s.position.set(...t.loc[0]),s.quaternion.set(...t.loc[1]),e=e+this.delim+t.name,this.groups[e.replaceAll(this.delim,"/")]=s,s.name=e,t.parts))if(r.parts)s.add(this.renderLoop(r,e,i));else{const t=n(r);this.groups[r.id]=t,s.add(t)}return s}render(t){return this.rootGroup=this.renderLoop(this.shapes,"",t),this.rootGroup}boundingBox(){return null==this.bbox&&(this.bbox=new su,this.bbox.setFromObject(this.rootGroup,!0)),this.bbox}_traverse(t,e){for(var i in this.groups)for(var n of this.groups[i].children)n instanceof uu&&n[t](e)}setMetalness(t){this.metalness=t,this._traverse("setMetalness",t)}setRoughness(t){this.roughness=t,this._traverse("setRoughness",t)}setTransparent(t){this.transparent=t,this._traverse("setTransparent",t)}setBlackEdges(t){this.blackEdges=t,this._traverse("setBlackEdges",t)}setBackVisible(t){this.backVisible=t,this._traverse("setBackVisible",t)}setEdgeColor(t){this.edge_color=t,this._traverse("setEdgeColor",t)}setOpacity(t){this.opacity=t,this._traverse("setOpacity",t)}setClipIntersection(t){this._traverse("setClipIntersection",t)}setClipPlanes(t){this.clipPlanes=t,this._traverse("setClipPlanes",t)}setPolygonOffset(t){this._traverse("setPolygonOffset",t)}updateMaterials(){this._traverse("updateMaterials",!0)}}class mu{constructor(t,e,i,n,s,r){void 0===i&&(i=10),this.display=t,this.bbox=e,this.grid=s,this.allGrid=s[0]|s[1]|s[2],this.gridHelper=[];var[a,o,l]=this.niceBounds(1.1*-e.max_dist_from_center(),1.1*e.max_dist_from_center(),2*i);this.size=o-a,this.ticks=l;for(var c=0;c<3;c++)this.gridHelper.push(new md(this.size,this.size/this.ticks,8947848,13421772));this.gridHelper[0].rotateX(Math.PI/2),this.gridHelper[1].rotateY(Math.PI/2),this.gridHelper[2].rotateZ(Math.PI/2),this.setCenter(n,r),this.setVisible()}niceNumber(t,e){var i=Math.floor(Math.log10(t)),n=t/10**i;return(e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10)*10**i}niceBounds(t,e,i){var n,s;i||(i=10);var r=e-t;return 0==r?n=0:(s=this.niceNumber(r),n=this.niceNumber(s/(i-1),!0),t=Math.floor(t/n)*n,e=Math.ceil(e/n)*n),[t,e,n]}computeGrid(){this.allGrid=this.grid[0]|this.grid[1]|this.grid[2],this.display.checkElement("tcv_grid",this.allGrid),this.display.checkElement("tcv_grid-xy",this.grid[0]),this.display.checkElement("tcv_grid-xz",this.grid[1]),this.display.checkElement("tcv_grid-yz",this.grid[2]),this.setVisible()}setGrid(t){switch(t){case"grid":this.allGrid=!this.allGrid,this.grid[0]=this.allGrid,this.grid[1]=this.allGrid,this.grid[2]=this.allGrid;break;case"grid-xy":this.grid[0]=!this.grid[0];break;case"grid-xz":this.grid[1]=!this.grid[1];break;case"grid-yz":this.grid[2]=!this.grid[2]}this.computeGrid()}setGrids(t,e,i){this.grid[0]=t,this.grid[1]=e,this.grid[2]=i,this.computeGrid()}setCenter(t,e){if(t){for(var i=0;i<3;i++)this.gridHelper[i].position.set(0,0,0);this.gridHelper[0].position.z=-this.size/2,this.gridHelper[1].position.y=(e?1:-1)*this.size/2,this.gridHelper[2].position.x=-this.size/2}else{const t=this.bbox.center();for(i=0;i<3;i++)this.gridHelper[i].position.set(...t);this.gridHelper[0].position.z=-this.size/2+t[2],this.gridHelper[1].position.y=(e?1:-1)*this.size/2+t[1],this.gridHelper[2].position.x=-this.size/2+t[0]}}setVisible(){for(var t=0;t<3;t++)this.gridHelper[t].visible=this.grid[t]}}class fu extends Kd{constructor(t,e,i,n,s,r,a,o){const l=new Float32Array([0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e]),c="dark"===o?[1,69/255,0,1,69/255,0,50/255,205/255,50/255,50/255,205/255,50/255,59/255,158/255,1,59/255,158/255,1]:[1,0,0,1,0,0,0,.7,0,0,.7,0,0,0,1,0,0,1],h=new $d;h.setPositions(l),h.setColors(new Float32Array(c));const d=new Ud({vertexColors:!0,toneMapped:!1,linewidth:i,transparent:!0});d.resolution.set(n,s),super(h,d),this.center=t,this.type="AxesHelper",this.visible=a,this.setCenter(r)}dispose(){this.geometry.dispose(),this.material.dispose()}setCenter(t){t?this.position.set(0,0,0):this.position.set(...this.center)}setVisible(t){this.visible=t}}function gu(t){if(Array.isArray(t))return t.map((t=>gu(t)));if("object"==typeof t){var e={};for(var[i,n]of Object.entries(t))e[i]=gu(n);return e}return t}function vu(t,e,i=1e-9){if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&t.every(((t,i)=>vu(t,e[i])));if("object"==typeof t&&"object"==typeof e){var n=Object.keys(t),s=Object.keys(e);return!(n.length!=s.length||!n.every((t=>Object.prototype.hasOwnProperty.call(e,t))))&&n.every((i=>vu(t[i],e[i])))}return Number(t)===t&&Number(e)===e?Math.abs(t-e)<i:t===e}function _u(t,e){t&&(e(t),t.children&&t.children.length>0&&t.children.forEach((t=>{_u(t,e)})))}class yu extends Wc{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new qc(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,(function(t){const i=s.parse(JSON.parse(t));e&&e(i)}),i,n)}parse(t){return new xu(t)}}class xu{constructor(t){this.isFont=!0,this.type="Font",this.data=t}generateShapes(t,e=100){const i=[],n=function(t,e,i){const n=Array.from(t),s=e/i.resolution,r=(i.boundingBox.yMax-i.boundingBox.yMin+i.underlineThickness)*s,a=[];let o=0,l=0;for(let t=0;t<n.length;t++){const e=n[t];if("\n"===e)o=0,l-=r;else{const t=Au(e,s,o,l,i);o+=t.offsetX,a.push(t.path)}}return a}(t,e,this.data);for(let t=0,e=n.length;t<e;t++)i.push(...n[t].toShapes());return i}}function Au(t,e,i,n,s){const r=s.glyphs[t]||s.glyphs["?"];if(!r)return void console.error('THREE.Font: character "'+t+'" does not exists in font family '+s.familyName+".");const a=new Sd;let o,l,c,h,d,u,p,m;if(r.o){const t=r._cachedOutline||(r._cachedOutline=r.o.split(" "));for(let s=0,r=t.length;s<r;){switch(t[s++]){case"m":o=t[s++]*e+i,l=t[s++]*e+n,a.moveTo(o,l);break;case"l":o=t[s++]*e+i,l=t[s++]*e+n,a.lineTo(o,l);break;case"q":c=t[s++]*e+i,h=t[s++]*e+n,d=t[s++]*e+i,u=t[s++]*e+n,a.quadraticCurveTo(d,u,c,h);break;case"b":c=t[s++]*e+i,h=t[s++]*e+n,d=t[s++]*e+i,u=t[s++]*e+n,p=t[s++]*e+i,m=t[s++]*e+n,a.bezierCurveTo(d,u,p,m,c,h)}}}return{offsetX:r.ha*e,path:a}}class wu{constructor(t,e,i,n){this.width=t,this.height=e,this.cad_camera=i,this.theme=n,this.camera=null,this.scene=null,this.renderer=null,this.labels=[],this.ready=!1}create(){(new yu).load("node_modules/three/examples/fonts/helvetiker_regular.typeface.json",(t=>{this._create(t)}))}_create(t){const e=2.5;this.scene=new Ia,this.camera=new os(-this.width,this.width,this.height,-this.height,1,1e3),this.camera.up=this.cad_camera.up,this.camera.lookAt(new Ae(0,0,0));const i=new fu([0,0,0],54,e,this.width,this.height,!0,!0,this.theme);this.scene.add(i);const n="dark"===this.theme?[[1,69/255,0],[50/255,205/255,50/255],[59/255,158/255,1]]:[[1,0,0],[0,.7,0],[0,0,1]];this.cones=[];for(var s=0;s<3;s++){var r=new ul(0,6.25,12.5,20,1);const t=new Vi({color:new Gi(...n[s]),toneMapped:!1}),e=new Cn(r,t);e.matrixAutoUpdate=!1,this.cones.push(e)}this.cones[0].geometry.rotateZ(-Math.PI/2),this.cones[0].geometry.translate(54,0,0),this.cones[1].geometry.translate(0,54,0),this.cones[2].geometry.rotateX(Math.PI/2),this.cones[2].geometry.translate(0,0,54),this.scene.add(...this.cones);const a=["X","Y","Z"];for(s=0;s<3;s++){const e=new wo({color:"dark"===this.theme?new Gi(.9,.9,.9):new Gi(0,0,0),side:2}),i=t.generateShapes(a[s],16),n=new ec(i);n.computeBoundingBox();const r=-.5*(n.boundingBox.max.x-n.boundingBox.min.x),o=-.5*(n.boundingBox.max.y-n.boundingBox.min.y);n.translate(r,o,0);const l=new Cn(n,e);this.scene.add(l),this.labels.push(l)}const o=new ic(7.5,20,20),l=new Vi({color:10526880}),c=new Cn(o,l);this.scene.add(c),this.scene.background=null,this.ready=!0}dispose(){_u(this.scene,(t=>{t.geometry?.dispose(),t.material?.dispose()})),this.scene=null,this.camera=null}render(t){this.ready&&(t.setViewport(0,0,this.width,this.height),t.render(this.scene,this.camera))}update(t,e,i){if(this.ready){this.camera.position.copy(t),this.camera.position.setLength(300),this.camera.rotation.copy(e);for(var n=0;n<3;n++)this.labels[n].position.set(0==n?72:0,1==n?72:0,2==n?72:0),this.labels[n].quaternion.copy(i)}}}function bu(t,e,i){var n=document.createElement(t);if(void 0!==e)for(var s in e)n.classList.add(e[s]);if(void 0!==i)for(var r in i)n[r]=i[r];return n}const Mu=0,Su=1,Eu=2,Cu=3;class Tu{constructor(t,e,i,n,s){this.states=t,this.tree=e,this.objectHandler=i,this.pickHandler=n,this.theme=s,this.lastSelection=null,this.setupIcons(s),this.treeModel=this.toModel(e)}setupIcons(t){var e={};e[Mu]=Td(t,"shape_no"),e[Su]=Td(t,"shape"),e[Eu]=Td(t,"shape_mix"),e[Cu]=Td(t,"shape_empty");var i={};i[Mu]=Td(t,"mesh_no"),i[Su]=Td(t,"mesh"),i[Eu]=Td(t,"mesh_mix"),i[Cu]=Td(t,"mesh_empty"),this.icons=[e,i]}toModel(t){var e={id:t.id,type:t.type,name:t.name,color:t.color,imgs:[],states:[]},i=0;if("node"===t.type){for(i in this.icons)e.states.push(Su);for(i in e.children=[],t.children)e.children.push(this.toModel(t.children[i]))}else if("leaf"===t.type){var n=this.states[t.id];for(i in this.icons)e.states.push(n[i])}else console.error(`Error, unknown type '${t.type}'`);return e}toHtml(t){var e,i=0,n=bu("li",[`node${t.id.replaceAll(" ","_")}`]),s=bu("span",["tcv_tree_label"]);s.innerHTML=t.name,s.id=t.id,s.addEventListener("mousedown",(e=>{e.preventDefault(),e.stopPropagation();const i=e.target.id.split("/"),n=i.slice(0,-1).join("/"),s=i[i.length-1];this.pickHandler(n,s,e.metaKey,e.shiftKey,t.type,!0)}),!1);var r=bu("span",["tcv_node_entry"],{id:t.id});if("node"===t.type){var a=bu("span",["tcv_node_entry_wrap"]);for(i in a.appendChild(bu("span",["tcv_t-caret","tcv_t-caret-down"])),this.icons)(e=bu("input",["tcv_icon"],{type:"button",style:`background-image: ${this.getIcon(i,1)}`})).setAttribute("icon_id",i),e.addEventListener("click",(e=>{this.handleClick(t.type,t.id,e.srcElement.getAttribute("icon_id"))})),r.appendChild(e),t.imgs.push(e);r.appendChild(s),a.appendChild(r),n.append(a);var o=bu("ul",["tcv_nested","tcv_active"]);for(var l in t.children)o.appendChild(this.toHtml(t.children[l]));n.appendChild(o)}else{for(i in this.icons)(e=bu("input",["tcv_icon"],{type:"button",style:`background-image: ${this.getIcon(i,t.states[i])}`})).setAttribute("icon_id",i),0==i&&e.classList.add("tcv_indent"),t.states[i]!=Cu&&e.addEventListener("click",(e=>{this.handleClick(t.type,t.id,e.srcElement.getAttribute("icon_id"))})),r.appendChild(e),t.imgs.push(e);r.appendChild(s),n.appendChild(r)}return n}_labelVisible(t){const e=this.container.parentElement.parentElement,i=e.getBoundingClientRect().height,n=e.scrollTop,s=t.offsetTop-134;return s-n<i-12&&s>n}_openToTop(t){for(var e=t.parentElement.parentElement.parentElement.parentElement;"LI"==e.tagName;)this.toggleTreeNode(e,!1),e=e.parentElement.parentElement}removeLabelHighlight(){this.lastSelection?.classList.remove("tcv_node_selected"),this.lastSelection=null}highlightLabel(t){const e=t!=this.lastSelection;this.removeLabelHighlight(),e&&(0==t.offsetTop&&this._openToTop(t),t.classList.add("tcv_node_selected"),this.lastSelection=t,this._labelVisible(t)||(null==t.scrollIntoViewIfNeeded?t.scrollIntoView({block:"nearest"}):t.scrollIntoViewIfNeeded()))}selectNode(t){const e=this.container.getElementsByClassName(`node${t.replaceAll(" ","_")}`)[0];if(null!=e){const t=e.getElementsByClassName("tcv_tree_label")[0];this.highlightLabel(t)}}toggleTreeNode(t,e){null==e?(t.querySelector(".tcv_nested").classList.toggle("tcv_active"),t.getElementsByClassName("tcv_t-caret")[0].classList.toggle("tcv_t-caret-down")):e?(t.querySelector(".tcv_nested").classList.remove("tcv_active"),t.getElementsByClassName("tcv_t-caret")[0].classList.remove("tcv_t-caret-down")):(t.querySelector(".tcv_nested").classList.add("tcv_active"),t.getElementsByClassName("tcv_t-caret")[0].classList.add("tcv_t-caret-down"))}render(t){this.container=bu("ul",["tcv_toplevel"]);var e=new MutationObserver((n=>{this.container.contains(i)&&(t>0&&t<4&&this.collapseNodes(t),e.disconnect())}));e.observe(this.container,{attributes:!1,childList:!0,characterData:!1,subtree:!1});const i=this.toHtml(this.treeModel);for(var n in this.container.appendChild(i),this.icons)this.updateNodes(this.treeModel,n);for(var s=this.container.getElementsByClassName("tcv_t-caret"),r=0;r<s.length;r++)s[r].addEventListener("click",(t=>{this.toggleTreeNode(t.target.parentElement.parentElement,null)}));return this.container}getNode(t,e){if(t.id==e)return t;for(var i in t.children){var n=this.getNode(t.children[i],e);if(null!=n)return n}return null}updateState(t,e,i){t.states[e]!=Cu&&(this.states[t.id][e]=i,t.states[e]=i,this.setIcon(t.imgs[e],e,i))}propagateChange(t,e,i){for(var n in t.children){var s=t.children[n];"leaf"==s.type?this.updateState(s,e,i):this.propagateChange(s,e,i)}}updateNodes(t,e){var i=0;if("node"===t.type){var n=[];for(var s in t.children)n.push(this.updateNodes(t.children[s],e));var r=n.filter((t=>3!=t));i=0==r.length?3:r.reduce(((t,e)=>t==e?t:Eu),r[0]),t.states[e]=i,this.setIcon(t.imgs[e],e,i)}else i=t.states[e];return i}_toggleNodes(t,e){var i=n=>{if("node"==n.type){if((1==t||3==t)&&(1===n.children.length||3==t)&&n!==this.tree&&"leaf"===n.children[0].type||2==t){var s=this.container.getElementsByClassName(`node${n.id.replaceAll(" ","_")}`)[0];null!=s&&this.toggleTreeNode(s,e)}for(var r of n.children)i(r)}};i(this.tree)}collapseNodes(t){this._toggleNodes(t,!0)}expandNodes(){this._toggleNodes(2,!1)}getIcon(t,e){return this.icons[t][e]}setIcon(t,e,i){t.style.backgroundImage=this.getIcon(e,i)}hideAll(){[0,1].forEach((t=>this.setState("node",this.treeModel.id,t,0)))}showAll(){[0,1].forEach((t=>this.setState("node",this.treeModel.id,t,1)))}setState(t,e,i,n){this.handleStateChange(t,e,i,n)}handleClick(t,e,i){this.handleStateChange(t,e,i,null)}handleStateChange(t,e,i,n){var s,r=this.getNode(this.treeModel,e);s=null==n?r.states[i]==Su?Mu:Su:n?Su:Mu,"leaf"==t?(this.updateState(r,i,s),this.updateNodes(this.treeModel,i),this.objectHandler(this.states)):"node"==t?(this.propagateChange(r,i,s),this.updateNodes(this.treeModel,i),this.objectHandler(this.states)):console.error(`Error, unknown type '${t}'`)}}class Lu{constructor(t,e){this.prefix=t,this.timeit=e,this.start=performance.now(),e&&console.info(`three-cad-viewer: Timer ${t}:start`)}split(t){if(this.timeit){const e=performance.now();console.info(`three-cad-viewer: Timer ${this.prefix}:${t} ${(e-this.start).toFixed(1)} ms`)}}stop(){if(this.timeit){const t=performance.now();console.info(`three-cad-viewer: Timer ${this.prefix}:stop ${(t-this.start).toFixed(1)} ms`)}}}class ku extends To{constructor(t,e,i,n=1,s=16776960){const r=s,a=new cn;a.setAttribute("position",new tn([-1,-1,1,-1,1,1,1,1,1,1,-1,1,-1,-1,1],3)),a.computeBoundingSphere(),super(a,new wo({color:r,toneMapped:!1})),this.type="PlaneHelper",this.index=t,this.plane=e,this.size=n,this.center=i;const o=new cn;o.setAttribute("position",new tn([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),o.computeBoundingSphere(),this.planeMesh=new Cn(o,new Vi({color:r,opacity:.05,transparent:!0,depthWrite:!1,toneMapped:!1})),this.add(this.planeMesh)}updateMatrixWorld(t){let e=-this.plane.constant;Math.abs(e)<1e-8&&(e=1e-8),this.scale.set(.5*this.size,.5*this.size,e),this.children[0].material.side=2,this.lookAt(this.plane.normal),super.updateMatrixWorld(t)}}class Iu{constructor(t,e,i,n,s){this.distance=i,this.uiCallback=n;const r=[new Ae(-1,0,0),new Ae(0,-1,0),new Ae(0,0,-1)];this.clipPlanes=[];for(var a=0;a<3;a++)this.clipPlanes.push(new Wn(r[a],i)),this.uiCallback(a,r[a].toArray());this.planeHelpers=new ya,this.planeHelpers.add(new ku(0,this.clipPlanes[0],t,e,"light"===s?16711680:16729344)),this.planeHelpers.add(new ku(1,this.clipPlanes[1],t,e,"light"===s?65280:3329330)),this.planeHelpers.add(new ku(2,this.clipPlanes[2],t,e,"light"===s?255:3907327)),this.planeHelpers.visible=!1}setConstant(t,e){this.clipPlanes[t].constant=e}setNormal=(t,e)=>{this.clipPlanes[t].normal=e,this.uiCallback(t,e.toArray())}}const Pu=["t","tx","ty","tz","q","rx","ry","rz"];class Ru{constructor(t){this.delim=t,this.tracks=[],this.mixer=null,this.clip=null,this.clipAction=null,this.clock=new Ch,this.duration=0,this._backup=[],this.root=null,this.duration=null,this.speed=null,this.repeat=null}addTrack(t,e,i,n,s){var r;if(t=t.replaceAll("/",this.delim),-1!==Pu.indexOf(i))if(n.length==s.length)if(i.startsWith("t")){const a=e.position;switch(i){case"t":r=s.map((t=>a.clone().add(new Ae(...t)).toArray()));break;case"tx":r=s.map((t=>a.add(new Ae(t,0,0)).toArray()));break;case"ty":r=s.map((t=>a.add(new Ae(0,t,0)).toArray()));break;case"tz":r=s.map((t=>a.add(new Ae(0,0,t)).toArray()));break;default:return void console.error(`action ${i} is not supported`)}this.tracks.push(new Oc(t+".position",n,r.flat()))}else{const a=e.quaternion;if(i.startsWith("r")){r=s.map((t=>function(t,e){switch(t){case"x":t=new Ae(1,0,0);break;case"y":t=new Ae(0,1,0);break;case"z":t=new Ae(0,0,1)}var i=new xe;return i.setFromAxisAngle(t,e/180*Math.PI),i}(i.slice(1),t))).map((t=>a.clone().multiply(t).toArray()))}else{if("q"!=i)return void console.error(`action ${i} is not supported`);r=s.map((t=>a.clone().multiply(t).toArray()))}this.tracks.push(new Uc(t+".quaternion",n,r.flat()))}else console.error("times and values arrays need have the same lenght");else console.error(`Unknown action: "${i}" not in ${Pu}`)}backup(){this._backup={tracks:this.tracks,root:this.root,duration:this.duration,speed:this.speed,repeat:this.repeat}}restore(){return this.tracks=this._backup.tracks,{duration:this._backup.duration,speed:this._backup.speed,repeat:this._backup.repeat}}cleanBackup(){this._backup=[]}hasTracks(){return null!=this.tracks&&this.tracks.length>0}hasBackup(){return null!=this._backup&&Object.keys(this._backup).length>0}animate(t,e,i,n=!0){return this.root=t,this.duration=e,this.speed=i,this.repeat=n,this.clip=new zc("track",e,this.tracks),this.mixer=new Zh(t),this.mixer.timeScale=i,this.clipAction=this.mixer.clipAction(this.clip),this.clipAction.setLoop(n?gt:vt),this.clipAction}setRelativeTime(t){this.clipAction.play(),this.clipAction.paused=!0;var e=this.duration*t;this.clipAction.time=e}getRelativeTime(){return this.clipAction.time/this.duration}dispose(){this.mixer=null,this.clipAction=null,this.clip=null,this.tracks=[],this.root=null}update(){this.mixer&&this.mixer.update(this.clock.getDelta())}}class Bu{constructor(t){this.html=t,this.clear()}clear(){this.html.value="",this.number=0,this.chunks=[]}dispose(){this.clear(),this.html.innerHTML=""}addText(t){this.addHtml(`<pre style="white-space: nowrap;">${t}</pre>`)}addHtml(t){this.chunks.unshift([this.number,t]),this.number+=1,this.render()}render(){var t="<table class='tcv_info_table'>";for(var e of this.chunks)t+="<tr class='tcv_info_row'>",t+=`<td><pre class="tcv_info_num">[${e[0]}]</pre></td>`,t+=`<td>${e[1]}</td>`,t+="</tr>";t+="</table>",this.html.innerHTML=t}versionMsg(t,e){this.addHtml(`<b>Versions</b>\n <table>\n <tr class="tcv_small_table"><td>CadQuery:</td> <td>${t}</td> </tr>\n <tr class="tcv_small_table"><td>Jupyter CadQuery:</td><td>${e}</td> </tr>\n </table>`)}readyMsg(t,e){var i=`<div class="tcv_info_header">Ready</div>\n <table class="small_table">\n <tr class="tcv_small_table_row" ><td>Tick size</td> <td>${t} mm</td> </tr>\n <tr class="tcv_small_table_row" ><td>Control</td><td>${e}</td></tr>\n <tr class="tcv_small_table_row" ><td>Axes</td>\n <td>\n <span class="tcv_info_red"><b>X</b></span>,\n <span class="tcv_info_green"><b>Y</b></span>,\n <span class="tcv_info_blue"><b>Z</b></span>\n </td> \n </tr>\n </table>`;this.addHtml(i)}bbInfo(t,e,i){var n=`\n <table class="tcv_small_table">\n <tr class="tcv_small_table_row">\n <td><b>Path:</b></td>\n <td>${t}</td>\n </tr>\n <tr class="tcv_small_table_row">\n <td><b>Name:</b></td>\n <td>${e}</td>\n </tr>\n </table>\n `;n+='\n <div class="tcv_info_header">Bounding box:</div>\n <table class="tcv_small_table">\n <tr class="tcv_small_table_row">\n <th></th>\n <th>min</th>\n <th>max</th>\n <th>center</th>\n </tr>\n ';var s=new Ae;i.getCenter(s),["x","y","z"].forEach((t=>{n+=`\n <tr class="tcv_small_table_row">\n <th>${t}</th>\n <td align='right'>${i.min[t].toFixed(3)}</td>\n <td align='right'>${i.max[t].toFixed(3)}</td>\n <td align='right'>${s[t].toFixed(3)}</td>\n </tr>\n `})),n+="</table>",this.addHtml(n)}centerInfo(t){var e=`<div>Camera target set to AABB center:</div><div class='tcv_info_line'>{ x: ${t[0].toFixed(2)}, y: ${t[1].toFixed(2)}, z: ${t[2].toFixed(2)} }</div>`;this.addHtml(e)}}var Du=function(t,n){void 0===n&&console.warn('THREE.CameraControls: The second parameter "domElement" is now mandatory.'),n===document&&console.error('THREE.CameraControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=t,this.domElement=n,this.enabled=!0,this.target=new Ae,this.trackball=!1,this.holroyd=!0,this.radius=.9,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:e.ROTATE,MIDDLE:e.DOLLY,RIGHT:e.PAN},this.touches={ONE:i.ROTATE,TWO:i.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.quaternion0=this.object.quaternion.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return p.phi},this.getAzimuthalAngle=function(){return p.theta},this.saveState=function(){a.target0.copy(a.target),a.position0.copy(a.object.position),a.quaternion0.copy(a.object.quaternion),a.zoom0=a.object.zoom},this.reset=function(){a.target.copy(a.target0),a.object.position.copy(a.position0),a.object.quaternion.copy(a.quaternion0),a.object.zoom=a.zoom0,a.object.updateProjectionMatrix(),a.dispatchEvent(o),a.update(),d=h.NONE},this.update=function(){var e=new Ae,i=(new xe).setFromUnitVectors(t.up,new Ae(0,1,0)),n=i.clone().invert(),s=new Ae,r=new xe,l=new xe,c=new Ae;const _=new Ae;return function(){var t,y=a.object.position;if(e.copy(y).sub(a.target),a.trackball&&!a.holroyd)m.theta&&(c.set(0,1,0).applyQuaternion(a.object.quaternion),t=a.enableDamping?a.dampingFactor:1,l.setFromAxisAngle(c,m.theta*t),a.object.quaternion.premultiply(l),e.applyQuaternion(l)),m.phi&&(c.set(1,0,0).applyQuaternion(a.object.quaternion),t=a.enableDamping?a.dampingFactor:1,l.setFromAxisAngle(c,m.phi*t),a.object.quaternion.premultiply(l),e.applyQuaternion(l)),e.multiplyScalar(f),e.clampLength(a.minDistance,a.maxDistance);else if(a.trackball&&a.holroyd){_.crossVectors(A,w);var x=Math.atan(_.length()/A.dot(w));x&&(_.normalize(),_.applyQuaternion(a.object.quaternion),x*=-2*(t=a.enableDamping?a.dampingFactor:1),l.setFromAxisAngle(_,x),a.object.quaternion.premultiply(l),e.applyQuaternion(l)),e.multiplyScalar(f),e.clampLength(a.minDistance,a.maxDistance),A.set(0,0,0),w.set(0,0,0)}else e.applyQuaternion(i),a.autoRotate&&d===h.NONE&&P(2*Math.PI/60/60*a.autoRotateSpeed),p.setFromVector3(e),a.enableDamping?(p.theta+=m.theta*a.dampingFactor,p.phi+=m.phi*a.dampingFactor):(p.theta+=m.theta,p.phi+=m.phi),p.theta=Math.max(a.minAzimuthAngle,Math.min(a.maxAzimuthAngle,p.theta)),p.phi=Math.max(a.minPolarAngle,Math.min(a.maxPolarAngle,p.phi)),p.makeSafe(),p.radius*=f,p.radius=Math.max(a.minDistance,Math.min(a.maxDistance,p.radius)),e.setFromSpherical(p),e.applyQuaternion(n);return!0===a.enableDamping?a.target.addScaledVector(g,a.dampingFactor):a.target.add(g),y.copy(a.target).add(e),!1===a.trackball&&a.object.lookAt(a.target),!0===a.enableDamping?(m.theta*=1-a.dampingFactor,m.phi*=1-a.dampingFactor,g.multiplyScalar(1-a.dampingFactor)):(m.set(0,0,0),g.set(0,0,0)),f=1,!!(v||s.distanceToSquared(a.object.position)>u||8*(1-r.dot(a.object.quaternion))>u)&&(a.dispatchEvent(o),s.copy(a.object.position),r.copy(a.object.quaternion),v=!1,!0)}}();const s={x:new Ae(1,0,0),y:new Ae(0,1,0),z:new Ae(0,0,1)};function r(t,e){if(a.trackball){const i=s[t],n=(new xe).setFromAxisAngle(i,e);a.object.quaternion.premultiply(n),a.object.position.sub(a.target).applyQuaternion(n).add(a.target)}else console.log("not supported for orbit controls")}this.rotateX=function(t){r("x",t)},this.rotateY=function(t){r("y",t)},this.rotateZ=function(t){r("z",t)},this.rotateLeft=function(t){this.trackball?console.log("not supported for trackball controls"):P(t)},this.rotateUp=function(t){this.trackball?console.log("not supported for trackball controls"):R(t)},this.dispose=function(){a.domElement.removeEventListener("contextmenu",st,!1),a.domElement.removeEventListener("mousedown",Y,!1),a.domElement.removeEventListener("wheel",$,!1),a.domElement.removeEventListener("touchstart",et,!1),a.domElement.removeEventListener("touchend",nt,!1),a.domElement.removeEventListener("touchmove",it,!1),document.removeEventListener("mousemove",J,!1),document.removeEventListener("mouseup",K,!1),a.domElement.removeEventListener("keydown",tt,!1)};var a=this,o={type:"change"},l={type:"start"},c={type:"end"},h={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},d=h.NONE,u=1e-6,p=new ed,m=new ed,f=1,g=new Ae,v=!1,_=new Yt,y=new Yt,x=new Yt,A=new Ae,w=new Ae,b=new Yt,M=new Yt,S=new Yt,E=new Yt,C=new Yt,T=new Yt,L=!0,k=!0;function I(){return Math.pow(.95,a.zoomSpeed)}function P(t){L&&(m.theta-=t)}function R(t){k&&(m.phi-=t)}var B,D,U=(B=new Ae,function(t,e){B.setFromMatrixColumn(e,0),B.multiplyScalar(-t),g.add(B)}),N=function(){var t=new Ae;return function(e,i){!0===a.screenSpacePanning?t.setFromMatrixColumn(i,1):(t.setFromMatrixColumn(i,0),t.crossVectors(a.object.up,t)),t.multiplyScalar(e),g.add(t)}}(),O=(D=new Ae,function(t,e){var i=a.domElement;if(a.object.isPerspectiveCamera){var n=a.object.position;D.copy(n).sub(a.target);var s=D.length();s*=Math.tan(a.object.fov/2*Math.PI/180),U(2*t*s/i.clientHeight,a.object.matrix),N(2*e*s/i.clientHeight,a.object.matrix)}else a.object.isOrthographicCamera?(U(t*(a.object.right-a.object.left)/a.object.zoom/i.clientWidth,a.object.matrix),N(e*(a.object.top-a.object.bottom)/a.object.zoom/i.clientHeight,a.object.matrix)):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - pan disabled."),a.enablePan=!1)});function z(t){a.object.isPerspectiveCamera?f/=t:a.object.isOrthographicCamera?(a.object.zoom=Math.max(a.minZoom,Math.min(a.maxZoom,a.object.zoom*t)),a.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - dolly/zoom disabled."),a.enableZoom=!1)}function F(t){a.object.isPerspectiveCamera?f*=t:a.object.isOrthographicCamera?(a.object.zoom=Math.max(a.minZoom,Math.min(a.maxZoom,a.object.zoom/t)),a.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - dolly/zoom disabled."),a.enableZoom=!1)}const G=function(){const t=new Ae,e=a.radius*a.radius;return function(i){const n=a.domElement.getBoundingClientRect(),s=(i.x-n.x)/(n.width/2)-1,r=1-(i.y-n.y)/(n.height/2);return function(i,n){var s=(i*=a.rotateSpeed)*i+(n*=a.rotateSpeed)*n;s<=e/2?t.set(i,n,Math.sqrt(e-s)):t.set(i,n,e/(2*Math.sqrt(s)))}(L?s:0,k?r:0),t}}();function H(t){_.set(t.clientX,t.clientY)}function V(t){b.set(t.clientX,t.clientY)}function W(t){if(1==t.touches.length)_.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);_.set(e,i)}}function j(t){if(1==t.touches.length)b.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);b.set(e,i)}}function Q(t){var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY,n=Math.sqrt(e*e+i*i);E.set(0,n)}function q(t){if(1==t.touches.length)y.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);y.set(e,i)}if(a.trackball&&a.holroyd)A=G(_).clone(),w=G(y).clone();else{x.subVectors(y,_).multiplyScalar(a.rotateSpeed);var n=a.domElement;P(2*Math.PI*x.x/n.clientHeight),R(2*Math.PI*x.y/n.clientHeight)}_.copy(y)}function Z(t){if(1==t.touches.length)M.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);M.set(e,i)}S.subVectors(M,b).multiplyScalar(a.panSpeed),O(S.x,S.y),b.copy(M)}function X(t){var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY,n=Math.sqrt(e*e+i*i);C.set(0,n),T.set(0,Math.pow(C.y/E.y,a.zoomSpeed)),z(T.y),E.copy(C)}function Y(t){if(!1!==a.enabled){var i;switch(t.preventDefault(),t.stopPropagation(),a.domElement.focus?a.domElement.focus():window.focus(),t.button){case 0:i=a.mouseButtons.LEFT;break;case 1:i=a.mouseButtons.MIDDLE;break;case 2:i=a.mouseButtons.RIGHT;break;default:i=-1}switch(i){case e.DOLLY:if(!1===a.enableZoom)return;!function(t){E.set(t.clientX,t.clientY)}(t),d=h.DOLLY;break;case e.ROTATE:if(t.shiftKey){if(!1===a.enablePan)return;V(t),d=h.PAN}else{if(!1===a.enableRotate)return;t.ctrlKey&&(L=!1),t.metaKey&&(k=!1),H(t),d=h.ROTATE}break;case e.PAN:if(t.ctrlKey||t.metaKey||t.shiftKey){if(!1===a.enableRotate)return;H(t),d=h.ROTATE}else{if(!1===a.enablePan)return;V(t),d=h.PAN}break;default:d=h.NONE}d!==h.NONE&&(document.addEventListener("mousemove",J,!1),document.addEventListener("mouseup",K,!1),a.dispatchEvent(l))}}function J(t){if(!1!==a.enabled)switch(t.preventDefault(),t.stopPropagation(),d){case h.ROTATE:if(!1===a.enableRotate)return;!function(t){if(y.set(t.clientX,t.clientY),a.trackball&&a.holroyd)A=G(_).clone(),w=G(y).clone();else{var e=a.domElement;x.subVectors(y,_).multiplyScalar(a.rotateSpeed),P(2*Math.PI*x.x/e.clientHeight),R(2*Math.PI*x.y/e.clientHeight)}_.copy(y),a.update()}(t);break;case h.DOLLY:if(!1===a.enableZoom)return;!function(t){C.set(t.clientX,t.clientY),T.subVectors(C,E),T.y>0?z(I()):T.y<0&&F(I()),E.copy(C),a.update()}(t);break;case h.PAN:if(!1===a.enablePan)return;!function(t){M.set(t.clientX,t.clientY),S.subVectors(M,b).multiplyScalar(a.panSpeed),O(S.x,S.y),b.copy(M),a.update()}(t)}}function K(t){!1!==a.enabled&&(document.removeEventListener("mousemove",J,!1),document.removeEventListener("mouseup",K,!1),L=!0,k=!0,a.dispatchEvent(c),d=h.NONE)}function $(t){!1===a.enabled||!1===a.enableZoom||d!==h.NONE&&d!==h.ROTATE||(t.preventDefault(),t.stopPropagation(),a.dispatchEvent(l),function(t){t.deltaY<0?F(I()):t.deltaY>0&&z(I()),a.update()}(t),a.dispatchEvent(c))}function tt(t){!1!==a.enabled&&!1!==a.enableKeys&&!1!==a.enablePan&&function(t){var e=!1;switch(t.keyCode){case a.keys.UP:O(0,a.keyPanSpeed),e=!0;break;case a.keys.BOTTOM:O(0,-a.keyPanSpeed),e=!0;break;case a.keys.LEFT:O(a.keyPanSpeed,0),e=!0;break;case a.keys.RIGHT:O(-a.keyPanSpeed,0),e=!0}e&&(t.preventDefault(),a.update())}(t)}function et(t){if(!1!==a.enabled){switch(t.preventDefault(),t.touches.length){case 1:switch(a.touches.ONE){case i.ROTATE:if(!1===a.enableRotate)return;W(t),d=h.TOUCH_ROTATE;break;case i.PAN:if(!1===a.enablePan)return;j(t),d=h.TOUCH_PAN;break;default:d=h.NONE}break;case 2:switch(a.touches.TWO){case i.DOLLY_PAN:if(!1===a.enableZoom&&!1===a.enablePan)return;!function(t){a.enableZoom&&Q(t),a.enablePan&&j(t)}(t),d=h.TOUCH_DOLLY_PAN;break;case i.DOLLY_ROTATE:if(!1===a.enableZoom&&!1===a.enableRotate)return;!function(t){a.enableZoom&&Q(t),a.enableRotate&&W(t)}(t),d=h.TOUCH_DOLLY_ROTATE;break;default:d=h.NONE}break;default:d=h.NONE}d!==h.NONE&&a.dispatchEvent(l)}}function it(t){if(!1!==a.enabled)switch(t.preventDefault(),t.stopPropagation(),d){case h.TOUCH_ROTATE:if(!1===a.enableRotate)return;q(t),a.update();break;case h.TOUCH_PAN:if(!1===a.enablePan)return;Z(t),a.update();break;case h.TOUCH_DOLLY_PAN:if(!1===a.enableZoom&&!1===a.enablePan)return;!function(t){a.enableZoom&&X(t),a.enablePan&&Z(t)}(t),a.update();break;case h.TOUCH_DOLLY_ROTATE:if(!1===a.enableZoom&&!1===a.enableRotate)return;!function(t){a.enableZoom&&X(t),a.enableRotate&&q(t)}(t),a.update();break;default:d=h.NONE}}function nt(t){!1!==a.enabled&&(a.dispatchEvent(c),d=h.NONE)}function st(t){!1!==a.enabled&&t.preventDefault()}a.domElement.addEventListener("contextmenu",st,!1),a.domElement.addEventListener("mousedown",Y,!1),a.domElement.addEventListener("wheel",$,!1),a.domElement.addEventListener("touchstart",et,!1),a.domElement.addEventListener("touchend",nt,!1),a.domElement.addEventListener("touchmove",it,!1),a.domElement.addEventListener("keydown",tt,!1),-1===a.domElement.tabIndex&&(a.domElement.tabIndex=0),this.object.lookAt(a.target),this.update(),this.saveState()};(Du.prototype=Object.create(Dt.prototype)).constructor=Du;var Uu=function(t,n){Du.call(this,t,n),this.mouseButtons.LEFT=e.ROTATE,this.mouseButtons.RIGHT=e.PAN,this.touches.ONE=i.ROTATE,this.touches.TWO=i.DOLLY_PAN};(Uu.prototype=Object.create(Dt.prototype)).constructor=Uu;var Nu=function(t,n){Du.call(this,t,n),this.mouseButtons.LEFT=e.PAN,this.mouseButtons.RIGHT=e.ROTATE,this.touches.ONE=i.PAN,this.touches.TWO=i.DOLLY_ROTATE};(Nu.prototype=Object.create(Dt.prototype)).constructor=Nu;var Ou=function(t,n){Du.call(this,t,n),this.trackball=!0,this.screenSpacePanning=!0,this.autoRotate=!1,this.mouseButtons.LEFT=e.ROTATE,this.mouseButtons.RIGHT=e.PAN,this.touches.ONE=i.ROTATE,this.touches.TWO=i.DOLLY_PAN};(Ou.prototype=Object.create(Dt.prototype)).constructor=Ou;class zu{constructor(t,e,i,n,s=1,r=1,a=1){switch(this.type=t,this.camera=e,this.target=i,this.target0=i.slice(),this.domElement=n,this.rotateSpeed=s,this.zoomSpeed=r,this.panSpeed=a,t){case"orbit":this.initOrbitControls();break;case"trackball":this.initTrackballControls()}this.controls.target=new Ae(...this.target),this.controls.rotateSpeed=this.rotateSpeed,this.controls.zoomSpeed=this.zoomSpeed,this.controls.panSpeed=this.panSpeed,this.currentUpdateCallback=null,this.saveState(),this.update()}dispose(){this.controls.dispose(),this.controls=null}saveState(){this.controls.saveState()}initTrackballControls(t=!0){this.controls=new Du(this.camera,this.domElement),this.controls.trackball=!0,this.setHolroydTrackball(t)}initOrbitControls(){this.controls=new Du(this.camera,this.domElement)}addChangeListener(t){null==this.currentUpdateCallback&&(this.currentUpdateCallback=t,this.controls.addEventListener("change",t))}removeChangeListener(){null!=this.currentUpdateCallback&&(this.controls.removeEventListener("change",this.currentUpdateCallback),this.currentUpdateCallback=null)}update(){this.controls.update()}reset(){this.controls.reset()}setCamera(t){this.controls.object=t}setHolroydTrackball(t){this.controls.holroyd=t}getTarget(){return this.controls.target}getZoom0(){return this.controls.zoom0}setTarget(t){this.controls.target.copy(t)}setZoomSpeed(t){this.controls.zoomSpeed=t}setPanSpeed(t){this.controls.panSpeed=t}setRotateSpeed(t){this.controls.rotateSpeed=t}getResetLocation=()=>({target0:this.controls.target0.clone(),position0:this.controls.position0.clone(),quaternion0:this.controls.quaternion0.clone(),zoom0:this.controls.zoom0});setResetLocation=(t,e,i,n)=>{this.controls.target0.copy(t),this.controls.position0.copy(e),this.controls.quaternion0.copy(i),this.controls.zoom0=n};rotateUp(t){this.controls.rotateUp(-t/180*Math.PI),this.update()}rotateLeft(t){this.controls.rotateLeft(t/180*Math.PI),this.update()}rotateX(t){this.controls.rotateX(t/180*Math.PI),this.update()}rotateY(t){this.controls.rotateY(t/180*Math.PI),this.update()}rotateZ(t){this.controls.rotateZ(t/180*Math.PI),this.update()}}const Fu={y_up:{iso:{pos:new Ae(1,1,1),z_rot:0},front:{pos:new Ae(0,0,1),z_rot:0},rear:{pos:new Ae(0,0,-1),z_rot:0},left:{pos:new Ae(-1,0,0),z_rot:0},right:{pos:new Ae(1,0,0),z_rot:0},top:{pos:new Ae(0,1,0),z_rot:0},bottom:{pos:new Ae(0,-1,0),z_rot:0}},z_up:{iso:{pos:new Ae(1,-1,1),z_rot:0},front:{pos:new Ae(0,-1,0),z_rot:0},rear:{pos:new Ae(0,1,0),z_rot:0},left:{pos:new Ae(-1,0,0),z_rot:0},right:{pos:new Ae(1,0,0),z_rot:0},top:{pos:new Ae(0,0,1),z_rot:-Math.PI/2},bottom:{pos:new Ae(0,0,-1),z_rot:-Math.PI/2}},legacy:{iso:{pos:new Ae(1,1,1),z_rot:0},front:{pos:new Ae(1,0,0),z_rot:0},rear:{pos:new Ae(-1,0,0),z_rot:0},left:{pos:new Ae(0,1,0),z_rot:0},right:{pos:new Ae(0,-1,0),z_rot:0},top:{pos:new Ae(0,0,1),z_rot:0},bottom:{pos:new Ae(0,0,-1),z_rot:0}}},Gu={y_up:[0,1,0],z_up:[0,0,1],legacy:[0,0,1]};class Hu{constructor(t,e,i,n,s,r){this.target=new Ae(...n),this.ortho=s,this.up={Y:"y_up",Z:"z_up",L:"legacy"}[r],this.yaxis=new Ae(0,1,0),this.zaxis=new Ae(0,0,1);const a=t/e;this.camera_distance=5*i;var o=2*Math.atan(.2)/Math.PI*180;this.pCamera=new Un(o,a,.1,100*i),this.pCamera.up.set(...Gu[this.up]),this.pCamera.lookAt(this.target);const l=this.projectSize(i,a);this.oCamera=new os(-l[0],l[0],l[1],-l[1],.1,100*i),this.oCamera.up.set(...Gu[this.up]),this.oCamera.lookAt(this.target),this.camera=s?this.oCamera:this.pCamera,this.camera.up.set(...Gu[this.up])}dispose(){this.oCamera=null,this.pCamera=null}getCamera(){return this.camera}lookAtTarget(){this.camera.lookAt(this.target)}updateProjectionMatrix(){this.camera.updateProjectionMatrix()}switchCamera(t){var e=this.getPosition().clone();const i=this.getZoom(),n=this.getQuaternion().clone();t?(this.camera=this.oCamera,this.ortho=!0):(this.camera=this.pCamera,this.ortho=!1),this.setPosition(e,!1),this.setZoom(i),this.setQuaternion(n),this.updateProjectionMatrix()}projectSize(t,e){var i,n;return e<1?n=(i=t)/e:i=(n=t)*e,[i,n]}setupCamera(t,e=null,i=null,n=null){if(null!=e){var s=t?e.clone().normalize().multiplyScalar(this.camera_distance).add(this.target):e;this.camera.position.set(...s.toArray())}null!=i&&this.camera.quaternion.set(...i.toArray()),null!=n&&this.setZoom(n),this.updateProjectionMatrix()}presetCamera(t,e=null){if(null==e&&(e=this.camera.zoom),this.setupCamera(!0,Fu[this.up][t].pos,null,e),this.lookAtTarget(),0!=Fu[this.up][t].z_rot){var i=new xe;i.setFromAxisAngle(new Ae(0,0,1),Fu[this.up][t].z_rot),i.multiply(this.getQuaternion()),this.setQuaternion(i)}}getZoom(){if(this.ortho)return this.camera.zoom;var t=this.camera.position.clone().sub(this.target);return this.camera_distance/t.length()}setZoom(t){this.ortho?this.camera.zoom=t:this.camera.position.sub(this.target).setLength(this.camera_distance/t).add(this.target),this.updateProjectionMatrix()}getPosition(){return this.camera.position}setPosition(t,e){const i=this;Array.isArray(t)&&3===t.length?i.setupCamera(e,new Ae(...t)):t instanceof Ae?i.setupCamera(e,t):console.error("wrong type for position",t)}getQuaternion(){return this.camera.quaternion}setQuaternion(t){const e=this;Array.isArray(t)&&4===t.length?e.setupCamera(null,null,new xe(...t)):t instanceof xe?e.setupCamera(null,null,t):console.error("wrong type for quaternion",t),this.updateProjectionMatrix()}getRotation(){return this.camera.rotation}changeDimensions(t,e,i){const n=e/i,s=this.projectSize(t,n);this.oCamera&&(this.oCamera.left=-s[0],this.oCamera.right=s[0],this.oCamera.top=s[1],this.oCamera.bottom=-s[1]),this.pCamera&&(this.pCamera.aspect=n),this.camera&&this.camera.updateProjectionMatrix()}}class Vu{constructor(t,e,i,n=null,s=!0){this.notifyCallback=i,this.pinAsPngCallback=n,this.updateMarker=s,this.hasAnimationLoop=!1,this.setDisplayDefaults(e),this.display=new Pd(t,{theme:this.theme,cadWidth:this.cadWidth,treeWidth:this.treeWidth,height:this.height,pinning:this.pinning,glass:this.glass,tools:this.tools}),window.THREE=Ed,this.nestedGroup=null,this.mapping=null,this.tree=null,this.bbox=null,this.bb_max=0,this.scene=null,this.gridHelper=null,this.axesHelper=null,this.camera=null,this.controls=null,this.orientationMarker=null,this.treeview=null,this.ready=!1,this.mixer=null,this.animation=new Ru("|"),this.continueAnimation=!0,this.clipNormals=[[-1,0,0],[0,-1,0],[0,0,-1]],this.camera_distance=0,this.raycaster=new Kh,this.mouse=new Yt,this.renderer=new Ca({alpha:!this.dark,antialias:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(this.cadWidth,this.height),this.renderer.setClearColor(16777215,0),this.renderer.autoClear=!1,this.lastNotification={},this.lastBbox=null,this.bboxNeedsUpdate=!1,this.keepHighlight=!1,this.renderer.domElement.addEventListener("dblclick",this.pick,!1),this.renderer.domElement.addEventListener("contextmenu",(t=>t.stopPropagation())),this.display.addCadView(this.renderer.domElement),console.debug("three-cad-viewer: WebGL Renderer created"),this.display.setupUI(this)}version(){return"1.7.12"}setDisplayDefaults(t){for(var e in this.theme="browser",this.cadWidth=800,this.treeWidth=250,this.height=600,this.pinning=!1,this.glass=!1,this.tools=!0,t)null==this[e]?console.warn(`Unknown option "${e}" to create a viewer - ignored`):this[e]=t[e]}setRenderDefaults(t){for(var e in this.ambientIntensity=.5,this.directIntensity=.6,this.metalness=.7,this.roughness=.7,this.defaultOpacity=.5,this.edgeColor=7368816,this.normalLen=0,t)void 0===this[e]?console.warn(`Unknown option "${e}" to create a viewer - ignored`):this[e]=t[e]}setViewerDefaults(t){for(var e in this.axes=!1,this.axes0=!1,this.grid=[!1,!1,!1],this.ortho=!0,this.transparent=!1,this.blackEdges=!1,this.collapse=0,this.clipIntersection=!1,this.clipPlaneHelpers=!1,this.clipNormal0=[-1,0,0],this.clipNormal1=[0,-1,0],this.clipNormal2=[0,0,-1],this.clipSlider0=-1,this.clipSlider1=-1,this.clipSlider2=-1,this.control="orbit",this.up="Z",this.ticks=10,this.position=null,this.quaternion=null,this.target=null,this.zoom=1,this.panSpeed=.5,this.rotateSpeed=1,this.zoomSpeed=.5,this.timeit=!1,t)void 0===this[e]?console.warn(`Unknown option ${e} to add shapes - ignored`):this[e]=t[e]}dumpOptions(){console.log("Display:"),console.log("- cadWidth",this.cadWidth),console.log("- control",this.control),console.log("- height",this.height),console.log("- pinning",this.pinning),console.log("- theme",this.theme),console.log("- treeHeight",this.treeHeight),console.log("- treeWidth",this.treeWidth),console.log("Render:"),console.log("- ambientIntensity",this.ambientIntensity),console.log("- defaultOpacity",this.defaultOpacity),console.log("- directIntensity",this.directIntensity),console.log("- edgeColor",this.edgeColor),console.log("- normalLen",this.normalLen),console.log("View:"),console.log("- axes",this.axes),console.log("- axes0",this.axes0),console.log("- blackEdges",this.blackEdges),console.log("- clipIntersection",this.clipIntersection),console.log("- clipPlaneHelpers",this.clipPlaneHelpers),console.log("- clipNormal0",this.clipNormal0),console.log("- clipNormal1",this.clipNormal1),console.log("- clipNormal2",this.clipNormal2),console.log("- clipSlider0",this.clipSlider0),console.log("- clipSlider1",this.clipSlider1),console.log("- clipSlider2",this.clipSlider2),console.log("- grid",this.grid),console.log("- ortho",this.ortho),console.log("- panSpeed",this.panSpeed),console.log("- position",this.position),console.log("- quaternion",this.quaternion),console.log("- rotateSpeed",this.rotateSpeed),console.log("- ticks",this.ticks),console.log("- timeit",this.timeit),console.log("- tools",this.tools),console.log("- glass",this.glass),console.log("- transparent",this.transparent),console.log("- zoom",this.zoom),console.log("- zoom0",this.controls.getZoom0()),console.log("- zoomSpeed",this.zoomSpeed)}_renderTessellatedShapes(t,e){const i=new pu(t,this.cadWidth,this.height,this.edgeColor,this.transparent,this.defaultOpacity,this.metalness,this.roughness,this.normalLen);return i.render(e),i}_getTree(t,e){const i=(t,n)=>{const s=`${n}/${t.name}`;var r={name:t.name,id:s};if(t.parts)for(var a of(r.type="node",r.children=[],t.parts))r.children.push(i(a,s));else r.type="leaf",r.states=e[s];return r};return i(t,"")}renderTessellatedShapes(t,e,i){return this.setRenderDefaults(i),[this._renderTessellatedShapes(t,e),this._getTree(t,e)]}addAnimationTrack(t,e,i,n){this.animation.addTrack(t,this.nestedGroup.groups[t],e,i,n)}initAnimation(t,e,i="A",n=!0){null!=this.animation&&0!=this.animation.tracks.lenght?(console.debug("three-cad-viewer: Animation initialized"),this.hasAnimationLoop||this.toggleAnimationLoop(!0),this.display.showAnimationControl(!0),this.clipAction=this.animation.animate(this.nestedGroup.rootGroup,t,e,n),this.display.setAnimationLabel(i),this.display.resetAnimationSlider()):console.error("Animation does not have tracks")}hasAnimation(){return!!this.animation.clipAction}clearAnimation(){this.animation&&this.animation.dispose(),this.display.showAnimationControl(!1),this.toggleAnimationLoop(!1)}checkChanges=(t,e=!0)=>{var i={};Object.keys(t).forEach((e=>{if(!vu(this.lastNotification[e],t[e])){var n=gu(t[e]);i[e]={new:n,old:null==this.lastNotification[e]?null:gu(this.lastNotification[e])},this.lastNotification[e]=n}})),Object.keys(i).includes("position")&&(this.keepHighlight?this.keepHighlight=!1:this.display.clearHighlights()),e&&this.notifyCallback&&Object.keys(i).length&&this.notifyCallback(i)};update=(t,e=!0)=>{this.ready&&(this.renderer.clear(),this.renderer.setViewport(0,0,this.cadWidth,this.height),this.renderer.render(this.scene,this.camera.getCamera()),this.directLight.position.copy(this.camera.getCamera().position),null!=this.lastBbox&&(this.lastBbox.needsUpdate||this.bboxNeedsUpdate)&&(console.log("updated bbox"),this.lastBbox.bbox.update(),this.lastBbox.needsUpdate=!1),t&&(this.renderer.clearDepth(),this.orientationMarker.update(this.camera.getPosition().clone().sub(this.controls.getTarget()),this.camera.getRotation(),this.camera.getQuaternion()),this.orientationMarker.render(this.renderer)),this.animation&&this.animation.update(),this.checkChanges({zoom:this.camera.getZoom(),position:this.camera.getPosition().toArray(),quaternion:this.camera.getQuaternion().toArray(),target:this.controls.getTarget().toArray()},e))};animate=()=>{this.continueAnimation?(requestAnimationFrame(this.animate),this.controls.update(),this.update(!0,!0)):console.debug("three-cad-viewer: Animation loop stopped")};toggleAnimationLoop(t){t?(this.continueAnimation=!0,this.hasAnimationLoop=!0,this.controls.removeChangeListener(),console.debug("three-cad-viewer: Change listener removed"),this.animate(),console.debug("three-cad-viewer: Animation loop started")):(this.hasAnimationLoop&&console.debug("three-cad-viewer: Turning animation loop off"),this.continueAnimation=!1,this.hasAnimationLoop=!1,this.controls.addChangeListener((()=>this.update(!0,!0))),console.debug("three-cad-viewer: Change listener registered"),setTimeout((()=>this.update(!0,!0)),50))}dispose(){this.clear(),null!=this.orientationMarker&&this.orientationMarker.dispose(),null!=this.renderer&&(this.renderer.renderLists.dispose(),this.renderer.getContext("webgl2").getExtension("WEBGL_lose_context").loseContext(),console.debug("three-cad-viewer: WebGL context disposed"),this.renderer=null),null!=this.display&&(this.display.dispose(),this.display=null)}clear(){null!=this.scene&&(this.continueAnimation=!1,this.hasAnimationLoop||(this.controls.removeChangeListener(),console.debug("three-cad-viewer: Change listener removed")),this.hasAnimationLoop=!1,this.display.showAnimationControl(!1),null!=this.animation&&this.animation.dispose(),this.display.setExplodeCheck(!1),this.renderer.clear(),_u(this.scene,(t=>{t.geometry?.dispose(),t.material?.dispose()})),this.scene=null,this.display.clearCadTree(),this.info.dispose(),this.camera.dispose(),this.controls.dispose(),this.scene=null,this.ready=!1)}render(t,e,i,n){this.setViewerDefaults(n),this.animation.cleanBackup();const s=new Lu("viewer",this.timeit);this.states=i,this.scene=new Ia,this.lastBbox=null,this.nestedGroup=t,this.scene.add(this.nestedGroup.render(i)),this.nestedGroup.setTransparent(this.transparent),this.nestedGroup.setBlackEdges(this.blackEdges),this.nestedGroup.setMetalness(this.metalness),this.nestedGroup.setRoughness(this.roughness),this.nestedGroup.setPolygonOffset(2),s.split("rendered nested group"),this.bbox=this.nestedGroup.boundingBox();const r=new Ae;this.bbox.getCenter(r),this.bb_max=this.bbox.max_dist_from_center(),this.bb_radius=Math.max(this.bbox.boundingSphere().radius,r.length()),s.split("bounding box"),this.info=new Bu(this.display.cadInfo),this.camera=new Hu(this.cadWidth,this.height,this.bb_radius,null==n.target?this.bbox.center():n.target,this.ortho,n.up),this.controls=new zu(this.control,this.camera.getCamera(),null==n.target?this.bbox.center():n.target,this.renderer.domElement,this.rotateSpeed,this.zoomSpeed,this.panSpeed),this.controls.enableKeys=!1,this.controls.controls.screenSpacePanning=!0,null==n.position&&null==n.quaternion?(this.presetCamera("iso",this.zoom),this.display.highlightButton("iso")):null!=n.position?(this.setCamera(!1,n.position,n.quaternion,this.zoom),null==n.quaternion&&this.camera.lookAtTarget()):(this.info.addHtml("<b>quaternion needs position to be provided, falling back to ISO view</b>"),this.presetCamera("iso",this.zoom)),this.controls.update(),this.controls.saveState();const a=new dh(16777215,this.ambientIntensity);this.scene.add(a),this.directLight=new hh(16777215,this.directIntensity),this.scene.add(this.directLight),this.setAmbientLight(this.ambientIntensity),this.setDirectLight(this.directIntensity),this.gridHelper=new mu(this.display,this.bbox,this.ticks,this.axes0,this.grid,"Z"==n.up),this.gridHelper.computeGrid();for(var o=0;o<3;o++)this.scene.add(this.gridHelper.gridHelper[o]);this.gridSize=this.gridHelper.size,this.axesHelper=new fu(this.bbox.center(),this.gridSize/2,2,this.cadWidth,this.height,this.axes0,this.axes,this.theme),this.scene.add(this.axesHelper),this.clipping=new Iu(this.bbox.center,this.gridSize,this.gridSize/2,((t,e)=>this.display.setNormalLabel(t,e)),this.theme),this.display.setSliderLimits(this.gridSize/2),this.clipSlider0=this.gridSize/2,this.clipSlider1=this.gridSize/2,this.clipSlider2=this.gridSize/2,this.setClipSlider(0,this.clipSlider0,!0),this.setClipSlider(1,this.clipSlider1,!0),this.setClipSlider(2,this.clipSlider2,!0),this.setClipNormal(0,n.clipNormal0,!1),this.setClipNormal(1,n.clipNormal1,!1),this.setClipNormal(2,n.clipNormal2,!1),this.setClipIntersection(n.clipIntersection,!1),this.setClipPlaneHelpersCheck(n.clipPlaneHelpers),this.scene.add(this.clipping.planeHelpers),this.nestedGroup.setClipPlanes(this.clipping.clipPlanes),this.setLocalClipping(!1),this.display.metalnessSlider.setValue(100*this.metalness),this.display.roughnessSlider.setValue(100*this.roughness),this.display.ambientlightSlider.setValue(100*this.ambientIntensity),this.display.directionallightSlider.setValue(100*this.directIntensity),this.orientationMarker=new wu(80,80,this.camera.getCamera(),this.theme),this.orientationMarker.create();const l="dark"===this.theme||"browser"===this.theme&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";this.tree=e,this.treeview=new Tu(gu(this.states),this.tree,this.setObjects,this.handlePick,l),this.display.addCadTree(this.treeview.render(n.collapse)),this.display.selectTabByName("tree"),s.split("scene done"),this.display.updateUI(this.axes,this.axes0,this.ortho,this.transparent,this.blackEdges,this.tools,this.glass),this.display.autoCollapse(),this.toggleAnimationLoop(this.hasAnimationLoop),this.ready=!0,this.info.readyMsg(this.gridHelper.ticks,this.control),this.notifyCallback&&this.notifyCallback({tab:{old:null,new:this.display.activeTab},target:{old:null,new:this.controls.target},target0:{old:null,new:this.controls.target0},clip_normal_0:{old:null,new:this.clipNormal0},clip_normal_1:{old:null,new:this.clipNormal1},clip_normal_2:{old:null,new:this.clipNormal2}}),this.update(!1,!1),s.stop()}setCamera=(t,e,i=null,n=null,s=!0)=>{this.camera.setupCamera(t,new Ae(...e),null!=i?new xe(...i):null,n,s),this.update(!0,s)};presetCamera=(t,e=null,i=!0)=>{this.camera.presetCamera(t,e,i),this.update(!0,i)};getCameraType(){return this.camera.ortho?"ortho":"perspective"}switchCamera(t,e=!0){this.ortho=t,this.camera.switchCamera(t,e),this.controls.setCamera(this.camera.getCamera()),this.display.setOrthoCheck(t),this.checkChanges({ortho:t},e),this.update(!0,e)}recenterCamera(t=!0){const e=this.camera.getCamera(),i=new Ae,n=this.bbox.center();i.fromArray(n);const s=new Ae,r=this.controls.target;s.fromArray(r),this.camera.camera_distance=5*this.bb_radius,e.position.sub(s).add(i),this.controls.controls.target=i;let a=new Ae;e.getWorldDirection(a);let o=i.clone().add(a.normalize().multiplyScalar(-this.camera.camera_distance));e.position.set(o.x,o.y,o.z),this.update(!0,t)}resize=()=>{this.camera.setZoom(this.controls.getZoom0()),this.camera.updateProjectionMatrix(),this.update(!0)};reset=()=>{this.controls.reset(),this.update(!0)};setLocalClipping(t){this.renderer.localClippingEnabled=t,this.update(this.updateMarker)}setObjects=(t,e=!0)=>{for(var i in this.states){var n=this.states[i],s=t[i],r=this.nestedGroup.groups[i];n[0]!=s[0]&&(r.setShapeVisible(1===s[0]),this.states[i][0]=s[0]),n[1]!=s[1]&&(r.setEdgesVisible(1===s[1]),this.states[i][1]=s[1])}this.checkChanges({states:t},e),this.update(this.updateMarker)};setBoundingBox=t=>{const e=this.nestedGroup.groups[t];null!=e&&(null!=this.lastBbox&&this.scene.remove(this.lastBbox.bbox),null==this.lastBbox||null!=this.lastBbox&&t!=this.lastBbox.id?(this.lastBbox={id:t,bbox:new ru(e,16711935),needsUpdate:!1},this.scene.add(this.lastBbox.bbox)):this.lastBbox=null,this.update(!1,!1,!1))};refreshPlane=(t,e)=>{this.clipping.setConstant(t,e),this.update(this.updateMarker)};backupAnimation(){this.animation.hasTracks()&&(this.backupTracks=this.animation.backup())}restoreAnimation(){if(this.animation.hasBackup()){var t=this.animation.restore();this.initAnimation(t.duration,t.speed,"A",t.repeat)}}controlAnimation=t=>{switch(t){case"play":this.clipAction.paused&&(this.clipAction.paused=!1),this.clipAction.play();break;case"pause":this.clipAction.paused=!this.clipAction.paused;break;case"stop":this.clipAction.stop()}};setState=(t,e,i="leaf",n=!0)=>{[0,1].forEach((n=>this.treeview.handleStateChange(i,t,n,e[n]))),this.update(this.updateMarker,n)};removeLastBbox(){null!=this.lastBbox&&(this.scene.remove(this.lastBbox.bbox),this.lastBbox=null,this.treeview.removeLabelHighlight())}handlePick=(t,e,i,n,s="leaf",r=!0)=>{const a=`${t}/${e}`,o=this.nestedGroup.groups[a],l=(new su).setFromObject(o,!0);if(null==this.lastBbox||this.lastBbox.id!==a||i||n)if(r&&this.treeview.selectNode(a),this.checkChanges({lastPick:{path:t,name:e,boundingBox:l,boundingSphere:l.boundingSphere()}}),this.animation.clipAction?.isRunning()&&(this.bboxNeedsUpdate=!0),i)this.setState(a,[0,0],s);else if(n){this.removeLastBbox(),this.treeview.hideAll(),this.setState(a,[1,1],s);const t=l.center();this.controls.setTarget(new Ae(...t)),this.info.centerInfo(t)}else this.info.bbInfo(t,e,l),this.setBoundingBox(a);else this.removeLastBbox();this.update(!0)};pick=t=>{const e=this.renderer.domElement.getBoundingClientRect(),i=e.x+window.pageXOffset,n=e.y+window.pageYOffset;this.mouse.x=(t.pageX-i)/this.cadWidth*2-1,this.mouse.y=-(t.pageY-n)/this.height*2+1,this.raycaster.setFromCamera(this.mouse,this.camera.getCamera());const s=this.raycaster.intersectObjects(this.scene.children.slice(0,1),!0);var r=null;for(var a of s)if(a.object.material.visible){r={path:a.object.parent.parent.name.replaceAll("|","/"),name:a.object.name,boundingBox:a.object.geometry.boundingBox,boundingSphere:a.object.geometry.boundingSphere,objectGroup:a.object.parent};break}null!=r&&this.handlePick(r.path,r.name,t.metaKey,t.shiftKey)};getAxes(){return this.axes}setAxes=(t,e=!0)=>{this.axes=t,this.axesHelper.setVisible(t),this.display.setAxesCheck(t),this.checkChanges({axes:t},e),this.update(this.updateMarker)};setGrid=(t,e=!0)=>{this.gridHelper.setGrid(t),this.checkChanges({grid:this.gridHelper.grid},e),this.update(this.updateMarker)};getGrids(){return this.grid}setGrids=(t,e=!0)=>{this.gridHelper.setGrids(...t),this.grid=this.gridHelper.grid,this.checkChanges({grid:this.gridHelper.grid},e),this.update(this.updateMarker)};getAxes0(){return this.axes0}setAxes0=(t,e=!0)=>{this.axes0=t,this.gridHelper.setCenter(t,"Z"==this.up),this.display.setAxes0Check(t),this.axesHelper.setCenter(t),this.checkChanges({axes0:t},e),this.update(this.updateMarker)};getMetalness=()=>this.metalness;setMetalness=(t,e=!0)=>{this.metalness=t,this.nestedGroup.setMetalness(t),this.checkChanges({metalness:t},e),this.update(this.updateMarker)};getRoughness=()=>this.roughness;setRoughness=(t,e=!0)=>{this.roughness=t,this.nestedGroup.setRoughness(t),this.checkChanges({roughness:t},e),this.update(this.updateMarker)};getTransparent(){return this.transparent}setTransparent=(t,e=!0)=>{this.transparent=t,this.nestedGroup.setTransparent(t),this.display.setTransparentCheck(t),this.checkChanges({transparent:t},e),this.update(this.updateMarker)};getBlackEdges(){return this.blackEdges}setBlackEdges=(t,e=!0)=>{this.blackEdges=t,this.nestedGroup.setBlackEdges(t),this.display.setBlackEdgesCheck(t),this.checkChanges({black_edges:t},e),this.update(this.updateMarker)};getOrtho(){return this.camera.ortho}setOrtho(t,e=!0){this.switchCamera(t,e)}getCameraZoom(){return this.camera.getZoom()}setCameraZoom(t,e=!0){this.camera.setZoom(t),this.controls.update(),this.update(!0,e)}getCameraPosition(){return this.camera.getPosition().toArray()}setCameraPosition(t,e=!1,i=!0){this.camera.setPosition(t,e),this.controls.update(),this.update(!0,i)}getCameraQuaternion(){return this.camera.getQuaternion().toArray()}setCameraQuaternion(t,e=!0){this.camera.setQuaternion(t),this.controls.update(),this.update(!0,e)}getCameraTarget(){return this.controls.getTarget().toArray()}setCameraTarget(t,e=!0){this.camera.getCamera().lookAt(new Ae(...t)),this.controls.setTarget(new Ae(...t)),this.controls.update(),this.update(!0,e)}getCameraLocationSettings(){return{position:this.getCameraPosition(),quaternion:this.getCameraQuaternion(),target:this.getCameraTarget(),zoom:this.getCameraZoom()}}setCameraLocationSettings(t=null,e=null,i=null,n=null,s=!0){null!=t&&this.camera.setPosition(t,!1),null!=e&&"trackball"===this.control&&this.camera.setQuaternion(e),null!=i&&this.controls.setTarget(new Ae(...i)),null!=n&&this.camera.setZoom(n),this.controls.update(),this.update(!0,s)}getEdgeColor(){return this.edgeColor}setEdgeColor=(t,e=!0)=>{this.edgeColor=t,this.nestedGroup.setEdgeColor(t),this.update(this.updateMarker,e)};getOpacity(){return this.defaultOpacity}setOpacity=(t,e=!0)=>{this.defaultOpacity=t,this.nestedGroup.setOpacity(t),this.update(this.updateMarker,e)};getTools(){return this.tools}showTools=(t,e=!0)=>{this.tools=t,this.display.showTools(t),this.update(this.updateMarker,e)};getAmbientLight(){return this.ambientIntensity}setAmbientLight=(t,e=!0)=>{for(var i of(this.ambientIntensity=t,this.scene.children))i instanceof dh&&(i.intensity=t);this.update(this.updateMarker,e)};getDirectLight(){return this.directIntensity}setDirectLight=(t,e=!0)=>{this.directIntensity=t,this.directLight.intensity=t,this.update(this.updateMarker,e)};getStates(){return this.states}setStates=(t,e=!0)=>{for(var i in t)t[i][0]==this.states[i][0]&&t[i][1]==this.states[i][1]||this.setState(i,t[i],"leaf",e)};getZoomSpeed(){return this.zoomSpeed}setZoomSpeed=(t,e=!0)=>{this.zoomSpeed=t,this.controls.setZoomSpeed(t),this.checkChanges({grid:this.gridHelper.grid},e)};getPanSpeed(){return this.panSpeed}setPanSpeed=(t,e=!0)=>{this.panSpeed=t,this.controls.setPanSpeed(t),this.checkChanges({grid:this.gridHelper.grid},e)};getRotateSpeed(){return this.rotateSpeed}setRotateSpeed=(t,e=!0)=>{this.rotateSpeed=t,this.controls.setRotateSpeed(t),this.checkChanges({grid:this.gridHelper.grid},e)};getClipIntersection(){return this.clipIntersection}setClipIntersection=(t,e=!0)=>{null!=t&&(this.clipIntersection=t,this.nestedGroup.setClipIntersection(t),this.display.setClipIntersectionCheck(t),this.checkChanges({clip_intersection:t},e),this.update(this.updateMarker))};getClipPlaneHelpers(){return this.clipPlaneHelpers}setClipPlaneHelpersCheck(t){null!=t&&this.display.setClipPlaneHelpersCheck(t)}setClipPlaneHelpers=(t,e=!0)=>{null!=t&&(this.clipPlaneHelpers=t,this.clipping.planeHelpers.visible=t,this.display.setClipPlaneHelpersCheck(t),this.checkChanges({clip_planes:t},e),this.update(this.updateMarker))};getClipNormal(t){return this.clipNormals[t]}setClipNormal(t,e,i=!0){if(null!=e){this.clipNormals[t]=e,this.clipping.setNormal(t,new Ae(...e));var n={};n[`clip_normal_${t}`]=e,this.checkChanges(n,i),this.nestedGroup.setClipPlanes(this.clipping.clipPlanes),this.update(this.updateMarker)}}setClipNormalFromPosition=(t,e=!0)=>{const i=this.camera.getPosition().clone().sub(this.controls.getTarget()).normalize().negate().toArray();this.setClipNormal(t,i,e)};getClipSlider=t=>this.display.clipSliders[t].getValue();setClipSlider=(t,e,i=!0)=>{-1!=e&&null!=e&&this.display.clipSliders[t].setValue(e,i)};getResetLocation=()=>{const t=this.controls.getResetLocation();return{target0:t.target0.toArray(),position0:t.position0.toArray(),quaternion0:t.quaternion0.toArray(),zoom0:t.zoom0}};setResetLocation=(t,e,i,n,s=!0)=>{var r=this.getResetLocation();this.controls.setResetLocation(new Ae(...t),new Ae(...e),new ge(...i),n),s&&this.notifyCallback&&this.notifyCallback({target0:{old:r.target0,new:t},position0:{old:r.position0,new:e},quaternion0:{old:r.quaternion0,new:i},zoom0:{old:r.zoom0,new:n}})};pinAsPng=()=>{const t=this.display.cadView.children[2];this.renderer.setViewport(0,0,this.cadWidth,this.height),this.renderer.render(this.scene,this.camera.getCamera()),t.toBlob((t=>{let e=new FileReader;const i=this;e.addEventListener("load",(function(){var t=document.createElement("img");if(t.width=i.cadWidth,t.height=i.height,t.src=e.result,null==i.pinAsPngCallback){for(var n of i.display.container.children)i.display.container.removeChild(n);i.display.container.appendChild(t)}else i.pinAsPngCallback(t)}),!1),e.readAsDataURL(t)}))};explode(t=2,e=1,i=2.5){this.clearAnimation();const n=this.getAxes0();var s=new Ae,r=new Ae,a=null,o=null,l=null;n||(new Me).setFromObject(this.nestedGroup.rootGroup).getCenter(s);for(var c in this.nestedGroup.groups){var h=this.nestedGroup.groups[c],d=new Me;h instanceof uu&&d.expandByObject(h),d.isEmpty()||(d.getCenter(r),a=r.sub(s),o=h.parent.worldToLocal(a.clone()),(l=h.parent.worldToLocal(a.clone().multiplyScalar(i))).sub(o),this.addAnimationTrack(c,"t",[0,t],[[0,0,0],l.toArray()]))}this.initAnimation(t,e,"E",!1)}trimUI(t,e){var i=e?"inline-block":"none";for(var n of t){var s;["axes","axes0","grid","ortho","more","help"].includes(n)&&("more"!=n?((s=this.display._getElement(`tcv_${n}`)).style.display=i,"help"!==n&&(s.nextElementSibling.style.display=i)):(s=this.display._getElement(`tcv_${n}-dropdown`)).style.display=i)}}resizeCadView(t,e,i,n=!1){this.cadWidth=t,this.height=i,this.renderer.setSize(t,i),this.display.setSizes({treeWidth:e,cadWidth:t,height:i}),this.display.cadView.children[2].style.width=`${t}px`,this.display.cadView.children[2].style.height=`${i}px`,this.display.glassMode(n);const s=t+(n?0:e);this.display.handleMoreButton(s),this.camera.changeDimensions(this.bb_radius,t,i),this.update(!0)}}export{Pd as Display,Lu as Timer,Vu as Viewer};