three-cad-viewer 2.2.4 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/three-cad-viewer.css +4 -0
- package/dist/three-cad-viewer.esm.js +2209 -1779
- package/dist/three-cad-viewer.esm.min.js +2 -2
- package/dist/three-cad-viewer.js +2209 -1779
- package/dist/three-cad-viewer.min.js +2 -2
- package/package.json +15 -15
- package/src/_version.js +1 -1
- package/src/bbox.js +0 -3
- package/src/cad_tools/measure.js +9 -9
- package/src/display.js +29 -3
- package/src/nestedgroup.js +10 -9
- package/src/timer.js +4 -4
- package/src/utils.js +4 -1
- package/src/viewer.js +224 -120
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).CadViewer={})}(this,(function(t){"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
|
-
* Copyright 2010-
|
|
4
|
+
* Copyright 2010-2024 Three.js Authors
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
6
|
-
*/const e="162",i={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},n={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},s=1,r=2,a=3,o=0,l=1,c=100,h=204,d=205,u=0,p=1,m=2,f=0,g=1,v=2,_=3,y=4,x=5,w=6,b=7,M="attached",S="detached",E=300,T=301,A=302,C=303,L=304,k=306,R=1e3,P=1001,I=1002,N=1003,U=1004,D=1005,O=1006,B=1007,F=1008,z=1009,H=1012,G=1013,V=1014,W=1015,j=1016,q=1017,X=1018,Z=1020,Y=1023,J=1026,$=1027,K=1028,Q=1029,tt=1031,et=1033,it=33776,nt=33777,st=33778,rt=33779,at=35840,ot=35841,lt=35842,ct=35843,ht=36196,dt=37492,ut=37496,pt=37808,mt=37809,ft=37810,gt=37811,vt=37812,_t=37813,yt=37814,xt=37815,wt=37816,bt=37817,Mt=37818,St=37819,Et=37820,Tt=37821,At=36492,Ct=36494,Lt=36495,kt=36284,Rt=36285,Pt=36286,It=2201,Nt=2202,Ut=2300,Dt=2301,Ot=2302,Bt=2400,Ft=2401,zt=2402,Ht=2500,Gt=2501,Vt="",Wt="srgb",jt="srgb-linear",qt="display-p3",Xt="display-p3-linear",Zt="linear",Yt="srgb",Jt="rec709",$t="p3",Kt=7680,Qt=7681,te=34055,ee=34056,ie=519,ne=35044,se="300 es",re=1035,ae=2e3,oe=2001;class le{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 ce=["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 he=1234567;const de=Math.PI/180,ue=180/Math.PI;function pe(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(ce[255&t]+ce[t>>8&255]+ce[t>>16&255]+ce[t>>24&255]+"-"+ce[255&e]+ce[e>>8&255]+"-"+ce[e>>16&15|64]+ce[e>>24&255]+"-"+ce[63&i|128]+ce[i>>8&255]+"-"+ce[i>>16&255]+ce[i>>24&255]+ce[255&n]+ce[n>>8&255]+ce[n>>16&255]+ce[n>>24&255]).toLowerCase()}function me(t,e,i){return Math.max(e,Math.min(i,t))}function fe(t,e){return(t%e+e)%e}function ge(t,e,i){return(1-i)*t+i*e}function ve(t){return 0==(t&t-1)&&0!==t}function _e(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function ye(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function xe(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const we={DEG2RAD:de,RAD2DEG:ue,generateUUID:pe,clamp:me,euclideanModulo:fe,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:ge,damp:function(t,e,i,n){return ge(t,e,1-Math.exp(-i*n))},pingpong:function(t,e=1){return e-Math.abs(fe(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&&(he=t);let e=he+=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*de},radToDeg:function(t){return t*ue},isPowerOfTwo:ve,ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:_e,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:xe,denormalize:ye};class be{constructor(t=0,e=0){be.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=Math.trunc(this.x),this.y=Math.trunc(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(me(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 Me{constructor(t,e,i,n,s,r,a,o,l){Me.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,n,s,r,a,o,l)}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],w=n[5],b=n[8];return s[0]=r*m+a*v+o*x,s[3]=r*f+a*_+o*w,s[6]=r*g+a*y+o*b,s[1]=l*m+c*v+h*x,s[4]=l*f+c*_+h*w,s[7]=l*g+c*y+h*b,s[2]=d*m+u*v+p*x,s[5]=d*f+u*_+p*w,s[8]=d*g+u*y+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],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(Se.makeScale(t,e)),this}rotate(t){return this.premultiply(Se.makeRotation(-t)),this}translate(t,e){return this.premultiply(Se.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):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 Se=new Me;function Ee(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 Ae(t,e){return new Te[t](e)}function Ce(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Le(){const t=Ce("canvas");return t.style.display="block",t}const ke={};function Re(t){t in ke||(ke[t]=!0,console.warn(t))}const Pe=(new Me).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Ie=(new Me).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Ne={[jt]:{transfer:Zt,primaries:Jt,toReference:t=>t,fromReference:t=>t},[Wt]:{transfer:Yt,primaries:Jt,toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[Xt]:{transfer:Zt,primaries:$t,toReference:t=>t.applyMatrix3(Ie),fromReference:t=>t.applyMatrix3(Pe)},[qt]:{transfer:Yt,primaries:$t,toReference:t=>t.convertSRGBToLinear().applyMatrix3(Ie),fromReference:t=>t.applyMatrix3(Pe).convertLinearToSRGB()}},Ue=new Set([jt,Xt]),De={enabled:!0,_workingColorSpace:jt,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!Ue.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,i){if(!1===this.enabled||e===i||!e||!i)return t;const n=Ne[e].toReference;return(0,Ne[i].fromReference)(n(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return Ne[t].primaries},getTransfer:function(t){return t===Vt?Zt:Ne[t].transfer}};function Oe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Be(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let Fe;class ze{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===Fe&&(Fe=Ce("canvas")),Fe.width=t.width,Fe.height=t.height;const i=Fe.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=Fe}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=Ce("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*Oe(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*Oe(e[t]/255)):e[t]=Oe(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}}let He=0;class Ge{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:He++}),this.uuid=pe(),this.data=t,this.dataReady=!0,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(Ve(n[e].image)):t.push(Ve(n[e]))}else t=Ve(n);i.url=t}return e||(t.images[this.uuid]=i),i}}function Ve(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?ze.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 We=0;class je extends le{constructor(t=je.DEFAULT_IMAGE,e=je.DEFAULT_MAPPING,i=1001,n=1001,s=1006,r=1008,a=1023,o=1009,l=je.DEFAULT_ANISOTROPY,c=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:We++}),this.uuid=pe(),this.name="",this.source=new Ge(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 be(0,0),this.repeat=new be(1,1),this.center=new be(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Me,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=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.colorSpace=t.colorSpace,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.6,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,colorSpace:this.colorSpace,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!==E)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case R:t.x=t.x-Math.floor(t.x);break;case P:t.x=t.x<0?0:1;break;case I: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 R:t.y=t.y-Math.floor(t.y);break;case P:t.y=t.y<0?0:1;break;case I: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)}}je.DEFAULT_IMAGE=null,je.DEFAULT_MAPPING=E,je.DEFAULT_ANISOTROPY=1;class qe{constructor(t=0,e=0,i=0,n=1){qe.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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(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 Xe extends le{constructor(t=1,e=1,i={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new qe(0,0,t,e),this.scissorTest=!1,this.viewport=new qe(0,0,t,e);const n={width:t,height:e,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:O,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},i);const s=new je(n,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const r=i.count;for(let t=0;t<r;t++)this.textures[t]=s.clone(),this.textures[t].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}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.textures.length;n<s;n++)this.textures[n].image.width=t,this.textures[n].image.height=e,this.textures[n].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.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,i=t.textures.length;e<i;e++)this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0;const e=Object.assign({},t.texture.image);return this.texture.source=new Ge(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 Ze extends Xe{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}}class Ye extends je{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=N,this.minFilter=N,this.wrapR=P,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Je extends je{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=N,this.minFilter=N,this.wrapR=P,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class $e{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=!0){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!0===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(me(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}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=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(n*Math.sin(t),n*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}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._onChangeCallback(),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 Ke{constructor(t=0,e=0,i=0){Ke.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(ti.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(ti.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=2*(r*n-a*i),c=2*(a*e-s*n),h=2*(s*i-r*e);return this.x=e+o*l+r*h-a*c,this.y=i+o*c+a*l-s*h,this.z=n+o*h+s*c-r*l,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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(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 Qe.copy(this).projectOnVector(t),this.sub(Qe)}reflect(t){return this.sub(Qe.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(me(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=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Qe=new Ke,ti=new $e;class ei{constructor(t=new Ke(1/0,1/0,1/0),e=new Ke(-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(ni.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(ni.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=ni.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){t.updateWorldMatrix(!1,!1);const i=t.geometry;if(void 0!==i){const n=i.getAttribute("position");if(!0===e&&void 0!==n&&!0!==t.isInstancedMesh)for(let e=0,i=n.count;e<i;e++)!0===t.isMesh?t.getVertexPosition(e,ni):ni.fromBufferAttribute(n,e),ni.applyMatrix4(t.matrixWorld),this.expandByPoint(ni);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),si.copy(t.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),si.copy(i.boundingBox)),si.applyMatrix4(t.matrixWorld),this.union(si)}const n=t.children;for(let t=0,i=n.length;t<i;t++)this.expandByObject(n[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,ni),ni.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(di),ui.subVectors(this.max,di),ri.subVectors(t.a,di),ai.subVectors(t.b,di),oi.subVectors(t.c,di),li.subVectors(ai,ri),ci.subVectors(oi,ai),hi.subVectors(ri,oi);let e=[0,-li.z,li.y,0,-ci.z,ci.y,0,-hi.z,hi.y,li.z,0,-li.x,ci.z,0,-ci.x,hi.z,0,-hi.x,-li.y,li.x,0,-ci.y,ci.x,0,-hi.y,hi.x,0];return!!fi(e,ri,ai,oi,ui)&&(e=[1,0,0,0,1,0,0,0,1],!!fi(e,ri,ai,oi,ui)&&(pi.crossVectors(li,ci),e=[pi.x,pi.y,pi.z],fi(e,ri,ai,oi,ui)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ni).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(ni).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()||(ii[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ii[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ii[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ii[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ii[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ii[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ii[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ii[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ii)),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 ii=[new Ke,new Ke,new Ke,new Ke,new Ke,new Ke,new Ke,new Ke],ni=new Ke,si=new ei,ri=new Ke,ai=new Ke,oi=new Ke,li=new Ke,ci=new Ke,hi=new Ke,di=new Ke,ui=new Ke,pi=new Ke,mi=new Ke;function fi(t,e,i,n,s){for(let r=0,a=t.length-3;r<=a;r+=3){mi.fromArray(t,r);const a=s.x*Math.abs(mi.x)+s.y*Math.abs(mi.y)+s.z*Math.abs(mi.z),o=e.dot(mi),l=i.dot(mi),c=n.dot(mi);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>a)return!1}return!0}const gi=new ei,vi=new Ke,_i=new Ke;class yi{constructor(t=new Ke,e=-1){this.isSphere=!0,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):gi.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;vi.subVectors(t,this.center);const e=vi.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.addScaledVector(vi,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):(_i.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(vi.copy(t.center).add(_i)),this.expandByPoint(vi.copy(t.center).sub(_i))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const xi=new Ke,wi=new Ke,bi=new Ke,Mi=new Ke,Si=new Ke,Ei=new Ke,Ti=new Ke;class Ai{constructor(t=new Ke,e=new Ke(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,xi)),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=xi.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(xi.copy(this.origin).addScaledVector(this.direction,e),xi.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){wi.copy(t).add(e).multiplyScalar(.5),bi.copy(e).sub(t).normalize(),Mi.copy(this.origin).sub(wi);const s=.5*t.distanceTo(e),r=-this.direction.dot(bi),a=Mi.dot(this.direction),o=-Mi.dot(bi),l=Mi.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(wi).addScaledVector(bi,d),u}intersectSphere(t,e){xi.subVectors(t.center,this.origin);const i=xi.dot(this.direction),n=xi.dot(xi)-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,xi)}intersectTriangle(t,e,i,n,s){Si.subVectors(e,t),Ei.subVectors(i,t),Ti.crossVectors(Si,Ei);let r,a=this.direction.dot(Ti);if(a>0){if(n)return null;r=1}else{if(!(a<0))return null;r=-1,a=-a}Mi.subVectors(this.origin,t);const o=r*this.direction.dot(Ei.crossVectors(Mi,Ei));if(o<0)return null;const l=r*this.direction.dot(Si.cross(Mi));if(l<0)return null;if(o+l>a)return null;const c=-r*Mi.dot(Ti);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 Ci{constructor(t,e,i,n,s,r,a,o,l,c,h,d,u,p,m,f){Ci.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,i,n,s,r,a,o,l,c,h,d,u,p,m,f)}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 Ci).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/Li.setFromMatrixColumn(t,0).length(),s=1/Li.setFromMatrixColumn(t,1).length(),r=1/Li.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(Ri,t,Pi)}lookAt(t,e,i){const n=this.elements;return Ui.subVectors(t,e),0===Ui.lengthSq()&&(Ui.z=1),Ui.normalize(),Ii.crossVectors(i,Ui),0===Ii.lengthSq()&&(1===Math.abs(i.z)?Ui.x+=1e-4:Ui.z+=1e-4,Ui.normalize(),Ii.crossVectors(i,Ui)),Ii.normalize(),Ni.crossVectors(Ui,Ii),n[0]=Ii.x,n[4]=Ni.x,n[8]=Ui.x,n[1]=Ii.y,n[5]=Ni.y,n[9]=Ui.y,n[2]=Ii.z,n[6]=Ni.z,n[10]=Ui.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],w=n[0],b=n[4],M=n[8],S=n[12],E=n[1],T=n[5],A=n[9],C=n[13],L=n[2],k=n[6],R=n[10],P=n[14],I=n[3],N=n[7],U=n[11],D=n[15];return s[0]=r*w+a*E+o*L+l*I,s[4]=r*b+a*T+o*k+l*N,s[8]=r*M+a*A+o*R+l*U,s[12]=r*S+a*C+o*P+l*D,s[1]=c*w+h*E+d*L+u*I,s[5]=c*b+h*T+d*k+u*N,s[9]=c*M+h*A+d*R+u*U,s[13]=c*S+h*C+d*P+u*D,s[2]=p*w+m*E+f*L+g*I,s[6]=p*b+m*T+f*k+g*N,s[10]=p*M+m*A+f*R+g*U,s[14]=p*S+m*C+f*P+g*D,s[3]=v*w+_*E+y*L+x*I,s[7]=v*b+_*T+y*k+x*N,s[11]=v*M+_*A+y*R+x*U,s[15]=v*S+_*C+y*P+x*D,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,w=e*v+i*_+n*y+s*x;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*s-h*f*s-m*n*u+i*f*u+h*n*g-i*d*g)*b,t[2]=(a*f*s-m*o*s+m*n*l-i*f*l-a*n*g+i*o*g)*b,t[3]=(h*o*s-a*d*s-h*n*l+i*d*l+a*n*u-i*o*u)*b,t[4]=_*b,t[5]=(c*f*s-p*d*s+p*n*u-e*f*u-c*n*g+e*d*g)*b,t[6]=(p*o*s-r*f*s-p*n*l+e*f*l+r*n*g-e*o*g)*b,t[7]=(r*d*s-c*o*s+c*n*l-e*d*l-r*n*u+e*o*u)*b,t[8]=y*b,t[9]=(p*h*s-c*m*s-p*i*u+e*m*u+c*i*g-e*h*g)*b,t[10]=(r*m*s-p*a*s+p*i*l-e*m*l-r*i*g+e*a*g)*b,t[11]=(c*a*s-r*h*s-c*i*l+e*h*l+r*i*u-e*a*u)*b,t[12]=x*b,t[13]=(c*m*n-p*h*n+p*i*d-e*m*d-c*i*f+e*h*f)*b,t[14]=(p*a*n-r*m*n-p*i*o+e*m*o+r*i*f-e*a*f)*b,t[15]=(r*h*n-c*a*n+c*i*o-e*h*o-r*i*d+e*a*d)*b,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 t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):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,w=i.y,b=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)*w,n[5]=(1-(d+g))*w,n[6]=(f+v)*w,n[7]=0,n[8]=(p+_)*b,n[9]=(f-v)*b,n[10]=(1-(d+m))*b,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=Li.set(n[0],n[1],n[2]).length();const r=Li.set(n[4],n[5],n[6]).length(),a=Li.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],ki.copy(this);const o=1/s,l=1/r,c=1/a;return ki.elements[0]*=o,ki.elements[1]*=o,ki.elements[2]*=o,ki.elements[4]*=l,ki.elements[5]*=l,ki.elements[6]*=l,ki.elements[8]*=c,ki.elements[9]*=c,ki.elements[10]*=c,e.setFromRotationMatrix(ki),i.x=s,i.y=r,i.z=a,this}makePerspective(t,e,i,n,s,r,a=2e3){const o=this.elements,l=2*s/(e-t),c=2*s/(i-n),h=(e+t)/(e-t),d=(i+n)/(i-n);let u,p;if(a===ae)u=-(r+s)/(r-s),p=-2*r*s/(r-s);else{if(a!==oe)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);u=-r/(r-s),p=-r*s/(r-s)}return o[0]=l,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=d,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,i,n,s,r,a=2e3){const o=this.elements,l=1/(e-t),c=1/(i-n),h=1/(r-s),d=(e+t)*l,u=(i+n)*c;let p,m;if(a===ae)p=(r+s)*h,m=-2*h;else{if(a!==oe)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);p=s*h,m=-1*h}return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-d,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=m,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[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 Li=new Ke,ki=new Ci,Ri=new Ke(0,0,0),Pi=new Ke(1,1,1),Ii=new Ke,Ni=new Ke,Ui=new Ke,Di=new Ci,Oi=new $e;class Bi{constructor(t=0,e=0,i=0,n=Bi.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(me(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(-me(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(me(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(-me(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(me(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(-me(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 Di.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Di,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Oi.setFromEuler(this),this.setFromQuaternion(Oi,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}}Bi.DEFAULT_ORDER="XYZ";class Fi{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 zi=0;const Hi=new Ke,Gi=new $e,Vi=new Ci,Wi=new Ke,ji=new Ke,qi=new Ke,Xi=new $e,Zi=new Ke(1,0,0),Yi=new Ke(0,1,0),Ji=new Ke(0,0,1),$i={type:"added"},Ki={type:"removed"},Qi={type:"childadded",child:null},tn={type:"childremoved",child:null};class en extends le{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:zi++}),this.uuid=pe(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=en.DEFAULT_UP.clone();const t=new Ke,e=new Bi,i=new $e,n=new Ke(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 Ci},normalMatrix:{value:new Me}}),this.matrix=new Ci,this.matrixWorld=new Ci,this.matrixAutoUpdate=en.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=en.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Fi,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}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 Gi.setFromAxisAngle(t,e),this.quaternion.multiply(Gi),this}rotateOnWorldAxis(t,e){return Gi.setFromAxisAngle(t,e),this.quaternion.premultiply(Gi),this}rotateX(t){return this.rotateOnAxis(Zi,t)}rotateY(t){return this.rotateOnAxis(Yi,t)}rotateZ(t){return this.rotateOnAxis(Ji,t)}translateOnAxis(t,e){return Hi.copy(t).applyQuaternion(this.quaternion),this.position.add(Hi.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(Zi,t)}translateY(t){return this.translateOnAxis(Yi,t)}translateZ(t){return this.translateOnAxis(Ji,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Vi.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?Wi.copy(t):Wi.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),ji.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Vi.lookAt(ji,Wi,this.up):Vi.lookAt(Wi,ji,this.up),this.quaternion.setFromRotationMatrix(Vi),n&&(Vi.extractRotation(n.matrixWorld),Gi.setFromRotationMatrix(Vi),this.quaternion.premultiply(Gi.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($i),Qi.child=t,this.dispatchEvent(Qi),Qi.child=null):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(Ki),tn.child=t,this.dispatchEvent(tn),tn.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Vi.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Vi.multiply(t.parent.matrixWorld)),t.applyMatrix4(Vi),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,i=[]){this[t]===e&&i.push(this);const n=this.children;for(let s=0,r=n.length;s<r;s++)n[s].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ji,t,qi),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ji,Xi,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.6,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.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.visibility=this._visibility,n.active=this._active,n.bounds=this._bounds.map((t=>({boxInitialized:t.boxInitialized,boxMin:t.box.min.toArray(),boxMax:t.box.max.toArray(),sphereInitialized:t.sphereInitialized,sphereRadius:t.sphere.radius,sphereCenter:t.sphere.center.toArray()}))),n.maxGeometryCount=this._maxGeometryCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.geometryCount=this._geometryCount,n.matricesTexture=this._matricesTexture.toJSON(t),null!==this.boundingSphere&&(n.boundingSphere={center:n.boundingSphere.center.toArray(),radius:n.boundingSphere.radius}),null!==this.boundingBox&&(n.boundingBox={min:n.boundingBox.min.toArray(),max:n.boundingBox.max.toArray()})),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.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,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.animations=t.animations.slice(),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}}en.DEFAULT_UP=new Ke(0,1,0),en.DEFAULT_MATRIX_AUTO_UPDATE=!0,en.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const nn=new Ke,sn=new Ke,rn=new Ke,an=new Ke,on=new Ke,ln=new Ke,cn=new Ke,hn=new Ke,dn=new Ke,un=new Ke;class pn{constructor(t=new Ke,e=new Ke,i=new Ke){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,n){n.subVectors(i,e),nn.subVectors(t,e),n.cross(nn);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){nn.subVectors(n,e),sn.subVectors(i,e),rn.subVectors(t,e);const r=nn.dot(nn),a=nn.dot(sn),o=nn.dot(rn),l=sn.dot(sn),c=sn.dot(rn),h=r*l-a*a;if(0===h)return s.set(0,0,0),null;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 null!==this.getBarycoord(t,e,i,n,an)&&(an.x>=0&&an.y>=0&&an.x+an.y<=1)}static getInterpolation(t,e,i,n,s,r,a,o){return null===this.getBarycoord(t,e,i,n,an)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(s,an.x),o.addScaledVector(r,an.y),o.addScaledVector(a,an.z),o)}static isFrontFacing(t,e,i,n){return nn.subVectors(i,e),sn.subVectors(t,e),nn.cross(sn).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 nn.subVectors(this.c,this.b),sn.subVectors(this.a,this.b),.5*nn.cross(sn).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return pn.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return pn.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,n,s){return pn.getInterpolation(t,this.a,this.b,this.c,e,i,n,s)}containsPoint(t){return pn.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return pn.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;on.subVectors(n,i),ln.subVectors(s,i),hn.subVectors(t,i);const o=on.dot(hn),l=ln.dot(hn);if(o<=0&&l<=0)return e.copy(i);dn.subVectors(t,n);const c=on.dot(dn),h=ln.dot(dn);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(on,r);un.subVectors(t,s);const u=on.dot(un),p=ln.dot(un);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(ln,a);const f=c*p-u*h;if(f<=0&&h-c>=0&&u-p>=0)return cn.subVectors(s,n),a=(h-c)/(h-c+(u-p)),e.copy(n).addScaledVector(cn,a);const g=1/(f+m+d);return r=m*g,a=d*g,e.copy(i).addScaledVector(on,r).addScaledVector(ln,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const mn={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},fn={h:0,s:0,l:0},gn={h:0,s:0,l:0};function vn(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 _n{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(void 0===e&&void 0===i){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Wt){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,De.toWorkingColorSpace(this,e),this}setRGB(t,e,i,n=De.workingColorSpace){return this.r=t,this.g=e,this.b=i,De.toWorkingColorSpace(this,n),this}setHSL(t,e,i,n=De.workingColorSpace){if(t=fe(t,1),e=me(e,0,1),i=me(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=vn(s,n,t+1/3),this.g=vn(s,n,t),this.b=vn(s,n,t-1/3)}return De.toWorkingColorSpace(this,n),this}setStyle(t,e=Wt){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 i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,e);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,e);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))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,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=Wt){const i=mn[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=Oe(t.r),this.g=Oe(t.g),this.b=Oe(t.b),this}copyLinearToSRGB(t){return this.r=Be(t.r),this.g=Be(t.g),this.b=Be(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Wt){return De.fromWorkingColorSpace(yn.copy(this),t),65536*Math.round(me(255*yn.r,0,255))+256*Math.round(me(255*yn.g,0,255))+Math.round(me(255*yn.b,0,255))}getHexString(t=Wt){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=De.workingColorSpace){De.fromWorkingColorSpace(yn.copy(this),e);const i=yn.r,n=yn.g,s=yn.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=De.workingColorSpace){return De.fromWorkingColorSpace(yn.copy(this),e),t.r=yn.r,t.g=yn.g,t.b=yn.b,t}getStyle(t=Wt){De.fromWorkingColorSpace(yn.copy(this),t);const e=yn.r,i=yn.g,n=yn.b;return t!==Wt?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*n)})`}offsetHSL(t,e,i){return this.getHSL(fn),this.setHSL(fn.h+t,fn.s+e,fn.l+i)}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(fn),t.getHSL(gn);const i=ge(fn.h,gn.h,e),n=ge(fn.s,gn.s,e),s=ge(fn.l,gn.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 yn=new _n;_n.NAMES=mn;let xn=0;class wn extends le{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:xn++}),this.uuid=pe(),this.name="",this.type="Material",this.blending=1,this.side=o,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=h,this.blendDst=d,this.blendEquation=c,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new _n(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=ie,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Kt,this.stencilZFail=Kt,this.stencilZPass=Kt,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.6,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()),void 0!==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),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.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.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),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!==o&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),this.blendSrc!==h&&(i.blendSrc=this.blendSrc),this.blendDst!==d&&(i.blendDst=this.blendDst),this.blendEquation!==c&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==ie&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Kt&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Kt&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Kt&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),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.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!0===this.wireframe&&(i.wireframe=!0),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=!0),!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.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,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.alphaHash=t.alphaHash,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++}}class bn extends wn{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new _n(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Bi,this.combine=u,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.envMapRotation.copy(t.envMapRotation),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 Mn=Sn();function Sn(){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 En(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=me(t,-65504,65504),Mn.floatView[0]=t;const e=Mn.uint32View[0],i=e>>23&511;return Mn.baseTable[i]+((8388607&e)>>Mn.shiftTable[i])}function Tn(t){const e=t>>10;return Mn.uint32View[0]=Mn.mantissaTable[Mn.offsetTable[e]+(1023&t)]+Mn.exponentTable[e],Mn.floatView[0]}const An={toHalfFloat:En,fromHalfFloat:Tn},Cn=new Ke,Ln=new be;class kn{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=ne,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=W,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}get updateRange(){return Re("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}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.gpuType=t.gpuType,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++)Ln.fromBufferAttribute(this,e),Ln.applyMatrix3(t),this.setXY(e,Ln.x,Ln.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)Cn.fromBufferAttribute(this,e),Cn.applyMatrix3(t),this.setXYZ(e,Cn.x,Cn.y,Cn.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)Cn.fromBufferAttribute(this,e),Cn.applyMatrix4(t),this.setXYZ(e,Cn.x,Cn.y,Cn.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Cn.fromBufferAttribute(this,e),Cn.applyNormalMatrix(t),this.setXYZ(e,Cn.x,Cn.y,Cn.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Cn.fromBufferAttribute(this,e),Cn.transformDirection(t),this.setXYZ(e,Cn.x,Cn.y,Cn.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=ye(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=xe(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=ye(e,this.array)),e}setX(t,e){return this.normalized&&(e=xe(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=ye(e,this.array)),e}setY(t,e){return this.normalized&&(e=xe(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=ye(e,this.array)),e}setZ(t,e){return this.normalized&&(e=xe(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=ye(e,this.array)),e}setW(t,e){return this.normalized&&(e=xe(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=xe(e,this.array),i=xe(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=xe(e,this.array),i=xe(i,this.array),n=xe(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=xe(e,this.array),i=xe(i,this.array),n=xe(n,this.array),s=xe(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!==ne&&(t.usage=this.usage),t}}class Rn extends kn{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class Pn extends kn{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class In extends kn{constructor(t,e,i){super(new Float32Array(t),e,i)}}let Nn=0;const Un=new Ci,Dn=new en,On=new Ke,Bn=new ei,Fn=new ei,zn=new Ke;class Hn extends le{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Nn++}),this.uuid=pe(),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(Ee(t)?Pn:Rn)(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 Me).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 Un.makeRotationFromQuaternion(t),this.applyMatrix4(Un),this}rotateX(t){return Un.makeRotationX(t),this.applyMatrix4(Un),this}rotateY(t){return Un.makeRotationY(t),this.applyMatrix4(Un),this}rotateZ(t){return Un.makeRotationZ(t),this.applyMatrix4(Un),this}translate(t,e,i){return Un.makeTranslation(t,e,i),this.applyMatrix4(Un),this}scale(t,e,i){return Un.makeScale(t,e,i),this.applyMatrix4(Un),this}lookAt(t){return Dn.lookAt(t),Dn.updateMatrix(),this.applyMatrix4(Dn.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(On).negate(),this.translate(On.x,On.y,On.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 In(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new ei);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.",this),void this.boundingBox.set(new Ke(-1/0,-1/0,-1/0),new Ke(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];Bn.setFromBufferAttribute(i),this.morphTargetsRelative?(zn.addVectors(this.boundingBox.min,Bn.min),this.boundingBox.expandByPoint(zn),zn.addVectors(this.boundingBox.max,Bn.max),this.boundingBox.expandByPoint(zn)):(this.boundingBox.expandByPoint(Bn.min),this.boundingBox.expandByPoint(Bn.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 yi);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.",this),void this.boundingSphere.set(new Ke,1/0);if(t){const i=this.boundingSphere.center;if(Bn.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];Fn.setFromBufferAttribute(i),this.morphTargetsRelative?(zn.addVectors(Bn.min,Fn.min),Bn.expandByPoint(zn),zn.addVectors(Bn.max,Fn.max),Bn.expandByPoint(zn)):(Bn.expandByPoint(Fn.min),Bn.expandByPoint(Fn.max))}Bn.getCenter(i);let n=0;for(let e=0,s=t.count;e<s;e++)zn.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(zn));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++)zn.fromBufferAttribute(r,e),a&&(On.fromBufferAttribute(t,e),zn.add(On)),n=Math.max(n,i.distanceToSquared(zn))}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=e.position,n=e.normal,s=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new kn(new Float32Array(4*i.count),4));const r=this.getAttribute("tangent"),a=[],o=[];for(let t=0;t<i.count;t++)a[t]=new Ke,o[t]=new Ke;const l=new Ke,c=new Ke,h=new Ke,d=new be,u=new be,p=new be,m=new Ke,f=new Ke;function g(t,e,n){l.fromBufferAttribute(i,t),c.fromBufferAttribute(i,e),h.fromBufferAttribute(i,n),d.fromBufferAttribute(s,t),u.fromBufferAttribute(s,e),p.fromBufferAttribute(s,n),c.sub(l),h.sub(l),u.sub(d),p.sub(d);const r=1/(u.x*p.y-p.x*u.y);isFinite(r)&&(m.copy(c).multiplyScalar(p.y).addScaledVector(h,-u.y).multiplyScalar(r),f.copy(h).multiplyScalar(u.x).addScaledVector(c,-p.x).multiplyScalar(r),a[t].add(m),a[e].add(m),a[n].add(m),o[t].add(f),o[e].add(f),o[n].add(f))}let v=this.groups;0===v.length&&(v=[{start:0,count:t.count}]);for(let e=0,i=v.length;e<i;++e){const i=v[e],n=i.start;for(let e=n,s=n+i.count;e<s;e+=3)g(t.getX(e+0),t.getX(e+1),t.getX(e+2))}const _=new Ke,y=new Ke,x=new Ke,w=new Ke;function b(t){x.fromBufferAttribute(n,t),w.copy(x);const e=a[t];_.copy(e),_.sub(x.multiplyScalar(x.dot(e))).normalize(),y.crossVectors(w,e);const i=y.dot(o[t])<0?-1:1;r.setXYZW(t,_.x,_.y,_.z,i)}for(let e=0,i=v.length;e<i;++e){const i=v[e],n=i.start;for(let e=n,s=n+i.count;e<s;e+=3)b(t.getX(e+0)),b(t.getX(e+1)),b(t.getX(e+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 kn(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 Ke,s=new Ke,r=new Ke,a=new Ke,o=new Ke,l=new Ke,c=new Ke,h=new Ke;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}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)zn.fromBufferAttribute(t,e),zn.normalize(),t.setXYZ(e,zn.x,zn.y,zn.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 kn(r,n,s)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Hn,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.6,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 Gn=new Ci,Vn=new Ai,Wn=new yi,jn=new Ke,qn=new Ke,Xn=new Ke,Zn=new Ke,Yn=new Ke,Jn=new Ke,$n=new be,Kn=new be,Qn=new be,ts=new Ke,es=new Ke,is=new Ke,ns=new Ke,ss=new Ke;class rs extends en{constructor(t=new Hn,e=new bn){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=Array.isArray(t.material)?t.material.slice():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){Jn.set(0,0,0);for(let i=0,n=s.length;i<n;i++){const n=a[i],o=s[i];0!==n&&(Yn.fromBufferAttribute(o,t),r?Jn.addScaledVector(Yn,n):Jn.addScaledVector(Yn.sub(e),n))}e.add(Jn)}return e}raycast(t,e){const i=this.geometry,n=this.material,s=this.matrixWorld;if(void 0!==n){if(null===i.boundingSphere&&i.computeBoundingSphere(),Wn.copy(i.boundingSphere),Wn.applyMatrix4(s),Vn.copy(t.ray).recast(t.near),!1===Wn.containsPoint(Vn.origin)){if(null===Vn.intersectSphere(Wn,jn))return;if(Vn.origin.distanceToSquared(jn)>(t.far-t.near)**2)return}Gn.copy(s).invert(),Vn.copy(t.ray).applyMatrix4(Gn),null!==i.boundingBox&&!1===Vn.intersectsBox(i.boundingBox)||this._computeIntersections(t,e,Vn)}}_computeIntersections(t,e,i){let n;const s=this.geometry,r=this.material,a=s.index,o=s.attributes.position,l=s.attributes.uv,c=s.attributes.uv1,h=s.attributes.normal,d=s.groups,u=s.drawRange;if(null!==a)if(Array.isArray(r))for(let s=0,o=d.length;s<o;s++){const o=d[s],p=r[o.materialIndex];for(let s=Math.max(o.start,u.start),r=Math.min(a.count,Math.min(o.start+o.count,u.start+u.count));s<r;s+=3){n=as(this,p,t,i,l,c,h,a.getX(s),a.getX(s+1),a.getX(s+2)),n&&(n.faceIndex=Math.floor(s/3),n.face.materialIndex=o.materialIndex,e.push(n))}}else{for(let s=Math.max(0,u.start),o=Math.min(a.count,u.start+u.count);s<o;s+=3){n=as(this,r,t,i,l,c,h,a.getX(s),a.getX(s+1),a.getX(s+2)),n&&(n.faceIndex=Math.floor(s/3),e.push(n))}}else if(void 0!==o)if(Array.isArray(r))for(let s=0,a=d.length;s<a;s++){const a=d[s],p=r[a.materialIndex];for(let s=Math.max(a.start,u.start),r=Math.min(o.count,Math.min(a.start+a.count,u.start+u.count));s<r;s+=3){n=as(this,p,t,i,l,c,h,s,s+1,s+2),n&&(n.faceIndex=Math.floor(s/3),n.face.materialIndex=a.materialIndex,e.push(n))}}else{for(let s=Math.max(0,u.start),a=Math.min(o.count,u.start+u.count);s<a;s+=3){n=as(this,r,t,i,l,c,h,s,s+1,s+2),n&&(n.faceIndex=Math.floor(s/3),e.push(n))}}}}function as(t,e,i,n,s,r,a,c,h,d){t.getVertexPosition(c,qn),t.getVertexPosition(h,Xn),t.getVertexPosition(d,Zn);const u=function(t,e,i,n,s,r,a,c){let h;if(h=e.side===l?n.intersectTriangle(a,r,s,!0,c):n.intersectTriangle(s,r,a,e.side===o,c),null===h)return null;ss.copy(c),ss.applyMatrix4(t.matrixWorld);const d=i.ray.origin.distanceTo(ss);return d<i.near||d>i.far?null:{distance:d,point:ss.clone(),object:t}}(t,e,i,n,qn,Xn,Zn,ns);if(u){s&&($n.fromBufferAttribute(s,c),Kn.fromBufferAttribute(s,h),Qn.fromBufferAttribute(s,d),u.uv=pn.getInterpolation(ns,qn,Xn,Zn,$n,Kn,Qn,new be)),r&&($n.fromBufferAttribute(r,c),Kn.fromBufferAttribute(r,h),Qn.fromBufferAttribute(r,d),u.uv1=pn.getInterpolation(ns,qn,Xn,Zn,$n,Kn,Qn,new be)),a&&(ts.fromBufferAttribute(a,c),es.fromBufferAttribute(a,h),is.fromBufferAttribute(a,d),u.normal=pn.getInterpolation(ns,qn,Xn,Zn,ts,es,is,new Ke),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const t={a:c,b:h,c:d,normal:new Ke,materialIndex:0};pn.getNormal(qn,Xn,Zn,t.normal),u.face=t}return u}class os extends Hn{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,w=p/2,b=m/2,M=f+1,S=g+1;let E=0,T=0;const A=new Ke;for(let r=0;r<S;r++){const a=r*y-w;for(let o=0;o<M;o++){const d=o*_-x;A[t]=d*n,A[e]=a*s,A[i]=b,l.push(A.x,A.y,A.z),A[t]=0,A[e]=0,A[i]=m>0?1:-1,c.push(A.x,A.y,A.z),h.push(o/f),h.push(1-r/g),E+=1}}for(let t=0;t<g;t++)for(let e=0;e<f;e++){const i=d+e+M*t,n=d+e+M*(t+1),s=d+(e+1)+M*(t+1),r=d+(e+1)+M*t;o.push(i,n,r),o.push(n,s,r),T+=6}a.addGroup(u,T,v),u+=T,d+=E}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 In(l,3)),this.setAttribute("normal",new In(c,3)),this.setAttribute("uv",new In(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new os(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function ls(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 cs(t){const e={};for(let i=0;i<t.length;i++){const n=ls(t[i]);for(const t in n)e[t]=n[t]}return e}function hs(t){return null===t.getRenderTarget()?t.outputColorSpace:De.workingColorSpace}const ds={clone:ls,merge:cs};class us extends wn{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,clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=ls(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,e.lights=this.lights,e.clipping=this.clipping;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}}let ps=class extends en{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ci,this.projectionMatrix=new Ci,this.projectionMatrixInverse=new Ci,this.coordinateSystem=ae}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}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)}};const ms=new Ke,fs=new be,gs=new be;class vs extends ps{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*ue*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*de*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*ue*Math.atan(Math.tan(.5*de*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,i){ms.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(ms.x,ms.y).multiplyScalar(-t/ms.z),ms.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(ms.x,ms.y).multiplyScalar(-t/ms.z)}getViewSize(t,e){return this.getViewBounds(t,fs,gs),e.subVectors(gs,fs)}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*de*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.coordinateSystem),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 _s=-90;class ys extends en{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const n=new vs(_s,1,t,e);n.layers=this.layers,this.add(n);const s=new vs(_s,1,t,e);s.layers=this.layers,this.add(s);const r=new vs(_s,1,t,e);r.layers=this.layers,this.add(r);const a=new vs(_s,1,t,e);a.layers=this.layers,this.add(a);const o=new vs(_s,1,t,e);o.layers=this.layers,this.add(o);const l=new vs(_s,1,t,e);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[i,n,s,r,a,o]=e;for(const t of e)this.remove(t);if(t===ae)i.up.set(0,1,0),i.lookAt(1,0,0),n.up.set(0,1,0),n.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),r.up.set(0,0,1),r.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(t!==oe)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);i.up.set(0,-1,0),i.lookAt(-1,0,0),n.up.set(0,-1,0),n.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),r.up.set(0,0,-1),r.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:n}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[s,r,a,o,l,c]=this.children,h=t.getRenderTarget(),d=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;const m=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0,n),t.render(e,s),t.setRenderTarget(i,1,n),t.render(e,r),t.setRenderTarget(i,2,n),t.render(e,a),t.setRenderTarget(i,3,n),t.render(e,o),t.setRenderTarget(i,4,n),t.render(e,l),i.texture.generateMipmaps=m,t.setRenderTarget(i,5,n),t.render(e,c),t.setRenderTarget(h,d,u),t.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class xs extends je{constructor(t,e,i,n,s,r,a,o,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:T,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 ws extends Ze{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 xs(n,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:O}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,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 os(5,5,5),s=new us({name:"CubemapFromEquirect",uniforms:ls(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:l,blending:0});s.uniforms.tEquirect.value=e;const r=new rs(n,s),a=e.minFilter;e.minFilter===F&&(e.minFilter=O);return new ys(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 bs=new Ke,Ms=new Ke,Ss=new Me;class Es{constructor(t=new Ke(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=bs.subVectors(i,e).cross(Ms.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(bs),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||Ss.getNormalMatrix(t),n=this.coplanarPoint(bs).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 Ts=new yi,As=new Ke;class Cs{constructor(t=new Es,e=new Es,i=new Es,n=new Es,s=new Es,r=new Es){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,e=2e3){const i=this.planes,n=t.elements,s=n[0],r=n[1],a=n[2],o=n[3],l=n[4],c=n[5],h=n[6],d=n[7],u=n[8],p=n[9],m=n[10],f=n[11],g=n[12],v=n[13],_=n[14],y=n[15];if(i[0].setComponents(o-s,d-l,f-u,y-g).normalize(),i[1].setComponents(o+s,d+l,f+u,y+g).normalize(),i[2].setComponents(o+r,d+c,f+p,y+v).normalize(),i[3].setComponents(o-r,d-c,f-p,y-v).normalize(),i[4].setComponents(o-a,d-h,f-m,y-_).normalize(),e===ae)i[5].setComponents(o+a,d+h,f+m,y+_).normalize();else{if(e!==oe)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);i[5].setComponents(a,h,m,_).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),Ts.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),Ts.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Ts)}intersectsSprite(t){return Ts.center.set(0,0,0),Ts.radius=.7071067811865476,Ts.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ts)}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(As.x=n.normal.x>0?t.max.x:t.min.x,As.y=n.normal.y>0?t.max.y:t.min.y,As.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(As)<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 Ls(){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 ks(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);if(void 0===r)n.set(e,function(e,n){const s=e.array,r=e.usage,a=s.byteLength,o=t.createBuffer();let l;if(t.bindBuffer(n,o),t.bufferData(n,s,r),e.onUploadCallback(),s instanceof Float32Array)l=t.FLOAT;else if(s instanceof Uint16Array)if(e.isFloat16BufferAttribute){if(!i)throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");l=t.HALF_FLOAT}else l=t.UNSIGNED_SHORT;else if(s instanceof Int16Array)l=t.SHORT;else if(s instanceof Uint32Array)l=t.UNSIGNED_INT;else if(s instanceof Int32Array)l=t.INT;else if(s instanceof Int8Array)l=t.BYTE;else if(s instanceof Uint8Array)l=t.UNSIGNED_BYTE;else{if(!(s instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+s);l=t.UNSIGNED_BYTE}return{buffer:o,type:l,bytesPerElement:s.BYTES_PER_ELEMENT,version:e.version,size:a}}(e,s));else if(r.version<e.version){if(r.size!==e.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(e,n,s){const r=n.array,a=n._updateRange,o=n.updateRanges;if(t.bindBuffer(s,e),-1===a.count&&0===o.length&&t.bufferSubData(s,0,r),0!==o.length){for(let e=0,n=o.length;e<n;e++){const n=o[e];i?t.bufferSubData(s,n.start*r.BYTES_PER_ELEMENT,r,n.start,n.count):t.bufferSubData(s,n.start*r.BYTES_PER_ELEMENT,r.subarray(n.start,n.start+n.count))}n.clearUpdateRanges()}-1!==a.count&&(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 Rs extends Hn{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 In(p,3)),this.setAttribute("normal",new In(m,3)),this.setAttribute("uv",new In(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Rs(t.width,t.height,t.widthSegments,t.heightSegments)}}const Ps={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\tattribute float batchId;\n\tuniform highp sampler2D batchingTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( batchId );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\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};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\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_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\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, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && 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\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[MORPHTARGETS_COUNT];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && 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\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t#endif\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\t#ifndef USE_INSTANCING_MORPH\n\t\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\t#endif\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#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\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_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat 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\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 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}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tfloat startCompression = 0.8 - 0.04;\n\tfloat desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min(color.r, min(color.g, color.b));\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max(color.r, max(color.g, color.b));\n\tif (peak < startCompression) return color;\n\tfloat d = 1. - startCompression;\n\tfloat newPeak = 1. - d * d / (peak + d - startCompression);\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);\n\treturn mix(color, vec3(1, 1, 1), g);\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float 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 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * 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 <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},Is={common:{diffuse:{value:new _n(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Me},alphaMap:{value:null},alphaMapTransform:{value:new Me},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Me}},envmap:{envMap:{value:null},envMapRotation:{value:new Me},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Me}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Me}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Me},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Me},normalScale:{value:new be(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Me},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Me}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Me}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Me}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new _n(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 _n(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Me},alphaTest:{value:0},uvTransform:{value:new Me}},sprite:{diffuse:{value:new _n(16777215)},opacity:{value:1},center:{value:new be(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Me},alphaMap:{value:null},alphaMapTransform:{value:new Me},alphaTest:{value:0}}},Ns={basic:{uniforms:cs([Is.common,Is.specularmap,Is.envmap,Is.aomap,Is.lightmap,Is.fog]),vertexShader:Ps.meshbasic_vert,fragmentShader:Ps.meshbasic_frag},lambert:{uniforms:cs([Is.common,Is.specularmap,Is.envmap,Is.aomap,Is.lightmap,Is.emissivemap,Is.bumpmap,Is.normalmap,Is.displacementmap,Is.fog,Is.lights,{emissive:{value:new _n(0)}}]),vertexShader:Ps.meshlambert_vert,fragmentShader:Ps.meshlambert_frag},phong:{uniforms:cs([Is.common,Is.specularmap,Is.envmap,Is.aomap,Is.lightmap,Is.emissivemap,Is.bumpmap,Is.normalmap,Is.displacementmap,Is.fog,Is.lights,{emissive:{value:new _n(0)},specular:{value:new _n(1118481)},shininess:{value:30}}]),vertexShader:Ps.meshphong_vert,fragmentShader:Ps.meshphong_frag},standard:{uniforms:cs([Is.common,Is.envmap,Is.aomap,Is.lightmap,Is.emissivemap,Is.bumpmap,Is.normalmap,Is.displacementmap,Is.roughnessmap,Is.metalnessmap,Is.fog,Is.lights,{emissive:{value:new _n(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ps.meshphysical_vert,fragmentShader:Ps.meshphysical_frag},toon:{uniforms:cs([Is.common,Is.aomap,Is.lightmap,Is.emissivemap,Is.bumpmap,Is.normalmap,Is.displacementmap,Is.gradientmap,Is.fog,Is.lights,{emissive:{value:new _n(0)}}]),vertexShader:Ps.meshtoon_vert,fragmentShader:Ps.meshtoon_frag},matcap:{uniforms:cs([Is.common,Is.bumpmap,Is.normalmap,Is.displacementmap,Is.fog,{matcap:{value:null}}]),vertexShader:Ps.meshmatcap_vert,fragmentShader:Ps.meshmatcap_frag},points:{uniforms:cs([Is.points,Is.fog]),vertexShader:Ps.points_vert,fragmentShader:Ps.points_frag},dashed:{uniforms:cs([Is.common,Is.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ps.linedashed_vert,fragmentShader:Ps.linedashed_frag},depth:{uniforms:cs([Is.common,Is.displacementmap]),vertexShader:Ps.depth_vert,fragmentShader:Ps.depth_frag},normal:{uniforms:cs([Is.common,Is.bumpmap,Is.normalmap,Is.displacementmap,{opacity:{value:1}}]),vertexShader:Ps.meshnormal_vert,fragmentShader:Ps.meshnormal_frag},sprite:{uniforms:cs([Is.sprite,Is.fog]),vertexShader:Ps.sprite_vert,fragmentShader:Ps.sprite_frag},background:{uniforms:{uvTransform:{value:new Me},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ps.background_vert,fragmentShader:Ps.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Me}},vertexShader:Ps.backgroundCube_vert,fragmentShader:Ps.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ps.cube_vert,fragmentShader:Ps.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ps.equirect_vert,fragmentShader:Ps.equirect_frag},distanceRGBA:{uniforms:cs([Is.common,Is.displacementmap,{referencePosition:{value:new Ke},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ps.distanceRGBA_vert,fragmentShader:Ps.distanceRGBA_frag},shadow:{uniforms:cs([Is.lights,Is.fog,{color:{value:new _n(0)},opacity:{value:1}}]),vertexShader:Ps.shadow_vert,fragmentShader:Ps.shadow_frag}};Ns.physical={uniforms:cs([Ns.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Me},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Me},clearcoatNormalScale:{value:new be(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Me},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Me},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Me},sheen:{value:0},sheenColor:{value:new _n(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Me},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Me},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Me},transmissionSamplerSize:{value:new be},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Me},attenuationDistance:{value:0},attenuationColor:{value:new _n(0)},specularColor:{value:new _n(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Me},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Me},anisotropyVector:{value:new be},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Me}}]),vertexShader:Ps.meshphysical_vert,fragmentShader:Ps.meshphysical_frag};const Us={r:0,b:0,g:0},Ds=new Bi,Os=new Ci;function Bs(t,e,i,n,s,r,a){const c=new _n(0);let h,d,u=!0===r?0:1,p=null,m=0,f=null;function g(e,i){e.getRGB(Us,hs(t)),n.buffers.color.setClear(Us.r,Us.g,Us.b,i,a)}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(r,v){let _=!1,y=!0===v.isScene?v.background:null;if(y&&y.isTexture){y=(v.backgroundBlurriness>0?i:e).get(y)}null===y?g(c,u):y&&y.isColor&&(g(y,1),_=!0);const x=t.xr.getEnvironmentBlendMode();"additive"===x?n.buffers.color.setClear(0,0,0,1,a):"alpha-blend"===x&&n.buffers.color.setClear(0,0,0,0,a),(t.autoClear||_)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),y&&(y.isCubeTexture||y.mapping===k)?(void 0===d&&(d=new rs(new os(1,1,1),new us({name:"BackgroundCubeMaterial",uniforms:ls(Ns.backgroundCube.uniforms),vertexShader:Ns.backgroundCube.vertexShader,fragmentShader:Ns.backgroundCube.fragmentShader,side:l,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)),Ds.copy(v.backgroundRotation),Ds.x*=-1,Ds.y*=-1,Ds.z*=-1,y.isCubeTexture&&!1===y.isRenderTargetTexture&&(Ds.y*=-1,Ds.z*=-1),d.material.uniforms.envMap.value=y,d.material.uniforms.flipEnvMap.value=y.isCubeTexture&&!1===y.isRenderTargetTexture?-1:1,d.material.uniforms.backgroundBlurriness.value=v.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(Os.makeRotationFromEuler(Ds)),d.material.toneMapped=De.getTransfer(y.colorSpace)!==Yt,p===y&&m===y.version&&f===t.toneMapping||(d.material.needsUpdate=!0,p=y,m=y.version,f=t.toneMapping),d.layers.enableAll(),r.unshift(d,d.geometry,d.material,0,0,null)):y&&y.isTexture&&(void 0===h&&(h=new rs(new Rs(2,2),new us({name:"BackgroundMaterial",uniforms:ls(Ns.background.uniforms),vertexShader:Ns.background.vertexShader,fragmentShader:Ns.background.fragmentShader,side:o,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=y,h.material.uniforms.backgroundIntensity.value=v.backgroundIntensity,h.material.toneMapped=De.getTransfer(y.colorSpace)!==Yt,!0===y.matrixAutoUpdate&&y.updateMatrix(),h.material.uniforms.uvTransform.value.copy(y.matrix),p===y&&m===y.version&&f===t.toneMapping||(h.material.needsUpdate=!0,p=y,m=y.version,f=t.toneMapping),h.layers.enableAll(),r.unshift(h,h.geometry,h.material,0,0,null))}}}function Fs(t,e,i,n){const s=t.getParameter(t.MAX_VERTEX_ATTRIBS),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,n,s,r,a,o){!0===o?t.vertexAttribIPointer(e,i,n,r,a):t.vertexAttribPointer(e,i,n,s,r,a)}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 w=!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)),w=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),w&&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,w=!0)}null!==x&&i.update(x,t.ELEMENT_ARRAY_BUFFER),(w||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 r=c[e];if(r.location>=0){let a=l[e];if(void 0===a&&("instanceMatrix"===e&&s.instanceMatrix&&(a=s.instanceMatrix),"instanceColor"===e&&s.instanceColor&&(a=s.instanceColor)),void 0!==a){const e=a.normalized,l=a.itemSize,c=i.get(a);if(void 0===c)continue;const h=c.buffer,d=c.type,u=c.bytesPerElement,p=!0===n.isWebGL2&&(d===t.INT||d===t.UNSIGNED_INT||a.gpuType===G);if(a.isInterleavedBufferAttribute){const i=a.data,n=i.stride,c=a.offset;if(i.isInstancedInterleavedBuffer){for(let t=0;t<r.locationSize;t++)g(r.location+t,i.meshPerAttribute);!0!==s.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=i.meshPerAttribute*i.count)}else for(let t=0;t<r.locationSize;t++)f(r.location+t);t.bindBuffer(t.ARRAY_BUFFER,h);for(let t=0;t<r.locationSize;t++)_(r.location+t,l/r.locationSize,d,e,n*u,(c+l/r.locationSize*t)*u,p)}else{if(a.isInstancedBufferAttribute){for(let t=0;t<r.locationSize;t++)g(r.location+t,a.meshPerAttribute);!0!==s.isInstancedMesh&&void 0===o._maxInstanceCount&&(o._maxInstanceCount=a.meshPerAttribute*a.count)}else for(let t=0;t<r.locationSize;t++)f(r.location+t);t.bindBuffer(t.ARRAY_BUFFER,h);for(let t=0;t<r.locationSize;t++)_(r.location+t,l/r.locationSize,d,e,l*u,l/r.locationSize*t*u,p)}}else if(void 0!==h){const i=h[e];if(void 0!==i)switch(i.length){case 2:t.vertexAttrib2fv(r.location,i);break;case 3:t.vertexAttrib3fv(r.location,i);break;case 4:t.vertexAttrib4fv(r.location,i);break;default:t.vertexAttrib1fv(r.location,i)}}}}v()}(s,l,u,y),null!==x&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,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 zs(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)},this.renderMultiDraw=function(t,n,s){if(0===s)return;const a=e.get("WEBGL_multi_draw");if(null===a)for(let e=0;e<s;e++)this.render(t[e],n[e]);else{a.multiDrawArraysWEBGL(r,t,0,n,0,s);let e=0;for(let t=0;t<s;t++)e+=n[t];i.update(e,r,1)}}}function Hs(t,e,i){let n;function s(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}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(t.MAX_TEXTURE_IMAGE_UNITS),d=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_TEXTURE_SIZE),p=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),m=t.getParameter(t.MAX_VERTEX_ATTRIBS),f=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),g=t.getParameter(t.MAX_VARYING_VECTORS),v=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),_=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(t.MAX_SAMPLES):0}}function Gs(t){const e=this;let i=null,n=0,s=!1,r=!1;const a=new Es,o=new Me,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 Vs(t){let e=new WeakMap;function i(t,e){return e===C?t.mapping=T:e===L&&(t.mapping=A),t}function n(t){const i=t.target;i.removeEventListener("dispose",n);const s=e.get(i);void 0!==s&&(e.delete(i),s.dispose())}return{get:function(s){if(s&&s.isTexture){const r=s.mapping;if(r===C||r===L){if(e.has(s)){return i(e.get(s).texture,s.mapping)}{const r=s.image;if(r&&r.height>0){const a=new ws(r.height);return a.fromEquirectangularTexture(t,s),e.set(s,a),s.addEventListener("dispose",n),i(a.texture,s.mapping)}return null}}}return s},dispose:function(){e=new WeakMap}}}class Ws extends ps{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.coordinateSystem),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 js=[.125,.215,.35,.446,.526,.582],qs=20,Xs=new Ws,Zs=new _n;let Ys=null,Js=0,$s=0;const Ks=(1+Math.sqrt(5))/2,Qs=1/Ks,tr=[new Ke(1,1,1),new Ke(-1,1,1),new Ke(1,1,-1),new Ke(-1,1,-1),new Ke(0,Ks,Qs),new Ke(0,Ks,-Qs),new Ke(Qs,0,Ks),new Ke(-Qs,0,Ks),new Ke(Ks,Qs,0),new Ke(-Ks,Qs,0)];class er{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){Ys=this._renderer.getRenderTarget(),Js=this._renderer.getActiveCubeFace(),$s=this._renderer.getActiveMipmapLevel(),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=rr(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=sr(),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(Ys,Js,$s),t.scissorTest=!1,nr(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===T||t.mapping===A?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),Ys=this._renderer.getRenderTarget(),Js=this._renderer.getActiveCubeFace(),$s=this._renderer.getActiveMipmapLevel();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:O,minFilter:O,generateMipmaps:!1,type:j,format:Y,colorSpace:jt,depthBuffer:!1},n=ir(t,e,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=ir(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+js.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=js[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 Hn;x.setAttribute("position",new kn(v,m)),x.setAttribute("uv",new kn(_,f)),x.setAttribute("faceIndex",new kn(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(qs),s=new Ke(0,1,0),r=new us({name:"SphericalGaussianBlur",defines:{n:qs,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:ar(),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 rs(this._lodPlanes[0],t);this._renderer.compile(e,Xs)}_sceneToCubeUV(t,e,i,n){const s=new vs(90,1,e,i),r=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],o=this._renderer,c=o.autoClear,h=o.toneMapping;o.getClearColor(Zs),o.toneMapping=f,o.autoClear=!1;const d=new bn({name:"PMREM.Background",side:l,depthWrite:!1,depthTest:!1}),u=new rs(new os,d);let p=!1;const m=t.background;m?m.isColor&&(d.color.copy(m),t.background=null,p=!0):(d.color.copy(Zs),p=!0);for(let e=0;e<6;e++){const i=e%3;0===i?(s.up.set(0,r[e],0),s.lookAt(a[e],0,0)):1===i?(s.up.set(0,0,r[e]),s.lookAt(0,a[e],0)):(s.up.set(0,r[e],0),s.lookAt(0,0,a[e]));const l=this._cubeSize;nr(n,i*l,e>2?l:0,l,l),o.setRenderTarget(n),p&&o.render(u,s),o.render(t,s)}u.geometry.dispose(),u.material.dispose(),o.toneMapping=h,o.autoClear=c,t.background=m}_textureToCubeUV(t,e){const i=this._renderer,n=t.mapping===T||t.mapping===A;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=rr()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=sr());const s=n?this._cubemapMaterial:this._equirectMaterial,r=new rs(this._lodPlanes[0],s);s.uniforms.envMap.value=t;const a=this._cubeSize;nr(e,0,0,3*a,2*a),i.setRenderTarget(e),i.render(r,Xs)}_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=tr[(e-1)%tr.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 rs(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):qs;m>qs&&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<qs;++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];nr(e,3*_*(n>v-4?n-v+4:0),4*(this._cubeSize-_),3*_,2*_),o.setRenderTarget(e),o.render(c,Xs)}}function ir(t,e,i){const n=new Ze(t,e,i);return n.texture.mapping=k,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function nr(t,e,i,n,s){t.viewport.set(e,i,n,s),t.scissor.set(e,i,n,s)}function sr(){return new us({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ar(),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 rr(){return new us({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ar(),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 ar(){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 or(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===C||r===L,o=r===T||r===A;if(a||o){if(s.isRenderTargetTexture&&!0===s.needsPMREMUpdate){s.needsPMREMUpdate=!1;let n=e.get(s);return null===i&&(i=new er(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 er(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 lr(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_clip_cull_distance")):(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 cr(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]);for(const t in o.morphAttributes){const i=o.morphAttributes[t];for(let t=0,n=i.length;t<n;t++)e.remove(i[t])}o.removeEventListener("dispose",a),delete s[o.id];const l=r.get(o);l&&(e.remove(l),r.delete(o)),n.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,i.memory.geometries--}function o(t){const i=[],n=t.index,s=t.attributes.position;let a=0;if(null!==n){const t=n.array;a=n.version;for(let e=0,n=t.length;e<n;e+=3){const n=t[e+0],s=t[e+1],r=t[e+2];i.push(n,s,s,r,r,n)}}else{if(void 0===s)return;{const t=s.array;a=s.version;for(let e=0,n=t.length/3-1;e<n;e+=3){const t=e+0,n=e+1,s=e+2;i.push(t,n,n,s,s,t)}}}const o=new(Ee(i)?Pn:Rn)(i,1);o.version=a;const l=r.get(t);l&&e.remove(l),r.set(t,o)}return{get:function(t,e){return!0===s[e.id]||(e.addEventListener("dispose",a),s[e.id]=!0,i.memory.geometries++),e},update:function(i){const n=i.attributes;for(const i in n)e.update(n[i],t.ARRAY_BUFFER);const s=i.morphAttributes;for(const i in s){const n=s[i];for(let i=0,s=n.length;i<s;i++)e.update(n[i],t.ARRAY_BUFFER)}},getWireframeAttribute:function(t){const e=r.get(t);if(e){const i=t.index;null!==i&&e.version<i.version&&o(t)}else o(t);return r.get(t)}}}function hr(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)},this.renderMultiDraw=function(t,n,s){if(0===s)return;const l=e.get("WEBGL_multi_draw");if(null===l)for(let e=0;e<s;e++)this.render(t[e]/o,n[e]);else{l.multiDrawElementsWEBGL(r,n,0,a,t,0,s);let e=0;for(let t=0;t<s;t++)e+=n[t];i.update(e,r,1)}}}function dr(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(i,n,s){switch(e.calls++,n){case t.TRIANGLES:e.triangles+=s*(i/3);break;case t.LINES:e.lines+=s*(i/2);break;case t.LINE_STRIP:e.lines+=s*(i-1);break;case t.LINE_LOOP:e.lines+=s*i;break;case t.POINTS:e.points+=s*i;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function ur(t,e){return t[0]-e[0]}function pr(t,e){return Math.abs(e[1])-Math.abs(t[1])}function mr(t,e,i){const n={},s=new Float32Array(8),r=new WeakMap,a=new qe,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 u=c.morphAttributes.position||c.morphAttributes.normal||c.morphAttributes.color,p=void 0!==u?u.length:0;let m=r.get(c);if(void 0===m||m.count!==p){void 0!==m&&m.texture.dispose();const f=void 0!==c.morphAttributes.position,g=void 0!==c.morphAttributes.normal,v=void 0!==c.morphAttributes.color,_=c.morphAttributes.position||[],y=c.morphAttributes.normal||[],x=c.morphAttributes.color||[];let w=0;!0===f&&(w=1),!0===g&&(w=2),!0===v&&(w=3);let b=c.attributes.position.count*w,M=1;b>e.maxTextureSize&&(M=Math.ceil(b/e.maxTextureSize),b=e.maxTextureSize);const S=new Float32Array(b*M*4*p),E=new Ye(S,b,M,p);E.type=W,E.needsUpdate=!0;const T=4*w;for(let C=0;C<p;C++){const L=_[C],k=y[C],R=x[C],P=b*M*4*C;for(let I=0;I<L.count;I++){const N=I*T;!0===f&&(a.fromBufferAttribute(L,I),S[P+N+0]=a.x,S[P+N+1]=a.y,S[P+N+2]=a.z,S[P+N+3]=0),!0===g&&(a.fromBufferAttribute(k,I),S[P+N+4]=a.x,S[P+N+5]=a.y,S[P+N+6]=a.z,S[P+N+7]=0),!0===v&&(a.fromBufferAttribute(R,I),S[P+N+8]=a.x,S[P+N+9]=a.y,S[P+N+10]=a.z,S[P+N+11]=4===R.itemSize?a.w:1)}}function A(){E.dispose(),r.delete(c),c.removeEventListener("dispose",A)}m={count:p,texture:E,size:new be(b,M)},r.set(c,m),c.addEventListener("dispose",A)}if(!0===l.isInstancedMesh&&null!==l.morphTexture)h.getUniforms().setValue(t,"morphTexture",l.morphTexture,i);else{let U=0;for(let O=0;O<d.length;O++)U+=d[O];const D=c.morphTargetsRelative?1:1-U;h.getUniforms().setValue(t,"morphTargetBaseInfluence",D),h.getUniforms().setValue(t,"morphTargetInfluences",d)}h.getUniforms().setValue(t,"morphTargetsTexture",m.texture,i),h.getUniforms().setValue(t,"morphTargetsTextureSize",m.size)}else{const B=void 0===d?0:d.length;let F=n[c.id];if(void 0===F||F.length!==B){F=[];for(let j=0;j<B;j++)F[j]=[j,0];n[c.id]=F}for(let q=0;q<B;q++){const X=F[q];X[0]=q,X[1]=d[q]}F.sort(pr);for(let Z=0;Z<8;Z++)Z<B&&F[Z][1]?(o[Z][0]=F[Z][0],o[Z][1]=F[Z][1]):(o[Z][0]=Number.MAX_SAFE_INTEGER,o[Z][1]=0);o.sort(ur);const z=c.morphAttributes.position,H=c.morphAttributes.normal;let G=0;for(let Y=0;Y<8;Y++){const J=o[Y],$=J[0],K=J[1];$!==Number.MAX_SAFE_INTEGER&&K?(z&&c.getAttribute("morphTarget"+Y)!==z[$]&&c.setAttribute("morphTarget"+Y,z[$]),H&&c.getAttribute("morphNormal"+Y)!==H[$]&&c.setAttribute("morphNormal"+Y,H[$]),s[Y]=K,G+=K):(z&&!0===c.hasAttribute("morphTarget"+Y)&&c.deleteAttribute("morphTarget"+Y),H&&!0===c.hasAttribute("morphNormal"+Y)&&c.deleteAttribute("morphNormal"+Y),s[Y]=0)}const V=c.morphTargetsRelative?1:1-G;h.getUniforms().setValue(t,"morphTargetBaseInfluence",V),h.getUniforms().setValue(t,"morphTargetInfluences",s)}}}}function fr(t,e,i,n){let s=new WeakMap;function r(t){const e=t.target;e.removeEventListener("dispose",r),i.remove(e.instanceMatrix),null!==e.instanceColor&&i.remove(e.instanceColor)}return{update:function(a){const o=n.render.frame,l=a.geometry,c=e.get(a,l);if(s.get(c)!==o&&(e.update(c),s.set(c,o)),a.isInstancedMesh&&(!1===a.hasEventListener("dispose",r)&&a.addEventListener("dispose",r),s.get(a)!==o&&(i.update(a.instanceMatrix,t.ARRAY_BUFFER),null!==a.instanceColor&&i.update(a.instanceColor,t.ARRAY_BUFFER),s.set(a,o))),a.isSkinnedMesh){const t=a.skeleton;s.get(t)!==o&&(t.update(),s.set(t,o))}return c},dispose:function(){s=new WeakMap}}}class gr extends je{constructor(t,e,i,n,s,r,a,o,l,c){if((c=void 0!==c?c:J)!==J&&c!==$)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&c===J&&(i=V),void 0===i&&c===$&&(i=Z),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:N,this.minFilter=void 0!==o?o:N,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}const vr=new je,_r=new gr(1,1);_r.compareFunction=515;const yr=new Ye,xr=new Je,wr=new xs,br=[],Mr=[],Sr=new Float32Array(16),Er=new Float32Array(9),Tr=new Float32Array(4);function Ar(t,e,i){const n=t[0];if(n<=0||n>0)return t;const s=e*i;let r=br[s];if(void 0===r&&(r=new Float32Array(s),br[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 Cr(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 Lr(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function kr(t,e){let i=Mr[e];void 0===i&&(i=new Int32Array(e),Mr[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function Rr(t,e){const i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function Pr(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(Cr(i,e))return;t.uniform2fv(this.addr,e),Lr(i,e)}}function Ir(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(Cr(i,e))return;t.uniform3fv(this.addr,e),Lr(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&&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(Cr(i,e))return;t.uniform4fv(this.addr,e),Lr(i,e)}}function Ur(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Cr(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),Lr(i,e)}else{if(Cr(i,n))return;Tr.set(n),t.uniformMatrix2fv(this.addr,!1,Tr),Lr(i,n)}}function Dr(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Cr(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),Lr(i,e)}else{if(Cr(i,n))return;Er.set(n),t.uniformMatrix3fv(this.addr,!1,Er),Lr(i,n)}}function Or(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Cr(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),Lr(i,e)}else{if(Cr(i,n))return;Sr.set(n),t.uniformMatrix4fv(this.addr,!1,Sr),Lr(i,n)}}function Br(t,e){const i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function Fr(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(Cr(i,e))return;t.uniform2iv(this.addr,e),Lr(i,e)}}function zr(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(Cr(i,e))return;t.uniform3iv(this.addr,e),Lr(i,e)}}function Hr(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(Cr(i,e))return;t.uniform4iv(this.addr,e),Lr(i,e)}}function Gr(t,e){const i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function Vr(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(Cr(i,e))return;t.uniform2uiv(this.addr,e),Lr(i,e)}}function Wr(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(Cr(i,e))return;t.uniform3uiv(this.addr,e),Lr(i,e)}}function jr(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(Cr(i,e))return;t.uniform4uiv(this.addr,e),Lr(i,e)}}function qr(t,e,i){const n=this.cache,s=i.allocateTextureUnit();n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s);const r=this.type===t.SAMPLER_2D_SHADOW?_r:vr;i.setTexture2D(e||r,s)}function Xr(t,e,i){const n=this.cache,s=i.allocateTextureUnit();n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),i.setTexture3D(e||xr,s)}function Zr(t,e,i){const n=this.cache,s=i.allocateTextureUnit();n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),i.setTextureCube(e||wr,s)}function Yr(t,e,i){const n=this.cache,s=i.allocateTextureUnit();n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),i.setTexture2DArray(e||yr,s)}function Jr(t,e){t.uniform1fv(this.addr,e)}function $r(t,e){const i=Ar(e,this.size,2);t.uniform2fv(this.addr,i)}function Kr(t,e){const i=Ar(e,this.size,3);t.uniform3fv(this.addr,i)}function Qr(t,e){const i=Ar(e,this.size,4);t.uniform4fv(this.addr,i)}function ta(t,e){const i=Ar(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function ea(t,e){const i=Ar(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function ia(t,e){const i=Ar(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function na(t,e){t.uniform1iv(this.addr,e)}function sa(t,e){t.uniform2iv(this.addr,e)}function ra(t,e){t.uniform3iv(this.addr,e)}function aa(t,e){t.uniform4iv(this.addr,e)}function oa(t,e){t.uniform1uiv(this.addr,e)}function la(t,e){t.uniform2uiv(this.addr,e)}function ca(t,e){t.uniform3uiv(this.addr,e)}function ha(t,e){t.uniform4uiv(this.addr,e)}function da(t,e,i){const n=this.cache,s=e.length,r=kr(i,s);Cr(n,r)||(t.uniform1iv(this.addr,r),Lr(n,r));for(let t=0;t!==s;++t)i.setTexture2D(e[t]||vr,r[t])}function ua(t,e,i){const n=this.cache,s=e.length,r=kr(i,s);Cr(n,r)||(t.uniform1iv(this.addr,r),Lr(n,r));for(let t=0;t!==s;++t)i.setTexture3D(e[t]||xr,r[t])}function pa(t,e,i){const n=this.cache,s=e.length,r=kr(i,s);Cr(n,r)||(t.uniform1iv(this.addr,r),Lr(n,r));for(let t=0;t!==s;++t)i.setTextureCube(e[t]||wr,r[t])}function ma(t,e,i){const n=this.cache,s=e.length,r=kr(i,s);Cr(n,r)||(t.uniform1iv(this.addr,r),Lr(n,r));for(let t=0;t!==s;++t)i.setTexture2DArray(e[t]||yr,r[t])}class fa{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.type=e.type,this.setValue=function(t){switch(t){case 5126:return Rr;case 35664:return Pr;case 35665:return Ir;case 35666:return Nr;case 35674:return Ur;case 35675:return Dr;case 35676:return Or;case 5124:case 35670:return Br;case 35667:case 35671:return Fr;case 35668:case 35672:return zr;case 35669:case 35673:return Hr;case 5125:return Gr;case 36294:return Vr;case 36295:return Wr;case 36296:return jr;case 35678:case 36198:case 36298:case 36306:case 35682:return qr;case 35679:case 36299:case 36307:return Xr;case 35680:case 36300:case 36308:case 36293:return Zr;case 36289:case 36303:case 36311:case 36292:return Yr}}(e.type)}}class ga{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Jr;case 35664:return $r;case 35665:return Kr;case 35666:return Qr;case 35674:return ta;case 35675:return ea;case 35676:return ia;case 5124:case 35670:return na;case 35667:case 35671:return sa;case 35668:case 35672:return ra;case 35669:case 35673:return aa;case 5125:return oa;case 36294:return la;case 36295:return ca;case 36296:return ha;case 35678:case 36198:case 36298:case 36306:case 35682:return da;case 35679:case 36299:case 36307:return ua;case 35680:case 36300:case 36308:case 36293:return pa;case 36289:case 36303:case 36311:case 36292:return ma}}(e.type)}}class va{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 _a=/(\w+)(\])?(\[|\.)?/g;function ya(t,e){t.seq.push(e),t.map[e.id]=e}function xa(t,e,i){const n=t.name,s=n.length;for(_a.lastIndex=0;;){const r=_a.exec(n),a=_a.lastIndex;let o=r[1];const l="]"===r[2],c=r[3];if(l&&(o|=0),void 0===c||"["===c&&a+2===s){ya(i,void 0===c?new fa(o,t,e):new ga(o,t,e));break}{let t=i.map[o];void 0===t&&(t=new va(o),ya(i,t)),i=t}}}class wa{constructor(t,e){this.seq=[],this.map={};const i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let n=0;n<i;++n){const i=t.getActiveUniform(e,n);xa(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 ba(t,e,i){const n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}const Ma=37297;let Sa=0;function Ea(t,e,i){const n=t.getShaderParameter(e,t.COMPILE_STATUS),s=t.getShaderInfoLog(e).trim();if(n&&""===s)return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const n=parseInt(r[1]);return i.toUpperCase()+"\n\n"+s+"\n\n"+function(t,e){const i=t.split("\n"),n=[],s=Math.max(e-6,0),r=Math.min(e+6,i.length);for(let t=s;t<r;t++){const s=t+1;n.push(`${s===e?">":" "} ${s}: ${i[t]}`)}return n.join("\n")}(t.getShaderSource(e),n)}return s}function Ta(t,e){const i=function(t){const e=De.getPrimaries(De.workingColorSpace),i=De.getPrimaries(t);let n;switch(e===i?n="":e===$t&&i===Jt?n="LinearDisplayP3ToLinearSRGB":e===Jt&&i===$t&&(n="LinearSRGBToLinearDisplayP3"),t){case jt:case Xt:return[n,"LinearTransferOETF"];case Wt:case qt:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[n,"LinearTransferOETF"]}}(e);return`vec4 ${t}( vec4 value ) { return ${i[0]}( ${i[1]}( value ) ); }`}function Aa(t,e){let i;switch(e){case g:i="Linear";break;case v:i="Reinhard";break;case _:i="OptimizedCineon";break;case y:i="ACESFilmic";break;case w:i="AgX";break;case b:i="Neutral";break;case x:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),i="Linear"}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function Ca(t){return""!==t}function La(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 ka(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Ra=/^[ \t]*#include +<([\w\d./]+)>/gm;function Pa(t){return t.replace(Ra,Na)}const Ia=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function Na(t,e){let i=Ps[e];if(void 0===i){const t=Ia.get(e);if(void 0===t)throw new Error("Can not resolve #include <"+e+">");i=Ps[t],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,t)}return Pa(i)}const Ua=/#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 Da(t){return t.replace(Ua,Oa)}function Oa(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 Ba(t){let e=`precision ${t.precision} float;\n\tprecision ${t.precision} int;\n\tprecision ${t.precision} sampler2D;\n\tprecision ${t.precision} samplerCube;\n\t`;return t.isWebGL2&&(e+=`precision ${t.precision} sampler3D;\n\t\tprecision ${t.precision} sampler2DArray;\n\t\tprecision ${t.precision} sampler2DShadow;\n\t\tprecision ${t.precision} samplerCubeShadow;\n\t\tprecision ${t.precision} sampler2DArrayShadow;\n\t\tprecision ${t.precision} isampler2D;\n\t\tprecision ${t.precision} isampler3D;\n\t\tprecision ${t.precision} isamplerCube;\n\t\tprecision ${t.precision} isampler2DArray;\n\t\tprecision ${t.precision} usampler2D;\n\t\tprecision ${t.precision} usampler3D;\n\t\tprecision ${t.precision} usamplerCube;\n\t\tprecision ${t.precision} usampler2DArray;\n\t\t`),"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 Fa(t,e,i,n){const o=t.getContext(),l=i.defines;let c=i.vertexShader,h=i.fragmentShader;const d=function(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===s?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===r?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===a&&(e="SHADOWMAP_TYPE_VSM"),e}(i),g=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case T:case A:e="ENVMAP_TYPE_CUBE";break;case k:e="ENVMAP_TYPE_CUBE_UV"}return e}(i),v=function(t){let e="ENVMAP_MODE_REFLECTION";t.envMap&&t.envMapMode===A&&(e="ENVMAP_MODE_REFRACTION");return e}(i),_=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case u:e="ENVMAP_BLENDING_MULTIPLY";break;case p:e="ENVMAP_BLENDING_MIX";break;case m:e="ENVMAP_BLENDING_ADD"}return e}(i),y=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),x=i.isWebGL2?"":function(t){return[t.extensionDerivatives||t.envMapCubeUVHeight||t.bumpMap||t.normalMapTangentSpace||t.clearcoatNormalMap||t.flatShading||t.alphaToCoverage||"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(Ca).join("\n")}(i),w=function(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Ca).join("\n")}(i),b=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),M=o.createProgram();let S,E,C=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?(S=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,b].filter(Ca).join("\n"),S.length>0&&(S+="\n"),E=[x,"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,b].filter(Ca).join("\n"),E.length>0&&(E+="\n")):(S=[Ba(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,b,i.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",i.batching?"#define USE_BATCHING":"",i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.instancingMorph?"#define USE_INSTANCING_MORPH":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+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.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.mapUv?"#define MAP_UV "+i.mapUv:"",i.alphaMapUv?"#define ALPHAMAP_UV "+i.alphaMapUv:"",i.lightMapUv?"#define LIGHTMAP_UV "+i.lightMapUv:"",i.aoMapUv?"#define AOMAP_UV "+i.aoMapUv:"",i.emissiveMapUv?"#define EMISSIVEMAP_UV "+i.emissiveMapUv:"",i.bumpMapUv?"#define BUMPMAP_UV "+i.bumpMapUv:"",i.normalMapUv?"#define NORMALMAP_UV "+i.normalMapUv:"",i.displacementMapUv?"#define DISPLACEMENTMAP_UV "+i.displacementMapUv:"",i.metalnessMapUv?"#define METALNESSMAP_UV "+i.metalnessMapUv:"",i.roughnessMapUv?"#define ROUGHNESSMAP_UV "+i.roughnessMapUv:"",i.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+i.anisotropyMapUv:"",i.clearcoatMapUv?"#define CLEARCOATMAP_UV "+i.clearcoatMapUv:"",i.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+i.clearcoatNormalMapUv:"",i.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+i.clearcoatRoughnessMapUv:"",i.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+i.iridescenceMapUv:"",i.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+i.iridescenceThicknessMapUv:"",i.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+i.sheenColorMapUv:"",i.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+i.sheenRoughnessMapUv:"",i.specularMapUv?"#define SPECULARMAP_UV "+i.specularMapUv:"",i.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+i.specularColorMapUv:"",i.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+i.specularIntensityMapUv:"",i.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+i.transmissionMapUv:"",i.thicknessMapUv?"#define THICKNESSMAP_UV "+i.thicknessMapUv:"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors&&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 "+d:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.useLegacyLights?"#define LEGACY_LIGHTS":"",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","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#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(Ca).join("\n"),E=[x,Ba(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,b,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+g:"",i.envMap?"#define "+v:"",i.envMap?"#define "+_:"",y?"#define CUBEUV_TEXEL_WIDTH "+y.texelWidth:"",y?"#define CUBEUV_TEXEL_HEIGHT "+y.texelHeight:"",y?"#define CUBEUV_MAX_MIP "+y.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+d:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.useLegacyLights?"#define LEGACY_LIGHTS":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",i.logarithmicDepthBuffer&&i.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",i.toneMapping!==f?"#define TONE_MAPPING":"",i.toneMapping!==f?Ps.tonemapping_pars_fragment:"",i.toneMapping!==f?Aa("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",Ps.colorspace_pars_fragment,Ta("linearToOutputTexel",i.outputColorSpace),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Ca).join("\n")),c=Pa(c),c=La(c,i),c=ka(c,i),h=Pa(h),h=La(h,i),h=ka(h,i),c=Da(c),h=Da(h),i.isWebGL2&&!0!==i.isRawShaderMaterial&&(C="#version 300 es\n",S=[w,"precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+S,E=["precision mediump sampler2DArray;","#define varying in",i.glslVersion===se?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===se?"":"#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"+E);const L=C+S+c,R=C+E+h,P=ba(o,o.VERTEX_SHADER,L),I=ba(o,o.FRAGMENT_SHADER,R);function N(e){if(t.debug.checkShaderErrors){const i=o.getProgramInfoLog(M).trim(),n=o.getShaderInfoLog(P).trim(),s=o.getShaderInfoLog(I).trim();let r=!0,a=!0;if(!1===o.getProgramParameter(M,o.LINK_STATUS))if(r=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(o,M,P,I);else{const t=Ea(o,P,"vertex"),n=Ea(o,I,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(M,o.VALIDATE_STATUS)+"\n\nMaterial Name: "+e.name+"\nMaterial Type: "+e.type+"\n\nProgram Info Log: "+i+"\n"+t+"\n"+n)}else""!==i?console.warn("THREE.WebGLProgram: Program Info Log:",i):""!==n&&""!==s||(a=!1);a&&(e.diagnostics={runnable:r,programLog:i,vertexShader:{log:n,prefix:S},fragmentShader:{log:s,prefix:E}})}o.deleteShader(P),o.deleteShader(I),U=new wa(o,M),D=function(t,e){const i={},n=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){const n=t.getActiveAttrib(e,s),r=n.name;let a=1;n.type===t.FLOAT_MAT2&&(a=2),n.type===t.FLOAT_MAT3&&(a=3),n.type===t.FLOAT_MAT4&&(a=4),i[r]={type:n.type,location:t.getAttribLocation(e,r),locationSize:a}}return i}(o,M)}let U,D;o.attachShader(M,P),o.attachShader(M,I),void 0!==i.index0AttributeName?o.bindAttribLocation(M,0,i.index0AttributeName):!0===i.morphTargets&&o.bindAttribLocation(M,0,"position"),o.linkProgram(M),this.getUniforms=function(){return void 0===U&&N(this),U},this.getAttributes=function(){return void 0===D&&N(this),D};let O=!1===i.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===O&&(O=o.getProgramParameter(M,Ma)),O},this.destroy=function(){n.releaseStatesOfProgram(this),o.deleteProgram(M),this.program=void 0},this.type=i.shaderType,this.name=i.shaderName,this.id=Sa++,this.cacheKey=e,this.usedTimes=1,this.program=M,this.vertexShader=P,this.fragmentShader=I,this}let za=0;class Ha{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 Ga(t),e.set(t,i)),i}}class Ga{constructor(t){this.id=za++,this.code=t,this.usedTimes=0}}function Va(t,e,i,n,s,r,a){const o=new Fi,c=new Ha,h=new Set,d=[],u=s.isWebGL2,p=s.logarithmicDepthBuffer,m=s.vertexTextures;let g=s.precision;const v={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 _(t){return h.add(t),0===t?"uv":`uv${t}`}return{getParameters:function(r,o,d,y,x){const w=y.fog,b=x.geometry,M=r.isMeshStandardMaterial?y.environment:null,S=(r.isMeshStandardMaterial?i:e).get(r.envMap||M),E=S&&S.mapping===k?S.image.height:null,T=v[r.type];null!==r.precision&&(g=s.getMaxPrecision(r.precision),g!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",g,"instead."));const A=b.morphAttributes.position||b.morphAttributes.normal||b.morphAttributes.color,C=void 0!==A?A.length:0;let L,R,P,I,N=0;if(void 0!==b.morphAttributes.position&&(N=1),void 0!==b.morphAttributes.normal&&(N=2),void 0!==b.morphAttributes.color&&(N=3),T){const t=Ns[T];L=t.vertexShader,R=t.fragmentShader}else L=r.vertexShader,R=r.fragmentShader,c.update(r),P=c.getVertexShaderID(r),I=c.getFragmentShaderID(r);const U=t.getRenderTarget(),D=!0===x.isInstancedMesh,O=!0===x.isBatchedMesh,B=!!r.map,F=!!r.matcap,z=!!S,H=!!r.aoMap,G=!!r.lightMap,V=!!r.bumpMap,W=!!r.normalMap,j=!!r.displacementMap,q=!!r.emissiveMap,X=!!r.metalnessMap,Z=!!r.roughnessMap,Y=r.anisotropy>0,J=r.clearcoat>0,$=r.iridescence>0,K=r.sheen>0,Q=r.transmission>0,tt=Y&&!!r.anisotropyMap,et=J&&!!r.clearcoatMap,it=J&&!!r.clearcoatNormalMap,nt=J&&!!r.clearcoatRoughnessMap,st=$&&!!r.iridescenceMap,rt=$&&!!r.iridescenceThicknessMap,at=K&&!!r.sheenColorMap,ot=K&&!!r.sheenRoughnessMap,lt=!!r.specularMap,ct=!!r.specularColorMap,ht=!!r.specularIntensityMap,dt=Q&&!!r.transmissionMap,ut=Q&&!!r.thicknessMap,pt=!!r.gradientMap,mt=!!r.alphaMap,ft=r.alphaTest>0,gt=!!r.alphaHash,vt=!!r.extensions;let _t=f;r.toneMapped&&(null!==U&&!0!==U.isXRRenderTarget||(_t=t.toneMapping));const yt={isWebGL2:u,shaderID:T,shaderType:r.type,shaderName:r.name,vertexShader:L,fragmentShader:R,defines:r.defines,customVertexShaderID:P,customFragmentShaderID:I,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:g,batching:O,instancing:D,instancingColor:D&&null!==x.instanceColor,instancingMorph:D&&null!==x.morphTexture,supportsVertexTextures:m,outputColorSpace:null===U?t.outputColorSpace:!0===U.isXRRenderTarget?U.texture.colorSpace:jt,alphaToCoverage:!!r.alphaToCoverage,map:B,matcap:F,envMap:z,envMapMode:z&&S.mapping,envMapCubeUVHeight:E,aoMap:H,lightMap:G,bumpMap:V,normalMap:W,displacementMap:m&&j,emissiveMap:q,normalMapObjectSpace:W&&1===r.normalMapType,normalMapTangentSpace:W&&0===r.normalMapType,metalnessMap:X,roughnessMap:Z,anisotropy:Y,anisotropyMap:tt,clearcoat:J,clearcoatMap:et,clearcoatNormalMap:it,clearcoatRoughnessMap:nt,iridescence:$,iridescenceMap:st,iridescenceThicknessMap:rt,sheen:K,sheenColorMap:at,sheenRoughnessMap:ot,specularMap:lt,specularColorMap:ct,specularIntensityMap:ht,transmission:Q,transmissionMap:dt,thicknessMap:ut,gradientMap:pt,opaque:!1===r.transparent&&1===r.blending&&!1===r.alphaToCoverage,alphaMap:mt,alphaTest:ft,alphaHash:gt,combine:r.combine,mapUv:B&&_(r.map.channel),aoMapUv:H&&_(r.aoMap.channel),lightMapUv:G&&_(r.lightMap.channel),bumpMapUv:V&&_(r.bumpMap.channel),normalMapUv:W&&_(r.normalMap.channel),displacementMapUv:j&&_(r.displacementMap.channel),emissiveMapUv:q&&_(r.emissiveMap.channel),metalnessMapUv:X&&_(r.metalnessMap.channel),roughnessMapUv:Z&&_(r.roughnessMap.channel),anisotropyMapUv:tt&&_(r.anisotropyMap.channel),clearcoatMapUv:et&&_(r.clearcoatMap.channel),clearcoatNormalMapUv:it&&_(r.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:nt&&_(r.clearcoatRoughnessMap.channel),iridescenceMapUv:st&&_(r.iridescenceMap.channel),iridescenceThicknessMapUv:rt&&_(r.iridescenceThicknessMap.channel),sheenColorMapUv:at&&_(r.sheenColorMap.channel),sheenRoughnessMapUv:ot&&_(r.sheenRoughnessMap.channel),specularMapUv:lt&&_(r.specularMap.channel),specularColorMapUv:ct&&_(r.specularColorMap.channel),specularIntensityMapUv:ht&&_(r.specularIntensityMap.channel),transmissionMapUv:dt&&_(r.transmissionMap.channel),thicknessMapUv:ut&&_(r.thicknessMap.channel),alphaMapUv:mt&&_(r.alphaMap.channel),vertexTangents:!!b.attributes.tangent&&(W||Y),vertexColors:r.vertexColors,vertexAlphas:!0===r.vertexColors&&!!b.attributes.color&&4===b.attributes.color.itemSize,pointsUvs:!0===x.isPoints&&!!b.attributes.uv&&(B||mt),fog:!!w,useFog:!0===r.fog,fogExp2:!!w&&w.isFogExp2,flatShading:!0===r.flatShading,sizeAttenuation:!0===r.sizeAttenuation,logarithmicDepthBuffer:p,skinning:!0===x.isSkinnedMesh,morphTargets:void 0!==b.morphAttributes.position,morphNormals:void 0!==b.morphAttributes.normal,morphColors:void 0!==b.morphAttributes.color,morphTargetsCount:C,morphTextureStride:N,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&d.length>0,shadowMapType:t.shadowMap.type,toneMapping:_t,useLegacyLights:t._useLegacyLights,decodeVideoTexture:B&&!0===r.map.isVideoTexture&&De.getTransfer(r.map.colorSpace)===Yt,premultipliedAlpha:r.premultipliedAlpha,doubleSided:2===r.side,flipSided:r.side===l,useDepthPacking:r.depthPacking>=0,depthPacking:r.depthPacking||0,index0AttributeName:r.index0AttributeName,extensionDerivatives:vt&&!0===r.extensions.derivatives,extensionFragDepth:vt&&!0===r.extensions.fragDepth,extensionDrawBuffers:vt&&!0===r.extensions.drawBuffers,extensionShaderTextureLOD:vt&&!0===r.extensions.shaderTextureLOD,extensionClipCullDistance:vt&&!0===r.extensions.clipCullDistance&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:vt&&!0===r.extensions.multiDraw&&n.has("WEBGL_multi_draw"),rendererExtensionFragDepth:u||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||n.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:r.customProgramCacheKey()};return yt.vertexUv1s=h.has(1),yt.vertexUv2s=h.has(2),yt.vertexUv3s=h.has(3),h.clear(),yt},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.customVertexShaderID),i.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(!function(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.numLightProbes),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(i,e),function(t,e){o.disableAll(),e.isWebGL2&&o.enable(0);e.supportsVertexTextures&&o.enable(1);e.instancing&&o.enable(2);e.instancingColor&&o.enable(3);e.instancingMorph&&o.enable(4);e.matcap&&o.enable(5);e.envMap&&o.enable(6);e.normalMapObjectSpace&&o.enable(7);e.normalMapTangentSpace&&o.enable(8);e.clearcoat&&o.enable(9);e.iridescence&&o.enable(10);e.alphaTest&&o.enable(11);e.vertexColors&&o.enable(12);e.vertexAlphas&&o.enable(13);e.vertexUv1s&&o.enable(14);e.vertexUv2s&&o.enable(15);e.vertexUv3s&&o.enable(16);e.vertexTangents&&o.enable(17);e.anisotropy&&o.enable(18);e.alphaHash&&o.enable(19);e.batching&&o.enable(20);t.push(o.mask),o.disableAll(),e.fog&&o.enable(0);e.useFog&&o.enable(1);e.flatShading&&o.enable(2);e.logarithmicDepthBuffer&&o.enable(3);e.skinning&&o.enable(4);e.morphTargets&&o.enable(5);e.morphNormals&&o.enable(6);e.morphColors&&o.enable(7);e.premultipliedAlpha&&o.enable(8);e.shadowMapEnabled&&o.enable(9);e.useLegacyLights&&o.enable(10);e.doubleSided&&o.enable(11);e.flipSided&&o.enable(12);e.useDepthPacking&&o.enable(13);e.dithering&&o.enable(14);e.transmission&&o.enable(15);e.sheen&&o.enable(16);e.opaque&&o.enable(17);e.pointsUvs&&o.enable(18);e.decodeVideoTexture&&o.enable(19);e.alphaToCoverage&&o.enable(20);t.push(o.mask)}(i,e),i.push(t.outputColorSpace)),i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=v[t.type];let i;if(e){const t=Ns[e];i=ds.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n;for(let t=0,e=d.length;t<e;t++){const e=d[t];if(e.cacheKey===i){n=e,++n.usedTimes;break}}return void 0===n&&(n=new Fa(t,i,e,r),d.push(n)),n},releaseProgram:function(t){if(0==--t.usedTimes){const e=d.indexOf(t);d[e]=d[d.length-1],d.pop(),t.destroy()}},releaseShaderCache:function(t){c.remove(t)},programs:d,dispose:function(){c.dispose()}}}function Wa(){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 ja(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 qa(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 Xa(){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||ja),n.length>1&&n.sort(e||qa),s.length>1&&s.sort(e||qa)}}}function Za(){let t=new WeakMap;return{get:function(e,i){const n=t.get(e);let s;return void 0===n?(s=new Xa,t.set(e,[s])):i>=n.length?(s=new Xa,n.push(s)):s=n[i],s},dispose:function(){t=new WeakMap}}}function Ya(){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 Ke,color:new _n};break;case"SpotLight":i={position:new Ke,direction:new Ke,color:new _n,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new Ke,color:new _n,distance:0,decay:0};break;case"HemisphereLight":i={direction:new Ke,skyColor:new _n,groundColor:new _n};break;case"RectAreaLight":i={color:new _n,position:new Ke,halfWidth:new Ke,halfHeight:new Ke}}return t[e.id]=i,i}}}let Ja=0;function $a(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Ka(t,e){const i=new Ya,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 be};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new be,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,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let t=0;t<9;t++)s.probe.push(new Ke);const r=new Ke,a=new Ci,o=new Ci;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,x=0;r.sort($a);const w=!0===a?Math.PI:1;for(let t=0,e=r.length;t<e;t++){const e=r[t],a=e.color,b=e.intensity,M=e.distance,S=e.shadow&&e.shadow.map?e.shadow.map.texture:null;if(e.isAmbientLight)o+=a.r*b*w,l+=a.g*b*w,c+=a.b*b*w;else if(e.isLightProbe){for(let t=0;t<9;t++)s.probe[t].addScaledVector(e.sh.coefficients[t],b);x++}else if(e.isDirectionalLight){const t=i.get(e);if(t.color.copy(e.color).multiplyScalar(e.intensity*w),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]=S,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(b*w),t.distance=M,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]=S,v++}u++}else if(e.isRectAreaLight){const t=i.get(e);t.color.copy(a).multiplyScalar(b),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*w),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]=S,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(b*w),t.groundColor.copy(e.groundColor).multiplyScalar(b*w),s.hemi[m]=t,m++}}p>0&&(e.isWebGL2?!0===t.has("OES_texture_float_linear")?(s.rectAreaLTC1=Is.LTC_FLOAT_1,s.rectAreaLTC2=Is.LTC_FLOAT_2):(s.rectAreaLTC1=Is.LTC_HALF_1,s.rectAreaLTC2=Is.LTC_HALF_2):!0===t.has("OES_texture_float_linear")?(s.rectAreaLTC1=Is.LTC_FLOAT_1,s.rectAreaLTC2=Is.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(s.rectAreaLTC1=Is.LTC_HALF_1,s.rectAreaLTC2=Is.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 b=s.hash;b.directionalLength===h&&b.pointLength===d&&b.spotLength===u&&b.rectAreaLength===p&&b.hemiLength===m&&b.numDirectionalShadows===f&&b.numPointShadows===g&&b.numSpotShadows===v&&b.numSpotMaps===_&&b.numLightProbes===x||(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,s.numLightProbes=x,b.directionalLength=h,b.pointLength=d,b.spotLength=u,b.rectAreaLength=p,b.hemiLength=m,b.numDirectionalShadows=f,b.numPointShadows=g,b.numSpotShadows=v,b.numSpotMaps=_,b.numLightProbes=x,s.version=Ja++)},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 Qa(t,e){const i=new Ka(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 to(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 Qa(t,e),i.set(n,[a])):s>=r.length?(a=new Qa(t,e),r.push(a)):a=r[s],a},dispose:function(){i=new WeakMap}}}class eo extends wn{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 io extends wn{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 no(t,e,i){let n=new Cs;const r=new be,c=new be,h=new qe,d=new eo({depthPacking:3201}),u=new io,p={},m=i.maxTextureSize,f={[o]:l,[l]:o,2:2},g=new us({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new be},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 Hn;_.setAttribute("position",new kn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new rs(_,g),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=s;let w=this.type;function b(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 Ze(r.x,r.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 M(e,i,n,s){let r=null;const o=!0===n.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==o)r=o;else if(r=!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=r.uuid,e=i.uuid;let n=p[t];void 0===n&&(n={},p[t]=n);let s=n[e];void 0===s&&(s=r.clone(),n[e]=s,i.addEventListener("dispose",E)),r=s}if(r.visible=i.visible,r.wireframe=i.wireframe,r.side=s===a?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:f[i.side],r.alphaMap=i.alphaMap,r.alphaTest=i.alphaTest,r.map=i.map,r.clipShadows=i.clipShadows,r.clippingPlanes=i.clippingPlanes,r.clipIntersection=i.clipIntersection,r.displacementMap=i.displacementMap,r.displacementScale=i.displacementScale,r.displacementBias=i.displacementBias,r.wireframeLinewidth=i.wireframeLinewidth,r.linewidth=i.linewidth,!0===n.isPointLight&&!0===r.isMeshDistanceMaterial){t.properties.get(r).light=n}return r}function S(i,s,r,o,l){if(!1===i.visible)return;if(i.layers.test(s.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&l===a)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,i.matrixWorld);const n=e.update(i),a=i.material;if(Array.isArray(a)){const e=n.groups;for(let c=0,h=e.length;c<h;c++){const h=e[c],d=a[h.materialIndex];if(d&&d.visible){const e=M(i,d,o,l);i.onBeforeShadow(t,i,s,r,n,e,h),t.renderBufferDirect(r,null,n,e,i,h),i.onAfterShadow(t,i,s,r,n,e,h)}}}else if(a.visible){const e=M(i,a,o,l);i.onBeforeShadow(t,i,s,r,n,e,null),t.renderBufferDirect(r,null,n,e,i,null),i.onAfterShadow(t,i,s,r,n,e,null)}}const c=i.children;for(let t=0,e=c.length;t<e;t++)S(c[t],s,r,o,l)}function E(t){t.target.removeEventListener("dispose",E);for(const e in p){const i=p[e],n=t.target.uuid;if(n in i){i[n].dispose(),delete i[n]}}}this.render=function(e,i,s){if(!1===x.enabled)return;if(!1===x.autoUpdate&&!1===x.needsUpdate)return;if(0===e.length)return;const o=t.getRenderTarget(),l=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);const p=w!==a&&this.type===a,f=w===a&&this.type!==a;for(let o=0,l=e.length;o<l;o++){const l=e[o],d=l.shadow;if(void 0===d){console.warn("THREE.WebGLShadowMap:",l,"has no shadow.");continue}if(!1===d.autoUpdate&&!1===d.needsUpdate)continue;r.copy(d.mapSize);const g=d.getFrameExtents();if(r.multiply(g),c.copy(d.mapSize),(r.x>m||r.y>m)&&(r.x>m&&(c.x=Math.floor(m/g.x),r.x=c.x*g.x,d.mapSize.x=c.x),r.y>m&&(c.y=Math.floor(m/g.y),r.y=c.y*g.y,d.mapSize.y=c.y)),null===d.map||!0===p||!0===f){const t=this.type!==a?{minFilter:N,magFilter:N}:{};null!==d.map&&d.map.dispose(),d.map=new Ze(r.x,r.y,t),d.map.texture.name=l.name+".shadowMap",d.camera.updateProjectionMatrix()}t.setRenderTarget(d.map),t.clear();const v=d.getViewportCount();for(let t=0;t<v;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(l,t),n=d.getFrustum(),S(i,s,d.camera,l,this.type)}!0!==d.isPointLightShadow&&this.type===a&&b(d,s),d.needsUpdate=!1}w=this.type,x.needsUpdate=!1,t.setRenderTarget(o,l,d)}}function so(t,e,i){const n=i.isWebGL2;const s=new function(){let e=!1;const i=new qe;let n=null;const s=new qe(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(e){e?q(t.DEPTH_TEST):X(t.DEPTH_TEST)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){switch(e){case 0:t.depthFunc(t.NEVER);break;case 1:t.depthFunc(t.ALWAYS);break;case 2:t.depthFunc(t.LESS);break;case 3:default:t.depthFunc(t.LEQUAL);break;case 4:t.depthFunc(t.EQUAL);break;case 5:t.depthFunc(t.GEQUAL);break;case 6:t.depthFunc(t.GREATER);break;case 7:t.depthFunc(t.NOTEQUAL)}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(i){e||(i?q(t.STENCIL_TEST):X(t.STENCIL_TEST))},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,a){n===e&&s===i&&r===a||(t.stencilFunc(e,i,a),n=e,s=i,r=a)},setOp:function(e,i,n){a===e&&o===i&&l===n||(t.stencilOp(e,i,n),a=e,o=i,l=n)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,i=null,n=null,s=null,r=null,a=null,o=null,l=null,c=null}}},o=new WeakMap,u=new WeakMap;let p={},m={},f=new WeakMap,g=[],v=null,_=!1,y=null,x=null,w=null,b=null,M=null,S=null,E=null,T=new _n(0,0,0),A=0,C=!1,L=null,k=null,R=null,P=null,I=null;const N=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let U=!1,D=0;const O=t.getParameter(t.VERSION);-1!==O.indexOf("WebGL")?(D=parseFloat(/^WebGL (\d)/.exec(O)[1]),U=D>=1):-1!==O.indexOf("OpenGL ES")&&(D=parseFloat(/^OpenGL ES (\d)/.exec(O)[1]),U=D>=2);let B=null,F={};const z=t.getParameter(t.SCISSOR_BOX),H=t.getParameter(t.VIEWPORT),G=(new qe).fromArray(z),V=(new qe).fromArray(H);function W(e,i,s,r){const a=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let o=0;o<s;o++)!n||e!==t.TEXTURE_3D&&e!==t.TEXTURE_2D_ARRAY?t.texImage2D(i+o,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,a):t.texImage3D(i,0,t.RGBA,1,1,r,0,t.RGBA,t.UNSIGNED_BYTE,a);return o}const j={};function q(e){!0!==p[e]&&(t.enable(e),p[e]=!0)}function X(e){!1!==p[e]&&(t.disable(e),p[e]=!1)}j[t.TEXTURE_2D]=W(t.TEXTURE_2D,t.TEXTURE_2D,1),j[t.TEXTURE_CUBE_MAP]=W(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),n&&(j[t.TEXTURE_2D_ARRAY]=W(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),j[t.TEXTURE_3D]=W(t.TEXTURE_3D,t.TEXTURE_3D,1,1)),s.setClear(0,0,0,1),r.setClear(1),a.setClear(0),q(t.DEPTH_TEST),r.setFunc(3),$(!1),K(1),q(t.CULL_FACE),J(0);const Z={[c]:t.FUNC_ADD,101:t.FUNC_SUBTRACT,102:t.FUNC_REVERSE_SUBTRACT};if(n)Z[103]=t.MIN,Z[104]=t.MAX;else{const t=e.get("EXT_blend_minmax");null!==t&&(Z[103]=t.MIN_EXT,Z[104]=t.MAX_EXT)}const Y={200:t.ZERO,201:t.ONE,202:t.SRC_COLOR,[h]:t.SRC_ALPHA,210:t.SRC_ALPHA_SATURATE,208:t.DST_COLOR,206:t.DST_ALPHA,203:t.ONE_MINUS_SRC_COLOR,[d]:t.ONE_MINUS_SRC_ALPHA,209:t.ONE_MINUS_DST_COLOR,207:t.ONE_MINUS_DST_ALPHA,211:t.CONSTANT_COLOR,212:t.ONE_MINUS_CONSTANT_COLOR,213:t.CONSTANT_ALPHA,214:t.ONE_MINUS_CONSTANT_ALPHA};function J(e,i,n,s,r,a,o,l,h,d){if(0!==e){if(!1===_&&(q(t.BLEND),_=!0),5===e)r=r||i,a=a||n,o=o||s,i===x&&r===M||(t.blendEquationSeparate(Z[i],Z[r]),x=i,M=r),n===w&&s===b&&a===S&&o===E||(t.blendFuncSeparate(Y[n],Y[s],Y[a],Y[o]),w=n,b=s,S=a,E=o),!1!==l.equals(T)&&h===A||(t.blendColor(l.r,l.g,l.b,h),T.copy(l),A=h),y=e,C=!1;else if(e!==y||d!==C){if(x===c&&M===c||(t.blendEquation(t.FUNC_ADD),x=c,M=c),d)switch(e){case 1:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.ONE,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}w=null,b=null,S=null,E=null,T.set(0,0,0),A=0,y=e,C=d}}else!0===_&&(X(t.BLEND),_=!1)}function $(e){L!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),L=e)}function K(e){0!==e?(q(t.CULL_FACE),e!==k&&(1===e?t.cullFace(t.BACK):2===e?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):X(t.CULL_FACE),k=e}function Q(e,i,n){e?(q(t.POLYGON_OFFSET_FILL),P===i&&I===n||(t.polygonOffset(i,n),P=i,I=n)):X(t.POLYGON_OFFSET_FILL)}return{buffers:{color:s,depth:r,stencil:a},enable:q,disable:X,bindFramebuffer:function(e,i){return m[e]!==i&&(t.bindFramebuffer(e,i),m[e]=i,n&&(e===t.DRAW_FRAMEBUFFER&&(m[t.FRAMEBUFFER]=i),e===t.FRAMEBUFFER&&(m[t.DRAW_FRAMEBUFFER]=i)),!0)},drawBuffers:function(n,s){let r=g,a=!1;if(n){r=f.get(s),void 0===r&&(r=[],f.set(s,r));const e=n.textures;if(r.length!==e.length||r[0]!==t.COLOR_ATTACHMENT0){for(let i=0,n=e.length;i<n;i++)r[i]=t.COLOR_ATTACHMENT0+i;r.length=e.length,a=!0}}else r[0]!==t.BACK&&(r[0]=t.BACK,a=!0);if(a)if(i.isWebGL2)t.drawBuffers(r);else{if(!0!==e.has("WEBGL_draw_buffers"))throw new Error("THREE.WebGLState: Usage of gl.drawBuffers() require WebGL2 or WEBGL_draw_buffers extension");e.get("WEBGL_draw_buffers").drawBuffersWEBGL(r)}},useProgram:function(e){return v!==e&&(t.useProgram(e),v=e,!0)},setBlending:J,setMaterial:function(e,i){2===e.side?X(t.CULL_FACE):q(t.CULL_FACE);let n=e.side===l;i&&(n=!n),$(n),1===e.blending&&!1===e.transparent?J(0):J(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.blendColor,e.blendAlpha,e.premultipliedAlpha),r.setFunc(e.depthFunc),r.setTest(e.depthTest),r.setMask(e.depthWrite),s.setMask(e.colorWrite);const o=e.stencilWrite;a.setTest(o),o&&(a.setMask(e.stencilWriteMask),a.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),a.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),Q(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?q(t.SAMPLE_ALPHA_TO_COVERAGE):X(t.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:$,setCullFace:K,setLineWidth:function(e){e!==R&&(U&&t.lineWidth(e),R=e)},setPolygonOffset:Q,setScissorTest:function(e){e?q(t.SCISSOR_TEST):X(t.SCISSOR_TEST)},activeTexture:function(e){void 0===e&&(e=t.TEXTURE0+N-1),B!==e&&(t.activeTexture(e),B=e)},bindTexture:function(e,i,n){void 0===n&&(n=null===B?t.TEXTURE0+N-1:B);let s=F[n];void 0===s&&(s={type:void 0,texture:void 0},F[n]=s),s.type===e&&s.texture===i||(B!==n&&(t.activeTexture(n),B=n),t.bindTexture(e,i||j[e]),s.type=e,s.texture=i)},unbindTexture:function(){const e=F[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=u.get(i);void 0===n&&(n=new WeakMap,u.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=u.get(i).get(e);o.get(i)!==n&&(t.uniformBlockBinding(i,n,e.__bindingPointIndex),o.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===G.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),G.copy(e))},viewport:function(e){!1===V.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),V.copy(e))},reset:function(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),!0===n&&(t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null)),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),p={},B=null,F={},m={},f=new WeakMap,g=[],v=null,_=!1,y=null,x=null,w=null,b=null,M=null,S=null,E=null,T=new _n(0,0,0),A=0,C=!1,L=null,k=null,R=null,P=null,I=null,G.set(0,0,t.canvas.width,t.canvas.height),V.set(0,0,t.canvas.width,t.canvas.height),s.reset(),r.reset(),a.reset()}}}function ro(t,e,i,n,s,r,a){const o=s.isWebGL2,l=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),h=new be,d=new WeakMap;let u;const p=new WeakMap;let m=!1;try{m="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function f(t,e){return m?new OffscreenCanvas(t,e):Ce("canvas")}function g(t,e,i,n){let s=1;const r=st(t);if((r.width>n||r.height>n)&&(s=n/Math.max(r.width,r.height)),s<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&t instanceof VideoFrame){const n=e?_e:Math.floor,a=n(s*r.width),o=n(s*r.height);void 0===u&&(u=f(a,o));const l=i?f(a,o):u;l.width=a,l.height=o;return l.getContext("2d").drawImage(t,0,0,a,o),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+a+"x"+o+")."),l}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),t}return t}function v(t){const e=st(t);return ve(e.width)&&ve(e.height)}function _(t,e){return t.generateMipmaps&&e&&t.minFilter!==N&&t.minFilter!==O}function y(e){t.generateMipmap(e)}function x(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;if(n===t.RED&&(s===t.FLOAT&&(l=t.R32F),s===t.HALF_FLOAT&&(l=t.R16F),s===t.UNSIGNED_BYTE&&(l=t.R8)),n===t.RED_INTEGER&&(s===t.UNSIGNED_BYTE&&(l=t.R8UI),s===t.UNSIGNED_SHORT&&(l=t.R16UI),s===t.UNSIGNED_INT&&(l=t.R32UI),s===t.BYTE&&(l=t.R8I),s===t.SHORT&&(l=t.R16I),s===t.INT&&(l=t.R32I)),n===t.RG&&(s===t.FLOAT&&(l=t.RG32F),s===t.HALF_FLOAT&&(l=t.RG16F),s===t.UNSIGNED_BYTE&&(l=t.RG8)),n===t.RG_INTEGER&&(s===t.UNSIGNED_BYTE&&(l=t.RG8UI),s===t.UNSIGNED_SHORT&&(l=t.RG16UI),s===t.UNSIGNED_INT&&(l=t.RG32UI),s===t.BYTE&&(l=t.RG8I),s===t.SHORT&&(l=t.RG16I),s===t.INT&&(l=t.RG32I)),n===t.RGBA){const e=a?Zt:De.getTransfer(r);s===t.FLOAT&&(l=t.RGBA32F),s===t.HALF_FLOAT&&(l=t.RGBA16F),s===t.UNSIGNED_BYTE&&(l=e===Yt?t.SRGB8_ALPHA8:t.RGBA8),s===t.UNSIGNED_SHORT_4_4_4_4&&(l=t.RGBA4),s===t.UNSIGNED_SHORT_5_5_5_1&&(l=t.RGB5_A1)}return l!==t.R16F&&l!==t.R32F&&l!==t.RG16F&&l!==t.RG32F&&l!==t.RGBA16F&&l!==t.RGBA32F||e.get("EXT_color_buffer_float"),l}function w(t,e,i){return!0===_(t,i)||t.isFramebufferTexture&&t.minFilter!==N&&t.minFilter!==O?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function b(e){return e===N||e===U||e===D?t.NEAREST:t.LINEAR}function M(t){const e=t.target;e.removeEventListener("dispose",M),function(t){const e=n.get(t);if(void 0===e.__webglInit)return;const i=t.source,s=p.get(i);if(s){const n=s[e.__cacheKey];n.usedTimes--,0===n.usedTimes&&E(t),0===Object.keys(s).length&&p.delete(i)}n.remove(t)}(e),e.isVideoTexture&&d.delete(e)}function S(e){const i=e.target;i.removeEventListener("dispose",S),function(e){const i=n.get(e);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++){if(Array.isArray(i.__webglFramebuffer[e]))for(let n=0;n<i.__webglFramebuffer[e].length;n++)t.deleteFramebuffer(i.__webglFramebuffer[e][n]);else t.deleteFramebuffer(i.__webglFramebuffer[e]);i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[e])}else{if(Array.isArray(i.__webglFramebuffer))for(let e=0;e<i.__webglFramebuffer.length;e++)t.deleteFramebuffer(i.__webglFramebuffer[e]);else t.deleteFramebuffer(i.__webglFramebuffer);if(i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(let e=0;e<i.__webglColorRenderbuffer.length;e++)i.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(i.__webglColorRenderbuffer[e]);i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer)}const s=e.textures;for(let e=0,i=s.length;e<i;e++){const i=n.get(s[e]);i.__webglTexture&&(t.deleteTexture(i.__webglTexture),a.memory.textures--),n.remove(s[e])}n.remove(e)}(i)}function E(e){const i=n.get(e);t.deleteTexture(i.__webglTexture);const s=e.source;delete p.get(s)[i.__cacheKey],a.memory.textures--}let T=0;function A(e,s){const r=n.get(e);if(e.isVideoTexture&&function(t){const e=a.render.frame;d.get(t)!==e&&(d.set(t,e),t.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&r.__version!==e.version){const t=e.image;if(null===t)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==t.complete)return void X(r,e,s);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.bindTexture(t.TEXTURE_2D,r.__webglTexture,t.TEXTURE0+s)}const C={[R]:t.REPEAT,[P]:t.CLAMP_TO_EDGE,[I]:t.MIRRORED_REPEAT},L={[N]:t.NEAREST,[U]:t.NEAREST_MIPMAP_NEAREST,[D]:t.NEAREST_MIPMAP_LINEAR,[O]:t.LINEAR,[B]:t.LINEAR_MIPMAP_NEAREST,[F]:t.LINEAR_MIPMAP_LINEAR},k={512:t.NEVER,519:t.ALWAYS,513:t.LESS,515:t.LEQUAL,514:t.EQUAL,518:t.GEQUAL,516:t.GREATER,517:t.NOTEQUAL};function G(i,r,a){if(r.type!==W||!1!==e.has("OES_texture_float_linear")||r.magFilter!==O&&r.magFilter!==B&&r.magFilter!==D&&r.magFilter!==F&&r.minFilter!==O&&r.minFilter!==B&&r.minFilter!==D&&r.minFilter!==F||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),a?(t.texParameteri(i,t.TEXTURE_WRAP_S,C[r.wrapS]),t.texParameteri(i,t.TEXTURE_WRAP_T,C[r.wrapT]),i!==t.TEXTURE_3D&&i!==t.TEXTURE_2D_ARRAY||t.texParameteri(i,t.TEXTURE_WRAP_R,C[r.wrapR]),t.texParameteri(i,t.TEXTURE_MAG_FILTER,L[r.magFilter]),t.texParameteri(i,t.TEXTURE_MIN_FILTER,L[r.minFilter])):(t.texParameteri(i,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(i,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),i!==t.TEXTURE_3D&&i!==t.TEXTURE_2D_ARRAY||t.texParameteri(i,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),r.wrapS===P&&r.wrapT===P||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(i,t.TEXTURE_MAG_FILTER,b(r.magFilter)),t.texParameteri(i,t.TEXTURE_MIN_FILTER,b(r.minFilter)),r.minFilter!==N&&r.minFilter!==O&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),r.compareFunction&&(t.texParameteri(i,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(i,t.TEXTURE_COMPARE_FUNC,k[r.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){if(r.magFilter===N)return;if(r.minFilter!==D&&r.minFilter!==F)return;if(r.type===W&&!1===e.has("OES_texture_float_linear"))return;if(!1===o&&r.type===j&&!1===e.has("OES_texture_half_float_linear"))return;if(r.anisotropy>1||n.get(r).__currentAnisotropy){const a=e.get("EXT_texture_filter_anisotropic");t.texParameterf(i,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(r.anisotropy,s.getMaxAnisotropy())),n.get(r).__currentAnisotropy=r.anisotropy}}}function q(e,i){let n=!1;void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",M));const s=i.source;let r=p.get(s);void 0===r&&(r={},p.set(s,r));const o=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}(i);if(o!==e.__cacheKey){void 0===r[o]&&(r[o]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,n=!0),r[o].usedTimes++;const s=r[e.__cacheKey];void 0!==s&&(r[e.__cacheKey].usedTimes--,0===s.usedTimes&&E(i)),e.__cacheKey=o,e.__webglTexture=r[o].texture}return n}function X(e,a,l){let c=t.TEXTURE_2D;(a.isDataArrayTexture||a.isCompressedArrayTexture)&&(c=t.TEXTURE_2D_ARRAY),a.isData3DTexture&&(c=t.TEXTURE_3D);const h=q(e,a),d=a.source;i.bindTexture(c,e.__webglTexture,t.TEXTURE0+l);const u=n.get(d);if(d.version!==u.__version||!0===h){i.activeTexture(t.TEXTURE0+l);const e=De.getPrimaries(De.workingColorSpace),n=a.colorSpace===Vt?null:De.getPrimaries(a.colorSpace),p=a.colorSpace===Vt||e===n?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,a.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,a.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);const m=function(t){return!o&&(t.wrapS!==P||t.wrapT!==P||t.minFilter!==N&&t.minFilter!==O)}(a)&&!1===v(a.image);let f=g(a.image,m,!1,s.maxTextureSize);f=nt(a,f);const b=v(f)||o,M=r.convert(a.format,a.colorSpace);let S,E=r.convert(a.type),T=x(a.internalFormat,M,E,a.colorSpace,a.isVideoTexture);G(c,a,b);const A=a.mipmaps,C=o&&!0!==a.isVideoTexture&&T!==ht,L=void 0===u.__version||!0===h,k=d.dataReady,R=w(a,f,b);if(a.isDepthTexture)T=t.DEPTH_COMPONENT,o?T=a.type===W?t.DEPTH_COMPONENT32F:a.type===V?t.DEPTH_COMPONENT24:a.type===Z?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT16:a.type===W&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),a.format===J&&T===t.DEPTH_COMPONENT&&a.type!==H&&a.type!==V&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),a.type=V,E=r.convert(a.type)),a.format===$&&T===t.DEPTH_COMPONENT&&(T=t.DEPTH_STENCIL,a.type!==Z&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),a.type=Z,E=r.convert(a.type))),L&&(C?i.texStorage2D(t.TEXTURE_2D,1,T,f.width,f.height):i.texImage2D(t.TEXTURE_2D,0,T,f.width,f.height,0,M,E,null));else if(a.isDataTexture)if(A.length>0&&b){C&&L&&i.texStorage2D(t.TEXTURE_2D,R,T,A[0].width,A[0].height);for(let e=0,n=A.length;e<n;e++)S=A[e],C?k&&i.texSubImage2D(t.TEXTURE_2D,e,0,0,S.width,S.height,M,E,S.data):i.texImage2D(t.TEXTURE_2D,e,T,S.width,S.height,0,M,E,S.data);a.generateMipmaps=!1}else C?(L&&i.texStorage2D(t.TEXTURE_2D,R,T,f.width,f.height),k&&i.texSubImage2D(t.TEXTURE_2D,0,0,0,f.width,f.height,M,E,f.data)):i.texImage2D(t.TEXTURE_2D,0,T,f.width,f.height,0,M,E,f.data);else if(a.isCompressedTexture)if(a.isCompressedArrayTexture){C&&L&&i.texStorage3D(t.TEXTURE_2D_ARRAY,R,T,A[0].width,A[0].height,f.depth);for(let e=0,n=A.length;e<n;e++)S=A[e],a.format!==Y?null!==M?C?k&&i.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,S.width,S.height,f.depth,M,S.data,0,0):i.compressedTexImage3D(t.TEXTURE_2D_ARRAY,e,T,S.width,S.height,f.depth,0,S.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):C?k&&i.texSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,S.width,S.height,f.depth,M,E,S.data):i.texImage3D(t.TEXTURE_2D_ARRAY,e,T,S.width,S.height,f.depth,0,M,E,S.data)}else{C&&L&&i.texStorage2D(t.TEXTURE_2D,R,T,A[0].width,A[0].height);for(let e=0,n=A.length;e<n;e++)S=A[e],a.format!==Y?null!==M?C?k&&i.compressedTexSubImage2D(t.TEXTURE_2D,e,0,0,S.width,S.height,M,S.data):i.compressedTexImage2D(t.TEXTURE_2D,e,T,S.width,S.height,0,S.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):C?k&&i.texSubImage2D(t.TEXTURE_2D,e,0,0,S.width,S.height,M,E,S.data):i.texImage2D(t.TEXTURE_2D,e,T,S.width,S.height,0,M,E,S.data)}else if(a.isDataArrayTexture)C?(L&&i.texStorage3D(t.TEXTURE_2D_ARRAY,R,T,f.width,f.height,f.depth),k&&i.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,M,E,f.data)):i.texImage3D(t.TEXTURE_2D_ARRAY,0,T,f.width,f.height,f.depth,0,M,E,f.data);else if(a.isData3DTexture)C?(L&&i.texStorage3D(t.TEXTURE_3D,R,T,f.width,f.height,f.depth),k&&i.texSubImage3D(t.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,M,E,f.data)):i.texImage3D(t.TEXTURE_3D,0,T,f.width,f.height,f.depth,0,M,E,f.data);else if(a.isFramebufferTexture){if(L)if(C)i.texStorage2D(t.TEXTURE_2D,R,T,f.width,f.height);else{let e=f.width,n=f.height;for(let s=0;s<R;s++)i.texImage2D(t.TEXTURE_2D,s,T,e,n,0,M,E,null),e>>=1,n>>=1}}else if(A.length>0&&b){if(C&&L){const e=st(A[0]);i.texStorage2D(t.TEXTURE_2D,R,T,e.width,e.height)}for(let e=0,n=A.length;e<n;e++)S=A[e],C?k&&i.texSubImage2D(t.TEXTURE_2D,e,0,0,M,E,S):i.texImage2D(t.TEXTURE_2D,e,T,M,E,S);a.generateMipmaps=!1}else if(C){if(L){const e=st(f);i.texStorage2D(t.TEXTURE_2D,R,T,e.width,e.height)}k&&i.texSubImage2D(t.TEXTURE_2D,0,0,0,M,E,f)}else i.texImage2D(t.TEXTURE_2D,0,T,M,E,f);_(a,b)&&y(c),u.__version=d.version,a.onUpdate&&a.onUpdate(a)}e.__version=a.version}function K(e,s,a,o,c,h){const d=r.convert(a.format,a.colorSpace),u=r.convert(a.type),p=x(a.internalFormat,d,u,a.colorSpace);if(!n.get(s).__hasExternalTextures){const e=Math.max(1,s.width>>h),n=Math.max(1,s.height>>h);c===t.TEXTURE_3D||c===t.TEXTURE_2D_ARRAY?i.texImage3D(c,h,p,e,n,s.depth,0,d,u,null):i.texImage2D(c,h,p,e,n,0,d,u,null)}i.bindFramebuffer(t.FRAMEBUFFER,e),it(s)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,o,c,n.get(a).__webglTexture,0,et(s)):(c===t.TEXTURE_2D||c>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,o,c,n.get(a).__webglTexture,h),i.bindFramebuffer(t.FRAMEBUFFER,null)}function Q(e,i,n){if(t.bindRenderbuffer(t.RENDERBUFFER,e),i.depthBuffer&&!i.stencilBuffer){let s=!0===o?t.DEPTH_COMPONENT24:t.DEPTH_COMPONENT16;if(n||it(i)){const e=i.depthTexture;e&&e.isDepthTexture&&(e.type===W?s=t.DEPTH_COMPONENT32F:e.type===V&&(s=t.DEPTH_COMPONENT24));const n=et(i);it(i)?l.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,n,s,i.width,i.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,n,s,i.width,i.height)}else t.renderbufferStorage(t.RENDERBUFFER,s,i.width,i.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)}else if(i.depthBuffer&&i.stencilBuffer){const s=et(i);n&&!1===it(i)?t.renderbufferStorageMultisample(t.RENDERBUFFER,s,t.DEPTH24_STENCIL8,i.width,i.height):it(i)?l.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,s,t.DEPTH24_STENCIL8,i.width,i.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)}else{const e=i.textures;for(let s=0;s<e.length;s++){const a=e[s],o=r.convert(a.format,a.colorSpace),c=r.convert(a.type),h=x(a.internalFormat,o,c,a.colorSpace),d=et(i);n&&!1===it(i)?t.renderbufferStorageMultisample(t.RENDERBUFFER,d,h,i.width,i.height):it(i)?l.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,d,h,i.width,i.height):t.renderbufferStorage(t.RENDERBUFFER,h,i.width,i.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function tt(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(t.FRAMEBUFFER,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),A(s.depthTexture,0);const r=n.get(s.depthTexture).__webglTexture,a=et(s);if(s.depthTexture.format===J)it(s)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,r,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,r,0);else{if(s.depthTexture.format!==$)throw new Error("Unknown depthTexture format");it(s)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,r,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,r,0)}}(s.__webglFramebuffer,e)}else if(r){s.__webglDepthbuffer=[];for(let n=0;n<6;n++)i.bindFramebuffer(t.FRAMEBUFFER,s.__webglFramebuffer[n]),s.__webglDepthbuffer[n]=t.createRenderbuffer(),Q(s.__webglDepthbuffer[n],e,!1)}else i.bindFramebuffer(t.FRAMEBUFFER,s.__webglFramebuffer),s.__webglDepthbuffer=t.createRenderbuffer(),Q(s.__webglDepthbuffer,e,!1);i.bindFramebuffer(t.FRAMEBUFFER,null)}function et(t){return Math.min(s.maxSamples,t.samples)}function it(t){const i=n.get(t);return o&&t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function nt(t,i){const n=t.colorSpace,s=t.format,r=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||t.format===re||n!==jt&&n!==Vt&&(De.getTransfer(n)===Yt?!1===o?!0===e.has("EXT_sRGB")&&s===Y?(t.format=re,t.minFilter=O,t.generateMipmaps=!1):i=ze.sRGBToLinear(i):s===Y&&r===z||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),i}function st(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?(h.width=t.naturalWidth||t.width,h.height=t.naturalHeight||t.height):"undefined"!=typeof VideoFrame&&t instanceof VideoFrame?(h.width=t.displayWidth,h.height=t.displayHeight):(h.width=t.width,h.height=t.height),h}this.allocateTextureUnit=function(){const t=T;return t>=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+s.maxTextures),T+=1,t},this.resetTextureUnits=function(){T=0},this.setTexture2D=A,this.setTexture2DArray=function(e,s){const r=n.get(e);e.version>0&&r.__version!==e.version?X(r,e,s):i.bindTexture(t.TEXTURE_2D_ARRAY,r.__webglTexture,t.TEXTURE0+s)},this.setTexture3D=function(e,s){const r=n.get(e);e.version>0&&r.__version!==e.version?X(r,e,s):i.bindTexture(t.TEXTURE_3D,r.__webglTexture,t.TEXTURE0+s)},this.setTextureCube=function(e,a){const l=n.get(e);e.version>0&&l.__version!==e.version?function(e,a,l){if(6!==a.image.length)return;const c=q(e,a),h=a.source;i.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+l);const d=n.get(h);if(h.version!==d.__version||!0===c){i.activeTexture(t.TEXTURE0+l);const e=De.getPrimaries(De.workingColorSpace),n=a.colorSpace===Vt?null:De.getPrimaries(a.colorSpace),u=a.colorSpace===Vt||e===n?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,a.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,a.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);const p=a.isCompressedTexture||a.image[0].isCompressedTexture,m=a.image[0]&&a.image[0].isDataTexture,f=[];for(let t=0;t<6;t++)f[t]=p||m?m?a.image[t].image:a.image[t]:g(a.image[t],!1,!0,s.maxCubemapSize),f[t]=nt(a,f[t]);const b=f[0],M=v(b)||o,S=r.convert(a.format,a.colorSpace),E=r.convert(a.type),T=x(a.internalFormat,S,E,a.colorSpace),A=o&&!0!==a.isVideoTexture,C=void 0===d.__version||!0===c,L=h.dataReady;let k,R=w(a,b,M);if(G(t.TEXTURE_CUBE_MAP,a,M),p){A&&C&&i.texStorage2D(t.TEXTURE_CUBE_MAP,R,T,b.width,b.height);for(let e=0;e<6;e++){k=f[e].mipmaps;for(let n=0;n<k.length;n++){const s=k[n];a.format!==Y?null!==S?A?L&&i.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,s.width,s.height,S,s.data):i.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,T,s.width,s.height,0,s.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):A?L&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,s.width,s.height,S,E,s.data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,T,s.width,s.height,0,S,E,s.data)}}}else{if(k=a.mipmaps,A&&C){k.length>0&&R++;const e=st(f[0]);i.texStorage2D(t.TEXTURE_CUBE_MAP,R,T,e.width,e.height)}for(let e=0;e<6;e++)if(m){A?L&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,f[e].width,f[e].height,S,E,f[e].data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,T,f[e].width,f[e].height,0,S,E,f[e].data);for(let n=0;n<k.length;n++){const s=k[n].image[e].image;A?L&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,0,0,s.width,s.height,S,E,s.data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,T,s.width,s.height,0,S,E,s.data)}}else{A?L&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,S,E,f[e]):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,T,S,E,f[e]);for(let n=0;n<k.length;n++){const s=k[n];A?L&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,0,0,S,E,s.image[e]):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,T,S,E,s.image[e])}}}_(a,M)&&y(t.TEXTURE_CUBE_MAP),d.__version=h.version,a.onUpdate&&a.onUpdate(a)}e.__version=a.version}(l,e,a):i.bindTexture(t.TEXTURE_CUBE_MAP,l.__webglTexture,t.TEXTURE0+a)},this.rebindTextures=function(e,i,s){const r=n.get(e);void 0!==i&&K(r.__webglFramebuffer,e,e.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),void 0!==s&&tt(e)},this.setupRenderTarget=function(e){const l=e.texture,c=n.get(e),h=n.get(l);e.addEventListener("dispose",S);const d=e.textures,u=!0===e.isWebGLCubeRenderTarget,p=d.length>1,m=v(e)||o;if(p||(void 0===h.__webglTexture&&(h.__webglTexture=t.createTexture()),h.__version=l.version,a.memory.textures++),u){c.__webglFramebuffer=[];for(let e=0;e<6;e++)if(o&&l.mipmaps&&l.mipmaps.length>0){c.__webglFramebuffer[e]=[];for(let i=0;i<l.mipmaps.length;i++)c.__webglFramebuffer[e][i]=t.createFramebuffer()}else c.__webglFramebuffer[e]=t.createFramebuffer()}else{if(o&&l.mipmaps&&l.mipmaps.length>0){c.__webglFramebuffer=[];for(let e=0;e<l.mipmaps.length;e++)c.__webglFramebuffer[e]=t.createFramebuffer()}else c.__webglFramebuffer=t.createFramebuffer();if(p)if(s.drawBuffers)for(let e=0,i=d.length;e<i;e++){const i=n.get(d[e]);void 0===i.__webglTexture&&(i.__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===it(e)){c.__webglMultisampledFramebuffer=t.createFramebuffer(),c.__webglColorRenderbuffer=[],i.bindFramebuffer(t.FRAMEBUFFER,c.__webglMultisampledFramebuffer);for(let i=0;i<d.length;i++){const n=d[i];c.__webglColorRenderbuffer[i]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,c.__webglColorRenderbuffer[i]);const s=r.convert(n.format,n.colorSpace),a=r.convert(n.type),o=x(n.internalFormat,s,a,n.colorSpace,!0===e.isXRRenderTarget),l=et(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,l,o,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+i,t.RENDERBUFFER,c.__webglColorRenderbuffer[i])}t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(c.__webglDepthRenderbuffer=t.createRenderbuffer(),Q(c.__webglDepthRenderbuffer,e,!0)),i.bindFramebuffer(t.FRAMEBUFFER,null)}}if(u){i.bindTexture(t.TEXTURE_CUBE_MAP,h.__webglTexture),G(t.TEXTURE_CUBE_MAP,l,m);for(let i=0;i<6;i++)if(o&&l.mipmaps&&l.mipmaps.length>0)for(let n=0;n<l.mipmaps.length;n++)K(c.__webglFramebuffer[i][n],e,l,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+i,n);else K(c.__webglFramebuffer[i],e,l,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+i,0);_(l,m)&&y(t.TEXTURE_CUBE_MAP),i.unbindTexture()}else if(p){for(let s=0,r=d.length;s<r;s++){const r=d[s],a=n.get(r);i.bindTexture(t.TEXTURE_2D,a.__webglTexture),G(t.TEXTURE_2D,r,m),K(c.__webglFramebuffer,e,r,t.COLOR_ATTACHMENT0+s,t.TEXTURE_2D,0),_(r,m)&&y(t.TEXTURE_2D)}i.unbindTexture()}else{let n=t.TEXTURE_2D;if((e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(o?n=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),i.bindTexture(n,h.__webglTexture),G(n,l,m),o&&l.mipmaps&&l.mipmaps.length>0)for(let i=0;i<l.mipmaps.length;i++)K(c.__webglFramebuffer[i],e,l,t.COLOR_ATTACHMENT0,n,i);else K(c.__webglFramebuffer,e,l,t.COLOR_ATTACHMENT0,n,0);_(l,m)&&y(n),i.unbindTexture()}e.depthBuffer&&tt(e)},this.updateRenderTargetMipmap=function(e){const s=v(e)||o,r=e.textures;for(let a=0,o=r.length;a<o;a++){const o=r[a];if(_(o,s)){const s=e.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,r=n.get(o).__webglTexture;i.bindTexture(s,r),y(s),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(o&&e.samples>0&&!1===it(e)){const s=e.textures,r=e.width,a=e.height;let o=t.COLOR_BUFFER_BIT;const l=[],h=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,d=n.get(e),u=s.length>1;if(u)for(let e=0;e<s.length;e++)i.bindFramebuffer(t.FRAMEBUFFER,d.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,null),i.bindFramebuffer(t.FRAMEBUFFER,d.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,null,0);i.bindFramebuffer(t.READ_FRAMEBUFFER,d.__webglMultisampledFramebuffer),i.bindFramebuffer(t.DRAW_FRAMEBUFFER,d.__webglFramebuffer);for(let i=0;i<s.length;i++){l.push(t.COLOR_ATTACHMENT0+i),e.depthBuffer&&l.push(h);const p=void 0!==d.__ignoreDepthValues&&d.__ignoreDepthValues;if(!1===p&&(e.depthBuffer&&(o|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&(o|=t.STENCIL_BUFFER_BIT)),u&&t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,d.__webglColorRenderbuffer[i]),!0===p&&(t.invalidateFramebuffer(t.READ_FRAMEBUFFER,[h]),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[h])),u){const e=n.get(s[i]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0)}t.blitFramebuffer(0,0,r,a,0,0,r,a,o,t.NEAREST),c&&t.invalidateFramebuffer(t.READ_FRAMEBUFFER,l)}if(i.bindFramebuffer(t.READ_FRAMEBUFFER,null),i.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),u)for(let e=0;e<s.length;e++){i.bindFramebuffer(t.FRAMEBUFFER,d.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,d.__webglColorRenderbuffer[e]);const r=n.get(s[e]).__webglTexture;i.bindFramebuffer(t.FRAMEBUFFER,d.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,r,0)}i.bindFramebuffer(t.DRAW_FRAMEBUFFER,d.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=tt,this.setupFrameBufferTexture=K,this.useMultisampledRTT=it}function ao(t,e,i){const n=i.isWebGL2;return{convert:function(i,s=""){let r;const a=De.getTransfer(s);if(i===z)return t.UNSIGNED_BYTE;if(i===q)return t.UNSIGNED_SHORT_4_4_4_4;if(i===X)return t.UNSIGNED_SHORT_5_5_5_1;if(1010===i)return t.BYTE;if(1011===i)return t.SHORT;if(i===H)return t.UNSIGNED_SHORT;if(i===G)return t.INT;if(i===V)return t.UNSIGNED_INT;if(i===W)return t.FLOAT;if(i===j)return n?t.HALF_FLOAT:(r=e.get("OES_texture_half_float"),null!==r?r.HALF_FLOAT_OES:null);if(1021===i)return t.ALPHA;if(i===Y)return t.RGBA;if(1024===i)return t.LUMINANCE;if(1025===i)return t.LUMINANCE_ALPHA;if(i===J)return t.DEPTH_COMPONENT;if(i===$)return t.DEPTH_STENCIL;if(i===re)return r=e.get("EXT_sRGB"),null!==r?r.SRGB_ALPHA_EXT:null;if(i===K)return t.RED;if(i===Q)return t.RED_INTEGER;if(1030===i)return t.RG;if(i===tt)return t.RG_INTEGER;if(i===et)return t.RGBA_INTEGER;if(i===it||i===nt||i===st||i===rt)if(a===Yt){if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(i===it)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===nt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===st)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===rt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=e.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(i===it)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===nt)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===st)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===rt)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(i===at||i===ot||i===lt||i===ct){if(r=e.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(i===at)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===ot)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===lt)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===ct)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(i===ht)return r=e.get("WEBGL_compressed_texture_etc1"),null!==r?r.COMPRESSED_RGB_ETC1_WEBGL:null;if(i===dt||i===ut){if(r=e.get("WEBGL_compressed_texture_etc"),null===r)return null;if(i===dt)return a===Yt?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(i===ut)return a===Yt?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(i===pt||i===mt||i===ft||i===gt||i===vt||i===_t||i===yt||i===xt||i===wt||i===bt||i===Mt||i===St||i===Et||i===Tt){if(r=e.get("WEBGL_compressed_texture_astc"),null===r)return null;if(i===pt)return a===Yt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===mt)return a===Yt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===ft)return a===Yt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===gt)return a===Yt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===vt)return a===Yt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===_t)return a===Yt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===yt)return a===Yt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===xt)return a===Yt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===wt)return a===Yt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===bt)return a===Yt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Mt)return a===Yt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===St)return a===Yt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Et)return a===Yt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Tt)return a===Yt?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(i===At||i===Ct||i===Lt){if(r=e.get("EXT_texture_compression_bptc"),null===r)return null;if(i===At)return a===Yt?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Ct)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Lt)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===i||i===kt||i===Rt||i===Pt){if(r=e.get("EXT_texture_compression_rgtc"),null===r)return null;if(i===At)return r.COMPRESSED_RED_RGTC1_EXT;if(i===kt)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Rt)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Pt)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return i===Z?n?t.UNSIGNED_INT_24_8:(r=e.get("WEBGL_depth_texture"),null!==r?r.UNSIGNED_INT_24_8_WEBGL:null):void 0!==t[i]?t[i]:null}}}class oo extends vs{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class lo extends en{constructor(){super(),this.isGroup=!0,this.type="Group"}}const co={type:"move"};class ho{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new lo,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 lo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Ke,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Ke),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new lo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Ke,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Ke),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.matrixWorldNeedsUpdate=!0,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),o.matrixWorldNeedsUpdate=!0,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),a.matrixWorldNeedsUpdate=!0,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(co)))}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 lo;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}class uo{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,i){if(null===this.texture){const n=new je;t.properties.get(n).__webglTexture=e.texture,e.depthNear==i.depthNear&&e.depthFar==i.depthFar||(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}render(t,e){if(null!==this.texture){if(null===this.mesh){const t=e.cameras[0].viewport,i=new us({extensions:{fragDepth:!0},vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepthEXT = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepthEXT = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new rs(new Rs(20,20),i)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}}class po extends le{constructor(t,e){super();const i=this;let n=null,s=1,r=null,a="local-floor",o=1,l=null,c=null,h=null,d=null,u=null,p=null;const m=new uo,f=e.getContextAttributes();let g=null,v=null;const _=[],y=[],x=new be;let w=null;const b=new vs;b.layers.enable(1),b.viewport=new qe;const M=new vs;M.layers.enable(2),M.viewport=new qe;const S=[b,M],E=new oo;E.layers.enable(1),E.layers.enable(2);let T=null,A=null;function C(t){const e=y.indexOf(t.inputSource);if(-1===e)return;const i=_[e];void 0!==i&&(i.update(t.inputSource,t.frame,l||r),i.dispatchEvent({type:t.type,data:t.inputSource}))}function L(){n.removeEventListener("select",C),n.removeEventListener("selectstart",C),n.removeEventListener("selectend",C),n.removeEventListener("squeeze",C),n.removeEventListener("squeezestart",C),n.removeEventListener("squeezeend",C),n.removeEventListener("end",L),n.removeEventListener("inputsourceschange",k);for(let t=0;t<_.length;t++){const e=y[t];null!==e&&(y[t]=null,_[t].disconnect(e))}T=null,A=null,m.reset(),t.setRenderTarget(g),u=null,d=null,h=null,n=null,v=null,U.stop(),i.isPresenting=!1,t.setPixelRatio(w),t.setSize(x.width,x.height,!1),i.dispatchEvent({type:"sessionend"})}function k(t){for(let e=0;e<t.removed.length;e++){const i=t.removed[e],n=y.indexOf(i);n>=0&&(y[n]=null,_[n].disconnect(i))}for(let e=0;e<t.added.length;e++){const i=t.added[e];let n=y.indexOf(i);if(-1===n){for(let t=0;t<_.length;t++){if(t>=y.length){y.push(i),n=t;break}if(null===y[t]){y[t]=i,n=t;break}}if(-1===n)break}const s=_[n];s&&s.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=_[t];return void 0===e&&(e=new ho,_[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=_[t];return void 0===e&&(e=new ho,_[t]=e),e.getGripSpace()},this.getHand=function(t){let e=_[t];return void 0===e&&(e=new ho,_[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(g=t.getRenderTarget(),n.addEventListener("select",C),n.addEventListener("selectstart",C),n.addEventListener("selectend",C),n.addEventListener("squeeze",C),n.addEventListener("squeezestart",C),n.addEventListener("squeezeend",C),n.addEventListener("end",L),n.addEventListener("inputsourceschange",k),!0!==f.xrCompatible&&await e.makeXRCompatible(),w=t.getPixelRatio(),t.getSize(x),void 0===n.renderState.layers||!1===t.capabilities.isWebGL2){const i={antialias:void 0!==n.renderState.layers||f.antialias,alpha:!0,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:s};u=new XRWebGLLayer(n,e,i),n.updateRenderState({baseLayer:u}),t.setPixelRatio(1),t.setSize(u.framebufferWidth,u.framebufferHeight,!1),v=new Ze(u.framebufferWidth,u.framebufferHeight,{format:Y,type:z,colorSpace:t.outputColorSpace,stencilBuffer:f.stencil})}else{let i=null,r=null,a=null;f.depth&&(a=f.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,i=f.stencil?$:J,r=f.stencil?Z:V);const o={colorFormat:e.RGBA8,depthFormat:a,scaleFactor:s};h=new XRWebGLBinding(n,e),d=h.createProjectionLayer(o),n.updateRenderState({layers:[d]}),t.setPixelRatio(1),t.setSize(d.textureWidth,d.textureHeight,!1),v=new Ze(d.textureWidth,d.textureHeight,{format:Y,type:z,depthTexture:new gr(d.textureWidth,d.textureHeight,r,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:f.stencil,colorSpace:t.outputColorSpace,samples:f.antialias?4:0});t.properties.get(v).__ignoreDepthValues=d.ignoreDepthValues}v.isXRRenderTarget=!0,this.setFoveation(o),l=null,r=await n.requestReferenceSpace(a),U.setContext(n),U.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==n)return n.environmentBlendMode};const R=new Ke,P=new Ke;function I(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===n)return;null!==m.texture&&(t.near=m.depthNear,t.far=m.depthFar),E.near=M.near=b.near=t.near,E.far=M.far=b.far=t.far,T===E.near&&A===E.far||(n.updateRenderState({depthNear:E.near,depthFar:E.far}),T=E.near,A=E.far,b.near=T,b.far=A,M.near=T,M.far=A,b.updateProjectionMatrix(),M.updateProjectionMatrix(),t.updateProjectionMatrix());const e=t.parent,i=E.cameras;I(E,e);for(let t=0;t<i.length;t++)I(i[t],e);2===i.length?function(t,e,i){R.setFromMatrixPosition(e.matrixWorld),P.setFromMatrixPosition(i.matrixWorld);const n=R.distanceTo(P),s=e.projectionMatrix.elements,r=i.projectionMatrix.elements,a=s[14]/(s[10]-1),o=s[14]/(s[10]+1),l=(s[9]+1)/s[5],c=(s[9]-1)/s[5],h=(s[8]-1)/s[0],d=(r[8]+1)/r[0],u=a*h,p=a*d,m=n/(-h+d),f=m*-h;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,w=c*o/v*g;t.projectionMatrix.makePerspective(_,y,x,w,g,v),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}(E,b,M):E.projectionMatrix.copy(b.projectionMatrix),function(t,e,i){null===i?t.matrix.copy(e.matrixWorld):(t.matrix.copy(i.matrixWorld),t.matrix.invert(),t.matrix.multiply(e.matrixWorld));t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*ue*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}(t,E,e)},this.getCamera=function(){return E},this.getFoveation=function(){if(null!==d||null!==u)return o},this.setFoveation=function(t){o=t,null!==d&&(d.fixedFoveation=t),null!==u&&void 0!==u.fixedFoveation&&(u.fixedFoveation=t)},this.hasDepthSensing=function(){return null!==m.texture};let N=null;const U=new Ls;U.setAnimationLoop((function(e,s){if(c=s.getViewerPose(l||r),p=s,null!==c){const e=c.views;null!==u&&(t.setRenderTargetFramebuffer(v,u.framebuffer),t.setRenderTarget(v));let i=!1;e.length!==E.cameras.length&&(E.cameras.length=0,i=!0);for(let n=0;n<e.length;n++){const s=e[n];let r=null;if(null!==u)r=u.getViewport(s);else{const e=h.getViewSubImage(d,s);r=e.viewport,0===n&&(t.setRenderTargetTextures(v,e.colorTexture,d.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(v))}let a=S[n];void 0===a&&(a=new vs,a.layers.enable(n),a.viewport=new qe,S[n]=a),a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale),a.projectionMatrix.fromArray(s.projectionMatrix),a.projectionMatrixInverse.copy(a.projectionMatrix).invert(),a.viewport.set(r.x,r.y,r.width,r.height),0===n&&(E.matrix.copy(a.matrix),E.matrix.decompose(E.position,E.quaternion,E.scale)),!0===i&&E.cameras.push(a)}const s=n.enabledFeatures;if(s&&s.includes("depth-sensing")){const i=h.getDepthInformation(e[0]);i&&i.isValid&&i.texture&&m.init(t,i,n.renderState)}}for(let t=0;t<_.length;t++){const e=y[t],i=_[t];null!==e&&void 0!==i&&i.update(e,s,l||r)}m.render(t,E),N&&N(e,s),s.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:s}),p=null})),this.setAnimationLoop=function(t){N=t},this.dispose=function(){}}}const mo=new Bi,fo=new Ci;function go(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===l&&(n.bumpScale.value*=-1)),s.normalMap&&(n.normalMap.value=s.normalMap,i(s.normalMap,n.normalMapTransform),n.normalScale.value.copy(s.normalScale),s.side===l&&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),a=r.envMap,o=r.envMapRotation;if(a&&(n.envMap.value=a,mo.copy(o),mo.x*=-1,mo.y*=-1,mo.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(mo.y*=-1,mo.z*=-1),n.envMapRotation.value.setFromMatrix4(fo.makeRotationFromEuler(mo)),n.flipEnvMap.value=a.isCubeTexture&&!1===a.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,hs(t)),i.isFog?(e.fogNear.value=i.near,e.fogFar.value=i.far):i.isFogExp2&&(e.fogDensity.value=i.density)},refreshMaterialUniforms:function(t,s,r,a,o){s.isMeshBasicMaterial||s.isMeshLambertMaterial?n(t,s):s.isMeshToonMaterial?(n(t,s),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,s)):s.isMeshPhongMaterial?(n(t,s),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,s)):s.isMeshStandardMaterial?(n(t,s),function(t,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===l&&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));e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,i(e.anisotropyMap,t.anisotropyMapTransform)));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,i(e.specularColorMap,t.specularColorMapTransform));e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,i(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,s,o)):s.isMeshMatcapMaterial?(n(t,s),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,s)):s.isMeshDepthMaterial?n(t,s):s.isMeshDistanceMaterial?(n(t,s),function(t,i){const n=e.get(i).light;t.referencePosition.value.setFromMatrixPosition(n.matrixWorld),t.nearDistance.value=n.shadow.camera.near,t.farDistance.value=n.shadow.camera.far}(t,s)):s.isMeshNormalMaterial?n(t,s):s.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,i(e.map,t.mapTransform))}(t,s),s.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,s)):s.isPointsMaterial?function(t,e,n,s){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*s,e.map&&(t.map.value=e.map,i(e.map,t.uvTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap,i(e.alphaMap,t.alphaMapTransform));e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,s,r,a):s.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,i(e.map,t.mapTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap,i(e.alphaMap,t.alphaMapTransform));e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,s):s.isShadowMaterial?(t.color.value.copy(s.color),t.opacity.value=s.opacity):s.isShaderMaterial&&(s.uniformsNeedUpdate=!1)}}}function vo(t,e,i,n){let s={},r={},a=[];const o=i.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(t,e,i,n){const s=t.value,r=e+"_"+i;if(void 0===n[r])return n[r]="number"==typeof s||"boolean"==typeof s?s:s.clone(),!0;{const t=n[r];if("number"==typeof s||"boolean"==typeof s){if(t!==s)return n[r]=s,!0}else if(!1===t.equals(s))return t.copy(s),!0}return!1}function c(t){const e={boundary:0,storage:0};return"number"==typeof t||"boolean"==typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.storage=64):t.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",t),e}function h(e){const i=e.target;i.removeEventListener("dispose",h);const n=a.indexOf(i.__bindingPointIndex);a.splice(n,1),t.deleteBuffer(s[i.id]),delete s[i.id],delete r[i.id]}return{bind:function(t,e){const i=e.program;n.uniformBlockBinding(t,i)},update:function(i,d){let u=s[i.id];void 0===u&&(!function(t){const e=t.uniforms;let i=0;const n=16;for(let t=0,s=e.length;t<s;t++){const s=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0,e=s.length;t<e;t++){const e=s[t],r=Array.isArray(e.value)?e.value:[e.value];for(let t=0,s=r.length;t<s;t++){const s=c(r[t]),a=i%n;0!==a&&n-a<s.boundary&&(i+=n-a),e.__data=new Float32Array(s.storage/Float32Array.BYTES_PER_ELEMENT),e.__offset=i,i+=s.storage}}}const s=i%n;s>0&&(i+=n-s);t.__size=i,t.__cache={}}(i),u=function(e){const i=function(){for(let t=0;t<o;t++)if(-1===a.indexOf(t))return a.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();e.__bindingPointIndex=i;const n=t.createBuffer(),s=e.__size,r=e.usage;return t.bindBuffer(t.UNIFORM_BUFFER,n),t.bufferData(t.UNIFORM_BUFFER,s,r),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,i,n),n}(i),s[i.id]=u,i.addEventListener("dispose",h));const p=d.program;n.updateUBOMapping(i,p);const m=e.render.frame;r[i.id]!==m&&(!function(e){const i=s[e.id],n=e.uniforms,r=e.__cache;t.bindBuffer(t.UNIFORM_BUFFER,i);for(let e=0,i=n.length;e<i;e++){const i=Array.isArray(n[e])?n[e]:[n[e]];for(let n=0,s=i.length;n<s;n++){const s=i[n];if(!0===l(s,e,n,r)){const e=s.__offset,i=Array.isArray(s.value)?s.value:[s.value];let n=0;for(let r=0;r<i.length;r++){const a=i[r],o=c(a);"number"==typeof a||"boolean"==typeof a?(s.__data[0]=a,t.bufferSubData(t.UNIFORM_BUFFER,e+n,s.__data)):a.isMatrix3?(s.__data[0]=a.elements[0],s.__data[1]=a.elements[1],s.__data[2]=a.elements[2],s.__data[3]=0,s.__data[4]=a.elements[3],s.__data[5]=a.elements[4],s.__data[6]=a.elements[5],s.__data[7]=0,s.__data[8]=a.elements[6],s.__data[9]=a.elements[7],s.__data[10]=a.elements[8],s.__data[11]=0):(a.toArray(s.__data,n),n+=o.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,e,s.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}(i),r[i.id]=m)},dispose:function(){for(const e in s)t.deleteBuffer(s[e]);a=[],s={},r={}}}}class _o{constructor(t={}){const{canvas:i=Le(),context:n=null,depth:s=!0,stencil:r=!0,alpha:a=!1,antialias:c=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:d=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:p=!1}=t;let m;this.isWebGLRenderer=!0,m=null!==n?n.getContextAttributes().alpha:a;const g=new Uint32Array(4),v=new Int32Array(4);let _=null,y=null;const x=[],w=[];this.domElement=i,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Wt,this._useLegacyLights=!1,this.toneMapping=f,this.toneMappingExposure=1;const b=this;let M=!1,S=0,E=0,T=null,A=-1,C=null;const L=new qe,k=new qe;let R=null;const P=new _n(0);let I=0,N=i.width,U=i.height,D=1,O=null,B=null;const G=new qe(0,0,N,U),J=new qe(0,0,N,U);let $=!1;const K=new Cs;let it=!1,nt=!1,st=null;const rt=new Ci,at=new be,ot=new Ke,lt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ct(){return null===T?D:1}let ht,dt,ut,pt,mt,ft,gt,vt,_t,yt,xt,wt,bt,Mt,St,Et,Tt,At,Ct,Lt,kt,Rt,Pt,It,Nt=n;function Ut(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 t={alpha:!0,depth:s,stencil:r,antialias:c,premultipliedAlpha:h,preserveDrawingBuffer:d,powerPreference:u,failIfMajorPerformanceCaveat:p};if("setAttribute"in i&&i.setAttribute("data-engine",`three.js r${e}`),i.addEventListener("webglcontextlost",Bt,!1),i.addEventListener("webglcontextrestored",Ft,!1),i.addEventListener("webglcontextcreationerror",zt,!1),null===Nt){const e=["webgl2","webgl","experimental-webgl"];if(!0===b.isWebGL1Renderer&&e.shift(),Nt=Ut(e,t),null===Nt)throw Ut(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}"undefined"!=typeof WebGLRenderingContext&&Nt instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),void 0===Nt.getShaderPrecisionFormat&&(Nt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function Dt(){ht=new lr(Nt),dt=new Hs(Nt,ht,t),ht.init(dt),Rt=new ao(Nt,ht,dt),ut=new so(Nt,ht,dt),pt=new dr(Nt),mt=new Wa,ft=new ro(Nt,ht,ut,mt,dt,Rt,pt),gt=new Vs(b),vt=new or(b),_t=new ks(Nt,dt),Pt=new Fs(Nt,ht,_t,dt),yt=new cr(Nt,_t,pt,Pt),xt=new fr(Nt,yt,_t,pt),Ct=new mr(Nt,dt,ft),Et=new Gs(mt),wt=new Va(b,gt,vt,ht,dt,Pt,Et),bt=new go(b,mt),Mt=new Za,St=new to(ht,dt),At=new Bs(b,gt,vt,ut,xt,m,h),Tt=new no(b,xt,dt),It=new vo(Nt,pt,dt,ut),Lt=new zs(Nt,ht,pt,dt),kt=new hr(Nt,ht,pt,dt),pt.programs=wt.programs,b.capabilities=dt,b.extensions=ht,b.properties=mt,b.renderLists=Mt,b.shadowMap=Tt,b.state=ut,b.info=pt}Dt();const Ot=new po(b,Nt);function Bt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),M=!0}function Ft(){console.log("THREE.WebGLRenderer: Context Restored."),M=!1;const t=pt.autoReset,e=Tt.enabled,i=Tt.autoUpdate,n=Tt.needsUpdate,s=Tt.type;Dt(),pt.autoReset=t,Tt.enabled=e,Tt.autoUpdate=i,Tt.needsUpdate=n,Tt.type=s}function zt(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function Ht(t){const e=t.target;e.removeEventListener("dispose",Ht),function(t){(function(t){const e=mt.get(t).programs;void 0!==e&&(e.forEach((function(t){wt.releaseProgram(t)})),t.isShaderMaterial&&wt.releaseShaderCache(t))})(t),mt.remove(t)}(e)}function Gt(t,e,i){!0===t.transparent&&2===t.side&&!1===t.forceSinglePass?(t.side=l,t.needsUpdate=!0,Qt(t,e,i),t.side=o,t.needsUpdate=!0,Qt(t,e,i),t.side=2):Qt(t,e,i)}this.xr=Ot,this.getContext=function(){return Nt},this.getContextAttributes=function(){return Nt.getContextAttributes()},this.forceContextLoss=function(){const t=ht.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=ht.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return D},this.setPixelRatio=function(t){void 0!==t&&(D=t,this.setSize(N,U,!1))},this.getSize=function(t){return t.set(N,U)},this.setSize=function(t,e,n=!0){Ot.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(N=t,U=e,i.width=Math.floor(t*D),i.height=Math.floor(e*D),!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(N*D,U*D).floor()},this.setDrawingBufferSize=function(t,e,n){N=t,U=e,D=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(L)},this.getViewport=function(t){return t.copy(G)},this.setViewport=function(t,e,i,n){t.isVector4?G.set(t.x,t.y,t.z,t.w):G.set(t,e,i,n),ut.viewport(L.copy(G).multiplyScalar(D).round())},this.getScissor=function(t){return t.copy(J)},this.setScissor=function(t,e,i,n){t.isVector4?J.set(t.x,t.y,t.z,t.w):J.set(t,e,i,n),ut.scissor(k.copy(J).multiplyScalar(D).round())},this.getScissorTest=function(){return $},this.setScissorTest=function(t){ut.setScissorTest($=t)},this.setOpaqueSort=function(t){O=t},this.setTransparentSort=function(t){B=t},this.getClearColor=function(t){return t.copy(At.getClearColor())},this.setClearColor=function(){At.setClearColor.apply(At,arguments)},this.getClearAlpha=function(){return At.getClearAlpha()},this.setClearAlpha=function(){At.setClearAlpha.apply(At,arguments)},this.clear=function(t=!0,e=!0,i=!0){let n=0;if(t){let t=!1;if(null!==T){const e=T.texture.format;t=e===et||e===tt||e===Q}if(t){const t=T.texture.type,e=t===z||t===V||t===H||t===Z||t===q||t===X,i=At.getClearColor(),n=At.getClearAlpha(),s=i.r,r=i.g,a=i.b;e?(g[0]=s,g[1]=r,g[2]=a,g[3]=n,Nt.clearBufferuiv(Nt.COLOR,0,g)):(v[0]=s,v[1]=r,v[2]=a,v[3]=n,Nt.clearBufferiv(Nt.COLOR,0,v))}else n|=Nt.COLOR_BUFFER_BIT}e&&(n|=Nt.DEPTH_BUFFER_BIT),i&&(n|=Nt.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Nt.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",Bt,!1),i.removeEventListener("webglcontextrestored",Ft,!1),i.removeEventListener("webglcontextcreationerror",zt,!1),Mt.dispose(),St.dispose(),mt.dispose(),gt.dispose(),vt.dispose(),xt.dispose(),Pt.dispose(),It.dispose(),wt.dispose(),Ot.dispose(),Ot.removeEventListener("sessionstart",qt),Ot.removeEventListener("sessionend",Xt),st&&(st.dispose(),st=null),Zt.stop()},this.renderBufferDirect=function(t,e,i,n,s,r){null===e&&(e=lt);const a=s.isMesh&&s.matrixWorld.determinant()<0,o=function(t,e,i,n,s){!0!==e.isScene&&(e=lt);ft.resetTextureUnits();const r=e.fog,a=n.isMeshStandardMaterial?e.environment:null,o=null===T?b.outputColorSpace:!0===T.isXRRenderTarget?T.texture.colorSpace:jt,l=(n.isMeshStandardMaterial?vt:gt).get(n.envMap||a),c=!0===n.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,h=!!i.attributes.tangent&&(!!n.normalMap||n.anisotropy>0),d=!!i.morphAttributes.position,u=!!i.morphAttributes.normal,p=!!i.morphAttributes.color;let m=f;n.toneMapped&&(null!==T&&!0!==T.isXRRenderTarget||(m=b.toneMapping));const g=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,v=void 0!==g?g.length:0,_=mt.get(n),x=y.state.lights;if(!0===it&&(!0===nt||t!==C)){const e=t===C&&n.id===A;Et.setState(n,t,e)}let w=!1;n.version===_.__version?_.needsLights&&_.lightsStateVersion!==x.state.version||_.outputColorSpace!==o||s.isBatchedMesh&&!1===_.batching?w=!0:s.isBatchedMesh||!0!==_.batching?s.isInstancedMesh&&!1===_.instancing?w=!0:s.isInstancedMesh||!0!==_.instancing?s.isSkinnedMesh&&!1===_.skinning?w=!0:s.isSkinnedMesh||!0!==_.skinning?s.isInstancedMesh&&!0===_.instancingColor&&null===s.instanceColor||s.isInstancedMesh&&!1===_.instancingColor&&null!==s.instanceColor||s.isInstancedMesh&&!0===_.instancingMorph&&null===s.morphTexture||s.isInstancedMesh&&!1===_.instancingMorph&&null!==s.morphTexture||_.envMap!==l||!0===n.fog&&_.fog!==r?w=!0:void 0===_.numClippingPlanes||_.numClippingPlanes===Et.numPlanes&&_.numIntersection===Et.numIntersection?(_.vertexAlphas!==c||_.vertexTangents!==h||_.morphTargets!==d||_.morphNormals!==u||_.morphColors!==p||_.toneMapping!==m||!0===dt.isWebGL2&&_.morphTargetsCount!==v)&&(w=!0):w=!0:w=!0:w=!0:w=!0:(w=!0,_.__version=n.version);let M=_.currentProgram;!0===w&&(M=Qt(n,e,s));let S=!1,E=!1,L=!1;const k=M.getUniforms(),R=_.uniforms;ut.useProgram(M.program)&&(S=!0,E=!0,L=!0);n.id!==A&&(A=n.id,E=!0);if(S||C!==t){k.setValue(Nt,"projectionMatrix",t.projectionMatrix),k.setValue(Nt,"viewMatrix",t.matrixWorldInverse);const e=k.map.cameraPosition;void 0!==e&&e.setValue(Nt,ot.setFromMatrixPosition(t.matrixWorld)),dt.logarithmicDepthBuffer&&k.setValue(Nt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&k.setValue(Nt,"isOrthographic",!0===t.isOrthographicCamera),C!==t&&(C=t,E=!0,L=!0)}if(s.isSkinnedMesh){k.setOptional(Nt,s,"bindMatrix"),k.setOptional(Nt,s,"bindMatrixInverse");const t=s.skeleton;t&&(dt.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),k.setValue(Nt,"boneTexture",t.boneTexture,ft)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}s.isBatchedMesh&&(k.setOptional(Nt,s,"batchingTexture"),k.setValue(Nt,"batchingTexture",s._matricesTexture,ft));const P=i.morphAttributes;(void 0!==P.position||void 0!==P.normal||void 0!==P.color&&!0===dt.isWebGL2)&&Ct.update(s,i,M);(E||_.receiveShadow!==s.receiveShadow)&&(_.receiveShadow=s.receiveShadow,k.setValue(Nt,"receiveShadow",s.receiveShadow));n.isMeshGouraudMaterial&&null!==n.envMap&&(R.envMap.value=l,R.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1);E&&(k.setValue(Nt,"toneMappingExposure",b.toneMappingExposure),_.needsLights&&(N=L,(I=R).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),r&&!0===n.fog&&bt.refreshFogUniforms(R,r),bt.refreshMaterialUniforms(R,n,D,U,st),wa.upload(Nt,te(_),R,ft));var I,N;n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(wa.upload(Nt,te(_),R,ft),n.uniformsNeedUpdate=!1);n.isSpriteMaterial&&k.setValue(Nt,"center",s.center);if(k.setValue(Nt,"modelViewMatrix",s.modelViewMatrix),k.setValue(Nt,"normalMatrix",s.normalMatrix),k.setValue(Nt,"modelMatrix",s.matrixWorld),n.isShaderMaterial||n.isRawShaderMaterial){const t=n.uniformsGroups;for(let e=0,i=t.length;e<i;e++)if(dt.isWebGL2){const i=t[e];It.update(i,M),It.bind(i,M)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return M}(t,e,i,n,s);ut.setMaterial(n,a);let l=i.index,c=1;if(!0===n.wireframe){if(l=yt.getWireframeAttribute(i),void 0===l)return;c=2}const h=i.drawRange,d=i.attributes.position;let u=h.start*c,p=(h.start+h.count)*c;null!==r&&(u=Math.max(u,r.start*c),p=Math.min(p,(r.start+r.count)*c)),null!==l?(u=Math.max(u,0),p=Math.min(p,l.count)):null!=d&&(u=Math.max(u,0),p=Math.min(p,d.count));const m=p-u;if(m<0||m===1/0)return;let g;Pt.setup(s,n,o,i,l);let v=Lt;if(null!==l&&(g=_t.get(l),v=kt,v.setIndex(g)),s.isMesh)!0===n.wireframe?(ut.setLineWidth(n.wireframeLinewidth*ct()),v.setMode(Nt.LINES)):v.setMode(Nt.TRIANGLES);else if(s.isLine){let t=n.linewidth;void 0===t&&(t=1),ut.setLineWidth(t*ct()),s.isLineSegments?v.setMode(Nt.LINES):s.isLineLoop?v.setMode(Nt.LINE_LOOP):v.setMode(Nt.LINE_STRIP)}else s.isPoints?v.setMode(Nt.POINTS):s.isSprite&&v.setMode(Nt.TRIANGLES);if(s.isBatchedMesh)v.renderMultiDraw(s._multiDrawStarts,s._multiDrawCounts,s._multiDrawCount);else if(s.isInstancedMesh)v.renderInstances(u,m,s.count);else if(i.isInstancedBufferGeometry){const t=void 0!==i._maxInstanceCount?i._maxInstanceCount:1/0,e=Math.min(i.instanceCount,t);v.renderInstances(u,m,e)}else v.render(u,m)},this.compile=function(t,e,i=null){null===i&&(i=t),y=St.get(i),y.init(),w.push(y),i.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(y.pushLight(t),t.castShadow&&y.pushShadow(t))})),t!==i&&t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(y.pushLight(t),t.castShadow&&y.pushShadow(t))})),y.setupLights(b._useLegacyLights);const n=new Set;return t.traverse((function(t){const e=t.material;if(e)if(Array.isArray(e))for(let s=0;s<e.length;s++){const r=e[s];Gt(r,i,t),n.add(r)}else Gt(e,i,t),n.add(e)})),w.pop(),y=null,n},this.compileAsync=function(t,e,i=null){const n=this.compile(t,e,i);return new Promise((e=>{function i(){n.forEach((function(t){mt.get(t).currentProgram.isReady()&&n.delete(t)})),0!==n.size?setTimeout(i,10):e(t)}null!==ht.get("KHR_parallel_shader_compile")?i():setTimeout(i,10)}))};let Vt=null;function qt(){Zt.stop()}function Xt(){Zt.start()}const Zt=new Ls;function Yt(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)y.pushLight(t),t.castShadow&&y.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||K.intersectsSprite(t)){n&&ot.setFromMatrixPosition(t.matrixWorld).applyMatrix4(rt);const e=xt.update(t),s=t.material;s.visible&&_.push(t,e,s,i,ot.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||K.intersectsObject(t))){const e=xt.update(t),s=t.material;if(n&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),ot.copy(t.boundingSphere.center)):(null===e.boundingSphere&&e.computeBoundingSphere(),ot.copy(e.boundingSphere.center)),ot.applyMatrix4(t.matrixWorld).applyMatrix4(rt)),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&&_.push(t,e,o,i,ot.z,a)}}else s.visible&&_.push(t,e,s,i,ot.z,null)}const s=t.children;for(let t=0,r=s.length;t<r;t++)Yt(s[t],e,i,n)}function Jt(t,e,i,n){const s=t.opaque,r=t.transmissive,a=t.transparent;y.setupLightsView(i),!0===it&&Et.setGlobalState(b.clippingPlanes,i),r.length>0&&function(t,e,i,n){const s=!0===i.isScene?i.overrideMaterial:null;if(null!==s)return;const r=dt.isWebGL2;null===st&&(st=new Ze(1,1,{generateMipmaps:!0,type:ht.has("EXT_color_buffer_half_float")?j:z,minFilter:F,samples:r?4:0}));b.getDrawingBufferSize(at),r?st.setSize(at.x,at.y):st.setSize(_e(at.x),_e(at.y));const a=b.getRenderTarget();b.setRenderTarget(st),b.getClearColor(P),I=b.getClearAlpha(),I<1&&b.setClearColor(16777215,.5);b.clear();const o=b.toneMapping;b.toneMapping=f,$t(t,i,n),ft.updateMultisampleRenderTarget(st),ft.updateRenderTargetMipmap(st);let c=!1;for(let t=0,s=e.length;t<s;t++){const s=e[t],r=s.object,a=s.geometry,o=s.material,h=s.group;if(2===o.side&&r.layers.test(n.layers)){const t=o.side;o.side=l,o.needsUpdate=!0,Kt(r,i,n,a,o,h),o.side=t,o.needsUpdate=!0,c=!0}}!0===c&&(ft.updateMultisampleRenderTarget(st),ft.updateRenderTargetMipmap(st));b.setRenderTarget(a),b.setClearColor(P,I),b.toneMapping=o}(s,r,e,i),n&&ut.viewport(L.copy(n)),s.length>0&&$t(s,e,i),r.length>0&&$t(r,e,i),a.length>0&&$t(a,e,i),ut.buffers.depth.setTest(!0),ut.buffers.depth.setMask(!0),ut.buffers.color.setMask(!0),ut.setPolygonOffset(!1)}function $t(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)&&Kt(a,e,i,o,l,c)}}function Kt(t,e,i,n,s,r){t.onBeforeRender(b,e,i,n,s,r),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),s.onBeforeRender(b,e,i,n,t,r),!0===s.transparent&&2===s.side&&!1===s.forceSinglePass?(s.side=l,s.needsUpdate=!0,b.renderBufferDirect(i,e,n,s,t,r),s.side=o,s.needsUpdate=!0,b.renderBufferDirect(i,e,n,s,t,r),s.side=2):b.renderBufferDirect(i,e,n,s,t,r),t.onAfterRender(b,e,i,n,s,r)}function Qt(t,e,i){!0!==e.isScene&&(e=lt);const n=mt.get(t),s=y.state.lights,r=y.state.shadowsArray,a=s.state.version,o=wt.getParameters(t,s.state,r,e,i),l=wt.getProgramCacheKey(o);let c=n.programs;n.environment=t.isMeshStandardMaterial?e.environment:null,n.fog=e.fog,n.envMap=(t.isMeshStandardMaterial?vt:gt).get(t.envMap||n.environment),n.envMapRotation=null!==n.environment&&null===t.envMap?e.environmentRotation:t.envMapRotation,void 0===c&&(t.addEventListener("dispose",Ht),c=new Map,n.programs=c);let h=c.get(l);if(void 0!==h){if(n.currentProgram===h&&n.lightsStateVersion===a)return ee(t,o),h}else o.uniforms=wt.getUniforms(t),t.onBuild(i,o,b),t.onBeforeCompile(o,b),h=wt.acquireProgram(o,l),c.set(l,h),n.uniforms=o.uniforms;const d=n.uniforms;return(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(d.clippingPlanes=Et.uniform),ee(t,o),n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),n.lightsStateVersion=a,n.needsLights&&(d.ambientLightColor.value=s.state.ambient,d.lightProbe.value=s.state.probe,d.directionalLights.value=s.state.directional,d.directionalLightShadows.value=s.state.directionalShadow,d.spotLights.value=s.state.spot,d.spotLightShadows.value=s.state.spotShadow,d.rectAreaLights.value=s.state.rectArea,d.ltc_1.value=s.state.rectAreaLTC1,d.ltc_2.value=s.state.rectAreaLTC2,d.pointLights.value=s.state.point,d.pointLightShadows.value=s.state.pointShadow,d.hemisphereLights.value=s.state.hemi,d.directionalShadowMap.value=s.state.directionalShadowMap,d.directionalShadowMatrix.value=s.state.directionalShadowMatrix,d.spotShadowMap.value=s.state.spotShadowMap,d.spotLightMatrix.value=s.state.spotLightMatrix,d.spotLightMap.value=s.state.spotLightMap,d.pointShadowMap.value=s.state.pointShadowMap,d.pointShadowMatrix.value=s.state.pointShadowMatrix),n.currentProgram=h,n.uniformsList=null,h}function te(t){if(null===t.uniformsList){const e=t.currentProgram.getUniforms();t.uniformsList=wa.seqWithValue(e.seq,t.uniforms)}return t.uniformsList}function ee(t,e){const i=mt.get(t);i.outputColorSpace=e.outputColorSpace,i.batching=e.batching,i.instancing=e.instancing,i.instancingColor=e.instancingColor,i.instancingMorph=e.instancingMorph,i.skinning=e.skinning,i.morphTargets=e.morphTargets,i.morphNormals=e.morphNormals,i.morphColors=e.morphColors,i.morphTargetsCount=e.morphTargetsCount,i.numClippingPlanes=e.numClippingPlanes,i.numIntersection=e.numClipIntersection,i.vertexAlphas=e.vertexAlphas,i.vertexTangents=e.vertexTangents,i.toneMapping=e.toneMapping}Zt.setAnimationLoop((function(t){Vt&&Vt(t)})),"undefined"!=typeof self&&Zt.setContext(self),this.setAnimationLoop=function(t){Vt=t,Ot.setAnimationLoop(t),null===t?Zt.stop():Zt.start()},Ot.addEventListener("sessionstart",qt),Ot.addEventListener("sessionend",Xt),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===M)return;!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===Ot.enabled&&!0===Ot.isPresenting&&(!0===Ot.cameraAutoUpdate&&Ot.updateCamera(e),e=Ot.getCamera()),!0===t.isScene&&t.onBeforeRender(b,t,e,T),y=St.get(t,w.length),y.init(),w.push(y),rt.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),K.setFromProjectionMatrix(rt),nt=this.localClippingEnabled,it=Et.init(this.clippingPlanes,nt),_=Mt.get(t,x.length),_.init(),x.push(_),Yt(t,e,0,b.sortObjects),_.finish(),!0===b.sortObjects&&_.sort(O,B),this.info.render.frame++,!0===it&&Et.beginShadows();const i=y.state.shadowsArray;if(Tt.render(i,t,e),!0===it&&Et.endShadows(),!0===this.info.autoReset&&this.info.reset(),!1!==Ot.enabled&&!1!==Ot.isPresenting&&!1!==Ot.hasDepthSensing()||At.render(_,t),y.setupLights(b._useLegacyLights),e.isArrayCamera){const i=e.cameras;for(let e=0,n=i.length;e<n;e++){const n=i[e];Jt(_,t,n,n.viewport)}}else Jt(_,t,e);null!==T&&(ft.updateMultisampleRenderTarget(T),ft.updateRenderTargetMipmap(T)),!0===t.isScene&&t.onAfterRender(b,t,e),Pt.resetDefaultState(),A=-1,C=null,w.pop(),y=w.length>0?w[w.length-1]:null,x.pop(),_=x.length>0?x[x.length-1]:null},this.getActiveCubeFace=function(){return S},this.getActiveMipmapLevel=function(){return E},this.getRenderTarget=function(){return T},this.setRenderTargetTextures=function(t,e,i){mt.get(t.texture).__webglTexture=e,mt.get(t.depthTexture).__webglTexture=i;const n=mt.get(t);n.__hasExternalTextures=!0,n.__autoAllocateDepthBuffer=void 0===i,n.__autoAllocateDepthBuffer||!0===ht.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=mt.get(t);i.__webglFramebuffer=e,i.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,i=0){T=t,S=e,E=i;let n=!0,s=null,r=!1,a=!1;if(t){const o=mt.get(t);void 0!==o.__useDefaultFramebuffer?(ut.bindFramebuffer(Nt.FRAMEBUFFER,null),n=!1):void 0===o.__webglFramebuffer?ft.setupRenderTarget(t):o.__hasExternalTextures&&ft.rebindTextures(t,mt.get(t.texture).__webglTexture,mt.get(t.depthTexture).__webglTexture);const l=t.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(a=!0);const c=mt.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(s=Array.isArray(c[e])?c[e][i]:c[e],r=!0):s=dt.isWebGL2&&t.samples>0&&!1===ft.useMultisampledRTT(t)?mt.get(t).__webglMultisampledFramebuffer:Array.isArray(c)?c[i]:c,L.copy(t.viewport),k.copy(t.scissor),R=t.scissorTest}else L.copy(G).multiplyScalar(D).floor(),k.copy(J).multiplyScalar(D).floor(),R=$;if(ut.bindFramebuffer(Nt.FRAMEBUFFER,s)&&dt.drawBuffers&&n&&ut.drawBuffers(t,s),ut.viewport(L),ut.scissor(k),ut.setScissorTest(R),r){const n=mt.get(t.texture);Nt.framebufferTexture2D(Nt.FRAMEBUFFER,Nt.COLOR_ATTACHMENT0,Nt.TEXTURE_CUBE_MAP_POSITIVE_X+e,n.__webglTexture,i)}else if(a){const n=mt.get(t.texture),s=e||0;Nt.framebufferTextureLayer(Nt.FRAMEBUFFER,Nt.COLOR_ATTACHMENT0,n.__webglTexture,i||0,s)}A=-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=mt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){ut.bindFramebuffer(Nt.FRAMEBUFFER,o);try{const a=t.texture,o=a.format,l=a.type;if(o!==Y&&Rt.convert(o)!==Nt.getParameter(Nt.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===j&&(ht.has("EXT_color_buffer_half_float")||dt.isWebGL2&&ht.has("EXT_color_buffer_float"));if(!(l===z||Rt.convert(l)===Nt.getParameter(Nt.IMPLEMENTATION_COLOR_READ_TYPE)||l===W&&(dt.isWebGL2||ht.has("OES_texture_float")||ht.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&&Nt.readPixels(e,i,n,s,Rt.convert(o),Rt.convert(l),r)}finally{const t=null!==T?mt.get(T).__webglFramebuffer:null;ut.bindFramebuffer(Nt.FRAMEBUFFER,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);ft.setTexture2D(e,0),Nt.copyTexSubImage2D(Nt.TEXTURE_2D,i,0,0,t.x,t.y,s,r),ut.unbindTexture()},this.copyTextureToTexture=function(t,e,i,n=0){const s=e.image.width,r=e.image.height,a=Rt.convert(i.format),o=Rt.convert(i.type);ft.setTexture2D(i,0),Nt.pixelStorei(Nt.UNPACK_FLIP_Y_WEBGL,i.flipY),Nt.pixelStorei(Nt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),Nt.pixelStorei(Nt.UNPACK_ALIGNMENT,i.unpackAlignment),e.isDataTexture?Nt.texSubImage2D(Nt.TEXTURE_2D,n,t.x,t.y,s,r,a,o,e.image.data):e.isCompressedTexture?Nt.compressedTexSubImage2D(Nt.TEXTURE_2D,n,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,a,e.mipmaps[0].data):Nt.texSubImage2D(Nt.TEXTURE_2D,n,t.x,t.y,a,o,e.image),0===n&&i.generateMipmaps&&Nt.generateMipmap(Nt.TEXTURE_2D),ut.unbindTexture()},this.copyTextureToTexture3D=function(t,e,i,n,s=0){if(b.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const r=Math.round(t.max.x-t.min.x),a=Math.round(t.max.y-t.min.y),o=t.max.z-t.min.z+1,l=Rt.convert(n.format),c=Rt.convert(n.type);let h;if(n.isData3DTexture)ft.setTexture3D(n,0),h=Nt.TEXTURE_3D;else{if(!n.isDataArrayTexture&&!n.isCompressedArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");ft.setTexture2DArray(n,0),h=Nt.TEXTURE_2D_ARRAY}Nt.pixelStorei(Nt.UNPACK_FLIP_Y_WEBGL,n.flipY),Nt.pixelStorei(Nt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),Nt.pixelStorei(Nt.UNPACK_ALIGNMENT,n.unpackAlignment);const d=Nt.getParameter(Nt.UNPACK_ROW_LENGTH),u=Nt.getParameter(Nt.UNPACK_IMAGE_HEIGHT),p=Nt.getParameter(Nt.UNPACK_SKIP_PIXELS),m=Nt.getParameter(Nt.UNPACK_SKIP_ROWS),f=Nt.getParameter(Nt.UNPACK_SKIP_IMAGES),g=i.isCompressedTexture?i.mipmaps[s]:i.image;Nt.pixelStorei(Nt.UNPACK_ROW_LENGTH,g.width),Nt.pixelStorei(Nt.UNPACK_IMAGE_HEIGHT,g.height),Nt.pixelStorei(Nt.UNPACK_SKIP_PIXELS,t.min.x),Nt.pixelStorei(Nt.UNPACK_SKIP_ROWS,t.min.y),Nt.pixelStorei(Nt.UNPACK_SKIP_IMAGES,t.min.z),i.isDataTexture||i.isData3DTexture?Nt.texSubImage3D(h,s,e.x,e.y,e.z,r,a,o,l,c,g.data):n.isCompressedArrayTexture?Nt.compressedTexSubImage3D(h,s,e.x,e.y,e.z,r,a,o,l,g.data):Nt.texSubImage3D(h,s,e.x,e.y,e.z,r,a,o,l,c,g),Nt.pixelStorei(Nt.UNPACK_ROW_LENGTH,d),Nt.pixelStorei(Nt.UNPACK_IMAGE_HEIGHT,u),Nt.pixelStorei(Nt.UNPACK_SKIP_PIXELS,p),Nt.pixelStorei(Nt.UNPACK_SKIP_ROWS,m),Nt.pixelStorei(Nt.UNPACK_SKIP_IMAGES,f),0===s&&n.generateMipmaps&&Nt.generateMipmap(h),ut.unbindTexture()},this.initTexture=function(t){t.isCubeTexture?ft.setTextureCube(t,0):t.isData3DTexture?ft.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?ft.setTexture2DArray(t,0):ft.setTexture2D(t,0),ut.unbindTexture()},this.resetState=function(){S=0,E=0,T=null,ut.reset(),Pt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ae}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=t===qt?"display-p3":"srgb",e.unpackColorSpace=De.workingColorSpace===Xt?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}}class yo extends _o{}yo.prototype.isWebGL1Renderer=!0;class xo{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new _n(t),this.density=e}clone(){return new xo(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class wo{constructor(t,e=1,i=1e3){this.isFog=!0,this.name="",this.color=new _n(t),this.near=e,this.far=i}clone(){return new wo(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class bo extends en{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Bi,this.environmentRotation=new Bi,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,this.backgroundRotation.copy(t.backgroundRotation),this.environmentRotation.copy(t.environmentRotation),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.object.backgroundRotation=this.backgroundRotation.toArray(),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class Mo{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=ne,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=pe()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}get updateRange(){return Re("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}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=pe()),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=pe()),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 So=new Ke;class Eo{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++)So.fromBufferAttribute(this,e),So.applyMatrix4(t),this.setXYZ(e,So.x,So.y,So.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)So.fromBufferAttribute(this,e),So.applyNormalMatrix(t),this.setXYZ(e,So.x,So.y,So.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)So.fromBufferAttribute(this,e),So.transformDirection(t),this.setXYZ(e,So.x,So.y,So.z);return this}getComponent(t,e){let i=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(i=ye(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=xe(i,this.array)),this.data.array[t*this.data.stride+this.offset+e]=i,this}setX(t,e){return this.normalized&&(e=xe(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=xe(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=xe(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=xe(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=ye(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=ye(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=ye(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=ye(e,this.array)),e}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=xe(e,this.array),i=xe(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=xe(e,this.array),i=xe(i,this.array),n=xe(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=xe(e,this.array),i=xe(i,this.array),n=xe(n,this.array),s=xe(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 kn(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 Eo(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 To extends wn{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new _n(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 Ao;const Co=new Ke,Lo=new Ke,ko=new Ke,Ro=new be,Po=new be,Io=new Ci,No=new Ke,Uo=new Ke,Do=new Ke,Oo=new be,Bo=new be,Fo=new be;class zo extends en{constructor(t=new To){if(super(),this.isSprite=!0,this.type="Sprite",void 0===Ao){Ao=new Hn;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 Mo(t,5);Ao.setIndex([0,1,2,0,2,3]),Ao.setAttribute("position",new Eo(e,3,0,!1)),Ao.setAttribute("uv",new Eo(e,2,3,!1))}this.geometry=Ao,this.material=t,this.center=new be(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Lo.setFromMatrixScale(this.matrixWorld),Io.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),ko.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Lo.multiplyScalar(-ko.z);const i=this.material.rotation;let n,s;0!==i&&(s=Math.cos(i),n=Math.sin(i));const r=this.center;Ho(No.set(-.5,-.5,0),ko,r,Lo,n,s),Ho(Uo.set(.5,-.5,0),ko,r,Lo,n,s),Ho(Do.set(.5,.5,0),ko,r,Lo,n,s),Oo.set(0,0),Bo.set(1,0),Fo.set(1,1);let a=t.ray.intersectTriangle(No,Uo,Do,!1,Co);if(null===a&&(Ho(Uo.set(-.5,.5,0),ko,r,Lo,n,s),Bo.set(0,1),a=t.ray.intersectTriangle(No,Do,Uo,!1,Co),null===a))return;const o=t.ray.origin.distanceTo(Co);o<t.near||o>t.far||e.push({distance:o,point:Co.clone(),uv:pn.getInterpolation(Co,No,Uo,Do,Oo,Bo,Fo,new be),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 Ho(t,e,i,n,s,r){Ro.subVectors(t,i).addScalar(.5).multiply(n),void 0!==s?(Po.x=r*Ro.x-s*Ro.y,Po.y=s*Ro.x+r*Ro.y):Po.copy(Ro),t.copy(e),t.x+=Po.x,t.y+=Po.y,t.applyMatrix4(Io)}const Go=new Ke,Vo=new Ke;class Wo extends en{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){Go.setFromMatrixPosition(this.matrixWorld);const i=t.ray.origin.distanceTo(Go);this.getObjectForDistance(i).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Go.setFromMatrixPosition(t.matrixWorld),Vo.setFromMatrixPosition(this.matrixWorld);const i=Go.distanceTo(Vo)/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 jo=new Ke,qo=new qe,Xo=new qe,Zo=new Ke,Yo=new Ci,Jo=new Ke,$o=new yi,Ko=new Ci,Qo=new Ai;class tl extends rs{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=M,this.bindMatrix=new Ci,this.bindMatrixInverse=new Ci,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;null===this.boundingBox&&(this.boundingBox=new ei),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,Jo),this.boundingBox.expandByPoint(Jo)}computeBoundingSphere(){const t=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new yi),this.boundingSphere.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,Jo),this.boundingSphere.expandByPoint(Jo)}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,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){const i=this.material,n=this.matrixWorld;void 0!==i&&(null===this.boundingSphere&&this.computeBoundingSphere(),$o.copy(this.boundingSphere),$o.applyMatrix4(n),!1!==t.ray.intersectsSphere($o)&&(Ko.copy(n).invert(),Qo.copy(t.ray).applyMatrix4(Ko),null!==this.boundingBox&&!1===Qo.intersectsBox(this.boundingBox)||this._computeIntersections(t,e,Qo)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}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 qe,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),this.bindMode===M?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===S?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){const i=this.skeleton,n=this.geometry;qo.fromBufferAttribute(n.attributes.skinIndex,t),Xo.fromBufferAttribute(n.attributes.skinWeight,t),jo.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const n=Xo.getComponent(t);if(0!==n){const s=qo.getComponent(t);Yo.multiplyMatrices(i.bones[s].matrixWorld,i.boneInverses[s]),e.addScaledVector(Zo.copy(jo).applyMatrix4(Yo),n)}}return e.applyMatrix4(this.bindMatrixInverse)}}class el extends en{constructor(){super(),this.isBone=!0,this.type="Bone"}}class il extends je{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 nl=new Ci,sl=new Ci;class rl{constructor(t=[],e=[]){this.uuid=pe(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,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 Ci)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new Ci;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:sl;nl.multiplyMatrices(s,e[n]),nl.toArray(i,16*n)}null!==n&&(n.needsUpdate=!0)}clone(){return new rl(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const i=new il(e,t,t,Y,W);return i.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=i,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 el),this.bones.push(s),this.boneInverses.push((new Ci).fromArray(t.boneInverses[i]))}return this.init(),this}toJSON(){const t={metadata:{version:4.6,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 al extends kn{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 ol=new Ci,ll=new Ci,cl=[],hl=new ei,dl=new Ci,ul=new rs,pl=new yi;class ml extends rs{constructor(t,e,i){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new al(new Float32Array(16*i),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let t=0;t<i;t++)this.setMatrixAt(t,dl)}computeBoundingBox(){const t=this.geometry,e=this.count;null===this.boundingBox&&(this.boundingBox=new ei),null===t.boundingBox&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,ol),hl.copy(t.boundingBox).applyMatrix4(ol),this.boundingBox.union(hl)}computeBoundingSphere(){const t=this.geometry,e=this.count;null===this.boundingSphere&&(this.boundingSphere=new yi),null===t.boundingSphere&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,ol),pl.copy(t.boundingSphere).applyMatrix4(ol),this.boundingSphere.union(pl)}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,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}getMorphAt(t,e){const i=e.morphTargetInfluences,n=this.morphTexture.source.data.data,s=t*(i.length+1)+1;for(let t=0;t<i.length;t++)i[t]=n[s+t]}raycast(t,e){const i=this.matrixWorld,n=this.count;if(ul.geometry=this.geometry,ul.material=this.material,void 0!==ul.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),pl.copy(this.boundingSphere),pl.applyMatrix4(i),!1!==t.ray.intersectsSphere(pl)))for(let s=0;s<n;s++){this.getMatrixAt(s,ol),ll.multiplyMatrices(i,ol),ul.matrixWorld=ll,ul.raycast(t,cl);for(let t=0,i=cl.length;t<i;t++){const i=cl[t];i.instanceId=s,i.object=this,e.push(i)}cl.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new al(new Float32Array(3*this.instanceMatrix.count),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}setMorphAt(t,e){const i=e.morphTargetInfluences,n=i.length+1;null===this.morphTexture&&(this.morphTexture=new il(new Float32Array(n*this.count),n,this.count,K,W));const s=this.morphTexture.source.data.data;let r=0;for(let t=0;t<i.length;t++)r+=i[t];const a=this.geometry.morphTargetsRelative?1:1-r,o=n*t;s[o]=a,s.set(i,o+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}function fl(t,e){return t.z-e.z}function gl(t,e){return e.z-t.z}class vl{constructor(){this.index=0,this.pool=[],this.list=[]}push(t,e){const i=this.pool,n=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1});const s=i[this.index];n.push(s),this.index++,s.start=t.start,s.count=t.count,s.z=e}reset(){this.list.length=0,this.index=0}}const _l="batchId",yl=new Ci,xl=new Ci,wl=new Ci,bl=new Ci,Ml=new Cs,Sl=new ei,El=new yi,Tl=new Ke,Al=new vl,Cl=new rs,Ll=[];function kl(t,e,i=0){const n=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const s=t.count;for(let r=0;r<s;r++)for(let s=0;s<n;s++)e.setComponent(r+i,s,t.getComponent(r,s))}else e.array.set(t.array,i*n);e.needsUpdate=!0}class Rl extends rs{get maxGeometryCount(){return this._maxGeometryCount}constructor(t,e,i=2*e,n){super(new Hn,n),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawRanges=[],this._reservedRanges=[],this._visibility=[],this._active=[],this._bounds=[],this._maxGeometryCount=t,this._maxVertexCount=e,this._maxIndexCount=i,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(t),this._multiDrawStarts=new Int32Array(t),this._multiDrawCount=0,this._visibilityChanged=!0,this._matricesTexture=null,this._initMatricesTexture()}_initMatricesTexture(){let t=Math.sqrt(4*this._maxGeometryCount);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4),i=new il(e,t,t,Y,W);this._matricesTexture=i}_initializeGeometry(t){const e=this.geometry,i=this._maxVertexCount,n=this._maxGeometryCount,s=this._maxIndexCount;if(!1===this._geometryInitialized){for(const n in t.attributes){const s=t.getAttribute(n),{array:r,itemSize:a,normalized:o}=s,l=new r.constructor(i*a),c=new s.constructor(l,a,o);c.setUsage(s.usage),e.setAttribute(n,c)}if(null!==t.getIndex()){const t=i>65536?new Uint32Array(s):new Uint16Array(s);e.setIndex(new kn(t,1))}const r=n>65536?new Uint32Array(i):new Uint16Array(i);e.setAttribute(_l,new kn(r,1)),this._geometryInitialized=!0}}_validateGeometry(t){if(t.getAttribute(_l))throw new Error(`BatchedMesh: Geometry cannot use attribute "${_l}"`);const e=this.geometry;if(Boolean(t.getIndex())!==Boolean(e.getIndex()))throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const i in e.attributes){if(i===_l)continue;if(!t.hasAttribute(i))throw new Error(`BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const n=t.getAttribute(i),s=e.getAttribute(i);if(n.itemSize!==s.itemSize||n.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new ei);const t=this._geometryCount,e=this.boundingBox,i=this._active;e.makeEmpty();for(let n=0;n<t;n++)!1!==i[n]&&(this.getMatrixAt(n,yl),this.getBoundingBoxAt(n,Sl).applyMatrix4(yl),e.union(Sl))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new yi);const t=this._geometryCount,e=this.boundingSphere,i=this._active;e.makeEmpty();for(let n=0;n<t;n++)!1!==i[n]&&(this.getMatrixAt(n,yl),this.getBoundingSphereAt(n,El).applyMatrix4(yl),e.union(El))}addGeometry(t,e=-1,i=-1){if(this._initializeGeometry(t),this._validateGeometry(t),this._geometryCount>=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const n={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const r=this._reservedRanges,a=this._drawRanges,o=this._bounds;0!==this._geometryCount&&(s=r[r.length-1]),n.vertexCount=-1===e?t.getAttribute("position").count:e,n.vertexStart=null===s?0:s.vertexStart+s.vertexCount;const l=t.getIndex(),c=null!==l;if(c&&(n.indexCount=-1===i?l.count:i,n.indexStart=null===s?0:s.indexStart+s.indexCount),-1!==n.indexStart&&n.indexStart+n.indexCount>this._maxIndexCount||n.vertexStart+n.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._visibility,d=this._active,u=this._matricesTexture,p=this._matricesTexture.image.data;h.push(!0),d.push(!0);const m=this._geometryCount;this._geometryCount++,wl.toArray(p,16*m),u.needsUpdate=!0,r.push(n),a.push({start:c?n.indexStart:n.vertexStart,count:-1}),o.push({boxInitialized:!1,box:new ei,sphereInitialized:!1,sphere:new yi});const f=this.geometry.getAttribute(_l);for(let t=0;t<n.vertexCount;t++)f.setX(n.vertexStart+t,m);return f.needsUpdate=!0,this.setGeometryAt(m,t),m}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);const i=this.geometry,n=null!==i.getIndex(),s=i.getIndex(),r=e.getIndex(),a=this._reservedRanges[t];if(n&&r.count>a.indexCount||e.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const o=a.vertexStart,l=a.vertexCount;for(const t in i.attributes){if(t===_l)continue;const n=e.getAttribute(t),s=i.getAttribute(t);kl(n,s,o);const r=n.itemSize;for(let t=n.count,e=l;t<e;t++){const e=o+t;for(let t=0;t<r;t++)s.setComponent(e,t,0)}s.needsUpdate=!0}if(n){const t=a.indexStart;for(let e=0;e<r.count;e++)s.setX(t+e,o+r.getX(e));for(let e=r.count,i=a.indexCount;e<i;e++)s.setX(t+e,o);s.needsUpdate=!0}const c=this._bounds[t];null!==e.boundingBox?(c.box.copy(e.boundingBox),c.boxInitialized=!0):c.boxInitialized=!1,null!==e.boundingSphere?(c.sphere.copy(e.boundingSphere),c.sphereInitialized=!0):c.sphereInitialized=!1;const h=this._drawRanges[t],d=e.getAttribute("position");return h.count=n?r.count:d.count,this._visibilityChanged=!0,t}deleteGeometry(t){const e=this._active;return t>=e.length||!1===e[t]||(e[t]=!1,this._visibilityChanged=!0),this}getBoundingBoxAt(t,e){if(!1===this._active[t])return null;const i=this._bounds[t],n=i.box,s=this.geometry;if(!1===i.boxInitialized){n.makeEmpty();const e=s.index,r=s.attributes.position,a=this._drawRanges[t];for(let t=a.start,i=a.start+a.count;t<i;t++){let i=t;e&&(i=e.getX(i)),n.expandByPoint(Tl.fromBufferAttribute(r,i))}i.boxInitialized=!0}return e.copy(n),e}getBoundingSphereAt(t,e){if(!1===this._active[t])return null;const i=this._bounds[t],n=i.sphere,s=this.geometry;if(!1===i.sphereInitialized){n.makeEmpty(),this.getBoundingBoxAt(t,Sl),Sl.getCenter(n.center);const e=s.index,r=s.attributes.position,a=this._drawRanges[t];let o=0;for(let t=a.start,i=a.start+a.count;t<i;t++){let i=t;e&&(i=e.getX(i)),Tl.fromBufferAttribute(r,i),o=Math.max(o,n.center.distanceToSquared(Tl))}n.radius=Math.sqrt(o),i.sphereInitialized=!0}return e.copy(n),e}setMatrixAt(t,e){const i=this._active,n=this._matricesTexture,s=this._matricesTexture.image.data;return t>=this._geometryCount||!1===i[t]||(e.toArray(s,16*t),n.needsUpdate=!0),this}getMatrixAt(t,e){const i=this._active,n=this._matricesTexture.image.data;return t>=this._geometryCount||!1===i[t]?null:e.fromArray(n,16*t)}setVisibleAt(t,e){const i=this._visibility,n=this._active;return t>=this._geometryCount||!1===n[t]||i[t]===e||(i[t]=e,this._visibilityChanged=!0),this}getVisibleAt(t){const e=this._visibility,i=this._active;return!(t>=this._geometryCount||!1===i[t])&&e[t]}raycast(t,e){const i=this._visibility,n=this._active,s=this._drawRanges,r=this._geometryCount,a=this.matrixWorld,o=this.geometry;Cl.material=this.material,Cl.geometry.index=o.index,Cl.geometry.attributes=o.attributes,null===Cl.geometry.boundingBox&&(Cl.geometry.boundingBox=new ei),null===Cl.geometry.boundingSphere&&(Cl.geometry.boundingSphere=new yi);for(let o=0;o<r;o++){if(!i[o]||!n[o])continue;const r=s[o];Cl.geometry.setDrawRange(r.start,r.count),this.getMatrixAt(o,Cl.matrixWorld).premultiply(a),this.getBoundingBoxAt(o,Cl.geometry.boundingBox),this.getBoundingSphereAt(o,Cl.geometry.boundingSphere),Cl.raycast(t,Ll);for(let t=0,i=Ll.length;t<i;t++){const i=Ll[t];i.object=this,i.batchId=o,e.push(i)}Ll.length=0}Cl.material=null,Cl.geometry.index=null,Cl.geometry.attributes={},Cl.geometry.setDrawRange(0,1/0)}copy(t){return super.copy(t),this.geometry=t.geometry.clone(),this.perObjectFrustumCulled=t.perObjectFrustumCulled,this.sortObjects=t.sortObjects,this.boundingBox=null!==t.boundingBox?t.boundingBox.clone():null,this.boundingSphere=null!==t.boundingSphere?t.boundingSphere.clone():null,this._drawRanges=t._drawRanges.map((t=>({...t}))),this._reservedRanges=t._reservedRanges.map((t=>({...t}))),this._visibility=t._visibility.slice(),this._active=t._active.slice(),this._bounds=t._bounds.map((t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()}))),this._maxGeometryCount=t._maxGeometryCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._geometryCount=t._geometryCount,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(t,e,i,n,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const r=n.getIndex(),a=null===r?1:r.array.BYTES_PER_ELEMENT,o=this._active,l=this._visibility,c=this._multiDrawStarts,h=this._multiDrawCounts,d=this._drawRanges,u=this.perObjectFrustumCulled;u&&(bl.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),Ml.setFromProjectionMatrix(bl,t.coordinateSystem));let p=0;if(this.sortObjects){xl.copy(this.matrixWorld).invert(),Tl.setFromMatrixPosition(i.matrixWorld).applyMatrix4(xl);for(let t=0,e=l.length;t<e;t++)if(l[t]&&o[t]){this.getMatrixAt(t,yl),this.getBoundingSphereAt(t,El).applyMatrix4(yl);let e=!1;if(u&&(e=!Ml.intersectsSphere(El)),!e){const e=Tl.distanceTo(El.center);Al.push(d[t],e)}}const t=Al.list,e=this.customSort;null===e?t.sort(s.transparent?gl:fl):e.call(this,t,i);for(let e=0,i=t.length;e<i;e++){const i=t[e];c[p]=i.start*a,h[p]=i.count,p++}Al.reset()}else for(let t=0,e=l.length;t<e;t++)if(l[t]&&o[t]){let e=!1;if(u&&(this.getMatrixAt(t,yl),this.getBoundingSphereAt(t,El).applyMatrix4(yl),e=!Ml.intersectsSphere(El)),!e){const e=d[t];c[p]=e.start*a,h[p]=e.count,p++}}this._multiDrawCount=p,this._visibilityChanged=!1}onBeforeShadow(t,e,i,n,s,r){this.onBeforeRender(t,null,n,s,r)}}class Pl extends wn{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new _n(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 Il=new Ke,Nl=new Ke,Ul=new Ci,Dl=new Ai,Ol=new yi;class Bl extends en{constructor(t=new Hn,e=new Pl){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=Array.isArray(t.material)?t.material.slice():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++)Il.fromBufferAttribute(e,t-1),Nl.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=Il.distanceTo(Nl);t.setAttribute("lineDistance",new In(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(),Ol.copy(i.boundingSphere),Ol.applyMatrix4(n),Ol.radius+=s,!1===t.ray.intersectsSphere(Ol))return;Ul.copy(n).invert(),Dl.copy(t.ray).applyMatrix4(Ul);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=new Ke,c=new Ke,h=new Ke,d=new Ke,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(Dl.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(Dl.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 Fl=new Ke,zl=new Ke;class Hl extends Bl{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)Fl.fromBufferAttribute(e,t),zl.fromBufferAttribute(e,t+1),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+Fl.distanceTo(zl);t.setAttribute("lineDistance",new In(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Gl extends Bl{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class Vl extends wn{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new _n(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 Wl=new Ci,jl=new Ai,ql=new yi,Xl=new Ke;class Zl extends en{constructor(t=new Hn,e=new Vl){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=Array.isArray(t.material)?t.material.slice():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(),ql.copy(i.boundingSphere),ql.applyMatrix4(n),ql.radius+=s,!1===t.ray.intersectsSphere(ql))return;Wl.copy(n).invert(),jl.copy(t.ray).applyMatrix4(Wl);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);Xl.fromBufferAttribute(c,s),Yl(Xl,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++)Xl.fromBufferAttribute(c,i),Yl(Xl,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 Yl(t,e,i,n,s,r,a){const o=jl.distanceSqToPoint(t);if(o<i){const i=new Ke;jl.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 Jl extends je{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 $l{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 be:new Ke);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 Ke,n=[],s=[],r=[],a=new Ke,o=new Ci;for(let e=0;e<=t;e++){const i=e/t;n[e]=this.getTangentAt(i,new Ke)}s[0]=new Ke,r[0]=new Ke;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(me(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(me(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.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Kl extends $l{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=new be){const i=e,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 Ql extends Kl{constructor(t,e,i,n,s,r){super(t,e,i,i,n,s,r),this.isArcCurve=!0,this.type="ArcCurve"}}function tc(){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 ec=new Ke,ic=new tc,nc=new tc,sc=new tc;class rc extends $l{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 Ke){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]:(ec.subVectors(n[0],n[1]).add(n[0]),a=ec);const h=n[l%s],d=n[(l+1)%s];if(this.closed||l+2<s?o=n[(l+2)%s]:(ec.subVectors(n[s-1],n[s-2]).add(n[s-1]),o=ec),"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),ic.initNonuniformCatmullRom(a.x,h.x,d.x,o.x,e,i,n),nc.initNonuniformCatmullRom(a.y,h.y,d.y,o.y,e,i,n),sc.initNonuniformCatmullRom(a.z,h.z,d.z,o.z,e,i,n)}else"catmullrom"===this.curveType&&(ic.initCatmullRom(a.x,h.x,d.x,o.x,this.tension),nc.initCatmullRom(a.y,h.y,d.y,o.y,this.tension),sc.initCatmullRom(a.z,h.z,d.z,o.z,this.tension));return i.set(ic.calc(c),nc.calc(c),sc.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 Ke).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function ac(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 oc(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 lc(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 cc extends $l{constructor(t=new be,e=new be,i=new be,n=new be){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new be){const i=e,n=this.v0,s=this.v1,r=this.v2,a=this.v3;return i.set(lc(t,n.x,s.x,r.x,a.x),lc(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 hc extends $l{constructor(t=new Ke,e=new Ke,i=new Ke,n=new Ke){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new Ke){const i=e,n=this.v0,s=this.v1,r=this.v2,a=this.v3;return i.set(lc(t,n.x,s.x,r.x,a.x),lc(t,n.y,s.y,r.y,a.y),lc(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 dc extends $l{constructor(t=new be,e=new be){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new be){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 be){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 uc extends $l{constructor(t=new Ke,e=new Ke){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new Ke){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 Ke){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 pc extends $l{constructor(t=new be,e=new be,i=new be){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new be){const i=e,n=this.v0,s=this.v1,r=this.v2;return i.set(oc(t,n.x,s.x,r.x),oc(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 mc extends $l{constructor(t=new Ke,e=new Ke,i=new Ke){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new Ke){const i=e,n=this.v0,s=this.v1,r=this.v2;return i.set(oc(t,n.x,s.x,r.x),oc(t,n.y,s.y,r.y),oc(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 fc extends $l{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new be){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(ac(a,o.x,l.x,c.x,h.x),ac(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 be).fromArray(i))}return this}}var gc=Object.freeze({__proto__:null,ArcCurve:Ql,CatmullRomCurve3:rc,CubicBezierCurve:cc,CubicBezierCurve3:hc,EllipseCurve:Kl,LineCurve:dc,LineCurve3:uc,QuadraticBezierCurve:pc,QuadraticBezierCurve3:mc,SplineCurve:fc});class vc extends $l{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);if(!t.equals(e)){const i=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new gc[i](e,t))}return this}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 gc[i.type]).fromJSON(i))}return this}}class _c extends vc{constructor(t){super(),this.type="Path",this.currentPoint=new be,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 dc(this.currentPoint.clone(),new be(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,n){const s=new pc(this.currentPoint.clone(),new be(t,e),new be(i,n));return this.curves.push(s),this.currentPoint.set(i,n),this}bezierCurveTo(t,e,i,n,s,r){const a=new cc(this.currentPoint.clone(),new be(t,e),new be(i,n),new be(s,r));return this.curves.push(a),this.currentPoint.set(s,r),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),i=new fc(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 Kl(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 yc extends Hn{constructor(t=[new be(0,-.5),new be(.5,0),new be(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=me(n,0,2*Math.PI);const s=[],r=[],a=[],o=[],l=[],c=1/e,h=new Ke,d=new be,u=new Ke,p=new Ke,m=new Ke;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 In(r,3)),this.setAttribute("uv",new In(a,2)),this.setAttribute("normal",new In(l,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new yc(t.points,t.segments,t.phiStart,t.phiLength)}}class xc extends yc{constructor(t=1,e=1,i=4,n=8){const s=new _c;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,length:e,capSegments:i,radialSegments:n}}static fromJSON(t){return new xc(t.radius,t.length,t.capSegments,t.radialSegments)}}class wc extends Hn{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 Ke,c=new be;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 In(r,3)),this.setAttribute("normal",new In(a,3)),this.setAttribute("uv",new In(o,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new wc(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class bc extends Hn{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 be,m=new Ke;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 Ke,v=new Ke;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 In(h,3)),this.setAttribute("normal",new In(d,3)),this.setAttribute("uv",new In(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new bc(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Mc extends bc{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 Mc(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Sc extends Hn{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 Ke,n=new Ke,s=new Ke;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 Ke;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 Ke;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 Ke,e=new Ke,i=new Ke,n=new Ke,a=new be,o=new be,l=new be;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 In(s,3)),this.setAttribute("normal",new In(s.slice(),3)),this.setAttribute("uv",new In(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 Sc(t.vertices,t.indices,t.radius,t.details)}}class Ec extends Sc{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 Ec(t.radius,t.detail)}}const Tc=new Ke,Ac=new Ke,Cc=new Ke,Lc=new pn;class kc extends Hn{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(de*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}=Lc;if(e.fromBufferAttribute(a,l[0]),i.fromBufferAttribute(a,l[1]),o.fromBufferAttribute(a,l[2]),Lc.getNormal(Cc),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=Lc[c[t]],a=Lc[c[e]],o=`${i}_${n}`,p=`${n}_${i}`;p in d&&d[p]?(Cc.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:Cc.clone()})}}for(const t in d)if(d[t]){const{index0:e,index1:i}=d[t];Tc.fromBufferAttribute(a,e),Ac.fromBufferAttribute(a,i),u.push(Tc.x,Tc.y,Tc.z),u.push(Ac.x,Ac.y,Ac.z)}this.setAttribute("position",new In(u,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}class Rc extends _c{constructor(t){super(t),this.uuid=pe(),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 _c).fromJSON(i))}return this}}const Pc=function(t,e,i=2){const n=e&&e.length,s=n?e[0]*i:t.length;let r=Ic(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=Ic(t,o,l,n,!1),c===c.next&&(c.steiner=!0),s.push(Wc(c));for(s.sort(zc),r=0;r<s.length;r++)i=Hc(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 Uc(r,a,i,o,l,p,0),a};function Ic(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=th(r,t[r],t[r+1],a);else for(r=i-n;r>=e;r-=n)a=th(r,t[r],t[r+1],a);return a&&Zc(a,a.next)&&(eh(a),a=a.next),a}function Nc(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!Zc(n,n.next)&&0!==Xc(n.prev,n,n.next))n=n.next;else{if(eh(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function Uc(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=Vc(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?Oc(t,n,s,r):Dc(t))e.push(o.i/i|0),e.push(t.i/i|0),e.push(l.i/i|0),eh(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?Uc(t=Bc(Nc(t),e,i),e,i,n,s,r,2):2===a&&Fc(t,e,i,n,s,r):Uc(Nc(t),e,i,n,s,r,1);break}}function Dc(t){const e=t.prev,i=t,n=t.next;if(Xc(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&&jc(s,o,r,l,a,c,m.x,m.y)&&Xc(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Oc(t,e,i,n){const s=t.prev,r=t,a=t.next;if(Xc(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=Vc(p,m,e,i,n),_=Vc(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&&jc(o,h,l,d,c,u,y.x,y.y)&&Xc(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&&jc(o,h,l,d,c,u,x.x,x.y)&&Xc(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&&jc(o,h,l,d,c,u,y.x,y.y)&&Xc(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&&jc(o,h,l,d,c,u,x.x,x.y)&&Xc(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Bc(t,e,i){let n=t;do{const s=n.prev,r=n.next.next;!Zc(s,r)&&Yc(s,n,n.next,r)&&Kc(s,r)&&Kc(r,s)&&(e.push(s.i/i|0),e.push(n.i/i|0),e.push(r.i/i|0),eh(n),eh(n.next),n=t=r),n=n.next}while(n!==t);return Nc(n)}function Fc(t,e,i,n,s,r){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&qc(a,t)){let o=Qc(a,t);return a=Nc(a,a.next),o=Nc(o,o.next),Uc(a,e,i,n,s,r,0),void Uc(o,e,i,n,s,r,0)}t=t.next}a=a.next}while(a!==t)}function zc(t,e){return t.x-e.x}function Hc(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&&jc(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),Kc(n,t)&&(h<d||h===d&&(n.x>i.x||n.x===i.x&&Gc(i,n)))&&(i=n,d=h)),n=n.next}while(n!==o);return i}(t,e);if(!i)return e;const n=Qc(i,t);return Nc(n,n.next),Nc(i,i.next)}function Gc(t,e){return Xc(t.prev,t,e.prev)<0&&Xc(e.next,t,t.next)<0}function Vc(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 Wc(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 jc(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 qc(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&&Yc(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(Kc(t,e)&&Kc(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)&&(Xc(t.prev,t,e.prev)||Xc(t,e.prev,e))||Zc(t,e)&&Xc(t.prev,t,t.next)>0&&Xc(e.prev,e,e.next)>0)}function Xc(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Zc(t,e){return t.x===e.x&&t.y===e.y}function Yc(t,e,i,n){const s=$c(Xc(t,e,i)),r=$c(Xc(t,e,n)),a=$c(Xc(i,n,t)),o=$c(Xc(i,n,e));return s!==r&&a!==o||(!(0!==s||!Jc(t,i,e))||(!(0!==r||!Jc(t,n,e))||(!(0!==a||!Jc(i,t,n))||!(0!==o||!Jc(i,e,n)))))}function Jc(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 $c(t){return t>0?1:t<0?-1:0}function Kc(t,e){return Xc(t.prev,t,t.next)<0?Xc(t,e,t.next)>=0&&Xc(t,t.prev,e)>=0:Xc(t,e,t.prev)<0||Xc(t,t.next,e)<0}function Qc(t,e){const i=new ih(t.i,t.x,t.y),n=new ih(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 th(t,e,i,n){const s=new ih(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 eh(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 ih(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 nh{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 nh.area(t)<0}static triangulateShape(t,e){const i=[],n=[],s=[];sh(t),rh(i,t);let r=t.length;e.forEach(sh);for(let t=0;t<e.length;t++)n.push(r),r+=e[t].length,rh(i,e[t]);const a=Pc(i,n);for(let t=0;t<a.length;t+=3)s.push(a.slice(t,t+3));return s}}function sh(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function rh(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}class ah extends Hn{constructor(t=new Rc([new be(.5,.5),new be(-.5,.5),new be(-.5,-.5),new be(.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:oh;let g,v,_,y,x,w=!1;m&&(g=m.getSpacedPoints(o),w=!0,c=!1,v=m.computeFrenetFrames(o,!1),_=new Ke,y=new Ke,x=new Ke),c||(p=0,h=0,d=0,u=0);const b=t.extractPoints(a);let M=b.shape;const S=b.holes;if(!nh.isClockWise(M)){M=M.reverse();for(let t=0,e=S.length;t<e;t++){const e=S[t];nh.isClockWise(e)&&(S[t]=e.reverse())}}const E=nh.triangulateShape(M,S),T=M;for(let t=0,e=S.length;t<e;t++){const e=S[t];M=M.concat(e)}function A(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().addScaledVector(e,i)}const C=M.length,L=E.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 be(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 be(n/r,s/r)}const R=[];for(let t=0,e=T.length,i=e-1,n=t+1;t<e;t++,i++,n++)i===e&&(i=0),n===e&&(n=0),R[t]=k(T[t],T[i],T[n]);const P=[];let I,N=R.concat();for(let t=0,e=S.length;t<e;t++){const e=S[t];I=[];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),I[t]=k(e[t],e[n],e[s]);P.push(I),N=N.concat(I)}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=T.length;t<e;t++){const e=A(T[t],R[t],n);O(e.x,e.y,-i)}for(let t=0,e=S.length;t<e;t++){const e=S[t];I=P[t];for(let t=0,s=e.length;t<s;t++){const s=A(e[t],I[t],n);O(s.x,s.y,-i)}}}const U=d+u;for(let t=0;t<C;t++){const e=c?A(M[t],N[t],U):M[t];w?(y.copy(v.normals[0]).multiplyScalar(e.x),_.copy(v.binormals[0]).multiplyScalar(e.y),x.copy(g[0]).add(y).add(_),O(x.x,x.y,x.z)):O(e.x,e.y,0)}for(let t=1;t<=o;t++)for(let e=0;e<C;e++){const i=c?A(M[e],N[e],U):M[e];w?(y.copy(v.normals[t]).multiplyScalar(i.x),_.copy(v.binormals[t]).multiplyScalar(i.y),x.copy(g[t]).add(y).add(_),O(x.x,x.y,x.z)):O(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=T.length;t<e;t++){const e=A(T[t],R[t],n);O(e.x,e.y,l+i)}for(let t=0,e=S.length;t<e;t++){const e=S[t];I=P[t];for(let t=0,s=e.length;t<s;t++){const s=A(e[t],I[t],n);w?O(s.x,s.y+g[o-1].y,g[o-1].x+i):O(s.x,s.y,l+i)}}}function D(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=C*t,r=C*(t+1);F(e+n+i,e+s+i,e+s+r,e+n+r)}}}function O(t,e,i){r.push(t),r.push(e),r.push(i)}function B(t,e,s){z(t),z(e),z(s);const r=n.length/3,a=f.generateTopUV(i,n,r-3,r-2,r-1);H(a[0]),H(a[1]),H(a[2])}function F(t,e,s,r){z(t),z(e),z(r),z(e),z(s),z(r);const a=n.length/3,o=f.generateSideWallUV(i,n,a-6,a-3,a-2,a-1);H(o[0]),H(o[1]),H(o[3]),H(o[1]),H(o[2]),H(o[3])}function z(t){n.push(r[3*t+0]),n.push(r[3*t+1]),n.push(r[3*t+2])}function H(t){s.push(t.x),s.push(t.y)}!function(){const t=n.length/3;if(c){let t=0,e=C*t;for(let t=0;t<L;t++){const i=E[t];B(i[2]+e,i[1]+e,i[0]+e)}t=o+2*p,e=C*t;for(let t=0;t<L;t++){const i=E[t];B(i[0]+e,i[1]+e,i[2]+e)}}else{for(let t=0;t<L;t++){const e=E[t];B(e[2],e[1],e[0])}for(let t=0;t<L;t++){const e=E[t];B(e[0]+C*o,e[1]+C*o,e[2]+C*o)}}i.addGroup(t,n.length/3-t,0)}(),function(){const t=n.length/3;let e=0;D(T,e),e+=T.length;for(let t=0,i=S.length;t<i;t++){const i=S[t];D(i,e),e+=i.length}i.addGroup(t,n.length/3-t,1)}()}this.setAttribute("position",new In(n,3)),this.setAttribute("uv",new In(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 gc[n.type]).fromJSON(n)),new ah(i,t.options)}}const oh={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 be(r,a),new be(o,l),new be(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 be(a,1-l),new be(c,1-d),new be(u,1-m),new be(f,1-v)]:[new be(o,1-l),new be(h,1-d),new be(p,1-m),new be(g,1-v)]}};class lh extends Sc{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 lh(t.radius,t.detail)}}class ch extends Sc{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 ch(t.radius,t.detail)}}class hh extends Hn{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 Ke,p=new be;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 In(o,3)),this.setAttribute("normal",new In(l,3)),this.setAttribute("uv",new In(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new hh(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class dh extends Hn{constructor(t=new Rc([new be(0,.5),new be(-.5,-.5),new be(.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===nh.isClockWise(c)&&(c=c.reverse());for(let t=0,e=h.length;t<e;t++){const e=h[t];!0===nh.isClockWise(e)&&(h[t]=e.reverse())}const d=nh.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 In(n,3)),this.setAttribute("normal",new In(s,3)),this.setAttribute("uv",new In(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 dh(i,t.curveSegments)}}class uh extends Hn{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 Ke,d=new Ke,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 In(p,3)),this.setAttribute("normal",new In(m,3)),this.setAttribute("uv",new In(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new uh(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class ph extends Sc{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 ph(t.radius,t.detail)}}class mh extends Hn{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 Ke,h=new Ke,d=new Ke;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 In(a,3)),this.setAttribute("normal",new In(o,3)),this.setAttribute("uv",new In(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new mh(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class fh extends Hn{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 Ke,d=new Ke,u=new Ke,p=new Ke,m=new Ke,f=new Ke,g=new Ke;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 In(o,3)),this.setAttribute("normal",new In(l,3)),this.setAttribute("uv",new In(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new fh(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class gh extends Hn{constructor(t=new mc(new Ke(-1,-1,0),new Ke(-1,1,0),new Ke(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 Ke,o=new Ke,l=new be;let c=new Ke;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 In(h,3)),this.setAttribute("normal",new In(d,3)),this.setAttribute("uv",new In(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 gh((new gc[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class vh extends Hn{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},null!==t){const e=[],i=new Set,n=new Ke,s=new Ke;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===_h(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===_h(n,s,i)&&(e.push(n.x,n.y,n.z),e.push(s.x,s.y,s.z))}}this.setAttribute("position",new In(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}function _h(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 yh=Object.freeze({__proto__:null,BoxGeometry:os,CapsuleGeometry:xc,CircleGeometry:wc,ConeGeometry:Mc,CylinderGeometry:bc,DodecahedronGeometry:Ec,EdgesGeometry:kc,ExtrudeGeometry:ah,IcosahedronGeometry:lh,LatheGeometry:yc,OctahedronGeometry:ch,PlaneGeometry:Rs,PolyhedronGeometry:Sc,RingGeometry:hh,ShapeGeometry:dh,SphereGeometry:uh,TetrahedronGeometry:ph,TorusGeometry:mh,TorusKnotGeometry:fh,TubeGeometry:gh,WireframeGeometry:vh});class xh extends wn{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new _n(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 wh extends us{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class bh extends wn{constructor(t){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new _n(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 _n(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new be(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Bi,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.envMapRotation.copy(t.envMapRotation),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 Mh extends bh{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new be(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return me(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 _n(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 _n(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new _n(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=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 sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=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.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,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 Sh extends wn{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new _n(16777215),this.specular=new _n(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _n(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new be(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Bi,this.combine=u,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.envMapRotation.copy(t.envMapRotation),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 Eh extends wn{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new _n(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _n(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new be(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 Th extends wn{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new be(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 Ah extends wn{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new _n(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new _n(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new be(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Bi,this.combine=u,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.envMapRotation.copy(t.envMapRotation),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 Ch extends wn{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new _n(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new be(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 Lh extends Pl{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 kh(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 Rh(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Ph(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 Ih(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 Nh(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 Uh={convertArray:kh,isTypedArray:Rh,getKeyframeOrder:Ph,sortedArray:Ih,flattenJSON:Nh,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=kh(l,e.times.constructor),e.values=kh(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=n.values.slice(t,e)}else if(r>=n.times[d]){const t=d*l+o,e=t+l-o;u=n.values.slice(t,e)}else{const t=n.createInterpolant(),e=o,i=l-o;t.evaluate(r),u=t.resultBuffer.slice(e,i)}if("quaternion"===s){(new $e).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)$e.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=Gt,t}};class Dh{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 Oh extends Dh{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:Bt,endingEnd:Bt}}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 Ft:s=t,a=2*e-i;break;case zt: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 Ft:r=t,o=2*i-e;break;case zt: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 Bh extends Dh{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 Fh extends Dh{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t){return this.copySampleValue_(t-1)}}class zh{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=kh(e,this.TimeBufferType),this.values=kh(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:kh(t.times,Array),values:kh(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new Fh(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Bh(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Oh(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Ut:e=this.InterpolantFactoryMethodDiscrete;break;case Dt:e=this.InterpolantFactoryMethodLinear;break;case Ot: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 Ut;case this.InterpolantFactoryMethodLinear:return Dt;case this.InterpolantFactoryMethodSmooth:return Ot}}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=i.slice(s,r),this.values=this.values.slice(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&&Rh(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=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),n=this.getInterpolation()===Ot,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=t.slice(0,r),this.values=e.slice(0,r*i)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}zh.prototype.TimeBufferType=Float32Array,zh.prototype.ValueBufferType=Float32Array,zh.prototype.DefaultInterpolation=Dt;class Hh extends zh{}Hh.prototype.ValueTypeName="bool",Hh.prototype.ValueBufferType=Array,Hh.prototype.DefaultInterpolation=Ut,Hh.prototype.InterpolantFactoryMethodLinear=void 0,Hh.prototype.InterpolantFactoryMethodSmooth=void 0;class Gh extends zh{}Gh.prototype.ValueTypeName="color";class Vh extends zh{}Vh.prototype.ValueTypeName="number";class Wh extends Dh{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)$e.slerpFlat(s,0,r,l-a,r,l,o);return s}}class jh extends zh{InterpolantFactoryMethodLinear(t){return new Wh(this.times,this.values,this.getValueSize(),t)}}jh.prototype.ValueTypeName="quaternion",jh.prototype.DefaultInterpolation=Dt,jh.prototype.InterpolantFactoryMethodSmooth=void 0;class qh extends zh{}qh.prototype.ValueTypeName="string",qh.prototype.ValueBufferType=Array,qh.prototype.DefaultInterpolation=Ut,qh.prototype.InterpolantFactoryMethodLinear=void 0,qh.prototype.InterpolantFactoryMethodSmooth=void 0;class Xh extends zh{}Xh.prototype.ValueTypeName="vector";class Zh{constructor(t,e=-1,i,n=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=n,this.uuid=pe(),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(Yh(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(zh.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=Ph(a);a=Ih(a,1,l),o=Ih(o,1,l),n||0!==a[0]||(a.push(s),o.push(o[0])),r.push(new Vh(".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=[];Nh(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 Vh(".morphTargetInfluence["+i+"]",t,r))}o=t.length*r}else{const r=".bones["+e[t].name+"]";i(Xh,r+".position",s,"pos",n),i(jh,r+".quaternion",s,"rot",n),i(Xh,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 Yh(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 Vh;case"vector":case"vector2":case"vector3":case"vector4":return Xh;case"color":return Gh;case"quaternion":return jh;case"bool":case"boolean":return Hh;case"string":return qh}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],i=[];Nh(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 Jh={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 $h{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 Kh=new $h;class Qh{constructor(t){this.manager=void 0!==t?t:Kh,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}}Qh.DEFAULT_MATERIAL_NAME="__DEFAULT";const td={};class ed extends Error{constructor(t,e){super(t),this.response=e}}class id extends Qh{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=Jh.get(t);if(void 0!==s)return this.manager.itemStart(t),setTimeout((()=>{e&&e(s),this.manager.itemEnd(t)}),0),s;if(void 0!==td[t])return void td[t].push({onLoad:e,onProgress:i,onError:n});td[t]=[],td[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=td[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 ed(`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=>{Jh.add(t,e);const i=td[t];delete td[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onLoad&&n.onLoad(e)}})).catch((e=>{const i=td[t];if(void 0===i)throw this.manager.itemError(t),e;delete td[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 nd extends Qh{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=Jh.get(t);if(void 0!==r)return s.manager.itemStart(t),setTimeout((function(){e&&e(r),s.manager.itemEnd(t)}),0),r;const a=Ce("img");function o(){c(),Jh.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 sd extends en{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new _n(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 rd extends sd{constructor(t,e,i){super(t,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(en.DEFAULT_UP),this.updateMatrix(),this.groundColor=new _n(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}}const ad=new Ci,od=new Ke,ld=new Ke;class cd{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new be(512,512),this.map=null,this.mapPass=null,this.matrix=new Ci,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Cs,this._frameExtents=new be(1,1),this._viewportCount=1,this._viewports=[new qe(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,i=this.matrix;od.setFromMatrixPosition(t.matrixWorld),e.position.copy(od),ld.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(ld),e.updateMatrixWorld(),ad.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ad),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(ad)}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 hd extends cd{constructor(){super(new vs(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){const e=this.camera,i=2*ue*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 dd extends sd{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(en.DEFAULT_UP),this.updateMatrix(),this.target=new en,this.distance=i,this.angle=n,this.penumbra=s,this.decay=r,this.map=null,this.shadow=new hd}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 ud=new Ci,pd=new Ke,md=new Ke;class fd extends cd{constructor(){super(new vs(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new be(4,2),this._viewportCount=6,this._viewports=[new qe(2,1,1,1),new qe(0,1,1,1),new qe(3,1,1,1),new qe(1,1,1,1),new qe(3,0,1,1),new qe(1,0,1,1)],this._cubeDirections=[new Ke(1,0,0),new Ke(-1,0,0),new Ke(0,0,1),new Ke(0,0,-1),new Ke(0,1,0),new Ke(0,-1,0)],this._cubeUps=[new Ke(0,1,0),new Ke(0,1,0),new Ke(0,1,0),new Ke(0,1,0),new Ke(0,0,1),new Ke(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()),pd.setFromMatrixPosition(t.matrixWorld),i.position.copy(pd),md.copy(i.position),md.add(this._cubeDirections[e]),i.up.copy(this._cubeUps[e]),i.lookAt(md),i.updateMatrixWorld(),n.makeTranslation(-pd.x,-pd.y,-pd.z),ud.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ud)}}class gd extends sd{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 fd}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 vd extends cd{constructor(){super(new Ws(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class _d extends sd{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(en.DEFAULT_UP),this.updateMatrix(),this.target=new en,this.shadow=new vd}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class yd extends sd{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class xd extends sd{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 wd{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new Ke)}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 bd extends sd{constructor(t=new wd,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 Md extends Qh{constructor(t){super(t),this.textures={}}load(t,e,i,n){const s=this,r=new id(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=Md.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 _n).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.anisotropy&&(n.anisotropy=t.anisotropy),void 0!==t.anisotropyRotation&&(n.anisotropyRotation=t.anisotropyRotation),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.alphaHash&&(n.alphaHash=t.alphaHash),void 0!==t.depthFunc&&(n.depthFunc=t.depthFunc),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.blendSrc&&(n.blendSrc=t.blendSrc),void 0!==t.blendDst&&(n.blendDst=t.blendDst),void 0!==t.blendEquation&&(n.blendEquation=t.blendEquation),void 0!==t.blendSrcAlpha&&(n.blendSrcAlpha=t.blendSrcAlpha),void 0!==t.blendDstAlpha&&(n.blendDstAlpha=t.blendDstAlpha),void 0!==t.blendEquationAlpha&&(n.blendEquationAlpha=t.blendEquationAlpha),void 0!==t.blendColor&&void 0!==n.blendColor&&n.blendColor.setHex(t.blendColor),void 0!==t.blendAlpha&&(n.blendAlpha=t.blendAlpha),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.stencilWrite&&(n.stencilWrite=t.stencilWrite),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),void 0!==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 _n).setHex(s.value);break;case"v2":n.uniforms[e].value=(new be).fromArray(s.value);break;case"v3":n.uniforms[e].value=(new Ke).fromArray(s.value);break;case"v4":n.uniforms[e].value=(new qe).fromArray(s.value);break;case"m3":n.uniforms[e].value=(new Me).fromArray(s.value);break;case"m4":n.uniforms[e].value=(new Ci).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.lights&&(n.lights=t.lights),void 0!==t.clipping&&(n.clipping=t.clipping),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 be).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.envMapRotation&&n.envMapRotation.fromArray(t.envMapRotation),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 be).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.anisotropyMap&&(n.anisotropyMap=i(t.anisotropyMap)),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:xh,SpriteMaterial:To,RawShaderMaterial:wh,ShaderMaterial:us,PointsMaterial:Vl,MeshPhysicalMaterial:Mh,MeshStandardMaterial:bh,MeshPhongMaterial:Sh,MeshToonMaterial:Eh,MeshNormalMaterial:Th,MeshLambertMaterial:Ah,MeshDepthMaterial:eo,MeshDistanceMaterial:io,MeshBasicMaterial:bn,MeshMatcapMaterial:Ch,LineDashedMaterial:Lh,LineBasicMaterial:Pl,Material:wn}[t]}}class Sd{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 Ed extends Hn{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 Td extends Qh{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new id(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=Ae(s.type,r),o=new Mo(a,s.stride);return o.uuid=s.uuid,e[n]=o,o}const s=t.isInstancedBufferGeometry?new Ed:new Hn,r=t.data.index;if(void 0!==r){const t=Ae(r.type,r.array);s.setIndex(new kn(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 Eo(e,i.itemSize,i.offset,i.normalized)}else{const t=Ae(i.type,i.array);r=new(i.isInstancedBufferAttribute?al:kn)(t,i.itemSize,i.normalized)}void 0!==i.name&&(r.name=i.name),void 0!==i.usage&&r.setUsage(i.usage),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 Eo(e,s.itemSize,s.offset,s.normalized)}else{const t=Ae(s.type,s.array);a=new kn(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 Ke;void 0!==c.center&&t.fromArray(c.center),s.boundingSphere=new yi(t,c.radius)}return t.name&&(s.name=t.name),t.userData&&(s.userData=t.userData),s}}const Ad={UVMapping:E,CubeReflectionMapping:T,CubeRefractionMapping:A,EquirectangularReflectionMapping:C,EquirectangularRefractionMapping:L,CubeUVReflectionMapping:k},Cd={RepeatWrapping:R,ClampToEdgeWrapping:P,MirroredRepeatWrapping:I},Ld={NearestFilter:N,NearestMipmapNearestFilter:U,NearestMipmapLinearFilter:D,LinearFilter:O,LinearMipmapNearestFilter:B,LinearMipmapLinearFilter:F};let kd;class Rd{static getContext(){return void 0===kd&&(kd=new(window.AudioContext||window.webkitAudioContext)),kd}static setContext(t){kd=t}}const Pd=new Ci,Id=new Ci,Nd=new Ci;class Ud{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Dd(),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=Dd();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function Dd(){return("undefined"==typeof performance?Date:performance).now()}const Od=new Ke,Bd=new $e,Fd=new Ke,zd=new Ke;class Hd extends en{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(!1!==this._connected){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){return this.detune=t,!0===this.isPlaying&&void 0!==this.source.detune&&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 Gd=new Ke,Vd=new $e,Wd=new Ke,jd=new Ke;class qd{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){$e.slerpFlat(t,e,t,e,t,i,n)}_slerpAdditive(t,e,i,n,s){const r=this._workIndex*s;$e.multiplyQuaternionsFlat(t,r,t,e,t,i),$e.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 Xd="\\[\\]\\.:\\/",Zd=new RegExp("["+Xd+"]","g"),Yd="[^"+Xd+"]",Jd="[^"+Xd.replace("\\.","")+"]",$d=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Yd)+/(WCOD+)?/.source.replace("WCOD",Jd)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Yd)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Yd)+"$"),Kd=["material","materials","bones","map"];class Qd{constructor(t,e,i){this.path=e,this.parsedPath=i||Qd.parseTrackName(e),this.node=Qd.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 Qd.Composite(t,e,i):new Qd(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Zd,"")}static parseTrackName(t){const e=$d.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!==Kd.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=Qd.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");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}}Qd.Composite=class{constructor(t,e,i){const n=i||Qd.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()}},Qd.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Qd.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Qd.prototype.GetterByBindingType=[Qd.prototype._getValue_direct,Qd.prototype._getValue_array,Qd.prototype._getValue_arrayElement,Qd.prototype._getValue_toArray],Qd.prototype.SetterByBindingTypeAndVersioning=[[Qd.prototype._setValue_direct,Qd.prototype._setValue_direct_setNeedsUpdate,Qd.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Qd.prototype._setValue_array,Qd.prototype._setValue_array_setNeedsUpdate,Qd.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Qd.prototype._setValue_arrayElement,Qd.prototype._setValue_arrayElement_setNeedsUpdate,Qd.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Qd.prototype._setValue_fromArray,Qd.prototype._setValue_fromArray_setNeedsUpdate,Qd.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class tu{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:Bt,endingEnd:Bt};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=It,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===Gt)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===Nt;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=Ft,n.endingEnd=Ft):(n.endingStart=t?this.zeroSlopeAtStart?Ft:Bt:zt,n.endingEnd=e?this.zeroSlopeAtEnd?Ft:Bt:zt)}_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 eu=new Float32Array(1);class iu extends le{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 qd(Qd.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 Bh(new Float32Array(2),new Float32Array(2),1,eu),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?Zh.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:Ht),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 tu(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?Zh.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 nu{constructor(t){this.value=t}clone(){return new nu(void 0===this.value.clone?this.value:this.value.clone())}}let su=0;class ru extends Mo{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}}const au=new Ci;let ou=class{constructor(t,e,i=0,n=1/0){this.ray=new Ai(t,e),this.near=i,this.far=n,this.camera=null,this.layers=new Fi,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)}setFromXRController(t){return au.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(au),this}intersectObject(t,e=!0,i=[]){return cu(t,this,i,e),i.sort(lu),i}intersectObjects(t,e=!0,i=[]){for(let n=0,s=t.length;n<s;n++)cu(t[n],this,i,e);return i.sort(lu),i}};function lu(t,e){return t.distance-e.distance}function cu(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++)cu(n[t],e,i,!0)}}class hu{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(me(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}const du=new be;const uu=new Ke,pu=new Ke;class mu{constructor(t=new Ke,e=new Ke){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){uu.subVectors(t,this.start),pu.subVectors(this.end,this.start);const i=pu.dot(pu);let n=pu.dot(uu)/i;return e&&(n=me(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 fu=new Ke;const gu=new Ke,vu=new Ci,_u=new Ci;function yu(t){const e=[];!0===t.isBone&&e.push(t);for(let i=0;i<t.children.length;i++)e.push.apply(e,yu(t.children[i]));return e}const xu=new Ke,wu=new _n,bu=new _n;class Mu extends Hl{constructor(t=10,e=10,i=4473924,n=8947848){i=new _n(i),n=new _n(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 Hn;c.setAttribute("position",new In(o,3)),c.setAttribute("color",new In(l,3));super(c,new Pl({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Su=new Ke,Eu=new Ke,Tu=new Ke;const Au=new Ke,Cu=new ps;function Lu(t,e,i,n,s,r,a){Au.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],Au.x,Au.y,Au.z)}}const ku=new ei;const Ru=new Ke;let Pu,Iu;class Nu{constructor(){this.type="ShapePath",this.color=new _n,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new _c,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=nh.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 Rc,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 Rc,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 Rc;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:e}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=e);var Uu=Object.freeze({__proto__:null,ACESFilmicToneMapping:y,AddEquation:c,AddOperation:m,AdditiveAnimationBlendMode:Gt,AdditiveBlending:2,AgXToneMapping:w,AlphaFormat:1021,AlwaysCompare:519,AlwaysDepth:1,AlwaysStencilFunc:ie,AmbientLight:yd,AnimationAction:tu,AnimationClip:Zh,AnimationLoader:class extends Qh{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new id(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=Zh.parse(t[i]);e.push(n)}return e}},AnimationMixer:iu,AnimationObjectGroup:class{constructor(){this.isAnimationObjectGroup=!0,this.uuid=pe(),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 Qd(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 Qd(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 Qd(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:Uh,ArcCurve:Ql,ArrayCamera:oo,ArrowHelper:class extends en{constructor(t=new Ke(0,0,1),e=new Ke(0,0,0),i=1,n=16776960,s=.2*i,r=.2*s){super(),this.type="ArrowHelper",void 0===Pu&&(Pu=new Hn,Pu.setAttribute("position",new In([0,0,0,0,1,0],3)),Iu=new bc(0,.5,1,5,1),Iu.translate(0,-.5,0)),this.position.copy(e),this.line=new Bl(Pu,new Pl({color:n,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new rs(Iu,new bn({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{Ru.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(Ru,e)}}setLength(t,e=.2*t,i=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}},AttachedBindMode:M,Audio:Hd,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:Rd,AudioListener:class extends en{constructor(){super(),this.type="AudioListener",this.context=Rd.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Ud}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(Od,Bd,Fd),zd.set(0,0,-1).applyQuaternion(Bd),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Od.x,t),e.positionY.linearRampToValueAtTime(Od.y,t),e.positionZ.linearRampToValueAtTime(Od.z,t),e.forwardX.linearRampToValueAtTime(zd.x,t),e.forwardY.linearRampToValueAtTime(zd.y,t),e.forwardZ.linearRampToValueAtTime(zd.z,t),e.upX.linearRampToValueAtTime(i.x,t),e.upY.linearRampToValueAtTime(i.y,t),e.upZ.linearRampToValueAtTime(i.z,t)}else e.setPosition(Od.x,Od.y,Od.z),e.setOrientation(zd.x,zd.y,zd.z,i.x,i.y,i.z)}},AudioLoader:class extends Qh{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new id(this.manager);function a(e){n?n(e):console.error(e),s.manager.itemError(t)}r.setResponseType("arraybuffer"),r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,(function(t){try{const i=t.slice(0);Rd.getContext().decodeAudioData(i,(function(t){e(t)})).catch(a)}catch(t){a(t)}}),i,n)}},AxesHelper:class extends Hl{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 Hn;i.setAttribute("position",new In(e,3)),i.setAttribute("color",new In([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(i,new Pl({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,i){const n=new _n,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:l,BasicDepthPacking:3200,BasicShadowMap:0,BatchedMesh:Rl,Bone:el,BooleanKeyframeTrack:Hh,Box2:class{constructor(t=new be(1/0,1/0),e=new be(-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=du.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,du).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:ei,Box3Helper:class extends Hl{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 Hn;n.setIndex(new kn(i,1)),n.setAttribute("position",new In([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 Pl({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}},BoxGeometry:os,BoxHelper:class extends Hl{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 Hn;s.setIndex(new kn(i,1)),s.setAttribute("position",new kn(n,3)),super(s,new Pl({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&&ku.setFromObject(this.object),ku.isEmpty())return;const e=ku.min,i=ku.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:kn,BufferGeometry:Hn,BufferGeometryLoader:Td,ByteType:1010,Cache:Jh,Camera:ps,CameraHelper:class extends Hl{constructor(t){const e=new Hn,i=new Pl({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 In(n,3)),e.setAttribute("color",new In(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 _n(16755200),c=new _n(16711680),h=new _n(43775),d=new _n(16777215),u=new _n(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;Cu.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Lu("c",e,t,Cu,0,0,-1),Lu("t",e,t,Cu,0,0,1),Lu("n1",e,t,Cu,-1,-1,-1),Lu("n2",e,t,Cu,1,-1,-1),Lu("n3",e,t,Cu,-1,1,-1),Lu("n4",e,t,Cu,1,1,-1),Lu("f1",e,t,Cu,-1,-1,1),Lu("f2",e,t,Cu,1,-1,1),Lu("f3",e,t,Cu,-1,1,1),Lu("f4",e,t,Cu,1,1,1),Lu("u1",e,t,Cu,.7,1.1,-1),Lu("u2",e,t,Cu,-.7,1.1,-1),Lu("u3",e,t,Cu,0,2,-1),Lu("cf1",e,t,Cu,-1,0,1),Lu("cf2",e,t,Cu,1,0,1),Lu("cf3",e,t,Cu,0,-1,1),Lu("cf4",e,t,Cu,0,1,1),Lu("cn1",e,t,Cu,-1,0,-1),Lu("cn2",e,t,Cu,1,0,-1),Lu("cn3",e,t,Cu,0,-1,-1),Lu("cn4",e,t,Cu,0,1,-1),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},CanvasTexture:class extends je{constructor(t,e,i,n,s,r,a,o,l){super(t,e,i,n,s,r,a,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}},CapsuleGeometry:xc,CatmullRomCurve3:rc,CineonToneMapping:_,CircleGeometry:wc,ClampToEdgeWrapping:P,Clock:Ud,Color:_n,ColorKeyframeTrack:Gh,ColorManagement:De,CompressedArrayTexture:class extends Jl{constructor(t,e,i,n,s,r){super(t,e,i,s,r),this.isCompressedArrayTexture=!0,this.image.depth=n,this.wrapR=P}},CompressedCubeTexture:class extends Jl{constructor(t,e,i){super(void 0,t[0].width,t[0].height,e,i,T),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}},CompressedTexture:Jl,CompressedTextureLoader:class extends Qh{constructor(t){super(t)}load(t,e,i,n){const s=this,r=[],a=new Jl,o=new id(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=O),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=O),a.format=i.format,a.needsUpdate=!0,e&&e(a)}),i,n);return a}},ConeGeometry:Mc,ConstantAlphaFactor:213,ConstantColorFactor:211,CubeCamera:ys,CubeReflectionMapping:T,CubeRefractionMapping:A,CubeTexture:xs,CubeTextureLoader:class extends Qh{constructor(t){super(t)}load(t,e,i,n){const s=new xs;s.colorSpace=Wt;const r=new nd(this.manager);r.setCrossOrigin(this.crossOrigin),r.setPath(this.path);let a=0;function o(i){r.load(t[i],(function(t){s.images[i]=t,a++,6===a&&(s.needsUpdate=!0,e&&e(s))}),void 0,n)}for(let e=0;e<t.length;++e)o(e);return s}},CubeUVReflectionMapping:k,CubicBezierCurve:cc,CubicBezierCurve3:hc,CubicInterpolant:Oh,CullFaceBack:1,CullFaceFront:2,CullFaceFrontBack:3,CullFaceNone:0,Curve:$l,CurvePath:vc,CustomBlending:5,CustomToneMapping:x,CylinderGeometry:bc,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:Je,DataArrayTexture:Ye,DataTexture:il,DataTextureLoader:class extends Qh{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new il,a=new id(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(t,(function(t){let i;try{i=s.parse(t)}catch(t){if(void 0===n)return void console.error(t);n(t)}void 0!==i.image?r.image=i.image:void 0!==i.data&&(r.image.width=i.width,r.image.height=i.height,r.image.data=i.data),r.wrapS=void 0!==i.wrapS?i.wrapS:P,r.wrapT=void 0!==i.wrapT?i.wrapT:P,r.magFilter=void 0!==i.magFilter?i.magFilter:O,r.minFilter=void 0!==i.minFilter?i.minFilter:O,r.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.colorSpace&&(r.colorSpace=i.colorSpace),void 0!==i.flipY&&(r.flipY=i.flipY),void 0!==i.format&&(r.format=i.format),void 0!==i.type&&(r.type=i.type),void 0!==i.mipmaps&&(r.mipmaps=i.mipmaps,r.minFilter=F),1===i.mipmapCount&&(r.minFilter=O),void 0!==i.generateMipmaps&&(r.generateMipmaps=i.generateMipmaps),r.needsUpdate=!0,e&&e(r,i)}),i,n),r}},DataUtils:An,DecrementStencilOp:7683,DecrementWrapStencilOp:ee,DefaultLoadingManager:Kh,DepthFormat:J,DepthStencilFormat:$,DepthTexture:gr,DetachedBindMode:S,DirectionalLight:_d,DirectionalLightHelper:class extends en{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 Hn;n.setAttribute("position",new In([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const s=new Pl({fog:!1,toneMapped:!1});this.lightPlane=new Bl(n,s),this.add(this.lightPlane),n=new Hn,n.setAttribute("position",new In([0,0,0,0,0,1],3)),this.targetLine=new Bl(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),Su.setFromMatrixPosition(this.light.matrixWorld),Eu.setFromMatrixPosition(this.light.target.matrixWorld),Tu.subVectors(Eu,Su),this.lightPlane.lookAt(Eu),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(Eu),this.targetLine.scale.z=Tu.length()}},DiscreteInterpolant:Fh,DisplayP3ColorSpace:qt,DodecahedronGeometry:Ec,DoubleSide:2,DstAlphaFactor:206,DstColorFactor:208,DynamicCopyUsage:35050,DynamicDrawUsage:35048,DynamicReadUsage:35049,EdgesGeometry:kc,EllipseCurve:Kl,EqualCompare:514,EqualDepth:4,EqualStencilFunc:514,EquirectangularReflectionMapping:C,EquirectangularRefractionMapping:L,Euler:Bi,EventDispatcher:le,ExtrudeGeometry:ah,FileLoader:id,Float16BufferAttribute:class extends kn{constructor(t,e,i){super(new Uint16Array(t),e,i),this.isFloat16BufferAttribute=!0}getX(t){let e=Tn(this.array[t*this.itemSize]);return this.normalized&&(e=ye(e,this.array)),e}setX(t,e){return this.normalized&&(e=xe(e,this.array)),this.array[t*this.itemSize]=En(e),this}getY(t){let e=Tn(this.array[t*this.itemSize+1]);return this.normalized&&(e=ye(e,this.array)),e}setY(t,e){return this.normalized&&(e=xe(e,this.array)),this.array[t*this.itemSize+1]=En(e),this}getZ(t){let e=Tn(this.array[t*this.itemSize+2]);return this.normalized&&(e=ye(e,this.array)),e}setZ(t,e){return this.normalized&&(e=xe(e,this.array)),this.array[t*this.itemSize+2]=En(e),this}getW(t){let e=Tn(this.array[t*this.itemSize+3]);return this.normalized&&(e=ye(e,this.array)),e}setW(t,e){return this.normalized&&(e=xe(e,this.array)),this.array[t*this.itemSize+3]=En(e),this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=xe(e,this.array),i=xe(i,this.array)),this.array[t+0]=En(e),this.array[t+1]=En(i),this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=xe(e,this.array),i=xe(i,this.array),n=xe(n,this.array)),this.array[t+0]=En(e),this.array[t+1]=En(i),this.array[t+2]=En(n),this}setXYZW(t,e,i,n,s){return t*=this.itemSize,this.normalized&&(e=xe(e,this.array),i=xe(i,this.array),n=xe(n,this.array),s=xe(s,this.array)),this.array[t+0]=En(e),this.array[t+1]=En(i),this.array[t+2]=En(n),this.array[t+3]=En(s),this}},Float32BufferAttribute:In,FloatType:W,Fog:wo,FogExp2:xo,FramebufferTexture:class extends je{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=N,this.minFilter=N,this.generateMipmaps=!1,this.needsUpdate=!0}},FrontSide:o,Frustum:Cs,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:se,GreaterCompare:516,GreaterDepth:6,GreaterEqualCompare:518,GreaterEqualDepth:5,GreaterEqualStencilFunc:518,GreaterStencilFunc:516,GridHelper:Mu,Group:lo,HalfFloatType:j,HemisphereLight:rd,HemisphereLightHelper:class extends en{constructor(t,e,i){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const n=new ch(e);n.rotateY(.5*Math.PI),this.material=new bn({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 kn(r,3)),this.add(new rs(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");wu.copy(this.light.color),bu.copy(this.light.groundColor);for(let t=0,i=e.count;t<i;t++){const n=t<i/2?wu:bu;e.setXYZ(t,n.r,n.g,n.b)}e.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),t.lookAt(xu.setFromMatrixPosition(this.light.matrixWorld).negate())}},IcosahedronGeometry:lh,ImageBitmapLoader:class extends Qh{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=Jh.get(t);if(void 0!==r)return s.manager.itemStart(t),r.then?void r.then((i=>{e&&e(i),s.manager.itemEnd(t)})).catch((t=>{n&&n(t)})):(setTimeout((function(){e&&e(r),s.manager.itemEnd(t)}),0),r);const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader;const o=fetch(t,a).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(s.options,{colorSpaceConversion:"none"}))})).then((function(i){return Jh.add(t,i),e&&e(i),s.manager.itemEnd(t),i})).catch((function(e){n&&n(e),Jh.remove(t),s.manager.itemError(t),s.manager.itemEnd(t)}));Jh.add(t,o),s.manager.itemStart(t)}},ImageLoader:nd,ImageUtils:ze,IncrementStencilOp:7682,IncrementWrapStencilOp:te,InstancedBufferAttribute:al,InstancedBufferGeometry:Ed,InstancedInterleavedBuffer:ru,InstancedMesh:ml,Int16BufferAttribute:class extends kn{constructor(t,e,i){super(new Int16Array(t),e,i)}},Int32BufferAttribute:class extends kn{constructor(t,e,i){super(new Int32Array(t),e,i)}},Int8BufferAttribute:class extends kn{constructor(t,e,i){super(new Int8Array(t),e,i)}},IntType:G,InterleavedBuffer:Mo,InterleavedBufferAttribute:Eo,Interpolant:Dh,InterpolateDiscrete:Ut,InterpolateLinear:Dt,InterpolateSmooth:Ot,InvertStencilOp:5386,KeepStencilOp:Kt,KeyframeTrack:zh,LOD:Wo,LatheGeometry:yc,Layers:Fi,LessCompare:513,LessDepth:2,LessEqualCompare:515,LessEqualDepth:3,LessEqualStencilFunc:515,LessStencilFunc:513,Light:sd,LightProbe:bd,Line:Bl,Line3:mu,LineBasicMaterial:Pl,LineCurve:dc,LineCurve3:uc,LineDashedMaterial:Lh,LineLoop:Gl,LineSegments:Hl,LinearDisplayP3ColorSpace:Xt,LinearFilter:O,LinearInterpolant:Bh,LinearMipMapLinearFilter:1008,LinearMipMapNearestFilter:1007,LinearMipmapLinearFilter:F,LinearMipmapNearestFilter:B,LinearSRGBColorSpace:jt,LinearToneMapping:g,LinearTransfer:Zt,Loader:Qh,LoaderUtils:Sd,LoadingManager:$h,LoopOnce:2200,LoopPingPong:Nt,LoopRepeat:It,LuminanceAlphaFormat:1025,LuminanceFormat:1024,MOUSE:i,Material:wn,MaterialLoader:Md,MathUtils:we,Matrix3:Me,Matrix4:Ci,MaxEquation:104,Mesh:rs,MeshBasicMaterial:bn,MeshDepthMaterial:eo,MeshDistanceMaterial:io,MeshLambertMaterial:Ah,MeshMatcapMaterial:Ch,MeshNormalMaterial:Th,MeshPhongMaterial:Sh,MeshPhysicalMaterial:Mh,MeshStandardMaterial:bh,MeshToonMaterial:Eh,MinEquation:103,MirroredRepeatWrapping:I,MixOperation:p,MultiplyBlending:4,MultiplyOperation:u,NearestFilter:N,NearestMipMapLinearFilter:1005,NearestMipMapNearestFilter:1004,NearestMipmapLinearFilter:D,NearestMipmapNearestFilter:U,NeutralToneMapping:b,NeverCompare:512,NeverDepth:0,NeverStencilFunc:512,NoBlending:0,NoColorSpace:Vt,NoToneMapping:f,NormalAnimationBlendMode:Ht,NormalBlending:1,NotEqualCompare:517,NotEqualDepth:7,NotEqualStencilFunc:517,NumberKeyframeTrack:Vh,Object3D:en,ObjectLoader:class extends Qh{constructor(t){super(t)}load(t,e,i,n){const s=this,r=""===this.path?Sd.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||r;const a=new id(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?Sd.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||i;const n=new id(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 Rc).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 rl).fromJSON(t[e],n);i[s.uuid]=s}return i}parseGeometries(t,e){const i={};if(void 0!==t){const n=new Td;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 yh?r=yh[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 Md;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=Zh.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:Ae(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){const i=new $h(e);s=new nd(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 il(i.data,i.width,i.height)))}n[i.uuid]=new Ge(t)}else{const t=r(i.url);n[i.uuid]=new Ge(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:Ae(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){n=new nd(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 il(n.data,n.width,n.height)))}i[n.uuid]=new Ge(t)}else{const t=await s(n.url);i[n.uuid]=new Ge(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 xs,6===o.length&&(l.needsUpdate=!0)):(l=o&&o.data?new il:new je,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,Ad)),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],Cd),l.wrapT=i(r.wrap[1],Cd)),void 0!==r.format&&(l.format=r.format),void 0!==r.internalFormat&&(l.internalFormat=r.internalFormat),void 0!==r.type&&(l.type=r.type),void 0!==r.colorSpace&&(l.colorSpace=r.colorSpace),void 0!==r.minFilter&&(l.minFilter=i(r.minFilter,Ld)),void 0!==r.magFilter&&(l.magFilter=i(r.magFilter,Ld)),void 0!==r.anisotropy&&(l.anisotropy=r.anisotropy),void 0!==r.flipY&&(l.flipY=r.flipY),void 0!==r.generateMipmaps&&(l.generateMipmaps=r.generateMipmaps),void 0!==r.premultiplyAlpha&&(l.premultiplyAlpha=r.premultiplyAlpha),void 0!==r.unpackAlignment&&(l.unpackAlignment=r.unpackAlignment),void 0!==r.compareFunction&&(l.compareFunction=r.compareFunction),void 0!==r.userData&&(l.userData=r.userData),n[r.uuid]=l}return n}parseObject(t,e,i,n,s){let r,a,o;function l(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function c(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let n=0,s=t.length;n<s;n++){const s=t[n];void 0===i[s]&&console.warn("THREE.ObjectLoader: Undefined material",s),e.push(i[s])}return e}return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),i[t]}}function h(t){return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined texture",t),n[t]}switch(t.type){case"Scene":r=new bo,void 0!==t.background&&(Number.isInteger(t.background)?r.background=new _n(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 wo(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(r.fog=new xo(t.fog.color,t.fog.density)),""!==t.fog.name&&(r.fog.name=t.fog.name)),void 0!==t.backgroundBlurriness&&(r.backgroundBlurriness=t.backgroundBlurriness),void 0!==t.backgroundIntensity&&(r.backgroundIntensity=t.backgroundIntensity),void 0!==t.backgroundRotation&&r.backgroundRotation.fromArray(t.backgroundRotation),void 0!==t.environmentRotation&&r.environmentRotation.fromArray(t.environmentRotation);break;case"PerspectiveCamera":r=new vs(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 Ws(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 yd(t.color,t.intensity);break;case"DirectionalLight":r=new _d(t.color,t.intensity);break;case"PointLight":r=new gd(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":r=new xd(t.color,t.intensity,t.width,t.height);break;case"SpotLight":r=new dd(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":r=new rd(t.color,t.groundColor,t.intensity);break;case"LightProbe":r=(new bd).fromJSON(t);break;case"SkinnedMesh":a=l(t.geometry),o=c(t.material),r=new tl(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 rs(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 ml(a,o,e),r.instanceMatrix=new al(new Float32Array(i.array),16),void 0!==n&&(r.instanceColor=new al(new Float32Array(n.array),n.itemSize));break;case"BatchedMesh":a=l(t.geometry),o=c(t.material),r=new Rl(t.maxGeometryCount,t.maxVertexCount,t.maxIndexCount,o),r.geometry=a,r.perObjectFrustumCulled=t.perObjectFrustumCulled,r.sortObjects=t.sortObjects,r._drawRanges=t.drawRanges,r._reservedRanges=t.reservedRanges,r._visibility=t.visibility,r._active=t.active,r._bounds=t.bounds.map((t=>{const e=new ei;e.min.fromArray(t.boxMin),e.max.fromArray(t.boxMax);const i=new yi;return i.radius=t.sphereRadius,i.center.fromArray(t.sphereCenter),{boxInitialized:t.boxInitialized,box:e,sphereInitialized:t.sphereInitialized,sphere:i}})),r._maxGeometryCount=t.maxGeometryCount,r._maxVertexCount=t.maxVertexCount,r._maxIndexCount=t.maxIndexCount,r._geometryInitialized=t.geometryInitialized,r._geometryCount=t.geometryCount,r._matricesTexture=h(t.matricesTexture.uuid);break;case"LOD":r=new Wo;break;case"Line":r=new Bl(l(t.geometry),c(t.material));break;case"LineLoop":r=new Gl(l(t.geometry),c(t.material));break;case"LineSegments":r=new Hl(l(t.geometry),c(t.material));break;case"PointCloud":case"Points":r=new Zl(l(t.geometry),c(t.material));break;case"Sprite":r=new zo(c(t.material));break;case"Group":r=new lo;break;case"Bone":r=new el;break;default:r=new en}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,OctahedronGeometry:ch,OneFactor:201,OneMinusConstantAlphaFactor:214,OneMinusConstantColorFactor:212,OneMinusDstAlphaFactor:207,OneMinusDstColorFactor:209,OneMinusSrcAlphaFactor:d,OneMinusSrcColorFactor:203,OrthographicCamera:Ws,P3Primaries:$t,PCFShadowMap:s,PCFSoftShadowMap:r,PMREMGenerator:er,Path:_c,PerspectiveCamera:vs,Plane:Es,PlaneGeometry:Rs,PlaneHelper:class extends Bl{constructor(t,e=1,i=16776960){const n=i,s=new Hn;s.setAttribute("position",new In([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 Pl({color:n,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const r=new Hn;r.setAttribute("position",new In([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),r.computeBoundingSphere(),this.add(new rs(r,new bn({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:gd,PointLightHelper:class extends rs{constructor(t,e,i){super(new uh(e,4,2),new bn({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:Zl,PointsMaterial:Vl,PolarGridHelper:class extends Hl{constructor(t=10,e=16,i=8,n=64,s=4473924,r=8947848){s=new _n(s),r=new _n(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 Hn;l.setAttribute("position",new In(a,3)),l.setAttribute("color",new In(o,3));super(l,new Pl({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}},PolyhedronGeometry:Sc,PositionalAudio:class extends Hd{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,i){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=i,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(Gd,Vd,Wd),jd.set(0,0,1).applyQuaternion(Vd);const e=this.panner;if(e.positionX){const t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(Gd.x,t),e.positionY.linearRampToValueAtTime(Gd.y,t),e.positionZ.linearRampToValueAtTime(Gd.z,t),e.orientationX.linearRampToValueAtTime(jd.x,t),e.orientationY.linearRampToValueAtTime(jd.y,t),e.orientationZ.linearRampToValueAtTime(jd.z,t)}else e.setPosition(Gd.x,Gd.y,Gd.z),e.setOrientation(jd.x,jd.y,jd.z)}},PropertyBinding:Qd,PropertyMixer:qd,QuadraticBezierCurve:pc,QuadraticBezierCurve3:mc,Quaternion:$e,QuaternionKeyframeTrack:jh,QuaternionLinearInterpolant:Wh,RED_GREEN_RGTC2_Format:Rt,RED_RGTC1_Format:36283,REVISION:e,RGBADepthPacking:3201,RGBAFormat:Y,RGBAIntegerFormat:et,RGBA_ASTC_10x10_Format:St,RGBA_ASTC_10x5_Format:wt,RGBA_ASTC_10x6_Format:bt,RGBA_ASTC_10x8_Format:Mt,RGBA_ASTC_12x10_Format:Et,RGBA_ASTC_12x12_Format:Tt,RGBA_ASTC_4x4_Format:pt,RGBA_ASTC_5x4_Format:mt,RGBA_ASTC_5x5_Format:ft,RGBA_ASTC_6x5_Format:gt,RGBA_ASTC_6x6_Format:vt,RGBA_ASTC_8x5_Format:_t,RGBA_ASTC_8x6_Format:yt,RGBA_ASTC_8x8_Format:xt,RGBA_BPTC_Format:At,RGBA_ETC2_EAC_Format:ut,RGBA_PVRTC_2BPPV1_Format:ct,RGBA_PVRTC_4BPPV1_Format:lt,RGBA_S3TC_DXT1_Format:nt,RGBA_S3TC_DXT3_Format:st,RGBA_S3TC_DXT5_Format:rt,RGB_BPTC_SIGNED_Format:Ct,RGB_BPTC_UNSIGNED_Format:Lt,RGB_ETC1_Format:ht,RGB_ETC2_Format:dt,RGB_PVRTC_2BPPV1_Format:ot,RGB_PVRTC_4BPPV1_Format:at,RGB_S3TC_DXT1_Format:it,RGFormat:1030,RGIntegerFormat:tt,RawShaderMaterial:wh,Ray:Ai,Raycaster:ou,Rec709Primaries:Jt,RectAreaLight:xd,RedFormat:K,RedIntegerFormat:Q,ReinhardToneMapping:v,RenderTarget:Xe,RepeatWrapping:R,ReplaceStencilOp:Qt,ReverseSubtractEquation:102,RingGeometry:hh,SIGNED_RED_GREEN_RGTC2_Format:Pt,SIGNED_RED_RGTC1_Format:kt,SRGBColorSpace:Wt,SRGBTransfer:Yt,Scene:bo,ShaderChunk:Ps,ShaderLib:Ns,ShaderMaterial:us,ShadowMaterial:xh,Shape:Rc,ShapeGeometry:dh,ShapePath:Nu,ShapeUtils:nh,ShortType:1011,Skeleton:rl,SkeletonHelper:class extends Hl{constructor(t){const e=yu(t),i=new Hn,n=[],s=[],r=new _n(0,0,1),a=new _n(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 In(n,3)),i.setAttribute("color",new In(s,3));super(i,new Pl({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");_u.copy(this.root.matrixWorld).invert();for(let t=0,i=0;t<e.length;t++){const s=e[t];s.parent&&s.parent.isBone&&(vu.multiplyMatrices(_u,s.matrixWorld),gu.setFromMatrixPosition(vu),n.setXYZ(i,gu.x,gu.y,gu.z),vu.multiplyMatrices(_u,s.parent.matrixWorld),gu.setFromMatrixPosition(vu),n.setXYZ(i+1,gu.x,gu.y,gu.z),i+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose()}},SkinnedMesh:tl,Source:Ge,Sphere:yi,SphereGeometry:uh,Spherical:hu,SphericalHarmonics3:wd,SplineCurve:fc,SpotLight:dd,SpotLightHelper:class extends en{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const i=new Hn,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 In(n,3));const s=new Pl({fog:!1,toneMapped:!1});this.cone=new Hl(i,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),fu.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(fu),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},Sprite:zo,SpriteMaterial:To,SrcAlphaFactor:h,SrcAlphaSaturateFactor:210,SrcColorFactor:202,StaticCopyUsage:35046,StaticDrawUsage:ne,StaticReadUsage:35045,StereoCamera:class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new vs,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new vs,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,Nd.copy(t.projectionMatrix);const i=e.eyeSep/2,n=i*e.near/e.focus,s=e.near*Math.tan(de*e.fov*.5)/e.zoom;let r,a;Id.elements[12]=-i,Pd.elements[12]=i,r=-s*e.aspect+n,a=s*e.aspect+n,Nd.elements[0]=2*e.near/(a-r),Nd.elements[8]=(a+r)/(a-r),this.cameraL.projectionMatrix.copy(Nd),r=-s*e.aspect-n,a=s*e.aspect-n,Nd.elements[0]=2*e.near/(a-r),Nd.elements[8]=(a+r)/(a-r),this.cameraR.projectionMatrix.copy(Nd)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Id),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Pd)}},StreamCopyUsage:35042,StreamDrawUsage:35040,StreamReadUsage:35041,StringKeyframeTrack:qh,SubtractEquation:101,SubtractiveBlending:3,TOUCH:n,TangentSpaceNormalMap:0,TetrahedronGeometry:ph,Texture:je,TextureLoader:class extends Qh{constructor(t){super(t)}load(t,e,i,n){const s=new je,r=new nd(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}},TorusGeometry:mh,TorusKnotGeometry:fh,Triangle:pn,TriangleFanDrawMode:2,TriangleStripDrawMode:1,TrianglesDrawMode:0,TubeGeometry:gh,UVMapping:E,Uint16BufferAttribute:Rn,Uint32BufferAttribute:Pn,Uint8BufferAttribute:class extends kn{constructor(t,e,i){super(new Uint8Array(t),e,i)}},Uint8ClampedBufferAttribute:class extends kn{constructor(t,e,i){super(new Uint8ClampedArray(t),e,i)}},Uniform:nu,UniformsGroup:class extends le{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:su++}),this.name="",this.usage=ne,this.uniforms=[]}add(t){return this.uniforms.push(t),this}remove(t){const e=this.uniforms.indexOf(t);return-1!==e&&this.uniforms.splice(e,1),this}setName(t){return this.name=t,this}setUsage(t){return this.usage=t,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(t){this.name=t.name,this.usage=t.usage;const e=t.uniforms;this.uniforms.length=0;for(let t=0,i=e.length;t<i;t++){const i=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0;t<i.length;t++)this.uniforms.push(i[t].clone())}return this}clone(){return(new this.constructor).copy(this)}},UniformsLib:Is,UniformsUtils:ds,UnsignedByteType:z,UnsignedInt248Type:Z,UnsignedIntType:V,UnsignedShort4444Type:q,UnsignedShort5551Type:X,UnsignedShortType:H,VSMShadowMap:a,Vector2:be,Vector3:Ke,Vector4:qe,VectorKeyframeTrack:Xh,VideoTexture:class extends je{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:O,this.magFilter=void 0!==s?s:O,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:yo,WebGL3DRenderTarget:class extends Ze{constructor(t=1,e=1,i=1,n={}){super(t,e,n),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new Je(null,t,e,i),this.texture.isRenderTargetTexture=!0}},WebGLArrayRenderTarget:class extends Ze{constructor(t=1,e=1,i=1,n={}){super(t,e,n),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new Ye(null,t,e,i),this.texture.isRenderTargetTexture=!0}},WebGLCoordinateSystem:ae,WebGLCubeRenderTarget:ws,WebGLMultipleRenderTargets:class extends Ze{constructor(t=1,e=1,i=1,n={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(t,e,{...n,count:i}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}},WebGLRenderTarget:Ze,WebGLRenderer:_o,WebGLUtils:ao,WebGPUCoordinateSystem:oe,WireframeGeometry:vh,WrapAroundEnding:zt,ZeroCurvatureEnding:Bt,ZeroFactor:200,ZeroSlopeEnding:Ft,ZeroStencilOp:0,_SRGBAFormat:re,createCanvasElement:Le});const Du={bottom:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},front:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},help:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M23.0%2c-13.0 A10.0%2c10.0%2c0%2c1%2c0%2c22.998476951563912%2c-12.825475935627155' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3ctext x='7.0' y='-6.0' font-size='20.0' fill='rgb(83%2c160%2c227)' font-family='sans-serif' font-weight='bold' dy='0em'%3e%3f%3c/text%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M23.0%2c-13.0 A10.0%2c10.0%2c0%2c1%2c0%2c22.998476951563912%2c-12.825475935627155' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3ctext x='7.0' y='-6.0' font-size='20.0' fill='rgb(48%2c 142%2c 225)' font-family='sans-serif' font-weight='bold' dy='0em'%3e%3f%3c/text%3e%3c/svg%3e"},iso:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M22.0%2c-7.5 L22.0%2c-18.5 L13.0%2c-13.0 L13.0%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-13.0 L13.0%2c-2.0 L4.0%2c-7.5 L4.0%2c-18.5 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-18.5 L13.0%2c-24.0 L4.0%2c-18.5 L13.0%2c-13.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M22.0%2c-7.5 L22.0%2c-18.5 L13.0%2c-13.0 L13.0%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-13.0 L13.0%2c-2.0 L4.0%2c-7.5 L4.0%2c-18.5 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-18.5 L13.0%2c-24.0 L4.0%2c-18.5 L13.0%2c-13.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},left:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},mesh:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e"},mesh_empty:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='%23ddd' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='%23ddd' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='%23666' stroke='%23666' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='%23666' stroke='%23666' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23666' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e"},mesh_mix:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-14.2 L12.6%2c-14.2 L8.6%2c-10.133333333333333 L8.6%2c-6.066666666666666 L12.6%2c-2.0 L6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='square' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M16.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 L16.6%2c-2.0 L12.6%2c-6.066666666666666 L12.6%2c-10.133333333333333 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M10.6%2c-10.133333333333333 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L10.6%2c-6.066666666666666' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-14.2 L6.0%2c-14.2 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L6.0%2c-2.0 L14.6%2c-2.0' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-14.2 L12.6%2c-14.2 L8.6%2c-10.133333333333333 L8.6%2c-6.066666666666666 L12.6%2c-2.0 L6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='square' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M16.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 L16.6%2c-2.0 L12.6%2c-6.066666666666666 L12.6%2c-10.133333333333333 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M10.6%2c-10.133333333333333 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L10.6%2c-6.066666666666666' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-14.2 L6.0%2c-14.2 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L6.0%2c-2.0 L14.6%2c-2.0' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},mesh_no:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e"},pause:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='5.2' y='-22.0' width='5.6' height='18.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3crect x='15.2' y='-22.0' width='5.6' height='18.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='5.2' y='-22.0' width='5.6' height='18.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3crect x='15.2' y='-22.0' width='5.6' height='18.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},pin:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='10.0' y='-23.0' width='6.0' height='11.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-3.0 L13.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M17.330127018922195%2c-21.5 A5.0%2c5.0%2c0%2c0%2c0%2c8.669872981077805%2c-21.5' stroke='%23444' stroke-width='1.25' fill='rgb(83%2c160%2c227)' stroke-linecap='round' /%3e%3cpath d='M21.66025403784439%2c-10.2 A10.0%2c10.0%2c0%2c0%2c0%2c4.339745962155613%2c-10.2' stroke='%23444' stroke-width='1.25' fill='rgb(83%2c160%2c227)' stroke-linecap='round' /%3e%3cpath d='M4.5%2c-10.2 L21.5%2c-10.2 Z' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M8.8%2c-21.4 L17.2%2c-21.4 Z' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='10.0' y='-23.0' width='6.0' height='11.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-3.0 L13.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M17.330127018922195%2c-21.5 A5.0%2c5.0%2c0%2c0%2c0%2c8.669872981077805%2c-21.5' stroke='%23ddd' stroke-width='1.25' fill='rgb(48%2c 142%2c 225)' stroke-linecap='round' /%3e%3cpath d='M21.66025403784439%2c-10.2 A10.0%2c10.0%2c0%2c0%2c0%2c4.339745962155613%2c-10.2' stroke='%23ddd' stroke-width='1.25' fill='rgb(48%2c 142%2c 225)' stroke-linecap='round' /%3e%3cpath d='M4.5%2c-10.2 L21.5%2c-10.2 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M8.8%2c-21.4 L17.2%2c-21.4 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},plane:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.0%2c-5.0 L4.4%2c-13.0 L24.0%2c-13.0 L21.0%2c-5.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-9.5 L13.0%2c-19.5 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M11.0%2c-17.5 L13.0%2c-19.5 L15.0%2c-17.5 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.0%2c-5.0 L4.4%2c-13.0 L24.0%2c-13.0 L21.0%2c-5.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-9.5 L13.0%2c-19.5 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M11.0%2c-17.5 L13.0%2c-19.5 L15.0%2c-17.5 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},play:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M5.0%2c-4.0 L5.0%2c-22.0 L21.0%2c-13.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M5.0%2c-4.0 L5.0%2c-22.0 L21.0%2c-13.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},rear:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},reset:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M18.0%2c-21.660254037844386 A10.0%2c10.0%2c0%2c1%2c0%2c23.0%2c-12.999999999999998' stroke='%23444' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M16.0%2c-18.196152422706632 A6.0%2c6.0%2c0%2c1%2c0%2c19.0%2c-12.999999999999998' stroke='%23444' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M17.0%2c-13.0 L21.0%2c-17.0 L25.0%2c-13.0' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M18.0%2c-21.660254037844386 A10.0%2c10.0%2c0%2c1%2c0%2c23.0%2c-12.999999999999998' stroke='%23ddd' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M16.0%2c-18.196152422706632 A6.0%2c6.0%2c0%2c1%2c0%2c19.0%2c-12.999999999999998' stroke='%23ddd' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M17.0%2c-13.0 L21.0%2c-17.0 L25.0%2c-13.0' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},resize:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='2.0' y='-24.0' width='22.0' height='22.0' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L6.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-6.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L20.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-20.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L6.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-20.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L20.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-6.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='2.0' y='-24.0' width='22.0' height='22.0' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L6.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-6.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L20.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-20.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L6.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-20.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L20.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-6.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},right:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},shape:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='rgb(83%2c160%2c227)' stroke='none' stroke-width='1.25' /%3e%3cellipse cx='12.6' cy='-8.1' rx='2.1' ry='2.1' fill='%23444' stroke='%23444' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='rgb(48%2c 142%2c 225)' stroke='none' stroke-width='1.25' /%3e%3cellipse cx='12.6' cy='-8.1' rx='2.1' ry='2.1' fill='%23ddd' stroke='%23ddd' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},shape_empty:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='%23ddd' stroke='none' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='%23666' stroke='none' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23666' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23666' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},shape_mix:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M12.6%2c-13.14 A5.04%2c5.04%2c0%2c0%2c0%2c12.599999999999998%2c-3.0599999999999996' stroke='none' stroke-width='1.25' fill='rgb(83%2c160%2c227)' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-10.2 A2.1%2c2.1%2c0%2c0%2c0%2c12.6%2c-6.0' stroke='%23444' stroke-width='1.25' fill='%23444' stroke-linecap='round' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c15.69914007006101%2c-13.236830413208175' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M15.69914007006101%2c-2.9631695867918246 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-13.7 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c12.6%2c-2.5' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M12.6%2c-13.14 A5.04%2c5.04%2c0%2c0%2c0%2c12.599999999999998%2c-3.0599999999999996' stroke='none' stroke-width='1.25' fill='rgb(48%2c 142%2c 225)' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-10.2 A2.1%2c2.1%2c0%2c0%2c0%2c12.6%2c-6.0' stroke='%23ddd' stroke-width='1.25' fill='%23ddd' stroke-linecap='round' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c15.69914007006101%2c-13.236830413208175' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M15.69914007006101%2c-2.9631695867918246 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-13.7 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c12.6%2c-2.5' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},shape_no:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},stop:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='4.0' y='-22.0' width='18.0' height='18.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='4.0' y='-22.0' width='18.0' height='18.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},top:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},axes:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-3.0 Z' fill='none' stroke='red' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-17.0 Z' fill='none' stroke='rgb(0%2c128%2c0)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L6.6%2c-24.0 Z' fill='none' stroke='blue' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-3.0 Z' fill='none' stroke='rgb(255%2c 69%2c 0)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-17.0 Z' fill='none' stroke='rgb(50%2c 205%2c 50)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L6.6%2c-24.0 Z' fill='none' stroke='rgb(59%2c 158%2c 255)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},axes0:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-3.0 Z' fill='none' stroke='red' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-17.0 Z' fill='none' stroke='rgb(0%2c128%2c0)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L6.6%2c-24.0 Z' fill='none' stroke='blue' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.6' cy='-10.0' rx='3.0' ry='3.8' fill='none' stroke='white' stroke-width='2.4' /%3e%3cellipse cx='6.6' cy='-10.0' rx='2.0' ry='3.0' fill='white' stroke='%23444' stroke-width='1.4' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-3.0 Z' fill='none' stroke='rgb(255%2c 69%2c 0)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-17.0 Z' fill='none' stroke='rgb(50%2c 205%2c 50)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L6.6%2c-24.0 Z' fill='none' stroke='rgb(59%2c 158%2c 255)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.6' cy='-10.0' rx='3.0' ry='3.8' fill='none' stroke='%23444' stroke-width='2.4' /%3e%3cellipse cx='6.6' cy='-10.0' rx='2.0' ry='3.0' fill='%23444' stroke='%23ddd' stroke-width='1.4' /%3e%3c/svg%3e"},grid:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.4%2c-2.0 L23.6%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-9.333333333333332 L23.6%2c-9.333333333333332 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-16.666666666666664 L23.6%2c-16.666666666666664 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-24.0 L23.6%2c-24.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.4 L2.0%2c-23.6 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M9.333333333333332%2c-2.4 L9.333333333333332%2c-23.6 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M16.666666666666664%2c-2.4 L16.666666666666664%2c-23.6 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M24.0%2c-2.4 L24.0%2c-23.6 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.4%2c-2.0 L23.6%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-9.333333333333332 L23.6%2c-9.333333333333332 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-16.666666666666664 L23.6%2c-16.666666666666664 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-24.0 L23.6%2c-24.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.4 L2.0%2c-23.6 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M9.333333333333332%2c-2.4 L9.333333333333332%2c-23.6 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M16.666666666666664%2c-2.4 L16.666666666666664%2c-23.6 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M24.0%2c-2.4 L24.0%2c-23.6 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},perspective:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='14.0' y='-24.0' width='10.0' height='10.0' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L14.0%2c-14.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-18.0 L24.0%2c-24.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L24.0%2c-14.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L14.0%2c-24.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.875' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='14.0' y='-24.0' width='10.0' height='10.0' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L14.0%2c-14.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-18.0 L24.0%2c-24.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L24.0%2c-14.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L14.0%2c-24.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.875' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},explode:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cellipse cx='22.5' cy='-13.0' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L20.5%2c-13.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='15.935661446562001' cy='-22.03503690480396' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L15.317627457812106%2c-20.132923872213652 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='5.3143385534380005' cy='-18.583959896778495' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L6.932372542187895%2c-17.40838939219355 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='5.314338553437999' cy='-7.416040103221507' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L6.932372542187894%2c-8.591610607806452 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='15.935661446561998' cy='-3.9649630951960404' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L15.317627457812105%2c-5.867076127786348 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='13.0' cy='-13.0' rx='2.0' ry='2.0' fill='%23444' stroke='%23444' stroke-width='1.75' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cellipse cx='22.5' cy='-13.0' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L20.5%2c-13.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='15.935661446562001' cy='-22.03503690480396' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L15.317627457812106%2c-20.132923872213652 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='5.3143385534380005' cy='-18.583959896778495' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L6.932372542187895%2c-17.40838939219355 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='5.314338553437999' cy='-7.416040103221507' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L6.932372542187894%2c-8.591610607806452 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='15.935661446561998' cy='-3.9649630951960404' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L15.317627457812105%2c-5.867076127786348 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='13.0' cy='-13.0' rx='2.0' ry='2.0' fill='%23ddd' stroke='%23ddd' stroke-width='1.75' /%3e%3c/svg%3e"},distance:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.0%2c-5.0 L2.0%2c-21.0 Z' fill='none' stroke='%23444' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M24.0%2c-5.0 L24.0%2c-21.0 Z' fill='none' stroke='%23444' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L22.0%2c-13.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L6.8%2c-16.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L6.8%2c-10.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-13.0 L19.2%2c-16.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-13.0 L19.2%2c-10.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.0%2c-5.0 L2.0%2c-21.0 Z' fill='none' stroke='%23ddd' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M24.0%2c-5.0 L24.0%2c-21.0 Z' fill='none' stroke='%23ddd' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L22.0%2c-13.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L6.8%2c-16.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L6.8%2c-10.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-13.0 L19.2%2c-16.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-13.0 L19.2%2c-10.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},properties:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M4.0%2c-21.6 L22.0%2c-21.6 Z' fill='none' stroke='%23444' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M9.2%2c-16.8 L20.8%2c-16.8 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-16.8' rx='0.8' ry='0.8' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-12.8 L20.8%2c-12.8 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-12.8' rx='0.8' ry='0.8' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-8.8 L20.8%2c-8.8 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-8.8' rx='0.8' ry='0.8' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-4.8 L20.8%2c-4.8 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-4.8' rx='0.8' ry='0.8' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M4.0%2c-21.6 L22.0%2c-21.6 Z' fill='none' stroke='%23ddd' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M9.2%2c-16.8 L20.8%2c-16.8 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-16.8' rx='0.8' ry='0.8' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-12.8 L20.8%2c-12.8 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-12.8' rx='0.8' ry='0.8' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-8.8 L20.8%2c-8.8 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-8.8' rx='0.8' ry='0.8' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-4.8 L20.8%2c-4.8 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-4.8' rx='0.8' ry='0.8' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3c/svg%3e"},angle:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.4%2c-3.84 L23.6%2c-3.84 Z' fill='none' stroke='%23444' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-3.84 L14.0%2c-22.88 Z' fill='none' stroke='%23444' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M17.80793811328415%2c-6.280377654627602 A15.6%2c15.6%2c0%2c0%2c0%2c12.217398100377466%2c-15.963476998728744' stroke='rgb(83%2c160%2c227)' stroke-width='2.0' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.4%2c-3.84 L23.6%2c-3.84 Z' fill='none' stroke='%23ddd' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-3.84 L14.0%2c-22.88 Z' fill='none' stroke='%23ddd' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M17.80793811328415%2c-6.280377654627602 A15.6%2c15.6%2c0%2c0%2c0%2c12.217398100377466%2c-15.963476998728744' stroke='rgb(48%2c 142%2c 225)' stroke-width='2.0' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},transparent:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='0.75' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='0.75' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' fill-opacity='0.75' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='0.75' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='0.75' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' fill-opacity='0.75' /%3e%3c/svg%3e"},blackedges:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='7.833333333333333' y='-23.5' width='15.666666666666666' height='15.666666666666666' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-2.5 L2.5%2c-18.166666666666664 L7.833333333333333%2c-23.5 L7.833333333333333%2c-7.833333333333333 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-2.5 L7.833333333333333%2c-7.833333333333333 L23.5%2c-7.833333333333333 L18.166666666666664%2c-2.5 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-18.166666666666664 L7.833333333333333%2c-23.5 L23.5%2c-23.5 L18.166666666666664%2c-18.166666666666664 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.166666666666664%2c-2.5 L18.166666666666664%2c-18.166666666666664 L23.5%2c-23.5 L23.5%2c-7.833333333333333 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.5' y='-18.166666666666664' width='15.666666666666666' height='15.666666666666666' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='7.833333333333333' y='-23.5' width='15.666666666666666' height='15.666666666666666' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-2.5 L2.5%2c-18.166666666666664 L7.833333333333333%2c-23.5 L7.833333333333333%2c-7.833333333333333 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-2.5 L7.833333333333333%2c-7.833333333333333 L23.5%2c-7.833333333333333 L18.166666666666664%2c-2.5 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-18.166666666666664 L7.833333333333333%2c-23.5 L23.5%2c-23.5 L18.166666666666664%2c-18.166666666666664 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.166666666666664%2c-2.5 L18.166666666666664%2c-18.166666666666664 L23.5%2c-23.5 L23.5%2c-7.833333333333333 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.5' y='-18.166666666666664' width='15.666666666666666' height='15.666666666666666' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"}};function Ou(t,e){return`url("${Du[e][t]}")`}function Bu(t){if(Array.isArray(t))return t.map((t=>Bu(t)));if("object"==typeof t){var e={};for(var[i,n]of Object.entries(t))e[i]=Bu(n);return e}return t}function Fu(t,e,i=1e-9){if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&t.every(((t,i)=>Fu(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=>Fu(t[i],e[i])))}return Number(t)===t&&Number(e)===e?Math.abs(t-e)<i:t===e}function zu(t,e){t&&(e(t),t.children&&t.children.length>0&&t.children.forEach((t=>{zu(t,e)})))}function Hu(t){return Math.round(Math.PI*t)}const Gu=new class{constructor(){this.keyMapping={shift:"shiftKey",ctrl:"ctrlKey",meta:"metaKey"}}getshortcuts=t=>this.keyMapping[t].replace("Key","");get_config(){return Object.assign({},this.keyMapping)}get=(t,e)=>t[this.keyMapping[e]];set=t=>{for(var e in t)this.keyMapping[e]=t[e]}};class Vu{constructor(t,e,i,n){t.startsWith("plane")?(this.index=parseInt(t.substring(5)),this.type="plane"):(this.index=void 0,this.type=t),this.display=n,this.slider=n.container.getElementsByClassName(`tcv_sld_value_${t}`)[0],this.slider.min=e,this.slider.max=i,this.input=n.container.getElementsByClassName(`tcv_inp_value_${t}`)[0],this.input.value=i,this.slider.oninput=this.sliderChange,this.input.addEventListener("change",this.inputChange)}_notify=(t,e=!0)=>{if("plane"==this.type){const i={};i["clip_slider_"+(this.index-1)]=parseFloat(t),this.display.viewer.checkChanges(i,e)}};_handle(t,e,i){"plane"==t?this.display.refreshPlane(e,i):"ambientlight"===t?this.display.viewer.ready&&this.display.viewer.setAmbientLight(i/100):"pointlight"===t?this.display.viewer.ready&&this.display.viewer.setDirectLight(i/100):"metalness"===t?this.display.viewer.ready&&this.display.viewer.setMetalness(i/100):"roughness"===t&&this.display.viewer.ready&&this.display.viewer.setRoughness(i/100)}sliderChange=t=>{const e=t.target.value;this.input.value=Math.round(1e3*e)/1e3,this._handle(this.type,this.index,this.input.value),this._notify(e)};inputChange=t=>{const e=Math.max(Math.min(t.target.value,this.slider.max),this.slider.min);this.slider.value=e,this._handle(this.type,this.index,this.input.value),this._notify(e)};setSlider(t){const e=Math.abs(Math.round(Math.log10(2*t)));this.slider.min=-t,this.slider.max=t,this.slider.step=Math.pow(10,-(3-e)),this.slider.value=t,this.input.value=Math.round(1e3*this.slider.max)/1e3,this.display.refreshPlane(this.index,this.input.value)}getValue(){return parseFloat(this.input.value)}setValue(t,e=!0){const i=Math.max(Math.min(t,this.slider.max),this.slider.min);this.input.value=Math.round(1e3*i)/1e3,this.slider.value=t,this._handle(this.type,this.index,this.input.value),this._notify(t,e)}}class Wu{constructor(t,e){this.id=e,this.container=t,this.buttons={}}addButton(t){t.setId(this.id),this.buttons[t.name]=t,this.container.appendChild(t.html)}addSeparator(){var t=document.createElement("span");t.className="tcv_separator",this.container.appendChild(t)}defineGroup(t){for(var e of t)for(var i of t)i!=e&&e.addGroupMember(i)}}class ju{constructor(t,e,i){this.svg=Ou(t,e),this.name=e;var n=document.createElement("span");n.className="tcv_tooltip",n.setAttribute("data-tooltip",i);var s=n.appendChild(document.createElement("span"));s.className="tcv_button_frame",s.appendChild(document.createElement("input")),s.children[0].className="tcv_reset tcv_btn",s.children[0].type="button",s.children[0].style.backgroundImage=this.svg,this.html=n,this.html.addEventListener("click",(t=>{this.handler(t)}))}dispose(){this.html="",this.container.removeEventListener("click",this.handler)}setId(t){this.containerId=t}handler=t=>{console.log("not implemented yet")};alignRight(){this.html.classList.add("tcv_align_right")}show(t){this.html.style.display=t?"inline-block":"none"}}class qu extends ju{constructor(t,e,i,n){super(t,e,i),this.action=n}handler=t=>{this.action(this.name)};highlight=t=>{t?this.html.firstChild.classList.add("tcv_btn_highlight"):this.html.firstChild.classList.remove("tcv_btn_highlight")}}class Xu extends ju{constructor(t,e,i,n,s=!1,r=null){if(super(t,e,i),this.action=n,this.state=s,this.dropdown=r,this.sameGroup=[],this.checkElems={},null!=r){const t=document.createElement("span");for(var a of(t.classList.add("tcv_grid-content"),t.classList.add("tcv_dropdown-content"),t.classList.add("tcv_round"),r)){const e=document.createElement("div");e.className="tcv_tooltip",e.setAttribute("data-tooltip",`${i} ${a}`),e.innerHTML=`<input class='tcv_grid-${a} tcv_check tcv_dropdown-entry' id='tcv_grid-${a}_${this.containerId}' type="checkbox"><label for='tcv_grid-${a}_${this.containerId}' class="tcv_label tcv_dropdown-entry">${a}</label>`,t.appendChild(e),this.checkElems[a]=e.children[0]}this.html.children[0].appendChild(t),this.html.children[0].classList.add("tcv_grid-dropdown")}}get=()=>this.state;set=t=>{this.state=t,this.html.children[0].classList.toggle("tcv_btn_click2",this.state)};clearGroup=()=>{for(var t of this.sameGroup)t.state&&(t.state=!1,t.html.children[0].classList.remove("tcv_btn_click2"),t.action(this.name,!1))};extractIdFromName=t=>{const e="grid-",i=t.indexOf(e)+5,n=t.indexOf("_",i);return t.slice(i,n)};handler=t=>{const e=this.extractIdFromName(t.target.id);if(null!=this.dropdown&&e&&this.dropdown.includes(e)){const i=t.target.checked;this.action(`grid-${e}`,i),this.checkElems[e].checked=i}else"button"===t.target.type&&(this.state||this.clearGroup(),this.set(!this.state),this.action(this.name,this.state))};addGroupMember(t){this.sameGroup.push(t)}}const Zu=new ei,Yu=new Ke;let Ju=class extends Ed{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 In([-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 In([-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 ru(e,6,1);return this.setAttribute("instanceStart",new Eo(i,3,0)),this.setAttribute("instanceEnd",new Eo(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 ru(e,6,1);return this.setAttribute("instanceColorStart",new Eo(i,3,0)),this.setAttribute("instanceColorEnd",new Eo(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 vh(t.geometry)),this}fromLineSegments(t){const e=t.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new ei);const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;void 0!==t&&void 0!==e&&(this.boundingBox.setFromBufferAttribute(t),Zu.setFromBufferAttribute(e),this.boundingBox.union(Zu))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new yi),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++)Yu.fromBufferAttribute(t,s),n=Math.max(n,i.distanceToSquared(Yu)),Yu.fromBufferAttribute(e,s),n=Math.max(n,i.distanceToSquared(Yu));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)}};Is.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new be(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},Ns.line={uniforms:ds.merge([Is.common,Is.fog,Is.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );\n\t\t\t\tvec3 worldUp = normalize( cross( worldDir, tmpFwd ) );\n\t\t\t\tvec3 worldFwd = cross( worldDir, worldUp );\n\t\t\t\tworldPos = position.y < 0.5 ? start: end;\n\n\t\t\t\t// height offset\n\t\t\t\tfloat hw = linewidth * 0.5;\n\t\t\t\tworldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// cap extension\n\t\t\t\t\tworldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;\n\n\t\t\t\t\t// add width to the box\n\t\t\t\t\tworldPos.xyz += worldFwd * hw;\n\n\t\t\t\t\t// endcaps\n\t\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\t\tworldPos.xyz -= worldFwd * 2.0 * hw;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <colorspace_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};class $u extends us{constructor(t){super({type:"LineMaterial",uniforms:ds.clone(Ns.line.uniforms),vertexShader:Ns.line.vertexShader,fragmentShader:Ns.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(t)}get color(){return this.uniforms.diffuse.value}set color(t){this.uniforms.diffuse.value=t}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(t){!0===t?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(t){this.uniforms.linewidth&&(this.uniforms.linewidth.value=t)}get dashed(){return"USE_DASH"in this.defines}set dashed(t){!0===t!==this.dashed&&(this.needsUpdate=!0),!0===t?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(t){this.uniforms.dashScale.value=t}get dashSize(){return this.uniforms.dashSize.value}set dashSize(t){this.uniforms.dashSize.value=t}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(t){this.uniforms.dashOffset.value=t}get gapSize(){return this.uniforms.gapSize.value}set gapSize(t){this.uniforms.gapSize.value=t}get opacity(){return this.uniforms.opacity.value}set opacity(t){this.uniforms&&(this.uniforms.opacity.value=t)}get resolution(){return this.uniforms.resolution.value}set resolution(t){this.uniforms.resolution.value.copy(t)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(t){this.defines&&(!0===t!==this.alphaToCoverage&&(this.needsUpdate=!0),!0===t?(this.defines.USE_ALPHA_TO_COVERAGE="",this.extensions.derivatives=!0):(delete this.defines.USE_ALPHA_TO_COVERAGE,this.extensions.derivatives=!1))}}const Ku=new Ke,Qu=new Ke,tp=new qe,ep=new qe,ip=new qe,np=new Ke,sp=new Ci,rp=new mu,ap=new Ke,op=new ei,lp=new yi,cp=new qe;let hp,dp;function up(t,e,i){return cp.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),cp.multiplyScalar(1/cp.w),cp.x=dp/i.width,cp.y=dp/i.height,cp.applyMatrix4(t.projectionMatrixInverse),cp.multiplyScalar(1/cp.w),Math.abs(Math.max(cp.x,cp.y))}class pp extends rs{constructor(t=new Ju,e=new $u({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)Ku.fromBufferAttribute(e,t),Qu.fromBufferAttribute(i,t),n[s]=0===s?0:n[s-1],n[s+1]=n[s]+Ku.distanceTo(Qu);const s=new ru(n,2,1);return t.setAttribute("instanceDistanceStart",new Eo(s,1,0)),t.setAttribute("instanceDistanceEnd",new Eo(s,1,1)),this}raycast(t,e){const i=this.material.worldUnits,n=t.camera;null!==n||i||console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const s=void 0!==t.params.Line2&&t.params.Line2.threshold||0;hp=t.ray;const r=this.matrixWorld,a=this.geometry,o=this.material;let l,c;if(dp=o.linewidth+s,null===a.boundingSphere&&a.computeBoundingSphere(),lp.copy(a.boundingSphere).applyMatrix4(r),i)l=.5*dp;else{l=up(n,Math.max(n.near,lp.distanceToPoint(hp.origin)),o.resolution)}if(lp.radius+=l,!1!==hp.intersectsSphere(lp)){if(null===a.boundingBox&&a.computeBoundingBox(),op.copy(a.boundingBox).applyMatrix4(r),i)c=.5*dp;else{c=up(n,Math.max(n.near,op.distanceToPoint(hp.origin)),o.resolution)}op.expandByScalar(c),!1!==hp.intersectsBox(op)&&(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++){rp.start.fromBufferAttribute(s,a),rp.end.fromBufferAttribute(r,a),rp.applyMatrix4(i);const n=new Ke,o=new Ke;hp.distanceSqToSegment(rp.start,rp.end,o,n),o.distanceTo(n)<.5*dp&&e.push({point:o,pointOnLine:n,distance:hp.origin.distanceTo(o),object:t,face:null,faceIndex:a,uv:null,uv1:null})}}(this,e):function(t,e,i){const n=e.projectionMatrix,s=t.material.resolution,r=t.matrixWorld,a=t.geometry,o=a.attributes.instanceStart,l=a.attributes.instanceEnd,c=Math.min(a.instanceCount,o.count),h=-e.near;hp.at(1,ip),ip.w=1,ip.applyMatrix4(e.matrixWorldInverse),ip.applyMatrix4(n),ip.multiplyScalar(1/ip.w),ip.x*=s.x/2,ip.y*=s.y/2,ip.z=0,np.copy(ip),sp.multiplyMatrices(e.matrixWorldInverse,r);for(let e=0,a=c;e<a;e++){if(tp.fromBufferAttribute(o,e),ep.fromBufferAttribute(l,e),tp.w=1,ep.w=1,tp.applyMatrix4(sp),ep.applyMatrix4(sp),tp.z>h&&ep.z>h)continue;if(tp.z>h){const t=tp.z-ep.z,e=(tp.z-h)/t;tp.lerp(ep,e)}else if(ep.z>h){const t=ep.z-tp.z,e=(ep.z-h)/t;ep.lerp(tp,e)}tp.applyMatrix4(n),ep.applyMatrix4(n),tp.multiplyScalar(1/tp.w),ep.multiplyScalar(1/ep.w),tp.x*=s.x/2,tp.y*=s.y/2,ep.x*=s.x/2,ep.y*=s.y/2,rp.start.copy(tp),rp.start.z=0,rp.end.copy(ep),rp.end.z=0;const a=rp.closestPointToPointParameter(np,!0);rp.at(a,ap);const c=we.lerp(tp.z,ep.z,a),d=c>=-1&&c<=1,u=np.distanceTo(ap)<.5*dp;if(d&&u){rp.start.fromBufferAttribute(o,e),rp.end.fromBufferAttribute(l,e),rp.start.applyMatrix4(r),rp.end.applyMatrix4(r);const n=new Ke,s=new Ke;hp.distanceSqToSegment(rp.start,rp.end,s,n),i.push({point:s,pointOnLine:n,distance:hp.origin.distanceTo(s),object:t,face:null,faceIndex:e,uv:null,uv1:null})}}}(this,n,e))}}}const mp={none:null,vertex:"vertex",edge:"edge",face:"face",solid:"solid"},fp=null,gp="plane",vp="line",_p="circle",yp={face:["plane","cylinder","cone","sphere","torus","bezier","bspline","revolution","extrusion","offset","other"],edge:["line","circle","ellipse","hyperbola","parabola","bezier","bspline","offset","other"]};class xp{constructor(t,e){this.obj=t,this.fromSolid=e}_getSolidObjectGroups(t){const e=t.parent.parent;let i;for(let t=0;t<e.children.length;t++){const n=e.children[t];if(n.name===e.name+"|faces"){i=n;break}}return i.children}objs(){return this.fromSolid?this._getSolidObjectGroups(this.obj):[this.obj]}}class wp{constructor(t,e,i,n,s,r,a){this.camera=t,this.group=r,this.domElement=e,this.width=i,this.height=n,this.threshold=s,this.callback=a,this.raycaster=new ou,this.raycastMode=!1,this.lastPosition=null,this.mouse=new be,this.mouseMoved=!1,this.filters={topoFilter:[mp.none],geomFilter:[fp]}}dispose(){this.domElement.removeEventListener("mousemove",this.onPointerMove),this.domElement.removeEventListener("mouseup",this.mouseKetUp),this.domElement.removeEventListener("mousedown",this.onMouseKeyDown),this.domElement.removeEventListener("keydown",this.onKeyDown),this.raycastMode=!1}init(){this.domElement.addEventListener("mousemove",this.onPointerMove),this.domElement.addEventListener("mouseup",this.onMouseKeyUp,!1),this.domElement.addEventListener("mousedown",this.onMouseKeyDown,!1),this.domElement.addEventListener("keydown",this.onKeyDown,!1),this.raycastMode=!0}getIntersectedObjs(){this.raycaster.setFromCamera(this.mouse,this.camera.getCamera()),this.raycaster.params.Points.threshold=this.threshold/this.camera.getZoom(),this.raycaster.params.Line2={threshold:4};var t=this.raycaster.intersectObjects(this.group,!0),e=[];for(var i in t)t[i].object.material.visible&&e.push(t[i]);return e}getValidIntersectedObjs(){var t=[];if(this.mouseMoved){const i=this.getIntersectedObjs();for(var e of i)if(e.object.material.visible){const i=e.object.parent;if(null==i)continue;if(!i.shapeInfo)continue;const n=i.shapeInfo.topo;let s;"vertex"!==n&&(s=yp[n][i.shapeInfo.geomtype]);const r="solid"===i.subtype;let a=this.filters.topoFilter.includes(mp.solid)&&r||this.filters.topoFilter.includes(mp.none)||this.filters.topoFilter.includes(n);if(!a)continue;a=this.filters.geomFilter.includes(fp)||this.filters.geomFilter.includes(s)&&!this.filters.topoFilter.includes(mp.solid),a&&t.push(e)}}return t}onMouseKeyDown=t=>{this.raycastMode&&(t.button!=i.LEFT&&t.button!=i.RIGHT||(this.lastPosition=this.camera.getPosition().clone()))};onMouseKeyUp=t=>{this.raycastMode&&(t.button==i.LEFT?this.lastPosition.equals(this.camera.getPosition())&&this.callback({mouse:"left"}):t.button==i.RIGHT&&this.lastPosition.equals(this.camera.getPosition())&&this.callback({mouse:"right"}))};onKeyDown=t=>{this.raycastMode&&("Backspace"==t.key?this.callback({key:"Backspace"}):"Escape"==t.key&&this.callback({key:"Escape"}))};onPointerMove=t=>{const e=this.domElement.getBoundingClientRect(),i=e.x+window.scrollX,n=e.y+window.scrollY;this.mouse.x=(t.pageX-i)/this.width*2-1,this.mouse.y=-(t.pageY-n)/this.height*2+1,this.mouseMoved=!0}}class bp{constructor(t){this.display=t,this.html=this._getHtml(),this.html.addEventListener("contextmenu",(t=>{t.preventDefault()}))}_getHtml(){throw new Error("Not implemented")}_getCellValue(t){const e=this.display._getElement(t);return e?e.textContent:null}_setCellValue(t,e){const i=this.display._getElement(t);i&&(i.textContent=e)}show=t=>{this.html.style.display=t?"inline-block":"none"};relocate=(t,e)=>{this.html.style.left=`${t}px`,this.html.style.top=`${e}px`};registerCallback(t,e){this.html.addEventListener(t,e)}}class Mp extends bp{constructor(t){super(t)}_getHtml(){return this.display._getElement("tcv_distance_measurement_panel")}get total(){return this._getCellValue("tcv_total")}set total(t){this._setCellValue("tcv_total",t)}get x_distance(){return this._getCellValue("tcv_x")}set x_distance(t){this._setCellValue("tcv_x",t)}get y_distance(){return this._getCellValue("tcv_y")}set y_distance(t){this._setCellValue("tcv_y",t)}get z_distance(){return this._getCellValue("tcv_z")}set z_distance(t){this._setCellValue("tcv_z",t)}}class Sp extends bp{constructor(t){super(t),this._hideAllRows()}_getHtml(){return this.display._getElement("tcv_properties_measurement_panel")}_hideAllRows(){const t=this.html.getElementsByTagName("tr");for(var e=0;e<t.length;e++){if(t[e].style.display="none",t[e].classList.contains("tcv_vertex_coords_title_row"))continue;const n=t[e].getElementsByTagName("td");for(var i=0;i<n.length;i++)n[i].textContent=""}}set subheader(t){this._setCellValue("tcv_measure_subheader",t)}get subheader(){return this._getCellValue("tcv_measure_subheader")}setProperties(t){this._hideAllRows();const e={vertex_coords:["x_value","y_value","z_value"],volume:"volume",area:"area",length:"length",width:"width",radius:"radius",geom_type:"geom_type"};for(const i in e){const n=e[i],s=t[i];if(null!=s){if(Array.isArray(n)){this.display._getElement("tcv_vertex_coords_title_row").style.display="table-row";for(let t=0;t<n.length;t++){this.display._getElement("tcv_"+n[t]).closest("tr").style.display="table-row",this._setCellValue("tcv_"+n[t],s[t])}}else{this.display._getElement("tcv_"+n).closest("tr").style.display="table-row"}this._setCellValue("tcv_"+n,s)}}}}class Ep extends bp{constructor(t){super(t)}_getHtml(){return this.display._getElement("tcv_angle_measurement_panel")}get angle(){return this._getCellValue("tcv_angle")}set angle(t){this._setCellValue("tcv_angle",t)}}class Tp{constructor(t){this.display=t,this.selectElement=t._getElement("tcv_shape_filter"),this.dropdownElement=t._getElement("tcv_filter_dropdown"),this.arrowElement=t._getElement("tcv_filter_icon"),this.options=["none","vertex","edge","face","solid"],this.selectElement.style.display="none",this.raycaster=null}setRaycaster(t){this.raycaster=t}_setValue=t=>{null!=this.raycaster&&(this.display._getElement("tcv_filter_value").innerText=t,this.raycaster.filters.topoFilter="none"==t?[mp.none]:[mp[t.toLowerCase()]])};_toggleDropdown=t=>{null!=t&&t.stopPropagation(),this.dropdownElement.classList.contains("tcv_filter_dropdown_active")?(this.dropdownElement.classList.remove("tcv_filter_dropdown_active"),this.arrowElement.innerText="⏶"):(this.dropdownElement.classList.add("tcv_filter_dropdown_active"),this.arrowElement.innerText="⏷")};_closeDropdown=t=>{this.dropdownElement.classList.contains("tcv_filter_dropdown_active")&&this._toggleDropdown(t)};handleSelection=t=>{const e=t.target.innerText;this._setValue(e),this._toggleDropdown(t)};reset=()=>{this._setValue("None")};_keybindSelect=t=>{-1!==["n","v","e","f","s","Escape"].indexOf(t.key)&&("n"==t.key?this._setValue("None"):"v"==t.key?this._setValue("Vertex"):"e"==t.key?this._setValue("Edge"):"f"==t.key?this._setValue("Face"):"s"==t.key?this._setValue("Solid"):"Escape"==t.key&&this._closeDropdown())};show(t){if(t){this.display.container.addEventListener("keydown",this._keybindSelect),this.display.container.addEventListener("click",this._closeDropdown);let t=this.display._getElement("tcv_filter_content");t.addEventListener("click",this._toggleDropdown);for(const e of this.options)t=this.display._getElement(`tvc_filter_${e}`),t.addEventListener("click",this.handleSelection)}else{this.display.container.removeEventListener("keydown",this._keybindSelect),this.display.container.removeEventListener("click",this._closeDropdown);let t=this.display._getElement("tcv_filter_content");t.removeEventListener("click",this._toggleDropdown);for(const e of this.options)t=this.display._getElement(`tvc_filter_${e}`),t.removeEventListener("click",this.handleSelection)}this.selectElement.style.display=t?"block":"none"}}class Ap extends lo{constructor(t,e,i,n,s,r=!0,a=!0){super(),this.coneLength=t,this.point1=e,this.point2=i,this.linewidth=n,this.color=s,this.arrowStart=r,this.arrowEnd=a,this.type="DistanceLineArrow",this.lineVec=void 0,this.initialize()}initialize(){const t=this.coneLength;let e,i;this.lineVec=this.point1.clone().sub(this.point2.clone()).normalize(),e=this.arrowStart?this.point1.clone().sub(this.lineVec.clone().multiplyScalar(t/2)):this.point1.clone(),i=this.arrowEnd?this.point2.clone().sub(this.lineVec.clone().multiplyScalar(-t/2)):this.point2.clone();const n=new $u({linewidth:this.linewidth,color:this.color}),s=new Ju;s.setPositions([...e.toArray(),...i.toArray()]);const r=new pp(s,n),a=new Mc(t/4,t,10),o=new bn({color:this.color}),l=new rs(a,o),c=new rs(a,o);l.name="startCone",c.name="endCone";const h=new Ci,d=new $e;h.lookAt(this.point1,this.point2,l.up),d.setFromRotationMatrix(h),l.setRotationFromQuaternion(d),h.lookAt(this.point2,this.point1,c.up),d.setFromRotationMatrix(h),c.setRotationFromQuaternion(d),l.rotateX(90*Math.PI/180),c.rotateX(90*Math.PI/180),l.position.copy(e),c.position.copy(i),this.arrowStart&&this.add(l),this.arrowEnd&&this.add(c),this.add(r)}update(t){const e=this.point1.clone().sub(this.lineVec.clone().multiplyScalar(t*this.coneLength/2)),i=this.point2.clone().sub(this.lineVec.clone().multiplyScalar(-t*this.coneLength/2));if(this.children.find((t=>"LineSegments2"==t.type)).geometry.setPositions([...e.toArray(),...i.toArray()]),this.arrowStart){const i=this.children.find((t=>"Mesh"==t.type&&"startCone"==t.name));i.position.copy(e),i.scale.set(t,t,t)}if(this.arrowEnd){const e=this.children.find((t=>"Mesh"==t.type&&"endCone"==t.name));e.position.copy(i),e.scale.set(t,t,t)}}}class Cp{constructor(t,e){this.selectedShapes=[],this.point1=null,this.point2=null,this.contextEnabled=!1,this.viewer=t,this.scene=new bo,this.panel=e,this.panelCenter=null,this.responseData=null,this.measurementLineColor=0,this.connectingLineColor=8388736,this.coneLength=void 0,this.panelDragData={x:null,y:null,clicked:!1},this.panel.registerCallback("mousedown",(t=>{this.panelDragData.clicked=!0,this.panelDragData.x=t.clientX,this.panelDragData.y=t.clientY,t.stopPropagation()})),document.addEventListener("mouseup",(t=>{this.panelDragData.clicked=!1,t.stopPropagation()})),document.addEventListener("mousemove",this._dragPanel)}enableContext(){this.contextEnabled=!0,this.panelCenter=new Ke(1,0,0)}disableContext(){this.contextEnabled=!1,this.selectedShapes=[],this._hideMeasurement(),this.viewer.checkChanges({selectedShapeIDs:[]})}_hideMeasurement(){this.responseData=null,this.panel.show(!1),this.scene.clear()}handleResponse(t){this.viewer.info.addHtml(t.center_info)}_setMeasurementVals(){throw new Error("Subclass needs to override this method")}_makeLines(){throw new Error("Subclass needs to override this method")}_getMaxObjSelected(){throw new Error("Subclass needs to override this method")}_waitResponse(t,e){this.responseData?t(this.responseData):setTimeout((()=>{this._waitResponse(t,e)}),100)}_updateMeasurement(){const t=this.selectedShapes.map((t=>{if(t.fromSolid){return t.obj.name.replace(/\|faces.*$/,"").replace(/\|edges.*$/,"").replace(/\|vertices.*$/,"").replaceAll("|","/")}return t.obj.name.replaceAll("|","/")}));if(this.viewer.checkChanges({selectedShapeIDs:[...t]}),this.selectedShapes.length==this._getMaxObjSelected()){new Promise(((t,e)=>{this._waitResponse(t,e)})).then((t=>{this._setMeasurementVals(),this._makeLines(),this.panel.show(!0),this._movePanel()}))}else this._hideMeasurement()}_computePanelCenter(){const t=this.viewer.camera.getCamera(),e=new Ke,i=new Ke,n=new Ke;t.getWorldDirection(e),e.multiplyScalar(-1),Math.abs(e.dot(t.up))>=.99?i.crossVectors(new Ke(1,0,0),e).normalize():i.crossVectors(t.up,e).normalize(),n.crossVectors(e,i).normalize();const s=this.viewer.bbox.boundingSphere().radius;this.panelCenter=this.viewer.bbox.boundingSphere().center.add(i.multiplyScalar(s))}handleSelection=t=>{this._hideMeasurement(),this.selectedShapes.length==this._getMaxObjSelected()&&this.removeLastSelectedObj(),void 0!==this.selectedShapes.find((e=>e.obj.name===t.obj.name))?this.selectedShapes.splice(this.selectedShapes.indexOf(t),1):this.selectedShapes.push(t),this._updateMeasurement()};_movePanel=()=>{var t=this.panelCenter.clone().project(this.viewer.camera.getCamera());t.x=Math.round((1+t.x)*this.viewer.renderer.domElement.offsetWidth/2),t.y=Math.round((1-t.y)*this.viewer.renderer.domElement.offsetHeight/2);const e=window.getComputedStyle(this.panel.html),i=t.x-parseFloat(e.width)/2,n=t.y-parseFloat(e.height)/2;this.panel.relocate(i,n)};_dragPanel=t=>{if(!this.panelDragData.clicked)return;const e=this.viewer.camera.getCamera();let i=t.clientX-this.panelDragData.x,n=t.clientY-this.panelDragData.y;const s=this.viewer.renderer.domElement.offsetWidth,r=this.viewer.renderer.domElement.offsetHeight,a=.5*s/document.documentElement.clientWidth,o=.5*r/document.documentElement.clientHeight;i/=document.documentElement.clientWidth,n/=document.documentElement.clientHeight,i/=a,n/=o;const l=this.panelCenter.clone().project(e),c=new Ke(i,-n,0);l.add(c),l.unproject(e),this.panelCenter=l,this.scene.clear(),this._updateMeasurement(),this.panelDragData.x=t.clientX,this.panelDragData.y=t.clientY};removeLastSelectedObj(){const t=this.selectedShapes.pop();if(t){let e=t.objs();for(let t of e)t.clearHighlights()}this._updateMeasurement()}_adjustArrowsScaleFactor(t){const e=1/t;for(let t of this.scene.children)t.update(e)}update(){const t=this.viewer.camera.getCamera(),e=this.viewer.camera.getZoom();this.coneLength=this.viewer.bb_radius/15,this._adjustArrowsScaleFactor(e),this.viewer.renderer.clearDepth(),this.viewer.renderer.render(this.scene,t),this._movePanel()}}class Lp extends Cp{constructor(t){super(t,new Mp(t.display)),this.point1=null,this.point2=null}_setMeasurementVals(){this._getPoints();const t=this.responseData.distance,e=this.point2.clone().sub(this.point1),i=Math.abs(e.x),n=Math.abs(e.y),s=Math.abs(e.z);this.panel.total=t.toFixed(2),this.panel.x_distance=i.toFixed(2),this.panel.y_distance=n.toFixed(2),this.panel.z_distance=s.toFixed(2)}_getMaxObjSelected(){return 2}_getPoints(){this.point1=new Ke(...this.responseData.point1),this.point2=new Ke(...this.responseData.point2)}_makeLines(){const t=.0025,e=new Ap(this.coneLength,this.point1,this.point2,.005,this.measurementLineColor);this.scene.add(e);const i=(new Ke).addVectors(this.point1,this.point2).multiplyScalar(.5),n=new Ap(this.coneLength,this.panelCenter,i,t,this.connectingLineColor,!1);this.scene.add(n)}handleResponse(t){super.handleResponse(t);const e={distance:t.distance,point1:new Ke(...t.point1),point2:new Ke(...t.point2)};this.responseData=e}}class kp extends Cp{constructor(t){super(t,new Sp(t.display))}_setMeasurementVals(){const t=this.selectedShapes[0].obj,e=t.name.match(/.*\|.*vertices/),i=t.name.match(/.*\|.*edges/),n=t.name.match(/.*\|.*faces/),s=this.selectedShapes[0].fromSolid?"Solid":e?"Vertex":i?"Edge":n?"Face":"Unknown";this.panel.subheader=s;const r=this.responseData;this.panel.setProperties(r)}_getMaxObjSelected(){return 1}_makeLines(){const t=this.responseData.center,e=new Ap(this.coneLength,this.panelCenter,t,.0025,this.connectingLineColor,!1);this.scene.add(e)}handleResponse(t){super.handleResponse(t);let e={...t};e.center=new Ke(...t.center),this.responseData=e}}class Rp extends Cp{constructor(t){super(t,new Ep(t.display))}_setMeasurementVals(){let t;t=this.responseData.angle.toFixed(2)+" °",this.panel.angle=t}enableContext(){super.enableContext(),this.viewer.raycaster.filters.geomFilter=[vp,gp,_p],this.viewer.info.addHtml("When in angle measurement<br>context you cannot pick :<br>- Non planar faces<br>- Curved edges<br>- Solids")}disableContext(){super.disableContext(),this.viewer.raycaster.filters.geomFilter=[fp]}_getMaxObjSelected(){return 2}_getPoints(){this.point1=new Ke(...this.responseData.point1),this.point2=new Ke(...this.responseData.point2)}_makeLines(){const t=.0025;this._getPoints();const e=new Ap(this.coneLength,this.point1,this.panelCenter,t,this.connectingLineColor,!0,!1),i=new Ap(this.coneLength,this.point2,this.panelCenter,t,this.connectingLineColor,!0,!1);this.scene.add(e),this.scene.add(i)}handleResponse(t){super.handleResponse(t);const e={angle:t.angle,point1:new Ke(...t.point1),point2:new Ke(...t.point2)};this.responseData=e}}const Pp="None",Ip="DistanceMeasurement",Np="PropertiesMeasurement",Up="AngleMeasurement";class Dp{constructor(t){this.viewer=t,this.distanceMeasurement=new Lp(t),this.propertiesMeasurement=new kp(t),this.angleMeasurement=new Rp(t),this.enabledTool=null}enable(t){switch(this.enabledTool&&(this.viewer.display.shapeFilterDropDownMenu.reset(),this._disable()),t){case Ip:this.distanceMeasurement.enableContext();break;case Np:this.propertiesMeasurement.enableContext();break;case Up:this.angleMeasurement.enableContext();break;default:throw new Error(`Unknown tool type: ${t}`)}this.enabledTool=t}_disable(){if(this.enabledTool){switch(this.enabledTool){case Ip:this.distanceMeasurement.disableContext();break;case Np:this.propertiesMeasurement.disableContext();break;case Up:this.angleMeasurement.disableContext();break;default:throw new Error(`Unknown tool type: ${this.enabledTool}`)}this.enabledTool=null}}handleRemoveLastSelection(){this.distanceMeasurement.contextEnabled?this.distanceMeasurement.removeLastSelectedObj():this.propertiesMeasurement.contextEnabled?this.propertiesMeasurement.removeLastSelectedObj():this.angleMeasurement.contextEnabled&&this.angleMeasurement.removeLastSelectedObj()}handleSelectedObj(t){this.distanceMeasurement.contextEnabled?this.distanceMeasurement.handleSelection(t):this.propertiesMeasurement.contextEnabled?this.propertiesMeasurement.handleSelection(t):this.angleMeasurement.contextEnabled&&this.angleMeasurement.handleSelection(t)}handleResetSelection(){this.distanceMeasurement.contextEnabled?(this.distanceMeasurement.removeLastSelectedObj(),this.distanceMeasurement.removeLastSelectedObj()):this.propertiesMeasurement.contextEnabled?this.propertiesMeasurement.removeLastSelectedObj():this.angleMeasurement.contextEnabled&&(this.angleMeasurement.removeLastSelectedObj(),this.angleMeasurement.removeLastSelectedObj())}handleResponse(t){console.log(t);switch(t.tool_type){case Ip:this.distanceMeasurement.handleResponse(t);break;case Np:this.propertiesMeasurement.handleResponse(t);break;case Up:this.angleMeasurement.handleResponse(t)}}update(){this.distanceMeasurement.contextEnabled?this.distanceMeasurement.update():this.propertiesMeasurement.contextEnabled?this.propertiesMeasurement.update():this.angleMeasurement.contextEnabled&&this.angleMeasurement.update()}}function Op(t){return`${t}px`}const Bp=["plane","play","pause","stop"];class Fp{constructor(t,e){this.container=t,this.container.innerHTML=function(t){const e=Gu.getshortcuts("shift"),i=Gu.getshortcuts("ctrl"),n=Gu.getshortcuts("meta");return'<div class="tcv_cad_viewer">\n <div class="tcv_cad_toolbar tcv_round">\n \x3c!-- \n <div class="tcv_grid-dropdown">\n <input class=\'tcv_grid tcv_check\' id=\'tcv_grid_{{id}}\' type="checkbox" />\n <label for=\'tcv_grid_{{id}}\' 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_{{id}}\' type="checkbox">\n <label for=\'tcv_grid-xy_{{id}}\' 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_{{id}}\' type="checkbox">\n <label for=\'tcv_grid-xz_{{id}}\' 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_{{id}}\' type="checkbox">\n <label for=\'tcv_grid-yz_{{id}}\' class="tcv_label tcv_dropdown-entry">yz</label>\n </div>\n </div>\n </div>\n\n <div class="tcv_more-dropdown">\n <button class="tcv_more-btn">More<span class="tcv_more_icon">\\u25BC</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_{{id}}\'\n type="checkbox" />\n <label for=\'tcv_transparent_{{id}}\' 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_{{id}}\'\n type="checkbox" />\n <label for=\'tcv_black_edges_{{id}}\' class="tcv_label tcv_dropdown-entry">Black edges</label>\n </span class="tcv_more_check">\n <span class="tcv_more_check" class="tcv_tools_widget tcv_tooltip" data-tooltip="Tools">\n <input class=\'tcv_tools tcv_check tcv_dropdown-entry\' id=\'tcv_tools_{{id}}\' type="checkbox" />\n <label for=\'tcv_tools_{{id}}\' class="tcv_label tcv_dropdown-entry">CAD Tools</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_{{id}}\' type="checkbox" />\n <label for=\'tcv_explode_{{id}}\' class="tcv_label tcv_dropdown-entry">Explode</label>\n </span class="tcv_more_check">\n </span>\n </div>\n --\x3e\n \x3c!-- <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> --\x3e\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 <input class=\'tcv_tab_material tcv_tab tcv_tab-right tcv_tab-unselected\' value="Material"\n type="button" />\n </div>\n <div class="tcv_cad_tree_toggles">\n <span class="tcv_tooltip" data-tooltip="Collpase nodes with a single leaf">\n <input class=\'tcv_collapse_singles tcv_btn tcv_small_btn\' value="1" type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Expand root node only">\n <input class=\'tcv_expand_root tcv_btn tcv_small_btn\' value="R" type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Collpase tree">\n <input class=\'tcv_collapse_all tcv_btn tcv_small_btn\' value="C" type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Expand tree">\n <input class=\'tcv_expand tcv_btn tcv_small_btn\' value="E" type="button" />\n </span>\n </div>\n <div class="tcv_box_content tcv_mac-scrollbar tcv_scroller">\n <div class="tcv_cad_tree_container"></div>\n <div class="tcv_cad_clip_container">\n <div class="tcv_slider_group">\n <div>\n <span class="tcv_tooltip" data-tooltip="Set red clipping plane to view direction">\n <input class=\'tcv_btn_norm_plane1 tcv_btn tcv_plane\' type="button" />\n </span>\n <span class="tcv_lbl_norm_plane1 tcv_label">N1 = (n/a, n/a, n/a)</span>\n </div>\n <div>\n <input type="range" min="1" max="100" value="50"\n class="tcv_sld_value_plane1 tcv_clip_slider">\n <input value=50 class="tcv_inp_value_plane1 tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_slider_group">\n <div>\n <span class="tooltip" data-tooltip="Set green clipping plane to view direction">\n <input class=\'tcv_btn_norm_plane2 tcv_btn tcv_plane\' type="button" />\n </span>\n <span class="tcv_lbl_norm_plane2 tcv_label">N2 = (n/a, n/a, n/a)</span>\n </div>\n <div>\n <input type="range" min="1" max="100" value="50"\n class="tcv_sld_value_plane2 tcv_clip_slider">\n <input value=50 class="tcv_inp_value_plane2 tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_slider_group">\n <div>\n <span class="tooltip" data-tooltip="Set blue clipping plane to view direction">\n <input class=\'tcv_btn_norm_plane3 tcv_btn tcv_plane\' type="button" />\n </span>\n <span class="tcv_lbl_norm_plane3 tcv_label">N3 = (n/a, n/a, n/a)</span>\n </div>\n <div>\n <input type="range" min="1" max="100" value="50"\n class="tcv_sld_value_plane3 tcv_clip_slider">\n <input value=50 class="tcv_inp_value_plane3 tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_clip_checks">\n <div>\n <span class="tcv_tooltip" data-tooltip="Use intersection clipping">\n <input class=\'tcv_clip_intersection tcv_check\' type="checkbox" />\n <span class="tcv_label">Intersection</span>\n </span>\n <span class="tcv_tooltip" data-tooltip="Show clipping planes">\n <input class=\'tcv_clip_plane_helpers tcv_axes0 tcv_check\' type="checkbox" />\n <span class="tcv_label">Planes</span>\n </span>\n </div>\n <span class="tcv_tooltip" data-tooltip="Use object color caps instead of RGB">\n <input class=\'tcv_clip_caps tcv_axes0 tcv_check\' type="checkbox" />\n <span class="tcv_label">Use object color caps</span>\n </span>\n </div>\n </div>\n <div class="tcv_cad_material_container">\n <div class="tcv_cad_tree_toggles">\n <span class="tcv_tooltip" data-tooltip="Reset to original values">\n <input class=\'tcv_material_reset tcv_btn tcv_small_btn\' value="R" type="button" />\n </span>\n </div>\n <div class="tcv_material_ambientlight tcv_label">\n Ambient light intensity (%)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="20" value="1"\n class="tcv_sld_value_ambientlight tcv_clip_slider">\n <input value=1 class="tcv_inp_value_ambientlight tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_pointlight tcv_label">\n Directional light intensity (%)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="40" value="1"\n class="tcv_sld_value_pointlight tcv_clip_slider">\n <input value=1 class="tcv_inp_value_pointlight tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_metalness tcv_label">\n Metalness (%)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="100" value="40"\n class="tcv_sld_value_metalness tcv_clip_slider">\n <input value=40 class="tcv_inp_value_metalness tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_roughness tcv_label">\n Roughness (%)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="100" value="40"\n class="tcv_sld_value_roughness tcv_clip_slider">\n <input value=40 class="tcv_inp_value_roughness tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_info">\n This is not a full material renderer (e.g. the environment is black), so\n not every combination creates expected or good results.\n </div>\n </div>\n </div>\n </div>\n <div class="tcv_cad_info_wrapper">\n <div class="tcv_toggle_info_wrapper">\n <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_distance_measurement_panel tcv_panel tcv_round">\n <div class="tcv_measure_header">Distance</div>\n <table class="tcv_properties_table">\n <tr class="tcv_measure_row_line">\n <td class="tcv_measure_cell tcv_measure_cell_header">Total</td>\n <td class="tcv_measure_cell tcv_measure_val tcv_total">total</td>\n </tr>\n <tr class="tcv_measure_row_line">\n <td class="tcv_measure_cell tcv_measure_cell_header tcv_xtitle">X</td>\n <td class="tcv_measure_cell tcv_measure_val tcv_x">x</td>\n </tr>\n <tr class="tcv_measure_row_line">\n <td class="tcv_measure_cell tcv_measure_cell_header tcv_ytitle">Y</td>\n <td class="tcv_measure_cell tcv_measure_val tcv_y">y</td>\n </tr>\n <tr>\n <td class="tcv_measure_cell tcv_measure_cell_header tcv_bottom_cell_left tcv_ztitle">Z</td>\n <td class="tcv_measure_cell tcv_measure_val bottom_cell_right tcv_z">z</td>\n </tr>\n </table>\n </div>\n\n <div class="tcv_properties_measurement_panel tcv_panel tcv_round">\n <div class="tcv_measure_header">Properties</div>\n <div class="tcv_measure_subheader">Shape</div>\n <table class="tcv_properties_table">\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Volume</th>\n <td class="tcv_props_cell tcv_measure_val tcv_volume" colspan="3">volume</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Area</th>\n <td class="tcv_props_cell tcv_measure_val tcv_area" colspan="3">area</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Length</th>\n <td class="tcv_props_cell tcv_measure_val tcv_length" colspan="3">length</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Width</th>\n <td class="tcv_props_cell tcv_measure_val tcv_width" colspan="3">w</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Geom</th>\n <td class="tcv_props_cell tcv_measure_val tcv_geom_type" colspan="3">g</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Radius</th>\n <td class="tcv_props_cell tcv_measure_val tcv_radius" colspan="3">r</td>\n </tr>\n <tr class="tcv_properties_row_line vertex_row tcv_vertex_coords_title_row">\n <td class="tcv_vertex_cell tcv_xtitle" colspan="2">X</td>\n <td class="tcv_vertex_cell tcv_ytitle" colspan="2">Y</td>\n <td class="tcv_vertex_cell tcv_ztitle" colspan="2">Z</td>\n </tr>\n <tr class="tcv_properties_row_line vertex_row tcv_vertex_coords_row">\n <td class="tcv_vertex_cell tcv_x_value" colspan="2">X</td>\n <td class="tcv_vertex_cell tcv_y_value" colspan="2">Y</td>\n <td class="tcv_vertex_cell tcv_z_value" colspan="2">Z</td>\n </tr>\n </table>\n </div>\n\n <div class="tcv_angle_measurement_panel tcv_panel tcv_round">\n <div class="tcv_measure_header">Angle</div>\n <table class="tcv_properties_table">\n <tr class="tcv_properties_row_line">\n <td class="tcv_angle tcv_measure_val">angle</td>\n </tr>\n </table>\n </div>\n\n <div class="tcv_cad_animation tcv_round">\n <span class="tcv_animation_label">E</span>\n <span><input type="range" min="0" max="1000" value="0"\n class="tcv_animation_slider tcv_clip_slider"></span>\n <span class="tcv_tooltip" data-tooltip="Play animation"><input class=\'tcv_play tcv_btn\'\n type="button" /></span>\n <span class="tcv_tooltip" data-tooltip="Pause animation"><input class=\'tcv_pause tcv_btn\'\n type="button" /></span>\n <span class="tcv_tooltip" data-tooltip="Stop and reset animation"><input class=\'tcv_stop tcv_btn\'\n type="button" /></span>\n </div>\n\n <div class="tcv_cad_help tcv_round">\n <table class="tcv_cad_help_layout">\n <tr>\n <td></td>\n <td><b>Mouse Navigation</b></td>\n </tr>\n <tr>\n <td>Rotate</td>\n <td><left mouse button></td>\n </tr>\n <tr>\n <td>Rotate up / down</td>\n <td><{{ctrl}}> + <left mouse button></td>\n </tr>\n <tr>\n <td>Rotate left / right</td>\n <td><{{meta}}> + <left mouse button></td>\n </tr>\n <tr>\n <td>Pan</td>\n <td><{{shift}}> + <left mouse button> or <right mouse button></td>\n </tr>\n <tr>\n <td>Zoom</td>\n <td><mouse wheel> or <middle mouse button></td>\n </tr>\n\n <tr>\n <td></td>\n <td><b>Mouse Selection</b></td>\n </tr>\n <tr>\n <td>Pick element</td>\n <td><left mouse button> double click</td>\n </tr>\n <tr>\n <td></td>\n <td>Click on navigation tree label</td>\n </tr>\n <tr>\n <td></td>\n <td>(Shows axis-aligned bounding box, AABB)</td>\n </tr>\n <tr>\n <td>Hide element</td>\n <td><{{meta}}> + <left mouse button> double click</td>\n </tr>\n <tr>\n <td></td>\n <td><{{meta}}> + click on navigation tree label</td>\n </tr>\n <tr>\n <td>Isolate element</td>\n <td><{{shift}}> + <left mouse button> double click</td>\n </tr>\n <tr>\n <td></td>\n <td><{{shift}}> + click on navigation tree label</td>\n </tr>\n <tr>\n <td></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 class="tcv_filter_menu">\n <div class="tcv_drop_down tcv_shape_filter">\n <span class="tcv_round tcv_filter_content"><span class="tcv_filter_value">None</span>\n <span class="tcv_filter_icon">⏶\n </span></span>\n <div class="tcv_filter_dropdown tcv_round">\n <div class="tcv_filter_dropdown_value tvc_filter_none">None</div>\n <div class="tcv_filter_dropdown_value tvc_filter_vertex">Vertex</div>\n <div class="tcv_filter_dropdown_value tvc_filter_edge">Edge</div>\n <div class="tcv_filter_dropdown_value tvc_filter_face">Face</div>\n <div class="tcv_filter_dropdown_value tvc_filter_solid">Solid</div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>'.replaceAll("{{id}}",t).replaceAll("{{shift}}",e).replaceAll("{{ctrl}}",i).replaceAll("{{meta}}",n)}(this.container.id),this.cadBody=this._getElement("tcv_cad_body"),this.cadTool=new Wu(this._getElement("tcv_cad_toolbar"),t.id),this.cadView=this._getElement("tcv_cad_view"),this.distanceMeasurementPanel=this._getElement("tcv_distance_measurement_panel"),this.propertiesMeasurementPanel=this._getElement("tcv_properties_measurement_panel"),this.angleMeasurementPanel=this._getElement("tcv_angle_measurement_panel"),this.cadTree=this._getElement("tcv_cad_tree_container"),this.cadTreeToggles=this._getElement("tcv_cad_tree_toggles"),this.cadClip=this._getElement("tcv_cad_clip_container"),this.cadMaterial=this._getElement("tcv_cad_material_container"),this.tabTree=this._getElement("tcv_tab_tree"),this.tabClip=this._getElement("tcv_tab_clip"),this.tabMaterial=this._getElement("tcv_tab_material"),this.cadInfo=this._getElement("tcv_cad_info_container"),this.cadAnim=this._getElement("tcv_cad_animation"),this.cadTools=this._getElement("tcv_cad_tools"),this.cadHelp=this._getElement("tcv_cad_help"),this.planeLabels=[];for(var i=1;i<4;i++)this.planeLabels.push(this._getElement(`tcv_lbl_norm_plane${i}`));var n;for(var s of(this.viewer=null,this.glass=e.glass,this.tools=e.tools,this.cadWidth=e.cadWidth,this.height=e.height,this.treeWidth=e.treeWidth,this._events=[],this.setSizes(e),this.activeTab="tree",this.cadTree.style.display="block",this.cadClip.style.display="none",this.cadMaterial.style.display="none",this.clipSliders=null,this.explodeFlag=!1,this.lastPlaneState=!1,"dark"===e.theme||"browser"==e.theme&&window.matchMedia("(prefers-color-scheme: dark)").matches?(document.documentElement.setAttribute("data-theme","dark"),n="dark"):(document.documentElement.setAttribute("data-theme","light"),n="light"),Bp)){var r=this.container.getElementsByClassName(`tcv_${s}`);for(i=0;i<r.length;i++){r[i].setAttribute("style",`background-image: ${Ou(n,s)}`)}}this.toolbarButtons={},this.toolbarButtons.axes=new Xu(n,"axes","Show axes",this.setAxes),this.cadTool.addButton(this.toolbarButtons.axes),this.toolbarButtons.axes0=new Xu(n,"axes0","Show axes at origin (0,0,0)",this.setAxes0),this.cadTool.addButton(this.toolbarButtons.axes0),this.toolbarButtons.grid=new Xu(n,"grid","Show grid",this.setGrid,null,["xy","xz","yz"]),this.cadTool.addButton(this.toolbarButtons.grid),this.cadTool.addSeparator(),this.toolbarButtons.perspective=new Xu(n,"perspective","Use perspective camera",this.setOrtho),this.cadTool.addButton(this.toolbarButtons.perspective),this.toolbarButtons.transparent=new Xu(n,"transparent","Show transparent faces",this.setTransparent),this.cadTool.addButton(this.toolbarButtons.transparent),this.toolbarButtons.blackedges=new Xu(n,"blackedges","Show black edges",this.setBlackEdges),this.cadTool.addButton(this.toolbarButtons.blackedges),this.cadTool.addSeparator(),this.toolbarButtons.reset=new qu(n,"reset","Reset view",this.reset),this.cadTool.addButton(this.toolbarButtons.reset),this.toolbarButtons.resize=new qu(n,"resize","Resize object",this.resize),this.cadTool.addButton(this.toolbarButtons.resize),this.cadTool.addSeparator(),this.toolbarButtons.iso=new qu(n,"iso","Switch to iso view",this.setView),this.cadTool.addButton(this.toolbarButtons.iso),this.toolbarButtons.front=new qu(n,"front","Switch to front view",this.setView),this.cadTool.addButton(this.toolbarButtons.front),this.toolbarButtons.rear=new qu(n,"rear","Switch to back view",this.setView),this.cadTool.addButton(this.toolbarButtons.rear),this.toolbarButtons.top=new qu(n,"top","Switch to top view",this.setView),this.cadTool.addButton(this.toolbarButtons.top),this.toolbarButtons.bottom=new qu(n,"bottom","Switch to bottom view",this.setView),this.cadTool.addButton(this.toolbarButtons.bottom),this.toolbarButtons.left=new qu(n,"left","Switch to left view",this.setView),this.cadTool.addButton(this.toolbarButtons.left),this.toolbarButtons.right=new qu(n,"right","Switch to right view",this.setView),this.cadTool.addButton(this.toolbarButtons.right),this.cadTool.addSeparator(),this.toolbarButtons.explode=new Xu(n,"explode","Explode tool",this.setExplode),this.cadTool.addButton(this.toolbarButtons.explode),this.toolbarButtons.distance=new Xu(n,"distance","Measure distance between shapes",this.setTool),this.cadTool.addButton(this.toolbarButtons.distance),this.toolbarButtons.properties=new Xu(n,"properties","Show shape properties",this.setTool),this.cadTool.addButton(this.toolbarButtons.properties),this.toolbarButtons.angle=new Xu(n,"angle","Measure angle between shapes",this.setTool),this.cadTool.addButton(this.toolbarButtons.angle),this.cadTool.defineGroup([this.toolbarButtons.explode,this.toolbarButtons.distance,this.toolbarButtons.properties,this.toolbarButtons.angle]),this.toolbarButtons.help=new qu(n,"help","Help",this.toggleHelp),this.toolbarButtons.help.alignRight(),this.cadTool.addButton(this.toolbarButtons.help),this.toolbarButtons.pin=new qu(n,"pin","Pin viewer as png",this.pinAsPng),this.toolbarButtons.pin.alignRight(),this.cadTool.addButton(this.toolbarButtons.pin),this.shapeFilterDropDownMenu=new Tp(this),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){}setSizes(t,e=2/3){if(t.cadWidth&&(this.cadWidth=t.cadWidth,this.cadView.style.width=Op(t.cadWidth)),t.height&&(this.height=t.height,this.cadView.style.height=Op(t.height)),t.treeWidth&&(this.treeWidth=t.treeWidth,this.cadTree.parentElement.parentElement.style.width=Op(t.treeWidth),this.cadInfo.parentElement.parentElement.style.width=Op(t.treeWidth)),!t.glass){const i=Math.round(t.height*e);this.cadTree.parentElement.parentElement.style.height=Op(i),this.cadInfo.parentElement.parentElement.style.height=Op(t.height-i-4)}t.tools&&!t.glass?(this.cadTool.container.style.width=Op(t.treeWidth+t.cadWidth+4),this.cadBody.style.width=Op(t.treeWidth+t.cadWidth+4)):(this.cadTool.container.style.width=Op(t.cadWidth+2),this.cadBody.style.width=Op(t.cadWidth+2)),this.cadBody.style.height=Op(t.height+4)}setupUI(t){this.viewer=t,this._setupClickEvent("tcv_expand_root",this.handleCollapseNodes),this._setupClickEvent("tcv_collapse_singles",this.handleCollapseNodes),this._setupClickEvent("tcv_collapse_all",this.handleCollapseNodes),this._setupClickEvent("tcv_expand",this.handleCollapseNodes),this._setupClickEvent("tcv_material_reset",this.handleMaterialReset),this._setupClickEvent("tcv_toggle_info",this.toggleInfo),this.help_shown=!0,this.info_shown=!this.glass;["tcv_tab_tree","tcv_tab_clip","tcv_tab_material"].forEach((t=>{this._setupClickEvent(t,this.selectTab)})),this.clipSliders=[];for(var e=1;e<4;e++)this.clipSliders.push(new Vu(`plane${e}`,0,100,this));for(this.ambientlightSlider=new Vu("ambientlight",0,400,this),this.directionallightSlider=new Vu("pointlight",0,400,this),this.metalnessSlider=new Vu("metalness",0,100,this),this.roughnessSlider=new Vu("roughness",0,100,this),this._setupCheckEvent("tcv_clip_plane_helpers",this.setClipPlaneHelpers,!1),this._setupCheckEvent("tcv_clip_intersection",this.setClipIntersection,!1),this._setupCheckEvent("tcv_clip_caps",this.setObjectColorCaps,!1),e=1;e<4;e++)this._setupClickEvent(`tcv_btn_norm_plane${e}`,this.setClipNormalFromPosition,!1);this._setupClickEvent("tcv_play",this.controlAnimation,!1),this._setupClickEvent("tcv_pause",this.controlAnimation,!1),this._setupClickEvent("tcv_stop",this.controlAnimation,!1),this.animationSlider=this.container.getElementsByClassName("tcv_animation_slider")[0],this.animationSlider.value=0,this.animationSlider.addEventListener("input",this.animationChange),this.showAnimationControl(!1),this.showHelp(!1),this.showDistancePanel(!1),this.showPropertiesPanel(!1),this.showAnglePanel(!1)}updateUI(t,e,i,n,s,r,a){this.toolbarButtons.axes.set(t),this.toolbarButtons.axes0.set(e),this.toolbarButtons.perspective.set(!i),this.toolbarButtons.transparent.set(n),this.toolbarButtons.blackedges.set(s),this.showTools(r),this.glassMode(a)}checkElement(t,e){this._getElement(t).checked=e}addCadView(t){this.cadView.appendChild(t)}clearCadTree(){this.cadTree.innerHTML=""}addCadTree(t){this.cadTree.appendChild(t)}setAxes=(t,e)=>{this.viewer.setAxes(e)};setAxesCheck=t=>{this.toolbarButtons.axes.set(t)};setGrid=(t,e)=>{this.viewer.setGrid(t,e)};setGridCheck=t=>{this.checkElement("tcv_grid",t)};setAxes0=(t,e)=>{this.viewer.setAxes0(e)};setAxes0Check=t=>{this.toolbarButtons.axes0.set(t)};setOrtho=(t,e)=>{this.viewer.switchCamera(!e)};setOrthoCheck=t=>{this.toolbarButtons.perspective.set(!t)};setTransparent=(t,e)=>{this.viewer.setTransparent(e)};setTransparentCheck=t=>{this.toolbarButtons.transparent.set(t)};setBlackEdges=(t,e)=>{this.viewer.setBlackEdges(e)};setBlackEdgesCheck=t=>{this.toolbarButtons.blackedges.set(t)};setExplode=(t,e)=>{e&&this.explodeFlag||(e||this.explodeFlag)&&(e?(this.viewer.hasAnimation()&&this.viewer.backupAnimation(),this.viewer.explode(),this.explodeFlag=!0):(this.viewer.hasAnimation()&&(this.controlAnimationByName("stop"),this.viewer.clearAnimation(),this.viewer.restoreAnimation()),this.explodeFlag=!1))};setExplodeCheck=t=>{this.toolbarButtons.explode.set(t)};showExplode=t=>{this._getElement("tcv_explode_widget").style.display=t?"inline-block":"none"};setTool=(t,e)=>{this.viewer.toggleAnimationLoop(e),this.viewer.setPickHandler(!e),this.viewer.setRaycastMode(e),e?(this.viewer.hasAnimation()&&this.viewer.backupAnimation(),this.shapeFilterDropDownMenu.setRaycaster(this.viewer.raycaster),"distance"==t?(this.viewer.cadTools.enable(Ip),this.viewer.checkChanges({activeTool:Ip})):"properties"==t?(this.viewer.cadTools.enable(Np),this.viewer.checkChanges({activeTool:Np})):"angle"==t&&(this.viewer.cadTools.enable(Up),this.viewer.checkChanges({activeTool:Up}))):(this.viewer.checkChanges({activeTool:Pp}),this.viewer.clearSelection(),this.viewer.hasAnimation()&&(this.controlAnimationByName("stop"),this.viewer.clearAnimation(),this.viewer.restoreAnimation())),this.shapeFilterDropDownMenu.show(e)};setClipPlaneHelpers=t=>{const e=!!t.target.checked;this.setClipPlaneHelpersCheck(e),this.viewer.setClipPlaneHelpers(e)};setClipPlaneHelpersCheck=t=>{this.checkElement("tcv_clip_plane_helpers",t),this.lastPlaneState=t};showTools=t=>{this.tools=t,this.viewer&&(this.viewer.tools=t);var e=this._getElement("tcv_cad_toolbar"),i=this._getElement("tcv_cad_navigation");for(var n of[i,e])t?(n.style.height="38px",n.style.display="block"):(n.style.height="0px",n.style.display="none")};showMeasureTools=t=>{this.toolbarButtons.distance.show(t),this.toolbarButtons.properties.show(t),this.toolbarButtons.angle.show(t)};setClipIntersection=t=>{const e=!!t.target.checked;this.viewer.setClipIntersection(e)};setClipIntersectionCheck=t=>{this._getElement("tcv_clip_intersection").checked=t};setObjectColorCaps=t=>{const e=!!t.target.checked;this.viewer.setClipObjectColorCaps(e)};setClipObjectColorsCheck=t=>{this._getElement("tcv_clip_caps").checked=t};reset=()=>{this.viewer.reset(),this.clearHighlights()};resize=()=>{this.viewer.resize()};clearHighlights(){["front","rear","top","bottom","left","right","iso"].forEach((t=>{this.toolbarButtons[t].highlight(!1)}))}highlightButton(t){this.clearHighlights(),this.toolbarButtons[t].highlight(!0),this.viewer.keepHighlight=!0}setView=t=>{this.viewer.presetCamera(t),this.highlightButton(t),this.viewer.update(!0,!1)};showPinning(t){this.toolbarButtons.pin.show(t)}pinAsPng=t=>{this.viewer.pinAsPng()};setNormalLabel=(t,e)=>{this.planeLabels[t].innerHTML=`N=(${e[0].toFixed(2)}, ${e[1].toFixed(2)}, ${e[2].toFixed(2)})`};setClipNormalFromPosition=t=>{const e=parseInt(t.target.classList[0].slice(-1));this.viewer.setClipNormalFromPosition(e-1)};selectTab=t=>{const e=t.target.className.split(" ")[0];this.selectTabByName(e.slice(8))};setAmbientLight=t=>{this.ambientlightSlider.setValue(100*t)};setDirectLight=t=>{this.directionallightSlider.setValue(100*t)};setMetalness=t=>{this.metalnessSlider.setValue(100*t)};setRoughness=t=>{this.roughnessSlider.setValue(100*t)};handleMaterialReset=t=>{this.viewer.resetMaterial()};selectTabByName(t){if(["clip","tree","material"].includes(t)){if("tree"===t&&"tree"!==this.activeTab){this.cadTree.style.display="block",this.cadTreeToggles.style.display="block",this.cadClip.style.display="none",this.cadMaterial.style.display="none",this.viewer.nestedGroup.setBackVisible(!1),this.viewer.setLocalClipping(!1),this.viewer.clipping.setVisible(!1);var e=this.viewer.getClipPlaneHelpers();this.viewer.setClipPlaneHelpers(!1),this.lastPlaneState=e}else"clip"===t&&"clip"!==this.activeTab?(this.cadTree.style.display="none",this.cadTreeToggles.style.display="none",this.cadClip.style.display="block",this.cadMaterial.style.display="none",this.viewer.nestedGroup.setBackVisible(!0),this.viewer.setLocalClipping(!0),this.viewer.setClipIntersection(this.viewer.clipIntersection),this.viewer.setClipPlaneHelpers(this.lastPlaneState),this.viewer.clipping.setVisible(!0),this.viewer.update(!0,!1)):"material"===t&&"material"!==this.activeTab&&(this.cadTree.style.display="none",this.cadTreeToggles.style.display="none",this.cadClip.style.display="none",this.cadMaterial.style.display="block",this.viewer.nestedGroup.setBackVisible(!1),this.viewer.setLocalClipping(!1),this.viewer.setClipPlaneHelpers(!1),this.viewer.clipping.setVisible(!1));this.activeTab=t,this.viewer.checkChanges({tab:t}),"tree"==t?(this.tabTree.classList.add("tcv_tab-selected"),this.tabTree.classList.remove("tcv_tab-unselected"),this.tabClip.classList.remove("tcv_tab-selected"),this.tabClip.classList.add("tcv_tab-unselected"),this.tabMaterial.classList.remove("tcv_tab-selected"),this.tabMaterial.classList.add("tcv_tab-unselected")):"clip"==t?(this.tabTree.classList.remove("tcv_tab-selected"),this.tabTree.classList.add("tcv_tab-unselected"),this.tabClip.classList.add("tcv_tab-selected"),this.tabClip.classList.remove("tcv_tab-unselected"),this.tabMaterial.classList.remove("tcv_tab-selected"),this.tabMaterial.classList.add("tcv_tab-unselected")):(this.tabTree.classList.add("tcv_tab-unselected"),this.tabTree.classList.remove("tcv_tab-selected"),this.tabClip.classList.add("tcv_tab-unselected"),this.tabClip.classList.remove("tcv_tab-selected"),this.tabMaterial.classList.add("tcv_tab-selected"),this.tabMaterial.classList.remove("tcv_tab-unselected"))}}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,t?this.container.addEventListener("keydown",(t=>{"Escape"===t.key&&this.showHelp(!1),this.container.removeEventListener("keydown",this)})):this.container.removeEventListener("keydown",this)};showDistancePanel=t=>{this.distanceMeasurementPanel.style.display=t?"block":"none"};showPropertiesPanel=t=>{this.propertiesMeasurementPanel.style.display=t?"block":"none"};showAnglePanel=t=>{this.angleMeasurementPanel.style.display=t?"block":"none"};toggleHelp=()=>{this.showHelp(!this.help_shown)};showInfo=t=>{this.cadInfo.parentNode.parentNode.style.display=t?"block":"none",this._getElement("tcv_toggle_info").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"]=Op(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=Op(Math.round(2*this.height/3)),this._getElement("tcv_cad_info").classList.remove("tcv_cad_info_glass"),this._getElement("tcv_cad_view").classList.remove("tcv_cad_view_glass"),this._getElement("tcv_toggle_info_wrapper").style.display="none",this.showInfo(!0),this.glass=!1),this.viewer&&(this.viewer.glass=!1);const e={cadWidth:this.cadWidth,glass:this.glass,height:this.height,tools:this.tools,treeWidth:t?0:this.treeWidth};this.setSizes(e)}updateHelp(t,e){console.log("updateHelp",t,e);const i=this._getElement("tcv_cad_help_layout");for(var n in t)i.innerHTML=i.innerHTML.replaceAll("<"+t[n].slice(0,-3)+">","<_"+e[n].slice(0,-3)+">");i.innerHTML=i.innerHTML.replaceAll("_shift","shift"),i.innerHTML=i.innerHTML.replaceAll("_ctrl","ctrl"),i.innerHTML=i.innerHTML.replaceAll("_alt","alt"),i.innerHTML=i.innerHTML.replaceAll("_meta","meta")}}class zp extends Ju{toJSON(){return Ed.prototype.toJSON.call(this)}}const Hp=new Ke,Gp=new Ke,Vp=new Me;class Wp extends Hl{constructor(t,e=1,i=16711680){const n=new Hn,s=t.geometry.attributes.normal.count,r=new In(2*s*3,3);n.setAttribute("position",r),super(n,new Pl({color:i,toneMapped:!1})),this.object=t,this.size=e,this.type="VertexNormalsHelper",this.matrixAutoUpdate=!1,this.update()}update(){this.object.updateMatrixWorld(!0),Vp.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++)Hp.fromBufferAttribute(n,i).applyMatrix4(t),Gp.fromBufferAttribute(s,i),Gp.applyMatrix3(Vp).normalize().multiplyScalar(this.size).add(Hp),e.setXYZ(r,Hp.x,Hp.y,Hp.z),r+=1,e.setXYZ(r,Gp.x,Gp.y,Gp.z),r+=1}e.needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}class jp extends ei{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(),Zp.copy(n.boundingBox),this.union(Zp)}else{const e=i.attributes.position;for(let i=0,n=e.count;i<n;i++)Xp.fromBufferAttribute(e,i).applyMatrix4(t.matrixWorld),this.expandByPoint(Xp)}else null===i.boundingBox&&i.computeBoundingBox(),Zp.copy(i.boundingBox),Zp.applyMatrix4(t.matrixWorld),this.union(Zp);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(Jp),Jp}center(){return this.getCenter(Xp),Xp.toArray()}}class qp extends Hl{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 Hn;s.setIndex(new kn(i,1)),s.setAttribute("position",new kn(n,3)),super(s,new Pl({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(void 0!==this.object&&Yp.setFromObject(this.object,!0),Yp.isEmpty())return;const t=Yp.min,e=Yp.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 Xp=new Ke,Zp=new jp,Yp=new jp,Jp=new yi;class $p extends lo{constructor(t,e,i,n,s,r){super(),this.opacity=t,this.alpha=null==e?1:e,this.edge_color=i,this.shapeInfo=n,this.subtype=s,this.renderback=r,this.types={front:null,back:null,edges:null,vertices:null},this.isSelected=!1,this.originalColor=null,this.originalWidth=null,this.vertexFocusSize=8,this.edgeFocusWidth=5}addType(t,e){this.add(t),this.types[e]=t,this.types.vertices?(this.originalColor=this.types.vertices.material.color.clone(),this.originalWidth=this.types.vertices.material.size):this.types.edges&&!this.types.front?(this.originalColor=this.types.edges.material.color.clone(),this.originalWidth=this.types.edges.material.linewidth):this.types.front&&(this.originalColor=this.types.front.material.color.clone())}widen(t){this.types.vertices?this.types.vertices.material.size=t?this.vertexFocusSize:this.isSelected?this.vertexFocusSize-2:this.originalWidth:this.types.edges&&(this.types.edges.material.linewidth=t?this.edgeFocusWidth:this.isSelected?this.edgeFocusWidth-2:this.originalWidth)}toggleSelection(){const t=!this.isSelected;this.isSelected=t,this.highlight(t),this.widen(!1)}unhighlight(t){t&&this.isSelected||(this.isSelected=!1,this.highlight(!1)),this.widen(!1)}highlight(t){var e=null,i=null,n=null;this.types.front?(e=this.types.front,i=this.isSelected?new _n(5480675):new _n(9026019),n=this.originalColor):this.types.vertices?(e=this.types.vertices,i=this.isSelected?new _n(5480675):new _n(9026019),n=this.originalColor):this.types.edges&&(e=this.types.edges,i=this.isSelected?new _n(5480675):new _n(9026019),n=this.originalColor),null!=e&&(this.widen(t),e.material.color=t?i:n,e.material.needsUpdate=!0)}clearHighlights(){this.highlight(!1),this.isSelected=!1,this.widen(!1)}metrics(){return this.types.front?{name:"face",value:0}:this.types.vertices?{name:"vertex",value:0}:this.types.edges?{name:"edge",value:0}:void 0}setMetalness(t){for(var e of this.children)e.name.startsWith("clipping")||(e.material.metalness=t,e.material.needsUpdate=!0)}setRoughness(t){for(var e of this.children)e.name.startsWith("clipping")||(e.material.roughness=t,e.material.needsUpdate=!0)}setTransparent(t){for(var e of(this.types.back&&(this.types.back.material.opacity=t?this.opacity*this.alpha:this.alpha,this.types.front.material.opacity=t?this.opacity*this.alpha:this.alpha),this.children))e.name.startsWith("clipping")||(e.material.depthWrite=!(this.alpha<1)&&!t,e.material.depthTest=!0,e.material.needsUpdate=!0)}setBlackEdges(t){if(this.types.edges){const e=t?0:this.edge_color;this.originalColor=new _n(e),this.types.edges.material.color=new _n(e),this.types.edges.material.needsUpdate=!0}}setEdgeColor(t){this.types.edges&&(this.edge_color=t,this.types.edges.material.color=new _n(t),this.types.edges.material.needsUpdate=!0)}setOpacity(t){(this.types.front||this.types.back)&&(this.opacity=t,this.types.back.material.opacity=this.opacity,this.types.front.material.opacity=this.opacity,this.types.back.material.needsUpdate=!0,this.types.front.material.needsUpdate=!0)}setShapeVisible(t){for(var e of(this.types.front&&(this.types.front.material.visible=t),["clipping-0","clipping-1","clipping-2"]))this.types[e]&&(this.types[e].children[0].material.visible=t,this.types[e].children[1].material.visible=t);this.types.back&&this.renderback&&(this.types.back.material.visible=t)}setEdgesVisible(t){this.types.edges&&(this.types.edges.material.visible=t),this.types.vertices&&(this.types.vertices.material.visible=t)}setBackVisible(t){this.types.back&&this.types.front.material.visible&&(this.types.back.material.visible=this.renderback||t)}setClipIntersection(t){for(var e of this.children)e.name.startsWith("clipping")||(e.material.clipIntersection=t,e.material.clipIntersection=t,e.material.clipIntersection=t)}setClipPlanes(t){this.types.back&&(this.types.back.material.clippingPlanes=t),this.types.front&&(this.types.front.material.clippingPlanes=t),this.types.edges&&(this.types.edges.material.clippingPlanes=t),this.types.vertices&&(this.types.vertices.material.clippingPlanes=t),this.updateMaterials(!0)}setPolygonOffset(t){this.types.back&&(this.types.back.material.polygonOffsetUnits=t)}updateMaterials(t){this.types.back&&(this.types.back.material.needsUpdate=t),this.types.front&&(this.types.front.material.needsUpdate=t),this.types.edges&&(this.types.edges.material.needsUpdate=t),this.types.vertices&&(this.types.vertices.material.needsUpdate=t)}}class Kp{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 zp;r.setPositions(s);const a=new $u({linewidth:e,transparent:!0,depthWrite:!this.transparent,depthTest:!this.transparent,clipIntersection:!1});if(Array.isArray(i)){var o=i.map((t=>[new _n(t).toArray(),new _n(t).toArray()])).flat(2);r.setColors(o),a.vertexColors="VertexColors"}else a.color=new _n(null==i?this.edgeColor:i);a.visible=1==n,a.resolution.set(this.width,this.height);var l=new pp(r,a);return l.renderOrder=999,l}renderEdges(t,e,i,n,s,r,a=null){var o=new $p(this.defaultOpacity,1,null==i?this.edgeColor:i,a,"edges"),l=this._renderEdges(t.edges?t.edges:t,e,i,r);return s&&(l.name=s),o.addType(l,"edges"),n=n+this.delim+s,this.groups[n.replaceAll(this.delim,"/")]=o,o.name=n,o}renderVertices(t,e,i,n,s,r,a=null){var o=new $p(this.defaultOpacity,1,null==i?this.edgeColor:i,a,"vertices");const l=null==i?this.edgeColor:i;let c;c=t.obj_vertices?t.obj_vertices instanceof Float32Array?t.obj_vertices:new Float32Array(t.obj_vertices):t instanceof Float32Array?t.flat():new Float32Array(t.flat());const h=new Hn;h.setAttribute("position",new In(c,3));const d=new Vl({color:l,sizeAttenuation:!1,size:e,transparent:!0,clipIntersection:!1,visible:1==r});var u=new Zl(h,d);return s&&(u.name=s),o.addType(u,"vertices"),n=n+this.delim+s,this.groups[n.replaceAll(this.delim,"/")]=o,o.name=n,o}renderShape(t,e,i,n,s,r,a,c=null,h=null,d=null,u=null,p=null){const m=t.vertices instanceof Float32Array?t.vertices:new Float32Array(t.vertices.flat()),f=t.normals instanceof Float32Array?t.normals:new Float32Array(t.normals.flat()),g=t.triangles instanceof Uint32Array?t.triangles:new Uint32Array(t.triangles.flat());var v,_=new $p(this.defaultOpacity,i,this.edgeColor,c,h,n);s=s+this.delim+r,this.groups[s.replaceAll(this.delim,"/")]=_,_.name=s,null==i?i=1:i<1&&(this.transparent=!0);var y=null,x=null;if(null!=d){const t=`data:image/${d.format};base64,${d.data}`;var w=new Image;w.setAttribute("src",t),v=new Rs(u,p),(y=new je(w)).needsUpdate=!0,y.colorSpace=Wt,x=new bn({color:"#ffffff",map:y,side:2}),n=!1}else(v=new Hn).setAttribute("position",new kn(m,3)),v.setAttribute("normal",new kn(f,3)),v.setIndex(new kn(g,1)),_.shapeGeometry=v,x=new bh({color:e,metalness:this.metalness,roughness:this.roughness,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,transparent:!0,opacity:this.transparent?this.defaultOpacity*i:i,depthWrite:!this.transparent,depthTest:!0,clipIntersection:!1,side:o,visible:1==a[0],map:y,name:"frontMaterial"});const b="solid"===_.subtype?e:new _n(this.edgeColor).lerp(new _n(1,1,1),.15),M=new bn({color:b,side:l,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,transparent:!0,opacity:this.transparent?this.defaultOpacity*i:i,depthWrite:!this.transparent,depthTest:!0,clipIntersection:!1,visible:1==a[0]&&(n||this.backVisible),name:"backMaterial"}),S=new rs(v,M);S.name=r;const E=new rs(v,x);if(E.name=r,i<1&&(S.renderOrder=999,E.renderOrder=999),_.addType(S,"back"),_.addType(E,"front"),this.normalLen>0){const t=new Wp(E,this.normalLen,16711935);_.add(t)}const T=t.edges;if(T.length>0){var A=this._renderEdges(T,1,null,a[1]);A.name=r,_.addType(A,"edges")}return _}renderLoop(t,e,i){const n=(t,n,s,r)=>{var a;switch(t.type){case"edges":a=this.renderEdges(t.shape,t.width,t.color,e,t.name,i[t.id][1],{topo:"edge",geomtype:t.geomtype});break;case"vertices":a=this.renderVertices(t.shape,t.size,t.color,e,t.name,i[t.id][1],{topo:"vertex",geomtype:null});break;default:a=this.renderShape(t.shape,t.color,t.alpha,null!=t.renderback&&t.renderback,e,t.name,i[t.id],{topo:"face",geomtype:t.geomtype},t.subtype,n,s,r)}return null!=t.loc&&(a.position.set(...t.loc[0]),a.quaternion.set(...t.loc[1])),a};var s=new lo;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=null!=r.texture;const e=n(r,t?r.texture.image:null,t?r.texture.width:null,t?r.texture.height:null);this.groups[r.id]=e,s.add(e)}return s}render(t){return this.rootGroup=this.renderLoop(this.shapes,"",t),this.rootGroup}boundingBox(){return null==this.bbox&&(this.bbox=new jp,this.bbox.setFromObject(this.rootGroup,!0)),this.bbox}_traverse(t,e){for(var i in this.groups){var n=this.groups[i];n instanceof $p&&n[t](e)}}selection(){var t=[];for(var e in this.groups)for(var i of this.groups[e].children)i instanceof $p&&i.isSelected&&t.push(i);return t}clearSelection(){for(var t of this.selection())t.clearHighlights()}setMetalness(t){this.metalness=t,this._traverse("setMetalness",t)}setRoughness(t){this.roughness=t,this._traverse("setRoughness",t)}setTransparent(t){this.transparent=t,this._traverse("setTransparent",t)}setBlackEdges(t){this.blackEdges=t,this._traverse("setBlackEdges",t)}setBackVisible(t){this.backVisible=t,this._traverse("setBackVisible",t)}setEdgeColor(t){this.edge_color=t,this._traverse("setEdgeColor",t)}setOpacity(t){this.opacity=t,this._traverse("setOpacity",t)}setClipIntersection(t){this._traverse("setClipIntersection",t)}setClipPlanes(t){this.clipPlanes=t,this._traverse("setClipPlanes",t)}setPolygonOffset(t){this._traverse("setPolygonOffset",t)}updateMaterials(){this._traverse("updateMaterials",!0)}}class Qp{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=tm(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 tm(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 Nu;let o,l,c,h,d,u,p,m;if(r.o){const t=r._cachedOutline||(r._cachedOutline=r.o.split(" "));for(let s=0,r=t.length;s<r;){switch(t[s++]){case"m":o=t[s++]*e+i,l=t[s++]*e+n,a.moveTo(o,l);break;case"l":o=t[s++]*e+i,l=t[s++]*e+n,a.lineTo(o,l);break;case"q":c=t[s++]*e+i,h=t[s++]*e+n,d=t[s++]*e+i,u=t[s++]*e+n,a.quadraticCurveTo(d,u,c,h);break;case"b":c=t[s++]*e+i,h=t[s++]*e+n,d=t[s++]*e+i,u=t[s++]*e+n,p=t[s++]*e+i,m=t[s++]*e+n,a.bezierCurveTo(d,u,p,m,c,h)}}}return{offsetX:r.ha*e,path:a}}const em={glyphs:{X:{x_min:-.015625,x_max:854.15625,ha:940,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},Y:{x_min:0,x_max:820,ha:886,o:"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},Z:{x_min:0,x_max:779,ha:849,o:"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},0:{x_min:73,x_max:715,ha:792,o:"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},1:{x_min:215.671875,x_max:574,ha:792,o:"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},2:{x_min:59,x_max:731,ha:792,o:"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},3:{x_min:54,x_max:737,ha:792,o:"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},4:{x_min:48,x_max:742.453125,ha:792,o:"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},5:{x_min:54.171875,x_max:738,ha:792,o:"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},6:{x_min:53,x_max:739,ha:792,o:"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},7:{x_min:58.71875,x_max:730.953125,ha:792,o:"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},8:{x_min:55,x_max:736,ha:792,o:"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},9:{x_min:53,x_max:739,ha:792,o:"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},"-":{x_min:8.71875,x_max:350.390625,ha:478,o:"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "}},cssFontWeight:"normal",ascender:1189,underlinePosition:-100,cssFontStyle:"normal",boundingBox:{yMin:-334,xMin:-111,yMax:1189,xMax:1672},resolution:1e3,original_font_information:"see https://github.com/mrdoob/three.js/blob/dev/examples/fonts/helvetiker_regular.typeface.json",descender:-334,familyName:"Helvetiker",lineHeight:1522,underlineThickness:50};class im{constructor(t,e,i,n,s,r,a,o){void 0===i&&(i=10),this.display=t,this.bbox=e,this.centerGrid=n,this.grid=r,this.allGrid=r[0]|r[1]|r[2];const l=new Ke;e.getSize(l);const c=Math.max(l.x,l.y,l.z);this.gridHelper=[];var[h,d,u]=this.niceBounds(1.05*-c,1.05*c,2*i);this.size=d-h;const p=new Qp(em);this.ticks=u;for(var m=0;m<3;m++){var f=new lo;f.name=`GridHelper-${m}`,f.add(new Mu(this.size,this.size/this.ticks,"dark"===o?13421772:7829367,"dark"==o?10066329:12303291));const t=new Pl({color:"dark"===o?new _n(.5,.5,.5):new _n(.4,.4,.4),side:2});for(var g,v,_=-this.size/2;_<=this.size/2;_+=this.ticks){v=this.createNumber(_,p),0==m?(v.rotateX(-Math.PI/2),v.rotateY(Math.PI/2)):(v.rotateX(Math.PI/2),v.rotateY(-Math.PI/2));const e=new rs(v,t);if(g=1==m?-1:1,e.position.set(g*_,0,0),f.add(e),Math.abs(_)<1e-6)continue;v=this.createNumber(_,p),0==m?v.rotateX(-Math.PI/2):1==m?(v.rotateX(-Math.PI/2),v.rotateZ(Math.PI)):v.rotateX(Math.PI/2);const i=new rs(v,t);g=0==m?-1:1,i.position.set(0,0,g*_),f.add(i)}this.gridHelper.push(f)}this.gridHelper[0].rotateX(Math.PI/2),this.gridHelper[1].rotateY(Math.PI/2),this.gridHelper[2].rotateZ(Math.PI/2),this.setCenter(s,a),this.setVisible()}createNumber(t,e){const i=(.035-7.1)/-637.8*(this.size-640)+7.1,n=e.generateShapes(t.toFixed(1),i);var s=new dh(n);s.computeBoundingBox();var r=-.5*(s.boundingBox.max.x-s.boundingBox.min.x),a=-.5*(s.boundingBox.max.y-s.boundingBox.min.y);return s.translate(r,a,0),s}niceNumber(t,e){var i=Math.floor(Math.log10(t)),n=t/10**i;return(e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10)*10**i}niceBounds(t,e,i){var n,s;i||(i=10);var r=e-t;return 0==r?n=0:(s=this.niceNumber(r),n=this.niceNumber(s/(i-1),!0),t=Math.floor(t/n)*n,e=Math.ceil(e/n)*n),[t,e,n]}computeGrid(){this.allGrid=this.grid[0]|this.grid[1]|this.grid[2],this.display.toolbarButtons.grid.set(this.allGrid),this.display.checkElement("tcv_grid-xy",this.grid[0]),this.display.checkElement("tcv_grid-xz",this.grid[1]),this.display.checkElement("tcv_grid-yz",this.grid[2]),this.setVisible()}setGrid(t,e=null){switch(t){case"grid":this.allGrid=null==e?!this.allGrid:e,this.grid[0]=this.allGrid,this.grid[1]=this.allGrid,this.grid[2]=this.allGrid;break;case"grid-xy":this.grid[0]=!this.grid[0];break;case"grid-xz":this.grid[1]=!this.grid[1];break;case"grid-yz":this.grid[2]=!this.grid[2]}this.computeGrid()}setGrids(t,e,i){this.grid[0]=t,this.grid[1]=e,this.grid[2]=i,this.computeGrid()}setCenter(t,e){if(t){for(var i=0;i<3;i++)this.gridHelper[i].position.set(0,0,0);this.gridHelper[0].position.z=this.centerGrid?0:-this.size/2,this.gridHelper[1].position.y=this.centerGrid?0:(e?1:-1)*this.size/2,this.gridHelper[2].position.x=this.centerGrid?0:-this.size/2}else{const t=this.bbox.center();for(i=0;i<3;i++)this.gridHelper[i].position.set(...t);this.gridHelper[0].position.z=this.centerGrid?t[2]:-this.size/2+t[2],this.gridHelper[1].position.y=this.centerGrid?t[1]:(e?1:-1)*this.size/2+t[1],this.gridHelper[2].position.x=this.centerGrid?t[0]:-this.size/2+t[0]}}setVisible(){for(var t=0;t<3;t++)this.gridHelper[t].visible=this.grid[t]}}class nm extends pp{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 zp;h.setPositions(l),h.setColors(new Float32Array(c));const d=new $u({vertexColors:!0,toneMapped:!1,linewidth:i,transparent:!0});d.resolution.set(n,s),super(h,d),this.center=t,this.type="AxesHelper",this.name="AxesHelper",this.visible=a,this.setCenter(r)}dispose(){this.geometry.dispose(),this.material.dispose()}setCenter(t){t?this.position.set(0,0,0):this.position.set(...this.center)}setVisible(t){this.visible=t}}class sm{constructor(t,e,i,n){this.width=t,this.height=e,this.cad_camera=i,this.theme=n,this.camera=null,this.scene=null,this.renderer=null,this.labels=[],this.ready=!1}create(){const t=new Qp(em),e=2.5;this.scene=new bo,this.camera=new Ws(-this.width,this.width,this.height,-this.height,1,1e3),this.camera.up=this.cad_camera.up,this.camera.lookAt(new Ke(0,0,0));const i=new nm([0,0,0],54,e,this.width,this.height,!0,!0,this.theme);this.scene.add(i);const n="dark"===this.theme?[[1,69/255,0],[50/255,205/255,50/255],[59/255,158/255,1]]:[[1,0,0],[0,.5,0],[0,0,1]];this.cones=[];for(var s=0;s<3;s++){var r=new bc(0,6.25,12.5,20,1);const t=new bn({color:new _n(...n[s]),toneMapped:!1}),e=new rs(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 Pl({color:"dark"===this.theme?new _n(.9,.9,.9):new _n(0,0,0),side:2}),i=t.generateShapes(a[s],16),n=new dh(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 rs(n,e);this.scene.add(l),this.labels.push(l)}const o=new uh(7.5,20,20),l=new bn({color:10526880}),c=new rs(o,l);this.scene.add(c),this.scene.background=null,this.ready=!0}dispose(){zu(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){if(this.ready){let n=(new $e).setFromUnitVectors(new Ke(0,0,1),t.normalize());this.camera.position.set(0,0,1).applyQuaternion(n).multiplyScalar(300),this.camera.quaternion.copy(e);for(var i=0;i<3;i++)this.labels[i].position.set(0==i?72:0,1==i?72:0,2==i?72:0),this.labels[i].quaternion.copy(e)}}}function rm(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 am=0,om=1,lm=2,cm=3;class hm{constructor(t,e,i,n,s,r){this.states=t,this.tree=e,this.objectHandler=i,this.pickHandler=n,this.theme=s,this.newTreeBehavior=r,this.lastSelection=null,this.setupIcons(s),this.treeModel=this.toModel(e)}setupIcons(t){var e={};e[am]=Ou(t,"shape_no"),e[om]=Ou(t,"shape"),e[lm]=Ou(t,"shape_mix"),e[cm]=Ou(t,"shape_empty");var i={};i[am]=Ou(t,"mesh_no"),i[om]=Ou(t,"mesh"),i[lm]=Ou(t,"mesh_mix"),i[cm]=Ou(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(om);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=rm("li",[`node${t.id.replaceAll(" ","_")}`]),s=rm("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,Gu.get(e,"meta"),Gu.get(e,"shift"),t.type,!0)}),!1);var r=rm("span",["tcv_node_entry"],{id:t.id});if("node"===t.type){var a=rm("span",["tcv_node_entry_wrap"]);for(i in a.appendChild(rm("span",["tcv_t-caret","tcv_t-caret-down"])),this.icons)(e=rm("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=rm("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=rm("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]!=cm&&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=rm("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]!=cm&&(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:lm),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(2===t||n!==this.tree&&(3===t||1==t&&1===n.children.length&&"leaf"===n.children[0].type)){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]==om?am:om:n?om:am,"leaf"==t?(this.updateState(r,i,s),this.updateNodes(this.treeModel,i),this.newTreeBehavior&&0==i&&(this.updateState(r,1,s),this.updateNodes(this.treeModel,1)),this.objectHandler(this.states)):"node"==t?(this.propagateChange(r,i,s),this.updateNodes(this.treeModel,i),this.newTreeBehavior&&0==i&&(this.objectHandler(this.states),this.propagateChange(r,1,s),this.updateNodes(this.treeModel,1)),this.objectHandler(this.states)):console.error(`Error, unknown type '${t}'`)}}class dm{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`)}}}const um=[new Ke(-1,0,0),new Ke(0,-1,0),new Ke(0,0,-1)],pm={light:[16711680,65280,255],dark:[16729344,3329330,3907327]},mm=new bn({opacity:.1,transparent:!0,depthWrite:!1,toneMapped:!1,side:2}),fm=new bn({depthWrite:!1,depthTest:!1,colorWrite:!1,side:l,stencilWrite:!0,stencilFunc:ie,stencilFail:te,stencilZFail:te,stencilZPass:te}),gm=new bn({depthWrite:!1,depthTest:!1,colorWrite:!1,side:o,stencilWrite:!0,stencilFunc:ie,stencilFail:ee,stencilZFail:ee,stencilZPass:ee}),vm=new bh({metalness:.3,roughness:.65,opacity:1,transparent:!1,side:2,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,stencilWrite:!0,stencilRef:0,stencilFunc:517,stencilFail:Qt,stencilZFail:Qt,stencilZPass:Qt});class _m extends Es{constructor(t,e,i){super(t,e),this.center=i,this.setConstant(e)}setConstant(t){this.centeredConstant=t;const e=this.distanceToPoint(new Ke(...this.center)),i=this.distanceToPoint(new Ke(0,0,0));this.constant=i-e+t}}class ym extends rs{static matrix=new Ci;constructor(t,e,i,n,s,r,a){const o=new Rs(2,2);o.computeBoundingSphere(),s.color.set(new _n(r)),super(o,s),this.type=a,this.index=t,this.plane=e,this.size=n,this.center=i}dispose=()=>{this.geometry.dispose(),this.material.dispose();for(var t=0;t<this.children.length;t++)this.children[t].geometry.dispose(),this.children[t].material.dispose()};onAfterRender=t=>{this.type.startsWith("StencilPlane")&&t.clearStencil()};updateMatrixWorld(t){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),ym.matrix.lookAt(this.position,this.plane.normal,this.up),this.quaternion.setFromRotationMatrix(ym.matrix),this.translateZ(this.plane.constant),super.updateMatrixWorld(this,t)}}function xm(t,e,i,n){e.clippingPlanes=[n];var s=new rs(i,e);return s.name=t,s}class wm{constructor(t,e,i,n,s){var r;for(this.center=t,this.distance=e/2,this.display=n,this.theme=s,this.nestedGroup=i,this.clipPlanes=[],this.reverseClipPlanes=[],this.planeHelpers=new lo,this.planeHelpers.name="PlaneHelpers",this.planeHelperMaterials=[],this.objectColors=[],this.objectColorCaps=!1,r=0;r<3;r++){const i=new _m(um[r],this.distance,t);this.clipPlanes.push(i);const n=new _m(um[r].clone().negate(),-this.distance,t);this.reverseClipPlanes.push(n),this.display.setNormalLabel(r,um[r].toArray());const a=mm.clone();a.opacity="dark"===s?.2:.1,this.planeHelperMaterials.push(a),this.planeHelpers.add(new ym(r,i,t,e,a,pm[s][r],"PlaneHelper"))}for(this.planeHelpers.visible=!1,r=0;r<3;r++){const t=this.clipPlanes.filter(((t,e)=>e!==r));this.planeHelpers.children[r].material.clippingPlanes=t}var a=new lo;for(a.name="PlaneMeshes",r=0;r<3;r++){const n=this.clipPlanes[r],u=this.clipPlanes.filter(((t,e)=>e!==r));var o=0;for(var l in i.groups){var c=new lo;c.name=`clipping-${r}`;var h=i.groups[l];if(h instanceof $p&&"solid"===h.subtype){this.objectColors.push(h.children[0].material.color.getHex()),c.add(xm(`frontStencil-${r}-${o}`,gm.clone(),h.shapeGeometry,n)),c.add(xm(`backStencil-${r}-${o}`,fm.clone(),h.shapeGeometry,n)),h.addType(c,`clipping-${r}`);var d=vm.clone();d.color.set(new _n(pm[s][r])),d.clippingPlanes=u,a.add(new ym(r,n,t,e,d,pm[s][r],`StencilPlane-${r}-${o}`)),o++}}}i.rootGroup.add(a)}setConstant(t,e){this.clipPlanes[t].setConstant(e),this.reverseClipPlanes[t].setConstant(-e)}setNormal=(t,e)=>{var i=e.clone();this.clipPlanes[t].normal=i,this.reverseClipPlanes[t].normal=i.clone().negate(),this.setConstant(t,this.distance),this.display.setNormalLabel(t,i.toArray())};getObjectColorCaps=()=>this.objectColorCaps;setObjectColorCaps=t=>{var e;for(e of this.nestedGroup.rootGroup.children)if("PlaneMeshes"===e.name)break;var i=0,n=-1;const s=Object.keys(e.children).length/3;for(var r of e.children)i%s==0&&n++,t?r.material.color.set(new _n(this.objectColors[i])):r.material.color.set(new _n(pm[this.theme][n])),i++;this.objectColorCaps=t};setVisible=t=>{var e;for(e of this.nestedGroup.rootGroup.children)if("PlaneMeshes"===e.name)break;for(var i of e.children)i.material.visible=t}}const bm=["t","tx","ty","tz","q","rx","ry","rz"];class Mm{constructor(t){this.delim=t,this.tracks=[],this.mixer=null,this.clip=null,this.clipAction=null,this.clock=new Ud,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!==bm.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 Ke(...t)).toArray()));break;case"tx":r=s.map((t=>a.add(new Ke(t,0,0)).toArray()));break;case"ty":r=s.map((t=>a.add(new Ke(0,t,0)).toArray()));break;case"tz":r=s.map((t=>a.add(new Ke(0,0,t)).toArray()));break;default:return void console.error(`action ${i} is not supported`)}this.tracks.push(new Xh(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 Ke(1,0,0);break;case"y":t=new Ke(0,1,0);break;case"z":t=new Ke(0,0,1)}var i=new $e;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 jh(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 ${bm}`)}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 Zh("track",e,this.tracks),this.mixer=new iu(t),this.mixer.timeScale=i,this.clipAction=this.mixer.clipAction(this.clip),this.clipAction.setLoop(n?It:Nt),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 Sm{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 Ke;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 Em=function(t,e){void 0===e&&console.warn('THREE.CameraControls: The second parameter "domElement" is now mandatory.'),e===document&&console.error('THREE.CameraControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=t,this.domElement=e,this.enabled=!0,this.target=new Ke,this.trackball=!1,this.holroyd=!0,this.radius=.9,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:i.ROTATE,MIDDLE:i.DOLLY,RIGHT:i.PAN},this.touches={ONE:n.ROTATE,TWO:n.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.quaternion0=this.object.quaternion.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return p.phi},this.getAzimuthalAngle=function(){return p.theta},this.saveState=function(){a.target0.copy(a.target),a.position0.copy(a.object.position),a.quaternion0.copy(a.object.quaternion),a.zoom0=a.object.zoom},this.reset=function(){a.target.copy(a.target0),a.object.position.copy(a.position0),a.object.quaternion.copy(a.quaternion0),a.object.zoom=a.zoom0,a.object.updateProjectionMatrix(),a.dispatchEvent(o),a.update(),d=h.NONE},this.update=function(){var e=new Ke,i=(new $e).setFromUnitVectors(t.up,new Ke(0,1,0)),n=i.clone().invert(),s=new Ke,r=new $e,l=new $e,c=new Ke;const _=new Ke;return function(){var t,y=a.object.position;if(e.copy(y).sub(a.target),a.trackball&&!a.holroyd)m.theta&&(c.set(0,1,0).applyQuaternion(a.object.quaternion),t=a.enableDamping?a.dampingFactor:1,l.setFromAxisAngle(c,m.theta*t),a.object.quaternion.premultiply(l),e.applyQuaternion(l)),m.phi&&(c.set(1,0,0).applyQuaternion(a.object.quaternion),t=a.enableDamping?a.dampingFactor:1,l.setFromAxisAngle(c,m.phi*t),a.object.quaternion.premultiply(l),e.applyQuaternion(l)),e.multiplyScalar(f),e.clampLength(a.minDistance,a.maxDistance);else if(a.trackball&&a.holroyd){_.crossVectors(w,b);var x=Math.atan(_.length()/w.dot(b));x&&(_.normalize(),_.applyQuaternion(a.object.quaternion),x*=-2*(t=a.enableDamping?a.dampingFactor:1),l.setFromAxisAngle(_,x),a.object.quaternion.premultiply(l),e.applyQuaternion(l)),e.multiplyScalar(f),e.clampLength(a.minDistance,a.maxDistance),w.set(0,0,0),b.set(0,0,0)}else e.applyQuaternion(i),a.autoRotate&&d===h.NONE&&P(2*Math.PI/60/60*a.autoRotateSpeed),p.setFromVector3(e),a.enableDamping?(p.theta+=m.theta*a.dampingFactor,p.phi+=m.phi*a.dampingFactor):(p.theta+=m.theta,p.phi+=m.phi),p.theta=Math.max(a.minAzimuthAngle,Math.min(a.maxAzimuthAngle,p.theta)),p.phi=Math.max(a.minPolarAngle,Math.min(a.maxPolarAngle,p.phi)),p.makeSafe(),p.radius*=f,p.radius=Math.max(a.minDistance,Math.min(a.maxDistance,p.radius)),e.setFromSpherical(p),e.applyQuaternion(n);return!0===a.enableDamping?a.target.addScaledVector(g,a.dampingFactor):a.target.add(g),y.copy(a.target).add(e),!1===a.trackball&&a.object.lookAt(a.target),!0===a.enableDamping?(m.theta*=1-a.dampingFactor,m.phi*=1-a.dampingFactor,g.multiplyScalar(1-a.dampingFactor)):(m.set(0,0,0),g.set(0,0,0)),f=1,!!(v||s.distanceToSquared(a.object.position)>u||8*(1-r.dot(a.object.quaternion))>u)&&(a.dispatchEvent(o),s.copy(a.object.position),r.copy(a.object.quaternion),v=!1,!0)}}();const s={x:new Ke(1,0,0),y:new Ke(0,1,0),z:new Ke(0,0,1)};function r(t,e){if(a.trackball){const i=s[t],n=(new $e).setFromAxisAngle(i,e);a.object.quaternion.premultiply(n),a.object.position.sub(a.target).applyQuaternion(n).add(a.target)}else console.log("not supported for orbit controls")}this.rotateX=function(t){r("x",t)},this.rotateY=function(t){r("y",t)},this.rotateZ=function(t){r("z",t)},this.rotateLeft=function(t){this.trackball?console.log("not supported for trackball controls"):P(t)},this.rotateUp=function(t){this.trackball?console.log("not supported for trackball controls"):I(t)},this.dispose=function(){a.domElement.removeEventListener("contextmenu",st,!1),a.domElement.removeEventListener("mousedown",J,!1),a.domElement.removeEventListener("wheel",Q,!1),a.domElement.removeEventListener("touchstart",et,!1),a.domElement.removeEventListener("touchend",nt,!1),a.domElement.removeEventListener("touchmove",it,!1),document.removeEventListener("mousemove",$,!1),document.removeEventListener("mouseup",K,!1),a.domElement.removeEventListener("keydown",tt,!1)};var a=this,o={type:"change"},l={type:"start"},c={type:"end"},h={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},d=h.NONE,u=1e-6,p=new hu,m=new hu,f=1,g=new Ke,v=!1,_=new be,y=new be,x=new be,w=new Ke,b=new Ke,M=new be,S=new be,E=new be,T=new be,A=new be,C=new be,L=!0,k=!0;function R(){return Math.pow(.95,a.zoomSpeed)}function P(t){L&&(m.theta-=t)}function I(t){k&&(m.phi-=t)}var N,U,D=(N=new Ke,function(t,e){N.setFromMatrixColumn(e,0),N.multiplyScalar(-t),g.add(N)}),O=function(){var t=new Ke;return function(e,i){!0===a.screenSpacePanning?t.setFromMatrixColumn(i,1):(t.setFromMatrixColumn(i,0),t.crossVectors(a.object.up,t)),t.multiplyScalar(e),g.add(t)}}(),B=(U=new Ke,function(t,e){var i=a.domElement;if(a.object.isPerspectiveCamera){var n=a.object.position;U.copy(n).sub(a.target);var s=U.length();s*=Math.tan(a.object.fov/2*Math.PI/180),D(2*t*s/i.clientHeight,a.object.matrix),O(2*e*s/i.clientHeight,a.object.matrix)}else a.object.isOrthographicCamera?(D(t*(a.object.right-a.object.left)/a.object.zoom/i.clientWidth,a.object.matrix),O(e*(a.object.top-a.object.bottom)/a.object.zoom/i.clientHeight,a.object.matrix)):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - pan disabled."),a.enablePan=!1)});function F(t){a.object.isPerspectiveCamera?f/=t:a.object.isOrthographicCamera?(a.object.zoom=Math.max(a.minZoom,Math.min(a.maxZoom,a.object.zoom*t)),a.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - dolly/zoom disabled."),a.enableZoom=!1)}function z(t){a.object.isPerspectiveCamera?f*=t:a.object.isOrthographicCamera?(a.object.zoom=Math.max(a.minZoom,Math.min(a.maxZoom,a.object.zoom/t)),a.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - dolly/zoom disabled."),a.enableZoom=!1)}const H=function(){const t=new Ke,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 G(t){_.set(t.clientX,t.clientY)}function V(t){M.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)M.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);M.set(e,i)}}function q(t){var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY,n=Math.sqrt(e*e+i*i);T.set(0,n)}function X(t){if(1==t.touches.length)y.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);y.set(e,i)}if(a.trackball&&a.holroyd)w=H(_).clone(),b=H(y).clone();else{x.subVectors(y,_).multiplyScalar(a.rotateSpeed);var n=a.domElement;P(2*Math.PI*x.x/n.clientHeight),I(2*Math.PI*x.y/n.clientHeight)}_.copy(y)}function Z(t){if(1==t.touches.length)S.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);S.set(e,i)}E.subVectors(S,M).multiplyScalar(a.panSpeed),B(E.x,E.y),M.copy(S)}function Y(t){var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY,n=Math.sqrt(e*e+i*i);A.set(0,n),C.set(0,Math.pow(A.y/T.y,a.zoomSpeed)),F(C.y),T.copy(A)}function J(t){if(!1!==a.enabled){var e;switch(t.preventDefault(),t.stopPropagation(),a.domElement.focus?a.domElement.focus():window.focus(),t.button){case 0:e=a.mouseButtons.LEFT;break;case 1:e=a.mouseButtons.MIDDLE;break;case 2:e=a.mouseButtons.RIGHT;break;default:e=-1}switch(e){case i.DOLLY:if(!1===a.enableZoom)return;!function(t){T.set(t.clientX,t.clientY)}(t),d=h.DOLLY;break;case i.ROTATE:if(Gu.get(t,"shift")){if(!1===a.enablePan)return;V(t),d=h.PAN}else{if(!1===a.enableRotate)return;Gu.get(t,"ctrl")&&(L=!1),Gu.get(t,"meta")&&(k=!1),G(t),d=h.ROTATE}break;case i.PAN:if(Gu.get(t,"ctrl")||Gu.get(t,"meta")||Gu.get(t,"shift")){if(!1===a.enableRotate)return;G(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",$,!1),document.addEventListener("mouseup",K,!1),a.dispatchEvent(l))}}function $(t){if(!1!==a.enabled)switch(t.preventDefault(),t.stopPropagation(),d){case h.ROTATE:if(!1===a.enableRotate)return;!function(t){if(y.set(t.clientX,t.clientY),a.trackball&&a.holroyd)w=H(_).clone(),b=H(y).clone();else{var e=a.domElement;x.subVectors(y,_).multiplyScalar(a.rotateSpeed),P(2*Math.PI*x.x/e.clientHeight),I(2*Math.PI*x.y/e.clientHeight)}_.copy(y),a.update()}(t);break;case h.DOLLY:if(!1===a.enableZoom)return;!function(t){A.set(t.clientX,t.clientY),C.subVectors(A,T),C.y>0?F(R()):C.y<0&&z(R()),T.copy(A),a.update()}(t);break;case h.PAN:if(!1===a.enablePan)return;!function(t){S.set(t.clientX,t.clientY),E.subVectors(S,M).multiplyScalar(a.panSpeed),B(E.x,E.y),M.copy(S),a.update()}(t)}}function K(t){!1!==a.enabled&&(document.removeEventListener("mousemove",$,!1),document.removeEventListener("mouseup",K,!1),L=!0,k=!0,a.dispatchEvent(c),d=h.NONE)}function Q(t){!1===a.enabled||!1===a.enableZoom||d!==h.NONE&&d!==h.ROTATE||(t.preventDefault(),t.stopPropagation(),a.dispatchEvent(l),function(t){t.deltaY<0?z(R()):t.deltaY>0&&F(R()),a.update()}(t),a.dispatchEvent(c))}function tt(t){!1!==a.enabled&&!1!==a.enableKeys&&!1!==a.enablePan&&function(t){var e=!1;switch(t.keyCode){case a.keys.UP:B(0,a.keyPanSpeed),e=!0;break;case a.keys.BOTTOM:B(0,-a.keyPanSpeed),e=!0;break;case a.keys.LEFT:B(a.keyPanSpeed,0),e=!0;break;case a.keys.RIGHT:B(-a.keyPanSpeed,0),e=!0}e&&(t.preventDefault(),a.update())}(t)}function et(t){if(!1!==a.enabled){switch(t.preventDefault(),t.touches.length){case 1:switch(a.touches.ONE){case n.ROTATE:if(!1===a.enableRotate)return;W(t),d=h.TOUCH_ROTATE;break;case n.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 n.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 n.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;X(t),a.update();break;case h.TOUCH_PAN:if(!1===a.enablePan)return;Z(t),a.update();break;case h.TOUCH_DOLLY_PAN:if(!1===a.enableZoom&&!1===a.enablePan)return;!function(t){a.enableZoom&&Y(t),a.enablePan&&Z(t)}(t),a.update();break;case h.TOUCH_DOLLY_ROTATE:if(!1===a.enableZoom&&!1===a.enableRotate)return;!function(t){a.enableZoom&&Y(t),a.enableRotate&&X(t)}(t),a.update();break;default:d=h.NONE}}function nt(t){!1!==a.enabled&&(a.dispatchEvent(c),d=h.NONE)}function st(t){!1!==a.enabled&&t.preventDefault()}a.domElement.addEventListener("contextmenu",st,!1),a.domElement.addEventListener("mousedown",J,!1),a.domElement.addEventListener("wheel",Q,!1),a.domElement.addEventListener("touchstart",et,!1),a.domElement.addEventListener("touchend",nt,!1),a.domElement.addEventListener("touchmove",it,!1),a.domElement.addEventListener("keydown",tt,!1),-1===a.domElement.tabIndex&&(a.domElement.tabIndex=0),this.object.lookAt(a.target),this.update(),this.saveState()};(Em.prototype=Object.create(le.prototype)).constructor=Em;var Tm=function(t,e){Em.call(this,t,e),this.mouseButtons.LEFT=i.ROTATE,this.mouseButtons.RIGHT=i.PAN,this.touches.ONE=n.ROTATE,this.touches.TWO=n.DOLLY_PAN};(Tm.prototype=Object.create(le.prototype)).constructor=Tm;var Am=function(t,e){Em.call(this,t,e),this.mouseButtons.LEFT=i.PAN,this.mouseButtons.RIGHT=i.ROTATE,this.touches.ONE=n.PAN,this.touches.TWO=n.DOLLY_ROTATE};(Am.prototype=Object.create(le.prototype)).constructor=Am;var Cm=function(t,e){Em.call(this,t,e),this.trackball=!0,this.screenSpacePanning=!0,this.autoRotate=!1,this.mouseButtons.LEFT=i.ROTATE,this.mouseButtons.RIGHT=i.PAN,this.touches.ONE=n.ROTATE,this.touches.TWO=n.DOLLY_PAN};(Cm.prototype=Object.create(le.prototype)).constructor=Cm;class Lm{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 Ke(...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 Em(this.camera,this.domElement),this.controls.trackball=!0,this.setHolroydTrackball(t)}initOrbitControls(){this.controls=new Em(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 km={y_up:{iso:{pos:new Ke(1,1,1),z_rot:0},front:{pos:new Ke(0,0,1),z_rot:0},rear:{pos:new Ke(0,0,-1),z_rot:0},left:{pos:new Ke(-1,0,0),z_rot:0},right:{pos:new Ke(1,0,0),z_rot:0},top:{pos:new Ke(0,1,0),z_rot:0},bottom:{pos:new Ke(0,-1,0),z_rot:0}},z_up:{iso:{pos:new Ke(1,-1,1),z_rot:0},front:{pos:new Ke(0,-1,0),z_rot:0},rear:{pos:new Ke(0,1,0),z_rot:0},left:{pos:new Ke(-1,0,0),z_rot:0},right:{pos:new Ke(1,0,0),z_rot:0},top:{pos:new Ke(0,0,1),z_rot:-Math.PI/2},bottom:{pos:new Ke(0,0,-1),z_rot:-Math.PI/2}},legacy:{iso:{pos:new Ke(1,1,1),z_rot:0},front:{pos:new Ke(1,0,0),z_rot:0},rear:{pos:new Ke(-1,0,0),z_rot:0},left:{pos:new Ke(0,1,0),z_rot:0},right:{pos:new Ke(0,-1,0),z_rot:0},top:{pos:new Ke(0,0,1),z_rot:0},bottom:{pos:new Ke(0,0,-1),z_rot:0}}},Rm={y_up:[0,1,0],z_up:[0,0,1],legacy:[0,0,1]};class Pm{constructor(t,e,i,n,s,r){this.target=new Ke(...n),this.ortho=s,this.up={Y:"y_up",Z:"z_up",L:"legacy"}[r],this.yaxis=new Ke(0,1,0),this.zaxis=new Ke(0,0,1);const a=t/e;this.camera_distance=5*i;var o=2*Math.atan(.2)/Math.PI*180;this.pCamera=new vs(o,a,.1,100*i),this.pCamera.up.set(...Rm[this.up]),this.pCamera.lookAt(this.target);const l=this.projectSize(i,a);this.oCamera=new Ws(-l[0],l[0],l[1],-l[1],.1,100*i),this.oCamera.up.set(...Rm[this.up]),this.oCamera.lookAt(this.target),this.camera=s?this.oCamera:this.pCamera,this.camera.up.set(...Rm[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,km[this.up][t].pos,null,e),this.lookAtTarget(),0!=km[this.up][t].z_rot){var i=new $e;i.setFromAxisAngle(new Ke(0,0,1),km[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 Ke(...t)):t instanceof Ke?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 $e(...t)):t instanceof $e?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()}}t.Display=Fp,t.Timer=dm,t.Viewer=class{constructor(t,e,i,n=null,s=!0){this.notifyCallback=i,this.pinAsPngCallback=n,this.updateMarker=s,this.hasAnimationLoop=!1,this.setDisplayDefaults(e),e.keymap&&Gu.set(e.keymap),this.display=new Fp(t,{theme:this.theme,cadWidth:this.cadWidth,treeWidth:this.treeWidth,height:this.height,pinning:this.pinning,glass:this.glass,tools:this.tools,measureTools:e.measureTools}),window.THREE=Uu,this.nestedGroup=null,this.mapping=null,this.tree=null,this.bbox=null,this.bb_max=0,this.scene=null,this.camera=null,this.orthographicCamera=null,this.orthographicScene=null,this.gridHelper=null,this.axesHelper=null,this.controls=null,this.orientationMarker=null,this.treeview=null,this.cadTools=new Dp(this),this.newTreeBehavior=e.newTreeBehavior,this.ready=!1,this.mixer=null,this.animation=new Mm("|"),this.continueAnimation=!0,this.clipNormals=[[-1,0,0],[0,-1,0],[0,0,-1]],this.camera_distance=0,this.mouse=new be,this.renderer=new _o({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.lastObject=null,this.lastSelection=null,this.lastPosition=null,this.bboxNeedsUpdate=!1,this.keepHighlight=!1,this.setPickHandler(!0),this.renderer.domElement.addEventListener("contextmenu",(t=>t.stopPropagation())),this.display.addCadView(this.renderer.domElement),console.debug("three-cad-viewer: WebGL Renderer created"),this.display.setupUI(this)}version(){return"2.2.4"}setDisplayDefaults(t){for(var e in this.theme="light",this.cadWidth=800,this.treeWidth=250,this.height=600,this.pinning=!1,this.glass=!1,this.tools=!0,this.keymap={shift:"shiftKey",ctrl:"ctrlKey",meta:"metaKey"},this.newTreeBehavior=!0,t)null==this[e]?console.warn(`Unknown option "${e}" to create a viewer - ignored`):this[e]=t[e];"dark"===t.theme||"browser"==t.theme&&window.matchMedia("(prefers-color-scheme: dark)").matches?this.theme="dark":this.theme="light"}setRenderDefaults(t){for(var e in this.ambientIntensity=.5,this.directIntensity=.6,this.metalness=.7,this.roughness=.7,this.defaultOpacity=.5,this.edgeColor=7368816,this.normalLen=0,this.measureTools=!1,t)void 0===this[e]?console.warn(`Unknown option "${e}" to create a viewer - ignored`):this[e]=t[e];this.materialSettings={ambientIntensity:this.ambientIntensity,directIntensity:this.directIntensity,metalness:this.metalness,roughness:this.roughness}}setViewerDefaults(t){for(var e in this.axes=!1,this.axes0=!1,this.grid=[!1,!1,!1],this.ortho=!0,this.transparent=!1,this.blackEdges=!1,this.collapse=0,this.clipIntersection=!1,this.clipPlaneHelpers=!1,this.clipObjectColors=!1,this.clipNormal0=[-1,0,0],this.clipNormal1=[0,-1,0],this.clipNormal2=[0,0,-1],this.clipSlider0=-1,this.clipSlider1=-1,this.clipSlider2=-1,this.control="orbit",this.up="Z",this.ticks=10,this.centerGrid=!1,this.position=null,this.quaternion=null,this.target=null,this.zoom=1,this.panSpeed=.5,this.rotateSpeed=1,this.zoomSpeed=.5,this.timeit=!1,t)void 0===this[e]?console.warn(`Unknown option ${e} to add shapes - ignored`):this[e]=t[e]}dumpOptions(){console.log("Display:"),console.log("- cadWidth",this.cadWidth),console.log("- control",this.control),console.log("- height",this.height),console.log("- pinning",this.pinning),console.log("- theme",this.theme),console.log("- treeHeight",this.treeHeight),console.log("- treeWidth",this.treeWidth),console.log("Render:"),console.log("- ambientIntensity",this.ambientIntensity),console.log("- defaultOpacity",this.defaultOpacity),console.log("- directIntensity",this.directIntensity),console.log("- edgeColor",this.edgeColor),console.log("- normalLen",this.normalLen),console.log("View:"),console.log("- axes",this.axes),console.log("- axes0",this.axes0),console.log("- blackEdges",this.blackEdges),console.log("- clipIntersection",this.clipIntersection),console.log("- clipPlaneHelpers",this.clipPlaneHelpers),console.log("- clipObjectColors",this.clipObjectColors),console.log("- clipNormal0",this.clipNormal0),console.log("- clipNormal1",this.clipNormal1),console.log("- clipNormal2",this.clipNormal2),console.log("- clipSlider0",this.clipSlider0),console.log("- clipSlider1",this.clipSlider1),console.log("- clipSlider2",this.clipSlider2),console.log("- grid",this.grid),console.log("- ortho",this.ortho),console.log("- panSpeed",this.panSpeed),console.log("- position",this.position),console.log("- quaternion",this.quaternion),console.log("- rotateSpeed",this.rotateSpeed),console.log("- ticks",this.ticks),console.log("- timeit",this.timeit),console.log("- tools",this.tools),console.log("- glass",this.glass),console.log("- transparent",this.transparent),console.log("- zoom",this.zoom),console.log("- zoom0",this.controls.getZoom0()),console.log("- zoomSpeed",this.zoomSpeed)}_renderTessellatedShapes(t,e){const i=new Kp(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,"")}_decompose(t,e){const i=t.shape;var n;if(t.parts=[],"shapes"==t.type){var s={parts:[],loc:[[0,0,0],[0,0,0,1]],name:"faces",id:`${t.id}/faces`};const o=i.vertices,l=i.normals;for(n=0;n<i.triangles.length;n++){var r=i.triangles[n],a={loc:[[0,0,0],[0,0,0,1]],name:`faces_${n}`,id:`${t.id}/faces/faces_${n}`,type:"shapes",color:t.color,alpha:t.alpha,renderBack:!1,accuracy:t.accuracy,bb:{},geomtype:i.face_types[n],subtype:t.subtype,shape:{triangles:[...Array(r.length).keys()],vertices:r.map((t=>[o[3*t],o[3*t+1],o[3*t+2]])).flat(),normals:r.map((t=>[l[3*t],l[3*t+1],l[3*t+2]])).flat(),edges:[]}};s.parts.push(a),e[a.id]=[1,3]}t.parts.push(s)}if("shapes"==t.type||"edges"==t.type){s={parts:[],loc:[[0,0,0],[0,0,0,1]],name:"edges",id:`${t.id}/edges`};const r=Array.isArray(t.color)&&t.color.length==i.edges.length;var o;for(n=0;n<i.edges.length;n++){const l=i.edges[n];o=r?t.color[n]:t.color,a={loc:[[0,0,0],[0,0,0,1]],name:`edges_${n}`,id:`${t.id}/edges/edges_${n}`,type:"edges",color:"shapes"==t.type?this.edgeColor:o,width:"shapes"==t.type?1:t.width,bb:{},geomtype:i.edge_types[n],shape:{edges:l}},s.parts.push(a),e[a.id]=[3,1]}t.parts.push(s)}s={parts:[],loc:[[0,0,0],[0,0,0,1]],name:"vertices",id:`${t.id}/vertices`};var l=i.obj_vertices;for(n=0;n<l.length/3;n++)a={loc:[[0,0,0],[0,0,0,1]],name:`vertices${n}`,id:`${t.id}/vertices/vertices${n}`,type:"vertices",color:"shapes"==t.type||"edges"==t.type?this.edgeColor:t.color,size:"shapes"==t.type||"edges"==t.type?4:t.size,bb:{},shape:{obj_vertices:[l[3*n],l[3*n+1],l[3*n+2]]}},s.parts.push(a),e[a.id]=[3,1];return t.parts.push(s),delete t.shape,delete t.color,delete t.alpha,delete t.accuracy,delete t.renderBack,delete e[t.id],t}renderTessellatedShapes(t,e,i){this.setRenderDefaults(i);const n=(t,e,s)=>{var r,a;if(2==t.version)if(s){var o,l;let s=[];for(o=0;o<t.parts.length;o++)null!=(r=t.parts[o]).parts?(l=n(r,e,i),s.push(l)):s.push(this._decompose(r,e));t.parts=s}else for(o=0;o<t.parts.length;o++)a=(r=t.parts[o]).shape,"shapes"==r.type?(a.triangles=a.triangles.flat(),a.edges=a.edges.flat()):"edges"!=r.type&&"shapes"!=r.type||(a.edges=a.edges.flat());return t};return t=n(t,e,i.measureTools),[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(!Fu(this.lastNotification[e],t[e])){var n=Bu(t[e]);i[e]={new:n,old:null==this.lastNotification[e]?null:Bu(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.raycaster&&this.raycaster.raycastMode&&this.handleRaycast(),this.renderer.setViewport(0,0,this.cadWidth,this.height),this.renderer.render(this.scene,this.camera.getCamera()),this.cadTools.update(),this.directLight.position.copy(this.camera.getCamera().position),null!=this.lastBbox&&(this.lastBbox.needsUpdate||this.bboxNeedsUpdate)&&(console.log("updated bbox"),this.lastBbox.bbox.update(),this.lastBbox.needsUpdate=!1),t&&(this.renderer.clearDepth(),this.orientationMarker.update(this.camera.getPosition().clone().sub(this.controls.getTarget()),this.camera.getQuaternion()),this.orientationMarker.render(this.renderer)),this.animation&&this.animation.update(),this.checkChanges({zoom:this.camera.getZoom(),position:this.camera.getPosition().toArray(),quaternion:this.camera.getQuaternion().toArray(),target:this.controls.getTarget().toArray()},e))};animate=()=>{this.continueAnimation?(requestAnimationFrame(this.animate),this.controls.update(),this.update(!0,!0)):console.debug("three-cad-viewer: Animation loop stopped")};toggleAnimationLoop(t){t?(this.continueAnimation=!0,this.hasAnimationLoop=!0,this.controls.removeChangeListener(),console.debug("three-cad-viewer: Change listener removed"),this.animate(),console.debug("three-cad-viewer: Animation loop started")):(this.hasAnimationLoop&&console.debug("three-cad-viewer: Turning animation loop off"),this.continueAnimation=!1,this.hasAnimationLoop=!1,this.controls.addChangeListener((()=>this.update(!0,!0))),console.debug("three-cad-viewer: Change listener registered"),setTimeout((()=>this.update(!0,!0)),50))}dispose(){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(),zu(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 dm("viewer",this.timeit);this.states=i,this.scene=new bo,this.orthographicScene=new bo,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 Ke;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 Sm(this.display.cadInfo),this.camera=new Pm(this.cadWidth,this.height,this.bb_radius,null==n.target?this.bbox.center():n.target,this.ortho,n.up),this.orthographicCamera=new Ws(-10,10,-10,10,0,100),this.orthographicCamera.position.z=50,this.orthographicCamera.up=this.camera.up,this.controls=new Lm(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(),this.ambientLight=new yd(16777215,Hu(this.ambientIntensity)),this.scene.add(this.ambientLight),this.directLight=new _d(16777215,Hu(this.directIntensity)),this.scene.add(this.directLight),this.setAmbientLight(this.ambientIntensity),this.setDirectLight(this.directIntensity),this.gridHelper=new im(this.display,this.bbox,this.ticks,this.centerGrid,this.axes0,this.grid,"Z"==n.up,this.theme),this.gridHelper.computeGrid();for(var a=0;a<3;a++)this.scene.add(this.gridHelper.gridHelper[a]);this.gridSize=this.gridHelper.size,this.axesHelper=new nm(this.bbox.center(),this.gridSize/2,2,this.cadWidth,this.height,this.axes0,this.axes,this.theme),this.scene.add(this.axesHelper);const o=1.1*Math.max(Math.abs(this.bbox.min.length()),Math.abs(this.bbox.max.length()));this.clipping=new wm(this.bbox.center(),2*o,this.nestedGroup,this.display,this.theme),this.display.setSliderLimits(this.gridSize/2,this.bbox.center()),this.setClipNormal(0,n.clipNormal0,!0),this.setClipNormal(1,n.clipNormal1,!0),this.setClipNormal(2,n.clipNormal2,!0),this.clipSlider0=null!=n.clipSlider0?n.clipSlider0:this.gridSize/2,this.clipSlider1=null!=n.clipSlider1?n.clipSlider1:this.gridSize/2,this.clipSlider2=null!=n.clipSlider2?n.clipSlider2:this.gridSize/2,this.setClipSlider(0,this.clipSlider0,!0),this.setClipSlider(1,this.clipSlider1,!0),this.setClipSlider(2,this.clipSlider2,!0),this.setClipIntersection(n.clipIntersection,!0),this.setClipObjectColorCaps(n.clipObjectColors,!0),this.setClipPlaneHelpersCheck(n.clipPlaneHelpers,!0),this.scene.add(this.clipping.planeHelpers),this.nestedGroup.setClipPlanes(this.clipping.clipPlanes),this.setLocalClipping(!1),this.clipping.setVisible(!1),this.display.metalnessSlider.setValue(100*this.metalness),this.display.roughnessSlider.setValue(100*this.roughness),this.display.ambientlightSlider.setValue(100*this.ambientIntensity),this.display.directionallightSlider.setValue(100*this.directIntensity);const l="dark"===this.theme||"browser"===this.theme&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";this.orientationMarker=new sm(80,80,this.camera.getCamera(),l),this.orientationMarker.create(),this.tree=e,this.treeview=new hm(Bu(this.states),this.tree,this.setObjects,this.handlePick,l,this.newTreeBehavior),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.setObjects(this.states,!0,!0),this.toggleAnimationLoop(this.hasAnimationLoop),this.display.showMeasureTools(n.measureTools),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(!0,!1),s.stop()}setCamera=(t,e,i=null,n=null,s=!0)=>{this.camera.setupCamera(t,new Ke(...e),null!=i?new $e(...i):null,n,s),this.update(!0,s)};presetCamera=(t,e=null,i=!0)=>{this.camera.target=new Ke(...this.bbox.center()),this.camera.presetCamera(t,e,i),this.controls.setTarget(this.camera.target),this.update(!0,i)};getCameraType(){return this.camera.ortho?"ortho":"perspective"}switchCamera(t,e=!0){this.ortho=t,this.camera.switchCamera(t,e),this.controls.setCamera(this.camera.getCamera()),this.display.setOrthoCheck(t),this.checkChanges({ortho:t},e),this.update(!0,e)}recenterCamera(t=!0){const e=this.camera.getCamera(),i=new Ke,n=this.bbox.center();i.fromArray(n);const s=new Ke,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 Ke;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=!1,i=!0)=>{for(var n in this.states){var s=this.states[n],r=t[n],a=this.nestedGroup.groups[n];(e||s[0]!=r[0])&&(a.setShapeVisible(1===r[0]),this.states[n][0]=r[0]),s[1]!=r[1]&&(a.setEdgesVisible(1===r[1]),this.states[n][1]=r[1])}this.checkChanges({states:t},i),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 qp(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 jp).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 Ke(...t)),this.info.centerInfo(t)}else this.info.bbInfo(t,e,l),this.setBoundingBox(a);else this.removeLastBbox();this.update(!0)};setPickHandler(t){t?this.renderer.domElement.addEventListener("dblclick",this.pick,!1):this.renderer.domElement.removeEventListener("dblclick",this.pick,!1)}pick=t=>{const e=new wp(this.camera,this.renderer.domElement,this.cadWidth,this.height,this.bb_max/30,this.scene.children.slice(0,1),(t=>{}));e.init(),e.onPointerMove(t);const i=e.getIntersectedObjs(t);if(0==i.length)return;var n=i[0];const s={path:n.object.parent.parent.name.replaceAll("|","/"),name:n.object.name,boundingBox:n.object.geometry.boundingBox,boundingSphere:n.object.geometry.boundingSphere,objectGroup:n.object.parent};null!=s&&this.handlePick(s.path,s.name,Gu.get(t,"meta"),Gu.get(t,"shift")),e.dispose()};clearSelection=()=>{this.nestedGroup.clearSelection(),this.cadTools.handleResetSelection()};_releaseLastSelected=t=>{if(null!=this.lastObject){let e=this.lastObject.objs();for(let t of e)t.unhighlight(!0);t&&(this.lastObject=null)}};_removeLastSelected=()=>{if(null!=this.lastSelection){let t=this.lastSelection.objs();for(let e of t)e.unhighlight(!1);this.lastSelection=null,this.cadTools.handleRemoveLastSelection()}};setRaycastMode(t){t?(this.raycaster=new wp(this.camera,this.renderer.domElement,this.cadWidth,this.height,this.bb_max/30,this.scene.children.slice(0,1),this.handleRaycastEvent),this.raycaster.init()):(this.raycaster.dispose(),this.raycaster=null)}handleRaycast=()=>{const t=this.raycaster.getValidIntersectedObjs();if(t.length>0)for(var e of t){const t=e.object.parent;if(t!==this.lastObject){this._releaseLastSelected(!1);const e=this.raycaster.filters.topoFilter.includes(mp.solid),i=new xp(t,e);for(let t of i.objs())t.highlight(!0);this.lastObject=i}break}else this._releaseLastSelected(!0)};handleRaycastEvent=t=>{if(t.key)switch(t.key){case"Escape":this.clearSelection();break;case"Backspace":this._removeLastSelected()}else switch(t.mouse){case"left":if(null!=this.lastObject){const t=this.lastObject.objs();for(let e of t)e.toggleSelection();this.cadTools.handleSelectedObj(this.lastObject),this.lastSelection=this.lastObject}break;case"right":this._removeLastSelected()}};handleBackendResponse=t=>{"tool_response"===t.subtype&&this.cadTools.handleResponse(t)};getAxes(){return this.axes}setAxes=(t,e=!0)=>{this.axes=t,this.axesHelper.setVisible(t),this.display.setAxesCheck(t),this.checkChanges({axes:t},e),this.update(this.updateMarker)};setGrid=(t,e,i=!0)=>{this.gridHelper.setGrid(t,e),this.checkChanges({grid:this.gridHelper.grid},i),this.update(this.updateMarker)};getGrids(){return this.grid}setGrids=(t,e=!0)=>{this.gridHelper.setGrids(...t),this.grid=this.gridHelper.grid,this.checkChanges({grid:this.gridHelper.grid},e),this.update(this.updateMarker)};getAxes0(){return this.axes0}setAxes0=(t,e=!0)=>{this.axes0=t,this.gridHelper.setCenter(t,"Z"==this.up),this.display.setAxes0Check(t),this.axesHelper.setCenter(t),this.checkChanges({axes0:t},e),this.update(this.updateMarker)};getMetalness=()=>this.metalness;setMetalness=(t,e=!0)=>{this.metalness=t,this.nestedGroup.setMetalness(t),this.checkChanges({metalness:t},e),this.update(this.updateMarker)};getRoughness=()=>this.roughness;setRoughness=(t,e=!0)=>{this.roughness=t,this.nestedGroup.setRoughness(t),this.checkChanges({roughness:t},e),this.update(this.updateMarker)};resetMaterial=()=>{this.setMetalness(this.materialSettings.metalness,!0),this.display.setMetalness(this.materialSettings.metalness),this.setRoughness(this.materialSettings.roughness,!0),this.display.setRoughness(this.materialSettings.roughness),this.setAmbientLight(this.materialSettings.ambientIntensity,!0),this.display.setAmbientLight(this.materialSettings.ambientIntensity),this.setDirectLight(this.materialSettings.directIntensity,!0),this.display.setDirectLight(this.materialSettings.directIntensity)};getTransparent(){return this.transparent}setTransparent=(t,e=!0)=>{this.transparent=t,this.nestedGroup.setTransparent(t),this.display.setTransparentCheck(t),this.checkChanges({transparent:t},e),this.update(this.updateMarker)};getBlackEdges(){return this.blackEdges}setBlackEdges=(t,e=!0)=>{this.blackEdges=t,this.nestedGroup.setBlackEdges(t),this.display.setBlackEdgesCheck(t),this.checkChanges({black_edges:t},e),this.update(this.updateMarker)};getOrtho(){return this.camera.ortho}setOrtho(t,e=!0){this.switchCamera(t,e)}getCameraZoom(){return this.camera.getZoom()}setCameraZoom(t,e=!0){this.camera.setZoom(t),this.controls.update(),this.update(!0,e)}getCameraPosition(){return this.camera.getPosition().toArray()}setCameraPosition(t,e=!1,i=!0){this.camera.setPosition(t,e),this.controls.update(),this.update(!0,i)}getCameraQuaternion(){return this.camera.getQuaternion().toArray()}setCameraQuaternion(t,e=!0){this.camera.setQuaternion(t),this.controls.update(),this.update(!0,e)}getCameraTarget(){return this.controls.getTarget().toArray()}setCameraTarget(t,e=!0){this.camera.getCamera().lookAt(new Ke(...t)),this.controls.setTarget(new Ke(...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 Ke(...i)),null!=n&&this.camera.setZoom(n),this.controls.update(),this.update(!0,s)}getEdgeColor(){return this.edgeColor}setEdgeColor=(t,e=!0)=>{this.edgeColor=t,this.nestedGroup.setEdgeColor(t),this.update(this.updateMarker,e)};getOpacity(){return this.defaultOpacity}setOpacity=(t,e=!0)=>{this.defaultOpacity=t,this.nestedGroup.setOpacity(t),this.update(this.updateMarker,e)};getTools(){return this.tools}showTools=(t,e=!0)=>{this.tools=t,this.display.showTools(t),this.update(this.updateMarker,e)};getAmbientLight(){return this.ambientIntensity}setAmbientLight=(t,e=!0)=>{this.ambientIntensity=t,this.ambientLight.intensity=Hu(t),this.checkChanges({ambient_intensity:t},e),this.update(this.updateMarker,e)};getDirectLight(){return this.directIntensity}setDirectLight=(t,e=!0)=>{this.directIntensity=t,this.directLight.intensity=Hu(t),this.checkChanges({direct_intensity:t},e),this.update(this.updateMarker,e)};getStates(){return this.states}getState(t){var e=t.replaceAll("|","/");return this.getStates()[e]}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)=>{if(null!=t){for(var i of(this.clipIntersection=t,this.nestedGroup.setClipIntersection(t),this.display.setClipIntersectionCheck(t),this.nestedGroup.rootGroup.children))if("PlaneMeshes"==i.name)for(var n of i.children)n.material.clippingPlanes=t?this.clipping.reverseClipPlanes.filter(((t,e)=>e!==n.index)):this.clipping.clipPlanes.filter(((t,e)=>e!==n.index));for(i of this.scene.children)if("PlaneHelpers"==i.name)for(var s of i.children)s.material.clippingPlanes=t?this.clipping.reverseClipPlanes.filter(((t,e)=>e!==s.index)):this.clipping.clipPlanes.filter(((t,e)=>e!==s.index));this.checkChanges({clip_intersection:t},e),this.update(this.updateMarker)}};getObjectColorCaps=()=>this.clipping.getObjectColorCaps();setClipObjectColorCaps=(t,e=!0)=>{null!=t&&(this.clipping.setObjectColorCaps(t),this.display.setClipObjectColorsCheck(t),this.checkChanges({clip_object_colors:t},e),this.update(this.updateMarker))};getClipPlaneHelpers(){return this.clipPlaneHelpers}setClipPlaneHelpersCheck(t){null!=t&&this.display.setClipPlaneHelpersCheck(t)}setClipPlaneHelpers=(t,e=!0)=>{null!=t&&(this.clipPlaneHelpers=t,this.clipping.planeHelpers.visible=t,this.display.setClipPlaneHelpersCheck(t),this.checkChanges({clip_planes:t},e),this.update(this.updateMarker))};getClipNormal(t){return this.clipNormals[t]}setClipNormal(t,e,i=!0){if(null==e)return;const n=new Ke(...e).normalize().toArray();this.clipNormals[t]=n,this.clipping.setNormal(t,new Ke(...n)),this.clipping.setConstant(t,this.gridSize/2),this.setClipSlider(t,this.gridSize/2);var s={};s[`clip_normal_${t}`]=n,this.checkChanges(s,i),this.nestedGroup.setClipPlanes(this.clipping.clipPlanes),this.update(this.updateMarker)}setClipNormalFromPosition=(t,e=!0)=>{const i=this.camera.getPosition().clone().sub(this.controls.getTarget()).normalize().negate().toArray();this.setClipNormal(t,i,e)};getClipSlider=t=>this.display.clipSliders[t].getValue();setClipSlider=(t,e,i=!0)=>{-1!=e&&null!=e&&this.display.clipSliders[t].setValue(e,i)};getResetLocation=()=>{const t=this.controls.getResetLocation();return{target0:t.target0.toArray(),position0:t.position0.toArray(),quaternion0:t.quaternion0.toArray(),zoom0:t.zoom0}};setResetLocation=(t,e,i,n,s=!0)=>{var r=this.getResetLocation();this.controls.setResetLocation(new Ke(...t),new Ke(...e),new qe(...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,e=t[t.length-1];this.renderer.setViewport(0,0,this.cadWidth,this.height),this.renderer.render(this.scene,this.camera.getCamera()),e.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 Ke,r=new Ke,a=null,o=null,l=null;n||(new ei).setFromObject(this.nestedGroup.rootGroup).getCenter(s);for(var c in this.nestedGroup.groups){var h=this.nestedGroup.groups[c],d=new ei;h instanceof $p&&d.expandByObject(h),d.isEmpty()||(d.getCenter(r),a=r.sub(s),o=h.parent.worldToLocal(a.clone()),(l=h.parent.worldToLocal(a.clone().multiplyScalar(i))).sub(o),this.addAnimationTrack(c,"t",[0,t],[[0,0,0],l.toArray()]))}this.initAnimation(t,e,"E",!1)}trimUI(t,e){var i=e?"inline-block":"none";for(var n of t){var s;["axes","axes0","grid","ortho","more","help"].includes(n)&&("more"!=n?((s=this.display._getElement(`tcv_${n}`)).style.display=i,"help"!==n&&(s.nextElementSibling.style.display=i)):(s=this.display._getElement(`tcv_${n}-dropdown`)).style.display=i)}}setKeyMap(t){const e=Gu.get_config();Gu.set(t),this.display.updateHelp(e,t)}resizeCadView(t,e,i,n=!1){this.cadWidth=t,this.height=i,this.renderer.setSize(t,i),this.display.setSizes({treeWidth:e,cadWidth:t,height:i}),this.display.glassMode(n);const s=t+(n?0:e);this.display.handleMoreButton(s),this.camera.changeDimensions(this.bb_radius,t,i),this.update(!0),this.raycaster&&(this.raycaster.width=t,this.raycaster.height=i)}vector3(t=0,e=0,i=0){return new Ke(t,e,i)}quaternion(t=0,e=0,i=0,n=1){return new $e(t,e,i,n)}}}));
|
|
6
|
+
*/const e="166",i={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},n={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},s=1,r=2,a=3,o=0,l=1,c=100,h=204,d=205,u=0,p=1,m=2,f=0,g=1,v=2,_=3,y=4,x=5,w=6,b=7,M="attached",S="detached",E=300,T=301,A=302,C=303,L=304,k=306,R=1e3,P=1001,I=1002,U=1003,N=1004,D=1005,O=1006,B=1007,F=1008,z=1009,H=1010,V=1011,G=1012,j=1013,W=1014,q=1015,X=1016,Z=1017,Y=1018,J=1020,K=35902,$=1021,Q=1022,tt=1023,et=1024,it=1025,nt=1026,st=1027,rt=1028,at=1029,ot=1030,lt=1031,ct=1033,ht=33776,dt=33777,ut=33778,pt=33779,mt=35840,ft=35841,gt=35842,vt=35843,_t=36196,yt=37492,xt=37496,wt=37808,bt=37809,Mt=37810,St=37811,Et=37812,Tt=37813,At=37814,Ct=37815,Lt=37816,kt=37817,Rt=37818,Pt=37819,It=37820,Ut=37821,Nt=36492,Dt=36494,Ot=36495,Bt=36283,Ft=36284,zt=36285,Ht=36286,Vt=2201,Gt=2202,jt=2300,Wt=2301,qt=2302,Xt=2400,Zt=2401,Yt=2402,Jt=2500,Kt=2501,$t="",Qt="srgb",te="srgb-linear",ee="display-p3",ie="display-p3-linear",ne="linear",se="srgb",re="rec709",ae="p3",oe=7680,le=7681,ce=34055,he=34056,de=519,ue=515,pe=35044,me="300 es",fe=2e3,ge=2001;class ve{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 _e=["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 ye=1234567;const xe=Math.PI/180,we=180/Math.PI;function be(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(_e[255&t]+_e[t>>8&255]+_e[t>>16&255]+_e[t>>24&255]+"-"+_e[255&e]+_e[e>>8&255]+"-"+_e[e>>16&15|64]+_e[e>>24&255]+"-"+_e[63&i|128]+_e[i>>8&255]+"-"+_e[i>>16&255]+_e[i>>24&255]+_e[255&n]+_e[n>>8&255]+_e[n>>16&255]+_e[n>>24&255]).toLowerCase()}function Me(t,e,i){return Math.max(e,Math.min(i,t))}function Se(t,e){return(t%e+e)%e}function Ee(t,e,i){return(1-i)*t+i*e}function Te(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Ae(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const Ce={DEG2RAD:xe,RAD2DEG:we,generateUUID:be,clamp:Me,euclideanModulo:Se,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:Ee,damp:function(t,e,i,n){return Ee(t,e,1-Math.exp(-i*n))},pingpong:function(t,e=1){return e-Math.abs(Se(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&&(ye=t);let e=ye+=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*xe},radToDeg:function(t){return t*we},isPowerOfTwo:function(t){return 0==(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},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:Ae,denormalize:Te};class Le{constructor(t=0,e=0){Le.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=Math.trunc(this.x),this.y=Math.trunc(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(Me(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 ke{constructor(t,e,i,n,s,r,a,o,l){ke.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,n,s,r,a,o,l)}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],w=n[5],b=n[8];return s[0]=r*m+a*v+o*x,s[3]=r*f+a*_+o*w,s[6]=r*g+a*y+o*b,s[1]=l*m+c*v+h*x,s[4]=l*f+c*_+h*w,s[7]=l*g+c*y+h*b,s[2]=d*m+u*v+p*x,s[5]=d*f+u*_+p*w,s[8]=d*g+u*y+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],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(Re.makeScale(t,e)),this}rotate(t){return this.premultiply(Re.makeRotation(-t)),this}translate(t,e){return this.premultiply(Re.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):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 Re=new ke;function Pe(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const Ie={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function Ue(t,e){return new Ie[t](e)}function Ne(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function De(){const t=Ne("canvas");return t.style.display="block",t}const Oe={};function Be(t){t in Oe||(Oe[t]=!0,console.warn(t))}const Fe=(new ke).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),ze=(new ke).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),He={[te]:{transfer:ne,primaries:re,toReference:t=>t,fromReference:t=>t},[Qt]:{transfer:se,primaries:re,toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[ie]:{transfer:ne,primaries:ae,toReference:t=>t.applyMatrix3(ze),fromReference:t=>t.applyMatrix3(Fe)},[ee]:{transfer:se,primaries:ae,toReference:t=>t.convertSRGBToLinear().applyMatrix3(ze),fromReference:t=>t.applyMatrix3(Fe).convertLinearToSRGB()}},Ve=new Set([te,ie]),Ge={enabled:!0,_workingColorSpace:te,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!Ve.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,i){if(!1===this.enabled||e===i||!e||!i)return t;const n=He[e].toReference;return(0,He[i].fromReference)(n(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return He[t].primaries},getTransfer:function(t){return t===$t?ne:He[t].transfer}};function je(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function We(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let qe;class Xe{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===qe&&(qe=Ne("canvas")),qe.width=t.width,qe.height=t.height;const i=qe.getContext("2d");t instanceof ImageData?i.putImageData(t,0,0):i.drawImage(t,0,0,t.width,t.height),e=qe}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=Ne("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*je(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*je(e[t]/255)):e[t]=je(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}}let Ze=0;class Ye{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Ze++}),this.uuid=be(),this.data=t,this.dataReady=!0,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(Je(n[e].image)):t.push(Je(n[e]))}else t=Je(n);i.url=t}return e||(t.images[this.uuid]=i),i}}function Je(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Xe.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 Ke=0;class $e extends ve{constructor(t=$e.DEFAULT_IMAGE,e=$e.DEFAULT_MAPPING,i=1001,n=1001,s=1006,r=1008,a=tt,o=z,l=$e.DEFAULT_ANISOTROPY,c=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Ke++}),this.uuid=be(),this.name="",this.source=new Ye(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 Le(0,0),this.repeat=new Le(1,1),this.center=new Le(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ke,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}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.colorSpace=t.colorSpace,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.6,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,colorSpace:this.colorSpace,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!==E)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case R:t.x=t.x-Math.floor(t.x);break;case P:t.x=t.x<0?0:1;break;case I: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 R:t.y=t.y-Math.floor(t.y);break;case P:t.y=t.y<0?0:1;break;case I: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)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}$e.DEFAULT_IMAGE=null,$e.DEFAULT_MAPPING=E,$e.DEFAULT_ANISOTROPY=1;class Qe{constructor(t=0,e=0,i=0,n=1){Qe.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}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(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 ti extends ve{constructor(t=1,e=1,i={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Qe(0,0,t,e),this.scissorTest=!1,this.viewport=new Qe(0,0,t,e);const n={width:t,height:e,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:O,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new $e(n,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const r=i.count;for(let t=0;t<r;t++)this.textures[t]=s.clone(),this.textures[t].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}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.textures.length;n<s;n++)this.textures[n].image.width=t,this.textures[n].image.height=e,this.textures[n].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.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,i=t.textures.length;e<i;e++)this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0;const e=Object.assign({},t.texture.image);return this.texture.source=new Ye(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ei extends ti{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}}class ii extends $e{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=U,this.minFilter=U,this.wrapR=P,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class ni extends $e{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=U,this.minFilter=U,this.wrapR=P,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class si{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=!0){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!0===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(Me(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}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=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(n*Math.sin(t),n*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}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._onChangeCallback(),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 ri{constructor(t=0,e=0,i=0){ri.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(oi.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(oi.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=2*(r*n-a*i),c=2*(a*e-s*n),h=2*(s*i-r*e);return this.x=e+o*l+r*h-a*c,this.y=i+o*c+a*l-s*h,this.z=n+o*h+s*c-r*l,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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(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 ai.copy(this).projectOnVector(t),this.sub(ai)}reflect(t){return this.sub(ai.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(Me(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=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const ai=new ri,oi=new si;class li{constructor(t=new ri(1/0,1/0,1/0),e=new ri(-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(hi.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(hi.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=hi.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){t.updateWorldMatrix(!1,!1);const i=t.geometry;if(void 0!==i){const n=i.getAttribute("position");if(!0===e&&void 0!==n&&!0!==t.isInstancedMesh)for(let e=0,i=n.count;e<i;e++)!0===t.isMesh?t.getVertexPosition(e,hi):hi.fromBufferAttribute(n,e),hi.applyMatrix4(t.matrixWorld),this.expandByPoint(hi);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),di.copy(t.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),di.copy(i.boundingBox)),di.applyMatrix4(t.matrixWorld),this.union(di)}const n=t.children;for(let t=0,i=n.length;t<i;t++)this.expandByObject(n[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,hi),hi.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(_i),yi.subVectors(this.max,_i),ui.subVectors(t.a,_i),pi.subVectors(t.b,_i),mi.subVectors(t.c,_i),fi.subVectors(pi,ui),gi.subVectors(mi,pi),vi.subVectors(ui,mi);let e=[0,-fi.z,fi.y,0,-gi.z,gi.y,0,-vi.z,vi.y,fi.z,0,-fi.x,gi.z,0,-gi.x,vi.z,0,-vi.x,-fi.y,fi.x,0,-gi.y,gi.x,0,-vi.y,vi.x,0];return!!bi(e,ui,pi,mi,yi)&&(e=[1,0,0,0,1,0,0,0,1],!!bi(e,ui,pi,mi,yi)&&(xi.crossVectors(fi,gi),e=[xi.x,xi.y,xi.z],bi(e,ui,pi,mi,yi)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,hi).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(hi).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()||(ci[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),ci[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),ci[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),ci[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),ci[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),ci[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),ci[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),ci[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(ci)),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 ci=[new ri,new ri,new ri,new ri,new ri,new ri,new ri,new ri],hi=new ri,di=new li,ui=new ri,pi=new ri,mi=new ri,fi=new ri,gi=new ri,vi=new ri,_i=new ri,yi=new ri,xi=new ri,wi=new ri;function bi(t,e,i,n,s){for(let r=0,a=t.length-3;r<=a;r+=3){wi.fromArray(t,r);const a=s.x*Math.abs(wi.x)+s.y*Math.abs(wi.y)+s.z*Math.abs(wi.z),o=e.dot(wi),l=i.dot(wi),c=n.dot(wi);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>a)return!1}return!0}const Mi=new li,Si=new ri,Ei=new ri;class Ti{constructor(t=new ri,e=-1){this.isSphere=!0,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):Mi.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;Si.subVectors(t,this.center);const e=Si.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.addScaledVector(Si,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):(Ei.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Si.copy(t.center).add(Ei)),this.expandByPoint(Si.copy(t.center).sub(Ei))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Ai=new ri,Ci=new ri,Li=new ri,ki=new ri,Ri=new ri,Pi=new ri,Ii=new ri;class Ui{constructor(t=new ri,e=new ri(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,Ai)),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=Ai.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Ai.copy(this.origin).addScaledVector(this.direction,e),Ai.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){Ci.copy(t).add(e).multiplyScalar(.5),Li.copy(e).sub(t).normalize(),ki.copy(this.origin).sub(Ci);const s=.5*t.distanceTo(e),r=-this.direction.dot(Li),a=ki.dot(this.direction),o=-ki.dot(Li),l=ki.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(Ci).addScaledVector(Li,d),u}intersectSphere(t,e){Ai.subVectors(t.center,this.origin);const i=Ai.dot(this.direction),n=Ai.dot(Ai)-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,Ai)}intersectTriangle(t,e,i,n,s){Ri.subVectors(e,t),Pi.subVectors(i,t),Ii.crossVectors(Ri,Pi);let r,a=this.direction.dot(Ii);if(a>0){if(n)return null;r=1}else{if(!(a<0))return null;r=-1,a=-a}ki.subVectors(this.origin,t);const o=r*this.direction.dot(Pi.crossVectors(ki,Pi));if(o<0)return null;const l=r*this.direction.dot(Ri.cross(ki));if(l<0)return null;if(o+l>a)return null;const c=-r*ki.dot(Ii);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 Ni{constructor(t,e,i,n,s,r,a,o,l,c,h,d,u,p,m,f){Ni.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,i,n,s,r,a,o,l,c,h,d,u,p,m,f)}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 Ni).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/Di.setFromMatrixColumn(t,0).length(),s=1/Di.setFromMatrixColumn(t,1).length(),r=1/Di.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(Bi,t,Fi)}lookAt(t,e,i){const n=this.elements;return Vi.subVectors(t,e),0===Vi.lengthSq()&&(Vi.z=1),Vi.normalize(),zi.crossVectors(i,Vi),0===zi.lengthSq()&&(1===Math.abs(i.z)?Vi.x+=1e-4:Vi.z+=1e-4,Vi.normalize(),zi.crossVectors(i,Vi)),zi.normalize(),Hi.crossVectors(Vi,zi),n[0]=zi.x,n[4]=Hi.x,n[8]=Vi.x,n[1]=zi.y,n[5]=Hi.y,n[9]=Vi.y,n[2]=zi.z,n[6]=Hi.z,n[10]=Vi.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],w=n[0],b=n[4],M=n[8],S=n[12],E=n[1],T=n[5],A=n[9],C=n[13],L=n[2],k=n[6],R=n[10],P=n[14],I=n[3],U=n[7],N=n[11],D=n[15];return s[0]=r*w+a*E+o*L+l*I,s[4]=r*b+a*T+o*k+l*U,s[8]=r*M+a*A+o*R+l*N,s[12]=r*S+a*C+o*P+l*D,s[1]=c*w+h*E+d*L+u*I,s[5]=c*b+h*T+d*k+u*U,s[9]=c*M+h*A+d*R+u*N,s[13]=c*S+h*C+d*P+u*D,s[2]=p*w+m*E+f*L+g*I,s[6]=p*b+m*T+f*k+g*U,s[10]=p*M+m*A+f*R+g*N,s[14]=p*S+m*C+f*P+g*D,s[3]=v*w+_*E+y*L+x*I,s[7]=v*b+_*T+y*k+x*U,s[11]=v*M+_*A+y*R+x*N,s[15]=v*S+_*C+y*P+x*D,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,w=e*v+i*_+n*y+s*x;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*s-h*f*s-m*n*u+i*f*u+h*n*g-i*d*g)*b,t[2]=(a*f*s-m*o*s+m*n*l-i*f*l-a*n*g+i*o*g)*b,t[3]=(h*o*s-a*d*s-h*n*l+i*d*l+a*n*u-i*o*u)*b,t[4]=_*b,t[5]=(c*f*s-p*d*s+p*n*u-e*f*u-c*n*g+e*d*g)*b,t[6]=(p*o*s-r*f*s-p*n*l+e*f*l+r*n*g-e*o*g)*b,t[7]=(r*d*s-c*o*s+c*n*l-e*d*l-r*n*u+e*o*u)*b,t[8]=y*b,t[9]=(p*h*s-c*m*s-p*i*u+e*m*u+c*i*g-e*h*g)*b,t[10]=(r*m*s-p*a*s+p*i*l-e*m*l-r*i*g+e*a*g)*b,t[11]=(c*a*s-r*h*s-c*i*l+e*h*l+r*i*u-e*a*u)*b,t[12]=x*b,t[13]=(c*m*n-p*h*n+p*i*d-e*m*d-c*i*f+e*h*f)*b,t[14]=(p*a*n-r*m*n-p*i*o+e*m*o+r*i*f-e*a*f)*b,t[15]=(r*h*n-c*a*n+c*i*o-e*h*o-r*i*d+e*a*d)*b,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 t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):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,w=i.y,b=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)*w,n[5]=(1-(d+g))*w,n[6]=(f+v)*w,n[7]=0,n[8]=(p+_)*b,n[9]=(f-v)*b,n[10]=(1-(d+m))*b,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=Di.set(n[0],n[1],n[2]).length();const r=Di.set(n[4],n[5],n[6]).length(),a=Di.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],Oi.copy(this);const o=1/s,l=1/r,c=1/a;return Oi.elements[0]*=o,Oi.elements[1]*=o,Oi.elements[2]*=o,Oi.elements[4]*=l,Oi.elements[5]*=l,Oi.elements[6]*=l,Oi.elements[8]*=c,Oi.elements[9]*=c,Oi.elements[10]*=c,e.setFromRotationMatrix(Oi),i.x=s,i.y=r,i.z=a,this}makePerspective(t,e,i,n,s,r,a=2e3){const o=this.elements,l=2*s/(e-t),c=2*s/(i-n),h=(e+t)/(e-t),d=(i+n)/(i-n);let u,p;if(a===fe)u=-(r+s)/(r-s),p=-2*r*s/(r-s);else{if(a!==ge)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);u=-r/(r-s),p=-r*s/(r-s)}return o[0]=l,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=d,o[13]=0,o[2]=0,o[6]=0,o[10]=u,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,i,n,s,r,a=2e3){const o=this.elements,l=1/(e-t),c=1/(i-n),h=1/(r-s),d=(e+t)*l,u=(i+n)*c;let p,m;if(a===fe)p=(r+s)*h,m=-2*h;else{if(a!==ge)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);p=s*h,m=-1*h}return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-d,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-u,o[2]=0,o[6]=0,o[10]=m,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[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 Di=new ri,Oi=new Ni,Bi=new ri(0,0,0),Fi=new ri(1,1,1),zi=new ri,Hi=new ri,Vi=new ri,Gi=new Ni,ji=new si;class Wi{constructor(t=0,e=0,i=0,n=Wi.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(Me(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(-Me(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(Me(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(-Me(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(Me(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(-Me(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 Gi.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Gi,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return ji.setFromEuler(this),this.setFromQuaternion(ji,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}}Wi.DEFAULT_ORDER="XYZ";class qi{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 Xi=0;const Zi=new ri,Yi=new si,Ji=new Ni,Ki=new ri,$i=new ri,Qi=new ri,tn=new si,en=new ri(1,0,0),nn=new ri(0,1,0),sn=new ri(0,0,1),rn={type:"added"},an={type:"removed"},on={type:"childadded",child:null},ln={type:"childremoved",child:null};class cn extends ve{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Xi++}),this.uuid=be(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=cn.DEFAULT_UP.clone();const t=new ri,e=new Wi,i=new si,n=new ri(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 Ni},normalMatrix:{value:new ke}}),this.matrix=new Ni,this.matrixWorld=new Ni,this.matrixAutoUpdate=cn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=cn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new qi,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}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 Yi.setFromAxisAngle(t,e),this.quaternion.multiply(Yi),this}rotateOnWorldAxis(t,e){return Yi.setFromAxisAngle(t,e),this.quaternion.premultiply(Yi),this}rotateX(t){return this.rotateOnAxis(en,t)}rotateY(t){return this.rotateOnAxis(nn,t)}rotateZ(t){return this.rotateOnAxis(sn,t)}translateOnAxis(t,e){return Zi.copy(t).applyQuaternion(this.quaternion),this.position.add(Zi.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(en,t)}translateY(t){return this.translateOnAxis(nn,t)}translateZ(t){return this.translateOnAxis(sn,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Ji.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?Ki.copy(t):Ki.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),$i.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ji.lookAt($i,Ki,this.up):Ji.lookAt(Ki,$i,this.up),this.quaternion.setFromRotationMatrix(Ji),n&&(Ji.extractRotation(n.matrixWorld),Yi.setFromRotationMatrix(Ji),this.quaternion.premultiply(Yi.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?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(rn),on.child=t,this.dispatchEvent(on),on.child=null):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(an),ln.child=t,this.dispatchEvent(ln),ln.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Ji.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Ji.multiply(t.parent.matrixWorld)),t.applyMatrix4(Ji),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(rn),on.child=t,this.dispatchEvent(on),on.child=null,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,i=[]){this[t]===e&&i.push(this);const n=this.children;for(let s=0,r=n.length;s<r;s++)n[s].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose($i,t,Qi),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose($i,tn,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)&&(!0===this.matrixWorldAutoUpdate&&(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++){e[i].updateMatrixWorld(t)}}updateWorldMatrix(t,e){const i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(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++){t[e].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.6,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.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.visibility=this._visibility,n.active=this._active,n.bounds=this._bounds.map((t=>({boxInitialized:t.boxInitialized,boxMin:t.box.min.toArray(),boxMax:t.box.max.toArray(),sphereInitialized:t.sphereInitialized,sphereRadius:t.sphere.radius,sphereCenter:t.sphere.center.toArray()}))),n.maxInstanceCount=this._maxInstanceCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.geometryCount=this._geometryCount,n.matricesTexture=this._matricesTexture.toJSON(t),null!==this._colorsTexture&&(n.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(n.boundingSphere={center:n.boundingSphere.center.toArray(),radius:n.boundingSphere.radius}),null!==this.boundingBox&&(n.boundingBox={min:n.boundingBox.min.toArray(),max:n.boundingBox.max.toArray()})),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.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,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.animations=t.animations.slice(),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}}cn.DEFAULT_UP=new ri(0,1,0),cn.DEFAULT_MATRIX_AUTO_UPDATE=!0,cn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const hn=new ri,dn=new ri,un=new ri,pn=new ri,mn=new ri,fn=new ri,gn=new ri,vn=new ri,_n=new ri,yn=new ri;class xn{constructor(t=new ri,e=new ri,i=new ri){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,n){n.subVectors(i,e),hn.subVectors(t,e),n.cross(hn);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){hn.subVectors(n,e),dn.subVectors(i,e),un.subVectors(t,e);const r=hn.dot(hn),a=hn.dot(dn),o=hn.dot(un),l=dn.dot(dn),c=dn.dot(un),h=r*l-a*a;if(0===h)return s.set(0,0,0),null;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 null!==this.getBarycoord(t,e,i,n,pn)&&(pn.x>=0&&pn.y>=0&&pn.x+pn.y<=1)}static getInterpolation(t,e,i,n,s,r,a,o){return null===this.getBarycoord(t,e,i,n,pn)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(s,pn.x),o.addScaledVector(r,pn.y),o.addScaledVector(a,pn.z),o)}static isFrontFacing(t,e,i,n){return hn.subVectors(i,e),dn.subVectors(t,e),hn.cross(dn).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 hn.subVectors(this.c,this.b),dn.subVectors(this.a,this.b),.5*hn.cross(dn).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return xn.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return xn.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,n,s){return xn.getInterpolation(t,this.a,this.b,this.c,e,i,n,s)}containsPoint(t){return xn.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return xn.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;mn.subVectors(n,i),fn.subVectors(s,i),vn.subVectors(t,i);const o=mn.dot(vn),l=fn.dot(vn);if(o<=0&&l<=0)return e.copy(i);_n.subVectors(t,n);const c=mn.dot(_n),h=fn.dot(_n);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(mn,r);yn.subVectors(t,s);const u=mn.dot(yn),p=fn.dot(yn);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(fn,a);const f=c*p-u*h;if(f<=0&&h-c>=0&&u-p>=0)return gn.subVectors(s,n),a=(h-c)/(h-c+(u-p)),e.copy(n).addScaledVector(gn,a);const g=1/(f+m+d);return r=m*g,a=d*g,e.copy(i).addScaledVector(mn,r).addScaledVector(fn,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const wn={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},bn={h:0,s:0,l:0},Mn={h:0,s:0,l:0};function Sn(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 En{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(void 0===e&&void 0===i){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Qt){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Ge.toWorkingColorSpace(this,e),this}setRGB(t,e,i,n=Ge.workingColorSpace){return this.r=t,this.g=e,this.b=i,Ge.toWorkingColorSpace(this,n),this}setHSL(t,e,i,n=Ge.workingColorSpace){if(t=Se(t,1),e=Me(e,0,1),i=Me(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=Sn(s,n,t+1/3),this.g=Sn(s,n,t),this.b=Sn(s,n,t-1/3)}return Ge.toWorkingColorSpace(this,n),this}setStyle(t,e=Qt){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 i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,e);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,e);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))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,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=Qt){const i=wn[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=je(t.r),this.g=je(t.g),this.b=je(t.b),this}copyLinearToSRGB(t){return this.r=We(t.r),this.g=We(t.g),this.b=We(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Qt){return Ge.fromWorkingColorSpace(Tn.copy(this),t),65536*Math.round(Me(255*Tn.r,0,255))+256*Math.round(Me(255*Tn.g,0,255))+Math.round(Me(255*Tn.b,0,255))}getHexString(t=Qt){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Ge.workingColorSpace){Ge.fromWorkingColorSpace(Tn.copy(this),e);const i=Tn.r,n=Tn.g,s=Tn.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=Ge.workingColorSpace){return Ge.fromWorkingColorSpace(Tn.copy(this),e),t.r=Tn.r,t.g=Tn.g,t.b=Tn.b,t}getStyle(t=Qt){Ge.fromWorkingColorSpace(Tn.copy(this),t);const e=Tn.r,i=Tn.g,n=Tn.b;return t!==Qt?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*n)})`}offsetHSL(t,e,i){return this.getHSL(bn),this.setHSL(bn.h+t,bn.s+e,bn.l+i)}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(bn),t.getHSL(Mn);const i=Ee(bn.h,Mn.h,e),n=Ee(bn.s,Mn.s,e),s=Ee(bn.l,Mn.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 Tn=new En;En.NAMES=wn;let An=0;class Cn extends ve{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:An++}),this.uuid=be(),this.name="",this.type="Material",this.blending=1,this.side=o,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=h,this.blendDst=d,this.blendEquation=c,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new En(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=de,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=oe,this.stencilZFail=oe,this.stencilZPass=oe,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}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.6,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()),void 0!==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.dispersion&&(i.dispersion=this.dispersion),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),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.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.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),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!==o&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),this.blendSrc!==h&&(i.blendSrc=this.blendSrc),this.blendDst!==d&&(i.blendDst=this.blendDst),this.blendEquation!==c&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==de&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==oe&&(i.stencilFail=this.stencilFail),this.stencilZFail!==oe&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==oe&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),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.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!0===this.wireframe&&(i.wireframe=!0),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=!0),!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.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,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.alphaHash=t.alphaHash,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++}onBuild(){console.warn("Material: onBuild() has been removed.")}onBeforeRender(){console.warn("Material: onBeforeRender() has been removed.")}}class Ln extends Cn{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new En(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Wi,this.combine=u,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.envMapRotation.copy(t.envMapRotation),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 kn=Rn();function Rn(){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 Pn(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=Me(t,-65504,65504),kn.floatView[0]=t;const e=kn.uint32View[0],i=e>>23&511;return kn.baseTable[i]+((8388607&e)>>kn.shiftTable[i])}function In(t){const e=t>>10;return kn.uint32View[0]=kn.mantissaTable[kn.offsetTable[e]+(1023&t)]+kn.exponentTable[e],kn.floatView[0]}const Un={toHalfFloat:Pn,fromHalfFloat:In},Nn=new ri,Dn=new Le;class On{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=pe,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=q,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}get updateRange(){return Be("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}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.gpuType=t.gpuType,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++)Dn.fromBufferAttribute(this,e),Dn.applyMatrix3(t),this.setXY(e,Dn.x,Dn.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)Nn.fromBufferAttribute(this,e),Nn.applyMatrix3(t),this.setXYZ(e,Nn.x,Nn.y,Nn.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)Nn.fromBufferAttribute(this,e),Nn.applyMatrix4(t),this.setXYZ(e,Nn.x,Nn.y,Nn.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Nn.fromBufferAttribute(this,e),Nn.applyNormalMatrix(t),this.setXYZ(e,Nn.x,Nn.y,Nn.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Nn.fromBufferAttribute(this,e),Nn.transformDirection(t),this.setXYZ(e,Nn.x,Nn.y,Nn.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=Te(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=Ae(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Te(e,this.array)),e}setX(t,e){return this.normalized&&(e=Ae(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Te(e,this.array)),e}setY(t,e){return this.normalized&&(e=Ae(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=Te(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Ae(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=Te(e,this.array)),e}setW(t,e){return this.normalized&&(e=Ae(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=Ae(e,this.array),i=Ae(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=Ae(e,this.array),i=Ae(i,this.array),n=Ae(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=Ae(e,this.array),i=Ae(i,this.array),n=Ae(n,this.array),s=Ae(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!==pe&&(t.usage=this.usage),t}}class Bn extends On{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class Fn extends On{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class zn extends On{constructor(t,e,i){super(new Float32Array(t),e,i)}}let Hn=0;const Vn=new Ni,Gn=new cn,jn=new ri,Wn=new li,qn=new li,Xn=new ri;class Zn extends ve{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Hn++}),this.uuid=be(),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(Pe(t)?Fn:Bn)(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 ke).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 Vn.makeRotationFromQuaternion(t),this.applyMatrix4(Vn),this}rotateX(t){return Vn.makeRotationX(t),this.applyMatrix4(Vn),this}rotateY(t){return Vn.makeRotationY(t),this.applyMatrix4(Vn),this}rotateZ(t){return Vn.makeRotationZ(t),this.applyMatrix4(Vn),this}translate(t,e,i){return Vn.makeTranslation(t,e,i),this.applyMatrix4(Vn),this}scale(t,e,i){return Vn.makeScale(t,e,i),this.applyMatrix4(Vn),this}lookAt(t){return Gn.lookAt(t),Gn.updateMatrix(),this.applyMatrix4(Gn.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(jn).negate(),this.translate(jn.x,jn.y,jn.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 zn(e,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new li);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.",this),void this.boundingBox.set(new ri(-1/0,-1/0,-1/0),new ri(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];Wn.setFromBufferAttribute(i),this.morphTargetsRelative?(Xn.addVectors(this.boundingBox.min,Wn.min),this.boundingBox.expandByPoint(Xn),Xn.addVectors(this.boundingBox.max,Wn.max),this.boundingBox.expandByPoint(Xn)):(this.boundingBox.expandByPoint(Wn.min),this.boundingBox.expandByPoint(Wn.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 Ti);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.",this),void this.boundingSphere.set(new ri,1/0);if(t){const i=this.boundingSphere.center;if(Wn.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];qn.setFromBufferAttribute(i),this.morphTargetsRelative?(Xn.addVectors(Wn.min,qn.min),Wn.expandByPoint(Xn),Xn.addVectors(Wn.max,qn.max),Wn.expandByPoint(Xn)):(Wn.expandByPoint(qn.min),Wn.expandByPoint(qn.max))}Wn.getCenter(i);let n=0;for(let e=0,s=t.count;e<s;e++)Xn.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(Xn));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++)Xn.fromBufferAttribute(r,e),a&&(jn.fromBufferAttribute(t,e),Xn.add(jn)),n=Math.max(n,i.distanceToSquared(Xn))}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=e.position,n=e.normal,s=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new On(new Float32Array(4*i.count),4));const r=this.getAttribute("tangent"),a=[],o=[];for(let t=0;t<i.count;t++)a[t]=new ri,o[t]=new ri;const l=new ri,c=new ri,h=new ri,d=new Le,u=new Le,p=new Le,m=new ri,f=new ri;function g(t,e,n){l.fromBufferAttribute(i,t),c.fromBufferAttribute(i,e),h.fromBufferAttribute(i,n),d.fromBufferAttribute(s,t),u.fromBufferAttribute(s,e),p.fromBufferAttribute(s,n),c.sub(l),h.sub(l),u.sub(d),p.sub(d);const r=1/(u.x*p.y-p.x*u.y);isFinite(r)&&(m.copy(c).multiplyScalar(p.y).addScaledVector(h,-u.y).multiplyScalar(r),f.copy(h).multiplyScalar(u.x).addScaledVector(c,-p.x).multiplyScalar(r),a[t].add(m),a[e].add(m),a[n].add(m),o[t].add(f),o[e].add(f),o[n].add(f))}let v=this.groups;0===v.length&&(v=[{start:0,count:t.count}]);for(let e=0,i=v.length;e<i;++e){const i=v[e],n=i.start;for(let e=n,s=n+i.count;e<s;e+=3)g(t.getX(e+0),t.getX(e+1),t.getX(e+2))}const _=new ri,y=new ri,x=new ri,w=new ri;function b(t){x.fromBufferAttribute(n,t),w.copy(x);const e=a[t];_.copy(e),_.sub(x.multiplyScalar(x.dot(e))).normalize(),y.crossVectors(w,e);const i=y.dot(o[t])<0?-1:1;r.setXYZW(t,_.x,_.y,_.z,i)}for(let e=0,i=v.length;e<i;++e){const i=v[e],n=i.start;for(let e=n,s=n+i.count;e<s;e+=3)b(t.getX(e+0)),b(t.getX(e+1)),b(t.getX(e+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 On(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 ri,s=new ri,r=new ri,a=new ri,o=new ri,l=new ri,c=new ri,h=new ri;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}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Xn.fromBufferAttribute(t,e),Xn.normalize(),t.setXYZ(e,Xn.x,Xn.y,Xn.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 On(r,n,s)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Zn,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.6,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 Yn=new Ni,Jn=new Ui,Kn=new Ti,$n=new ri,Qn=new ri,ts=new ri,es=new ri,is=new ri,ns=new ri,ss=new Le,rs=new Le,as=new Le,os=new ri,ls=new ri,cs=new ri,hs=new ri,ds=new ri;class us extends cn{constructor(t=new Zn,e=new Ln){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=Array.isArray(t.material)?t.material.slice():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){ns.set(0,0,0);for(let i=0,n=s.length;i<n;i++){const n=a[i],o=s[i];0!==n&&(is.fromBufferAttribute(o,t),r?ns.addScaledVector(is,n):ns.addScaledVector(is.sub(e),n))}e.add(ns)}return e}raycast(t,e){const i=this.geometry,n=this.material,s=this.matrixWorld;if(void 0!==n){if(null===i.boundingSphere&&i.computeBoundingSphere(),Kn.copy(i.boundingSphere),Kn.applyMatrix4(s),Jn.copy(t.ray).recast(t.near),!1===Kn.containsPoint(Jn.origin)){if(null===Jn.intersectSphere(Kn,$n))return;if(Jn.origin.distanceToSquared($n)>(t.far-t.near)**2)return}Yn.copy(s).invert(),Jn.copy(t.ray).applyMatrix4(Yn),null!==i.boundingBox&&!1===Jn.intersectsBox(i.boundingBox)||this._computeIntersections(t,e,Jn)}}_computeIntersections(t,e,i){let n;const s=this.geometry,r=this.material,a=s.index,o=s.attributes.position,l=s.attributes.uv,c=s.attributes.uv1,h=s.attributes.normal,d=s.groups,u=s.drawRange;if(null!==a)if(Array.isArray(r))for(let s=0,o=d.length;s<o;s++){const o=d[s],p=r[o.materialIndex];for(let s=Math.max(o.start,u.start),r=Math.min(a.count,Math.min(o.start+o.count,u.start+u.count));s<r;s+=3){n=ps(this,p,t,i,l,c,h,a.getX(s),a.getX(s+1),a.getX(s+2)),n&&(n.faceIndex=Math.floor(s/3),n.face.materialIndex=o.materialIndex,e.push(n))}}else{for(let s=Math.max(0,u.start),o=Math.min(a.count,u.start+u.count);s<o;s+=3){n=ps(this,r,t,i,l,c,h,a.getX(s),a.getX(s+1),a.getX(s+2)),n&&(n.faceIndex=Math.floor(s/3),e.push(n))}}else if(void 0!==o)if(Array.isArray(r))for(let s=0,a=d.length;s<a;s++){const a=d[s],p=r[a.materialIndex];for(let s=Math.max(a.start,u.start),r=Math.min(o.count,Math.min(a.start+a.count,u.start+u.count));s<r;s+=3){n=ps(this,p,t,i,l,c,h,s,s+1,s+2),n&&(n.faceIndex=Math.floor(s/3),n.face.materialIndex=a.materialIndex,e.push(n))}}else{for(let s=Math.max(0,u.start),a=Math.min(o.count,u.start+u.count);s<a;s+=3){n=ps(this,r,t,i,l,c,h,s,s+1,s+2),n&&(n.faceIndex=Math.floor(s/3),e.push(n))}}}}function ps(t,e,i,n,s,r,a,c,h,d){t.getVertexPosition(c,Qn),t.getVertexPosition(h,ts),t.getVertexPosition(d,es);const u=function(t,e,i,n,s,r,a,c){let h;if(h=e.side===l?n.intersectTriangle(a,r,s,!0,c):n.intersectTriangle(s,r,a,e.side===o,c),null===h)return null;ds.copy(c),ds.applyMatrix4(t.matrixWorld);const d=i.ray.origin.distanceTo(ds);return d<i.near||d>i.far?null:{distance:d,point:ds.clone(),object:t}}(t,e,i,n,Qn,ts,es,hs);if(u){s&&(ss.fromBufferAttribute(s,c),rs.fromBufferAttribute(s,h),as.fromBufferAttribute(s,d),u.uv=xn.getInterpolation(hs,Qn,ts,es,ss,rs,as,new Le)),r&&(ss.fromBufferAttribute(r,c),rs.fromBufferAttribute(r,h),as.fromBufferAttribute(r,d),u.uv1=xn.getInterpolation(hs,Qn,ts,es,ss,rs,as,new Le)),a&&(os.fromBufferAttribute(a,c),ls.fromBufferAttribute(a,h),cs.fromBufferAttribute(a,d),u.normal=xn.getInterpolation(hs,Qn,ts,es,os,ls,cs,new ri),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const t={a:c,b:h,c:d,normal:new ri,materialIndex:0};xn.getNormal(Qn,ts,es,t.normal),u.face=t}return u}class ms extends Zn{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,w=p/2,b=m/2,M=f+1,S=g+1;let E=0,T=0;const A=new ri;for(let r=0;r<S;r++){const a=r*y-w;for(let o=0;o<M;o++){const d=o*_-x;A[t]=d*n,A[e]=a*s,A[i]=b,l.push(A.x,A.y,A.z),A[t]=0,A[e]=0,A[i]=m>0?1:-1,c.push(A.x,A.y,A.z),h.push(o/f),h.push(1-r/g),E+=1}}for(let t=0;t<g;t++)for(let e=0;e<f;e++){const i=d+e+M*t,n=d+e+M*(t+1),s=d+(e+1)+M*(t+1),r=d+(e+1)+M*t;o.push(i,n,r),o.push(n,s,r),T+=6}a.addGroup(u,T,v),u+=T,d+=E}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 zn(l,3)),this.setAttribute("normal",new zn(c,3)),this.setAttribute("uv",new zn(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ms(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function fs(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 gs(t){const e={};for(let i=0;i<t.length;i++){const n=fs(t[i]);for(const t in n)e[t]=n[t]}return e}function vs(t){const e=t.getRenderTarget();return null===e?t.outputColorSpace:!0===e.isXRRenderTarget?e.texture.colorSpace:Ge.workingColorSpace}const _s={clone:fs,merge:gs};class ys extends Cn{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={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=fs(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,e.lights=this.lights,e.clipping=this.clipping;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}}let xs=class extends cn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ni,this.projectionMatrix=new Ni,this.projectionMatrixInverse=new Ni,this.coordinateSystem=fe}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}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)}};const ws=new ri,bs=new Le,Ms=new Le;class Ss extends xs{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*we*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*xe*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*we*Math.atan(Math.tan(.5*xe*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,i){ws.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(ws.x,ws.y).multiplyScalar(-t/ws.z),ws.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(ws.x,ws.y).multiplyScalar(-t/ws.z)}getViewSize(t,e){return this.getViewBounds(t,bs,Ms),e.subVectors(Ms,bs)}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*xe*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.coordinateSystem),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 Es=-90;class Ts extends cn{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const n=new Ss(Es,1,t,e);n.layers=this.layers,this.add(n);const s=new Ss(Es,1,t,e);s.layers=this.layers,this.add(s);const r=new Ss(Es,1,t,e);r.layers=this.layers,this.add(r);const a=new Ss(Es,1,t,e);a.layers=this.layers,this.add(a);const o=new Ss(Es,1,t,e);o.layers=this.layers,this.add(o);const l=new Ss(Es,1,t,e);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[i,n,s,r,a,o]=e;for(const t of e)this.remove(t);if(t===fe)i.up.set(0,1,0),i.lookAt(1,0,0),n.up.set(0,1,0),n.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),r.up.set(0,0,1),r.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(t!==ge)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);i.up.set(0,-1,0),i.lookAt(-1,0,0),n.up.set(0,-1,0),n.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),r.up.set(0,0,-1),r.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:n}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[s,r,a,o,l,c]=this.children,h=t.getRenderTarget(),d=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;const m=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,t.setRenderTarget(i,0,n),t.render(e,s),t.setRenderTarget(i,1,n),t.render(e,r),t.setRenderTarget(i,2,n),t.render(e,a),t.setRenderTarget(i,3,n),t.render(e,o),t.setRenderTarget(i,4,n),t.render(e,l),i.texture.generateMipmaps=m,t.setRenderTarget(i,5,n),t.render(e,c),t.setRenderTarget(h,d,u),t.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class As extends $e{constructor(t,e,i,n,s,r,a,o,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:T,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 Cs extends ei{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 As(n,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:O}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,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 ms(5,5,5),s=new ys({name:"CubemapFromEquirect",uniforms:fs(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:l,blending:0});s.uniforms.tEquirect.value=e;const r=new us(n,s),a=e.minFilter;e.minFilter===F&&(e.minFilter=O);return new Ts(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 Ls=new ri,ks=new ri,Rs=new ke;class Ps{constructor(t=new ri(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=Ls.subVectors(i,e).cross(ks.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(Ls),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||Rs.getNormalMatrix(t),n=this.coplanarPoint(Ls).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 Is=new Ti,Us=new ri;class Ns{constructor(t=new Ps,e=new Ps,i=new Ps,n=new Ps,s=new Ps,r=new Ps){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,e=2e3){const i=this.planes,n=t.elements,s=n[0],r=n[1],a=n[2],o=n[3],l=n[4],c=n[5],h=n[6],d=n[7],u=n[8],p=n[9],m=n[10],f=n[11],g=n[12],v=n[13],_=n[14],y=n[15];if(i[0].setComponents(o-s,d-l,f-u,y-g).normalize(),i[1].setComponents(o+s,d+l,f+u,y+g).normalize(),i[2].setComponents(o+r,d+c,f+p,y+v).normalize(),i[3].setComponents(o-r,d-c,f-p,y-v).normalize(),i[4].setComponents(o-a,d-h,f-m,y-_).normalize(),e===fe)i[5].setComponents(o+a,d+h,f+m,y+_).normalize();else{if(e!==ge)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);i[5].setComponents(a,h,m,_).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),Is.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),Is.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Is)}intersectsSprite(t){return Is.center.set(0,0,0),Is.radius=.7071067811865476,Is.applyMatrix4(t.matrixWorld),this.intersectsSphere(Is)}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(Us.x=n.normal.x>0?t.max.x:t.min.x,Us.y=n.normal.y>0?t.max.y:t.min.y,Us.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(Us)<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 Ds(){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 Os(t){const e=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)},remove:function(i){i.isInterleavedBufferAttribute&&(i=i.data);const n=e.get(i);n&&(t.deleteBuffer(n.buffer),e.delete(i))},update:function(i,n){if(i.isGLBufferAttribute){const t=e.get(i);return void((!t||t.version<i.version)&&e.set(i,{buffer:i.buffer,type:i.type,bytesPerElement:i.elementSize,version:i.version}))}i.isInterleavedBufferAttribute&&(i=i.data);const s=e.get(i);if(void 0===s)e.set(i,function(e,i){const n=e.array,s=e.usage,r=n.byteLength,a=t.createBuffer();let o;if(t.bindBuffer(i,a),t.bufferData(i,n,s),e.onUploadCallback(),n instanceof Float32Array)o=t.FLOAT;else if(n instanceof Uint16Array)o=e.isFloat16BufferAttribute?t.HALF_FLOAT:t.UNSIGNED_SHORT;else if(n instanceof Int16Array)o=t.SHORT;else if(n instanceof Uint32Array)o=t.UNSIGNED_INT;else if(n instanceof Int32Array)o=t.INT;else if(n instanceof Int8Array)o=t.BYTE;else if(n instanceof Uint8Array)o=t.UNSIGNED_BYTE;else{if(!(n instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+n);o=t.UNSIGNED_BYTE}return{buffer:a,type:o,bytesPerElement:n.BYTES_PER_ELEMENT,version:e.version,size:r}}(i,n));else if(s.version<i.version){if(s.size!==i.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(e,i,n){const s=i.array,r=i._updateRange,a=i.updateRanges;if(t.bindBuffer(n,e),-1===r.count&&0===a.length&&t.bufferSubData(n,0,s),0!==a.length){for(let e=0,i=a.length;e<i;e++){const i=a[e];t.bufferSubData(n,i.start*s.BYTES_PER_ELEMENT,s,i.start,i.count)}i.clearUpdateRanges()}-1!==r.count&&(t.bufferSubData(n,r.offset*s.BYTES_PER_ELEMENT,s,r.offset,r.count),r.count=-1),i.onUploadCallback()}(s.buffer,i,n),s.version=i.version}}}}class Bs extends Zn{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 zn(p,3)),this.setAttribute("normal",new zn(m,3)),this.setAttribute("uv",new zn(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Bs(t.width,t.height,t.widthSegments,t.heightSegments)}}const Fs={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\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_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = 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\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\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_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 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}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * 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 <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},zs={common:{diffuse:{value:new En(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ke},alphaMap:{value:null},alphaMapTransform:{value:new ke},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ke}},envmap:{envMap:{value:null},envMapRotation:{value:new ke},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ke}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ke}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ke},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ke},normalScale:{value:new Le(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ke},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ke}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ke}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ke}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new En(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new En(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ke},alphaTest:{value:0},uvTransform:{value:new ke}},sprite:{diffuse:{value:new En(16777215)},opacity:{value:1},center:{value:new Le(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ke},alphaMap:{value:null},alphaMapTransform:{value:new ke},alphaTest:{value:0}}},Hs={basic:{uniforms:gs([zs.common,zs.specularmap,zs.envmap,zs.aomap,zs.lightmap,zs.fog]),vertexShader:Fs.meshbasic_vert,fragmentShader:Fs.meshbasic_frag},lambert:{uniforms:gs([zs.common,zs.specularmap,zs.envmap,zs.aomap,zs.lightmap,zs.emissivemap,zs.bumpmap,zs.normalmap,zs.displacementmap,zs.fog,zs.lights,{emissive:{value:new En(0)}}]),vertexShader:Fs.meshlambert_vert,fragmentShader:Fs.meshlambert_frag},phong:{uniforms:gs([zs.common,zs.specularmap,zs.envmap,zs.aomap,zs.lightmap,zs.emissivemap,zs.bumpmap,zs.normalmap,zs.displacementmap,zs.fog,zs.lights,{emissive:{value:new En(0)},specular:{value:new En(1118481)},shininess:{value:30}}]),vertexShader:Fs.meshphong_vert,fragmentShader:Fs.meshphong_frag},standard:{uniforms:gs([zs.common,zs.envmap,zs.aomap,zs.lightmap,zs.emissivemap,zs.bumpmap,zs.normalmap,zs.displacementmap,zs.roughnessmap,zs.metalnessmap,zs.fog,zs.lights,{emissive:{value:new En(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Fs.meshphysical_vert,fragmentShader:Fs.meshphysical_frag},toon:{uniforms:gs([zs.common,zs.aomap,zs.lightmap,zs.emissivemap,zs.bumpmap,zs.normalmap,zs.displacementmap,zs.gradientmap,zs.fog,zs.lights,{emissive:{value:new En(0)}}]),vertexShader:Fs.meshtoon_vert,fragmentShader:Fs.meshtoon_frag},matcap:{uniforms:gs([zs.common,zs.bumpmap,zs.normalmap,zs.displacementmap,zs.fog,{matcap:{value:null}}]),vertexShader:Fs.meshmatcap_vert,fragmentShader:Fs.meshmatcap_frag},points:{uniforms:gs([zs.points,zs.fog]),vertexShader:Fs.points_vert,fragmentShader:Fs.points_frag},dashed:{uniforms:gs([zs.common,zs.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Fs.linedashed_vert,fragmentShader:Fs.linedashed_frag},depth:{uniforms:gs([zs.common,zs.displacementmap]),vertexShader:Fs.depth_vert,fragmentShader:Fs.depth_frag},normal:{uniforms:gs([zs.common,zs.bumpmap,zs.normalmap,zs.displacementmap,{opacity:{value:1}}]),vertexShader:Fs.meshnormal_vert,fragmentShader:Fs.meshnormal_frag},sprite:{uniforms:gs([zs.sprite,zs.fog]),vertexShader:Fs.sprite_vert,fragmentShader:Fs.sprite_frag},background:{uniforms:{uvTransform:{value:new ke},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Fs.background_vert,fragmentShader:Fs.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ke}},vertexShader:Fs.backgroundCube_vert,fragmentShader:Fs.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Fs.cube_vert,fragmentShader:Fs.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Fs.equirect_vert,fragmentShader:Fs.equirect_frag},distanceRGBA:{uniforms:gs([zs.common,zs.displacementmap,{referencePosition:{value:new ri},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Fs.distanceRGBA_vert,fragmentShader:Fs.distanceRGBA_frag},shadow:{uniforms:gs([zs.lights,zs.fog,{color:{value:new En(0)},opacity:{value:1}}]),vertexShader:Fs.shadow_vert,fragmentShader:Fs.shadow_frag}};Hs.physical={uniforms:gs([Hs.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ke},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ke},clearcoatNormalScale:{value:new Le(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ke},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ke},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ke},sheen:{value:0},sheenColor:{value:new En(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ke},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ke},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ke},transmissionSamplerSize:{value:new Le},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ke},attenuationDistance:{value:0},attenuationColor:{value:new En(0)},specularColor:{value:new En(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ke},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ke},anisotropyVector:{value:new Le},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ke}}]),vertexShader:Fs.meshphysical_vert,fragmentShader:Fs.meshphysical_frag};const Vs={r:0,b:0,g:0},Gs=new Wi,js=new Ni;function Ws(t,e,i,n,s,r,a){const c=new En(0);let h,d,u=!0===r?0:1,p=null,m=0,f=null;function g(t){let n=!0===t.isScene?t.background:null;if(n&&n.isTexture){n=(t.backgroundBlurriness>0?i:e).get(n)}return n}function v(e,i){e.getRGB(Vs,vs(t)),n.buffers.color.setClear(Vs.r,Vs.g,Vs.b,i,a)}return{getClearColor:function(){return c},setClearColor:function(t,e=1){c.set(t),u=e,v(c,u)},getClearAlpha:function(){return u},setClearAlpha:function(t){u=t,v(c,u)},render:function(e){let i=!1;const s=g(e);null===s?v(c,u):s&&s.isColor&&(v(s,1),i=!0);const r=t.xr.getEnvironmentBlendMode();"additive"===r?n.buffers.color.setClear(0,0,0,1,a):"alpha-blend"===r&&n.buffers.color.setClear(0,0,0,0,a),(t.autoClear||i)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))},addToRenderList:function(e,i){const n=g(i);n&&(n.isCubeTexture||n.mapping===k)?(void 0===d&&(d=new us(new ms(1,1,1),new ys({name:"BackgroundCubeMaterial",uniforms:fs(Hs.backgroundCube.uniforms),vertexShader:Hs.backgroundCube.vertexShader,fragmentShader:Hs.backgroundCube.fragmentShader,side:l,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)),Gs.copy(i.backgroundRotation),Gs.x*=-1,Gs.y*=-1,Gs.z*=-1,n.isCubeTexture&&!1===n.isRenderTargetTexture&&(Gs.y*=-1,Gs.z*=-1),d.material.uniforms.envMap.value=n,d.material.uniforms.flipEnvMap.value=n.isCubeTexture&&!1===n.isRenderTargetTexture?-1:1,d.material.uniforms.backgroundBlurriness.value=i.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(js.makeRotationFromEuler(Gs)),d.material.toneMapped=Ge.getTransfer(n.colorSpace)!==se,p===n&&m===n.version&&f===t.toneMapping||(d.material.needsUpdate=!0,p=n,m=n.version,f=t.toneMapping),d.layers.enableAll(),e.unshift(d,d.geometry,d.material,0,0,null)):n&&n.isTexture&&(void 0===h&&(h=new us(new Bs(2,2),new ys({name:"BackgroundMaterial",uniforms:fs(Hs.background.uniforms),vertexShader:Hs.background.vertexShader,fragmentShader:Hs.background.fragmentShader,side:o,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=n,h.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,h.material.toneMapped=Ge.getTransfer(n.colorSpace)!==se,!0===n.matrixAutoUpdate&&n.updateMatrix(),h.material.uniforms.uvTransform.value.copy(n.matrix),p===n&&m===n.version&&f===t.toneMapping||(h.material.needsUpdate=!0,p=n,m=n.version,f=t.toneMapping),h.layers.enableAll(),e.unshift(h,h.geometry,h.material,0,0,null))}}}function qs(t,e){const i=t.getParameter(t.MAX_VERTEX_ATTRIBS),n={},s=c(null);let r=s,a=!1;function o(e){return t.bindVertexArray(e)}function l(e){return t.deleteVertexArray(e)}function c(t){const e=[],n=[],s=[];for(let t=0;t<i;t++)e[t]=0,n[t]=0,s[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:s,object:t,attributes:{},index:null}}function h(){const t=r.newAttributes;for(let e=0,i=t.length;e<i;e++)t[e]=0}function d(t){u(t,0)}function u(e,i){const n=r.newAttributes,s=r.enabledAttributes,a=r.attributeDivisors;n[e]=1,0===s[e]&&(t.enableVertexAttribArray(e),s[e]=1),a[e]!==i&&(t.vertexAttribDivisor(e,i),a[e]=i)}function p(){const e=r.newAttributes,i=r.enabledAttributes;for(let n=0,s=i.length;n<s;n++)i[n]!==e[n]&&(t.disableVertexAttribArray(n),i[n]=0)}function m(e,i,n,s,r,a,o){!0===o?t.vertexAttribIPointer(e,i,n,r,a):t.vertexAttribPointer(e,i,n,s,r,a)}function f(){g(),a=!0,r!==s&&(r=s,o(r.object))}function g(){s.geometry=null,s.program=null,s.wireframe=!1}return{setup:function(i,s,l,f,g){let v=!1;const _=function(e,i,s){const r=!0===s.wireframe;let a=n[e.id];void 0===a&&(a={},n[e.id]=a);let o=a[i.id];void 0===o&&(o={},a[i.id]=o);let l=o[r];void 0===l&&(l=c(t.createVertexArray()),o[r]=l);return l}(f,l,s);r!==_&&(r=_,o(r.object)),v=function(t,e,i,n){const s=r.attributes,a=e.attributes;let o=0;const l=i.getAttributes();for(const e in l){if(l[e].location>=0){const i=s[e];let n=a[e];if(void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor)),void 0===i)return!0;if(i.attribute!==n)return!0;if(n&&i.data!==n.data)return!0;o++}}return r.attributesNum!==o||r.index!==n}(i,f,l,g),v&&function(t,e,i,n){const s={},a=e.attributes;let o=0;const l=i.getAttributes();for(const e in l){if(l[e].location>=0){let i=a[e];void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor));const n={};n.attribute=i,i&&i.data&&(n.data=i.data),s[e]=n,o++}}r.attributes=s,r.attributesNum=o,r.index=n}(i,f,l,g),null!==g&&e.update(g,t.ELEMENT_ARRAY_BUFFER),(v||a)&&(a=!1,function(i,n,s,r){h();const a=r.attributes,o=s.getAttributes(),l=n.defaultAttributeValues;for(const n in o){const s=o[n];if(s.location>=0){let o=a[n];if(void 0===o&&("instanceMatrix"===n&&i.instanceMatrix&&(o=i.instanceMatrix),"instanceColor"===n&&i.instanceColor&&(o=i.instanceColor)),void 0!==o){const n=o.normalized,a=o.itemSize,l=e.get(o);if(void 0===l)continue;const c=l.buffer,h=l.type,p=l.bytesPerElement,f=h===t.INT||h===t.UNSIGNED_INT||o.gpuType===j;if(o.isInterleavedBufferAttribute){const e=o.data,l=e.stride,g=o.offset;if(e.isInstancedInterleavedBuffer){for(let t=0;t<s.locationSize;t++)u(s.location+t,e.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===r._maxInstanceCount&&(r._maxInstanceCount=e.meshPerAttribute*e.count)}else for(let t=0;t<s.locationSize;t++)d(s.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<s.locationSize;t++)m(s.location+t,a/s.locationSize,h,n,l*p,(g+a/s.locationSize*t)*p,f)}else{if(o.isInstancedBufferAttribute){for(let t=0;t<s.locationSize;t++)u(s.location+t,o.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===r._maxInstanceCount&&(r._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let t=0;t<s.locationSize;t++)d(s.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<s.locationSize;t++)m(s.location+t,a/s.locationSize,h,n,a*p,a/s.locationSize*t*p,f)}}else if(void 0!==l){const e=l[n];if(void 0!==e)switch(e.length){case 2:t.vertexAttrib2fv(s.location,e);break;case 3:t.vertexAttrib3fv(s.location,e);break;case 4:t.vertexAttrib4fv(s.location,e);break;default:t.vertexAttrib1fv(s.location,e)}}}}p()}(i,s,l,f),null!==g&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(g).buffer))},reset:f,resetDefaultState:g,dispose:function(){f();for(const t in n){const e=n[t];for(const t in e){const i=e[t];for(const t in i)l(i[t].object),delete i[t];delete e[t]}delete n[t]}},releaseStatesOfGeometry:function(t){if(void 0===n[t.id])return;const e=n[t.id];for(const t in e){const i=e[t];for(const t in i)l(i[t].object),delete i[t];delete e[t]}delete n[t.id]},releaseStatesOfProgram:function(t){for(const e in n){const i=n[e];if(void 0===i[t.id])continue;const s=i[t.id];for(const t in s)l(s[t].object),delete s[t];delete i[t.id]}},initAttributes:h,enableAttribute:d,disableUnusedAttributes:p}}function Xs(t,e,i){let n;function s(e,s,r){0!==r&&(t.drawArraysInstanced(n,e,s,r),i.update(s,n,r))}this.setMode=function(t){n=t},this.render=function(e,s){t.drawArrays(n,e,s),i.update(s,n,1)},this.renderInstances=s,this.renderMultiDraw=function(t,s,r){if(0===r)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,t,0,s,0,r);let a=0;for(let t=0;t<r;t++)a+=s[t];i.update(a,n,1)},this.renderMultiDrawInstances=function(t,r,a,o){if(0===a)return;const l=e.get("WEBGL_multi_draw");if(null===l)for(let e=0;e<t.length;e++)s(t[e],r[e],o[e]);else{l.multiDrawArraysInstancedWEBGL(n,t,0,r,0,o,0,a);let e=0;for(let t=0;t<a;t++)e+=r[t];for(let t=0;t<o.length;t++)i.update(e,n,o[t])}}}function Zs(t,e,i,n){let s;function r(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=void 0!==i.precision?i.precision:"highp";const o=r(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=!0===i.logarithmicDepthBuffer,c=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==s)return s;if(!0===e.has("EXT_texture_filter_anisotropic")){const i=e.get("EXT_texture_filter_anisotropic");s=t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else s=0;return s},getMaxPrecision:r,textureFormatReadable:function(e){return e===tt||n.convert(e)===t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(i){const s=i===X&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(i!==z&&n.convert(i)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&i!==q&&!s)},precision:a,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxCubemapSize:t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:t.getParameter(t.MAX_VERTEX_ATTRIBS),maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:t.getParameter(t.MAX_VARYING_VECTORS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:t.getParameter(t.MAX_SAMPLES)}}function Ys(t){const e=this;let i=null,n=0,s=!1,r=!1;const a=new Ps,o=new ke,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 Js(t){let e=new WeakMap;function i(t,e){return e===C?t.mapping=T:e===L&&(t.mapping=A),t}function n(t){const i=t.target;i.removeEventListener("dispose",n);const s=e.get(i);void 0!==s&&(e.delete(i),s.dispose())}return{get:function(s){if(s&&s.isTexture){const r=s.mapping;if(r===C||r===L){if(e.has(s)){return i(e.get(s).texture,s.mapping)}{const r=s.image;if(r&&r.height>0){const a=new Cs(r.height);return a.fromEquirectangularTexture(t,s),e.set(s,a),s.addEventListener("dispose",n),i(a.texture,s.mapping)}return null}}}return s},dispose:function(){e=new WeakMap}}}class Ks extends xs{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.coordinateSystem),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 $s=[.125,.215,.35,.446,.526,.582],Qs=20,tr=new Ks,er=new En;let ir=null,nr=0,sr=0,rr=!1;const ar=(1+Math.sqrt(5))/2,or=1/ar,lr=[new ri(-ar,or,0),new ri(ar,or,0),new ri(-or,0,ar),new ri(or,0,ar),new ri(0,ar,-or),new ri(0,ar,or),new ri(-1,1,-1),new ri(1,1,-1),new ri(-1,1,1),new ri(1,1,1)];class cr{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){ir=this._renderer.getRenderTarget(),nr=this._renderer.getActiveCubeFace(),sr=this._renderer.getActiveMipmapLevel(),rr=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(t,i,n,s),e>0&&this._blur(s,0,0,e),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=pr(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=ur(),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(ir,nr,sr),this._renderer.xr.enabled=rr,t.scissorTest=!1,dr(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===T||t.mapping===A?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),ir=this._renderer.getRenderTarget(),nr=this._renderer.getActiveCubeFace(),sr=this._renderer.getActiveMipmapLevel(),rr=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=e||this._allocateTargets();return this._textureToCubeUV(t,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,i={magFilter:O,minFilter:O,generateMipmaps:!1,type:X,format:tt,colorSpace:te,depthBuffer:!1},n=hr(t,e,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=hr(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+$s.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=$s[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 Zn;x.setAttribute("position",new On(v,m)),x.setAttribute("uv",new On(_,f)),x.setAttribute("faceIndex",new On(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(Qs),s=new ri(0,1,0),r=new ys({name:"SphericalGaussianBlur",defines:{n:Qs,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:mr(),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 us(this._lodPlanes[0],t);this._renderer.compile(e,tr)}_sceneToCubeUV(t,e,i,n){const s=new Ss(90,1,e,i),r=[1,-1,1,1,1,1],a=[1,1,1,-1,-1,-1],o=this._renderer,c=o.autoClear,h=o.toneMapping;o.getClearColor(er),o.toneMapping=f,o.autoClear=!1;const d=new Ln({name:"PMREM.Background",side:l,depthWrite:!1,depthTest:!1}),u=new us(new ms,d);let p=!1;const m=t.background;m?m.isColor&&(d.color.copy(m),t.background=null,p=!0):(d.color.copy(er),p=!0);for(let e=0;e<6;e++){const i=e%3;0===i?(s.up.set(0,r[e],0),s.lookAt(a[e],0,0)):1===i?(s.up.set(0,0,r[e]),s.lookAt(0,a[e],0)):(s.up.set(0,r[e],0),s.lookAt(0,0,a[e]));const l=this._cubeSize;dr(n,i*l,e>2?l:0,l,l),o.setRenderTarget(n),p&&o.render(u,s),o.render(t,s)}u.geometry.dispose(),u.material.dispose(),o.toneMapping=h,o.autoClear=c,t.background=m}_textureToCubeUV(t,e){const i=this._renderer,n=t.mapping===T||t.mapping===A;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=pr()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=ur());const s=n?this._cubemapMaterial:this._equirectMaterial,r=new us(this._lodPlanes[0],s);s.uniforms.envMap.value=t;const a=this._cubeSize;dr(e,0,0,3*a,2*a),i.setRenderTarget(e),i.render(r,tr)}_applyPMREM(t){const e=this._renderer,i=e.autoClear;e.autoClear=!1;const n=this._lodPlanes.length;for(let e=1;e<n;e++){const i=Math.sqrt(this._sigmas[e]*this._sigmas[e]-this._sigmas[e-1]*this._sigmas[e-1]),s=lr[(n-e-1)%lr.length];this._blur(t,e-1,e,i,s)}e.autoClear=i}_blur(t,e,i,n,s){const r=this._pingPongRenderTarget;this._halfBlur(t,r,e,i,n,"latitudinal",s),this._halfBlur(r,t,i,i,n,"longitudinal",s)}_halfBlur(t,e,i,n,s,r,a){const o=this._renderer,l=this._blurMaterial;"latitudinal"!==r&&"longitudinal"!==r&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new us(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):Qs;m>Qs&&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<Qs;++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];dr(e,3*_*(n>v-4?n-v+4:0),4*(this._cubeSize-_),3*_,2*_),o.setRenderTarget(e),o.render(c,tr)}}function hr(t,e,i){const n=new ei(t,e,i);return n.texture.mapping=k,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function dr(t,e,i,n,s){t.viewport.set(e,i,n,s),t.scissor.set(e,i,n,s)}function ur(){return new ys({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:mr(),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 pr(){return new ys({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:mr(),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 mr(){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 fr(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===C||r===L,o=r===T||r===A;if(a||o){let r=e.get(s);const l=void 0!==r?r.texture.pmremVersion:0;if(s.isRenderTargetTexture&&s.pmremVersion!==l)return null===i&&(i=new cr(t)),r=a?i.fromEquirectangular(s,r):i.fromCubemap(s,r),r.texture.pmremVersion=s.pmremVersion,e.set(s,r),r.texture;if(void 0!==r)return r.texture;{const l=s.image;return a&&l&&l.height>0||o&&l&&function(t){let e=0;const i=6;for(let n=0;n<i;n++)void 0!==t[n]&&e++;return e===i}(l)?(null===i&&(i=new cr(t)),r=a?i.fromEquirectangular(s):i.fromCubemap(s),r.texture.pmremVersion=s.pmremVersion,e.set(s,r),s.addEventListener("dispose",n),r.texture):null}}}return s},dispose:function(){e=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function gr(t){const e={};function i(i){if(void 0!==e[i])return e[i];let n;switch(i){case"WEBGL_depth_texture":n=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=t.getExtension(i)}return e[i]=n,n}return{has:function(t){return null!==i(t)},init:function(){i("EXT_color_buffer_float"),i("WEBGL_clip_cull_distance"),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture"),i("WEBGL_render_shared_exponent")},get:function(t){const e=i(t);return null===e&&Be("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function vr(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]);for(const t in o.morphAttributes){const i=o.morphAttributes[t];for(let t=0,n=i.length;t<n;t++)e.remove(i[t])}o.removeEventListener("dispose",a),delete s[o.id];const l=r.get(o);l&&(e.remove(l),r.delete(o)),n.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,i.memory.geometries--}function o(t){const i=[],n=t.index,s=t.attributes.position;let a=0;if(null!==n){const t=n.array;a=n.version;for(let e=0,n=t.length;e<n;e+=3){const n=t[e+0],s=t[e+1],r=t[e+2];i.push(n,s,s,r,r,n)}}else{if(void 0===s)return;{const t=s.array;a=s.version;for(let e=0,n=t.length/3-1;e<n;e+=3){const t=e+0,n=e+1,s=e+2;i.push(t,n,n,s,s,t)}}}const o=new(Pe(i)?Fn:Bn)(i,1);o.version=a;const l=r.get(t);l&&e.remove(l),r.set(t,o)}return{get:function(t,e){return!0===s[e.id]||(e.addEventListener("dispose",a),s[e.id]=!0,i.memory.geometries++),e},update:function(i){const n=i.attributes;for(const i in n)e.update(n[i],t.ARRAY_BUFFER);const s=i.morphAttributes;for(const i in s){const n=s[i];for(let i=0,s=n.length;i<s;i++)e.update(n[i],t.ARRAY_BUFFER)}},getWireframeAttribute:function(t){const e=r.get(t);if(e){const i=t.index;null!==i&&e.version<i.version&&o(t)}else o(t);return r.get(t)}}}function _r(t,e,i){let n,s,r;function a(e,a,o){0!==o&&(t.drawElementsInstanced(n,a,s,e*r,o),i.update(a,n,o))}this.setMode=function(t){n=t},this.setIndex=function(t){s=t.type,r=t.bytesPerElement},this.render=function(e,a){t.drawElements(n,a,s,e*r),i.update(a,n,1)},this.renderInstances=a,this.renderMultiDraw=function(t,r,a){if(0===a)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,r,0,s,t,0,a);let o=0;for(let t=0;t<a;t++)o+=r[t];i.update(o,n,1)},this.renderMultiDrawInstances=function(t,o,l,c){if(0===l)return;const h=e.get("WEBGL_multi_draw");if(null===h)for(let e=0;e<t.length;e++)a(t[e]/r,o[e],c[e]);else{h.multiDrawElementsInstancedWEBGL(n,o,0,s,t,0,c,0,l);let e=0;for(let t=0;t<l;t++)e+=o[t];for(let t=0;t<c.length;t++)i.update(e,n,c[t])}}}function yr(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(i,n,s){switch(e.calls++,n){case t.TRIANGLES:e.triangles+=s*(i/3);break;case t.LINES:e.lines+=s*(i/2);break;case t.LINE_STRIP:e.lines+=s*(i-1);break;case t.LINE_LOOP:e.lines+=s*i;break;case t.POINTS:e.points+=s*i;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function xr(t,e,i){const n=new WeakMap,s=new Qe;return{update:function(r,a,o){const l=r.morphTargetInfluences,c=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=void 0!==c?c.length:0;let d=n.get(a);if(void 0===d||d.count!==h){void 0!==d&&d.texture.dispose();const u=void 0!==a.morphAttributes.position,p=void 0!==a.morphAttributes.normal,m=void 0!==a.morphAttributes.color,f=a.morphAttributes.position||[],g=a.morphAttributes.normal||[],v=a.morphAttributes.color||[];let _=0;!0===u&&(_=1),!0===p&&(_=2),!0===m&&(_=3);let y=a.attributes.position.count*_,x=1;y>e.maxTextureSize&&(x=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const w=new Float32Array(y*x*4*h),b=new ii(w,y,x,h);b.type=q,b.needsUpdate=!0;const M=4*_;for(let E=0;E<h;E++){const T=f[E],A=g[E],C=v[E],L=y*x*4*E;for(let k=0;k<T.count;k++){const R=k*M;!0===u&&(s.fromBufferAttribute(T,k),w[L+R+0]=s.x,w[L+R+1]=s.y,w[L+R+2]=s.z,w[L+R+3]=0),!0===p&&(s.fromBufferAttribute(A,k),w[L+R+4]=s.x,w[L+R+5]=s.y,w[L+R+6]=s.z,w[L+R+7]=0),!0===m&&(s.fromBufferAttribute(C,k),w[L+R+8]=s.x,w[L+R+9]=s.y,w[L+R+10]=s.z,w[L+R+11]=4===C.itemSize?s.w:1)}}function S(){b.dispose(),n.delete(a),a.removeEventListener("dispose",S)}d={count:h,texture:b,size:new Le(y,x)},n.set(a,d),a.addEventListener("dispose",S)}if(!0===r.isInstancedMesh&&null!==r.morphTexture)o.getUniforms().setValue(t,"morphTexture",r.morphTexture,i);else{let P=0;for(let U=0;U<l.length;U++)P+=l[U];const I=a.morphTargetsRelative?1:1-P;o.getUniforms().setValue(t,"morphTargetBaseInfluence",I),o.getUniforms().setValue(t,"morphTargetInfluences",l)}o.getUniforms().setValue(t,"morphTargetsTexture",d.texture,i),o.getUniforms().setValue(t,"morphTargetsTextureSize",d.size)}}}function wr(t,e,i,n){let s=new WeakMap;function r(t){const e=t.target;e.removeEventListener("dispose",r),i.remove(e.instanceMatrix),null!==e.instanceColor&&i.remove(e.instanceColor)}return{update:function(a){const o=n.render.frame,l=a.geometry,c=e.get(a,l);if(s.get(c)!==o&&(e.update(c),s.set(c,o)),a.isInstancedMesh&&(!1===a.hasEventListener("dispose",r)&&a.addEventListener("dispose",r),s.get(a)!==o&&(i.update(a.instanceMatrix,t.ARRAY_BUFFER),null!==a.instanceColor&&i.update(a.instanceColor,t.ARRAY_BUFFER),s.set(a,o))),a.isSkinnedMesh){const t=a.skeleton;s.get(t)!==o&&(t.update(),s.set(t,o))}return c},dispose:function(){s=new WeakMap}}}class br extends $e{constructor(t,e,i,n,s,r,a,o,l,c=1026){if(c!==nt&&c!==st)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&c===nt&&(i=W),void 0===i&&c===st&&(i=J),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:U,this.minFilter=void 0!==o?o:U,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}const Mr=new $e,Sr=new br(1,1),Er=new ii,Tr=new ni,Ar=new As,Cr=[],Lr=[],kr=new Float32Array(16),Rr=new Float32Array(9),Pr=new Float32Array(4);function Ir(t,e,i){const n=t[0];if(n<=0||n>0)return t;const s=e*i;let r=Cr[s];if(void 0===r&&(r=new Float32Array(s),Cr[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 Ur(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 Nr(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function Dr(t,e){let i=Lr[e];void 0===i&&(i=new Int32Array(e),Lr[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function Or(t,e){const i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function Br(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(Ur(i,e))return;t.uniform2fv(this.addr,e),Nr(i,e)}}function Fr(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(Ur(i,e))return;t.uniform3fv(this.addr,e),Nr(i,e)}}function zr(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(Ur(i,e))return;t.uniform4fv(this.addr,e),Nr(i,e)}}function Hr(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Ur(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),Nr(i,e)}else{if(Ur(i,n))return;Pr.set(n),t.uniformMatrix2fv(this.addr,!1,Pr),Nr(i,n)}}function Vr(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Ur(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),Nr(i,e)}else{if(Ur(i,n))return;Rr.set(n),t.uniformMatrix3fv(this.addr,!1,Rr),Nr(i,n)}}function Gr(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Ur(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),Nr(i,e)}else{if(Ur(i,n))return;kr.set(n),t.uniformMatrix4fv(this.addr,!1,kr),Nr(i,n)}}function jr(t,e){const i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function Wr(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(Ur(i,e))return;t.uniform2iv(this.addr,e),Nr(i,e)}}function qr(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(Ur(i,e))return;t.uniform3iv(this.addr,e),Nr(i,e)}}function Xr(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(Ur(i,e))return;t.uniform4iv(this.addr,e),Nr(i,e)}}function Zr(t,e){const i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function Yr(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(Ur(i,e))return;t.uniform2uiv(this.addr,e),Nr(i,e)}}function Jr(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(Ur(i,e))return;t.uniform3uiv(this.addr,e),Nr(i,e)}}function Kr(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(Ur(i,e))return;t.uniform4uiv(this.addr,e),Nr(i,e)}}function $r(t,e,i){const n=this.cache,s=i.allocateTextureUnit();let r;n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),this.type===t.SAMPLER_2D_SHADOW?(Sr.compareFunction=ue,r=Sr):r=Mr,i.setTexture2D(e||r,s)}function Qr(t,e,i){const n=this.cache,s=i.allocateTextureUnit();n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),i.setTexture3D(e||Tr,s)}function ta(t,e,i){const n=this.cache,s=i.allocateTextureUnit();n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),i.setTextureCube(e||Ar,s)}function ea(t,e,i){const n=this.cache,s=i.allocateTextureUnit();n[0]!==s&&(t.uniform1i(this.addr,s),n[0]=s),i.setTexture2DArray(e||Er,s)}function ia(t,e){t.uniform1fv(this.addr,e)}function na(t,e){const i=Ir(e,this.size,2);t.uniform2fv(this.addr,i)}function sa(t,e){const i=Ir(e,this.size,3);t.uniform3fv(this.addr,i)}function ra(t,e){const i=Ir(e,this.size,4);t.uniform4fv(this.addr,i)}function aa(t,e){const i=Ir(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function oa(t,e){const i=Ir(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function la(t,e){const i=Ir(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function ca(t,e){t.uniform1iv(this.addr,e)}function ha(t,e){t.uniform2iv(this.addr,e)}function da(t,e){t.uniform3iv(this.addr,e)}function ua(t,e){t.uniform4iv(this.addr,e)}function pa(t,e){t.uniform1uiv(this.addr,e)}function ma(t,e){t.uniform2uiv(this.addr,e)}function fa(t,e){t.uniform3uiv(this.addr,e)}function ga(t,e){t.uniform4uiv(this.addr,e)}function va(t,e,i){const n=this.cache,s=e.length,r=Dr(i,s);Ur(n,r)||(t.uniform1iv(this.addr,r),Nr(n,r));for(let t=0;t!==s;++t)i.setTexture2D(e[t]||Mr,r[t])}function _a(t,e,i){const n=this.cache,s=e.length,r=Dr(i,s);Ur(n,r)||(t.uniform1iv(this.addr,r),Nr(n,r));for(let t=0;t!==s;++t)i.setTexture3D(e[t]||Tr,r[t])}function ya(t,e,i){const n=this.cache,s=e.length,r=Dr(i,s);Ur(n,r)||(t.uniform1iv(this.addr,r),Nr(n,r));for(let t=0;t!==s;++t)i.setTextureCube(e[t]||Ar,r[t])}function xa(t,e,i){const n=this.cache,s=e.length,r=Dr(i,s);Ur(n,r)||(t.uniform1iv(this.addr,r),Nr(n,r));for(let t=0;t!==s;++t)i.setTexture2DArray(e[t]||Er,r[t])}class wa{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.type=e.type,this.setValue=function(t){switch(t){case 5126:return Or;case 35664:return Br;case 35665:return Fr;case 35666:return zr;case 35674:return Hr;case 35675:return Vr;case 35676:return Gr;case 5124:case 35670:return jr;case 35667:case 35671:return Wr;case 35668:case 35672:return qr;case 35669:case 35673:return Xr;case 5125:return Zr;case 36294:return Yr;case 36295:return Jr;case 36296:return Kr;case 35678:case 36198:case 36298:case 36306:case 35682:return $r;case 35679:case 36299:case 36307:return Qr;case 35680:case 36300:case 36308:case 36293:return ta;case 36289:case 36303:case 36311:case 36292:return ea}}(e.type)}}class ba{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return ia;case 35664:return na;case 35665:return sa;case 35666:return ra;case 35674:return aa;case 35675:return oa;case 35676:return la;case 5124:case 35670:return ca;case 35667:case 35671:return ha;case 35668:case 35672:return da;case 35669:case 35673:return ua;case 5125:return pa;case 36294:return ma;case 36295:return fa;case 36296:return ga;case 35678:case 36198:case 36298:case 36306:case 35682:return va;case 35679:case 36299:case 36307:return _a;case 35680:case 36300:case 36308:case 36293:return ya;case 36289:case 36303:case 36311:case 36292:return xa}}(e.type)}}class Ma{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 Sa=/(\w+)(\])?(\[|\.)?/g;function Ea(t,e){t.seq.push(e),t.map[e.id]=e}function Ta(t,e,i){const n=t.name,s=n.length;for(Sa.lastIndex=0;;){const r=Sa.exec(n),a=Sa.lastIndex;let o=r[1];const l="]"===r[2],c=r[3];if(l&&(o|=0),void 0===c||"["===c&&a+2===s){Ea(i,void 0===c?new wa(o,t,e):new ba(o,t,e));break}{let t=i.map[o];void 0===t&&(t=new Ma(o),Ea(i,t)),i=t}}}class Aa{constructor(t,e){this.seq=[],this.map={};const i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let n=0;n<i;++n){const i=t.getActiveUniform(e,n);Ta(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 Ca(t,e,i){const n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}const La=37297;let ka=0;function Ra(t,e,i){const n=t.getShaderParameter(e,t.COMPILE_STATUS),s=t.getShaderInfoLog(e).trim();if(n&&""===s)return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const n=parseInt(r[1]);return i.toUpperCase()+"\n\n"+s+"\n\n"+function(t,e){const i=t.split("\n"),n=[],s=Math.max(e-6,0),r=Math.min(e+6,i.length);for(let t=s;t<r;t++){const s=t+1;n.push(`${s===e?">":" "} ${s}: ${i[t]}`)}return n.join("\n")}(t.getShaderSource(e),n)}return s}function Pa(t,e){const i=function(t){const e=Ge.getPrimaries(Ge.workingColorSpace),i=Ge.getPrimaries(t);let n;switch(e===i?n="":e===ae&&i===re?n="LinearDisplayP3ToLinearSRGB":e===re&&i===ae&&(n="LinearSRGBToLinearDisplayP3"),t){case te:case ie:return[n,"LinearTransferOETF"];case Qt:case ee:return[n,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[n,"LinearTransferOETF"]}}(e);return`vec4 ${t}( vec4 value ) { return ${i[0]}( ${i[1]}( value ) ); }`}function Ia(t,e){let i;switch(e){case g:i="Linear";break;case v:i="Reinhard";break;case _:i="OptimizedCineon";break;case y:i="ACESFilmic";break;case w:i="AgX";break;case b:i="Neutral";break;case x:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),i="Linear"}return"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}function Ua(t){return""!==t}function Na(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 Da(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Oa=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ba(t){return t.replace(Oa,za)}const Fa=new Map;function za(t,e){let i=Fs[e];if(void 0===i){const t=Fa.get(e);if(void 0===t)throw new Error("Can not resolve #include <"+e+">");i=Fs[t],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,t)}return Ba(i)}const Ha=/#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 Va(t){return t.replace(Ha,Ga)}function Ga(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 ja(t){let e=`precision ${t.precision} float;\n\tprecision ${t.precision} int;\n\tprecision ${t.precision} sampler2D;\n\tprecision ${t.precision} samplerCube;\n\tprecision ${t.precision} sampler3D;\n\tprecision ${t.precision} sampler2DArray;\n\tprecision ${t.precision} sampler2DShadow;\n\tprecision ${t.precision} samplerCubeShadow;\n\tprecision ${t.precision} sampler2DArrayShadow;\n\tprecision ${t.precision} isampler2D;\n\tprecision ${t.precision} isampler3D;\n\tprecision ${t.precision} isamplerCube;\n\tprecision ${t.precision} isampler2DArray;\n\tprecision ${t.precision} usampler2D;\n\tprecision ${t.precision} usampler3D;\n\tprecision ${t.precision} usamplerCube;\n\tprecision ${t.precision} usampler2DArray;\n\t`;return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function Wa(t,e,i,n){const o=t.getContext(),l=i.defines;let c=i.vertexShader,h=i.fragmentShader;const d=function(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===s?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===r?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===a&&(e="SHADOWMAP_TYPE_VSM"),e}(i),g=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case T:case A:e="ENVMAP_TYPE_CUBE";break;case k:e="ENVMAP_TYPE_CUBE_UV"}return e}(i),v=function(t){let e="ENVMAP_MODE_REFLECTION";t.envMap&&t.envMapMode===A&&(e="ENVMAP_MODE_REFRACTION");return e}(i),_=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case u:e="ENVMAP_BLENDING_MULTIPLY";break;case p:e="ENVMAP_BLENDING_MIX";break;case m:e="ENVMAP_BLENDING_ADD"}return e}(i),y=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),x=function(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Ua).join("\n")}(i),w=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),b=o.createProgram();let M,S,E=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?(M=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,w].filter(Ua).join("\n"),M.length>0&&(M+="\n"),S=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,w].filter(Ua).join("\n"),S.length>0&&(S+="\n")):(M=[ja(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,w,i.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",i.batching?"#define USE_BATCHING":"",i.batchingColor?"#define USE_BATCHING_COLOR":"",i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.instancingMorph?"#define USE_INSTANCING_MORPH":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+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.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.mapUv?"#define MAP_UV "+i.mapUv:"",i.alphaMapUv?"#define ALPHAMAP_UV "+i.alphaMapUv:"",i.lightMapUv?"#define LIGHTMAP_UV "+i.lightMapUv:"",i.aoMapUv?"#define AOMAP_UV "+i.aoMapUv:"",i.emissiveMapUv?"#define EMISSIVEMAP_UV "+i.emissiveMapUv:"",i.bumpMapUv?"#define BUMPMAP_UV "+i.bumpMapUv:"",i.normalMapUv?"#define NORMALMAP_UV "+i.normalMapUv:"",i.displacementMapUv?"#define DISPLACEMENTMAP_UV "+i.displacementMapUv:"",i.metalnessMapUv?"#define METALNESSMAP_UV "+i.metalnessMapUv:"",i.roughnessMapUv?"#define ROUGHNESSMAP_UV "+i.roughnessMapUv:"",i.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+i.anisotropyMapUv:"",i.clearcoatMapUv?"#define CLEARCOATMAP_UV "+i.clearcoatMapUv:"",i.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+i.clearcoatNormalMapUv:"",i.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+i.clearcoatRoughnessMapUv:"",i.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+i.iridescenceMapUv:"",i.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+i.iridescenceThicknessMapUv:"",i.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+i.sheenColorMapUv:"",i.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+i.sheenRoughnessMapUv:"",i.specularMapUv?"#define SPECULARMAP_UV "+i.specularMapUv:"",i.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+i.specularColorMapUv:"",i.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+i.specularIntensityMapUv:"",i.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+i.transmissionMapUv:"",i.thicknessMapUv?"#define THICKNESSMAP_UV "+i.thicknessMapUv:"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+d:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Ua).join("\n"),S=[ja(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,w,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+g:"",i.envMap?"#define "+v:"",i.envMap?"#define "+_:"",y?"#define CUBEUV_TEXEL_WIDTH "+y.texelWidth:"",y?"#define CUBEUV_TEXEL_HEIGHT "+y.texelHeight:"",y?"#define CUBEUV_MAX_MIP "+y.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.dispersion?"#define USE_DISPERSION":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor||i.batchingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+d:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",i.toneMapping!==f?"#define TONE_MAPPING":"",i.toneMapping!==f?Fs.tonemapping_pars_fragment:"",i.toneMapping!==f?Ia("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",Fs.colorspace_pars_fragment,Pa("linearToOutputTexel",i.outputColorSpace),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Ua).join("\n")),c=Ba(c),c=Na(c,i),c=Da(c,i),h=Ba(h),h=Na(h,i),h=Da(h,i),c=Va(c),h=Va(h),!0!==i.isRawShaderMaterial&&(E="#version 300 es\n",M=[x,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+M,S=["#define varying in",i.glslVersion===me?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===me?"":"#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"+S);const C=E+M+c,L=E+S+h,R=Ca(o,o.VERTEX_SHADER,C),P=Ca(o,o.FRAGMENT_SHADER,L);function I(e){if(t.debug.checkShaderErrors){const i=o.getProgramInfoLog(b).trim(),n=o.getShaderInfoLog(R).trim(),s=o.getShaderInfoLog(P).trim();let r=!0,a=!0;if(!1===o.getProgramParameter(b,o.LINK_STATUS))if(r=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(o,b,R,P);else{const t=Ra(o,R,"vertex"),n=Ra(o,P,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(b,o.VALIDATE_STATUS)+"\n\nMaterial Name: "+e.name+"\nMaterial Type: "+e.type+"\n\nProgram Info Log: "+i+"\n"+t+"\n"+n)}else""!==i?console.warn("THREE.WebGLProgram: Program Info Log:",i):""!==n&&""!==s||(a=!1);a&&(e.diagnostics={runnable:r,programLog:i,vertexShader:{log:n,prefix:M},fragmentShader:{log:s,prefix:S}})}o.deleteShader(R),o.deleteShader(P),U=new Aa(o,b),N=function(t,e){const i={},n=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let s=0;s<n;s++){const n=t.getActiveAttrib(e,s),r=n.name;let a=1;n.type===t.FLOAT_MAT2&&(a=2),n.type===t.FLOAT_MAT3&&(a=3),n.type===t.FLOAT_MAT4&&(a=4),i[r]={type:n.type,location:t.getAttribLocation(e,r),locationSize:a}}return i}(o,b)}let U,N;o.attachShader(b,R),o.attachShader(b,P),void 0!==i.index0AttributeName?o.bindAttribLocation(b,0,i.index0AttributeName):!0===i.morphTargets&&o.bindAttribLocation(b,0,"position"),o.linkProgram(b),this.getUniforms=function(){return void 0===U&&I(this),U},this.getAttributes=function(){return void 0===N&&I(this),N};let D=!1===i.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===D&&(D=o.getProgramParameter(b,La)),D},this.destroy=function(){n.releaseStatesOfProgram(this),o.deleteProgram(b),this.program=void 0},this.type=i.shaderType,this.name=i.shaderName,this.id=ka++,this.cacheKey=e,this.usedTimes=1,this.program=b,this.vertexShader=R,this.fragmentShader=P,this}let qa=0;class Xa{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 Za(t),e.set(t,i)),i}}class Za{constructor(t){this.id=qa++,this.code=t,this.usedTimes=0}}function Ya(t,e,i,n,s,r,a){const o=new qi,c=new Xa,h=new Set,d=[],u=s.logarithmicDepthBuffer,p=s.vertexTextures;let m=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 h.add(t),0===t?"uv":`uv${t}`}return{getParameters:function(r,o,d,_,y){const x=_.fog,w=y.geometry,b=r.isMeshStandardMaterial?_.environment:null,M=(r.isMeshStandardMaterial?i:e).get(r.envMap||b),S=M&&M.mapping===k?M.image.height:null,E=g[r.type];null!==r.precision&&(m=s.getMaxPrecision(r.precision),m!==r.precision&&console.warn("THREE.WebGLProgram.getParameters:",r.precision,"not supported, using",m,"instead."));const T=w.morphAttributes.position||w.morphAttributes.normal||w.morphAttributes.color,A=void 0!==T?T.length:0;let C,L,R,P,I=0;if(void 0!==w.morphAttributes.position&&(I=1),void 0!==w.morphAttributes.normal&&(I=2),void 0!==w.morphAttributes.color&&(I=3),E){const t=Hs[E];C=t.vertexShader,L=t.fragmentShader}else C=r.vertexShader,L=r.fragmentShader,c.update(r),R=c.getVertexShaderID(r),P=c.getFragmentShaderID(r);const U=t.getRenderTarget(),N=!0===y.isInstancedMesh,D=!0===y.isBatchedMesh,O=!!r.map,B=!!r.matcap,F=!!M,z=!!r.aoMap,H=!!r.lightMap,V=!!r.bumpMap,G=!!r.normalMap,j=!!r.displacementMap,W=!!r.emissiveMap,q=!!r.metalnessMap,X=!!r.roughnessMap,Z=r.anisotropy>0,Y=r.clearcoat>0,J=r.dispersion>0,K=r.iridescence>0,$=r.sheen>0,Q=r.transmission>0,tt=Z&&!!r.anisotropyMap,et=Y&&!!r.clearcoatMap,it=Y&&!!r.clearcoatNormalMap,nt=Y&&!!r.clearcoatRoughnessMap,st=K&&!!r.iridescenceMap,rt=K&&!!r.iridescenceThicknessMap,at=$&&!!r.sheenColorMap,ot=$&&!!r.sheenRoughnessMap,lt=!!r.specularMap,ct=!!r.specularColorMap,ht=!!r.specularIntensityMap,dt=Q&&!!r.transmissionMap,ut=Q&&!!r.thicknessMap,pt=!!r.gradientMap,mt=!!r.alphaMap,ft=r.alphaTest>0,gt=!!r.alphaHash,vt=!!r.extensions;let _t=f;r.toneMapped&&(null!==U&&!0!==U.isXRRenderTarget||(_t=t.toneMapping));const yt={shaderID:E,shaderType:r.type,shaderName:r.name,vertexShader:C,fragmentShader:L,defines:r.defines,customVertexShaderID:R,customFragmentShaderID:P,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:m,batching:D,batchingColor:D&&null!==y._colorsTexture,instancing:N,instancingColor:N&&null!==y.instanceColor,instancingMorph:N&&null!==y.morphTexture,supportsVertexTextures:p,outputColorSpace:null===U?t.outputColorSpace:!0===U.isXRRenderTarget?U.texture.colorSpace:te,alphaToCoverage:!!r.alphaToCoverage,map:O,matcap:B,envMap:F,envMapMode:F&&M.mapping,envMapCubeUVHeight:S,aoMap:z,lightMap:H,bumpMap:V,normalMap:G,displacementMap:p&&j,emissiveMap:W,normalMapObjectSpace:G&&1===r.normalMapType,normalMapTangentSpace:G&&0===r.normalMapType,metalnessMap:q,roughnessMap:X,anisotropy:Z,anisotropyMap:tt,clearcoat:Y,clearcoatMap:et,clearcoatNormalMap:it,clearcoatRoughnessMap:nt,dispersion:J,iridescence:K,iridescenceMap:st,iridescenceThicknessMap:rt,sheen:$,sheenColorMap:at,sheenRoughnessMap:ot,specularMap:lt,specularColorMap:ct,specularIntensityMap:ht,transmission:Q,transmissionMap:dt,thicknessMap:ut,gradientMap:pt,opaque:!1===r.transparent&&1===r.blending&&!1===r.alphaToCoverage,alphaMap:mt,alphaTest:ft,alphaHash:gt,combine:r.combine,mapUv:O&&v(r.map.channel),aoMapUv:z&&v(r.aoMap.channel),lightMapUv:H&&v(r.lightMap.channel),bumpMapUv:V&&v(r.bumpMap.channel),normalMapUv:G&&v(r.normalMap.channel),displacementMapUv:j&&v(r.displacementMap.channel),emissiveMapUv:W&&v(r.emissiveMap.channel),metalnessMapUv:q&&v(r.metalnessMap.channel),roughnessMapUv:X&&v(r.roughnessMap.channel),anisotropyMapUv:tt&&v(r.anisotropyMap.channel),clearcoatMapUv:et&&v(r.clearcoatMap.channel),clearcoatNormalMapUv:it&&v(r.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:nt&&v(r.clearcoatRoughnessMap.channel),iridescenceMapUv:st&&v(r.iridescenceMap.channel),iridescenceThicknessMapUv:rt&&v(r.iridescenceThicknessMap.channel),sheenColorMapUv:at&&v(r.sheenColorMap.channel),sheenRoughnessMapUv:ot&&v(r.sheenRoughnessMap.channel),specularMapUv:lt&&v(r.specularMap.channel),specularColorMapUv:ct&&v(r.specularColorMap.channel),specularIntensityMapUv:ht&&v(r.specularIntensityMap.channel),transmissionMapUv:dt&&v(r.transmissionMap.channel),thicknessMapUv:ut&&v(r.thicknessMap.channel),alphaMapUv:mt&&v(r.alphaMap.channel),vertexTangents:!!w.attributes.tangent&&(G||Z),vertexColors:r.vertexColors,vertexAlphas:!0===r.vertexColors&&!!w.attributes.color&&4===w.attributes.color.itemSize,pointsUvs:!0===y.isPoints&&!!w.attributes.uv&&(O||mt),fog:!!x,useFog:!0===r.fog,fogExp2:!!x&&x.isFogExp2,flatShading:!0===r.flatShading,sizeAttenuation:!0===r.sizeAttenuation,logarithmicDepthBuffer:u,skinning:!0===y.isSkinnedMesh,morphTargets:void 0!==w.morphAttributes.position,morphNormals:void 0!==w.morphAttributes.normal,morphColors:void 0!==w.morphAttributes.color,morphTargetsCount:A,morphTextureStride:I,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&d.length>0,shadowMapType:t.shadowMap.type,toneMapping:_t,decodeVideoTexture:O&&!0===r.map.isVideoTexture&&Ge.getTransfer(r.map.colorSpace)===se,premultipliedAlpha:r.premultipliedAlpha,doubleSided:2===r.side,flipSided:r.side===l,useDepthPacking:r.depthPacking>=0,depthPacking:r.depthPacking||0,index0AttributeName:r.index0AttributeName,extensionClipCullDistance:vt&&!0===r.extensions.clipCullDistance&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(vt&&!0===r.extensions.multiDraw||D)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:r.customProgramCacheKey()};return yt.vertexUv1s=h.has(1),yt.vertexUv2s=h.has(2),yt.vertexUv3s=h.has(3),h.clear(),yt},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.customVertexShaderID),i.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(!function(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.numLightProbes),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(i,e),function(t,e){o.disableAll(),e.supportsVertexTextures&&o.enable(0);e.instancing&&o.enable(1);e.instancingColor&&o.enable(2);e.instancingMorph&&o.enable(3);e.matcap&&o.enable(4);e.envMap&&o.enable(5);e.normalMapObjectSpace&&o.enable(6);e.normalMapTangentSpace&&o.enable(7);e.clearcoat&&o.enable(8);e.iridescence&&o.enable(9);e.alphaTest&&o.enable(10);e.vertexColors&&o.enable(11);e.vertexAlphas&&o.enable(12);e.vertexUv1s&&o.enable(13);e.vertexUv2s&&o.enable(14);e.vertexUv3s&&o.enable(15);e.vertexTangents&&o.enable(16);e.anisotropy&&o.enable(17);e.alphaHash&&o.enable(18);e.batching&&o.enable(19);e.dispersion&&o.enable(20);e.batchingColor&&o.enable(21);t.push(o.mask),o.disableAll(),e.fog&&o.enable(0);e.useFog&&o.enable(1);e.flatShading&&o.enable(2);e.logarithmicDepthBuffer&&o.enable(3);e.skinning&&o.enable(4);e.morphTargets&&o.enable(5);e.morphNormals&&o.enable(6);e.morphColors&&o.enable(7);e.premultipliedAlpha&&o.enable(8);e.shadowMapEnabled&&o.enable(9);e.doubleSided&&o.enable(10);e.flipSided&&o.enable(11);e.useDepthPacking&&o.enable(12);e.dithering&&o.enable(13);e.transmission&&o.enable(14);e.sheen&&o.enable(15);e.opaque&&o.enable(16);e.pointsUvs&&o.enable(17);e.decodeVideoTexture&&o.enable(18);e.alphaToCoverage&&o.enable(19);t.push(o.mask)}(i,e),i.push(t.outputColorSpace)),i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=g[t.type];let i;if(e){const t=Hs[e];i=_s.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n;for(let t=0,e=d.length;t<e;t++){const e=d[t];if(e.cacheKey===i){n=e,++n.usedTimes;break}}return void 0===n&&(n=new Wa(t,i,e,r),d.push(n)),n},releaseProgram:function(t){if(0==--t.usedTimes){const e=d.indexOf(t);d[e]=d[d.length-1],d.pop(),t.destroy()}},releaseShaderCache:function(t){c.remove(t)},programs:d,dispose:function(){c.dispose()}}}function Ja(){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 Ka(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 $a(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 Qa(){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||Ka),n.length>1&&n.sort(e||$a),s.length>1&&s.sort(e||$a)}}}function to(){let t=new WeakMap;return{get:function(e,i){const n=t.get(e);let s;return void 0===n?(s=new Qa,t.set(e,[s])):i>=n.length?(s=new Qa,n.push(s)):s=n[i],s},dispose:function(){t=new WeakMap}}}function eo(){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 ri,color:new En};break;case"SpotLight":i={position:new ri,direction:new ri,color:new En,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new ri,color:new En,distance:0,decay:0};break;case"HemisphereLight":i={direction:new ri,skyColor:new En,groundColor:new En};break;case"RectAreaLight":i={color:new En,position:new ri,halfWidth:new ri,halfHeight:new ri}}return t[e.id]=i,i}}}let io=0;function no(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function so(t){const e=new eo,i=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Le};break;case"PointLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Le,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}}(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let t=0;t<9;t++)n.probe.push(new ri);const s=new ri,r=new Ni,a=new Ni;return{setup:function(s){let r=0,a=0,o=0;for(let t=0;t<9;t++)n.probe[t].set(0,0,0);let l=0,c=0,h=0,d=0,u=0,p=0,m=0,f=0,g=0,v=0,_=0;s.sort(no);for(let t=0,y=s.length;t<y;t++){const y=s[t],x=y.color,w=y.intensity,b=y.distance,M=y.shadow&&y.shadow.map?y.shadow.map.texture:null;if(y.isAmbientLight)r+=x.r*w,a+=x.g*w,o+=x.b*w;else if(y.isLightProbe){for(let t=0;t<9;t++)n.probe[t].addScaledVector(y.sh.coefficients[t],w);_++}else if(y.isDirectionalLight){const t=e.get(y);if(t.color.copy(y.color).multiplyScalar(y.intensity),y.castShadow){const t=y.shadow,e=i.get(y);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,n.directionalShadow[l]=e,n.directionalShadowMap[l]=M,n.directionalShadowMatrix[l]=y.shadow.matrix,p++}n.directional[l]=t,l++}else if(y.isSpotLight){const t=e.get(y);t.position.setFromMatrixPosition(y.matrixWorld),t.color.copy(x).multiplyScalar(w),t.distance=b,t.coneCos=Math.cos(y.angle),t.penumbraCos=Math.cos(y.angle*(1-y.penumbra)),t.decay=y.decay,n.spot[h]=t;const s=y.shadow;if(y.map&&(n.spotLightMap[g]=y.map,g++,s.updateMatrices(y),y.castShadow&&v++),n.spotLightMatrix[h]=s.matrix,y.castShadow){const t=i.get(y);t.shadowIntensity=s.intensity,t.shadowBias=s.bias,t.shadowNormalBias=s.normalBias,t.shadowRadius=s.radius,t.shadowMapSize=s.mapSize,n.spotShadow[h]=t,n.spotShadowMap[h]=M,f++}h++}else if(y.isRectAreaLight){const t=e.get(y);t.color.copy(x).multiplyScalar(w),t.halfWidth.set(.5*y.width,0,0),t.halfHeight.set(0,.5*y.height,0),n.rectArea[d]=t,d++}else if(y.isPointLight){const t=e.get(y);if(t.color.copy(y.color).multiplyScalar(y.intensity),t.distance=y.distance,t.decay=y.decay,y.castShadow){const t=y.shadow,e=i.get(y);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,e.shadowCameraNear=t.camera.near,e.shadowCameraFar=t.camera.far,n.pointShadow[c]=e,n.pointShadowMap[c]=M,n.pointShadowMatrix[c]=y.shadow.matrix,m++}n.point[c]=t,c++}else if(y.isHemisphereLight){const t=e.get(y);t.skyColor.copy(y.color).multiplyScalar(w),t.groundColor.copy(y.groundColor).multiplyScalar(w),n.hemi[u]=t,u++}}d>0&&(!0===t.has("OES_texture_float_linear")?(n.rectAreaLTC1=zs.LTC_FLOAT_1,n.rectAreaLTC2=zs.LTC_FLOAT_2):(n.rectAreaLTC1=zs.LTC_HALF_1,n.rectAreaLTC2=zs.LTC_HALF_2)),n.ambient[0]=r,n.ambient[1]=a,n.ambient[2]=o;const y=n.hash;y.directionalLength===l&&y.pointLength===c&&y.spotLength===h&&y.rectAreaLength===d&&y.hemiLength===u&&y.numDirectionalShadows===p&&y.numPointShadows===m&&y.numSpotShadows===f&&y.numSpotMaps===g&&y.numLightProbes===_||(n.directional.length=l,n.spot.length=h,n.rectArea.length=d,n.point.length=c,n.hemi.length=u,n.directionalShadow.length=p,n.directionalShadowMap.length=p,n.pointShadow.length=m,n.pointShadowMap.length=m,n.spotShadow.length=f,n.spotShadowMap.length=f,n.directionalShadowMatrix.length=p,n.pointShadowMatrix.length=m,n.spotLightMatrix.length=f+g-v,n.spotLightMap.length=g,n.numSpotLightShadowsWithMaps=v,n.numLightProbes=_,y.directionalLength=l,y.pointLength=c,y.spotLength=h,y.rectAreaLength=d,y.hemiLength=u,y.numDirectionalShadows=p,y.numPointShadows=m,y.numSpotShadows=f,y.numSpotMaps=g,y.numLightProbes=_,n.version=io++)},setupView:function(t,e){let i=0,o=0,l=0,c=0,h=0;const d=e.matrixWorldInverse;for(let e=0,u=t.length;e<u;e++){const u=t[e];if(u.isDirectionalLight){const t=n.directional[i];t.direction.setFromMatrixPosition(u.matrixWorld),s.setFromMatrixPosition(u.target.matrixWorld),t.direction.sub(s),t.direction.transformDirection(d),i++}else if(u.isSpotLight){const t=n.spot[l];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),t.direction.setFromMatrixPosition(u.matrixWorld),s.setFromMatrixPosition(u.target.matrixWorld),t.direction.sub(s),t.direction.transformDirection(d),l++}else if(u.isRectAreaLight){const t=n.rectArea[c];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),a.identity(),r.copy(u.matrixWorld),r.premultiply(d),a.extractRotation(r),t.halfWidth.set(.5*u.width,0,0),t.halfHeight.set(0,.5*u.height,0),t.halfWidth.applyMatrix4(a),t.halfHeight.applyMatrix4(a),c++}else if(u.isPointLight){const t=n.point[o];t.position.setFromMatrixPosition(u.matrixWorld),t.position.applyMatrix4(d),o++}else if(u.isHemisphereLight){const t=n.hemi[h];t.direction.setFromMatrixPosition(u.matrixWorld),t.direction.transformDirection(d),h++}}},state:n}}function ro(t){const e=new so(t),i=[],n=[];const s={lightsArray:i,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:function(t){s.camera=t,i.length=0,n.length=0},state:s,setupLights:function(){e.setup(i)},setupLightsView:function(t){e.setupView(i,t)},pushLight:function(t){i.push(t)},pushShadow:function(t){n.push(t)}}}function ao(t){let e=new WeakMap;return{get:function(i,n=0){const s=e.get(i);let r;return void 0===s?(r=new ro(t),e.set(i,[r])):n>=s.length?(r=new ro(t),s.push(r)):r=s[n],r},dispose:function(){e=new WeakMap}}}class oo extends Cn{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 lo extends Cn{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 co(t,e,i){let n=new Ns;const r=new Le,c=new Le,h=new Qe,d=new oo({depthPacking:3201}),u=new lo,p={},m=i.maxTextureSize,f={[o]:l,[l]:o,2:2},g=new ys({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Le},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 Zn;_.setAttribute("position",new On(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new us(_,g),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=s;let w=this.type;function b(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 ei(r.x,r.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 M(e,i,n,s){let r=null;const o=!0===n.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==o)r=o;else if(r=!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=r.uuid,e=i.uuid;let n=p[t];void 0===n&&(n={},p[t]=n);let s=n[e];void 0===s&&(s=r.clone(),n[e]=s,i.addEventListener("dispose",E)),r=s}if(r.visible=i.visible,r.wireframe=i.wireframe,r.side=s===a?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:f[i.side],r.alphaMap=i.alphaMap,r.alphaTest=i.alphaTest,r.map=i.map,r.clipShadows=i.clipShadows,r.clippingPlanes=i.clippingPlanes,r.clipIntersection=i.clipIntersection,r.displacementMap=i.displacementMap,r.displacementScale=i.displacementScale,r.displacementBias=i.displacementBias,r.wireframeLinewidth=i.wireframeLinewidth,r.linewidth=i.linewidth,!0===n.isPointLight&&!0===r.isMeshDistanceMaterial){t.properties.get(r).light=n}return r}function S(i,s,r,o,l){if(!1===i.visible)return;if(i.layers.test(s.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&l===a)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,i.matrixWorld);const n=e.update(i),a=i.material;if(Array.isArray(a)){const e=n.groups;for(let c=0,h=e.length;c<h;c++){const h=e[c],d=a[h.materialIndex];if(d&&d.visible){const e=M(i,d,o,l);i.onBeforeShadow(t,i,s,r,n,e,h),t.renderBufferDirect(r,null,n,e,i,h),i.onAfterShadow(t,i,s,r,n,e,h)}}}else if(a.visible){const e=M(i,a,o,l);i.onBeforeShadow(t,i,s,r,n,e,null),t.renderBufferDirect(r,null,n,e,i,null),i.onAfterShadow(t,i,s,r,n,e,null)}}const c=i.children;for(let t=0,e=c.length;t<e;t++)S(c[t],s,r,o,l)}function E(t){t.target.removeEventListener("dispose",E);for(const e in p){const i=p[e],n=t.target.uuid;if(n in i){i[n].dispose(),delete i[n]}}}this.render=function(e,i,s){if(!1===x.enabled)return;if(!1===x.autoUpdate&&!1===x.needsUpdate)return;if(0===e.length)return;const o=t.getRenderTarget(),l=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);const p=w!==a&&this.type===a,f=w===a&&this.type!==a;for(let o=0,l=e.length;o<l;o++){const l=e[o],d=l.shadow;if(void 0===d){console.warn("THREE.WebGLShadowMap:",l,"has no shadow.");continue}if(!1===d.autoUpdate&&!1===d.needsUpdate)continue;r.copy(d.mapSize);const g=d.getFrameExtents();if(r.multiply(g),c.copy(d.mapSize),(r.x>m||r.y>m)&&(r.x>m&&(c.x=Math.floor(m/g.x),r.x=c.x*g.x,d.mapSize.x=c.x),r.y>m&&(c.y=Math.floor(m/g.y),r.y=c.y*g.y,d.mapSize.y=c.y)),null===d.map||!0===p||!0===f){const t=this.type!==a?{minFilter:U,magFilter:U}:{};null!==d.map&&d.map.dispose(),d.map=new ei(r.x,r.y,t),d.map.texture.name=l.name+".shadowMap",d.camera.updateProjectionMatrix()}t.setRenderTarget(d.map),t.clear();const v=d.getViewportCount();for(let t=0;t<v;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(l,t),n=d.getFrustum(),S(i,s,d.camera,l,this.type)}!0!==d.isPointLightShadow&&this.type===a&&b(d,s),d.needsUpdate=!1}w=this.type,x.needsUpdate=!1,t.setRenderTarget(o,l,d)}}function ho(t){const e=new function(){let e=!1;const i=new Qe;let n=null;const s=new Qe(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)}}},i=new function(){let e=!1,i=null,n=null,s=null;return{setTest:function(e){e?G(t.DEPTH_TEST):j(t.DEPTH_TEST)},setMask:function(n){i===n||e||(t.depthMask(n),i=n)},setFunc:function(e){if(n!==e){switch(e){case 0:t.depthFunc(t.NEVER);break;case 1:t.depthFunc(t.ALWAYS);break;case 2:t.depthFunc(t.LESS);break;case 3:default:t.depthFunc(t.LEQUAL);break;case 4:t.depthFunc(t.EQUAL);break;case 5:t.depthFunc(t.GEQUAL);break;case 6:t.depthFunc(t.GREATER);break;case 7:t.depthFunc(t.NOTEQUAL)}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}}},n=new function(){let e=!1,i=null,n=null,s=null,r=null,a=null,o=null,l=null,c=null;return{setTest:function(i){e||(i?G(t.STENCIL_TEST):j(t.STENCIL_TEST))},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,a){n===e&&s===i&&r===a||(t.stencilFunc(e,i,a),n=e,s=i,r=a)},setOp:function(e,i,n){a===e&&o===i&&l===n||(t.stencilOp(e,i,n),a=e,o=i,l=n)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,i=null,n=null,s=null,r=null,a=null,o=null,l=null,c=null}}},s=new WeakMap,r=new WeakMap;let a={},o={},u=new WeakMap,p=[],m=null,f=!1,g=null,v=null,_=null,y=null,x=null,w=null,b=null,M=new En(0,0,0),S=0,E=!1,T=null,A=null,C=null,L=null,k=null;const R=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let P=!1,I=0;const U=t.getParameter(t.VERSION);-1!==U.indexOf("WebGL")?(I=parseFloat(/^WebGL (\d)/.exec(U)[1]),P=I>=1):-1!==U.indexOf("OpenGL ES")&&(I=parseFloat(/^OpenGL ES (\d)/.exec(U)[1]),P=I>=2);let N=null,D={};const O=t.getParameter(t.SCISSOR_BOX),B=t.getParameter(t.VIEWPORT),F=(new Qe).fromArray(O),z=(new Qe).fromArray(B);function H(e,i,n,s){const r=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let a=0;a<n;a++)e===t.TEXTURE_3D||e===t.TEXTURE_2D_ARRAY?t.texImage3D(i,0,t.RGBA,1,1,s,0,t.RGBA,t.UNSIGNED_BYTE,r):t.texImage2D(i+a,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,r);return a}const V={};function G(e){!0!==a[e]&&(t.enable(e),a[e]=!0)}function j(e){!1!==a[e]&&(t.disable(e),a[e]=!1)}V[t.TEXTURE_2D]=H(t.TEXTURE_2D,t.TEXTURE_2D,1),V[t.TEXTURE_CUBE_MAP]=H(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),V[t.TEXTURE_2D_ARRAY]=H(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),V[t.TEXTURE_3D]=H(t.TEXTURE_3D,t.TEXTURE_3D,1,1),e.setClear(0,0,0,1),i.setClear(1),n.setClear(0),G(t.DEPTH_TEST),i.setFunc(3),Z(!1),Y(1),G(t.CULL_FACE),X(0);const W={[c]:t.FUNC_ADD,101:t.FUNC_SUBTRACT,102:t.FUNC_REVERSE_SUBTRACT};W[103]=t.MIN,W[104]=t.MAX;const q={200:t.ZERO,201:t.ONE,202:t.SRC_COLOR,[h]:t.SRC_ALPHA,210:t.SRC_ALPHA_SATURATE,208:t.DST_COLOR,206:t.DST_ALPHA,203:t.ONE_MINUS_SRC_COLOR,[d]:t.ONE_MINUS_SRC_ALPHA,209:t.ONE_MINUS_DST_COLOR,207:t.ONE_MINUS_DST_ALPHA,211:t.CONSTANT_COLOR,212:t.ONE_MINUS_CONSTANT_COLOR,213:t.CONSTANT_ALPHA,214:t.ONE_MINUS_CONSTANT_ALPHA};function X(e,i,n,s,r,a,o,l,h,d){if(0!==e){if(!1===f&&(G(t.BLEND),f=!0),5===e)r=r||i,a=a||n,o=o||s,i===v&&r===x||(t.blendEquationSeparate(W[i],W[r]),v=i,x=r),n===_&&s===y&&a===w&&o===b||(t.blendFuncSeparate(q[n],q[s],q[a],q[o]),_=n,y=s,w=a,b=o),!1!==l.equals(M)&&h===S||(t.blendColor(l.r,l.g,l.b,h),M.copy(l),S=h),g=e,E=!1;else if(e!==g||d!==E){if(v===c&&x===c||(t.blendEquation(t.FUNC_ADD),v=c,x=c),d)switch(e){case 1:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.ONE,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}_=null,y=null,w=null,b=null,M.set(0,0,0),S=0,g=e,E=d}}else!0===f&&(j(t.BLEND),f=!1)}function Z(e){T!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),T=e)}function Y(e){0!==e?(G(t.CULL_FACE),e!==A&&(1===e?t.cullFace(t.BACK):2===e?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):j(t.CULL_FACE),A=e}function J(e,i,n){e?(G(t.POLYGON_OFFSET_FILL),L===i&&k===n||(t.polygonOffset(i,n),L=i,k=n)):j(t.POLYGON_OFFSET_FILL)}return{buffers:{color:e,depth:i,stencil:n},enable:G,disable:j,bindFramebuffer:function(e,i){return o[e]!==i&&(t.bindFramebuffer(e,i),o[e]=i,e===t.DRAW_FRAMEBUFFER&&(o[t.FRAMEBUFFER]=i),e===t.FRAMEBUFFER&&(o[t.DRAW_FRAMEBUFFER]=i),!0)},drawBuffers:function(e,i){let n=p,s=!1;if(e){n=u.get(i),void 0===n&&(n=[],u.set(i,n));const r=e.textures;if(n.length!==r.length||n[0]!==t.COLOR_ATTACHMENT0){for(let e=0,i=r.length;e<i;e++)n[e]=t.COLOR_ATTACHMENT0+e;n.length=r.length,s=!0}}else n[0]!==t.BACK&&(n[0]=t.BACK,s=!0);s&&t.drawBuffers(n)},useProgram:function(e){return m!==e&&(t.useProgram(e),m=e,!0)},setBlending:X,setMaterial:function(s,r){2===s.side?j(t.CULL_FACE):G(t.CULL_FACE);let a=s.side===l;r&&(a=!a),Z(a),1===s.blending&&!1===s.transparent?X(0):X(s.blending,s.blendEquation,s.blendSrc,s.blendDst,s.blendEquationAlpha,s.blendSrcAlpha,s.blendDstAlpha,s.blendColor,s.blendAlpha,s.premultipliedAlpha),i.setFunc(s.depthFunc),i.setTest(s.depthTest),i.setMask(s.depthWrite),e.setMask(s.colorWrite);const o=s.stencilWrite;n.setTest(o),o&&(n.setMask(s.stencilWriteMask),n.setFunc(s.stencilFunc,s.stencilRef,s.stencilFuncMask),n.setOp(s.stencilFail,s.stencilZFail,s.stencilZPass)),J(s.polygonOffset,s.polygonOffsetFactor,s.polygonOffsetUnits),!0===s.alphaToCoverage?G(t.SAMPLE_ALPHA_TO_COVERAGE):j(t.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:Z,setCullFace:Y,setLineWidth:function(e){e!==C&&(P&&t.lineWidth(e),C=e)},setPolygonOffset:J,setScissorTest:function(e){e?G(t.SCISSOR_TEST):j(t.SCISSOR_TEST)},activeTexture:function(e){void 0===e&&(e=t.TEXTURE0+R-1),N!==e&&(t.activeTexture(e),N=e)},bindTexture:function(e,i,n){void 0===n&&(n=null===N?t.TEXTURE0+R-1:N);let s=D[n];void 0===s&&(s={type:void 0,texture:void 0},D[n]=s),s.type===e&&s.texture===i||(N!==n&&(t.activeTexture(n),N=n),t.bindTexture(e,i||V[e]),s.type=e,s.texture=i)},unbindTexture:function(){const e=D[N];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=r.get(i);void 0===n&&(n=new WeakMap,r.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=r.get(i).get(e);s.get(i)!==n&&(t.uniformBlockBinding(i,n,e.__bindingPointIndex),s.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===F.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),F.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(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),a={},N=null,D={},o={},u=new WeakMap,p=[],m=null,f=!1,g=null,v=null,_=null,y=null,x=null,w=null,b=null,M=new En(0,0,0),S=0,E=!1,T=null,A=null,C=null,L=null,k=null,F.set(0,0,t.canvas.width,t.canvas.height),z.set(0,0,t.canvas.width,t.canvas.height),e.reset(),i.reset(),n.reset()}}}function uo(t,e,i,n){const s=function(t){switch(t){case z:case H:return{byteLength:1,components:1};case G:case V:case X:return{byteLength:2,components:1};case Z:case Y:return{byteLength:2,components:4};case W:case j:case q:return{byteLength:4,components:1};case K:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}(n);switch(i){case $:case et:return t*e;case it:return t*e*2;case rt:case at:return t*e/s.components*s.byteLength;case ot:case lt:return t*e*2/s.components*s.byteLength;case Q:return t*e*3/s.components*s.byteLength;case tt:case ct:return t*e*4/s.components*s.byteLength;case ht:case dt:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case ut:case pt:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case ft:case vt:return Math.max(t,16)*Math.max(e,8)/4;case mt:case gt:return Math.max(t,8)*Math.max(e,8)/2;case _t:case yt:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case xt:case wt:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case bt:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case Mt:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case St:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case Et:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case Tt:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case At:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case Ct:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case Lt:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case kt:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case Rt:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case Pt:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case It:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case Ut:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case Nt:case Dt:case Ot:return Math.ceil(t/4)*Math.ceil(e/4)*16;case Bt:case Ft:return Math.ceil(t/4)*Math.ceil(e/4)*8;case zt:case Ht:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${i} format.`)}const po={contain:function(t,e){const i=t.image&&t.image.width?t.image.width/t.image.height:1;return i>e?(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t},cover:function(t,e){const i=t.image&&t.image.width?t.image.width/t.image.height:1;return i>e?(t.repeat.x=e/i,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=i/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t},fill:function(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t},getByteLength:uo};function mo(t,e,i,n,s,r,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new Le,h=new WeakMap;let d;const u=new WeakMap;let p=!1;try{p="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function m(t,e){return p?new OffscreenCanvas(t,e):Ne("canvas")}function f(t,e,i){let n=1;const s=et(t);if((s.width>i||s.height>i)&&(n=i/Math.max(s.width,s.height)),n<1){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&t instanceof VideoFrame){const i=Math.floor(n*s.width),r=Math.floor(n*s.height);void 0===d&&(d=m(i,r));const a=e?m(i,r):d;a.width=i,a.height=r;return a.getContext("2d").drawImage(t,0,0,i,r),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+s.width+"x"+s.height+") to ("+i+"x"+r+")."),a}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+s.width+"x"+s.height+")."),t}return t}function g(t){return t.generateMipmaps&&t.minFilter!==U&&t.minFilter!==O}function v(e){t.generateMipmap(e)}function _(i,n,s,r,a=!1){if(null!==i){if(void 0!==t[i])return t[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let o=n;if(n===t.RED&&(s===t.FLOAT&&(o=t.R32F),s===t.HALF_FLOAT&&(o=t.R16F),s===t.UNSIGNED_BYTE&&(o=t.R8)),n===t.RED_INTEGER&&(s===t.UNSIGNED_BYTE&&(o=t.R8UI),s===t.UNSIGNED_SHORT&&(o=t.R16UI),s===t.UNSIGNED_INT&&(o=t.R32UI),s===t.BYTE&&(o=t.R8I),s===t.SHORT&&(o=t.R16I),s===t.INT&&(o=t.R32I)),n===t.RG&&(s===t.FLOAT&&(o=t.RG32F),s===t.HALF_FLOAT&&(o=t.RG16F),s===t.UNSIGNED_BYTE&&(o=t.RG8)),n===t.RG_INTEGER&&(s===t.UNSIGNED_BYTE&&(o=t.RG8UI),s===t.UNSIGNED_SHORT&&(o=t.RG16UI),s===t.UNSIGNED_INT&&(o=t.RG32UI),s===t.BYTE&&(o=t.RG8I),s===t.SHORT&&(o=t.RG16I),s===t.INT&&(o=t.RG32I)),n===t.RGB&&s===t.UNSIGNED_INT_5_9_9_9_REV&&(o=t.RGB9_E5),n===t.RGBA){const e=a?ne:Ge.getTransfer(r);s===t.FLOAT&&(o=t.RGBA32F),s===t.HALF_FLOAT&&(o=t.RGBA16F),s===t.UNSIGNED_BYTE&&(o=e===se?t.SRGB8_ALPHA8:t.RGBA8),s===t.UNSIGNED_SHORT_4_4_4_4&&(o=t.RGBA4),s===t.UNSIGNED_SHORT_5_5_5_1&&(o=t.RGB5_A1)}return o!==t.R16F&&o!==t.R32F&&o!==t.RG16F&&o!==t.RG32F&&o!==t.RGBA16F&&o!==t.RGBA32F||e.get("EXT_color_buffer_float"),o}function y(e,i){let n;return e?null===i||i===W||i===J?n=t.DEPTH24_STENCIL8:i===q?n=t.DEPTH32F_STENCIL8:i===G&&(n=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===i||i===W||i===J?n=t.DEPTH_COMPONENT24:i===q?n=t.DEPTH_COMPONENT32F:i===G&&(n=t.DEPTH_COMPONENT16),n}function x(t,e){return!0===g(t)||t.isFramebufferTexture&&t.minFilter!==U&&t.minFilter!==O?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function w(t){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=u.get(i);if(s){const n=s[e.__cacheKey];n.usedTimes--,0===n.usedTimes&&M(t),0===Object.keys(s).length&&u.delete(i)}n.remove(t)}(e),e.isVideoTexture&&h.delete(e)}function b(e){const i=e.target;i.removeEventListener("dispose",b),function(e){const i=n.get(e);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++){if(Array.isArray(i.__webglFramebuffer[e]))for(let n=0;n<i.__webglFramebuffer[e].length;n++)t.deleteFramebuffer(i.__webglFramebuffer[e][n]);else t.deleteFramebuffer(i.__webglFramebuffer[e]);i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[e])}else{if(Array.isArray(i.__webglFramebuffer))for(let e=0;e<i.__webglFramebuffer.length;e++)t.deleteFramebuffer(i.__webglFramebuffer[e]);else t.deleteFramebuffer(i.__webglFramebuffer);if(i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(let e=0;e<i.__webglColorRenderbuffer.length;e++)i.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(i.__webglColorRenderbuffer[e]);i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer)}const s=e.textures;for(let e=0,i=s.length;e<i;e++){const i=n.get(s[e]);i.__webglTexture&&(t.deleteTexture(i.__webglTexture),a.memory.textures--),n.remove(s[e])}n.remove(e)}(i)}function M(e){const i=n.get(e);t.deleteTexture(i.__webglTexture);const s=e.source;delete u.get(s)[i.__cacheKey],a.memory.textures--}let S=0;function E(e,s){const r=n.get(e);if(e.isVideoTexture&&function(t){const e=a.render.frame;h.get(t)!==e&&(h.set(t,e),t.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&r.__version!==e.version){const t=e.image;if(null===t)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==t.complete)return void H(r,e,s);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.bindTexture(t.TEXTURE_2D,r.__webglTexture,t.TEXTURE0+s)}const T={[R]:t.REPEAT,[P]:t.CLAMP_TO_EDGE,[I]:t.MIRRORED_REPEAT},A={[U]:t.NEAREST,[N]:t.NEAREST_MIPMAP_NEAREST,[D]:t.NEAREST_MIPMAP_LINEAR,[O]:t.LINEAR,[B]:t.LINEAR_MIPMAP_NEAREST,[F]:t.LINEAR_MIPMAP_LINEAR},C={512:t.NEVER,519:t.ALWAYS,513:t.LESS,[ue]:t.LEQUAL,514:t.EQUAL,518:t.GEQUAL,516:t.GREATER,517:t.NOTEQUAL};function L(i,r){if(r.type!==q||!1!==e.has("OES_texture_float_linear")||r.magFilter!==O&&r.magFilter!==B&&r.magFilter!==D&&r.magFilter!==F&&r.minFilter!==O&&r.minFilter!==B&&r.minFilter!==D&&r.minFilter!==F||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(i,t.TEXTURE_WRAP_S,T[r.wrapS]),t.texParameteri(i,t.TEXTURE_WRAP_T,T[r.wrapT]),i!==t.TEXTURE_3D&&i!==t.TEXTURE_2D_ARRAY||t.texParameteri(i,t.TEXTURE_WRAP_R,T[r.wrapR]),t.texParameteri(i,t.TEXTURE_MAG_FILTER,A[r.magFilter]),t.texParameteri(i,t.TEXTURE_MIN_FILTER,A[r.minFilter]),r.compareFunction&&(t.texParameteri(i,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(i,t.TEXTURE_COMPARE_FUNC,C[r.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){if(r.magFilter===U)return;if(r.minFilter!==D&&r.minFilter!==F)return;if(r.type===q&&!1===e.has("OES_texture_float_linear"))return;if(r.anisotropy>1||n.get(r).__currentAnisotropy){const a=e.get("EXT_texture_filter_anisotropic");t.texParameterf(i,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(r.anisotropy,s.getMaxAnisotropy())),n.get(r).__currentAnisotropy=r.anisotropy}}}function k(e,i){let n=!1;void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",w));const s=i.source;let r=u.get(s);void 0===r&&(r={},u.set(s,r));const o=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}(i);if(o!==e.__cacheKey){void 0===r[o]&&(r[o]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,n=!0),r[o].usedTimes++;const s=r[e.__cacheKey];void 0!==s&&(r[e.__cacheKey].usedTimes--,0===s.usedTimes&&M(i)),e.__cacheKey=o,e.__webglTexture=r[o].texture}return n}function H(e,a,o){let l=t.TEXTURE_2D;(a.isDataArrayTexture||a.isCompressedArrayTexture)&&(l=t.TEXTURE_2D_ARRAY),a.isData3DTexture&&(l=t.TEXTURE_3D);const c=k(e,a),h=a.source;i.bindTexture(l,e.__webglTexture,t.TEXTURE0+o);const d=n.get(h);if(h.version!==d.__version||!0===c){i.activeTexture(t.TEXTURE0+o);const e=Ge.getPrimaries(Ge.workingColorSpace),n=a.colorSpace===$t?null:Ge.getPrimaries(a.colorSpace),u=a.colorSpace===$t||e===n?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,a.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,a.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);let p=f(a.image,!1,s.maxTextureSize);p=Q(a,p);const m=r.convert(a.format,a.colorSpace),w=r.convert(a.type);let b,M=_(a.internalFormat,m,w,a.colorSpace,a.isVideoTexture);L(l,a);const S=a.mipmaps,E=!0!==a.isVideoTexture,T=void 0===d.__version||!0===c,A=h.dataReady,C=x(a,p);if(a.isDepthTexture)M=y(a.format===st,a.type),T&&(E?i.texStorage2D(t.TEXTURE_2D,1,M,p.width,p.height):i.texImage2D(t.TEXTURE_2D,0,M,p.width,p.height,0,m,w,null));else if(a.isDataTexture)if(S.length>0){E&&T&&i.texStorage2D(t.TEXTURE_2D,C,M,S[0].width,S[0].height);for(let e=0,n=S.length;e<n;e++)b=S[e],E?A&&i.texSubImage2D(t.TEXTURE_2D,e,0,0,b.width,b.height,m,w,b.data):i.texImage2D(t.TEXTURE_2D,e,M,b.width,b.height,0,m,w,b.data);a.generateMipmaps=!1}else E?(T&&i.texStorage2D(t.TEXTURE_2D,C,M,p.width,p.height),A&&i.texSubImage2D(t.TEXTURE_2D,0,0,0,p.width,p.height,m,w,p.data)):i.texImage2D(t.TEXTURE_2D,0,M,p.width,p.height,0,m,w,p.data);else if(a.isCompressedTexture)if(a.isCompressedArrayTexture){E&&T&&i.texStorage3D(t.TEXTURE_2D_ARRAY,C,M,S[0].width,S[0].height,p.depth);for(let e=0,n=S.length;e<n;e++)if(b=S[e],a.format!==tt)if(null!==m)if(E){if(A)if(a.layerUpdates.size>0){const n=uo(b.width,b.height,a.format,a.type);for(const s of a.layerUpdates){const r=b.data.subarray(s*n/b.data.BYTES_PER_ELEMENT,(s+1)*n/b.data.BYTES_PER_ELEMENT);i.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,s,b.width,b.height,1,m,r,0,0)}a.clearLayerUpdates()}else i.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,b.width,b.height,p.depth,m,b.data,0,0)}else i.compressedTexImage3D(t.TEXTURE_2D_ARRAY,e,M,b.width,b.height,p.depth,0,b.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else E?A&&i.texSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,b.width,b.height,p.depth,m,w,b.data):i.texImage3D(t.TEXTURE_2D_ARRAY,e,M,b.width,b.height,p.depth,0,m,w,b.data)}else{E&&T&&i.texStorage2D(t.TEXTURE_2D,C,M,S[0].width,S[0].height);for(let e=0,n=S.length;e<n;e++)b=S[e],a.format!==tt?null!==m?E?A&&i.compressedTexSubImage2D(t.TEXTURE_2D,e,0,0,b.width,b.height,m,b.data):i.compressedTexImage2D(t.TEXTURE_2D,e,M,b.width,b.height,0,b.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):E?A&&i.texSubImage2D(t.TEXTURE_2D,e,0,0,b.width,b.height,m,w,b.data):i.texImage2D(t.TEXTURE_2D,e,M,b.width,b.height,0,m,w,b.data)}else if(a.isDataArrayTexture)if(E){if(T&&i.texStorage3D(t.TEXTURE_2D_ARRAY,C,M,p.width,p.height,p.depth),A)if(a.layerUpdates.size>0){const e=uo(p.width,p.height,a.format,a.type);for(const n of a.layerUpdates){const s=p.data.subarray(n*e/p.data.BYTES_PER_ELEMENT,(n+1)*e/p.data.BYTES_PER_ELEMENT);i.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,n,p.width,p.height,1,m,w,s)}a.clearLayerUpdates()}else i.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,m,w,p.data)}else i.texImage3D(t.TEXTURE_2D_ARRAY,0,M,p.width,p.height,p.depth,0,m,w,p.data);else if(a.isData3DTexture)E?(T&&i.texStorage3D(t.TEXTURE_3D,C,M,p.width,p.height,p.depth),A&&i.texSubImage3D(t.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,m,w,p.data)):i.texImage3D(t.TEXTURE_3D,0,M,p.width,p.height,p.depth,0,m,w,p.data);else if(a.isFramebufferTexture){if(T)if(E)i.texStorage2D(t.TEXTURE_2D,C,M,p.width,p.height);else{let e=p.width,n=p.height;for(let s=0;s<C;s++)i.texImage2D(t.TEXTURE_2D,s,M,e,n,0,m,w,null),e>>=1,n>>=1}}else if(S.length>0){if(E&&T){const e=et(S[0]);i.texStorage2D(t.TEXTURE_2D,C,M,e.width,e.height)}for(let e=0,n=S.length;e<n;e++)b=S[e],E?A&&i.texSubImage2D(t.TEXTURE_2D,e,0,0,m,w,b):i.texImage2D(t.TEXTURE_2D,e,M,m,w,b);a.generateMipmaps=!1}else if(E){if(T){const e=et(p);i.texStorage2D(t.TEXTURE_2D,C,M,e.width,e.height)}A&&i.texSubImage2D(t.TEXTURE_2D,0,0,0,m,w,p)}else i.texImage2D(t.TEXTURE_2D,0,M,m,w,p);g(a)&&v(l),d.__version=h.version,a.onUpdate&&a.onUpdate(a)}e.__version=a.version}function V(e,s,a,l,c,h){const d=r.convert(a.format,a.colorSpace),u=r.convert(a.type),p=_(a.internalFormat,d,u,a.colorSpace);if(!n.get(s).__hasExternalTextures){const e=Math.max(1,s.width>>h),n=Math.max(1,s.height>>h);c===t.TEXTURE_3D||c===t.TEXTURE_2D_ARRAY?i.texImage3D(c,h,p,e,n,s.depth,0,d,u,null):i.texImage2D(c,h,p,e,n,0,d,u,null)}i.bindFramebuffer(t.FRAMEBUFFER,e),$(s)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,l,c,n.get(a).__webglTexture,0,K(s)):(c===t.TEXTURE_2D||c>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,l,c,n.get(a).__webglTexture,h),i.bindFramebuffer(t.FRAMEBUFFER,null)}function j(e,i,n){if(t.bindRenderbuffer(t.RENDERBUFFER,e),i.depthBuffer){const s=i.depthTexture,r=s&&s.isDepthTexture?s.type:null,a=y(i.stencilBuffer,r),l=i.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,c=K(i);$(i)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,c,a,i.width,i.height):n?t.renderbufferStorageMultisample(t.RENDERBUFFER,c,a,i.width,i.height):t.renderbufferStorage(t.RENDERBUFFER,a,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,l,t.RENDERBUFFER,e)}else{const e=i.textures;for(let s=0;s<e.length;s++){const a=e[s],l=r.convert(a.format,a.colorSpace),c=r.convert(a.type),h=_(a.internalFormat,l,c,a.colorSpace),d=K(i);n&&!1===$(i)?t.renderbufferStorageMultisample(t.RENDERBUFFER,d,h,i.width,i.height):$(i)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,d,h,i.width,i.height):t.renderbufferStorage(t.RENDERBUFFER,h,i.width,i.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function X(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(t.FRAMEBUFFER,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),E(s.depthTexture,0);const r=n.get(s.depthTexture).__webglTexture,a=K(s);if(s.depthTexture.format===nt)$(s)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,r,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,r,0);else{if(s.depthTexture.format!==st)throw new Error("Unknown depthTexture format");$(s)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,r,0,a):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,r,0)}}(s.__webglFramebuffer,e)}else if(r){s.__webglDepthbuffer=[];for(let n=0;n<6;n++)i.bindFramebuffer(t.FRAMEBUFFER,s.__webglFramebuffer[n]),s.__webglDepthbuffer[n]=t.createRenderbuffer(),j(s.__webglDepthbuffer[n],e,!1)}else i.bindFramebuffer(t.FRAMEBUFFER,s.__webglFramebuffer),s.__webglDepthbuffer=t.createRenderbuffer(),j(s.__webglDepthbuffer,e,!1);i.bindFramebuffer(t.FRAMEBUFFER,null)}const Z=[],Y=[];function K(t){return Math.min(s.maxSamples,t.samples)}function $(t){const i=n.get(t);return t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function Q(t,e){const i=t.colorSpace,n=t.format,s=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||i!==te&&i!==$t&&(Ge.getTransfer(i)===se?n===tt&&s===z||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",i)),e}function et(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?(c.width=t.naturalWidth||t.width,c.height=t.naturalHeight||t.height):"undefined"!=typeof VideoFrame&&t instanceof VideoFrame?(c.width=t.displayWidth,c.height=t.displayHeight):(c.width=t.width,c.height=t.height),c}this.allocateTextureUnit=function(){const t=S;return t>=s.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+s.maxTextures),S+=1,t},this.resetTextureUnits=function(){S=0},this.setTexture2D=E,this.setTexture2DArray=function(e,s){const r=n.get(e);e.version>0&&r.__version!==e.version?H(r,e,s):i.bindTexture(t.TEXTURE_2D_ARRAY,r.__webglTexture,t.TEXTURE0+s)},this.setTexture3D=function(e,s){const r=n.get(e);e.version>0&&r.__version!==e.version?H(r,e,s):i.bindTexture(t.TEXTURE_3D,r.__webglTexture,t.TEXTURE0+s)},this.setTextureCube=function(e,a){const o=n.get(e);e.version>0&&o.__version!==e.version?function(e,a,o){if(6!==a.image.length)return;const l=k(e,a),c=a.source;i.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+o);const h=n.get(c);if(c.version!==h.__version||!0===l){i.activeTexture(t.TEXTURE0+o);const e=Ge.getPrimaries(Ge.workingColorSpace),n=a.colorSpace===$t?null:Ge.getPrimaries(a.colorSpace),d=a.colorSpace===$t||e===n?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,a.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,a.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);const u=a.isCompressedTexture||a.image[0].isCompressedTexture,p=a.image[0]&&a.image[0].isDataTexture,m=[];for(let t=0;t<6;t++)m[t]=u||p?p?a.image[t].image:a.image[t]:f(a.image[t],!0,s.maxCubemapSize),m[t]=Q(a,m[t]);const y=m[0],w=r.convert(a.format,a.colorSpace),b=r.convert(a.type),M=_(a.internalFormat,w,b,a.colorSpace),S=!0!==a.isVideoTexture,E=void 0===h.__version||!0===l,T=c.dataReady;let A,C=x(a,y);if(L(t.TEXTURE_CUBE_MAP,a),u){S&&E&&i.texStorage2D(t.TEXTURE_CUBE_MAP,C,M,y.width,y.height);for(let e=0;e<6;e++){A=m[e].mipmaps;for(let n=0;n<A.length;n++){const s=A[n];a.format!==tt?null!==w?S?T&&i.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,s.width,s.height,w,s.data):i.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,M,s.width,s.height,0,s.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):S?T&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,s.width,s.height,w,b,s.data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,M,s.width,s.height,0,w,b,s.data)}}}else{if(A=a.mipmaps,S&&E){A.length>0&&C++;const e=et(m[0]);i.texStorage2D(t.TEXTURE_CUBE_MAP,C,M,e.width,e.height)}for(let e=0;e<6;e++)if(p){S?T&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,m[e].width,m[e].height,w,b,m[e].data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,M,m[e].width,m[e].height,0,w,b,m[e].data);for(let n=0;n<A.length;n++){const s=A[n].image[e].image;S?T&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,0,0,s.width,s.height,w,b,s.data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,M,s.width,s.height,0,w,b,s.data)}}else{S?T&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,w,b,m[e]):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,M,w,b,m[e]);for(let n=0;n<A.length;n++){const s=A[n];S?T&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,0,0,w,b,s.image[e]):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,M,w,b,s.image[e])}}}g(a)&&v(t.TEXTURE_CUBE_MAP),h.__version=c.version,a.onUpdate&&a.onUpdate(a)}e.__version=a.version}(o,e,a):i.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture,t.TEXTURE0+a)},this.rebindTextures=function(e,i,s){const r=n.get(e);void 0!==i&&V(r.__webglFramebuffer,e,e.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),void 0!==s&&X(e)},this.setupRenderTarget=function(e){const s=e.texture,o=n.get(e),l=n.get(s);e.addEventListener("dispose",b);const c=e.textures,h=!0===e.isWebGLCubeRenderTarget,d=c.length>1;if(d||(void 0===l.__webglTexture&&(l.__webglTexture=t.createTexture()),l.__version=s.version,a.memory.textures++),h){o.__webglFramebuffer=[];for(let e=0;e<6;e++)if(s.mipmaps&&s.mipmaps.length>0){o.__webglFramebuffer[e]=[];for(let i=0;i<s.mipmaps.length;i++)o.__webglFramebuffer[e][i]=t.createFramebuffer()}else o.__webglFramebuffer[e]=t.createFramebuffer()}else{if(s.mipmaps&&s.mipmaps.length>0){o.__webglFramebuffer=[];for(let e=0;e<s.mipmaps.length;e++)o.__webglFramebuffer[e]=t.createFramebuffer()}else o.__webglFramebuffer=t.createFramebuffer();if(d)for(let e=0,i=c.length;e<i;e++){const i=n.get(c[e]);void 0===i.__webglTexture&&(i.__webglTexture=t.createTexture(),a.memory.textures++)}if(e.samples>0&&!1===$(e)){o.__webglMultisampledFramebuffer=t.createFramebuffer(),o.__webglColorRenderbuffer=[],i.bindFramebuffer(t.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let i=0;i<c.length;i++){const n=c[i];o.__webglColorRenderbuffer[i]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,o.__webglColorRenderbuffer[i]);const s=r.convert(n.format,n.colorSpace),a=r.convert(n.type),l=_(n.internalFormat,s,a,n.colorSpace,!0===e.isXRRenderTarget),h=K(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,h,l,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+i,t.RENDERBUFFER,o.__webglColorRenderbuffer[i])}t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(o.__webglDepthRenderbuffer=t.createRenderbuffer(),j(o.__webglDepthRenderbuffer,e,!0)),i.bindFramebuffer(t.FRAMEBUFFER,null)}}if(h){i.bindTexture(t.TEXTURE_CUBE_MAP,l.__webglTexture),L(t.TEXTURE_CUBE_MAP,s);for(let i=0;i<6;i++)if(s.mipmaps&&s.mipmaps.length>0)for(let n=0;n<s.mipmaps.length;n++)V(o.__webglFramebuffer[i][n],e,s,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+i,n);else V(o.__webglFramebuffer[i],e,s,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+i,0);g(s)&&v(t.TEXTURE_CUBE_MAP),i.unbindTexture()}else if(d){for(let s=0,r=c.length;s<r;s++){const r=c[s],a=n.get(r);i.bindTexture(t.TEXTURE_2D,a.__webglTexture),L(t.TEXTURE_2D,r),V(o.__webglFramebuffer,e,r,t.COLOR_ATTACHMENT0+s,t.TEXTURE_2D,0),g(r)&&v(t.TEXTURE_2D)}i.unbindTexture()}else{let n=t.TEXTURE_2D;if((e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(n=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),i.bindTexture(n,l.__webglTexture),L(n,s),s.mipmaps&&s.mipmaps.length>0)for(let i=0;i<s.mipmaps.length;i++)V(o.__webglFramebuffer[i],e,s,t.COLOR_ATTACHMENT0,n,i);else V(o.__webglFramebuffer,e,s,t.COLOR_ATTACHMENT0,n,0);g(s)&&v(n),i.unbindTexture()}e.depthBuffer&&X(e)},this.updateRenderTargetMipmap=function(e){const s=e.textures;for(let r=0,a=s.length;r<a;r++){const a=s[r];if(g(a)){const s=e.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:t.TEXTURE_2D,r=n.get(a).__webglTexture;i.bindTexture(s,r),v(s),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(e.samples>0)if(!1===$(e)){const s=e.textures,r=e.width,a=e.height;let o=t.COLOR_BUFFER_BIT;const c=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,h=n.get(e),d=s.length>1;if(d)for(let e=0;e<s.length;e++)i.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,null),i.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,null,0);i.bindFramebuffer(t.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),i.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let i=0;i<s.length;i++){if(e.resolveDepthBuffer&&(e.depthBuffer&&(o|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&e.resolveStencilBuffer&&(o|=t.STENCIL_BUFFER_BIT)),d){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,h.__webglColorRenderbuffer[i]);const e=n.get(s[i]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0)}t.blitFramebuffer(0,0,r,a,0,0,r,a,o,t.NEAREST),!0===l&&(Z.length=0,Y.length=0,Z.push(t.COLOR_ATTACHMENT0+i),e.depthBuffer&&!1===e.resolveDepthBuffer&&(Z.push(c),Y.push(c),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,Y)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,Z))}if(i.bindFramebuffer(t.READ_FRAMEBUFFER,null),i.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),d)for(let e=0;e<s.length;e++){i.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,h.__webglColorRenderbuffer[e]);const r=n.get(s[e]).__webglTexture;i.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,r,0)}i.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(e.depthBuffer&&!1===e.resolveDepthBuffer&&l){const i=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[i])}},this.setupDepthRenderbuffer=X,this.setupFrameBufferTexture=V,this.useMultisampledRTT=$}function fo(t,e){return{convert:function(i,n=""){let s;const r=Ge.getTransfer(n);if(i===z)return t.UNSIGNED_BYTE;if(i===Z)return t.UNSIGNED_SHORT_4_4_4_4;if(i===Y)return t.UNSIGNED_SHORT_5_5_5_1;if(i===K)return t.UNSIGNED_INT_5_9_9_9_REV;if(i===H)return t.BYTE;if(i===V)return t.SHORT;if(i===G)return t.UNSIGNED_SHORT;if(i===j)return t.INT;if(i===W)return t.UNSIGNED_INT;if(i===q)return t.FLOAT;if(i===X)return t.HALF_FLOAT;if(i===$)return t.ALPHA;if(i===Q)return t.RGB;if(i===tt)return t.RGBA;if(i===et)return t.LUMINANCE;if(i===it)return t.LUMINANCE_ALPHA;if(i===nt)return t.DEPTH_COMPONENT;if(i===st)return t.DEPTH_STENCIL;if(i===rt)return t.RED;if(i===at)return t.RED_INTEGER;if(i===ot)return t.RG;if(i===lt)return t.RG_INTEGER;if(i===ct)return t.RGBA_INTEGER;if(i===ht||i===dt||i===ut||i===pt)if(r===se){if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===s)return null;if(i===ht)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===dt)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===ut)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===pt)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(s=e.get("WEBGL_compressed_texture_s3tc"),null===s)return null;if(i===ht)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===dt)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===ut)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===pt)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(i===mt||i===ft||i===gt||i===vt){if(s=e.get("WEBGL_compressed_texture_pvrtc"),null===s)return null;if(i===mt)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===ft)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===gt)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===vt)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(i===_t||i===yt||i===xt){if(s=e.get("WEBGL_compressed_texture_etc"),null===s)return null;if(i===_t||i===yt)return r===se?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===xt)return r===se?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}if(i===wt||i===bt||i===Mt||i===St||i===Et||i===Tt||i===At||i===Ct||i===Lt||i===kt||i===Rt||i===Pt||i===It||i===Ut){if(s=e.get("WEBGL_compressed_texture_astc"),null===s)return null;if(i===wt)return r===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===bt)return r===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Mt)return r===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===St)return r===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Et)return r===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Tt)return r===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===At)return r===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===Ct)return r===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Lt)return r===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===kt)return r===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Rt)return r===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Pt)return r===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===It)return r===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Ut)return r===se?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}if(i===Nt||i===Dt||i===Ot){if(s=e.get("EXT_texture_compression_bptc"),null===s)return null;if(i===Nt)return r===se?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Dt)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Ot)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(i===Bt||i===Ft||i===zt||i===Ht){if(s=e.get("EXT_texture_compression_rgtc"),null===s)return null;if(i===Nt)return s.COMPRESSED_RED_RGTC1_EXT;if(i===Ft)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===zt)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Ht)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return i===J?t.UNSIGNED_INT_24_8:void 0!==t[i]?t[i]:null}}}class go extends Ss{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}}class vo extends cn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const _o={type:"move"};class yo{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new vo,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 vo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new ri,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new ri),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new vo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new ri,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new ri),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.matrixWorldNeedsUpdate=!0,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),o.matrixWorldNeedsUpdate=!0,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),a.matrixWorldNeedsUpdate=!0,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(_o)))}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 vo;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}class xo{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,i){if(null===this.texture){const n=new $e;t.properties.get(n).__webglTexture=e.texture,e.depthNear==i.depthNear&&e.depthFar==i.depthFar||(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(t){if(null!==this.texture&&null===this.mesh){const e=t.cameras[0].viewport,i=new ys({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new us(new Bs(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class wo extends ve{constructor(t,e){super();const i=this;let n=null,s=1,r=null,a="local-floor",o=1,l=null,c=null,h=null,d=null,u=null,p=null;const m=new xo,f=e.getContextAttributes();let g=null,v=null;const _=[],y=[],x=new Le;let w=null;const b=new Ss;b.layers.enable(1),b.viewport=new Qe;const M=new Ss;M.layers.enable(2),M.viewport=new Qe;const S=[b,M],E=new go;E.layers.enable(1),E.layers.enable(2);let T=null,A=null;function C(t){const e=y.indexOf(t.inputSource);if(-1===e)return;const i=_[e];void 0!==i&&(i.update(t.inputSource,t.frame,l||r),i.dispatchEvent({type:t.type,data:t.inputSource}))}function L(){n.removeEventListener("select",C),n.removeEventListener("selectstart",C),n.removeEventListener("selectend",C),n.removeEventListener("squeeze",C),n.removeEventListener("squeezestart",C),n.removeEventListener("squeezeend",C),n.removeEventListener("end",L),n.removeEventListener("inputsourceschange",k);for(let t=0;t<_.length;t++){const e=y[t];null!==e&&(y[t]=null,_[t].disconnect(e))}T=null,A=null,m.reset(),t.setRenderTarget(g),u=null,d=null,h=null,n=null,v=null,N.stop(),i.isPresenting=!1,t.setPixelRatio(w),t.setSize(x.width,x.height,!1),i.dispatchEvent({type:"sessionend"})}function k(t){for(let e=0;e<t.removed.length;e++){const i=t.removed[e],n=y.indexOf(i);n>=0&&(y[n]=null,_[n].disconnect(i))}for(let e=0;e<t.added.length;e++){const i=t.added[e];let n=y.indexOf(i);if(-1===n){for(let t=0;t<_.length;t++){if(t>=y.length){y.push(i),n=t;break}if(null===y[t]){y[t]=i,n=t;break}}if(-1===n)break}const s=_[n];s&&s.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=_[t];return void 0===e&&(e=new yo,_[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=_[t];return void 0===e&&(e=new yo,_[t]=e),e.getGripSpace()},this.getHand=function(t){let e=_[t];return void 0===e&&(e=new yo,_[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(g=t.getRenderTarget(),n.addEventListener("select",C),n.addEventListener("selectstart",C),n.addEventListener("selectend",C),n.addEventListener("squeeze",C),n.addEventListener("squeezestart",C),n.addEventListener("squeezeend",C),n.addEventListener("end",L),n.addEventListener("inputsourceschange",k),!0!==f.xrCompatible&&await e.makeXRCompatible(),w=t.getPixelRatio(),t.getSize(x),void 0===n.renderState.layers){const i={antialias:f.antialias,alpha:!0,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:s};u=new XRWebGLLayer(n,e,i),n.updateRenderState({baseLayer:u}),t.setPixelRatio(1),t.setSize(u.framebufferWidth,u.framebufferHeight,!1),v=new ei(u.framebufferWidth,u.framebufferHeight,{format:tt,type:z,colorSpace:t.outputColorSpace,stencilBuffer:f.stencil})}else{let i=null,r=null,a=null;f.depth&&(a=f.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,i=f.stencil?st:nt,r=f.stencil?J:W);const o={colorFormat:e.RGBA8,depthFormat:a,scaleFactor:s};h=new XRWebGLBinding(n,e),d=h.createProjectionLayer(o),n.updateRenderState({layers:[d]}),t.setPixelRatio(1),t.setSize(d.textureWidth,d.textureHeight,!1),v=new ei(d.textureWidth,d.textureHeight,{format:tt,type:z,depthTexture:new br(d.textureWidth,d.textureHeight,r,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:f.stencil,colorSpace:t.outputColorSpace,samples:f.antialias?4:0,resolveDepthBuffer:!1===d.ignoreDepthValues})}v.isXRRenderTarget=!0,this.setFoveation(o),l=null,r=await n.requestReferenceSpace(a),N.setContext(n),N.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==n)return n.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};const R=new ri,P=new ri;function I(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===n)return;null!==m.texture&&(t.near=m.depthNear,t.far=m.depthFar),E.near=M.near=b.near=t.near,E.far=M.far=b.far=t.far,T===E.near&&A===E.far||(n.updateRenderState({depthNear:E.near,depthFar:E.far}),T=E.near,A=E.far,b.near=T,b.far=A,M.near=T,M.far=A,b.updateProjectionMatrix(),M.updateProjectionMatrix(),t.updateProjectionMatrix());const e=t.parent,i=E.cameras;I(E,e);for(let t=0;t<i.length;t++)I(i[t],e);2===i.length?function(t,e,i){R.setFromMatrixPosition(e.matrixWorld),P.setFromMatrixPosition(i.matrixWorld);const n=R.distanceTo(P),s=e.projectionMatrix.elements,r=i.projectionMatrix.elements,a=s[14]/(s[10]-1),o=s[14]/(s[10]+1),l=(s[9]+1)/s[5],c=(s[9]-1)/s[5],h=(s[8]-1)/s[0],d=(r[8]+1)/r[0],u=a*h,p=a*d,m=n/(-h+d),f=m*-h;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,w=c*o/v*g;t.projectionMatrix.makePerspective(_,y,x,w,g,v),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}(E,b,M):E.projectionMatrix.copy(b.projectionMatrix),function(t,e,i){null===i?t.matrix.copy(e.matrixWorld):(t.matrix.copy(i.matrixWorld),t.matrix.invert(),t.matrix.multiply(e.matrixWorld));t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*we*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}(t,E,e)},this.getCamera=function(){return E},this.getFoveation=function(){if(null!==d||null!==u)return o},this.setFoveation=function(t){o=t,null!==d&&(d.fixedFoveation=t),null!==u&&void 0!==u.fixedFoveation&&(u.fixedFoveation=t)},this.hasDepthSensing=function(){return null!==m.texture},this.getDepthSensingMesh=function(){return m.getMesh(E)};let U=null;const N=new Ds;N.setAnimationLoop((function(e,s){if(c=s.getViewerPose(l||r),p=s,null!==c){const e=c.views;null!==u&&(t.setRenderTargetFramebuffer(v,u.framebuffer),t.setRenderTarget(v));let i=!1;e.length!==E.cameras.length&&(E.cameras.length=0,i=!0);for(let n=0;n<e.length;n++){const s=e[n];let r=null;if(null!==u)r=u.getViewport(s);else{const e=h.getViewSubImage(d,s);r=e.viewport,0===n&&(t.setRenderTargetTextures(v,e.colorTexture,d.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(v))}let a=S[n];void 0===a&&(a=new Ss,a.layers.enable(n),a.viewport=new Qe,S[n]=a),a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale),a.projectionMatrix.fromArray(s.projectionMatrix),a.projectionMatrixInverse.copy(a.projectionMatrix).invert(),a.viewport.set(r.x,r.y,r.width,r.height),0===n&&(E.matrix.copy(a.matrix),E.matrix.decompose(E.position,E.quaternion,E.scale)),!0===i&&E.cameras.push(a)}const s=n.enabledFeatures;if(s&&s.includes("depth-sensing")){const i=h.getDepthInformation(e[0]);i&&i.isValid&&i.texture&&m.init(t,i,n.renderState)}}for(let t=0;t<_.length;t++){const e=y[t],i=_[t];null!==e&&void 0!==i&&i.update(e,s,l||r)}U&&U(e,s),s.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:s}),p=null})),this.setAnimationLoop=function(t){U=t},this.dispose=function(){}}}const bo=new Wi,Mo=new Ni;function So(t,e){function i(t,e){!0===t.matrixAutoUpdate&&t.updateMatrix(),e.value.copy(t.matrix)}function n(t,n){t.opacity.value=n.opacity,n.color&&t.diffuse.value.copy(n.color),n.emissive&&t.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(t.map.value=n.map,i(n.map,t.mapTransform)),n.alphaMap&&(t.alphaMap.value=n.alphaMap,i(n.alphaMap,t.alphaMapTransform)),n.bumpMap&&(t.bumpMap.value=n.bumpMap,i(n.bumpMap,t.bumpMapTransform),t.bumpScale.value=n.bumpScale,n.side===l&&(t.bumpScale.value*=-1)),n.normalMap&&(t.normalMap.value=n.normalMap,i(n.normalMap,t.normalMapTransform),t.normalScale.value.copy(n.normalScale),n.side===l&&t.normalScale.value.negate()),n.displacementMap&&(t.displacementMap.value=n.displacementMap,i(n.displacementMap,t.displacementMapTransform),t.displacementScale.value=n.displacementScale,t.displacementBias.value=n.displacementBias),n.emissiveMap&&(t.emissiveMap.value=n.emissiveMap,i(n.emissiveMap,t.emissiveMapTransform)),n.specularMap&&(t.specularMap.value=n.specularMap,i(n.specularMap,t.specularMapTransform)),n.alphaTest>0&&(t.alphaTest.value=n.alphaTest);const s=e.get(n),r=s.envMap,a=s.envMapRotation;r&&(t.envMap.value=r,bo.copy(a),bo.x*=-1,bo.y*=-1,bo.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(bo.y*=-1,bo.z*=-1),t.envMapRotation.value.setFromMatrix4(Mo.makeRotationFromEuler(bo)),t.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,t.reflectivity.value=n.reflectivity,t.ior.value=n.ior,t.refractionRatio.value=n.refractionRatio),n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity,i(n.lightMap,t.lightMapTransform)),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity,i(n.aoMap,t.aoMapTransform))}return{refreshFogUniforms:function(e,i){i.color.getRGB(e.fogColor.value,vs(t)),i.isFog?(e.fogNear.value=i.near,e.fogFar.value=i.far):i.isFogExp2&&(e.fogDensity.value=i.density)},refreshMaterialUniforms:function(t,s,r,a,o){s.isMeshBasicMaterial||s.isMeshLambertMaterial?n(t,s):s.isMeshToonMaterial?(n(t,s),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,s)):s.isMeshPhongMaterial?(n(t,s),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,s)):s.isMeshStandardMaterial?(n(t,s),function(t,e){t.metalness.value=e.metalness,e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap,i(e.metalnessMap,t.metalnessMapTransform));t.roughness.value=e.roughness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap,i(e.roughnessMap,t.roughnessMapTransform));e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}(t,s),s.isMeshPhysicalMaterial&&function(t,e,n){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,i(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,i(e.sheenRoughnessMap,t.sheenRoughnessMapTransform)));e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,i(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,i(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,i(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),e.side===l&&t.clearcoatNormalScale.value.negate()));e.dispersion>0&&(t.dispersion.value=e.dispersion);e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,i(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,i(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform)));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,i(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,i(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor));e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,i(e.anisotropyMap,t.anisotropyMapTransform)));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,i(e.specularColorMap,t.specularColorMapTransform));e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,i(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,s,o)):s.isMeshMatcapMaterial?(n(t,s),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,s)):s.isMeshDepthMaterial?n(t,s):s.isMeshDistanceMaterial?(n(t,s),function(t,i){const n=e.get(i).light;t.referencePosition.value.setFromMatrixPosition(n.matrixWorld),t.nearDistance.value=n.shadow.camera.near,t.farDistance.value=n.shadow.camera.far}(t,s)):s.isMeshNormalMaterial?n(t,s):s.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,i(e.map,t.mapTransform))}(t,s),s.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,s)):s.isPointsMaterial?function(t,e,n,s){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*s,e.map&&(t.map.value=e.map,i(e.map,t.uvTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap,i(e.alphaMap,t.alphaMapTransform));e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,s,r,a):s.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,i(e.map,t.mapTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap,i(e.alphaMap,t.alphaMapTransform));e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,s):s.isShadowMaterial?(t.color.value.copy(s.color),t.opacity.value=s.opacity):s.isShaderMaterial&&(s.uniformsNeedUpdate=!1)}}}function Eo(t,e,i,n){let s={},r={},a=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(t,e,i,n){const s=t.value,r=e+"_"+i;if(void 0===n[r])return n[r]="number"==typeof s||"boolean"==typeof s?s:s.clone(),!0;{const t=n[r];if("number"==typeof s||"boolean"==typeof s){if(t!==s)return n[r]=s,!0}else if(!1===t.equals(s))return t.copy(s),!0}return!1}function c(t){const e={boundary:0,storage:0};return"number"==typeof t||"boolean"==typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.storage=64):t.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",t),e}function h(e){const i=e.target;i.removeEventListener("dispose",h);const n=a.indexOf(i.__bindingPointIndex);a.splice(n,1),t.deleteBuffer(s[i.id]),delete s[i.id],delete r[i.id]}return{bind:function(t,e){const i=e.program;n.uniformBlockBinding(t,i)},update:function(i,d){let u=s[i.id];void 0===u&&(!function(t){const e=t.uniforms;let i=0;const n=16;for(let t=0,s=e.length;t<s;t++){const s=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0,e=s.length;t<e;t++){const e=s[t],r=Array.isArray(e.value)?e.value:[e.value];for(let t=0,s=r.length;t<s;t++){const s=c(r[t]),a=i%n;0!==a&&n-a<s.boundary&&(i+=n-a),e.__data=new Float32Array(s.storage/Float32Array.BYTES_PER_ELEMENT),e.__offset=i,i+=s.storage}}}const s=i%n;s>0&&(i+=n-s);t.__size=i,t.__cache={}}(i),u=function(e){const i=function(){for(let t=0;t<o;t++)if(-1===a.indexOf(t))return a.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();e.__bindingPointIndex=i;const n=t.createBuffer(),s=e.__size,r=e.usage;return t.bindBuffer(t.UNIFORM_BUFFER,n),t.bufferData(t.UNIFORM_BUFFER,s,r),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,i,n),n}(i),s[i.id]=u,i.addEventListener("dispose",h));const p=d.program;n.updateUBOMapping(i,p);const m=e.render.frame;r[i.id]!==m&&(!function(e){const i=s[e.id],n=e.uniforms,r=e.__cache;t.bindBuffer(t.UNIFORM_BUFFER,i);for(let e=0,i=n.length;e<i;e++){const i=Array.isArray(n[e])?n[e]:[n[e]];for(let n=0,s=i.length;n<s;n++){const s=i[n];if(!0===l(s,e,n,r)){const e=s.__offset,i=Array.isArray(s.value)?s.value:[s.value];let n=0;for(let r=0;r<i.length;r++){const a=i[r],o=c(a);"number"==typeof a||"boolean"==typeof a?(s.__data[0]=a,t.bufferSubData(t.UNIFORM_BUFFER,e+n,s.__data)):a.isMatrix3?(s.__data[0]=a.elements[0],s.__data[1]=a.elements[1],s.__data[2]=a.elements[2],s.__data[3]=0,s.__data[4]=a.elements[3],s.__data[5]=a.elements[4],s.__data[6]=a.elements[5],s.__data[7]=0,s.__data[8]=a.elements[6],s.__data[9]=a.elements[7],s.__data[10]=a.elements[8],s.__data[11]=0):(a.toArray(s.__data,n),n+=o.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,e,s.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}(i),r[i.id]=m)},dispose:function(){for(const e in s)t.deleteBuffer(s[e]);a=[],s={},r={}}}}class To{constructor(t={}){const{canvas:i=De(),context:n=null,depth:s=!0,stencil:r=!1,alpha:a=!1,antialias:c=!1,premultipliedAlpha:h=!0,preserveDrawingBuffer:d=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:p=!1}=t;let m;if(this.isWebGLRenderer=!0,null!==n){if("undefined"!=typeof WebGLRenderingContext&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=n.getContextAttributes().alpha}else m=a;const g=new Uint32Array(4),v=new Int32Array(4);let _=null,y=null;const x=[],w=[];this.domElement=i,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Qt,this.toneMapping=f,this.toneMappingExposure=1;const b=this;let M=!1,S=0,E=0,T=null,A=-1,C=null;const L=new Qe,k=new Qe;let R=null;const P=new En(0);let I=0,U=i.width,N=i.height,D=1,O=null,B=null;const H=new Qe(0,0,U,N),V=new Qe(0,0,U,N);let j=!1;const q=new Ns;let K=!1,$=!1;const Q=new Ni,tt=new ri,et=new Qe,it={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let nt=!1;function st(){return null===T?D:1}let rt,ot,ht,dt,ut,pt,mt,ft,gt,vt,_t,yt,xt,wt,bt,Mt,St,Et,Tt,At,Ct,Lt,kt,Rt,Pt=n;function It(t,e){return i.getContext(t,e)}try{const t={alpha:!0,depth:s,stencil:r,antialias:c,premultipliedAlpha:h,preserveDrawingBuffer:d,powerPreference:u,failIfMajorPerformanceCaveat:p};if("setAttribute"in i&&i.setAttribute("data-engine",`three.js r${e}`),i.addEventListener("webglcontextlost",Dt,!1),i.addEventListener("webglcontextrestored",Ot,!1),i.addEventListener("webglcontextcreationerror",Bt,!1),null===Pt){const e="webgl2";if(Pt=It(e,t),null===Pt)throw It(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function Ut(){rt=new gr(Pt),rt.init(),Lt=new fo(Pt,rt),ot=new Zs(Pt,rt,t,Lt),ht=new ho(Pt),dt=new yr(Pt),ut=new Ja,pt=new mo(Pt,rt,ht,ut,ot,Lt,dt),mt=new Js(b),ft=new fr(b),gt=new Os(Pt),kt=new qs(Pt,gt),vt=new vr(Pt,gt,dt,kt),_t=new wr(Pt,vt,gt,dt),Tt=new xr(Pt,ot,pt),Mt=new Ys(ut),yt=new Ya(b,mt,ft,rt,ot,kt,Mt),xt=new So(b,ut),wt=new to,bt=new ao(rt),Et=new Ws(b,mt,ft,ht,_t,m,h),St=new co(b,_t,ot),Rt=new Eo(Pt,dt,ot,ht),At=new Xs(Pt,rt,dt),Ct=new _r(Pt,rt,dt),dt.programs=yt.programs,b.capabilities=ot,b.extensions=rt,b.properties=ut,b.renderLists=wt,b.shadowMap=St,b.state=ht,b.info=dt}Ut();const Nt=new wo(b,Pt);function Dt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),M=!0}function Ot(){console.log("THREE.WebGLRenderer: Context Restored."),M=!1;const t=dt.autoReset,e=St.enabled,i=St.autoUpdate,n=St.needsUpdate,s=St.type;Ut(),dt.autoReset=t,St.enabled=e,St.autoUpdate=i,St.needsUpdate=n,St.type=s}function Bt(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function Ft(t){const e=t.target;e.removeEventListener("dispose",Ft),function(t){(function(t){const e=ut.get(t).programs;void 0!==e&&(e.forEach((function(t){yt.releaseProgram(t)})),t.isShaderMaterial&&yt.releaseShaderCache(t))})(t),ut.remove(t)}(e)}function zt(t,e,i){!0===t.transparent&&2===t.side&&!1===t.forceSinglePass?(t.side=l,t.needsUpdate=!0,Jt(t,e,i),t.side=o,t.needsUpdate=!0,Jt(t,e,i),t.side=2):Jt(t,e,i)}this.xr=Nt,this.getContext=function(){return Pt},this.getContextAttributes=function(){return Pt.getContextAttributes()},this.forceContextLoss=function(){const t=rt.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=rt.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return D},this.setPixelRatio=function(t){void 0!==t&&(D=t,this.setSize(U,N,!1))},this.getSize=function(t){return t.set(U,N)},this.setSize=function(t,e,n=!0){Nt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(U=t,N=e,i.width=Math.floor(t*D),i.height=Math.floor(e*D),!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(U*D,N*D).floor()},this.setDrawingBufferSize=function(t,e,n){U=t,N=e,D=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(L)},this.getViewport=function(t){return t.copy(H)},this.setViewport=function(t,e,i,n){t.isVector4?H.set(t.x,t.y,t.z,t.w):H.set(t,e,i,n),ht.viewport(L.copy(H).multiplyScalar(D).round())},this.getScissor=function(t){return t.copy(V)},this.setScissor=function(t,e,i,n){t.isVector4?V.set(t.x,t.y,t.z,t.w):V.set(t,e,i,n),ht.scissor(k.copy(V).multiplyScalar(D).round())},this.getScissorTest=function(){return j},this.setScissorTest=function(t){ht.setScissorTest(j=t)},this.setOpaqueSort=function(t){O=t},this.setTransparentSort=function(t){B=t},this.getClearColor=function(t){return t.copy(Et.getClearColor())},this.setClearColor=function(){Et.setClearColor.apply(Et,arguments)},this.getClearAlpha=function(){return Et.getClearAlpha()},this.setClearAlpha=function(){Et.setClearAlpha.apply(Et,arguments)},this.clear=function(t=!0,e=!0,i=!0){let n=0;if(t){let t=!1;if(null!==T){const e=T.texture.format;t=e===ct||e===lt||e===at}if(t){const t=T.texture.type,e=t===z||t===W||t===G||t===J||t===Z||t===Y,i=Et.getClearColor(),n=Et.getClearAlpha(),s=i.r,r=i.g,a=i.b;e?(g[0]=s,g[1]=r,g[2]=a,g[3]=n,Pt.clearBufferuiv(Pt.COLOR,0,g)):(v[0]=s,v[1]=r,v[2]=a,v[3]=n,Pt.clearBufferiv(Pt.COLOR,0,v))}else n|=Pt.COLOR_BUFFER_BIT}e&&(n|=Pt.DEPTH_BUFFER_BIT),i&&(n|=Pt.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Pt.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){i.removeEventListener("webglcontextlost",Dt,!1),i.removeEventListener("webglcontextrestored",Ot,!1),i.removeEventListener("webglcontextcreationerror",Bt,!1),wt.dispose(),bt.dispose(),ut.dispose(),mt.dispose(),ft.dispose(),_t.dispose(),kt.dispose(),Rt.dispose(),yt.dispose(),Nt.dispose(),Nt.removeEventListener("sessionstart",Vt),Nt.removeEventListener("sessionend",Gt),jt.stop()},this.renderBufferDirect=function(t,e,i,n,s,r){null===e&&(e=it);const a=s.isMesh&&s.matrixWorld.determinant()<0,o=function(t,e,i,n,s){!0!==e.isScene&&(e=it);pt.resetTextureUnits();const r=e.fog,a=n.isMeshStandardMaterial?e.environment:null,o=null===T?b.outputColorSpace:!0===T.isXRRenderTarget?T.texture.colorSpace:te,l=(n.isMeshStandardMaterial?ft:mt).get(n.envMap||a),c=!0===n.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,h=!!i.attributes.tangent&&(!!n.normalMap||n.anisotropy>0),d=!!i.morphAttributes.position,u=!!i.morphAttributes.normal,p=!!i.morphAttributes.color;let m=f;n.toneMapped&&(null!==T&&!0!==T.isXRRenderTarget||(m=b.toneMapping));const g=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,v=void 0!==g?g.length:0,_=ut.get(n),x=y.state.lights;if(!0===K&&(!0===$||t!==C)){const e=t===C&&n.id===A;Mt.setState(n,t,e)}let w=!1;n.version===_.__version?_.needsLights&&_.lightsStateVersion!==x.state.version||_.outputColorSpace!==o||s.isBatchedMesh&&!1===_.batching?w=!0:s.isBatchedMesh||!0!==_.batching?s.isBatchedMesh&&!0===_.batchingColor&&null===s.colorTexture||s.isBatchedMesh&&!1===_.batchingColor&&null!==s.colorTexture||s.isInstancedMesh&&!1===_.instancing?w=!0:s.isInstancedMesh||!0!==_.instancing?s.isSkinnedMesh&&!1===_.skinning?w=!0:s.isSkinnedMesh||!0!==_.skinning?s.isInstancedMesh&&!0===_.instancingColor&&null===s.instanceColor||s.isInstancedMesh&&!1===_.instancingColor&&null!==s.instanceColor||s.isInstancedMesh&&!0===_.instancingMorph&&null===s.morphTexture||s.isInstancedMesh&&!1===_.instancingMorph&&null!==s.morphTexture||_.envMap!==l||!0===n.fog&&_.fog!==r?w=!0:void 0===_.numClippingPlanes||_.numClippingPlanes===Mt.numPlanes&&_.numIntersection===Mt.numIntersection?(_.vertexAlphas!==c||_.vertexTangents!==h||_.morphTargets!==d||_.morphNormals!==u||_.morphColors!==p||_.toneMapping!==m||_.morphTargetsCount!==v)&&(w=!0):w=!0:w=!0:w=!0:w=!0:(w=!0,_.__version=n.version);let M=_.currentProgram;!0===w&&(M=Jt(n,e,s));let S=!1,E=!1,L=!1;const k=M.getUniforms(),R=_.uniforms;ht.useProgram(M.program)&&(S=!0,E=!0,L=!0);n.id!==A&&(A=n.id,E=!0);if(S||C!==t){k.setValue(Pt,"projectionMatrix",t.projectionMatrix),k.setValue(Pt,"viewMatrix",t.matrixWorldInverse);const e=k.map.cameraPosition;void 0!==e&&e.setValue(Pt,tt.setFromMatrixPosition(t.matrixWorld)),ot.logarithmicDepthBuffer&&k.setValue(Pt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&k.setValue(Pt,"isOrthographic",!0===t.isOrthographicCamera),C!==t&&(C=t,E=!0,L=!0)}if(s.isSkinnedMesh){k.setOptional(Pt,s,"bindMatrix"),k.setOptional(Pt,s,"bindMatrixInverse");const t=s.skeleton;t&&(null===t.boneTexture&&t.computeBoneTexture(),k.setValue(Pt,"boneTexture",t.boneTexture,pt))}s.isBatchedMesh&&(k.setOptional(Pt,s,"batchingTexture"),k.setValue(Pt,"batchingTexture",s._matricesTexture,pt),k.setOptional(Pt,s,"batchingIdTexture"),k.setValue(Pt,"batchingIdTexture",s._indirectTexture,pt),k.setOptional(Pt,s,"batchingColorTexture"),null!==s._colorsTexture&&k.setValue(Pt,"batchingColorTexture",s._colorsTexture,pt));const P=i.morphAttributes;void 0===P.position&&void 0===P.normal&&void 0===P.color||Tt.update(s,i,M);(E||_.receiveShadow!==s.receiveShadow)&&(_.receiveShadow=s.receiveShadow,k.setValue(Pt,"receiveShadow",s.receiveShadow));n.isMeshGouraudMaterial&&null!==n.envMap&&(R.envMap.value=l,R.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1);n.isMeshStandardMaterial&&null===n.envMap&&null!==e.environment&&(R.envMapIntensity.value=e.environmentIntensity);E&&(k.setValue(Pt,"toneMappingExposure",b.toneMappingExposure),_.needsLights&&(U=L,(I=R).ambientLightColor.needsUpdate=U,I.lightProbe.needsUpdate=U,I.directionalLights.needsUpdate=U,I.directionalLightShadows.needsUpdate=U,I.pointLights.needsUpdate=U,I.pointLightShadows.needsUpdate=U,I.spotLights.needsUpdate=U,I.spotLightShadows.needsUpdate=U,I.rectAreaLights.needsUpdate=U,I.hemisphereLights.needsUpdate=U),r&&!0===n.fog&&xt.refreshFogUniforms(R,r),xt.refreshMaterialUniforms(R,n,D,N,y.state.transmissionRenderTarget[t.id]),Aa.upload(Pt,Kt(_),R,pt));var I,U;n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(Aa.upload(Pt,Kt(_),R,pt),n.uniformsNeedUpdate=!1);n.isSpriteMaterial&&k.setValue(Pt,"center",s.center);if(k.setValue(Pt,"modelViewMatrix",s.modelViewMatrix),k.setValue(Pt,"normalMatrix",s.normalMatrix),k.setValue(Pt,"modelMatrix",s.matrixWorld),n.isShaderMaterial||n.isRawShaderMaterial){const t=n.uniformsGroups;for(let e=0,i=t.length;e<i;e++){const i=t[e];Rt.update(i,M),Rt.bind(i,M)}}return M}(t,e,i,n,s);ht.setMaterial(n,a);let l=i.index,c=1;if(!0===n.wireframe){if(l=vt.getWireframeAttribute(i),void 0===l)return;c=2}const h=i.drawRange,d=i.attributes.position;let u=h.start*c,p=(h.start+h.count)*c;null!==r&&(u=Math.max(u,r.start*c),p=Math.min(p,(r.start+r.count)*c)),null!==l?(u=Math.max(u,0),p=Math.min(p,l.count)):null!=d&&(u=Math.max(u,0),p=Math.min(p,d.count));const m=p-u;if(m<0||m===1/0)return;let g;kt.setup(s,n,o,i,l);let v=At;if(null!==l&&(g=gt.get(l),v=Ct,v.setIndex(g)),s.isMesh)!0===n.wireframe?(ht.setLineWidth(n.wireframeLinewidth*st()),v.setMode(Pt.LINES)):v.setMode(Pt.TRIANGLES);else if(s.isLine){let t=n.linewidth;void 0===t&&(t=1),ht.setLineWidth(t*st()),s.isLineSegments?v.setMode(Pt.LINES):s.isLineLoop?v.setMode(Pt.LINE_LOOP):v.setMode(Pt.LINE_STRIP)}else s.isPoints?v.setMode(Pt.POINTS):s.isSprite&&v.setMode(Pt.TRIANGLES);if(s.isBatchedMesh)if(null!==s._multiDrawInstances)v.renderMultiDrawInstances(s._multiDrawStarts,s._multiDrawCounts,s._multiDrawCount,s._multiDrawInstances);else if(rt.get("WEBGL_multi_draw"))v.renderMultiDraw(s._multiDrawStarts,s._multiDrawCounts,s._multiDrawCount);else{const t=s._multiDrawStarts,e=s._multiDrawCounts,i=s._multiDrawCount,r=l?gt.get(l).bytesPerElement:1,a=ut.get(n).currentProgram.getUniforms();for(let n=0;n<i;n++)a.setValue(Pt,"_gl_DrawID",n),v.render(t[n]/r,e[n])}else if(s.isInstancedMesh)v.renderInstances(u,m,s.count);else if(i.isInstancedBufferGeometry){const t=void 0!==i._maxInstanceCount?i._maxInstanceCount:1/0,e=Math.min(i.instanceCount,t);v.renderInstances(u,m,e)}else v.render(u,m)},this.compile=function(t,e,i=null){null===i&&(i=t),y=bt.get(i),y.init(e),w.push(y),i.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(y.pushLight(t),t.castShadow&&y.pushShadow(t))})),t!==i&&t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(y.pushLight(t),t.castShadow&&y.pushShadow(t))})),y.setupLights();const n=new Set;return t.traverse((function(t){const e=t.material;if(e)if(Array.isArray(e))for(let s=0;s<e.length;s++){const r=e[s];zt(r,i,t),n.add(r)}else zt(e,i,t),n.add(e)})),w.pop(),y=null,n},this.compileAsync=function(t,e,i=null){const n=this.compile(t,e,i);return new Promise((e=>{function i(){n.forEach((function(t){ut.get(t).currentProgram.isReady()&&n.delete(t)})),0!==n.size?setTimeout(i,10):e(t)}null!==rt.get("KHR_parallel_shader_compile")?i():setTimeout(i,10)}))};let Ht=null;function Vt(){jt.stop()}function Gt(){jt.start()}const jt=new Ds;function Wt(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)y.pushLight(t),t.castShadow&&y.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||q.intersectsSprite(t)){n&&et.setFromMatrixPosition(t.matrixWorld).applyMatrix4(Q);const e=_t.update(t),s=t.material;s.visible&&_.push(t,e,s,i,et.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||q.intersectsObject(t))){const e=_t.update(t),s=t.material;if(n&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),et.copy(t.boundingSphere.center)):(null===e.boundingSphere&&e.computeBoundingSphere(),et.copy(e.boundingSphere.center)),et.applyMatrix4(t.matrixWorld).applyMatrix4(Q)),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&&_.push(t,e,o,i,et.z,a)}}else s.visible&&_.push(t,e,s,i,et.z,null)}const s=t.children;for(let t=0,r=s.length;t<r;t++)Wt(s[t],e,i,n)}function qt(t,e,i,n){const s=t.opaque,r=t.transmissive,a=t.transparent;y.setupLightsView(i),!0===K&&Mt.setGlobalState(b.clippingPlanes,i),n&&ht.viewport(L.copy(n)),s.length>0&&Zt(s,e,i),r.length>0&&Zt(r,e,i),a.length>0&&Zt(a,e,i),ht.buffers.depth.setTest(!0),ht.buffers.depth.setMask(!0),ht.buffers.color.setMask(!0),ht.setPolygonOffset(!1)}function Xt(t,e,i,n){if(null!==(!0===i.isScene?i.overrideMaterial:null))return;void 0===y.state.transmissionRenderTarget[n.id]&&(y.state.transmissionRenderTarget[n.id]=new ei(1,1,{generateMipmaps:!0,type:rt.has("EXT_color_buffer_half_float")||rt.has("EXT_color_buffer_float")?X:z,minFilter:F,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ge.workingColorSpace}));const s=y.state.transmissionRenderTarget[n.id],a=n.viewport||L;s.setSize(a.z,a.w);const o=b.getRenderTarget();b.setRenderTarget(s),b.getClearColor(P),I=b.getClearAlpha(),I<1&&b.setClearColor(16777215,.5),nt?Et.render(i):b.clear();const c=b.toneMapping;b.toneMapping=f;const h=n.viewport;if(void 0!==n.viewport&&(n.viewport=void 0),y.setupLightsView(n),!0===K&&Mt.setGlobalState(b.clippingPlanes,n),Zt(t,i,n),pt.updateMultisampleRenderTarget(s),pt.updateRenderTargetMipmap(s),!1===rt.has("WEBGL_multisampled_render_to_texture")){let t=!1;for(let s=0,r=e.length;s<r;s++){const r=e[s],a=r.object,o=r.geometry,c=r.material,h=r.group;if(2===c.side&&a.layers.test(n.layers)){const e=c.side;c.side=l,c.needsUpdate=!0,Yt(a,i,n,o,c,h),c.side=e,c.needsUpdate=!0,t=!0}}!0===t&&(pt.updateMultisampleRenderTarget(s),pt.updateRenderTargetMipmap(s))}b.setRenderTarget(o),b.setClearColor(P,I),void 0!==h&&(n.viewport=h),b.toneMapping=c}function Zt(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)&&Yt(a,e,i,o,l,c)}}function Yt(t,e,i,n,s,r){t.onBeforeRender(b,e,i,n,s,r),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),!0===s.transparent&&2===s.side&&!1===s.forceSinglePass?(s.side=l,s.needsUpdate=!0,b.renderBufferDirect(i,e,n,s,t,r),s.side=o,s.needsUpdate=!0,b.renderBufferDirect(i,e,n,s,t,r),s.side=2):b.renderBufferDirect(i,e,n,s,t,r),t.onAfterRender(b,e,i,n,s,r)}function Jt(t,e,i){!0!==e.isScene&&(e=it);const n=ut.get(t),s=y.state.lights,r=y.state.shadowsArray,a=s.state.version,o=yt.getParameters(t,s.state,r,e,i),l=yt.getProgramCacheKey(o);let c=n.programs;n.environment=t.isMeshStandardMaterial?e.environment:null,n.fog=e.fog,n.envMap=(t.isMeshStandardMaterial?ft:mt).get(t.envMap||n.environment),n.envMapRotation=null!==n.environment&&null===t.envMap?e.environmentRotation:t.envMapRotation,void 0===c&&(t.addEventListener("dispose",Ft),c=new Map,n.programs=c);let h=c.get(l);if(void 0!==h){if(n.currentProgram===h&&n.lightsStateVersion===a)return $t(t,o),h}else o.uniforms=yt.getUniforms(t),t.onBeforeCompile(o,b),h=yt.acquireProgram(o,l),c.set(l,h),n.uniforms=o.uniforms;const d=n.uniforms;return(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(d.clippingPlanes=Mt.uniform),$t(t,o),n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),n.lightsStateVersion=a,n.needsLights&&(d.ambientLightColor.value=s.state.ambient,d.lightProbe.value=s.state.probe,d.directionalLights.value=s.state.directional,d.directionalLightShadows.value=s.state.directionalShadow,d.spotLights.value=s.state.spot,d.spotLightShadows.value=s.state.spotShadow,d.rectAreaLights.value=s.state.rectArea,d.ltc_1.value=s.state.rectAreaLTC1,d.ltc_2.value=s.state.rectAreaLTC2,d.pointLights.value=s.state.point,d.pointLightShadows.value=s.state.pointShadow,d.hemisphereLights.value=s.state.hemi,d.directionalShadowMap.value=s.state.directionalShadowMap,d.directionalShadowMatrix.value=s.state.directionalShadowMatrix,d.spotShadowMap.value=s.state.spotShadowMap,d.spotLightMatrix.value=s.state.spotLightMatrix,d.spotLightMap.value=s.state.spotLightMap,d.pointShadowMap.value=s.state.pointShadowMap,d.pointShadowMatrix.value=s.state.pointShadowMatrix),n.currentProgram=h,n.uniformsList=null,h}function Kt(t){if(null===t.uniformsList){const e=t.currentProgram.getUniforms();t.uniformsList=Aa.seqWithValue(e.seq,t.uniforms)}return t.uniformsList}function $t(t,e){const i=ut.get(t);i.outputColorSpace=e.outputColorSpace,i.batching=e.batching,i.batchingColor=e.batchingColor,i.instancing=e.instancing,i.instancingColor=e.instancingColor,i.instancingMorph=e.instancingMorph,i.skinning=e.skinning,i.morphTargets=e.morphTargets,i.morphNormals=e.morphNormals,i.morphColors=e.morphColors,i.morphTargetsCount=e.morphTargetsCount,i.numClippingPlanes=e.numClippingPlanes,i.numIntersection=e.numClipIntersection,i.vertexAlphas=e.vertexAlphas,i.vertexTangents=e.vertexTangents,i.toneMapping=e.toneMapping}jt.setAnimationLoop((function(t){Ht&&Ht(t)})),"undefined"!=typeof self&&jt.setContext(self),this.setAnimationLoop=function(t){Ht=t,Nt.setAnimationLoop(t),null===t?jt.stop():jt.start()},Nt.addEventListener("sessionstart",Vt),Nt.addEventListener("sessionend",Gt),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===M)return;if(!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===Nt.enabled&&!0===Nt.isPresenting&&(!0===Nt.cameraAutoUpdate&&Nt.updateCamera(e),e=Nt.getCamera()),!0===t.isScene&&t.onBeforeRender(b,t,e,T),y=bt.get(t,w.length),y.init(e),w.push(y),Q.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),q.setFromProjectionMatrix(Q),$=this.localClippingEnabled,K=Mt.init(this.clippingPlanes,$),_=wt.get(t,x.length),_.init(),x.push(_),!0===Nt.enabled&&!0===Nt.isPresenting){const t=b.xr.getDepthSensingMesh();null!==t&&Wt(t,e,-1/0,b.sortObjects)}Wt(t,e,0,b.sortObjects),_.finish(),!0===b.sortObjects&&_.sort(O,B),nt=!1===Nt.enabled||!1===Nt.isPresenting||!1===Nt.hasDepthSensing(),nt&&Et.addToRenderList(_,t),this.info.render.frame++,!0===K&&Mt.beginShadows();const i=y.state.shadowsArray;St.render(i,t,e),!0===K&&Mt.endShadows(),!0===this.info.autoReset&&this.info.reset();const n=_.opaque,s=_.transmissive;if(y.setupLights(),e.isArrayCamera){const i=e.cameras;if(s.length>0)for(let e=0,r=i.length;e<r;e++){Xt(n,s,t,i[e])}nt&&Et.render(t);for(let e=0,n=i.length;e<n;e++){const n=i[e];qt(_,t,n,n.viewport)}}else s.length>0&&Xt(n,s,t,e),nt&&Et.render(t),qt(_,t,e);null!==T&&(pt.updateMultisampleRenderTarget(T),pt.updateRenderTargetMipmap(T)),!0===t.isScene&&t.onAfterRender(b,t,e),kt.resetDefaultState(),A=-1,C=null,w.pop(),w.length>0?(y=w[w.length-1],!0===K&&Mt.setGlobalState(b.clippingPlanes,y.state.camera)):y=null,x.pop(),_=x.length>0?x[x.length-1]:null},this.getActiveCubeFace=function(){return S},this.getActiveMipmapLevel=function(){return E},this.getRenderTarget=function(){return T},this.setRenderTargetTextures=function(t,e,i){ut.get(t.texture).__webglTexture=e,ut.get(t.depthTexture).__webglTexture=i;const n=ut.get(t);n.__hasExternalTextures=!0,n.__autoAllocateDepthBuffer=void 0===i,n.__autoAllocateDepthBuffer||!0===rt.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=ut.get(t);i.__webglFramebuffer=e,i.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,i=0){T=t,S=e,E=i;let n=!0,s=null,r=!1,a=!1;if(t){const o=ut.get(t);void 0!==o.__useDefaultFramebuffer?(ht.bindFramebuffer(Pt.FRAMEBUFFER,null),n=!1):void 0===o.__webglFramebuffer?pt.setupRenderTarget(t):o.__hasExternalTextures&&pt.rebindTextures(t,ut.get(t.texture).__webglTexture,ut.get(t.depthTexture).__webglTexture);const l=t.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(a=!0);const c=ut.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(s=Array.isArray(c[e])?c[e][i]:c[e],r=!0):s=t.samples>0&&!1===pt.useMultisampledRTT(t)?ut.get(t).__webglMultisampledFramebuffer:Array.isArray(c)?c[i]:c,L.copy(t.viewport),k.copy(t.scissor),R=t.scissorTest}else L.copy(H).multiplyScalar(D).floor(),k.copy(V).multiplyScalar(D).floor(),R=j;if(ht.bindFramebuffer(Pt.FRAMEBUFFER,s)&&n&&ht.drawBuffers(t,s),ht.viewport(L),ht.scissor(k),ht.setScissorTest(R),r){const n=ut.get(t.texture);Pt.framebufferTexture2D(Pt.FRAMEBUFFER,Pt.COLOR_ATTACHMENT0,Pt.TEXTURE_CUBE_MAP_POSITIVE_X+e,n.__webglTexture,i)}else if(a){const n=ut.get(t.texture),s=e||0;Pt.framebufferTextureLayer(Pt.FRAMEBUFFER,Pt.COLOR_ATTACHMENT0,n.__webglTexture,i||0,s)}A=-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=ut.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){ht.bindFramebuffer(Pt.FRAMEBUFFER,o);try{const a=t.texture,o=a.format,l=a.type;if(!ot.textureFormatReadable(o))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!ot.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-n&&i>=0&&i<=t.height-s&&Pt.readPixels(e,i,n,s,Lt.convert(o),Lt.convert(l),r)}finally{const t=null!==T?ut.get(T).__webglFramebuffer:null;ht.bindFramebuffer(Pt.FRAMEBUFFER,t)}}},this.readRenderTargetPixelsAsync=async function(t,e,i,n,s,r,a){if(!t||!t.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=ut.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){ht.bindFramebuffer(Pt.FRAMEBUFFER,o);try{const a=t.texture,o=a.format,l=a.type;if(!ot.textureFormatReadable(o))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ot.textureTypeReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(e>=0&&e<=t.width-n&&i>=0&&i<=t.height-s){const t=Pt.createBuffer();Pt.bindBuffer(Pt.PIXEL_PACK_BUFFER,t),Pt.bufferData(Pt.PIXEL_PACK_BUFFER,r.byteLength,Pt.STREAM_READ),Pt.readPixels(e,i,n,s,Lt.convert(o),Lt.convert(l),0),Pt.flush();const a=Pt.fenceSync(Pt.SYNC_GPU_COMMANDS_COMPLETE,0);await function(t,e,i){return new Promise((function(n,s){setTimeout((function r(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:s();break;case t.TIMEOUT_EXPIRED:setTimeout(r,i);break;default:n()}}),i)}))}(Pt,a,4);try{Pt.bindBuffer(Pt.PIXEL_PACK_BUFFER,t),Pt.getBufferSubData(Pt.PIXEL_PACK_BUFFER,0,r)}finally{Pt.deleteBuffer(t),Pt.deleteSync(a)}return r}}finally{const t=null!==T?ut.get(T).__webglFramebuffer:null;ht.bindFramebuffer(Pt.FRAMEBUFFER,t)}}},this.copyFramebufferToTexture=function(t,e=null,i=0){!0!==t.isTexture&&(console.warn("WebGLRenderer: copyFramebufferToTexture function signature has changed."),e=arguments[0]||null,t=arguments[1]);const n=Math.pow(2,-i),s=Math.floor(t.image.width*n),r=Math.floor(t.image.height*n),a=null!==e?e.x:0,o=null!==e?e.y:0;pt.setTexture2D(t,0),Pt.copyTexSubImage2D(Pt.TEXTURE_2D,i,0,0,a,o,s,r),ht.unbindTexture()},this.copyTextureToTexture=function(t,e,i=null,n=null,s=0){let r,a,o,l,c,h;!0!==t.isTexture&&(console.warn("WebGLRenderer: copyTextureToTexture function signature has changed."),n=arguments[0]||null,t=arguments[1],e=arguments[2],s=arguments[3]||0,i=null),null!==i?(r=i.max.x-i.min.x,a=i.max.y-i.min.y,o=i.min.x,l=i.min.y):(r=t.image.width,a=t.image.height,o=0,l=0),null!==n?(c=n.x,h=n.y):(c=0,h=0);const d=Lt.convert(e.format),u=Lt.convert(e.type);pt.setTexture2D(e,0),Pt.pixelStorei(Pt.UNPACK_FLIP_Y_WEBGL,e.flipY),Pt.pixelStorei(Pt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),Pt.pixelStorei(Pt.UNPACK_ALIGNMENT,e.unpackAlignment);const p=Pt.getParameter(Pt.UNPACK_ROW_LENGTH),m=Pt.getParameter(Pt.UNPACK_IMAGE_HEIGHT),f=Pt.getParameter(Pt.UNPACK_SKIP_PIXELS),g=Pt.getParameter(Pt.UNPACK_SKIP_ROWS),v=Pt.getParameter(Pt.UNPACK_SKIP_IMAGES),_=t.isCompressedTexture?t.mipmaps[s]:t.image;Pt.pixelStorei(Pt.UNPACK_ROW_LENGTH,_.width),Pt.pixelStorei(Pt.UNPACK_IMAGE_HEIGHT,_.height),Pt.pixelStorei(Pt.UNPACK_SKIP_PIXELS,o),Pt.pixelStorei(Pt.UNPACK_SKIP_ROWS,l),t.isDataTexture?Pt.texSubImage2D(Pt.TEXTURE_2D,s,c,h,r,a,d,u,_.data):t.isCompressedTexture?Pt.compressedTexSubImage2D(Pt.TEXTURE_2D,s,c,h,_.width,_.height,d,_.data):Pt.texSubImage2D(Pt.TEXTURE_2D,s,c,h,r,a,d,u,_),Pt.pixelStorei(Pt.UNPACK_ROW_LENGTH,p),Pt.pixelStorei(Pt.UNPACK_IMAGE_HEIGHT,m),Pt.pixelStorei(Pt.UNPACK_SKIP_PIXELS,f),Pt.pixelStorei(Pt.UNPACK_SKIP_ROWS,g),Pt.pixelStorei(Pt.UNPACK_SKIP_IMAGES,v),0===s&&e.generateMipmaps&&Pt.generateMipmap(Pt.TEXTURE_2D),ht.unbindTexture()},this.copyTextureToTexture3D=function(t,e,i=null,n=null,s=0){let r,a,o,l,c,h,d,u,p;!0!==t.isTexture&&(console.warn("WebGLRenderer: copyTextureToTexture3D function signature has changed."),i=arguments[0]||null,n=arguments[1]||null,t=arguments[2],e=arguments[3],s=arguments[4]||0);const m=t.isCompressedTexture?t.mipmaps[s]:t.image;null!==i?(r=i.max.x-i.min.x,a=i.max.y-i.min.y,o=i.max.z-i.min.z,l=i.min.x,c=i.min.y,h=i.min.z):(r=m.width,a=m.height,o=m.depth,l=0,c=0,h=0),null!==n?(d=n.x,u=n.y,p=n.z):(d=0,u=0,p=0);const f=Lt.convert(e.format),g=Lt.convert(e.type);let v;if(e.isData3DTexture)pt.setTexture3D(e,0),v=Pt.TEXTURE_3D;else{if(!e.isDataArrayTexture&&!e.isCompressedArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");pt.setTexture2DArray(e,0),v=Pt.TEXTURE_2D_ARRAY}Pt.pixelStorei(Pt.UNPACK_FLIP_Y_WEBGL,e.flipY),Pt.pixelStorei(Pt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),Pt.pixelStorei(Pt.UNPACK_ALIGNMENT,e.unpackAlignment);const _=Pt.getParameter(Pt.UNPACK_ROW_LENGTH),y=Pt.getParameter(Pt.UNPACK_IMAGE_HEIGHT),x=Pt.getParameter(Pt.UNPACK_SKIP_PIXELS),w=Pt.getParameter(Pt.UNPACK_SKIP_ROWS),b=Pt.getParameter(Pt.UNPACK_SKIP_IMAGES);Pt.pixelStorei(Pt.UNPACK_ROW_LENGTH,m.width),Pt.pixelStorei(Pt.UNPACK_IMAGE_HEIGHT,m.height),Pt.pixelStorei(Pt.UNPACK_SKIP_PIXELS,l),Pt.pixelStorei(Pt.UNPACK_SKIP_ROWS,c),Pt.pixelStorei(Pt.UNPACK_SKIP_IMAGES,h),t.isDataTexture||t.isData3DTexture?Pt.texSubImage3D(v,s,d,u,p,r,a,o,f,g,m.data):e.isCompressedArrayTexture?Pt.compressedTexSubImage3D(v,s,d,u,p,r,a,o,f,m.data):Pt.texSubImage3D(v,s,d,u,p,r,a,o,f,g,m),Pt.pixelStorei(Pt.UNPACK_ROW_LENGTH,_),Pt.pixelStorei(Pt.UNPACK_IMAGE_HEIGHT,y),Pt.pixelStorei(Pt.UNPACK_SKIP_PIXELS,x),Pt.pixelStorei(Pt.UNPACK_SKIP_ROWS,w),Pt.pixelStorei(Pt.UNPACK_SKIP_IMAGES,b),0===s&&e.generateMipmaps&&Pt.generateMipmap(v),ht.unbindTexture()},this.initRenderTarget=function(t){void 0===ut.get(t).__webglFramebuffer&&pt.setupRenderTarget(t)},this.initTexture=function(t){t.isCubeTexture?pt.setTextureCube(t,0):t.isData3DTexture?pt.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?pt.setTexture2DArray(t,0):pt.setTexture2D(t,0),ht.unbindTexture()},this.resetState=function(){S=0,E=0,T=null,ht.reset(),kt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return fe}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=t===ee?"display-p3":"srgb",e.unpackColorSpace=Ge.workingColorSpace===ie?"display-p3":"srgb"}}class Ao{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new En(t),this.density=e}clone(){return new Ao(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Co{constructor(t,e=1,i=1e3){this.isFog=!0,this.name="",this.color=new En(t),this.near=e,this.far=i}clone(){return new Co(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Lo extends cn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Wi,this.environmentIntensity=1,this.environmentRotation=new Wi,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,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),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.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class ko{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=pe,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=be()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}get updateRange(){return Be("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}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=be()),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=be()),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 Ro=new ri;class Po{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++)Ro.fromBufferAttribute(this,e),Ro.applyMatrix4(t),this.setXYZ(e,Ro.x,Ro.y,Ro.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Ro.fromBufferAttribute(this,e),Ro.applyNormalMatrix(t),this.setXYZ(e,Ro.x,Ro.y,Ro.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Ro.fromBufferAttribute(this,e),Ro.transformDirection(t),this.setXYZ(e,Ro.x,Ro.y,Ro.z);return this}getComponent(t,e){let i=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(i=Te(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=Ae(i,this.array)),this.data.array[t*this.data.stride+this.offset+e]=i,this}setX(t,e){return this.normalized&&(e=Ae(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=Ae(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=Ae(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=Ae(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=Te(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Te(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Te(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Te(e,this.array)),e}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=Ae(e,this.array),i=Ae(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=Ae(e,this.array),i=Ae(i,this.array),n=Ae(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=Ae(e,this.array),i=Ae(i,this.array),n=Ae(n,this.array),s=Ae(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 On(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 Po(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 Io extends Cn{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new En(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 Uo;const No=new ri,Do=new ri,Oo=new ri,Bo=new Le,Fo=new Le,zo=new Ni,Ho=new ri,Vo=new ri,Go=new ri,jo=new Le,Wo=new Le,qo=new Le;class Xo extends cn{constructor(t=new Io){if(super(),this.isSprite=!0,this.type="Sprite",void 0===Uo){Uo=new Zn;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 ko(t,5);Uo.setIndex([0,1,2,0,2,3]),Uo.setAttribute("position",new Po(e,3,0,!1)),Uo.setAttribute("uv",new Po(e,2,3,!1))}this.geometry=Uo,this.material=t,this.center=new Le(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Do.setFromMatrixScale(this.matrixWorld),zo.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Oo.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Do.multiplyScalar(-Oo.z);const i=this.material.rotation;let n,s;0!==i&&(s=Math.cos(i),n=Math.sin(i));const r=this.center;Zo(Ho.set(-.5,-.5,0),Oo,r,Do,n,s),Zo(Vo.set(.5,-.5,0),Oo,r,Do,n,s),Zo(Go.set(.5,.5,0),Oo,r,Do,n,s),jo.set(0,0),Wo.set(1,0),qo.set(1,1);let a=t.ray.intersectTriangle(Ho,Vo,Go,!1,No);if(null===a&&(Zo(Vo.set(-.5,.5,0),Oo,r,Do,n,s),Wo.set(0,1),a=t.ray.intersectTriangle(Ho,Go,Vo,!1,No),null===a))return;const o=t.ray.origin.distanceTo(No);o<t.near||o>t.far||e.push({distance:o,point:No.clone(),uv:xn.getInterpolation(No,Ho,Vo,Go,jo,Wo,qo,new Le),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 Zo(t,e,i,n,s,r){Bo.subVectors(t,i).addScalar(.5).multiply(n),void 0!==s?(Fo.x=r*Bo.x-s*Bo.y,Fo.y=s*Bo.x+r*Bo.y):Fo.copy(Bo),t.copy(e),t.x+=Fo.x,t.y+=Fo.y,t.applyMatrix4(zo)}const Yo=new ri,Jo=new ri;class Ko extends cn{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){Yo.setFromMatrixPosition(this.matrixWorld);const i=t.ray.origin.distanceTo(Yo);this.getObjectForDistance(i).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Yo.setFromMatrixPosition(t.matrixWorld),Jo.setFromMatrixPosition(this.matrixWorld);const i=Yo.distanceTo(Jo)/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 $o=new ri,Qo=new Qe,tl=new Qe,el=new ri,il=new Ni,nl=new ri,sl=new Ti,rl=new Ni,al=new Ui;class ol extends us{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=M,this.bindMatrix=new Ni,this.bindMatrixInverse=new Ni,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;null===this.boundingBox&&(this.boundingBox=new li),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,nl),this.boundingBox.expandByPoint(nl)}computeBoundingSphere(){const t=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new Ti),this.boundingSphere.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,nl),this.boundingSphere.expandByPoint(nl)}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,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){const i=this.material,n=this.matrixWorld;void 0!==i&&(null===this.boundingSphere&&this.computeBoundingSphere(),sl.copy(this.boundingSphere),sl.applyMatrix4(n),!1!==t.ray.intersectsSphere(sl)&&(rl.copy(n).invert(),al.copy(t.ray).applyMatrix4(rl),null!==this.boundingBox&&!1===al.intersectsBox(this.boundingBox)||this._computeIntersections(t,e,al)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}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 Qe,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),this.bindMode===M?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===S?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){const i=this.skeleton,n=this.geometry;Qo.fromBufferAttribute(n.attributes.skinIndex,t),tl.fromBufferAttribute(n.attributes.skinWeight,t),$o.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const n=tl.getComponent(t);if(0!==n){const s=Qo.getComponent(t);il.multiplyMatrices(i.bones[s].matrixWorld,i.boneInverses[s]),e.addScaledVector(el.copy($o).applyMatrix4(il),n)}}return e.applyMatrix4(this.bindMatrixInverse)}}class ll extends cn{constructor(){super(),this.isBone=!0,this.type="Bone"}}class cl extends $e{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 hl=new Ni,dl=new Ni;class ul{constructor(t=[],e=[]){this.uuid=be(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,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 Ni)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new Ni;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:dl;hl.multiplyMatrices(s,e[n]),hl.toArray(i,16*n)}null!==n&&(n.needsUpdate=!0)}clone(){return new ul(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const i=new cl(e,t,t,tt,q);return i.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=i,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 ll),this.bones.push(s),this.boneInverses.push((new Ni).fromArray(t.boneInverses[i]))}return this.init(),this}toJSON(){const t={metadata:{version:4.6,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 pl extends On{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 ml=new Ni,fl=new Ni,gl=[],vl=new li,_l=new Ni,yl=new us,xl=new Ti;class wl extends us{constructor(t,e,i){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new pl(new Float32Array(16*i),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let t=0;t<i;t++)this.setMatrixAt(t,_l)}computeBoundingBox(){const t=this.geometry,e=this.count;null===this.boundingBox&&(this.boundingBox=new li),null===t.boundingBox&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,ml),vl.copy(t.boundingBox).applyMatrix4(ml),this.boundingBox.union(vl)}computeBoundingSphere(){const t=this.geometry,e=this.count;null===this.boundingSphere&&(this.boundingSphere=new Ti),null===t.boundingSphere&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,ml),xl.copy(t.boundingSphere).applyMatrix4(ml),this.boundingSphere.union(xl)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),null!==t.morphTexture&&(this.morphTexture=t.morphTexture.clone()),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}getMorphAt(t,e){const i=e.morphTargetInfluences,n=this.morphTexture.source.data.data,s=t*(i.length+1)+1;for(let t=0;t<i.length;t++)i[t]=n[s+t]}raycast(t,e){const i=this.matrixWorld,n=this.count;if(yl.geometry=this.geometry,yl.material=this.material,void 0!==yl.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),xl.copy(this.boundingSphere),xl.applyMatrix4(i),!1!==t.ray.intersectsSphere(xl)))for(let s=0;s<n;s++){this.getMatrixAt(s,ml),fl.multiplyMatrices(i,ml),yl.matrixWorld=fl,yl.raycast(t,gl);for(let t=0,i=gl.length;t<i;t++){const i=gl[t];i.instanceId=s,i.object=this,e.push(i)}gl.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new pl(new Float32Array(3*this.instanceMatrix.count),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}setMorphAt(t,e){const i=e.morphTargetInfluences,n=i.length+1;null===this.morphTexture&&(this.morphTexture=new cl(new Float32Array(n*this.count),n,this.count,rt,q));const s=this.morphTexture.source.data.data;let r=0;for(let t=0;t<i.length;t++)r+=i[t];const a=this.geometry.morphTargetsRelative?1:1-r,o=n*t;s[o]=a,s.set(i,o+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null),this}}function bl(t,e){return t.z-e.z}function Ml(t,e){return e.z-t.z}class Sl{constructor(){this.index=0,this.pool=[],this.list=[]}push(t,e,i){const n=this.pool,s=this.list;this.index>=n.length&&n.push({start:-1,count:-1,z:-1,index:-1});const r=n[this.index];s.push(r),this.index++,r.start=t.start,r.count=t.count,r.z=e,r.index=i}reset(){this.list.length=0,this.index=0}}const El=new Ni,Tl=new Ni,Al=new Ni,Cl=new En(1,1,1),Ll=new Ni,kl=new Ns,Rl=new li,Pl=new Ti,Il=new ri,Ul=new ri,Nl=new ri,Dl=new Sl,Ol=new us,Bl=[];function Fl(t,e,i=0){const n=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const s=t.count;for(let r=0;r<s;r++)for(let s=0;s<n;s++)e.setComponent(r+i,s,t.getComponent(r,s))}else e.array.set(t.array,i*n);e.needsUpdate=!0}class zl extends us{get maxInstanceCount(){return this._maxInstanceCount}constructor(t,e,i=2*e,n){super(new Zn,n),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawInfo=[],this._drawRanges=[],this._reservedRanges=[],this._bounds=[],this._maxInstanceCount=t,this._maxVertexCount=e,this._maxIndexCount=i,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(t),this._multiDrawStarts=new Int32Array(t),this._multiDrawCount=0,this._multiDrawInstances=null,this._visibilityChanged=!0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let t=Math.sqrt(4*this._maxInstanceCount);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4),i=new cl(e,t,t,tt,q);this._matricesTexture=i}_initIndirectTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);const e=new Uint32Array(t*t),i=new cl(e,t,t,at,W);this._indirectTexture=i}_initColorsTexture(){let t=Math.sqrt(this._maxIndexCount);t=Math.ceil(t);const e=new Float32Array(t*t*4).fill(1),i=new cl(e,t,t,tt,q);i.colorSpace=Ge.workingColorSpace,this._colorsTexture=i}_initializeGeometry(t){const e=this.geometry,i=this._maxVertexCount,n=this._maxIndexCount;if(!1===this._geometryInitialized){for(const n in t.attributes){const s=t.getAttribute(n),{array:r,itemSize:a,normalized:o}=s,l=new r.constructor(i*a),c=new On(l,a,o);e.setAttribute(n,c)}if(null!==t.getIndex()){const t=i>65535?new Uint32Array(n):new Uint16Array(n);e.setIndex(new On(t,1))}this._geometryInitialized=!0}}_validateGeometry(t){const e=this.geometry;if(Boolean(t.getIndex())!==Boolean(e.getIndex()))throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const i in e.attributes){if(!t.hasAttribute(i))throw new Error(`BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const n=t.getAttribute(i),s=e.getAttribute(i);if(n.itemSize!==s.itemSize||n.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new li);const t=this._geometryCount,e=this.boundingBox,i=this._drawInfo;e.makeEmpty();for(let n=0;n<t;n++){if(!1===i[n].active)continue;const t=i[n].geometryIndex;this.getMatrixAt(n,El),this.getBoundingBoxAt(t,Rl).applyMatrix4(El),e.union(Rl)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Ti);const t=this.boundingSphere,e=this._drawInfo;t.makeEmpty();for(let i=0,n=e.length;i<n;i++){if(!1===e[i].active)continue;const n=e[i].geometryIndex;this.getMatrixAt(i,El),this.getBoundingSphereAt(n,Pl).applyMatrix4(El),t.union(Pl)}}addInstance(t){if(this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");this._drawInfo.push({visible:!0,active:!0,geometryIndex:t});const e=this._drawInfo.length-1,i=this._matricesTexture,n=i.image.data;Al.toArray(n,16*e),i.needsUpdate=!0;const s=this._colorsTexture;return s&&(Cl.toArray(s.image.data,4*e),s.needsUpdate=!0),e}addGeometry(t,e=-1,i=-1){if(this._initializeGeometry(t),this._validateGeometry(t),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const n={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const r=this._reservedRanges,a=this._drawRanges,o=this._bounds;0!==this._geometryCount&&(s=r[r.length-1]),n.vertexCount=-1===e?t.getAttribute("position").count:e,n.vertexStart=null===s?0:s.vertexStart+s.vertexCount;const l=t.getIndex(),c=null!==l;if(c&&(n.indexCount=-1===i?l.count:i,n.indexStart=null===s?0:s.indexStart+s.indexCount),-1!==n.indexStart&&n.indexStart+n.indexCount>this._maxIndexCount||n.vertexStart+n.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._geometryCount;return this._geometryCount++,r.push(n),a.push({start:c?n.indexStart:n.vertexStart,count:-1}),o.push({boxInitialized:!1,box:new li,sphereInitialized:!1,sphere:new Ti}),this.setGeometryAt(h,t),h}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);const i=this.geometry,n=null!==i.getIndex(),s=i.getIndex(),r=e.getIndex(),a=this._reservedRanges[t];if(n&&r.count>a.indexCount||e.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const o=a.vertexStart,l=a.vertexCount;for(const t in i.attributes){const n=e.getAttribute(t),s=i.getAttribute(t);Fl(n,s,o);const r=n.itemSize;for(let t=n.count,e=l;t<e;t++){const e=o+t;for(let t=0;t<r;t++)s.setComponent(e,t,0)}s.needsUpdate=!0,s.addUpdateRange(o*r,l*r)}if(n){const t=a.indexStart;for(let e=0;e<r.count;e++)s.setX(t+e,o+r.getX(e));for(let e=r.count,i=a.indexCount;e<i;e++)s.setX(t+e,o);s.needsUpdate=!0,s.addUpdateRange(t,a.indexCount)}const c=this._bounds[t];null!==e.boundingBox?(c.box.copy(e.boundingBox),c.boxInitialized=!0):c.boxInitialized=!1,null!==e.boundingSphere?(c.sphere.copy(e.boundingSphere),c.sphereInitialized=!0):c.sphereInitialized=!1;const h=this._drawRanges[t],d=e.getAttribute("position");return h.count=n?r.count:d.count,this._visibilityChanged=!0,t}getBoundingBoxAt(t,e){if(t>=this._geometryCount)return null;const i=this._bounds[t],n=i.box,s=this.geometry;if(!1===i.boxInitialized){n.makeEmpty();const e=s.index,r=s.attributes.position,a=this._drawRanges[t];for(let t=a.start,i=a.start+a.count;t<i;t++){let i=t;e&&(i=e.getX(i)),n.expandByPoint(Il.fromBufferAttribute(r,i))}i.boxInitialized=!0}return e.copy(n),e}getBoundingSphereAt(t,e){if(t>=this._geometryCount)return null;const i=this._bounds[t],n=i.sphere,s=this.geometry;if(!1===i.sphereInitialized){n.makeEmpty(),this.getBoundingBoxAt(t,Rl),Rl.getCenter(n.center);const e=s.index,r=s.attributes.position,a=this._drawRanges[t];let o=0;for(let t=a.start,i=a.start+a.count;t<i;t++){let i=t;e&&(i=e.getX(i)),Il.fromBufferAttribute(r,i),o=Math.max(o,n.center.distanceToSquared(Il))}n.radius=Math.sqrt(o),i.sphereInitialized=!0}return e.copy(n),e}setMatrixAt(t,e){const i=this._drawInfo,n=this._matricesTexture,s=this._matricesTexture.image.data;return t>=i.length||!1===i[t].active||(e.toArray(s,16*t),n.needsUpdate=!0),this}getMatrixAt(t,e){const i=this._drawInfo,n=this._matricesTexture.image.data;return t>=i.length||!1===i[t].active?null:e.fromArray(n,16*t)}setColorAt(t,e){null===this._colorsTexture&&this._initColorsTexture();const i=this._colorsTexture,n=this._colorsTexture.image.data,s=this._drawInfo;return t>=s.length||!1===s[t].active||(e.toArray(n,4*t),i.needsUpdate=!0),this}getColorAt(t,e){const i=this._colorsTexture.image.data,n=this._drawInfo;return t>=n.length||!1===n[t].active?null:e.fromArray(i,4*t)}setVisibleAt(t,e){const i=this._drawInfo;return t>=i.length||!1===i[t].active||i[t].visible===e||(i[t].visible=e,this._visibilityChanged=!0),this}getVisibleAt(t){const e=this._drawInfo;return!(t>=e.length||!1===e[t].active)&&e[t].visible}raycast(t,e){const i=this._drawInfo,n=this._drawRanges,s=this.matrixWorld,r=this.geometry;Ol.material=this.material,Ol.geometry.index=r.index,Ol.geometry.attributes=r.attributes,null===Ol.geometry.boundingBox&&(Ol.geometry.boundingBox=new li),null===Ol.geometry.boundingSphere&&(Ol.geometry.boundingSphere=new Ti);for(let r=0,a=i.length;r<a;r++){if(!i[r].visible||!i[r].active)continue;const a=i[r].geometryIndex,o=n[a];Ol.geometry.setDrawRange(o.start,o.count),this.getMatrixAt(r,Ol.matrixWorld).premultiply(s),this.getBoundingBoxAt(a,Ol.geometry.boundingBox),this.getBoundingSphereAt(a,Ol.geometry.boundingSphere),Ol.raycast(t,Bl);for(let t=0,i=Bl.length;t<i;t++){const i=Bl[t];i.object=this,i.batchId=r,e.push(i)}Bl.length=0}Ol.material=null,Ol.geometry.index=null,Ol.geometry.attributes={},Ol.geometry.setDrawRange(0,1/0)}copy(t){return super.copy(t),this.geometry=t.geometry.clone(),this.perObjectFrustumCulled=t.perObjectFrustumCulled,this.sortObjects=t.sortObjects,this.boundingBox=null!==t.boundingBox?t.boundingBox.clone():null,this.boundingSphere=null!==t.boundingSphere?t.boundingSphere.clone():null,this._drawRanges=t._drawRanges.map((t=>({...t}))),this._reservedRanges=t._reservedRanges.map((t=>({...t}))),this._drawInfo=t._drawInfo.map((t=>({...t}))),this._bounds=t._bounds.map((t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()}))),this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._geometryCount=t._geometryCount,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),null!==this._colorsTexture&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(t,e,i,n,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const r=n.getIndex(),a=null===r?1:r.array.BYTES_PER_ELEMENT,o=this._drawInfo,l=this._multiDrawStarts,c=this._multiDrawCounts,h=this._drawRanges,d=this.perObjectFrustumCulled,u=this._indirectTexture,p=u.image.data;d&&(Ll.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),kl.setFromProjectionMatrix(Ll,t.coordinateSystem));let m=0;if(this.sortObjects){Tl.copy(this.matrixWorld).invert(),Il.setFromMatrixPosition(i.matrixWorld).applyMatrix4(Tl),Ul.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(Tl);for(let t=0,e=o.length;t<e;t++)if(o[t].visible&&o[t].active){const e=o[t].geometryIndex;this.getMatrixAt(t,El),this.getBoundingSphereAt(e,Pl).applyMatrix4(El);let i=!1;if(d&&(i=!kl.intersectsSphere(Pl)),!i){const i=Nl.subVectors(Pl.center,Il).dot(Ul);Dl.push(h[e],i,t)}}const t=Dl.list,e=this.customSort;null===e?t.sort(s.transparent?Ml:bl):e.call(this,t,i);for(let e=0,i=t.length;e<i;e++){const i=t[e];l[m]=i.start*a,c[m]=i.count,p[m]=i.index,m++}Dl.reset()}else for(let t=0,e=o.length;t<e;t++)if(o[t].visible&&o[t].active){const e=o[t].geometryIndex;let i=!1;if(d&&(this.getMatrixAt(t,El),this.getBoundingSphereAt(e,Pl).applyMatrix4(El),i=!kl.intersectsSphere(Pl)),!i){const i=h[e];l[m]=i.start*a,c[m]=i.count,p[m]=t,m++}}u.needsUpdate=!0,this._multiDrawCount=m,this._visibilityChanged=!1}onBeforeShadow(t,e,i,n,s,r){this.onBeforeRender(t,null,n,s,r)}}class Hl extends Cn{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new En(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 Vl=new ri,Gl=new ri,jl=new Ni,Wl=new Ui,ql=new Ti,Xl=new ri,Zl=new ri;class Yl extends cn{constructor(t=new Zn,e=new Hl){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=Array.isArray(t.material)?t.material.slice():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++)Vl.fromBufferAttribute(e,t-1),Gl.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=Vl.distanceTo(Gl);t.setAttribute("lineDistance",new zn(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(),ql.copy(i.boundingSphere),ql.applyMatrix4(n),ql.radius+=s,!1===t.ray.intersectsSphere(ql))return;jl.copy(n).invert(),Wl.copy(t.ray).applyMatrix4(jl);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=this.isLineSegments?2:1,c=i.index,h=i.attributes.position;if(null!==c){const i=Math.max(0,r.start),n=Math.min(c.count,r.start+r.count);for(let s=i,r=n-1;s<r;s+=l){const i=c.getX(s),n=c.getX(s+1),r=Jl(this,t,Wl,o,i,n);r&&e.push(r)}if(this.isLineLoop){const s=c.getX(n-1),r=c.getX(i),a=Jl(this,t,Wl,o,s,r);a&&e.push(a)}}else{const i=Math.max(0,r.start),n=Math.min(h.count,r.start+r.count);for(let s=i,r=n-1;s<r;s+=l){const i=Jl(this,t,Wl,o,s,s+1);i&&e.push(i)}if(this.isLineLoop){const s=Jl(this,t,Wl,o,n-1,i);s&&e.push(s)}}}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 Jl(t,e,i,n,s,r){const a=t.geometry.attributes.position;Vl.fromBufferAttribute(a,s),Gl.fromBufferAttribute(a,r);if(i.distanceSqToSegment(Vl,Gl,Xl,Zl)>n)return;Xl.applyMatrix4(t.matrixWorld);const o=e.ray.origin.distanceTo(Xl);return o<e.near||o>e.far?void 0:{distance:o,point:Zl.clone().applyMatrix4(t.matrixWorld),index:s,face:null,faceIndex:null,object:t}}const Kl=new ri,$l=new ri;class Ql extends Yl{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)Kl.fromBufferAttribute(e,t),$l.fromBufferAttribute(e,t+1),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+Kl.distanceTo($l);t.setAttribute("lineDistance",new zn(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class tc extends Yl{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class ec extends Cn{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new En(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 ic=new Ni,nc=new Ui,sc=new Ti,rc=new ri;class ac extends cn{constructor(t=new Zn,e=new ec){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=Array.isArray(t.material)?t.material.slice():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(),sc.copy(i.boundingSphere),sc.applyMatrix4(n),sc.radius+=s,!1===t.ray.intersectsSphere(sc))return;ic.copy(n).invert(),nc.copy(t.ray).applyMatrix4(ic);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);rc.fromBufferAttribute(c,s),oc(rc,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++)rc.fromBufferAttribute(c,i),oc(rc,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 oc(t,e,i,n,s,r,a){const o=nc.distanceSqToPoint(t);if(o<i){const i=new ri;nc.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 lc extends $e{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 cc{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 Le:new ri);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 ri,n=[],s=[],r=[],a=new ri,o=new Ni;for(let e=0;e<=t;e++){const i=e/t;n[e]=this.getTangentAt(i,new ri)}s[0]=new ri,r[0]=new ri;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(Me(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(Me(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.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class hc extends cc{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=new Le){const i=e,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 dc extends hc{constructor(t,e,i,n,s,r){super(t,e,i,i,n,s,r),this.isArcCurve=!0,this.type="ArcCurve"}}function uc(){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 pc=new ri,mc=new uc,fc=new uc,gc=new uc;class vc extends cc{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 ri){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]:(pc.subVectors(n[0],n[1]).add(n[0]),a=pc);const h=n[l%s],d=n[(l+1)%s];if(this.closed||l+2<s?o=n[(l+2)%s]:(pc.subVectors(n[s-1],n[s-2]).add(n[s-1]),o=pc),"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),mc.initNonuniformCatmullRom(a.x,h.x,d.x,o.x,e,i,n),fc.initNonuniformCatmullRom(a.y,h.y,d.y,o.y,e,i,n),gc.initNonuniformCatmullRom(a.z,h.z,d.z,o.z,e,i,n)}else"catmullrom"===this.curveType&&(mc.initCatmullRom(a.x,h.x,d.x,o.x,this.tension),fc.initCatmullRom(a.y,h.y,d.y,o.y,this.tension),gc.initCatmullRom(a.z,h.z,d.z,o.z,this.tension));return i.set(mc.calc(c),fc.calc(c),gc.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 ri).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function _c(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 yc(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 xc(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 wc extends cc{constructor(t=new Le,e=new Le,i=new Le,n=new Le){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new Le){const i=e,n=this.v0,s=this.v1,r=this.v2,a=this.v3;return i.set(xc(t,n.x,s.x,r.x,a.x),xc(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 bc extends cc{constructor(t=new ri,e=new ri,i=new ri,n=new ri){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new ri){const i=e,n=this.v0,s=this.v1,r=this.v2,a=this.v3;return i.set(xc(t,n.x,s.x,r.x,a.x),xc(t,n.y,s.y,r.y,a.y),xc(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 Mc extends cc{constructor(t=new Le,e=new Le){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Le){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 Le){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 Sc extends cc{constructor(t=new ri,e=new ri){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new ri){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 ri){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 Ec extends cc{constructor(t=new Le,e=new Le,i=new Le){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new Le){const i=e,n=this.v0,s=this.v1,r=this.v2;return i.set(yc(t,n.x,s.x,r.x),yc(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 Tc extends cc{constructor(t=new ri,e=new ri,i=new ri){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new ri){const i=e,n=this.v0,s=this.v1,r=this.v2;return i.set(yc(t,n.x,s.x,r.x),yc(t,n.y,s.y,r.y),yc(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 Ac extends cc{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new Le){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(_c(a,o.x,l.x,c.x,h.x),_c(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 Le).fromArray(i))}return this}}var Cc=Object.freeze({__proto__:null,ArcCurve:dc,CatmullRomCurve3:vc,CubicBezierCurve:wc,CubicBezierCurve3:bc,EllipseCurve:hc,LineCurve:Mc,LineCurve3:Sc,QuadraticBezierCurve:Ec,QuadraticBezierCurve3:Tc,SplineCurve:Ac});class Lc extends cc{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);if(!t.equals(e)){const i=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new Cc[i](e,t))}return this}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 Cc[i.type]).fromJSON(i))}return this}}class kc extends Lc{constructor(t){super(),this.type="Path",this.currentPoint=new Le,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 Mc(this.currentPoint.clone(),new Le(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,n){const s=new Ec(this.currentPoint.clone(),new Le(t,e),new Le(i,n));return this.curves.push(s),this.currentPoint.set(i,n),this}bezierCurveTo(t,e,i,n,s,r){const a=new wc(this.currentPoint.clone(),new Le(t,e),new Le(i,n),new Le(s,r));return this.curves.push(a),this.currentPoint.set(s,r),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),i=new Ac(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 hc(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 Rc extends Zn{constructor(t=[new Le(0,-.5),new Le(.5,0),new Le(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=Me(n,0,2*Math.PI);const s=[],r=[],a=[],o=[],l=[],c=1/e,h=new ri,d=new Le,u=new ri,p=new ri,m=new ri;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 zn(r,3)),this.setAttribute("uv",new zn(a,2)),this.setAttribute("normal",new zn(l,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Rc(t.points,t.segments,t.phiStart,t.phiLength)}}class Pc extends Rc{constructor(t=1,e=1,i=4,n=8){const s=new kc;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,length:e,capSegments:i,radialSegments:n}}static fromJSON(t){return new Pc(t.radius,t.length,t.capSegments,t.radialSegments)}}class Ic extends Zn{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 ri,c=new Le;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 zn(r,3)),this.setAttribute("normal",new zn(a,3)),this.setAttribute("uv",new zn(o,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Ic(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class Uc extends Zn{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 Le,m=new ri;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 ri,v=new ri;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 zn(h,3)),this.setAttribute("normal",new zn(d,3)),this.setAttribute("uv",new zn(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Uc(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Nc extends Uc{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 Nc(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class Dc extends Zn{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 ri,n=new ri,s=new ri;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 ri;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 ri;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 ri,e=new ri,i=new ri,n=new ri,a=new Le,o=new Le,l=new Le;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 zn(s,3)),this.setAttribute("normal",new zn(s.slice(),3)),this.setAttribute("uv",new zn(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 Dc(t.vertices,t.indices,t.radius,t.details)}}class Oc extends Dc{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 Oc(t.radius,t.detail)}}const Bc=new ri,Fc=new ri,zc=new ri,Hc=new xn;class Vc extends Zn{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(xe*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}=Hc;if(e.fromBufferAttribute(a,l[0]),i.fromBufferAttribute(a,l[1]),o.fromBufferAttribute(a,l[2]),Hc.getNormal(zc),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=Hc[c[t]],a=Hc[c[e]],o=`${i}_${n}`,p=`${n}_${i}`;p in d&&d[p]?(zc.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:zc.clone()})}}for(const t in d)if(d[t]){const{index0:e,index1:i}=d[t];Bc.fromBufferAttribute(a,e),Fc.fromBufferAttribute(a,i),u.push(Bc.x,Bc.y,Bc.z),u.push(Fc.x,Fc.y,Fc.z)}this.setAttribute("position",new zn(u,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}class Gc extends kc{constructor(t){super(t),this.uuid=be(),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 kc).fromJSON(i))}return this}}const jc=function(t,e,i=2){const n=e&&e.length,s=n?e[0]*i:t.length;let r=Wc(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=Wc(t,o,l,n,!1),c===c.next&&(c.steiner=!0),s.push(ih(c));for(s.sort($c),r=0;r<s.length;r++)i=Qc(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 Xc(r,a,i,o,l,p,0),a};function Wc(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=uh(r,t[r],t[r+1],a);else for(r=i-n;r>=e;r-=n)a=uh(r,t[r],t[r+1],a);return a&&ah(a,a.next)&&(ph(a),a=a.next),a}function qc(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!ah(n,n.next)&&0!==rh(n.prev,n,n.next))n=n.next;else{if(ph(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function Xc(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=eh(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?Yc(t,n,s,r):Zc(t))e.push(o.i/i|0),e.push(t.i/i|0),e.push(l.i/i|0),ph(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?Xc(t=Jc(qc(t),e,i),e,i,n,s,r,2):2===a&&Kc(t,e,i,n,s,r):Xc(qc(t),e,i,n,s,r,1);break}}function Zc(t){const e=t.prev,i=t,n=t.next;if(rh(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&&nh(s,o,r,l,a,c,m.x,m.y)&&rh(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Yc(t,e,i,n){const s=t.prev,r=t,a=t.next;if(rh(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=eh(p,m,e,i,n),_=eh(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&&nh(o,h,l,d,c,u,y.x,y.y)&&rh(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&&nh(o,h,l,d,c,u,x.x,x.y)&&rh(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&&nh(o,h,l,d,c,u,y.x,y.y)&&rh(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&&nh(o,h,l,d,c,u,x.x,x.y)&&rh(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Jc(t,e,i){let n=t;do{const s=n.prev,r=n.next.next;!ah(s,r)&&oh(s,n,n.next,r)&&hh(s,r)&&hh(r,s)&&(e.push(s.i/i|0),e.push(n.i/i|0),e.push(r.i/i|0),ph(n),ph(n.next),n=t=r),n=n.next}while(n!==t);return qc(n)}function Kc(t,e,i,n,s,r){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&sh(a,t)){let o=dh(a,t);return a=qc(a,a.next),o=qc(o,o.next),Xc(a,e,i,n,s,r,0),void Xc(o,e,i,n,s,r,0)}t=t.next}a=a.next}while(a!==t)}function $c(t,e){return t.x-e.x}function Qc(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&&nh(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),hh(n,t)&&(h<d||h===d&&(n.x>i.x||n.x===i.x&&th(i,n)))&&(i=n,d=h)),n=n.next}while(n!==o);return i}(t,e);if(!i)return e;const n=dh(i,t);return qc(n,n.next),qc(i,i.next)}function th(t,e){return rh(t.prev,t,e.prev)<0&&rh(e.next,t,t.next)<0}function eh(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 ih(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 nh(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 sh(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&&oh(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(hh(t,e)&&hh(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)&&(rh(t.prev,t,e.prev)||rh(t,e.prev,e))||ah(t,e)&&rh(t.prev,t,t.next)>0&&rh(e.prev,e,e.next)>0)}function rh(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function ah(t,e){return t.x===e.x&&t.y===e.y}function oh(t,e,i,n){const s=ch(rh(t,e,i)),r=ch(rh(t,e,n)),a=ch(rh(i,n,t)),o=ch(rh(i,n,e));return s!==r&&a!==o||(!(0!==s||!lh(t,i,e))||(!(0!==r||!lh(t,n,e))||(!(0!==a||!lh(i,t,n))||!(0!==o||!lh(i,e,n)))))}function lh(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 ch(t){return t>0?1:t<0?-1:0}function hh(t,e){return rh(t.prev,t,t.next)<0?rh(t,e,t.next)>=0&&rh(t,t.prev,e)>=0:rh(t,e,t.prev)<0||rh(t,t.next,e)<0}function dh(t,e){const i=new mh(t.i,t.x,t.y),n=new mh(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 uh(t,e,i,n){const s=new mh(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 ph(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 mh(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 fh{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 fh.area(t)<0}static triangulateShape(t,e){const i=[],n=[],s=[];gh(t),vh(i,t);let r=t.length;e.forEach(gh);for(let t=0;t<e.length;t++)n.push(r),r+=e[t].length,vh(i,e[t]);const a=jc(i,n);for(let t=0;t<a.length;t+=3)s.push(a.slice(t,t+3));return s}}function gh(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function vh(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}class _h extends Zn{constructor(t=new Gc([new Le(.5,.5),new Le(-.5,.5),new Le(-.5,-.5),new Le(.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:yh;let g,v,_,y,x,w=!1;m&&(g=m.getSpacedPoints(o),w=!0,c=!1,v=m.computeFrenetFrames(o,!1),_=new ri,y=new ri,x=new ri),c||(p=0,h=0,d=0,u=0);const b=t.extractPoints(a);let M=b.shape;const S=b.holes;if(!fh.isClockWise(M)){M=M.reverse();for(let t=0,e=S.length;t<e;t++){const e=S[t];fh.isClockWise(e)&&(S[t]=e.reverse())}}const E=fh.triangulateShape(M,S),T=M;for(let t=0,e=S.length;t<e;t++){const e=S[t];M=M.concat(e)}function A(t,e,i){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().addScaledVector(e,i)}const C=M.length,L=E.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 Le(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 Le(n/r,s/r)}const R=[];for(let t=0,e=T.length,i=e-1,n=t+1;t<e;t++,i++,n++)i===e&&(i=0),n===e&&(n=0),R[t]=k(T[t],T[i],T[n]);const P=[];let I,U=R.concat();for(let t=0,e=S.length;t<e;t++){const e=S[t];I=[];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),I[t]=k(e[t],e[n],e[s]);P.push(I),U=U.concat(I)}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=T.length;t<e;t++){const e=A(T[t],R[t],n);O(e.x,e.y,-i)}for(let t=0,e=S.length;t<e;t++){const e=S[t];I=P[t];for(let t=0,s=e.length;t<s;t++){const s=A(e[t],I[t],n);O(s.x,s.y,-i)}}}const N=d+u;for(let t=0;t<C;t++){const e=c?A(M[t],U[t],N):M[t];w?(y.copy(v.normals[0]).multiplyScalar(e.x),_.copy(v.binormals[0]).multiplyScalar(e.y),x.copy(g[0]).add(y).add(_),O(x.x,x.y,x.z)):O(e.x,e.y,0)}for(let t=1;t<=o;t++)for(let e=0;e<C;e++){const i=c?A(M[e],U[e],N):M[e];w?(y.copy(v.normals[t]).multiplyScalar(i.x),_.copy(v.binormals[t]).multiplyScalar(i.y),x.copy(g[t]).add(y).add(_),O(x.x,x.y,x.z)):O(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=T.length;t<e;t++){const e=A(T[t],R[t],n);O(e.x,e.y,l+i)}for(let t=0,e=S.length;t<e;t++){const e=S[t];I=P[t];for(let t=0,s=e.length;t<s;t++){const s=A(e[t],I[t],n);w?O(s.x,s.y+g[o-1].y,g[o-1].x+i):O(s.x,s.y,l+i)}}}function D(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=C*t,r=C*(t+1);F(e+n+i,e+s+i,e+s+r,e+n+r)}}}function O(t,e,i){r.push(t),r.push(e),r.push(i)}function B(t,e,s){z(t),z(e),z(s);const r=n.length/3,a=f.generateTopUV(i,n,r-3,r-2,r-1);H(a[0]),H(a[1]),H(a[2])}function F(t,e,s,r){z(t),z(e),z(r),z(e),z(s),z(r);const a=n.length/3,o=f.generateSideWallUV(i,n,a-6,a-3,a-2,a-1);H(o[0]),H(o[1]),H(o[3]),H(o[1]),H(o[2]),H(o[3])}function z(t){n.push(r[3*t+0]),n.push(r[3*t+1]),n.push(r[3*t+2])}function H(t){s.push(t.x),s.push(t.y)}!function(){const t=n.length/3;if(c){let t=0,e=C*t;for(let t=0;t<L;t++){const i=E[t];B(i[2]+e,i[1]+e,i[0]+e)}t=o+2*p,e=C*t;for(let t=0;t<L;t++){const i=E[t];B(i[0]+e,i[1]+e,i[2]+e)}}else{for(let t=0;t<L;t++){const e=E[t];B(e[2],e[1],e[0])}for(let t=0;t<L;t++){const e=E[t];B(e[0]+C*o,e[1]+C*o,e[2]+C*o)}}i.addGroup(t,n.length/3-t,0)}(),function(){const t=n.length/3;let e=0;D(T,e),e+=T.length;for(let t=0,i=S.length;t<i;t++){const i=S[t];D(i,e),e+=i.length}i.addGroup(t,n.length/3-t,1)}()}this.setAttribute("position",new zn(n,3)),this.setAttribute("uv",new zn(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 Cc[n.type]).fromJSON(n)),new _h(i,t.options)}}const yh={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 Le(r,a),new Le(o,l),new Le(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 Le(a,1-l),new Le(c,1-d),new Le(u,1-m),new Le(f,1-v)]:[new Le(o,1-l),new Le(h,1-d),new Le(p,1-m),new Le(g,1-v)]}};class xh extends Dc{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 xh(t.radius,t.detail)}}class wh extends Dc{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 wh(t.radius,t.detail)}}class bh extends Zn{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 ri,p=new Le;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 zn(o,3)),this.setAttribute("normal",new zn(l,3)),this.setAttribute("uv",new zn(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new bh(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class Mh extends Zn{constructor(t=new Gc([new Le(0,.5),new Le(-.5,-.5),new Le(.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===fh.isClockWise(c)&&(c=c.reverse());for(let t=0,e=h.length;t<e;t++){const e=h[t];!0===fh.isClockWise(e)&&(h[t]=e.reverse())}const d=fh.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 zn(n,3)),this.setAttribute("normal",new zn(s,3)),this.setAttribute("uv",new zn(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 Mh(i,t.curveSegments)}}class Sh extends Zn{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 ri,d=new ri,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 zn(p,3)),this.setAttribute("normal",new zn(m,3)),this.setAttribute("uv",new zn(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Sh(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class Eh extends Dc{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 Eh(t.radius,t.detail)}}class Th extends Zn{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 ri,h=new ri,d=new ri;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 zn(a,3)),this.setAttribute("normal",new zn(o,3)),this.setAttribute("uv",new zn(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Th(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class Ah extends Zn{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 ri,d=new ri,u=new ri,p=new ri,m=new ri,f=new ri,g=new ri;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 zn(o,3)),this.setAttribute("normal",new zn(l,3)),this.setAttribute("uv",new zn(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Ah(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class Ch extends Zn{constructor(t=new Tc(new ri(-1,-1,0),new ri(-1,1,0),new ri(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 ri,o=new ri,l=new Le;let c=new ri;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 zn(h,3)),this.setAttribute("normal",new zn(d,3)),this.setAttribute("uv",new zn(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 Ch((new Cc[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class Lh extends Zn{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},null!==t){const e=[],i=new Set,n=new ri,s=new ri;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===kh(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===kh(n,s,i)&&(e.push(n.x,n.y,n.z),e.push(s.x,s.y,s.z))}}this.setAttribute("position",new zn(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}function kh(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 Rh=Object.freeze({__proto__:null,BoxGeometry:ms,CapsuleGeometry:Pc,CircleGeometry:Ic,ConeGeometry:Nc,CylinderGeometry:Uc,DodecahedronGeometry:Oc,EdgesGeometry:Vc,ExtrudeGeometry:_h,IcosahedronGeometry:xh,LatheGeometry:Rc,OctahedronGeometry:wh,PlaneGeometry:Bs,PolyhedronGeometry:Dc,RingGeometry:bh,ShapeGeometry:Mh,SphereGeometry:Sh,TetrahedronGeometry:Eh,TorusGeometry:Th,TorusKnotGeometry:Ah,TubeGeometry:Ch,WireframeGeometry:Lh});class Ph extends Cn{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new En(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 Ih extends ys{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Uh extends Cn{constructor(t){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new En(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 En(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Le(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Wi,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.envMapRotation.copy(t.envMapRotation),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 Nh extends Uh{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Le(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Me(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 En(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 En(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new En(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=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 dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=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.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,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.dispersion=t.dispersion,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 Dh extends Cn{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new En(16777215),this.specular=new En(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new En(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Le(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Wi,this.combine=u,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.envMapRotation.copy(t.envMapRotation),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 Oh extends Cn{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new En(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new En(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Le(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 Bh extends Cn{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Le(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 Fh extends Cn{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new En(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new En(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Le(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Wi,this.combine=u,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.envMapRotation.copy(t.envMapRotation),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 zh extends Cn{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new En(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Le(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 Hh extends Hl{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 Vh(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 Gh(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function jh(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 Wh(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 qh(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 Xh={convertArray:Vh,isTypedArray:Gh,getKeyframeOrder:jh,sortedArray:Wh,flattenJSON:qh,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=Vh(l,e.times.constructor),e.values=Vh(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=n.values.slice(t,e)}else if(r>=n.times[d]){const t=d*l+o,e=t+l-o;u=n.values.slice(t,e)}else{const t=n.createInterpolant(),e=o,i=l-o;t.evaluate(r),u=t.resultBuffer.slice(e,i)}if("quaternion"===s){(new si).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)si.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=Kt,t}};class Zh{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 Yh extends Zh{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:Xt,endingEnd:Xt}}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 Zt:s=t,a=2*e-i;break;case Yt: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 Zt:r=t,o=2*i-e;break;case Yt: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 Jh extends Zh{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 Kh extends Zh{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t){return this.copySampleValue_(t-1)}}class $h{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=Vh(e,this.TimeBufferType),this.values=Vh(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:Vh(t.times,Array),values:Vh(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new Kh(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Jh(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Yh(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case jt:e=this.InterpolantFactoryMethodDiscrete;break;case Wt:e=this.InterpolantFactoryMethodLinear;break;case qt: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 jt;case this.InterpolantFactoryMethodLinear:return Wt;case this.InterpolantFactoryMethodSmooth:return qt}}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=i.slice(s,r),this.values=this.values.slice(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&&Gh(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=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),n=this.getInterpolation()===qt,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=t.slice(0,r),this.values=e.slice(0,r*i)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}$h.prototype.TimeBufferType=Float32Array,$h.prototype.ValueBufferType=Float32Array,$h.prototype.DefaultInterpolation=Wt;class Qh extends $h{constructor(t,e,i){super(t,e,i)}}Qh.prototype.ValueTypeName="bool",Qh.prototype.ValueBufferType=Array,Qh.prototype.DefaultInterpolation=jt,Qh.prototype.InterpolantFactoryMethodLinear=void 0,Qh.prototype.InterpolantFactoryMethodSmooth=void 0;class td extends $h{}td.prototype.ValueTypeName="color";class ed extends $h{}ed.prototype.ValueTypeName="number";class id extends Zh{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)si.slerpFlat(s,0,r,l-a,r,l,o);return s}}class nd extends $h{InterpolantFactoryMethodLinear(t){return new id(this.times,this.values,this.getValueSize(),t)}}nd.prototype.ValueTypeName="quaternion",nd.prototype.InterpolantFactoryMethodSmooth=void 0;class sd extends $h{constructor(t,e,i){super(t,e,i)}}sd.prototype.ValueTypeName="string",sd.prototype.ValueBufferType=Array,sd.prototype.DefaultInterpolation=jt,sd.prototype.InterpolantFactoryMethodLinear=void 0,sd.prototype.InterpolantFactoryMethodSmooth=void 0;class rd extends $h{}rd.prototype.ValueTypeName="vector";class ad{constructor(t="",e=-1,i=[],n=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=n,this.uuid=be(),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(od(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($h.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=jh(a);a=Wh(a,1,l),o=Wh(o,1,l),n||0!==a[0]||(a.push(s),o.push(o[0])),r.push(new ed(".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=[];qh(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 ed(".morphTargetInfluence["+i+"]",t,r))}o=t.length*r}else{const r=".bones["+e[t].name+"]";i(rd,r+".position",s,"pos",n),i(nd,r+".quaternion",s,"rot",n),i(rd,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 od(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 ed;case"vector":case"vector2":case"vector3":case"vector4":return rd;case"color":return td;case"quaternion":return nd;case"bool":case"boolean":return Qh;case"string":return sd}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],i=[];qh(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 ld={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 cd{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 hd=new cd;class dd{constructor(t){this.manager=void 0!==t?t:hd,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}}dd.DEFAULT_MATERIAL_NAME="__DEFAULT";const ud={};class pd extends Error{constructor(t,e){super(t),this.response=e}}class md extends dd{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=ld.get(t);if(void 0!==s)return this.manager.itemStart(t),setTimeout((()=>{e&&e(s),this.manager.itemEnd(t)}),0),s;if(void 0!==ud[t])return void ud[t].push({onLoad:e,onProgress:i,onError:n});ud[t]=[],ud[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=ud[t],n=e.body.getReader(),s=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),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()}}),(e=>{t.error(e)}))}()}});return new Response(l)}throw new pd(`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=>{ld.add(t,e);const i=ud[t];delete ud[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onLoad&&n.onLoad(e)}})).catch((e=>{const i=ud[t];if(void 0===i)throw this.manager.itemError(t),e;delete ud[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 fd extends dd{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=ld.get(t);if(void 0!==r)return s.manager.itemStart(t),setTimeout((function(){e&&e(r),s.manager.itemEnd(t)}),0),r;const a=Ne("img");function o(){c(),ld.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 gd extends cn{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new En(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()),void 0!==this.target&&(e.object.target=this.target.uuid),e}}class vd extends gd{constructor(t,e,i){super(t,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(cn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new En(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}}const _d=new Ni,yd=new ri,xd=new ri;class wd{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Le(512,512),this.map=null,this.mapPass=null,this.matrix=new Ni,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ns,this._frameExtents=new Le(1,1),this._viewportCount=1,this._viewports=[new Qe(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,i=this.matrix;yd.setFromMatrixPosition(t.matrixWorld),e.position.copy(yd),xd.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(xd),e.updateMatrixWorld(),_d.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(_d),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(_d)}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.intensity=t.intensity,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 1!==this.intensity&&(t.intensity=this.intensity),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 bd extends wd{constructor(){super(new Ss(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){const e=this.camera,i=2*we*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 Md extends gd{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(cn.DEFAULT_UP),this.updateMatrix(),this.target=new cn,this.distance=i,this.angle=n,this.penumbra=s,this.decay=r,this.map=null,this.shadow=new bd}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 Sd=new Ni,Ed=new ri,Td=new ri;class Ad extends wd{constructor(){super(new Ss(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Le(4,2),this._viewportCount=6,this._viewports=[new Qe(2,1,1,1),new Qe(0,1,1,1),new Qe(3,1,1,1),new Qe(1,1,1,1),new Qe(3,0,1,1),new Qe(1,0,1,1)],this._cubeDirections=[new ri(1,0,0),new ri(-1,0,0),new ri(0,0,1),new ri(0,0,-1),new ri(0,1,0),new ri(0,-1,0)],this._cubeUps=[new ri(0,1,0),new ri(0,1,0),new ri(0,1,0),new ri(0,1,0),new ri(0,0,1),new ri(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()),Ed.setFromMatrixPosition(t.matrixWorld),i.position.copy(Ed),Td.copy(i.position),Td.add(this._cubeDirections[e]),i.up.copy(this._cubeUps[e]),i.lookAt(Td),i.updateMatrixWorld(),n.makeTranslation(-Ed.x,-Ed.y,-Ed.z),Sd.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Sd)}}class Cd extends gd{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 Ad}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 Ld extends wd{constructor(){super(new Ks(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class kd extends gd{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(cn.DEFAULT_UP),this.updateMatrix(),this.target=new cn,this.shadow=new Ld}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class Rd extends gd{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class Pd extends gd{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 Id{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new ri)}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 Ud extends gd{constructor(t=new Id,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 Nd extends dd{constructor(t){super(t),this.textures={}}load(t,e,i,n){const s=this,r=new md(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=Nd.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 En).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.dispersion&&(n.dispersion=t.dispersion),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.anisotropy&&(n.anisotropy=t.anisotropy),void 0!==t.anisotropyRotation&&(n.anisotropyRotation=t.anisotropyRotation),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.alphaHash&&(n.alphaHash=t.alphaHash),void 0!==t.depthFunc&&(n.depthFunc=t.depthFunc),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.blendSrc&&(n.blendSrc=t.blendSrc),void 0!==t.blendDst&&(n.blendDst=t.blendDst),void 0!==t.blendEquation&&(n.blendEquation=t.blendEquation),void 0!==t.blendSrcAlpha&&(n.blendSrcAlpha=t.blendSrcAlpha),void 0!==t.blendDstAlpha&&(n.blendDstAlpha=t.blendDstAlpha),void 0!==t.blendEquationAlpha&&(n.blendEquationAlpha=t.blendEquationAlpha),void 0!==t.blendColor&&void 0!==n.blendColor&&n.blendColor.setHex(t.blendColor),void 0!==t.blendAlpha&&(n.blendAlpha=t.blendAlpha),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.stencilWrite&&(n.stencilWrite=t.stencilWrite),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),void 0!==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 En).setHex(s.value);break;case"v2":n.uniforms[e].value=(new Le).fromArray(s.value);break;case"v3":n.uniforms[e].value=(new ri).fromArray(s.value);break;case"v4":n.uniforms[e].value=(new Qe).fromArray(s.value);break;case"m3":n.uniforms[e].value=(new ke).fromArray(s.value);break;case"m4":n.uniforms[e].value=(new Ni).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.lights&&(n.lights=t.lights),void 0!==t.clipping&&(n.clipping=t.clipping),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 Le).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.envMapRotation&&n.envMapRotation.fromArray(t.envMapRotation),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 Le).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.anisotropyMap&&(n.anisotropyMap=i(t.anisotropyMap)),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:Ph,SpriteMaterial:Io,RawShaderMaterial:Ih,ShaderMaterial:ys,PointsMaterial:ec,MeshPhysicalMaterial:Nh,MeshStandardMaterial:Uh,MeshPhongMaterial:Dh,MeshToonMaterial:Oh,MeshNormalMaterial:Bh,MeshLambertMaterial:Fh,MeshDepthMaterial:oo,MeshDistanceMaterial:lo,MeshBasicMaterial:Ln,MeshMatcapMaterial:zh,LineDashedMaterial:Hh,LineBasicMaterial:Hl,Material:Cn}[t]}}class Dd{static decodeText(t){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),"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 Od extends Zn{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 Bd extends dd{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new md(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=Ue(s.type,r),o=new ko(a,s.stride);return o.uuid=s.uuid,e[n]=o,o}const s=t.isInstancedBufferGeometry?new Od:new Zn,r=t.data.index;if(void 0!==r){const t=Ue(r.type,r.array);s.setIndex(new On(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 Po(e,i.itemSize,i.offset,i.normalized)}else{const t=Ue(i.type,i.array);r=new(i.isInstancedBufferAttribute?pl:On)(t,i.itemSize,i.normalized)}void 0!==i.name&&(r.name=i.name),void 0!==i.usage&&r.setUsage(i.usage),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 Po(e,s.itemSize,s.offset,s.normalized)}else{const t=Ue(s.type,s.array);a=new On(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 ri;void 0!==c.center&&t.fromArray(c.center),s.boundingSphere=new Ti(t,c.radius)}return t.name&&(s.name=t.name),t.userData&&(s.userData=t.userData),s}}const Fd={UVMapping:E,CubeReflectionMapping:T,CubeRefractionMapping:A,EquirectangularReflectionMapping:C,EquirectangularRefractionMapping:L,CubeUVReflectionMapping:k},zd={RepeatWrapping:R,ClampToEdgeWrapping:P,MirroredRepeatWrapping:I},Hd={NearestFilter:U,NearestMipmapNearestFilter:N,NearestMipmapLinearFilter:D,LinearFilter:O,LinearMipmapNearestFilter:B,LinearMipmapLinearFilter:F};let Vd;class Gd{static getContext(){return void 0===Vd&&(Vd=new(window.AudioContext||window.webkitAudioContext)),Vd}static setContext(t){Vd=t}}const jd=new Ni,Wd=new Ni,qd=new Ni;class Xd{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Zd(),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=Zd();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function Zd(){return("undefined"==typeof performance?Date:performance).now()}const Yd=new ri,Jd=new si,Kd=new ri,$d=new ri;class Qd extends cn{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(!1!==this._connected){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){return this.detune=t,!0===this.isPlaying&&void 0!==this.source.detune&&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 tu=new ri,eu=new si,iu=new ri,nu=new ri;class su{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){si.slerpFlat(t,e,t,e,t,i,n)}_slerpAdditive(t,e,i,n,s){const r=this._workIndex*s;si.multiplyQuaternionsFlat(t,r,t,e,t,i),si.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 ru="\\[\\]\\.:\\/",au=new RegExp("["+ru+"]","g"),ou="[^"+ru+"]",lu="[^"+ru.replace("\\.","")+"]",cu=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",ou)+/(WCOD+)?/.source.replace("WCOD",lu)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ou)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ou)+"$"),hu=["material","materials","bones","map"];class du{constructor(t,e,i){this.path=e,this.parsedPath=i||du.parseTrackName(e),this.node=du.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 du.Composite(t,e,i):new du(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(au,"")}static parseTrackName(t){const e=cu.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!==hu.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=du.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");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}}du.Composite=class{constructor(t,e,i){const n=i||du.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()}},du.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},du.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},du.prototype.GetterByBindingType=[du.prototype._getValue_direct,du.prototype._getValue_array,du.prototype._getValue_arrayElement,du.prototype._getValue_toArray],du.prototype.SetterByBindingTypeAndVersioning=[[du.prototype._setValue_direct,du.prototype._setValue_direct_setNeedsUpdate,du.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[du.prototype._setValue_array,du.prototype._setValue_array_setNeedsUpdate,du.prototype._setValue_array_setMatrixWorldNeedsUpdate],[du.prototype._setValue_arrayElement,du.prototype._setValue_arrayElement_setNeedsUpdate,du.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[du.prototype._setValue_fromArray,du.prototype._setValue_fromArray_setNeedsUpdate,du.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class uu{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:Xt,endingEnd:Xt};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=Vt,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===Kt)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===Gt;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=Zt,n.endingEnd=Zt):(n.endingStart=t?this.zeroSlopeAtStart?Zt:Xt:Yt,n.endingEnd=e?this.zeroSlopeAtEnd?Zt:Xt:Yt)}_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 pu=new Float32Array(1);class mu extends ve{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 su(du.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 Jh(new Float32Array(2),new Float32Array(2),1,pu),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?ad.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:Jt),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 uu(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?ad.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 fu{constructor(t){this.value=t}clone(){return new fu(void 0===this.value.clone?this.value:this.value.clone())}}let gu=0;class vu extends ko{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}}const _u=new Ni;let yu=class{constructor(t,e,i=0,n=1/0){this.ray=new Ui(t,e),this.near=i,this.far=n,this.camera=null,this.layers=new qi,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)}setFromXRController(t){return _u.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(_u),this}intersectObject(t,e=!0,i=[]){return wu(t,this,i,e),i.sort(xu),i}intersectObjects(t,e=!0,i=[]){for(let n=0,s=t.length;n<s;n++)wu(t[n],this,i,e);return i.sort(xu),i}};function xu(t,e){return t.distance-e.distance}function wu(t,e,i,n){let s=!0;if(t.layers.test(e.layers)){!1===t.raycast(e,i)&&(s=!1)}if(!0===s&&!0===n){const n=t.children;for(let t=0,s=n.length;t<s;t++)wu(n[t],e,i,!0)}}class bu{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(Me(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}const Mu=new Le;const Su=new ri,Eu=new ri;class Tu{constructor(t=new ri,e=new ri){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){Su.subVectors(t,this.start),Eu.subVectors(this.end,this.start);const i=Eu.dot(Eu);let n=Eu.dot(Su)/i;return e&&(n=Me(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 Au=new ri;const Cu=new ri,Lu=new Ni,ku=new Ni;function Ru(t){const e=[];!0===t.isBone&&e.push(t);for(let i=0;i<t.children.length;i++)e.push.apply(e,Ru(t.children[i]));return e}const Pu=new ri,Iu=new En,Uu=new En;class Nu extends Ql{constructor(t=10,e=10,i=4473924,n=8947848){i=new En(i),n=new En(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 Zn;c.setAttribute("position",new zn(o,3)),c.setAttribute("color",new zn(l,3));super(c,new Hl({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Du=new ri,Ou=new ri,Bu=new ri;const Fu=new ri,zu=new xs;function Hu(t,e,i,n,s,r,a){Fu.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],Fu.x,Fu.y,Fu.z)}}const Vu=new li;const Gu=new ri;let ju,Wu;class qu{constructor(){this.type="ShapePath",this.color=new En,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new kc,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=fh.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 Gc,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 Gc,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 Gc;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:e}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=e);var Xu=Object.freeze({__proto__:null,ACESFilmicToneMapping:y,AddEquation:c,AddOperation:m,AdditiveAnimationBlendMode:Kt,AdditiveBlending:2,AgXToneMapping:w,AlphaFormat:$,AlwaysCompare:519,AlwaysDepth:1,AlwaysStencilFunc:de,AmbientLight:Rd,AnimationAction:uu,AnimationClip:ad,AnimationLoader:class extends dd{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new md(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=ad.parse(t[i]);e.push(n)}return e}},AnimationMixer:mu,AnimationObjectGroup:class{constructor(){this.isAnimationObjectGroup=!0,this.uuid=be(),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 du(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 du(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 du(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:Xh,ArcCurve:dc,ArrayCamera:go,ArrowHelper:class extends cn{constructor(t=new ri(0,0,1),e=new ri(0,0,0),i=1,n=16776960,s=.2*i,r=.2*s){super(),this.type="ArrowHelper",void 0===ju&&(ju=new Zn,ju.setAttribute("position",new zn([0,0,0,0,1,0],3)),Wu=new Uc(0,.5,1,5,1),Wu.translate(0,-.5,0)),this.position.copy(e),this.line=new Yl(ju,new Hl({color:n,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new us(Wu,new Ln({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{Gu.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(Gu,e)}}setLength(t,e=.2*t,i=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}},AttachedBindMode:M,Audio:Qd,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:Gd,AudioListener:class extends cn{constructor(){super(),this.type="AudioListener",this.context=Gd.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Xd}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(Yd,Jd,Kd),$d.set(0,0,-1).applyQuaternion(Jd),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Yd.x,t),e.positionY.linearRampToValueAtTime(Yd.y,t),e.positionZ.linearRampToValueAtTime(Yd.z,t),e.forwardX.linearRampToValueAtTime($d.x,t),e.forwardY.linearRampToValueAtTime($d.y,t),e.forwardZ.linearRampToValueAtTime($d.z,t),e.upX.linearRampToValueAtTime(i.x,t),e.upY.linearRampToValueAtTime(i.y,t),e.upZ.linearRampToValueAtTime(i.z,t)}else e.setPosition(Yd.x,Yd.y,Yd.z),e.setOrientation($d.x,$d.y,$d.z,i.x,i.y,i.z)}},AudioLoader:class extends dd{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new md(this.manager);function a(e){n?n(e):console.error(e),s.manager.itemError(t)}r.setResponseType("arraybuffer"),r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,(function(t){try{const i=t.slice(0);Gd.getContext().decodeAudioData(i,(function(t){e(t)})).catch(a)}catch(t){a(t)}}),i,n)}},AxesHelper:class extends Ql{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 Zn;i.setAttribute("position",new zn(e,3)),i.setAttribute("color",new zn([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(i,new Hl({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,i){const n=new En,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:l,BasicDepthPacking:3200,BasicShadowMap:0,BatchedMesh:zl,Bone:ll,BooleanKeyframeTrack:Qh,Box2:class{constructor(t=new Le(1/0,1/0),e=new Le(-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=Mu.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,Mu).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:li,Box3Helper:class extends Ql{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 Zn;n.setIndex(new On(i,1)),n.setAttribute("position",new zn([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 Hl({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}},BoxGeometry:ms,BoxHelper:class extends Ql{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 Zn;s.setIndex(new On(i,1)),s.setAttribute("position",new On(n,3)),super(s,new Hl({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&&Vu.setFromObject(this.object),Vu.isEmpty())return;const e=Vu.min,i=Vu.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:On,BufferGeometry:Zn,BufferGeometryLoader:Bd,ByteType:H,Cache:ld,Camera:xs,CameraHelper:class extends Ql{constructor(t){const e=new Zn,i=new Hl({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 zn(n,3)),e.setAttribute("color",new zn(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 En(16755200),c=new En(16711680),h=new En(43775),d=new En(16777215),u=new En(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;zu.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),Hu("c",e,t,zu,0,0,-1),Hu("t",e,t,zu,0,0,1),Hu("n1",e,t,zu,-1,-1,-1),Hu("n2",e,t,zu,1,-1,-1),Hu("n3",e,t,zu,-1,1,-1),Hu("n4",e,t,zu,1,1,-1),Hu("f1",e,t,zu,-1,-1,1),Hu("f2",e,t,zu,1,-1,1),Hu("f3",e,t,zu,-1,1,1),Hu("f4",e,t,zu,1,1,1),Hu("u1",e,t,zu,.7,1.1,-1),Hu("u2",e,t,zu,-.7,1.1,-1),Hu("u3",e,t,zu,0,2,-1),Hu("cf1",e,t,zu,-1,0,1),Hu("cf2",e,t,zu,1,0,1),Hu("cf3",e,t,zu,0,-1,1),Hu("cf4",e,t,zu,0,1,1),Hu("cn1",e,t,zu,-1,0,-1),Hu("cn2",e,t,zu,1,0,-1),Hu("cn3",e,t,zu,0,-1,-1),Hu("cn4",e,t,zu,0,1,-1),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},CanvasTexture:class extends $e{constructor(t,e,i,n,s,r,a,o,l){super(t,e,i,n,s,r,a,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}},CapsuleGeometry:Pc,CatmullRomCurve3:vc,CineonToneMapping:_,CircleGeometry:Ic,ClampToEdgeWrapping:P,Clock:Xd,Color:En,ColorKeyframeTrack:td,ColorManagement:Ge,CompressedArrayTexture:class extends lc{constructor(t,e,i,n,s,r){super(t,e,i,s,r),this.isCompressedArrayTexture=!0,this.image.depth=n,this.wrapR=P,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}},CompressedCubeTexture:class extends lc{constructor(t,e,i){super(void 0,t[0].width,t[0].height,e,i,T),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}},CompressedTexture:lc,CompressedTextureLoader:class extends dd{constructor(t){super(t)}load(t,e,i,n){const s=this,r=[],a=new lc,o=new md(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=O),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=O),a.format=i.format,a.needsUpdate=!0,e&&e(a)}),i,n);return a}},ConeGeometry:Nc,ConstantAlphaFactor:213,ConstantColorFactor:211,CubeCamera:Ts,CubeReflectionMapping:T,CubeRefractionMapping:A,CubeTexture:As,CubeTextureLoader:class extends dd{constructor(t){super(t)}load(t,e,i,n){const s=new As;s.colorSpace=Qt;const r=new fd(this.manager);r.setCrossOrigin(this.crossOrigin),r.setPath(this.path);let a=0;function o(i){r.load(t[i],(function(t){s.images[i]=t,a++,6===a&&(s.needsUpdate=!0,e&&e(s))}),void 0,n)}for(let e=0;e<t.length;++e)o(e);return s}},CubeUVReflectionMapping:k,CubicBezierCurve:wc,CubicBezierCurve3:bc,CubicInterpolant:Yh,CullFaceBack:1,CullFaceFront:2,CullFaceFrontBack:3,CullFaceNone:0,Curve:cc,CurvePath:Lc,CustomBlending:5,CustomToneMapping:x,CylinderGeometry:Uc,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:ni,DataArrayTexture:ii,DataTexture:cl,DataTextureLoader:class extends dd{constructor(t){super(t)}load(t,e,i,n){const s=this,r=new cl,a=new md(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(t,(function(t){let i;try{i=s.parse(t)}catch(t){if(void 0===n)return void console.error(t);n(t)}void 0!==i.image?r.image=i.image:void 0!==i.data&&(r.image.width=i.width,r.image.height=i.height,r.image.data=i.data),r.wrapS=void 0!==i.wrapS?i.wrapS:P,r.wrapT=void 0!==i.wrapT?i.wrapT:P,r.magFilter=void 0!==i.magFilter?i.magFilter:O,r.minFilter=void 0!==i.minFilter?i.minFilter:O,r.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.colorSpace&&(r.colorSpace=i.colorSpace),void 0!==i.flipY&&(r.flipY=i.flipY),void 0!==i.format&&(r.format=i.format),void 0!==i.type&&(r.type=i.type),void 0!==i.mipmaps&&(r.mipmaps=i.mipmaps,r.minFilter=F),1===i.mipmapCount&&(r.minFilter=O),void 0!==i.generateMipmaps&&(r.generateMipmaps=i.generateMipmaps),r.needsUpdate=!0,e&&e(r,i)}),i,n),r}},DataUtils:Un,DecrementStencilOp:7683,DecrementWrapStencilOp:he,DefaultLoadingManager:hd,DepthFormat:nt,DepthStencilFormat:st,DepthTexture:br,DetachedBindMode:S,DirectionalLight:kd,DirectionalLightHelper:class extends cn{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 Zn;n.setAttribute("position",new zn([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const s=new Hl({fog:!1,toneMapped:!1});this.lightPlane=new Yl(n,s),this.add(this.lightPlane),n=new Zn,n.setAttribute("position",new zn([0,0,0,0,0,1],3)),this.targetLine=new Yl(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),Du.setFromMatrixPosition(this.light.matrixWorld),Ou.setFromMatrixPosition(this.light.target.matrixWorld),Bu.subVectors(Ou,Du),this.lightPlane.lookAt(Ou),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(Ou),this.targetLine.scale.z=Bu.length()}},DiscreteInterpolant:Kh,DisplayP3ColorSpace:ee,DodecahedronGeometry:Oc,DoubleSide:2,DstAlphaFactor:206,DstColorFactor:208,DynamicCopyUsage:35050,DynamicDrawUsage:35048,DynamicReadUsage:35049,EdgesGeometry:Vc,EllipseCurve:hc,EqualCompare:514,EqualDepth:4,EqualStencilFunc:514,EquirectangularReflectionMapping:C,EquirectangularRefractionMapping:L,Euler:Wi,EventDispatcher:ve,ExtrudeGeometry:_h,FileLoader:md,Float16BufferAttribute:class extends On{constructor(t,e,i){super(new Uint16Array(t),e,i),this.isFloat16BufferAttribute=!0}getX(t){let e=In(this.array[t*this.itemSize]);return this.normalized&&(e=Te(e,this.array)),e}setX(t,e){return this.normalized&&(e=Ae(e,this.array)),this.array[t*this.itemSize]=Pn(e),this}getY(t){let e=In(this.array[t*this.itemSize+1]);return this.normalized&&(e=Te(e,this.array)),e}setY(t,e){return this.normalized&&(e=Ae(e,this.array)),this.array[t*this.itemSize+1]=Pn(e),this}getZ(t){let e=In(this.array[t*this.itemSize+2]);return this.normalized&&(e=Te(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Ae(e,this.array)),this.array[t*this.itemSize+2]=Pn(e),this}getW(t){let e=In(this.array[t*this.itemSize+3]);return this.normalized&&(e=Te(e,this.array)),e}setW(t,e){return this.normalized&&(e=Ae(e,this.array)),this.array[t*this.itemSize+3]=Pn(e),this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=Ae(e,this.array),i=Ae(i,this.array)),this.array[t+0]=Pn(e),this.array[t+1]=Pn(i),this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=Ae(e,this.array),i=Ae(i,this.array),n=Ae(n,this.array)),this.array[t+0]=Pn(e),this.array[t+1]=Pn(i),this.array[t+2]=Pn(n),this}setXYZW(t,e,i,n,s){return t*=this.itemSize,this.normalized&&(e=Ae(e,this.array),i=Ae(i,this.array),n=Ae(n,this.array),s=Ae(s,this.array)),this.array[t+0]=Pn(e),this.array[t+1]=Pn(i),this.array[t+2]=Pn(n),this.array[t+3]=Pn(s),this}},Float32BufferAttribute:zn,FloatType:q,Fog:Co,FogExp2:Ao,FramebufferTexture:class extends $e{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=U,this.minFilter=U,this.generateMipmaps=!1,this.needsUpdate=!0}},FrontSide:o,Frustum:Ns,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:me,GreaterCompare:516,GreaterDepth:6,GreaterEqualCompare:518,GreaterEqualDepth:5,GreaterEqualStencilFunc:518,GreaterStencilFunc:516,GridHelper:Nu,Group:vo,HalfFloatType:X,HemisphereLight:vd,HemisphereLightHelper:class extends cn{constructor(t,e,i){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const n=new wh(e);n.rotateY(.5*Math.PI),this.material=new Ln({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 On(r,3)),this.add(new us(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");Iu.copy(this.light.color),Uu.copy(this.light.groundColor);for(let t=0,i=e.count;t<i;t++){const n=t<i/2?Iu:Uu;e.setXYZ(t,n.r,n.g,n.b)}e.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),t.lookAt(Pu.setFromMatrixPosition(this.light.matrixWorld).negate())}},IcosahedronGeometry:xh,ImageBitmapLoader:class extends dd{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=ld.get(t);if(void 0!==r)return s.manager.itemStart(t),r.then?void r.then((i=>{e&&e(i),s.manager.itemEnd(t)})).catch((t=>{n&&n(t)})):(setTimeout((function(){e&&e(r),s.manager.itemEnd(t)}),0),r);const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader;const o=fetch(t,a).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(s.options,{colorSpaceConversion:"none"}))})).then((function(i){return ld.add(t,i),e&&e(i),s.manager.itemEnd(t),i})).catch((function(e){n&&n(e),ld.remove(t),s.manager.itemError(t),s.manager.itemEnd(t)}));ld.add(t,o),s.manager.itemStart(t)}},ImageLoader:fd,ImageUtils:Xe,IncrementStencilOp:7682,IncrementWrapStencilOp:ce,InstancedBufferAttribute:pl,InstancedBufferGeometry:Od,InstancedInterleavedBuffer:vu,InstancedMesh:wl,Int16BufferAttribute:class extends On{constructor(t,e,i){super(new Int16Array(t),e,i)}},Int32BufferAttribute:class extends On{constructor(t,e,i){super(new Int32Array(t),e,i)}},Int8BufferAttribute:class extends On{constructor(t,e,i){super(new Int8Array(t),e,i)}},IntType:j,InterleavedBuffer:ko,InterleavedBufferAttribute:Po,Interpolant:Zh,InterpolateDiscrete:jt,InterpolateLinear:Wt,InterpolateSmooth:qt,InvertStencilOp:5386,KeepStencilOp:oe,KeyframeTrack:$h,LOD:Ko,LatheGeometry:Rc,Layers:qi,LessCompare:513,LessDepth:2,LessEqualCompare:ue,LessEqualDepth:3,LessEqualStencilFunc:515,LessStencilFunc:513,Light:gd,LightProbe:Ud,Line:Yl,Line3:Tu,LineBasicMaterial:Hl,LineCurve:Mc,LineCurve3:Sc,LineDashedMaterial:Hh,LineLoop:tc,LineSegments:Ql,LinearDisplayP3ColorSpace:ie,LinearFilter:O,LinearInterpolant:Jh,LinearMipMapLinearFilter:1008,LinearMipMapNearestFilter:1007,LinearMipmapLinearFilter:F,LinearMipmapNearestFilter:B,LinearSRGBColorSpace:te,LinearToneMapping:g,LinearTransfer:ne,Loader:dd,LoaderUtils:Dd,LoadingManager:cd,LoopOnce:2200,LoopPingPong:Gt,LoopRepeat:Vt,LuminanceAlphaFormat:it,LuminanceFormat:et,MOUSE:i,Material:Cn,MaterialLoader:Nd,MathUtils:Ce,Matrix3:ke,Matrix4:Ni,MaxEquation:104,Mesh:us,MeshBasicMaterial:Ln,MeshDepthMaterial:oo,MeshDistanceMaterial:lo,MeshLambertMaterial:Fh,MeshMatcapMaterial:zh,MeshNormalMaterial:Bh,MeshPhongMaterial:Dh,MeshPhysicalMaterial:Nh,MeshStandardMaterial:Uh,MeshToonMaterial:Oh,MinEquation:103,MirroredRepeatWrapping:I,MixOperation:p,MultiplyBlending:4,MultiplyOperation:u,NearestFilter:U,NearestMipMapLinearFilter:1005,NearestMipMapNearestFilter:1004,NearestMipmapLinearFilter:D,NearestMipmapNearestFilter:N,NeutralToneMapping:b,NeverCompare:512,NeverDepth:0,NeverStencilFunc:512,NoBlending:0,NoColorSpace:$t,NoToneMapping:f,NormalAnimationBlendMode:Jt,NormalBlending:1,NotEqualCompare:517,NotEqualDepth:7,NotEqualStencilFunc:517,NumberKeyframeTrack:ed,Object3D:cn,ObjectLoader:class extends dd{constructor(t){super(t)}load(t,e,i,n){const s=this,r=""===this.path?Dd.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||r;const a=new md(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?Dd.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||i;const n=new md(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials);const s=await n.loadAsync(t,e),r=JSON.parse(s),a=r.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+t);return await this.parseAsync(r)}parse(t,e){const i=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),s=this.parseGeometries(t.geometries,n),r=this.parseImages(t.images,(function(){void 0!==e&&e(l)})),a=this.parseTextures(t.textures,r),o=this.parseMaterials(t.materials,a),l=this.parseObject(t.object,s,o,a,i),c=this.parseSkeletons(t.skeletons,l);if(this.bindSkeletons(l,c),this.bindLightTargets(l),void 0!==e){let t=!1;for(const e in r)if(r[e].data instanceof HTMLImageElement){t=!0;break}!1===t&&e(l)}return l}async parseAsync(t){const e=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),n=this.parseGeometries(t.geometries,i),s=await this.parseImagesAsync(t.images),r=this.parseTextures(t.textures,s),a=this.parseMaterials(t.materials,r),o=this.parseObject(t.object,n,a,r,e),l=this.parseSkeletons(t.skeletons,o);return this.bindSkeletons(o,l),this.bindLightTargets(o),o}parseShapes(t){const e={};if(void 0!==t)for(let i=0,n=t.length;i<n;i++){const n=(new Gc).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 ul).fromJSON(t[e],n);i[s.uuid]=s}return i}parseGeometries(t,e){const i={};if(void 0!==t){const n=new Bd;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 Rh?r=Rh[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 Nd;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=ad.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:Ue(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){const i=new cd(e);s=new fd(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 cl(i.data,i.width,i.height)))}n[i.uuid]=new Ye(t)}else{const t=r(i.url);n[i.uuid]=new Ye(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:Ue(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){n=new fd(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 cl(n.data,n.width,n.height)))}i[n.uuid]=new Ye(t)}else{const t=await s(n.url);i[n.uuid]=new Ye(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 As,6===o.length&&(l.needsUpdate=!0)):(l=o&&o.data?new cl:new $e,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,Fd)),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],zd),l.wrapT=i(r.wrap[1],zd)),void 0!==r.format&&(l.format=r.format),void 0!==r.internalFormat&&(l.internalFormat=r.internalFormat),void 0!==r.type&&(l.type=r.type),void 0!==r.colorSpace&&(l.colorSpace=r.colorSpace),void 0!==r.minFilter&&(l.minFilter=i(r.minFilter,Hd)),void 0!==r.magFilter&&(l.magFilter=i(r.magFilter,Hd)),void 0!==r.anisotropy&&(l.anisotropy=r.anisotropy),void 0!==r.flipY&&(l.flipY=r.flipY),void 0!==r.generateMipmaps&&(l.generateMipmaps=r.generateMipmaps),void 0!==r.premultiplyAlpha&&(l.premultiplyAlpha=r.premultiplyAlpha),void 0!==r.unpackAlignment&&(l.unpackAlignment=r.unpackAlignment),void 0!==r.compareFunction&&(l.compareFunction=r.compareFunction),void 0!==r.userData&&(l.userData=r.userData),n[r.uuid]=l}return n}parseObject(t,e,i,n,s){let r,a,o;function l(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function c(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let n=0,s=t.length;n<s;n++){const s=t[n];void 0===i[s]&&console.warn("THREE.ObjectLoader: Undefined material",s),e.push(i[s])}return e}return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),i[t]}}function h(t){return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined texture",t),n[t]}switch(t.type){case"Scene":r=new Lo,void 0!==t.background&&(Number.isInteger(t.background)?r.background=new En(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 Co(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(r.fog=new Ao(t.fog.color,t.fog.density)),""!==t.fog.name&&(r.fog.name=t.fog.name)),void 0!==t.backgroundBlurriness&&(r.backgroundBlurriness=t.backgroundBlurriness),void 0!==t.backgroundIntensity&&(r.backgroundIntensity=t.backgroundIntensity),void 0!==t.backgroundRotation&&r.backgroundRotation.fromArray(t.backgroundRotation),void 0!==t.environmentIntensity&&(r.environmentIntensity=t.environmentIntensity),void 0!==t.environmentRotation&&r.environmentRotation.fromArray(t.environmentRotation);break;case"PerspectiveCamera":r=new Ss(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 Ks(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 Rd(t.color,t.intensity);break;case"DirectionalLight":r=new kd(t.color,t.intensity),r.target=t.target||"";break;case"PointLight":r=new Cd(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":r=new Pd(t.color,t.intensity,t.width,t.height);break;case"SpotLight":r=new Md(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay),r.target=t.target||"";break;case"HemisphereLight":r=new vd(t.color,t.groundColor,t.intensity);break;case"LightProbe":r=(new Ud).fromJSON(t);break;case"SkinnedMesh":a=l(t.geometry),o=c(t.material),r=new ol(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 us(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 wl(a,o,e),r.instanceMatrix=new pl(new Float32Array(i.array),16),void 0!==n&&(r.instanceColor=new pl(new Float32Array(n.array),n.itemSize));break;case"BatchedMesh":a=l(t.geometry),o=c(t.material),r=new zl(t.maxInstanceCount,t.maxVertexCount,t.maxIndexCount,o),r.geometry=a,r.perObjectFrustumCulled=t.perObjectFrustumCulled,r.sortObjects=t.sortObjects,r._drawRanges=t.drawRanges,r._reservedRanges=t.reservedRanges,r._visibility=t.visibility,r._active=t.active,r._bounds=t.bounds.map((t=>{const e=new li;e.min.fromArray(t.boxMin),e.max.fromArray(t.boxMax);const i=new Ti;return i.radius=t.sphereRadius,i.center.fromArray(t.sphereCenter),{boxInitialized:t.boxInitialized,box:e,sphereInitialized:t.sphereInitialized,sphere:i}})),r._maxInstanceCount=t.maxInstanceCount,r._maxVertexCount=t.maxVertexCount,r._maxIndexCount=t.maxIndexCount,r._geometryInitialized=t.geometryInitialized,r._geometryCount=t.geometryCount,r._matricesTexture=h(t.matricesTexture.uuid),void 0!==t.colorsTexture&&(r._colorsTexture=h(t.colorsTexture.uuid));break;case"LOD":r=new Ko;break;case"Line":r=new Yl(l(t.geometry),c(t.material));break;case"LineLoop":r=new tc(l(t.geometry),c(t.material));break;case"LineSegments":r=new Ql(l(t.geometry),c(t.material));break;case"PointCloud":case"Points":r=new ac(l(t.geometry),c(t.material));break;case"Sprite":r=new Xo(c(t.material));break;case"Group":r=new vo;break;case"Bone":r=new ll;break;default:r=new cn}if(r.uuid=t.uuid,void 0!==t.name&&(r.name=t.name),void 0!==t.matrix?(r.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(r.matrixAutoUpdate=t.matrixAutoUpdate),r.matrixAutoUpdate&&r.matrix.decompose(r.position,r.quaternion,r.scale)):(void 0!==t.position&&r.position.fromArray(t.position),void 0!==t.rotation&&r.rotation.fromArray(t.rotation),void 0!==t.quaternion&&r.quaternion.fromArray(t.quaternion),void 0!==t.scale&&r.scale.fromArray(t.scale)),void 0!==t.up&&r.up.fromArray(t.up),void 0!==t.castShadow&&(r.castShadow=t.castShadow),void 0!==t.receiveShadow&&(r.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.intensity&&(r.shadow.intensity=t.shadow.intensity),void 0!==t.shadow.bias&&(r.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(r.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(r.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&r.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(r.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(r.visible=t.visible),void 0!==t.frustumCulled&&(r.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(r.renderOrder=t.renderOrder),void 0!==t.userData&&(r.userData=t.userData),void 0!==t.layers&&(r.layers.mask=t.layers),void 0!==t.children){const a=t.children;for(let t=0;t<a.length;t++)r.add(this.parseObject(a[t],e,i,n,s))}if(void 0!==t.animations){const e=t.animations;for(let t=0;t<e.length;t++){const i=e[t];r.animations.push(s[i])}}if("LOD"===t.type){void 0!==t.autoUpdate&&(r.autoUpdate=t.autoUpdate);const e=t.levels;for(let t=0;t<e.length;t++){const i=e[t],n=r.getObjectByProperty("uuid",i.object);void 0!==n&&r.addLevel(n,i.distance,i.hysteresis)}}return r}bindSkeletons(t,e){0!==Object.keys(e).length&&t.traverse((function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){const i=e[t.skeleton];void 0===i?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(i,t.bindMatrix)}}))}bindLightTargets(t){t.traverse((function(e){if(e.isDirectionalLight||e.isSpotLight){const i=e.target,n=t.getObjectByProperty("uuid",i);e.target=void 0!==n?n:new cn}}))}},ObjectSpaceNormalMap:1,OctahedronGeometry:wh,OneFactor:201,OneMinusConstantAlphaFactor:214,OneMinusConstantColorFactor:212,OneMinusDstAlphaFactor:207,OneMinusDstColorFactor:209,OneMinusSrcAlphaFactor:d,OneMinusSrcColorFactor:203,OrthographicCamera:Ks,P3Primaries:ae,PCFShadowMap:s,PCFSoftShadowMap:r,PMREMGenerator:cr,Path:kc,PerspectiveCamera:Ss,Plane:Ps,PlaneGeometry:Bs,PlaneHelper:class extends Yl{constructor(t,e=1,i=16776960){const n=i,s=new Zn;s.setAttribute("position",new zn([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 Hl({color:n,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const r=new Zn;r.setAttribute("position",new zn([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),r.computeBoundingSphere(),this.add(new us(r,new Ln({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:Cd,PointLightHelper:class extends us{constructor(t,e,i){super(new Sh(e,4,2),new Ln({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:ac,PointsMaterial:ec,PolarGridHelper:class extends Ql{constructor(t=10,e=16,i=8,n=64,s=4473924,r=8947848){s=new En(s),r=new En(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 Zn;l.setAttribute("position",new zn(a,3)),l.setAttribute("color",new zn(o,3));super(l,new Hl({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}},PolyhedronGeometry:Dc,PositionalAudio:class extends Qd{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,i){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=i,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(tu,eu,iu),nu.set(0,0,1).applyQuaternion(eu);const e=this.panner;if(e.positionX){const t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(tu.x,t),e.positionY.linearRampToValueAtTime(tu.y,t),e.positionZ.linearRampToValueAtTime(tu.z,t),e.orientationX.linearRampToValueAtTime(nu.x,t),e.orientationY.linearRampToValueAtTime(nu.y,t),e.orientationZ.linearRampToValueAtTime(nu.z,t)}else e.setPosition(tu.x,tu.y,tu.z),e.setOrientation(nu.x,nu.y,nu.z)}},PropertyBinding:du,PropertyMixer:su,QuadraticBezierCurve:Ec,QuadraticBezierCurve3:Tc,Quaternion:si,QuaternionKeyframeTrack:nd,QuaternionLinearInterpolant:id,RED_GREEN_RGTC2_Format:zt,RED_RGTC1_Format:Bt,REVISION:e,RGBADepthPacking:3201,RGBAFormat:tt,RGBAIntegerFormat:ct,RGBA_ASTC_10x10_Format:Pt,RGBA_ASTC_10x5_Format:Lt,RGBA_ASTC_10x6_Format:kt,RGBA_ASTC_10x8_Format:Rt,RGBA_ASTC_12x10_Format:It,RGBA_ASTC_12x12_Format:Ut,RGBA_ASTC_4x4_Format:wt,RGBA_ASTC_5x4_Format:bt,RGBA_ASTC_5x5_Format:Mt,RGBA_ASTC_6x5_Format:St,RGBA_ASTC_6x6_Format:Et,RGBA_ASTC_8x5_Format:Tt,RGBA_ASTC_8x6_Format:At,RGBA_ASTC_8x8_Format:Ct,RGBA_BPTC_Format:Nt,RGBA_ETC2_EAC_Format:xt,RGBA_PVRTC_2BPPV1_Format:vt,RGBA_PVRTC_4BPPV1_Format:gt,RGBA_S3TC_DXT1_Format:dt,RGBA_S3TC_DXT3_Format:ut,RGBA_S3TC_DXT5_Format:pt,RGBFormat:Q,RGBIntegerFormat:1032,RGB_BPTC_SIGNED_Format:Dt,RGB_BPTC_UNSIGNED_Format:Ot,RGB_ETC1_Format:_t,RGB_ETC2_Format:yt,RGB_PVRTC_2BPPV1_Format:ft,RGB_PVRTC_4BPPV1_Format:mt,RGB_S3TC_DXT1_Format:ht,RGFormat:ot,RGIntegerFormat:lt,RawShaderMaterial:Ih,Ray:Ui,Raycaster:yu,Rec709Primaries:re,RectAreaLight:Pd,RedFormat:rt,RedIntegerFormat:at,ReinhardToneMapping:v,RenderTarget:ti,RepeatWrapping:R,ReplaceStencilOp:le,ReverseSubtractEquation:102,RingGeometry:bh,SIGNED_RED_GREEN_RGTC2_Format:Ht,SIGNED_RED_RGTC1_Format:Ft,SRGBColorSpace:Qt,SRGBTransfer:se,Scene:Lo,ShaderChunk:Fs,ShaderLib:Hs,ShaderMaterial:ys,ShadowMaterial:Ph,Shape:Gc,ShapeGeometry:Mh,ShapePath:qu,ShapeUtils:fh,ShortType:V,Skeleton:ul,SkeletonHelper:class extends Ql{constructor(t){const e=Ru(t),i=new Zn,n=[],s=[],r=new En(0,0,1),a=new En(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 zn(n,3)),i.setAttribute("color",new zn(s,3));super(i,new Hl({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");ku.copy(this.root.matrixWorld).invert();for(let t=0,i=0;t<e.length;t++){const s=e[t];s.parent&&s.parent.isBone&&(Lu.multiplyMatrices(ku,s.matrixWorld),Cu.setFromMatrixPosition(Lu),n.setXYZ(i,Cu.x,Cu.y,Cu.z),Lu.multiplyMatrices(ku,s.parent.matrixWorld),Cu.setFromMatrixPosition(Lu),n.setXYZ(i+1,Cu.x,Cu.y,Cu.z),i+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose()}},SkinnedMesh:ol,Source:Ye,Sphere:Ti,SphereGeometry:Sh,Spherical:bu,SphericalHarmonics3:Id,SplineCurve:Ac,SpotLight:Md,SpotLightHelper:class extends cn{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const i=new Zn,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 zn(n,3));const s=new Hl({fog:!1,toneMapped:!1});this.cone=new Ql(i,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),Au.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Au),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}},Sprite:Xo,SpriteMaterial:Io,SrcAlphaFactor:h,SrcAlphaSaturateFactor:210,SrcColorFactor:202,StaticCopyUsage:35046,StaticDrawUsage:pe,StaticReadUsage:35045,StereoCamera:class{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ss,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ss,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,qd.copy(t.projectionMatrix);const i=e.eyeSep/2,n=i*e.near/e.focus,s=e.near*Math.tan(xe*e.fov*.5)/e.zoom;let r,a;Wd.elements[12]=-i,jd.elements[12]=i,r=-s*e.aspect+n,a=s*e.aspect+n,qd.elements[0]=2*e.near/(a-r),qd.elements[8]=(a+r)/(a-r),this.cameraL.projectionMatrix.copy(qd),r=-s*e.aspect-n,a=s*e.aspect-n,qd.elements[0]=2*e.near/(a-r),qd.elements[8]=(a+r)/(a-r),this.cameraR.projectionMatrix.copy(qd)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Wd),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(jd)}},StreamCopyUsage:35042,StreamDrawUsage:35040,StreamReadUsage:35041,StringKeyframeTrack:sd,SubtractEquation:101,SubtractiveBlending:3,TOUCH:n,TangentSpaceNormalMap:0,TetrahedronGeometry:Eh,Texture:$e,TextureLoader:class extends dd{constructor(t){super(t)}load(t,e,i,n){const s=new $e,r=new fd(this.manager);return r.setCrossOrigin(this.crossOrigin),r.setPath(this.path),r.load(t,(function(t){s.image=t,s.needsUpdate=!0,void 0!==e&&e(s)}),i,n),s}},TextureUtils:po,TorusGeometry:Th,TorusKnotGeometry:Ah,Triangle:xn,TriangleFanDrawMode:2,TriangleStripDrawMode:1,TrianglesDrawMode:0,TubeGeometry:Ch,UVMapping:E,Uint16BufferAttribute:Bn,Uint32BufferAttribute:Fn,Uint8BufferAttribute:class extends On{constructor(t,e,i){super(new Uint8Array(t),e,i)}},Uint8ClampedBufferAttribute:class extends On{constructor(t,e,i){super(new Uint8ClampedArray(t),e,i)}},Uniform:fu,UniformsGroup:class extends ve{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:gu++}),this.name="",this.usage=pe,this.uniforms=[]}add(t){return this.uniforms.push(t),this}remove(t){const e=this.uniforms.indexOf(t);return-1!==e&&this.uniforms.splice(e,1),this}setName(t){return this.name=t,this}setUsage(t){return this.usage=t,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(t){this.name=t.name,this.usage=t.usage;const e=t.uniforms;this.uniforms.length=0;for(let t=0,i=e.length;t<i;t++){const i=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0;t<i.length;t++)this.uniforms.push(i[t].clone())}return this}clone(){return(new this.constructor).copy(this)}},UniformsLib:zs,UniformsUtils:_s,UnsignedByteType:z,UnsignedInt248Type:J,UnsignedInt5999Type:K,UnsignedIntType:W,UnsignedShort4444Type:Z,UnsignedShort5551Type:Y,UnsignedShortType:G,VSMShadowMap:a,Vector2:Le,Vector3:ri,Vector4:Qe,VectorKeyframeTrack:rd,VideoTexture:class extends $e{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:O,this.magFilter=void 0!==s?s:O,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)}},WebGL3DRenderTarget:class extends ei{constructor(t=1,e=1,i=1,n={}){super(t,e,n),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new ni(null,t,e,i),this.texture.isRenderTargetTexture=!0}},WebGLArrayRenderTarget:class extends ei{constructor(t=1,e=1,i=1,n={}){super(t,e,n),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new ii(null,t,e,i),this.texture.isRenderTargetTexture=!0}},WebGLCoordinateSystem:fe,WebGLCubeRenderTarget:Cs,WebGLMultipleRenderTargets:class extends ei{constructor(t=1,e=1,i=1,n={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(t,e,{...n,count:i}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}},WebGLRenderTarget:ei,WebGLRenderer:To,WebGLUtils:fo,WebGPUCoordinateSystem:ge,WireframeGeometry:Lh,WrapAroundEnding:Yt,ZeroCurvatureEnding:Xt,ZeroFactor:200,ZeroSlopeEnding:Zt,ZeroStencilOp:0,createCanvasElement:De});const Zu={bottom:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},front:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},help:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M23.0%2c-13.0 A10.0%2c10.0%2c0%2c1%2c0%2c22.998476951563912%2c-12.825475935627155' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3ctext x='7.0' y='-6.0' font-size='20.0' fill='rgb(83%2c160%2c227)' font-family='sans-serif' font-weight='bold' dy='0em'%3e%3f%3c/text%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M23.0%2c-13.0 A10.0%2c10.0%2c0%2c1%2c0%2c22.998476951563912%2c-12.825475935627155' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3ctext x='7.0' y='-6.0' font-size='20.0' fill='rgb(48%2c 142%2c 225)' font-family='sans-serif' font-weight='bold' dy='0em'%3e%3f%3c/text%3e%3c/svg%3e"},iso:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M22.0%2c-7.5 L22.0%2c-18.5 L13.0%2c-13.0 L13.0%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-13.0 L13.0%2c-2.0 L4.0%2c-7.5 L4.0%2c-18.5 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-18.5 L13.0%2c-24.0 L4.0%2c-18.5 L13.0%2c-13.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M22.0%2c-7.5 L22.0%2c-18.5 L13.0%2c-13.0 L13.0%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-13.0 L13.0%2c-2.0 L4.0%2c-7.5 L4.0%2c-18.5 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-18.5 L13.0%2c-24.0 L4.0%2c-18.5 L13.0%2c-13.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},left:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},mesh:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e"},mesh_empty:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='%23ddd' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='%23ddd' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='%23666' stroke='%23666' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='%23666' stroke='%23666' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L10.6%2c-10.133333333333333 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 Z' fill='none' stroke='%23666' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e"},mesh_mix:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-14.2 L12.6%2c-14.2 L8.6%2c-10.133333333333333 L8.6%2c-6.066666666666666 L12.6%2c-2.0 L6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='square' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M16.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 L16.6%2c-2.0 L12.6%2c-6.066666666666666 L12.6%2c-10.133333333333333 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M10.6%2c-10.133333333333333 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L10.6%2c-6.066666666666666' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-14.2 L6.0%2c-14.2 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L6.0%2c-2.0 L14.6%2c-2.0' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-14.2 L12.6%2c-14.2 L8.6%2c-10.133333333333333 L8.6%2c-6.066666666666666 L12.6%2c-2.0 L6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='square' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M16.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 L16.6%2c-2.0 L12.6%2c-6.066666666666666 L12.6%2c-10.133333333333333 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M10.6%2c-10.133333333333333 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L10.6%2c-6.066666666666666' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-14.2 L6.0%2c-14.2 L2.0%2c-10.133333333333333 L2.0%2c-6.066666666666666 L6.0%2c-2.0 L14.6%2c-2.0' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},mesh_no:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M6.0%2c-2.0 L2.0%2c-6.066666666666666 L2.0%2c-10.133333333333333 L6.0%2c-14.2 L14.6%2c-14.2 L10.6%2c-10.133333333333333 L10.6%2c-6.066666666666666 L14.6%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3cpath d='M14.6%2c-2.0 L10.6%2c-6.066666666666666 L10.6%2c-10.133333333333333 L14.6%2c-14.2 L23.2%2c-14.2 L19.2%2c-10.133333333333333 L19.2%2c-6.066666666666666 L23.2%2c-2.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='square' fill-opacity='1.0' /%3e%3c/svg%3e"},pause:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='5.2' y='-22.0' width='5.6' height='18.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3crect x='15.2' y='-22.0' width='5.6' height='18.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='5.2' y='-22.0' width='5.6' height='18.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3crect x='15.2' y='-22.0' width='5.6' height='18.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},pin:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='10.0' y='-23.0' width='6.0' height='11.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-3.0 L13.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M17.330127018922195%2c-21.5 A5.0%2c5.0%2c0%2c0%2c0%2c8.669872981077805%2c-21.5' stroke='%23444' stroke-width='1.25' fill='rgb(83%2c160%2c227)' stroke-linecap='round' /%3e%3cpath d='M21.66025403784439%2c-10.2 A10.0%2c10.0%2c0%2c0%2c0%2c4.339745962155613%2c-10.2' stroke='%23444' stroke-width='1.25' fill='rgb(83%2c160%2c227)' stroke-linecap='round' /%3e%3cpath d='M4.5%2c-10.2 L21.5%2c-10.2 Z' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M8.8%2c-21.4 L17.2%2c-21.4 Z' fill='none' stroke='%23444' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='10.0' y='-23.0' width='6.0' height='11.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-3.0 L13.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M17.330127018922195%2c-21.5 A5.0%2c5.0%2c0%2c0%2c0%2c8.669872981077805%2c-21.5' stroke='%23ddd' stroke-width='1.25' fill='rgb(48%2c 142%2c 225)' stroke-linecap='round' /%3e%3cpath d='M21.66025403784439%2c-10.2 A10.0%2c10.0%2c0%2c0%2c0%2c4.339745962155613%2c-10.2' stroke='%23ddd' stroke-width='1.25' fill='rgb(48%2c 142%2c 225)' stroke-linecap='round' /%3e%3cpath d='M4.5%2c-10.2 L21.5%2c-10.2 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M8.8%2c-21.4 L17.2%2c-21.4 Z' fill='none' stroke='%23ddd' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},plane:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.0%2c-5.0 L4.4%2c-13.0 L24.0%2c-13.0 L21.0%2c-5.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-9.5 L13.0%2c-19.5 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M11.0%2c-17.5 L13.0%2c-19.5 L15.0%2c-17.5 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.0%2c-5.0 L4.4%2c-13.0 L24.0%2c-13.0 L21.0%2c-5.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M13.0%2c-9.5 L13.0%2c-19.5 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M11.0%2c-17.5 L13.0%2c-19.5 L15.0%2c-17.5 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='2.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},play:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M5.0%2c-4.0 L5.0%2c-22.0 L21.0%2c-13.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M5.0%2c-4.0 L5.0%2c-22.0 L21.0%2c-13.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},rear:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},reset:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M18.0%2c-21.660254037844386 A10.0%2c10.0%2c0%2c1%2c0%2c23.0%2c-12.999999999999998' stroke='%23444' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M16.0%2c-18.196152422706632 A6.0%2c6.0%2c0%2c1%2c0%2c19.0%2c-12.999999999999998' stroke='%23444' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M17.0%2c-13.0 L21.0%2c-17.0 L25.0%2c-13.0' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M18.0%2c-21.660254037844386 A10.0%2c10.0%2c0%2c1%2c0%2c23.0%2c-12.999999999999998' stroke='%23ddd' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M16.0%2c-18.196152422706632 A6.0%2c6.0%2c0%2c1%2c0%2c19.0%2c-12.999999999999998' stroke='%23ddd' stroke-width='1.5' fill='none' stroke-linecap='round' /%3e%3cpath d='M17.0%2c-13.0 L21.0%2c-17.0 L25.0%2c-13.0' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},resize:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='2.0' y='-24.0' width='22.0' height='22.0' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L6.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-6.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L20.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-20.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L6.0%2c-16.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-20.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L20.0%2c-10.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-6.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='2.0' y='-24.0' width='22.0' height='22.0' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L6.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-6.0 L10.0%2c-6.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L20.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-20.0 L16.0%2c-20.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L6.0%2c-16.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.0%2c-20.0 L10.0%2c-20.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L20.0%2c-10.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M20.0%2c-6.0 L16.0%2c-6.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},right:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},shape:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='rgb(83%2c160%2c227)' stroke='none' stroke-width='1.25' /%3e%3cellipse cx='12.6' cy='-8.1' rx='2.1' ry='2.1' fill='%23444' stroke='%23444' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='rgb(48%2c 142%2c 225)' stroke='none' stroke-width='1.25' /%3e%3cellipse cx='12.6' cy='-8.1' rx='2.1' ry='2.1' fill='%23ddd' stroke='%23ddd' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},shape_empty:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='%23ddd' stroke='none' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cellipse cx='12.6' cy='-8.1' rx='5.04' ry='5.04' fill='%23666' stroke='none' stroke-width='1.25' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23666' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23666' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},shape_mix:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M12.6%2c-13.14 A5.04%2c5.04%2c0%2c0%2c0%2c12.599999999999998%2c-3.0599999999999996' stroke='none' stroke-width='1.25' fill='rgb(83%2c160%2c227)' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-10.2 A2.1%2c2.1%2c0%2c0%2c0%2c12.6%2c-6.0' stroke='%23444' stroke-width='1.25' fill='%23444' stroke-linecap='round' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c15.69914007006101%2c-13.236830413208175' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M15.69914007006101%2c-2.9631695867918246 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-13.7 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c12.6%2c-2.5' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M12.6%2c-13.14 A5.04%2c5.04%2c0%2c0%2c0%2c12.599999999999998%2c-3.0599999999999996' stroke='none' stroke-width='1.25' fill='rgb(48%2c 142%2c 225)' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-10.2 A2.1%2c2.1%2c0%2c0%2c0%2c12.6%2c-6.0' stroke='%23ddd' stroke-width='1.25' fill='%23ddd' stroke-linecap='round' /%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c15.69914007006101%2c-13.236830413208175' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M15.69914007006101%2c-2.9631695867918246 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M12.6%2c-13.7 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c12.6%2c-2.5' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},shape_no:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23444' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='25.2' height='16.2' viewBox='0 -16.2 25.2 16.2'%3e%3cpath d='M21.77986928011505%2c-8.399999999999999 A10.6%2c10.6%2c0%2c0%2c0%2c3.42013071988495%2c-8.399999999999999' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3cpath d='M3.42013071988495%2c-7.800000000000001 A10.6%2c10.6%2c0%2c0%2c0%2c21.77986928011505%2c-7.800000000000001' stroke='%23ddd' stroke-width='1.25' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},stop:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='4.0' y='-22.0' width='18.0' height='18.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='4.0' y='-22.0' width='18.0' height='18.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},top:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.2' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},axes:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-3.0 Z' fill='none' stroke='red' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-17.0 Z' fill='none' stroke='rgb(0%2c128%2c0)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L6.6%2c-24.0 Z' fill='none' stroke='blue' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-3.0 Z' fill='none' stroke='rgb(255%2c 69%2c 0)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-17.0 Z' fill='none' stroke='rgb(50%2c 205%2c 50)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L6.6%2c-24.0 Z' fill='none' stroke='rgb(59%2c 158%2c 255)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},axes0:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-3.0 Z' fill='none' stroke='red' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-17.0 Z' fill='none' stroke='rgb(0%2c128%2c0)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L6.6%2c-24.0 Z' fill='none' stroke='blue' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.6' cy='-10.0' rx='3.0' ry='3.8' fill='none' stroke='white' stroke-width='2.4' /%3e%3cellipse cx='6.6' cy='-10.0' rx='2.0' ry='3.0' fill='white' stroke='%23444' stroke-width='1.4' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-3.0 Z' fill='none' stroke='rgb(255%2c 69%2c 0)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L19.4%2c-17.0 Z' fill='none' stroke='rgb(50%2c 205%2c 50)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M6.6%2c-10.0 L6.6%2c-24.0 Z' fill='none' stroke='rgb(59%2c 158%2c 255)' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.6' cy='-10.0' rx='3.0' ry='3.8' fill='none' stroke='%23444' stroke-width='2.4' /%3e%3cellipse cx='6.6' cy='-10.0' rx='2.0' ry='3.0' fill='%23444' stroke='%23ddd' stroke-width='1.4' /%3e%3c/svg%3e"},grid:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.4%2c-2.0 L23.6%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-9.333333333333332 L23.6%2c-9.333333333333332 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-16.666666666666664 L23.6%2c-16.666666666666664 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-24.0 L23.6%2c-24.0 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.4 L2.0%2c-23.6 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M9.333333333333332%2c-2.4 L9.333333333333332%2c-23.6 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M16.666666666666664%2c-2.4 L16.666666666666664%2c-23.6 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M24.0%2c-2.4 L24.0%2c-23.6 Z' fill='none' stroke='%23444' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.4%2c-2.0 L23.6%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-9.333333333333332 L23.6%2c-9.333333333333332 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-16.666666666666664 L23.6%2c-16.666666666666664 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-24.0 L23.6%2c-24.0 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.4 L2.0%2c-23.6 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M9.333333333333332%2c-2.4 L9.333333333333332%2c-23.6 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M16.666666666666664%2c-2.4 L16.666666666666664%2c-23.6 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M24.0%2c-2.4 L24.0%2c-23.6 Z' fill='none' stroke='%23ddd' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},perspective:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='14.0' y='-24.0' width='10.0' height='10.0' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L14.0%2c-14.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-18.0 L24.0%2c-24.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L24.0%2c-14.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L14.0%2c-24.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.875' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='14.0' y='-24.0' width='10.0' height='10.0' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L14.0%2c-14.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-18.0 L24.0%2c-24.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.0%2c-2.0 L24.0%2c-14.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L14.0%2c-24.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='0.75' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.875' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"},explode:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cellipse cx='22.5' cy='-13.0' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L20.5%2c-13.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='15.935661446562001' cy='-22.03503690480396' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L15.317627457812106%2c-20.132923872213652 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='5.3143385534380005' cy='-18.583959896778495' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L6.932372542187895%2c-17.40838939219355 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='5.314338553437999' cy='-7.416040103221507' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L6.932372542187894%2c-8.591610607806452 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='15.935661446561998' cy='-3.9649630951960404' rx='2.5' ry='2.5' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L15.317627457812105%2c-5.867076127786348 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='13.0' cy='-13.0' rx='2.0' ry='2.0' fill='%23444' stroke='%23444' stroke-width='1.75' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cellipse cx='22.5' cy='-13.0' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L20.5%2c-13.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='15.935661446562001' cy='-22.03503690480396' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L15.317627457812106%2c-20.132923872213652 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='5.3143385534380005' cy='-18.583959896778495' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L6.932372542187895%2c-17.40838939219355 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='5.314338553437999' cy='-7.416040103221507' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L6.932372542187894%2c-8.591610607806452 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='15.935661446561998' cy='-3.9649630951960404' rx='2.5' ry='2.5' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M13.0%2c-13.0 L15.317627457812105%2c-5.867076127786348 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.25' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='13.0' cy='-13.0' rx='2.0' ry='2.0' fill='%23ddd' stroke='%23ddd' stroke-width='1.75' /%3e%3c/svg%3e"},distance:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.0%2c-5.0 L2.0%2c-21.0 Z' fill='none' stroke='%23444' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M24.0%2c-5.0 L24.0%2c-21.0 Z' fill='none' stroke='%23444' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L22.0%2c-13.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L6.8%2c-16.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L6.8%2c-10.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-13.0 L19.2%2c-16.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-13.0 L19.2%2c-10.0 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.0%2c-5.0 L2.0%2c-21.0 Z' fill='none' stroke='%23ddd' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M24.0%2c-5.0 L24.0%2c-21.0 Z' fill='none' stroke='%23ddd' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L22.0%2c-13.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L6.8%2c-16.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M4.0%2c-13.0 L6.8%2c-10.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-13.0 L19.2%2c-16.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M22.0%2c-13.0 L19.2%2c-10.0 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.7' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3c/svg%3e"},properties:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M4.0%2c-21.6 L22.0%2c-21.6 Z' fill='none' stroke='%23444' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M9.2%2c-16.8 L20.8%2c-16.8 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-16.8' rx='0.8' ry='0.8' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-12.8 L20.8%2c-12.8 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-12.8' rx='0.8' ry='0.8' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-8.8 L20.8%2c-8.8 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-8.8' rx='0.8' ry='0.8' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-4.8 L20.8%2c-4.8 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-4.8' rx='0.8' ry='0.8' fill='rgb(83%2c160%2c227)' stroke='rgb(83%2c160%2c227)' stroke-width='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M4.0%2c-21.6 L22.0%2c-21.6 Z' fill='none' stroke='%23ddd' stroke-width='2.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M9.2%2c-16.8 L20.8%2c-16.8 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-16.8' rx='0.8' ry='0.8' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-12.8 L20.8%2c-12.8 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-12.8' rx='0.8' ry='0.8' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-8.8 L20.8%2c-8.8 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-8.8' rx='0.8' ry='0.8' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3cpath d='M9.2%2c-4.8 L20.8%2c-4.8 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.4' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cellipse cx='6.0' cy='-4.8' rx='0.8' ry='0.8' fill='rgb(48%2c 142%2c 225)' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.0' /%3e%3c/svg%3e"},angle:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.4%2c-3.84 L23.6%2c-3.84 Z' fill='none' stroke='%23444' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-3.84 L14.0%2c-22.88 Z' fill='none' stroke='%23444' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M17.80793811328415%2c-6.280377654627602 A15.6%2c15.6%2c0%2c0%2c0%2c12.217398100377466%2c-15.963476998728744' stroke='rgb(83%2c160%2c227)' stroke-width='2.0' fill='none' stroke-linecap='round' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3cpath d='M2.4%2c-3.84 L23.6%2c-3.84 Z' fill='none' stroke='%23ddd' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.4%2c-3.84 L14.0%2c-22.88 Z' fill='none' stroke='%23ddd' stroke-width='1.45' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M17.80793811328415%2c-6.280377654627602 A15.6%2c15.6%2c0%2c0%2c0%2c12.217398100377466%2c-15.963476998728744' stroke='rgb(48%2c 142%2c 225)' stroke-width='2.0' fill='none' stroke-linecap='round' /%3e%3c/svg%3e"},transparent:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='0.75' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='0.75' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='rgb(83%2c160%2c227)' stroke='%23444' stroke-width='1.0' stroke-linejoin='round' fill-opacity='0.75' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='8.0' y='-24.0' width='16.0' height='16.0' fill='none' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L2.0%2c-18.0 L8.0%2c-24.0 L8.0%2c-8.0 Z' fill='none' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-2.0 L8.0%2c-8.0 L24.0%2c-8.0 L18.0%2c-2.0 Z' fill='none' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.0%2c-18.0 L8.0%2c-24.0 L24.0%2c-24.0 L18.0%2c-18.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='0.75' /%3e%3cpath d='M18.0%2c-2.0 L18.0%2c-18.0 L24.0%2c-24.0 L24.0%2c-8.0 Z' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' stroke-linecap='round' fill-opacity='0.75' /%3e%3crect x='2.0' y='-18.0' width='16.0' height='16.0' fill='rgb(48%2c 142%2c 225)' stroke='%23ddd' stroke-width='1.0' stroke-linejoin='round' fill-opacity='0.75' /%3e%3c/svg%3e"},blackedges:{light:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='7.833333333333333' y='-23.5' width='15.666666666666666' height='15.666666666666666' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-2.5 L2.5%2c-18.166666666666664 L7.833333333333333%2c-23.5 L7.833333333333333%2c-7.833333333333333 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-2.5 L7.833333333333333%2c-7.833333333333333 L23.5%2c-7.833333333333333 L18.166666666666664%2c-2.5 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-18.166666666666664 L7.833333333333333%2c-23.5 L23.5%2c-23.5 L18.166666666666664%2c-18.166666666666664 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.166666666666664%2c-2.5 L18.166666666666664%2c-18.166666666666664 L23.5%2c-23.5 L23.5%2c-7.833333333333333 Z' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.5' y='-18.166666666666664' width='15.666666666666666' height='15.666666666666666' fill='none' stroke='rgb(83%2c160%2c227)' stroke-width='1.5625' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e",dark:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='26.0' height='26.0' viewBox='0 -26.0 26.0 26.0'%3e%3crect x='7.833333333333333' y='-23.5' width='15.666666666666666' height='15.666666666666666' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-2.5 L2.5%2c-18.166666666666664 L7.833333333333333%2c-23.5 L7.833333333333333%2c-7.833333333333333 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-2.5 L7.833333333333333%2c-7.833333333333333 L23.5%2c-7.833333333333333 L18.166666666666664%2c-2.5 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M2.5%2c-18.166666666666664 L7.833333333333333%2c-23.5 L23.5%2c-23.5 L18.166666666666664%2c-18.166666666666664 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3cpath d='M18.166666666666664%2c-2.5 L18.166666666666664%2c-18.166666666666664 L23.5%2c-23.5 L23.5%2c-7.833333333333333 Z' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' stroke-linecap='round' fill-opacity='1.0' /%3e%3crect x='2.5' y='-18.166666666666664' width='15.666666666666666' height='15.666666666666666' fill='none' stroke='rgb(48%2c 142%2c 225)' stroke-width='1.5625' stroke-linejoin='round' fill-opacity='1.0' /%3e%3c/svg%3e"}};function Yu(t,e){return`url("${Zu[e][t]}")`}function Ju(t){if(Array.isArray(t))return t.map((t=>Ju(t)));if("object"==typeof t){var e={};for(var[i,n]of Object.entries(t))e[i]=Ju(n);return e}return t}function Ku(t,e=1){return Array.isArray(t)?t.flat(e):t}function $u(t,e,i=1e-9){if(Array.isArray(t)&&Array.isArray(e))return t.length===e.length&&t.every(((t,i)=>$u(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=>$u(t[i],e[i])))}return Number(t)===t&&Number(e)===e?Math.abs(t-e)<i:t===e}function Qu(t,e){t&&(e(t),t.children&&t.children.length>0&&t.children.forEach((t=>{Qu(t,e)})))}function tp(t){return Math.round(Math.PI*t)}const ep=new class{constructor(){this.keyMapping={shift:"shiftKey",ctrl:"ctrlKey",meta:"metaKey"}}getshortcuts=t=>this.keyMapping[t].replace("Key","");get_config(){return Object.assign({},this.keyMapping)}get=(t,e)=>t[this.keyMapping[e]];set=t=>{for(var e in t)this.keyMapping[e]=t[e]}};class ip{constructor(t,e,i,n){t.startsWith("plane")?(this.index=parseInt(t.substring(5)),this.type="plane"):(this.index=void 0,this.type=t),this.display=n,this.slider=n.container.getElementsByClassName(`tcv_sld_value_${t}`)[0],this.slider.min=e,this.slider.max=i,this.input=n.container.getElementsByClassName(`tcv_inp_value_${t}`)[0],this.input.value=i,this.slider.oninput=this.sliderChange,this.input.addEventListener("change",this.inputChange)}_notify=(t,e=!0)=>{if("plane"==this.type){const i={};i["clip_slider_"+(this.index-1)]=parseFloat(t),this.display.viewer.checkChanges(i,e)}};_handle(t,e,i){"plane"==t?this.display.refreshPlane(e,i):"ambientlight"===t?this.display.viewer.ready&&this.display.viewer.setAmbientLight(i/100):"pointlight"===t?this.display.viewer.ready&&this.display.viewer.setDirectLight(i/100):"metalness"===t?this.display.viewer.ready&&this.display.viewer.setMetalness(i/100):"roughness"===t&&this.display.viewer.ready&&this.display.viewer.setRoughness(i/100)}sliderChange=t=>{const e=t.target.value;this.input.value=Math.round(1e3*e)/1e3,this._handle(this.type,this.index,this.input.value),this._notify(e)};inputChange=t=>{const e=Math.max(Math.min(t.target.value,this.slider.max),this.slider.min);this.slider.value=e,this._handle(this.type,this.index,this.input.value),this._notify(e)};setSlider(t){const e=Math.abs(Math.round(Math.log10(2*t)));this.slider.min=-t,this.slider.max=t,this.slider.step=Math.pow(10,-(3-e)),this.slider.value=t,this.input.value=Math.round(1e3*this.slider.max)/1e3,this.display.refreshPlane(this.index,this.input.value)}getValue(){return parseFloat(this.input.value)}setValue(t,e=!0){const i=Math.max(Math.min(t,this.slider.max),this.slider.min);this.input.value=Math.round(1e3*i)/1e3,this.slider.value=t,this._handle(this.type,this.index,this.input.value),this._notify(t,e)}}class np{constructor(t,e){this.id=e,this.container=t,this.buttons={}}addButton(t){t.setId(this.id),this.buttons[t.name]=t,this.container.appendChild(t.html)}addSeparator(){var t=document.createElement("span");t.className="tcv_separator",this.container.appendChild(t)}defineGroup(t){for(var e of t)for(var i of t)i!=e&&e.addGroupMember(i)}}class sp{constructor(t,e,i){this.svg=Yu(t,e),this.name=e;var n=document.createElement("span");n.className="tcv_tooltip",n.setAttribute("data-tooltip",i);var s=n.appendChild(document.createElement("span"));s.className="tcv_button_frame",s.appendChild(document.createElement("input")),s.children[0].className="tcv_reset tcv_btn",s.children[0].type="button",s.children[0].style.backgroundImage=this.svg,this.html=n,this.html.addEventListener("click",(t=>{this.handler(t)}))}dispose(){this.html="",this.container.removeEventListener("click",this.handler)}setId(t){this.containerId=t}handler=t=>{console.log("not implemented yet")};alignRight(){this.html.classList.add("tcv_align_right")}show(t){this.html.style.display=t?"inline-block":"none"}}class rp extends sp{constructor(t,e,i,n){super(t,e,i),this.action=n}handler=t=>{this.action(this.name)};highlight=t=>{t?this.html.firstChild.classList.add("tcv_btn_highlight"):this.html.firstChild.classList.remove("tcv_btn_highlight")}}class ap extends sp{constructor(t,e,i,n,s=!1,r=null){if(super(t,e,i),this.action=n,this.state=s,this.dropdown=r,this.sameGroup=[],this.checkElems={},null!=r){const t=document.createElement("span");for(var a of(t.classList.add("tcv_grid-content"),t.classList.add("tcv_dropdown-content"),t.classList.add("tcv_round"),r)){const e=document.createElement("div");e.className="tcv_tooltip",e.setAttribute("data-tooltip",`${i} ${a}`),e.innerHTML=`<input class='tcv_grid-${a} tcv_check tcv_dropdown-entry' id='tcv_grid-${a}_${this.containerId}' type="checkbox"><label for='tcv_grid-${a}_${this.containerId}' class="tcv_label tcv_dropdown-entry">${a}</label>`,t.appendChild(e),this.checkElems[a]=e.children[0]}this.html.children[0].appendChild(t),this.html.children[0].classList.add("tcv_grid-dropdown")}}get=()=>this.state;set=t=>{this.state=t,this.html.children[0].classList.toggle("tcv_btn_click2",this.state)};clearGroup=()=>{for(var t of this.sameGroup)t.state&&(t.state=!1,t.html.children[0].classList.remove("tcv_btn_click2"),t.action(this.name,!1))};extractIdFromName=t=>{const e="grid-",i=t.indexOf(e)+5,n=t.indexOf("_",i);return t.slice(i,n)};handler=t=>{const e=this.extractIdFromName(t.target.id);if(null!=this.dropdown&&e&&this.dropdown.includes(e)){const i=t.target.checked;this.action(`grid-${e}`,i),this.checkElems[e].checked=i}else"button"===t.target.type&&(this.state||this.clearGroup(),this.set(!this.state),this.action(this.name,this.state))};addGroupMember(t){this.sameGroup.push(t)}}const op=new li,lp=new ri;let cp=class extends Od{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 zn([-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 zn([-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 vu(e,6,1);return this.setAttribute("instanceStart",new Po(i,3,0)),this.setAttribute("instanceEnd",new Po(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 vu(e,6,1);return this.setAttribute("instanceColorStart",new Po(i,3,0)),this.setAttribute("instanceColorEnd",new Po(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 Lh(t.geometry)),this}fromLineSegments(t){const e=t.geometry;return this.setPositions(e.attributes.position.array),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new li);const t=this.attributes.instanceStart,e=this.attributes.instanceEnd;void 0!==t&&void 0!==e&&(this.boundingBox.setFromBufferAttribute(t),op.setFromBufferAttribute(e),this.boundingBox.union(op))}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Ti),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++)lp.fromBufferAttribute(t,s),n=Math.max(n,i.distanceToSquared(lp)),lp.fromBufferAttribute(e,s),n=Math.max(n,i.distanceToSquared(lp));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)}};zs.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new Le(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}},Hs.line={uniforms:_s.merge([zs.common,zs.fog,zs.line]),vertexShader:"\n\t\t#include <common>\n\t\t#include <color_pars_vertex>\n\t\t#include <fog_pars_vertex>\n\t\t#include <logdepthbuf_pars_vertex>\n\t\t#include <clipping_planes_pars_vertex>\n\n\t\tuniform float linewidth;\n\t\tuniform vec2 resolution;\n\n\t\tattribute vec3 instanceStart;\n\t\tattribute vec3 instanceEnd;\n\n\t\tattribute vec3 instanceColorStart;\n\t\tattribute vec3 instanceColorEnd;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashScale;\n\t\t\tattribute float instanceDistanceStart;\n\t\t\tattribute float instanceDistanceEnd;\n\t\t\tvarying float vLineDistance;\n\n\t\t#endif\n\n\t\tvoid trimSegment( const in vec4 start, inout vec4 end ) {\n\n\t\t\t// trim end segment so it terminates between the camera plane and the near plane\n\n\t\t\t// conservative estimate of the near plane\n\t\t\tfloat a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column\n\t\t\tfloat b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column\n\t\t\tfloat nearEstimate = - 0.5 * b / a;\n\n\t\t\tfloat alpha = ( nearEstimate - start.z ) / ( end.z - start.z );\n\n\t\t\tend.xyz = mix( start.xyz, end.xyz, alpha );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#ifdef USE_COLOR\n\n\t\t\t\tvColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;\n\n\t\t\t#endif\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\tfloat aspect = resolution.x / resolution.y;\n\n\t\t\t// camera space\n\t\t\tvec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );\n\t\t\tvec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tworldStart = start.xyz;\n\t\t\t\tworldEnd = end.xyz;\n\n\t\t\t#else\n\n\t\t\t\tvUv = uv;\n\n\t\t\t#endif\n\n\t\t\t// special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n\t\t\t// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n\t\t\t// but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n\t\t\t// perhaps there is a more elegant solution -- WestLangley\n\n\t\t\tbool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column\n\n\t\t\tif ( perspective ) {\n\n\t\t\t\tif ( start.z < 0.0 && end.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( start, end );\n\n\t\t\t\t} else if ( end.z < 0.0 && start.z >= 0.0 ) {\n\n\t\t\t\t\ttrimSegment( end, start );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t// clip space\n\t\t\tvec4 clipStart = projectionMatrix * start;\n\t\t\tvec4 clipEnd = projectionMatrix * end;\n\n\t\t\t// ndc space\n\t\t\tvec3 ndcStart = clipStart.xyz / clipStart.w;\n\t\t\tvec3 ndcEnd = clipEnd.xyz / clipEnd.w;\n\n\t\t\t// direction\n\t\t\tvec2 dir = ndcEnd.xy - ndcStart.xy;\n\n\t\t\t// account for clip-space aspect ratio\n\t\t\tdir.x *= aspect;\n\t\t\tdir = normalize( dir );\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\tvec3 worldDir = normalize( end.xyz - start.xyz );\n\t\t\t\tvec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );\n\t\t\t\tvec3 worldUp = normalize( cross( worldDir, tmpFwd ) );\n\t\t\t\tvec3 worldFwd = cross( worldDir, worldUp );\n\t\t\t\tworldPos = position.y < 0.5 ? start: end;\n\n\t\t\t\t// height offset\n\t\t\t\tfloat hw = linewidth * 0.5;\n\t\t\t\tworldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;\n\n\t\t\t\t// don't extend the line if we're rendering dashes because we\n\t\t\t\t// won't be rendering the endcaps\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t// cap extension\n\t\t\t\t\tworldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;\n\n\t\t\t\t\t// add width to the box\n\t\t\t\t\tworldPos.xyz += worldFwd * hw;\n\n\t\t\t\t\t// endcaps\n\t\t\t\t\tif ( position.y > 1.0 || position.y < 0.0 ) {\n\n\t\t\t\t\t\tworldPos.xyz -= worldFwd * 2.0 * hw;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t\t// project the worldpos\n\t\t\t\tvec4 clip = projectionMatrix * worldPos;\n\n\t\t\t\t// shift the depth of the projected points so the line\n\t\t\t\t// segments overlap neatly\n\t\t\t\tvec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;\n\t\t\t\tclip.z = clipPose.z * clip.w;\n\n\t\t\t#else\n\n\t\t\t\tvec2 offset = vec2( dir.y, - dir.x );\n\t\t\t\t// undo aspect ratio adjustment\n\t\t\t\tdir.x /= aspect;\n\t\t\t\toffset.x /= aspect;\n\n\t\t\t\t// sign flip\n\t\t\t\tif ( position.x < 0.0 ) offset *= - 1.0;\n\n\t\t\t\t// endcaps\n\t\t\t\tif ( position.y < 0.0 ) {\n\n\t\t\t\t\toffset += - dir;\n\n\t\t\t\t} else if ( position.y > 1.0 ) {\n\n\t\t\t\t\toffset += dir;\n\n\t\t\t\t}\n\n\t\t\t\t// adjust for linewidth\n\t\t\t\toffset *= linewidth;\n\n\t\t\t\t// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...\n\t\t\t\toffset /= resolution.y;\n\n\t\t\t\t// select end\n\t\t\t\tvec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;\n\n\t\t\t\t// back to clip space\n\t\t\t\toffset *= clip.w;\n\n\t\t\t\tclip.xy += offset;\n\n\t\t\t#endif\n\n\t\t\tgl_Position = clip;\n\n\t\t\tvec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation\n\n\t\t\t#include <logdepthbuf_vertex>\n\t\t\t#include <clipping_planes_vertex>\n\t\t\t#include <fog_vertex>\n\n\t\t}\n\t\t",fragmentShader:"\n\t\tuniform vec3 diffuse;\n\t\tuniform float opacity;\n\t\tuniform float linewidth;\n\n\t\t#ifdef USE_DASH\n\n\t\t\tuniform float dashOffset;\n\t\t\tuniform float dashSize;\n\t\t\tuniform float gapSize;\n\n\t\t#endif\n\n\t\tvarying float vLineDistance;\n\n\t\t#ifdef WORLD_UNITS\n\n\t\t\tvarying vec4 worldPos;\n\t\t\tvarying vec3 worldStart;\n\t\t\tvarying vec3 worldEnd;\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t#endif\n\n\t\t#else\n\n\t\t\tvarying vec2 vUv;\n\n\t\t#endif\n\n\t\t#include <common>\n\t\t#include <color_pars_fragment>\n\t\t#include <fog_pars_fragment>\n\t\t#include <logdepthbuf_pars_fragment>\n\t\t#include <clipping_planes_pars_fragment>\n\n\t\tvec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {\n\n\t\t\tfloat mua;\n\t\t\tfloat mub;\n\n\t\t\tvec3 p13 = p1 - p3;\n\t\t\tvec3 p43 = p4 - p3;\n\n\t\t\tvec3 p21 = p2 - p1;\n\n\t\t\tfloat d1343 = dot( p13, p43 );\n\t\t\tfloat d4321 = dot( p43, p21 );\n\t\t\tfloat d1321 = dot( p13, p21 );\n\t\t\tfloat d4343 = dot( p43, p43 );\n\t\t\tfloat d2121 = dot( p21, p21 );\n\n\t\t\tfloat denom = d2121 * d4343 - d4321 * d4321;\n\n\t\t\tfloat numer = d1343 * d4321 - d1321 * d4343;\n\n\t\t\tmua = numer / denom;\n\t\t\tmua = clamp( mua, 0.0, 1.0 );\n\t\t\tmub = ( d1343 + d4321 * ( mua ) ) / d4343;\n\t\t\tmub = clamp( mub, 0.0, 1.0 );\n\n\t\t\treturn vec2( mua, mub );\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\t#include <clipping_planes_fragment>\n\n\t\t\t#ifdef USE_DASH\n\n\t\t\t\tif ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps\n\n\t\t\t\tif ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX\n\n\t\t\t#endif\n\n\t\t\tfloat alpha = opacity;\n\n\t\t\t#ifdef WORLD_UNITS\n\n\t\t\t\t// Find the closest points on the view ray and the line segment\n\t\t\t\tvec3 rayEnd = normalize( worldPos.xyz ) * 1e5;\n\t\t\t\tvec3 lineDir = worldEnd - worldStart;\n\t\t\t\tvec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );\n\n\t\t\t\tvec3 p1 = worldStart + lineDir * params.x;\n\t\t\t\tvec3 p2 = rayEnd * params.y;\n\t\t\t\tvec3 delta = p1 - p2;\n\t\t\t\tfloat len = length( delta );\n\t\t\t\tfloat norm = len / linewidth;\n\n\t\t\t\t#ifndef USE_DASH\n\n\t\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t\tfloat dnorm = fwidth( norm );\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );\n\n\t\t\t\t\t#else\n\n\t\t\t\t\t\tif ( norm > 0.5 ) {\n\n\t\t\t\t\t\t\tdiscard;\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t#endif\n\n\t\t\t\t#endif\n\n\t\t\t#else\n\n\t\t\t\t#ifdef USE_ALPHA_TO_COVERAGE\n\n\t\t\t\t\t// artifacts appear on some hardware if a derivative is taken within a conditional\n\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\tfloat len2 = a * a + b * b;\n\t\t\t\t\tfloat dlen = fwidth( len2 );\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\talpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );\n\n\t\t\t\t\t}\n\n\t\t\t\t#else\n\n\t\t\t\t\tif ( abs( vUv.y ) > 1.0 ) {\n\n\t\t\t\t\t\tfloat a = vUv.x;\n\t\t\t\t\t\tfloat b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;\n\t\t\t\t\t\tfloat len2 = a * a + b * b;\n\n\t\t\t\t\t\tif ( len2 > 1.0 ) discard;\n\n\t\t\t\t\t}\n\n\t\t\t\t#endif\n\n\t\t\t#endif\n\n\t\t\tvec4 diffuseColor = vec4( diffuse, alpha );\n\n\t\t\t#include <logdepthbuf_fragment>\n\t\t\t#include <color_fragment>\n\n\t\t\tgl_FragColor = vec4( diffuseColor.rgb, alpha );\n\n\t\t\t#include <tonemapping_fragment>\n\t\t\t#include <colorspace_fragment>\n\t\t\t#include <fog_fragment>\n\t\t\t#include <premultiplied_alpha_fragment>\n\n\t\t}\n\t\t"};class hp extends ys{constructor(t){super({type:"LineMaterial",uniforms:_s.clone(Hs.line.uniforms),vertexShader:Hs.line.vertexShader,fragmentShader:Hs.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(t)}get color(){return this.uniforms.diffuse.value}set color(t){this.uniforms.diffuse.value=t}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(t){!0===t?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(t){this.uniforms.linewidth&&(this.uniforms.linewidth.value=t)}get dashed(){return"USE_DASH"in this.defines}set dashed(t){!0===t!==this.dashed&&(this.needsUpdate=!0),!0===t?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(t){this.uniforms.dashScale.value=t}get dashSize(){return this.uniforms.dashSize.value}set dashSize(t){this.uniforms.dashSize.value=t}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(t){this.uniforms.dashOffset.value=t}get gapSize(){return this.uniforms.gapSize.value}set gapSize(t){this.uniforms.gapSize.value=t}get opacity(){return this.uniforms.opacity.value}set opacity(t){this.uniforms&&(this.uniforms.opacity.value=t)}get resolution(){return this.uniforms.resolution.value}set resolution(t){this.uniforms.resolution.value.copy(t)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(t){this.defines&&(!0===t!==this.alphaToCoverage&&(this.needsUpdate=!0),!0===t?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const dp=new Qe,up=new ri,pp=new ri,mp=new Qe,fp=new Qe,gp=new Qe,vp=new ri,_p=new Ni,yp=new Tu,xp=new ri,wp=new li,bp=new Ti,Mp=new Qe;let Sp,Ep;function Tp(t,e,i){return Mp.set(0,0,-e,1).applyMatrix4(t.projectionMatrix),Mp.multiplyScalar(1/Mp.w),Mp.x=Ep/i.width,Mp.y=Ep/i.height,Mp.applyMatrix4(t.projectionMatrixInverse),Mp.multiplyScalar(1/Mp.w),Math.abs(Math.max(Mp.x,Mp.y))}class Ap extends us{constructor(t=new cp,e=new hp({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)up.fromBufferAttribute(e,t),pp.fromBufferAttribute(i,t),n[s]=0===s?0:n[s-1],n[s+1]=n[s]+up.distanceTo(pp);const s=new vu(n,2,1);return t.setAttribute("instanceDistanceStart",new Po(s,1,0)),t.setAttribute("instanceDistanceEnd",new Po(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;Sp=t.ray;const r=this.matrixWorld,a=this.geometry,o=this.material;let l,c;if(Ep=o.linewidth+s,null===a.boundingSphere&&a.computeBoundingSphere(),bp.copy(a.boundingSphere).applyMatrix4(r),i)l=.5*Ep;else{l=Tp(n,Math.max(n.near,bp.distanceToPoint(Sp.origin)),o.resolution)}if(bp.radius+=l,!1!==Sp.intersectsSphere(bp)){if(null===a.boundingBox&&a.computeBoundingBox(),wp.copy(a.boundingBox).applyMatrix4(r),i)c=.5*Ep;else{c=Tp(n,Math.max(n.near,wp.distanceToPoint(Sp.origin)),o.resolution)}wp.expandByScalar(c),!1!==Sp.intersectsBox(wp)&&(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++){yp.start.fromBufferAttribute(s,a),yp.end.fromBufferAttribute(r,a),yp.applyMatrix4(i);const n=new ri,o=new ri;Sp.distanceSqToSegment(yp.start,yp.end,o,n),o.distanceTo(n)<.5*Ep&&e.push({point:o,pointOnLine:n,distance:Sp.origin.distanceTo(o),object:t,face:null,faceIndex:a,uv:null,uv1:null})}}(this,e):function(t,e,i){const n=e.projectionMatrix,s=t.material.resolution,r=t.matrixWorld,a=t.geometry,o=a.attributes.instanceStart,l=a.attributes.instanceEnd,c=Math.min(a.instanceCount,o.count),h=-e.near;Sp.at(1,gp),gp.w=1,gp.applyMatrix4(e.matrixWorldInverse),gp.applyMatrix4(n),gp.multiplyScalar(1/gp.w),gp.x*=s.x/2,gp.y*=s.y/2,gp.z=0,vp.copy(gp),_p.multiplyMatrices(e.matrixWorldInverse,r);for(let e=0,a=c;e<a;e++){if(mp.fromBufferAttribute(o,e),fp.fromBufferAttribute(l,e),mp.w=1,fp.w=1,mp.applyMatrix4(_p),fp.applyMatrix4(_p),mp.z>h&&fp.z>h)continue;if(mp.z>h){const t=mp.z-fp.z,e=(mp.z-h)/t;mp.lerp(fp,e)}else if(fp.z>h){const t=fp.z-mp.z,e=(fp.z-h)/t;fp.lerp(mp,e)}mp.applyMatrix4(n),fp.applyMatrix4(n),mp.multiplyScalar(1/mp.w),fp.multiplyScalar(1/fp.w),mp.x*=s.x/2,mp.y*=s.y/2,fp.x*=s.x/2,fp.y*=s.y/2,yp.start.copy(mp),yp.start.z=0,yp.end.copy(fp),yp.end.z=0;const a=yp.closestPointToPointParameter(vp,!0);yp.at(a,xp);const c=Ce.lerp(mp.z,fp.z,a),d=c>=-1&&c<=1,u=vp.distanceTo(xp)<.5*Ep;if(d&&u){yp.start.fromBufferAttribute(o,e),yp.end.fromBufferAttribute(l,e),yp.start.applyMatrix4(r),yp.end.applyMatrix4(r);const n=new ri,s=new ri;Sp.distanceSqToSegment(yp.start,yp.end,s,n),i.push({point:s,pointOnLine:n,distance:Sp.origin.distanceTo(s),object:t,face:null,faceIndex:e,uv:null,uv1:null})}}}(this,n,e))}}onBeforeRender(t){const e=this.material.uniforms;e&&e.resolution&&(t.getViewport(dp),this.material.uniforms.resolution.value.set(dp.z,dp.w))}}const Cp={none:null,vertex:"vertex",edge:"edge",face:"face",solid:"solid"},Lp=null,kp="plane",Rp="line",Pp="circle",Ip={face:["plane","cylinder","cone","sphere","torus","bezier","bspline","revolution","extrusion","offset","other"],edge:["line","circle","ellipse","hyperbola","parabola","bezier","bspline","offset","other"]};class Up{constructor(t,e){this.obj=t,this.fromSolid=e}_getSolidObjectGroups(t){const e=t.parent.parent;let i;for(let t=0;t<e.children.length;t++){const n=e.children[t];if(n.name===e.name+"|faces"){i=n;break}}return i.children}objs(){return this.fromSolid?this._getSolidObjectGroups(this.obj):[this.obj]}}class Np{constructor(t,e,i,n,s,r,a){this.camera=t,this.group=r,this.domElement=e,this.width=i,this.height=n,this.threshold=s,this.callback=a,this.raycaster=new yu,this.raycastMode=!1,this.lastPosition=null,this.mouse=new Le,this.mouseMoved=!1,this.filters={topoFilter:[Cp.none],geomFilter:[Lp]}}dispose(){this.domElement.removeEventListener("mousemove",this.onPointerMove),this.domElement.removeEventListener("mouseup",this.mouseKetUp),this.domElement.removeEventListener("mousedown",this.onMouseKeyDown),this.domElement.removeEventListener("keydown",this.onKeyDown),this.raycastMode=!1}init(){this.domElement.addEventListener("mousemove",this.onPointerMove),this.domElement.addEventListener("mouseup",this.onMouseKeyUp,!1),this.domElement.addEventListener("mousedown",this.onMouseKeyDown,!1),this.domElement.addEventListener("keydown",this.onKeyDown,!1),this.raycastMode=!0}getIntersectedObjs(){this.raycaster.setFromCamera(this.mouse,this.camera.getCamera()),this.raycaster.params.Points.threshold=this.threshold/this.camera.getZoom(),this.raycaster.params.Line2={threshold:4};var t=this.raycaster.intersectObjects(this.group,!0),e=[];for(var i in t)t[i].object.material.visible&&e.push(t[i]);return e}getValidIntersectedObjs(){var t=[];if(this.mouseMoved){const i=this.getIntersectedObjs();for(var e of i)if(e.object.material.visible){const i=e.object.parent;if(null==i)continue;if(!i.shapeInfo)continue;const n=i.shapeInfo.topo;let s;"vertex"!==n&&(s=Ip[n][i.shapeInfo.geomtype]);const r="solid"===i.subtype;let a=this.filters.topoFilter.includes(Cp.solid)&&r||this.filters.topoFilter.includes(Cp.none)||this.filters.topoFilter.includes(n);if(!a)continue;a=this.filters.geomFilter.includes(Lp)||this.filters.geomFilter.includes(s)&&!this.filters.topoFilter.includes(Cp.solid),a&&t.push(e)}}return t}onMouseKeyDown=t=>{this.raycastMode&&(t.button!=i.LEFT&&t.button!=i.RIGHT||(this.lastPosition=this.camera.getPosition().clone()))};onMouseKeyUp=t=>{this.raycastMode&&(t.button==i.LEFT?this.lastPosition.equals(this.camera.getPosition())&&this.callback({mouse:"left"}):t.button==i.RIGHT&&this.lastPosition.equals(this.camera.getPosition())&&this.callback({mouse:"right"}))};onKeyDown=t=>{this.raycastMode&&("Backspace"==t.key?this.callback({key:"Backspace"}):"Escape"==t.key&&this.callback({key:"Escape"}))};onPointerMove=t=>{const e=this.domElement.getBoundingClientRect(),i=e.x+window.scrollX,n=e.y+window.scrollY;this.mouse.x=(t.pageX-i)/this.width*2-1,this.mouse.y=-(t.pageY-n)/this.height*2+1,this.mouseMoved=!0}}class Dp{constructor(t){this.display=t,this.html=this._getHtml(),this.html.addEventListener("contextmenu",(t=>{t.preventDefault()}))}_getHtml(){throw new Error("Not implemented")}_getCellValue(t){const e=this.display._getElement(t);return e?e.textContent:null}_setCellValue(t,e){const i=this.display._getElement(t);i&&(i.textContent=e)}show=t=>{this.html.style.display=t?"inline-block":"none"};relocate=(t,e)=>{this.html.style.left=`${t}px`,this.html.style.top=`${e}px`};registerCallback(t,e){this.html.addEventListener(t,e)}}class Op extends Dp{constructor(t){super(t)}_getHtml(){return this.display._getElement("tcv_distance_measurement_panel")}get total(){return this._getCellValue("tcv_total")}set total(t){this._setCellValue("tcv_total",t)}get x_distance(){return this._getCellValue("tcv_x")}set x_distance(t){this._setCellValue("tcv_x",t)}get y_distance(){return this._getCellValue("tcv_y")}set y_distance(t){this._setCellValue("tcv_y",t)}get z_distance(){return this._getCellValue("tcv_z")}set z_distance(t){this._setCellValue("tcv_z",t)}}class Bp extends Dp{constructor(t){super(t),this._hideAllRows()}_getHtml(){return this.display._getElement("tcv_properties_measurement_panel")}_hideAllRows(){const t=this.html.getElementsByTagName("tr");for(var e=0;e<t.length;e++){if(t[e].style.display="none",t[e].classList.contains("tcv_vertex_coords_title_row"))continue;const n=t[e].getElementsByTagName("td");for(var i=0;i<n.length;i++)n[i].textContent=""}}set subheader(t){this._setCellValue("tcv_measure_subheader",t)}get subheader(){return this._getCellValue("tcv_measure_subheader")}setProperties(t){this._hideAllRows();const e={vertex_coords:["x_value","y_value","z_value"],volume:"volume",area:"area",length:"length",width:"width",radius:"radius",geom_type:"geom_type"};for(const i in e){const n=e[i],s=t[i];if(null!=s){if(Array.isArray(n)){this.display._getElement("tcv_vertex_coords_title_row").style.display="table-row";for(let t=0;t<n.length;t++){this.display._getElement("tcv_"+n[t]).closest("tr").style.display="table-row",this._setCellValue("tcv_"+n[t],s[t])}}else{this.display._getElement("tcv_"+n).closest("tr").style.display="table-row"}this._setCellValue("tcv_"+n,s)}}}}class Fp extends Dp{constructor(t){super(t)}_getHtml(){return this.display._getElement("tcv_angle_measurement_panel")}get angle(){return this._getCellValue("tcv_angle")}set angle(t){this._setCellValue("tcv_angle",t)}}class zp{constructor(t){this.display=t,this.selectElement=t._getElement("tcv_shape_filter"),this.dropdownElement=t._getElement("tcv_filter_dropdown"),this.arrowElement=t._getElement("tcv_filter_icon"),this.options=["none","vertex","edge","face","solid"],this.selectElement.style.display="none",this.raycaster=null}setRaycaster(t){this.raycaster=t}_setValue=t=>{null!=this.raycaster&&(this.display._getElement("tcv_filter_value").innerText=t,this.raycaster.filters.topoFilter="none"==t?[Cp.none]:[Cp[t.toLowerCase()]])};_toggleDropdown=t=>{null!=t&&t.stopPropagation(),this.dropdownElement.classList.contains("tcv_filter_dropdown_active")?(this.dropdownElement.classList.remove("tcv_filter_dropdown_active"),this.arrowElement.innerText="⏶"):(this.dropdownElement.classList.add("tcv_filter_dropdown_active"),this.arrowElement.innerText="⏷")};_closeDropdown=t=>{this.dropdownElement.classList.contains("tcv_filter_dropdown_active")&&this._toggleDropdown(t)};handleSelection=t=>{const e=t.target.innerText;this._setValue(e),this._toggleDropdown(t)};reset=()=>{this._setValue("None")};_keybindSelect=t=>{-1!==["n","v","e","f","s","Escape"].indexOf(t.key)&&("n"==t.key?this._setValue("None"):"v"==t.key?this._setValue("Vertex"):"e"==t.key?this._setValue("Edge"):"f"==t.key?this._setValue("Face"):"s"==t.key?this._setValue("Solid"):"Escape"==t.key&&this._closeDropdown())};show(t){if(t){this.display.container.addEventListener("keydown",this._keybindSelect),this.display.container.addEventListener("click",this._closeDropdown);let t=this.display._getElement("tcv_filter_content");t.addEventListener("click",this._toggleDropdown);for(const e of this.options)t=this.display._getElement(`tvc_filter_${e}`),t.addEventListener("click",this.handleSelection)}else{this.display.container.removeEventListener("keydown",this._keybindSelect),this.display.container.removeEventListener("click",this._closeDropdown);let t=this.display._getElement("tcv_filter_content");t.removeEventListener("click",this._toggleDropdown);for(const e of this.options)t=this.display._getElement(`tvc_filter_${e}`),t.removeEventListener("click",this.handleSelection)}this.selectElement.style.display=t?"block":"none"}}class Hp extends vo{constructor(t,e,i,n,s,r=!0,a=!0){super(),this.coneLength=t,this.point1=e,this.point2=i,this.linewidth=n,this.color=s,this.arrowStart=r,this.arrowEnd=a,this.type="DistanceLineArrow",this.lineVec=void 0,this.initialize()}initialize(){const t=this.coneLength;let e,i;this.lineVec=this.point1.clone().sub(this.point2.clone()).normalize(),e=this.arrowStart?this.point1.clone().sub(this.lineVec.clone().multiplyScalar(t/2)):this.point1.clone(),i=this.arrowEnd?this.point2.clone().sub(this.lineVec.clone().multiplyScalar(-t/2)):this.point2.clone();const n=new hp({linewidth:this.linewidth,color:this.color}),s=new cp;s.setPositions([...e.toArray(),...i.toArray()]);const r=new Ap(s,n),a=new Nc(t/4,t,10),o=new Ln({color:this.color}),l=new us(a,o),c=new us(a,o);l.name="startCone",c.name="endCone";const h=new Ni,d=new si;h.lookAt(this.point1,this.point2,l.up),d.setFromRotationMatrix(h),l.setRotationFromQuaternion(d),h.lookAt(this.point2,this.point1,c.up),d.setFromRotationMatrix(h),c.setRotationFromQuaternion(d),l.rotateX(90*Math.PI/180),c.rotateX(90*Math.PI/180),l.position.copy(e),c.position.copy(i),this.arrowStart&&this.add(l),this.arrowEnd&&this.add(c),this.add(r)}update(t){const e=this.point1.clone().sub(this.lineVec.clone().multiplyScalar(t*this.coneLength/2)),i=this.point2.clone().sub(this.lineVec.clone().multiplyScalar(-t*this.coneLength/2));if(this.children.find((t=>"LineSegments2"==t.type)).geometry.setPositions([...e.toArray(),...i.toArray()]),this.arrowStart){const i=this.children.find((t=>"Mesh"==t.type&&"startCone"==t.name));i.position.copy(e),i.scale.set(t,t,t)}if(this.arrowEnd){const e=this.children.find((t=>"Mesh"==t.type&&"endCone"==t.name));e.position.copy(i),e.scale.set(t,t,t)}}}class Vp{constructor(t,e){this.selectedShapes=[],this.point1=null,this.point2=null,this.contextEnabled=!1,this.viewer=t,this.scene=new Lo,this.panel=e,this.panelCenter=null,this.responseData=null,this.measurementLineColor=0,this.connectingLineColor=8388736,this.coneLength=void 0,this.panelDragData={x:null,y:null,clicked:!1},this.panel.registerCallback("mousedown",(t=>{this.panelDragData.clicked=!0,this.panelDragData.x=t.clientX,this.panelDragData.y=t.clientY,t.stopPropagation()})),document.addEventListener("mouseup",(t=>{this.panelDragData.clicked=!1,t.stopPropagation()})),document.addEventListener("mousemove",this._dragPanel)}enableContext(){this.contextEnabled=!0,this.panelCenter=new ri(1,0,0)}disableContext(){this.contextEnabled=!1,this.selectedShapes=[],this._hideMeasurement(),this.viewer.checkChanges({selectedShapeIDs:[]})}_hideMeasurement(){this.responseData=null,this.panel.show(!1),this.scene.clear()}handleResponse(t){this.viewer.info.addHtml(t.center_info)}_setMeasurementVals(){throw new Error("Subclass needs to override this method")}_makeLines(){throw new Error("Subclass needs to override this method")}_getMaxObjSelected(){throw new Error("Subclass needs to override this method")}_waitResponse(t,e){this.responseData?t(this.responseData):setTimeout((()=>{this._waitResponse(t,e)}),100)}_updateMeasurement(){const t=this.selectedShapes.map((t=>{if(t.fromSolid){return t.obj.name.replace(/\|faces.*$/,"").replace(/\|edges.*$/,"").replace(/\|vertices.*$/,"").replaceAll("|","/")}return t.obj.name.replaceAll("|","/")}));if(this.viewer.checkChanges({selectedShapeIDs:[...t]}),this.selectedShapes.length==this._getMaxObjSelected()){new Promise(((t,e)=>{this._waitResponse(t,e)})).then((t=>{this._setMeasurementVals(),this._makeLines(),this.panel.show(!0),this._movePanel()}))}else this._hideMeasurement()}_computePanelCenter(){const t=this.viewer.camera.getCamera(),e=new ri,i=new ri,n=new ri;t.getWorldDirection(e),e.multiplyScalar(-1),Math.abs(e.dot(t.up))>=.99?i.crossVectors(new ri(1,0,0),e).normalize():i.crossVectors(t.up,e).normalize(),n.crossVectors(e,i).normalize();const s=this.viewer.bbox.boundingSphere().radius;this.panelCenter=this.viewer.bbox.boundingSphere().center.add(i.multiplyScalar(s))}handleSelection=t=>{this._hideMeasurement(),this.selectedShapes.length==this._getMaxObjSelected()&&this.removeLastSelectedObj(),void 0!==this.selectedShapes.find((e=>e.obj.name===t.obj.name))?this.selectedShapes.splice(this.selectedShapes.indexOf(t),1):this.selectedShapes.push(t),this._updateMeasurement()};_movePanel=()=>{var t=this.panelCenter.clone().project(this.viewer.camera.getCamera());t.x=Math.round((1+t.x)*this.viewer.renderer.domElement.offsetWidth/2),t.y=Math.round((1-t.y)*this.viewer.renderer.domElement.offsetHeight/2);const e=window.getComputedStyle(this.panel.html),i=t.x-parseFloat(e.width)/2,n=t.y-parseFloat(e.height)/2;this.panel.relocate(i,n)};_dragPanel=t=>{if(!this.panelDragData.clicked)return;const e=this.viewer.camera.getCamera();let i=t.clientX-this.panelDragData.x,n=t.clientY-this.panelDragData.y;const s=this.viewer.renderer.domElement.offsetWidth,r=this.viewer.renderer.domElement.offsetHeight,a=.5*s/document.documentElement.clientWidth,o=.5*r/document.documentElement.clientHeight;i/=document.documentElement.clientWidth,n/=document.documentElement.clientHeight,i/=a,n/=o;const l=this.panelCenter.clone().project(e),c=new ri(i,-n,0);l.add(c),l.unproject(e),this.panelCenter=l,this.scene.clear(),this._updateMeasurement(),this.panelDragData.x=t.clientX,this.panelDragData.y=t.clientY};removeLastSelectedObj(){const t=this.selectedShapes.pop();if(t){let e=t.objs();for(let t of e)t.clearHighlights()}this._updateMeasurement()}_adjustArrowsScaleFactor(t){const e=1/t;for(let t of this.scene.children)t.update(e)}update(){const t=this.viewer.camera.getCamera(),e=this.viewer.camera.getZoom();this.coneLength=this.viewer.bb_radius/15,this._adjustArrowsScaleFactor(e),this.viewer.renderer.clearDepth(),this.viewer.renderer.render(this.scene,t),this._movePanel()}}class Gp extends Vp{constructor(t){super(t,new Op(t.display)),this.point1=null,this.point2=null}_setMeasurementVals(){this._getPoints();const t=this.responseData.distance,e=this.point2.clone().sub(this.point1),i=Math.abs(e.x),n=Math.abs(e.y),s=Math.abs(e.z);this.panel.total=t.toFixed(2),this.panel.x_distance=i.toFixed(2),this.panel.y_distance=n.toFixed(2),this.panel.z_distance=s.toFixed(2)}_getMaxObjSelected(){return 2}_getPoints(){this.point1=new ri(...this.responseData.point1),this.point2=new ri(...this.responseData.point2)}_makeLines(){const t=new Hp(this.coneLength,this.point1,this.point2,3,this.measurementLineColor);this.scene.add(t);const e=(new ri).addVectors(this.point1,this.point2).multiplyScalar(.5),i=new Hp(this.coneLength,this.panelCenter,e,1.5,this.connectingLineColor,!1);this.scene.add(i)}handleResponse(t){super.handleResponse(t);const e={distance:t.distance,point1:new ri(...t.point1),point2:new ri(...t.point2)};this.responseData=e}}class jp extends Vp{constructor(t){super(t,new Bp(t.display))}_setMeasurementVals(){const t=this.selectedShapes[0].obj,e=t.name.match(/.*\|.*vertices/),i=t.name.match(/.*\|.*edges/),n=t.name.match(/.*\|.*faces/),s=this.selectedShapes[0].fromSolid?"Solid":e?"Vertex":i?"Edge":n?"Face":"Unknown";this.panel.subheader=s;const r=this.responseData;this.panel.setProperties(r)}_getMaxObjSelected(){return 1}_makeLines(){const t=this.responseData.center,e=new Hp(this.coneLength,this.panelCenter,t,1.5,this.connectingLineColor,!1);this.scene.add(e)}handleResponse(t){super.handleResponse(t);let e={...t};e.center=new ri(...t.center),this.responseData=e}}class Wp extends Vp{constructor(t){super(t,new Fp(t.display))}_setMeasurementVals(){let t;t=this.responseData.angle.toFixed(2)+" °",this.panel.angle=t}enableContext(){super.enableContext(),this.viewer.raycaster.filters.geomFilter=[Rp,kp,Pp],this.viewer.info.addHtml("When in angle measurement<br>context you cannot pick :<br>- Non planar faces<br>- Curved edges<br>- Solids")}disableContext(){super.disableContext(),this.viewer.raycaster.filters.geomFilter=[Lp]}_getMaxObjSelected(){return 2}_getPoints(){this.point1=new ri(...this.responseData.point1),this.point2=new ri(...this.responseData.point2)}_makeLines(){this._getPoints();const t=new Hp(this.coneLength,this.point1,this.panelCenter,1.5,this.connectingLineColor,!0,!1),e=new Hp(this.coneLength,this.point2,this.panelCenter,1.5,this.connectingLineColor,!0,!1);this.scene.add(t),this.scene.add(e)}handleResponse(t){super.handleResponse(t);const e={angle:t.angle,point1:new ri(...t.point1),point2:new ri(...t.point2)};this.responseData=e}}const qp="None",Xp="DistanceMeasurement",Zp="PropertiesMeasurement",Yp="AngleMeasurement";class Jp{constructor(t){this.viewer=t,this.distanceMeasurement=new Gp(t),this.propertiesMeasurement=new jp(t),this.angleMeasurement=new Wp(t),this.enabledTool=null}enable(t){switch(this.enabledTool&&(this.viewer.display.shapeFilterDropDownMenu.reset(),this._disable()),t){case Xp:this.distanceMeasurement.enableContext();break;case Zp:this.propertiesMeasurement.enableContext();break;case Yp:this.angleMeasurement.enableContext();break;default:throw new Error(`Unknown tool type: ${t}`)}this.enabledTool=t}_disable(){if(this.enabledTool){switch(this.enabledTool){case Xp:this.distanceMeasurement.disableContext();break;case Zp:this.propertiesMeasurement.disableContext();break;case Yp:this.angleMeasurement.disableContext();break;default:throw new Error(`Unknown tool type: ${this.enabledTool}`)}this.enabledTool=null}}handleRemoveLastSelection(){this.distanceMeasurement.contextEnabled?this.distanceMeasurement.removeLastSelectedObj():this.propertiesMeasurement.contextEnabled?this.propertiesMeasurement.removeLastSelectedObj():this.angleMeasurement.contextEnabled&&this.angleMeasurement.removeLastSelectedObj()}handleSelectedObj(t){this.distanceMeasurement.contextEnabled?this.distanceMeasurement.handleSelection(t):this.propertiesMeasurement.contextEnabled?this.propertiesMeasurement.handleSelection(t):this.angleMeasurement.contextEnabled&&this.angleMeasurement.handleSelection(t)}handleResetSelection(){this.distanceMeasurement.contextEnabled?(this.distanceMeasurement.removeLastSelectedObj(),this.distanceMeasurement.removeLastSelectedObj()):this.propertiesMeasurement.contextEnabled?this.propertiesMeasurement.removeLastSelectedObj():this.angleMeasurement.contextEnabled&&(this.angleMeasurement.removeLastSelectedObj(),this.angleMeasurement.removeLastSelectedObj())}handleResponse(t){console.log(t);switch(t.tool_type){case Xp:this.distanceMeasurement.handleResponse(t);break;case Zp:this.propertiesMeasurement.handleResponse(t);break;case Yp:this.angleMeasurement.handleResponse(t)}}update(){this.distanceMeasurement.contextEnabled?this.distanceMeasurement.update():this.propertiesMeasurement.contextEnabled?this.propertiesMeasurement.update():this.angleMeasurement.contextEnabled&&this.angleMeasurement.update()}}function Kp(t){return`${t}px`}const $p=["plane","play","pause","stop"];class Qp{constructor(t,e){this.container=t,this.container.innerHTML=function(t){const e=ep.getshortcuts("shift"),i=ep.getshortcuts("ctrl"),n=ep.getshortcuts("meta");return'<div class="tcv_cad_viewer">\n <div class="tcv_cad_toolbar tcv_round">\n \x3c!-- \n <div class="tcv_grid-dropdown">\n <input class=\'tcv_grid tcv_check\' id=\'tcv_grid_{{id}}\' type="checkbox" />\n <label for=\'tcv_grid_{{id}}\' 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_{{id}}\' type="checkbox">\n <label for=\'tcv_grid-xy_{{id}}\' 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_{{id}}\' type="checkbox">\n <label for=\'tcv_grid-xz_{{id}}\' 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_{{id}}\' type="checkbox">\n <label for=\'tcv_grid-yz_{{id}}\' class="tcv_label tcv_dropdown-entry">yz</label>\n </div>\n </div>\n </div>\n\n <div class="tcv_more-dropdown">\n <button class="tcv_more-btn">More<span class="tcv_more_icon">\\u25BC</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_{{id}}\'\n type="checkbox" />\n <label for=\'tcv_transparent_{{id}}\' 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_{{id}}\'\n type="checkbox" />\n <label for=\'tcv_black_edges_{{id}}\' class="tcv_label tcv_dropdown-entry">Black edges</label>\n </span class="tcv_more_check">\n <span class="tcv_more_check" class="tcv_tools_widget tcv_tooltip" data-tooltip="Tools">\n <input class=\'tcv_tools tcv_check tcv_dropdown-entry\' id=\'tcv_tools_{{id}}\' type="checkbox" />\n <label for=\'tcv_tools_{{id}}\' class="tcv_label tcv_dropdown-entry">CAD Tools</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_{{id}}\' type="checkbox" />\n <label for=\'tcv_explode_{{id}}\' class="tcv_label tcv_dropdown-entry">Explode</label>\n </span class="tcv_more_check">\n </span>\n </div>\n --\x3e\n \x3c!-- <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> --\x3e\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 <input class=\'tcv_tab_material tcv_tab tcv_tab-right tcv_tab-unselected\' value="Material"\n type="button" />\n </div>\n <div class="tcv_cad_tree_toggles">\n <span class="tcv_tooltip" data-tooltip="Collpase nodes with a single leaf">\n <input class=\'tcv_collapse_singles tcv_btn tcv_small_btn\' value="1" type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Expand root node only">\n <input class=\'tcv_expand_root tcv_btn tcv_small_btn\' value="R" type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Collpase tree">\n <input class=\'tcv_collapse_all tcv_btn tcv_small_btn\' value="C" type="button" />\n </span>\n <span class="tcv_tooltip" data-tooltip="Expand tree">\n <input class=\'tcv_expand tcv_btn tcv_small_btn\' value="E" type="button" />\n </span>\n </div>\n <div class="tcv_box_content tcv_mac-scrollbar tcv_scroller">\n <div class="tcv_cad_tree_container"></div>\n <div class="tcv_cad_clip_container">\n <div class="tcv_slider_group">\n <div>\n <span class="tcv_tooltip" data-tooltip="Set red clipping plane to view direction">\n <input class=\'tcv_btn_norm_plane1 tcv_btn tcv_plane\' type="button" />\n </span>\n <span class="tcv_lbl_norm_plane1 tcv_label">N1 = (n/a, n/a, n/a)</span>\n </div>\n <div>\n <input type="range" min="1" max="100" value="50"\n class="tcv_sld_value_plane1 tcv_clip_slider">\n <input value=50 class="tcv_inp_value_plane1 tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_slider_group">\n <div>\n <span class="tooltip" data-tooltip="Set green clipping plane to view direction">\n <input class=\'tcv_btn_norm_plane2 tcv_btn tcv_plane\' type="button" />\n </span>\n <span class="tcv_lbl_norm_plane2 tcv_label">N2 = (n/a, n/a, n/a)</span>\n </div>\n <div>\n <input type="range" min="1" max="100" value="50"\n class="tcv_sld_value_plane2 tcv_clip_slider">\n <input value=50 class="tcv_inp_value_plane2 tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_slider_group">\n <div>\n <span class="tooltip" data-tooltip="Set blue clipping plane to view direction">\n <input class=\'tcv_btn_norm_plane3 tcv_btn tcv_plane\' type="button" />\n </span>\n <span class="tcv_lbl_norm_plane3 tcv_label">N3 = (n/a, n/a, n/a)</span>\n </div>\n <div>\n <input type="range" min="1" max="100" value="50"\n class="tcv_sld_value_plane3 tcv_clip_slider">\n <input value=50 class="tcv_inp_value_plane3 tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_clip_checks">\n <div>\n <span class="tcv_tooltip" data-tooltip="Use intersection clipping">\n <input class=\'tcv_clip_intersection tcv_check\' type="checkbox" />\n <span class="tcv_label">Intersection</span>\n </span>\n <span class="tcv_tooltip" data-tooltip="Show clipping planes">\n <input class=\'tcv_clip_plane_helpers tcv_axes0 tcv_check\' type="checkbox" />\n <span class="tcv_label">Planes</span>\n </span>\n </div>\n <span class="tcv_tooltip" data-tooltip="Use object color caps instead of RGB">\n <input class=\'tcv_clip_caps tcv_axes0 tcv_check\' type="checkbox" />\n <span class="tcv_label">Use object color caps</span>\n </span>\n </div>\n </div>\n <div class="tcv_cad_material_container">\n <div class="tcv_cad_tree_toggles">\n <span class="tcv_tooltip" data-tooltip="Reset to original values">\n <input class=\'tcv_material_reset tcv_btn tcv_small_btn\' value="R" type="button" />\n </span>\n </div>\n <div class="tcv_material_ambientlight tcv_label">\n Ambient light intensity (%)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="20" value="1"\n class="tcv_sld_value_ambientlight tcv_clip_slider">\n <input value=1 class="tcv_inp_value_ambientlight tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_pointlight tcv_label">\n Directional light intensity (%)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="40" value="1"\n class="tcv_sld_value_pointlight tcv_clip_slider">\n <input value=1 class="tcv_inp_value_pointlight tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_metalness tcv_label">\n Metalness (%)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="100" value="40"\n class="tcv_sld_value_metalness tcv_clip_slider">\n <input value=40 class="tcv_inp_value_metalness tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_roughness tcv_label">\n Roughness (%)\n </div>\n <div class="tcv_slider_group">\n <div>\n <input type="range" min="0" max="100" value="40"\n class="tcv_sld_value_roughness tcv_clip_slider">\n <input value=40 class="tcv_inp_value_roughness tcv_clip_input"></input>\n </div>\n </div>\n <div class="tcv_material_info">\n This is not a full material renderer (e.g. the environment is black), so\n not every combination creates expected or good results.\n </div>\n </div>\n </div>\n </div>\n <div class="tcv_cad_info_wrapper">\n <div class="tcv_toggle_info_wrapper">\n <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_distance_measurement_panel tcv_panel tcv_round">\n <div class="tcv_measure_header">Distance</div>\n <table class="tcv_properties_table">\n <tr class="tcv_measure_row_line">\n <td class="tcv_measure_cell tcv_measure_cell_header">Total</td>\n <td class="tcv_measure_cell tcv_measure_val tcv_total">total</td>\n </tr>\n <tr class="tcv_measure_row_line">\n <td class="tcv_measure_cell tcv_measure_cell_header tcv_xtitle">X</td>\n <td class="tcv_measure_cell tcv_measure_val tcv_x">x</td>\n </tr>\n <tr class="tcv_measure_row_line">\n <td class="tcv_measure_cell tcv_measure_cell_header tcv_ytitle">Y</td>\n <td class="tcv_measure_cell tcv_measure_val tcv_y">y</td>\n </tr>\n <tr>\n <td class="tcv_measure_cell tcv_measure_cell_header tcv_bottom_cell_left tcv_ztitle">Z</td>\n <td class="tcv_measure_cell tcv_measure_val bottom_cell_right tcv_z">z</td>\n </tr>\n </table>\n </div>\n\n <div class="tcv_properties_measurement_panel tcv_panel tcv_round">\n <div class="tcv_measure_header">Properties</div>\n <div class="tcv_measure_subheader">Shape</div>\n <table class="tcv_properties_table">\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Volume</th>\n <td class="tcv_props_cell tcv_measure_val tcv_volume" colspan="3">volume</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Area</th>\n <td class="tcv_props_cell tcv_measure_val tcv_area" colspan="3">area</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Length</th>\n <td class="tcv_props_cell tcv_measure_val tcv_length" colspan="3">length</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Width</th>\n <td class="tcv_props_cell tcv_measure_val tcv_width" colspan="3">w</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Geom</th>\n <td class="tcv_props_cell tcv_measure_val tcv_geom_type" colspan="3">g</td>\n </tr>\n <tr class="tcv_properties_row_line">\n <th class="tcv_props_cell tcv_props_header" colspan="3">Radius</th>\n <td class="tcv_props_cell tcv_measure_val tcv_radius" colspan="3">r</td>\n </tr>\n <tr class="tcv_properties_row_line vertex_row tcv_vertex_coords_title_row">\n <td class="tcv_vertex_cell tcv_xtitle" colspan="2">X</td>\n <td class="tcv_vertex_cell tcv_ytitle" colspan="2">Y</td>\n <td class="tcv_vertex_cell tcv_ztitle" colspan="2">Z</td>\n </tr>\n <tr class="tcv_properties_row_line vertex_row tcv_vertex_coords_row">\n <td class="tcv_vertex_cell tcv_x_value" colspan="2">X</td>\n <td class="tcv_vertex_cell tcv_y_value" colspan="2">Y</td>\n <td class="tcv_vertex_cell tcv_z_value" colspan="2">Z</td>\n </tr>\n </table>\n </div>\n\n <div class="tcv_angle_measurement_panel tcv_panel tcv_round">\n <div class="tcv_measure_header">Angle</div>\n <table class="tcv_properties_table">\n <tr class="tcv_properties_row_line">\n <td class="tcv_angle tcv_measure_val">angle</td>\n </tr>\n </table>\n </div>\n\n <div class="tcv_cad_animation tcv_round">\n <span class="tcv_animation_label">E</span>\n <span><input type="range" min="0" max="1000" value="0"\n class="tcv_animation_slider tcv_clip_slider"></span>\n <span class="tcv_tooltip" data-tooltip="Play animation"><input class=\'tcv_play tcv_btn\'\n type="button" /></span>\n <span class="tcv_tooltip" data-tooltip="Pause animation"><input class=\'tcv_pause tcv_btn\'\n type="button" /></span>\n <span class="tcv_tooltip" data-tooltip="Stop and reset animation"><input class=\'tcv_stop tcv_btn\'\n type="button" /></span>\n </div>\n\n <div class="tcv_cad_help tcv_round">\n <table class="tcv_cad_help_layout">\n <tr>\n <td></td>\n <td><b>Mouse Navigation</b></td>\n </tr>\n <tr>\n <td>Rotate</td>\n <td><left mouse button></td>\n </tr>\n <tr>\n <td>Rotate up / down</td>\n <td><{{ctrl}}> + <left mouse button></td>\n </tr>\n <tr>\n <td>Rotate left / right</td>\n <td><{{meta}}> + <left mouse button></td>\n </tr>\n <tr>\n <td>Pan</td>\n <td><{{shift}}> + <left mouse button> or <right mouse button></td>\n </tr>\n <tr>\n <td>Zoom</td>\n <td><mouse wheel> or <middle mouse button></td>\n </tr>\n\n <tr>\n <td></td>\n <td><b>Mouse Selection</b></td>\n </tr>\n <tr>\n <td>Pick element</td>\n <td><left mouse button> double click</td>\n </tr>\n <tr>\n <td></td>\n <td>Click on navigation tree label</td>\n </tr>\n <tr>\n <td></td>\n <td>(Shows axis-aligned bounding box, AABB)</td>\n </tr>\n <tr>\n <td>Hide element</td>\n <td><{{meta}}> + <left mouse button> double click</td>\n </tr>\n <tr>\n <td></td>\n <td><{{meta}}> + click on navigation tree label</td>\n </tr>\n <tr>\n <td>Isolate element</td>\n <td><{{shift}}> + <left mouse button> double click</td>\n </tr>\n <tr>\n <td></td>\n <td><{{shift}}> + click on navigation tree label</td>\n </tr>\n <tr>\n <td></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 class="tcv_filter_menu">\n <div class="tcv_drop_down tcv_shape_filter">\n <span class="tcv_round tcv_filter_content"><span class="tcv_filter_value">None</span>\n <span class="tcv_filter_icon">⏶\n </span></span>\n <div class="tcv_filter_dropdown tcv_round">\n <div class="tcv_filter_dropdown_value tvc_filter_none">None</div>\n <div class="tcv_filter_dropdown_value tvc_filter_vertex">Vertex</div>\n <div class="tcv_filter_dropdown_value tvc_filter_edge">Edge</div>\n <div class="tcv_filter_dropdown_value tvc_filter_face">Face</div>\n <div class="tcv_filter_dropdown_value tvc_filter_solid">Solid</div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</div>'.replaceAll("{{id}}",t).replaceAll("{{shift}}",e).replaceAll("{{ctrl}}",i).replaceAll("{{meta}}",n)}(this.container.id),this.cadBody=this._getElement("tcv_cad_body"),this.cadTool=new np(this._getElement("tcv_cad_toolbar"),t.id),this.cadView=this._getElement("tcv_cad_view"),this.distanceMeasurementPanel=this._getElement("tcv_distance_measurement_panel"),this.propertiesMeasurementPanel=this._getElement("tcv_properties_measurement_panel"),this.angleMeasurementPanel=this._getElement("tcv_angle_measurement_panel"),this.cadTree=this._getElement("tcv_cad_tree_container"),this.cadTreeToggles=this._getElement("tcv_cad_tree_toggles"),this.cadClip=this._getElement("tcv_cad_clip_container"),this.cadMaterial=this._getElement("tcv_cad_material_container"),this.tabTree=this._getElement("tcv_tab_tree"),this.tabClip=this._getElement("tcv_tab_clip"),this.tabMaterial=this._getElement("tcv_tab_material"),this.cadInfo=this._getElement("tcv_cad_info_container"),this.cadAnim=this._getElement("tcv_cad_animation"),this.cadTools=this._getElement("tcv_cad_tools"),this.cadHelp=this._getElement("tcv_cad_help"),this.planeLabels=[];for(var i=1;i<4;i++)this.planeLabels.push(this._getElement(`tcv_lbl_norm_plane${i}`));var n;for(var s of(this.viewer=null,this.glass=e.glass,this.tools=e.tools,this.cadWidth=e.cadWidth,this.height=e.height,this.treeWidth=e.treeWidth,this._events=[],this.setSizes(e),this.activeTab="tree",this.cadTree.style.display="block",this.cadClip.style.display="none",this.cadMaterial.style.display="none",this.clipSliders=null,this.explodeFlag=!1,this.currentButton=null,this.lastPlaneState=!1,"dark"===e.theme||"browser"==e.theme&&window.matchMedia("(prefers-color-scheme: dark)").matches?(document.documentElement.setAttribute("data-theme","dark"),n="dark"):(document.documentElement.setAttribute("data-theme","light"),n="light"),$p)){var r=this.container.getElementsByClassName(`tcv_${s}`);for(i=0;i<r.length;i++){r[i].setAttribute("style",`background-image: ${Yu(n,s)}`)}}this.toolbarButtons={},this.toolbarButtons.axes=new ap(n,"axes","Show axes",this.setAxes),this.cadTool.addButton(this.toolbarButtons.axes),this.toolbarButtons.axes0=new ap(n,"axes0","Show axes at origin (0,0,0)",this.setAxes0),this.cadTool.addButton(this.toolbarButtons.axes0),this.toolbarButtons.grid=new ap(n,"grid","Show grid",this.setGrid,null,["xy","xz","yz"]),this.cadTool.addButton(this.toolbarButtons.grid),this.cadTool.addSeparator(),this.toolbarButtons.perspective=new ap(n,"perspective","Use perspective camera",this.setOrtho),this.cadTool.addButton(this.toolbarButtons.perspective),this.toolbarButtons.transparent=new ap(n,"transparent","Show transparent faces",this.setTransparent),this.cadTool.addButton(this.toolbarButtons.transparent),this.toolbarButtons.blackedges=new ap(n,"blackedges","Show black edges",this.setBlackEdges),this.cadTool.addButton(this.toolbarButtons.blackedges),this.cadTool.addSeparator(),this.toolbarButtons.reset=new rp(n,"reset","Reset view",this.reset),this.cadTool.addButton(this.toolbarButtons.reset),this.toolbarButtons.resize=new rp(n,"resize","Resize object",this.resize),this.cadTool.addButton(this.toolbarButtons.resize),this.cadTool.addSeparator(),this.toolbarButtons.iso=new rp(n,"iso","Switch to iso view",this.setView),this.cadTool.addButton(this.toolbarButtons.iso),this.toolbarButtons.front=new rp(n,"front","Switch to front view",this.setView),this.cadTool.addButton(this.toolbarButtons.front),this.toolbarButtons.rear=new rp(n,"rear","Switch to back view",this.setView),this.cadTool.addButton(this.toolbarButtons.rear),this.toolbarButtons.top=new rp(n,"top","Switch to top view",this.setView),this.cadTool.addButton(this.toolbarButtons.top),this.toolbarButtons.bottom=new rp(n,"bottom","Switch to bottom view",this.setView),this.cadTool.addButton(this.toolbarButtons.bottom),this.toolbarButtons.left=new rp(n,"left","Switch to left view",this.setView),this.cadTool.addButton(this.toolbarButtons.left),this.toolbarButtons.right=new rp(n,"right","Switch to right view",this.setView),this.cadTool.addButton(this.toolbarButtons.right),this.cadTool.addSeparator(),this.toolbarButtons.explode=new ap(n,"explode","Explode tool",this.setExplode),this.cadTool.addButton(this.toolbarButtons.explode),this.toolbarButtons.distance=new ap(n,"distance","Measure distance between shapes",this.setTool),this.cadTool.addButton(this.toolbarButtons.distance),this.toolbarButtons.properties=new ap(n,"properties","Show shape properties",this.setTool),this.cadTool.addButton(this.toolbarButtons.properties),this.toolbarButtons.angle=new ap(n,"angle","Measure angle between shapes",this.setTool),this.cadTool.addButton(this.toolbarButtons.angle),this.cadTool.defineGroup([this.toolbarButtons.explode,this.toolbarButtons.distance,this.toolbarButtons.properties,this.toolbarButtons.angle]),this.toolbarButtons.help=new rp(n,"help","Help",this.toggleHelp),this.toolbarButtons.help.alignRight(),this.cadTool.addButton(this.toolbarButtons.help),this.toolbarButtons.pin=new rp(n,"pin","Pin viewer as png",this.pinAsPng),this.toolbarButtons.pin.alignRight(),this.cadTool.addButton(this.toolbarButtons.pin),this.shapeFilterDropDownMenu=new zp(this),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){}setSizes(t,e=2/3){if(t.cadWidth&&(this.cadWidth=t.cadWidth,this.cadView.style.width=Kp(t.cadWidth)),t.height&&(this.height=t.height,this.cadView.style.height=Kp(t.height)),t.treeWidth&&(this.treeWidth=t.treeWidth,this.cadTree.parentElement.parentElement.style.width=Kp(t.treeWidth),this.cadInfo.parentElement.parentElement.style.width=Kp(t.treeWidth)),!t.glass){const i=Math.round(t.height*e);this.cadTree.parentElement.parentElement.style.height=Kp(i),this.cadInfo.parentElement.parentElement.style.height=Kp(t.height-i-4)}t.tools&&!t.glass?(this.cadTool.container.style.width=Kp(t.treeWidth+t.cadWidth+4),this.cadBody.style.width=Kp(t.treeWidth+t.cadWidth+4)):(this.cadTool.container.style.width=Kp(t.cadWidth+2),this.cadBody.style.width=Kp(t.cadWidth+2)),this.cadBody.style.height=Kp(t.height+4)}setupUI(t){this.viewer=t,this._setupClickEvent("tcv_expand_root",this.handleCollapseNodes),this._setupClickEvent("tcv_collapse_singles",this.handleCollapseNodes),this._setupClickEvent("tcv_collapse_all",this.handleCollapseNodes),this._setupClickEvent("tcv_expand",this.handleCollapseNodes),this._setupClickEvent("tcv_material_reset",this.handleMaterialReset),this._setupClickEvent("tcv_toggle_info",this.toggleInfo),this.help_shown=!0,this.info_shown=!this.glass;["tcv_tab_tree","tcv_tab_clip","tcv_tab_material"].forEach((t=>{this._setupClickEvent(t,this.selectTab)})),this.clipSliders=[];for(var e=1;e<4;e++)this.clipSliders.push(new ip(`plane${e}`,0,100,this));for(this.ambientlightSlider=new ip("ambientlight",0,400,this),this.directionallightSlider=new ip("pointlight",0,400,this),this.metalnessSlider=new ip("metalness",0,100,this),this.roughnessSlider=new ip("roughness",0,100,this),this._setupCheckEvent("tcv_clip_plane_helpers",this.setClipPlaneHelpers,!1),this._setupCheckEvent("tcv_clip_intersection",this.setClipIntersection,!1),this._setupCheckEvent("tcv_clip_caps",this.setObjectColorCaps,!1),e=1;e<4;e++)this._setupClickEvent(`tcv_btn_norm_plane${e}`,this.setClipNormalFromPosition,!1);this._setupClickEvent("tcv_play",this.controlAnimation,!1),this._setupClickEvent("tcv_pause",this.controlAnimation,!1),this._setupClickEvent("tcv_stop",this.controlAnimation,!1),this.animationSlider=this.container.getElementsByClassName("tcv_animation_slider")[0],this.animationSlider.value=0,this.animationSlider.addEventListener("input",this.animationChange),this.showAnimationControl(!1),this.showHelp(!1),this.showDistancePanel(!1),this.showPropertiesPanel(!1),this.showAnglePanel(!1)}updateUI(t,e,i,n,s,r,a){this.toolbarButtons.axes.set(t),this.toolbarButtons.axes0.set(e),this.toolbarButtons.perspective.set(!i),this.toolbarButtons.transparent.set(n),this.toolbarButtons.blackedges.set(s),this.showTools(r),this.glassMode(a)}checkElement(t,e){this._getElement(t).checked=e}addCadView(t){this.cadView.appendChild(t)}clearCadTree(){this.cadTree.innerHTML=""}addCadTree(t){this.cadTree.appendChild(t)}setAxes=(t,e)=>{this.viewer.setAxes(e)};setAxesCheck=t=>{this.toolbarButtons.axes.set(t)};setGrid=(t,e)=>{this.viewer.setGrid(t,e)};setGridCheck=t=>{this.checkElement("tcv_grid",t)};setAxes0=(t,e)=>{this.viewer.setAxes0(e)};setAxes0Check=t=>{this.toolbarButtons.axes0.set(t)};setOrtho=(t,e)=>{this.viewer.switchCamera(!e)};setOrthoCheck=t=>{this.toolbarButtons.perspective.set(!t)};setTransparent=(t,e)=>{this.viewer.setTransparent(e)};setTransparentCheck=t=>{this.toolbarButtons.transparent.set(t)};setBlackEdges=(t,e)=>{this.viewer.setBlackEdges(e)};setBlackEdgesCheck=t=>{this.toolbarButtons.blackedges.set(t)};setExplode=(t,e)=>{e&&this.explodeFlag||(e||this.explodeFlag)&&(e?(this.viewer.hasAnimation()&&this.viewer.backupAnimation(),this.viewer.explode(),this.explodeFlag=!0):(this.viewer.hasAnimation()&&(this.controlAnimationByName("stop"),this.viewer.clearAnimation(),this.viewer.restoreAnimation()),this.explodeFlag=!1))};setExplodeCheck=t=>{this.toolbarButtons.explode.set(t)};showExplode=t=>{this._getElement("tcv_explode_widget").style.display=t?"inline-block":"none"};setTool=(t,e)=>{this.viewer.toggleAnimationLoop(e),e?(this.viewer.hasAnimation()&&this.viewer.backupAnimation(),["distance","properties","angle"].includes(t)&&!["distance","properties","angle"].includes(this.currentButton)&&this.viewer.toggleGroup(!0),this.viewer.setRaycastMode(e),this.shapeFilterDropDownMenu.setRaycaster(this.viewer.raycaster),"distance"==t?(this.viewer.cadTools.enable(Xp),this.viewer.checkChanges({activeTool:Xp})):"properties"==t?(this.viewer.cadTools.enable(Zp),this.viewer.checkChanges({activeTool:Zp})):"angle"==t&&(this.viewer.cadTools.enable(Yp),this.viewer.checkChanges({activeTool:Yp})),this.currentButton=t):(this.currentButton==t&&(this.viewer.toggleGroup(!1),this.currentButton=null),this.viewer.checkChanges({activeTool:qp}),this.viewer.clearSelection(),this.viewer.hasAnimation()&&(this.controlAnimationByName("stop"),this.viewer.clearAnimation(),this.viewer.restoreAnimation()),this.viewer.setRaycastMode(e)),this.viewer.setPickHandler(!e),this.shapeFilterDropDownMenu.show(e)};setClipPlaneHelpers=t=>{const e=!!t.target.checked;this.setClipPlaneHelpersCheck(e),this.viewer.setClipPlaneHelpers(e)};setClipPlaneHelpersCheck=t=>{this.checkElement("tcv_clip_plane_helpers",t),this.lastPlaneState=t};showTools=t=>{this.tools=t,this.viewer&&(this.viewer.tools=t);var e=this._getElement("tcv_cad_toolbar"),i=this._getElement("tcv_cad_navigation");for(var n of[i,e])t?(n.style.height="38px",n.style.display="block"):(n.style.height="0px",n.style.display="none")};showMeasureTools=t=>{this.toolbarButtons.distance.show(t),this.toolbarButtons.properties.show(t),this.toolbarButtons.angle.show(t)};setClipIntersection=t=>{const e=!!t.target.checked;this.viewer.setClipIntersection(e)};setClipIntersectionCheck=t=>{this._getElement("tcv_clip_intersection").checked=t};setObjectColorCaps=t=>{const e=!!t.target.checked;this.viewer.setClipObjectColorCaps(e)};setClipObjectColorsCheck=t=>{this._getElement("tcv_clip_caps").checked=t};reset=()=>{this.viewer.reset(),this.clearHighlights()};resize=()=>{this.viewer.resize()};clearHighlights(){["front","rear","top","bottom","left","right","iso"].forEach((t=>{this.toolbarButtons[t].highlight(!1)}))}highlightButton(t){this.clearHighlights(),this.toolbarButtons[t].highlight(!0),this.viewer.keepHighlight=!0}setView=t=>{this.viewer.presetCamera(t),this.highlightButton(t),this.viewer.update(!0,!1)};showPinning(t){this.toolbarButtons.pin.show(t)}pinAsPng=t=>{this.viewer.pinAsPng()};setNormalLabel=(t,e)=>{this.planeLabels[t].innerHTML=`N=(${e[0].toFixed(2)}, ${e[1].toFixed(2)}, ${e[2].toFixed(2)})`};setClipNormalFromPosition=t=>{const e=parseInt(t.target.classList[0].slice(-1));this.viewer.setClipNormalFromPosition(e-1)};selectTab=t=>{const e=t.target.className.split(" ")[0];this.selectTabByName(e.slice(8))};setAmbientLight=t=>{this.ambientlightSlider.setValue(100*t)};setDirectLight=t=>{this.directionallightSlider.setValue(100*t)};setMetalness=t=>{this.metalnessSlider.setValue(100*t)};setRoughness=t=>{this.roughnessSlider.setValue(100*t)};handleMaterialReset=t=>{this.viewer.resetMaterial()};selectTabByName(t){if(["clip","tree","material"].includes(t)){if("tree"===t&&"tree"!==this.activeTab){this.cadTree.style.display="block",this.cadTreeToggles.style.display="block",this.cadClip.style.display="none",this.cadMaterial.style.display="none",this.viewer.nestedGroup.setBackVisible(!1),this.viewer.setLocalClipping(!1),this.viewer.clipping.setVisible(!1);var e=this.viewer.getClipPlaneHelpers();this.viewer.setClipPlaneHelpers(!1),this.lastPlaneState=e}else"clip"===t&&"clip"!==this.activeTab?(this.cadTree.style.display="none",this.cadTreeToggles.style.display="none",this.cadClip.style.display="block",this.cadMaterial.style.display="none",this.viewer.nestedGroup.setBackVisible(!0),this.viewer.setLocalClipping(!0),this.viewer.setClipIntersection(this.viewer.clipIntersection),this.viewer.setClipPlaneHelpers(this.lastPlaneState),this.viewer.clipping.setVisible(!0),this.viewer.update(!0,!1)):"material"===t&&"material"!==this.activeTab&&(this.cadTree.style.display="none",this.cadTreeToggles.style.display="none",this.cadClip.style.display="none",this.cadMaterial.style.display="block",this.viewer.nestedGroup.setBackVisible(!1),this.viewer.setLocalClipping(!1),this.viewer.setClipPlaneHelpers(!1),this.viewer.clipping.setVisible(!1));this.activeTab=t,this.viewer.checkChanges({tab:t}),"tree"==t?(this.tabTree.classList.add("tcv_tab-selected"),this.tabTree.classList.remove("tcv_tab-unselected"),this.tabClip.classList.remove("tcv_tab-selected"),this.tabClip.classList.add("tcv_tab-unselected"),this.tabMaterial.classList.remove("tcv_tab-selected"),this.tabMaterial.classList.add("tcv_tab-unselected")):"clip"==t?(this.tabTree.classList.remove("tcv_tab-selected"),this.tabTree.classList.add("tcv_tab-unselected"),this.tabClip.classList.add("tcv_tab-selected"),this.tabClip.classList.remove("tcv_tab-unselected"),this.tabMaterial.classList.remove("tcv_tab-selected"),this.tabMaterial.classList.add("tcv_tab-unselected")):(this.tabTree.classList.add("tcv_tab-unselected"),this.tabTree.classList.remove("tcv_tab-selected"),this.tabClip.classList.add("tcv_tab-unselected"),this.tabClip.classList.remove("tcv_tab-selected"),this.tabMaterial.classList.add("tcv_tab-selected"),this.tabMaterial.classList.remove("tcv_tab-unselected"))}}toggleClippingTab=t=>{t?this.tabClip.removeAttribute("disabled"):this.tabClip.setAttribute("disabled","true"),this.tabClip.classList.toggle("tcv_tab-disabled",!t)};handleCollapseNodes=t=>{this.collapseNodes(t.target.value)};collapseNodes(t){"1"===t?(this.viewer.treeview.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,t?this.container.addEventListener("keydown",(t=>{"Escape"===t.key&&this.showHelp(!1),this.container.removeEventListener("keydown",this)})):this.container.removeEventListener("keydown",this)};showDistancePanel=t=>{this.distanceMeasurementPanel.style.display=t?"block":"none"};showPropertiesPanel=t=>{this.propertiesMeasurementPanel.style.display=t?"block":"none"};showAnglePanel=t=>{this.angleMeasurementPanel.style.display=t?"block":"none"};toggleHelp=()=>{this.showHelp(!this.help_shown)};showInfo=t=>{this.cadInfo.parentNode.parentNode.style.display=t?"block":"none",this._getElement("tcv_toggle_info").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"]=Kp(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=Kp(Math.round(2*this.height/3)),this._getElement("tcv_cad_info").classList.remove("tcv_cad_info_glass"),this._getElement("tcv_cad_view").classList.remove("tcv_cad_view_glass"),this._getElement("tcv_toggle_info_wrapper").style.display="none",this.showInfo(!0),this.glass=!1),this.viewer&&(this.viewer.glass=!1);const e={cadWidth:this.cadWidth,glass:this.glass,height:this.height,tools:this.tools,treeWidth:t?0:this.treeWidth};this.setSizes(e)}updateHelp(t,e){console.log("updateHelp",t,e);const i=this._getElement("tcv_cad_help_layout");for(var n in t)i.innerHTML=i.innerHTML.replaceAll("<"+t[n].slice(0,-3)+">","<_"+e[n].slice(0,-3)+">");i.innerHTML=i.innerHTML.replaceAll("_shift","shift"),i.innerHTML=i.innerHTML.replaceAll("_ctrl","ctrl"),i.innerHTML=i.innerHTML.replaceAll("_alt","alt"),i.innerHTML=i.innerHTML.replaceAll("_meta","meta")}}class tm extends cp{toJSON(){return Od.prototype.toJSON.call(this)}}const em=new ri,im=new ri,nm=new ke;class sm extends Ql{constructor(t,e=1,i=16711680){const n=new Zn,s=t.geometry.attributes.normal.count,r=new zn(2*s*3,3);n.setAttribute("position",r),super(n,new Hl({color:i,toneMapped:!1})),this.object=t,this.size=e,this.type="VertexNormalsHelper",this.matrixAutoUpdate=!1,this.update()}update(){this.object.updateMatrixWorld(!0),nm.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++)em.fromBufferAttribute(n,i).applyMatrix4(t),im.fromBufferAttribute(s,i),im.applyMatrix3(nm).normalize().multiplyScalar(this.size).add(em),e.setXYZ(r,em.x,em.y,em.z),r+=1,e.setXYZ(r,im.x,im.y,im.z),r+=1}e.needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}class rm extends li{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(),lm.copy(n.boundingBox),this.union(lm)}else{const e=i.attributes.position;for(let i=0,n=e.count;i<n;i++)om.fromBufferAttribute(e,i).applyMatrix4(t.matrixWorld),this.expandByPoint(om)}else null===i.boundingBox&&i.computeBoundingBox(),lm.copy(i.boundingBox),lm.applyMatrix4(t.matrixWorld),this.union(lm);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(hm),hm}center(){return this.getCenter(om),om.toArray()}}class am extends Ql{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 Zn;s.setIndex(new On(i,1)),s.setAttribute("position",new On(n,3)),super(s,new Hl({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(void 0!==this.object&&cm.setFromObject(this.object,!0),cm.isEmpty())return;const t=cm.min,e=cm.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 om=new ri,lm=new rm,cm=new rm,hm=new Ti;class dm extends vo{constructor(t,e,i,n,s,r){super(),this.opacity=t,this.alpha=null==e?1:e,this.edge_color=i,this.shapeInfo=n,this.subtype=s,this.renderback=r,this.types={front:null,back:null,edges:null,vertices:null},this.isSelected=!1,this.originalColor=null,this.originalWidth=null,this.vertexFocusSize=8,this.edgeFocusWidth=5}addType(t,e){this.add(t),this.types[e]=t,this.types.vertices?(this.originalColor=this.types.vertices.material.color.clone(),this.originalWidth=this.types.vertices.material.size):this.types.edges&&!this.types.front?(this.originalColor=this.types.edges.material.color.clone(),this.originalWidth=this.types.edges.material.linewidth):this.types.front&&(this.originalColor=this.types.front.material.color.clone())}widen(t){this.types.vertices?this.types.vertices.material.size=t?this.vertexFocusSize:this.isSelected?this.vertexFocusSize-2:this.originalWidth:this.types.edges&&(this.types.edges.material.linewidth=t?this.edgeFocusWidth:this.isSelected?this.edgeFocusWidth-2:this.originalWidth)}toggleSelection(){const t=!this.isSelected;this.isSelected=t,this.highlight(t),this.widen(!1)}unhighlight(t){t&&this.isSelected||(this.isSelected=!1,this.highlight(!1)),this.widen(!1)}highlight(t){var e=null,i=null,n=null;this.types.front?(e=this.types.front,i=this.isSelected?new En(5480675):new En(9026019),n=this.originalColor):this.types.vertices?(e=this.types.vertices,i=this.isSelected?new En(5480675):new En(9026019),n=this.originalColor):this.types.edges&&(e=this.types.edges,i=this.isSelected?new En(5480675):new En(9026019),n=this.originalColor),null!=e&&(this.widen(t),e.material.color=t?i:n,e.material.needsUpdate=!0)}clearHighlights(){this.highlight(!1),this.isSelected=!1,this.widen(!1)}metrics(){return this.types.front?{name:"face",value:0}:this.types.vertices?{name:"vertex",value:0}:this.types.edges?{name:"edge",value:0}:void 0}setMetalness(t){for(var e of this.children)e.name.startsWith("clipping")||(e.material.metalness=t,e.material.needsUpdate=!0)}setRoughness(t){for(var e of this.children)e.name.startsWith("clipping")||(e.material.roughness=t,e.material.needsUpdate=!0)}setTransparent(t){for(var e of(this.types.back&&(this.types.back.material.opacity=t?this.opacity*this.alpha:this.alpha,this.types.front.material.opacity=t?this.opacity*this.alpha:this.alpha),this.children))e.name.startsWith("clipping")||(e.material.depthWrite=!(this.alpha<1)&&!t,e.material.depthTest=!0,e.material.needsUpdate=!0)}setBlackEdges(t){if(this.types.edges){const e=t?0:this.edge_color;this.originalColor=new En(e),this.types.edges.material.color=new En(e),this.types.edges.material.needsUpdate=!0}}setEdgeColor(t){this.types.edges&&(this.edge_color=t,this.types.edges.material.color=new En(t),this.types.edges.material.needsUpdate=!0)}setOpacity(t){(this.types.front||this.types.back)&&(this.opacity=t,this.types.back.material.opacity=this.opacity,this.types.front.material.opacity=this.opacity,this.types.back.material.needsUpdate=!0,this.types.front.material.needsUpdate=!0)}setShapeVisible(t){for(var e of(this.types.front&&(this.types.front.material.visible=t),["clipping-0","clipping-1","clipping-2"]))this.types[e]&&(this.types[e].children[0].material.visible=t,this.types[e].children[1].material.visible=t);this.types.back&&this.renderback&&(this.types.back.material.visible=t)}setEdgesVisible(t){this.types.edges&&(this.types.edges.material.visible=t),this.types.vertices&&(this.types.vertices.material.visible=t)}setBackVisible(t){this.types.back&&this.types.front.material.visible&&(this.types.back.material.visible=this.renderback||t)}setClipIntersection(t){for(var e of this.children)e.name.startsWith("clipping")||(e.material.clipIntersection=t,e.material.clipIntersection=t,e.material.clipIntersection=t)}setClipPlanes(t){this.types.back&&(this.types.back.material.clippingPlanes=t),this.types.front&&(this.types.front.material.clippingPlanes=t),this.types.edges&&(this.types.edges.material.clippingPlanes=t),this.types.vertices&&(this.types.vertices.material.clippingPlanes=t),this.updateMaterials(!0)}setPolygonOffset(t){this.types.back&&(this.types.back.material.polygonOffsetUnits=t)}updateMaterials(t){this.types.back&&(this.types.back.material.needsUpdate=t),this.types.front&&(this.types.front.material.needsUpdate=t),this.types.edges&&(this.types.edges.material.needsUpdate=t),this.types.vertices&&(this.types.vertices.material.needsUpdate=t)}}class um{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(Ku(t,3));const r=new tm;r.setPositions(s);const a=new hp({linewidth:e,transparent:!0,depthWrite:!this.transparent,depthTest:!this.transparent,clipIntersection:!1});if(Array.isArray(i)){var o=i.map((t=>[new En(t).toArray(),new En(t).toArray()])).flat(2);r.setColors(o),a.vertexColors="VertexColors"}else a.color=new En(null==i?this.edgeColor:i);a.visible=1==n,a.resolution.set(this.width,this.height);var l=new Ap(r,a);return l.renderOrder=999,l}renderEdges(t,e,i,n,s,r,a=null){var o=new dm(this.defaultOpacity,1,null==i?this.edgeColor:i,a,"edges"),l=this._renderEdges(t.edges?t.edges:Ku(t),e,i,r);return s&&(l.name=s),o.addType(l,"edges"),n=n+this.delim+s,this.groups[n.replaceAll(this.delim,"/")]=o,o.name=n,o}renderVertices(t,e,i,n,s,r,a=null){var o=new dm(this.defaultOpacity,1,null==i?this.edgeColor:i,a,"vertices");const l=null==i?this.edgeColor:i;let c;c=t.obj_vertices?t.obj_vertices instanceof Float32Array?t.obj_vertices:new Float32Array(t.obj_vertices):t instanceof Float32Array?t:new Float32Array(Ku(t));const h=new Zn;h.setAttribute("position",new zn(c,3));const d=new ec({color:l,sizeAttenuation:!1,size:e,transparent:!0,clipIntersection:!1,visible:1==r});var u=new ac(h,d);return s&&(u.name=s),o.addType(u,"vertices"),n=n+this.delim+s,this.groups[n.replaceAll(this.delim,"/")]=o,o.name=n,o}renderShape(t,e,i,n,s,r,a,c=null,h=null,d=null,u=null,p=null){const m=t.vertices instanceof Float32Array?t.vertices:new Float32Array(Ku(t.vertices)),f=t.normals instanceof Float32Array?t.normals:new Float32Array(Ku(t.normals)),g=t.triangles instanceof Uint32Array?t.triangles:new Uint32Array(Ku(t.triangles));var v,_=new dm(this.defaultOpacity,i,this.edgeColor,c,h,n);s=s+this.delim+r,this.groups[s.replaceAll(this.delim,"/")]=_,_.name=s,null==i?i=1:i<1&&(this.transparent=!0);var y=null,x=null;if(null!=d){const t=`data:image/${d.format};base64,${d.data}`;var w=new Image;w.setAttribute("src",t),v=new Bs(u,p),(y=new $e(w)).needsUpdate=!0,y.colorSpace=Qt,x=new Ln({color:"#ffffff",map:y,side:2}),n=!1}else(v=new Zn).setAttribute("position",new On(m,3)),v.setAttribute("normal",new On(f,3)),v.setIndex(new On(g,1)),_.shapeGeometry=v,x=new Uh({color:e,metalness:this.metalness,roughness:this.roughness,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,transparent:!0,opacity:this.transparent?this.defaultOpacity*i:i,depthWrite:!this.transparent,depthTest:!0,clipIntersection:!1,side:o,visible:1==a[0],map:y,name:"frontMaterial"});const b="solid"===_.subtype?e:new En(this.edgeColor).lerp(new En(1,1,1),.15),M=new Ln({color:b,side:l,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,transparent:!0,opacity:this.transparent?this.defaultOpacity*i:i,depthWrite:!this.transparent,depthTest:!0,clipIntersection:!1,visible:1==a[0]&&(n||this.backVisible),name:"backMaterial"}),S=new us(v,M);S.name=r;const E=new us(v,x);if(E.name=r,i<1&&(S.renderOrder=999,E.renderOrder=999),_.addType(S,"back"),_.addType(E,"front"),this.normalLen>0){const t=new sm(E,this.normalLen,16711935);_.add(t)}const T=t.edges;if(T.length>0){var A=this._renderEdges(T,1,null,a[1]);A.name=r,_.addType(A,"edges")}return _}renderLoop(t,e,i){const n=(t,n,s,r)=>{var a;switch(t.type){case"edges":a=this.renderEdges(t.shape,t.width,t.color,e,t.name,i[t.id][1],{topo:"edge",geomtype:t.geomtype});break;case"vertices":a=this.renderVertices(t.shape,t.size,t.color,e,t.name,i[t.id][1],{topo:"vertex",geomtype:null});break;default:a=this.renderShape(t.shape,t.color,t.alpha,null!=t.renderback&&t.renderback,e,t.name,i[t.id],{topo:"face",geomtype:t.geomtype},t.subtype,n,s,r)}return null!=t.loc&&(a.position.set(...t.loc[0]),a.quaternion.set(...t.loc[1])),a};var s=new vo;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=null!=r.texture;const e=n(r,t?r.texture.image:null,t?r.texture.width:null,t?r.texture.height:null);this.groups[r.id]=e,s.add(e)}return s}render(t){return this.rootGroup=this.renderLoop(this.shapes,"",t),this.rootGroup}boundingBox(){return null==this.bbox&&(this.bbox=new rm,this.bbox.setFromObject(this.rootGroup,!0)),this.bbox}_traverse(t,e){for(var i in this.groups){var n=this.groups[i];n instanceof dm&&n[t](e)}}selection(){var t=[];for(var e in this.groups)for(var i of this.groups[e].children)i instanceof dm&&i.isSelected&&t.push(i);return t}clearSelection(){for(var t of this.selection())t.clearHighlights()}setMetalness(t){this.metalness=t,this._traverse("setMetalness",t)}setRoughness(t){this.roughness=t,this._traverse("setRoughness",t)}setTransparent(t){this.transparent=t,this._traverse("setTransparent",t)}setBlackEdges(t){this.blackEdges=t,this._traverse("setBlackEdges",t)}setBackVisible(t){this.backVisible=t,this._traverse("setBackVisible",t)}setEdgeColor(t){this.edge_color=t,this._traverse("setEdgeColor",t)}setOpacity(t){this.opacity=t,this._traverse("setOpacity",t)}setClipIntersection(t){this._traverse("setClipIntersection",t)}setClipPlanes(t){this.clipPlanes=t,this._traverse("setClipPlanes",t)}setPolygonOffset(t){this._traverse("setPolygonOffset",t)}updateMaterials(){this._traverse("updateMaterials",!0)}}class pm{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=mm(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 mm(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 qu;let o,l,c,h,d,u,p,m;if(r.o){const t=r._cachedOutline||(r._cachedOutline=r.o.split(" "));for(let s=0,r=t.length;s<r;){switch(t[s++]){case"m":o=t[s++]*e+i,l=t[s++]*e+n,a.moveTo(o,l);break;case"l":o=t[s++]*e+i,l=t[s++]*e+n,a.lineTo(o,l);break;case"q":c=t[s++]*e+i,h=t[s++]*e+n,d=t[s++]*e+i,u=t[s++]*e+n,a.quadraticCurveTo(d,u,c,h);break;case"b":c=t[s++]*e+i,h=t[s++]*e+n,d=t[s++]*e+i,u=t[s++]*e+n,p=t[s++]*e+i,m=t[s++]*e+n,a.bezierCurveTo(d,u,p,m,c,h)}}}return{offsetX:r.ha*e,path:a}}const fm={glyphs:{X:{x_min:-.015625,x_max:854.15625,ha:940,o:"m 854 0 l 683 0 l 423 409 l 166 0 l 0 0 l 347 519 l 18 1013 l 186 1013 l 428 637 l 675 1013 l 836 1013 l 504 520 l 854 0 "},Y:{x_min:0,x_max:820,ha:886,o:"m 820 1013 l 482 416 l 482 0 l 342 0 l 342 416 l 0 1013 l 140 1013 l 411 534 l 679 1012 l 820 1013 "},Z:{x_min:0,x_max:779,ha:849,o:"m 779 0 l 0 0 l 0 113 l 621 896 l 40 896 l 40 1013 l 779 1013 l 778 887 l 171 124 l 779 124 l 779 0 "},0:{x_min:73,x_max:715,ha:792,o:"m 394 -29 q 153 129 242 -29 q 73 479 73 272 q 152 829 73 687 q 394 989 241 989 q 634 829 545 989 q 715 479 715 684 q 635 129 715 270 q 394 -29 546 -29 m 394 89 q 546 211 489 89 q 598 479 598 322 q 548 748 598 640 q 394 871 491 871 q 241 748 298 871 q 190 479 190 637 q 239 211 190 319 q 394 89 296 89 "},1:{x_min:215.671875,x_max:574,ha:792,o:"m 574 0 l 442 0 l 442 697 l 215 697 l 215 796 q 386 833 330 796 q 475 986 447 875 l 574 986 l 574 0 "},2:{x_min:59,x_max:731,ha:792,o:"m 731 0 l 59 0 q 197 314 59 188 q 457 487 199 315 q 598 691 598 580 q 543 819 598 772 q 411 867 488 867 q 272 811 328 867 q 209 630 209 747 l 81 630 q 182 901 81 805 q 408 986 271 986 q 629 909 536 986 q 731 694 731 826 q 613 449 731 541 q 378 316 495 383 q 201 122 235 234 l 731 122 l 731 0 "},3:{x_min:54,x_max:737,ha:792,o:"m 737 284 q 635 55 737 141 q 399 -25 541 -25 q 156 52 248 -25 q 54 308 54 140 l 185 308 q 245 147 185 202 q 395 96 302 96 q 539 140 484 96 q 602 280 602 190 q 510 429 602 390 q 324 454 451 454 l 324 565 q 487 584 441 565 q 565 719 565 617 q 515 835 565 791 q 395 879 466 879 q 255 824 307 879 q 203 661 203 769 l 78 661 q 166 909 78 822 q 387 992 250 992 q 603 921 513 992 q 701 723 701 844 q 669 607 701 656 q 578 524 637 558 q 696 434 655 499 q 737 284 737 369 "},4:{x_min:48,x_max:742.453125,ha:792,o:"m 742 243 l 602 243 l 602 0 l 476 0 l 476 243 l 48 243 l 48 368 l 476 958 l 602 958 l 602 354 l 742 354 l 742 243 m 476 354 l 476 792 l 162 354 l 476 354 "},5:{x_min:54.171875,x_max:738,ha:792,o:"m 738 314 q 626 60 738 153 q 382 -23 526 -23 q 155 47 248 -23 q 54 256 54 125 l 183 256 q 259 132 204 174 q 382 91 314 91 q 533 149 471 91 q 602 314 602 213 q 538 469 602 411 q 386 528 475 528 q 284 506 332 528 q 197 439 237 484 l 81 439 l 159 958 l 684 958 l 684 840 l 254 840 l 214 579 q 306 627 258 612 q 407 643 354 643 q 636 552 540 643 q 738 314 738 457 "},6:{x_min:53,x_max:739,ha:792,o:"m 739 312 q 633 62 739 162 q 400 -31 534 -31 q 162 78 257 -31 q 53 439 53 206 q 178 859 53 712 q 441 986 284 986 q 643 912 559 986 q 732 713 732 833 l 601 713 q 544 830 594 786 q 426 875 494 875 q 268 793 331 875 q 193 517 193 697 q 301 597 240 570 q 427 624 362 624 q 643 540 552 624 q 739 312 739 451 m 603 298 q 540 461 603 400 q 404 516 484 516 q 268 461 323 516 q 207 300 207 401 q 269 137 207 198 q 405 83 325 83 q 541 137 486 83 q 603 298 603 197 "},7:{x_min:58.71875,x_max:730.953125,ha:792,o:"m 730 839 q 469 448 560 641 q 335 0 378 255 l 192 0 q 328 441 235 252 q 593 830 421 630 l 58 830 l 58 958 l 730 958 l 730 839 "},8:{x_min:55,x_max:736,ha:792,o:"m 571 527 q 694 424 652 491 q 736 280 736 358 q 648 71 736 158 q 395 -26 551 -26 q 142 69 238 -26 q 55 279 55 157 q 96 425 55 359 q 220 527 138 491 q 120 615 153 562 q 88 726 88 668 q 171 904 88 827 q 395 986 261 986 q 618 905 529 986 q 702 727 702 830 q 670 616 702 667 q 571 527 638 565 m 394 565 q 519 610 475 565 q 563 717 563 655 q 521 823 563 781 q 392 872 474 872 q 265 824 312 872 q 224 720 224 783 q 265 613 224 656 q 394 565 312 565 m 395 91 q 545 150 488 91 q 597 280 597 204 q 546 408 597 355 q 395 465 492 465 q 244 408 299 465 q 194 280 194 356 q 244 150 194 203 q 395 91 299 91 "},9:{x_min:53,x_max:739,ha:792,o:"m 739 524 q 619 94 739 241 q 362 -32 516 -32 q 150 47 242 -32 q 59 244 59 126 l 191 244 q 246 129 191 176 q 373 82 301 82 q 526 161 466 82 q 597 440 597 255 q 363 334 501 334 q 130 432 216 334 q 53 650 53 521 q 134 880 53 786 q 383 986 226 986 q 659 841 566 986 q 739 524 739 719 m 388 449 q 535 514 480 449 q 585 658 585 573 q 535 805 585 744 q 388 873 480 873 q 242 809 294 873 q 191 658 191 745 q 239 514 191 572 q 388 449 292 449 "},"-":{x_min:8.71875,x_max:350.390625,ha:478,o:"m 350 317 l 8 317 l 8 428 l 350 428 l 350 317 "},".":{x_min:0,x_max:142,ha:239,o:"m 142 0 l 0 0 l 0 151 l 142 151 l 142 0 "}},cssFontWeight:"normal",ascender:1189,underlinePosition:-100,cssFontStyle:"normal",boundingBox:{yMin:-334,xMin:-111,yMax:1189,xMax:1672},resolution:1e3,original_font_information:"see https://github.com/mrdoob/three.js/blob/dev/examples/fonts/helvetiker_regular.typeface.json",descender:-334,familyName:"Helvetiker",lineHeight:1522,underlineThickness:50};class gm{constructor(t,e,i,n,s,r,a,o){void 0===i&&(i=10),this.display=t,this.bbox=e,this.centerGrid=n,this.grid=r,this.allGrid=r[0]|r[1]|r[2];const l=new ri;e.getSize(l);const c=Math.max(l.x,l.y,l.z);this.gridHelper=[];var[h,d,u]=this.niceBounds(1.05*-c,1.05*c,2*i);this.size=d-h;const p=new pm(fm);this.ticks=u;for(var m=0;m<3;m++){var f=new vo;f.name=`GridHelper-${m}`,f.add(new Nu(this.size,this.size/this.ticks,"dark"===o?13421772:7829367,"dark"==o?10066329:12303291));const t=new Hl({color:"dark"===o?new En(.5,.5,.5):new En(.4,.4,.4),side:2});for(var g,v,_=-this.size/2;_<=this.size/2;_+=this.ticks){v=this.createNumber(_,p),0==m?(v.rotateX(-Math.PI/2),v.rotateY(Math.PI/2)):(v.rotateX(Math.PI/2),v.rotateY(-Math.PI/2));const e=new us(v,t);if(g=1==m?-1:1,e.position.set(g*_,0,0),f.add(e),Math.abs(_)<1e-6)continue;v=this.createNumber(_,p),0==m?v.rotateX(-Math.PI/2):1==m?(v.rotateX(-Math.PI/2),v.rotateZ(Math.PI)):v.rotateX(Math.PI/2);const i=new us(v,t);g=0==m?-1:1,i.position.set(0,0,g*_),f.add(i)}this.gridHelper.push(f)}this.gridHelper[0].rotateX(Math.PI/2),this.gridHelper[1].rotateY(Math.PI/2),this.gridHelper[2].rotateZ(Math.PI/2),this.setCenter(s,a),this.setVisible()}createNumber(t,e){const i=(.035-7.1)/-637.8*(this.size-640)+7.1,n=e.generateShapes(t.toFixed(1),i);var s=new Mh(n);s.computeBoundingBox();var r=-.5*(s.boundingBox.max.x-s.boundingBox.min.x),a=-.5*(s.boundingBox.max.y-s.boundingBox.min.y);return s.translate(r,a,0),s}niceNumber(t,e){var i=Math.floor(Math.log10(t)),n=t/10**i;return(e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10)*10**i}niceBounds(t,e,i){var n,s;i||(i=10);var r=e-t;return 0==r?n=0:(s=this.niceNumber(r),n=this.niceNumber(s/(i-1),!0),t=Math.floor(t/n)*n,e=Math.ceil(e/n)*n),[t,e,n]}computeGrid(){this.allGrid=this.grid[0]|this.grid[1]|this.grid[2],this.display.toolbarButtons.grid.set(this.allGrid),this.display.checkElement("tcv_grid-xy",this.grid[0]),this.display.checkElement("tcv_grid-xz",this.grid[1]),this.display.checkElement("tcv_grid-yz",this.grid[2]),this.setVisible()}setGrid(t,e=null){switch(t){case"grid":this.allGrid=null==e?!this.allGrid:e,this.grid[0]=this.allGrid,this.grid[1]=this.allGrid,this.grid[2]=this.allGrid;break;case"grid-xy":this.grid[0]=!this.grid[0];break;case"grid-xz":this.grid[1]=!this.grid[1];break;case"grid-yz":this.grid[2]=!this.grid[2]}this.computeGrid()}setGrids(t,e,i){this.grid[0]=t,this.grid[1]=e,this.grid[2]=i,this.computeGrid()}setCenter(t,e){if(t){for(var i=0;i<3;i++)this.gridHelper[i].position.set(0,0,0);this.gridHelper[0].position.z=this.centerGrid?0:-this.size/2,this.gridHelper[1].position.y=this.centerGrid?0:(e?1:-1)*this.size/2,this.gridHelper[2].position.x=this.centerGrid?0:-this.size/2}else{const t=this.bbox.center();for(i=0;i<3;i++)this.gridHelper[i].position.set(...t);this.gridHelper[0].position.z=this.centerGrid?t[2]:-this.size/2+t[2],this.gridHelper[1].position.y=this.centerGrid?t[1]:(e?1:-1)*this.size/2+t[1],this.gridHelper[2].position.x=this.centerGrid?t[0]:-this.size/2+t[0]}}setVisible(){for(var t=0;t<3;t++)this.gridHelper[t].visible=this.grid[t]}}class vm extends Ap{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 tm;h.setPositions(l),h.setColors(new Float32Array(c));const d=new hp({vertexColors:!0,toneMapped:!1,linewidth:i,transparent:!0});d.resolution.set(n,s),super(h,d),this.center=t,this.type="AxesHelper",this.name="AxesHelper",this.visible=a,this.setCenter(r)}dispose(){this.geometry.dispose(),this.material.dispose()}setCenter(t){t?this.position.set(0,0,0):this.position.set(...this.center)}setVisible(t){this.visible=t}}class _m{constructor(t,e,i,n){this.width=t,this.height=e,this.cad_camera=i,this.theme=n,this.camera=null,this.scene=null,this.renderer=null,this.labels=[],this.ready=!1}create(){const t=new pm(fm),e=2.5;this.scene=new Lo,this.camera=new Ks(-this.width,this.width,this.height,-this.height,1,1e3),this.camera.up=this.cad_camera.up,this.camera.lookAt(new ri(0,0,0));const i=new vm([0,0,0],54,e,this.width,this.height,!0,!0,this.theme);this.scene.add(i);const n="dark"===this.theme?[[1,69/255,0],[50/255,205/255,50/255],[59/255,158/255,1]]:[[1,0,0],[0,.5,0],[0,0,1]];this.cones=[];for(var s=0;s<3;s++){var r=new Uc(0,6.25,12.5,20,1);const t=new Ln({color:new En(...n[s]),toneMapped:!1}),e=new us(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 Hl({color:"dark"===this.theme?new En(.9,.9,.9):new En(0,0,0),side:2}),i=t.generateShapes(a[s],16),n=new Mh(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 us(n,e);this.scene.add(l),this.labels.push(l)}const o=new Sh(7.5,20,20),l=new Ln({color:10526880}),c=new us(o,l);this.scene.add(c),this.scene.background=null,this.ready=!0}dispose(){Qu(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){if(this.ready){let n=(new si).setFromUnitVectors(new ri(0,0,1),t.normalize());this.camera.position.set(0,0,1).applyQuaternion(n).multiplyScalar(300),this.camera.quaternion.copy(e);for(var i=0;i<3;i++)this.labels[i].position.set(0==i?72:0,1==i?72:0,2==i?72:0),this.labels[i].quaternion.copy(e)}}}function ym(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 xm=0,wm=1,bm=2,Mm=3;class Sm{constructor(t,e,i,n,s,r){this.states=t,this.tree=e,this.objectHandler=i,this.pickHandler=n,this.theme=s,this.newTreeBehavior=r,this.lastSelection=null,this.setupIcons(s),this.treeModel=this.toModel(e)}setupIcons(t){var e={};e[xm]=Yu(t,"shape_no"),e[wm]=Yu(t,"shape"),e[bm]=Yu(t,"shape_mix"),e[Mm]=Yu(t,"shape_empty");var i={};i[xm]=Yu(t,"mesh_no"),i[wm]=Yu(t,"mesh"),i[bm]=Yu(t,"mesh_mix"),i[Mm]=Yu(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(wm);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=ym("li",[`node${t.id.replaceAll(" ","_")}`]),s=ym("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,ep.get(e,"meta"),ep.get(e,"shift"),t.type,!0)}),!1);var r=ym("span",["tcv_node_entry"],{id:t.id});if("node"===t.type){var a=ym("span",["tcv_node_entry_wrap"]);for(i in a.appendChild(ym("span",["tcv_t-caret","tcv_t-caret-down"])),this.icons)(e=ym("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=ym("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=ym("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]!=Mm&&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=ym("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]!=Mm&&(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:bm),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(2===t||n!==this.tree&&(3===t||1==t&&1===n.children.length&&"leaf"===n.children[0].type)){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]==wm?xm:wm:n?wm:xm,"leaf"==t?(this.updateState(r,i,s),this.updateNodes(this.treeModel,i),this.newTreeBehavior&&0==i&&(this.updateState(r,1,s),this.updateNodes(this.treeModel,1)),this.objectHandler(this.states)):"node"==t?(this.propagateChange(r,i,s),this.updateNodes(this.treeModel,i),this.newTreeBehavior&&0==i&&(this.objectHandler(this.states),this.propagateChange(r,1,s),this.updateNodes(this.treeModel,1)),this.objectHandler(this.states)):console.error(`Error, unknown type '${t}'`)}}class Em{constructor(t,e){this.prefix=t,this.timeit=e,this.start=performance.now(),e&&console.info(`three-cad-viewer: ${t}:timer start`)}split(t){if(this.timeit){const e=performance.now();console.info(`three-cad-viewer: ${this.prefix}:${t}:timer split ${(e-this.start).toFixed(1)} ms`)}}stop(){if(this.timeit){const t=performance.now();console.info(`three-cad-viewer: ${this.prefix}:timer stop ${(t-this.start).toFixed(1)} ms:`)}}}const Tm=[new ri(-1,0,0),new ri(0,-1,0),new ri(0,0,-1)],Am={light:[16711680,65280,255],dark:[16729344,3329330,3907327]},Cm=new Ln({opacity:.1,transparent:!0,depthWrite:!1,toneMapped:!1,side:2}),Lm=new Ln({depthWrite:!1,depthTest:!1,colorWrite:!1,side:l,stencilWrite:!0,stencilFunc:de,stencilFail:ce,stencilZFail:ce,stencilZPass:ce}),km=new Ln({depthWrite:!1,depthTest:!1,colorWrite:!1,side:o,stencilWrite:!0,stencilFunc:de,stencilFail:he,stencilZFail:he,stencilZPass:he}),Rm=new Uh({metalness:.3,roughness:.65,opacity:1,transparent:!1,side:2,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1,stencilWrite:!0,stencilRef:0,stencilFunc:517,stencilFail:le,stencilZFail:le,stencilZPass:le});class Pm extends Ps{constructor(t,e,i){super(t,e),this.center=i,this.setConstant(e)}setConstant(t){this.centeredConstant=t;const e=this.distanceToPoint(new ri(...this.center)),i=this.distanceToPoint(new ri(0,0,0));this.constant=i-e+t}}class Im extends us{static matrix=new Ni;constructor(t,e,i,n,s,r,a){const o=new Bs(2,2);o.computeBoundingSphere(),s.color.set(new En(r)),super(o,s),this.type=a,this.index=t,this.plane=e,this.size=n,this.center=i}dispose=()=>{this.geometry.dispose(),this.material.dispose();for(var t=0;t<this.children.length;t++)this.children[t].geometry.dispose(),this.children[t].material.dispose()};onAfterRender=t=>{this.type.startsWith("StencilPlane")&&t.clearStencil()};updateMatrixWorld(t){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),Im.matrix.lookAt(this.position,this.plane.normal,this.up),this.quaternion.setFromRotationMatrix(Im.matrix),this.translateZ(this.plane.constant),super.updateMatrixWorld(this,t)}}function Um(t,e,i,n){e.clippingPlanes=[n];var s=new us(i,e);return s.name=t,s}class Nm{constructor(t,e,i,n,s){var r;for(this.center=t,this.distance=e/2,this.display=n,this.theme=s,this.nestedGroup=i,this.clipPlanes=[],this.reverseClipPlanes=[],this.planeHelpers=new vo,this.planeHelpers.name="PlaneHelpers",this.planeHelperMaterials=[],this.objectColors=[],this.objectColorCaps=!1,r=0;r<3;r++){const i=new Pm(Tm[r],this.distance,t);this.clipPlanes.push(i);const n=new Pm(Tm[r].clone().negate(),-this.distance,t);this.reverseClipPlanes.push(n),this.display.setNormalLabel(r,Tm[r].toArray());const a=Cm.clone();a.opacity="dark"===s?.2:.1,this.planeHelperMaterials.push(a),this.planeHelpers.add(new Im(r,i,t,e,a,Am[s][r],"PlaneHelper"))}for(this.planeHelpers.visible=!1,r=0;r<3;r++){const t=this.clipPlanes.filter(((t,e)=>e!==r));this.planeHelpers.children[r].material.clippingPlanes=t}var a=new vo;for(a.name="PlaneMeshes",r=0;r<3;r++){const n=this.clipPlanes[r],u=this.clipPlanes.filter(((t,e)=>e!==r));var o=0;for(var l in i.groups){var c=new vo;c.name=`clipping-${r}`;var h=i.groups[l];if(h instanceof dm&&"solid"===h.subtype){this.objectColors.push(h.children[0].material.color.getHex()),c.add(Um(`frontStencil-${r}-${o}`,km.clone(),h.shapeGeometry,n)),c.add(Um(`backStencil-${r}-${o}`,Lm.clone(),h.shapeGeometry,n)),h.addType(c,`clipping-${r}`);var d=Rm.clone();d.color.set(new En(Am[s][r])),d.clippingPlanes=u,a.add(new Im(r,n,t,e,d,Am[s][r],`StencilPlane-${r}-${o}`)),o++}}}i.rootGroup.add(a)}setConstant(t,e){this.clipPlanes[t].setConstant(e),this.reverseClipPlanes[t].setConstant(-e)}setNormal=(t,e)=>{var i=e.clone();this.clipPlanes[t].normal=i,this.reverseClipPlanes[t].normal=i.clone().negate(),this.setConstant(t,this.distance),this.display.setNormalLabel(t,i.toArray())};getObjectColorCaps=()=>this.objectColorCaps;setObjectColorCaps=t=>{var e;for(e of this.nestedGroup.rootGroup.children)if("PlaneMeshes"===e.name)break;var i=0,n=-1;const s=Object.keys(e.children).length/3;for(var r of e.children)i%s==0&&n++,t?r.material.color.set(new En(this.objectColors[i])):r.material.color.set(new En(Am[this.theme][n])),i++;this.objectColorCaps=t};setVisible=t=>{var e;for(e of this.nestedGroup.rootGroup.children)if("PlaneMeshes"===e.name)break;for(var i of e.children)i.material.visible=t}}const Dm=["t","tx","ty","tz","q","rx","ry","rz"];class Om{constructor(t){this.delim=t,this.tracks=[],this.mixer=null,this.clip=null,this.clipAction=null,this.clock=new Xd,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!==Dm.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 ri(...t)).toArray()));break;case"tx":r=s.map((t=>a.add(new ri(t,0,0)).toArray()));break;case"ty":r=s.map((t=>a.add(new ri(0,t,0)).toArray()));break;case"tz":r=s.map((t=>a.add(new ri(0,0,t)).toArray()));break;default:return void console.error(`action ${i} is not supported`)}this.tracks.push(new rd(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 ri(1,0,0);break;case"y":t=new ri(0,1,0);break;case"z":t=new ri(0,0,1)}var i=new si;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 nd(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 ${Dm}`)}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 ad("track",e,this.tracks),this.mixer=new mu(t),this.mixer.timeScale=i,this.clipAction=this.mixer.clipAction(this.clip),this.clipAction.setLoop(n?Vt:Gt),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 Bm{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 ri;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 Fm=function(t,e){void 0===e&&console.warn('THREE.CameraControls: The second parameter "domElement" is now mandatory.'),e===document&&console.error('THREE.CameraControls: "document" should not be used as the target "domElement". Please use "renderer.domElement" instead.'),this.object=t,this.domElement=e,this.enabled=!0,this.target=new ri,this.trackball=!1,this.holroyd=!0,this.radius=.9,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:i.ROTATE,MIDDLE:i.DOLLY,RIGHT:i.PAN},this.touches={ONE:n.ROTATE,TWO:n.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.quaternion0=this.object.quaternion.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return p.phi},this.getAzimuthalAngle=function(){return p.theta},this.saveState=function(){a.target0.copy(a.target),a.position0.copy(a.object.position),a.quaternion0.copy(a.object.quaternion),a.zoom0=a.object.zoom},this.reset=function(){a.target.copy(a.target0),a.object.position.copy(a.position0),a.object.quaternion.copy(a.quaternion0),a.object.zoom=a.zoom0,a.object.updateProjectionMatrix(),a.dispatchEvent(o),a.update(),d=h.NONE},this.update=function(){var e=new ri,i=(new si).setFromUnitVectors(t.up,new ri(0,1,0)),n=i.clone().invert(),s=new ri,r=new si,l=new si,c=new ri;const _=new ri;return function(){var t,y=a.object.position;if(e.copy(y).sub(a.target),a.trackball&&!a.holroyd)m.theta&&(c.set(0,1,0).applyQuaternion(a.object.quaternion),t=a.enableDamping?a.dampingFactor:1,l.setFromAxisAngle(c,m.theta*t),a.object.quaternion.premultiply(l),e.applyQuaternion(l)),m.phi&&(c.set(1,0,0).applyQuaternion(a.object.quaternion),t=a.enableDamping?a.dampingFactor:1,l.setFromAxisAngle(c,m.phi*t),a.object.quaternion.premultiply(l),e.applyQuaternion(l)),e.multiplyScalar(f),e.clampLength(a.minDistance,a.maxDistance);else if(a.trackball&&a.holroyd){_.crossVectors(w,b);var x=Math.atan(_.length()/w.dot(b));x&&(_.normalize(),_.applyQuaternion(a.object.quaternion),x*=-2*(t=a.enableDamping?a.dampingFactor:1),l.setFromAxisAngle(_,x),a.object.quaternion.premultiply(l),e.applyQuaternion(l)),e.multiplyScalar(f),e.clampLength(a.minDistance,a.maxDistance),w.set(0,0,0),b.set(0,0,0)}else e.applyQuaternion(i),a.autoRotate&&d===h.NONE&&P(2*Math.PI/60/60*a.autoRotateSpeed),p.setFromVector3(e),a.enableDamping?(p.theta+=m.theta*a.dampingFactor,p.phi+=m.phi*a.dampingFactor):(p.theta+=m.theta,p.phi+=m.phi),p.theta=Math.max(a.minAzimuthAngle,Math.min(a.maxAzimuthAngle,p.theta)),p.phi=Math.max(a.minPolarAngle,Math.min(a.maxPolarAngle,p.phi)),p.makeSafe(),p.radius*=f,p.radius=Math.max(a.minDistance,Math.min(a.maxDistance,p.radius)),e.setFromSpherical(p),e.applyQuaternion(n);return!0===a.enableDamping?a.target.addScaledVector(g,a.dampingFactor):a.target.add(g),y.copy(a.target).add(e),!1===a.trackball&&a.object.lookAt(a.target),!0===a.enableDamping?(m.theta*=1-a.dampingFactor,m.phi*=1-a.dampingFactor,g.multiplyScalar(1-a.dampingFactor)):(m.set(0,0,0),g.set(0,0,0)),f=1,!!(v||s.distanceToSquared(a.object.position)>u||8*(1-r.dot(a.object.quaternion))>u)&&(a.dispatchEvent(o),s.copy(a.object.position),r.copy(a.object.quaternion),v=!1,!0)}}();const s={x:new ri(1,0,0),y:new ri(0,1,0),z:new ri(0,0,1)};function r(t,e){if(a.trackball){const i=s[t],n=(new si).setFromAxisAngle(i,e);a.object.quaternion.premultiply(n),a.object.position.sub(a.target).applyQuaternion(n).add(a.target)}else console.log("not supported for orbit controls")}this.rotateX=function(t){r("x",t)},this.rotateY=function(t){r("y",t)},this.rotateZ=function(t){r("z",t)},this.rotateLeft=function(t){this.trackball?console.log("not supported for trackball controls"):P(t)},this.rotateUp=function(t){this.trackball?console.log("not supported for trackball controls"):I(t)},this.dispose=function(){a.domElement.removeEventListener("contextmenu",st,!1),a.domElement.removeEventListener("mousedown",J,!1),a.domElement.removeEventListener("wheel",Q,!1),a.domElement.removeEventListener("touchstart",et,!1),a.domElement.removeEventListener("touchend",nt,!1),a.domElement.removeEventListener("touchmove",it,!1),document.removeEventListener("mousemove",K,!1),document.removeEventListener("mouseup",$,!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 bu,m=new bu,f=1,g=new ri,v=!1,_=new Le,y=new Le,x=new Le,w=new ri,b=new ri,M=new Le,S=new Le,E=new Le,T=new Le,A=new Le,C=new Le,L=!0,k=!0;function R(){return Math.pow(.95,a.zoomSpeed)}function P(t){L&&(m.theta-=t)}function I(t){k&&(m.phi-=t)}var U,N,D=(U=new ri,function(t,e){U.setFromMatrixColumn(e,0),U.multiplyScalar(-t),g.add(U)}),O=function(){var t=new ri;return function(e,i){!0===a.screenSpacePanning?t.setFromMatrixColumn(i,1):(t.setFromMatrixColumn(i,0),t.crossVectors(a.object.up,t)),t.multiplyScalar(e),g.add(t)}}(),B=(N=new ri,function(t,e){var i=a.domElement;if(a.object.isPerspectiveCamera){var n=a.object.position;N.copy(n).sub(a.target);var s=N.length();s*=Math.tan(a.object.fov/2*Math.PI/180),D(2*t*s/i.clientHeight,a.object.matrix),O(2*e*s/i.clientHeight,a.object.matrix)}else a.object.isOrthographicCamera?(D(t*(a.object.right-a.object.left)/a.object.zoom/i.clientWidth,a.object.matrix),O(e*(a.object.top-a.object.bottom)/a.object.zoom/i.clientHeight,a.object.matrix)):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - pan disabled."),a.enablePan=!1)});function F(t){a.object.isPerspectiveCamera?f/=t:a.object.isOrthographicCamera?(a.object.zoom=Math.max(a.minZoom,Math.min(a.maxZoom,a.object.zoom*t)),a.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - dolly/zoom disabled."),a.enableZoom=!1)}function z(t){a.object.isPerspectiveCamera?f*=t:a.object.isOrthographicCamera?(a.object.zoom=Math.max(a.minZoom,Math.min(a.maxZoom,a.object.zoom/t)),a.object.updateProjectionMatrix(),v=!0):(console.warn("WARNING: CameraControls.js encountered an unknown camera type - dolly/zoom disabled."),a.enableZoom=!1)}const H=function(){const t=new ri,e=a.radius*a.radius;return function(i){const n=a.domElement.getBoundingClientRect(),s=(i.x-n.x)/(n.width/2)-1,r=1-(i.y-n.y)/(n.height/2);return function(i,n){var s=(i*=a.rotateSpeed)*i+(n*=a.rotateSpeed)*n;s<=e/2?t.set(i,n,Math.sqrt(e-s)):t.set(i,n,e/(2*Math.sqrt(s)))}(L?s:0,k?r:0),t}}();function V(t){_.set(t.clientX,t.clientY)}function G(t){M.set(t.clientX,t.clientY)}function j(t){if(1==t.touches.length)_.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);_.set(e,i)}}function W(t){if(1==t.touches.length)M.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);M.set(e,i)}}function q(t){var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY,n=Math.sqrt(e*e+i*i);T.set(0,n)}function X(t){if(1==t.touches.length)y.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);y.set(e,i)}if(a.trackball&&a.holroyd)w=H(_).clone(),b=H(y).clone();else{x.subVectors(y,_).multiplyScalar(a.rotateSpeed);var n=a.domElement;P(2*Math.PI*x.x/n.clientHeight),I(2*Math.PI*x.y/n.clientHeight)}_.copy(y)}function Z(t){if(1==t.touches.length)S.set(t.touches[0].pageX,t.touches[0].pageY);else{var e=.5*(t.touches[0].pageX+t.touches[1].pageX),i=.5*(t.touches[0].pageY+t.touches[1].pageY);S.set(e,i)}E.subVectors(S,M).multiplyScalar(a.panSpeed),B(E.x,E.y),M.copy(S)}function Y(t){var e=t.touches[0].pageX-t.touches[1].pageX,i=t.touches[0].pageY-t.touches[1].pageY,n=Math.sqrt(e*e+i*i);A.set(0,n),C.set(0,Math.pow(A.y/T.y,a.zoomSpeed)),F(C.y),T.copy(A)}function J(t){if(!1!==a.enabled){var e;switch(t.preventDefault(),t.stopPropagation(),a.domElement.focus?a.domElement.focus():window.focus(),t.button){case 0:e=a.mouseButtons.LEFT;break;case 1:e=a.mouseButtons.MIDDLE;break;case 2:e=a.mouseButtons.RIGHT;break;default:e=-1}switch(e){case i.DOLLY:if(!1===a.enableZoom)return;!function(t){T.set(t.clientX,t.clientY)}(t),d=h.DOLLY;break;case i.ROTATE:if(ep.get(t,"shift")){if(!1===a.enablePan)return;G(t),d=h.PAN}else{if(!1===a.enableRotate)return;ep.get(t,"ctrl")&&(L=!1),ep.get(t,"meta")&&(k=!1),V(t),d=h.ROTATE}break;case i.PAN:if(ep.get(t,"ctrl")||ep.get(t,"meta")||ep.get(t,"shift")){if(!1===a.enableRotate)return;V(t),d=h.ROTATE}else{if(!1===a.enablePan)return;G(t),d=h.PAN}break;default:d=h.NONE}d!==h.NONE&&(document.addEventListener("mousemove",K,!1),document.addEventListener("mouseup",$,!1),a.dispatchEvent(l))}}function K(t){if(!1!==a.enabled)switch(t.preventDefault(),t.stopPropagation(),d){case h.ROTATE:if(!1===a.enableRotate)return;!function(t){if(y.set(t.clientX,t.clientY),a.trackball&&a.holroyd)w=H(_).clone(),b=H(y).clone();else{var e=a.domElement;x.subVectors(y,_).multiplyScalar(a.rotateSpeed),P(2*Math.PI*x.x/e.clientHeight),I(2*Math.PI*x.y/e.clientHeight)}_.copy(y),a.update()}(t);break;case h.DOLLY:if(!1===a.enableZoom)return;!function(t){A.set(t.clientX,t.clientY),C.subVectors(A,T),C.y>0?F(R()):C.y<0&&z(R()),T.copy(A),a.update()}(t);break;case h.PAN:if(!1===a.enablePan)return;!function(t){S.set(t.clientX,t.clientY),E.subVectors(S,M).multiplyScalar(a.panSpeed),B(E.x,E.y),M.copy(S),a.update()}(t)}}function $(t){!1!==a.enabled&&(document.removeEventListener("mousemove",K,!1),document.removeEventListener("mouseup",$,!1),L=!0,k=!0,a.dispatchEvent(c),d=h.NONE)}function Q(t){!1===a.enabled||!1===a.enableZoom||d!==h.NONE&&d!==h.ROTATE||(t.preventDefault(),t.stopPropagation(),a.dispatchEvent(l),function(t){t.deltaY<0?z(R()):t.deltaY>0&&F(R()),a.update()}(t),a.dispatchEvent(c))}function tt(t){!1!==a.enabled&&!1!==a.enableKeys&&!1!==a.enablePan&&function(t){var e=!1;switch(t.keyCode){case a.keys.UP:B(0,a.keyPanSpeed),e=!0;break;case a.keys.BOTTOM:B(0,-a.keyPanSpeed),e=!0;break;case a.keys.LEFT:B(a.keyPanSpeed,0),e=!0;break;case a.keys.RIGHT:B(-a.keyPanSpeed,0),e=!0}e&&(t.preventDefault(),a.update())}(t)}function et(t){if(!1!==a.enabled){switch(t.preventDefault(),t.touches.length){case 1:switch(a.touches.ONE){case n.ROTATE:if(!1===a.enableRotate)return;j(t),d=h.TOUCH_ROTATE;break;case n.PAN:if(!1===a.enablePan)return;W(t),d=h.TOUCH_PAN;break;default:d=h.NONE}break;case 2:switch(a.touches.TWO){case n.DOLLY_PAN:if(!1===a.enableZoom&&!1===a.enablePan)return;!function(t){a.enableZoom&&q(t),a.enablePan&&W(t)}(t),d=h.TOUCH_DOLLY_PAN;break;case n.DOLLY_ROTATE:if(!1===a.enableZoom&&!1===a.enableRotate)return;!function(t){a.enableZoom&&q(t),a.enableRotate&&j(t)}(t),d=h.TOUCH_DOLLY_ROTATE;break;default:d=h.NONE}break;default:d=h.NONE}d!==h.NONE&&a.dispatchEvent(l)}}function it(t){if(!1!==a.enabled)switch(t.preventDefault(),t.stopPropagation(),d){case h.TOUCH_ROTATE:if(!1===a.enableRotate)return;X(t),a.update();break;case h.TOUCH_PAN:if(!1===a.enablePan)return;Z(t),a.update();break;case h.TOUCH_DOLLY_PAN:if(!1===a.enableZoom&&!1===a.enablePan)return;!function(t){a.enableZoom&&Y(t),a.enablePan&&Z(t)}(t),a.update();break;case h.TOUCH_DOLLY_ROTATE:if(!1===a.enableZoom&&!1===a.enableRotate)return;!function(t){a.enableZoom&&Y(t),a.enableRotate&&X(t)}(t),a.update();break;default:d=h.NONE}}function nt(t){!1!==a.enabled&&(a.dispatchEvent(c),d=h.NONE)}function st(t){!1!==a.enabled&&t.preventDefault()}a.domElement.addEventListener("contextmenu",st,!1),a.domElement.addEventListener("mousedown",J,!1),a.domElement.addEventListener("wheel",Q,!1),a.domElement.addEventListener("touchstart",et,!1),a.domElement.addEventListener("touchend",nt,!1),a.domElement.addEventListener("touchmove",it,!1),a.domElement.addEventListener("keydown",tt,!1),-1===a.domElement.tabIndex&&(a.domElement.tabIndex=0),this.object.lookAt(a.target),this.update(),this.saveState()};(Fm.prototype=Object.create(ve.prototype)).constructor=Fm;var zm=function(t,e){Fm.call(this,t,e),this.mouseButtons.LEFT=i.ROTATE,this.mouseButtons.RIGHT=i.PAN,this.touches.ONE=n.ROTATE,this.touches.TWO=n.DOLLY_PAN};(zm.prototype=Object.create(ve.prototype)).constructor=zm;var Hm=function(t,e){Fm.call(this,t,e),this.mouseButtons.LEFT=i.PAN,this.mouseButtons.RIGHT=i.ROTATE,this.touches.ONE=n.PAN,this.touches.TWO=n.DOLLY_ROTATE};(Hm.prototype=Object.create(ve.prototype)).constructor=Hm;var Vm=function(t,e){Fm.call(this,t,e),this.trackball=!0,this.screenSpacePanning=!0,this.autoRotate=!1,this.mouseButtons.LEFT=i.ROTATE,this.mouseButtons.RIGHT=i.PAN,this.touches.ONE=n.ROTATE,this.touches.TWO=n.DOLLY_PAN};(Vm.prototype=Object.create(ve.prototype)).constructor=Vm;class Gm{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 ri(...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 Fm(this.camera,this.domElement),this.controls.trackball=!0,this.setHolroydTrackball(t)}initOrbitControls(){this.controls=new Fm(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 jm={y_up:{iso:{pos:new ri(1,1,1),z_rot:0},front:{pos:new ri(0,0,1),z_rot:0},rear:{pos:new ri(0,0,-1),z_rot:0},left:{pos:new ri(-1,0,0),z_rot:0},right:{pos:new ri(1,0,0),z_rot:0},top:{pos:new ri(0,1,0),z_rot:0},bottom:{pos:new ri(0,-1,0),z_rot:0}},z_up:{iso:{pos:new ri(1,-1,1),z_rot:0},front:{pos:new ri(0,-1,0),z_rot:0},rear:{pos:new ri(0,1,0),z_rot:0},left:{pos:new ri(-1,0,0),z_rot:0},right:{pos:new ri(1,0,0),z_rot:0},top:{pos:new ri(0,0,1),z_rot:-Math.PI/2},bottom:{pos:new ri(0,0,-1),z_rot:-Math.PI/2}},legacy:{iso:{pos:new ri(1,1,1),z_rot:0},front:{pos:new ri(1,0,0),z_rot:0},rear:{pos:new ri(-1,0,0),z_rot:0},left:{pos:new ri(0,1,0),z_rot:0},right:{pos:new ri(0,-1,0),z_rot:0},top:{pos:new ri(0,0,1),z_rot:0},bottom:{pos:new ri(0,0,-1),z_rot:0}}},Wm={y_up:[0,1,0],z_up:[0,0,1],legacy:[0,0,1]};class qm{constructor(t,e,i,n,s,r){this.target=new ri(...n),this.ortho=s,this.up={Y:"y_up",Z:"z_up",L:"legacy"}[r],this.yaxis=new ri(0,1,0),this.zaxis=new ri(0,0,1);const a=t/e;this.camera_distance=5*i;var o=2*Math.atan(.2)/Math.PI*180;this.pCamera=new Ss(o,a,.1,100*i),this.pCamera.up.set(...Wm[this.up]),this.pCamera.lookAt(this.target);const l=this.projectSize(i,a);this.oCamera=new Ks(-l[0],l[0],l[1],-l[1],.1,100*i),this.oCamera.up.set(...Wm[this.up]),this.oCamera.lookAt(this.target),this.camera=s?this.oCamera:this.pCamera,this.camera.up.set(...Wm[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,jm[this.up][t].pos,null,e),this.lookAtTarget(),0!=jm[this.up][t].z_rot){var i=new si;i.setFromAxisAngle(new ri(0,0,1),jm[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 ri(...t)):t instanceof ri?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 si(...t)):t instanceof si?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()}}t.Display=Qp,t.Timer=Em,t.Viewer=class{constructor(t,e,i,n=null,s=!0){this.notifyCallback=i,this.pinAsPngCallback=n,this.updateMarker=s,this.hasAnimationLoop=!1,this.setDisplayDefaults(e),e.keymap&&ep.set(e.keymap),this.display=new Qp(t,{theme:this.theme,cadWidth:this.cadWidth,treeWidth:this.treeWidth,height:this.height,pinning:this.pinning,glass:this.glass,tools:this.tools,measureTools:e.measureTools}),window.THREE=Xu,this.nestedGroup=null,this.mapping=null,this.tree=null,this.bbox=null,this.bb_max=0,this.scene=null,this.camera=null,this.orthographicCamera=null,this.gridHelper=null,this.axesHelper=null,this.controls=null,this.orientationMarker=null,this.treeview=null,this.cadTools=new Jp(this),this.newTreeBehavior=e.newTreeBehavior,this.ready=!1,this.mixer=null,this.animation=new Om("|"),this.continueAnimation=!0,this.clipNormals=[[-1,0,0],[0,-1,0],[0,0,-1]],this.camera_distance=0,this.mouse=new Le,this.renderer=new To({alpha:!this.dark,antialias:!0,stencil:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(this.cadWidth,this.height),this.renderer.setClearColor(16777215,0),this.renderer.autoClear=!1,this.lastNotification={},this.lastBbox=null,this.explodedGroup=null,this.explodedTree=null,this.explodedStates=null,this.compactGroup=null,this.compactTree=null,this.compactStates=null,this.lastObject=null,this.lastSelection=null,this.lastPosition=null,this.bboxNeedsUpdate=!1,this.keepHighlight=!1,this.setPickHandler(!0),this.renderer.domElement.addEventListener("contextmenu",(t=>t.stopPropagation())),this.display.addCadView(this.renderer.domElement),console.debug("three-cad-viewer: WebGL Renderer created"),this.display.setupUI(this)}version(){return"3.0.2"}setDisplayDefaults(t){for(var e in this.theme="light",this.cadWidth=800,this.treeWidth=250,this.height=600,this.pinning=!1,this.glass=!1,this.tools=!0,this.keymap={shift:"shiftKey",ctrl:"ctrlKey",meta:"metaKey"},this.newTreeBehavior=!0,t)null==this[e]?console.warn(`Unknown option "${e}" to create a viewer - ignored`):this[e]=t[e];"dark"===t.theme||"browser"==t.theme&&window.matchMedia("(prefers-color-scheme: dark)").matches?this.theme="dark":this.theme="light"}setRenderDefaults(t){for(var e in this.ambientIntensity=.5,this.directIntensity=.6,this.metalness=.7,this.roughness=.7,this.defaultOpacity=.5,this.edgeColor=7368816,this.normalLen=0,this.measureTools=!1,t)void 0===this[e]?console.warn(`Unknown option "${e}" to create a viewer - ignored`):this[e]=t[e];this.materialSettings={ambientIntensity:this.ambientIntensity,directIntensity:this.directIntensity,metalness:this.metalness,roughness:this.roughness}}setViewerDefaults(t){for(var e in this.axes=!1,this.axes0=!1,this.grid=[!1,!1,!1],this.ortho=!0,this.transparent=!1,this.blackEdges=!1,this.collapse=0,this.clipIntersection=!1,this.clipPlaneHelpers=!1,this.clipObjectColors=!1,this.clipNormal0=[-1,0,0],this.clipNormal1=[0,-1,0],this.clipNormal2=[0,0,-1],this.clipSlider0=-1,this.clipSlider1=-1,this.clipSlider2=-1,this.control="orbit",this.up="Z",this.ticks=10,this.centerGrid=!1,this.position=null,this.quaternion=null,this.target=null,this.measureTools=!0,this.newTreeBehaviour=!0,this.zoom=1,this.panSpeed=.5,this.rotateSpeed=1,this.zoomSpeed=.5,this.timeit=!1,t)void 0===this[e]?console.warn(`Unknown option ${e} to add shapes - ignored`):this[e]=t[e]}dumpOptions(){console.log("Display:"),console.log("- cadWidth",this.cadWidth),console.log("- control",this.control),console.log("- height",this.height),console.log("- pinning",this.pinning),console.log("- theme",this.theme),console.log("- treeHeight",this.treeHeight),console.log("- treeWidth",this.treeWidth),console.log("Render:"),console.log("- ambientIntensity",this.ambientIntensity),console.log("- defaultOpacity",this.defaultOpacity),console.log("- directIntensity",this.directIntensity),console.log("- edgeColor",this.edgeColor),console.log("- normalLen",this.normalLen),console.log("View:"),console.log("- axes",this.axes),console.log("- axes0",this.axes0),console.log("- blackEdges",this.blackEdges),console.log("- clipIntersection",this.clipIntersection),console.log("- clipPlaneHelpers",this.clipPlaneHelpers),console.log("- clipObjectColors",this.clipObjectColors),console.log("- clipNormal0",this.clipNormal0),console.log("- clipNormal1",this.clipNormal1),console.log("- clipNormal2",this.clipNormal2),console.log("- clipSlider0",this.clipSlider0),console.log("- clipSlider1",this.clipSlider1),console.log("- clipSlider2",this.clipSlider2),console.log("- grid",this.grid),console.log("- ortho",this.ortho),console.log("- panSpeed",this.panSpeed),console.log("- position",this.position),console.log("- quaternion",this.quaternion),console.log("- rotateSpeed",this.rotateSpeed),console.log("- ticks",this.ticks),console.log("- timeit",this.timeit),console.log("- tools",this.tools),console.log("- glass",this.glass),console.log("- transparent",this.transparent),console.log("- zoom",this.zoom),console.log("- zoom0",this.controls.getZoom0()),console.log("- zoomSpeed",this.zoomSpeed)}_renderTessellatedShapes(t,e){const i=new um(t,this.cadWidth,this.height,this.edgeColor,this.transparent,this.defaultOpacity,this.metalness,this.roughness,this.normalLen);return t.bb&&(this.bbox=new rm(new ri(t.bb.xmin,t.bb.ymin,t.bb.zmin),new ri(t.bb.xmax,t.bb.ymax,t.bb.zmax))),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,"")}_decompose(t,e){const i=t.shape;var n;if(t.parts=[],"shapes"==t.type){var s,r={parts:[],loc:[[0,0,0],[0,0,0,1]],name:"faces",id:`${t.id}/faces`};const u=i.vertices,p=i.normals,m=i.triangles_per_face?i.triangles_per_face.length:i.triangles.length;var a=0;for(n=0;n<m;n++){i.triangles_per_face?(s=i.triangles.subarray(a,a+3*i.triangles_per_face[n]),a+=3*i.triangles_per_face[n]):s=i.triangles[n];for(var o=new Float32Array(3*s.length),l=new Float32Array(3*s.length),c=0;c<s.length;c++){var h=s[c];o[3*c]=u[3*h],o[3*c+1]=u[3*h+1],o[3*c+2]=u[3*h+2],l[3*c]=p[3*h],l[3*c+1]=p[3*h+1],l[3*c+2]=p[3*h+2]}var d={loc:[[0,0,0],[0,0,0,1]],name:`faces_${n}`,id:`${t.id}/faces/faces_${n}`,type:"shapes",color:t.color,alpha:t.alpha,renderBack:!1,accuracy:t.accuracy,bb:{},geomtype:i.face_types[n],subtype:t.subtype,shape:{triangles:[...Array(s.length).keys()],vertices:o,normals:l,edges:[]}};r.parts.push(d),e[d.id]=[1,3]}t.parts.push(r)}if("shapes"==t.type||"edges"==t.type){r={parts:[],loc:[[0,0,0],[0,0,0,1]],name:"edges",id:`${t.id}/edges`};const s=Array.isArray(t.color)&&t.color.length==i.edges.length;var u;const o=i.segments_per_edge?i.segments_per_edge.length:i.edges.length;var p;for(a=0,n=0;n<o;n++)i.segments_per_edge?(p=i.edges.subarray(a,a+6*i.segments_per_edge[n]),a+=6*i.segments_per_edge[n]):p=i.edges[n],u=s?t.color[n]:t.color,d={loc:[[0,0,0],[0,0,0,1]],name:`edges_${n}`,id:`${t.id}/edges/edges_${n}`,type:"edges",color:"shapes"==t.type?this.edgeColor:u,width:"shapes"==t.type?1:t.width,bb:{},geomtype:i.edge_types[n],shape:{edges:p}},r.parts.push(d),e[d.id]=[3,1];t.parts.push(r)}r={parts:[],loc:[[0,0,0],[0,0,0,1]],name:"vertices",id:`${t.id}/vertices`};var m=i.obj_vertices;for(n=0;n<m.length/3;n++)d={loc:[[0,0,0],[0,0,0,1]],name:`vertices${n}`,id:`${t.id}/vertices/vertices${n}`,type:"vertices",color:"shapes"==t.type||"edges"==t.type?this.edgeColor:t.color,size:"shapes"==t.type||"edges"==t.type?4:t.size,bb:{},shape:{obj_vertices:[m[3*n],m[3*n+1],m[3*n+2]]}},r.parts.push(d),e[d.id]=[3,1];return t.parts.push(r),delete t.shape,delete t.color,delete t.alpha,delete t.accuracy,delete t.renderBack,delete e[t.id],t}renderTessellatedShapes(t,e,i){const n=(t,e)=>{var i;if(2==t.version||3==t.version){var s,r;let a=[];for(s=0;s<t.parts.length;s++)null!=(i=t.parts[s]).parts?(r=n(i,e),a.push(r)):a.push(this._decompose(i,e));t.parts=a}return t};var s,r=structuredClone(i);return s=t?n(structuredClone(e),r):structuredClone(e),{group:this._renderTessellatedShapes(s,r),tree:this._getTree(s,r),states:r}}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(!$u(this.lastNotification[e],t[e])){var n=Ju(t[e]);i[e]={new:n,old:null==this.lastNotification[e]?null:Ju(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.raycaster&&this.raycaster.raycastMode&&this.handleRaycast(),this.renderer.setViewport(0,0,this.cadWidth,this.height),this.renderer.render(this.scene,this.camera.getCamera()),this.cadTools.update(),this.directLight.position.copy(this.camera.getCamera().position),null!=this.lastBbox&&(this.lastBbox.needsUpdate||this.bboxNeedsUpdate)&&(console.log("updated bbox"),this.lastBbox.bbox.update(),this.lastBbox.needsUpdate=!1),t&&(this.renderer.clearDepth(),this.orientationMarker.update(this.camera.getPosition().clone().sub(this.controls.getTarget()),this.camera.getQuaternion()),this.orientationMarker.render(this.renderer)),this.animation&&this.animation.update(),this.checkChanges({zoom:this.camera.getZoom(),position:this.camera.getPosition().toArray(),quaternion:this.camera.getQuaternion().toArray(),target:this.controls.getTarget().toArray()},e))};animate=()=>{this.continueAnimation?(requestAnimationFrame(this.animate),this.controls.update(),this.update(!0,!0)):console.debug("three-cad-viewer: Animation loop stopped")};toggleAnimationLoop(t){t?(this.continueAnimation=!0,this.hasAnimationLoop=!0,this.controls.removeChangeListener(),console.debug("three-cad-viewer: Change listener removed"),this.animate(),console.debug("three-cad-viewer: Animation loop started")):(this.hasAnimationLoop&&console.debug("three-cad-viewer: Turning animation loop off"),this.continueAnimation=!1,this.hasAnimationLoop=!1,this.controls.addChangeListener((()=>this.update(!0,!0))),console.debug("three-cad-viewer: Change listener registered"),setTimeout((()=>this.update(!0,!0)),50))}dispose(){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(),Qu(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)}toggleGroup(t){var e,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)};this.setRenderDefaults(this.renderOptions),t?null==this.explodedGroup&&(e=this.renderTessellatedShapes(t,this.shapes,this.states),this.nestedGroup=e.group,i(),this.explodedStates=e.states,this.explodedTree=e.tree,this.explodedGroup=this.nestedGroup.render(e.states)):null==this.compactGroup&&(e=this.renderTessellatedShapes(t,this.shapes,this.states),this.nestedGroup=e.group,i(),this.compactStates=e.states,this.compactTree=e.tree,this.compactGroup=this.nestedGroup.render(this.states)),this.states=t?this.explodedStates:this.compactStates,this.tree=t?this.explodedTree:this.compactTree,this.scene.children[0]=t?this.explodedGroup:this.compactGroup,this.treeview=new Sm(structuredClone(this.states),this.tree,this.setObjects,this.handlePick,this.theme,this.newTreeBehavior),this.update(!0,!0),this.display.clearCadTree(),this.display.addCadTree(this.treeview.render(this.collapse)),this.display.selectTabByName("tree"),this.display.toggleClippingTab(!t)}render(t,e,i,n){this.shapes=t,this.states=e,this.renderOptions=i,this.setViewerDefaults(n),this.animation.cleanBackup();const s=new Em("viewer",this.timeit);this.scene=new Lo,this.toggleGroup(!1),s.split("scene and tree done"),this.bbox||(this.bbox=this.nestedGroup.boundingBox());const r=new ri;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 Bm(this.display.cadInfo),this.camera=new qm(this.cadWidth,this.height,this.bb_radius,null==n.target?this.bbox.center():n.target,this.ortho,n.up),this.orthographicCamera=new Ks(-10,10,-10,10,0,100),this.orthographicCamera.position.z=50,this.orthographicCamera.up=this.camera.up,this.controls=new Gm(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(),this.ambientLight=new Rd(16777215,tp(this.ambientIntensity)),this.scene.add(this.ambientLight),this.directLight=new kd(16777215,tp(this.directIntensity)),this.scene.add(this.directLight),this.setAmbientLight(this.ambientIntensity),this.setDirectLight(this.directIntensity),this.gridHelper=new gm(this.display,this.bbox,this.ticks,this.centerGrid,this.axes0,this.grid,"Z"==n.up,this.theme),this.gridHelper.computeGrid();for(var a=0;a<3;a++)this.scene.add(this.gridHelper.gridHelper[a]);this.gridSize=this.gridHelper.size,this.axesHelper=new vm(this.bbox.center(),this.gridSize/2,2,this.cadWidth,this.height,this.axes0,this.axes,this.theme),this.scene.add(this.axesHelper);const o=1.1*Math.max(Math.abs(this.bbox.min.length()),Math.abs(this.bbox.max.length()));this.clipping=new Nm(this.bbox.center(),2*o,this.nestedGroup,this.display,this.theme),this.display.setSliderLimits(this.gridSize/2,this.bbox.center()),this.setClipNormal(0,n.clipNormal0,!0),this.setClipNormal(1,n.clipNormal1,!0),this.setClipNormal(2,n.clipNormal2,!0),this.clipSlider0=null!=n.clipSlider0?n.clipSlider0:this.gridSize/2,this.clipSlider1=null!=n.clipSlider1?n.clipSlider1:this.gridSize/2,this.clipSlider2=null!=n.clipSlider2?n.clipSlider2:this.gridSize/2,this.setClipSlider(0,this.clipSlider0,!0),this.setClipSlider(1,this.clipSlider1,!0),this.setClipSlider(2,this.clipSlider2,!0),this.setClipIntersection(n.clipIntersection,!0),this.setClipObjectColorCaps(n.clipObjectColors,!0),this.setClipPlaneHelpersCheck(n.clipPlaneHelpers,!0),this.scene.add(this.clipping.planeHelpers),this.nestedGroup.setClipPlanes(this.clipping.clipPlanes),this.setLocalClipping(!1),this.clipping.setVisible(!1),this.display.metalnessSlider.setValue(100*this.metalness),this.display.roughnessSlider.setValue(100*this.roughness),this.display.ambientlightSlider.setValue(100*this.ambientIntensity),this.display.directionallightSlider.setValue(100*this.directIntensity);const l="dark"===this.theme||"browser"===this.theme&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";this.orientationMarker=new _m(80,80,this.camera.getCamera(),l),this.orientationMarker.create(),this.display.updateUI(this.axes,this.axes0,this.ortho,this.transparent,this.blackEdges,this.tools,this.glass),s.split("ui updated"),this.display.autoCollapse(),this.setObjects(this.states,!0,!0),s.split("stencil done"),this.toggleAnimationLoop(this.hasAnimationLoop),this.display.showMeasureTools(n.measureTools),this.ready=!0,this.info.readyMsg(this.gridHelper.ticks,this.control),s.split("show done"),this.notifyCallback&&this.notifyCallback({tab:{old:null,new:this.display.activeTab},target:{old:null,new:this.controls.target},target0:{old:null,new:this.controls.target0},clip_normal_0:{old:null,new:this.clipNormal0},clip_normal_1:{old:null,new:this.clipNormal1},clip_normal_2:{old:null,new:this.clipNormal2}}),s.split("notification done"),this.update(!0,!1),s.split("update done"),s.stop()}setCamera=(t,e,i=null,n=null,s=!0)=>{this.camera.setupCamera(t,new ri(...e),null!=i?new si(...i):null,n,s),this.update(!0,s)};presetCamera=(t,e=null,i=!0)=>{this.camera.target=new ri(...this.bbox.center()),this.camera.presetCamera(t,e,i),this.controls.setTarget(this.camera.target),this.update(!0,i)};getCameraType(){return this.camera.ortho?"ortho":"perspective"}switchCamera(t,e=!0){this.ortho=t,this.camera.switchCamera(t,e),this.controls.setCamera(this.camera.getCamera()),this.display.setOrthoCheck(t),this.checkChanges({ortho:t},e),this.update(!0,e)}recenterCamera(t=!0){const e=this.camera.getCamera(),i=new ri,n=this.bbox.center();i.fromArray(n);const s=new ri,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 ri;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=!1,i=!0)=>{for(var n in this.states){var s=this.states[n],r=t[n],a=this.nestedGroup.groups[n];(e||s[0]!=r[0])&&(a.setShapeVisible(1===r[0]),this.states[n][0]=r[0]),s[1]!=r[1]&&(a.setEdgesVisible(1===r[1]),this.states[n][1]=r[1])}this.checkChanges({states:t},i),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 am(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 rm).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 ri(...t)),this.info.centerInfo(t)}else this.info.bbInfo(t,e,l),this.setBoundingBox(a);else this.removeLastBbox();this.update(!0)};setPickHandler(t){t?this.renderer.domElement.addEventListener("dblclick",this.pick,!1):this.renderer.domElement.removeEventListener("dblclick",this.pick,!1)}pick=t=>{const e=new Np(this.camera,this.renderer.domElement,this.cadWidth,this.height,this.bb_max/30,this.scene.children.slice(0,1),(t=>{}));e.init(),e.onPointerMove(t);const i=e.getIntersectedObjs(t);if(0==i.length)return;var n=i[0];const s={path:n.object.parent.parent.name.replaceAll("|","/"),name:n.object.name,boundingBox:n.object.geometry.boundingBox,boundingSphere:n.object.geometry.boundingSphere,objectGroup:n.object.parent};null!=s&&this.handlePick(s.path,s.name,ep.get(t,"meta"),ep.get(t,"shift")),e.dispose()};clearSelection=()=>{this.nestedGroup.clearSelection(),this.cadTools.handleResetSelection()};_releaseLastSelected=t=>{if(null!=this.lastObject){let e=this.lastObject.objs();for(let t of e)t.unhighlight(!0);t&&(this.lastObject=null)}};_removeLastSelected=()=>{if(null!=this.lastSelection){let t=this.lastSelection.objs();for(let e of t)e.unhighlight(!1);this.lastSelection=null,this.cadTools.handleRemoveLastSelection()}};setRaycastMode(t){t?(this.raycaster=new Np(this.camera,this.renderer.domElement,this.cadWidth,this.height,this.bb_max/30,this.scene.children.slice(0,1),this.handleRaycastEvent),this.raycaster.init()):(this.raycaster.dispose(),this.raycaster=null)}handleRaycast=()=>{const t=this.raycaster.getValidIntersectedObjs();if(t.length>0)for(var e of t){const t=e.object.parent;if(t!==this.lastObject){this._releaseLastSelected(!1);const e=this.raycaster.filters.topoFilter.includes(Cp.solid),i=new Up(t,e);for(let t of i.objs())t.highlight(!0);this.lastObject=i}break}else this._releaseLastSelected(!0)};handleRaycastEvent=t=>{if(t.key)switch(t.key){case"Escape":this.clearSelection();break;case"Backspace":this._removeLastSelected()}else switch(t.mouse){case"left":if(null!=this.lastObject){const t=this.lastObject.objs();for(let e of t)e.toggleSelection();this.cadTools.handleSelectedObj(this.lastObject),this.lastSelection=this.lastObject}break;case"right":this._removeLastSelected()}};handleBackendResponse=t=>{"tool_response"===t.subtype&&this.cadTools.handleResponse(t)};getAxes(){return this.axes}setAxes=(t,e=!0)=>{this.axes=t,this.axesHelper.setVisible(t),this.display.setAxesCheck(t),this.checkChanges({axes:t},e),this.update(this.updateMarker)};setGrid=(t,e,i=!0)=>{this.gridHelper.setGrid(t,e),this.checkChanges({grid:this.gridHelper.grid},i),this.update(this.updateMarker)};getGrids(){return this.grid}setGrids=(t,e=!0)=>{this.gridHelper.setGrids(...t),this.grid=this.gridHelper.grid,this.checkChanges({grid:this.gridHelper.grid},e),this.update(this.updateMarker)};getAxes0(){return this.axes0}setAxes0=(t,e=!0)=>{this.axes0=t,this.gridHelper.setCenter(t,"Z"==this.up),this.display.setAxes0Check(t),this.axesHelper.setCenter(t),this.checkChanges({axes0:t},e),this.update(this.updateMarker)};getMetalness=()=>this.metalness;setMetalness=(t,e=!0)=>{this.metalness=t,this.nestedGroup.setMetalness(t),this.checkChanges({metalness:t},e),this.update(this.updateMarker)};getRoughness=()=>this.roughness;setRoughness=(t,e=!0)=>{this.roughness=t,this.nestedGroup.setRoughness(t),this.checkChanges({roughness:t},e),this.update(this.updateMarker)};resetMaterial=()=>{this.setMetalness(this.materialSettings.metalness,!0),this.display.setMetalness(this.materialSettings.metalness),this.setRoughness(this.materialSettings.roughness,!0),this.display.setRoughness(this.materialSettings.roughness),this.setAmbientLight(this.materialSettings.ambientIntensity,!0),this.display.setAmbientLight(this.materialSettings.ambientIntensity),this.setDirectLight(this.materialSettings.directIntensity,!0),this.display.setDirectLight(this.materialSettings.directIntensity)};getTransparent(){return this.transparent}setTransparent=(t,e=!0)=>{this.transparent=t,this.nestedGroup.setTransparent(t),this.display.setTransparentCheck(t),this.checkChanges({transparent:t},e),this.update(this.updateMarker)};getBlackEdges(){return this.blackEdges}setBlackEdges=(t,e=!0)=>{this.blackEdges=t,this.nestedGroup.setBlackEdges(t),this.display.setBlackEdgesCheck(t),this.checkChanges({black_edges:t},e),this.update(this.updateMarker)};getOrtho(){return this.camera.ortho}setOrtho(t,e=!0){this.switchCamera(t,e)}getCameraZoom(){return this.camera.getZoom()}setCameraZoom(t,e=!0){this.camera.setZoom(t),this.controls.update(),this.update(!0,e)}getCameraPosition(){return this.camera.getPosition().toArray()}setCameraPosition(t,e=!1,i=!0){this.camera.setPosition(t,e),this.controls.update(),this.update(!0,i)}getCameraQuaternion(){return this.camera.getQuaternion().toArray()}setCameraQuaternion(t,e=!0){this.camera.setQuaternion(t),this.controls.update(),this.update(!0,e)}getCameraTarget(){return this.controls.getTarget().toArray()}setCameraTarget(t,e=!0){this.camera.getCamera().lookAt(new ri(...t)),this.controls.setTarget(new ri(...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 ri(...i)),null!=n&&this.camera.setZoom(n),this.controls.update(),this.update(!0,s)}getEdgeColor(){return this.edgeColor}setEdgeColor=(t,e=!0)=>{this.edgeColor=t,this.nestedGroup.setEdgeColor(t),this.update(this.updateMarker,e)};getOpacity(){return this.defaultOpacity}setOpacity=(t,e=!0)=>{this.defaultOpacity=t,this.nestedGroup.setOpacity(t),this.update(this.updateMarker,e)};getTools(){return this.tools}showTools=(t,e=!0)=>{this.tools=t,this.display.showTools(t),this.update(this.updateMarker,e)};getAmbientLight(){return this.ambientIntensity}setAmbientLight=(t,e=!0)=>{this.ambientIntensity=t,this.ambientLight.intensity=tp(t),this.checkChanges({ambient_intensity:t},e),this.update(this.updateMarker,e)};getDirectLight(){return this.directIntensity}setDirectLight=(t,e=!0)=>{this.directIntensity=t,this.directLight.intensity=tp(t),this.checkChanges({direct_intensity:t},e),this.update(this.updateMarker,e)};getStates(){return this.states}getState(t){var e=t.replaceAll("|","/");return this.getStates()[e]}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)=>{if(null!=t){for(var i of(this.clipIntersection=t,this.nestedGroup.setClipIntersection(t),this.display.setClipIntersectionCheck(t),this.nestedGroup.rootGroup.children))if("PlaneMeshes"==i.name)for(var n of i.children)n.material.clippingPlanes=t?this.clipping.reverseClipPlanes.filter(((t,e)=>e!==n.index)):this.clipping.clipPlanes.filter(((t,e)=>e!==n.index));for(i of this.scene.children)if("PlaneHelpers"==i.name)for(var s of i.children)s.material.clippingPlanes=t?this.clipping.reverseClipPlanes.filter(((t,e)=>e!==s.index)):this.clipping.clipPlanes.filter(((t,e)=>e!==s.index));this.checkChanges({clip_intersection:t},e),this.update(this.updateMarker)}};getObjectColorCaps=()=>this.clipping.getObjectColorCaps();setClipObjectColorCaps=(t,e=!0)=>{null!=t&&(this.clipping.setObjectColorCaps(t),this.display.setClipObjectColorsCheck(t),this.checkChanges({clip_object_colors:t},e),this.update(this.updateMarker))};getClipPlaneHelpers(){return this.clipPlaneHelpers}setClipPlaneHelpersCheck(t){null!=t&&this.display.setClipPlaneHelpersCheck(t)}setClipPlaneHelpers=(t,e=!0)=>{null!=t&&(this.clipPlaneHelpers=t,this.clipping.planeHelpers.visible=t,this.display.setClipPlaneHelpersCheck(t),this.checkChanges({clip_planes:t},e),this.update(this.updateMarker))};getClipNormal(t){return this.clipNormals[t]}setClipNormal(t,e,i=!0){if(null==e)return;const n=new ri(...e).normalize().toArray();this.clipNormals[t]=n,this.clipping.setNormal(t,new ri(...n)),this.clipping.setConstant(t,this.gridSize/2),this.setClipSlider(t,this.gridSize/2);var s={};s[`clip_normal_${t}`]=n,this.checkChanges(s,i),this.nestedGroup.setClipPlanes(this.clipping.clipPlanes),this.update(this.updateMarker)}setClipNormalFromPosition=(t,e=!0)=>{const i=this.camera.getPosition().clone().sub(this.controls.getTarget()).normalize().negate().toArray();this.setClipNormal(t,i,e)};getClipSlider=t=>this.display.clipSliders[t].getValue();setClipSlider=(t,e,i=!0)=>{-1!=e&&null!=e&&this.display.clipSliders[t].setValue(e,i)};getResetLocation=()=>{const t=this.controls.getResetLocation();return{target0:t.target0.toArray(),position0:t.position0.toArray(),quaternion0:t.quaternion0.toArray(),zoom0:t.zoom0}};setResetLocation=(t,e,i,n,s=!0)=>{var r=this.getResetLocation();this.controls.setResetLocation(new ri(...t),new ri(...e),new Qe(...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,e=t[t.length-1];this.renderer.setViewport(0,0,this.cadWidth,this.height),this.renderer.render(this.scene,this.camera.getCamera()),e.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 ri,r=new ri,a=null,o=null,l=null;n||(new li).setFromObject(this.nestedGroup.rootGroup).getCenter(s);for(var c in this.nestedGroup.groups){var h=this.nestedGroup.groups[c],d=new li;h instanceof dm&&d.expandByObject(h),d.isEmpty()||(d.getCenter(r),a=r.sub(s),o=h.parent.worldToLocal(a.clone()),(l=h.parent.worldToLocal(a.clone().multiplyScalar(i))).sub(o),this.addAnimationTrack(c,"t",[0,t],[[0,0,0],l.toArray()]))}this.initAnimation(t,e,"E",!1)}trimUI(t,e){var i=e?"inline-block":"none";for(var n of t){var s;["axes","axes0","grid","ortho","more","help"].includes(n)&&("more"!=n?((s=this.display._getElement(`tcv_${n}`)).style.display=i,"help"!==n&&(s.nextElementSibling.style.display=i)):(s=this.display._getElement(`tcv_${n}-dropdown`)).style.display=i)}}setKeyMap(t){const e=ep.get_config();ep.set(t),this.display.updateHelp(e,t)}resizeCadView(t,e,i,n=!1){this.cadWidth=t,this.height=i,this.renderer.setSize(t,i),this.display.setSizes({treeWidth:e,cadWidth:t,height:i}),this.display.glassMode(n);const s=t+(n?0:e);this.display.handleMoreButton(s),this.camera.changeDimensions(this.bb_radius,t,i),this.update(!0),this.raycaster&&(this.raycaster.width=t,this.raycaster.height=i)}vector3(t=0,e=0,i=0){return new ri(t,e,i)}quaternion(t=0,e=0,i=0,n=1){return new si(t,e,i,n)}}}));
|