(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,76148,e=>{"use strict";let t,i,n,r,a,s,o,l,h,c,u,d,A,p,g;e.s(["default",()=>fb],76148);var m,f,v,_,y,E,x,S,C,I,M,w,b,T,B,R,L,D,U,P,N,F,Q,O,k,G,H,z,V,W,q,X,j,Y,K,J,Z,$,ee,et,ei,en,er,ea=e.i(43476),es=e.i(71645);function eo(e){return(t,i)=>void 0!==i?void t.constructor.createProperty(i,e):"method"!==t.kind||!t.descriptor||"value"in t.descriptor?{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(i){i.createProperty(t.key,e)}}:{...t,finisher(i){i.createProperty(t.key,e)}}}null!=(null==(m=window.HTMLSlotElement)?void 0:m.prototype.assignedElements)||((e,t)=>e.assignedNodes(t).filter(e=>e.nodeType===Node.ELEMENT_NODE));let el="attached",eh="srgb",ec="srgb-linear",eu="display-p3",ed="display-p3-linear",eA="linear",ep="srgb",eg="rec709",em="300 es";class ef{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let i=this._listeners[e];if(void 0!==i){let e=i.indexOf(t);-1!==e&&i.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners[e.type];if(void 0!==t){e.target=this;let i=t.slice(0);for(let t=0,n=i.length;t>8&255]+ev[e>>16&255]+ev[e>>24&255]+"-"+ev[255&t]+ev[t>>8&255]+"-"+ev[t>>16&15|64]+ev[t>>24&255]+"-"+ev[63&i|128]+ev[i>>8&255]+"-"+ev[i>>16&255]+ev[i>>24&255]+ev[255&n]+ev[n>>8&255]+ev[n>>16&255]+ev[n>>24&255]).toLowerCase()}function ex(e,t,i){return Math.max(t,Math.min(i,e))}function eS(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/0xffffffff;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/0x7fffffff,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function eC(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(0xffffffff*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(0x7fffffff*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}let eI={degToRad:function(e){return e*e_},radToDeg:function(e){return e*ey},normalize:eC};class eM{get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,i=this.y,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6],this.y=n[1]*t+n[4]*i+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,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(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(ex(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let i=Math.cos(t),n=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*i-a*n+e.x,this.y=r*n+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}constructor(e=0,t=0){eM.prototype.isVector2=!0,this.x=e,this.y=t}}class ew{set(e,t,i,n,r,a,s,o,l){let h=this.elements;return h[0]=e,h[1]=n,h[2]=s,h[3]=t,h[4]=r,h[5]=o,h[6]=i,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,r=this.elements,a=i[0],s=i[3],o=i[6],l=i[1],h=i[4],c=i[7],u=i[2],d=i[5],A=i[8],p=n[0],g=n[3],m=n[6],f=n[1],v=n[4],_=n[7],y=n[2],E=n[5],x=n[8];return r[0]=a*p+s*f+o*y,r[3]=a*g+s*v+o*E,r[6]=a*m+s*_+o*x,r[1]=l*p+h*f+c*y,r[4]=l*g+h*v+c*E,r[7]=l*m+h*_+c*x,r[2]=u*p+d*f+A*y,r[5]=u*g+d*v+A*E,r[8]=u*m+d*_+A*x,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8];return t*a*h-t*s*l-i*r*h+i*s*o+n*r*l-n*a*o}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8],c=h*a-s*l,u=s*o-h*r,d=l*r-a*o,A=t*c+i*u+n*d;if(0===A)return this.set(0,0,0,0,0,0,0,0,0);let p=1/A;return e[0]=c*p,e[1]=(n*l-h*i)*p,e[2]=(s*i-n*a)*p,e[3]=u*p,e[4]=(h*t-n*o)*p,e[5]=(n*r-s*t)*p,e[6]=d*p,e[7]=(i*o-l*t)*p,e[8]=(a*t-i*r)*p,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,n,r,a,s){let o=Math.cos(r),l=Math.sin(r);return this.set(i*o,i*l,-i*(o*a+l*s)+a+e,-n*l,n*o,-n*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(eb.makeScale(e,t)),this}rotate(e){return this.premultiply(eb.makeRotation(-e)),this}translate(e,t){return this.premultiply(eb.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,i=e.elements;for(let e=0;e<9;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}constructor(e,t,i,n,r,a,s,o,l){ew.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,i,n,r,a,s,o,l)}}let eb=new ew;function eT(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function eB(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let eR={};function eL(e){e in eR||(eR[e]=!0,console.warn(e))}let eD=new ew().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),eU=new ew().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),eP={[ec]:{transfer:eA,primaries:eg,toReference:e=>e,fromReference:e=>e},[eh]:{transfer:ep,primaries:eg,toReference:e=>e.convertSRGBToLinear(),fromReference:e=>e.convertLinearToSRGB()},[ed]:{transfer:eA,primaries:"p3",toReference:e=>e.applyMatrix3(eU),fromReference:e=>e.applyMatrix3(eD)},[eu]:{transfer:ep,primaries:"p3",toReference:e=>e.convertSRGBToLinear().applyMatrix3(eU),fromReference:e=>e.applyMatrix3(eD).convertLinearToSRGB()}},eN=new Set([ec,ed]),eF={enabled:!0,_workingColorSpace:ec,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(colorSpace){if(!eN.has(colorSpace))throw Error('Unsupported working color space, "'.concat(colorSpace,'".'));this._workingColorSpace=colorSpace},convert:function(e,t,i){if(!1===this.enabled||t===i||!t||!i)return e;let n=eP[t].toReference;return(0,eP[i].fromReference)(n(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this._workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this._workingColorSpace)},getPrimaries:function(e){return eP[e].primaries},getTransfer:function(e){return""===e?eA:eP[e].transfer}};function eQ(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function eO(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class ek{static getDataURL(e){let i;if(/^data:/i.test(e.src)||"undefined"==typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)i=e;else{void 0===t&&(t=eB("canvas")),t.width=e.width,t.height=e.height;let n=t.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),i=t}return i.width>2048||i.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),i.toDataURL("image/jpeg",.6)):i.toDataURL("image/png")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){let t=eB("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let n=i.getImageData(0,0,e.width,e.height),r=n.data;for(let e=0;e0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}constructor(e=eW.DEFAULT_IMAGE,t=eW.DEFAULT_MAPPING,i=1001,n=1001,r=1006,a=1008,s=1023,o=1009,l=eW.DEFAULT_ANISOTROPY,h=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:eV++}),this.uuid=eE(),this.name="",this.source=new eH(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new eM(0,0),this.repeat=new eM(1,1),this.center=new eM(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ew,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}}eW.DEFAULT_IMAGE=null,eW.DEFAULT_MAPPING=300,eW.DEFAULT_ANISOTROPY=1;class eq{get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,n){return this.x=e,this.y=t,this.z=i,this.w=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*t+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*t+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*t+a[7]*i+a[11]*n+a[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,n,r,a=e.elements,s=a[0],o=a[4],l=a[8],h=a[1],c=a[5],u=a[9],d=a[2],A=a[6],p=a[10];if(.01>Math.abs(o-h)&&.01>Math.abs(l-d)&&.01>Math.abs(u-A)){if(.1>Math.abs(o+h)&&.1>Math.abs(l+d)&&.1>Math.abs(u+A)&&.1>Math.abs(s+c+p-3))return this.set(1,0,0,0),this;t=Math.PI;let e=(s+1)/2,a=(c+1)/2,g=(p+1)/2,m=(o+h)/4,f=(l+d)/4,v=(u+A)/4;return e>a&&e>g?e<.01?(i=0,n=.707106781,r=.707106781):(n=m/(i=Math.sqrt(e)),r=f/i):a>g?a<.01?(i=.707106781,n=0,r=.707106781):(i=m/(n=Math.sqrt(a)),r=v/n):g<.01?(i=.707106781,n=.707106781,r=0):(i=f/(r=Math.sqrt(g)),n=v/r),this.set(i,n,r,t),this}let g=Math.sqrt((A-u)*(A-u)+(l-d)*(l-d)+(h-o)*(h-o));return .001>Math.abs(g)&&(g=1),this.x=(A-u)/g,this.y=(l-d)/g,this.z=(h-o)/g,this.w=Math.acos((s+c+p-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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}constructor(e=0,t=0,i=0,n=1){eq.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=n}}class eX extends ef{get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let n=0,r=this.textures.length;n=0?1:-1,n=1-t*t;if(n>Number.EPSILON){let r=Math.sqrt(n),a=Math.atan2(r,t*i);e=Math.sin(e*a)/r,s=Math.sin(s*a)/r}let r=s*i;if(o=o*e+u*r,l=l*e+d*r,h=h*e+A*r,c=c*e+p*r,e===1-s){let e=1/Math.sqrt(o*o+l*l+h*h+c*c);o*=e,l*=e,h*=e,c*=e}}e[t]=o,e[t+1]=l,e[t+2]=h,e[t+3]=c}static multiplyQuaternionsFlat(e,t,i,n,r,a){let s=i[n],o=i[n+1],l=i[n+2],h=i[n+3],c=r[a],u=r[a+1],d=r[a+2],A=r[a+3];return e[t]=s*A+h*c+o*d-l*u,e[t+1]=o*A+h*u+l*c-s*d,e[t+2]=l*A+h*d+s*u-o*c,e[t+3]=h*A-s*c-o*u-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,n){return this._x=e,this._y=t,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=e._x,n=e._y,r=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(i/2),h=s(n/2),c=s(r/2),u=o(i/2),d=o(n/2),A=o(r/2);switch(a){case"XYZ":this._x=u*h*c+l*d*A,this._y=l*d*c-u*h*A,this._z=l*h*A+u*d*c,this._w=l*h*c-u*d*A;break;case"YXZ":this._x=u*h*c+l*d*A,this._y=l*d*c-u*h*A,this._z=l*h*A-u*d*c,this._w=l*h*c+u*d*A;break;case"ZXY":this._x=u*h*c-l*d*A,this._y=l*d*c+u*h*A,this._z=l*h*A+u*d*c,this._w=l*h*c-u*d*A;break;case"ZYX":this._x=u*h*c-l*d*A,this._y=l*d*c+u*h*A,this._z=l*h*A-u*d*c,this._w=l*h*c+u*d*A;break;case"YZX":this._x=u*h*c+l*d*A,this._y=l*d*c+u*h*A,this._z=l*h*A-u*d*c,this._w=l*h*c-u*d*A;break;case"XZY":this._x=u*h*c-l*d*A,this._y=l*d*c-u*h*A,this._z=l*h*A+u*d*c,this._w=l*h*c+u*d*A;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],n=t[4],r=t[8],a=t[1],s=t[5],o=t[9],l=t[2],h=t[6],c=t[10],u=i+s+c;if(u>0){let e=.5/Math.sqrt(u+1);this._w=.25/e,this._x=(h-o)*e,this._y=(r-l)*e,this._z=(a-n)*e}else if(i>s&&i>c){let e=2*Math.sqrt(1+i-s-c);this._w=(h-o)/e,this._x=.25*e,this._y=(n+a)/e,this._z=(r+l)/e}else if(s>c){let e=2*Math.sqrt(1+s-i-c);this._w=(r-l)/e,this._x=(n+a)/e,this._y=.25*e,this._z=(o+h)/e}else{let e=2*Math.sqrt(1+c-i-s);this._w=(a-n)/e,this._x=(r+l)/e,this._y=(o+h)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x),this._w=i,this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ex(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(0===i)return this;let n=Math.min(1,t/i);return this.slerp(e,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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let i=e._x,n=e._y,r=e._z,a=e._w,s=t._x,o=t._y,l=t._z,h=t._w;return this._x=i*h+a*s+n*l-r*o,this._y=n*h+a*o+r*s-i*l,this._z=r*h+a*l+i*o-n*s,this._w=a*h-i*s-n*o-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);let i=this._x,n=this._y,r=this._z,a=this._w,s=a*e._w+i*e._x+n*e._y+r*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=a,this._x=i,this._y=n,this._z=r,this;let o=1-s*s;if(o<=Number.EPSILON){let e=1-t;return this._w=e*a+t*this._w,this._x=e*i+t*this._x,this._y=e*n+t*this._y,this._z=e*r+t*this._z,this.normalize(),this}let l=Math.sqrt(o),h=Math.atan2(l,s),c=Math.sin((1-t)*h)/l,u=Math.sin(t*h)/l;return this._w=a*c+this._w*u,this._x=i*c+this._x*u,this._y=n*c+this._y*u,this._z=r*c+this._z*u,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(n*Math.sin(e),n*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}constructor(e=0,t=0,i=0,n=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=n}}class eZ{set(e,t,i){return void 0===i&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(e0.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(e0.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*n,this.y=r[1]*t+r[4]*i+r[7]*n,this.z=r[2]*t+r[5]*i+r[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,r=e.elements,a=1/(r[3]*t+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*n+r[12])*a,this.y=(r[1]*t+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*t+r[6]*i+r[10]*n+r[14])*a,this}applyQuaternion(e){let t=this.x,i=this.y,n=this.z,r=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*n-s*i),h=2*(s*t-r*n),c=2*(r*i-a*t);return this.x=t+o*l+a*c-s*h,this.y=i+o*h+s*l-r*c,this.z=n+o*c+r*h-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n,this.y=r[1]*t+r[5]*i+r[9]*n,this.z=r[2]*t+r[6]*i+r[10]*n,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,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(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let i=e.x,n=e.y,r=e.z,a=t.x,s=t.y,o=t.z;return this.x=n*o-r*s,this.y=r*a-i*o,this.z=i*s-n*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return e$.copy(this).projectOnVector(e),this.sub(e$)}reflect(e){return this.sub(e$.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(ex(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){let n=Math.sin(t)*e;return this.x=n*Math.sin(i),this.y=Math.cos(t)*e,this.z=n*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=2*Math.random()-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}constructor(e=0,t=0,i=0){eZ.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}}let e$=new eZ,e0=new eJ;class e1{set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=Infinity,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x1&&void 0!==arguments[1]&&arguments[1];e.updateWorldMatrix(!1,!1);let i=e.geometry;if(void 0!==i){let n=i.getAttribute("position");if(!0===t&&void 0!==n&&!0!==e.isInstancedMesh)for(let t=0,i=n.count;tthis.max.x)&&!(e.ythis.max.y)&&!(e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x)&&!(e.max.ythis.max.y)&&!(e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,e3),e3.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(tt),ti.subVectors(this.max,tt),e5.subVectors(e.a,tt),e8.subVectors(e.b,tt),e6.subVectors(e.c,tt),e9.subVectors(e8,e5),e7.subVectors(e6,e8),te.subVectors(e5,e6);let t=[0,-e9.z,e9.y,0,-e7.z,e7.y,0,-te.z,te.y,e9.z,0,-e9.x,e7.z,0,-e7.x,te.z,0,-te.x,-e9.y,e9.x,0,-e7.y,e7.x,0,-te.y,te.x,0];return!!ta(t,e5,e8,e6,ti)&&!!ta(t=[1,0,0,0,1,0,0,0,1],e5,e8,e6,ti)&&(tn.crossVectors(e9,e7),ta(t=[tn.x,tn.y,tn.z],e5,e8,e6,ti))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,e3).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(e3).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(e2[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),e2[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),e2[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),e2[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),e2[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),e2[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),e2[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),e2[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(e2)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}constructor(e=new eZ(Infinity,Infinity,Infinity),t=new eZ(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}}let e2=[new eZ,new eZ,new eZ,new eZ,new eZ,new eZ,new eZ,new eZ],e3=new eZ,e4=new e1,e5=new eZ,e8=new eZ,e6=new eZ,e9=new eZ,e7=new eZ,te=new eZ,tt=new eZ,ti=new eZ,tn=new eZ,tr=new eZ;function ta(e,t,i,n,r){for(let a=0,s=e.length-3;a<=s;a+=3){tr.fromArray(e,a);let s=r.x*Math.abs(tr.x)+r.y*Math.abs(tr.y)+r.z*Math.abs(tr.z),o=t.dot(tr),l=i.dot(tr),h=n.dot(tr);if(Math.max(-Math.max(o,l,h),Math.min(o,l,h))>s)return!1}return!0}let ts=new e1,to=new eZ,tl=new eZ;class th{set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;void 0!==t?i.copy(t):ts.setFromPoints(e).getCenter(i);let n=0;for(let t=0,r=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?e.makeEmpty():(e.set(this.center,this.center),e.expandByScalar(this.radius)),e}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;to.subVectors(e,this.center);let t=to.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),i=(e-this.radius)*.5;this.center.addScaledVector(to,i/e),this.radius+=i}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(tl.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(to.copy(e.center).add(tl)),this.expandByPoint(to.copy(e.center).sub(tl)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}constructor(e=new eZ,t=-1){this.isSphere=!0,this.center=e,this.radius=t}}let tc=new eZ,tu=new eZ,td=new eZ,tA=new eZ,tp=new eZ,tg=new eZ,tm=new eZ;class tf{set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,tc)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=tc.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(tc.copy(this.origin).addScaledVector(this.direction,t),tc.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){let r,a,s,o;tu.copy(e).add(t).multiplyScalar(.5),td.copy(t).sub(e).normalize(),tA.copy(this.origin).sub(tu);let l=.5*e.distanceTo(t),h=-this.direction.dot(td),c=tA.dot(this.direction),u=-tA.dot(td),d=tA.lengthSq(),A=Math.abs(1-h*h);if(A>0)if(r=h*u-c,a=h*c-u,o=l*A,r>=0)if(a>=-o)if(a<=o){let e=1/A;r*=e,a*=e,s=r*(r+h*a+2*c)+a*(h*r+a+2*u)+d}else s=-(r=Math.max(0,-(h*(a=l)+c)))*r+a*(a+2*u)+d;else s=-(r=Math.max(0,-(h*(a=-l)+c)))*r+a*(a+2*u)+d;else a<=-o?(a=(r=Math.max(0,-(-h*l+c)))>0?-l:Math.min(Math.max(-l,-u),l),s=-r*r+a*(a+2*u)+d):a<=o?(r=0,s=(a=Math.min(Math.max(-l,-u),l))*(a+2*u)+d):(a=(r=Math.max(0,-(h*l+c)))>0?l:Math.min(Math.max(-l,-u),l),s=-r*r+a*(a+2*u)+d);else a=h>0?-l:l,s=-(r=Math.max(0,-(h*a+c)))*r+a*(a+2*u)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,r),n&&n.copy(tu).addScaledVector(td,a),s}intersectSphere(e,t){tc.subVectors(e.center,this.origin);let i=tc.dot(this.direction),n=tc.dot(tc)-i*i,r=e.radius*e.radius;if(n>r)return null;let a=Math.sqrt(r-n),s=i-a,o=i+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return null===i?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return!!(0===t||e.normal.dot(this.direction)*t<0)}intersectBox(e,t){let i,n,r,a,s,o,l=1/this.direction.x,h=1/this.direction.y,c=1/this.direction.z,u=this.origin;return(l>=0?(i=(e.min.x-u.x)*l,n=(e.max.x-u.x)*l):(i=(e.max.x-u.x)*l,n=(e.min.x-u.x)*l),h>=0?(r=(e.min.y-u.y)*h,a=(e.max.y-u.y)*h):(r=(e.max.y-u.y)*h,a=(e.min.y-u.y)*h),i>a||r>n||((r>i||isNaN(i))&&(i=r),(a=0?(s=(e.min.z-u.z)*c,o=(e.max.z-u.z)*c):(s=(e.max.z-u.z)*c,o=(e.min.z-u.z)*c),i>o||s>n||((s>i||i!=i)&&(i=s),(o=0?i:n,t)}intersectsBox(e){return null!==this.intersectBox(e,tc)}intersectTriangle(e,t,i,n,r){let a;tp.subVectors(t,e),tg.subVectors(i,e),tm.crossVectors(tp,tg);let s=this.direction.dot(tm);if(s>0){if(n)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}tA.subVectors(this.origin,e);let o=a*this.direction.dot(tg.crossVectors(tA,tg));if(o<0)return null;let l=a*this.direction.dot(tp.cross(tA));if(l<0||o+l>s)return null;let h=-a*tA.dot(tm);return h<0?null:this.at(h/s,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}constructor(e=new eZ,t=new eZ(0,0,-1)){this.origin=e,this.direction=t}}class tv{set(e,t,i,n,r,a,s,o,l,h,c,u,d,A,p,g){let m=this.elements;return m[0]=e,m[4]=t,m[8]=i,m[12]=n,m[1]=r,m[5]=a,m[9]=s,m[13]=o,m[2]=l,m[6]=h,m[10]=c,m[14]=u,m[3]=d,m[7]=A,m[11]=p,m[15]=g,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 tv().fromArray(this.elements)}copy(e){let t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,i=e.elements,n=1/t_.setFromMatrixColumn(e,0).length(),r=1/t_.setFromMatrixColumn(e,1).length(),a=1/t_.setFromMatrixColumn(e,2).length();return t[0]=i[0]*n,t[1]=i[1]*n,t[2]=i[2]*n,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,i=e.x,n=e.y,r=e.z,a=Math.cos(i),s=Math.sin(i),o=Math.cos(n),l=Math.sin(n),h=Math.cos(r),c=Math.sin(r);if("XYZ"===e.order){let e=a*h,i=a*c,n=s*h,r=s*c;t[0]=o*h,t[4]=-o*c,t[8]=l,t[1]=i+n*l,t[5]=e-r*l,t[9]=-s*o,t[2]=r-e*l,t[6]=n+i*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*h,i=o*c,n=l*h,r=l*c;t[0]=e+r*s,t[4]=n*s-i,t[8]=a*l,t[1]=a*c,t[5]=a*h,t[9]=-s,t[2]=i*s-n,t[6]=r+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*h,i=o*c,n=l*h,r=l*c;t[0]=e-r*s,t[4]=-a*c,t[8]=n+i*s,t[1]=i+n*s,t[5]=a*h,t[9]=r-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*h,i=a*c,n=s*h,r=s*c;t[0]=o*h,t[4]=n*l-i,t[8]=e*l+r,t[1]=o*c,t[5]=r*l+e,t[9]=i*l-n,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,i=a*l,n=s*o,r=s*l;t[0]=o*h,t[4]=r-e*c,t[8]=n*c+i,t[1]=c,t[5]=a*h,t[9]=-s*h,t[2]=-l*h,t[6]=i*c+n,t[10]=e-r*c}else if("XZY"===e.order){let e=a*o,i=a*l,n=s*o,r=s*l;t[0]=o*h,t[4]=-c,t[8]=l*h,t[1]=e*c+r,t[5]=a*h,t[9]=i*c-n,t[2]=n*c-i,t[6]=s*h,t[10]=r*c+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(tE,e,tx)}lookAt(e,t,i){let n=this.elements;return tI.subVectors(e,t),0===tI.lengthSq()&&(tI.z=1),tI.normalize(),tS.crossVectors(i,tI),0===tS.lengthSq()&&(1===Math.abs(i.z)?tI.x+=1e-4:tI.z+=1e-4,tI.normalize(),tS.crossVectors(i,tI)),tS.normalize(),tC.crossVectors(tI,tS),n[0]=tS.x,n[4]=tC.x,n[8]=tI.x,n[1]=tS.y,n[5]=tC.y,n[9]=tI.y,n[2]=tS.z,n[6]=tC.z,n[10]=tI.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,r=this.elements,a=i[0],s=i[4],o=i[8],l=i[12],h=i[1],c=i[5],u=i[9],d=i[13],A=i[2],p=i[6],g=i[10],m=i[14],f=i[3],v=i[7],_=i[11],y=i[15],E=n[0],x=n[4],S=n[8],C=n[12],I=n[1],M=n[5],w=n[9],b=n[13],T=n[2],B=n[6],R=n[10],L=n[14],D=n[3],U=n[7],P=n[11],N=n[15];return r[0]=a*E+s*I+o*T+l*D,r[4]=a*x+s*M+o*B+l*U,r[8]=a*S+s*w+o*R+l*P,r[12]=a*C+s*b+o*L+l*N,r[1]=h*E+c*I+u*T+d*D,r[5]=h*x+c*M+u*B+d*U,r[9]=h*S+c*w+u*R+d*P,r[13]=h*C+c*b+u*L+d*N,r[2]=A*E+p*I+g*T+m*D,r[6]=A*x+p*M+g*B+m*U,r[10]=A*S+p*w+g*R+m*P,r[14]=A*C+p*b+g*L+m*N,r[3]=f*E+v*I+_*T+y*D,r[7]=f*x+v*M+_*B+y*U,r[11]=f*S+v*w+_*R+y*P,r[15]=f*C+v*b+_*L+y*N,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],i=e[4],n=e[8],r=e[12],a=e[1],s=e[5],o=e[9],l=e[13],h=e[2],c=e[6],u=e[10],d=e[14],A=e[3],p=e[7];return A*(r*o*c-n*l*c-r*s*u+i*l*u+n*s*d-i*o*d)+p*(t*o*d-t*l*u+r*a*u-n*a*d+n*l*h-r*o*h)+e[11]*(t*l*c-t*s*d-r*a*c+i*a*d+r*s*h-i*l*h)+e[15]*(-n*s*h-t*o*c+t*s*u+n*a*c-i*a*u+i*o*h)}transpose(){let e,t=this.elements;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(e,t,i){let n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],h=e[8],c=e[9],u=e[10],d=e[11],A=e[12],p=e[13],g=e[14],m=e[15],f=c*g*l-p*u*l+p*o*d-s*g*d-c*o*m+s*u*m,v=A*u*l-h*g*l-A*o*d+a*g*d+h*o*m-a*u*m,_=h*p*l-A*c*l+A*s*d-a*p*d-h*s*m+a*c*m,y=A*c*o-h*p*o-A*s*u+a*p*u+h*s*g-a*c*g,E=t*f+i*v+n*_+r*y;if(0===E)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let x=1/E;return e[0]=f*x,e[1]=(p*u*r-c*g*r-p*n*d+i*g*d+c*n*m-i*u*m)*x,e[2]=(s*g*r-p*o*r+p*n*l-i*g*l-s*n*m+i*o*m)*x,e[3]=(c*o*r-s*u*r-c*n*l+i*u*l+s*n*d-i*o*d)*x,e[4]=v*x,e[5]=(h*g*r-A*u*r+A*n*d-t*g*d-h*n*m+t*u*m)*x,e[6]=(A*o*r-a*g*r-A*n*l+t*g*l+a*n*m-t*o*m)*x,e[7]=(a*u*r-h*o*r+h*n*l-t*u*l-a*n*d+t*o*d)*x,e[8]=_*x,e[9]=(A*c*r-h*p*r-A*i*d+t*p*d+h*i*m-t*c*m)*x,e[10]=(a*p*r-A*s*r+A*i*l-t*p*l-a*i*m+t*s*m)*x,e[11]=(h*s*r-a*c*r-h*i*l+t*c*l+a*i*d-t*s*d)*x,e[12]=y*x,e[13]=(h*p*n-A*c*n+A*i*u-t*p*u-h*i*g+t*c*g)*x,e[14]=(A*s*n-a*p*n-A*i*o+t*p*o+a*i*g-t*s*g)*x,e[15]=(a*c*n-h*s*n+h*i*o-t*c*o-a*i*u+t*s*u)*x,this}scale(e){let t=this.elements,i=e.x,n=e.y,r=e.z;return t[0]*=i,t[4]*=n,t[8]*=r,t[1]*=i,t[5]*=n,t[9]*=r,t[2]*=i,t[6]*=n,t[10]*=r,t[3]*=i,t[7]*=n,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];return Math.sqrt(Math.max(t,e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let i=Math.cos(t),n=Math.sin(t),r=1-i,a=e.x,s=e.y,o=e.z,l=r*a,h=r*s;return this.set(l*a+i,l*s-n*o,l*o+n*s,0,l*s+n*o,h*s+i,h*o-n*a,0,l*o-n*s,h*o+n*a,r*o*o+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,n,r,a){return this.set(1,i,r,0,e,1,a,0,t,n,1,0,0,0,0,1),this}compose(e,t,i){let n=this.elements,r=t._x,a=t._y,s=t._z,o=t._w,l=r+r,h=a+a,c=s+s,u=r*l,d=r*h,A=r*c,p=a*h,g=a*c,m=s*c,f=o*l,v=o*h,_=o*c,y=i.x,E=i.y,x=i.z;return n[0]=(1-(p+m))*y,n[1]=(d+_)*y,n[2]=(A-v)*y,n[3]=0,n[4]=(d-_)*E,n[5]=(1-(u+m))*E,n[6]=(g+f)*E,n[7]=0,n[8]=(A+v)*x,n[9]=(g-f)*x,n[10]=(1-(u+p))*x,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,i){let n=this.elements,r=t_.set(n[0],n[1],n[2]).length(),a=t_.set(n[4],n[5],n[6]).length(),s=t_.set(n[8],n[9],n[10]).length();0>this.determinant()&&(r=-r),e.x=n[12],e.y=n[13],e.z=n[14],ty.copy(this);let o=1/r,l=1/a,h=1/s;return ty.elements[0]*=o,ty.elements[1]*=o,ty.elements[2]*=o,ty.elements[4]*=l,ty.elements[5]*=l,ty.elements[6]*=l,ty.elements[8]*=h,ty.elements[9]*=h,ty.elements[10]*=h,t.setFromRotationMatrix(ty),i.x=r,i.y=a,i.z=s,this}makePerspective(e,t,i,n,r,a){let s,o,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2e3,h=this.elements;if(2e3===l)s=-(a+r)/(a-r),o=-2*a*r/(a-r);else if(2001===l)s=-a/(a-r),o=-a*r/(a-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+l);return h[0]=2*r/(t-e),h[4]=0,h[8]=(t+e)/(t-e),h[12]=0,h[1]=0,h[5]=2*r/(i-n),h[9]=(i+n)/(i-n),h[13]=0,h[2]=0,h[6]=0,h[10]=s,h[14]=o,h[3]=0,h[7]=0,h[11]=-1,h[15]=0,this}makeOrthographic(e,t,i,n,r,a){let s,o,l=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2e3,h=this.elements,c=1/(t-e),u=1/(i-n),d=1/(a-r);if(2e3===l)s=(a+r)*d,o=-2*d;else if(2001===l)s=r*d,o=-1*d;else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+l);return h[0]=2*c,h[4]=0,h[8]=0,h[12]=-((t+e)*c),h[1]=0,h[5]=2*u,h[9]=0,h[13]=-((i+n)*u),h[2]=0,h[6]=0,h[10]=o,h[14]=-s,h[3]=0,h[7]=0,h[11]=0,h[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let e=0;e<16;e++)if(t[e]!==i[e])return!1;return!0}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}constructor(e,t,i,n,r,a,s,o,l,h,c,u,d,A,p,g){tv.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,i,n,r,a,s,o,l,h,c,u,d,A,p,g)}}let t_=new eZ,ty=new tv,tE=new eZ(0,0,0),tx=new eZ(1,1,1),tS=new eZ,tC=new eZ,tI=new eZ,tM=new tv,tw=new eJ;class tb{get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=e.elements,r=n[0],a=n[4],s=n[8],o=n[1],l=n[5],h=n[9],c=n[2],u=n[6],d=n[10];switch(t){case"XYZ":this._y=Math.asin(ex(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-h,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-ex(h,-1,1)),.9999999>Math.abs(h)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(ex(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-ex(c,-1,1)),.9999999>Math.abs(c)?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(ex(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-ex(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(u,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-h,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===i&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return tM.makeRotationFromQuaternion(e),this.setFromRotationMatrix(tM,t,i)}setFromVector3(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}reorder(e){return tw.setFromEuler(this),this.setFromQuaternion(tw,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}constructor(e=0,t=0,i=0,n=tb.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=n}}tb.DEFAULT_ORDER="XYZ";class tT{set(e){this.mask=1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:[];this[e]===t&&i.push(this);let n=this.children;for(let r=0,a=n.length;r0&&(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(e=>({boxInitialized:e.boxInitialized,boxMin:e.box.min.toArray(),boxMax:e.box.max.toArray(),sphereInitialized:e.sphereInitialized,sphereRadius:e.sphere.radius,sphereCenter:e.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(e),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(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=r(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let i=t.shapes;if(Array.isArray(i))for(let t=0,n=i.length;t0){n.children=[];for(let t=0;t0){n.animations=[];for(let t=0;t0&&(i.geometries=t),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),s.length>0&&(i.images=s),o.length>0&&(i.shapes=o),l.length>0&&(i.skeletons=l),h.length>0&&(i.animations=h),c.length>0&&(i.nodes=c)}return i.object=n,i;function a(e){let t=[];for(let i in e){let n=e[i];delete n.metadata,t.push(n)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(e,t,i,n,r){tq.subVectors(n,t),tX.subVectors(i,t),tj.subVectors(e,t);let a=tq.dot(tq),s=tq.dot(tX),o=tq.dot(tj),l=tX.dot(tX),h=tX.dot(tj),c=a*l-s*s;if(0===c)return r.set(0,0,0),null;let u=1/c,d=(l*o-s*h)*u,A=(a*h-s*o)*u;return r.set(1-d-A,A,d)}static containsPoint(e,t,i,n){return null!==this.getBarycoord(e,t,i,n,tY)&&tY.x>=0&&tY.y>=0&&tY.x+tY.y<=1}static getInterpolation(e,t,i,n,r,a,s,o){return null===this.getBarycoord(e,t,i,n,tY)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,tY.x),o.addScaledVector(a,tY.y),o.addScaledVector(s,tY.z),o)}static isFrontFacing(e,t,i,n){return tq.subVectors(i,t),tX.subVectors(e,t),0>tq.cross(tX).dot(n)}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,n){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[n]),this}setFromAttributeAndIndices(e,t,i,n){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return tq.subVectors(this.c,this.b),tX.subVectors(this.a,this.b),.5*tq.cross(tX).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return t2.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return t2.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,n,r){return t2.getInterpolation(e,this.a,this.b,this.c,t,i,n,r)}containsPoint(e){return t2.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return t2.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i,n,r=this.a,a=this.b,s=this.c;tK.subVectors(a,r),tJ.subVectors(s,r),t$.subVectors(e,r);let o=tK.dot(t$),l=tJ.dot(t$);if(o<=0&&l<=0)return t.copy(r);t0.subVectors(e,a);let h=tK.dot(t0),c=tJ.dot(t0);if(h>=0&&c<=h)return t.copy(a);let u=o*c-h*l;if(u<=0&&o>=0&&h<=0)return i=o/(o-h),t.copy(r).addScaledVector(tK,i);t1.subVectors(e,s);let d=tK.dot(t1),A=tJ.dot(t1);if(A>=0&&d<=A)return t.copy(s);let p=d*l-o*A;if(p<=0&&l>=0&&A<=0)return n=l/(l-A),t.copy(r).addScaledVector(tJ,n);let g=h*A-d*c;if(g<=0&&c-h>=0&&d-A>=0)return tZ.subVectors(s,a),n=(c-h)/(c-h+(d-A)),t.copy(a).addScaledVector(tZ,n);let m=1/(g+p+u);return i=p*m,n=u*m,t.copy(r).addScaledVector(tK,i).addScaledVector(tJ,n)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}constructor(e=new eZ,t=new eZ,i=new eZ){this.a=e,this.b=t,this.c=i}}let t3={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},t4={h:0,s:0,l:0},t5={h:0,s:0,l:0};function t8(e,t,i){return(i<0&&(i+=1),i>1&&(i-=1),i<1/6)?e+(t-e)*6*i:i<.5?t:i<2/3?e+(t-e)*6*(2/3-i):e}class t6{set(e,t,i){return void 0===t&&void 0===i?e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e):this.setRGB(e,t,i),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eh;return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,eF.toWorkingColorSpace(this,t),this}setRGB(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:eF.workingColorSpace;return this.r=e,this.g=t,this.b=i,eF.toWorkingColorSpace(this,n),this}setHSL(e,t,i){var n;let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:eF.workingColorSpace;if(e=(e%1+(n=1))%n,t=ex(t,0,1),i=ex(i,0,1),0===t)this.r=this.g=this.b=i;else{let n=i<=.5?i*(1+t):i+t-i*t,r=2*i-n;this.r=t8(r,n,e+1/3),this.g=t8(r,n,e),this.b=t8(r,n,e-1/3)}return eF.toWorkingColorSpace(this,r),this}setStyle(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eh;function n(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(t=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,a=t[1],s=t[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,i);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,i);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,i);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=t[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,i);if(6===r)return this.setHex(parseInt(n,16),i);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,i);return this}setColorName(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eh,i=t3[e.toLowerCase()];return void 0!==i?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=eQ(e.r),this.g=eQ(e.g),this.b=eQ(e.b),this}copyLinearToSRGB(e){return this.r=eO(e.r),this.g=eO(e.g),this.b=eO(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:eh;return eF.fromWorkingColorSpace(t9.copy(this),e),65536*Math.round(ex(255*t9.r,0,255))+256*Math.round(ex(255*t9.g,0,255))+Math.round(ex(255*t9.b,0,255))}getHexString(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:eh;return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e){let t,i,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eF.workingColorSpace;eF.fromWorkingColorSpace(t9.copy(this),n);let r=t9.r,a=t9.g,s=t9.b,o=Math.max(r,a,s),l=Math.min(r,a,s),h=(l+o)/2;if(l===o)t=0,i=0;else{let e=o-l;switch(i=h<=.5?e/(o+l):e/(2-o-l),o){case r:t=(a-s)/e+6*(a1&&void 0!==arguments[1]?arguments[1]:eF.workingColorSpace;return eF.fromWorkingColorSpace(t9.copy(this),t),e.r=t9.r,e.g=t9.g,e.b=t9.b,e}getStyle(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:eh;eF.fromWorkingColorSpace(t9.copy(this),e);let t=t9.r,i=t9.g,n=t9.b;return e!==eh?"color(".concat(e," ").concat(t.toFixed(3)," ").concat(i.toFixed(3)," ").concat(n.toFixed(3),")"):"rgb(".concat(Math.round(255*t),",").concat(Math.round(255*i),",").concat(Math.round(255*n),")")}offsetHSL(e,t,i){return this.getHSL(t4),this.setHSL(t4.h+e,t4.s+t,t4.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){var i,n,r,a,s,o,l,h,c;this.getHSL(t4),e.getHSL(t5);let u=(i=t4.h,n=t5.h,(1-(r=t))*i+r*n),d=(a=t4.s,s=t5.s,(1-(o=t))*a+o*s),A=(l=t4.l,h=t5.l,(1-(c=t))*l+c*h);return this.setHSL(u,d,A),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,i=this.g,n=this.b,r=e.elements;return this.r=r[0]*t+r[3]*i+r[6]*n,this.g=r[1]*t+r[4]*i+r[7]*n,this.b=r[2]*t+r[5]*i+r[8]*n,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}}let t9=new t6;t6.NAMES=t3;let t7=0;class ie extends ef{get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let i=e[t];if(void 0===i){console.warn("THREE.Material: parameter '".concat(t,"' has value of undefined."));continue}let n=this[t];if(void 0===n){console.warn("THREE.Material: '".concat(t,"' is not a property of THREE.").concat(this.type,"."));continue}n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[t]=i}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function n(e){let t=[];for(let i in e){let n=e[i];delete n.metadata,t.push(n)}return t}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(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).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(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).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(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).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(e).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).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),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),100!==this.blendEquation&&(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),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),7680!==this.stencilFail&&(i.stencilFail=this.stencilFail),7680!==this.stencilZFail&&(i.stencilZFail=this.stencilZFail),7680!==this.stencilZPass&&(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),t){let t=n(e.textures),r=n(e.images);t.length>0&&(i.textures=t),r.length>0&&(i.images=r)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,i=null;if(null!==t){let e=t.length;i=Array(e);for(let n=0;n!==e;++n)i[n]=t[n].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:t7++}),this.uuid=eE(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new t6(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}}class it extends ie{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new t6(0xffffff),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 tb,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}}let ii=function(){let e=new ArrayBuffer(4),t=new Float32Array(e),i=new Uint32Array(e),n=new Uint32Array(512),r=new Uint32Array(512);for(let e=0;e<256;++e){let t=e-127;t<-27?(n[e]=0,n[256|e]=32768,r[e]=24,r[256|e]=24):t<-14?(n[e]=1024>>-t-14,n[256|e]=1024>>-t-14|32768,r[e]=-t-1,r[256|e]=-t-1):t<=15?(n[e]=t+15<<10,n[256|e]=t+15<<10|32768,r[e]=13,r[256|e]=13):t<128?(n[e]=31744,n[256|e]=64512,r[e]=24,r[256|e]=24):(n[e]=31744,n[256|e]=64512,r[e]=13,r[256|e]=13)}let a=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,i=0;for(;(8388608&t)==0;)t<<=1,i-=8388608;t&=-8388609,i+=0x38800000,a[e]=t|i}for(let e=1024;e<2048;++e)a[e]=0x38000000+(e-1024<<13);for(let e=1;e<31;++e)s[e]=e<<23;s[31]=0x47800000,s[32]=0x80000000;for(let e=33;e<63;++e)s[e]=0x80000000+(e-32<<23);s[63]=0xc7800000;for(let e=1;e<64;++e)32!==e&&(o[e]=1024);return{floatView:t,uint32View:i,baseTable:n,shiftTable:r,mantissaTable:a,exponentTable:s,offsetTable:o}}(),ir={toHalfFloat:function(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=ex(e,-65504,65504),ii.floatView[0]=e;let t=ii.uint32View[0],i=t>>23&511;return ii.baseTable[i]+((8388607&t)>>ii.shiftTable[i])}},ia=new eZ,is=new eM;class io{onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return eL("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let n=0,r=this.itemSize;n1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=eS(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=eC(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=eS(t,this.array)),t}setX(e,t){return this.normalized&&(t=eC(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=eS(t,this.array)),t}setY(e,t){return this.normalized&&(t=eC(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=eS(t,this.array)),t}setZ(e,t){return this.normalized&&(t=eC(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=eS(t,this.array)),t}setW(e,t){return this.normalized&&(t=eC(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=eC(t,this.array),i=eC(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,n){return e*=this.itemSize,this.normalized&&(t=eC(t,this.array),i=eC(i,this.array),n=eC(n,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this}setXYZW(e,t,i,n,r){return e*=this.itemSize,this.normalized&&(t=eC(t,this.array),i=eC(i,this.array),n=eC(n,this.array),r=eC(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),35044!==this.usage&&(e.usage=this.usage),e}constructor(e,t,i=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=i,this.usage=35044,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=1015,this.version=0}}class il extends io{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class ih extends io{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class ic extends io{constructor(e,t,i){super(new Float32Array(e),t,i)}}let iu=0,id=new tv,iA=new tW,ip=new eZ,ig=new e1,im=new e1,iv=new eZ;class i_ extends ef{getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(eT(e)?ih:il)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(void 0!==i){let t=new ew().getNormalMatrix(e);i.applyNormalMatrix(t),i.needsUpdate=!0}let n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(e),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return id.makeRotationFromQuaternion(e),this.applyMatrix4(id),this}rotateX(e){return id.makeRotationX(e),this.applyMatrix4(id),this}rotateY(e){return id.makeRotationY(e),this.applyMatrix4(id),this}rotateZ(e){return id.makeRotationZ(e),this.applyMatrix4(id),this}translate(e,t,i){return id.makeTranslation(e,t,i),this.applyMatrix4(id),this}scale(e,t,i){return id.makeScale(e,t,i),this.applyMatrix4(id),this}lookAt(e){return iA.lookAt(e),iA.updateMatrix(),this.applyMatrix4(iA.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ip).negate(),this.translate(ip.x,ip.y,ip.z),this}setFromPoints(e){let t=[];for(let i=0,n=e.length;i0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let t in i){let n=i[t];e.data.attributes[t]=n.toJSON(e.data)}let n={},r=!1;for(let t in this.morphAttributes){let i=this.morphAttributes[t],a=[];for(let t=0,n=i.length;t0&&(n[t]=a,r=!0)}r&&(e.data.morphAttributes=n,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let i=e.index;null!==i&&this.setIndex(i.clone(t));let n=e.attributes;for(let e in n){let i=n[e];this.setAttribute(e,i.clone(t))}let r=e.morphAttributes;for(let e in r){let i=[],n=r[e];for(let e=0,r=n.length;e0){let i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e(e.far-e.near)**2)||(iy.copy(r).invert(),iE.copy(e.ray).applyMatrix4(iy),(null===i.boundingBox||!1!==iE.intersectsBox(i.boundingBox))&&this._computeIntersections(e,t,iE))}_computeIntersections(e,t,i){let n,r=this.geometry,a=this.material,s=r.index,o=r.attributes.position,l=r.attributes.uv,h=r.attributes.uv1,c=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==s)if(Array.isArray(a))for(let r=0,o=u.length;ri.far?null:{distance:l,point:iN.clone(),object:e}}(e,t,i,n,iC,iI,iM,iP);if(c){r&&(iT.fromBufferAttribute(r,o),iB.fromBufferAttribute(r,l),iR.fromBufferAttribute(r,h),c.uv=t2.getInterpolation(iP,iC,iI,iM,iT,iB,iR,new eM)),a&&(iT.fromBufferAttribute(a,o),iB.fromBufferAttribute(a,l),iR.fromBufferAttribute(a,h),c.uv1=t2.getInterpolation(iP,iC,iI,iM,iT,iB,iR,new eM)),s&&(iL.fromBufferAttribute(s,o),iD.fromBufferAttribute(s,l),iU.fromBufferAttribute(s,h),c.normal=t2.getInterpolation(iP,iC,iI,iM,iL,iD,iU,new eZ),c.normal.dot(n.direction)>0&&c.normal.multiplyScalar(-1));let e={a:o,b:l,c:h,normal:new eZ,materialIndex:0};t2.getNormal(iC,iI,iM,e.normal),c.face=e}return c}class iO extends i_{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new iO(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}constructor(e=1,t=1,i=1,n=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:r,depthSegments:a};let s=this;n=Math.floor(n),r=Math.floor(r);let o=[],l=[],h=[],c=[],u=0,d=0;function A(e,t,i,n,r,a,A,p,g,m,f){let v=a/g,_=A/m,y=a/2,E=A/2,x=p/2,S=g+1,C=m+1,I=0,M=0,w=new eZ;for(let a=0;a0?1:-1,h.push(w.x,w.y,w.z),c.push(o/g),c.push(1-a/m),I+=1}}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let i={};for(let e in this.extensions)!0===this.extensions[e]&&(i[e]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_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!==e&&this.setValues(e)}}class iW extends tW{copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new tv,this.projectionMatrix=new tv,this.projectionMatrixInverse=new tv,this.coordinateSystem=2e3}}let iq=new eZ,iX=new eM,ij=new eM;class iY extends iW{copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*ey*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*e_*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*ey*Math.atan(Math.tan(.5*e_*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){iq.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(iq.x,iq.y).multiplyScalar(-e/iq.z),iq.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(iq.x,iq.y).multiplyScalar(-e/iq.z)}getViewSize(e,t){return this.getViewBounds(e,iX,ij),t.subVectors(ij,iX)}setViewOffset(e,t,i,n,r,a){this.aspect=e/t,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=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*e_*this.fov)/this.zoom,i=2*t,n=this.aspect*i,r=-.5*n,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;r+=a.offsetX*n/e,t-=a.offsetY*i/s,n*=a.width/e,i*=a.height/s}let s=this.filmOffset;0!==s&&(r+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}constructor(e=50,t=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}}class iK extends tW{updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[i,n,r,a,s,o]=t;for(let e of t)this.remove(e);if(2e3===e)i.up.set(0,1,0),i.lookAt(1,0,0),n.up.set(0,1,0),n.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(2001===e)i.up.set(0,-1,0),i.lookAt(-1,0,0),n.up.set(0,-1,0),n.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:n}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[r,a,s,o,l,h]=this.children,c=e.getRenderTarget(),u=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),A=e.xr.enabled;e.xr.enabled=!1;let p=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,n),e.render(t,r),e.setRenderTarget(i,1,n),e.render(t,a),e.setRenderTarget(i,2,n),e.render(t,s),e.setRenderTarget(i,3,n),e.render(t,o),e.setRenderTarget(i,4,n),e.render(t,l),i.texture.generateMipmaps=p,e.setRenderTarget(i,5,n),e.render(t,h),e.setRenderTarget(c,u,d),e.xr.enabled=A,i.texture.needsPMREMUpdate=!0}constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;let n=new iY(-90,1,e,t);n.layers=this.layers,this.add(n);let r=new iY(-90,1,e,t);r.layers=this.layers,this.add(r);let a=new iY(-90,1,e,t);a.layers=this.layers,this.add(a);let s=new iY(-90,1,e,t);s.layers=this.layers,this.add(s);let o=new iY(-90,1,e,t);o.layers=this.layers,this.add(o);let l=new iY(-90,1,e,t);l.layers=this.layers,this.add(l)}}class iJ extends eW{get images(){return this.image}set images(e){this.image=e}constructor(e,t,i,n,r,a,s,o,l,h){super(e=void 0!==e?e:[],t=void 0!==t?t:301,i,n,r,a,s,o,l,h),this.isCubeTexture=!0,this.flipY=!1}}class iZ extends ej{fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let i=new iO(5,5,5),n=new iV({name:"CubemapFromEquirect",uniforms:ik({tEquirect:{value:null}}),vertexShader:"\n\n varying vec3 vWorldDirection;\n\n vec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n }\n\n void main() {\n\n vWorldDirection = transformDirection( position, modelMatrix );\n\n #include \n #include \n\n }\n ",fragmentShader:"\n\n uniform sampler2D tEquirect;\n\n varying vec3 vWorldDirection;\n\n #include \n\n void main() {\n\n vec3 direction = normalize( vWorldDirection );\n\n vec2 sampleUV = equirectUv( direction );\n\n gl_FragColor = texture2D( tEquirect, sampleUV );\n\n }\n ",side:1,blending:0});n.uniforms.tEquirect.value=t;let r=new iF(i,n),a=t.minFilter;return 1008===t.minFilter&&(t.minFilter=1006),new iK(1,10,this).update(e,r),t.minFilter=a,r.geometry.dispose(),r.material.dispose(),this}clear(e,t,i,n){let r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,i,n);e.setRenderTarget(r)}constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let i={width:e,height:e,depth:1};this.texture=new iJ([i,i,i,i,i,i],t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:1006}}let i$=new eZ,i0=new eZ,i1=new ew;class i2{set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,n){return this.normal.set(e,t,i),this.constant=n,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let n=i$.subVectors(i,t).cross(i0.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let i=e.delta(i$),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;let r=-(e.start.dot(this.normal)+this.constant)/n;return r<0||r>1?null:t.copy(e.start).addScaledVector(i,r)}intersectsLine(e){let t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let i=t||i1.getNormalMatrix(e),n=this.coplanarPoint(i$).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}constructor(e=new eZ(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}}let i3=new th,i4=new eZ;class i5{set(e,t,i,n,r,a){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(i),s[3].copy(n),s[4].copy(r),s[5].copy(a),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2e3,i=this.planes,n=e.elements,r=n[0],a=n[1],s=n[2],o=n[3],l=n[4],h=n[5],c=n[6],u=n[7],d=n[8],A=n[9],p=n[10],g=n[11],m=n[12],f=n[13],v=n[14],_=n[15];if(i[0].setComponents(o-r,u-l,g-d,_-m).normalize(),i[1].setComponents(o+r,u+l,g+d,_+m).normalize(),i[2].setComponents(o+a,u+h,g+A,_+f).normalize(),i[3].setComponents(o-a,u-h,g-A,_-f).normalize(),i[4].setComponents(o-s,u-c,g-p,_-v).normalize(),2e3===t)i[5].setComponents(o+s,u+c,g+p,_+v).normalize();else if(2001===t)i[5].setComponents(s,c,p,v).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),i3.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),i3.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(i3)}intersectsSprite(e){return i3.center.set(0,0,0),i3.radius=.7071067811865476,i3.applyMatrix4(e.matrixWorld),this.intersectsSphere(i3)}intersectsSphere(e){let t=this.planes,i=e.center,n=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(i)0?e.max.x:e.min.x,i4.y=n.normal.y>0?e.max.y:e.min.y,i4.z=n.normal.z>0?e.max.z:e.min.z,0>n.distanceToPoint(i4))return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(0>t[i].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}constructor(e=new i2,t=new i2,i=new i2,n=new i2,r=new i2,a=new i2){this.planes=[e,t,i,n,r,a]}}function i8(){let e=null,t=!1,i=null,n=null;function r(t,a){i(t,a),n=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==i&&(n=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(e){i=e},setContext:function(t){e=t}}}function i6(e){let t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(i){i.isInterleavedBufferAttribute&&(i=i.data);let n=t.get(i);n&&(e.deleteBuffer(n.buffer),t.delete(i))},update:function(i,n){if(i.isGLBufferAttribute){let e=t.get(i);(!e||e.version 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.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 const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n return dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n vec3( 0.8224621, 0.177538, 0.0 ),\n vec3( 0.0331941, 0.9668058, 0.0 ),\n vec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n vec3( 1.2249401, - 0.2249404, 0.0 ),\n vec3( - 0.0420569, 1.0420571, 0.0 ),\n vec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return sRGBTransferOETF( value );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n reflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n #if defined ( LEGACY_LIGHTS )\n if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n }\n return 1.0;\n #else\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n #endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 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 material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return saturate(v);\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColor;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n return 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 vec2 fab = DFGApprox( normal, viewDir, roughness );\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.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 reflectedLight.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 #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n #endif\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n #endif\n vec3 totalScattering = singleScattering + multiScattering;\n vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = 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 \n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[MORPHTARGETS_COUNT];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n #endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n #endif\n #ifdef MORPHTARGETS_TEXTURE\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n #else\n #ifndef USE_MORPHNORMALS\n uniform float morphTargetInfluences[ 8 ];\n #else\n uniform float morphTargetInfluences[ 4 ];\n #endif\n #endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n #ifdef MORPHTARGETS_TEXTURE\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n #else\n transformed += morphTarget0 * morphTargetInfluences[ 0 ];\n transformed += morphTarget1 * morphTargetInfluences[ 1 ];\n transformed += morphTarget2 * morphTargetInfluences[ 2 ];\n transformed += morphTarget3 * morphTargetInfluences[ 3 ];\n #ifndef USE_MORPHNORMALS\n transformed += morphTarget4 * morphTargetInfluences[ 4 ];\n transformed += morphTarget5 * morphTargetInfluences[ 5 ];\n transformed += morphTarget6 * morphTargetInfluences[ 6 ];\n transformed += morphTarget7 * morphTargetInfluences[ 7 ];\n #endif\n #endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\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 vec4 r = vec4( fract( v * PackFactors ), v );\n r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n return packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n float hard_shadow = step( compare , distribution.x );\n if (hard_shadow != 1.0 ) {\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return shadow;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n \n float lightToPositionLength = length( lightToPosition );\n if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n shadow = (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n return shadow;\n }\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n float startCompression = 0.8 - 0.04;\n float desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min(color.r, min(color.g, color.b));\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max(color.r, max(color.g, color.b));\n if (peak < startCompression) return color;\n float d = 1. - startCompression;\n float newPeak = 1. - d * d / (peak + d - startCompression);\n color *= newPeak / peak;\n float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);\n return mix(color, newPeak * vec3(1, 1, 1), g);\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include \n #include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include \n #include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include \n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include \n #include \n #include \n #include \n #include \n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #ifdef USE_DISPLACEMENTMAP\n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n vec4 diffuseColor = vec4( 1.0 );\n #include \n #include \n #include \n #include \n #include \n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include \n #include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include \n #include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vLineDistance = scale * lineDistance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include \n #include \n #include \n #include \n #include \n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include \n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include \n #include \n #include \n #include \n gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n #include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include \n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vViewPosition = - mvPosition.xyz;\n #include \n #include \n #include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include \n #include \n #include \n #include \n #include \n #include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include \n #include \n #include \n #include \n #include \n #include \n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include \n #include \n #include \n #include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n #include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n #include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include \n #include \n #include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n #include \n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include \n #include \n #include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include \n vec3 outgoingLight = vec3( 0.0 );\n #include \n #include \n #include \n #include \n #include \n outgoingLight = diffuseColor.rgb;\n #include \n #include \n #include \n #include \n}"},ne={common:{diffuse:{value:new t6(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new ew},alphaMap:{value:null},alphaMapTransform:{value:new ew},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ew}},envmap:{envMap:{value:null},envMapRotation:{value:new ew},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ew}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ew}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ew},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ew},normalScale:{value:new eM(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ew},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ew}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ew}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ew}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new t6(0xffffff)}},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 t6(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ew},alphaTest:{value:0},uvTransform:{value:new ew}},sprite:{diffuse:{value:new t6(0xffffff)},opacity:{value:1},center:{value:new eM(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ew},alphaMap:{value:null},alphaMapTransform:{value:new ew},alphaTest:{value:0}}},nt={basic:{uniforms:iG([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.fog]),vertexShader:i7.meshbasic_vert,fragmentShader:i7.meshbasic_frag},lambert:{uniforms:iG([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,ne.lights,{emissive:{value:new t6(0)}}]),vertexShader:i7.meshlambert_vert,fragmentShader:i7.meshlambert_frag},phong:{uniforms:iG([ne.common,ne.specularmap,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,ne.lights,{emissive:{value:new t6(0)},specular:{value:new t6(1118481)},shininess:{value:30}}]),vertexShader:i7.meshphong_vert,fragmentShader:i7.meshphong_frag},standard:{uniforms:iG([ne.common,ne.envmap,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.roughnessmap,ne.metalnessmap,ne.fog,ne.lights,{emissive:{value:new t6(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:i7.meshphysical_vert,fragmentShader:i7.meshphysical_frag},toon:{uniforms:iG([ne.common,ne.aomap,ne.lightmap,ne.emissivemap,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.gradientmap,ne.fog,ne.lights,{emissive:{value:new t6(0)}}]),vertexShader:i7.meshtoon_vert,fragmentShader:i7.meshtoon_frag},matcap:{uniforms:iG([ne.common,ne.bumpmap,ne.normalmap,ne.displacementmap,ne.fog,{matcap:{value:null}}]),vertexShader:i7.meshmatcap_vert,fragmentShader:i7.meshmatcap_frag},points:{uniforms:iG([ne.points,ne.fog]),vertexShader:i7.points_vert,fragmentShader:i7.points_frag},dashed:{uniforms:iG([ne.common,ne.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:i7.linedashed_vert,fragmentShader:i7.linedashed_frag},depth:{uniforms:iG([ne.common,ne.displacementmap]),vertexShader:i7.depth_vert,fragmentShader:i7.depth_frag},normal:{uniforms:iG([ne.common,ne.bumpmap,ne.normalmap,ne.displacementmap,{opacity:{value:1}}]),vertexShader:i7.meshnormal_vert,fragmentShader:i7.meshnormal_frag},sprite:{uniforms:iG([ne.sprite,ne.fog]),vertexShader:i7.sprite_vert,fragmentShader:i7.sprite_frag},background:{uniforms:{uvTransform:{value:new ew},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:i7.background_vert,fragmentShader:i7.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ew}},vertexShader:i7.backgroundCube_vert,fragmentShader:i7.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:i7.cube_vert,fragmentShader:i7.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:i7.equirect_vert,fragmentShader:i7.equirect_frag},distanceRGBA:{uniforms:iG([ne.common,ne.displacementmap,{referencePosition:{value:new eZ},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:i7.distanceRGBA_vert,fragmentShader:i7.distanceRGBA_frag},shadow:{uniforms:iG([ne.lights,ne.fog,{color:{value:new t6(0)},opacity:{value:1}}]),vertexShader:i7.shadow_vert,fragmentShader:i7.shadow_frag}};nt.physical={uniforms:iG([nt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ew},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ew},clearcoatNormalScale:{value:new eM(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ew},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ew},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ew},sheen:{value:0},sheenColor:{value:new t6(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ew},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ew},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ew},transmissionSamplerSize:{value:new eM},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ew},attenuationDistance:{value:0},attenuationColor:{value:new t6(0)},specularColor:{value:new t6(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ew},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ew},anisotropyVector:{value:new eM},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ew}}]),vertexShader:i7.meshphysical_vert,fragmentShader:i7.meshphysical_frag};let ni={r:0,b:0,g:0},nn=new tb,nr=new tv;function na(e,t,i,n,r,a,s){let o,l,h=new t6(0),c=+(!0!==a),u=null,d=0,A=null;function p(t,i){t.getRGB(ni,iH(e)),n.buffers.color.setClear(ni.r,ni.g,ni.b,i,s)}return{getClearColor:function(){return h},setClearColor:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;h.set(e),p(h,c=t)},getClearAlpha:function(){return c},setClearAlpha:function(e){p(h,c=e)},render:function(a,g){let m=!1,f=!0===g.isScene?g.background:null;f&&f.isTexture&&(f=(g.backgroundBlurriness>0?i:t).get(f)),null===f?p(h,c):f&&f.isColor&&(p(f,1),m=!0);let v=e.xr.getEnvironmentBlendMode();"additive"===v?n.buffers.color.setClear(0,0,0,1,s):"alpha-blend"===v&&n.buffers.color.setClear(0,0,0,0,s),(e.autoClear||m)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),f&&(f.isCubeTexture||306===f.mapping)?(void 0===l&&((l=new iF(new iO(1,1,1),new iV({name:"BackgroundCubeMaterial",uniforms:ik(nt.backgroundCube.uniforms),vertexShader:nt.backgroundCube.vertexShader,fragmentShader:nt.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(l)),nn.copy(g.backgroundRotation),nn.x*=-1,nn.y*=-1,nn.z*=-1,f.isCubeTexture&&!1===f.isRenderTargetTexture&&(nn.y*=-1,nn.z*=-1),l.material.uniforms.envMap.value=f,l.material.uniforms.flipEnvMap.value=f.isCubeTexture&&!1===f.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(nr.makeRotationFromEuler(nn)),l.material.toneMapped=eF.getTransfer(f.colorSpace)!==ep,(u!==f||d!==f.version||A!==e.toneMapping)&&(l.material.needsUpdate=!0,u=f,d=f.version,A=e.toneMapping),l.layers.enableAll(),a.unshift(l,l.geometry,l.material,0,0,null)):f&&f.isTexture&&(void 0===o&&((o=new iF(new i9(2,2),new iV({name:"BackgroundMaterial",uniforms:ik(nt.background.uniforms),vertexShader:nt.background.vertexShader,fragmentShader:nt.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(o)),o.material.uniforms.t2D.value=f,o.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,o.material.toneMapped=eF.getTransfer(f.colorSpace)!==ep,!0===f.matrixAutoUpdate&&f.updateMatrix(),o.material.uniforms.uvTransform.value.copy(f.matrix),(u!==f||d!==f.version||A!==e.toneMapping)&&(o.material.needsUpdate=!0,u=f,d=f.version,A=e.toneMapping),o.layers.enableAll(),a.unshift(o,o.geometry,o.material,0,0,null))}}}function ns(e,t){let i=e.getParameter(e.MAX_VERTEX_ATTRIBS),n={},r=h(null),a=r,s=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function h(e){let t=[],n=[],r=[];for(let e=0;e=0){let i=r[t],n=s[t];if(void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor)),void 0===i||i.attribute!==n||n&&i.data!==n.data)return!0;o++}return a.attributesNum!==o||a.index!==n}(i,g,l,m))&&function(e,t,i,n){let r={},s=t.attributes,o=0,l=i.getAttributes();for(let t in l)if(l[t].location>=0){let i=s[t];void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor));let n={};n.attribute=i,i&&i.data&&(n.data=i.data),r[t]=n,o++}a.attributes=r,a.attributesNum=o,a.index=n}(i,g,l,m),null!==m&&t.update(m,e.ELEMENT_ARRAY_BUFFER),(f||s)&&(s=!1,function(i,n,r,a){c();let s=a.attributes,o=r.getAttributes(),l=n.defaultAttributeValues;for(let n in o){let r=o[n];if(r.location>=0){let o=s[n];if(void 0===o&&("instanceMatrix"===n&&i.instanceMatrix&&(o=i.instanceMatrix),"instanceColor"===n&&i.instanceColor&&(o=i.instanceColor)),void 0!==o){let n=o.normalized,s=o.itemSize,l=t.get(o);if(void 0===l)continue;let h=l.buffer,c=l.type,A=l.bytesPerElement,g=c===e.INT||c===e.UNSIGNED_INT||1013===o.gpuType;if(o.isInterleavedBufferAttribute){let t=o.data,l=t.stride,m=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=void 0!==i.precision?i.precision:"highp",s=r(a);s!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",s,"instead."),a=s);let o=!0===i.logarithmicDepthBuffer,l=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),c=e.getParameter(e.MAX_TEXTURE_SIZE),u=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),d=e.getParameter(e.MAX_VERTEX_ATTRIBS),A=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),p=e.getParameter(e.MAX_VARYING_VECTORS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==n)return n;if(!0===t.has("EXT_texture_filter_anisotropic")){let i=t.get("EXT_texture_filter_anisotropic");n=e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:o,maxTextures:l,maxVertexTextures:h,maxTextureSize:c,maxCubemapSize:u,maxAttributes:d,maxVertexUniforms:A,maxVaryings:p,maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function nh(e){let t=this,i=null,n=0,r=!1,a=!1,s=new i2,o=new ew,l={value:null,needsUpdate:!1};function h(e,i,n,r){let a=null!==e?e.length:0,h=null;if(0!==a){if(h=l.value,!0!==r||null===h){let t=n+4*a,r=i.matrixWorldInverse;o.getNormalMatrix(r),(null===h||h.length0),t.numPlanes=n,t.numIntersection=0)}}function nc(e){let t=new WeakMap;function i(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}function n(e){let i=e.target;i.removeEventListener("dispose",n);let r=t.get(i);void 0!==r&&(t.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){let a=r.mapping;if(303===a||304===a)if(t.has(r))return i(t.get(r).texture,r.mapping);else{let a=r.image;if(!a||!(a.height>0))return null;{let s=new iZ(a.height);return s.fromEquirectangularTexture(e,r),t.set(r,s),r.addEventListener("dispose",n),i(s.texture,r.mapping)}}}return r},dispose:function(){t=new WeakMap}}}class nu extends iW{copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,i,n,r,a){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=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,r=i-e,a=i+e,s=n+t,o=n-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,a=r+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}constructor(e=-1,t=1,i=1,n=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=n,this.near=r,this.far=a,this.updateProjectionMatrix()}}let nd=[.125,.215,.35,.446,.526,.582],nA=new nu,np=new t6,ng=null,nm=0,nf=0,nv=!1,n_=(1+Math.sqrt(5))/2,ny=1/n_,nE=[new eZ(1,1,1),new eZ(-1,1,1),new eZ(1,1,-1),new eZ(-1,1,-1),new eZ(0,n_,ny),new eZ(0,n_,-ny),new eZ(ny,0,n_),new eZ(-ny,0,n_),new eZ(n_,ny,0),new eZ(-n_,ny,0)];class nx{fromScene(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100;ng=this._renderer.getRenderTarget(),nm=this._renderer.getActiveCubeFace(),nf=this._renderer.getActiveMipmapLevel(),nv=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);let r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,i,n,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}fromCubemap(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=nM(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=nI(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?o=nd[s-e+4-1]:0===s&&(o=0),n.push(o);let l=1/(a-2),h=-l,c=1+l,u=[h,h,c,h,c,c,h,h,c,c,h,c],d=new Float32Array(108),A=new Float32Array(72),p=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,i=e>2?0:-1,n=[t,i,0,t+2/3,i,0,t+2/3,i+1,0,t,i,0,t+2/3,i+1,0,t,i+1,0];d.set(n,18*e),A.set(u,12*e);let r=[e,e,e,e,e,e];p.set(r,6*e)}let g=new i_;g.setAttribute("position",new io(d,3)),g.setAttribute("uv",new io(A,2)),g.setAttribute("faceIndex",new io(p,1)),t.push(g),r>4&&r--}return{lodPlanes:t,sizeLods:i,sigmas:n}}(n)),this._blurMaterial=function(e,t,i){let n=new Float32Array(20),r=new eZ(0,1,0);return new iV({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:"".concat(e,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:nw(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform float mipInt;\n uniform vec3 poleAxis;\n\n #define ENVMAP_TYPE_CUBE_UV\n #include \n\n vec3 getSample( float theta, vec3 axis ) {\n\n float cosTheta = cos( theta );\n // Rodrigues' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n return bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n }\n\n void main() {\n\n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n }\n\n axis = normalize( axis );\n\n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n for ( int i = 1; i < n; i++ ) {\n\n if ( i >= samples ) {\n\n break;\n\n }\n\n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n }\n\n }\n ",blending:0,depthTest:!1,depthWrite:!1})}(n,e,t)}return n}_compileMaterial(e){let t=new iF(this._lodPlanes[0],e);this._renderer.compile(t,nA)}_sceneToCubeUV(e,t,i,n){let r=new iY(90,1,t,i),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,h=o.toneMapping;o.getClearColor(np),o.toneMapping=0,o.autoClear=!1;let c=new it({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),u=new iF(new iO,c),d=!1,A=e.background;A?A.isColor&&(c.color.copy(A),e.background=null,d=!0):(c.color.copy(np),d=!0);for(let t=0;t<6;t++){let i=t%3;0===i?(r.up.set(0,a[t],0),r.lookAt(s[t],0,0)):1===i?(r.up.set(0,0,a[t]),r.lookAt(0,s[t],0)):(r.up.set(0,a[t],0),r.lookAt(0,0,s[t]));let l=this._cubeSize;nC(n,i*l,t>2?l:0,l,l),o.setRenderTarget(n),d&&o.render(u,r),o.render(e,r)}u.geometry.dispose(),u.material.dispose(),o.toneMapping=h,o.autoClear=l,e.background=A}_textureToCubeUV(e,t){let i=this._renderer,n=301===e.mapping||302===e.mapping;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=nM()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=nI());let r=n?this._cubemapMaterial:this._equirectMaterial,a=new iF(this._lodPlanes[0],r);r.uniforms.envMap.value=e;let s=this._cubeSize;nC(t,0,0,3*s,2*s),i.setRenderTarget(t),i.render(a,nA)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let t=1;t20&&console.warn("sigmaRadians, ".concat(r,", is too large and will clip, as it requested ").concat(p," samples when the maximum is set to ").concat(20));let g=[],m=0;for(let e=0;e<20;++e){let t=e/A,i=Math.exp(-t*t/2);g.push(i),0===e?m+=i:ef-4?n-f+4:0),_,3*v,2*v),o.setRenderTarget(t),o.render(h,nA)}constructor(e){this._renderer=e,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)}}function nS(e,t,i){let n=new ej(e,t,i);return n.texture.mapping=306,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function nC(e,t,i,n,r){e.viewport.set(t,i,n,r),e.scissor.set(t,i,n,r)}function nI(){return new iV({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:nw(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n\n #include \n\n void main() {\n\n vec3 outputDirection = normalize( vOutputDirection );\n vec2 uv = equirectUv( outputDirection );\n\n gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n }\n ",blending:0,depthTest:!1,depthWrite:!1})}function nM(){return new iV({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:nw(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n uniform float flipEnvMap;\n\n varying vec3 vOutputDirection;\n\n uniform samplerCube envMap;\n\n void main() {\n\n gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n }\n ",blending:0,depthTest:!1,depthWrite:!1})}function nw(){return"\n\n precision mediump float;\n precision mediump int;\n\n attribute float faceIndex;\n\n varying vec3 vOutputDirection;\n\n // RH coordinate system; PMREM face-indexing convention\n vec3 getDirection( vec2 uv, float face ) {\n\n uv = 2.0 * uv - 1.0;\n\n vec3 direction = vec3( uv, 1.0 );\n\n if ( face == 0.0 ) {\n\n direction = direction.zyx; // ( 1, v, u ) pos x\n\n } else if ( face == 1.0 ) {\n\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n } else if ( face == 2.0 ) {\n\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n\n } else if ( face == 3.0 ) {\n\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n\n } else if ( face == 4.0 ) {\n\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n\n } else if ( face == 5.0 ) {\n\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n\n }\n\n return direction;\n\n }\n\n void main() {\n\n vOutputDirection = getDirection( uv, faceIndex );\n gl_Position = vec4( position, 1.0 );\n\n }\n "}function nb(e){let t=new WeakMap,i=null;function n(e){let i=e.target;i.removeEventListener("dispose",n);let r=t.get(i);void 0!==r&&(t.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){let a=r.mapping,s=303===a||304===a,o=301===a||302===a;if(s||o){let a=t.get(r),l=void 0!==a?a.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===i&&(i=new nx(e)),(a=s?i.fromEquirectangular(r,a):i.fromCubemap(r,a)).texture.pmremVersion=r.pmremVersion,t.set(r,a),a.texture;{if(void 0!==a)return a.texture;let l=r.image;return s&&l&&l.height>0||o&&l&&function(e){let t=0;for(let i=0;i<6;i++)void 0!==e[i]&&t++;return 6===t}(l)?(null===i&&(i=new nx(e)),(a=s?i.fromEquirectangular(r):i.fromCubemap(r)).texture.pmremVersion=r.pmremVersion,t.set(r,a),r.addEventListener("dispose",n),a.texture):null}}}return r},dispose:function(){t=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function nT(e){let t={};function i(i){let n;if(void 0!==t[i])return t[i];switch(i){case"WEBGL_depth_texture":n=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=e.getExtension(i)}return t[i]=n,n}return{has:function(e){return null!==i(e)},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(e){let t=i(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function nB(e,t,i,n){let r={},a=new WeakMap;function s(e){let o=e.target;for(let e in null!==o.index&&t.remove(o.index),o.attributes)t.remove(o.attributes[e]);for(let e in o.morphAttributes){let i=o.morphAttributes[e];for(let e=0,n=i.length;et.maxTextureSize&&(p=Math.ceil(A/t.maxTextureSize),A=t.maxTextureSize);let g=new Float32Array(A*p*4*c),m=new eY(g,A,p,c);m.type=1015,m.needsUpdate=!0;let f=4*d;for(let t=0;t0)return e;let r=t*i,a=nG[r];if(void 0===a&&(a=new Float32Array(r),nG[r]=a),0!==t){n.toArray(a,0);for(let n=1,r=0;n!==t;++n)r+=i,e[n].toArray(a,r)}return a}function nX(e,t){if(e.length!==t.length)return!1;for(let i=0,n=e.length;i":" "," ").concat(r,": ").concat(i[e]))}return n.join("\n")}(e.getShaderSource(t),n)}}function rD(e){return""!==e}function rU(e,t){let i=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,i).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function rP(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let rN=/^[ \t]*#include +<([\w\d./]+)>/gm;function rF(e){return e.replace(rN,rO)}let rQ=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function rO(e,t){let i=i7[t];if(void 0===i){let e=rQ.get(t);if(void 0!==e)i=i7[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e);else throw Error("Can not resolve #include <"+t+">")}return rF(i)}let rk=/#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 rG(e){return e.replace(rk,rH)}function rH(e,t,i,n){let r="";for(let e=parseInt(t);e0&&(r+="\n"),(a=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y].filter(rD).join("\n")).length>0&&(a+="\n")):(r=[rz(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y,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 "+m:"",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":"",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 "+p:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.useLegacyLights?"#define LEGACY_LIGHTS":"",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"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(rD).join("\n"),a=[rz(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y,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 "+m:"",i.envMap?"#define "+f:"",v?"#define CUBEUV_TEXEL_WIDTH "+v.texelWidth:"",v?"#define CUBEUV_TEXEL_HEIGHT "+v.texelHeight:"",v?"#define CUBEUV_MAX_MIP "+v.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 "+p:"",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":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?i7.tonemapping_pars_fragment:"",0!==i.toneMapping?function(e,t){let i;switch(t){case 1:i="Linear";break;case 2:i="Reinhard";break;case 3:i="OptimizedCineon";break;case 4:i="ACESFilmic";break;case 6:i="AgX";break;case 7:i="Neutral";break;case 5:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),i="Linear"}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",i7.colorspace_pars_fragment,function(e,t){let i=function(e){let t,i=eF.getPrimaries(eF.workingColorSpace),n=eF.getPrimaries(e);switch(i===n?t="":"p3"===i&&n===eg?t="LinearDisplayP3ToLinearSRGB":i===eg&&"p3"===n&&(t="LinearSRGBToLinearDisplayP3"),e){case ec:case ed:return[t,"LinearTransferOETF"];case eh:case eu:return[t,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),[t,"LinearTransferOETF"]}}(t);return"vec4 ".concat(e,"( vec4 value ) { return ").concat(i[0],"( ").concat(i[1],"( value ) ); }")}("linearToOutputTexel",i.outputColorSpace),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(rD).join("\n")),d=rP(d=rU(d=rF(d),i),i),A=rP(A=rU(A=rF(A),i),i),d=rG(d),A=rG(A),!0!==i.isRawShaderMaterial&&(x="#version 300 es\n",r=[_,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+r,a=["#define varying in",i.glslVersion===em?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===em?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+a);let S=x+r+d,C=x+a+A,I=rB(c,c.VERTEX_SHADER,S),M=rB(c,c.FRAGMENT_SHADER,C);function w(t){if(e.debug.checkShaderErrors){let i=c.getProgramInfoLog(E).trim(),n=c.getShaderInfoLog(I).trim(),s=c.getShaderInfoLog(M).trim(),o=!0,l=!0;if(!1===c.getProgramParameter(E,c.LINK_STATUS))if(o=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(c,E,I,M);else{let e=rL(c,I,"vertex"),n=rL(c,M,"fragment");console.error("THREE.WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(E,c.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+i+"\n"+e+"\n"+n)}else""!==i?console.warn("THREE.WebGLProgram: Program Info Log:",i):(""===n||""===s)&&(l=!1);l&&(t.diagnostics={runnable:o,programLog:i,vertexShader:{log:n,prefix:r},fragmentShader:{log:s,prefix:a}})}c.deleteShader(I),c.deleteShader(M),s=new rT(c,E),o=function(e,t){let i={},n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r0,q=a.clearcoat>0,X=a.iridescence>0,j=a.sheen>0,Y=a.transmission>0,K=W&&!!a.anisotropyMap,J=q&&!!a.clearcoatMap,Z=q&&!!a.clearcoatNormalMap,$=q&&!!a.clearcoatRoughnessMap,ee=X&&!!a.iridescenceMap,et=X&&!!a.iridescenceThicknessMap,ei=j&&!!a.sheenColorMap,en=j&&!!a.sheenRoughnessMap,er=!!a.specularMap,ea=!!a.specularColorMap,es=!!a.specularIntensityMap,eo=Y&&!!a.transmissionMap,el=Y&&!!a.thicknessMap,eh=!!a.gradientMap,eu=!!a.alphaMap,ed=a.alphaTest>0,eA=!!a.alphaHash,eg=!!a.extensions,em=0;a.toneMapped&&(null===R||!0===R.isXRRenderTarget)&&(em=e.toneMapping);let ef={shaderID:w,shaderType:a.type,shaderName:a.name,vertexShader:v,fragmentShader:_,defines:a.defines,customVertexShaderID:y,customFragmentShaderID:E,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:A,batching:D,instancing:L,instancingColor:L&&null!==f.instanceColor,instancingMorph:L&&null!==f.morphTexture,supportsVertexTextures:d,outputColorSpace:null===R?e.outputColorSpace:!0===R.isXRRenderTarget?R.texture.colorSpace:ec,alphaToCoverage:!!a.alphaToCoverage,map:U,matcap:P,envMap:N,envMapMode:N&&I.mapping,envMapCubeUVHeight:M,aoMap:F,lightMap:Q,bumpMap:O,normalMap:k,displacementMap:d&&G,emissiveMap:H,normalMapObjectSpace:k&&1===a.normalMapType,normalMapTangentSpace:k&&0===a.normalMapType,metalnessMap:z,roughnessMap:V,anisotropy:W,anisotropyMap:K,clearcoat:q,clearcoatMap:J,clearcoatNormalMap:Z,clearcoatRoughnessMap:$,iridescence:X,iridescenceMap:ee,iridescenceThicknessMap:et,sheen:j,sheenColorMap:ei,sheenRoughnessMap:en,specularMap:er,specularColorMap:ea,specularIntensityMap:es,transmission:Y,transmissionMap:eo,thicknessMap:el,gradientMap:eh,opaque:!1===a.transparent&&1===a.blending&&!1===a.alphaToCoverage,alphaMap:eu,alphaTest:ed,alphaHash:eA,combine:a.combine,mapUv:U&&g(a.map.channel),aoMapUv:F&&g(a.aoMap.channel),lightMapUv:Q&&g(a.lightMap.channel),bumpMapUv:O&&g(a.bumpMap.channel),normalMapUv:k&&g(a.normalMap.channel),displacementMapUv:G&&g(a.displacementMap.channel),emissiveMapUv:H&&g(a.emissiveMap.channel),metalnessMapUv:z&&g(a.metalnessMap.channel),roughnessMapUv:V&&g(a.roughnessMap.channel),anisotropyMapUv:K&&g(a.anisotropyMap.channel),clearcoatMapUv:J&&g(a.clearcoatMap.channel),clearcoatNormalMapUv:Z&&g(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:$&&g(a.clearcoatRoughnessMap.channel),iridescenceMapUv:ee&&g(a.iridescenceMap.channel),iridescenceThicknessMapUv:et&&g(a.iridescenceThicknessMap.channel),sheenColorMapUv:ei&&g(a.sheenColorMap.channel),sheenRoughnessMapUv:en&&g(a.sheenRoughnessMap.channel),specularMapUv:er&&g(a.specularMap.channel),specularColorMapUv:ea&&g(a.specularColorMap.channel),specularIntensityMapUv:es&&g(a.specularIntensityMap.channel),transmissionMapUv:eo&&g(a.transmissionMap.channel),thicknessMapUv:el&&g(a.thicknessMap.channel),alphaMapUv:eu&&g(a.alphaMap.channel),vertexTangents:!!S.attributes.tangent&&(k||W),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!S.attributes.color&&4===S.attributes.color.itemSize,pointsUvs:!0===f.isPoints&&!!S.attributes.uv&&(U||eu),fog:!!x,useFog:!0===a.fog,fogExp2:!!x&&x.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:u,skinning:!0===f.isSkinnedMesh,morphTargets:void 0!==S.morphAttributes.position,morphNormals:void 0!==S.morphAttributes.normal,morphColors:void 0!==S.morphAttributes.color,morphTargetsCount:T,morphTextureStride:B,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:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&c.length>0,shadowMapType:e.shadowMap.type,toneMapping:em,useLegacyLights:e._useLegacyLights,decodeVideoTexture:U&&!0===a.map.isVideoTexture&&eF.getTransfer(a.map.colorSpace)===ep,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:eg&&!0===a.extensions.clipCullDistance&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:eg&&!0===a.extensions.multiDraw&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return ef.vertexUv1s=h.has(1),ef.vertexUv2s=h.has(2),ef.vertexUv3s=h.has(3),h.clear(),ef},getProgramCacheKey:function(t){var i,n,r,a;let s=[];if(t.shaderID?s.push(t.shaderID):(s.push(t.customVertexShaderID),s.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)s.push(e),s.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(i=s,n=t,i.push(n.precision),i.push(n.outputColorSpace),i.push(n.envMapMode),i.push(n.envMapCubeUVHeight),i.push(n.mapUv),i.push(n.alphaMapUv),i.push(n.lightMapUv),i.push(n.aoMapUv),i.push(n.bumpMapUv),i.push(n.normalMapUv),i.push(n.displacementMapUv),i.push(n.emissiveMapUv),i.push(n.metalnessMapUv),i.push(n.roughnessMapUv),i.push(n.anisotropyMapUv),i.push(n.clearcoatMapUv),i.push(n.clearcoatNormalMapUv),i.push(n.clearcoatRoughnessMapUv),i.push(n.iridescenceMapUv),i.push(n.iridescenceThicknessMapUv),i.push(n.sheenColorMapUv),i.push(n.sheenRoughnessMapUv),i.push(n.specularMapUv),i.push(n.specularColorMapUv),i.push(n.specularIntensityMapUv),i.push(n.transmissionMapUv),i.push(n.thicknessMapUv),i.push(n.combine),i.push(n.fogExp2),i.push(n.sizeAttenuation),i.push(n.morphTargetsCount),i.push(n.morphAttributeCount),i.push(n.numDirLights),i.push(n.numPointLights),i.push(n.numSpotLights),i.push(n.numSpotLightMaps),i.push(n.numHemiLights),i.push(n.numRectAreaLights),i.push(n.numDirLightShadows),i.push(n.numPointLightShadows),i.push(n.numSpotLightShadows),i.push(n.numSpotLightShadowsWithMaps),i.push(n.numLightProbes),i.push(n.shadowMapType),i.push(n.toneMapping),i.push(n.numClippingPlanes),i.push(n.numClipIntersection),i.push(n.depthPacking),r=s,a=t,o.disableAll(),a.supportsVertexTextures&&o.enable(0),a.instancing&&o.enable(1),a.instancingColor&&o.enable(2),a.instancingMorph&&o.enable(3),a.matcap&&o.enable(4),a.envMap&&o.enable(5),a.normalMapObjectSpace&&o.enable(6),a.normalMapTangentSpace&&o.enable(7),a.clearcoat&&o.enable(8),a.iridescence&&o.enable(9),a.alphaTest&&o.enable(10),a.vertexColors&&o.enable(11),a.vertexAlphas&&o.enable(12),a.vertexUv1s&&o.enable(13),a.vertexUv2s&&o.enable(14),a.vertexUv3s&&o.enable(15),a.vertexTangents&&o.enable(16),a.anisotropy&&o.enable(17),a.alphaHash&&o.enable(18),a.batching&&o.enable(19),r.push(o.mask),o.disableAll(),a.fog&&o.enable(0),a.useFog&&o.enable(1),a.flatShading&&o.enable(2),a.logarithmicDepthBuffer&&o.enable(3),a.skinning&&o.enable(4),a.morphTargets&&o.enable(5),a.morphNormals&&o.enable(6),a.morphColors&&o.enable(7),a.premultipliedAlpha&&o.enable(8),a.shadowMapEnabled&&o.enable(9),a.useLegacyLights&&o.enable(10),a.doubleSided&&o.enable(11),a.flipSided&&o.enable(12),a.useDepthPacking&&o.enable(13),a.dithering&&o.enable(14),a.transmission&&o.enable(15),a.sheen&&o.enable(16),a.opaque&&o.enable(17),a.pointsUvs&&o.enable(18),a.decodeVideoTexture&&o.enable(19),a.alphaToCoverage&&o.enable(20),r.push(o.mask),s.push(e.outputColorSpace)),s.push(t.customProgramCacheKey),s.join()},getUniforms:function(e){let t,i=p[e.type];if(i){let e=nt[i];t=iz.clone(e.uniforms)}else t=e.uniforms;return t},acquireProgram:function(t,i){let n;for(let e=0,t=c.length;e0?n.push(c):!0===s.transparent?r.push(c):i.push(c)},unshift:function(e,t,s,o,l,h){let c=a(e,t,s,o,l,h);s.transmission>0?n.unshift(c):!0===s.transparent?r.unshift(c):i.unshift(c)},finish:function(){for(let i=t,n=e.length;i1&&i.sort(e||rK),n.length>1&&n.sort(t||rJ),r.length>1&&r.sort(t||rJ)}}}function r$(){let e=new WeakMap;return{get:function(t,i){let n,r=e.get(t);return void 0===r?(n=new rZ,e.set(t,[n])):i>=r.length?(n=new rZ,r.push(n)):n=r[i],n},dispose:function(){e=new WeakMap}}}function r0(){let e={};return{get:function(t){let i;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":i={direction:new eZ,color:new t6};break;case"SpotLight":i={position:new eZ,direction:new eZ,color:new t6,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new eZ,color:new t6,distance:0,decay:0};break;case"HemisphereLight":i={direction:new eZ,skyColor:new t6,groundColor:new t6};break;case"RectAreaLight":i={color:new t6,position:new eZ,halfWidth:new eZ,halfHeight:new eZ}}return e[t.id]=i,i}}}let r1=0;function r2(e,t){return 2*!!t.castShadow-2*!!e.castShadow+ +!!t.map-!!e.map}function r3(e){let t=new r0,i=function(){let e={};return{get:function(t){let i;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new eM};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new eM,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.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 e=0;e<9;e++)n.probe.push(new eZ);let r=new eZ,a=new tv,s=new tv;return{setup:function(r,a){let s=0,o=0,l=0;for(let e=0;e<9;e++)n.probe[e].set(0,0,0);let h=0,c=0,u=0,d=0,A=0,p=0,g=0,m=0,f=0,v=0,_=0;r.sort(r2);let y=!0===a?Math.PI:1;for(let e=0,a=r.length;e0&&(!0===e.has("OES_texture_float_linear")?(n.rectAreaLTC1=ne.LTC_FLOAT_1,n.rectAreaLTC2=ne.LTC_FLOAT_2):(n.rectAreaLTC1=ne.LTC_HALF_1,n.rectAreaLTC2=ne.LTC_HALF_2)),n.ambient[0]=s,n.ambient[1]=o,n.ambient[2]=l;let E=n.hash;(E.directionalLength!==h||E.pointLength!==c||E.spotLength!==u||E.rectAreaLength!==d||E.hemiLength!==A||E.numDirectionalShadows!==p||E.numPointShadows!==g||E.numSpotShadows!==m||E.numSpotMaps!==f||E.numLightProbes!==_)&&(n.directional.length=h,n.spot.length=u,n.rectArea.length=d,n.point.length=c,n.hemi.length=A,n.directionalShadow.length=p,n.directionalShadowMap.length=p,n.pointShadow.length=g,n.pointShadowMap.length=g,n.spotShadow.length=m,n.spotShadowMap.length=m,n.directionalShadowMatrix.length=p,n.pointShadowMatrix.length=g,n.spotLightMatrix.length=m+f-v,n.spotLightMap.length=f,n.numSpotLightShadowsWithMaps=v,n.numLightProbes=_,E.directionalLength=h,E.pointLength=c,E.spotLength=u,E.rectAreaLength=d,E.hemiLength=A,E.numDirectionalShadows=p,E.numPointShadows=g,E.numSpotShadows=m,E.numSpotMaps=f,E.numLightProbes=_,n.version=r1++)},setupView:function(e,t){let i=0,o=0,l=0,h=0,c=0,u=t.matrixWorldInverse;for(let t=0,d=e.length;t1&&void 0!==arguments[1]?arguments[1]:0,a=t.get(i);return void 0===a?(n=new r4(e),t.set(i,[n])):r>=a.length?(n=new r4(e),a.push(n)):n=a[r],n},dispose:function(){t=new WeakMap}}}class r8 extends ie{copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}constructor(e){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(e)}}class r6 extends ie{copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}}function r9(e,t,i){let n=new i5,r=new eM,a=new eM,s=new eq,o=new r8({depthPacking:3201}),l=new r6,h={},c=i.maxTextureSize,u={0:1,1:0,2:2},d=new iV({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new eM},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),A=d.clone();A.defines.HORIZONTAL_PASS=1;let p=new i_;p.setAttribute("position",new io(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let g=new iF(p,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let f=this.type;function v(t,i,n,r){let a=null,s=!0===n.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===n.isPointLight?l:o,e.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){let e=a.uuid,t=i.uuid,n=h[e];void 0===n&&(n={},h[e]=n);let r=n[t];void 0===r&&(r=a.clone(),n[t]=r,i.addEventListener("dispose",_)),a=r}return a.visible=i.visible,a.wireframe=i.wireframe,3===r?a.side=null!==i.shadowSide?i.shadowSide:i.side:a.side=null!==i.shadowSide?i.shadowSide:u[i.side],a.alphaMap=i.alphaMap,a.alphaTest=i.alphaTest,a.map=i.map,a.clipShadows=i.clipShadows,a.clippingPlanes=i.clippingPlanes,a.clipIntersection=i.clipIntersection,a.displacementMap=i.displacementMap,a.displacementScale=i.displacementScale,a.displacementBias=i.displacementBias,a.wireframeLinewidth=i.wireframeLinewidth,a.linewidth=i.linewidth,!0===n.isPointLight&&!0===a.isMeshDistanceMaterial&&(e.properties.get(a).light=n),a}function _(e){for(let t in e.target.removeEventListener("dispose",_),h){let i=h[t],n=e.target.uuid;n in i&&(i[n].dispose(),delete i[n])}}this.render=function(i,o,l){if(!1===m.enabled||!1===m.autoUpdate&&!1===m.needsUpdate||0===i.length)return;let h=e.getRenderTarget(),u=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),_=e.state;_.setBlending(0),_.buffers.color.setClear(1,1,1,1),_.buffers.depth.setTest(!0),_.setScissorTest(!1);let y=3!==f&&3===this.type,E=3===f&&3!==this.type;for(let h=0,u=i.length;hc||r.y>c)&&(r.x>c&&(a.x=Math.floor(c/m.x),r.x=a.x*m.x,p.mapSize.x=a.x),r.y>c&&(a.y=Math.floor(c/m.y),r.y=a.y*m.y,p.mapSize.y=a.y)),null===p.map||!0===y||!0===E){let e=3!==this.type?{minFilter:1003,magFilter:1003}:{};null!==p.map&&p.map.dispose(),p.map=new ej(r.x,r.y,e),p.map.texture.name=u.name+".shadowMap",p.camera.updateProjectionMatrix()}e.setRenderTarget(p.map),e.clear();let f=p.getViewportCount();for(let i=0;i=1:-1!==T.indexOf("OpenGL ES")&&(b=parseFloat(/^OpenGL ES (\d)/.exec(T)[1])>=2);let B=null,R={},L=e.getParameter(e.SCISSOR_BOX),D=e.getParameter(e.VIEWPORT),U=new eq().fromArray(L),P=new eq().fromArray(D);function N(t,i,n,r){let a=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let s=0;si||r.height>i)&&(n=i/Math.max(r.width,r.height)),n<1)if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){let i=Math.floor(n*r.width),a=Math.floor(n*r.height);void 0===o&&(o=p(i,a));let s=t?p(i,a):o;return s.width=i,s.height=a,s.getContext("2d").drawImage(e,0,0,i,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+i+"x"+a+")."),s}else"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+").");return e}function m(e){return e.generateMipmaps&&1003!==e.minFilter&&1006!==e.minFilter}function f(t){e.generateMipmap(t)}function v(i,n,r,a){let s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(null!==i){if(void 0!==e[i])return e[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let o=n;if(n===e.RED&&(r===e.FLOAT&&(o=e.R32F),r===e.HALF_FLOAT&&(o=e.R16F),r===e.UNSIGNED_BYTE&&(o=e.R8)),n===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.R8UI),r===e.UNSIGNED_SHORT&&(o=e.R16UI),r===e.UNSIGNED_INT&&(o=e.R32UI),r===e.BYTE&&(o=e.R8I),r===e.SHORT&&(o=e.R16I),r===e.INT&&(o=e.R32I)),n===e.RG&&(r===e.FLOAT&&(o=e.RG32F),r===e.HALF_FLOAT&&(o=e.RG16F),r===e.UNSIGNED_BYTE&&(o=e.RG8)),n===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RG8UI),r===e.UNSIGNED_SHORT&&(o=e.RG16UI),r===e.UNSIGNED_INT&&(o=e.RG32UI),r===e.BYTE&&(o=e.RG8I),r===e.SHORT&&(o=e.RG16I),r===e.INT&&(o=e.RG32I)),n===e.RGB&&r===e.UNSIGNED_INT_5_9_9_9_REV&&(o=e.RGB9_E5),n===e.RGBA){let t=s?eA:eF.getTransfer(a);r===e.FLOAT&&(o=e.RGBA32F),r===e.HALF_FLOAT&&(o=e.RGBA16F),r===e.UNSIGNED_BYTE&&(o=t===ep?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)}return(o===e.R16F||o===e.R32F||o===e.RG16F||o===e.RG32F||o===e.RGBA16F||o===e.RGBA32F)&&t.get("EXT_color_buffer_float"),o}function _(e,t){return!0===m(e)||e.isFramebufferTexture&&1003!==e.minFilter&&1006!==e.minFilter?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function y(e){let t=e.target;t.removeEventListener("dispose",y),function(e){let t=n.get(e);if(void 0===t.__webglInit)return;let i=e.source,r=d.get(i);if(r){let n=r[t.__cacheKey];n.usedTimes--,0===n.usedTimes&&x(e),0===Object.keys(r).length&&d.delete(i)}n.remove(e)}(t),t.isVideoTexture&&u.delete(t)}function E(t){let i=t.target;i.removeEventListener("dispose",E),function(t){let i=n.get(t);if(t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(i.__webglFramebuffer[t]))for(let n=0;n0&&a.__version!==t.version){let e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void B(a,t,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+r)}let I={1e3:e.REPEAT,1001:e.CLAMP_TO_EDGE,1002:e.MIRRORED_REPEAT},M={1003:e.NEAREST,1004:e.NEAREST_MIPMAP_NEAREST,1005:e.NEAREST_MIPMAP_LINEAR,1006:e.LINEAR,1007:e.LINEAR_MIPMAP_NEAREST,1008:e.LINEAR_MIPMAP_LINEAR},w={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function b(i,a){if((1015===a.type&&!1===t.has("OES_texture_float_linear")&&(1006===a.magFilter||1007===a.magFilter||1005===a.magFilter||1008===a.magFilter||1006===a.minFilter||1007===a.minFilter||1005===a.minFilter||1008===a.minFilter)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(i,e.TEXTURE_WRAP_S,I[a.wrapS]),e.texParameteri(i,e.TEXTURE_WRAP_T,I[a.wrapT]),(i===e.TEXTURE_3D||i===e.TEXTURE_2D_ARRAY)&&e.texParameteri(i,e.TEXTURE_WRAP_R,I[a.wrapR]),e.texParameteri(i,e.TEXTURE_MAG_FILTER,M[a.magFilter]),e.texParameteri(i,e.TEXTURE_MIN_FILTER,M[a.minFilter]),a.compareFunction&&(e.texParameteri(i,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(i,e.TEXTURE_COMPARE_FUNC,w[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic"))&&1003!==a.magFilter&&(1005===a.minFilter||1008===a.minFilter)&&(1015!==a.type||!1!==t.has("OES_texture_float_linear"))&&(a.anisotropy>1||n.get(a).__currentAnisotropy)){let s=t.get("EXT_texture_filter_anisotropic");e.texParameterf(i,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),n.get(a).__currentAnisotropy=a.anisotropy}}function T(t,i){let n=!1;void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",y));let r=i.source,a=d.get(r);void 0===a&&(a={},d.set(r,a));let o=function(e){let t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(i);if(o!==t.__cacheKey){void 0===a[o]&&(a[o]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,n=!0),a[o].usedTimes++;let r=a[t.__cacheKey];void 0!==r&&(a[t.__cacheKey].usedTimes--,0===r.usedTimes&&x(i)),t.__cacheKey=o,t.__webglTexture=a[o].texture}return n}function B(t,s,o){let l=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=e.TEXTURE_3D);let h=T(t,s),c=s.source;i.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);let u=n.get(c);if(c.version!==u.__version||!0===h){let t;i.activeTexture(e.TEXTURE0+o);let n=eF.getPrimaries(eF.workingColorSpace),d=""===s.colorSpace?null:eF.getPrimaries(s.colorSpace),A=""===s.colorSpace||n===d?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,A);let p=g(s.image,!1,r.maxTextureSize);p=N(s,p);let y=a.convert(s.format,s.colorSpace),E=a.convert(s.type),x=v(s.internalFormat,y,E,s.colorSpace,s.isVideoTexture);b(l,s);let S=s.mipmaps,C=!0!==s.isVideoTexture&&36196!==x,I=void 0===u.__version||!0===h,M=c.dataReady,w=_(s,p);if(s.isDepthTexture)x=e.DEPTH_COMPONENT16,1015===s.type?x=e.DEPTH_COMPONENT32F:1014===s.type?x=e.DEPTH_COMPONENT24:1020===s.type&&(x=e.DEPTH24_STENCIL8),I&&(C?i.texStorage2D(e.TEXTURE_2D,1,x,p.width,p.height):i.texImage2D(e.TEXTURE_2D,0,x,p.width,p.height,0,y,E,null));else if(s.isDataTexture)if(S.length>0){C&&I&&i.texStorage2D(e.TEXTURE_2D,w,x,S[0].width,S[0].height);for(let n=0,r=S.length;n>=1,n>>=1}}else if(S.length>0){if(C&&I){let t=F(S[0]);i.texStorage2D(e.TEXTURE_2D,w,x,t.width,t.height)}for(let n=0,r=S.length;n>c),n=Math.max(1,r.height>>c);h===e.TEXTURE_3D||h===e.TEXTURE_2D_ARRAY?i.texImage3D(h,c,A,t,n,r.depth,0,u,d,null):i.texImage2D(h,c,A,t,n,0,u,d,null)}i.bindFramebuffer(e.FRAMEBUFFER,t),P(r)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,o,h,n.get(s).__webglTexture,0,U(r)):(h===e.TEXTURE_2D||h>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&h<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,o,h,n.get(s).__webglTexture,c),i.bindFramebuffer(e.FRAMEBUFFER,null)}function L(t,i,n){if(e.bindRenderbuffer(e.RENDERBUFFER,t),i.depthBuffer&&!i.stencilBuffer){let r=e.DEPTH_COMPONENT24;if(n||P(i)){let t=i.depthTexture;t&&t.isDepthTexture&&(1015===t.type?r=e.DEPTH_COMPONENT32F:1014===t.type&&(r=e.DEPTH_COMPONENT24));let n=U(i);P(i)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,n,r,i.width,i.height):e.renderbufferStorageMultisample(e.RENDERBUFFER,n,r,i.width,i.height)}else e.renderbufferStorage(e.RENDERBUFFER,r,i.width,i.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)}else if(i.depthBuffer&&i.stencilBuffer){let r=U(i);n&&!1===P(i)?e.renderbufferStorageMultisample(e.RENDERBUFFER,r,e.DEPTH24_STENCIL8,i.width,i.height):P(i)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,r,e.DEPTH24_STENCIL8,i.width,i.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,i.width,i.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)}else{let t=i.textures;for(let r=0;r0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function N(e,t){let i=e.colorSpace,n=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||i!==ec&&""!==i&&(eF.getTransfer(i)===ep?(1023!==n||1009!==r)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",i)),t}function F(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(c.width=e.naturalWidth||e.width,c.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(c.width=e.displayWidth,c.height=e.displayHeight):(c.width=e.width,c.height=e.height),c}this.allocateTextureUnit=function(){let e=S;return e>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),S+=1,e},this.resetTextureUnits=function(){S=0},this.setTexture2D=C,this.setTexture2DArray=function(t,r){let a=n.get(t);if(t.version>0&&a.__version!==t.version)return void B(a,t,r);i.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+r)},this.setTexture3D=function(t,r){let a=n.get(t);if(t.version>0&&a.__version!==t.version)return void B(a,t,r);i.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,s){let o=n.get(t);if(t.version>0&&o.__version!==t.version)return void function(t,s,o){if(6!==s.image.length)return;let l=T(t,s),h=s.source;i.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);let c=n.get(h);if(h.version!==c.__version||!0===l){let t;i.activeTexture(e.TEXTURE0+o);let n=eF.getPrimaries(eF.workingColorSpace),u=""===s.colorSpace?null:eF.getPrimaries(s.colorSpace),d=""===s.colorSpace||n===u?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let A=s.isCompressedTexture||s.image[0].isCompressedTexture,p=s.image[0]&&s.image[0].isDataTexture,y=[];for(let e=0;e<6;e++)A||p?y[e]=p?s.image[e].image:s.image[e]:y[e]=g(s.image[e],!0,r.maxCubemapSize),y[e]=N(s,y[e]);let E=y[0],x=a.convert(s.format,s.colorSpace),S=a.convert(s.type),C=v(s.internalFormat,x,S,s.colorSpace),I=!0!==s.isVideoTexture,M=void 0===c.__version||!0===l,w=h.dataReady,T=_(s,E);if(b(e.TEXTURE_CUBE_MAP,s),A){I&&M&&i.texStorage2D(e.TEXTURE_CUBE_MAP,T,C,E.width,E.height);for(let n=0;n<6;n++){t=y[n].mipmaps;for(let r=0;r0&&T++;let n=F(y[0]);i.texStorage2D(e.TEXTURE_CUBE_MAP,T,C,n.width,n.height)}for(let n=0;n<6;n++)if(p){I?w&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,0,0,y[n].width,y[n].height,x,S,y[n].data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,C,y[n].width,y[n].height,0,x,S,y[n].data);for(let r=0;r1;if(!u&&(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,s.memory.textures++),c){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let i=0;i0){o.__webglFramebuffer=[];for(let t=0;t0&&!1===P(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],i.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let i=0;i0)for(let n=0;n0)for(let i=0;i0&&!1===P(t)){let r=t.textures,a=t.width,s=t.height,o=e.COLOR_BUFFER_BIT,l=[],c=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=n.get(t),d=r.length>1;if(d)for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:"",a=eF.getTransfer(r);if(1009===i)return e.UNSIGNED_BYTE;if(1017===i)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===i)return e.UNSIGNED_SHORT_5_5_5_1;if(35902===i)return e.UNSIGNED_INT_5_9_9_9_REV;if(1010===i)return e.BYTE;if(1011===i)return e.SHORT;if(1012===i)return e.UNSIGNED_SHORT;if(1013===i)return e.INT;if(1014===i)return e.UNSIGNED_INT;if(1015===i)return e.FLOAT;if(1016===i)return e.HALF_FLOAT;if(1021===i)return e.ALPHA;if(1022===i)return e.RGB;if(1023===i)return e.RGBA;if(1024===i)return e.LUMINANCE;if(1025===i)return e.LUMINANCE_ALPHA;if(1026===i)return e.DEPTH_COMPONENT;if(1027===i)return e.DEPTH_STENCIL;if(1028===i)return e.RED;if(1029===i)return e.RED_INTEGER;if(1030===i)return e.RG;if(1031===i)return e.RG_INTEGER;if(1033===i)return e.RGBA_INTEGER;if(33776===i||33777===i||33778===i||33779===i)if(a===ep){if(null===(n=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(33776===i)return n.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===i)return n.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===i)return n.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===i)return n.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(n=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===i)return n.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===i)return n.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===i)return n.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===i)return n.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===i||35841===i||35842===i||35843===i){if(null===(n=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===i)return n.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===i)return n.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===i)return n.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===i)return n.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===i)return null!==(n=t.get("WEBGL_compressed_texture_etc1"))?n.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===i||37496===i){if(null===(n=t.get("WEBGL_compressed_texture_etc")))return null;if(37492===i)return a===ep?n.COMPRESSED_SRGB8_ETC2:n.COMPRESSED_RGB8_ETC2;if(37496===i)return a===ep?n.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:n.COMPRESSED_RGBA8_ETC2_EAC}if(37808===i||37809===i||37810===i||37811===i||37812===i||37813===i||37814===i||37815===i||37816===i||37817===i||37818===i||37819===i||37820===i||37821===i){if(null===(n=t.get("WEBGL_compressed_texture_astc")))return null;if(37808===i)return a===ep?n.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:n.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===i)return a===ep?n.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:n.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===i)return a===ep?n.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:n.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===i)return a===ep?n.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:n.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===i)return a===ep?n.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:n.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===i)return a===ep?n.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:n.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===i)return a===ep?n.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:n.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===i)return a===ep?n.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:n.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===i)return a===ep?n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:n.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===i)return a===ep?n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:n.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===i)return a===ep?n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:n.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===i)return a===ep?n.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:n.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===i)return a===ep?n.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:n.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===i)return a===ep?n.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:n.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===i||36494===i||36495===i){if(null===(n=t.get("EXT_texture_compression_bptc")))return null;if(36492===i)return a===ep?n.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:n.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(36494===i)return n.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(36495===i)return n.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===i||36284===i||36285===i||36286===i){if(null===(n=t.get("EXT_texture_compression_rgtc")))return null;if(36492===i)return n.COMPRESSED_RED_RGTC1_EXT;if(36284===i)return n.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===i)return n.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===i)return n.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return 1020===i?e.UNSIGNED_INT_24_8:void 0!==e[i]?e[i]:null}}}class ai extends iY{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class an extends tW{constructor(){super(),this.isGroup=!0,this.type="Group"}}let ar={type:"move"};class aa{getHandSpace(){return null===this._hand&&(this._hand=new an,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 an,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new eZ,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new eZ),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new an,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new eZ,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new eZ),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,i){let n=null,r=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){for(let n of(a=!0,e.hand.values())){let e=t.getJointPose(n,i),r=this._getHandJoint(l,n);null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=e.radius),r.visible=null!==e}let n=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=n.position.distanceTo(r.position);l.inputState.pinching&&s>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,i))&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1);null!==s&&(null===(n=t.getPose(e.targetRaySpace,i))&&null!==r&&(n=r),null!==n&&(s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,n.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(n.linearVelocity)):s.hasLinearVelocity=!1,n.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(n.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(ar)))}return null!==s&&(s.visible=null!==n),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let i=new an;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}constructor(){this._targetRay=null,this._grip=null,this._hand=null}}class as{init(e,t,i){if(null===this.texture){let n=new eW;e.properties.get(n).__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}render(e,t){if(null!==this.texture){if(null===this.mesh){let e=t.cameras[0].viewport,i=new iV({vertexShader:"\nvoid main() {\n\n gl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n if ( coord.x >= 1.0 ) {\n\n gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n } else {\n\n gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n }\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new iF(new i9(20,20),i)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}}class ao extends ef{constructor(e,t){super();let i=this,n=null,r=1,a=null,s="local-floor",o=1,l=null,h=null,c=null,u=null,d=null,A=null,p=new as,g=t.getContextAttributes(),m=null,f=null,v=[],_=[],y=new eM,E=null,x=new iY;x.layers.enable(1),x.viewport=new eq;let S=new iY;S.layers.enable(2),S.viewport=new eq;let C=[x,S],I=new ai;I.layers.enable(1),I.layers.enable(2);let M=null,w=null;function b(e){let t=_.indexOf(e.inputSource);if(-1===t)return;let i=v[t];void 0!==i&&(i.update(e.inputSource,e.frame,l||a),i.dispatchEvent({type:e.type,data:e.inputSource}))}function T(){n.removeEventListener("select",b),n.removeEventListener("selectstart",b),n.removeEventListener("selectend",b),n.removeEventListener("squeeze",b),n.removeEventListener("squeezestart",b),n.removeEventListener("squeezeend",b),n.removeEventListener("end",T),n.removeEventListener("inputsourceschange",B);for(let e=0;e=0&&(_[n]=null,v[n].disconnect(i))}for(let t=0;t=_.length){_.push(i),n=e;break}else if(null===_[e]){_[e]=i,n=e;break}if(-1===n)break}let r=v[n];r&&r.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=v[e];return void 0===t&&(t=new aa,v[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=v[e];return void 0===t&&(t=new aa,v[e]=t),t.getGripSpace()},this.getHand=function(e){let t=v[e];return void 0===t&&(t=new aa,v[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return c},this.getFrame=function(){return A},this.getSession=function(){return n},this.setSession=async function(h){if(null!==(n=h)){if(m=e.getRenderTarget(),n.addEventListener("select",b),n.addEventListener("selectstart",b),n.addEventListener("selectend",b),n.addEventListener("squeeze",b),n.addEventListener("squeezestart",b),n.addEventListener("squeezeend",b),n.addEventListener("end",T),n.addEventListener("inputsourceschange",B),!0!==g.xrCompatible&&await t.makeXRCompatible(),E=e.getPixelRatio(),e.getSize(y),void 0===n.renderState.layers){let i={antialias:g.antialias,alpha:!0,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(n,t,i),n.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),f=new ej(d.framebufferWidth,d.framebufferHeight,{format:1023,type:1009,colorSpace:e.outputColorSpace,stencilBuffer:g.stencil})}else{let i=null,a=null,s=null;g.depth&&(s=g.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,i=g.stencil?1027:1026,a=g.stencil?1020:1014);let o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:r};u=(c=new XRWebGLBinding(n,t)).createProjectionLayer(o),n.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),f=new ej(u.textureWidth,u.textureHeight,{format:1023,type:1009,depthTexture:new nP(u.textureWidth,u.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:g.stencil,colorSpace:e.outputColorSpace,samples:4*!!g.antialias}),e.properties.get(f).__ignoreDepthValues=u.ignoreDepthValues}f.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await n.requestReferenceSpace(s),P.setContext(n),P.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==n)return n.environmentBlendMode};let R=new eZ,L=new eZ;function D(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var t,i,r;if(null===n)return;null!==p.texture&&(e.near=p.depthNear,e.far=p.depthFar),I.near=S.near=x.near=e.near,I.far=S.far=x.far=e.far,(M!==I.near||w!==I.far)&&(n.updateRenderState({depthNear:I.near,depthFar:I.far}),M=I.near,w=I.far,x.near=M,x.far=w,S.near=M,S.far=w,x.updateProjectionMatrix(),S.updateProjectionMatrix(),e.updateProjectionMatrix());let a=e.parent,s=I.cameras;D(I,a);for(let e=0;e0&&(n.alphaTest.value=r.alphaTest);let a=t.get(r),s=a.envMap,o=a.envMapRotation;if(s&&(n.envMap.value=s,al.copy(o),al.x*=-1,al.y*=-1,al.z*=-1,s.isCubeTexture&&!1===s.isRenderTargetTexture&&(al.y*=-1,al.z*=-1),n.envMapRotation.value.setFromMatrix4(ah.makeRotationFromEuler(al)),n.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,n.reflectivity.value=r.reflectivity,n.ior.value=r.ior,n.refractionRatio.value=r.refractionRatio),r.lightMap){n.lightMap.value=r.lightMap;let t=!0===e._useLegacyLights?Math.PI:1;n.lightMapIntensity.value=r.lightMapIntensity*t,i(r.lightMap,n.lightMapTransform)}r.aoMap&&(n.aoMap.value=r.aoMap,n.aoMapIntensity.value=r.aoMapIntensity,i(r.aoMap,n.aoMapTransform))}return{refreshFogUniforms:function(t,i){i.color.getRGB(t.fogColor.value,iH(e)),i.isFog?(t.fogNear.value=i.near,t.fogFar.value=i.far):i.isFogExp2&&(t.fogDensity.value=i.density)},refreshMaterialUniforms:function(e,r,a,s,o){var l,h,c,u,d,A,p,g,m,f,v,_,y,E,x,S,C,I,M,w,b;r.isMeshBasicMaterial||r.isMeshLambertMaterial?n(e,r):r.isMeshToonMaterial?(n(e,r),l=e,(h=r).gradientMap&&(l.gradientMap.value=h.gradientMap)):r.isMeshPhongMaterial?(n(e,r),c=e,u=r,c.specular.value.copy(u.specular),c.shininess.value=Math.max(u.shininess,1e-4)):r.isMeshStandardMaterial?(n(e,r),d=e,A=r,d.metalness.value=A.metalness,A.metalnessMap&&(d.metalnessMap.value=A.metalnessMap,i(A.metalnessMap,d.metalnessMapTransform)),d.roughness.value=A.roughness,A.roughnessMap&&(d.roughnessMap.value=A.roughnessMap,i(A.roughnessMap,d.roughnessMapTransform)),A.envMap&&(d.envMapIntensity.value=A.envMapIntensity),r.isMeshPhysicalMaterial&&(p=e,g=r,m=o,p.ior.value=g.ior,g.sheen>0&&(p.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),p.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(p.sheenColorMap.value=g.sheenColorMap,i(g.sheenColorMap,p.sheenColorMapTransform)),g.sheenRoughnessMap&&(p.sheenRoughnessMap.value=g.sheenRoughnessMap,i(g.sheenRoughnessMap,p.sheenRoughnessMapTransform))),g.clearcoat>0&&(p.clearcoat.value=g.clearcoat,p.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(p.clearcoatMap.value=g.clearcoatMap,i(g.clearcoatMap,p.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,i(g.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(p.clearcoatNormalMap.value=g.clearcoatNormalMap,i(g.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),1===g.side&&p.clearcoatNormalScale.value.negate())),g.iridescence>0&&(p.iridescence.value=g.iridescence,p.iridescenceIOR.value=g.iridescenceIOR,p.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(p.iridescenceMap.value=g.iridescenceMap,i(g.iridescenceMap,p.iridescenceMapTransform)),g.iridescenceThicknessMap&&(p.iridescenceThicknessMap.value=g.iridescenceThicknessMap,i(g.iridescenceThicknessMap,p.iridescenceThicknessMapTransform))),g.transmission>0&&(p.transmission.value=g.transmission,p.transmissionSamplerMap.value=m.texture,p.transmissionSamplerSize.value.set(m.width,m.height),g.transmissionMap&&(p.transmissionMap.value=g.transmissionMap,i(g.transmissionMap,p.transmissionMapTransform)),p.thickness.value=g.thickness,g.thicknessMap&&(p.thicknessMap.value=g.thicknessMap,i(g.thicknessMap,p.thicknessMapTransform)),p.attenuationDistance.value=g.attenuationDistance,p.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(p.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(p.anisotropyMap.value=g.anisotropyMap,i(g.anisotropyMap,p.anisotropyMapTransform))),p.specularIntensity.value=g.specularIntensity,p.specularColor.value.copy(g.specularColor),g.specularColorMap&&(p.specularColorMap.value=g.specularColorMap,i(g.specularColorMap,p.specularColorMapTransform)),g.specularIntensityMap&&(p.specularIntensityMap.value=g.specularIntensityMap,i(g.specularIntensityMap,p.specularIntensityMapTransform)))):r.isMeshMatcapMaterial?(n(e,r),f=e,(v=r).matcap&&(f.matcap.value=v.matcap)):r.isMeshDepthMaterial?n(e,r):r.isMeshDistanceMaterial?(n(e,r),function(e,i){let n=t.get(i).light;e.referencePosition.value.setFromMatrixPosition(n.matrixWorld),e.nearDistance.value=n.shadow.camera.near,e.farDistance.value=n.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?n(e,r):r.isLineBasicMaterial?(_=e,y=r,_.diffuse.value.copy(y.color),_.opacity.value=y.opacity,y.map&&(_.map.value=y.map,i(y.map,_.mapTransform)),r.isLineDashedMaterial&&(E=e,x=r,E.dashSize.value=x.dashSize,E.totalSize.value=x.dashSize+x.gapSize,E.scale.value=x.scale)):r.isPointsMaterial?(S=e,C=r,I=a,M=s,S.diffuse.value.copy(C.color),S.opacity.value=C.opacity,S.size.value=C.size*I,S.scale.value=.5*M,C.map&&(S.map.value=C.map,i(C.map,S.uvTransform)),C.alphaMap&&(S.alphaMap.value=C.alphaMap,i(C.alphaMap,S.alphaMapTransform)),C.alphaTest>0&&(S.alphaTest.value=C.alphaTest)):r.isSpriteMaterial?(w=e,b=r,w.diffuse.value.copy(b.color),w.opacity.value=b.opacity,w.rotation.value=b.rotation,b.map&&(w.map.value=b.map,i(b.map,w.mapTransform)),b.alphaMap&&(w.alphaMap.value=b.alphaMap,i(b.alphaMap,w.alphaMapTransform)),b.alphaTest>0&&(w.alphaTest.value=b.alphaTest)):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function au(e,t,i,n){let r={},a={},s=[],o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e){let t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function h(t){let i=t.target;i.removeEventListener("dispose",h);let n=s.indexOf(i.__bindingPointIndex);s.splice(n,1),e.deleteBuffer(r[i.id]),delete r[i.id],delete a[i.id]}return{bind:function(e,t){let i=t.program;n.uniformBlockBinding(e,i)},update:function(i,c){let u=r[i.id];void 0===u&&(function(e){let t=e.uniforms,i=0;for(let e=0,n=t.length;e0&&(i+=16-n),e.__size=i,e.__cache={}}(i),u=function(t){let i=function(){for(let e=0;e2)||void 0===arguments[2]||arguments[2];if(eE.isPresenting)return void console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");ee=e,et=t,M.width=Math.floor(e*ei),M.height=Math.floor(t*ei),!0===i&&(M.style.width=e+"px",M.style.height=t+"px"),this.setViewport(0,0,e,t)},this.getDrawingBufferSize=function(e){return e.set(ee*ei,et*ei).floor()},this.setDrawingBufferSize=function(e,t,i){ee=e,et=t,ei=i,M.width=Math.floor(e*i),M.height=Math.floor(t*i),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(Y)},this.getViewport=function(e){return e.copy(ea)},this.setViewport=function(e,t,i,n){e.isVector4?ea.set(e.x,e.y,e.z,e.w):ea.set(e,t,i,n),r.viewport(Y.copy(ea).multiplyScalar(ei).round())},this.getScissor=function(e){return e.copy(es)},this.setScissor=function(e,t,i,n){e.isVector4?es.set(e.x,e.y,e.z,e.w):es.set(e,t,i,n),r.scissor(K.copy(es).multiplyScalar(ei).round())},this.getScissorTest=function(){return eo},this.setScissorTest=function(e){r.setScissorTest(eo=e)},this.setOpaqueSort=function(e){en=e},this.setTransparentSort=function(e){er=e},this.getClearColor=function(e){return e.copy(_.getClearColor())},this.setClearColor=function(){_.setClearColor.apply(_,arguments)},this.getClearAlpha=function(){return _.getClearAlpha()},this.setClearAlpha=function(){_.setClearAlpha.apply(_,arguments)},this.clear=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=0;if(e){let e=!1;if(null!==q){let t=q.texture.format;e=1033===t||1031===t||1029===t}if(e){let e=q.texture.type,t=1009===e||1014===e||1012===e||1020===e||1017===e||1018===e,i=_.getClearColor(),n=_.getClearAlpha(),r=i.r,a=i.g,s=i.b;t?(N[0]=r,N[1]=a,N[2]=s,N[3]=n,ev.clearBufferuiv(ev.COLOR,0,N)):(F[0]=r,F[1]=a,F[2]=s,F[3]=n,ev.clearBufferiv(ev.COLOR,0,F))}else n|=ev.COLOR_BUFFER_BIT}t&&(n|=ev.DEPTH_BUFFER_BIT),i&&(n|=ev.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(0xffffffff)),ev.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(){M.removeEventListener("webglcontextlost",ex,!1),M.removeEventListener("webglcontextrestored",eS,!1),M.removeEventListener("webglcontextcreationerror",eC,!1),g.dispose(),m.dispose(),s.dispose(),l.dispose(),h.dispose(),d.dispose(),C.dispose(),I.dispose(),A.dispose(),eE.dispose(),eE.removeEventListener("sessionstart",eT),eE.removeEventListener("sessionend",eR),eL.stop()},this.renderBufferDirect=function(e,t,i,a,d,A){let g;null===t&&(t=em);let m=d.isMesh&&0>d.matrixWorld.determinant(),v=function(e,t,i,a,c){var u,d;!0!==t.isScene&&(t=em),o.resetTextureUnits();let A=t.fog,g=a.isMeshStandardMaterial?t.environment:null,m=null===q?H.outputColorSpace:!0===q.isXRRenderTarget?q.texture.colorSpace:ec,v=(a.isMeshStandardMaterial?h:l).get(a.envMap||g),_=!0===a.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,E=!!i.attributes.tangent&&(!!a.normalMap||a.anisotropy>0),x=!!i.morphAttributes.position,S=!!i.morphAttributes.normal,C=!!i.morphAttributes.color,M=0;a.toneMapped&&(null===q||!0===q.isXRRenderTarget)&&(M=H.toneMapping);let w=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,b=void 0!==w?w.length:0,T=s.get(a),B=O.state.lights;if(!0===eu&&(!0===ed||e!==j)){let t=e===j&&a.id===X;f.setState(a,e,t)}let R=!1;a.version===T.__version?T.needsLights&&T.lightsStateVersion!==B.state.version||T.outputColorSpace!==m||c.isBatchedMesh&&!1===T.batching?R=!0:c.isBatchedMesh||!0!==T.batching?c.isInstancedMesh&&!1===T.instancing?R=!0:c.isInstancedMesh||!0!==T.instancing?c.isSkinnedMesh&&!1===T.skinning?R=!0:c.isSkinnedMesh||!0!==T.skinning?c.isInstancedMesh&&!0===T.instancingColor&&null===c.instanceColor||c.isInstancedMesh&&!1===T.instancingColor&&null!==c.instanceColor||c.isInstancedMesh&&!0===T.instancingMorph&&null===c.morphTexture||c.isInstancedMesh&&!1===T.instancingMorph&&null!==c.morphTexture||T.envMap!==v||!0===a.fog&&T.fog!==A||void 0!==T.numClippingPlanes&&(T.numClippingPlanes!==f.numPlanes||T.numIntersection!==f.numIntersection)||T.vertexAlphas!==_||T.vertexTangents!==E||T.morphTargets!==x||T.morphNormals!==S||T.morphColors!==C||T.toneMapping!==M?R=!0:T.morphTargetsCount!==b&&(R=!0):R=!0:R=!0:R=!0:(R=!0,T.__version=a.version);let L=T.currentProgram;!0===R&&(L=eN(a,t,c));let D=!1,U=!1,P=!1,N=L.getUniforms(),F=T.uniforms;if(r.useProgram(L.program)&&(D=!0,U=!0,P=!0),a.id!==X&&(X=a.id,U=!0),D||j!==e){N.setValue(ev,"projectionMatrix",e.projectionMatrix),N.setValue(ev,"viewMatrix",e.matrixWorldInverse);let t=N.map.cameraPosition;void 0!==t&&t.setValue(ev,eg.setFromMatrixPosition(e.matrixWorld)),n.logarithmicDepthBuffer&&N.setValue(ev,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(a.isMeshPhongMaterial||a.isMeshToonMaterial||a.isMeshLambertMaterial||a.isMeshBasicMaterial||a.isMeshStandardMaterial||a.isShaderMaterial)&&N.setValue(ev,"isOrthographic",!0===e.isOrthographicCamera),j!==e&&(j=e,U=!0,P=!0)}if(c.isSkinnedMesh){N.setOptional(ev,c,"bindMatrix"),N.setOptional(ev,c,"bindMatrixInverse");let e=c.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),N.setValue(ev,"boneTexture",e.boneTexture,o))}c.isBatchedMesh&&(N.setOptional(ev,c,"batchingTexture"),N.setValue(ev,"batchingTexture",c._matricesTexture,o));let Q=i.morphAttributes;if((void 0!==Q.position||void 0!==Q.normal||void 0!==Q.color)&&y.update(c,i,L),(U||T.receiveShadow!==c.receiveShadow)&&(T.receiveShadow=c.receiveShadow,N.setValue(ev,"receiveShadow",c.receiveShadow)),a.isMeshGouraudMaterial&&null!==a.envMap&&(F.envMap.value=v,F.flipEnvMap.value=v.isCubeTexture&&!1===v.isRenderTargetTexture?-1:1),a.isMeshStandardMaterial&&null===a.envMap&&null!==t.environment&&(F.envMapIntensity.value=t.environmentIntensity),U&&(N.setValue(ev,"toneMappingExposure",H.toneMappingExposure),T.needsLights&&(u=F,d=P,u.ambientLightColor.needsUpdate=d,u.lightProbe.needsUpdate=d,u.directionalLights.needsUpdate=d,u.directionalLightShadows.needsUpdate=d,u.pointLights.needsUpdate=d,u.pointLightShadows.needsUpdate=d,u.spotLights.needsUpdate=d,u.spotLightShadows.needsUpdate=d,u.rectAreaLights.needsUpdate=d,u.hemisphereLights.needsUpdate=d),A&&!0===a.fog&&p.refreshFogUniforms(F,A),p.refreshMaterialUniforms(F,a,ei,et,O.state.transmissionRenderTarget),rT.upload(ev,eF(T),F,o)),a.isShaderMaterial&&!0===a.uniformsNeedUpdate&&(rT.upload(ev,eF(T),F,o),a.uniformsNeedUpdate=!1),a.isSpriteMaterial&&N.setValue(ev,"center",c.center),N.setValue(ev,"modelViewMatrix",c.modelViewMatrix),N.setValue(ev,"normalMatrix",c.normalMatrix),N.setValue(ev,"modelMatrix",c.matrixWorld),a.isShaderMaterial||a.isRawShaderMaterial){let e=a.uniformsGroups;for(let t=0,i=e.length;t2&&void 0!==arguments[2]?arguments[2]:null;null===i&&(i=e),(O=m.get(i)).init(),G.push(O),i.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(O.pushLight(e),e.castShadow&&O.pushShadow(e))}),e!==i&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(O.pushLight(e),e.castShadow&&O.pushShadow(e))}),O.setupLights(H._useLegacyLights);let n=new Set;return e.traverse(function(e){let t=e.material;if(t)if(Array.isArray(t))for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:null,r=this.compile(e,t,n);return new Promise(t=>{function n(){if(r.forEach(function(e){s.get(e).currentProgram.isReady()&&r.delete(e)}),0===r.size)return void t(e);setTimeout(n,10)}null!==i.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)})};let eb=null;function eT(){eL.stop()}function eR(){eL.start()}let eL=new i8;function eD(e,t,n,a){let l=e.opaque,h=e.transmissive,c=e.transparent;O.setupLightsView(n),!0===eu&&f.setGlobalState(H.clippingPlanes,n),h.length>0&&function(e,t,n,r){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;null===O.state.transmissionRenderTarget&&(O.state.transmissionRenderTarget=new ej(1,1,{generateMipmaps:!0,type:i.has("EXT_color_buffer_half_float")||i.has("EXT_color_buffer_float")?1016:1009,minFilter:1008,samples:4,stencilBuffer:T}),s.get(O.state.transmissionRenderTarget).__isTransmissionRenderTarget=!0);let a=O.state.transmissionRenderTarget;H.getDrawingBufferSize(ep),a.setSize(ep.x,ep.y);let l=H.getRenderTarget();H.setRenderTarget(a),H.getClearColor(Z),($=H.getClearAlpha())<1&&H.setClearColor(0xffffff,.5),H.clear();let h=H.toneMapping;H.toneMapping=0,eU(e,n,r),o.updateMultisampleRenderTarget(a),o.updateRenderTargetMipmap(a);let c=!1;for(let e=0,i=t.length;e0&&eU(l,t,n),h.length>0&&eU(h,t,n),c.length>0&&eU(c,t,n),r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),r.setPolygonOffset(!1)}function eU(e,t,i){let n=!0===t.isScene?t.overrideMaterial:null;for(let r=0,a=e.length;r0?G[G.length-1]:null,k.pop(),Q=k.length>0?k[k.length-1]:null},this.getActiveCubeFace=function(){return V},this.getActiveMipmapLevel=function(){return W},this.getRenderTarget=function(){return q},this.setRenderTargetTextures=function(e,t,n){s.get(e.texture).__webglTexture=t,s.get(e.depthTexture).__webglTexture=n;let r=s.get(e);r.__hasExternalTextures=!0,r.__autoAllocateDepthBuffer=void 0===n,r.__autoAllocateDepthBuffer||!0!==i.has("WEBGL_multisampled_render_to_texture")||(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),r.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(e,t){let i=s.get(e);i.__webglFramebuffer=t,i.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;q=e,V=t,W=i;let n=!0,a=null,l=!1,h=!1;if(e){let c=s.get(e);void 0!==c.__useDefaultFramebuffer?(r.bindFramebuffer(ev.FRAMEBUFFER,null),n=!1):void 0===c.__webglFramebuffer?o.setupRenderTarget(e):c.__hasExternalTextures&&o.rebindTextures(e,s.get(e.texture).__webglTexture,s.get(e.depthTexture).__webglTexture);let u=e.texture;(u.isData3DTexture||u.isDataArrayTexture||u.isCompressedArrayTexture)&&(h=!0);let d=s.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(a=Array.isArray(d[t])?d[t][i]:d[t],l=!0):a=e.samples>0&&!1===o.useMultisampledRTT(e)?s.get(e).__webglMultisampledFramebuffer:Array.isArray(d)?d[i]:d,Y.copy(e.viewport),K.copy(e.scissor),J=e.scissorTest}else Y.copy(ea).multiplyScalar(ei).floor(),K.copy(es).multiplyScalar(ei).floor(),J=eo;if(r.bindFramebuffer(ev.FRAMEBUFFER,a)&&n&&r.drawBuffers(e,a),r.viewport(Y),r.scissor(K),r.setScissorTest(J),l){let n=s.get(e.texture);ev.framebufferTexture2D(ev.FRAMEBUFFER,ev.COLOR_ATTACHMENT0,ev.TEXTURE_CUBE_MAP_POSITIVE_X+t,n.__webglTexture,i)}else if(h){let n=s.get(e.texture);ev.framebufferTextureLayer(ev.FRAMEBUFFER,ev.COLOR_ATTACHMENT0,n.__webglTexture,i||0,t||0)}X=-1},this.readRenderTargetPixels=function(e,t,n,a,o,l,h){if(!(e&&e.isWebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let c=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==h&&(c=c[h]),c){r.bindFramebuffer(ev.FRAMEBUFFER,c);try{let r=e.texture,s=r.format,h=r.type;if(1023!==s&&S.convert(s)!==ev.getParameter(ev.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");let c=1016===h&&(i.has("EXT_color_buffer_half_float")||i.has("EXT_color_buffer_float"));if(1009!==h&&S.convert(h)!==ev.getParameter(ev.IMPLEMENTATION_COLOR_READ_TYPE)&&1015!==h&&!c)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-a&&n>=0&&n<=e.height-o&&ev.readPixels(t,n,a,o,S.convert(s),S.convert(h),l)}finally{let e=null!==q?s.get(q).__webglFramebuffer:null;r.bindFramebuffer(ev.FRAMEBUFFER,e)}}},this.copyFramebufferToTexture=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=Math.pow(2,-i),a=Math.floor(t.image.width*n),s=Math.floor(t.image.height*n);o.setTexture2D(t,0),ev.copyTexSubImage2D(ev.TEXTURE_2D,i,0,0,e.x,e.y,a,s),r.unbindTexture()},this.copyTextureToTexture=function(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=t.image.width,s=t.image.height,l=S.convert(i.format),h=S.convert(i.type);o.setTexture2D(i,0),ev.pixelStorei(ev.UNPACK_FLIP_Y_WEBGL,i.flipY),ev.pixelStorei(ev.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),ev.pixelStorei(ev.UNPACK_ALIGNMENT,i.unpackAlignment),t.isDataTexture?ev.texSubImage2D(ev.TEXTURE_2D,n,e.x,e.y,a,s,l,h,t.image.data):t.isCompressedTexture?ev.compressedTexSubImage2D(ev.TEXTURE_2D,n,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,l,t.mipmaps[0].data):ev.texSubImage2D(ev.TEXTURE_2D,n,e.x,e.y,l,h,t.image),0===n&&i.generateMipmaps&&ev.generateMipmap(ev.TEXTURE_2D),r.unbindTexture()},this.copyTextureToTexture3D=function(e,t,i,n){let a,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=Math.round(e.max.x-e.min.x),h=Math.round(e.max.y-e.min.y),c=e.max.z-e.min.z+1,u=S.convert(n.format),d=S.convert(n.type);if(n.isData3DTexture)o.setTexture3D(n,0),a=ev.TEXTURE_3D;else{if(!n.isDataArrayTexture&&!n.isCompressedArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");o.setTexture2DArray(n,0),a=ev.TEXTURE_2D_ARRAY}ev.pixelStorei(ev.UNPACK_FLIP_Y_WEBGL,n.flipY),ev.pixelStorei(ev.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),ev.pixelStorei(ev.UNPACK_ALIGNMENT,n.unpackAlignment);let A=ev.getParameter(ev.UNPACK_ROW_LENGTH),p=ev.getParameter(ev.UNPACK_IMAGE_HEIGHT),g=ev.getParameter(ev.UNPACK_SKIP_PIXELS),m=ev.getParameter(ev.UNPACK_SKIP_ROWS),f=ev.getParameter(ev.UNPACK_SKIP_IMAGES),v=i.isCompressedTexture?i.mipmaps[s]:i.image;ev.pixelStorei(ev.UNPACK_ROW_LENGTH,v.width),ev.pixelStorei(ev.UNPACK_IMAGE_HEIGHT,v.height),ev.pixelStorei(ev.UNPACK_SKIP_PIXELS,e.min.x),ev.pixelStorei(ev.UNPACK_SKIP_ROWS,e.min.y),ev.pixelStorei(ev.UNPACK_SKIP_IMAGES,e.min.z),i.isDataTexture||i.isData3DTexture?ev.texSubImage3D(a,s,t.x,t.y,t.z,l,h,c,u,d,v.data):n.isCompressedArrayTexture?ev.compressedTexSubImage3D(a,s,t.x,t.y,t.z,l,h,c,u,v.data):ev.texSubImage3D(a,s,t.x,t.y,t.z,l,h,c,u,d,v),ev.pixelStorei(ev.UNPACK_ROW_LENGTH,A),ev.pixelStorei(ev.UNPACK_IMAGE_HEIGHT,p),ev.pixelStorei(ev.UNPACK_SKIP_PIXELS,g),ev.pixelStorei(ev.UNPACK_SKIP_ROWS,m),ev.pixelStorei(ev.UNPACK_SKIP_IMAGES,f),0===s&&n.generateMipmaps&&ev.generateMipmap(a),r.unbindTexture()},this.initTexture=function(e){e.isCubeTexture?o.setTextureCube(e,0):e.isData3DTexture?o.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?o.setTexture2DArray(e,0):o.setTexture2D(e,0),r.unbindTexture()},this.resetState=function(){V=0,W=0,q=null,r.reset(),C.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}}class aA extends tW{copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}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 tb,this.environmentIntensity=1,this.environmentRotation=new tb,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}}class ap{onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return eL("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let n=0,r=this.stride;n1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=eE()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=eE()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.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}}constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=35044,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=eE()}}let ag=new eZ;class am{get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;to)continue;u.applyMatrix4(this.matrixWorld);let a=e.ray.origin.distanceTo(u);ae.far||t.push({distance:a,point:c.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this})}}else{let i=Math.max(0,a.start),n=Math.min(p.count,a.start+a.count);for(let r=i,a=n-1;ro)continue;u.applyMatrix4(this.matrixWorld);let i=e.ray.origin.distanceTo(u);ie.far||t.push({distance:i,point:c.clone().applyMatrix4(this.matrixWorld),index:r,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e0){let i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;er.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:i,index:t,face:null,object:s})}}class a5 extends eW{clone(){return new this.constructor(this.image).copy(this)}update(){let e=this.image;!1=="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}constructor(e,t,i,n,r,a,s,o,l){super(e,t,i,n,r,a,s,o,l),this.isVideoTexture=!0,this.minFilter=void 0!==a?a:1006,this.magFilter=void 0!==r?r:1006,this.generateMipmaps=!1;let h=this;"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(function t(){h.needsUpdate=!0,e.requestVideoFrameCallback(t)})}}class a8 extends eW{constructor(e,t,i,n,r,a,s,o,l,h,c,u){super(null,a,s,o,l,h,n,r,c,u),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class a6 extends a8{constructor(e,t,i,n,r,a){super(e,t,i,r,a),this.isCompressedArrayTexture=!0,this.image.depth=n,this.wrapR=1001}}class a9 extends a8{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,301),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class a7 extends eW{constructor(e,t,i,n,r,a,s,o,l){super(e,t,i,n,r,a,s,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class se{getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5,t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],i,n=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)t.push(r+=(i=this.getPoint(a/e)).distanceTo(n)),n=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let i,n=this.getLengths(),r=0,a=n.length;i=t||e*n[a-1];let s=0,o=a-1,l;for(;s<=o;)if((l=n[r=Math.floor(s+(o-s)/2)]-i)<0)s=r+1;else if(l>0)o=r-1;else{o=r;break}if(n[r=o]===i)return r/(a-1);let h=n[r],c=n[r+1];return(r+(i-h)/(c-h))/(a-1)}getTangent(e,t){let i=e-1e-4,n=e+1e-4;i<0&&(i=0),n>1&&(n=1);let r=this.getPoint(i),a=this.getPoint(n),s=t||(r.isVector2?new eM:new eZ);return s.copy(a).sub(r).normalize(),s}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){let i=new eZ,n=[],r=[],a=[],s=new eZ,o=new tv;for(let t=0;t<=e;t++){let i=t/e;n[t]=this.getTangentAt(i,new eZ)}r[0]=new eZ,a[0]=new eZ;let l=Number.MAX_VALUE,h=Math.abs(n[0].x),c=Math.abs(n[0].y),u=Math.abs(n[0].z);h<=l&&(l=h,i.set(1,0,0)),c<=l&&(l=c,i.set(0,1,0)),u<=l&&i.set(0,0,1),s.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],s),a[0].crossVectors(n[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),a[t]=a[t-1].clone(),s.crossVectors(n[t-1],n[t]),s.length()>Number.EPSILON){s.normalize();let e=Math.acos(ex(n[t-1].dot(n[t]),-1,1));r[t].applyMatrix4(o.makeRotationAxis(s,e))}a[t].crossVectors(n[t],r[t])}if(!0===t){let t=Math.acos(ex(r[0].dot(r[e]),-1,1));t/=e,n[0].dot(s.crossVectors(r[0],r[e]))>0&&(t=-t);for(let i=1;i<=e;i++)r[i].applyMatrix4(o.makeRotationAxis(n[i],t*i)),a[i].crossVectors(n[i],r[i])}return{tangents:n,normals:r,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}constructor(){this.type="Curve",this.arcLengthDivisions=200}}class st extends se{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new eM,i=2*Math.PI,n=this.aEndAngle-this.aStartAngle,r=Math.abs(n)i;)n-=i;n1&&void 0!==arguments[1]?arguments[1]:new eM,i=this.v0,n=this.v1,r=this.v2,a=this.v3;return t.set(sh(e,i.x,n.x,r.x,a.x),sh(e,i.y,n.y,r.y,a.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}constructor(e=new eM,t=new eM,i=new eM,n=new eM){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=n}}class su extends se{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new eM;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new eM;return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new eM,t=new eM){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}}class sd extends se{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new eM,i=this.v0,n=this.v1,r=this.v2;return t.set(sl(e,i.x,n.x,r.x),sl(e,i.y,n.y,r.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new eM,t=new eM,i=new eM){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}}class sA extends se{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new eZ,i=this.v0,n=this.v1,r=this.v2;return t.set(sl(e,i.x,n.x,r.x),sl(e,i.y,n.y,r.y),sl(e,i.z,n.z,r.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}constructor(e=new eZ,t=new eZ,i=new eZ){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}}class sp extends se{getPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new eM,i=this.points,n=(i.length-1)*e,r=Math.floor(n),a=n-r,s=i[0===r?r:r-1],o=i[r],l=i[r>i.length-2?i.length-1:r+1],h=i[r>i.length-3?i.length-1:r+2];return t.set(so(a,s.x,o.x,l.x,h.x),so(a,s.y,o.y,l.y,h.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t0)&&d.push(t,r,l),(e!==i-1||o0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}constructor(e){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 eM(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return ex(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new t6(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 t6(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new t6(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}}function sv(e,t,i){return e&&(i||e.constructor!==t)?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function s_(e,t,i){let n=e.length,r=new e.constructor(n);for(let a=0,s=0;s!==n;++a){let n=i[a]*t;for(let i=0;i!==t;++i)r[s++]=e[n+i]}return r}function sy(e,t,i,n){let r=1,a=e[0];for(;void 0!==a&&void 0===a[n];)a=e[r++];if(void 0===a)return;let s=a[n];if(void 0!==s)if(Array.isArray(s))do void 0!==(s=a[n])&&(t.push(a.time),i.push.apply(i,s)),a=e[r++];while(void 0!==a)else if(void 0!==s.toArray)do void 0!==(s=a[n])&&(t.push(a.time),s.toArray(i,i.length)),a=e[r++];while(void 0!==a)else do void 0!==(s=a[n])&&(t.push(a.time),i.push(s)),a=e[r++];while(void 0!==a)}class sE{evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,n=t[i],r=t[i-1];e:{t:{let a;i:{n:if(!(e=r)){let s=t[1];e=(r=t[--i-1]))break t}a=i,i=0;break i}break e}for(;i>>1;et;)--a;if(++a,0!==r||a!==n){r>=a&&(r=(a=Math.max(a,1))-1);let e=this.getValueSize();this.times=i.slice(r,a),this.values=this.values.slice(r*e,a*e)}return this}validate(){var e;let t=!0,i=this.getValueSize();i-Math.floor(i)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,r=this.values,a=n.length;0===a&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let e=0;e!==a;e++){let i=n[e];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==s&&s>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,s),t=!1;break}s=i}if(void 0!==r&&ArrayBuffer.isView(e=r)&&!(e instanceof DataView))for(let e=0,i=r.length;e!==i;++e){let i=r[e];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){let e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),n=2302===this.getInterpolation(),r=e.length-1,a=1;for(let s=1;s0){e[a]=e[r];for(let e=r*i,n=a*i,s=0;s!==i;++s)t[n+s]=t[e+s];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*i)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),i=new this.constructor(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}constructor(e,t,i,n){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=sv(t,this.TimeBufferType),this.values=sv(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}}sI.prototype.TimeBufferType=Float32Array,sI.prototype.ValueBufferType=Float32Array,sI.prototype.DefaultInterpolation=2301;class sM extends sI{}sM.prototype.ValueTypeName="bool",sM.prototype.ValueBufferType=Array,sM.prototype.DefaultInterpolation=2300,sM.prototype.InterpolantFactoryMethodLinear=void 0,sM.prototype.InterpolantFactoryMethodSmooth=void 0;class sw extends sI{}sw.prototype.ValueTypeName="color";class sb extends sI{}sb.prototype.ValueTypeName="number";class sT extends sE{interpolate_(e,t,i,n){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(i-t)/(n-t),l=e*s;for(let e=l+s;l!==e;l+=4)eJ.slerpFlat(r,0,a,l-s,a,l,o);return r}constructor(e,t,i,n){super(e,t,i,n)}}class sB extends sI{InterpolantFactoryMethodLinear(e){return new sT(this.times,this.values,this.getValueSize(),e)}}sB.prototype.ValueTypeName="quaternion",sB.prototype.DefaultInterpolation=2301,sB.prototype.InterpolantFactoryMethodSmooth=void 0;class sR extends sI{}sR.prototype.ValueTypeName="string",sR.prototype.ValueBufferType=Array,sR.prototype.DefaultInterpolation=2300,sR.prototype.InterpolantFactoryMethodLinear=void 0,sR.prototype.InterpolantFactoryMethodSmooth=void 0;class sL extends sI{}sL.prototype.ValueTypeName="vector";class sD{static parse(e){let t=[],i=e.tracks,n=1/(e.fps||1);for(let e=0,r=i.length;e!==r;++e)t.push((function(e){if(void 0===e.type)throw Error("THREE.KeyframeTrack: track type undefined, can not parse");let t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return sb;case"vector":case"vector2":case"vector3":case"vector4":return sL;case"color":return sw;case"quaternion":return sB;case"bool":case"boolean":return sM;case"string":return sR}throw Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){let t=[],i=[];sy(e.keys,t,i,"value"),e.times=t,e.values=i}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)})(i[e]).scale(n));let r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){let t=[],i=e.tracks,n={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,n=i.length;e!==n;++e)t.push(sI.toJSON(i[e]));return n}static CreateFromMorphTargetSequence(e,t,i,n){let r=t.length,a=[];for(let e=0;e1){let e=a[1],t=n[e];t||(n[e]=t=[]),t.push(i)}}let a=[];for(let e in n)a.push(this.CreateFromMorphTargetSequence(e,n[e],t,i));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;let i=function(e,t,i,n,r){if(0!==i.length){let a=[],s=[];sy(i,a,s,n),0!==a.length&&r.push(new e(t,a,s))}},n=[],r=e.name||"default",a=e.fps||30,s=e.blendMode,o=e.length||-1,l=e.hierarchy||[];for(let e=0;e{t&&t(r),this.manager.itemEnd(e)},0),r;if(void 0!==sQ[e])return void sQ[e].push({onLoad:t,onProgress:i,onError:n});sQ[e]=[],sQ[e].push({onLoad:t,onProgress:i,onError:n});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,o=this.responseType;fetch(a).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;let i=sQ[e],n=t.body.getReader(),r=t.headers.get("Content-Length")||t.headers.get("X-File-Size"),a=r?parseInt(r):0,s=0!==a,o=0;return new Response(new ReadableStream({start(e){!function t(){n.read().then(n=>{let{done:r,value:l}=n;if(r)e.close();else{let n=new ProgressEvent("progress",{lengthComputable:s,loaded:o+=l.byteLength,total:a});for(let e=0,t=i.length;e{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>new DOMParser().parseFromString(e,s));case"json":return e.json();default:if(void 0===s)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(s),i=new TextDecoder(t&&t[1]?t[1].toLowerCase():void 0);return e.arrayBuffer().then(e=>i.decode(e))}}}).then(t=>{sU.add(e,t);let i=sQ[e];delete sQ[e];for(let e=0,n=i.length;e{let i=sQ[e];if(void 0===i)throw this.manager.itemError(e),t;delete sQ[e];for(let e=0,n=i.length;e{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}constructor(e){super(e)}}class sG extends sF{load(e,t,i,n){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let r=this,a=sU.get(e);if(void 0!==a)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;let s=eB("img");function o(){h(),sU.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){h(),n&&n(t),r.manager.itemError(e),r.manager.itemEnd(e)}function h(){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1)}return s.addEventListener("load",o,!1),s.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),r.manager.itemStart(e),s.src=e,s}constructor(e){super(e)}}class sH extends sF{load(e,t,i,n){let r=this,a=new ab,s=new sk(this.manager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(r.withCredentials),s.load(e,function(e){let i;try{i=r.parse(e)}catch(e){if(void 0===n)return void console.error(e);n(e)}void 0!==i.image?a.image=i.image:void 0!==i.data&&(a.image.width=i.width,a.image.height=i.height,a.image.data=i.data),a.wrapS=void 0!==i.wrapS?i.wrapS:1001,a.wrapT=void 0!==i.wrapT?i.wrapT:1001,a.magFilter=void 0!==i.magFilter?i.magFilter:1006,a.minFilter=void 0!==i.minFilter?i.minFilter:1006,a.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.colorSpace&&(a.colorSpace=i.colorSpace),void 0!==i.flipY&&(a.flipY=i.flipY),void 0!==i.format&&(a.format=i.format),void 0!==i.type&&(a.type=i.type),void 0!==i.mipmaps&&(a.mipmaps=i.mipmaps,a.minFilter=1008),1===i.mipmapCount&&(a.minFilter=1006),void 0!==i.generateMipmaps&&(a.generateMipmaps=i.generateMipmaps),a.needsUpdate=!0,t&&t(a,i)},i,n),a}constructor(e){super(e)}}class sz extends sF{load(e,t,i,n){let r=new eW,a=new sG(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){r.image=e,r.needsUpdate=!0,void 0!==t&&t(r)},i,n),r}constructor(e){super(e)}}class sV extends tW{dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),t}constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new t6(e),this.intensity=t}}let sW=new tv,sq=new eZ,sX=new eZ;class sj{getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,i=this.matrix;sq.setFromMatrixPosition(e.matrixWorld),t.position.copy(sq),sX.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(sX),t.updateMatrixWorld(),sW.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(sW),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(sW)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return 0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),(512!==this.mapSize.x||512!==this.mapSize.y)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new eM(512,512),this.map=null,this.mapPass=null,this.matrix=new tv,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new i5,this._frameExtents=new eM(1,1),this._viewportCount=1,this._viewports=[new eq(0,0,1,1)]}}class sY extends sj{updateMatrices(e){let t=this.camera,i=2*ey*e.angle*this.focus,n=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(i!==t.fov||n!==t.aspect||r!==t.far)&&(t.fov=i,t.aspect=n,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}constructor(){super(new iY(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}}class sK extends sV{get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}constructor(e,t,i=0,n=Math.PI/3,r=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(tW.DEFAULT_UP),this.updateMatrix(),this.target=new tW,this.distance=i,this.angle=n,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new sY}}let sJ=new tv,sZ=new eZ,s$=new eZ;class s0 extends sj{updateMatrices(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.camera,n=this.matrix,r=e.distance||i.far;r!==i.far&&(i.far=r,i.updateProjectionMatrix()),sZ.setFromMatrixPosition(e.matrixWorld),i.position.copy(sZ),s$.copy(i.position),s$.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(s$),i.updateMatrixWorld(),n.makeTranslation(-sZ.x,-sZ.y,-sZ.z),sJ.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(sJ)}constructor(){super(new iY(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new eM(4,2),this._viewportCount=6,this._viewports=[new eq(2,1,1,1),new eq(0,1,1,1),new eq(3,1,1,1),new eq(1,1,1,1),new eq(3,0,1,1),new eq(1,0,1,1)],this._cubeDirections=[new eZ(1,0,0),new eZ(-1,0,0),new eZ(0,0,1),new eZ(0,0,-1),new eZ(0,1,0),new eZ(0,-1,0)],this._cubeUps=[new eZ(0,1,0),new eZ(0,1,0),new eZ(0,1,0),new eZ(0,1,0),new eZ(0,0,1),new eZ(0,0,-1)]}}class s1 extends sV{get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}constructor(e,t,i=0,n=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=n,this.shadow=new s0}}class s2 extends sj{constructor(){super(new nu(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class s3 extends sV{dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(tW.DEFAULT_UP),this.updateMatrix(),this.target=new tW,this.shadow=new s2}}class s4{set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){let i=e.x,n=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*n),t.addScaledVector(a[2],.488603*r),t.addScaledVector(a[3],.488603*i),t.addScaledVector(a[4],i*n*1.092548),t.addScaledVector(a[5],n*r*1.092548),t.addScaledVector(a[6],.315392*(3*r*r-1)),t.addScaledVector(a[7],i*r*1.092548),t.addScaledVector(a[8],.546274*(i*i-n*n)),t}getIrradianceAt(e,t){let i=e.x,n=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*n),t.addScaledVector(a[2],1.023328*r),t.addScaledVector(a[3],1.023328*i),t.addScaledVector(a[4],.858086*i*n),t.addScaledVector(a[5],.858086*n*r),t.addScaledVector(a[6],.743125*r*r-.247708),t.addScaledVector(a[7],.858086*i*r),t.addScaledVector(a[8],.429043*(i*i-n*n)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.coefficients;for(let n=0;n<9;n++)i[n].fromArray(e,t+3*n);return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.coefficients;for(let n=0;n<9;n++)i[n].toArray(e,t+3*n);return e}static getBasisAt(e,t){let i=e.x,n=e.y,r=e.z;t[0]=.282095,t[1]=.488603*n,t[2]=.488603*r,t[3]=.488603*i,t[4]=1.092548*i*n,t[5]=1.092548*n*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*i*r,t[8]=.546274*(i*i-n*n)}constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new eZ)}}class s5 extends sV{copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){let t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}constructor(e=new s4,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}}class s8{static decodeText(e){if("undefined"!=typeof TextDecoder)return new TextDecoder().decode(e);let t="";for(let i=0,n=e.length;i{t&&t(i),r.manager.itemEnd(e)}).catch(e=>{n&&n(e)}):(setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a);let s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader;let o=fetch(e,s).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(i){return sU.add(e,i),t&&t(i),r.manager.itemEnd(e),i}).catch(function(t){n&&n(t),sU.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)});sU.add(e,o),r.manager.itemStart(e)}constructor(e){super(e),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"}}}class s9{accumulate(e,t){let i=this.buffer,n=this.valueSize,r=e*n+n,a=this.cumulativeWeight;if(0===a){for(let e=0;e!==n;++e)i[r+e]=i[e];a=t}else{a+=t;let e=t/a;this._mixBufferRegion(i,r,0,e,n)}this.cumulativeWeight=a}accumulateAdditive(e){let t=this.buffer,i=this.valueSize,n=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,n,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){let t=this.valueSize,i=this.buffer,n=e*t+t,r=this.cumulativeWeight,a=this.cumulativeWeightAdditive,s=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){let e=t*this._origIndex;this._mixBufferRegion(i,n,e,1-r,t)}a>0&&this._mixBufferRegionAdditive(i,n,this._addIndex*t,1,t);for(let e=t,r=t+t;e!==r;++e)if(i[e]!==i[e+t]){s.setValue(i,n);break}}saveOriginalState(){let e=this.binding,t=this.buffer,i=this.valueSize,n=i*this._origIndex;e.getValue(t,n);for(let e=i;e!==n;++e)t[e]=t[n+e%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){let e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){let e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i=.5)for(let n=0;n!==r;++n)e[t+n]=e[i+n]}_slerp(e,t,i,n){eJ.slerpFlat(e,t,e,t,e,i,n)}_slerpAdditive(e,t,i,n,r){let a=this._workIndex*r;eJ.multiplyQuaternionsFlat(e,a,e,t,e,i),eJ.slerpFlat(e,t,e,t,e,a,n)}_lerp(e,t,i,n,r){let a=1-n;for(let s=0;s!==r;++s){let r=t+s;e[r]=e[r]*a+e[i+s]*n}}_lerpAdditive(e,t,i,n,r){for(let a=0;a!==r;++a){let r=t+a;e[r]=e[r]+e[i+a]*n}}constructor(e,t,i){let n,r,a;switch(this.binding=e,this.valueSize=i,t){case"quaternion":n=this._slerp,r=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":n=this._select,r=this._select,a=this._setAdditiveIdentityOther,this.buffer=Array(5*i);break;default:n=this._lerp,r=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=r,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}}let s7="\\[\\]\\.:\\/",oe=RegExp("["+s7+"]","g"),ot="[^"+s7+"]",oi="[^"+s7.replace("\\.","")+"]",on=/((?:WC+[\/:])*)/.source.replace("WC",ot),or=/(WCOD+)?/.source.replace("WCOD",oi),oa=RegExp("^"+on+or+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ot)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ot)+"$"),os=["material","materials","bones","map"];class oo{static create(e,t,i){return e&&e.isAnimationObjectGroup?new oo.Composite(e,t,i):new oo(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(oe,"")}static parseTrackName(e){let t=oa.exec(e);if(null===t)throw Error("PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){let e=i.nodeName.substring(n+1);-1!==os.indexOf(e)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=e)}if(null===i.propertyName||0===i.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(void 0!==i)return i}if(e.children){let i=function(e){for(let n=0;n0){let e=this._interpolants,t=this._propertyBindings;if(2501===this.blendMode)for(let i=0,n=e.length;i!==n;++i)e[i].evaluate(a),t[i].accumulateAdditive(s);else for(let i=0,r=e.length;i!==r;++i)e[i].evaluate(a),t[i].accumulate(n,s)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;let i=this._weightInterpolant;if(null!==i){let n=i.evaluate(e)[0];t*=n,e>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;let i=this._timeScaleInterpolant;null!==i&&(t*=i.evaluate(e)[0],e>i.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){let t=this._clip.duration,i=this.loop,n=this.time+e,r=this._loopCount,a=2202===i;if(0===e)return -1===r?n:a&&(1&r)==1?t-n:n;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));r:{if(n>=t)n=t;else if(n<0)n=0;else{this.time=n;break r}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),n>=t||n<0){let i=Math.floor(n/t);n-=t*i,r+=Math.abs(i);let s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=e>0?t:0,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){let t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=n;if(a&&(1&r)==1)return t-n}return n}_setEndings(e,t,i){let n=this._interpolantSettings;i?(n.endingStart=2401,n.endingEnd=2401):(e?n.endingStart=this.zeroSlopeAtStart?2401:2400:n.endingStart=2402,t?n.endingEnd=this.zeroSlopeAtEnd?2401:2400:n.endingEnd=2402)}_scheduleFading(e,t,i){let n=this._mixer,r=n.time,a=this._weightInterpolant;null===a&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);let s=a.parameterPositions,o=a.sampleValues;return s[0]=r,o[0]=t,s[1]=r+e,o[1]=i,this}constructor(e,t,i=null,n=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=n;let r=t.tracks,a=r.length,s=Array(a),o={endingStart:2400,endingEnd:2400};for(let e=0;e!==a;++e){let t=r[e].createInterpolant(null);s[e]=t,t.settings=o}this._interpolantSettings=o,this._interpolants=s,this._propertyBindings=Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=2201,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}}let oh=new Float32Array(1);class oc extends ef{_bindAction(e,t){let i=e._localRoot||this._root,n=e._clip.tracks,r=n.length,a=e._propertyBindings,s=e._interpolants,o=i.uuid,l=this._bindingsByRootAndName,h=l[o];void 0===h&&(h={},l[o]=h);for(let e=0;e!==r;++e){let r=n[e],l=r.name,c=h[l];if(void 0!==c)++c.referenceCount,a[e]=c;else{if(void 0!==(c=a[e])){null===c._cacheIndex&&(++c.referenceCount,this._addInactiveBinding(c,o,l));continue}let n=t&&t._propertyBindings[e].binding.parsedPath;c=new s9(oo.create(i,l,n),r.ValueTypeName,r.getValueSize()),++c.referenceCount,this._addInactiveBinding(c,o,l),a[e]=c}s[e].resultBuffer=c.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){let t=(e._localRoot||this._root).uuid,i=e._clip.uuid,n=this._actionsByClip[i];this._bindAction(e,n&&n.knownActions[0]),this._addInactiveAction(e,i,t)}let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;let e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){let t=e._cacheIndex;return null!==t&&t=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;let t=this._actions,i=this._nActiveActions,n=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1;for(let s=0;s!==i;++s)t[s]._update(n,e,r,a);let s=this._bindings,o=this._nActiveBindings;for(let e=0;e!==o;++e)s[e].apply(a);return this}setTime(e){this.time=0;for(let e=0;eoB,"defaultConverter",()=>oM,"notEqual",()=>ow],31507);let om=window,of=om.ShadowRoot&&(void 0===om.ShadyCSS||om.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ov=Symbol(),o_=new WeakMap;class oy{get styleSheet(){let e=this.o,t=this.t;if(of&&void 0===e){let i=void 0!==t&&1===t.length;i&&(e=o_.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&o_.set(t,e))}return e}toString(){return this.cssText}constructor(e,t,i){if(this._$cssResult$=!0,i!==ov)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}}let oE=of?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let i of e.cssRules)t+=i.cssText;return(e=>new oy("string"==typeof e?e:e+"",void 0,ov))(t)})(e):e,ox=window,oS=ox.trustedTypes,oC=oS?oS.emptyScript:"",oI=ox.reactiveElementPolyfillSupport,oM={toAttribute(e,t){switch(t){case Boolean:e=e?oC:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},ow=(e,t)=>t!==e&&(t==t||e==e),ob={attribute:!0,type:String,converter:oM,reflect:!1,hasChanged:ow},oT="finalized";class oB extends HTMLElement{static addInitializer(e){var t;this.finalize(),(null!=(t=this.h)?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((t,i)=>{let n=this._$Ep(i,t);void 0!==n&&(this._$Ev.set(n,i),e.push(n))}),e}static createProperty(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ob;if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let i="symbol"==typeof e?Symbol():"__"+e,n=this.getPropertyDescriptor(e,i,t);void 0!==n&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(n){let r=this[e];this[t]=n,this.requestUpdate(e,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||ob}static finalize(){if(this.hasOwnProperty(oT))return!1;this[oT]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let e=this.properties;for(let t of[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)])this.createProperty(t,e[t])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e))for(let i of new Set(e.flat(1/0).reverse()))t.unshift(oE(i));else void 0!==e&&t.push(oE(e));return t}static _$Ep(e,t){let i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null==(e=this.constructor.h)||e.forEach(e=>e(this))}addController(e){var t,i;(null!=(t=this._$ES)?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null==(i=e.hostConnected)||i.call(e))}removeController(e){var t;null==(t=this._$ES)||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e,t;let i=null!=(e=this.shadowRoot)?e:this.attachShadow(this.constructor.shadowRootOptions);return t=this.constructor.elementStyles,of?i.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{let t=document.createElement("style"),n=om.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=e.cssText,i.appendChild(t)}),i}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null==(e=this._$ES)||e.forEach(e=>{var t;return null==(t=e.hostConnected)?void 0:t.call(e)})}enableUpdating(e){}disconnectedCallback(){var e;null==(e=this._$ES)||e.forEach(e=>{var t;return null==(t=e.hostDisconnected)?void 0:t.call(e)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t){var i;let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ob,r=this.constructor._$Ep(e,n);if(void 0!==r&&!0===n.reflect){let a=(void 0!==(null==(i=n.converter)?void 0:i.toAttribute)?n.converter:oM).toAttribute(t,n.type);this._$El=e,null==a?this.removeAttribute(r):this.setAttribute(r,a),this._$El=null}}_$AK(e,t){var i;let n=this.constructor,r=n._$Ev.get(e);if(void 0!==r&&this._$El!==r){let e=n.getPropertyOptions(r),a="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null==(i=e.converter)?void 0:i.fromAttribute)?e.converter:oM;this._$El=r,this[r]=a.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,i){let n=!0;void 0!==e&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||ow)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===i.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((e,t)=>this[t]=e),this._$Ei=void 0);let t=!1,i=this._$AL;try{(t=this.shouldUpdate(i))?(this.willUpdate(i),null==(e=this._$ES)||e.forEach(e=>{var t;return null==(t=e.hostUpdate)?void 0:t.call(e)}),this.update(i)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;null==(t=this._$ES)||t.forEach(e=>{var t;return null==(t=e.hostUpdated)?void 0:t.call(e)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach((e,t)=>this._$EO(t,this[t],e)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}}oB[oT]=!0,oB.elementProperties=new Map,oB.elementStyles=[],oB.shadowRootOptions={mode:"open"},null==oI||oI({ReactiveElement:oB}),(null!=(f=ox.reactiveElementVersions)?f:ox.reactiveElementVersions=[]).push("1.6.3");let oR=window,oL=oR.trustedTypes,oD=oL?oL.createPolicy("lit-html",{createHTML:e=>e}):void 0,oU="$lit$",oP="lit$".concat((Math.random()+"").slice(9),"$"),oN="?"+oP,oF="<".concat(oN,">"),oQ=document,oO=()=>oQ.createComment(""),ok=e=>null===e||"object"!=typeof e&&"function"!=typeof e,oG=Array.isArray,oH="[ \n\f\r]",oz=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,oV=/-->/g,oW=/>/g,oq=RegExp(">|".concat(oH,"(?:([^\\s\"'>=/]+)(").concat(oH,"*=").concat(oH,"*(?:[^ \n\f\r\"'`<>=]|(\"|')|))|$)"),"g"),oX=/'/g,oj=/"/g,oY=/^(?:script|style|textarea|title)$/i,oK=e=>function(t){for(var i=arguments.length,n=Array(i>1?i-1:0),r=1;r{let i=e.length-1,n=[],r,a=2===t?"":"",s=oz;for(let t=0;t"===l[0]?(s=null!=r?r:oz,h=-1):void 0===l[1]?h=-2:(h=s.lastIndex-l[2].length,o=l[1],s=void 0===l[3]?oq:'"'===l[3]?oj:oX):s===oj||s===oX?s=oq:s===oV||s===oW?s=oz:(s=oq,r=void 0);let u=s===oq&&e[t+1].startsWith("/>")?" ":"";a+=s===oz?i+oF:h>=0?(n.push(o),i.slice(0,h)+oU+i.slice(h)+oP+u):i+oP+(-2===h?(n.push(void 0),t):u)}return[o2(e,a+(e[i]||"")+(2===t?"":"")),n]})(e,t);if(this.el=o3.createElement(l,i),o1.currentNode=this.el.content,2===t){let e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(n=o1.nextNode())&&o.length0){n.textContent=oL?oL.emptyScript:"";for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:e,s=arguments.length>3?arguments[3]:void 0;if(t===oZ)return t;let o=void 0!==s?null==(i=a._$Co)?void 0:i[s]:a._$Cl,l=ok(t)?void 0:t._$litDirective$;return(null==o?void 0:o.constructor)!==l&&(null==(n=null==o?void 0:o._$AO)||n.call(o,!1),void 0===l?o=void 0:(o=new l(e))._$AT(e,a,s),void 0!==s?(null!=(r=a._$Co)?r:a._$Co=[])[s]=o:a._$Cl=o),void 0!==o&&(t=o4(e,o._$AS(e,t.values),o,s)),t}class o5{get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;let{el:{content:i},parts:n}=this._$AD,r=(null!=(t=null==e?void 0:e.creationScope)?t:oQ).importNode(i,!0);o1.currentNode=r;let a=o1.nextNode(),s=0,o=0,l=n[0];for(;void 0!==l;){if(s===l.index){let t;2===l.type?t=new o8(a,a.nextSibling,this,e):1===l.type?t=new l.ctor(a,l.name,l.strings,this,e):6===l.type&&(t=new li(a,this,e)),this._$AV.push(t),l=n[++o]}s!==(null==l?void 0:l.index)&&(a=o1.nextNode(),s++)}return o1.currentNode=oQ,r}v(e){let t=0;for(let i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}}class o8{get _$AU(){var e,t;return null!=(t=null==(e=this._$AM)?void 0:e._$AU)?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return void 0!==t&&11===(null==e?void 0:e.nodeType)&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this;ok(e=o4(this,e,i))?e===o$||null==e||""===e?(this._$AH!==o$&&this._$AR(),this._$AH=o$):e!==this._$AH&&e!==oZ&&this._(e):void 0!==e._$litType$?this.g(e):void 0!==e.nodeType?this.$(e):oG(t=e)||"function"==typeof(null==t?void 0:t[Symbol.iterator])?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==o$&&ok(this._$AH)?this._$AA.nextSibling.data=e:this.$(oQ.createTextNode(e)),this._$AH=e}g(e){var t;let{values:i,_$litType$:n}=e,r="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=o3.createElement(o2(n.h,n.h[0]),this.options)),n);if((null==(t=this._$AH)?void 0:t._$AD)===r)this._$AH.v(i);else{let e=new o5(r,this),t=e.u(this.options);e.v(i),this.$(t),this._$AH=e}}_$AC(e){let t=o0.get(e.strings);return void 0===t&&o0.set(e.strings,t=new o3(e)),t}T(e){oG(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,i,n=0;for(let r of e)n===t.length?t.push(i=new o8(this.k(oO()),this.k(oO()),this,this.options)):i=t[n],i._$AI(r),n++;n0&&void 0!==arguments[0]?arguments[0]:this._$AA.nextSibling,i=arguments.length>1?arguments[1]:void 0;for(null==(e=this._$AP)||e.call(this,!1,!0,i);t&&t!==this._$AB;){let e=t.nextSibling;t.remove(),t=e}}setConnected(e){var t;void 0===this._$AM&&(this._$Cp=e,null==(t=this._$AP)||t.call(this,e))}constructor(e,t,i,n){var r;this.type=2,this._$AH=o$,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=n,this._$Cp=null==(r=null==n?void 0:n.isConnected)||r}}class o6{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,r=this.strings,a=!1;if(void 0===r)(a=!ok(e=o4(this,e,t,0))||e!==this._$AH&&e!==oZ)&&(this._$AH=e);else{let n,s,o=e;for(e=r[0],n=0;n2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=o$}}class o9 extends o6{j(e){this.element[this.name]=e===o$?void 0:e}constructor(){super(...arguments),this.type=3}}let o7=oL?oL.emptyScript:"";class le extends o6{j(e){e&&e!==o$?this.element.setAttribute(this.name,o7):this.element.removeAttribute(this.name)}constructor(){super(...arguments),this.type=4}}class lt extends o6{_$AI(e){var t;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this;if((e=null!=(t=o4(this,e,i,0))?t:o$)===oZ)return;let n=this._$AH,r=e===o$&&n!==o$||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,a=e!==o$&&(n===o$||r);r&&this.element.removeEventListener(this.name,this,n),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,i;"function"==typeof this._$AH?this._$AH.call(null!=(i=null==(t=this.options)?void 0:t.host)?i:this.element,e):this._$AH.handleEvent(e)}constructor(e,t,i,n,r){super(e,t,i,n,r),this.type=5}}class li{get _$AU(){return this._$AM._$AU}_$AI(e){o4(this,e)}constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}}let ln=oR.litHtmlPolyfillSupport;null==ln||ln(o3,o8),(null!=(v=oR.litHtmlVersions)?v:oR.litHtmlVersions=[]).push("2.8.0");let lr=(e,t,i)=>{var n,r;let a=null!=(n=null==i?void 0:i.renderBefore)?n:t,s=a._$litPart$;if(void 0===s){let e=null!=(r=null==i?void 0:i.renderBefore)?r:null;a._$litPart$=s=new o8(t.insertBefore(oO(),e),e,void 0,null!=i?i:{})}return s._$AI(e),s};class la extends oB{createRenderRoot(){var e;let t=super.createRenderRoot();return null!=(e=this.renderOptions).renderBefore||(e.renderBefore=t.firstChild),t}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=lr(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null==(e=this._$Do)||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null==(e=this._$Do)||e.setConnected(!1)}render(){return oZ}constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}}la.finalized=!0,la._$litElement$=!0,null==(_=globalThis.litElementHydrateSupport)||_.call(globalThis,{LitElement:la});let ls=globalThis.litElementPolyfillSupport;null==ls||ls({LitElement:la}),(null!=(y=globalThis.litElementVersions)?y:globalThis.litElementVersions=[]).push("3.3.3"),e.i(31507);let lo=null!=navigator.xr&&null!=self.XRSession&&null!=navigator.xr.isSessionSupported,ll=lo&&null!=self.XRSession.prototype.requestHitTestSource,lh=null!=self.ResizeObserver,lc=null!=self.IntersectionObserver;(()=>{let e=navigator.userAgent||navigator.vendor||self.opera;/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4))})(),/\bCrOS\b/.test(navigator.userAgent);let lu=/android/i.test(navigator.userAgent),ld=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1;/Safari\//.test(navigator.userAgent);let lA=/firefox/i.test(navigator.userAgent),lp=/OculusBrowser/.test(navigator.userAgent);ld&&/CriOS\//.test(navigator.userAgent);let lg=lu&&!lA&&!lp,lm=!!(window.webkit&&window.webkit.messageHandlers),lf=(()=>{if(!ld)return!1;if(lm)return!!/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent);{let e=document.createElement("a");return!!(e.relList&&e.relList.supports&&e.relList.supports("ar"))}})(),lv=e=>e&&"null"!==e?ly(e):null,l_=()=>{if(ll)return;let e=[];throw lo||e.push("WebXR Device API"),ll||e.push("WebXR Hit Test API"),Error("The following APIs are required for AR, but are missing in this browser: ".concat(e.join(", ")))},ly=e=>new URL(e,window.location.toString()).toString(),lE=(e,t)=>{let i=null;return function(){for(var n=arguments.length,r=Array(n),a=0;a{i=null,e(...r)},t)}},lx=(e,t,i)=>Math.max(t,Math.min(i,e)),lS=(()=>{let e=(()=>{var e;if((null==(e=document.documentElement.getAttribute("itemtype"))?void 0:e.includes("schema.org/SearchResultsPage"))||window.self!==window.top)return!0;for(let e of null!=document.head?Array.from(document.head.querySelectorAll("meta")):[])if("viewport"===e.name)return!0;return!1})();return e||console.warn('No detected; will cap pixel density at 1.'),()=>e?window.devicePixelRatio:1})(),lC=(()=>{let e=new RegExp("[?&]".concat("model-viewer-debug-mode","(&|$)"));return()=>self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(e)})(),lI=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise(t=>setTimeout(t,e))},lM=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return new Promise(n=>{e.addEventListener(t,function r(a){(!i||i(a))&&(n(a),e.removeEventListener(t,r))})})};var lw=function(e,t,i,n){var r,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(a<3?r(s):a>3?r(t,i,s):r(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let lb=Symbol("currentEnvironmentMap"),lT=Symbol("currentBackground"),lB=Symbol("updateEnvironment"),lR=Symbol("cancelEnvironmentUpdate");function lL(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function lD(){let e=lL(['\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n']);return lD=function(){return e},e}let lU=oJ(lD());function lP(){let e=lL(['\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n']);return lP=function(){return e},e}let lN=oJ(lP());function lF(){let e=lL(['\n\n\n\n \n \n \n \n \n \n \n\n']);return lF=function(){return e},e}let lQ=oJ(lF());function lO(){let e=lL(['\n\n
\n \n\n \n
\n \n \n \n
\n\n
\n \n \n ','\n \n \n
\n\n
\n \n
\n
\n
\n
\n\n
\n
\n \n
\n
\n\n
\n \n
\n
\n \n
\n\n
\n \n\n
\n \n \n \n
\n\n
\n \n \n \n
\n
\n
\n
\n \n
']);return lO=function(){return e},e}let lk=oJ(lO(),lQ,lN,lU),lG=new WeakMap;function lH(){let e,t;onmessage=function(i){let n=i.data;switch(n.type){case"init":e=n.decoderConfig,t=new Promise(function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)});break;case"decode":let r=n.buffer,a=n.taskConfig;t.then(e=>{let t=e.draco,i=new t.Decoder;try{let e=function(e,t,i,n){let r,a,s=n.attributeIDs,o=n.attributeTypes,l=t.GetEncodedGeometryType(i);if(l===e.TRIANGULAR_MESH)r=new e.Mesh,a=t.DecodeArrayToMesh(i,i.byteLength,r);else if(l===e.POINT_CLOUD)r=new e.PointCloud,a=t.DecodeArrayToPointCloud(i,i.byteLength,r);else throw Error("THREE.DRACOLoader: Unexpected geometry type.");if(!a.ok()||0===r.ptr)throw Error("THREE.DRACOLoader: Decoding failed: "+a.error_msg());let h={index:null,attributes:[]};for(let i in s){let a,l,c=self[o[i]];if(n.useUniqueIDs)l=s[i],a=t.GetAttributeByUniqueId(r,l);else{if(-1===(l=t.GetAttributeId(r,e[s[i]])))continue;a=t.GetAttribute(r,l)}let u=function(e,t,i,n,r,a){let s=a.num_components(),o=i.num_points()*s,l=o*r.BYTES_PER_ELEMENT,h=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,r),c=e._malloc(l);t.GetAttributeDataArrayForAllPoints(i,a,h,l,c);let u=new r(e.HEAPF32.buffer,c,o).slice();return e._free(c),{name:n,array:u,itemSize:s}}(e,t,r,i,c,a);"color"===i&&(u.vertexColorSpace=n.vertexColorSpace),h.attributes.push(u)}return l===e.TRIANGULAR_MESH&&(h.index=function(e,t,i){let n=3*i.num_faces(),r=4*n,a=e._malloc(r);t.GetTrianglesUInt32Array(i,r,a);let s=new Uint32Array(e.HEAPF32.buffer,a,n).slice();return e._free(a),{array:s,itemSize:1}}(e,t,r)),e.destroy(r),h}(t,i,new Int8Array(r),a),s=e.attributes.map(e=>e.array.buffer);e.index&&s.push(e.index.array.buffer),self.postMessage({type:"decode",id:n.id,geometry:e},s)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}finally{t.destroy(i)}})}}}function lz(e,t){if(0===t)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(2!==t&&1!==t)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e;{let i=e.getIndex();if(null===i){let t=[],n=e.getAttribute("position");if(void 0===n)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e=2.0 are supported."));return}let l=new hS(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===s[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(a),l.setPlugins(s),l.parse(i,n)}parseAsync(e,t){let i=this;return new Promise(function(n,r){i.parse(e,t,n,r)})}constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new lK(e)}),this.register(function(e){return new l5(e)}),this.register(function(e){return new l8(e)}),this.register(function(e){return new l6(e)}),this.register(function(e){return new lZ(e)}),this.register(function(e){return new l$(e)}),this.register(function(e){return new l0(e)}),this.register(function(e){return new l1(e)}),this.register(function(e){return new lY(e)}),this.register(function(e){return new l2(e)}),this.register(function(e){return new lJ(e)}),this.register(function(e){return new l4(e)}),this.register(function(e){return new l3(e)}),this.register(function(e){return new lX(e)}),this.register(function(e){return new l9(e)}),this.register(function(e){return new l7(e)})}}function lW(){let e={};return{get:function(t){return e[t]},add:function(t,i){e[t]=i},remove:function(t){delete e[t]},removeAll:function(){e={}}}}let lq={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class lX{_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let i=0,n=t.length;i=0))return null;else throw Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return t.loadTextureImage(e,r.source,a)}constructor(e){this.parser=e,this.name=lq.KHR_TEXTURE_BASISU}}class l8{loadTexture(e){let t=this.name,i=this.parser,n=i.json,r=n.textures[e];if(!r.extensions||!r.extensions[t])return null;let a=r.extensions[t],s=n.images[a.source],o=i.textureLoader;if(s.uri){let e=i.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then(function(r){if(r)return i.loadTextureImage(e,a.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}constructor(e){this.parser=e,this.name=lq.EXT_TEXTURE_WEBP,this.isSupported=null}}class l6{loadTexture(e){let t=this.name,i=this.parser,n=i.json,r=n.textures[e];if(!r.extensions||!r.extensions[t])return null;let a=r.extensions[t],s=n.images[a.source],o=i.textureLoader;if(s.uri){let e=i.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then(function(r){if(r)return i.loadTextureImage(e,a.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){let t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}constructor(e){this.parser=e,this.name=lq.EXT_TEXTURE_AVIF,this.isSupported=null}}class l9{loadBufferView(e){let t=this.parser.json,i=t.bufferViews[e];if(!i.extensions||!i.extensions[this.name])return null;{let e=i.extensions[this.name],n=this.parser.getDependency("buffer",e.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported)if(!(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0))return null;else throw Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return n.then(function(t){let i=e.byteOffset||0,n=e.byteLength||0,a=e.count,s=e.byteStride,o=new Uint8Array(t,i,n);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(a,s,o,e.mode,e.filter).then(function(e){return e.buffer}):r.ready.then(function(){let t=new ArrayBuffer(a*s);return r.decodeGltfBuffer(new Uint8Array(t),a,s,o,e.mode,e.filter),t})})}}constructor(e){this.name=lq.EXT_MESHOPT_COMPRESSION,this.parser=e}}class l7{createNodeMesh(e){let t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||void 0===i.mesh)return null;for(let e of t.meshes[i.mesh].primitives)if(e.mode!==hh.TRIANGLES&&e.mode!==hh.TRIANGLE_STRIP&&e.mode!==hh.TRIANGLE_FAN&&void 0!==e.mode)return null;let n=i.extensions[this.name].attributes,r=[],a={};for(let e in n)r.push(this.parser.getDependency("accessor",n[e]).then(t=>(a[e]=t,a[e])));return r.length<1?null:(r.push(this.parser.createNodeMesh(e)),Promise.all(r).then(e=>{let t=e.pop(),i=t.isGroup?t.children:[t],n=e[0].count,r=[];for(let e of i){let t=new tv,i=new eZ,s=new eJ,o=new eZ(1,1,1),l=new ak(e.geometry,e.material,n);for(let e=0;e{let i=this.associations.get(e);for(let[n,a]of(null!=i&&this.associations.set(t,i),e.children.entries()))r(a,t.children[n])};return r(i,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let i=0;i=2&&r.setY(t,u[e*s+1]),s>=3&&r.setZ(t,u[e*s+2]),s>=4&&r.setW(t,u[e*s+3]),s>=5)throw Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return r})}loadTexture(e){let t=this.json,i=this.options,n=t.textures[e].source,r=t.images[n],a=this.textureLoader;if(r.uri){let e=i.manager.getHandler(r.uri);null!==e&&(a=e)}return this.loadTextureImage(e,n,a)}loadTextureImage(e,t,i){let n=this,r=this.json,a=r.textures[e],s=r.images[t],o=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[o])return this.textureCache[o];let l=this.loadImageSource(t,i).then(function(t){t.flipY=!1,t.name=a.name||s.name||"",""===t.name&&"string"==typeof s.uri&&!1===s.uri.startsWith("data:image/")&&(t.name=s.uri);let i=(r.samplers||{})[a.sampler]||{};return t.magFilter=hu[i.magFilter]||1006,t.minFilter=hu[i.minFilter]||1008,t.wrapS=hd[i.wrapS]||1e3,t.wrapT=hd[i.wrapT]||1e3,n.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[o]=l,l}loadImageSource(e,t){let i=this.json,n=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());let r=i.images[e],a=self.URL||self.webkitURL,s=r.uri||"",o=!1;if(void 0!==r.bufferView)s=this.getDependency("bufferView",r.bufferView).then(function(e){o=!0;let t=new Blob([e],{type:r.mimeType});return s=a.createObjectURL(t)});else if(void 0===r.uri)throw Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");let l=Promise.resolve(s).then(function(e){return new Promise(function(i,r){let a=i;!0===t.isImageBitmapLoader&&(a=function(e){let t=new eW(e);t.needsUpdate=!0,i(t)}),t.load(s8.resolveURL(e,n.path),a,void 0,r)})}).then(function(e){var t;return!0===o&&a.revokeObjectURL(s),e.userData.mimeType=r.mimeType||((t=r.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,i,n){let r=this;return this.getDependency("texture",i.index).then(function(a){if(!a)return null;if(void 0!==i.texCoord&&i.texCoord>0&&((a=a.clone()).channel=i.texCoord),r.extensions[lq.KHR_TEXTURE_TRANSFORM]){let e=void 0!==i.extensions?i.extensions[lq.KHR_TEXTURE_TRANSFORM]:void 0;if(e){let t=r.associations.get(a);a=r.extensions[lq.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),r.associations.set(a,t)}}return void 0!==n&&(a.colorSpace=n),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,i=e.material,n=void 0===t.attributes.tangent,r=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){let e="PointsMaterial:"+i.uuid,t=this.cache.get(e);t||(t=new aZ,ie.prototype.copy.call(t,i),t.color.copy(i.color),t.map=i.map,t.sizeAttenuation=!1,this.cache.add(e,t)),i=t}else if(e.isLine){let e="LineBasicMaterial:"+i.uuid,t=this.cache.get(e);t||(t=new aG,ie.prototype.copy.call(t,i),t.color.copy(i.color),t.map=i.map,this.cache.add(e,t)),i=t}if(n||r||a){let e="ClonedMaterial:"+i.uuid+":";n&&(e+="derivative-tangents:"),r&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=i.clone(),r&&(t.vertexColors=!0),a&&(t.flatShading=!0),n&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(i))),i=t}e.material=i}getMaterialType(){return sm}loadMaterial(e){let t,i=this,n=this.json,r=this.extensions,a=n.materials[e],s={},o=a.extensions||{},l=[];if(o[lq.KHR_MATERIALS_UNLIT]){let e=r[lq.KHR_MATERIALS_UNLIT];t=e.getMaterialType(),l.push(e.extendParams(s,a,i))}else{let n=a.pbrMetallicRoughness||{};if(s.color=new t6(1,1,1),s.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;s.color.setRGB(e[0],e[1],e[2],ec),s.opacity=e[3]}void 0!==n.baseColorTexture&&l.push(i.assignTexture(s,"map",n.baseColorTexture,eh)),s.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,s.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(l.push(i.assignTexture(s,"metalnessMap",n.metallicRoughnessTexture)),l.push(i.assignTexture(s,"roughnessMap",n.metallicRoughnessTexture))),t=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)})))}!0===a.doubleSided&&(s.side=2);let h=a.alphaMode||hf.OPAQUE;if(h===hf.BLEND?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,h===hf.MASK&&(s.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==it&&(l.push(i.assignTexture(s,"normalMap",a.normalTexture)),s.normalScale=new eM(1,1),void 0!==a.normalTexture.scale)){let e=a.normalTexture.scale;s.normalScale.set(e,e)}if(void 0!==a.occlusionTexture&&t!==it&&(l.push(i.assignTexture(s,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(s.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==it){let e=a.emissiveFactor;s.emissive=new t6().setRGB(e[0],e[1],e[2],ec)}return void 0!==a.emissiveTexture&&t!==it&&l.push(i.assignTexture(s,"emissiveMap",a.emissiveTexture,eh)),Promise.all(l).then(function(){let n=new t(s);return a.name&&(n.name=a.name),h_(n,a),i.associations.set(n,{materials:e}),a.extensions&&hv(r,n,a),n})}createUniqueName(e){let t=oo.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,i=this.extensions,n=this.primitiveCache,r=[];for(let a=0,s=e.length;a0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let i=0,n=t.weights.length;i1?new an:1===t.length?t[0]:new tW)!==t[0])for(let e=0,i=t.length;e{let t=new Map;for(let[e,i]of n.associations)(e instanceof ie||e instanceof eW)&&t.set(e,i);return e.traverse(e=>{let i=n.associations.get(e);null!=i&&t.set(e,i)}),t})(r),r})}_createAnimationTracks(e,t,i,n,r){let a,s=[],o=e.name?e.name:e.uuid,l=[];switch(hg[r.path]===hg.weights?e.traverse(function(e){e.morphTargetInfluences&&l.push(e.name?e.name:e.uuid)}):l.push(o),hg[r.path]){case hg.weights:a=sb;break;case hg.rotation:a=sB;break;case hg.position:case hg.scale:a=sL;break;default:a=1===i.itemSize?sb:sL}let h=void 0!==n.interpolation?hm[n.interpolation]:2301,c=this._getArrayFromAccessor(i);for(let e=0,i=l.length;e-1)?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||i||n&&r<98?this.textureLoader=new sz(this.options.manager):this.textureLoader=new s6(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new sk(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}}function hC(e,t,i){let n=t.attributes,r=[];for(let t in n){let a=hp[t]||t.toLowerCase();a in e.attributes||r.push(function(t,n){return i.getDependency("accessor",t).then(function(t){e.setAttribute(n,t)})}(n[t],a))}if(void 0!==t.indices&&!e.index){let n=i.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});r.push(n)}return eF.workingColorSpace!==ec&&"COLOR_0"in n&&console.warn('THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "'.concat(eF.workingColorSpace,'" not supported.')),h_(e,t),!function(e,t,i){let n=t.attributes,r=new e1;if(void 0===n.POSITION)return;{let e=i.json.accessors[n.POSITION],t=e.min,a=e.max;if(void 0===t||void 0===a)return console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(r.set(new eZ(t[0],t[1],t[2]),new eZ(a[0],a[1],a[2])),e.normalized){let t=hE(hc[e.componentType]);r.min.multiplyScalar(t),r.max.multiplyScalar(t)}}let a=t.targets;if(void 0!==a){let e=new eZ,t=new eZ;for(let n=0,r=a.length;n{let n=this._getIdleWorker();-1!==n?(this._initWorker(n),this.workerStatus|=1<e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}}var hM=e.i(67034);class hw{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class hb{_nextUint8(){let e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){let e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){let e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){let e=this._dataView.getUint32(this._offset,this._littleEndian)+0x100000000*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){let e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_skip(e){return this._offset+=e,this}_scan(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this._offset,n=0;for(;this._dataView.getUint8(this._offset)!==t&&ne.arrayBuffer()).then(e=>WebAssembly.instantiate(e,hR)).then(this._init):WebAssembly.instantiate(hM.Buffer.from(hD,"base64"),hR).then(this._init))}_init(e){n=e.instance,hR.env.emscripten_notify_memory_growth(0)}decode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!n)throw Error("ZSTDDecoder: Await .init() before decoding.");let i=e.byteLength,a=n.exports.malloc(i);r.set(e,a),t=t||Number(n.exports.ZSTD_findDecompressedSize(a,i));let s=n.exports.malloc(t),o=n.exports.ZSTD_decompress(s,t,a,i),l=r.slice(s,s+o);return n.exports.free(a),n.exports.free(s),l}}let hD="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IAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQh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ASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigC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C0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdB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IAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY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wOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEE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",hU=new WeakMap,hP=0;class hN extends sF{setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return this.workerConfig={astcSupported:await e.hasFeatureAsync("texture-compression-astc"),etc1Supported:await e.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await e.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await e.hasFeatureAsync("texture-compression-bc"),bptcSupported:await e.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await e.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:e.hasFeature("texture-compression-bptc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:(this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this.workerConfig.etc1Supported=!1),this}init(){if(!this.transcoderPending){let e=new sk(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);let t=e.loadAsync("basis_transcoder.js"),i=new sk(this.manager);i.setPath(this.transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);let n=i.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,n]).then(e=>{let[t,i]=e,n=hN.BasisWorker.toString(),r=["/* constants */","let _EngineFormat = "+JSON.stringify(hN.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(hN.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(hN.BasisFormat),"/* basis_transcoder.js */",t,"/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r])),this.transcoderBinary=i,this.workerPool.setWorkerCreator(()=>{let e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e})}),hP>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),hP++}return this.transcoderPending}load(e,t,i,n){if(null===this.workerConfig)throw Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");let r=new sk(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials),r.load(e,e=>{if(hU.has(e))return hU.get(e).promise.then(t).catch(n);this._createTexture(e).then(e=>t?t(e):null).catch(n)},i,n)}_createTextureFrom(e,t){let i,{faces:n,width:r,height:a,format:s,type:o,error:l,dfdFlags:h}=e;if("error"===o)return Promise.reject(l);if(6===t.faceCount)i=new a9(n,s,1009);else{let e=n[0].mipmaps;i=t.layerCount>1?new a6(e,r,a,t.layerCount,s,1009):new a8(e,r,a,s,1009)}return i.minFilter=1===n[0].mipmaps.length?1006:1008,i.magFilter=1006,i.generateMipmaps=!1,i.needsUpdate=!0,i.colorSpace=hG(t),i.premultiplyAlpha=!!(1&h),i}async _createTexture(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=function(e){let t=new Uint8Array(e.buffer,e.byteOffset,hT.length);if(t[0]!==hT[0]||t[1]!==hT[1]||t[2]!==hT[2]||t[3]!==hT[3]||t[4]!==hT[4]||t[5]!==hT[5]||t[6]!==hT[6]||t[7]!==hT[7]||t[8]!==hT[8]||t[9]!==hT[9]||t[10]!==hT[10]||t[11]!==hT[11])throw Error("Missing KTX 2.0 identifier.");let i=new hw,n=17*Uint32Array.BYTES_PER_ELEMENT,r=new hb(e,hT.length,n,!0);i.vkFormat=r._nextUint32(),i.typeSize=r._nextUint32(),i.pixelWidth=r._nextUint32(),i.pixelHeight=r._nextUint32(),i.pixelDepth=r._nextUint32(),i.layerCount=r._nextUint32(),i.faceCount=r._nextUint32();let a=r._nextUint32();i.supercompressionScheme=r._nextUint32();let s=r._nextUint32(),o=r._nextUint32(),l=r._nextUint32(),h=r._nextUint32(),c=r._nextUint64(),u=r._nextUint64(),d=new hb(e,hT.length+n,3*a*8,!0);for(let t=0;tthis.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:t},[e])).then(e=>this._createTextureFrom(e.data,i));return hU.set(e,{promise:n}),n}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),hP--,this}constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new hI,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}}hN.BasisFormat={ETC1S:0,UASTC_4x4:1},hN.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},hN.EngineFormat={RGBAFormat:1023,RGBA_ASTC_4x4_Format:37808,RGBA_BPTC_Format:36492,RGBA_ETC2_EAC_Format:37496,RGBA_PVRTC_4BPPV1_Format:35842,RGBA_S3TC_DXT5_Format:33779,RGB_ETC1_Format:36196,RGB_ETC2_Format:37492,RGB_PVRTC_4BPPV1_Format:35840,RGB_S3TC_DXT1_Format:33776},hN.BasisWorker=function(){let e,t,i,n=_EngineFormat,r=_TranscoderFormat,a=_BasisFormat;self.addEventListener("message",function(s){let c=s.data;switch(c.type){case"init":var u;e=c.config,u=c.transcoderBinary,t=new Promise(e=>{BASIS(i={wasmBinary:u,onRuntimeInitialized:e})}).then(()=>{i.initializeBasis(),void 0===i.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")});break;case"transcode":t.then(()=>{try{let{faces:t,buffers:s,width:u,height:d,hasAlpha:A,format:p,dfdFlags:g}=function(t){let s=new i.KTX2File(new Uint8Array(t));function c(){s.close(),s.delete()}if(!s.isValid())throw c(),Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");let u=s.isUASTC()?a.UASTC_4x4:a.ETC1S,d=s.getWidth(),A=s.getHeight(),p=s.getLayers()||1,g=s.getLevels(),m=s.getFaces(),f=s.getHasAlpha(),v=s.getDFDFlags(),{transcoderFormat:_,engineFormat:y}=function(t,i,s,c){let u,d=t===a.ETC1S?o:l;for(let n=0;n1?(n=o.origWidth,r=o.origHeight):(n=o.width,r=o.height);let l=new Uint8Array(s.getImageTranscodedSizeInBytes(i,t,0,_));if(!s.transcodeImage(l,i,t,e,_,0,-1,-1))throw c(),Error("THREE.KTX2Loader: .transcodeImage failed.");a.push(l)}let o=function(e){if(1===e.length)return e[0];let t=0;for(let i=0;i{let t=new hL;await t.init(),e(t)})),t=await a);let r=[];for(let i=0;i>i),l=Math.max(1,e.pixelHeight>>i),h=e.pixelDepth?Math.max(1,e.pixelDepth>>i):0,c=e.levels[i];if(0===e.supercompressionScheme)a=c.levelData;else if(2===e.supercompressionScheme)a=t.decode(c.levelData,c.uncompressedByteLength);else throw Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");s=1015===hO[n]?new Float32Array(a.buffer,a.byteOffset,a.byteLength/Float32Array.BYTES_PER_ELEMENT):1016===hO[n]?new Uint16Array(a.buffer,a.byteOffset,a.byteLength/Uint16Array.BYTES_PER_ELEMENT):a,r.push({data:s,width:o,height:l,depth:h})}if(hF.has(hQ[n]))i=0===e.pixelDepth?new ab(r[0].data,e.pixelWidth,e.pixelHeight):new eK(r[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw Error("THREE.KTX2Loader: Unsupported pixelDepth.");i=new a8(r,e.pixelWidth,e.pixelHeight)}return i.mipmaps=r,i.type=hO[n],i.format=hQ[n],i.colorSpace=hG(e),i.needsUpdate=!0,Promise.resolve(i)}function hG(e){let t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?eh:ec:10===t.colorPrimaries?2===t.transferFunction?eu:ed:(0===t.colorPrimaries||console.warn('THREE.KTX2Loader: Unsupported color primaries, "'.concat(t.colorPrimaries,'"')),"")}let hH=Symbol("retainerCount"),hz=Symbol("recentlyUsed"),hV=Symbol("evict"),hW=Symbol("evictionThreshold"),hq=Symbol("cache");class hX{set evictionThreshold(e){this[hW]=e,this[hV]()}get evictionThreshold(){return this[hW]}get cache(){return this[hq]}retainerCount(e){return this[hH].get(e)||0}reset(){this[hH].clear(),this[hz]=[]}retain(e){this[hH].has(e)||this[hH].set(e,0),this[hH].set(e,this[hH].get(e)+1);let t=this[hz].indexOf(e);-1!==t&&this[hz].splice(t,1),this[hz].unshift(e),this[hV]()}release(e){this[hH].has(e)&&this[hH].set(e,Math.max(this[hH].get(e)-1,0)),this[hV]()}[(E=hH,x=hz,hV)](){if(!(this[hz].length=this[hW];--e){let t=this[hz][e];0===this[hH].get(t)&&(this[hq].delete(t),this[hz].splice(e,1))}}constructor(e,t=5){this[E]=new Map,this[x]=[],this[hq]=e,this[hW]=t}}let hj=e=>{let t=new Map;for(let i of e.mappings)for(let e of i.variants)t.set(e,{material:null,gltfMaterialIndex:i.material});return t};class hY{afterRoot(e){let t=this.parser,i=t.json;if(void 0===i.extensions||void 0===i.extensions[this.name])return null;let n=(e=>{let t=[],i=new Set;for(let n of e){let e=n,r=0;for(;i.has(e);)e=n+"."+ ++r;i.add(e),t.push(e)}return t})((i.extensions[this.name].variants||[]).map(e=>e.name));for(let n of e.scenes)n.traverse(e=>{if(!e.material)return;let n=t.associations.get(e);if(null==n||null==n.meshes||null==n.primitives)return;let r=i.meshes[n.meshes].primitives[n.primitives].extensions;r&&r[this.name]&&(e.userData.variantMaterials=hj(r[this.name]))});return e.userData.variants=n,Promise.resolve()}constructor(e){this.parser=e,this.name="KHR_materials_variants"}}eW.DEFAULT_ANISOTROPY=4;let hK=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>{},n=e=>{let t=e.loaded/e.total;i(Math.max(0,Math.min(1,isFinite(t)?t:1)))};return new Promise((i,r)=>{t.load(e,i,n,r)})},hJ=new Map,hZ=new Map,h$=new class extends sF{setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,n){let r=new sk(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,e=>{this.parse(e,t,n)},i,n)}parse(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>{};this.decodeDracoFile(e,t,null,null,eh).catch(i)}decodeDracoFile(e,t,i,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:ec,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:()=>{},s={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:r};return this.decodeGeometry(e,s).then(t).catch(a)}decodeGeometry(e,t){let i,n=JSON.stringify(t);if(lG.has(e)){let t=lG.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r=this.workerNextTaskID++,a=e.byteLength,s=this._getWorker(r,a).then(n=>(i=n,new Promise((n,a)=>{i._callbacks[r]={resolve:n,reject:a},i.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return s.catch(()=>!0).then(()=>{i&&r&&this._releaseTask(i,r)}),lG.set(e,{key:n,promise:s}),s}_createGeometry(e){let t=new i_;e.index&&t.setIndex(new io(e.index.array,1));for(let i=0;i{i.load(e,t,void 0,n)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{let i=t[0];e||(this.decoderConfig.wasmBinary=t[1]);let n=lH.toString(),r=["/* draco decoder */",i,"\n/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.lengtht._taskLoad?-1:1});let i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{let n=document.createElement("script");document.body.appendChild(n),n.onload=t,n.onerror=i,n.async=!0,n.src=e}).then(()=>MeshoptDecoder.ready).then(()=>MeshoptDecoder))}static getMeshoptDecoderLocation(){return l}static initializeKTX2Loader(e){h0.detectSupport(e)}static get cache(){return hJ}static clearCache(){hJ.forEach((e,t)=>{this.delete(t)}),this[h2].reset()}static has(e){return hJ.has(e)}static async delete(e){if(!this.has(e))return;let t=hJ.get(e);hZ.delete(e),hJ.delete(e),(await t).dispose()}static hasFinishedLoading(e){return!!hZ.get(e)}get[(S=h2,C=h1,h2)](){return this.constructor[h2]}async preload(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>{};if(this[h1].setWithCredentials(h4.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!hJ.has(e)){null!=h&&this[h1].setMeshoptDecoder(await h);let t=hK(e,this[h1],e=>{i(.8*e)}),n=this[h3],r=t.then(e=>n.prepare(e)).then(e=>(i(.9),new n(e))).catch(e=>(console.error(e),new n));hJ.set(e,r)}await hJ.get(e),hZ.set(e,!0),i&&i(1)}async load(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>{};await this.preload(e,t,i);let n=await hJ.get(e),r=await n.clone();return this[h2].retain(e),r.dispose=()=>{this[h2].release(e)},r}constructor(e){super(),this[C]=new lV().register(e=>new hY(e)),this[h3]=e,this[h1].setDRACOLoader(h$),this[h1].setKTX2Loader(h0)}}h4[S]=new hX(h4);class h5 extends tW{copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new eM(.5,.5),this.addEventListener("removed",function(){this.traverse(function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)})})}}let h8=new eZ,h6=new tv,h9=new tv,h7=new eZ,ce=new eZ;class ct{constructor(e={}){let t,i,n,r,a=this,s={objects:new WeakMap},o=void 0!==e.element?e.element:document.createElement("div");o.style.overflow="hidden",this.domElement=o,this.getSize=function(){return{width:t,height:i}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),h6.copy(t.matrixWorldInverse),h9.multiplyMatrices(t.projectionMatrix,h6),function e(t,i,l){if(t.isCSS2DObject){var h,c;h8.setFromMatrixPosition(t.matrixWorld),h8.applyMatrix4(h9);let e=!0===t.visible&&h8.z>=-1&&h8.z<=1&&!0===t.layers.test(l.layers);if(t.element.style.display=!0===e?"":"none",!0===e){t.onBeforeRender(a,i,l);let e=t.element;e.style.transform="translate("+-100*t.center.x+"%,"+-100*t.center.y+"%)translate("+(h8.x*n+n)+"px,"+(-h8.y*r+r)+"px)",e.parentNode!==o&&o.appendChild(e),t.onAfterRender(a,i,l)}let u={distanceToCameraSquared:(h=l,c=t,h7.setFromMatrixPosition(h.matrixWorld),ce.setFromMatrixPosition(c.matrixWorld),h7.distanceToSquared(ce))};s.objects.set(t,u)}for(let n=0,r=t.children.length;n{let{geometry:i}=e;if(void 0!==i){let{position:a}=i.attributes;if(void 0!==a)for(let i=0,s=a.count;i1&&void 0!==arguments[1]?arguments[1]:1/0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;u||(u=new i9(2,2,1,1)),d||(d=new iV({uniforms:{blitTexture:new ou(e)},vertexShader:"\n varying vec2 vUv;\n void main(){\n vUv = uv;\n gl_Position = vec4(position.xy * 1.0,0.,.999999);\n }",fragmentShader:"\n uniform sampler2D blitTexture; \n varying vec2 vUv;\n\n void main(){ \n gl_FragColor = vec4(vUv.xy, 0, 1);\n \n #ifdef IS_SRGB\n gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );\n #else\n gl_FragColor = texture2D( blitTexture, vUv);\n #endif\n }"})),d.uniforms.blitTexture.value=e,d.defines.IS_SRGB=e.colorSpace==eh,d.needsUpdate=!0,A||((A=new iF(u,d)).frustumCulled=!1);let n=new iY,r=new aA;r.add(A),null===i&&(i=c=new ad({antialias:!1}));let a=Math.min(e.image.width,t),s=Math.min(e.image.height,t);i.setSize(a,s),i.clear(),i.render(r,n);let o=document.createElement("canvas"),l=o.getContext("2d");o.width=a,o.height=s,l.drawImage(i.domElement,0,0,a,s);let h=new a7(o);return h.minFilter=e.minFilter,h.magFilter=e.magFilter,h.wrapS=e.wrapS,h.wrapT=e.wrapT,h.name=e.name,c&&(c.forceContextLoss(),c.dispose(),c=null),h}let cr={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class ca{register(e){return -1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return -1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,i,n){let r=new cm,a=[];for(let e=0,t=this.pluginCallbacks.length;e1&&void 0!==arguments[1]?arguments[1]:0,i=cd(e.byteLength);if(i!==e.byteLength){let n=new Uint8Array(i);if(n.set(new Uint8Array(e)),0!==t)for(let r=e.byteLength;re.toBlob(i,t)):("image/jpeg"===t?i=.92:"image/webp"===t&&(i=.8),e.convertToBlob({type:t,quality:i}))}class cm{setPlugins(e){this.plugins=e}async write(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},i),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);let n=this.buffers,r=this.json;i=this.options;let a=this.extensionsUsed,s=this.extensionsRequired,o=new Blob(n,{type:"application/octet-stream"}),l=Object.keys(a),h=Object.keys(s);if(l.length>0&&(r.extensionsUsed=l),h.length>0&&(r.extensionsRequired=h),r.buffers&&r.buffers.length>0&&(r.buffers[0].byteLength=o.size),!0===i.binary){let e=new FileReader;e.readAsArrayBuffer(o),e.onloadend=function(){var i;let n=cA(e.result),a=new DataView(new ArrayBuffer(8));a.setUint32(0,n.byteLength,!0),a.setUint32(4,5130562,!0);let s=cA((i=JSON.stringify(r),new TextEncoder().encode(i).buffer),32),o=new DataView(new ArrayBuffer(8));o.setUint32(0,s.byteLength,!0),o.setUint32(4,0x4e4f534a,!0);let l=new ArrayBuffer(12),h=new DataView(l);h.setUint32(0,0x46546c67,!0),h.setUint32(4,2,!0);let c=12+o.byteLength+s.byteLength+a.byteLength+n.byteLength;h.setUint32(8,c,!0);let u=new Blob([l,o,s,a,n],{type:"application/octet-stream"}),d=new FileReader;d.readAsArrayBuffer(u),d.onloadend=function(){t(d.result)}}}else if(r.buffers&&r.buffers.length>0){let e=new FileReader;e.readAsDataURL(o),e.onloadend=function(){let i=e.result;r.buffers[0].uri=i,t(r)}}else t(r)}serializeUserData(e,t){if(0===Object.keys(e.userData).length)return;let i=this.options,n=this.extensionsUsed;try{let r=JSON.parse(JSON.stringify(e.userData));if(i.includeCustomExtensions&&r.gltfExtensions){for(let e in void 0===t.extensions&&(t.extensions={}),r.gltfExtensions)t.extensions[e]=r.gltfExtensions[e],n[e]=!0;delete r.gltfExtensions}Object.keys(r).length>0&&(t.extras=r)}catch(t){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}getUID(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!1===this.uids.has(e)){let t=new Map;t.set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;let t=new eZ;for(let i=0,n=e.count;i5e-4)return!1;return!0}createNormalizedNormalAttribute(e){let t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);let i=e.clone(),n=new eZ;for(let e=0,t=i.count;e4?n=e.array[r*e.itemSize+i]:(0===i?n=e.getX(r):1===i?n=e.getY(r):2===i?n=e.getZ(r):3===i&&(n=e.getW(r)),!0===e.normalized&&(n=eI.normalize(n,e.array))),t===cs.FLOAT?h.setFloat32(c,n,!0):t===cs.INT?h.setInt32(c,n,!0):t===cs.UNSIGNED_INT?h.setUint32(c,n,!0):t===cs.SHORT?h.setInt16(c,n,!0):t===cs.UNSIGNED_SHORT?h.setUint16(c,n,!0):t===cs.BYTE?h.setInt8(c,n):t===cs.UNSIGNED_BYTE&&h.setUint8(c,n),c+=a}c%o!=0&&(c+=o-c%o)}let u={buffer:this.processBuffer(h.buffer),byteOffset:this.byteOffset,byteLength:l};return void 0!==r&&(u.target=r),r===cs.ARRAY_BUFFER&&(u.byteStride=o),this.byteOffset+=l,s.bufferViews.push(u),{id:s.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){let t=this,i=t.json;return i.bufferViews||(i.bufferViews=[]),new Promise(function(n){let r=new FileReader;r.readAsArrayBuffer(e),r.onloadend=function(){let e=cA(r.result),a={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,n(i.bufferViews.push(a)-1)}})}processAccessor(e,t,i,n){let r,a,s=this.json;if(e.array.constructor===Float32Array)r=cs.FLOAT;else if(e.array.constructor===Int32Array)r=cs.INT;else if(e.array.constructor===Uint32Array)r=cs.UNSIGNED_INT;else if(e.array.constructor===Int16Array)r=cs.SHORT;else if(e.array.constructor===Uint16Array)r=cs.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)r=cs.BYTE;else if(e.array.constructor===Uint8Array)r=cs.UNSIGNED_BYTE;else throw Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(void 0===i&&(i=0),(void 0===n||n===1/0)&&(n=e.count),0===n)return null;let o=function(e,t,i){let n={min:Array(e.itemSize).fill(1/0),max:Array(e.itemSize).fill(-1/0)};for(let r=t;r4?i=e.array[r*e.itemSize+t]:(0===t?i=e.getX(r):1===t?i=e.getY(r):2===t?i=e.getZ(r):3===t&&(i=e.getW(r)),!0===e.normalized&&(i=eI.normalize(i,e.array))),n.min[t]=Math.min(n.min[t],i),n.max[t]=Math.max(n.max[t],i)}return n}(e,i,n);void 0!==t&&(a=e===t.index?cs.ELEMENT_ARRAY_BUFFER:cs.ARRAY_BUFFER);let l=this.processBufferView(e,r,i,n,a),h={bufferView:l.id,byteOffset:l.byteOffset,componentType:r,count:n,max:o.max,min:o.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(h.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(h)-1}processImage(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"image/png";if(null!==e){let r=this,a=r.cache,s=r.json,o=r.options,l=r.pending;a.images.has(e)||a.images.set(e,{});let h=a.images.get(e),c=n+":flipY/"+i.toString();if(void 0!==h[c])return h[c];s.images||(s.images=[]);let u={mimeType:n},d=cp();d.width=Math.min(e.width,o.maxTextureSize),d.height=Math.min(e.height,o.maxTextureSize);let A=d.getContext("2d");if(!0===i&&(A.translate(0,d.height),A.scale(1,-1)),void 0!==e.data){1023!==t&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>o.maxTextureSize||e.height>o.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);let i=new Uint8ClampedArray(e.height*e.width*4);for(let t=0;tr.processBufferViewImage(e)).then(e=>{u.bufferView=e})):void 0!==d.toDataURL?u.uri=d.toDataURL(n):l.push(cg(d,n).then(e=>new FileReader().readAsDataURL(e)).then(e=>{u.uri=e}));let p=s.images.push(u)-1;return h[c]=p,p}throw Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){let t=this.json;t.samplers||(t.samplers=[]);let i={magFilter:cl[e.magFilter],minFilter:cl[e.minFilter],wrapS:cl[e.wrapS],wrapT:cl[e.wrapT]};return t.samplers.push(i)-1}processTexture(e){let t=this.options,i=this.cache,n=this.json;if(i.textures.has(e))return i.textures.get(e);n.textures||(n.textures=[]),e instanceof a8&&(e=cn(e,t.maxTextureSize));let r=e.userData.mimeType;"image/webp"===r&&(r="image/png");let a={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,r)};e.name&&(a.name=e.name),this._invokeAll(function(t){t.writeTexture&&t.writeTexture(e,a)});let s=n.textures.push(a)-1;return i.textures.set(e,s),s}processMaterial(e){let t=this.cache,i=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;i.materials||(i.materials=[]);let n={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");let r=e.color.toArray().concat([e.opacity]);if(cu(r,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=r),e.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=e.metalness,n.pbrMetallicRoughness.roughnessFactor=e.roughness):(n.pbrMetallicRoughness.metallicFactor=.5,n.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){let t=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),i={index:this.processTexture(t),channel:t.channel};this.applyTextureTransform(i,t),n.pbrMetallicRoughness.metallicRoughnessTexture=i}if(e.map){let t={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(t,e.map),n.pbrMetallicRoughness.baseColorTexture=t}if(e.emissive){let t=e.emissive;if(Math.max(t.r,t.g,t.b)>0&&(n.emissiveFactor=e.emissive.toArray()),e.emissiveMap){let t={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(t,e.emissiveMap),n.emissiveTexture=t}}if(e.normalMap){let t={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&1!==e.normalScale.x&&(t.scale=e.normalScale.x),this.applyTextureTransform(t,e.normalMap),n.normalTexture=t}if(e.aoMap){let t={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};1!==e.aoMapIntensity&&(t.strength=e.aoMapIntensity),this.applyTextureTransform(t,e.aoMap),n.occlusionTexture=t}e.transparent?n.alphaMode="BLEND":e.alphaTest>0&&(n.alphaMode="MASK",n.alphaCutoff=e.alphaTest),2===e.side&&(n.doubleSided=!0),""!==e.name&&(n.name=e.name),this.serializeUserData(e,n),this._invokeAll(function(t){t.writeMaterial&&t.writeMaterial(e,n)});let a=i.materials.push(n)-1;return t.materials.set(e,a),a}processMesh(e){let t,i=this.cache,n=this.json,r=[e.geometry.uuid];if(Array.isArray(e.material))for(let t=0,i=e.material.length;t0){let t=[],n=[],r={};if(void 0!==e.morphTargetDictionary)for(let t in e.morphTargetDictionary)r[e.morphTargetDictionary[t]]=t;for(let a=0;a0&&(o.extras={},o.extras.targetNames=n)}let p=Array.isArray(e.material);if(p&&0===s.groups.length)return null;let g=!1;if(p&&null===s.index){let e=[];for(let t=0,i=s.attributes.position.count;t0&&(n.targets=c),null!==s.index){let t=this.getUID(s.index);(void 0!==f[e].start||void 0!==f[e].count)&&(t+=":"+f[e].start+":"+f[e].count),i.attributes.has(t)?n.indices=i.attributes.get(t):(n.indices=this.processAccessor(s.index,s,f[e].start,f[e].count),i.attributes.set(t,n.indices)),null===n.indices&&delete n.indices}let r=this.processMaterial(m[f[e].materialIndex]);null!==r&&(n.material=r),h.push(n)}!0===g&&s.setIndex(null),o.primitives=h,n.meshes||(n.meshes=[]),this._invokeAll(function(t){t.writeMesh&&t.writeMesh(e,o)});let v=n.meshes.push(o)-1;return i.meshes.set(a,v),v}detectMeshQuantization(e,t){let i;if(this.extensionsUsed[co])return;switch(t.array.constructor){case Int8Array:i="byte";break;case Uint8Array:i="unsigned byte";break;case Int16Array:i="short";break;case Uint16Array:i="unsigned short";break;default:return}t.normalized&&(i+=" normalized");let n=e.split("_",1)[0];cr[n]&&cr[n].includes(i)&&(this.extensionsUsed[co]=!0,this.extensionsRequired[co]=!0)}processCamera(e){let t=this.json;t.cameras||(t.cameras=[]);let i=e.isOrthographicCamera,n={type:i?"orthographic":"perspective"};return i?n.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:n.perspective={aspectRatio:e.aspect,yfov:eI.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(n.name=e.type),t.cameras.push(n)-1}processAnimation(e,t){let i=this.json,n=this.nodeMap;i.animations||(i.animations=[]);let r=(e=ca.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,a=[],s=[];for(let e=0;e0){let t=[];for(let n=0,r=e.children.length;n0&&(r.children=t)}this._invokeAll(function(t){t.writeNode&&t.writeNode(e,r)});let a=t.nodes.push(r)-1;return n.set(e,a),a}processScene(e){let t=this.json,i=this.options;t.scenes||(t.scenes=[],t.scene=0);let n={};""!==e.name&&(n.name=e.name),t.scenes.push(n);let r=[];for(let t=0,n=e.children.length;t0&&(n.nodes=r),this.serializeUserData(e,n)}processObjects(e){let t=new aA;t.name="AuxScene";for(let i=0;i0&&this.processObjects(i);for(let e=0;e0&&(a.range=e.distance)):e.isSpotLight&&(a.type="spot",e.distance>0&&(a.range=e.distance),a.spot={},a.spot.innerConeAngle=(1-e.penumbra)*e.angle,a.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||0!==e.target.position.x||0!==e.target.position.y||-1!==e.target.position.z)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),r[this.name]||(n.extensions=n.extensions||{},n.extensions[this.name]={lights:[]},r[this.name]=!0);let s=n.extensions[this.name].lights;s.push(a),t.extensions=t.extensions||{},t.extensions[this.name]={light:s.length-1}}constructor(e){this.writer=e,this.name="KHR_lights_punctual"}}class cv{writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;let i=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},i[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}constructor(e){this.writer=e,this.name="KHR_materials_unlit"}}class c_{writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.clearcoat)return;let i=this.writer,n=i.extensionsUsed,r={};if(r.clearcoatFactor=e.clearcoat,e.clearcoatMap){let t={index:i.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};i.applyTextureTransform(t,e.clearcoatMap),r.clearcoatTexture=t}if(r.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){let t={index:i.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};i.applyTextureTransform(t,e.clearcoatRoughnessMap),r.clearcoatRoughnessTexture=t}if(e.clearcoatNormalMap){let t={index:i.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};i.applyTextureTransform(t,e.clearcoatNormalMap),r.clearcoatNormalTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=r,n[this.name]=!0}constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}}class cy{writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.iridescence)return;let i=this.writer,n=i.extensionsUsed,r={};if(r.iridescenceFactor=e.iridescence,e.iridescenceMap){let t={index:i.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};i.applyTextureTransform(t,e.iridescenceMap),r.iridescenceTexture=t}if(r.iridescenceIor=e.iridescenceIOR,r.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],r.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){let t={index:i.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};i.applyTextureTransform(t,e.iridescenceThicknessMap),r.iridescenceThicknessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=r,n[this.name]=!0}constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}}class cE{writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;let i=this.writer,n=i.extensionsUsed,r={};if(r.transmissionFactor=e.transmission,e.transmissionMap){let t={index:i.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};i.applyTextureTransform(t,e.transmissionMap),r.transmissionTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=r,n[this.name]=!0}constructor(e){this.writer=e,this.name="KHR_materials_transmission"}}class cx{writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;let i=this.writer,n=i.extensionsUsed,r={};if(r.thicknessFactor=e.thickness,e.thicknessMap){let t={index:i.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};i.applyTextureTransform(t,e.thicknessMap),r.thicknessTexture=t}r.attenuationDistance=e.attenuationDistance,r.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=r,n[this.name]=!0}constructor(e){this.writer=e,this.name="KHR_materials_volume"}}class cS{writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||1.5===e.ior)return;let i=this.writer.extensionsUsed,n={};n.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=n,i[this.name]=!0}constructor(e){this.writer=e,this.name="KHR_materials_ior"}}class cC{writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||1===e.specularIntensity&&e.specularColor.equals(cc)&&!e.specularIntensityMap&&!e.specularColorMap)return;let i=this.writer,n=i.extensionsUsed,r={};if(e.specularIntensityMap){let t={index:i.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};i.applyTextureTransform(t,e.specularIntensityMap),r.specularTexture=t}if(e.specularColorMap){let t={index:i.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};i.applyTextureTransform(t,e.specularColorMap),r.specularColorTexture=t}r.specularFactor=e.specularIntensity,r.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=r,n[this.name]=!0}constructor(e){this.writer=e,this.name="KHR_materials_specular"}}class cI{writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0==e.sheen)return;let i=this.writer,n=i.extensionsUsed,r={};if(e.sheenRoughnessMap){let t={index:i.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};i.applyTextureTransform(t,e.sheenRoughnessMap),r.sheenRoughnessTexture=t}if(e.sheenColorMap){let t={index:i.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};i.applyTextureTransform(t,e.sheenColorMap),r.sheenColorTexture=t}r.sheenRoughnessFactor=e.sheenRoughness,r.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=r,n[this.name]=!0}constructor(e){this.writer=e,this.name="KHR_materials_sheen"}}class cM{writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0==e.anisotropy)return;let i=this.writer,n=i.extensionsUsed,r={};if(e.anisotropyMap){let t={index:i.processTexture(e.anisotropyMap)};i.applyTextureTransform(t,e.anisotropyMap),r.anisotropyTexture=t}r.anisotropyStrength=e.anisotropy,r.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=r,n[this.name]=!0}constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}}class cw{writeMaterial(e,t){if(!e.isMeshStandardMaterial||1===e.emissiveIntensity)return;let i=this.writer.extensionsUsed,n={};n.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=n,i[this.name]=!0}constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}}class cb{writeMaterial(e,t){if(!e.isMeshStandardMaterial||1===e.bumpScale&&!e.bumpMap)return;let i=this.writer,n=i.extensionsUsed,r={};if(e.bumpMap){let t={index:i.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};i.applyTextureTransform(t,e.bumpMap),r.bumpTexture=t}r.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=r,n[this.name]=!0}constructor(e){this.writer=e,this.name="EXT_materials_bump"}}class cT{writeNode(e,t){if(!e.isInstancedMesh)return;let i=this.writer,n=new Float32Array(3*e.count),r=new Float32Array(4*e.count),a=new Float32Array(3*e.count),s=new tv,o=new eZ,l=new eJ,h=new eZ;for(let t=0;tMath.abs(e.times[0]-t))return 0;r[0]=t,r.set(e.times,1),a.set(s.evaluate(t),0),a.set(e.values,n),i=0}else if(t>e.times[e.times.length-1]){if(.001>Math.abs(e.times[e.times.length-1]-t))return e.times.length-1;r[r.length-1]=t,r.set(e.times,0),a.set(e.values,0),a.set(s.evaluate(t),e.values.length),i=r.length-1}else for(let o=0;oMath.abs(e.times[o]-t))return o;if(e.times[o]t){r.set(e.times.slice(0,o+1),0),r[o+1]=t,r.set(e.times.slice(o+1),o+2),a.set(e.values.slice(0,(o+1)*n),0),a.set(s.evaluate(t),(o+1)*n),a.set(e.values.slice((o+1)*n),(o+2)*n),i=o+1;break}}return e.times=r,e.values=a,i},mergeMorphTargetTracks:function(e,t){let i=[],n={},r=e.tracks;for(let e=0;evoid 0!==e.material&&e.userData&&e.userData.variantMaterials&&!!Array.from(e.userData.variantMaterials.values()).filter(e=>cR(e.material)),cR=e=>e&&e.isMaterial&&!Array.isArray(e);class cL{beforeParse(e){let t=new Set;for(let i of e)i.traverse(e=>{if(!cB(e))return;let i=e.userData.variantMaterials;for(let[n,r]of e.userData.variantData){let e=i.get(r.index);e&&cR(e.material)&&t.add(n)}});t.forEach(e=>this.variantNames.push(e))}writeMesh(e,t){if(!cB(e))return;let i=e.userData,n=i.variantMaterials,r=i.variantData,a=new Map,s=new Map;for(let[e,t]of Array.from(r.values()).sort((e,t)=>e.index-t.index).entries())s.set(t.index,e);for(let e of r.values()){let t=n.get(e.index);if(!t||!cR(t.material))continue;let i=this.writer.processMaterial(t.material);a.has(i)||a.set(i,{material:i,variants:[]}),a.get(i).variants.push(s.get(e.index))}let o=Array.from(a.values()).map(e=>e.variants.sort((e,t)=>e-t)&&e).sort((e,t)=>e.material-t.material);if(0===o.length)return;let l=cR(i.originalMaterial)?this.writer.processMaterial(i.originalMaterial):-1;for(let e of t.primitives)l>=0&&(e.material=l),e.extensions=e.extensions||{},e.extensions[this.name]={mappings:o}}afterParse(){if(0===this.variantNames.length)return;let e=this.writer.json;e.extensions=e.extensions||{};let t=this.variantNames.map(e=>({name:e}));e.extensions[this.name]={variants:t},this.writer.extensionsUsed[this.name]=!0}constructor(e){this.writer=e,this.name="KHR_materials_variants",this.variantNames=[]}}class cD{updateReflection(){let e=this.renderer.properties.get(this.xrLight.environment);if(e){let t=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);t&&(e.__webglTexture=t,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(e,t){if(!this.xrLight)return;t.session.requestAnimationFrame(this.frameCallback);let i=t.getLightEstimate(this.lightProbe);if(i){this.xrLight.lightProbe.sh.fromArray(i.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;let e=Math.max(1,Math.max(i.primaryLightIntensity.x,Math.max(i.primaryLightIntensity.y,i.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(i.primaryLightIntensity.x/e,i.primaryLightIntensity.y/e,i.primaryLightIntensity.z/e),this.xrLight.directionalLight.intensity=e,this.xrLight.directionalLight.position.copy(i.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}constructor(e,t,i,n,r){this.xrLight=e,this.renderer=t,this.lightProbe=i,this.xrWebGLBinding=null,this.estimationStartCallback=r,this.frameCallback=this.onXRFrame.bind(this);let a=t.xr.getSession();if(n&&"XRWebGLBinding"in window){e.environment=new iZ(16).texture;let i=t.getContext();switch(a.preferredReflectionFormat){case"srgba8":i.getExtension("EXT_sRGB");break;case"rgba16f":i.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(a,i),this.lightProbe.addEventListener("reflectionchange",()=>{this.updateReflection()})}a.requestAnimationFrame(this.frameCallback)}}class cU extends an{constructor(e,t=!0){super(),this.lightProbe=new s5,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new s3,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let i=null,n=!1;e.xr.addEventListener("sessionstart",()=>{let r=e.xr.getSession();"requestLightProbe"in r&&r.requestLightProbe({reflectionFormat:r.preferredReflectionFormat}).then(r=>{i=new cD(this,e,r,t,()=>{n=!0,this.dispatchEvent({type:"estimationstart"})})})}),e.xr.addEventListener("sessionend",()=>{i&&(i.dispose(),i=null),n&&this.dispatchEvent({type:"estimationend"})}),this.dispose=()=>{i&&(i.dispose(),i=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}class cP{setDecayTime(e){this.naturalFrequency=1/Math.max(.001,e)}update(e,t,i,n){let r=2e-4*this.naturalFrequency;if(null==e||0===n||e===t&&0===this.velocity)return t;if(i<0)return e;let a=e-t,s=this.velocity+this.naturalFrequency*a,o=a+i*s,l=Math.exp(-this.naturalFrequency*i),h=(s-this.naturalFrequency*o)*l,c=-this.naturalFrequency*(h+s*l);return Math.abs(h)=0?(this.velocity=0,t):(this.velocity=h,t+o*l)}constructor(e=50){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(e)}}let cN=Math.PI/24,cF=new eM,cQ=(e,t,i)=>{let n=t>0?i>0?0:-Math.PI/2:i>0?Math.PI/2:Math.PI;for(let r=0;r<=12;++r)e.push(t+.17*Math.cos(n),i+.17*Math.sin(n),0,t+.2*Math.cos(n),i+.2*Math.sin(n),0),n+=cN};class cO extends iF{getHit(e,t,i){cF.set(t,-i),this.hitPlane.visible=!0;let n=e.positionAndNormalFromPoint(cF,this.hitPlane);return this.hitPlane.visible=!1,null==n?null:n.position}getExpandedHit(e,t,i){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();let n=this.getHit(e,t,i);return this.hitPlane.scale.set(1,1,1),n}set offsetHeight(e){e-=.001,"back"===this.side?this.position.z=this.shadowHeight+e:this.position.y=this.shadowHeight+e}get offsetHeight(){return"back"===this.side?this.position.z-this.shadowHeight:this.position.y-this.shadowHeight}set show(e){this.goalOpacity=.75*!!e}updateOpacity(e){let t=this.material;t.opacity=this.opacityDamper.update(t.opacity,this.goalOpacity,e,1),this.visible=t.opacity>0}dispose(){var e;let{geometry:t,material:i}=this.hitPlane;t.dispose(),i.dispose(),this.geometry.dispose(),this.material.dispose(),null==(e=this.parent)||e.remove(this)}constructor(e,t){let i=new i_,n=[],r=[],{size:a,boundingBox:s}=e,o=a.x/2,l=("back"===t?a.y:a.z)/2;cQ(r,o,l),cQ(r,-o,l),cQ(r,-o,-l),cQ(r,o,-l);let h=r.length/3;for(let e=0;e({type:"number",number:e,unit:t}),cG=(()=>{let e={};return t=>{let i=t;if(i in e)return e[i];let n=[],r=0;for(;t;){if(++r>1e3){t="";break}let e=cH(t),i=e.nodes[0];if(null==i||0===i.terms.length)break;n.push(i),t=e.remainingInput}return e[i]=n}})(),cH=(()=>{let e=/^(\-\-|[a-z\u0240-\uffff])/i,t=/^([\*\+\/]|[\-]\s)/i,i=/^[\),]/;return n=>{let r=[];for(;n.length&&(n=n.trim(),!i.test(n));)if("("===n[0]){let{nodes:e,remainingInput:t}=cq(n);n=t,r.push({type:"function",name:{type:"ident",value:"calc"},arguments:e})}else if(e.test(n)){let e=cz(n),t=e.nodes[0];if("("===(n=e.remainingInput)[0]){let{nodes:e,remainingInput:i}=cq(n);r.push({type:"function",name:t,arguments:e}),n=i}else r.push(t)}else if(t.test(n))r.push({type:"operator",value:n[0]}),n=n.slice(1);else{let{nodes:e,remainingInput:t}="#"===n[0]?cW(n):cV(n);if(0===e.length)break;r.push(e[0]),n=t}return{nodes:[{type:"expression",terms:r}],remainingInput:n}}})(),cz=(()=>{let e=/[^a-z0-9_\-\u0240-\uffff]/i;return t=>{let i=t.match(e);return{nodes:[{type:"ident",value:null==i?t:t.substr(0,i.index)}],remainingInput:null==i?"":t.substr(i.index)}}})(),cV=(()=>{let e=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,t=/^[a-z%]+/i,i=/^(m|mm|cm|rad|deg|[%])$/;return n=>{let r=n.match(e),a=null==r?"0":r[0],s=(n=null==a?n:n.slice(a.length)).match(t),o=null!=s&&""!==s[0]?s[0]:null,l=null==s?n:n.slice(o.length);return null==o||i.test(o)||(o=null),{nodes:[{type:"number",number:parseFloat(a)||0,unit:o}],remainingInput:l}}})(),cW=(()=>{let e=/^[a-f0-9]*/i;return t=>{let i=(t=t.slice(1).trim()).match(e);return{nodes:null==i?[]:[{type:"hex",value:i[0]}],remainingInput:null==i?t:t.slice(i[0].length)}}})(),cq=e=>{let t=[];for(e=e.slice(1).trim();e.length;){let i=cH(e);if(t.push(i.nodes[0]),","===(e=i.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},cX=Symbol("visitedTypes");class cj{walk(e,t){let i=e.slice();for(;i.length;){let e=i.shift();switch(this[cX].indexOf(e.type)>-1&&t(e),e.type){case"expression":i.unshift(...e.terms);break;case"function":i.unshift(e.name,...e.arguments)}}}constructor(e){this[cX]=e}}let cY=Object.freeze({type:"number",number:0,unit:null}),cK=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,{number:i,unit:n}=e;if(isFinite(i)){if("rad"===e.unit||null==e.unit)return e}else i=t,n="rad";return{type:"number",number:("deg"===n&&null!=i?i:0)*Math.PI/180,unit:"rad"}},cJ=function(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,{number:n,unit:r}=e;if(isFinite(n)){if("m"===e.unit)return e}else n=i,r="m";switch(r){default:t=1;break;case"cm":t=.01;break;case"mm":t=.001}return{type:"number",number:t*n,unit:"m"}},cZ=(()=>{let e=e=>e,t={rad:e,deg:cK,m:e,mm:cJ,cm:cJ};return function(e){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cY;isFinite(e.number)||(e.number=i.number,e.unit=i.unit);let{unit:n}=e;if(null==n)return e;let r=t[n];return null==r?i:r(e)}})(),c$=Symbol("evaluate"),c0=Symbol("lastValue");class c1{static evaluatableFor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:cY;if(e instanceof c1)return e;if("number"===e.type)return"%"===e.unit?new c4(e,t):e;switch(e.name.value){case"calc":return new c7(e,t);case"env":return new c8(e)}return cY}static evaluate(e){return e instanceof c1?e.evaluate():e}static isConstant(e){return!(e instanceof c1)||e.isConstant}static applyIntrinsics(e,t){let{basis:i,keywords:n}=t,{auto:r}=n;return i.map((t,i)=>{let a=null==r[i]?t:r[i],s=e[i]?e[i]:a;if("ident"===s.type){let e=s.value;e in n&&(s=n[e][i])}return((null==s||"ident"===s.type)&&(s=a),"%"===s.unit)?ck(s.number/100*t.number,t.unit):(s=cZ(s,t)).unit!==t.unit?t:s})}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[c0]||(this[c0]=this[c$]()),this[c0]}constructor(){this[I]=null}}I=c0;let c2=Symbol("percentage"),c3=Symbol("basis");class c4 extends c1{get isConstant(){return!0}[c$](){return ck(this[c2].number/100*this[c3].number,this[c3].unit)}constructor(e,t){super(),this[c2]=e,this[c3]=t}}let c5=Symbol("identNode");class c8 extends c1{get isConstant(){return!1}[(M=c5,c$)](){return null!=this[c5]&&"window-scroll-y"===this[c5].value?{type:"number",number:window.pageYOffset/(Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)-window.innerHeight)||0,unit:null}:cY}constructor(e){super(),this[M]=null;let t=e.arguments.length?e.arguments[0].terms[0]:null;null!=t&&"ident"===t.type&&(this[c5]=t)}}let c6=/[\*\/]/,c9=Symbol("evaluator");class c7 extends c1{get isConstant(){return null==this[c9]||c1.isConstant(this[c9])}[(w=c9,c$)](){return null!=this[c9]?c1.evaluate(this[c9]):cY}constructor(e,t=cY){if(super(),this[w]=null,1!==e.arguments.length)return;let i=e.arguments[0].terms.slice(),n=[];for(;i.length;){let e=i.shift();if(n.length>0){let i=n[n.length-1];if("operator"===i.type&&c6.test(i.value)){let i=n.pop(),r=n.pop();if(null==r)return;n.push(new un(i,c1.evaluatableFor(r,t),c1.evaluatableFor(e,t)));continue}}n.push("operator"===e.type?e:c1.evaluatableFor(e,t))}for(;n.length>2;){let[e,i,r]=n.splice(0,3);if("operator"!==i.type)return;n.unshift(new un(i,c1.evaluatableFor(e,t),c1.evaluatableFor(r,t)))}1===n.length&&(this[c9]=n[0])}}let ue=Symbol("operator"),ut=Symbol("left"),ui=Symbol("right");class un extends c1{get isConstant(){return c1.isConstant(this[ut])&&c1.isConstant(this[ui])}[c$](){let e,t=cZ(c1.evaluate(this[ut])),i=cZ(c1.evaluate(this[ui])),{number:n,unit:r}=t,{number:a,unit:s}=i;if(null!=s&&null!=r&&s!=r)return cY;switch(this[ue].value){case"+":e=n+a;break;case"-":e=n-a;break;case"/":e=n/a;break;case"*":e=n*a;break;default:return cY}return{type:"number",number:e,unit:r||s}}constructor(e,t,i){super(),this[ue]=e,this[ut]=t,this[ui]=i}}let ur=Symbol("evaluatables"),ua=Symbol("intrinsics");class us extends c1{get isConstant(){for(let e of this[ur])if(!c1.isConstant(e))return!1;return!0}[c$](){let e=this[ur].map(e=>c1.evaluate(e));return c1.applyIntrinsics(e,this[ua]).map(e=>e.number)}constructor(e,t){super(),this[ua]=t;let i=e[0],n=null!=i?i.terms:[];this[ur]=t.basis.map((e,t)=>{let i=n[t];return null==i?{type:"ident",value:"auto"}:"ident"===i.type?i:c1.evaluatableFor(i,e)})}}let uo=Symbol("instances"),ul=Symbol("activateListener"),uh=Symbol("deactivateListener"),uc=Symbol("notifyInstances"),uu=Symbol("notify"),ud=Symbol("callback");class uA{static[uc](){for(let e of uA[uo])e[uu]()}static[(b=uo,ul)](){window.addEventListener("scroll",this[uc],{passive:!0})}static[uh](){window.removeEventListener("scroll",this[uc])}observe(){0===uA[uo].size&&uA[ul](),uA[uo].add(this)}disconnect(){uA[uo].delete(this),0===uA[uo].size&&uA[uh]()}[uu](){this[ud]()}constructor(e){this[ud]=e}}uA[b]=new Set;let up=Symbol("computeStyleCallback"),ug=Symbol("astWalker"),um=Symbol("dependencies"),uf=Symbol("onScroll");class uv{observeEffectsFor(e){let t={},i=this[um];for(let n in this[ug].walk(e,e=>{let{name:n}=e,r=e.arguments[0].terms[0];if("env"===n.value&&null!=r&&"ident"===r.type&&"window-scroll-y"===r.value&&null==t["window-scroll"]){let e="window-scroll"in i?i["window-scroll"]:new uA(this[uf]);e.observe(),delete i["window-scroll"],t["window-scroll"]=e}}),i)i[n].disconnect();this[um]=t}dispose(){for(let e in this[um])this[um][e].disconnect()}constructor(e){this[T]={},this[B]=new cj(["function"]),this[R]=()=>{this[up]({relatedState:"window-scroll"})},this[up]=e}}T=um,B=ug,R=uf;let u_=e=>{let t=e.observeEffects||!1,i=e.intrinsics instanceof Function?e.intrinsics:()=>e.intrinsics;return(n,r)=>{let a=n.updated,s=n.connectedCallback,o=n.disconnectedCallback,l=Symbol("".concat(r,"StyleEffector")),h=Symbol("".concat(r,"StyleEvaluator")),c=Symbol("".concat(r,"UpdateEvaluator")),u=Symbol("".concat(r,"EvaluateAndSync"));Object.defineProperties(n,{[l]:{value:null,writable:!0},[h]:{value:null,writable:!0},[c]:{value:function(){let e=cG(this[r]);this[h]=new us(e,i(this)),null==this[l]&&t&&(this[l]=new uv(()=>this[u]())),null!=this[l]&&this[l].observeEffectsFor(e)}},[u]:{value:function(){if(null==this[h])return;let t=this[h].evaluate();this[e.updateHandler](t)}},updated:{value:function(e){e.has(r)&&(this[c](),this[u]()),a.call(this,e)}},connectedCallback:{value:function(){s.call(this),this.requestUpdate(r,this[r])}},disconnectedCallback:{value:function(){o.call(this),null!=this[l]&&(this[l].dispose(),this[l]=null)}}})}},uy=e=>e<.5?2*e*e:-1+(4-2*e)*e,uE=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:uy;return n=>e+(t-e)*i(n)},ux=e=>{let t=[],i=[],n=e.initialValue;for(let r=0;r{let i=t.map((e=>t=>e+=t)(0));return t=>{t=lx(t,0,1)*i[i.length-1];let n=i.findIndex(e=>e>=t),r=n<1?0:i[n-1],a=i[n];return e[n]((t-r)/(a-r))}})(t,i)};var uS=function(e,t,i,n){var r,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(a<3?r(s):a>3?r(t,i,s):r(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let uC=ux({initialValue:0,keyframes:[{frames:5,value:-1},{frames:1,value:-1},{frames:8,value:1},{frames:1,value:1},{frames:5,value:0},{frames:18,value:0}]}),uI=ux({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),uM="0deg 75deg 105%",uw=["front","right","back","left"],ub=["upper-","","lower-"],uT={AUTO:"auto"},uB={BASIC:"basic",WIGGLE:"wiggle"},uR={NONE:"none"},uL=()=>({basis:[cK(ck(30,"deg"))],keywords:{auto:[null]}}),uD=()=>({basis:[cK(ck(12,"deg"))],keywords:{auto:[null]}}),uU=(()=>{let e=cG(uM)[0].terms,t=cZ(e[0]),i=cZ(e[1]);return e=>({basis:[t,i,ck(e[pZ].idealCameraDistance(),"m")],keywords:{auto:[null,null,ck(105,"%")]}})})(),uP=e=>{let t=2.2*e[pZ].boundingSphere.radius;return{basis:[ck(-1/0,"rad"),ck(Math.PI/8,"rad"),ck(t,"m")],keywords:{auto:[null,null,null]}}},uN=e=>{let t=new us([],uU(e)).evaluate()[2];return{basis:[ck(1/0,"rad"),ck(Math.PI-Math.PI/8,"rad"),ck(t,"m")],keywords:{auto:[null,null,null]}}},uF=e=>{let t=e[pZ].boundingBox.getCenter(new eZ);return{basis:[ck(t.x,"m"),ck(t.y,"m"),ck(t.z,"m")],keywords:{auto:[null,null,null]}}},uQ=Math.PI/2,uO=Math.PI/3,uk=uQ/2,uG=2*Math.PI,uH=Symbol("controls"),uz=Symbol("panElement"),uV=Symbol("promptElement"),uW=Symbol("promptAnimatedContainer"),uq=Symbol("fingerAnimatedContainers"),uX=Symbol("deferInteractionPrompt"),uj=Symbol("updateAria"),uY=Symbol("a11y"),uK=Symbol("updateA11y"),uJ=Symbol("updateCameraForRadius"),uZ=Symbol("cancelPrompts"),u$=Symbol("onChange"),u0=Symbol("onPointerChange"),u1=Symbol("waitingToPromptUser"),u2=Symbol("userHasInteracted"),u3=Symbol("promptElementVisibleTime"),u4=Symbol("lastPromptOffset"),u5=Symbol("cancellationSource"),u8=Symbol("lastSpherical"),u6=Symbol("jumpCamera"),u9=Symbol("initialized"),u7=Symbol("maintainThetaPhi"),de=Symbol("syncCameraOrbit"),dt=Symbol("syncFieldOfView"),di=Symbol("syncCameraTarget"),dn=Symbol("syncMinCameraOrbit"),dr=Symbol("syncMaxCameraOrbit"),da=Symbol("syncMinFieldOfView"),ds=Symbol("syncMaxFieldOfView"),dl=new eM,dh=new eZ,dc=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:Math.PI/8,maximumPolarAngle:Math.PI-Math.PI/8,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,touchAction:"none"}),du=Math.PI/8,dd={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class dA extends ef{get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(!1===this._interactionEnabled){let{element:e}=this;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerUp),this._disableZoom||e.addEventListener("wheel",this.onWheel),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("touchmove",()=>{},{passive:!1}),e.addEventListener("contextmenu",this.onContext),this.element.style.cursor="grab",this._interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(!0===this._interactionEnabled){let{element:e}=this;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),e.removeEventListener("pointercancel",this.onPointerUp),e.removeEventListener("wheel",this.onWheel),e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("contextmenu",this.onContext),e.style.cursor="",this.touchMode=null,this._interactionEnabled=!1,this.updateTouchActionStyle()}}get options(){return this._options}set disableZoom(e){this._disableZoom!=e&&(this._disableZoom=e,!0===e?this.element.removeEventListener("wheel",this.onWheel):this.element.addEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}getCameraSpherical(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new og;return e.copy(this.spherical)}getFieldOfView(){return this.camera.fov}applyOptions(e){Object.assign(this._options,e),this.setOrbit(),this.setFieldOfView(Math.exp(this.goalLogFov))}updateNearFar(e,t){this.camera.far=0===t?2:t,this.camera.near=Math.max(e,this.camera.far/1e3),this.camera.updateProjectionMatrix()}updateAspect(e){this.camera.aspect=e,this.camera.updateProjectionMatrix()}setOrbit(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.goalSpherical.theta,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.goalSpherical.phi,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.goalSpherical.radius,{minimumAzimuthalAngle:n,maximumAzimuthalAngle:r,minimumPolarAngle:a,maximumPolarAngle:s,minimumRadius:o,maximumRadius:l}=this._options,{theta:h,phi:c,radius:u}=this.goalSpherical,d=lx(e,n,r);isFinite(n)||isFinite(r)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-d)+d);let A=lx(t,a,s),p=lx(i,o,l);return(d!==h||A!==c||p!==u)&&!!isFinite(d)&&!!isFinite(A)&&!!isFinite(p)&&(this.goalSpherical.theta=d,this.goalSpherical.phi=A,this.goalSpherical.radius=p,this.goalSpherical.makeSafe(),!0)}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){let{minimumFieldOfView:t,maximumFieldOfView:i}=this._options;e=lx(e,t,i),this.goalLogFov=Math.log(e)}setDamperDecayTime(e){this.thetaDamper.setDecayTime(e),this.phiDamper.setDecayTime(e),this.radiusDamper.setDecayTime(e),this.fovDamper.setDecayTime(e)}adjustOrbit(e,t,i){let{theta:n,phi:r,radius:a}=this.goalSpherical,{minimumRadius:s,maximumRadius:o,minimumFieldOfView:l,maximumFieldOfView:h}=this._options,c=this.spherical.theta-n,u=Math.PI-.001,d=n-lx(e,-u-c,u-c),A=0===i?0:((i>0?o:s)-a)/(Math.log(i>0?h:l)-this.goalLogFov),p=a+i*(isFinite(A)?A:(o-s)*2);if(this.setOrbit(d,r-t,p),0!==i){let e=this.goalLogFov+i;this.setFieldOfView(Math.exp(e))}}jumpToGoal(){this.update(0,1e4)}update(e,t){if(this.isStationary())return!1;let{maximumPolarAngle:i,maximumRadius:n}=this._options,r=this.spherical.theta-this.goalSpherical.theta;return!(Math.abs(r)>Math.PI)||isFinite(this._options.minimumAzimuthalAngle)||isFinite(this._options.maximumAzimuthalAngle)||(this.spherical.theta-=2*Math.sign(r)*Math.PI),this.spherical.theta=this.thetaDamper.update(this.spherical.theta,this.goalSpherical.theta,t,Math.PI),this.spherical.phi=this.phiDamper.update(this.spherical.phi,this.goalSpherical.phi,t,i),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,n),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,t,1),this.moveCamera(),!0}updateTouchActionStyle(){let{style:e}=this.element;if(this._interactionEnabled){let{touchAction:t}=this._options;this._disableZoom&&"none"!==t?e.touchAction="manipulation":e.touchAction=t}else e.touchAction=""}isStationary(){return this.goalSpherical.theta===this.spherical.theta&&this.goalSpherical.phi===this.spherical.phi&&this.goalSpherical.radius===this.spherical.radius&&this.goalLogFov===this.logFov}moveCamera(){this.spherical.makeSafe(),this.camera.position.setFromSpherical(this.spherical),this.camera.setRotationFromEuler(new tb(this.spherical.phi-Math.PI/2,this.spherical.theta,0,"YXZ")),this.camera.fov!==Math.exp(this.logFov)&&(this.camera.fov=Math.exp(this.logFov),this.camera.updateProjectionMatrix())}userAdjustOrbit(e,t,i){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,i*this.inputSensitivity)}wrapAngle(e){let t=(e+Math.PI)/(2*Math.PI);return 2*(t-Math.floor(t))*Math.PI-Math.PI}pixelLengthToSphericalAngle(e){return 2*Math.PI*e/this.scene.height}twoTouchDistance(e,t){let{clientX:i,clientY:n}=e,{clientX:r,clientY:a}=t,s=r-i,o=a-n;return Math.sqrt(s*s+o*o)}handleSinglePointerMove(e,t){let i=this.pixelLengthToSphericalAngle(e),n=this.pixelLengthToSphericalAngle(t);!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(i,n,0)}initializePan(){let{theta:e,phi:t}=this.spherical,i=e-this.scene.yaw;this.panPerPixel=.018*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(i),-Math.cos(t)*Math.sin(i),0,0,Math.sin(t),0,Math.sin(i),-Math.cos(t)*Math.cos(i),0)}movePan(e,t){let{scene:i}=this,n=dh.set(e,t,0).multiplyScalar(this.inputSensitivity),r=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;n.multiplyScalar(r);let a=i.getTarget();a.add(n.applyMatrix3(this.panProjection)),i.boundingSphere.clampPoint(a,a),i.setTarget(a.x,a.y,a.z)}recenter(e){if(performance.now()>this.startTime+300||Math.abs(e.clientX-this.startPointerPosition.clientX)>2||Math.abs(e.clientY-this.startPointerPosition.clientY)>2)return;let{scene:t}=this,i=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(null==i){let{cameraTarget:e}=t.element;t.element.cameraTarget="",t.element.cameraTarget=e,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(i.position),t.setTarget(i.position.x,i.position.y,i.position.z)}resetRadius(){let{scene:e}=this,t=e.positionAndNormalFromPoint(dl.set(0,0));if(null==t)return;e.target.worldToLocal(t.position);let i=e.getTarget(),{theta:n,phi:r}=this.spherical,a=n-e.yaw,s=dh.set(Math.sin(r)*Math.sin(a),Math.cos(r),Math.sin(r)*Math.cos(a)),o=s.dot(t.position.sub(i));i.add(s.multiplyScalar(o)),e.setTarget(i.x,i.y,i.z),this.setOrbit(void 0,void 0,this.goalSpherical.radius-o)}onTouchChange(e){if(1===this.pointers.length)this.touchMode=this.touchModeRotate;else{if(this._disableZoom){this.touchMode=null,this.element.removeEventListener("touchmove",this.disableScroll);return}this.touchMode=this.touchDecided&&null===this.touchMode?null:this.touchModeZoom,this.touchDecided=!0,this.element.addEventListener("touchmove",this.disableScroll,{passive:!1}),this.lastSeparation=this.twoTouchDistance(this.pointers[0],this.pointers[1]),this.enablePan&&null!=this.touchMode&&(this.initializePan(),e.altKey||(this.scene.element[uz].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[uz].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,.04*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-.04*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-du,0);break;case"ArrowDown":this.userAdjustOrbit(0,du,0);break;case"ArrowLeft":this.userAdjustOrbit(-du,0,0);break;case"ArrowRight":this.userAdjustOrbit(du,0,0);break;default:t=!1}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.key){case"ArrowUp":this.movePan(0,-10);break;case"ArrowDown":this.movePan(0,10);break;case"ArrowLeft":this.movePan(-10,0);break;case"ArrowRight":this.movePan(10,0);break;default:t=!1}return t}constructor(e,t,i){super(),this.camera=e,this.element=t,this.scene=i,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=dd.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new ew,this.panPerPixel=0,this.spherical=new og,this.goalSpherical=new og,this.thetaDamper=new cP,this.phiDamper=new cP,this.radiusDamper=new cP,this.logFov=Math.log(dc.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new cP,this.touchMode=null,this.pointers=[],this.startTime=0,this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.onContext=e=>{if(this.enablePan)e.preventDefault();else for(let e of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:e.id})))},this.touchModeZoom=(e,t)=>{if(!this._disableZoom){let e=this.twoTouchDistance(this.pointers[0],this.pointers[1]),t=.04*this.zoomSensitivity*(this.lastSeparation-e)*50/this.scene.height;this.lastSeparation=e,this.userAdjustOrbit(0,0,t)}this.panPerPixel>0&&this.movePan(e,t)},this.disableScroll=e=>{e.preventDefault()},this.touchModeRotate=(e,t)=>{let{touchAction:i}=this._options;if(!this.touchDecided&&"none"!==i){this.touchDecided=!0;let n=Math.abs(e),r=Math.abs(t);if(this.changeSource===dd.USER_INTERACTION&&("pan-y"===i&&r>n||"pan-x"===i&&n>r)){this.touchMode=null;return}this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(e,t)},this.onPointerDown=e=>{if(this.pointers.length>2)return;let{element:t}=this;0===this.pointers.length&&(t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=e.clientX,this.startPointerPosition.clientY=e.clientY,this.startTime=performance.now());try{t.setPointerCapture(e.pointerId)}catch(e){}this.pointers.push({clientX:e.clientX,clientY:e.clientY,id:e.pointerId}),this.isUserPointing=!1,"touch"===e.pointerType?(this.changeSource=e.altKey?dd.AUTOMATIC:dd.USER_INTERACTION,this.onTouchChange(e)):(this.changeSource=dd.USER_INTERACTION,this.onMouseDown(e)),this.changeSource===dd.USER_INTERACTION&&this.dispatchEvent({type:"user-interaction"})},this.onPointerMove=e=>{let t=this.pointers.find(t=>t.id===e.pointerId);if(null==t)return;if("mouse"===e.pointerType&&0===e.buttons)return void this.onPointerUp(e);let i=this.pointers.length,n=(e.clientX-t.clientX)/i,r=(e.clientY-t.clientY)/i;(0!==n||0!==r)&&(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?dd.AUTOMATIC:dd.USER_INTERACTION,null!==this.touchMode&&this.touchMode(n,r)):(this.changeSource=dd.USER_INTERACTION,this.panPerPixel>0?this.movePan(n,r):this.handleSinglePointerMove(n,r)))},this.onPointerUp=e=>{let{element:t}=this,i=this.pointers.findIndex(t=>t.id===e.pointerId);-1!==i&&this.pointers.splice(i,1),this.panPerPixel>0&&!e.altKey&&this.resetRadius(),0===this.pointers.length?(t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),t.removeEventListener("touchmove",this.disableScroll),this.enablePan&&this.enableTap&&this.recenter(e)):null!==this.touchMode&&this.onTouchChange(e),this.scene.element[uz].style.opacity=0,t.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=e=>{this.changeSource=dd.USER_INTERACTION;let t=e.deltaY*(1==e.deltaMode?18:1)*.04*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,t),e.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=e=>{let{changeSource:t}=this;this.changeSource=dd.USER_INTERACTION,(e.shiftKey&&this.enablePan?this.panKeyCodeHandler(e):this.orbitZoomKeyCodeHandler(e))?(e.preventDefault(),this.dispatchEvent({type:"user-interaction"})):this.changeSource=t},this._options=Object.assign({},dc),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}}let dp={NOT_PRESENTING:"not-presenting",SESSION_STARTED:"session-started",OBJECT_PLACED:"object-placed",FAILED:"failed"},dg={TRACKING:"tracking",NOT_TRACKING:"not-tracking"},dm=new eZ,df=new tv,dv=new eZ,d_=new iY(45,1,.1,100);class dy extends ef{async resolveARSession(){l_();let e=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["dom-overlay","light-estimation"],domOverlay:this.overlay?{root:this.overlay}:void 0});return this.threeRenderer.xr.setReferenceSpaceType("local"),await this.threeRenderer.xr.setSession(e),this.threeRenderer.xr.cameraAutoUpdate=!1,e}get presentedScene(){return this._presentedScene}async supportsPresentation(){try{return l_(),await navigator.xr.isSessionSupported("immersive-ar")}catch(e){return console.warn("Request to present in WebXR denied:"),console.warn(e),console.warn("Falling back to next ar-mode"),!1}}async present(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.isPresenting&&console.warn("Cannot present while a model is already presenting");let i=new Promise((e,t)=>{requestAnimationFrame(()=>e())});e.setHotspotsVisibility(!1),e.queueRender(),await i,this._presentedScene=e,this.overlay=e.element.shadowRoot.querySelector("div.default"),!0===t&&(this.xrLight=new cU(this.threeRenderer),this.xrLight.addEventListener("estimationstart",()=>{if(!this.isPresenting||null==this.xrLight)return;let e=this.presentedScene;e.add(this.xrLight),e.environment=this.xrLight.environment}));let n=await this.resolveARSession();n.addEventListener("end",()=>{this.postSessionCleanup()},{once:!0});let r=e.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");r.classList.add("enabled"),r.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=r;let a=await n.requestReferenceSpace("viewer");this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=e.yaw,this.goalYaw=e.yaw,this.goalScale=1,e.setBackground(null),this.oldShadowIntensity=e.shadowIntensity,e.setShadowIntensity(.01),this.oldTarget.copy(e.getTarget()),e.element.addEventListener("load",this.onUpdateScene);let s=20*Math.PI/180,o=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(s),z:-Math.cos(s)});n.requestHitTestSource({space:a,offsetRay:o}).then(e=>{this.initialHitSource=e}),this.currentSession=n,this.placementBox=new cO(e,this.placeOnWall?"back":"bottom"),this.placementComplete=!1,this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:dp.SESSION_STARTED})}async stopPresenting(){if(!this.isPresenting)return;let e=new Promise(e=>{this.resolveCleanup=e});try{await this.currentSession.end(),await e}catch(e){console.warn("Error while trying to end WebXR AR session"),console.warn(e),this.postSessionCleanup()}}get isPresenting(){return null!=this.presentedScene}get target(){return this.oldTarget}updateTarget(){let e=this.presentedScene;if(null!=e){let t=e.getTarget();this.oldTarget.copy(t),this.placeOnWall?t.z=e.boundingBox.min.z:t.y=e.boundingBox.min.y,e.setTarget(t.x,t.y,t.z)}}postSessionCleanup(){let e=this.currentSession;null!=e&&(e.removeEventListener("selectstart",this.onSelectStart),e.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);let t=this.presentedScene;if(this._presentedScene=null,null!=t){let{element:e}=t;null!=this.xrLight&&(t.remove(this.xrLight),this.xrLight.dispose(),this.xrLight=null),t.position.set(0,0,0),t.scale.set(1,1,1),t.setShadowOffset(0);let i=this.turntableRotation;null!=i&&(t.yaw=i);let n=this.oldShadowIntensity;null!=n&&t.setShadowIntensity(n),t.setEnvironmentAndSkybox(e[lb],e[lT]);let r=this.oldTarget;t.setTarget(r.x,r.y,r.z),t.xrCamera=null,t.element.removeEventListener("load",this.onUpdateScene),t.orientHotspots(0),e.requestUpdate("cameraTarget"),e.requestUpdate("maxCameraOrbit"),e[p2](e.getBoundingClientRect()),requestAnimationFrame(()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:dd.NONE}}))})}this.renderer.height=0;let i=this.exitWebXRButtonContainer;null!=i&&(i.classList.remove("enabled"),i.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);let n=this.transientHitTestSource;null!=n&&(n.cancel(),this.transientHitTestSource=null);let r=this.initialHitSource;null!=r&&(r.cancel(),this.initialHitSource=null),null!=this.placementBox&&(this.placementBox.dispose(),this.placementBox=null),this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,this.overlay=null,null!=this.resolveCleanup&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:dp.NOT_PRESENTING})}updateView(e){let t=this.presentedScene,i=this.threeRenderer.xr;i.updateCamera(d_),t.xrCamera=i.getCamera();let{elements:n}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(n[1],n[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){let t=e.recommendedViewportScale;e.requestViewportScale(Math.max(t,.25))}let r=i.getBaseLayer();if(null!=r){let t=r instanceof XRWebGLLayer?r.getViewport(e):i.getBinding().getViewSubImage(r,e).viewport;this.threeRenderer.setViewport(t.x,t.y,t.width,t.height)}}placeInitially(){let e=this.presentedScene,{position:t,element:i}=e,n=e.getCamera(),{width:r,height:a}=this.overlay.getBoundingClientRect();e.setSize(r,a),n.projectionMatrixInverse.copy(n.projectionMatrix).invert();let{theta:s,radius:o}=i.getCameraOrbit(),l=n.getWorldDirection(dm);e.yaw=Math.atan2(-l.x,-l.z)-s,this.goalYaw=e.yaw,t.copy(n.position).add(l.multiplyScalar(o)),this.updateTarget();let h=e.getTarget();t.add(h).sub(this.oldTarget),this.goalPosition.copy(t),e.setHotspotsVisibility(!0);let{session:c}=this.frame;c.addEventListener("selectstart",this.onSelectStart),c.addEventListener("selectend",this.onSelectEnd),c.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then(e=>{this.transientHitTestSource=e})}getTouchLocation(){let{axes:e}=this.inputSource.gamepad,t=this.placementBox.getExpandedHit(this.presentedScene,e[0],e[1]);return null!=t&&(dm.copy(t).sub(this.presentedScene.getCamera().position),dm.length()>10)?null:t}getHitPoint(e){let t=this.threeRenderer.xr.getReferenceSpace(),i=e.getPose(t);if(null==i)return null;let n=df.fromArray(i.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(n.elements[4],n.elements[6])),n.elements[5]>.75!==this.placeOnWall?dv.setFromMatrixPosition(n):null}moveToFloor(e){let t=this.initialHitSource;if(null==t)return;let i=e.getHitTestResults(t);if(0==i.length)return;let n=i[0],r=this.getHitPoint(n);null!=r&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(r):this.goalPosition.y=r.y),t.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:dp.OBJECT_PLACED}))}fingerPolar(e){let t=e[0].inputSource.gamepad.axes,i=e[1].inputSource.gamepad.axes,n=i[0]-t[0],r=i[1]-t[1],a=Math.atan2(r,n),s=this.lastAngle-a;return s>Math.PI?s-=2*Math.PI:s<-Math.PI&&(s+=2*Math.PI),this.lastAngle=a,{separation:Math.sqrt(n*n+r*r),deltaYaw:s}}processInput(e){let t=this.transientHitTestSource;if(null==t||!this.isTranslating&&!this.isTwoFingering&&!this.isRotating)return;let i=e.getHitTestResultsForTransientInput(t),n=this.presentedScene,r=n.scale.x;if(this.isTwoFingering){if(i.length<2)this.isTwoFingering=!1;else{let{separation:e,deltaYaw:t}=this.fingerPolar(i);if(!1===this.placeOnWall&&(this.goalYaw+=t),n.canScale){let t=e/this.firstRatio;this.goalScale=t<1.3&&t>.7692307692307692?1:t}}return}if(2===i.length){this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!0;let{separation:e}=this.fingerPolar(i);this.firstRatio=e/r;return}if(this.isRotating){let e=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=e-this.lastAngle,this.lastAngle=e}else this.isTranslating&&i.forEach(e=>{if(e.inputSource!==this.inputSource)return;let t=null;if(e.results.length>0&&(t=this.getHitPoint(e.results[0])),null==t&&(t=this.getTouchLocation()),null!=t){if(this.goalPosition.sub(this.lastDragPosition),!1===this.placeOnWall){let e=t.y-this.lastDragPosition.y;if(e<0){this.placementBox.offsetHeight=e/r,this.presentedScene.setShadowOffset(e);let i=dm.copy(n.getCamera().position),a=-e/(i.y-t.y);i.multiplyScalar(a),t.multiplyScalar(1-a).add(i)}}this.goalPosition.add(t),this.lastDragPosition.copy(t)}})}moveScene(e){let t=this.presentedScene,{position:i,yaw:n}=t,r=t.boundingSphere.radius,a=this.goalPosition,s=t.scale.x,o=this.placementBox,l=dd.NONE;if(!a.equals(i)||this.goalScale!==s){l=dd.USER_INTERACTION;let{x:n,y:h,z:c}=i;n=this.xDamper.update(n,a.x,e,r),h=this.yDamper.update(h,a.y,e,r),c=this.zDamper.update(c,a.z,e,r),i.set(n,h,c);let u=this.scaleDamper.update(s,this.goalScale,e,1);if(t.scale.set(u,u,u),!this.isTranslating){let e=a.y-h;this.placementComplete&&!1===this.placeOnWall?(o.offsetHeight=e/u,t.setShadowOffset(e)):0===e&&(this.placementComplete=!0,o.show=!1,t.setShadowIntensity(.8))}}o.updateOpacity(e),t.updateTarget(e),t.yaw=this.yawDamper.update(n,this.goalYaw,e,Math.PI),t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:l}}))}onWebXRFrame(e,t){this.frame=t,++this.frames;let i=this.threeRenderer.xr.getReferenceSpace(),n=t.getViewerPose(i);null==n&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:dg.NOT_TRACKING}));let r=this.presentedScene;if(null==n||null==r||!r.element.loaded)return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:dg.TRACKING}));let a=!0;for(let i of n.views){if(this.updateView(i),a){this.moveToFloor(t),this.processInput(t);let i=e-this.lastTick;this.moveScene(i),this.renderer.preRender(r,e,i),this.lastTick=e,r.renderShadow(this.threeRenderer)}this.threeRenderer.render(r,r.getCamera()),a=!1}}constructor(e){super(),this.renderer=e,this.currentSession=null,this.placeOnWall=!1,this.placementBox=null,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.initialHitSource=null,this.transientHitTestSource=null,this.inputSource=null,this._presentedScene=null,this.resolveCleanup=null,this.exitWebXRButtonContainer=null,this.overlay=null,this.xrLight=null,this.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new eZ,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.lastDragPosition=new eZ,this.firstRatio=0,this.lastAngle=0,this.goalPosition=new eZ,this.goalYaw=0,this.goalScale=1,this.xDamper=new cP,this.yDamper=new cP,this.zDamper=new cP,this.yawDamper=new cP,this.scaleDamper=new cP,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.dispose(),this.placementBox=new cO(this.presentedScene,this.placeOnWall?"back":"bottom"))},this.onSelectStart=e=>{let t=this.transientHitTestSource;if(null==t)return;let i=this.frame.getHitTestResultsForTransientInput(t),n=this.presentedScene,r=this.placementBox;if(1===i.length){this.inputSource=e.inputSource;let{axes:t}=this.inputSource.gamepad,i=r.getHit(this.presentedScene,t[0],t[1]);r.show=!0,null!=i?(this.isTranslating=!0,this.lastDragPosition.copy(i)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*t[0])}else if(2===i.length){r.show=!0,this.isTwoFingering=!0;let{separation:e}=this.fingerPolar(i);this.firstRatio=e/n.scale.x}},this.onSelectEnd=()=>{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.inputSource=null,this.goalPosition.y+=this.placementBox.offsetHeight*this.presentedScene.scale.x,this.placementBox.show=!1},this.threeRenderer=e.threeRenderer,this.threeRenderer.xr.enabled=!0}}let dE=Symbol("prepared"),dx=Symbol("prepare"),dS=Symbol("preparedGLTF"),dC=Symbol("clone");class dI{static prepare(e){if(null==e.scene)throw Error("Model does not have a scene");if(e[dE])return e;let t=this[dx](e);return t[dE]=!0,t}static[dx](e){let{scene:t}=e,i=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:i})}get parser(){return this[dS].parser}get animations(){return this[dS].animations}get scene(){return this[dS].scene}get scenes(){return this[dS].scenes}get cameras(){return this[dS].cameras}get asset(){return this[dS].asset}get userData(){return this[dS].userData}clone(){return new this.constructor(this[dC]())}dispose(){this.scenes.forEach(e=>{e.traverse(e=>{e.material&&((Array.isArray(e.material)?e.material:[e.material]).forEach(e=>{for(let t in e){let i=e[t];if(i instanceof eW){let e=i.source.data;null!=e.close&&e.close(),i.dispose()}}e.dispose()}),e.geometry.dispose())})})}[dC](){let e=this[dS],t=function(e){let t=new Map,i=new Map,n=e.clone();return function e(t,i,n){n(t,i);for(let r=0;r{dw(e,t,(e,t)=>{void 0!==t.userData.variantMaterials&&(e.userData.variantMaterials=new Map(t.userData.variantMaterials)),void 0!==t.userData.variantData&&(e.userData.variantData=t.userData.variantData),void 0!==t.userData.originalMaterial&&(e.userData.originalMaterial=t.userData.originalMaterial)})},dw=(e,t,i)=>{i(e,t);for(let n=0;n{let s=t.threeObjectMap.get(e);if(null!=s){for(let e in s)if(null!=e&&"primitives"!==e){let t=s[e],o=n[e][t],l=r.get(i)||{};l[e]=t,r.set(i,l);let h=a.get(o)||new Set;h.add(i),a.set(o,h)}}});return new dP(e,n,r,a)}static[dL](e,t,i){let n=(e,t)=>{if(i(e,t),e.isObject3D){if(e.material)if(Array.isArray(e.material))for(let n=0;n{if(e.renderOrder=1e3,e.frustumCulled=!1,e.name||(e.name=e.uuid),e.material){let{geometry:i}=e;e.castShadow=!0,e.isSkinnedMesh&&(i.boundingSphere=n,i.boundingBox=null);let r=e.material;if(!0===r.isMeshBasicMaterial&&(r.toneMapped=!1),r.shadowSide=0,r.aoMap){let{gltf:e,threeObjectMap:n}=t[dN],a=n.get(r);if(null!=e.materials&&null!=a&&null!=a.materials){let t=e.materials[a.materials];t.occlusionTexture&&0===t.occlusionTexture.texCoord&&null!=i.attributes.uv&&i.setAttribute("uv2",i.attributes.uv)}}}}),t}get correlatedSceneGraph(){return this[dS][dN]}[dC](){let e=super[dC](),t=new Map;return e.scene.traverse(e=>{if(e.material){let i=e.material;if(null!=i){if(t.has(i.uuid)){e.material=t.get(i.uuid);return}e.material=i.clone(),t.set(i.uuid,e.material)}}void 0!==e.target&&e.add(e.target)}),e[dN]=dP.from(e,this.correlatedSceneGraph),e}}let dQ=(e,t,i)=>{let n;switch(e){case 1009:n=new Uint8ClampedArray(t*i*4);break;case 1016:n=new Uint16Array(t*i*4);break;case 1014:n=new Uint32Array(t*i*4);break;case 1010:n=new Int8Array(t*i*4);break;case 1011:n=new Int16Array(t*i*4);break;case 1013:n=new Int32Array(t*i*4);break;case 1015:n=new Float32Array(t*i*4);break;default:throw Error("Unsupported data type")}return n};class dO{static instantiateRenderer(){let e=new ad;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw Error("Can't read pixels in this browser");let e=dQ(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){let t=new ab(this.toArray(),this.width,this.height,1023,this._type,(null==e?void 0:e.mapping)||300,(null==e?void 0:e.wrapS)||1001,(null==e?void 0:e.wrapT)||1001,(null==e?void 0:e.magFilter)||1006,(null==e?void 0:e.minFilter)||1006,(null==e?void 0:e.anisotropy)||1,ec);return t.generateMipmaps=(null==e?void 0:e.generateMipmaps)!==void 0&&(null==e?void 0:e.generateMipmaps),t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof iV&&Object.values(this.material.uniforms).forEach(e=>{e.value instanceof eW&&e.value.dispose()}),Object.values(this.material).forEach(e=>{e instanceof eW&&e.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}constructor(e){var t,i,n,r,a,s,o,l,h,c,u,d,A,g,m,f;this._rendererIsDisposable=!1,this._supportsReadPixels=!0,this.render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)},this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;let v={format:1023,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:(null==(t=e.renderTargetOptions)?void 0:t.anisotropy)!==void 0?null==(i=e.renderTargetOptions)?void 0:i.anisotropy:1,generateMipmaps:(null==(n=e.renderTargetOptions)?void 0:n.generateMipmaps)!==void 0&&(null==(r=e.renderTargetOptions)?void 0:r.generateMipmaps),magFilter:(null==(a=e.renderTargetOptions)?void 0:a.magFilter)!==void 0?null==(s=e.renderTargetOptions)?void 0:s.magFilter:1006,minFilter:(null==(o=e.renderTargetOptions)?void 0:o.minFilter)!==void 0?null==(l=e.renderTargetOptions)?void 0:l.minFilter:1006,samples:(null==(h=e.renderTargetOptions)?void 0:h.samples)!==void 0?null==(c=e.renderTargetOptions)?void 0:c.samples:void 0,wrapS:(null==(u=e.renderTargetOptions)?void 0:u.wrapS)!==void 0?null==(d=e.renderTargetOptions)?void 0:d.wrapS:1001,wrapT:(null==(A=e.renderTargetOptions)?void 0:A.wrapT)!==void 0?null==(g=e.renderTargetOptions)?void 0:g.wrapT:1001};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=dO.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new aA,this._camera=new nu,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!((e,t,i,n)=>{if(void 0!==p)return p;let r=new ej(1,1,n);t.setRenderTarget(r);let a=new iF(new i9,new it({color:0xffffff}));t.render(a,i),t.setRenderTarget(null);let s=dQ(e,r.width,r.height);return t.readRenderTargetPixels(r,0,0,r.width,r.height,s),r.dispose(),a.geometry.dispose(),a.material.dispose(),p=0!==s[0]})(this._type,this._renderer,this._camera,v)){let e;1016===this._type&&(e=this._renderer.extensions.has("EXT_color_buffer_float")?1015:void 0),void 0!==e?(console.warn("This browser does not support reading pixels from ".concat(this._type," RenderTargets, switching to ").concat(1015)),this._type=e):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new iF(new i9,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new ej(this.width,this.height,v),this._renderTarget.texture.mapping=(null==(m=e.renderTargetOptions)?void 0:m.mapping)!==void 0?null==(f=e.renderTargetOptions)?void 0:f.mapping:300}}class dk extends iV{get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){let e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){let t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){let e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}constructor({gamma:e,offsetHdr:t,offsetSdr:i,gainMapMin:n,gainMapMax:r,maxDisplayBoost:a,hdrCapacityMin:s,hdrCapacityMax:o,sdr:l,gainMap:h}){super({name:"GainMapDecoderMaterial",vertexShader:"\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\n// min half float value\n#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )\n// max half float value\n#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )\n\nuniform sampler2D sdr;\nuniform sampler2D gainMap;\nuniform vec3 gamma;\nuniform vec3 offsetHdr;\nuniform vec3 offsetSdr;\nuniform vec3 gainMapMin;\nuniform vec3 gainMapMax;\nuniform float weightFactor;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec3 rgb = texture2D( sdr, vUv ).rgb;\n vec3 recovery = texture2D( gainMap, vUv ).rgb;\n vec3 logRecovery = pow( recovery, gamma );\n vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;\n vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;\n vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));\n gl_FragColor = vec4( clampedHdrColor , 1.0 );\n}\n",uniforms:{sdr:{value:l},gainMap:{value:h},gamma:{value:new eZ(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:new eZ().fromArray(t)},offsetSdr:{value:new eZ().fromArray(i)},gainMapMin:{value:new eZ().fromArray(n)},gainMapMax:{value:new eZ().fromArray(r)},weightFactor:{value:(Math.log2(a)-s)/(o-s)}},blending:0,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=a,this._hdrCapacityMin=s,this._hdrCapacityMax=o,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}}class dG extends Error{}class dH extends Error{}let dz=(e,t,i)=>{let n=RegExp("".concat(t,'="([^"]*)"'),"i").exec(e);if(n)return n[1];let r=RegExp("<".concat(t,"[^>]*>([\\s\\S]*?)"),"i").exec(e);if(r){let e=r[1].match(/([^<]*)<\/rdf:li>/g);return e&&3===e.length?e.map(e=>e.replace(/<\/?rdf:li>/g,"")):r[1].trim()}if(void 0!==i)return i;throw Error("Can't find ".concat(t," in gainmap metadata"))};class dV{extract(e){return new Promise((t,i)=>{let n,r=this.options.debug,a=new DataView(e.buffer);if(65496!==a.getUint16(0))return void i(Error("Not a valid jpeg"));let s=a.byteLength,o=2,l=0;for(;o250)return void i(Error("Found no marker after ".concat(l," loops 😵")));if(255!==a.getUint8(o))return void i(Error("Not a valid marker at offset 0x".concat(o.toString(16),", found: 0x").concat(a.getUint8(o).toString(16))));if(n=a.getUint8(o+1),r&&console.log("Marker: ".concat(n.toString(16))),226===n){r&&console.log("Found APP2 marker (0xffe2)");let e=o+4;if(0x4d504600===a.getUint32(e)){let n,r=e+4;if(18761===a.getUint16(r))n=!1;else{if(19789!==a.getUint16(r))return void i(Error("No valid endianness marker found in TIFF header"));n=!0}if(42!==a.getUint16(r+2,!n))return void i(Error("Not valid TIFF data! (no 0x002A marker)"));let s=a.getUint32(r+4,!n);if(s<8)return void i(Error("Not valid TIFF data! (First offset less than 8)"));let o=r+s,l=a.getUint16(o,!n),h=o+2,c=0;for(let e=h;e{let t=(e=>{let t,i=(t="undefined"!=typeof TextDecoder?new TextDecoder().decode(e):e.toString()).indexOf("",i),n=t.slice(i,e+10);try{let e=dz(n,"hdrgm:GainMapMin","0"),t=dz(n,"hdrgm:GainMapMax"),i=dz(n,"hdrgm:Gamma","1"),r=dz(n,"hdrgm:OffsetSDR","0.015625"),a=dz(n,"hdrgm:OffsetHDR","0.015625"),s=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(n),o=s?s[1]:"0",l=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(n);if(!l)throw Error("Incomplete gainmap metadata");let h=l[1];return{gainMapMin:Array.isArray(e)?e.map(e=>parseFloat(e)):[parseFloat(e),parseFloat(e),parseFloat(e)],gainMapMax:Array.isArray(t)?t.map(e=>parseFloat(e)):[parseFloat(t),parseFloat(t),parseFloat(t)],gamma:Array.isArray(i)?i.map(e=>parseFloat(e)):[parseFloat(i),parseFloat(i),parseFloat(i)],offsetSdr:Array.isArray(r)?r.map(e=>parseFloat(e)):[parseFloat(r),parseFloat(r),parseFloat(r)],offsetHdr:Array.isArray(a)?a.map(e=>parseFloat(e)):[parseFloat(a),parseFloat(a),parseFloat(a)],hdrCapacityMin:parseFloat(o),hdrCapacityMax:parseFloat(h)}}catch(e){}i=t.indexOf("new Promise((t,i)=>{let n=document.createElement("img");n.onload=()=>{t(n)},n.onerror=e=>{i(e)},n.src=URL.createObjectURL(e)});class dX extends sF{setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){return this._renderer||console.warn("WARNING: An existing WebGL Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer."),new dO({width:16,height:16,type:1016,colorSpace:ec,material:new dk({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new eW,sdr:new eW}),renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async render(e,t,i,n){let r,a,s=n?new Blob([n],{type:"image/jpeg"}):void 0,o=new Blob([i],{type:"image/jpeg"}),l=!1;if("undefined"==typeof createImageBitmap){let e=await Promise.all([s?dq(s):Promise.resolve(void 0),dq(o)]);a=e[0],r=e[1],l=!0}else{let e=await Promise.all([s?createImageBitmap(s,{imageOrientation:"flipY"}):Promise.resolve(void 0),createImageBitmap(o,{imageOrientation:"flipY"})]);a=e[0],r=e[1]}let h=new eW(a||new ImageData(2,2),300,1001,1001,1006,1008,1023,1009,1,ec);h.flipY=l,h.needsUpdate=!0;let c=new eW(r,300,1001,1001,1006,1008,1023,1009,1,eh);c.flipY=l,c.needsUpdate=!0,e.width=r.width,e.height=r.height,e.material.gainMap=h,e.material.sdr=c,e.material.gainMapMin=t.gainMapMin,e.material.gainMapMax=t.gainMapMax,e.material.offsetHdr=t.offsetHdr,e.material.offsetSdr=t.offsetSdr,e.material.gamma=t.gamma,e.material.hdrCapacityMin=t.hdrCapacityMin,e.material.hdrCapacityMax=t.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,t.hdrCapacityMax),e.material.needsUpdate=!0,e.render()}constructor(e,t){super(t),e&&(this._renderer=e),this._internalLoadingManager=new sP}}class dj extends dX{load(e,t,i,n){let r=this.prepareQuadRenderer(),a=new sk(this._internalLoadingManager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(this.withCredentials),this.manager.itemStart(e),a.load(e,async i=>{let a,s,o;if("string"==typeof i)throw Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");let l=new Uint8Array(i);try{let e=await dW(l);a=e.sdr,s=e.gainMap,o=e.metadata}catch(t){if(t instanceof dH||t instanceof dG)console.warn("Failure to reconstruct an HDR image from ".concat(e,": Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg")),o={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},a=l;else throw t}try{await this.render(r,o,a,s)}catch(t){this.manager.itemError(e),"function"==typeof n&&n(t),r.disposeOnDemandRenderer();return}"function"==typeof t&&t(r),this.manager.itemEnd(e),r.disposeOnDemandRenderer()},i,t=>{this.manager.itemError(e),"function"==typeof n&&n(t)}),r}}class dY extends sH{parse(e){let t,i,n,r=function(e,t){switch(e){case 1:throw Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw Error("THREE.RGBELoader: Memory Error: "+(t||""))}},a=function(e,t,i){t=t||1024;let n=e.pos,r=-1,a=0,s="",o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(n,n+128)));for(;0>(r=o.indexOf("\n"))&&a=e.byteLength)&&(t=a(e))||r(1,"no header found"),(i=t.match(/^#\?(\S+)/))||r(3,"bad initial token"),h.valid|=1,h.programtype=i[1],h.string+=t+"\n";!1!==(t=a(e));){if(h.string+=t+"\n","#"===t.charAt(0)){h.comments+=t+"\n";continue}if((i=t.match(n))&&(h.gamma=parseFloat(i[1])),(i=t.match(s))&&(h.exposure=parseFloat(i[1])),(i=t.match(o))&&(h.valid|=2,h.format=i[1]),(i=t.match(l))&&(h.valid|=4,h.height=parseInt(i[1],10),h.width=parseInt(i[2],10)),2&h.valid&&4&h.valid)break}return 2&h.valid||r(3,"missing format specifier"),4&h.valid||r(3,"missing image size specifier"),h}(s),l=o.width,h=o.height,c=function(e,t,i){if(t<8||t>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);t!==(e[2]<<8|e[3])&&r(3,"wrong scanline width");let n=new Uint8Array(4*t*i);n.length||r(4,"unable to allocate buffer space");let a=0,s=0,o=4*t,l=new Uint8Array(4),h=new Uint8Array(o),c=i;for(;c>0&&se.byteLength&&r(1),l[0]=e[s++],l[1]=e[s++],l[2]=e[s++],l[3]=e[s++],(2!=l[0]||2!=l[1]||(l[2]<<8|l[3])!=t)&&r(3,"bad rgbe scanline format");let i=0,u;for(;i128;if(t&&(u-=128),(0===u||i+u>o)&&r(3,"bad scanline data"),t){let t=e[s++];for(let e=0;ethis.ldrLoader.load(e,t,()=>{},i));return t.name=e,t.flipY=!1,t}async loadLottie(e,t){let i=await this.getLottieLoader();i.setQuality(t);let n=await new Promise((t,n)=>i.load(e,t,()=>{},n));return n.name=e,n}async loadEquirect(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};try{let i=d$.test(e),n=i?this.hdrLoader:this.imageLoader,r=await new Promise((i,r)=>n.load(e,e=>{let{renderTarget:t}=e;if(null!=t){let{texture:n}=t;e.dispose(!1),i(n)}else i(e)},e=>{t(e.loaded/e.total*.9)},r));return t(1),r.name=e,r.mapping=303,i||(r.colorSpace=eh),r}finally{t&&t(1)}}async generateEnvironmentMapAndSkybox(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>{},r="legacy"!==i;("legacy"===i||"neutral"===i)&&(i=null),i=lv(i);let a=Promise.resolve(null);t&&(a=this.loadEquirectFromUrl(t,n)),e=i?this.loadEquirectFromUrl(i,n):t?this.loadEquirectFromUrl(t,n):r?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();let[s,o]=await Promise.all([e,a]);if(null==s)throw Error("Failed to load environment map.");return{environmentMap:s,skybox:o}}async loadEquirectFromUrl(e,t){if(!this.skyboxCache.has(e)){let i=this.loadEquirect(e,t);this.skyboxCache.set(e,i)}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,t){await lI();let i=this.threeRenderer,n=new iZ(256,{generateMipmaps:!1,type:1016,format:1023,colorSpace:ec,depthBuffer:!0}),r=new iK(.1,100,n),a=r.renderTarget.texture;a.name=t;let s=i.outputColorSpace,o=i.toneMapping;return i.toneMapping=0,i.outputColorSpace=ec,r.update(i,e),this.blurCubemap(n,.04),i.toneMapping=o,i.outputColorSpace=s,a}async loadGeneratedEnvironmentMap(){return null==this.generatedEnvironmentMap&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new dZ("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return null==this.generatedEnvironmentMapAlt&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new dZ("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(e,t){if(null==this.blurMaterial){this.blurMaterial=this.getBlurShader(20);let e=new iF(new iO,this.blurMaterial);this.blurScene=new aA,this.blurScene.add(e)}let i=e.clone();this.halfblur(e,i,t,"latitudinal"),this.halfblur(i,e,t,"longitudinal")}halfblur(e,t,i,n){let r=e.width,a=isFinite(i)?Math.PI/(2*r):2*Math.PI/39,s=i/a,o=isFinite(i)?1+Math.floor(3*s):20;o>20&&console.warn("sigmaRadians, ".concat(i,", is too large and will clip, as it requested ").concat(o," samples when the maximum is set to ").concat(20));let l=[],h=0;for(let e=0;e<20;++e){let t=e/s,i=Math.exp(-t*t/2);l.push(i),0==e?h+=i:e= samples ) {\n \n break;\n \n }\n \n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n \n }\n }\n ",blending:0,depthTest:!1,depthWrite:!1,side:1})}async dispose(){for(let[,e]of this.skyboxCache)(await e).dispose();null!=this.generatedEnvironmentMap&&((await this.generatedEnvironmentMap).dispose(),this.generatedEnvironmentMap=null),null!=this.generatedEnvironmentMapAlt&&((await this.generatedEnvironmentMapAlt).dispose(),this.generatedEnvironmentMapAlt=null),null!=this.blurMaterial&&this.blurMaterial.dispose()}constructor(e){this.threeRenderer=e,this.lottieLoaderUrl="",this.withCredentials=!1,this._ldrLoader=null,this._imageLoader=null,this._hdrLoader=null,this._lottieLoader=null,this.generatedEnvironmentMap=null,this.generatedEnvironmentMapAlt=null,this.skyboxCache=new Map,this.blurMaterial=null,this.blurScene=null}}let d1=[1,.79,.62,.5,.4,.31,.25],d2="high-performance";class d3 extends ef{static get singleton(){return this._singleton||(this._singleton=new d3({powerPreference:(self.ModelViewerElement||{}).powerPreference||d2,debug:lC()})),this._singleton}static resetSingleton(){let e=this._singleton.dispose();for(let t of e)t.disconnectedCallback();for(let t of(this._singleton=new d3({powerPreference:(self.ModelViewerElement||{}).powerPreference||d2,debug:lC()}),e))t.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return d1[this.scaleStep]}set minScale(e){let t=1;for(;t0&&this.threeRenderer.setAnimationLoop((e,t)=>this.render(e,t))}unregisterScene(e){this.scenes.delete(e),this.canvas3D.parentElement===e.canvas.parentElement&&e.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null)}displayCanvas(e){return e.element.modelIsVisible&&!this.multipleScenesVisible?this.canvas3D:e.element[pJ]}countVisibleScenes(){let{canvas3D:e}=this,t=0,i=null;for(let n of this.scenes){let{element:r}=n;r.modelIsVisible&&null==n.externalRenderer&&++t,e.parentElement===n.canvas.parentElement&&(i=n)}let n=t>1;if(null!=i){let t=n&&!this.multipleScenesVisible,r=!i.element.modelIsVisible;if(t||r){let{width:t,height:n}=this.sceneSize(i);this.copyPixels(i,t,n),e.parentElement.removeChild(e)}}this.multipleScenesVisible=n}updateRendererSize(){var e;let t=lS();if(t!==this.dpr)for(let e of this.scenes){let{element:t}=e;t[pQ](t.getBoundingClientRect())}let i=0,n=0;for(let e of this.scenes)i=Math.max(i,e.width),n=Math.max(n,e.height);if(i!==this.width||n!==this.height||t!==this.dpr)for(let r of(this.width=i,this.height=n,this.dpr=t,i=Math.ceil(i*t),n=Math.ceil(n*t),this.canRender&&this.threeRenderer.setSize(i,n,!1),this.scenes)){let{canvas:t}=r;t.width=i,t.height=n,r.forceRescale(),null==(e=r.effectRenderer)||e.setSize(i,n)}}updateRendererScale(e){let t=this.scaleStep;this.avgFrameDuration+=lx(.2*(e-this.avgFrameDuration),-5,5),this.avgFrameDuration>60?++this.scaleStep:this.avgFrameDuration<40&&this.scaleStep>0&&--this.scaleStep,this.scaleStep=Math.min(this.scaleStep,this.lastStep),t!==this.scaleStep&&(this.avgFrameDuration=50)}shouldRender(e){if(e.shouldRender())e.scaleStep!=this.scaleStep&&(e.scaleStep=this.scaleStep,this.rescaleCanvas(e));else{if(0==e.scaleStep)return!1;e.scaleStep=0,this.rescaleCanvas(e)}return!0}rescaleCanvas(e){let t=d1[e.scaleStep],i=Math.ceil(this.width/t),n=Math.ceil(this.height/t),{style:r}=e.canvas;r.width="".concat(i,"px"),r.height="".concat(n,"px"),this.canvas3D.style.width="".concat(i,"px"),this.canvas3D.style.height="".concat(n,"px");let a=this.dpr*t,s=t<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";e.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:a,minimumDpr:this.dpr*d1[this.lastStep],pixelWidth:Math.ceil(e.width*a),pixelHeight:Math.ceil(e.height*a),reason:s}}))}sceneSize(e){let{dpr:t}=this,i=d1[e.scaleStep];return{width:Math.min(Math.ceil(e.width*i*t),this.canvas3D.width),height:Math.min(Math.ceil(e.height*i*t),this.canvas3D.height)}}copyPixels(e,t,i){let n=e.context;if(null==n)return void console.log("could not acquire 2d context");n.clearRect(0,0,t,i),n.drawImage(this.canvas3D,0,0,t,i,0,0,t,i),e.canvas.classList.add("show")}orderedScenes(){let e=[];for(let t of[!1,!0])for(let i of this.scenes)i.element.modelIsVisible===t&&e.push(i);return e}get isPresenting(){return this.arRenderer.isPresenting}preRender(e,t,i){let{element:n,exposure:r,toneMapping:a}=e;n[p0](t,i);let s="number"==typeof r&&!Number.isNaN(r),o=n.environmentImage,l=n.skyboxImage;this.threeRenderer.toneMappingExposure=(s?r:1)*(7!==a||"neutral"!==o&&"legacy"!==o&&(o||l)?1:1.3)}render(e,t){if(null!=t)return void this.arRenderer.onWebXRFrame(e,t);let i=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(i),this.renderedLastFrame=!1);let{canvas3D:n}=this;for(let t of this.orderedScenes()){let{element:r}=t;if(!r.loaded||!r.modelIsVisible&&t.renderCount>0||(this.preRender(t,e,i),!this.shouldRender(t)))continue;if(null!=t.externalRenderer){let e=t.getCamera();e.updateMatrix();let{matrix:i,projectionMatrix:n}=e,r=i.elements.slice(),a=t.getTarget();r[12]+=a.x,r[13]+=a.y,r[14]+=a.z,t.externalRenderer.render({viewMatrix:r,projectionMatrix:n.elements});continue}if(!r.modelIsVisible&&!this.multipleScenesVisible)for(let e of this.scenes)e.element.modelIsVisible&&e.queueRender();let{width:a,height:s}=this.sceneSize(t);t.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-s,a,s),null!=t.effectRenderer?t.effectRenderer.render(i):(this.threeRenderer.autoClear=!0,this.threeRenderer.toneMapping=t.toneMapping,this.threeRenderer.render(t,t.camera)),this.multipleScenesVisible||!t.element.modelIsVisible&&0===t.renderCount?this.copyPixels(t,a,s):n.parentElement!==t.canvas.parentElement&&(t.canvas.parentElement.appendChild(n),t.canvas.classList.remove("show")),t.hasRendered(),++t.renderCount,this.renderedLastFrame=!0}}dispose(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.threeRenderer&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null;let e=[];for(let t of this.scenes)e.push(t.element);return this.canvas3D.removeEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.removeEventListener("webglcontextrestored",this.onWebGLContextRestored),e}constructor(e){super(),this.loader=new h4(dF),this.width=0,this.height=0,this.dpr=1,this.scenes=new Set,this.multipleScenesVisible=!1,this.lastTick=performance.now(),this.renderedLastFrame=!1,this.scaleStep=0,this.lastStep=3,this.avgFrameDuration=50,this.onWebGLContextLost=e=>{this.dispatchEvent({type:"contextlost",sourceEvent:e})},this.onWebGLContextRestored=()=>{var e;for(let t of(null==(e=this.textureUtils)||e.dispose(),this.textureUtils=new d0(this.threeRenderer),this.scenes))t.element[lB]()},this.dpr=lS(),this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show");try{this.threeRenderer=new ad({canvas:this.canvas3D,alpha:!0,antialias:!0,powerPreference:e.powerPreference,preserveDrawingBuffer:!0}),this.threeRenderer.autoClear=!0,this.threeRenderer.setPixelRatio(1),this.threeRenderer.debug={checkShaderErrors:!!e.debug,onShaderError:null},this.threeRenderer.toneMapping=4}catch(e){console.warn(e)}this.arRenderer=new dy(this),this.textureUtils=this.canRender?new d0(this.threeRenderer):null,h4.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}}let d4=Symbol("correlatedObjects"),d5=Symbol("onUpdate");class d8{constructor(e,t=null){this[d5]=e,this[d4]=t}}let d6=new it,d9=new i9(2,2),d7=0,Ae=Symbol("threeTexture"),At=Symbol("threeTextures");Symbol("applyTexture");class Ai extends d8{get[Ae](){var e;return null==(e=this[d4])?void 0:e.values().next().value}get[At](){return this[d4]}get name(){return this[Ae].image.name||""}get uri(){return this[Ae].image.src}get bufferView(){return this[Ae].image.bufferView}get element(){let e=this[Ae];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){let e=this[Ae];if(e&&e.isCanvasTexture&&e.animation)return e.animation}get type(){return null!=this.uri?"external":"embedded"}set name(e){for(let t of this[At])t.image.name=e}update(){let e=this[Ae];e&&e.isCanvasTexture&&!e.animation&&(this[Ae].needsUpdate=!0,this[d5]())}async createThumbnail(e,t){let i=new aA;d6.map=this[Ae];let n=new iF(d9,d6);i.add(n);let r=new nu(-1,1,1,-1,0,1),{threeRenderer:a}=d3.singleton,s=new ej(e,t);a.setRenderTarget(s),a.render(i,r),a.setRenderTarget(null);let o=new Uint8Array(e*t*4);a.readRenderTargetPixels(s,0,0,e,t,o),pb.width=e,pb.height=t;let l=pb.getContext("2d"),h=l.createImageData(e,t);return h.data.set(o),l.putImageData(h,0,0),new Promise(async(e,t)=>{pb.toBlob(i=>{if(!i)return t("Failed to capture thumbnail.");e(URL.createObjectURL(i))},"image/png")})}constructor(e,t){super(e,new Set(t?[t]:[])),this[Ae].image.src||(this[Ae].image.src=t.name?t.name:"adhoc_image"+d7++),this[Ae].image.name||(this[Ae].image.name=t&&t.image&&t.image.src?t.image.src.split("/").pop():"adhoc_image")}}!function(e){e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.NearestMipmapNearest=9984]="NearestMipmapNearest",e[e.LinearMipmapNearest=9985]="LinearMipmapNearest",e[e.NearestMipmapLinear=9986]="NearestMipmapLinear",e[e.LinearMipmapLinear=9987]="LinearMipmapLinear"}(L||(L={})),function(e){e[e.ClampToEdge=33071]="ClampToEdge",e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.Repeat=10497]="Repeat"}(D||(D={}));let An=new Map([[D.Repeat,1e3],[D.ClampToEdge,1001],[D.MirroredRepeat,1002]]),Ar=new Map([[1e3,D.Repeat],[1001,D.ClampToEdge],[1002,D.MirroredRepeat]]),Aa=new Map([[L.Nearest,1003],[L.Linear,1006],[L.NearestMipmapNearest,1004],[L.LinearMipmapNearest,1007],[L.NearestMipmapLinear,1005],[L.LinearMipmapLinear,1008]]),As=new Map([[1003,L.Nearest],[1006,L.Linear],[1004,L.NearestMipmapNearest],[1007,L.LinearMipmapNearest],[1005,L.NearestMipmapLinear],[1008,L.LinearMipmapLinear]]),Ao=new Map([[L.Nearest,1003],[L.Linear,1006]]),Al=new Map([[1003,L.Nearest],[1006,L.Linear]]),Ah=Symbol("threeTexture"),Ac=Symbol("threeTextures"),Au=Symbol("setProperty");class Ad extends d8{get[Ah](){var e;return null==(e=this[d4])?void 0:e.values().next().value}get[Ac](){return this[d4]}get name(){return this[Ah].name||""}get minFilter(){return As.get(this[Ah].minFilter)}get magFilter(){return Al.get(this[Ah].magFilter)}get wrapS(){return Ar.get(this[Ah].wrapS)}get wrapT(){return Ar.get(this[Ah].wrapT)}get rotation(){return this[Ah].rotation}get scale(){return p7(this[Ah].repeat)}get offset(){return p7(this[Ah].offset)}setMinFilter(e){this[Au]("minFilter",Aa.get(e))}setMagFilter(e){this[Au]("magFilter",Ao.get(e))}setWrapS(e){this[Au]("wrapS",An.get(e))}setWrapT(e){this[Au]("wrapT",An.get(e))}setRotation(e){null==e&&(e=0),this[Au]("rotation",e)}setScale(e){null==e&&(e={u:1,v:1}),this[Au]("repeat",new eM(e.u,e.v))}setOffset(e){null==e&&(e={u:0,v:0}),this[Au]("offset",new eM(e.u,e.v))}[Au](e,t){if(((e,t)=>{switch(e){case"minFilter":let i;return i=t,As.has(i);case"magFilter":let n;return n=t,Al.has(n);case"wrapS":case"wrapT":let r;return r=t,Ar.has(r);case"rotation":case"repeat":case"offset":return!0;default:throw Error('Cannot configure property "'.concat(e,'" on Sampler'))}})(e,t))for(let i of this[Ac])i[e]=t,i.needsUpdate=!0;this[d5]()}constructor(e,t){super(e,new Set(t?[t]:[]))}}let AA=Symbol("image"),Ap=Symbol("sampler"),Ag=Symbol("threeTexture");class Am extends d8{get[Ag](){var e;return null==(e=this[d4])?void 0:e.values().next().value}get name(){return this[Ag].name||""}set name(e){for(let t of this[d4])t.name=e}get sampler(){return this[Ap]}get source(){return this[AA]}constructor(e,t){super(e,new Set(t?[t]:[])),this[Ap]=new Ad(e,t),this[AA]=new Ai(e,t)}}let Af=Symbol("texture"),Av=Symbol("transform"),A_=Symbol("materials"),Ay=Symbol("usage"),AE=Symbol("onUpdate"),Ax=Symbol("activeVideo");!function(e){e[e.Base=0]="Base",e[e.MetallicRoughness=1]="MetallicRoughness",e[e.Normal=2]="Normal",e[e.Occlusion=3]="Occlusion",e[e.Emissive=4]="Emissive",e[e.Clearcoat=5]="Clearcoat",e[e.ClearcoatRoughness=6]="ClearcoatRoughness",e[e.ClearcoatNormal=7]="ClearcoatNormal",e[e.SheenColor=8]="SheenColor",e[e.SheenRoughness=9]="SheenRoughness",e[e.Transmission=10]="Transmission",e[e.Thickness=11]="Thickness",e[e.Specular=12]="Specular",e[e.SpecularColor=13]="SpecularColor",e[e.Iridescence=14]="Iridescence",e[e.IridescenceThickness=15]="IridescenceThickness",e[e.Anisotropy=16]="Anisotropy"}(F||(F={}));class AS{get texture(){return this[Af]}setTexture(e){var t,i;let n=null!=e?e.source[Ae]:null,r=null==(t=this[Af])?void 0:t.source[Ae];if(null!=r&&r.isVideoTexture?this[Ax]=!1:(null==(i=this[Af])?void 0:i.source.animation)&&this[Af].source.animation.removeEventListener("enterFrame",this[AE]),this[Af]=e,null!=n&&n.isVideoTexture){let e=n.image;if(this[Ax]=!0,null!=e.requestVideoFrameCallback){let t=()=>{this[Ax]&&(this[AE](),e.requestVideoFrameCallback(t))};e.requestVideoFrameCallback(t)}else{let e=()=>{this[Ax]&&(this[AE](),requestAnimationFrame(e))};requestAnimationFrame(e)}}else(null==e?void 0:e.source.animation)!=null&&e.source.animation.addEventListener("enterFrame",this[AE]);let a=eh;if(this[A_])for(let e of this[A_]){switch(this[Ay]){case F.Base:e.map=n;break;case F.MetallicRoughness:a=ec,e.metalnessMap=n,e.roughnessMap=n;break;case F.Normal:a=ec,e.normalMap=n;break;case F.Occlusion:a=ec,e.aoMap=n;break;case F.Emissive:e.emissiveMap=n;break;case F.Clearcoat:e.clearcoatMap=n;break;case F.ClearcoatRoughness:e.clearcoatRoughnessMap=n;break;case F.ClearcoatNormal:e.clearcoatNormalMap=n;break;case F.SheenColor:e.sheenColorMap=n;break;case F.SheenRoughness:e.sheenRoughnessMap=n;break;case F.Transmission:e.transmissionMap=n;break;case F.Thickness:e.thicknessMap=n;break;case F.Specular:e.specularIntensityMap=n;break;case F.SpecularColor:e.specularColorMap=n;break;case F.Iridescence:e.iridescenceMap=n;break;case F.IridescenceThickness:e.iridescenceThicknessMap=n;break;case F.Anisotropy:e.anisotropyMap=n}e.needsUpdate=!0}n&&(n.colorSpace=a,n.rotation=this[Av].rotation,n.repeat=this[Av].scale,n.offset=this[Av].offset),this[AE]()}constructor(e,t,i,n){this[U]=null,this[P]={rotation:0,scale:new eM(1,1),offset:new eM(0,0)},this[N]=!1,i&&(this[Av].rotation=i.rotation,this[Av].scale.copy(i.repeat),this[Av].offset.copy(i.offset),this[Af]=new Am(e,i)),this[AE]=e,this[A_]=n,this[Ay]=t}}U=Af,P=Av,N=Ax;let AC=Symbol("threeMaterial"),AI=Symbol("threeMaterials"),AM=Symbol("baseColorTexture"),Aw=Symbol("metallicRoughnessTexture");class Ab extends d8{get[AI](){return this[d4]}get[AC](){var e;return null==(e=this[d4])?void 0:e.values().next().value}get baseColorFactor(){let e=[0,0,0,this[AC].opacity];return this[AC].color.toArray(e),e}get metallicFactor(){return this[AC].metalness}get roughnessFactor(){return this[AC].roughness}get baseColorTexture(){return this[AM]}get metallicRoughnessTexture(){return this[Aw]}setBaseColorFactor(e){let t=new t6;for(let i of(e instanceof Array?t.fromArray(e):t.set(e),this[AI]))i.color.set(t),e instanceof Array&&e.length>3?i.opacity=e[3]:(e=[0,0,0,i.opacity],t.toArray(e));this[d5]()}setMetallicFactor(e){for(let t of this[AI])t.metalness=e;this[d5]()}setRoughnessFactor(e){for(let t of this[AI])t.roughness=e;this[d5]()}constructor(e,t){super(e,t);let{map:i,metalnessMap:n}=t.values().next().value;this[AM]=new AS(e,F.Base,i,t),this[Aw]=new AS(e,F.MetallicRoughness,n,t)}}let AT=Symbol("pbrMetallicRoughness"),AB=Symbol("normalTexture"),AR=Symbol("occlusionTexture"),AL=Symbol("emissiveTexture"),AD=Symbol("backingThreeMaterial"),AU=Symbol("applyAlphaCutoff"),AP=Symbol("getAlphaMode"),AN=Symbol("lazyLoadGLTFInfo"),AF=Symbol("initialize"),AQ=Symbol("getLoadedMaterial"),AO=Symbol("ensureMaterialIsLoaded"),Ak=Symbol("gltfIndex"),AG=Symbol("setActive"),AH=Symbol("variantIndices"),Az=Symbol("isActive"),AV=Symbol("variantSet"),AW=Symbol("modelVariants"),Aq=Symbol("name"),AX=Symbol("pbrTextures");class Aj extends d8{get[(Q=AV,O=AX,AD)](){return this[d4].values().next().value}[AF](){let e=this[d5],t=this[d4];this[AT]=new Ab(e,t);let{normalMap:i,aoMap:n,emissiveMap:r}=t.values().next().value;this[AB]=new AS(e,F.Normal,i,t),this[AR]=new AS(e,F.Occlusion,n,t),this[AL]=new AS(e,F.Emissive,r,t);let a=i=>{this[AX].set(i,new AS(e,i,null,t))};a(F.Clearcoat),a(F.ClearcoatRoughness),a(F.ClearcoatNormal),a(F.SheenColor),a(F.SheenRoughness),a(F.Transmission),a(F.Thickness),a(F.Specular),a(F.SpecularColor),a(F.Iridescence),a(F.IridescenceThickness),a(F.Anisotropy)}async [AQ](){if(null!=this[AN]){let{set:e,material:t}=await this[AN].doLazyLoad();return this[d4]=e,this[AF](),this[AN]=void 0,this.ensureLoaded=async()=>{},t}return this[d4].values().next().value}colorFromRgb(e){let t=new t6;return e instanceof Array?t.fromArray(e):t.set(e),t}[AO](){if(null!=this[AN])throw Error('Material "'.concat(this.name,"\" has not been loaded, call 'await\n myMaterial.ensureLoaded()' before using an unloaded material."))}async ensureLoaded(){await this[AQ]()}get isLoaded(){return null==this[AN]}get isActive(){return this[Az]}[AG](e){this[Az]=e}get name(){return this[Aq]||""}set name(e){if(this[Aq]=e,null!=this[d4])for(let t of this[d4])t.name=e}get pbrMetallicRoughness(){return this[AO](),this[AT]}get normalTexture(){return this[AO](),this[AB]}get occlusionTexture(){return this[AO](),this[AR]}get emissiveTexture(){return this[AO](),this[AL]}get emissiveFactor(){return this[AO](),this[AD].emissive.toArray()}get index(){return this[Ak]}[AH](){return this[AV]}hasVariant(e){let t=this[AW].get(e);return null!=t&&this[AV].has(t.index)}setEmissiveFactor(e){this[AO]();let t=this.colorFromRgb(e);for(let e of this[d4])e.emissive.set(t);this[d5]()}[AP](){return this[AD].transparent?"BLEND":this[AD].alphaTest>0?"MASK":"OPAQUE"}[AU](){for(let e of(this[AO](),this[d4]))"MASK"===this[AP]()?void 0==e.alphaTest&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){for(let t of(this[AO](),this[d4]))t.alphaTest=e,t.needsUpdate=!0;this[AU](),this[d5]()}getAlphaCutoff(){return this[AO](),this[AD].alphaTest}setDoubleSided(e){for(let t of(this[AO](),this[d4]))t.side=2*!!e,t.needsUpdate=!0;this[d5]()}getDoubleSided(){return this[AO](),2==this[AD].side}setAlphaMode(e){this[AO]();let t=(e,t)=>{e.transparent=t,e.depthWrite=!t};for(let i of this[d4])t(i,"BLEND"===e),"MASK"===e?i.alphaTest=.5:i.alphaTest=void 0,i.needsUpdate=!0;this[d5]()}getAlphaMode(){return this[AO](),this[AP]()}get emissiveStrength(){return this[AO](),this[AD].emissiveIntensity}setEmissiveStrength(e){for(let t of(this[AO](),this[d4]))t.emissiveIntensity=e;this[d5]()}get clearcoatFactor(){return this[AO](),this[AD].clearcoat}get clearcoatRoughnessFactor(){return this[AO](),this[AD].clearcoatRoughness}get clearcoatTexture(){return this[AO](),this[AX].get(F.Clearcoat)}get clearcoatRoughnessTexture(){return this[AO](),this[AX].get(F.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[AO](),this[AX].get(F.ClearcoatNormal)}get clearcoatNormalScale(){return this[AO](),this[AD].clearcoatNormalScale.x}setClearcoatFactor(e){for(let t of(this[AO](),this[d4]))t.clearcoat=e;this[d5]()}setClearcoatRoughnessFactor(e){for(let t of(this[AO](),this[d4]))t.clearcoatRoughness=e;this[d5]()}setClearcoatNormalScale(e){for(let t of(this[AO](),this[d4]))t.clearcoatNormalScale=new eM(e,e);this[d5]()}get ior(){return this[AO](),this[AD].ior}setIor(e){for(let t of(this[AO](),this[d4]))t.ior=e;this[d5]()}get sheenColorFactor(){return this[AO](),this[AD].sheenColor.toArray()}get sheenColorTexture(){return this[AO](),this[AX].get(F.SheenColor)}get sheenRoughnessFactor(){return this[AO](),this[AD].sheenRoughness}get sheenRoughnessTexture(){return this[AO](),this[AX].get(F.SheenRoughness)}setSheenColorFactor(e){this[AO]();let t=this.colorFromRgb(e);for(let e of this[d4])e.sheenColor.set(t),e.sheen=1;this[d5]()}setSheenRoughnessFactor(e){for(let t of(this[AO](),this[d4]))t.sheenRoughness=e,t.sheen=1;this[d5]()}get transmissionFactor(){return this[AO](),this[AD].transmission}get transmissionTexture(){return this[AO](),this[AX].get(F.Transmission)}setTransmissionFactor(e){for(let t of(this[AO](),this[d4]))t.transmission=e;this[d5]()}get thicknessFactor(){return this[AO](),this[AD].thickness}get thicknessTexture(){return this[AO](),this[AX].get(F.Thickness)}get attenuationDistance(){return this[AO](),this[AD].attenuationDistance}get attenuationColor(){return this[AO](),this[AD].attenuationColor.toArray()}setThicknessFactor(e){for(let t of(this[AO](),this[d4]))t.thickness=e;this[d5]()}setAttenuationDistance(e){for(let t of(this[AO](),this[d4]))t.attenuationDistance=e;this[d5]()}setAttenuationColor(e){this[AO]();let t=this.colorFromRgb(e);for(let e of this[d4])e.attenuationColor.set(t);this[d5]()}get specularFactor(){return this[AO](),this[AD].specularIntensity}get specularTexture(){return this[AO](),this[AX].get(F.Specular)}get specularColorFactor(){return this[AO](),this[AD].specularColor.toArray()}get specularColorTexture(){return this[AO](),this[AX].get(F.SheenColor)}setSpecularFactor(e){for(let t of(this[AO](),this[d4]))t.specularIntensity=e;this[d5]()}setSpecularColorFactor(e){this[AO]();let t=this.colorFromRgb(e);for(let e of this[d4])e.specularColor.set(t);this[d5]()}get iridescenceFactor(){return this[AO](),this[AD].iridescence}get iridescenceTexture(){return this[AO](),this[AX].get(F.Iridescence)}get iridescenceIor(){return this[AO](),this[AD].iridescenceIOR}get iridescenceThicknessMinimum(){return this[AO](),this[AD].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[AO](),this[AD].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[AO](),this[AX].get(F.IridescenceThickness)}setIridescenceFactor(e){for(let t of(this[AO](),this[d4]))t.iridescence=e;this[d5]()}setIridescenceIor(e){for(let t of(this[AO](),this[d4]))t.iridescenceIOR=e;this[d5]()}setIridescenceThicknessMinimum(e){for(let t of(this[AO](),this[d4]))t.iridescenceThicknessRange[0]=e;this[d5]()}setIridescenceThicknessMaximum(e){for(let t of(this[AO](),this[d4]))t.iridescenceThicknessRange[1]=e;this[d5]()}get anisotropyStrength(){return this[AO](),this[AD].anisotropy}get anisotropyRotation(){return this[AO](),this[AD].anisotropyRotation}get anisotropyTexture(){return this[AO](),this[AX].get(F.Anisotropy)}setAnisotropyStrength(e){for(let t of(this[AO](),this[d4]))t.anisotropy=e;this[d5]()}setAnisotropyRotation(e){for(let t of(this[AO](),this[d4]))t.anisotropyRotation=e;this[d5]()}constructor(e,t,i,n,r,a,s){super(e,r),this[Q]=new Set,this[O]=new Map,this[Ak]=t,this[Az]=i,this[AW]=n,this[Aq]=a,null==s?this[AF]():this[AN]=s}}class AY{constructor(e){this.name="",this.children=[],this.name=e}}class AK extends AY{async setActiveMaterial(e){let t=this.materials.get(e);if(null!=t&&e!==this.activeMaterialIdx){this.mesh.material=await t[AQ]();let{normalScale:i}=this.mesh.material;null!=i&&i.y*i.x<0!=(null==this.mesh.geometry.attributes.tangent)&&this.parser.assignFinalMaterial(this.mesh),this.activeMaterialIdx=e}return this.mesh.material}getActiveMaterial(){return this.materials.get(this.activeMaterialIdx)}getMaterial(e){return this.materials.get(e)}async enableVariant(e){if(null==e)return this.setActiveMaterial(this.initialMaterialIdx);if(null!=this.variantToMaterialMap&&this.modelVariants.has(e)){let t=this.modelVariants.get(e);return this.enableVariantHelper(t.index)}return null}async enableVariantHelper(e){if(null!=this.variantToMaterialMap&&null!=e){let t=this.variantToMaterialMap.get(e);if(null!=t)return this.setActiveMaterial(t.index)}return null}async instantiateVariants(){if(null!=this.variantToMaterialMap)for(let e of this.variantToMaterialMap.keys()){let t=this.mesh.userData.variantMaterials.get(e);if(null!=t.material)continue;let i=await this.enableVariantHelper(e);null!=i&&(t.material=i)}}get variantInfo(){return this.variantToMaterialMap}addVariant(e,t){if(!this.ensureVariantIsUnused(t))return!1;this.modelVariants.has(t)||this.modelVariants.set(t,{name:t,index:this.modelVariants.size});let i=this.modelVariants.get(t).index;return e[AH]().add(i),this.variantToMaterialMap.set(i,e),this.materials.set(e.index,e),this.updateVariantUserData(i,e),!0}deleteVariant(e){if(this.variantInfo.has(e)){this.variantInfo.delete(e);let t=this.mesh.userData.variantMaterials;null!=t&&t.delete(e)}}updateVariantUserData(e,t){t[AH]().add(e),this.mesh.userData.variantData=this.modelVariants,this.mesh.userData.variantMaterials=this.mesh.userData.variantMaterials||new Map,this.mesh.userData.variantMaterials.set(e,{material:t[d4].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){let t=this.modelVariants.get(e);return!(null!=t&&this.variantInfo.has(t.index))||(console.warn("Primitive cannot add variant '".concat(e,"' for this material, it already exists.")),!1)}constructor(e,t,i,n){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;let{gltf:r,threeGLTF:a,threeObjectMap:s}=n;this.parser=a.parser,this.modelVariants=i,this.mesh.userData.variantData=i;let o=s.get(e.material);null!=o.materials?this.initialMaterialIdx=this.activeMaterialIdx=o.materials:console.error("Primitive (".concat(e.name,") missing initial material reference."));let l=e.userData.associations||{};if(null==l.meshes)return void console.error("Mesh is missing primitive index association");let h=((r.meshes||[])[l.meshes].primitives||[])[l.primitives];if(null==h)return void console.error("Mesh primitive definition is missing.");if(null!=h.material)this.materials.set(h.material,t[h.material]);else{let e=t.findIndex(e=>"Default"===e.name);e>=0?this.materials.set(e,t[e]):console.warn("gltfPrimitive has no material!")}if(h.extensions&&h.extensions.KHR_materials_variants){let e=h.extensions.KHR_materials_variants,n=a.parser.json.extensions.KHR_materials_variants.variants;for(let r of e.mappings){let e=t[r.material];for(let t of(this.materials.set(r.material,e),r.variants)){let{name:r}=n[t];this.variantToMaterialMap.set(t,e),e[AH]().add(t),i.has(r)||i.set(r,{name:r,index:t})}}}}}let AJ=Symbol("materials"),AZ=Symbol("hierarchy"),A$=Symbol("roots"),A0=Symbol("primitives");Symbol("loadVariant");let A1=Symbol("prepareVariantsForExport"),A2=Symbol("switchVariant"),A3=Symbol("materialFromPoint"),A4=Symbol("nodeFromPoint"),A5=Symbol("nodeFromIndex"),A8=Symbol("variantData"),A6=Symbol("availableVariants"),A9=Symbol("modelOnUpdate"),A7=Symbol("cloneMaterial");class pe{constructor(e,t,i,n){this.gltf=e,this.gltfElementMap=t,this.mapKey=i,this.doLazyLoad=n}}class pt{get materials(){return this[AJ]}[(k=AJ,G=AZ,H=A$,z=A0,V=A9,W=A8,A6)](){let e=Array.from(this[A8].values());return e.sort((e,t)=>e.index-t.index),e.map(e=>e.name)}getMaterialByName(e){let t=this[AJ].filter(t=>t.name===e);return t.length>0?t[0]:null}[A5](e,t){let i=this[AZ].find(i=>{if(i instanceof AK){let{meshes:n,primitives:r}=i.mesh.userData.associations;if(n==e&&r==t)return!0}return!1});return null==i?null:i}[A4](e){return this[AZ].find(t=>t instanceof AK&&t.mesh===e.object||!1)}[A3](e){return this[A4](e).getActiveMaterial()}async [A2](e){for(let t of this[A0])await t.enableVariant(e);for(let e of this.materials)e[AG](!1);for(let e of this[A0])this.materials[e.getActiveMaterial().index][AG](!0)}async [A1](){let e=[];for(let t of this[A0])e.push(t.instantiateVariants());await Promise.all(e)}[A7](e,t){let i=this.materials[e];i.isLoaded||console.error("Cloning an unloaded material,\n call 'material.ensureLoaded() before cloning the material.");let n=i[d4],r=new Set;for(let[e,i]of n.entries()){let a=i.clone();a.name=t+(n.size>1?"_inst"+e:""),r.add(a)}let a=new Aj(this[A9],this[AJ].length,!1,this[A8],r,t);return this[AJ].push(a),a}createMaterialInstanceForVariant(e,t,i){let n=!(arguments.length>3)||void 0===arguments[3]||arguments[3],r=null;for(let n of this[A0]){let a=this[A8].get(i);null!=a&&n.variantInfo.has(a.index)||null!=n.getMaterial(e)&&(this.hasVariant(i)||this.createVariant(i),null==r&&(r=this[A7](e,t)),n.addVariant(r,i))}if(n&&null!=r)for(let t of(r[AG](!0),this.materials[e][AG](!1),this[A0]))t.enableVariant(i);return r}createVariant(e){this[A8].has(e)?console.warn("Variant '".concat(e,"'' already exists")):this[A8].set(e,{name:e,index:this[A8].size})}hasVariant(e){return this[A8].has(e)}setMaterialToVariant(e,t){if(null==this[A6]().find(e=>e===t))return void console.warn("Can't add material to '".concat(t,"', the variant does not exist.'"));if(e<0||e>=this.materials.length)return void console.error("setMaterialToVariant(): materialIndex is out of bounds.");for(let i of this[A0]){let n=i.getMaterial(e);null!=n&&i.addVariant(n,t)}}updateVariantName(e,t){let i=this[A8].get(e);null!=i&&(i.name=t,this[A8].set(t,i),this[A8].delete(e))}deleteVariant(e){let t=this[A8].get(e);if(null!=t){for(let i of this.materials)i.hasVariant(e)&&i[AV].delete(t.index);for(let e of this[A0])e.deleteVariant(t.index);this[A8].delete(e)}}constructor(e,t=()=>{}){this[k]=[],this[G]=[],this[H]=[],this[z]=[],this[V]=()=>{},this[W]=new Map,this[A9]=t;let{gltf:i,threeGLTF:n,gltfElementMap:r}=e;for(let[e,a]of i.materials.entries()){let s=r.get(a);if(null!=s)this[AJ].push(new Aj(t,e,!0,this[A8],s,a.name));else{let o=(i.materials||[])[e],l=e,h=async()=>{let e=await n.parser.getDependency("material",l),t=new Set;return r.set(o,t),t.add(e),{set:t,material:e}};this[AJ].push(new Aj(t,e,!1,this[A8],s,a.name,new pe(i,r,o,h)))}}let a=new Map,s=[];for(let e of n.scene.children)s.push(e);for(;s.length>0;){let t=s.pop(),i=null;t instanceof iF?(i=new AK(t,this.materials,this[A8],e),this[A0].push(i)):i=new AY(t.name);let n=a.get(t);for(let e of(null!=n?n.children.push(i):this[A$].push(i),this[AZ].push(i),t.children))s.push(e),a.set(t,i)}}}var pi=function(e,t,i,n){var r,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(a<3?r(s):a>3?r(t,i,s):r(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let pn=Symbol("currentGLTF"),pr=Symbol("originalGltfJson"),pa=Symbol("model"),ps=Symbol("getOnUpdateMethod"),po=Symbol("buildTexture");class pl extends iF{get map(){return this.material.map}set map(e){this.material.map=e}isUsable(){return this.height>0&&this.radius>0&&null!=this.geometry&&null!=this.map}updateGeometry(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.height,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.radius,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:128;(e!=this.height||t!=this.radius||i!=this.resolution)&&(this.height=e,this.radius=t,this.resolution=i,e>0&&t>0&&(this.geometry.dispose(),this.geometry=function(e,t,i){let n=new sg(t,2*i,i);n.scale(1,1,-1);let r=n.getAttribute("position"),a=new eZ;for(let t=0;t0&&--this.referenceCount,0===this.referenceCount}updatePosition(e){if(null==e)return;let t=cG(e)[0].terms;for(let e=0;e<3;++e)this.position.setComponent(e,cZ(t[e]).number);this.updateMatrixWorld()}updateNormal(e){if(null==e)return;let t=cG(e)[0].terms;for(let e=0;e<3;++e)this.normal.setComponent(e,t[e].number)}updateSurface(e){if(!e&&this.initialized)return;let{mesh:t,tri:i,bary:n}=this;if(null==t||null==i||null==n)return;t.getVertexPosition(i.x,ph),t.getVertexPosition(i.y,pc),t.getVertexPosition(i.z,pu),ph.toArray(pd.elements,0),pc.toArray(pd.elements,3),pu.toArray(pd.elements,6),this.position.copy(n).applyMatrix3(pd);let r=this.parent;r.worldToLocal(t.localToWorld(this.position)),pA.set(ph,pc,pu),pA.getNormal(this.normal).transformDirection(t.matrixWorld);let a=r.parent;pp.setFromAxisAngle(ph.set(0,1,0),-a.yaw),this.normal.applyQuaternion(pp)}orient(e){this.pivot.style.transform="rotate(".concat(e,"rad)")}updateVisibility(e){this.element.classList.toggle("hide",!e),this.slot.assignedNodes().forEach(t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;let i=t.dataset.visibilityAttribute;null!=i&&t.toggleAttribute("data-".concat(i),e),t.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))}),this.initialized=!0}constructor(e){super(document.createElement("div")),this.normal=new eZ(0,1,0),this.initialized=!1,this.referenceCount=1,this.pivot=document.createElement("div"),this.slot=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this.slot.name=e.name,this.element.appendChild(this.pivot),this.pivot.appendChild(this.slot),this.updatePosition(e.position),this.updateNormal(e.normal),this.surface=e.surface}}let pm={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:"\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",fragmentShader:"\n\n uniform sampler2D tDiffuse;\n uniform float h;\n\n varying vec2 vUv;\n\n void main() {\n\n vec4 sum = vec4( 0.0 );\n\n sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n gl_FragColor = sum;\n\n }"},pf={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:"\n\n varying vec2 vUv;\n\n void main() {\n\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n }",fragmentShader:"\n\n uniform sampler2D tDiffuse;\n uniform float v;\n\n varying vec2 vUv;\n\n void main() {\n\n vec4 sum = vec4( 0.0 );\n\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n gl_FragColor = sum;\n\n }"};class pv extends tW{setScene(e,t,i){let{boundingBox:n,size:r,rotation:a,position:s}=this;if(this.isAnimated=e.animationNames.length>0,this.boundingBox.copy(e.boundingBox),this.size.copy(e.size),this.maxDimension=Math.max(r.x,r.y,r.z)*(this.isAnimated?2:1),this.boundingBox.getCenter(s),"back"===i){let{min:e,max:t}=n;[e.y,e.z]=[e.z,e.y],[t.y,t.z]=[t.z,t.y],[r.y,r.z]=[r.z,r.y],a.x=Math.PI/2,a.y=Math.PI}else a.x=0,a.y=0;if(this.isAnimated){let e=n.min.y,t=n.max.y;r.y=this.maxDimension,n.expandByVector(r.subScalar(this.maxDimension).multiplyScalar(-.5)),n.min.y=e,n.max.y=t,r.set(this.maxDimension,t-e,this.maxDimension)}"bottom"===i?s.y=n.min.y:s.z=n.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;let{size:t,camera:i}=this,n=this.isAnimated?2:1,r=n*Math.pow(2,9-3*e);this.setMapSize(r);let a=t.y/2,s=t.y*n;i.near=0,i.far=(1-e)*s+e*a,this.depthMaterial.opacity=1/e,i.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){let{size:t}=this;this.isAnimated&&(e*=2);let i=Math.floor(t.x>t.z?e:e*t.x/t.z),n=Math.floor(t.x>t.z?e*t.z/t.x:e),r=10+i,a=10+n;if(null!=this.renderTarget&&(this.renderTarget.width!==r||this.renderTarget.height!==a)&&(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){let e={format:1023};this.renderTarget=new ej(r,a,e),this.renderTargetBlur=new ej(r,a,e),this.floor.material.map=this.renderTarget.texture}this.camera.scale.set(t.x*(1+10/i),t.z*(1+10/n),1),this.needsUpdate=!0}setIntensity(e){if(this.intensity=e,e>0){var t;this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*((1-(t=this.softness*this.softness))*.3+ +t)}else this.visible=!1,this.floor.visible=!1}getIntensity(){return this.intensity}setOffset(e){this.floor.position.z=-e+this.gap()}gap(){return .001*this.maxDimension}render(e,t){t.overrideMaterial=this.depthMaterial;let i=e.getClearAlpha();e.setClearAlpha(0),this.floor.visible=!1;let n=e.xr.enabled;e.xr.enabled=!1;let r=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.render(t,this.camera),t.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(e),e.xr.enabled=n,e.setRenderTarget(r),e.setClearAlpha(i)}blurShadow(e){let{camera:t,horizontalBlurMaterial:i,verticalBlurMaterial:n,renderTarget:r,renderTargetBlur:a,blurPlane:s}=this;s.visible=!0,s.material=i,i.uniforms.h.value=1/this.renderTarget.width,i.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(a),e.render(s,t),s.material=n,n.uniforms.v.value=1/this.renderTarget.height,n.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(r),e.render(s,t),s.visible=!1}dispose(){null!=this.renderTarget&&this.renderTarget.dispose(),null!=this.renderTargetBlur&&this.renderTargetBlur.dispose(),this.depthMaterial.dispose(),this.horizontalBlurMaterial.dispose(),this.verticalBlurMaterial.dispose(),this.floor.material.dispose(),this.floor.geometry.dispose(),this.blurPlane.geometry.dispose(),this.removeFromParent()}constructor(e,t,i){super(),this.camera=new nu,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new r8,this.horizontalBlurMaterial=new iV(pm),this.verticalBlurMaterial=new iV(pf),this.intensity=0,this.softness=1,this.boundingBox=new e1,this.size=new eZ,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;let{camera:n}=this;n.rotation.x=Math.PI/2,n.left=-.5,n.right=.5,n.bottom=-.5,n.top=.5,this.add(n);let r=new i9,a=new it({opacity:1,transparent:!0,side:1});this.floor=new iF(r,a),this.floor.userData.noHit=!0,n.add(this.floor),this.blurPlane=new iF(r),this.blurPlane.visible=!1,n.add(this.blurPlane),e.target.add(this),this.depthMaterial.onBeforeCompile=function(e){e.fragmentShader=e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );")},this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial.depthTest=!1,this.setScene(e,t,i)}}let p_=new eZ,py=new eZ,pE=new eZ,px=new class{set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return od.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(od),this}intersectObject(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return op(e,this,i,t),i.sort(oA),i}intersectObjects(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];for(let n=0,r=e.length;n1&&void 0!==arguments[1]?arguments[1]:()=>{};if(!e||e===this.url)return void i(1);if(this.reset(),this.url=e,null!=this.externalRenderer){let e=await this.externalRenderer.load(i);this.boundingSphere.radius=e.framedRadius,this.idealAspect=e.fieldOfViewAspect;return}null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);try{t=await new Promise(async(t,n)=>{this.cancelPendingSourceChange=()=>n();try{let n=await this.element[p3].loader.load(e,this.element,i);t(n)}catch(e){n(e)}})}catch(e){if(null==e)return;throw e}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this._currentGLTF=t,null!=t&&(this._model=t.scene,this.target.add(t.scene));let{animations:n}=t,r=new Map,a=[];for(let e of n)r.set(e.name,e),a.push(e.name);this.animations=n,this.animationsByName=r,this.animationNames=a,await this.setupScene()}async setupScene(){this.applyTransform(),this.updateBoundingBox(),await this.updateFraming(),this.updateShadow(),this.setShadowIntensity(this.shadowIntensity),this.setGroundedSkybox()}reset(){this.url=null,this.renderCount=0,this.queueRender(),null!=this.shadow&&this.shadow.setIntensity(0),this.bakedShadows.clear();let{_model:e}=this;null!=e&&(e.removeFromParent(),this._model=null);let t=this._currentGLTF;null!=t&&(t.dispose(),this._currentGLTF=null),null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}dispose(){this.reset(),null!=this.shadow&&(this.shadow.dispose(),this.shadow=null),this.element[pn]=null,this.element[pr]=null,this.element[pa]=null}get currentGLTF(){return this._currentGLTF}setSize(e,t){if(this.width!==e||this.height!==t){if(this.width=Math.max(e,1),this.height=Math.max(t,1),this.annotationRenderer.setSize(e,t),this.aspect=this.width/this.height,null!=this.externalRenderer){let i=lS();this.externalRenderer.resize(e*i,t*i)}this.queueRender()}}markBakedShadow(e){e.userData.noHit=!0,this.bakedShadows.add(e)}unmarkBakedShadow(e){e.userData.noHit=!1,e.visible=!0,this.bakedShadows.delete(e),this.boundingBox.expandByObject(e)}findBakedShadows(e){let t=new e1;e.traverse(e=>{if(!e.material||!e.material.transparent)return;t.setFromObject(e);let i=t.getSize(pS),n=Math.min(i.x,i.y,i.z);Math.max(i.x,i.y,i.z)<100*n||this.markBakedShadow(e)})}checkBakedShadows(){let{min:e,max:t}=this.boundingBox,i=new e1;for(let n of(this.boundingBox.getSize(this.size),this.bakedShadows))i.setFromObject(n),(!(i.min.y=t.x)||!(i.min.z<=e.z)||!(i.max.z>=t.z))&&(i.min.z=t.x&&i.min.y<=e.y&&i.max.y>=t.y||this.unmarkBakedShadow(n))}applyTransform(){let{model:e}=this;if(null==e)return;let t=cG(this.element.orientation)[0].terms,i=cZ(t[0]).number,n=cZ(t[1]).number,r=cZ(t[2]).number;e.quaternion.setFromEuler(new tb(n,r,i,"YXZ"));let a=cG(this.element.scale)[0].terms;e.scale.set(a[0].number,a[1].number,a[2].number)}updateBoundingBox(){let{model:e}=this;if(null==e)return;this.target.remove(e),this.findBakedShadows(e);let t=(e,t)=>e.expandByPoint(t);this.setBakedShadowVisibility(!1),this.boundingBox=ci(e,t,new e1),this.boundingBox.isEmpty()&&(this.setBakedShadowVisibility(!0),this.bakedShadows.forEach(e=>this.unmarkBakedShadow(e)),this.boundingBox=ci(e,t,new e1)),this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size),this.target.add(e)}async updateFraming(){let{model:e}=this;if(null==e)return;this.target.remove(e),this.setBakedShadowVisibility(!1);let{center:t}=this.boundingSphere;this.element.requestUpdate("cameraTarget"),await this.element.updateComplete,t.copy(this.getTarget()),this.boundingSphere.radius=Math.sqrt(ci(e,(e,i)=>Math.max(e,t.distanceToSquared(i)),0));let i=(e,i)=>(i.sub(t),Math.max(e,Math.sqrt(i.x*i.x+i.z*i.z)/(this.idealCameraDistance()-Math.abs(i.y))));this.idealAspect=ci(e,i,0)/Math.tan(this.framedFoVDeg/2*Math.PI/180),this.setBakedShadowVisibility(),this.target.add(e)}setBakedShadowVisibility(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.shadowIntensity<=0;for(let t of this.bakedShadows)t.visible=e}idealCameraDistance(){let e=this.framedFoVDeg/2*Math.PI/180;return this.boundingSphere.radius/Math.sin(e)}adjustedFoV(e){return 2*Math.atan(Math.tan(e/2*Math.PI/180)*Math.max(1,this.idealAspect/this.aspect))*180/Math.PI}getNDC(e,t){if(null!=this.xrCamera)pC.set(e/window.screen.width,t/window.screen.height);else{let i=this.element.getBoundingClientRect();pC.set((e-i.x)/this.width,(t-i.y)/this.height)}return pC.multiplyScalar(2).subScalar(1),pC.y*=-1,pC}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[p3].arRenderer.presentedScene!==this&&(this.environment=e,this.setBackground(t),this.queueRender())}setBackground(e){this.groundedSkybox.map=e,this.groundedSkybox.isUsable()?(this.target.add(this.groundedSkybox),this.background=null):(this.target.remove(this.groundedSkybox),this.background=e)}farRadius(){return this.boundingSphere.radius*(null!=this.groundedSkybox.parent?10:1)}setGroundedSkybox(){let e=cZ(cG(this.element.skyboxHeight)[0].terms[0]).number,t=10*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(e,t),this.groundedSkybox.position.y=e-(this.shadow?2*this.shadow.gap():0),this.setBackground(this.groundedSkybox.map)}setTarget(e,t,i){this.goalTarget.set(-e,-t,-i)}setTargetDamperDecayTime(e){this.targetDamperX.setDecayTime(e),this.targetDamperY.setDecayTime(e),this.targetDamperZ.setDecayTime(e)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(e){let t=this.goalTarget,i=this.target.position;if(t.equals(i))return!1;{let n=this.boundingSphere.radius/10,{x:r,y:a,z:s}=i;return r=this.targetDamperX.update(r,t.x,e,n),a=this.targetDamperY.update(a,t.y,e,n),s=this.targetDamperZ.update(s,t.z,e,n),this.groundedSkybox.position.x=-r,this.groundedSkybox.position.z=-s,this.target.position.set(r,a,s),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){let{x:i,z:n}=this.position;this.yaw=Math.atan2(e-i,t-n)}get model(){return this._model}set yaw(e){this.rotation.y=e,this.groundedSkybox.rotation.y=-e,this.queueRender()}get yaw(){return this.rotation.y}set animationTime(e){this.mixer.setTime(e),this.queueShadowRender()}get animationTime(){if(null!=this.currentAnimationAction){let e=Math.max(this.currentAnimationAction._loopCount,0);return 2202===this.currentAnimationAction.loop&&(1&e)==1?this.duration-this.currentAnimationAction.time:this.currentAnimationAction.time}return 0}set animationTimeScale(e){this.mixer.timeScale=e}get animationTimeScale(){return this.mixer.timeScale}get duration(){return null!=this.currentAnimationAction&&this.currentAnimationAction.getClip()?this.currentAnimationAction.getClip().duration:0}get hasActiveAnimation(){return null!=this.currentAnimationAction}playAnimation(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2201,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/0;if(null==this._currentGLTF)return;let{animations:r}=this;if(null==r||0===r.length)return;let a=null;if(null!=e&&null==(a=this.animationsByName.get(e))){let t=parseInt(e);!isNaN(t)&&t>=0&&t0&&this.animationTime==this.duration&&(this.animationTime=0)),r.setLoop(i,n),r.enabled=!0,r.clampWhenFinished=!0,r.play()}catch(e){console.error(e)}}stopAnimation(){this.currentAnimationAction=null,this.mixer.stopAllAction()}updateAnimation(e){this.mixer.update(e),this.queueShadowRender()}subscribeMixerEvent(e,t){this.mixer.addEventListener(e,t)}updateShadow(){let e=this.shadow;if(null!=e){let t="wall"===this.element.arPlacement?"back":"bottom";e.setScene(this,this.shadowSoftness,t),e.needsUpdate=!0}}renderShadow(e){let t=this.shadow;null!=t&&!0==t.needsUpdate&&(t.render(e,this),t.needsUpdate=!1)}queueShadowRender(){null!=this.shadow&&(this.shadow.needsUpdate=!0)}setShadowIntensity(e){if((this.shadowIntensity=e,null!=this._currentGLTF)&&(this.setBakedShadowVisibility(),!(e<=0)||null!=this.shadow)){if(null==this.shadow){let e="wall"===this.element.arPlacement?"back":"bottom";this.shadow=new pv(this,this.shadowSoftness,e)}this.shadow.setIntensity(e)}}setShadowSoftness(e){this.shadowSoftness=e;let t=this.shadow;null!=t&&t.setSoftness(e)}setShadowOffset(e){let t=this.shadow;null!=t&&t.setOffset(e)}hitFromPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this;return px.setFromCamera(e,this.getCamera()),px.intersectObject(t,!0).find(e=>e.object.visible&&!e.object.userData.noHit)}positionAndNormalFromPoint(e){var t;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,n=this.hitFromPoint(e,i);if(null==n)return null;let r=n.point;return{position:r,normal:null!=n.face?n.face.normal.clone().applyNormalMatrix(new ew().getNormalMatrix(n.object.matrixWorld)):px.ray.direction.clone().multiplyScalar(-1),uv:null!=(t=n.uv)?t:null}}surfaceFromPoint(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,i=this.element.model;if(null==i)return null;let n=this.hitFromPoint(e,t);if(null==n||null==n.face)return null;let{meshes:r,primitives:a}=i[A4](n).mesh.userData.associations,s=new eZ,o=new eZ,l=new eZ,{a:h,b:c,c:u}=n.face,d=n.object;d.getVertexPosition(h,s),d.getVertexPosition(c,o),d.getVertexPosition(u,l);let A=new t2(s,o,l),p=new eZ;return A.getBarycoord(d.worldToLocal(n.point),p),"".concat(r," ").concat(a," ").concat(h," ").concat(c," ").concat(u," ").concat(p.x.toFixed(3)," ").concat(p.y.toFixed(3)," ").concat(p.z.toFixed(3))}addHotspot(e){this.target.add(e),this.annotationRenderer.domElement.appendChild(e.element)}removeHotspot(e){this.target.remove(e)}forHotspots(e){let{children:t}=this.target;for(let i=0,n=t.length;i=r||n.y>=r||n.z>=r)return void console.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");let a=new eZ(t[5].number,t[6].number,t[7].number);e.mesh=i.mesh,e.tri=n,e.bary=a}}updateSurfaceHotspots(){let e=!this.element.paused;this.forHotspots(t=>{this.initializeSurface(t),t.updateSurface(e)})}updateHotspotsVisibility(e){this.forHotspots(t=>{p_.copy(e),py.setFromMatrixPosition(t.matrixWorld),p_.sub(py),pE.copy(t.normal).transformDirection(this.target.matrixWorld),0>p_.dot(pE)?t.hide():t.show()})}orientHotspots(e){this.forHotspots(t=>{t.orient(e)})}setHotspotsVisibility(e){this.forHotspots(t=>{t.visible=e})}updateSchema(e){var t;let{schemaElement:i,element:n}=this,{alt:r,poster:a,iosSrc:s}=n;if(null!=e){let n=[{"@type":"MediaObject",contentUrl:e,encodingFormat:(null==(t=e.split(".").pop())?void 0:t.toLowerCase())==="gltf"?"model/gltf+json":"model/gltf-binary"}];s&&n.push({"@type":"MediaObject",contentUrl:s,encodingFormat:"model/vnd.usdz+zip"}),i.textContent=JSON.stringify({"@context":"http://schema.org/","@type":"3DModel",image:null!=a?a:void 0,name:null!=r?r:void 0,encoding:n}),document.head.appendChild(i)}else null!=i.parentElement&&i.parentElement.removeChild(i)}constructor({canvas:e,element:t,width:i,height:n}){super(),this.annotationRenderer=new ct,this.effectRenderer=null,this.schemaElement=document.createElement("script"),this.width=1,this.height=1,this.aspect=1,this.scaleStep=0,this.renderCount=0,this.externalRenderer=null,this.camera=new iY(45,1,.1,100),this.xrCamera=null,this.url=null,this.target=new tW,this.animationNames=[],this.boundingBox=new e1,this.boundingSphere=new th,this.size=new eZ,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=4,this.canScale=!0,this.isDirty=!1,this.goalTarget=new eZ,this.targetDamperX=new cP,this.targetDamperY=new cP,this.targetDamperZ=new cP,this._currentGLTF=null,this._model=null,this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.groundedSkybox=new pl,this.name="ModelScene",this.element=t,this.canvas=e,this.camera=new iY(45,1,.1,100),this.camera.name="MainCamera",this.add(this.target),this.setSize(i,n),this.target.name="Target",this.mixer=new oc(this.target);let{domElement:r}=this.annotationRenderer,{style:a}=r;a.display="none",a.pointerEvents="none",a.position="absolute",a.top="0",this.element.shadowRoot.querySelector(".default").appendChild(r),this.schemaElement.setAttribute("type","application/ld+json")}}class pM extends EventTarget{get ongoingActivityCount(){return this.ongoingActivities.size}beginActivity(e){let t={progress:0,completed:!1};return this.ongoingActivities.add(t),1===this.ongoingActivityCount&&this.announceTotalProgress(t,0,e),i=>{let n;return(n=Math.max(lx(i,0,1),t.progress))!==t.progress&&this.announceTotalProgress(t,n,e),t.progress}}announceTotalProgress(e,t,i){let n=0,r=0;for(let i of(1==t&&(e.completed=!0),this.ongoingActivities)){let{progress:e}=i;n+=1-e,i.completed&&r++}let a=e.progress;e.progress=t,this.totalProgress+=(t-a)*(1-this.totalProgress)/n;let s=r===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:s,reason:i}})),r===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}constructor(){super(...arguments),this.ongoingActivities=new Set,this.totalProgress=0}}var pw=function(e,t,i,n){var r,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(a<3?r(s):a>3?r(t,i,s):r(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let pb=document.createElement("canvas"),pT=Symbol("fallbackResizeHandler"),pB=Symbol("defaultAriaLabel"),pR=Symbol("resizeObserver"),pL=Symbol("clearModelTimeout"),pD=Symbol("onContextLost"),pU=Symbol("loaded"),pP=Symbol("status"),pN=Symbol("onFocus"),pF=Symbol("onBlur"),pQ=Symbol("updateSize"),pO=Symbol("intersectionObserver"),pk=Symbol("isElementInViewport"),pG=Symbol("announceModelVisibility"),pH=Symbol("ariaLabel"),pz=Symbol("altDefaulted"),pV=Symbol("statusElement"),pW=Symbol("updateStatus"),pq=Symbol("loadedTime"),pX=Symbol("updateSource"),pj=Symbol("markLoaded"),pY=Symbol("container"),pK=Symbol("input"),pJ=Symbol("canvas"),pZ=Symbol("scene"),p$=Symbol("needsRender"),p0=Symbol("tick"),p1=Symbol("onModelLoad"),p2=Symbol("onResize"),p3=Symbol("renderer"),p4=Symbol("progressTracker"),p5=Symbol("getLoaded"),p8=Symbol("getModelIsVisible"),p6=Symbol("shouldAttemptPreload"),p9=e=>({x:e.x,y:e.y,z:e.z,toString(){return"".concat(this.x,"m ").concat(this.y,"m ").concat(this.z,"m")}}),p7=e=>({u:e.x,v:e.y,toString(){return"".concat(this.u," ").concat(this.v)}});class ge extends oB{static get is(){return"model-viewer"}static set modelCacheSize(e){h4[h2].evictionThreshold=e}static get modelCacheSize(){return h4[h2].evictionThreshold}static set minimumRenderScale(e){e>1&&console.warn(" minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&console.warn(" minimumRenderScale has been clamped to a minimum value of 0.25."),d3.singleton.minScale=e}static get minimumRenderScale(){return d3.singleton.minScale}get loaded(){return this[p5]()}get[(q=pk,X=pU,j=pq,Y=pP,K=pL,J=pT,Z=pG,$=pR,ee=pO,et=p4,p3)](){return d3.singleton}get modelIsVisible(){return this[p8]()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),lh?this[pR].observe(this):self.addEventListener("resize",this[pT]),lc&&this[pO].observe(this),this.addEventListener("focus",this[pN]),this.addEventListener("blur",this[pF]);let e=this[p3];e.addEventListener("contextlost",this[pD]),e.registerScene(this[pZ]),null!=this[pL]&&(self.clearTimeout(this[pL]),this[pL]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),lh?this[pR].unobserve(this):self.removeEventListener("resize",this[pT]),lc&&this[pO].unobserve(this),this.removeEventListener("focus",this[pN]),this.removeEventListener("blur",this[pF]);let e=this[p3];e.removeEventListener("contextlost",this[pD]),e.unregisterScene(this[pZ]),this[pL]=self.setTimeout(()=>{this[pZ].dispose(),this[pL]=null},10)}updated(e){super.updated(e),e.has("src")&&(null==this.src?(this[pU]=!1,this[pq]=0,this[pZ].reset()):this.src!==this[pZ].url&&(this[pU]=!1,this[pq]=0,this[pX]())),e.has("alt")&&this[pK].setAttribute("aria-label",this[pH]),e.has("withCredentials")&&(h4.withCredentials=this.withCredentials,this[p3].textureUtils.withCredentials=this.withCredentials),e.has("generateSchema")&&(this.generateSchema?this[pZ].updateSchema(this.src):this[pZ].updateSchema(null))}toDataURL(e,t){return this[p3].displayCanvas(this[pZ]).toDataURL(e,t)}async toBlob(e){let t=e?e.mimeType:void 0,i=e?e.qualityArgument:void 0,n=e?e.idealAspect:void 0,{width:r,height:a,idealAspect:s,aspect:o}=this[pZ],{dpr:l,scaleFactor:h}=this[p3],c=r*h*l,u=a*h*l,d=0,A=0;!0===n&&(s>o?A=(u-(u=Math.round(c/s)))/2:d=(c-(c=Math.round(u*s)))/2),pb.width=c,pb.height=u;try{return new Promise(async(e,n)=>{pb.getContext("2d").drawImage(this[p3].displayCanvas(this[pZ]),d,A,c,u,0,0,c,u),pb.toBlob(t=>{if(!t)return n(Error("Unable to retrieve canvas blob"));e(t)},t,i)})}finally{this[pQ]({width:r,height:a})}}registerEffectComposer(e){e.setRenderer(this[p3].threeRenderer),e.setMainCamera(this[pZ].getCamera()),e.setMainScene(this[pZ]),this[pZ].effectRenderer=e}unregisterEffectComposer(){this[pZ].effectRenderer=null}registerRenderer(e){this[pZ].externalRenderer=e}unregisterRenderer(){this[pZ].externalRenderer=null}get[pH](){return this[pz]}get[pz](){return null==this.alt||"null"===this.alt?this[pB]:this.alt}[p5](){return this[pU]}[p8](){return this.loaded&&this[pk]}[p6](){return!!this.src&&this[pk]}[pQ](e){let{width:t,height:i}=e;0!==t&&0!==i&&(this[pY].style.width="".concat(t,"px"),this[pY].style.height="".concat(i,"px"),this[p2]({width:t,height:i}))}[p0](e,t){var i;null==(i=this[pZ].effectRenderer)||i.beforeRender(e,t)}[pj](){this[pU]||(this[pU]=!0,this[pq]=performance.now())}[p$](){this[pZ].queueRender()}[p1](){}[pW](e){this[pP]=e;let t=this.getRootNode();null!=t&&t.activeElement===this&&this[pV].textContent!=e&&(this[pV].textContent=e)}[(ei=pN,en=pF,p2)](e){this[pZ].setSize(e.width,e.height)}async [(er=pD,pX)](){let e=this[pZ];if(this.loaded||!this[p6]()||this.src===e.url)return;this.generateSchema&&e.updateSchema(this.src),this[pW]("Loading"),e.stopAnimation();let t=this[p4].beginActivity("model-load"),i=this.src;try{let n=e.setSource(i,e=>t(.95*lx(e,0,1))),r=this[lB]();await Promise.all([n,r]),this[pj](),this[p1](),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("before-render"))}),await new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.dispatchEvent(new CustomEvent("load",{detail:{url:i}})),e()})})})}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:e}}))}finally{t(1)}}constructor(){let e,t;super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[q]=!1,this[X]=!1,this[j]=0,this[Y]="",this[K]=null,this[J]=lE(()=>{let e=this.getBoundingClientRect();this[pQ](e)},50),this[Z]=lE(e=>{let t=this.modelIsVisible;t!==e&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:t}}))},0),this[$]=null,this[ee]=null,this[et]=new pM,this[ei]=()=>{this[pV].textContent=this[pP]},this[en]=()=>{this[pV].textContent=""},this[er]=e=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))},this.attachShadow({mode:"open"});let i=this.shadowRoot;if(lr(lk,i),this[pY]=i.querySelector(".container"),this[pK]=i.querySelector(".userInput"),this[pJ]=i.querySelector("canvas"),this[pV]=i.querySelector("#status"),this[pB]=this[pK].getAttribute("aria-label"),this.isConnected){let i=this.getBoundingClientRect();e=i.width,t=i.height}else e=300,t=150;this[pZ]=new pI({canvas:this[pJ],element:this,width:e,height:t}),Promise.resolve().then(()=>{this[pQ](this.getBoundingClientRect())}),lh&&(this[pR]=new ResizeObserver(e=>{if(!this[p3].isPresenting)for(let t of e)t.target===this&&this[pQ](t.contentRect)})),lc?this[pO]=new IntersectionObserver(e=>{for(let t of e)if(t.target===this){let e=this.modelIsVisible;this[pk]=t.isIntersecting,this[pG](e),this[pk]&&!this.loaded&&this[pX]()}},{root:null,rootMargin:"0px",threshold:1e-5}):this[pk]=!0}}pw([eo({type:String})],ge.prototype,"alt",void 0),pw([eo({type:String})],ge.prototype,"src",void 0),pw([eo({type:Boolean,attribute:"with-credentials"})],ge.prototype,"withCredentials",void 0),pw([eo({type:Boolean,attribute:"generate-schema"})],ge.prototype,"generateSchema",void 0);var gt=function(e,t,i,n){var r,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(a<3?r(s):a>3?r(t,i,s):r(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let gi=Symbol("changeAnimation"),gn=Symbol("paused"),gr={repetitions:1/0,pingpong:!1},ga=Symbol("hotspotMap"),gs=Symbol("mutationCallback"),go=Symbol("observer"),gl=Symbol("addHotspot"),gh=Symbol("removeHotspot"),gc=new tv;var gu={},gd=function(e,t,i,n,r){var a=new Worker(gu[t]||(gu[t]=URL.createObjectURL(new Blob([e+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return a.onmessage=function(e){var t=e.data,i=t.$e$;if(i){var n=Error(i[0]);n.code=i[1],n.stack=i[2],r(n,null)}else r(null,t)},a.postMessage(i,n),a},gA=Uint8Array,gp=Uint16Array,gg=Int32Array,gm=new gA([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),gf=new gA([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),gv=new gA([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),g_=function(e,t){for(var i=new gp(31),n=0;n<31;++n)i[n]=t+=1<>1|(21845&gw)<<1;gb=(61680&(gb=(52428&gb)>>2|(13107&gb)<<2))>>4|(3855&gb)<<4,gM[gw]=((65280&gb)>>8|(255&gb)<<8)>>1}for(var gT=function(e,t,i){for(var n,r=e.length,a=0,s=new gp(t);a>l]=h}else for(a=0,n=new gp(r);a>15-e[a]);return n},gB=new gA(288),gw=0;gw<144;++gw)gB[gw]=8;for(var gw=144;gw<256;++gw)gB[gw]=9;for(var gw=256;gw<280;++gw)gB[gw]=7;for(var gw=280;gw<288;++gw)gB[gw]=8;for(var gR=new gA(32),gw=0;gw<32;++gw)gR[gw]=5;var gL=gT(gB,9,0),gD=gT(gB,9,1),gU=gT(gR,5,0),gP=gT(gR,5,1),gN=function(e){for(var t=e[0],i=1;it&&(t=e[i]);return t},gF=function(e,t,i){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(7&t)&i},gQ=function(e,t){var i=t/8|0;return(e[i]|e[i+1]<<8|e[i+2]<<16)>>(7&t)},gO=function(e){return(e+7)/8|0},gk=function(e,t,i){return(null==t||t<0)&&(t=0),(null==i||i>e.length)&&(i=e.length),new gA(e.subarray(t,i))},gG=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],gH=function(e,t,i){var n=Error(t||gG[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,gH),!i)throw n;return n},gz=function(e,t,i,n){var r=e.length,a=n?n.length:0;if(!r||t.f&&!t.l)return i||new gA(0);var s=!i,o=s||2!=t.i,l=t.i;s&&(i=new gA(3*r));var h=function(e){var t=i.length;if(e>t){var n=new gA(Math.max(2*t,e));n.set(i),i=n}},c=t.f||0,u=t.p||0,d=t.b||0,A=t.l,p=t.d,g=t.m,m=t.n,f=8*r;do{if(!A){c=gF(e,u,1);var v=gF(e,u+1,3);if(u+=3,v)if(1==v)A=gD,p=gP,g=9,m=5;else if(2==v){var _=gF(e,u,31)+257,y=gF(e,u+10,15)+4,E=_+gF(e,u+5,31)+1;u+=14;for(var x=new gA(E),S=new gA(19),C=0;C>4;if(T<16)x[C++]=T;else{var B=0,R=0;for(16==T?(R=3+gF(e,u,3),u+=2,B=x[C-1]):17==T?(R=3+gF(e,u,7),u+=3):18==T&&(R=11+gF(e,u,127),u+=7);R--;)x[C++]=B}}var L=x.subarray(0,_),D=x.subarray(_);g=gN(L),m=gN(D),A=gT(L,g,1),p=gT(D,m,1)}else gH(1);else{var T=gO(u)+4,U=e[T-4]|e[T-3]<<8,P=T+U;if(P>r){l&&gH(0);break}o&&h(d+U),i.set(e.subarray(T,P),d),t.b=d+=U,t.p=u=8*P,t.f=c;continue}if(u>f){l&&gH(0);break}}o&&h(d+131072);for(var N=(1<>4;if((u+=15&B)>f){l&&gH(0);break}if(B||gH(2),O<256)i[d++]=O;else if(256==O){Q=u,A=null;break}else{var k=O-254;if(O>264){var C=O-257,G=gm[C];k=gF(e,u,(1<>4;H||gH(3),u+=15&H;var D=gC[z];if(z>3){var G=gf[z];D+=gQ(e,u)&(1<f){l&&gH(0);break}o&&h(d+131072);var V=d+k;if(d>8},gW=function(e,t,i){i<<=7&t;var n=t/8|0;e[n]|=i,e[n+1]|=i>>8,e[n+2]|=i>>16},gq=function(e,t){for(var i=[],n=0;nd&&(d=a[n].s);var A=new gp(d+1),p=gX(i[c-1],A,0);if(p>t){var n=0,g=0,m=p-t,f=1<t)g+=f-(1<>=m;g>0;){var _=a[n].s;A[_]=0&&g;--n){var y=a[n].s;A[y]==t&&(--A[y],++g)}p=t}return{t:new gA(A),l:p}},gX=function(e,t,i){return -1==e.s?Math.max(gX(e.l,t,i+1),gX(e.r,t,i+1)):t[e.s]=i},gj=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new gp(++t),n=0,r=e[0],a=1,s=function(e){i[n++]=e},o=1;o<=t;++o)if(e[o]==r&&o!=t)++a;else{if(!r&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(r),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(r);a=1,r=e[o]}return{c:i.subarray(0,n),n:t}},gY=function(e,t){for(var i=0,n=0;n>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var a=0;a4&&!B[gv[L-1]];--L);var D=h+5<<3,U=gY(r,gB)+gY(a,gR)+s,P=gY(r,m)+gY(a,_)+s+14+3*L+gY(w,B)+2*w[16]+3*w[17]+7*w[18];if(l>=0&&D<=U&&D<=P)return gK(t,c,e.subarray(l,l+h));if(gV(t,c,1+(P15&&(gV(t,c,O[b]>>5&127),c+=O[b]>>12)}}else u=gL,d=gB,A=gU,p=gR;for(var b=0;b255){var k=G>>18&31;gW(t,c,u[k+257]),c+=d[k+257],k>7&&(gV(t,c,G>>23&31),c+=gm[k]);var H=31&G;gW(t,c,A[H]),c+=p[H],H>3&&(gW(t,c,G>>5&8191),c+=gf[H])}else gW(t,c,u[G]),c+=d[G]}return gW(t,c,u[256]),c+d[256]},gZ=new gg([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),g$=new gA(0),g0=function(e,t,i,n,r,a){var s=a.z||e.length,o=new gA(n+s+5*(1+Math.ceil(s/7e3))+r),l=o.subarray(n,o.length-r),h=a.l,c=7&(a.r||0);if(t){c&&(l[0]=a.r>>3);for(var u=gZ[t-1],d=u>>13,A=8191&u,p=(1<7e3||M>24576)&&(L>423||!h)){c=gJ(e,l,0,y,E,x,C,M,b,I-b,c),M=S=C=0,b=I;for(var D=0;D<286;++D)E[D]=0;for(var D=0;D<30;++D)x[D]=0}var U=2,P=0,N=A,F=B-R&32767;if(L>2&&T==_(I-F))for(var Q=Math.min(d,L)-1,O=Math.min(32767,I),k=Math.min(258,L);F<=O&&--N&&B!=R;){if(e[I+U]==e[I+U-F]){for(var G=0;GU){if(U=G,P=F,G>Q)break;for(var H=Math.min(F,G-2),z=0,D=0;Dz&&(z=q,R=V)}}}R=g[B=R],F+=B-R&32767}if(P){y[M++]=0x10000000|gx[U]<<18|gI[P];var X=31&gx[U],j=31&gI[P];C+=gm[X]+gf[j],++E[257+X],++x[j],w=I+U,++S}else y[M++]=e[I],++E[e[I]]}}for(I=Math.max(I,w);I=s&&(l[c/8|0]=h,Y=s),c=gK(l,c+1,e.subarray(I,Y))}a.i=s}return gk(o,0,n+gO(c)+r)},g1=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var i=t,n=9;--n;)i=(1&i&&-0x12477ce0)^i>>>1;e[t]=i}return e}(),g2=function(){var e=-1;return{p:function(t){for(var i=e,n=0;n>>8;e=i},d:function(){return~e}}},g3=function(){var e=1,t=0;return{p:function(i){for(var n=e,r=t,a=0|i.length,s=0;s!=a;){for(var o=Math.min(s+2655,a);s>16),r=(65535&r)+15*(r>>16)}e=n,t=r},d:function(){return e%=65521,t%=65521,(255&e)<<24|(65280&e)<<8|(255&t)<<8|t>>8}}},g4=function(e,t,i,n,r){if(!r&&(r={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),s=new gA(a.length+e.length);s.set(a),s.set(e,a.length),e=s,r.w=a.length}return g0(e,null==t.level?6:t.level,null==t.mem?r.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,i,n,r)},g5=function(e,t){var i={};for(var n in e)i[n]=e[n];for(var n in t)i[n]=t[n];return i},g8=function(e,t,i){for(var n=e(),r=e.toString(),a=r.slice(r.indexOf("[")+1,r.lastIndexOf("]")).replace(/\s+/g,"").split(","),s=0;s>>0},mc=function(e,t){return mh(e,t)+0x100000000*mh(e,t+4)},mu=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8},md=function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:2*(9==t.level),e[9]=3,0!=t.mtime&&mu(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var n=0;n<=i.length;++n)e[n+10]=i.charCodeAt(n)}},mA=function(e){(31!=e[0]||139!=e[1]||8!=e[2])&&gH(6,"invalid gzip data");var t=e[3],i=10;4&t&&(i+=(e[10]|e[11]<<8)+2);for(var n=(t>>3&1)+(t>>4&1);n>0;n-=!e[i++]);return i+(2&t)},mp=function(e){var t=e.length;return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0},mg=function(e){return 10+(e.filename?e.filename.length+1:0)},mm=function(e,t){var i=t.level;if(e[0]=120,e[1]=(0==i?0:i<6?1:9==i?3:2)<<6|(t.dictionary&&32),e[1]|=31-(e[0]<<8|e[1])%31,t.dictionary){var n=g3();n.p(t.dictionary),mu(e,2,n.d())}},mf=function(e,t){return((15&e[0])!=8||e[0]>>4>7||(e[0]<<8|e[1])%31)&&gH(6,"invalid zlib data"),(e[1]>>5&1)==+!t&&gH(6,"invalid zlib data: "+(32&e[1]?"need":"unexpected")+" dictionary"),(e[1]>>3&4)+2};function mv(e,t){return"function"==typeof e&&(t=e,e={}),this.ondata=t,e}var m_=function(){function e(e,t){if("function"==typeof e&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new gA(98304),this.o.dictionary){var i=this.o.dictionary.subarray(-32768);this.b.set(i,32768-i.length),this.s.i=32768-i.length}}return e.prototype.p=function(e,t){this.ondata(g4(e,this.o,0,0,this.s),t)},e.prototype.push=function(e,t){this.ondata||gH(5),this.s.l&&gH(4);var i=e.length+this.s.z;if(i>this.b.length){if(i>2*this.b.length-32768){var n=new gA(-32768&i);n.set(this.b.subarray(0,this.s.z)),this.b=n}var r=this.b.length-this.s.z;this.b.set(e.subarray(0,r),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(r),32768),this.s.z=e.length-r+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=1&t,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2)},e.prototype.flush=function(){this.ondata||gH(5),this.s.l&&gH(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},e}(),my=function(e,t){mo([mt,function(){return[ms,m_]}],this,mv.call(this,e,t),function(e){onmessage=ms(new m_(e.data))},6,1)};function mE(e,t){return g4(e,t||{},0,0)}var mx=function(){function e(e,t){"function"==typeof e&&(t=e,e={}),this.ondata=t;var i=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:i?i.length:0},this.o=new gA(32768),this.p=new gA(0),i&&this.o.set(i)}return e.prototype.e=function(e){if(this.ondata||gH(5),this.d&&gH(4),this.p.length){if(e.length){var t=new gA(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}}else this.p=e},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,i=gz(this.p,this.s,this.o);this.ondata(gk(i,t,this.s.b),this.d),this.o=gk(i,this.s.b-32768),this.s.b=this.o.length,this.p=gk(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),mS=function(e,t){mo([me,function(){return[ms,mx]}],this,mv.call(this,e,t),function(e){onmessage=ms(new mx(e.data))},7,0)};function mC(e,t){return gz(e,{i:2},t&&t.out,t&&t.dictionary)}(function(){function e(e,t){this.c=g2(),this.l=0,this.v=1,m_.call(this,e,t)}e.prototype.push=function(e,t){this.c.p(e),this.l+=e.length,m_.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var i=g4(e,this.o,this.v&&mg(this.o),t&&8,this.s);this.v&&(md(i,this.o),this.v=0),t&&(mu(i,i.length-8,this.c.d()),mu(i,i.length-4,this.l)),this.ondata(i,t)},e.prototype.flush=function(){m_.prototype.flush.call(this)}})();var mI=function(){function e(e,t){this.v=1,this.r=0,mx.call(this,e,t)}return e.prototype.push=function(e,t){if(mx.prototype.e.call(this,e),this.r+=e.length,this.v){var i=this.p.subarray(this.v-1),n=i.length>3?mA(i):4;if(n>i.length){if(!t)return}else this.v>1&&this.onmember&&this.onmember(this.r-i.length);this.p=i.subarray(n),this.v=0}mx.prototype.c.call(this,t),!this.s.f||this.s.l||t||(this.v=gO(this.s.p)+9,this.s={i:0},this.o=new gA(0),this.push(new gA(0),t))},e}(),mM=function(e,t){var i=this;mo([me,mi,function(){return[ms,mx,mI]}],this,mv.call(this,e,t),function(e){var t=new mI(e.data);t.onmember=function(e){return postMessage(e)},onmessage=ms(t)},9,0,function(e){return i.onmember&&i.onmember(e)})},mw=(function(){function e(e,t){this.c=g3(),this.v=1,m_.call(this,e,t)}e.prototype.push=function(e,t){this.c.p(e),m_.prototype.push.call(this,e,t)},e.prototype.p=function(e,t){var i=g4(e,this.o,this.v&&(this.o.dictionary?6:2),t&&4,this.s);this.v&&(mm(i,this.o),this.v=0),t&&mu(i,i.length-4,this.c.d()),this.ondata(i,t)},e.prototype.flush=function(){m_.prototype.flush.call(this)}}(),function(){function e(e,t){mx.call(this,e,t),this.v=e&&e.dictionary?2:1}return e.prototype.push=function(e,t){if(mx.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(mf(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&gH(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),mx.prototype.c.call(this,t)},e}()),mb=function(e,t){mo([me,mn,function(){return[ms,mx,mw]}],this,mv.call(this,e,t),function(e){onmessage=ms(new mw(e.data))},11,0)},mT=function(){function e(e,t){this.o=mv.call(this,e,t)||{},this.G=mI,this.I=mx,this.Z=mw}return e.prototype.i=function(){var e=this;this.s.ondata=function(t,i){e.ondata(t,i)}},e.prototype.push=function(e,t){if(this.ondata||gH(5),this.s)this.s.push(e,t);else{if(this.p&&this.p.length){var i=new gA(this.p.length+e.length);i.set(this.p),i.set(e,this.p.length)}else this.p=e;this.p.length>2&&(this.s=31==this.p[0]&&139==this.p[1]&&8==this.p[2]?new this.G(this.o):(15&this.p[0])!=8||this.p[0]>>4>7||(this.p[0]<<8|this.p[1])%31?new this.I(this.o):new this.Z(this.o),this.i(),this.s.push(this.p,t),this.p=null)}},e}();!function(){function e(e,t){mT.call(this,e,t),this.queuedSize=0,this.G=mM,this.I=mS,this.Z=mb}e.prototype.i=function(){var e=this;this.s.ondata=function(t,i,n){e.ondata(t,i,n)},this.s.ondrain=function(t){e.queuedSize-=t,e.ondrain&&e.ondrain(t)}},e.prototype.push=function(e,t){this.queuedSize+=e.length,mT.prototype.push.call(this,e,t)}}();var mB=function(e,t,i,n){for(var r in e){var a=e[r],s=t+r,o=n;Array.isArray(a)&&(o=g5(n,a[1]),a=a[0]),a instanceof gA?i[s]=[a,o]:(i[s+="/"]=[new gA(0),o],mB(a,s,i,n))}},mR="undefined"!=typeof TextEncoder&&new TextEncoder,mL="undefined"!=typeof TextDecoder&&new TextDecoder,mD=0;try{mL.decode(g$,{stream:!0}),mD=1}catch(e){}var mU=function(e){for(var t="",i=0;;){var n=e[i++],r=(n>127)+(n>223)+(n>239);if(i+r>e.length)return{s:t,r:gk(e,i-1)};r?3==r?t+=String.fromCharCode(55296|(n=((15&n)<<18|(63&e[i++])<<12|(63&e[i++])<<6|63&e[i++])-65536)>>10,56320|1023&n):1&r?t+=String.fromCharCode((31&n)<<6|63&e[i++]):t+=String.fromCharCode((15&n)<<12|(63&e[i++])<<6|63&e[i++]):t+=String.fromCharCode(n)}};function mP(e,t){if(t){for(var i=new gA(e.length),n=0;n>1)),s=0,o=function(e){a[s++]=e},n=0;na.length){var l=new gA(s+8+(r-n<<1));l.set(a),a=l}var h=e.charCodeAt(n);h<128||t?o(h):(h<2048?o(192|h>>6):(h>55295&&h<57344?(o(240|(h=65536+(1047552&h)|1023&e.charCodeAt(++n))>>18),o(128|h>>12&63)):o(224|h>>12),o(128|h>>6&63)),o(128|63&h))}return gk(a,0,s)}(function(e){this.ondata=e,mD?this.t=new TextDecoder:this.p=g$}).prototype.push=function(e,t){if(this.ondata||gH(5),t=!!t,this.t){this.ondata(this.t.decode(e,{stream:!0}),t),t&&(this.t.decode().length&&gH(8),this.t=null);return}this.p||gH(4);var i=new gA(this.p.length+e.length);i.set(this.p),i.set(e,this.p.length);var n=mU(i),r=n.s,a=n.r;t?(a.length&&gH(8),this.p=null):this.p=a,this.ondata(r,t)},(function(e){this.ondata=e}).prototype.push=function(e,t){this.ondata||gH(5),this.d&&gH(4),this.ondata(mP(e),this.d=t||!1)};var mN=function(e){return 1==e?3:e<6?2:+(9==e)},mF=function(e,t){for(;1!=ml(e,t);t+=4+ml(e,t+2));return[mc(e,t+12),mc(e,t+4),mc(e,t+20)]},mQ=function(e){var t=0;if(e)for(var i in e){var n=e[i].length;n>65535&&gH(9),t+=n+4}return t},mO=function(e,t,i,n,r,a,s,o){var l=n.length,h=i.extra,c=o&&o.length,u=mQ(h);mu(e,t,null!=s?0x2014b50:0x4034b50),t+=4,null!=s&&(e[t++]=20,e[t++]=i.os),e[t]=20,t+=2,e[t++]=i.flag<<1|(a<0&&8),e[t++]=r&&8,e[t++]=255&i.compression,e[t++]=i.compression>>8;var d=new Date(null==i.mtime?Date.now():i.mtime),A=d.getFullYear()-1980;if((A<0||A>119)&&gH(10),mu(e,t,A<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1),t+=4,-1!=a&&(mu(e,t,i.crc),mu(e,t+4,a<0?-a-2:a),mu(e,t+8,i.size)),mu(e,t+12,l),mu(e,t+14,u),t+=16,null!=s&&(mu(e,t,c),mu(e,t+6,i.attrs),mu(e,t+10,s),t+=14),e.set(n,t),t+=l,u)for(var p in h){var g=h[p],m=g.length;mu(e,t,+p),mu(e,t+2,m),e.set(g,t+4),t+=4+m}return c&&(e.set(o,t),t+=c),t},mk=function(e,t,i,n,r){mu(e,t,0x6054b50),mu(e,t+8,i),mu(e,t+10,i),mu(e,t+12,n),mu(e,t+16,r)},mG=function(){function e(e){this.filename=e,this.c=g2(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){this.ondata||gH(5),this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}();!function(){function e(e,t){var i=this;t||(t={}),mG.call(this,e),this.d=new m_(t,function(e,t){i.ondata(null,e,t)}),this.compression=8,this.flag=mN(t.level)}e.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e.prototype.push=function(e,t){mG.prototype.push.call(this,e,t)}}(),function(){function e(e,t){var i=this;t||(t={}),mG.call(this,e),this.d=new my(t,function(e,t,n){i.ondata(e,t,n)}),this.compression=8,this.flag=mN(t.level),this.terminate=this.d.terminate}e.prototype.process=function(e,t){this.d.push(e,t)},e.prototype.push=function(e,t){mG.prototype.push.call(this,e,t)}}(),function(){function e(e){this.ondata=e,this.u=[],this.d=1}e.prototype.add=function(e){var t=this;if(this.ondata||gH(5),2&this.d)this.ondata(gH(4+(1&this.d)*8,0,1),null,!1);else{var i=mP(e.filename),n=i.length,r=e.comment,a=r&&mP(r),s=n!=e.filename.length||a&&r.length!=a.length,o=n+mQ(e.extra)+30;n>65535&&this.ondata(gH(11,0,1),null,!1);var l=new gA(o);mO(l,0,e,i,s,-1);var h=[l],c=function(){for(var e=0,i=h;e0){var n=Math.min(this.c,e.length),r=e.subarray(0,n);if(this.c-=n,this.d?this.d.push(r,!this.c):this.k[0].push(r),(e=e.subarray(n)).length)return this.push(e,t)}else{var a=0,s=0,o=void 0,l=void 0;this.p.length?e.length?((l=new gA(this.p.length+e.length)).set(this.p),l.set(e,this.p.length)):l=this.p:l=e;for(var h=l.length,c=this.c,u=c&&this.d,d=this;ss+30+u+A){var p,g,m=[];d.k.unshift(m),a=2;var f=mh(l,s+18),v=mh(l,s+22),_=function(e,t){if(t){for(var i="",n=0;n=0&&(y.size=f,y.originalSize=v),d.onfile(y)}return"break"}if(c){if(0x8074b50==e)return o=s+=12+(-2==c&&8),a=3,d.c=0,"break";else if(0x2014b50==e)return o=s-=4,a=3,d.c=0,"break"}}();++s);if(this.p=g$,c<0){var A=a?l.subarray(0,o-12-(-2==c&&8)-(0x8074b50==mh(l,o-16)&&4)):l.subarray(0,s);u?u.push(A,!!a):this.k[+(2==a)].push(A)}if(2&a)return this.push(l.subarray(s),t);this.p=l.subarray(s)}t&&(this.c&&gH(13),this.p=null)},e.prototype.register=function(e){this.o[e.compression]=e}}(),"function"==typeof queueMicrotask&&queueMicrotask;class mz{async parse(e){var t;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},quickLookCompatible:!1,maxTextureSize:1024},i);let n={},r="model.usda";n[r]=null;let a=mV();a+=(t=i,'def Xform "Root"\n{\n def Scope "Scenes" (\n kind = "sceneLibrary"\n )\n {\n def Xform "Scene" (\n customData = {\n bool preliminary_collidesWithEnvironment = 0\n string sceneName = "Scene"\n }\n sceneName = "Scene"\n )\n {\n token preliminary:anchoring:type = "'.concat(t.ar.anchoring.type,'"\n token preliminary:planeAnchoring:alignment = "').concat(t.ar.planeAnchoring.alignment,'"\n\n'));let s={},o={};for(let t in e.traverseVisible(e=>{if(e.isMesh){let i=e.geometry,r=e.material;if(r.isMeshStandardMaterial){let o="geometries/Geometry_"+i.id+".usda";if(!(o in n)){var t;let e,r=function(e){let t=function(e){var t;let i=e.attributes,n=i.position.count;return'\n def Mesh "'.concat("Geometry",'"\n {\n int[] faceVertexCounts = [').concat(Array((null!==(t=e).index?t.index.count:t.attributes.position.count)/3).fill(3).join(", "),"]\n int[] faceVertexIndices = [").concat(function(e){let t=e.index,i=[];if(null!==t)for(let e=0;e0?i:"",r=e["uv"+n];void 0!==r&&(t+="\n texCoord2f[] primvars:st".concat(n," = [").concat(function(e){let t=[];for(let i=0;ie.matrixWorld.determinant()&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",e),'def Xform "'.concat(n,'" (\n prepend references = @./geometries/Geometry_').concat(t.id,'.usda@\n prepend apiSchemas = ["MaterialBindingAPI"]\n)\n{\n matrix4d xformOp:transform = ').concat(r,'\n uniform token[] xformOpOrder = ["xformOp:transform"]\n\n rel material:binding = \n}\n\n")}(e,i,r)}else console.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",e)}else e.isCamera&&(a+=function(e){let t=e.name?e.name:"Camera_"+e.id,i=mW(e.matrixWorld);return(0>e.matrixWorld.determinant()&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",e),e.isOrthographicCamera)?'def Camera "'.concat(t,'"\n {\n matrix4d xformOp:transform = ').concat(i,'\n uniform token[] xformOpOrder = ["xformOp:transform"]\n\n float2 clippingRange = (').concat(e.near.toPrecision(7),", ").concat(e.far.toPrecision(7),")\n float horizontalAperture = ").concat(((Math.abs(e.left)+Math.abs(e.right))*10).toPrecision(7),"\n float verticalAperture = ").concat(((Math.abs(e.top)+Math.abs(e.bottom))*10).toPrecision(7),'\n token projection = "orthographic"\n }\n \n '):'def Camera "'.concat(t,'"\n {\n matrix4d xformOp:transform = ').concat(i,'\n uniform token[] xformOpOrder = ["xformOp:transform"]\n\n float2 clippingRange = (').concat(e.near.toPrecision(7),", ").concat(e.far.toPrecision(7),")\n float focalLength = ").concat(e.getFocalLength().toPrecision(7),"\n float focusDistance = ").concat(e.focus.toPrecision(7),"\n float horizontalAperture = ").concat(e.getFilmWidth().toPrecision(7),'\n token projection = "perspective"\n float verticalAperture = ').concat(e.getFilmHeight().toPrecision(7),"\n }\n \n ")}(e))}),a+="\n }\n }\n}\n\n",a+=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=[];for(let r in e){let a=e[r];n.push(function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=[],r=[];function a(n,r,a){var s;let o=n.source.id+"_"+n.flipY;t[o]=n;let l=n.channel>0?"st"+n.channel:"st",h={1e3:"repeat",1001:"clamp",1002:"mirror"},c=n.repeat.clone(),u=n.offset.clone(),d=n.rotation,A=Math.sin(d),p=Math.cos(d);return u.y=1-u.y-c.y,i?(u.x=u.x/c.x,u.y=u.y/c.y,u.x+=A/c.x,u.y+=p-1):(u.x+=A*c.x,u.y+=(1-p)*c.y),'\n def Shader "PrimvarReader_'.concat(r,'"\n {\n uniform token info:id = "UsdPrimvarReader_float2"\n float2 inputs:fallback = (0.0, 0.0)\n token inputs:varname = "').concat(l,'"\n float2 outputs:result\n }\n\n def Shader "Transform2d_').concat(r,'"\n {\n uniform token info:id = "UsdTransform2d"\n token inputs:in.connect = \n float inputs:rotation = ").concat((180/Math.PI*d).toFixed(7),"\n float2 inputs:scale = ").concat(mY(c),"\n float2 inputs:translation = ").concat(mY(u),'\n float2 outputs:result\n }\n\n def Shader "Texture_').concat(n.id,"_").concat(r,'"\n {\n uniform token info:id = "UsdUVTexture"\n asset inputs:file = @textures/Texture_').concat(o,".png@\n float2 inputs:st.connect = \n ").concat(void 0!==a?"float4 inputs:scale = "+(s=a,"(".concat(s.r,", ").concat(s.g,", ").concat(s.b,", 1.0)")):"",'\n token inputs:sourceColorSpace = "').concat(""===n.colorSpace?"raw":"sRGB",'"\n token inputs:wrapS = "').concat(h[n.wrapS],'"\n token inputs:wrapT = "').concat(h[n.wrapT],'"\n float outputs:r\n float outputs:g\n float outputs:b\n float3 outputs:rgb\n ').concat(e.transparent||e.alphaTest>0?"float outputs:a":"","\n }")}return 2===e.side&&console.warn("THREE.USDZExporter: USDZ does not support double sided materials",e),null!==e.map?(n.push("".concat(" ","color3f inputs:diffuseColor.connect = ")),e.transparent?n.push("".concat(" ","float inputs:opacity.connect = ")):e.alphaTest>0&&(n.push("".concat(" ","float inputs:opacity.connect = ")),n.push("".concat(" ","float inputs:opacityThreshold = ").concat(e.alphaTest))),r.push(a(e.map,"diffuse",e.color))):n.push("".concat(" ","color3f inputs:diffuseColor = ").concat(mj(e.color))),null!==e.emissiveMap?(n.push("".concat(" ","color3f inputs:emissiveColor.connect = ")),r.push(a(e.emissiveMap,"emissive"))):e.emissive.getHex()>0&&n.push("".concat(" ","color3f inputs:emissiveColor = ").concat(mj(e.emissive))),null!==e.normalMap&&(n.push("".concat(" ","normal3f inputs:normal.connect = ")),r.push(a(e.normalMap,"normal"))),null!==e.aoMap&&(n.push("".concat(" ","float inputs:occlusion.connect = ")),r.push(a(e.aoMap,"occlusion"))),null!==e.roughnessMap&&1===e.roughness?(n.push("".concat(" ","float inputs:roughness.connect = ")),r.push(a(e.roughnessMap,"roughness"))):n.push("".concat(" ","float inputs:roughness = ").concat(e.roughness)),null!==e.metalnessMap&&1===e.metalness?(n.push("".concat(" ","float inputs:metallic.connect = ")),r.push(a(e.metalnessMap,"metallic"))):n.push("".concat(" ","float inputs:metallic = ").concat(e.metalness)),null!==e.alphaMap?(n.push("".concat(" ","float inputs:opacity.connect = ")),n.push("".concat(" ","float inputs:opacityThreshold = 0.0001")),r.push(a(e.alphaMap,"opacity"))):n.push("".concat(" ","float inputs:opacity = ").concat(e.opacity)),e.isMeshPhysicalMaterial&&(n.push("".concat(" ","float inputs:clearcoat = ").concat(e.clearcoat)),n.push("".concat(" ","float inputs:clearcoatRoughness = ").concat(e.clearcoatRoughness)),n.push("".concat(" ","float inputs:ior = ").concat(e.ior))),'\n def Material "Material_'.concat(e.id,'"\n {\n def Shader "PreviewSurface"\n {\n uniform token info:id = "UsdPreviewSurface"\n').concat(n.join("\n"),"\n int inputs:useSpecularWorkflow = 0\n token outputs:surface\n }\n\n token outputs:surface.connect = \n\n").concat(r.join("\n"),"\n\n }\n")}(a,t,i))}return'def "Materials"\n{\n'.concat(n.join(""),"\n}\n\n")}(s,o,i.quickLookCompatible),n[r]=mP(a),a=null,o){let e=o[t];!0===e.isCompressedTexture&&(e=cn(e));let r=function(e,t,i){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){let n=i/Math.max(e.width,e.height),r=document.createElement("canvas");r.width=e.width*Math.min(1,n),r.height=e.height*Math.min(1,n);let a=r.getContext("2d");return!0===t&&(a.translate(0,r.height),a.scale(1,-1)),a.drawImage(e,0,0,r.width,r.height),r}throw Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}(e.image,e.flipY,i.maxTextureSize),a=await new Promise(e=>r.toBlob(e,"image/png",1));n["textures/Texture_".concat(t,".png")]=new Uint8Array(await a.arrayBuffer())}let l=0;for(let e in n){let t=n[e],i=63&(l+=34+e.length);if(4!==i){let r=new Uint8Array(64-i);n[e]=[t,{extra:{12345:r}}]}l=t.length}return function(e,t){t||(t={});var i={},n=[];mB(e,"",i,t);var r=0,a=0;for(var s in i){var o=i[s],l=o[0],h=o[1],c=8*(0!=h.level),u=mP(s),d=u.length,A=h.comment,p=A&&mP(A),g=p&&p.length,m=mQ(h.extra);d>65535&&gH(11);var f=c?mE(l,h):l,v=f.length,_=g2();_.p(l),n.push(g5(h,{size:l.length,crc:_.d(),c:f,f:u,m:p,u:d!=s.length||p&&A.length!=g,o:r,compression:c})),r+=30+d+m+v,a+=76+2*(d+m)+(g||0)+v}for(var y=new gA(a+22),E=r,x=a-r,S=0;S=0;o--)(r=e[o])&&(s=(a<3?r(s):a>3?r(t,i,s):r(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let mJ=!1,mZ=!1,m$="#model-viewer-no-ar-fallback",m0=(g=["quick-look","scene-viewer","webxr","none"],e=>{try{let t=cG(e),i=(t.length?t[0].terms:[]).filter(e=>e&&"ident"===e.type).map(e=>e.value).filter(e=>g.indexOf(e)>-1);return new Set(i)}catch(e){}return new Set}),m1={QUICK_LOOK:"quick-look",SCENE_VIEWER:"scene-viewer",WEBXR:"webxr",NONE:"none"},m2=Symbol("arButtonContainer"),m3=Symbol("enterARWithWebXR"),m4=Symbol("openSceneViewer"),m5=Symbol("openIOSARQuickLook"),m8=Symbol("canActivateAR"),m6=Symbol("arMode"),m9=Symbol("arModes"),m7=Symbol("arAnchor"),fe=Symbol("preload"),ft=Symbol("onARButtonContainerClick"),fi=Symbol("onARStatus"),fn=Symbol("onARTracking"),fr=Symbol("onARTap"),fa=Symbol("selectARMode"),fs=Symbol("triggerLoad");var fo=function(e,t,i,n){var r,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(a<3?r(s):a>3?r(t,i,s):r(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let fl={AUTO:"auto"},fh={AUTO:"auto",EAGER:"eager"},fc=Symbol("defaultProgressBarElement"),fu=Symbol("posterContainerElement"),fd=Symbol("defaultPosterElement"),fA=Symbol("shouldDismissPoster"),fp=Symbol("hidePoster"),fg=Symbol("modelIsRevealed"),fm=Symbol("updateProgressBar"),ff=Symbol("ariaLabelCallToAction"),fv=Symbol("onProgress");var f_=function(e,t,i,n){var r,a=arguments.length,s=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var o=e.length-1;o>=0;o--)(r=e[o])&&(s=(a<3?r(s):a>3?r(t,i,s):r(t,i))||s);return a>3&&s&&Object.defineProperty(t,i,s),s};let fy={basis:[cK(ck(Math.PI/32,"rad"))],keywords:{auto:[null]}},fE=Symbol("autoRotateStartTime"),fx=Symbol("radiansPerSecond"),fS=Symbol("syncRotationRate"),fC=Symbol("onCameraChange"),fI=(e=>{var t,i,n;class r extends e{connectedCallback(){super.connectedCallback();for(let e=0;e{e.forEach(e=>{e instanceof MutationRecord&&"childList"!==e.type||(e.addedNodes.forEach(e=>{this[gl](e)}),e.removedNodes.forEach(e=>{this[gh](e)}),this[p$]())})},this[n]=new MutationObserver(this[gs])}}return r})((e=>{var t,i,n;class r extends e{get model(){return this[pa]}get availableVariants(){return this.model?this.model[A6]():[]}get originalGltfJson(){return this[pr]}[(t=pa,i=pn,n=pr,ps)](){return()=>{this[p$]()}}[po](e){return e.colorSpace=eh,e.wrapS=1e3,e.wrapT=1e3,new Am(this[ps](),e)}async createTexture(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"image/png",{textureUtils:i}=this[p3],n=await i.loadImage(e);return n.userData.mimeType=t,this[po](n)}async createLottieTexture(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,{textureUtils:i}=this[p3],n=await i.loadLottie(e,t);return this[po](n)}createVideoTexture(e){let t=document.createElement("video");t.crossOrigin=this.withCredentials?"use-credentials":"anonymous",t.src=e,t.muted=!0,t.playsInline=!0,t.loop=!0,t.play();let i=new a5(t);return this[po](i)}createCanvasTexture(){let e=new a7(document.createElement("canvas"));return this[po](e)}async updated(e){if(super.updated(e),e.has("variantName")){let e=this[p4].beginActivity("variant-update");e(.1);let t=this[pa],{variantName:i}=this;null!=t&&(await t[A2](i),this[p$](),this.dispatchEvent(new CustomEvent("variant-applied"))),e(1)}if(e.has("orientation")||e.has("scale")){if(!this.loaded)return;let e=this[pZ];e.applyTransform(),e.updateBoundingBox(),e.updateShadow(),this[p3].arRenderer.onUpdateScene(),this[p$]()}}[p1](){super[p1]();let{currentGLTF:e}=this[pZ];if(null!=e){let{correlatedSceneGraph:t}=e;null!=t&&e!==this[pn]&&(this[pa]=new pt(t,this[ps]()),this[pr]=JSON.parse(JSON.stringify(t.gltf))),"variants"in e.userData&&this.requestUpdate("variantName")}this[pn]=e}async exportScene(e){let t=this[pZ];return new Promise(async(i,n)=>{let r={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(r,e),r.animations=t.animations,r.truncateDrawRange=!0;let a=t.shadow,s=!1;null!=a&&(s=a.visible,a.visible=!1),await this[pa][A1](),new ca().register(e=>new cL(e)).parse(t.model,e=>i(new Blob([r.binary?e:JSON.stringify(e)],{type:r.binary?"application/octet-stream":"application/json"})),()=>n("glTF export failed"),r),null!=a&&(a.visible=s)})}materialFromPoint(e,t){let i=this[pa];if(null==i)return null;let n=this[pZ],r=n.getNDC(e,t),a=n.hitFromPoint(r);return null==a||null==a.face?null:i[A3](a)}constructor(){super(...arguments),this[t]=void 0,this[i]=null,this[n]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}}return pi([eo({type:String,attribute:"variant-name"})],r.prototype,"variantName",void 0),pi([eo({type:String,attribute:"orientation"})],r.prototype,"orientation",void 0),pi([eo({type:String,attribute:"scale"})],r.prototype,"scale",void 0),r})((e=>{var t,i,n;class r extends e{connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[fC]),this[fE]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[fC]),this[fE]=performance.now()}updated(e){super.updated(e),e.has("autoRotate")&&(this[fE]=performance.now())}[(t=fE,i=fx,fS)](e){this[fx]=e[0]}[p0](e,t){if(super[p0](e,t),!this.autoRotate||!this[p8]()||this[p3].isPresenting)return;let i=Math.min(t,e-this[fE]-this.autoRotateDelay);i>0&&(this[pZ].yaw=this.turntableRotation+this[fx]*i*.001)}get turntableRotation(){return this[pZ].yaw}resetTurntableRotation(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this[pZ].yaw=e}constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[t]=performance.now(),this[i]=0,this[n]=e=>{this.autoRotate&&"user-interaction"===e.detail.source&&(this[fE]=performance.now())}}}return n=fC,f_([eo({type:Boolean,attribute:"auto-rotate"})],r.prototype,"autoRotate",void 0),f_([eo({type:Number,attribute:"auto-rotate-delay"})],r.prototype,"autoRotateDelay",void 0),f_([u_({intrinsics:fy,updateHandler:fS}),eo({type:String,attribute:"rotation-per-second"})],r.prototype,"rotationPerSecond",void 0),r})((e=>{var t,i,n;class r extends e{updated(e){super.updated(e),e.has("shadowIntensity")&&(this[pZ].setShadowIntensity(.5*this.shadowIntensity),this[p$]()),e.has("shadowSoftness")&&(this[pZ].setShadowSoftness(this.shadowSoftness),this[p$]()),e.has("exposure")&&(this[pZ].exposure=this.exposure,this[p$]()),e.has("toneMapping")&&(this[pZ].toneMapping="commerce"===this.toneMapping||"neutral"===this.toneMapping?7:"agx"===this.toneMapping?6:4,this[p$]()),(e.has("environmentImage")||e.has("skyboxImage"))&&this[p6]()&&this[lB](),e.has("skyboxHeight")&&(this[pZ].setGroundedSkybox(),this[p$]())}hasBakedShadow(){return this[pZ].bakedShadows.size>0}async [(t=lb,i=lT,n=lR,lB)](){let{skyboxImage:e,environmentImage:t}=this;null!=this[lR]&&(this[lR](),this[lR]=null);let{textureUtils:i}=this[p3];if(null==i)return;let n=this[p4].beginActivity("environment-update");try{let{environmentMap:r,skybox:a}=await i.generateEnvironmentMapAndSkybox(lv(e),t,e=>n(lx(e,0,1)));this[lb]!==r&&(this[lb]=r,this.dispatchEvent(new CustomEvent("environment-change"))),null!=a?this[lT]=a.name===r.name?r:a:this[lT]=null,this[pZ].setEnvironmentAndSkybox(this[lb],this[lT])}catch(e){if(e instanceof Error)throw this[pZ].setEnvironmentAndSkybox(null,null),e}finally{n(1)}}constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.shadowIntensity=0,this.shadowSoftness=1,this.exposure=1,this.toneMapping="auto",this.skyboxHeight="0",this[t]=null,this[i]=null,this[n]=null}}return lw([eo({type:String,attribute:"environment-image"})],r.prototype,"environmentImage",void 0),lw([eo({type:String,attribute:"skybox-image"})],r.prototype,"skyboxImage",void 0),lw([eo({type:Number,attribute:"shadow-intensity"})],r.prototype,"shadowIntensity",void 0),lw([eo({type:Number,attribute:"shadow-softness"})],r.prototype,"shadowSoftness",void 0),lw([eo({type:Number})],r.prototype,"exposure",void 0),lw([eo({type:String,attribute:"tone-mapping"})],r.prototype,"toneMapping",void 0),lw([eo({type:String,attribute:"skybox-height"})],r.prototype,"skyboxHeight",void 0),r})((e=>{var t,i,n,r,a,s,o,l,h,c,u,d,A,p,g,m,f,v;class _ extends e{get inputSensitivity(){return this[uH].inputSensitivity}set inputSensitivity(e){this[uH].inputSensitivity=e}getCameraOrbit(){let{theta:e,phi:t,radius:i}=this[u8];return{theta:e,phi:t,radius:i,toString(){return"".concat(this.theta,"rad ").concat(this.phi,"rad ").concat(this.radius,"m")}}}getCameraTarget(){return p9(this[p3].isPresenting?this[p3].arRenderer.target:this[pZ].getTarget())}getFieldOfView(){return this[uH].getFieldOfView()}getMinimumFieldOfView(){return this[uH].options.minimumFieldOfView}getMaximumFieldOfView(){return this[uH].options.maximumFieldOfView}getIdealAspect(){return this[pZ].idealAspect}jumpCameraToGoal(){this[u6]=!0,this.requestUpdate(u6,!1)}resetInteractionPrompt(){this[u4]=0,this[u3]=1/0,this[u2]=!1,this[u1]=this.interactionPrompt===uT.AUTO&&this.cameraControls}zoom(e){let t=new WheelEvent("wheel",{deltaY:-30*e});this[pK].dispatchEvent(t)}connectedCallback(){super.connectedCallback(),this[uH].addEventListener("user-interaction",this[uZ]),this[uH].addEventListener("pointer-change-start",this[u0]),this[uH].addEventListener("pointer-change-end",this[u0])}disconnectedCallback(){super.disconnectedCallback(),this[uH].removeEventListener("user-interaction",this[uZ]),this[uH].removeEventListener("pointer-change-start",this[u0]),this[uH].removeEventListener("pointer-change-end",this[u0])}updated(e){super.updated(e);let t=this[uH],i=this[pZ];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),this.interactionPrompt===uT.AUTO&&(this[u1]=!0)):(t.disableInteraction(),this[uX]()),this[pK].setAttribute("aria-label",this[pH])),e.has("disableZoom")&&(t.disableZoom=this.disableZoom),e.has("disablePan")&&(t.enablePan=!this.disablePan),e.has("disableTap")&&(t.enableTap=!this.disableTap),(e.has("interactionPrompt")||e.has("cameraControls")||e.has("src"))&&(this.interactionPrompt===uT.AUTO&&this.cameraControls&&!this[u2]?this[u1]=!0:this[uX]()),e.has("interactionPromptStyle")&&(this[uW].style.opacity=this.interactionPromptStyle==uB.BASIC?"1":"0"),e.has("touchAction")){let e=this.touchAction;t.applyOptions({touchAction:e}),t.updateTouchActionStyle()}e.has("orbitSensitivity")&&(t.orbitSensitivity=this.orbitSensitivity),e.has("zoomSensitivity")&&(t.zoomSensitivity=this.zoomSensitivity),e.has("panSensitivity")&&(t.panSensitivity=this.panSensitivity),e.has("interpolationDecay")&&(t.setDamperDecayTime(this.interpolationDecay),i.setTargetDamperDecayTime(this.interpolationDecay)),e.has("a11y")&&this[uK](),!0===this[u6]&&Promise.resolve().then(()=>{t.jumpToGoal(),i.jumpToGoal(),this[u$](),this[u6]=!1})}async updateFraming(){let e=this[pZ],t=e.adjustedFoV(e.framedFoVDeg);await e.updateFraming();let i=e.adjustedFoV(e.framedFoVDeg),n=this[uH].getFieldOfView()/t;this[uH].setFieldOfView(i*n),this[u7]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(e,t,i){let n=this[pK],r=this[uq];if("1"===r[0].style.opacity)return void console.warn("interact() failed because an existing interaction is running.");let a=[];a.push({x:ux(t.x),y:ux(t.y)});let s=[{x:a[0].x(0),y:a[0].y(0)}];null!=i&&(a.push({x:ux(i.x),y:ux(i.y)}),s.push({x:a[1].x(0),y:a[1].y(0)}));let o=performance.now(),{width:l,height:h}=this[pZ],c=this.getBoundingClientRect(),u=e=>{for(let[t,i]of s.entries()){let{style:a}=r[t];a.transform="translateX(".concat(l*i.x,"px) translateY(").concat(h*i.y,"px)"),"pointerdown"===e?a.opacity="1":"pointerup"===e&&(a.opacity="0");let s={pointerId:t-5678,pointerType:"touch",target:n,clientX:l*i.x+c.x,clientY:h*i.y+c.y,altKey:!0};n.dispatchEvent(new PointerEvent(e,s))}},d=()=>{let t=this[u5];if(t!==dd.AUTOMATIC||!n.isConnected){for(let e of this[uq])e.style.opacity="0";u("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:t}})),document.removeEventListener("visibilitychange",A);return}let i=Math.min(1,(performance.now()-o)/e);for(let[e,t]of s.entries())t.x=a[e].x(i),t.y=a[e].y(i);u("pointermove"),i<1?requestAnimationFrame(d):(u("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:dd.AUTOMATIC}})),document.removeEventListener("visibilitychange",A))},A=()=>{let e=0;"hidden"===document.visibilityState?e=performance.now()-o:o=performance.now()-e};document.addEventListener("visibilitychange",A),u("pointerdown"),this[u5]=dd.AUTOMATIC,requestAnimationFrame(d)}[(t=uV,i=uW,n=uq,r=uz,a=u4,s=u3,o=u2,l=u1,h=u5,c=uH,u=u8,d=u6,A=u9,p=u7,g=uY,dt)](e){let t=this[uH],i=this[pZ];i.framedFoVDeg=180*e[0]/Math.PI,t.changeSource=dd.NONE,t.setFieldOfView(i.adjustedFoV(i.framedFoVDeg)),this[uZ]()}[de](e){let t=this[uH];if(this[u7]){let{theta:t,phi:i}=this.getCameraOrbit();e[0]=t,e[1]=i,this[u7]=!1}t.changeSource=dd.NONE,t.setOrbit(e[0],e[1],e[2]),this[uZ]()}[dn](e){this[uH].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]}),this.jumpCameraToGoal()}[dr](e){this[uH].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]}),this[uJ](e[2]),this.jumpCameraToGoal()}[da](e){this[uH].applyOptions({minimumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}[ds](e){let t=this[pZ].adjustedFoV(180*e[0]/Math.PI);this[uH].applyOptions({maximumFieldOfView:t}),this.jumpCameraToGoal()}[di](e){let[t,i,n]=e;this[p3].arRenderer.isPresenting||this[pZ].setTarget(t,i,n),this[uH].changeSource=dd.NONE,this[p3].arRenderer.updateTarget(),this[uZ]()}[p0](e,t){if(super[p0](e,t),this[p3].isPresenting||!this[p8]())return;let i=this[uH],n=this[pZ],r=performance.now();if(this[u1]&&this.loaded&&r>this[pq]+this.interactionPromptThreshold&&(this[u1]=!1,this[u3]=r,this[uV].classList.add("visible")),isFinite(this[u3])&&this.interactionPromptStyle===uB.WIGGLE){let e=(r-this[u3])/5e3%1,t=uC(e),a=uI(e);if(this[uW].style.opacity="".concat(a),t!==this[u4]){let e=t*n.width*.05,r=(t-this[u4])*Math.PI/16;this[uW].style.transform="translateX(".concat(e,"px)"),i.changeSource=dd.AUTOMATIC,i.adjustOrbit(r,0,0),this[u4]=t}}let a=i.update(e,t),s=n.updateTarget(t);(a||s)&&this[u$]()}[uX](){this[u1]=!1,this[uV].classList.remove("visible"),this[u3]=1/0}[uJ](e){let t=Math.abs(2*Math.max(this[pZ].farRadius(),e));this[uH].updateNearFar(0,t)}[uj](){let{theta:e,phi:t}=this[uH].getCameraSpherical(this[u8]),i=Math.floor(t/uO),n=uw[(4+Math.floor((e%uG+uk)/uQ))%4],r=ub[i],a="".concat(r).concat(n);a in this[uY]?this[pW](this[uY][a]):this[pW]("View from stage ".concat(a))}get[pH](){let e=". Use mouse, touch or arrow keys to move.";return"interaction-prompt"in this[uY]&&(e=". ".concat(this[uY]["interaction-prompt"])),super[pH].replace(/\.$/,"")+(this.cameraControls?e:"")}async [p2](e){let t=this[uH],i=this[pZ],n=i.adjustedFoV(i.framedFoVDeg);super[p2](e);let r=i.adjustedFoV(i.framedFoVDeg)/n,a=t.getFieldOfView()*(isFinite(r)?r:1);t.updateAspect(this[pZ].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[uH].setFieldOfView(a),this.jumpCameraToGoal()}[p1](){super[p1](),this[u9]?this[u7]=!0:this[u9]=!0,this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.requestUpdate("minCameraOrbit",this.minCameraOrbit),this.requestUpdate("maxCameraOrbit",this.maxCameraOrbit),this.requestUpdate("cameraOrbit",this.cameraOrbit),this.requestUpdate("cameraTarget",this.cameraTarget),this.jumpCameraToGoal()}[(m=uZ,f=u$,v=u0,uK)](){if("string"==typeof this.a11y)if(this.a11y.startsWith("{"))try{this[uY]=JSON.parse(this.a11y)}catch(e){console.warn("Error parsing a11y JSON:",e)}else this.a11y.length>0?console.warn("Error not supported format, should be a JSON string:",this.a11y):this[uY]={};else"object"==typeof this.a11y&&null!=this.a11y?this[uY]=Object.assign({},this.a11y):this[uY]={};this[pK].setAttribute("aria-label",this[pH])}constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=uM,this.cameraTarget="auto auto auto",this.fieldOfView="auto",this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=3e3,this.interactionPrompt=uT.AUTO,this.interactionPromptStyle=uB.WIGGLE,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction=uR.NONE,this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=50,this.a11y=null,this[t]=this.shadowRoot.querySelector(".interaction-prompt"),this[i]=this.shadowRoot.querySelector("#prompt"),this[n]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[r]=this.shadowRoot.querySelector(".pan-target"),this[a]=0,this[s]=1/0,this[o]=!1,this[l]=!1,this[h]=dd.AUTOMATIC,this[c]=new dA(this[pZ].camera,this[pK],this[pZ]),this[u]=new og,this[d]=!1,this[A]=!1,this[p]=!1,this[g]={},this[m]=()=>{let e=this[uH].changeSource;this[u5]=e,e===dd.USER_INTERACTION&&(this[u2]=!0,this[uX]())},this[f]=()=>{this[uj](),this[p$]();let e=this[uH].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:e}}))},this[v]=e=>{this[pY].classList.toggle("pointer-tumbling","pointer-change-start"===e.type)}}}return uS([eo({type:Boolean,attribute:"camera-controls"})],_.prototype,"cameraControls",void 0),uS([u_({intrinsics:uU,observeEffects:!0,updateHandler:de}),eo({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],_.prototype,"cameraOrbit",void 0),uS([u_({intrinsics:uF,observeEffects:!0,updateHandler:di}),eo({type:String,attribute:"camera-target",hasChanged:()=>!0})],_.prototype,"cameraTarget",void 0),uS([u_({intrinsics:uL,observeEffects:!0,updateHandler:dt}),eo({type:String,attribute:"field-of-view",hasChanged:()=>!0})],_.prototype,"fieldOfView",void 0),uS([u_({intrinsics:uP,updateHandler:dn}),eo({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],_.prototype,"minCameraOrbit",void 0),uS([u_({intrinsics:uN,updateHandler:dr}),eo({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],_.prototype,"maxCameraOrbit",void 0),uS([u_({intrinsics:uD,updateHandler:da}),eo({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],_.prototype,"minFieldOfView",void 0),uS([u_({intrinsics:uL,updateHandler:ds}),eo({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],_.prototype,"maxFieldOfView",void 0),uS([eo({type:Number,attribute:"interaction-prompt-threshold"})],_.prototype,"interactionPromptThreshold",void 0),uS([eo({type:String,attribute:"interaction-prompt"})],_.prototype,"interactionPrompt",void 0),uS([eo({type:String,attribute:"interaction-prompt-style"})],_.prototype,"interactionPromptStyle",void 0),uS([eo({type:Number,attribute:"orbit-sensitivity"})],_.prototype,"orbitSensitivity",void 0),uS([eo({type:Number,attribute:"zoom-sensitivity"})],_.prototype,"zoomSensitivity",void 0),uS([eo({type:Number,attribute:"pan-sensitivity"})],_.prototype,"panSensitivity",void 0),uS([eo({type:String,attribute:"touch-action"})],_.prototype,"touchAction",void 0),uS([eo({type:Boolean,attribute:"disable-zoom"})],_.prototype,"disableZoom",void 0),uS([eo({type:Boolean,attribute:"disable-pan"})],_.prototype,"disablePan",void 0),uS([eo({type:Boolean,attribute:"disable-tap"})],_.prototype,"disableTap",void 0),uS([eo({type:Number,attribute:"interpolation-decay"})],_.prototype,"interpolationDecay",void 0),uS([eo()],_.prototype,"a11y",void 0),_})((e=>{var t,i,n,r,a,s,o,l,h,c;class u extends e{get canActivateAR(){return this[m6]!==m1.NONE}connectedCallback(){super.connectedCallback(),this[p3].arRenderer.addEventListener("status",this[fi]),this.setAttribute("ar-status",dp.NOT_PRESENTING),this[p3].arRenderer.addEventListener("tracking",this[fn]),this[m7].addEventListener("message",this[fr])}disconnectedCallback(){super.disconnectedCallback(),this[p3].arRenderer.removeEventListener("status",this[fi]),this[p3].arRenderer.removeEventListener("tracking",this[fn]),this[m7].removeEventListener("message",this[fr])}update(e){super.update(e),e.has("arScale")&&(this[pZ].canScale="fixed"!==this.arScale),e.has("arPlacement")&&(this[pZ].updateShadow(),this[p$]()),e.has("arModes")&&(this[m9]=m0(this.arModes)),(e.has("ar")||e.has("arModes")||e.has("src")||e.has("iosSrc"))&&this[fa]()}async activateAR(){switch(this[m6]){case m1.QUICK_LOOK:await this[m5]();break;case m1.WEBXR:await this[m3]();break;case m1.SCENE_VIEWER:this[m4]();break;default:console.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async [(t=m8,i=m2,n=m7,r=m9,a=m6,s=fe,o=ft,l=fi,h=fn,c=fr,fa)](){var e;let t=m1.NONE;if(this.ar){if(null!=this.src)for(let i of this[m9]){if("webxr"===i&&ll&&!mJ&&await this[p3].arRenderer.supportsPresentation()){t=m1.WEBXR;break}if("scene-viewer"===i&&!mZ&&(lg||navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues&&(null==(e=(await navigator.userAgentData.getHighEntropyValues(["formFactor"])).formFactor)?void 0:e.includes("XR")))){t=m1.SCENE_VIEWER;break}if("quick-look"===i&&lf){t=m1.QUICK_LOOK;break}}t===m1.NONE&&null!=this.iosSrc&&lf&&(t=m1.QUICK_LOOK)}if(t!==m1.NONE)this[m2].classList.add("enabled"),this[m2].addEventListener("click",this[ft]);else if(this[m2].classList.contains("enabled")){this[m2].removeEventListener("click",this[ft]),this[m2].classList.remove("enabled");let e=dp.FAILED;this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}}))}this[m6]=t}async [m3](){console.log("Attempting to present in AR with WebXR..."),await this[fs]();try{this[m2].removeEventListener("click",this[ft]);let{arRenderer:e}=this[p3];e.placeOnWall="wall"===this.arPlacement,await e.present(this[pZ],this.xrEnvironment)}catch(e){console.warn("Error while trying to present in AR with WebXR"),console.error(e),await this[p3].arRenderer.stopPresenting(),mJ=!0,console.warn("Falling back to next ar-mode"),await this[fa](),this.activateAR()}finally{this[fa]()}}async [fs](){this.loaded||(this[fe]=!0,this[pX](),await lM(this,"load"),this[fe]=!1)}[p6](){return super[p6]()||this[fe]}[m4](){let e=self.location.toString(),t=new URL(e),i=new URL(this.src,e);i.hash&&(i.hash="");let n=new URLSearchParams(i.search);if(t.hash=m$,n.set("mode","ar_preferred"),n.has("disable_occlusion")||n.set("disable_occlusion","true"),"fixed"===this.arScale&&n.set("resizable","false"),"wall"===this.arPlacement&&n.set("enable_vertical_placement","true"),n.has("sound")){let t=new URL(n.get("sound"),e);n.set("sound",t.toString())}if(n.has("link")){let t=new URL(n.get("link"),e);n.set("link",t.toString())}let r="intent://arvr.google.com/scene-viewer/1.2?".concat(n.toString()+"&file="+encodeURIComponent(i.toString()),"#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=").concat(encodeURIComponent(t.toString()),";end;"),a=()=>{self.location.hash===m$&&(mZ=!0,self.history.back(),console.warn("Error while trying to present in AR with Scene Viewer"),console.warn("Falling back to next ar-mode"),this[fa]())};self.addEventListener("hashchange",a,{once:!0}),this[m7].setAttribute("href",r),console.log("Attempting to present in AR with Scene Viewer..."),this[m7].click()}async [m5](){let e=!this.iosSrc;this[m2].classList.remove("enabled");let t=e?await this.prepareUSDZ():this.iosSrc,i=new URL(t,self.location.toString());if(e){let e=new URL(self.location.toString()),t=new URL(this.src,e);t.hash&&(i.hash=t.hash)}"fixed"===this.arScale&&(i.hash&&(i.hash+="&"),i.hash+="allowsContentScaling=0");let n=this[m7];n.setAttribute("rel","ar");let r=document.createElement("img");n.appendChild(r),n.setAttribute("href",i.toString()),e&&n.setAttribute("download","model.usdz"),n.style.display="none",n.isConnected||this.shadowRoot.appendChild(n),console.log("Attempting to present in AR with Quick Look..."),n.click(),n.removeChild(r),e&&URL.revokeObjectURL(t),this[m2].classList.add("enabled")}async prepareUSDZ(){let e=this[p4].beginActivity("usdz-conversion");await this[fs]();let{model:t,shadow:i,target:n}=this[pZ];if(null==t)return"";let r=!1;null!=i&&(r=i.visible,i.visible=!1),e(.2);let a=new mz;n.remove(t),t.position.copy(n.position),t.updateWorldMatrix(!1,!0);let s=await a.parse(t);t.position.set(0,0,0),n.add(t);let o=new Blob([s],{type:"model/vnd.usdz+zip"}),l=URL.createObjectURL(o);return e(1),null!=i&&(i.visible=r),l}constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arPlacement="floor",this.arModes="webxr scene-viewer quick-look",this.iosSrc=null,this.xrEnvironment=!1,this[t]=!1,this[i]=this.shadowRoot.querySelector(".ar-button"),this[n]=document.createElement("a"),this[r]=new Set,this[a]=m1.NONE,this[s]=!1,this[o]=e=>{e.preventDefault(),this.activateAR()},this[l]=e=>{let{status:t}=e;(t===dp.NOT_PRESENTING||this[p3].arRenderer.presentedScene===this[pZ])&&(this.setAttribute("ar-status",t),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:t}})),t===dp.NOT_PRESENTING?this.removeAttribute("ar-tracking"):t===dp.SESSION_STARTED&&this.setAttribute("ar-tracking",dg.TRACKING))},this[h]=e=>{let{status:t}=e;this.setAttribute("ar-tracking",t),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:t}}))},this[c]=e=>{"_apple_ar_quicklook_button_tapped"==e.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}}return mK([eo({type:Boolean,attribute:"ar"})],u.prototype,"ar",void 0),mK([eo({type:String,attribute:"ar-scale"})],u.prototype,"arScale",void 0),mK([eo({type:String,attribute:"ar-placement"})],u.prototype,"arPlacement",void 0),mK([eo({type:String,attribute:"ar-modes"})],u.prototype,"arModes",void 0),mK([eo({type:String,attribute:"ios-src"})],u.prototype,"iosSrc",void 0),mK([eo({type:Boolean,attribute:"xr-environment"})],u.prototype,"xrEnvironment",void 0),u})((e=>{var t,i,n,r,a,s,o,l;class h extends e{static set dracoDecoderLocation(e){h4.setDRACODecoderLocation(e)}static get dracoDecoderLocation(){return h4.getDRACODecoderLocation()}static set ktx2TranscoderLocation(e){h4.setKTX2TranscoderLocation(e)}static get ktx2TranscoderLocation(){return h4.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(e){h4.setMeshoptDecoderLocation(e)}static get meshoptDecoderLocation(){return h4.getMeshoptDecoderLocation()}static set lottieLoaderLocation(e){d3.singleton.textureUtils.lottieLoaderUrl=e}static get lottieLoaderLocation(){return d3.singleton.textureUtils.lottieLoaderUrl}static mapURLs(e){d3.singleton.loader[h1].manager.setURLModifier(e)}dismissPoster(){this.loaded?this[fp]():(this[fA]=!0,this[pX]())}showPoster(){let e=this[fu];if(e.classList.contains("show"))return;e.classList.add("show"),this[pK].classList.remove("show");let t=this[fd];t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden");let i=this.modelIsVisible;this[fg]=!1,this[pG](i)}getDimensions(){return p9(this[pZ].size)}getBoundingBoxCenter(){return p9(this[pZ].boundingBox.getCenter(new eZ))}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[p4].addEventListener("progress",this[fv])}disconnectedCallback(){super.disconnectedCallback(),this[p4].removeEventListener("progress",this[fv])}async updated(e){super.updated(e),e.has("poster")&&null!=this.poster&&(this[fd].style.backgroundImage="url(".concat(this.poster,")")),e.has("alt")&&this[fd].setAttribute("aria-label",this[pz]),(e.has("reveal")||e.has("loading"))&&this[pX]()}[(t=fg,i=fA,n=fu,r=fd,a=fc,s=ff,o=fm,l=fv,p6)](){return!!this.src&&(this[fA]||this.loading===fh.EAGER||this.reveal===fl.AUTO&&this[pk])}[fp](){this[fA]=!1;let e=this[fu];if(!e.classList.contains("show"))return;e.classList.remove("show"),this[pK].classList.add("show");let t=this.modelIsVisible;this[fg]=!0,this[pG](t);let i=this.getRootNode();i&&i.activeElement===this&&this[pK].focus();let n=this[fd];n.setAttribute("aria-hidden","true"),n.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[p8](){return super[p8]()&&this[fg]}constructor(...e){super(...e),this.poster=null,this.reveal=fl.AUTO,this.loading=fh.AUTO,this[t]=!1,this[i]=!1,this[n]=this.shadowRoot.querySelector(".slot.poster"),this[r]=this.shadowRoot.querySelector("#default-poster"),this[a]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[s]=this[fd].getAttribute("aria-label"),this[o]=((e,t)=>{let i=null,n=function(){for(var n=arguments.length,r=Array(n),a=0;ai=null,t))};return n.flush=()=>{null!=i&&(self.clearTimeout(i),i=null)},n})(e=>{let t=this[fc].parentNode;requestAnimationFrame(()=>{this[fc].style.transform="scaleX(".concat(e,")"),0===e&&(t.removeChild(this[fc]),t.appendChild(this[fc])),this[fc].classList.toggle("hide",1===e)})},100),this[l]=e=>{let t=e.detail.totalProgress,i=e.detail.reason;1===t&&(this[fm].flush(),this.loaded&&(this[fA]||this.reveal===fl.AUTO)&&this[fp]()),this[fm](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t,reason:i}}))};let h=self.ModelViewerElement||{},c=h.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.5.6/";h4.setDRACODecoderLocation(c);let u=h.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";h4.setKTX2TranscoderLocation(u),h.meshoptDecoderLocation&&h4.setMeshoptDecoderLocation(h.meshoptDecoderLocation);let d=h.lottieLoaderLocation||"https://cdn.jsdelivr.net/npm/three@0.149.0/examples/jsm/loaders/LottieLoader.js";d3.singleton.textureUtils.lottieLoaderUrl=d}}return fo([eo({type:String})],h.prototype,"poster",void 0),fo([eo({type:String})],h.prototype,"reveal",void 0),fo([eo({type:String})],h.prototype,"loading",void 0),h})((e=>{var t;class i extends e{get availableAnimations(){return this.loaded?this[pZ].animationNames:[]}get duration(){return this[pZ].duration}get paused(){return this[gn]}get currentTime(){return this[pZ].animationTime}set currentTime(e){this[pZ].animationTime=e,this[p$]()}get timeScale(){return this[pZ].animationTimeScale}set timeScale(e){this[pZ].animationTimeScale=e}pause(){this[gn]||(this[gn]=!0,this.dispatchEvent(new CustomEvent("pause")))}play(e){this.availableAnimations.length>0&&(this[gn]=!1,this[gi](e),this.dispatchEvent(new CustomEvent("play")))}[(t=gn,p1)](){super[p1](),this[gn]=!0,null!=this.animationName&&this[gi](),this.autoplay&&this.play()}[p0](e,t){super[p0](e,t),!this[gn]&&(this[p8]()||this[p3].isPresenting)&&(this[pZ].updateAnimation(t/1e3),this[p$]())}updated(e){super.updated(e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[gi]()}[gi](){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:gr,i=null!=(e=t.repetitions)?e:1/0,n=t.pingpong?2202:1===i?2200:2201;this[pZ].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3,n,i),this[gn]&&(this[pZ].updateAnimation(0),this[p$]())}constructor(...e){super(e),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[t]=!0,this[pZ].subscribeMixerEvent("loop",e=>{let t=e.action._loopCount;this.dispatchEvent(new CustomEvent("loop",{detail:{count:t}}))}),this[pZ].subscribeMixerEvent("finished",()=>{this[gn]=!0,this.dispatchEvent(new CustomEvent("finished"))})}}return gt([eo({type:Boolean})],i.prototype,"autoplay",void 0),gt([eo({type:String,attribute:"animation-name"})],i.prototype,"animationName",void 0),gt([eo({type:Number,attribute:"animation-crossfade-duration"})],i.prototype,"animationCrossfadeDuration",void 0),i})(ge))))))));customElements.define("model-viewer",fI);var fM=e.i(63871);function fw(e){let{modelUrl:t,environmentImageUrl:i,showEnvironment:n=!1,exposure:r=1,animationName:a,animationPaused:s=!1,timeScale:o=1,cameraOrbit:l,cameraTarget:h,fieldOfView:c,children:u}=e,[d,A]=(0,es.useState)(null),[p,g]=(0,es.useState)(!1),m=(0,es.useMemo)(()=>d&&p&&d.model?{modelViewer:d,model:d.model,isLoaded:p}:null,[d,p]);return(0,es.useEffect)(()=>{d&&(d.timeScale=o)},[d,o]),(0,es.useEffect)(()=>{if(!d)return;let e=!1,t=()=>{e||g(!0)};return d.addEventListener("load",t),()=>{e=!0,d.removeEventListener("load",t)}},[d,t]),!p&&d&&d.loaded&&g(!0),(0,es.useEffect)(()=>{d&&p&&(s?d.pause():d.play())},[d,p,s]),(0,es.useEffect)(()=>{d&&p&&c&&d.setAttribute("field-of-view",c)},[d,p,c]),(0,ea.jsxs)(ea.Fragment,{children:[(0,ea.jsx)("model-viewer",{ref:A,alt:"Tribes 2 Model",src:t,"camera-controls":!0,"camera-orbit":l,"max-camera-orbit":i&&n?"auto 90deg auto":void 0,"camera-target":h,"min-field-of-view":"10deg","max-field-of-view":"45deg","animation-name":null!=a?a:void 0,autoplay:null!=a,"touch-action":"pan-y",exposure:r,"environment-image":null!=i?i:void 0,"skybox-image":i&&n?i:void 0,"skybox-height":"1.5m","shadow-intensity":i&&n?1:0,style:{width:"100%",height:"100%"}}),p?(0,ea.jsx)(fM.ModelViewerContext.Provider,{value:m,children:u}):null]})}function fb(e){return(0,ea.jsx)(fw,{...e},e.modelUrl)}},66641,e=>{e.n(e.i(76148))}]);