mirror of
https://github.com/exogen/t2-model-skinner.git
synced 2026-01-19 19:24:44 +00:00
1 line
902 KiB
JavaScript
1 line
902 KiB
JavaScript
(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<n;t++)i[t].call(this,e);e.target=null}}}let ev=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],e_=Math.PI/180,ey=180/Math.PI;function eE(){let e=0xffffffff*Math.random()|0,t=0xffffffff*Math.random()|0,i=0xffffffff*Math.random()|0,n=0xffffffff*Math.random()|0;return(ev[255&e]+ev[e>>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;e<r.length;e++)r[e]=255*eQ(r[e]/255);return i.putImageData(n,0,0),t}if(!e.data)return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e;{let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*eQ(t[e]/255)):t[e]=eQ(t[e]);return{data:t,width:e.width,height:e.height}}}}let eG=0;class eH{set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let e;if(Array.isArray(n)){e=[];for(let t=0,i=n.length;t<i;t++)n[t].isDataTexture?e.push(ez(n[t].image)):e.push(ez(n[t]))}else e=ez(n);i.url=e}return t||(e.images[this.uuid]=i),i}constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:eG++}),this.uuid=eE(),this.data=e,this.dataReady=!0,this.version=0}}function ez(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?ek.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let eV=0;class eW extends ef{get image(){return this.source.data}set image(e){void 0===e&&(e=null),this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),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<r;n++)this.textures[n].image.width=e,this.textures[n].image.height=t,this.textures[n].image.depth=i;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,i=e.textures.length;t<i;t++)this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0;let t=Object.assign({},e.texture.image);return this.texture.source=new eH(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new eq(0,0,e,t),this.scissorTest=!1,this.viewport=new eq(0,0,e,t);let n=new eW({width:e,height:t,depth:1},(i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},i)).mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);n.flipY=!1,n.generateMipmaps=i.generateMipmaps,n.internalFormat=i.internalFormat,this.textures=[];let r=i.count;for(let e=0;e<r;e++)this.textures[e]=n.clone(),this.textures[e].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}}class ej extends eX{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class eY extends eW{constructor(e=null,t=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class eK extends eW{constructor(e=null,t=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class eJ{static slerpFlat(e,t,i,n,r,a,s){let o=i[n+0],l=i[n+1],h=i[n+2],c=i[n+3],u=r[a+0],d=r[a+1],A=r[a+2],p=r[a+3];if(0===s){e[t+0]=o,e[t+1]=l,e[t+2]=h,e[t+3]=c;return}if(1===s){e[t+0]=u,e[t+1]=d,e[t+2]=A,e[t+3]=p;return}if(c!==p||o!==u||l!==d||h!==A){let e=1-s,t=o*u+l*d+h*A+c*p,i=t>=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 i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.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;t<i;t+=3)this.expandByPoint(e3.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(e3.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=e3.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e){let t=arguments.length>1&&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.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e){let t=arguments.length>1&&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;t<i;t++)!0===e.isMesh?e.getVertexPosition(t,e3):e3.fromBufferAttribute(n,t),e3.applyMatrix4(e.matrixWorld),this.expandByPoint(e3);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),e4.copy(e.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),e4.copy(i.boundingBox)),e4.applyMatrix4(e.matrixWorld),this.union(e4)}let n=e.children;for(let e=0,i=n.length;e<i;e++)this.expandByObject(n[e],t);return this}containsPoint(e){return!(e.x<this.min.x)&&!(e.x>this.max.x)&&!(e.y<this.min.y)&&!(e.y>this.max.y)&&!(e.z<this.min.z)&&!(e.z>this.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.x<this.min.x)&&!(e.min.x>this.max.x)&&!(e.max.y<this.min.y)&&!(e.min.y>this.max.y)&&!(e.max.z<this.min.z)&&!(e.min.z>this.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;t<r;t++)n=Math.max(n,i.distanceToSquared(e[t]));return this.radius=Math.sqrt(n),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>this.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<n||isNaN(n))&&(n=a),c>=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<n||n!=n)&&(n=o),n<0)))?null:this.at(i>=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<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&1<<e)!=0}constructor(){this.mask=1}}let tB=0,tR=new eZ,tL=new eJ,tD=new tv,tU=new eZ,tP=new eZ,tN=new eZ,tF=new eJ,tQ=new eZ(1,0,0),tO=new eZ(0,1,0),tk=new eZ(0,0,1),tG={type:"added"},tH={type:"removed"},tz={type:"childadded",child:null},tV={type:"childremoved",child:null};class tW extends ef{onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return tL.setFromAxisAngle(e,t),this.quaternion.multiply(tL),this}rotateOnWorldAxis(e,t){return tL.setFromAxisAngle(e,t),this.quaternion.premultiply(tL),this}rotateX(e){return this.rotateOnAxis(tQ,e)}rotateY(e){return this.rotateOnAxis(tO,e)}rotateZ(e){return this.rotateOnAxis(tk,e)}translateOnAxis(e,t){return tR.copy(e).applyQuaternion(this.quaternion),this.position.add(tR.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(tQ,e)}translateY(e){return this.translateOnAxis(tO,e)}translateZ(e){return this.translateOnAxis(tk,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(tD.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?tU.copy(e):tU.set(e,t,i);let n=this.parent;this.updateWorldMatrix(!0,!1),tP.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?tD.lookAt(tP,tU,this.up):tD.lookAt(tU,tP,this.up),this.quaternion.setFromRotationMatrix(tD),n&&(tD.extractRotation(n.matrixWorld),tL.setFromRotationMatrix(tD),this.quaternion.premultiply(tL.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(tG),tz.child=e,this.dispatchEvent(tz),tz.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return -1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(tH),tV.child=e,this.dispatchEvent(tV),tV.child=null),this}removeFromParent(){let e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),tD.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),tD.multiply(e.parent.matrixWorld)),e.applyMatrix4(tD),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(tG),tz.child=e,this.dispatchEvent(tz),tz.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,n=this.children.length;i<n;i++){let n=this.children[i].getObjectByProperty(e,t);if(void 0!==n)return n}}getObjectsByProperty(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];this[e]===t&&i.push(this);let n=this.children;for(let r=0,a=n.length;r<a;r++)n[r].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(tP,e,tN),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(tP,tF,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);let t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverseVisible(e)}traverseAncestors(e){let t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let i=0,n=t.length;i<n;i++){let n=t[i];(!0===n.matrixWorldAutoUpdate||!0===e)&&n.updateMatrixWorld(e)}}updateWorldMatrix(e,t){let i=this.parent;if(!0===e&&null!==i&&!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t){let e=this.children;for(let t=0,i=e.length;t<i;t++){let i=e[t];!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!1,!0)}}}toJSON(e){let t=void 0===e||"string"==typeof e,i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let n={};function r(t,i){return void 0===t[i.uuid]&&(t[i.uuid]=i.toJSON(e)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.visibility=this._visibility,n.active=this._active,n.bounds=this._bounds.map(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;t<n;t++){let n=i[t];r(e.shapes,n)}else r(e.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){let t=[];for(let i=0,n=this.material.length;i<n;i++)t.push(r(e.materials,this.material[i]));n.material=t}else n.material=r(e.materials,this.material);if(this.children.length>0){n.children=[];for(let t=0;t<this.children.length;t++)n.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){n.animations=[];for(let t=0;t<this.animations.length;t++){let i=this.animations[t];n.animations.push(r(e.animations,i))}}if(t){let t=a(e.geometries),n=a(e.materials),r=a(e.textures),s=a(e.images),o=a(e.shapes),l=a(e.skeletons),h=a(e.animations),c=a(e.nodes);t.length>0&&(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;t<e.children.length;t++){let i=e.children[t];this.add(i.clone())}return this}constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:tB++}),this.uuid=eE(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=tW.DEFAULT_UP.clone();let e=new eZ,t=new tb,i=new eJ,n=new eZ(1,1,1);t._onChange(function(){i.setFromEuler(t,!1)}),i._onChange(function(){t.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new tv},normalMatrix:{value:new ew}}),this.matrix=new tv,this.matrixWorld=new tv,this.matrixAutoUpdate=tW.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=tW.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new tT,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}}tW.DEFAULT_UP=new eZ(0,1,0),tW.DEFAULT_MATRIX_AUTO_UPDATE=!0,tW.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let tq=new eZ,tX=new eZ,tj=new eZ,tY=new eZ,tK=new eZ,tJ=new eZ,tZ=new eZ,t$=new eZ,t0=new eZ,t1=new eZ;class t2{static getNormal(e,t,i,n){n.subVectors(i,t),tq.subVectors(e,t),n.cross(tq);let r=n.lengthSq();return r>0?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*(a<s);break;case a:t=(s-r)/e+2;break;case s:t=(r-a)/e+4}t/=6}return e.h=t,e.s=i,e.l=h,e}getRGB(e){let t=arguments.length>1&&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;n<r;n++)this.array[e+n]=t.array[i+n];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,i=this.count;t<i;t++)is.fromBufferAttribute(this,t),is.applyMatrix3(e),this.setXY(t,is.x,is.y);else if(3===this.itemSize)for(let t=0,i=this.count;t<i;t++)ia.fromBufferAttribute(this,t),ia.applyMatrix3(e),this.setXYZ(t,ia.x,ia.y,ia.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)ia.fromBufferAttribute(this,t),ia.applyMatrix4(e),this.setXYZ(t,ia.x,ia.y,ia.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)ia.fromBufferAttribute(this,t),ia.applyNormalMatrix(e),this.setXYZ(t,ia.x,ia.y,ia.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)ia.fromBufferAttribute(this,t),ia.transformDirection(e),this.setXYZ(t,ia.x,ia.y,ia.z);return this}set(e){let t=arguments.length>1&&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;i<n;i++){let n=e[i];t.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new ic(t,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new e1);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new eZ(-1/0,-1/0,-1/0),new eZ(Infinity,Infinity,Infinity));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){let i=t[e];ig.setFromBufferAttribute(i),this.morphTargetsRelative?(iv.addVectors(this.boundingBox.min,ig.min),this.boundingBox.expandByPoint(iv),iv.addVectors(this.boundingBox.max,ig.max),this.boundingBox.expandByPoint(iv)):(this.boundingBox.expandByPoint(ig.min),this.boundingBox.expandByPoint(ig.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new th);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new eZ,1/0);return}if(e){let i=this.boundingSphere.center;if(ig.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){let i=t[e];im.setFromBufferAttribute(i),this.morphTargetsRelative?(iv.addVectors(ig.min,im.min),ig.expandByPoint(iv),iv.addVectors(ig.max,im.max),ig.expandByPoint(iv)):(ig.expandByPoint(im.min),ig.expandByPoint(im.max))}ig.getCenter(i);let n=0;for(let t=0,r=e.count;t<r;t++)iv.fromBufferAttribute(e,t),n=Math.max(n,i.distanceToSquared(iv));if(t)for(let r=0,a=t.length;r<a;r++){let a=t[r],s=this.morphTargetsRelative;for(let t=0,r=a.count;t<r;t++)iv.fromBufferAttribute(a,t),s&&(ip.fromBufferAttribute(e,t),iv.add(ip)),n=Math.max(n,i.distanceToSquared(iv))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");let i=t.position,n=t.normal,r=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new io(new Float32Array(4*i.count),4));let a=this.getAttribute("tangent"),s=[],o=[];for(let e=0;e<i.count;e++)s[e]=new eZ,o[e]=new eZ;let l=new eZ,h=new eZ,c=new eZ,u=new eM,d=new eM,A=new eM,p=new eZ,g=new eZ,m=this.groups;0===m.length&&(m=[{start:0,count:e.count}]);for(let t=0,n=m.length;t<n;++t){let n=m[t],a=n.start,f=n.count;for(let t=a,n=a+f;t<n;t+=3)!function(e,t,n){l.fromBufferAttribute(i,e),h.fromBufferAttribute(i,t),c.fromBufferAttribute(i,n),u.fromBufferAttribute(r,e),d.fromBufferAttribute(r,t),A.fromBufferAttribute(r,n),h.sub(l),c.sub(l),d.sub(u),A.sub(u);let a=1/(d.x*A.y-A.x*d.y);isFinite(a)&&(p.copy(h).multiplyScalar(A.y).addScaledVector(c,-d.y).multiplyScalar(a),g.copy(c).multiplyScalar(d.x).addScaledVector(h,-A.x).multiplyScalar(a),s[e].add(p),s[t].add(p),s[n].add(p),o[e].add(g),o[t].add(g),o[n].add(g))}(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let f=new eZ,v=new eZ,_=new eZ,y=new eZ;function E(e){_.fromBufferAttribute(n,e),y.copy(_);let t=s[e];f.copy(t),f.sub(_.multiplyScalar(_.dot(t))).normalize(),v.crossVectors(y,t);let i=v.dot(o[e]);a.setXYZW(e,f.x,f.y,f.z,i<0?-1:1)}for(let t=0,i=m.length;t<i;++t){let i=m[t],n=i.start,r=i.count;for(let t=n,i=n+r;t<i;t+=3)E(e.getX(t+0)),E(e.getX(t+1)),E(e.getX(t+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(void 0!==t){let i=this.getAttribute("normal");if(void 0===i)i=new io(new Float32Array(3*t.count),3),this.setAttribute("normal",i);else for(let e=0,t=i.count;e<t;e++)i.setXYZ(e,0,0,0);let n=new eZ,r=new eZ,a=new eZ,s=new eZ,o=new eZ,l=new eZ,h=new eZ,c=new eZ;if(e)for(let u=0,d=e.count;u<d;u+=3){let d=e.getX(u+0),A=e.getX(u+1),p=e.getX(u+2);n.fromBufferAttribute(t,d),r.fromBufferAttribute(t,A),a.fromBufferAttribute(t,p),h.subVectors(a,r),c.subVectors(n,r),h.cross(c),s.fromBufferAttribute(i,d),o.fromBufferAttribute(i,A),l.fromBufferAttribute(i,p),s.add(h),o.add(h),l.add(h),i.setXYZ(d,s.x,s.y,s.z),i.setXYZ(A,o.x,o.y,o.z),i.setXYZ(p,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)n.fromBufferAttribute(t,e+0),r.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),h.subVectors(a,r),c.subVectors(n,r),h.cross(c),i.setXYZ(e+0,h.x,h.y,h.z),i.setXYZ(e+1,h.x,h.y,h.z),i.setXYZ(e+2,h.x,h.y,h.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)iv.fromBufferAttribute(e,t),iv.normalize(),e.setXYZ(t,iv.x,iv.y,iv.z)}toNonIndexed(){function e(e,t){let i=e.array,n=e.itemSize,r=e.normalized,a=new i.constructor(t.length*n),s=0,o=0;for(let r=0,l=t.length;r<l;r++){s=e.isInterleavedBufferAttribute?t[r]*e.data.stride+e.offset:t[r]*n;for(let e=0;e<n;e++)a[o++]=i[s++]}return new io(a,n,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new i_,i=this.index.array,n=this.attributes;for(let r in n){let a=e(n[r],i);t.setAttribute(r,a)}let r=this.morphAttributes;for(let n in r){let a=[],s=r[n];for(let t=0,n=s.length;t<n;t++){let n=e(s[t],i);a.push(n)}t.morphAttributes[n]=a}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let e=0,i=a.length;e<i;e++){let i=a[e];t.addGroup(i.start,i.count,i.materialIndex)}return t}toJSON(){let e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(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;t<n;t++){let n=i[t];a.push(n.toJSON(e.data))}a.length>0&&(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;e<r;e++)i.push(n[e].clone(t));this.morphAttributes[e]=i}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());let o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:iu++}),this.uuid=eE(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}}let iy=new tv,iE=new tf,ix=new th,iS=new eZ,iC=new eZ,iI=new eZ,iM=new eZ,iw=new eZ,ib=new eZ,iT=new eM,iB=new eM,iR=new eM,iL=new eZ,iD=new eZ,iU=new eZ,iP=new eZ,iN=new eZ;class iF extends tW{copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,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;e<t;e++){let t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let i=this.geometry,n=i.attributes.position,r=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(n,e);let s=this.morphTargetInfluences;if(r&&s){ib.set(0,0,0);for(let i=0,n=r.length;i<n;i++){let n=s[i],o=r[i];0!==n&&(iw.fromBufferAttribute(o,e),a?ib.addScaledVector(iw,n):ib.addScaledVector(iw.sub(t),n))}t.add(ib)}return t}raycast(e,t){let i=this.geometry,n=this.material,r=this.matrixWorld;if(void 0!==n)null===i.boundingSphere&&i.computeBoundingSphere(),ix.copy(i.boundingSphere),ix.applyMatrix4(r),iE.copy(e.ray).recast(e.near),!1===ix.containsPoint(iE.origin)&&(null===iE.intersectSphere(ix,iS)||iE.origin.distanceToSquared(iS)>(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;r<o;r++){let o=u[r],A=a[o.materialIndex],p=Math.max(o.start,d.start),g=Math.min(s.count,Math.min(o.start+o.count,d.start+d.count));for(let r=p;r<g;r+=3){let a=s.getX(r);(n=iQ(this,A,e,i,l,h,c,a,s.getX(r+1),s.getX(r+2)))&&(n.faceIndex=Math.floor(r/3),n.face.materialIndex=o.materialIndex,t.push(n))}}else{let r=Math.max(0,d.start),o=Math.min(s.count,d.start+d.count);for(let u=r;u<o;u+=3){let r=s.getX(u);(n=iQ(this,a,e,i,l,h,c,r,s.getX(u+1),s.getX(u+2)))&&(n.faceIndex=Math.floor(u/3),t.push(n))}}else if(void 0!==o)if(Array.isArray(a))for(let r=0,s=u.length;r<s;r++){let s=u[r],A=a[s.materialIndex],p=Math.max(s.start,d.start),g=Math.min(o.count,Math.min(s.start+s.count,d.start+d.count));for(let r=p;r<g;r+=3)(n=iQ(this,A,e,i,l,h,c,r,r+1,r+2))&&(n.faceIndex=Math.floor(r/3),n.face.materialIndex=s.materialIndex,t.push(n))}else{let r=Math.max(0,d.start),s=Math.min(o.count,d.start+d.count);for(let o=r;o<s;o+=3)(n=iQ(this,a,e,i,l,h,c,o,o+1,o+2))&&(n.faceIndex=Math.floor(o/3),t.push(n))}}constructor(e=new i_,t=new it){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}}function iQ(e,t,i,n,r,a,s,o,l,h){e.getVertexPosition(o,iC),e.getVertexPosition(l,iI),e.getVertexPosition(h,iM);let c=function(e,t,i,n,r,a,s,o){if(null===(1===t.side?n.intersectTriangle(s,a,r,!0,o):n.intersectTriangle(r,a,s,0===t.side,o)))return null;iN.copy(o),iN.applyMatrix4(e.matrixWorld);let l=i.ray.origin.distanceTo(iN);return l<i.near||l>i.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;a<C;a++){let s=a*_-E;for(let o=0;o<S;o++){let u=o*v-y;w[e]=u*n,w[t]=s*r,w[i]=x,l.push(w.x,w.y,w.z),w[e]=0,w[t]=0,w[i]=p>0?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;e<m;e++)for(let t=0;t<g;t++){let i=u+t+S*e,n=u+t+S*(e+1),r=u+(t+1)+S*(e+1),a=u+(t+1)+S*e;o.push(i,n,a),o.push(n,r,a),M+=6}s.addGroup(d,M,f),d+=M,u+=I}A("z","y","x",-1,-1,i,t,e,a=Math.floor(a),r,0),A("z","y","x",1,-1,i,t,-e,a,r,1),A("x","z","y",1,1,e,i,t,n,a,2),A("x","z","y",1,-1,e,i,-t,n,a,3),A("x","y","z",1,-1,e,t,i,n,r,4),A("x","y","z",-1,-1,e,t,-i,n,r,5),this.setIndex(o),this.setAttribute("position",new ic(l,3)),this.setAttribute("normal",new ic(h,3)),this.setAttribute("uv",new ic(c,2))}}function ik(e){let t={};for(let i in e)for(let n in t[i]={},e[i]){let r=e[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[i][n]=null):t[i][n]=r.clone():Array.isArray(r)?t[i][n]=r.slice():t[i][n]=r}return t}function iG(e){let t={};for(let i=0;i<e.length;i++){let n=ik(e[i]);for(let e in n)t[e]=n[e]}return t}function iH(e){let t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:eF.workingColorSpace}let iz={clone:ik};class iV extends ie{copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ik(e.uniforms),this.uniformsGroups=function(e){let t=[];for(let i=0;i<e.length;i++)t.push(e[i].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);for(let i in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){let n=this.uniforms[i].value;n&&n.isTexture?t.uniforms[i]={type:"t",value:n.toJSON(e).uuid}:n&&n.isColor?t.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?t.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?t.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?t.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?t.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?t.uniforms[i]={type:"m4",value:n.toArray()}:t.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(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 <begin_vertex>\n #include <project_vertex>\n\n }\n ",fragmentShader:"\n\n uniform sampler2D tEquirect;\n\n varying vec3 vWorldDirection;\n\n #include <common>\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)<n)return!1;return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let n=t[i];if(i4.x=n.normal.x>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<i.version)&&t.set(i,{buffer:i.buffer,type:i.type,bytesPerElement:i.elementSize,version:i.version});return}i.isInterleavedBufferAttribute&&(i=i.data);let r=t.get(i);if(void 0===r)t.set(i,function(t,i){let n,r=t.array,a=t.usage,s=r.byteLength,o=e.createBuffer();if(e.bindBuffer(i,o),e.bufferData(i,r,a),t.onUploadCallback(),r instanceof Float32Array)n=e.FLOAT;else if(r instanceof Uint16Array)n=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(r instanceof Int16Array)n=e.SHORT;else if(r instanceof Uint32Array)n=e.UNSIGNED_INT;else if(r instanceof Int32Array)n=e.INT;else if(r instanceof Int8Array)n=e.BYTE;else if(r instanceof Uint8Array)n=e.UNSIGNED_BYTE;else if(r instanceof Uint8ClampedArray)n=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);return{buffer:o,type:n,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version,size:s}}(i,n));else if(r.version<i.version){if(r.size!==i.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(t,i,n){let r=i.array,a=i._updateRange,s=i.updateRanges;if(e.bindBuffer(n,t),-1===a.count&&0===s.length&&e.bufferSubData(n,0,r),0!==s.length){for(let t=0,i=s.length;t<i;t++){let i=s[t];e.bufferSubData(n,i.start*r.BYTES_PER_ELEMENT,r,i.start,i.count)}i.clearUpdateRanges()}-1!==a.count&&(e.bufferSubData(n,a.offset*r.BYTES_PER_ELEMENT,r,a.offset,a.count),a.count=-1),i.onUploadCallback()}(r.buffer,i,n),r.version=i.version}}}}class i9 extends i_{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new i9(e.width,e.height,e.widthSegments,e.heightSegments)}constructor(e=1,t=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n};let r=e/2,a=t/2,s=Math.floor(i),o=Math.floor(n),l=s+1,h=o+1,c=e/s,u=t/o,d=[],A=[],p=[],g=[];for(let e=0;e<h;e++){let t=e*u-a;for(let i=0;i<l;i++){let n=i*c-r;A.push(n,-t,0),p.push(0,0,1),g.push(i/s),g.push(1-e/o)}}for(let e=0;e<o;e++)for(let t=0;t<s;t++){let i=t+l*e,n=t+l*(e+1),r=t+1+l*(e+1),a=t+1+l*e;d.push(i,n,a),d.push(n,r,a)}this.setIndex(d),this.setAttribute("position",new ic(A,3)),this.setAttribute("normal",new ic(p,3)),this.setAttribute("uv",new ic(g,2))}}let i7={alphahash_fragment:"#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n #ifdef ALPHA_TO_COVERAGE\n diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n if ( diffuseColor.a < alphaTest ) discard;\n #endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n attribute float batchId;\n uniform highp sampler2D batchingTexture;\n mat4 getBatchingMatrix( const in float i ) {\n int size = textureSize( batchingTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif",batching_vertex:"#ifdef USE_BATCHING\n mat4 batchingMatrix = getBatchingMatrix( batchId );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_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 <tonemapping_fragment>\n #include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * 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 <tonemapping_fragment>\n #include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <logdepthbuf_fragment>\n 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 <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vLineDistance = scale * lineDistance;\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( 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 <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\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 <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n 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 <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n #include <logdepthbuf_fragment>\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix * 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 <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}"},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<i;e++)t[e]=0,n[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:n,attributeDivisors:r,object:e,attributes:{},index:null}}function c(){let e=a.newAttributes;for(let t=0,i=e.length;t<i;t++)e[t]=0}function u(e){d(e,0)}function d(t,i){let n=a.newAttributes,r=a.enabledAttributes,s=a.attributeDivisors;n[t]=1,0===r[t]&&(e.enableVertexAttribArray(t),r[t]=1),s[t]!==i&&(e.vertexAttribDivisor(t,i),s[t]=i)}function A(){let t=a.newAttributes,i=a.enabledAttributes;for(let n=0,r=i.length;n<r;n++)i[n]!==t[n]&&(e.disableVertexAttribArray(n),i[n]=0)}function p(t,i,n,r,a,s,o){!0===o?e.vertexAttribIPointer(t,i,n,a,s):e.vertexAttribPointer(t,i,n,r,a,s)}function g(){m(),s=!0,a!==r&&o((a=r).object)}function m(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(i,r,l,g,m){let f=!1,v=function(t,i,r){let a=!0===r.wireframe,s=n[t.id];void 0===s&&(s={},n[t.id]=s);let o=s[i.id];void 0===o&&(o={},s[i.id]=o);let l=o[a];return void 0===l&&(l=h(e.createVertexArray()),o[a]=l),l}(g,l,r);a!==v&&o((a=v).object),(f=function(e,t,i,n){let r=a.attributes,s=t.attributes,o=0,l=i.getAttributes();for(let t in l)if(l[t].location>=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;e<r.locationSize;e++)d(r.location+e,t.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<r.locationSize;e++)u(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,h);for(let e=0;e<r.locationSize;e++)p(r.location+e,s/r.locationSize,c,n,l*A,(m+s/r.locationSize*e)*A,g)}else{if(o.isInstancedBufferAttribute){for(let e=0;e<r.locationSize;e++)d(r.location+e,o.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let e=0;e<r.locationSize;e++)u(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,h);for(let e=0;e<r.locationSize;e++)p(r.location+e,s/r.locationSize,c,n,s*A,s/r.locationSize*e*A,g)}}else if(void 0!==l){let t=l[n];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(r.location,t);break;case 3:e.vertexAttrib3fv(r.location,t);break;case 4:e.vertexAttrib4fv(r.location,t);break;default:e.vertexAttrib1fv(r.location,t)}}}}A()}(i,r,l,g),null!==m&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(m).buffer))},reset:g,resetDefaultState:m,dispose:function(){for(let e in g(),n){let t=n[e];for(let e in t){let i=t[e];for(let e in i)l(i[e].object),delete i[e];delete t[e]}delete n[e]}},releaseStatesOfGeometry:function(e){if(void 0===n[e.id])return;let t=n[e.id];for(let e in t){let i=t[e];for(let e in i)l(i[e].object),delete i[e];delete t[e]}delete n[e.id]},releaseStatesOfProgram:function(e){for(let t in n){let i=n[t];if(void 0===i[e.id])continue;let r=i[e.id];for(let e in r)l(r[e].object),delete r[e];delete i[e.id]}},initAttributes:c,enableAttribute:u,disableUnusedAttributes:A}}function no(e,t,i){let n;this.setMode=function(e){n=e},this.render=function(t,r){e.drawArrays(n,t,r),i.update(r,n,1)},this.renderInstances=function(t,r,a){0!==a&&(e.drawArraysInstanced(n,t,r,a),i.update(r,n,a))},this.renderMultiDraw=function(e,r,a){if(0===a)return;let s=t.get("WEBGL_multi_draw");if(null===s)for(let t=0;t<a;t++)this.render(e[t],r[t]);else{s.multiDrawArraysWEBGL(n,e,0,r,0,a);let t=0;for(let e=0;e<a;e++)t+=r[e];i.update(t,n,1)}}}function nl(e,t,i){let n;function r(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let 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.length<t)&&(h=new Float32Array(t));for(let t=0,i=n;t!==a;++t,i+=4)s.copy(e[t]).applyMatrix4(r,o),s.normal.toArray(h,i),h[i+3]=s.constant}l.value=h,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,h}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let i=0!==e.length||t||0!==n||r;return r=t,n=e.length,i},this.beginShadows=function(){a=!0,h(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){i=h(e,t,0)},this.setState=function(s,o,c){let u=s.clippingPlanes,d=s.clipIntersection,A=s.clipShadows,p=e.get(s);if(r&&null!==u&&0!==u.length&&(!a||A)){let e=a?0:n,t=4*e,r=p.clippingState||null;l.value=r,r=h(u,o,t,c);for(let e=0;e!==t;++e)r[e]=i[e];p.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=e}else a?h(null):(l.value!==i&&(l.value=i,l.needsUpdate=n>0),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;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(ng,nm,nf),this._renderer.xr.enabled=nv,e.scissorTest=!1,nC(e,0,0,e.width,e.height)}_fromTexture(e,t){301===e.mapping||302===e.mapping?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),ng=this._renderer.getRenderTarget(),nm=this._renderer.getActiveCubeFace(),nf=this._renderer.getActiveMipmapLevel(),nv=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:1006,minFilter:1006,generateMipmaps:!1,type:1016,format:1023,colorSpace:ec,depthBuffer:!1},n=nS(e,t,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=nS(e,t,i);let{_lodMax:n}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(e){let t=[],i=[],n=[],r=e,a=e-4+1+nd.length;for(let s=0;s<a;s++){let a=Math.pow(2,r);i.push(a);let o=1/a;s>e-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 <cube_uv_reflection_fragment>\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;t<this._lodPlanes.length;t++){let i=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),n=nE[(t-1)%nE.length];this._blur(e,t-1,t,i,n)}t.autoClear=i}_blur(e,t,i,n,r){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,n,"latitudinal",r),this._halfBlur(a,e,i,i,n,"longitudinal",r)}_halfBlur(e,t,i,n,r,a,s){let o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");let h=new iF(this._lodPlanes[n],l),c=l.uniforms,u=this._sizeLods[i]-1,d=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,A=r/d,p=isFinite(r)?1+Math.floor(3*A):20;p>20&&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:e<p&&(m+=2*i)}for(let e=0;e<g.length;e++)g[e]=g[e]/m;c.envMap.value=e.texture,c.samples.value=p,c.weights.value=g,c.latitudinal.value="latitudinal"===a,s&&(c.poleAxis.value=s);let{_lodMax:f}=this;c.dTheta.value=d,c.mipInt.value=f-i;let v=this._sizeLods[n],_=4*(this._cubeSize-v);nC(t,3*v*(n>f-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 <common>\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;e<n;e++)t.remove(i[e])}o.removeEventListener("dispose",s),delete r[o.id];let l=a.get(o);l&&(t.remove(l),a.delete(o)),n.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,i.memory.geometries--}function o(e){let i=[],n=e.index,r=e.attributes.position,s=0;if(null!==n){let e=n.array;s=n.version;for(let t=0,n=e.length;t<n;t+=3){let n=e[t+0],r=e[t+1],a=e[t+2];i.push(n,r,r,a,a,n)}}else{if(void 0===r)return;let e=r.array;s=r.version;for(let t=0,n=e.length/3-1;t<n;t+=3){let e=t+0,n=t+1,r=t+2;i.push(e,n,n,r,r,e)}}let o=new(eT(i)?ih:il)(i,1);o.version=s;let l=a.get(e);l&&t.remove(l),a.set(e,o)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",s),r[t.id]=!0,i.memory.geometries++),t},update:function(i){let n=i.attributes;for(let i in n)t.update(n[i],e.ARRAY_BUFFER);let r=i.morphAttributes;for(let i in r){let n=r[i];for(let i=0,r=n.length;i<r;i++)t.update(n[i],e.ARRAY_BUFFER)}},getWireframeAttribute:function(e){let t=a.get(e);if(t){let i=e.index;null!==i&&t.version<i.version&&o(e)}else o(e);return a.get(e)}}}function nR(e,t,i){let n,r,a;this.setMode=function(e){n=e},this.setIndex=function(e){r=e.type,a=e.bytesPerElement},this.render=function(t,s){e.drawElements(n,s,r,t*a),i.update(s,n,1)},this.renderInstances=function(t,s,o){0!==o&&(e.drawElementsInstanced(n,s,r,t*a,o),i.update(s,n,o))},this.renderMultiDraw=function(e,s,o){if(0===o)return;let l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<o;t++)this.render(e[t]/a,s[t]);else{l.multiDrawElementsWEBGL(n,s,0,r,e,0,o);let t=0;for(let e=0;e<o;e++)t+=s[e];i.update(t,n,1)}}}function nL(e){let t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(i,n,r){switch(t.calls++,n){case e.TRIANGLES:t.triangles+=i/3*r;break;case e.LINES:t.lines+=i/2*r;break;case e.LINE_STRIP:t.lines+=r*(i-1);break;case e.LINE_LOOP:t.lines+=r*i;break;case e.POINTS:t.points+=r*i;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function nD(e,t,i){let n=new WeakMap,r=new eq;return{update:function(a,s,o){let l=a.morphTargetInfluences,h=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,c=void 0!==h?h.length:0,u=n.get(s);if(void 0===u||u.count!==c){void 0!==u&&u.texture.dispose();let e=void 0!==s.morphAttributes.position,i=void 0!==s.morphAttributes.normal,a=void 0!==s.morphAttributes.color,o=s.morphAttributes.position||[],l=s.morphAttributes.normal||[],h=s.morphAttributes.color||[],d=0;!0===e&&(d=1),!0===i&&(d=2),!0===a&&(d=3);let A=s.attributes.position.count*d,p=1;A>t.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;t<c;t++){let n=o[t],s=l[t],c=h[t],u=A*p*4*t;for(let t=0;t<n.count;t++){let o=t*f;!0===e&&(r.fromBufferAttribute(n,t),g[u+o+0]=r.x,g[u+o+1]=r.y,g[u+o+2]=r.z,g[u+o+3]=0),!0===i&&(r.fromBufferAttribute(s,t),g[u+o+4]=r.x,g[u+o+5]=r.y,g[u+o+6]=r.z,g[u+o+7]=0),!0===a&&(r.fromBufferAttribute(c,t),g[u+o+8]=r.x,g[u+o+9]=r.y,g[u+o+10]=r.z,g[u+o+11]=4===c.itemSize?r.w:1)}}u={count:c,texture:m,size:new eM(A,p)},n.set(s,u),s.addEventListener("dispose",function e(){m.dispose(),n.delete(s),s.removeEventListener("dispose",e)})}if(!0===a.isInstancedMesh&&null!==a.morphTexture)o.getUniforms().setValue(e,"morphTexture",a.morphTexture,i);else{let t=0;for(let e=0;e<l.length;e++)t+=l[e];let i=s.morphTargetsRelative?1:1-t;o.getUniforms().setValue(e,"morphTargetBaseInfluence",i),o.getUniforms().setValue(e,"morphTargetInfluences",l)}o.getUniforms().setValue(e,"morphTargetsTexture",u.texture,i),o.getUniforms().setValue(e,"morphTargetsTextureSize",u.size)}}}function nU(e,t,i,n){let r=new WeakMap;function a(e){let t=e.target;t.removeEventListener("dispose",a),i.remove(t.instanceMatrix),null!==t.instanceColor&&i.remove(t.instanceColor)}return{update:function(s){let o=n.render.frame,l=s.geometry,h=t.get(s,l);if(r.get(h)!==o&&(t.update(h),r.set(h,o)),s.isInstancedMesh&&(!1===s.hasEventListener("dispose",a)&&s.addEventListener("dispose",a),r.get(s)!==o&&(i.update(s.instanceMatrix,e.ARRAY_BUFFER),null!==s.instanceColor&&i.update(s.instanceColor,e.ARRAY_BUFFER),r.set(s,o))),s.isSkinnedMesh){let e=s.skeleton;r.get(e)!==o&&(e.update(),r.set(e,o))}return h},dispose:function(){r=new WeakMap}}}class nP extends eW{copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}constructor(e,t,i,n,r,a,s,o,l,h){if(1026!==(h=void 0!==h?h:1026)&&1027!==h)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&1026===h&&(i=1014),void 0===i&&1027===h&&(i=1020),super(null,n,r,a,s,o,h,i,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==s?s:1003,this.minFilter=void 0!==o?o:1003,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}}let nN=new eW,nF=new nP(1,1);nF.compareFunction=515;let nQ=new eY,nO=new eK,nk=new iJ,nG=[],nH=[],nz=new Float32Array(16),nV=new Float32Array(9),nW=new Float32Array(4);function nq(e,t,i){let n=e[0];if(n<=0||n>0)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<n;i++)if(e[i]!==t[i])return!1;return!0}function nj(e,t){for(let i=0,n=t.length;i<n;i++)e[i]=t[i]}function nY(e,t){let i=nH[t];void 0===i&&(i=new Int32Array(t),nH[t]=i);for(let n=0;n!==t;++n)i[n]=e.allocateTextureUnit();return i}function nK(e,t){let i=this.cache;i[0]!==t&&(e.uniform1f(this.addr,t),i[0]=t)}function nJ(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(nX(i,t))return;e.uniform2fv(this.addr,t),nj(i,t)}}function nZ(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else if(void 0!==t.r)(i[0]!==t.r||i[1]!==t.g||i[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),i[0]=t.r,i[1]=t.g,i[2]=t.b);else{if(nX(i,t))return;e.uniform3fv(this.addr,t),nj(i,t)}}function n$(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(nX(i,t))return;e.uniform4fv(this.addr,t),nj(i,t)}}function n0(e,t){let i=this.cache,n=t.elements;if(void 0===n){if(nX(i,t))return;e.uniformMatrix2fv(this.addr,!1,t),nj(i,t)}else{if(nX(i,n))return;nW.set(n),e.uniformMatrix2fv(this.addr,!1,nW),nj(i,n)}}function n1(e,t){let i=this.cache,n=t.elements;if(void 0===n){if(nX(i,t))return;e.uniformMatrix3fv(this.addr,!1,t),nj(i,t)}else{if(nX(i,n))return;nV.set(n),e.uniformMatrix3fv(this.addr,!1,nV),nj(i,n)}}function n2(e,t){let i=this.cache,n=t.elements;if(void 0===n){if(nX(i,t))return;e.uniformMatrix4fv(this.addr,!1,t),nj(i,t)}else{if(nX(i,n))return;nz.set(n),e.uniformMatrix4fv(this.addr,!1,nz),nj(i,n)}}function n3(e,t){let i=this.cache;i[0]!==t&&(e.uniform1i(this.addr,t),i[0]=t)}function n4(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(nX(i,t))return;e.uniform2iv(this.addr,t),nj(i,t)}}function n5(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else{if(nX(i,t))return;e.uniform3iv(this.addr,t),nj(i,t)}}function n8(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(nX(i,t))return;e.uniform4iv(this.addr,t),nj(i,t)}}function n6(e,t){let i=this.cache;i[0]!==t&&(e.uniform1ui(this.addr,t),i[0]=t)}function n9(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(nX(i,t))return;e.uniform2uiv(this.addr,t),nj(i,t)}}function n7(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else{if(nX(i,t))return;e.uniform3uiv(this.addr,t),nj(i,t)}}function re(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(nX(i,t))return;e.uniform4uiv(this.addr,t),nj(i,t)}}function rt(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r);let a=this.type===e.SAMPLER_2D_SHADOW?nF:nN;i.setTexture2D(t||a,r)}function ri(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(t||nO,r)}function rn(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.setTextureCube(t||nk,r)}function rr(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(t||nQ,r)}function ra(e,t){e.uniform1fv(this.addr,t)}function rs(e,t){let i=nq(t,this.size,2);e.uniform2fv(this.addr,i)}function ro(e,t){let i=nq(t,this.size,3);e.uniform3fv(this.addr,i)}function rl(e,t){let i=nq(t,this.size,4);e.uniform4fv(this.addr,i)}function rh(e,t){let i=nq(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,i)}function rc(e,t){let i=nq(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,i)}function ru(e,t){let i=nq(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,i)}function rd(e,t){e.uniform1iv(this.addr,t)}function rA(e,t){e.uniform2iv(this.addr,t)}function rp(e,t){e.uniform3iv(this.addr,t)}function rg(e,t){e.uniform4iv(this.addr,t)}function rm(e,t){e.uniform1uiv(this.addr,t)}function rf(e,t){e.uniform2uiv(this.addr,t)}function rv(e,t){e.uniform3uiv(this.addr,t)}function r_(e,t){e.uniform4uiv(this.addr,t)}function ry(e,t,i){let n=this.cache,r=t.length,a=nY(i,r);nX(n,a)||(e.uniform1iv(this.addr,a),nj(n,a));for(let e=0;e!==r;++e)i.setTexture2D(t[e]||nN,a[e])}function rE(e,t,i){let n=this.cache,r=t.length,a=nY(i,r);nX(n,a)||(e.uniform1iv(this.addr,a),nj(n,a));for(let e=0;e!==r;++e)i.setTexture3D(t[e]||nO,a[e])}function rx(e,t,i){let n=this.cache,r=t.length,a=nY(i,r);nX(n,a)||(e.uniform1iv(this.addr,a),nj(n,a));for(let e=0;e!==r;++e)i.setTextureCube(t[e]||nk,a[e])}function rS(e,t,i){let n=this.cache,r=t.length,a=nY(i,r);nX(n,a)||(e.uniform1iv(this.addr,a),nj(n,a));for(let e=0;e!==r;++e)i.setTexture2DArray(t[e]||nQ,a[e])}class rC{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return nK;case 35664:return nJ;case 35665:return nZ;case 35666:return n$;case 35674:return n0;case 35675:return n1;case 35676:return n2;case 5124:case 35670:return n3;case 35667:case 35671:return n4;case 35668:case 35672:return n5;case 35669:case 35673:return n8;case 5125:return n6;case 36294:return n9;case 36295:return n7;case 36296:return re;case 35678:case 36198:case 36298:case 36306:case 35682:return rt;case 35679:case 36299:case 36307:return ri;case 35680:case 36300:case 36308:case 36293:return rn;case 36289:case 36303:case 36311:case 36292:return rr}}(t.type)}}class rI{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return ra;case 35664:return rs;case 35665:return ro;case 35666:return rl;case 35674:return rh;case 35675:return rc;case 35676:return ru;case 5124:case 35670:return rd;case 35667:case 35671:return rA;case 35668:case 35672:return rp;case 35669:case 35673:return rg;case 5125:return rm;case 36294:return rf;case 36295:return rv;case 36296:return r_;case 35678:case 36198:case 36298:case 36306:case 35682:return ry;case 35679:case 36299:case 36307:return rE;case 35680:case 36300:case 36308:case 36293:return rx;case 36289:case 36303:case 36311:case 36292:return rS}}(t.type)}}class rM{setValue(e,t,i){let n=this.seq;for(let r=0,a=n.length;r!==a;++r){let a=n[r];a.setValue(e,t[a.id],i)}}constructor(e){this.id=e,this.seq=[],this.map={}}}let rw=/(\w+)(\])?(\[|\.)?/g;function rb(e,t){e.seq.push(t),e.map[t.id]=t}class rT{setValue(e,t,i,n){let r=this.map[t];void 0!==r&&r.setValue(e,i,n)}setOptional(e,t,i){let n=t[i];void 0!==n&&this.setValue(e,i,n)}static upload(e,t,i,n){for(let r=0,a=t.length;r!==a;++r){let a=t[r],s=i[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,n)}}static seqWithValue(e,t){let i=[];for(let n=0,r=e.length;n!==r;++n){let r=e[n];r.id in t&&i.push(r)}return i}constructor(e,t){this.seq=[],this.map={};let i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let n=0;n<i;++n){let i=e.getActiveUniform(t,n),r=e.getUniformLocation(t,i.name);!function(e,t,i){let n=e.name,r=n.length;for(rw.lastIndex=0;;){let a=rw.exec(n),s=rw.lastIndex,o=a[1],l="]"===a[2],h=a[3];if(l&&(o|=0),void 0===h||"["===h&&s+2===r){rb(i,void 0===h?new rC(o,e,t):new rI(o,e,t));break}{let e=i.map[o];void 0===e&&rb(i,e=new rM(o)),i=e}}}(i,r,this)}}}function rB(e,t,i){let n=e.createShader(t);return e.shaderSource(n,i),e.compileShader(n),n}let rR=0;function rL(e,t,i){let n=e.getShaderParameter(t,e.COMPILE_STATUS),r=e.getShaderInfoLog(t).trim();if(n&&""===r)return"";let a=/ERROR: 0:(\d+)/.exec(r);if(!a)return r;{let n=parseInt(a[1]);return i.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){let i=e.split("\n"),n=[],r=Math.max(t-6,0),a=Math.min(t+6,i.length);for(let e=r;e<a;e++){let r=e+1;n.push("".concat(r===t?">":" "," ").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);e<parseInt(i);e++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return r}function rz(e){let t="precision ".concat(e.precision," float;\n precision ").concat(e.precision," int;\n precision ").concat(e.precision," sampler2D;\n precision ").concat(e.precision," samplerCube;\n precision ").concat(e.precision," sampler3D;\n precision ").concat(e.precision," sampler2DArray;\n precision ").concat(e.precision," sampler2DShadow;\n precision ").concat(e.precision," samplerCubeShadow;\n precision ").concat(e.precision," sampler2DArrayShadow;\n precision ").concat(e.precision," isampler2D;\n precision ").concat(e.precision," isampler3D;\n precision ").concat(e.precision," isamplerCube;\n precision ").concat(e.precision," isampler2DArray;\n precision ").concat(e.precision," usampler2D;\n precision ").concat(e.precision," usampler3D;\n precision ").concat(e.precision," usamplerCube;\n precision ").concat(e.precision," usampler2DArray;\n ");return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function rV(e,t,i,n){let r,a,s,o,l,h,c=e.getContext(),u=i.defines,d=i.vertexShader,A=i.fragmentShader,p=(l="SHADOWMAP_TYPE_BASIC",1===i.shadowMapType?l="SHADOWMAP_TYPE_PCF":2===i.shadowMapType?l="SHADOWMAP_TYPE_PCF_SOFT":3===i.shadowMapType&&(l="SHADOWMAP_TYPE_VSM"),l),g=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 301:case 302:t="ENVMAP_TYPE_CUBE";break;case 306:t="ENVMAP_TYPE_CUBE_UV"}return t}(i),m=(h="ENVMAP_MODE_REFLECTION",i.envMap&&302===i.envMapMode&&(h="ENVMAP_MODE_REFRACTION"),h),f=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(i),v=function(e){let t=e.envMapCubeUVHeight;if(null===t)return null;let i=Math.log2(t)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:1/t,maxMip:i}}(i),_=[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(rD).join("\n"),y=function(e){let t=[];for(let i in e){let n=e[i];!1!==n&&t.push("#define "+i+" "+n)}return t.join("\n")}(u),E=c.createProgram(),x=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?((r=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y].filter(rD).join("\n")).length>0&&(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;r<n;r++){let n=e.getActiveAttrib(t,r),a=n.name,s=1;n.type===e.FLOAT_MAT2&&(s=2),n.type===e.FLOAT_MAT3&&(s=3),n.type===e.FLOAT_MAT4&&(s=4),i[a]={type:n.type,location:e.getAttribLocation(t,a),locationSize:s}}return i}(c,E)}c.attachShader(E,I),c.attachShader(E,M),void 0!==i.index0AttributeName?c.bindAttribLocation(E,0,i.index0AttributeName):!0===i.morphTargets&&c.bindAttribLocation(E,0,"position"),c.linkProgram(E),this.getUniforms=function(){return void 0===s&&w(this),s},this.getAttributes=function(){return void 0===o&&w(this),o};let b=!1===i.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===b&&(b=c.getProgramParameter(E,37297)),b},this.destroy=function(){n.releaseStatesOfProgram(this),c.deleteProgram(E),this.program=void 0},this.type=i.shaderType,this.name=i.shaderName,this.id=rR++,this.cacheKey=t,this.usedTimes=1,this.program=E,this.vertexShader=I,this.fragmentShader=M,this}let rW=0;class rq{update(e){let t=e.vertexShader,i=e.fragmentShader,n=this._getShaderStage(t),r=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return!1===a.has(n)&&(a.add(n),n.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}remove(e){for(let t of this.materialCache.get(e))t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,i=t.get(e);return void 0===i&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){let t=this.shaderCache,i=t.get(e);return void 0===i&&(i=new rX(e),t.set(e,i)),i}constructor(){this.shaderCache=new Map,this.materialCache=new Map}}class rX{constructor(e){this.id=rW++,this.code=e,this.usedTimes=0}}function rj(e,t,i,n,r,a,s){let o=new tT,l=new rq,h=new Set,c=[],u=r.logarithmicDepthBuffer,d=r.vertexTextures,A=r.precision,p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(e){return(h.add(e),0===e)?"uv":"uv".concat(e)}return{getParameters:function(a,o,c,m,f){let v,_,y,E,x=m.fog,S=f.geometry,C=a.isMeshStandardMaterial?m.environment:null,I=(a.isMeshStandardMaterial?i:t).get(a.envMap||C),M=I&&306===I.mapping?I.image.height:null,w=p[a.type];null!==a.precision&&(A=r.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",A,"instead.");let b=S.morphAttributes.position||S.morphAttributes.normal||S.morphAttributes.color,T=void 0!==b?b.length:0,B=0;if(void 0!==S.morphAttributes.position&&(B=1),void 0!==S.morphAttributes.normal&&(B=2),void 0!==S.morphAttributes.color&&(B=3),w){let e=nt[w];v=e.vertexShader,_=e.fragmentShader}else v=a.vertexShader,_=a.fragmentShader,l.update(a),y=l.getVertexShaderID(a),E=l.getFragmentShaderID(a);let R=e.getRenderTarget(),L=!0===f.isInstancedMesh,D=!0===f.isBatchedMesh,U=!!a.map,P=!!a.matcap,N=!!I,F=!!a.aoMap,Q=!!a.lightMap,O=!!a.bumpMap,k=!!a.normalMap,G=!!a.displacementMap,H=!!a.emissiveMap,z=!!a.metalnessMap,V=!!a.roughnessMap,W=a.anisotropy>0,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;e<t;e++){let t=c[e];if(t.cacheKey===i){n=t,++n.usedTimes;break}}return void 0===n&&(n=new rV(e,i,t,a),c.push(n)),n},releaseProgram:function(e){if(0==--e.usedTimes){let t=c.indexOf(e);c[t]=c[c.length-1],c.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:c,dispose:function(){l.dispose()}}}function rY(){let e=new WeakMap;return{get:function(t){let i=e.get(t);return void 0===i&&(i={},e.set(t,i)),i},remove:function(t){e.delete(t)},update:function(t,i,n){e.get(t)[i]=n},dispose:function(){e=new WeakMap}}}function rK(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function rJ(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function rZ(){let e=[],t=0,i=[],n=[],r=[];function a(i,n,r,a,s,o){let l=e[t];return void 0===l?(l={id:i.id,object:i,geometry:n,material:r,groupOrder:a,renderOrder:i.renderOrder,z:s,group:o},e[t]=l):(l.id=i.id,l.object=i,l.geometry=n,l.material=r,l.groupOrder=a,l.renderOrder=i.renderOrder,l.z=s,l.group=o),t++,l}return{opaque:i,transmissive:n,transparent:r,init:function(){t=0,i.length=0,n.length=0,r.length=0},push:function(e,t,s,o,l,h){let c=a(e,t,s,o,l,h);s.transmission>0?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;i<n;i++){let t=e[i];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){i.length>1&&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;e<a;e++){let a=r[e],E=a.color,x=a.intensity,S=a.distance,C=a.shadow&&a.shadow.map?a.shadow.map.texture:null;if(a.isAmbientLight)s+=E.r*x*y,o+=E.g*x*y,l+=E.b*x*y;else if(a.isLightProbe){for(let e=0;e<9;e++)n.probe[e].addScaledVector(a.sh.coefficients[e],x);_++}else if(a.isDirectionalLight){let e=t.get(a);if(e.color.copy(a.color).multiplyScalar(a.intensity*y),a.castShadow){let e=a.shadow,t=i.get(a);t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,n.directionalShadow[h]=t,n.directionalShadowMap[h]=C,n.directionalShadowMatrix[h]=a.shadow.matrix,p++}n.directional[h]=e,h++}else if(a.isSpotLight){let e=t.get(a);e.position.setFromMatrixPosition(a.matrixWorld),e.color.copy(E).multiplyScalar(x*y),e.distance=S,e.coneCos=Math.cos(a.angle),e.penumbraCos=Math.cos(a.angle*(1-a.penumbra)),e.decay=a.decay,n.spot[u]=e;let r=a.shadow;if(a.map&&(n.spotLightMap[f]=a.map,f++,r.updateMatrices(a),a.castShadow&&v++),n.spotLightMatrix[u]=r.matrix,a.castShadow){let e=i.get(a);e.shadowBias=r.bias,e.shadowNormalBias=r.normalBias,e.shadowRadius=r.radius,e.shadowMapSize=r.mapSize,n.spotShadow[u]=e,n.spotShadowMap[u]=C,m++}u++}else if(a.isRectAreaLight){let e=t.get(a);e.color.copy(E).multiplyScalar(x),e.halfWidth.set(.5*a.width,0,0),e.halfHeight.set(0,.5*a.height,0),n.rectArea[d]=e,d++}else if(a.isPointLight){let e=t.get(a);if(e.color.copy(a.color).multiplyScalar(a.intensity*y),e.distance=a.distance,e.decay=a.decay,a.castShadow){let e=a.shadow,t=i.get(a);t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,n.pointShadow[c]=t,n.pointShadowMap[c]=C,n.pointShadowMatrix[c]=a.shadow.matrix,g++}n.point[c]=e,c++}else if(a.isHemisphereLight){let e=t.get(a);e.skyColor.copy(a.color).multiplyScalar(x*y),e.groundColor.copy(a.groundColor).multiplyScalar(x*y),n.hemi[A]=e,A++}}d>0&&(!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;t<d;t++){let d=e[t];if(d.isDirectionalLight){let e=n.directional[i];e.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(u),i++}else if(d.isSpotLight){let e=n.spot[l];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),e.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(u),l++}else if(d.isRectAreaLight){let e=n.rectArea[h];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),s.identity(),a.copy(d.matrixWorld),a.premultiply(u),s.extractRotation(a),e.halfWidth.set(.5*d.width,0,0),e.halfHeight.set(0,.5*d.height,0),e.halfWidth.applyMatrix4(s),e.halfHeight.applyMatrix4(s),h++}else if(d.isPointLight){let e=n.point[o];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),o++}else if(d.isHemisphereLight){let e=n.hemi[c];e.direction.setFromMatrixPosition(d.matrixWorld),e.direction.transformDirection(u),c++}}},state:n}}function r4(e){let t=new r3(e),i=[],n=[];return{init:function(){i.length=0,n.length=0},state:{lightsArray:i,shadowsArray:n,lights:t,transmissionRenderTarget:null},setupLights:function(e){t.setup(i,e)},setupLightsView:function(e){t.setupView(i,e)},pushLight:function(e){i.push(e)},pushShadow:function(e){n.push(e)}}}function r5(e){let t=new WeakMap;return{get:function(i){let n,r=arguments.length>1&&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 <packing>\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;h<u;h++){let u=i[h],p=u.shadow;if(void 0===p){console.warn("THREE.WebGLShadowMap:",u,"has no shadow.");continue}if(!1===p.autoUpdate&&!1===p.needsUpdate)continue;r.copy(p.mapSize);let m=p.getFrameExtents();if(r.multiply(m),a.copy(p.mapSize),(r.x>c||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<f;i++){let r=p.getViewport(i);s.set(a.x*r.x,a.y*r.y,a.x*r.z,a.y*r.w),_.viewport(s),p.updateMatrices(u,i),n=p.getFrustum(),function i(r,a,s,o,l){if(!1===r.visible)return;if(r.layers.test(a.layers)&&(r.isMesh||r.isLine||r.isPoints)&&(r.castShadow||r.receiveShadow&&3===l)&&(!r.frustumCulled||n.intersectsObject(r))){r.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,r.matrixWorld);let i=t.update(r),n=r.material;if(Array.isArray(n)){let t=i.groups;for(let h=0,c=t.length;h<c;h++){let c=t[h],u=n[c.materialIndex];if(u&&u.visible){let t=v(r,u,o,l);r.onBeforeShadow(e,r,a,s,i,t,c),e.renderBufferDirect(s,null,i,t,r,c),r.onAfterShadow(e,r,a,s,i,t,c)}}}else if(n.visible){let t=v(r,n,o,l);r.onBeforeShadow(e,r,a,s,i,t,null),e.renderBufferDirect(s,null,i,t,r,null),r.onAfterShadow(e,r,a,s,i,t,null)}}let h=r.children;for(let e=0,t=h.length;e<t;e++)i(h[e],a,s,o,l)}(o,l,p.camera,u,this.type)}!0!==p.isPointLightShadow&&3===this.type&&function(i,n){let a=t.update(g);d.defines.VSM_SAMPLES!==i.blurSamples&&(d.defines.VSM_SAMPLES=i.blurSamples,A.defines.VSM_SAMPLES=i.blurSamples,d.needsUpdate=!0,A.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new ej(r.x,r.y)),d.uniforms.shadow_pass.value=i.map.texture,d.uniforms.resolution.value=i.mapSize,d.uniforms.radius.value=i.radius,e.setRenderTarget(i.mapPass),e.clear(),e.renderBufferDirect(n,null,a,d,g,null),A.uniforms.shadow_pass.value=i.mapPass.texture,A.uniforms.resolution.value=i.mapSize,A.uniforms.radius.value=i.radius,e.setRenderTarget(i.map),e.clear(),e.renderBufferDirect(n,null,a,A,g,null)}(p,l),p.needsUpdate=!1}f=this.type,m.needsUpdate=!1,e.setRenderTarget(h,u,p)}}function r7(e){let t=new function(){let t=!1,i=new eq,n=null,r=new eq(0,0,0,0);return{setMask:function(i){n===i||t||(e.colorMask(i,i,i,i),n=i)},setLocked:function(e){t=e},setClear:function(t,n,a,s,o){!0===o&&(t*=s,n*=s,a*=s),i.set(t,n,a,s),!1===r.equals(i)&&(e.clearColor(t,n,a,s),r.copy(i))},reset:function(){t=!1,n=null,r.set(-1,0,0,0)}}},i=new function(){let t=!1,i=null,n=null,r=null;return{setTest:function(t){t?Q(e.DEPTH_TEST):O(e.DEPTH_TEST)},setMask:function(n){i===n||t||(e.depthMask(n),i=n)},setFunc:function(t){if(n!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:default:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL)}n=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,i=null,n=null,r=null}}},n=new function(){let t=!1,i=null,n=null,r=null,a=null,s=null,o=null,l=null,h=null;return{setTest:function(i){t||(i?Q(e.STENCIL_TEST):O(e.STENCIL_TEST))},setMask:function(n){i===n||t||(e.stencilMask(n),i=n)},setFunc:function(t,i,s){(n!==t||r!==i||a!==s)&&(e.stencilFunc(t,i,s),n=t,r=i,a=s)},setOp:function(t,i,n){(s!==t||o!==i||l!==n)&&(e.stencilOp(t,i,n),s=t,o=i,l=n)},setLocked:function(e){t=e},setClear:function(t){h!==t&&(e.clearStencil(t),h=t)},reset:function(){t=!1,i=null,n=null,r=null,a=null,s=null,o=null,l=null,h=null}}},r=new WeakMap,a=new WeakMap,s={},o={},l=new WeakMap,h=[],c=null,u=!1,d=null,A=null,p=null,g=null,m=null,f=null,v=null,_=new t6(0,0,0),y=0,E=!1,x=null,S=null,C=null,I=null,M=null,w=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),b=!1,T=e.getParameter(e.VERSION);-1!==T.indexOf("WebGL")?b=parseFloat(/^WebGL (\d)/.exec(T)[1])>=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;s<n;s++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(i,0,e.RGBA,1,1,r,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(i+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return s}let F={};function Q(t){!0!==s[t]&&(e.enable(t),s[t]=!0)}function O(t){!1!==s[t]&&(e.disable(t),s[t]=!1)}F[e.TEXTURE_2D]=N(e.TEXTURE_2D,e.TEXTURE_2D,1),F[e.TEXTURE_CUBE_MAP]=N(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),F[e.TEXTURE_2D_ARRAY]=N(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),F[e.TEXTURE_3D]=N(e.TEXTURE_3D,e.TEXTURE_3D,1,1),t.setClear(0,0,0,1),i.setClear(1),n.setClear(0),Q(e.DEPTH_TEST),i.setFunc(3),z(!1),V(1),Q(e.CULL_FACE),H(0);let k={100:e.FUNC_ADD,101:e.FUNC_SUBTRACT,102:e.FUNC_REVERSE_SUBTRACT};k[103]=e.MIN,k[104]=e.MAX;let G={200:e.ZERO,201:e.ONE,202:e.SRC_COLOR,204:e.SRC_ALPHA,210:e.SRC_ALPHA_SATURATE,208:e.DST_COLOR,206:e.DST_ALPHA,203:e.ONE_MINUS_SRC_COLOR,205:e.ONE_MINUS_SRC_ALPHA,209:e.ONE_MINUS_DST_COLOR,207:e.ONE_MINUS_DST_ALPHA,211:e.CONSTANT_COLOR,212:e.ONE_MINUS_CONSTANT_COLOR,213:e.CONSTANT_ALPHA,214:e.ONE_MINUS_CONSTANT_ALPHA};function H(t,i,n,r,a,s,o,l,h,c){if(0===t){!0===u&&(O(e.BLEND),u=!1);return}if(!1===u&&(Q(e.BLEND),u=!0),5!==t){if(t!==d||c!==E){if((100!==A||100!==m)&&(e.blendEquation(e.FUNC_ADD),A=100,m=100),c)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}p=null,g=null,f=null,v=null,_.set(0,0,0),y=0,d=t,E=c}return}a=a||i,s=s||n,o=o||r,(i!==A||a!==m)&&(e.blendEquationSeparate(k[i],k[a]),A=i,m=a),(n!==p||r!==g||s!==f||o!==v)&&(e.blendFuncSeparate(G[n],G[r],G[s],G[o]),p=n,g=r,f=s,v=o),(!1===l.equals(_)||h!==y)&&(e.blendColor(l.r,l.g,l.b,h),_.copy(l),y=h),d=t,E=!1}function z(t){x!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),x=t)}function V(t){0!==t?(Q(e.CULL_FACE),t!==S&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):O(e.CULL_FACE),S=t}function W(t,i,n){t?(Q(e.POLYGON_OFFSET_FILL),(I!==i||M!==n)&&(e.polygonOffset(i,n),I=i,M=n)):O(e.POLYGON_OFFSET_FILL)}return{buffers:{color:t,depth:i,stencil:n},enable:Q,disable:O,bindFramebuffer:function(t,i){return o[t]!==i&&(e.bindFramebuffer(t,i),o[t]=i,t===e.DRAW_FRAMEBUFFER&&(o[e.FRAMEBUFFER]=i),t===e.FRAMEBUFFER&&(o[e.DRAW_FRAMEBUFFER]=i),!0)},drawBuffers:function(t,i){let n=h,r=!1;if(t){void 0===(n=l.get(i))&&(n=[],l.set(i,n));let a=t.textures;if(n.length!==a.length||n[0]!==e.COLOR_ATTACHMENT0){for(let t=0,i=a.length;t<i;t++)n[t]=e.COLOR_ATTACHMENT0+t;n.length=a.length,r=!0}}else n[0]!==e.BACK&&(n[0]=e.BACK,r=!0);r&&e.drawBuffers(n)},useProgram:function(t){return c!==t&&(e.useProgram(t),c=t,!0)},setBlending:H,setMaterial:function(r,a){2===r.side?O(e.CULL_FACE):Q(e.CULL_FACE);let s=1===r.side;a&&(s=!s),z(s),1===r.blending&&!1===r.transparent?H(0):H(r.blending,r.blendEquation,r.blendSrc,r.blendDst,r.blendEquationAlpha,r.blendSrcAlpha,r.blendDstAlpha,r.blendColor,r.blendAlpha,r.premultipliedAlpha),i.setFunc(r.depthFunc),i.setTest(r.depthTest),i.setMask(r.depthWrite),t.setMask(r.colorWrite);let o=r.stencilWrite;n.setTest(o),o&&(n.setMask(r.stencilWriteMask),n.setFunc(r.stencilFunc,r.stencilRef,r.stencilFuncMask),n.setOp(r.stencilFail,r.stencilZFail,r.stencilZPass)),W(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),!0===r.alphaToCoverage?Q(e.SAMPLE_ALPHA_TO_COVERAGE):O(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:z,setCullFace:V,setLineWidth:function(t){t!==C&&(b&&e.lineWidth(t),C=t)},setPolygonOffset:W,setScissorTest:function(t){t?Q(e.SCISSOR_TEST):O(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+w-1),B!==t&&(e.activeTexture(t),B=t)},bindTexture:function(t,i,n){void 0===n&&(n=null===B?e.TEXTURE0+w-1:B);let r=R[n];void 0===r&&(r={type:void 0,texture:void 0},R[n]=r),(r.type!==t||r.texture!==i)&&(B!==n&&(e.activeTexture(n),B=n),e.bindTexture(t,i||F[t]),r.type=t,r.texture=i)},unbindTexture:function(){let t=R[B];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,i){let n=a.get(i);void 0===n&&(n=new WeakMap,a.set(i,n));let r=n.get(t);void 0===r&&(r=e.getUniformBlockIndex(i,t.name),n.set(t,r))},uniformBlockBinding:function(t,i){let n=a.get(i).get(t);r.get(i)!==n&&(e.uniformBlockBinding(i,n,t.__bindingPointIndex),r.set(i,n))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===U.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),U.copy(t))},viewport:function(t){!1===P.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),P.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),e.clearDepth(1),e.stencilMask(0xffffffff),e.stencilFunc(e.ALWAYS,0,0xffffffff),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),s={},B=null,R={},o={},l=new WeakMap,h=[],c=null,u=!1,d=null,A=null,p=null,g=null,m=null,f=null,v=null,_=new t6(0,0,0),y=0,E=!1,x=null,S=null,C=null,I=null,M=null,U.set(0,0,e.canvas.width,e.canvas.height),P.set(0,0,e.canvas.width,e.canvas.height),t.reset(),i.reset(),n.reset()}}}function ae(e,t,i,n,r,a,s){let o,l=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,h="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new eM,u=new WeakMap,d=new WeakMap,A=!1;try{A="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function p(e,t){return A?new OffscreenCanvas(e,t):eB("canvas")}function g(e,t,i){let n=1,r=F(e);if((r.width>i||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;n<i.__webglFramebuffer[t].length;n++)e.deleteFramebuffer(i.__webglFramebuffer[t][n]);else e.deleteFramebuffer(i.__webglFramebuffer[t]);i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[t])}else{if(Array.isArray(i.__webglFramebuffer))for(let t=0;t<i.__webglFramebuffer.length;t++)e.deleteFramebuffer(i.__webglFramebuffer[t]);else e.deleteFramebuffer(i.__webglFramebuffer);if(i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&e.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(let t=0;t<i.__webglColorRenderbuffer.length;t++)i.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(i.__webglColorRenderbuffer[t]);i.__webglDepthRenderbuffer&&e.deleteRenderbuffer(i.__webglDepthRenderbuffer)}let r=t.textures;for(let t=0,i=r.length;t<i;t++){let i=n.get(r[t]);i.__webglTexture&&(e.deleteTexture(i.__webglTexture),s.memory.textures--),n.remove(r[t])}n.remove(t)}(i)}function x(t){let i=n.get(t);e.deleteTexture(i.__webglTexture);let r=t.source,a=d.get(r);delete a[i.__cacheKey],s.memory.textures--}let S=0;function C(t,r){let a=n.get(t);if(t.isVideoTexture&&function(e){let t=s.render.frame;u.get(e)!==t&&(u.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&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<r;n++)t=S[n],C?M&&i.texSubImage2D(e.TEXTURE_2D,n,0,0,t.width,t.height,y,E,t.data):i.texImage2D(e.TEXTURE_2D,n,x,t.width,t.height,0,y,E,t.data);s.generateMipmaps=!1}else C?(I&&i.texStorage2D(e.TEXTURE_2D,w,x,p.width,p.height),M&&i.texSubImage2D(e.TEXTURE_2D,0,0,0,p.width,p.height,y,E,p.data)):i.texImage2D(e.TEXTURE_2D,0,x,p.width,p.height,0,y,E,p.data);else if(s.isCompressedTexture)if(s.isCompressedArrayTexture){C&&I&&i.texStorage3D(e.TEXTURE_2D_ARRAY,w,x,S[0].width,S[0].height,p.depth);for(let n=0,r=S.length;n<r;n++)t=S[n],1023!==s.format?null!==y?C?M&&i.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,n,0,0,0,t.width,t.height,p.depth,y,t.data,0,0):i.compressedTexImage3D(e.TEXTURE_2D_ARRAY,n,x,t.width,t.height,p.depth,0,t.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):C?M&&i.texSubImage3D(e.TEXTURE_2D_ARRAY,n,0,0,0,t.width,t.height,p.depth,y,E,t.data):i.texImage3D(e.TEXTURE_2D_ARRAY,n,x,t.width,t.height,p.depth,0,y,E,t.data)}else{C&&I&&i.texStorage2D(e.TEXTURE_2D,w,x,S[0].width,S[0].height);for(let n=0,r=S.length;n<r;n++)t=S[n],1023!==s.format?null!==y?C?M&&i.compressedTexSubImage2D(e.TEXTURE_2D,n,0,0,t.width,t.height,y,t.data):i.compressedTexImage2D(e.TEXTURE_2D,n,x,t.width,t.height,0,t.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):C?M&&i.texSubImage2D(e.TEXTURE_2D,n,0,0,t.width,t.height,y,E,t.data):i.texImage2D(e.TEXTURE_2D,n,x,t.width,t.height,0,y,E,t.data)}else if(s.isDataArrayTexture)C?(I&&i.texStorage3D(e.TEXTURE_2D_ARRAY,w,x,p.width,p.height,p.depth),M&&i.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,y,E,p.data)):i.texImage3D(e.TEXTURE_2D_ARRAY,0,x,p.width,p.height,p.depth,0,y,E,p.data);else if(s.isData3DTexture)C?(I&&i.texStorage3D(e.TEXTURE_3D,w,x,p.width,p.height,p.depth),M&&i.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,y,E,p.data)):i.texImage3D(e.TEXTURE_3D,0,x,p.width,p.height,p.depth,0,y,E,p.data);else if(s.isFramebufferTexture){if(I)if(C)i.texStorage2D(e.TEXTURE_2D,w,x,p.width,p.height);else{let t=p.width,n=p.height;for(let r=0;r<w;r++)i.texImage2D(e.TEXTURE_2D,r,x,t,n,0,y,E,null),t>>=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<r;n++)t=S[n],C?M&&i.texSubImage2D(e.TEXTURE_2D,n,0,0,y,E,t):i.texImage2D(e.TEXTURE_2D,n,x,y,E,t);s.generateMipmaps=!1}else if(C){if(I){let t=F(p);i.texStorage2D(e.TEXTURE_2D,w,x,t.width,t.height)}M&&i.texSubImage2D(e.TEXTURE_2D,0,0,0,y,E,p)}else i.texImage2D(e.TEXTURE_2D,0,x,y,E,p);m(s)&&f(l),u.__version=c.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}function R(t,r,s,o,h,c){let u=a.convert(s.format,s.colorSpace),d=a.convert(s.type),A=v(s.internalFormat,u,d,s.colorSpace);if(!n.get(r).__hasExternalTextures){let t=Math.max(1,r.width>>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;r<t.length;r++){let s=t[r],o=a.convert(s.format,s.colorSpace),h=a.convert(s.type),c=v(s.internalFormat,o,h,s.colorSpace),u=U(i);n&&!1===P(i)?e.renderbufferStorageMultisample(e.RENDERBUFFER,u,c,i.width,i.height):P(i)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,u,c,i.width,i.height):e.renderbufferStorage(e.RENDERBUFFER,c,i.width,i.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function D(t){let r=n.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw Error("target.depthTexture not supported in Cube render targets");var s=r.__webglFramebuffer;if(t&&t.isWebGLCubeRenderTarget)throw Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(e.FRAMEBUFFER,s),!(t.depthTexture&&t.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(t.depthTexture).__webglTexture&&t.depthTexture.image.width===t.width&&t.depthTexture.image.height===t.height||(t.depthTexture.image.width=t.width,t.depthTexture.image.height=t.height,t.depthTexture.needsUpdate=!0),C(t.depthTexture,0);let o=n.get(t.depthTexture).__webglTexture,h=U(t);if(1026===t.depthTexture.format)P(t)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,o,0,h):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,o,0);else if(1027===t.depthTexture.format)P(t)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,o,0,h):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,o,0);else throw Error("Unknown depthTexture format")}else if(a){r.__webglDepthbuffer=[];for(let n=0;n<6;n++)i.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[n]),r.__webglDepthbuffer[n]=e.createRenderbuffer(),L(r.__webglDepthbuffer[n],t,!1)}else i.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=e.createRenderbuffer(),L(r.__webglDepthbuffer,t,!1);i.bindFramebuffer(e.FRAMEBUFFER,null)}function U(e){return Math.min(r.maxSamples,e.samples)}function P(e){let i=n.get(e);return e.samples>0&&!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;r<t.length;r++){let a=t[r];1023!==s.format?null!==x?I?w&&i.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r,0,0,a.width,a.height,x,a.data):i.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r,C,a.width,a.height,0,a.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):I?w&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r,0,0,a.width,a.height,x,S,a.data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r,C,a.width,a.height,0,x,S,a.data)}}}else{if(t=s.mipmaps,I&&M){t.length>0&&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;r<t.length;r++){let a=t[r].image[n].image;I?w&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r+1,0,0,a.width,a.height,x,S,a.data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r+1,C,a.width,a.height,0,x,S,a.data)}}else{I?w&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,0,0,x,S,y[n]):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,C,x,S,y[n]);for(let r=0;r<t.length;r++){let a=t[r];I?w&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r+1,0,0,x,S,a.image[n]):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r+1,C,x,S,a.image[n])}}}m(s)&&f(e.TEXTURE_CUBE_MAP),c.__version=h.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}(o,t,s);i.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture,e.TEXTURE0+s)},this.rebindTextures=function(t,i,r){let a=n.get(t);void 0!==i&&R(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==r&&D(t)},this.setupRenderTarget=function(t){let r=t.texture,o=n.get(t),l=n.get(r);t.addEventListener("dispose",E);let h=t.textures,c=!0===t.isWebGLCubeRenderTarget,u=h.length>1;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;i<r.mipmaps.length;i++)o.__webglFramebuffer[t][i]=e.createFramebuffer()}else o.__webglFramebuffer[t]=e.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer=[];for(let t=0;t<r.mipmaps.length;t++)o.__webglFramebuffer[t]=e.createFramebuffer()}else o.__webglFramebuffer=e.createFramebuffer();if(u)for(let t=0,i=h.length;t<i;t++){let i=n.get(h[t]);void 0===i.__webglTexture&&(i.__webglTexture=e.createTexture(),s.memory.textures++)}if(t.samples>0&&!1===P(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],i.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let i=0;i<h.length;i++){let n=h[i];o.__webglColorRenderbuffer[i]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,o.__webglColorRenderbuffer[i]);let r=a.convert(n.format,n.colorSpace),s=a.convert(n.type),l=v(n.internalFormat,r,s,n.colorSpace,!0===t.isXRRenderTarget),c=U(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,c,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+i,e.RENDERBUFFER,o.__webglColorRenderbuffer[i])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(o.__webglDepthRenderbuffer=e.createRenderbuffer(),L(o.__webglDepthRenderbuffer,t,!0)),i.bindFramebuffer(e.FRAMEBUFFER,null)}}if(c){i.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),b(e.TEXTURE_CUBE_MAP,r);for(let i=0;i<6;i++)if(r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)R(o.__webglFramebuffer[i][n],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+i,n);else R(o.__webglFramebuffer[i],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0);m(r)&&f(e.TEXTURE_CUBE_MAP),i.unbindTexture()}else if(u){for(let r=0,a=h.length;r<a;r++){let a=h[r],s=n.get(a);i.bindTexture(e.TEXTURE_2D,s.__webglTexture),b(e.TEXTURE_2D,a),R(o.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0+r,e.TEXTURE_2D,0),m(a)&&f(e.TEXTURE_2D)}i.unbindTexture()}else{let n=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(n=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),i.bindTexture(n,l.__webglTexture),b(n,r),r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)R(o.__webglFramebuffer[i],t,r,e.COLOR_ATTACHMENT0,n,i);else R(o.__webglFramebuffer,t,r,e.COLOR_ATTACHMENT0,n,0);m(r)&&f(n),i.unbindTexture()}t.depthBuffer&&D(t)},this.updateRenderTargetMipmap=function(t){let r=t.textures;for(let a=0,s=r.length;a<s;a++){let s=r[a];if(m(s)){let r=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,a=n.get(s).__webglTexture;i.bindTexture(r,a),f(r),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0&&!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;t<r.length;t++)i.bindFramebuffer(e.FRAMEBUFFER,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),i.bindFramebuffer(e.FRAMEBUFFER,u.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);i.bindFramebuffer(e.READ_FRAMEBUFFER,u.__webglMultisampledFramebuffer),i.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer);for(let i=0;i<r.length;i++){l.push(e.COLOR_ATTACHMENT0+i),t.depthBuffer&&l.push(c);let A=void 0!==u.__ignoreDepthValues&&u.__ignoreDepthValues;if(!1===A&&(t.depthBuffer&&(o|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&!0!==u.__isTransmissionRenderTarget&&(o|=e.STENCIL_BUFFER_BIT)),d&&e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,u.__webglColorRenderbuffer[i]),!0===A&&(e.invalidateFramebuffer(e.READ_FRAMEBUFFER,[c]),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[c])),d){let t=n.get(r[i]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,s,0,0,a,s,o,e.NEAREST),h&&e.invalidateFramebuffer(e.READ_FRAMEBUFFER,l)}if(i.bindFramebuffer(e.READ_FRAMEBUFFER,null),i.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),d)for(let t=0;t<r.length;t++){i.bindFramebuffer(e.FRAMEBUFFER,u.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,u.__webglColorRenderbuffer[t]);let a=n.get(r[t]).__webglTexture;i.bindFramebuffer(e.FRAMEBUFFER,u.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}i.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=D,this.setupFrameBufferTexture=R,this.useMultisampledRTT=P}function at(e,t){return{convert:function(i){let n,r=arguments.length>1&&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<v.length;e++){let t=_[e];null!==t&&(_[e]=null,v[e].disconnect(t))}M=null,w=null,p.reset(),e.setRenderTarget(m),d=null,u=null,c=null,n=null,f=null,P.stop(),i.isPresenting=!1,e.setPixelRatio(E),e.setSize(y.width,y.height,!1),i.dispatchEvent({type:"sessionend"})}function B(e){for(let t=0;t<e.removed.length;t++){let i=e.removed[t],n=_.indexOf(i);n>=0&&(_[n]=null,v[n].disconnect(i))}for(let t=0;t<e.added.length;t++){let i=e.added[t],n=_.indexOf(i);if(-1===n){for(let e=0;e<v.length;e++)if(e>=_.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;e<s.length;e++)D(s[e],a);2===s.length?function(e,t,i){R.setFromMatrixPosition(t.matrixWorld),L.setFromMatrixPosition(i.matrixWorld);let n=R.distanceTo(L),r=t.projectionMatrix.elements,a=i.projectionMatrix.elements,s=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],h=(r[9]-1)/r[5],c=(r[8]-1)/r[0],u=(a[8]+1)/a[0],d=n/(-c+u),A=-(d*c);t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(A),e.translateZ(d),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert();let p=s+d,g=o+d;e.projectionMatrix.makePerspective(s*c-A,s*u+(n-A),l*o/g*p,h*o/g*p,p,g),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}(I,x,S):I.projectionMatrix.copy(x.projectionMatrix),t=e,i=I,null===(r=a)?t.matrix.copy(i.matrixWorld):(t.matrix.copy(r.matrixWorld),t.matrix.invert(),t.matrix.multiply(i.matrixWorld)),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(i.projectionMatrix),t.projectionMatrixInverse.copy(i.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*ey*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)},this.getCamera=function(){return I},this.getFoveation=function(){if(null!==u||null!==d)return o},this.setFoveation=function(e){o=e,null!==u&&(u.fixedFoveation=e),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==p.texture};let U=null,P=new i8;P.setAnimationLoop(function(t,r){if(h=r.getViewerPose(l||a),A=r,null!==h){let t=h.views;null!==d&&(e.setRenderTargetFramebuffer(f,d.framebuffer),e.setRenderTarget(f));let i=!1;t.length!==I.cameras.length&&(I.cameras.length=0,i=!0);for(let n=0;n<t.length;n++){let r=t[n],a=null;if(null!==d)a=d.getViewport(r);else{let t=c.getViewSubImage(u,r);a=t.viewport,0===n&&(e.setRenderTargetTextures(f,t.colorTexture,u.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(f))}let s=C[n];void 0===s&&((s=new iY).layers.enable(n),s.viewport=new eq,C[n]=s),s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.quaternion,s.scale),s.projectionMatrix.fromArray(r.projectionMatrix),s.projectionMatrixInverse.copy(s.projectionMatrix).invert(),s.viewport.set(a.x,a.y,a.width,a.height),0===n&&(I.matrix.copy(s.matrix),I.matrix.decompose(I.position,I.quaternion,I.scale)),!0===i&&I.cameras.push(s)}let r=n.enabledFeatures;if(r&&r.includes("depth-sensing")){let i=c.getDepthInformation(t[0]);i&&i.isValid&&i.texture&&p.init(e,i,n.renderState)}}for(let e=0;e<v.length;e++){let t=_[e],i=v[e];null!==t&&void 0!==i&&i.update(t,r,l||a)}p.render(e,I),U&&U(t,r),r.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:r}),A=null}),this.setAnimationLoop=function(e){U=e},this.dispose=function(){}}}let al=new tb,ah=new tv;function ac(e,t){function i(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function n(n,r){n.opacity.value=r.opacity,r.color&&n.diffuse.value.copy(r.color),r.emissive&&n.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(n.map.value=r.map,i(r.map,n.mapTransform)),r.alphaMap&&(n.alphaMap.value=r.alphaMap,i(r.alphaMap,n.alphaMapTransform)),r.bumpMap&&(n.bumpMap.value=r.bumpMap,i(r.bumpMap,n.bumpMapTransform),n.bumpScale.value=r.bumpScale,1===r.side&&(n.bumpScale.value*=-1)),r.normalMap&&(n.normalMap.value=r.normalMap,i(r.normalMap,n.normalMapTransform),n.normalScale.value.copy(r.normalScale),1===r.side&&n.normalScale.value.negate()),r.displacementMap&&(n.displacementMap.value=r.displacementMap,i(r.displacementMap,n.displacementMapTransform),n.displacementScale.value=r.displacementScale,n.displacementBias.value=r.displacementBias),r.emissiveMap&&(n.emissiveMap.value=r.emissiveMap,i(r.emissiveMap,n.emissiveMapTransform)),r.specularMap&&(n.specularMap.value=r.specularMap,i(r.specularMap,n.specularMapTransform)),r.alphaTest>0&&(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;e<n;e++){let n=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=n.length;e<t;e++){let t=n[e],r=Array.isArray(t.value)?t.value:[t.value];for(let e=0,n=r.length;e<n;e++){let n=l(r[e]),a=i%16;0!==a&&16-a<n.boundary&&(i+=16-a),t.__data=new Float32Array(n.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=i,i+=n.storage}}}let n=i%16;n>0&&(i+=16-n),e.__size=i,e.__cache={}}(i),u=function(t){let i=function(){for(let e=0;e<o;e++)if(-1===s.indexOf(e))return s.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=i;let n=e.createBuffer(),r=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,n),e.bufferData(e.UNIFORM_BUFFER,r,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,i,n),n}(i),r[i.id]=u,i.addEventListener("dispose",h));let d=c.program;n.updateUBOMapping(i,d);let A=t.render.frame;a[i.id]!==A&&(function(t){let i=r[t.id],n=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,i);for(let t=0,i=n.length;t<i;t++){let i=Array.isArray(n[t])?n[t]:[n[t]];for(let n=0,r=i.length;n<r;n++){let r=i[n];if(!0===function(e,t,i,n){let r=e.value,a=t+"_"+i;if(void 0===n[a])return"number"==typeof r||"boolean"==typeof r?n[a]=r:n[a]=r.clone(),!0;{let e=n[a];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return n[a]=r,!0}else if(!1===e.equals(r))return e.copy(r),!0}return!1}(r,t,n,a)){let t=r.__offset,i=Array.isArray(r.value)?r.value:[r.value],n=0;for(let a=0;a<i.length;a++){let s=i[a],o=l(s);"number"==typeof s||"boolean"==typeof s?(r.__data[0]=s,e.bufferSubData(e.UNIFORM_BUFFER,t+n,r.__data)):s.isMatrix3?(r.__data[0]=s.elements[0],r.__data[1]=s.elements[1],r.__data[2]=s.elements[2],r.__data[3]=0,r.__data[4]=s.elements[3],r.__data[5]=s.elements[4],r.__data[6]=s.elements[5],r.__data[7]=0,r.__data[8]=s.elements[6],r.__data[9]=s.elements[7],r.__data[10]=s.elements[8],r.__data[11]=0):(s.toArray(r.__data,n),n+=o.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,r.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(i),a[i.id]=A)},dispose:function(){for(let t in r)e.deleteBuffer(r[t]);s=[],r={},a={}}}}class ad{get coordinateSystem(){return 2e3}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=e===eu?"display-p3":"srgb",t.unpackColorSpace=eF.workingColorSpace===ed?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}constructor(e={}){let t,i,n,r,a,s,o,l,h,c,u,d,A,p,g,m,f,v,_,y,E,x,S,C,I,{canvas:M=function(){let e=eB("canvas");return e.style.display="block",e}(),context:w=null,depth:b=!0,stencil:T=!1,alpha:B=!1,antialias:R=!1,premultipliedAlpha:L=!0,preserveDrawingBuffer:D=!1,powerPreference:U="default",failIfMajorPerformanceCaveat:P=!1}=e;if(this.isWebGLRenderer=!0,null!==w){if("undefined"!=typeof WebGLRenderingContext&&w instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");t=w.getContextAttributes().alpha}else t=B;let N=new Uint32Array(4),F=new Int32Array(4),Q=null,O=null,k=[],G=[];this.domElement=M,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=eh,this._useLegacyLights=!1,this.toneMapping=0,this.toneMappingExposure=1;let H=this,z=!1,V=0,W=0,q=null,X=-1,j=null,Y=new eq,K=new eq,J=null,Z=new t6(0),$=0,ee=M.width,et=M.height,ei=1,en=null,er=null,ea=new eq(0,0,ee,et),es=new eq(0,0,ee,et),eo=!1,el=new i5,eu=!1,ed=!1,eA=new tv,ep=new eM,eg=new eZ,em={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ef(){return null===q?ei:1}let ev=w;function e_(e,t){let i=M.getContext(e,t);return null!==i?i:null}try{if("setAttribute"in M&&M.setAttribute("data-engine","three.js r".concat("163")),M.addEventListener("webglcontextlost",ex,!1),M.addEventListener("webglcontextrestored",eS,!1),M.addEventListener("webglcontextcreationerror",eC,!1),null===ev){let e="webgl2";if(ev=e_(e,{alpha:!0,depth:b,stencil:T,antialias:R,premultipliedAlpha:L,preserveDrawingBuffer:D,powerPreference:U,failIfMajorPerformanceCaveat:P}),null===ev)if(e_(e))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function ey(){(i=new nT(ev)).init(),n=new nl(ev,i,e),S=new at(ev,i),r=new r7(ev),a=new nL(ev),s=new rY,o=new ae(ev,i,r,s,n,S,a),l=new nc(H),h=new nb(H),c=new i6(ev),C=new ns(ev,c),u=new nB(ev,c,a,C),d=new nU(ev,u,c,a),y=new nD(ev,n,o),f=new nh(s),A=new rj(H,l,h,i,n,C,f),p=new ac(H,s),g=new r$,m=new r5(i),_=new na(H,l,h,r,d,t,L),v=new r9(H,d,n),I=new au(ev,a,n,r),E=new no(ev,i,a),x=new nR(ev,i,a),a.programs=A.programs,H.capabilities=n,H.extensions=i,H.properties=s,H.renderLists=g,H.shadowMap=v,H.state=r,H.info=a}ey();let eE=new ao(H,ev);function ex(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),z=!0}function eS(){console.log("THREE.WebGLRenderer: Context Restored."),z=!1;let e=a.autoReset,t=v.enabled,i=v.autoUpdate,n=v.needsUpdate,r=v.type;ey(),a.autoReset=e,v.enabled=t,v.autoUpdate=i,v.needsUpdate=n,v.type=r}function eC(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function eI(e){var t;let i=e.target;i.removeEventListener("dispose",eI),function(e){let t=s.get(e).programs;void 0!==t&&(t.forEach(function(e){A.releaseProgram(e)}),e.isShaderMaterial&&A.releaseShaderCache(e))}(t=i),s.remove(t)}function ew(e,t,i){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,eN(e,t,i),e.side=0,e.needsUpdate=!0,eN(e,t,i),e.side=2):eN(e,t,i)}this.xr=eE,this.getContext=function(){return ev},this.getContextAttributes=function(){return ev.getContextAttributes()},this.forceContextLoss=function(){let e=i.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=i.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return ei},this.setPixelRatio=function(e){void 0!==e&&(ei=e,this.setSize(ee,et,!1))},this.getSize=function(e){return e.set(ee,et)},this.setSize=function(e,t){let i=!(arguments.length>2)||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;t<i;t++){let i=e[t];I.update(i,L),I.bind(i,L)}}return L}(e,t,i,a,d);r.setMaterial(a,m);let _=i.index,S=1;if(!0===a.wireframe){if(void 0===(_=u.getWireframeAttribute(i)))return;S=2}let M=i.drawRange,w=i.attributes.position,b=M.start*S,T=(M.start+M.count)*S;null!==A&&(b=Math.max(b,A.start*S),T=Math.min(T,(A.start+A.count)*S)),null!==_?(b=Math.max(b,0),T=Math.min(T,_.count)):null!=w&&(b=Math.max(b,0),T=Math.min(T,w.count));let B=T-b;if(B<0||B===1/0)return;C.setup(d,a,v,i,_);let R=E;if(null!==_&&(g=c.get(_),(R=x).setIndex(g)),d.isMesh)!0===a.wireframe?(r.setLineWidth(a.wireframeLinewidth*ef()),R.setMode(ev.LINES)):R.setMode(ev.TRIANGLES);else if(d.isLine){let e=a.linewidth;void 0===e&&(e=1),r.setLineWidth(e*ef()),d.isLineSegments?R.setMode(ev.LINES):d.isLineLoop?R.setMode(ev.LINE_LOOP):R.setMode(ev.LINE_STRIP)}else d.isPoints?R.setMode(ev.POINTS):d.isSprite&&R.setMode(ev.TRIANGLES);if(d.isBatchedMesh)R.renderMultiDraw(d._multiDrawStarts,d._multiDrawCounts,d._multiDrawCount);else if(d.isInstancedMesh)R.renderInstances(b,B,d.count);else if(i.isInstancedBufferGeometry){let e=void 0!==i._maxInstanceCount?i._maxInstanceCount:1/0,t=Math.min(i.instanceCount,e);R.renderInstances(b,B,t)}else R.render(b,B)},this.compile=function(e,t){let i=arguments.length>2&&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;r<t.length;r++){let a=t[r];ew(a,i,e),n.add(a)}else ew(t,i,e),n.add(t)}),G.pop(),O=null,n},this.compileAsync=function(e,t){let n=arguments.length>2&&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;e<i;e++){let i=t[e],a=i.object,s=i.geometry,o=i.material,l=i.group;if(2===o.side&&a.layers.test(r.layers)){let e=o.side;o.side=1,o.needsUpdate=!0,eP(a,n,r,s,o,l),o.side=e,o.needsUpdate=!0,c=!0}}!0===c&&(o.updateMultisampleRenderTarget(a),o.updateRenderTargetMipmap(a)),H.setRenderTarget(l),H.setClearColor(Z,$),H.toneMapping=h}(l,h,t,n),a&&r.viewport(Y.copy(a)),l.length>0&&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;r<a;r++){let a=e[r],s=a.object,o=a.geometry,l=null===n?a.material:n,h=a.group;s.layers.test(i.layers)&&eP(s,t,i,o,l,h)}}function eP(e,t,i,n,r,a){e.onBeforeRender(H,t,i,n,r,a),e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),r.onBeforeRender(H,t,i,n,e,a),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,r.needsUpdate=!0,H.renderBufferDirect(i,t,n,r,e,a),r.side=0,r.needsUpdate=!0,H.renderBufferDirect(i,t,n,r,e,a),r.side=2):H.renderBufferDirect(i,t,n,r,e,a),e.onAfterRender(H,t,i,n,r,a)}function eN(e,t,i){var n;!0!==t.isScene&&(t=em);let r=s.get(e),a=O.state.lights,o=O.state.shadowsArray,c=a.state.version,u=A.getParameters(e,a.state,o,t,i),d=A.getProgramCacheKey(u),p=r.programs;r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.envMap=(e.isMeshStandardMaterial?h:l).get(e.envMap||r.environment),r.envMapRotation=null!==r.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===p&&(e.addEventListener("dispose",eI),r.programs=p=new Map);let g=p.get(d);if(void 0!==g){if(r.currentProgram===g&&r.lightsStateVersion===c)return eQ(e,u),g}else u.uniforms=A.getUniforms(e),e.onBuild(i,u,H),e.onBeforeCompile(u,H),g=A.acquireProgram(u,d),p.set(d,g),r.uniforms=u.uniforms;let m=r.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(m.clippingPlanes=f.uniform),eQ(e,u),r.needsLights=(n=e).isMeshLambertMaterial||n.isMeshToonMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isShadowMaterial||n.isShaderMaterial&&!0===n.lights,r.lightsStateVersion=c,r.needsLights&&(m.ambientLightColor.value=a.state.ambient,m.lightProbe.value=a.state.probe,m.directionalLights.value=a.state.directional,m.directionalLightShadows.value=a.state.directionalShadow,m.spotLights.value=a.state.spot,m.spotLightShadows.value=a.state.spotShadow,m.rectAreaLights.value=a.state.rectArea,m.ltc_1.value=a.state.rectAreaLTC1,m.ltc_2.value=a.state.rectAreaLTC2,m.pointLights.value=a.state.point,m.pointLightShadows.value=a.state.pointShadow,m.hemisphereLights.value=a.state.hemi,m.directionalShadowMap.value=a.state.directionalShadowMap,m.directionalShadowMatrix.value=a.state.directionalShadowMatrix,m.spotShadowMap.value=a.state.spotShadowMap,m.spotLightMatrix.value=a.state.spotLightMatrix,m.spotLightMap.value=a.state.spotLightMap,m.pointShadowMap.value=a.state.pointShadowMap,m.pointShadowMatrix.value=a.state.pointShadowMatrix),r.currentProgram=g,r.uniformsList=null,g}function eF(e){if(null===e.uniformsList){let t=e.currentProgram.getUniforms();e.uniformsList=rT.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function eQ(e,t){let i=s.get(e);i.outputColorSpace=t.outputColorSpace,i.batching=t.batching,i.instancing=t.instancing,i.instancingColor=t.instancingColor,i.instancingMorph=t.instancingMorph,i.skinning=t.skinning,i.morphTargets=t.morphTargets,i.morphNormals=t.morphNormals,i.morphColors=t.morphColors,i.morphTargetsCount=t.morphTargetsCount,i.numClippingPlanes=t.numClippingPlanes,i.numIntersection=t.numClipIntersection,i.vertexAlphas=t.vertexAlphas,i.vertexTangents=t.vertexTangents,i.toneMapping=t.toneMapping}eL.setAnimationLoop(function(e){eb&&eb(e)}),"undefined"!=typeof self&&eL.setContext(self),this.setAnimationLoop=function(e){eb=e,eE.setAnimationLoop(e),null===e?eL.stop():eL.start()},eE.addEventListener("sessionstart",eT),eE.addEventListener("sessionend",eR),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===z)return;!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===eE.enabled&&!0===eE.isPresenting&&(!0===eE.cameraAutoUpdate&&eE.updateCamera(t),t=eE.getCamera()),!0===e.isScene&&e.onBeforeRender(H,e,t,q),(O=m.get(e,G.length)).init(),G.push(O),eA.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),el.setFromProjectionMatrix(eA),ed=this.localClippingEnabled,eu=f.init(this.clippingPlanes,ed),(Q=g.get(e,k.length)).init(),k.push(Q),function e(t,i,n,r){if(!1===t.visible)return;if(t.layers.test(i.layers)){if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(i);else if(t.isLight)O.pushLight(t),t.castShadow&&O.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||el.intersectsSprite(t)){r&&eg.setFromMatrixPosition(t.matrixWorld).applyMatrix4(eA);let e=d.update(t),i=t.material;i.visible&&Q.push(t,e,i,n,eg.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||el.intersectsObject(t))){let e=d.update(t),i=t.material;if(r&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),eg.copy(t.boundingSphere.center)):(null===e.boundingSphere&&e.computeBoundingSphere(),eg.copy(e.boundingSphere.center)),eg.applyMatrix4(t.matrixWorld).applyMatrix4(eA)),Array.isArray(i)){let r=e.groups;for(let a=0,s=r.length;a<s;a++){let s=r[a],o=i[s.materialIndex];o&&o.visible&&Q.push(t,e,o,n,eg.z,s)}}else i.visible&&Q.push(t,e,i,n,eg.z,null)}}let a=t.children;for(let t=0,s=a.length;t<s;t++)e(a[t],i,n,r)}(e,t,0,H.sortObjects),Q.finish(),!0===H.sortObjects&&Q.sort(en,er),this.info.render.frame++,!0===eu&&f.beginShadows();let i=O.state.shadowsArray;if(v.render(i,e,t),!0===eu&&f.endShadows(),!0===this.info.autoReset&&this.info.reset(),(!1===eE.enabled||!1===eE.isPresenting||!1===eE.hasDepthSensing())&&_.render(Q,e),O.setupLights(H._useLegacyLights),t.isArrayCamera){let i=t.cameras;for(let t=0,n=i.length;t<n;t++){let n=i[t];eD(Q,e,n,n.viewport)}}else eD(Q,e,t);null!==q&&(o.updateMultisampleRenderTarget(q),o.updateRenderTargetMipmap(q)),!0===e.isScene&&e.onAfterRender(H,e,t),C.resetDefaultState(),X=-1,j=null,G.pop(),O=G.length>0?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;n<r;n++)this.array[e+n]=t.array[i+n];return this}set(e){let t=arguments.length>1&&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;t<i;t++)ag.fromBufferAttribute(this,t),ag.applyMatrix4(e),this.setXYZ(t,ag.x,ag.y,ag.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)ag.fromBufferAttribute(this,t),ag.applyNormalMatrix(e),this.setXYZ(t,ag.x,ag.y,ag.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)ag.fromBufferAttribute(this,t),ag.transformDirection(e),this.setXYZ(t,ag.x,ag.y,ag.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=eS(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=eC(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=eC(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=eC(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=eC(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=eC(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=eS(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=eS(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=eS(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=eS(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=eC(t,this.array),i=eC(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=eC(t,this.array),i=eC(i,this.array),n=eC(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=n,this}setXYZW(e,t,i,n,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=eC(t,this.array),i=eC(i,this.array),n=eC(n,this.array),r=eC(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=n,this.data.array[e+3]=r,this}clone(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new am(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized);{console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let i=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[i+t])}return new io(new this.array.constructor(e),this.itemSize,this.normalized)}}toJSON(e){if(void 0!==e)return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized};{console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let t=0;t<this.count;t++){let i=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[i+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}}constructor(e,t,i,n=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=n}}let af=new eZ,av=new eq,a_=new eq,ay=new eZ,aE=new tv,ax=new eZ,aS=new th,aC=new tv,aI=new tf;class aM extends iF{computeBoundingBox(){let e=this.geometry;null===this.boundingBox&&(this.boundingBox=new e1),this.boundingBox.makeEmpty();let t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,ax),this.boundingBox.expandByPoint(ax)}computeBoundingSphere(){let e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new th),this.boundingSphere.makeEmpty();let t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,ax),this.boundingSphere.expandByPoint(ax)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){let i=this.material,n=this.matrixWorld;if(void 0!==i)null===this.boundingSphere&&this.computeBoundingSphere(),aS.copy(this.boundingSphere),aS.applyMatrix4(n),!1!==e.ray.intersectsSphere(aS)&&(aC.copy(n).invert(),aI.copy(e.ray).applyMatrix4(aC),(null===this.boundingBox||!1!==aI.intersectsBox(this.boundingBox))&&this._computeIntersections(e,t,aI))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){let e=new eq,t=this.geometry.attributes.skinWeight;for(let i=0,n=t.count;i<n;i++){e.fromBufferAttribute(t,i);let n=1/e.manhattanLength();n!==1/0?e.multiplyScalar(n):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===el?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){let i=this.skeleton,n=this.geometry;av.fromBufferAttribute(n.attributes.skinIndex,e),a_.fromBufferAttribute(n.attributes.skinWeight,e),af.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){let n=a_.getComponent(e);if(0!==n){let r=av.getComponent(e);aE.multiplyMatrices(i.bones[r].matrixWorld,i.boneInverses[r]),t.addScaledVector(ay.copy(af).applyMatrix4(aE),n)}}return t.applyMatrix4(this.bindMatrixInverse)}constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=el,this.bindMatrix=new tv,this.bindMatrixInverse=new tv,this.boundingBox=null,this.boundingSphere=null}}class aw extends tW{constructor(){super(),this.isBone=!0,this.type="Bone"}}class ab extends eW{constructor(e=null,t=1,i=1,n,r,a,s,o,l=1003,h=1003,c,u){super(null,a,s,o,l,h,n,r,c,u),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}let aT=new tv,aB=new tv;class aR{init(){let e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new tv)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){let t=new tv;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){let t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){let e=this.bones,t=this.boneInverses,i=this.boneMatrices,n=this.boneTexture;for(let n=0,r=e.length;n<r;n++){let r=e[n]?e[n].matrixWorld:aB;aT.multiplyMatrices(r,t[n]),aT.toArray(i,16*n)}null!==n&&(n.needsUpdate=!0)}clone(){return new aR(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length),t=new Float32Array((e=Math.max(e=4*Math.ceil(e/4),4))*e*4);t.set(this.boneMatrices);let i=new ab(t,e,e,1023,1015);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){let i=this.bones[t];if(i.name===e)return i}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,n=e.bones.length;i<n;i++){let n=e.bones[i],r=t[n];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",n),r=new aw),this.bones.push(r),this.boneInverses.push(new tv().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){let e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;let t=this.bones,i=this.boneInverses;for(let n=0,r=t.length;n<r;n++){let r=t[n];e.bones.push(r.uuid);let a=i[n];e.boneInverses.push(a.toArray())}return e}constructor(e=[],t=[]){this.uuid=eE(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}}class aL extends io{copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){let e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}constructor(e,t,i,n=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=n}}let aD=new tv,aU=new tv,aP=[],aN=new e1,aF=new tv,aQ=new iF,aO=new th;class ak extends iF{computeBoundingBox(){let e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new e1),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,aD),aN.copy(e.boundingBox).applyMatrix4(aD),this.boundingBox.union(aN)}computeBoundingSphere(){let e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new th),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,aD),aO.copy(e.boundingSphere).applyMatrix4(aD),this.boundingSphere.union(aO)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.morphTexture&&(this.morphTexture=e.morphTexture.clone()),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}getMorphAt(e,t){let i=t.morphTargetInfluences,n=this.morphTexture.source.data.data,r=e*(i.length+1)+1;for(let e=0;e<i.length;e++)i[e]=n[r+e]}raycast(e,t){let i=this.matrixWorld,n=this.count;if((aQ.geometry=this.geometry,aQ.material=this.material,void 0!==aQ.material)&&(null===this.boundingSphere&&this.computeBoundingSphere(),aO.copy(this.boundingSphere),aO.applyMatrix4(i),!1!==e.ray.intersectsSphere(aO)))for(let r=0;r<n;r++){this.getMatrixAt(r,aD),aU.multiplyMatrices(i,aD),aQ.matrixWorld=aU,aQ.raycast(e,aP);for(let e=0,i=aP.length;e<i;e++){let i=aP[e];i.instanceId=r,i.object=this,t.push(i)}aP.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new aL(new Float32Array(3*this.instanceMatrix.count),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}setMorphAt(e,t){let i=t.morphTargetInfluences,n=i.length+1;null===this.morphTexture&&(this.morphTexture=new ab(new Float32Array(n*this.count),n,this.count,1028,1015));let r=this.morphTexture.source.data.data,a=0;for(let e=0;e<i.length;e++)a+=i[e];let s=this.geometry.morphTargetsRelative?1:1-a,o=n*e;r[o]=s,r.set(i,o+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null),this}constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new aL(new Float32Array(16*i),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<i;e++)this.setMatrixAt(e,aF)}}class aG extends ie{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new t6(0xffffff),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}}let aH=new eZ,az=new eZ,aV=new tv,aW=new tf,aq=new th;class aX extends tW{copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,i=[0];for(let e=1,n=t.count;e<n;e++)aH.fromBufferAttribute(t,e-1),az.fromBufferAttribute(t,e),i[e]=i[e-1],i[e]+=aH.distanceTo(az);e.setAttribute("lineDistance",new ic(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let i=this.geometry,n=this.matrixWorld,r=e.params.Line.threshold,a=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),aq.copy(i.boundingSphere),aq.applyMatrix4(n),aq.radius+=r,!1===e.ray.intersectsSphere(aq))return;aV.copy(n).invert(),aW.copy(e.ray).applyMatrix4(aV);let s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=new eZ,h=new eZ,c=new eZ,u=new eZ,d=this.isLineSegments?2:1,A=i.index,p=i.attributes.position;if(null!==A){let i=Math.max(0,a.start),n=Math.min(A.count,a.start+a.count);for(let r=i,a=n-1;r<a;r+=d){let i=A.getX(r),n=A.getX(r+1);if(l.fromBufferAttribute(p,i),h.fromBufferAttribute(p,n),aW.distanceSqToSegment(l,h,u,c)>o)continue;u.applyMatrix4(this.matrixWorld);let a=e.ray.origin.distanceTo(u);a<e.near||a>e.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;r<a;r+=d){if(l.fromBufferAttribute(p,r),h.fromBufferAttribute(p,r+1),aW.distanceSqToSegment(l,h,u,c)>o)continue;u.applyMatrix4(this.matrixWorld);let i=e.ray.origin.distanceTo(u);i<e.near||i>e.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;e<t;e++){let t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}constructor(e=new i_,t=new aG){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}}let aj=new eZ,aY=new eZ;class aK extends aX{computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,i=[];for(let e=0,n=t.count;e<n;e+=2)aj.fromBufferAttribute(t,e),aY.fromBufferAttribute(t,e+1),i[e]=0===e?0:i[e-1],i[e+1]=i[e]+aj.distanceTo(aY);e.setAttribute("lineDistance",new ic(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}}class aJ extends aX{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class aZ extends ie{copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new t6(0xffffff),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}}let a$=new tv,a0=new tf,a1=new th,a2=new eZ;class a3 extends tW{copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let i=this.geometry,n=this.matrixWorld,r=e.params.Points.threshold,a=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),a1.copy(i.boundingSphere),a1.applyMatrix4(n),a1.radius+=r,!1===e.ray.intersectsSphere(a1))return;a$.copy(n).invert(),a0.copy(e.ray).applyMatrix4(a$);let s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=i.index,h=i.attributes.position;if(null!==l){let i=Math.max(0,a.start),r=Math.min(l.count,a.start+a.count);for(let a=i;a<r;a++){let i=l.getX(a);a2.fromBufferAttribute(h,i),a4(a2,i,o,n,e,t,this)}}else{let i=Math.max(0,a.start),r=Math.min(h.count,a.start+a.count);for(let a=i;a<r;a++)a2.fromBufferAttribute(h,a),a4(a2,a,o,n,e,t,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;e<t;e++){let t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}constructor(e=new i_,t=new aZ){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}}function a4(e,t,i,n,r,a,s){let o=a0.distanceSqToPoint(e);if(o<i){let i=new eZ;a0.closestPointToPoint(e,i),i.applyMatrix4(n);let l=r.ray.origin.distanceTo(i);if(l<r.near||l>r.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)<Number.EPSILON;for(;n<0;)n+=i;for(;n>i;)n-=i;n<Number.EPSILON&&(n=r?0:i),!0!==this.aClockwise||r||(n===i?n=-i:n-=i);let a=this.aStartAngle+e*n,s=this.aX+this.xRadius*Math.cos(a),o=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),i=s-this.aX,n=o-this.aY;s=i*e-n*t+this.aX,o=i*t+n*e+this.aY}return t.set(s,o)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}constructor(e=0,t=0,i=1,n=1,r=0,a=2*Math.PI,s=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}}function si(){let e=0,t=0,i=0,n=0;function r(r,a,s,o){e=r,t=s,i=-3*r+3*a-2*s-o,n=2*r-2*a+s+o}return{initCatmullRom:function(e,t,i,n,a){r(t,i,a*(i-e),a*(n-t))},initNonuniformCatmullRom:function(e,t,i,n,a,s,o){let l=(t-e)/a-(i-e)/(a+s)+(i-t)/s,h=(i-t)/s-(n-t)/(s+o)+(n-i)/o;r(t,i,l*=s,h*=s)},calc:function(r){let a=r*r;return e+t*r+i*a+a*r*n}}}let sn=new eZ,sr=new si,sa=new si,ss=new si;function so(e,t,i,n,r){let a=(n-t)*.5,s=(r-i)*.5,o=e*e;return e*o*(2*i-2*n+a+s)+(-3*i+3*n-2*a-s)*o+a*e+i}function sl(e,t,i,n){return function(e,t){let i=1-e;return i*i*t}(e,t)+2*(1-e)*e*i+e*e*n}function sh(e,t,i,n,r){return function(e,t){let i=1-e;return i*i*i*t}(e,t)+function(e,t){let i=1-e;return 3*i*i*e*t}(e,i)+3*(1-e)*e*e*n+e*e*e*r}class sc 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,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;t<i;t++){let i=e.points[t];this.points.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(new eM().fromArray(i))}return this}constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}}class sg extends i_{copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new sg(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}constructor(e=1,t=32,i=16,n=0,r=2*Math.PI,a=0,s=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:n,phiLength:r,thetaStart:a,thetaLength:s},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));let o=Math.min(a+s,Math.PI),l=0,h=[],c=new eZ,u=new eZ,d=[],A=[],p=[],g=[];for(let d=0;d<=i;d++){let m=[],f=d/i,v=0;0===d&&0===a?v=.5/t:d===i&&o===Math.PI&&(v=-.5/t);for(let i=0;i<=t;i++){let o=i/t;c.x=-e*Math.cos(n+o*r)*Math.sin(a+f*s),c.y=e*Math.cos(a+f*s),c.z=e*Math.sin(n+o*r)*Math.sin(a+f*s),A.push(c.x,c.y,c.z),u.copy(c).normalize(),p.push(u.x,u.y,u.z),g.push(o+v,1-f),m.push(l++)}h.push(m)}for(let e=0;e<i;e++)for(let n=0;n<t;n++){let t=h[e][n+1],r=h[e][n],s=h[e+1][n],l=h[e+1][n+1];(0!==e||a>0)&&d.push(t,r,l),(e!==i-1||o<Math.PI)&&d.push(r,s,l)}this.setIndex(d),this.setAttribute("position",new ic(A,3)),this.setAttribute("normal",new ic(p,3)),this.setAttribute("uv",new ic(g,2))}}class sm extends ie{copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new t6(0xffffff),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new t6(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new eM(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new tb,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}}class sf extends sm{get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=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<n)){for(let a=i+2;;){if(void 0===n){if(e<r)break n;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(r=n,e<(n=t[++i]))break t}a=t.length;break i}if(!(e>=r)){let s=t[1];e<s&&(i=2,r=s);for(let a=i-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(i===a)break;if(n=r,e>=(r=t[--i-1]))break t}a=i,i=0;break i}break e}for(;i<a;){let n=i+a>>>1;e<t[n]?a=n:i=n+1}if(n=t[i],void 0===(r=t[i-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===n)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,e,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=e*n;for(let e=0;e!==n;++e)t[e]=i[r+e];return t}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}constructor(e,t,i,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}}class sx extends sE{intervalChanged_(e,t,i){let n=this.parameterPositions,r=e-2,a=e+1,s=n[r],o=n[a];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:r=e,s=2*t-i;break;case 2402:r=n.length-2,s=t+n[r]-n[r+1];break;default:r=e,s=i}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:a=e,o=2*i-t;break;case 2402:a=1,o=i+n[1]-n[0];break;default:a=e-1,o=t}let l=(i-t)*.5,h=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(o-i),this._offsetPrev=r*h,this._offsetNext=a*h}interpolate_(e,t,i,n){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,h=this._offsetPrev,c=this._offsetNext,u=this._weightPrev,d=this._weightNext,A=(i-t)/(n-t),p=A*A,g=p*A,m=-u*g+2*u*p-u*A,f=(1+u)*g+(-1.5-2*u)*p+(-.5+u)*A+1,v=(-1-d)*g+(1.5+d)*p+.5*A,_=d*g-d*p;for(let e=0;e!==s;++e)r[e]=m*a[h+e]+f*a[l+e]+v*a[o+e]+_*a[c+e];return r}constructor(e,t,i,n){super(e,t,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}}class sS extends sE{interpolate_(e,t,i,n){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,h=(i-t)/(n-t),c=1-h;for(let e=0;e!==s;++e)r[e]=a[l+e]*c+a[o+e]*h;return r}constructor(e,t,i,n){super(e,t,i,n)}}class sC extends sE{interpolate_(e){return this.copySampleValue_(e-1)}constructor(e,t,i,n){super(e,t,i,n)}}class sI{static toJSON(e){let t,i=e.constructor;if(i.toJSON!==this.toJSON)t=i.toJSON(e);else{t={name:e.name,times:sv(e.times,Array),values:sv(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}InterpolantFactoryMethodDiscrete(e){return new sC(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new sS(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new sx(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){let t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t);return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){let t=this.times;for(let i=0,n=t.length;i!==n;++i)t[i]+=e}return this}scale(e){if(1!==e){let t=this.times;for(let i=0,n=t.length;i!==n;++i)t[i]*=e}return this}trim(e,t){let i=this.times,n=i.length,r=0,a=n-1;for(;r!==n&&i[r]<e;)++r;for(;-1!==a&&i[a]>t;)--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;s<r;++s){let r=!1,o=e[s];if(o!==e[s+1]&&(1!==s||o!==e[0]))if(n)r=!0;else{let e=s*i,n=e-i,a=e+i;for(let s=0;s!==i;++s){let i=t[e+s];if(i!==t[n+s]||i!==t[a+s]){r=!0;break}}}if(r){if(s!==a){e[a]=e[s];let n=s*i,r=a*i;for(let e=0;e!==i;++e)t[r+e]=t[n+e]}++a}}if(r>0){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;e<r;e++){let s=[],o=[];s.push((e+r-1)%r,e,(e+1)%r),o.push(0,1,0);let l=function(e){let t=e.length,i=Array(t);for(let e=0;e!==t;++e)i[e]=e;return i.sort(function(t,i){return e[t]-e[i]}),i}(s);s=s_(s,1,l),o=s_(o,1,l),n||0!==s[0]||(s.push(r),o.push(o[0])),a.push(new sb(".morphTargetInfluences["+t[e].name+"]",s,o).scale(1/i))}return new this(e,-1,a)}static findByName(e,t){let i=e;Array.isArray(e)||(i=e.geometry&&e.geometry.animations||e.animations);for(let e=0;e<i.length;e++)if(i[e].name===t)return i[e];return null}static CreateClipsFromMorphTargetSequences(e,t,i){let n={},r=/^([\w-]*?)([\d]+)$/;for(let t=0,i=e.length;t<i;t++){let i=e[t],a=i.name.match(r);if(a&&a.length>1){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<l.length;e++){let r=l[e].keys;if(r&&0!==r.length)if(r[0].morphTargets){let e,t={};for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let i=0;i<r[e].morphTargets.length;i++)t[r[e].morphTargets[i]]=-1;for(let i in t){let t=[],a=[];for(let n=0;n!==r[e].morphTargets.length;++n){let n=r[e];t.push(n.time),a.push(+(n.morphTarget===i))}n.push(new sb(".morphTargetInfluence["+i+"]",t,a))}o=t.length*a}else{let a=".bones["+t[e].name+"]";i(sL,a+".position",r,"pos",n),i(sB,a+".quaternion",r,"rot",n),i(sL,a+".scale",r,"scl",n)}}return 0===n.length?null:new this(r,o,n,s)}resetDuration(){let e=this.tracks,t=0;for(let i=0,n=e.length;i!==n;++i){let e=this.tracks[i];t=Math.max(t,e.times[e.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){let e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}constructor(e="",t=-1,i=[],n=2500){this.name=e,this.tracks=i,this.duration=t,this.blendMode=n,this.uuid=eE(),this.duration<0&&this.resetDuration()}}let sU={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class sP{constructor(e,t,i){let n,r=this,a=!1,s=0,o=0,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(e){o++,!1===a&&void 0!==r.onStart&&r.onStart(e,s,o),a=!0},this.itemEnd=function(e){s++,void 0!==r.onProgress&&r.onProgress(e,s,o),s===o&&(a=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(e){void 0!==r.onError&&r.onError(e)},this.resolveURL=function(e){return n?n(e):e},this.setURLModifier=function(e){return n=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){let t=l.indexOf(e);return -1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,i=l.length;t<i;t+=2){let i=l[t],n=l[t+1];if(i.global&&(i.lastIndex=0),i.test(e))return n}return null}}}let sN=new sP;class sF{load(){}loadAsync(e,t){let i=this;return new Promise(function(n,r){i.load(e,n,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}constructor(e){this.manager=void 0!==e?e:sN,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}}sF.DEFAULT_MATERIAL_NAME="__DEFAULT";let sQ={};class sO extends Error{constructor(e,t){super(e),this.response=t}}class sk extends sF{load(e,t,i,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let r=sU.get(e);if(void 0!==r)return this.manager.itemStart(e),setTimeout(()=>{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<t;e++){let t=i[e];t.onProgress&&t.onProgress(n)}e.enqueue(l),t()}})}()}}))}throw new sO('fetch for "'.concat(t.url,'" responded with ').concat(t.status,": ").concat(t.statusText),t)}).then(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<n;e++){let n=i[e];n.onLoad&&n.onLoad(t)}}).catch(t=>{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<n;e++){let n=i[e];n.onError&&n.onError(t)}this.manager.itemError(e)}).finally(()=>{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<n;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch(e){return t}}static extractUrlBase(e){let t=e.lastIndexOf("/");return -1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e))?e:t+e}}class s6 extends sF{setOptions(e){return this.options=e,this}load(e,t,i,n){void 0===e&&(e=""),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),a.then)?void a.then(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<t;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){let e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,n,r){if(n>=.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;n<e.length;n++){let r=e[n];if(r.name===t||r.uuid===t)return r;let a=i(r.children);if(a)return a}return null},n=i(e.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)e[t++]=i[n]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,i=t.objectName,n=t.propertyName,r=t.propertyIndex;if(e||(e=oo.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(i){let n=t.objectIndex;switch(i){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===n){n=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[i]}if(void 0!==n){if(void 0===e[n])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[n]}}let a=e[n];if(void 0===a)return void console.error("THREE.PropertyBinding: Trying to update property for track: "+t.nodeName+"."+n+" but it wasn't found.",e);let s=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else void 0!==a.fromArray&&void 0!==a.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(o=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=n;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}constructor(e,t,i){this.path=t,this.parsedPath=i||oo.parseTrackName(t),this.node=oo.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}oo.Composite=class{getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}constructor(e,t,i){let n=i||oo.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}},oo.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},oo.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},oo.prototype.GetterByBindingType=[oo.prototype._getValue_direct,oo.prototype._getValue_array,oo.prototype._getValue_arrayElement,oo.prototype._getValue_toArray],oo.prototype.SetterByBindingTypeAndVersioning=[[oo.prototype._setValue_direct,oo.prototype._setValue_direct_setNeedsUpdate,oo.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[oo.prototype._setValue_array,oo.prototype._setValue_array_setNeedsUpdate,oo.prototype._setValue_array_setMatrixWorldNeedsUpdate],[oo.prototype._setValue_arrayElement,oo.prototype._setValue_arrayElement_setNeedsUpdate,oo.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[oo.prototype._setValue_fromArray,oo.prototype._setValue_fromArray_setNeedsUpdate,oo.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class ol{play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){let i=this._clip.duration,n=e._clip.duration;e.warp(1,n/i,t),this.warp(i/n,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){let e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){let n=this._mixer,r=n.time,a=this.timeScale,s=this._timeScaleInterpolant;null===s&&(s=n._lendControlInterpolant(),this._timeScaleInterpolant=s);let o=s.parameterPositions,l=s.sampleValues;return o[0]=r,o[1]=r+i,l[0]=e/a,l[1]=t/a,this}stopWarping(){let e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,n){if(!this.enabled)return void this._updateWeight(e);let r=this._startTime;if(null!==r){let n=(e-r)*i;n<0||0===i?t=0:(this._startTime=null,t=i*n)}t*=this._updateTimeScale(e);let a=this._updateTime(t),s=this._updateWeight(e);if(s>0){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<this._nActiveActions}_addInactiveAction(e,t,i){let n=this._actions,r=this._actionsByClip,a=r[t];if(void 0===a)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{let t=a.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=n.length,n.push(e),a.actionByRoot[i]=e}_removeInactiveAction(e){let t=this._actions,i=t[t.length-1],n=e._cacheIndex;i._cacheIndex=n,t[n]=i,t.pop(),e._cacheIndex=null;let r=e._clip.uuid,a=this._actionsByClip,s=a[r],o=s.knownActions,l=o[o.length-1],h=e._byClipCacheIndex;l._byClipCacheIndex=h,o[h]=l,o.pop(),e._byClipCacheIndex=null;let c=s.actionByRoot,u=(e._localRoot||this._root).uuid;delete c[u],0===o.length&&delete a[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){let t=e._propertyBindings;for(let e=0,i=t.length;e!==i;++e){let i=t[e];0==--i.referenceCount&&this._removeInactiveBinding(i)}}_lendAction(e){let t=this._actions,i=e._cacheIndex,n=this._nActiveActions++,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r}_takeBackAction(e){let t=this._actions,i=e._cacheIndex,n=--this._nActiveActions,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r}_addInactiveBinding(e,t,i){let n=this._bindingsByRootAndName,r=this._bindings,a=n[t];void 0===a&&(a={},n[t]=a),a[i]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){let t=this._bindings,i=e.binding,n=i.rootNode.uuid,r=i.path,a=this._bindingsByRootAndName,s=a[n],o=t[t.length-1],l=e._cacheIndex;o._cacheIndex=l,t[l]=o,t.pop(),delete s[r],0===Object.keys(s).length&&delete a[n]}_lendBinding(e){let t=this._bindings,i=e._cacheIndex,n=this._nActiveBindings++,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r}_takeBackBinding(e){let t=this._bindings,i=e._cacheIndex,n=--this._nActiveBindings,r=t[n];e._cacheIndex=n,t[n]=e,r._cacheIndex=i,t[i]=r}_lendControlInterpolant(){let e=this._controlInterpolants,t=this._nActiveControlInterpolants++,i=e[t];return void 0===i&&((i=new sS(new Float32Array(2),new Float32Array(2),1,oh)).__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){let t=this._controlInterpolants,i=e.__cacheIndex,n=--this._nActiveControlInterpolants,r=t[n];e.__cacheIndex=n,t[n]=e,r.__cacheIndex=i,t[i]=r}clipAction(e,t,i){let n=t||this._root,r=n.uuid,a="string"==typeof e?sD.findByName(n,e):e,s=null!==a?a.uuid:e,o=this._actionsByClip[s],l=null;if(void 0===i&&(i=null!==a?a.blendMode:2500),void 0!==o){let e=o.actionByRoot[r];if(void 0!==e&&e.blendMode===i)return e;l=o.knownActions[0],null===a&&(a=l._clip)}if(null===a)return null;let h=new ol(this,a,t,i);return this._bindAction(h,l),this._addInactiveAction(h,s,r),h}existingAction(e,t){let i=t||this._root,n=i.uuid,r="string"==typeof e?sD.findByName(i,e):e,a=r?r.uuid:e,s=this._actionsByClip[a];return void 0!==s&&s.actionByRoot[n]||null}stopAllAction(){let e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=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;e<this._actions.length;e++)this._actions[e].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){let t=this._actions,i=e.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){let e=r.knownActions;for(let i=0,n=e.length;i!==n;++i){let n=e[i];this._deactivateAction(n);let r=n._cacheIndex,a=t[t.length-1];n._cacheIndex=null,n._byClipCacheIndex=null,a._cacheIndex=r,t[r]=a,t.pop(),this._removeInactiveBindingsForAction(n)}delete n[i]}}uncacheRoot(e){let t=e.uuid,i=this._actionsByClip;for(let e in i){let n=i[e].actionByRoot[t];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}let n=this._bindingsByRootAndName[t];if(void 0!==n)for(let e in n){let t=n[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(e,t){let i=this.existingAction(e,t);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}}class ou{clone(){return new ou(void 0===this.value.clone?this.value:this.value.clone())}constructor(e){this.value=e}}let od=new tv;function oA(e,t){return e.distance-t.distance}function op(e,t,i,n){if(e.layers.test(t.layers)&&e.raycast(t,i),!0===n){let n=e.children;for(let e=0,r=n.length;e<r;e++)op(n[e],t,i,!0)}}class og{set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(ex(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"163"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="163"),e.s(["ReactiveElement",()=>oB,"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<i;r++)n[r-1]=arguments[r];return{_$litType$:e,strings:t,values:n}},oJ=oK(1),oZ=(oK(2),Symbol.for("lit-noChange")),o$=Symbol.for("lit-nothing"),o0=new WeakMap,o1=oQ.createTreeWalker(oQ,129,null,!1);function o2(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==oD?oD.createHTML(t):t}class o3{static createElement(e,t){let i=oQ.createElement("template");return i.innerHTML=e,i}constructor({strings:e,_$litType$:t},i){let n;this.parts=[];let r=0,a=0,s=e.length-1,o=this.parts,[l,h]=((e,t)=>{let i=e.length-1,n=[],r,a=2===t?"<svg>":"",s=oz;for(let t=0;t<i;t++){let i=e[t],o,l,h=-1,c=0;for(;c<i.length&&(s.lastIndex=c,null!==(l=s.exec(i)));)c=s.lastIndex,s===oz?"!--"===l[1]?s=oV:void 0!==l[1]?s=oW:void 0!==l[2]?(oY.test(l[2])&&(r=RegExp("</"+l[2],"g")),s=oq):void 0!==l[3]&&(s=oq):s===oq?">"===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?"</svg>":"")),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.length<s;){if(1===n.nodeType){if(n.hasAttributes()){let e=[];for(let t of n.getAttributeNames())if(t.endsWith(oU)||t.startsWith(oP)){let i=h[a++];if(e.push(t),void 0!==i){let e=n.getAttribute(i.toLowerCase()+oU).split(oP),t=/([.?@])?(.*)/.exec(i);o.push({type:1,index:r,name:t[2],strings:e,ctor:"."===t[1]?o9:"?"===t[1]?le:"@"===t[1]?lt:o6})}else o.push({type:6,index:r})}for(let t of e)n.removeAttribute(t)}if(oY.test(n.tagName)){let e=n.textContent.split(oP),t=e.length-1;if(t>0){n.textContent=oL?oL.emptyScript:"";for(let i=0;i<t;i++)n.append(e[i],oO()),o1.nextNode(),o.push({type:2,index:++r});n.append(e[t],oO())}}}else if(8===n.nodeType)if(n.data===oN)o.push({type:2,index:r});else{let e=-1;for(;-1!==(e=n.data.indexOf(oP,e+1));)o.push({type:7,index:r}),e+=oP.length-1}r++}}}function o4(e,t){var i,n,r;let a=arguments.length>2&&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++;n<t.length&&(this._$AR(i&&i._$AB.nextSibling,n),t.length=n)}_$AR(){var e;let t=arguments.length>0&&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;n<r.length-1;n++)(s=o4(this,o[i+n],t,n))===oZ&&(s=this._$AH[n]),a||(a=!ok(s)||s!==this._$AH[n]),s===o$?e=o$:e!==o$&&(e+=(null!=s?s:"")+r[n+1]),this._$AH[n]=s}a&&!n&&this.j(e)}j(e){e===o$?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=e?e:"")}constructor(e,t,i,n,r){this.type=1,this._$AH=o$,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=r,i.length>2||""!==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<n;a++)r[a]=arguments[a];null!=i&&self.clearTimeout(i),i=self.setTimeout(()=>{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 <meta name="viewport"> detected; <model-viewer> 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<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#000000">\n <!-- NOTE(cdata): This SVG filter is a stop-gap until we can implement\n support for dynamic re-coloring of UI components -->\n <defs>\n <filter id="drop-shadow" x="-100%" y="-100%" width="300%" height="300%">\n <feGaussianBlur in="SourceAlpha" stdDeviation="1"/>\n <feOffset dx="0" dy="0" result="offsetblur"/>\n <feFlood flood-color="#000000"/>\n <feComposite in2="offsetblur" operator="in"/>\n <feMerge>\n <feMergeNode/>\n <feMergeNode in="SourceGraphic"/>\n </feMerge>\n </filter>\n </defs>\n <path filter="url(#drop-shadow)" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>\n <path d="M0 0h24v24H0z" fill="none"/>\n</svg>']);return lD=function(){return e},e}let lU=oJ(lD());function lP(){let e=lL(['\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="36">\n <defs>\n <path id="A" d="M.001.232h24.997V36H.001z" />\n </defs>\n <g transform="translate(-11 -4)" fill="none" fill-rule="evenodd">\n <path fill-opacity="0" fill="#fff" d="M0 0h44v44H0z" />\n <g transform="translate(11 3)">\n <path d="M8.733 11.165c.04-1.108.766-2.027 1.743-2.307a2.54 2.54 0 0 1 .628-.089c.16 0 .314.017.463.044 1.088.2 1.9 1.092 1.9 2.16v8.88h1.26c2.943-1.39 5-4.45 5-8.025a9.01 9.01 0 0 0-1.9-5.56l-.43-.5c-.765-.838-1.683-1.522-2.712-2-1.057-.49-2.226-.77-3.46-.77s-2.4.278-3.46.77c-1.03.478-1.947 1.162-2.71 2l-.43.5a9.01 9.01 0 0 0-1.9 5.56 9.04 9.04 0 0 0 .094 1.305c.03.21.088.41.13.617l.136.624c.083.286.196.56.305.832l.124.333a8.78 8.78 0 0 0 .509.953l.065.122a8.69 8.69 0 0 0 3.521 3.191l1.11.537v-9.178z" fill-opacity=".5" fill="#e4e4e4" />\n <path d="M22.94 26.218l-2.76 7.74c-.172.485-.676.8-1.253.8H12.24c-1.606 0-3.092-.68-3.98-1.82-1.592-2.048-3.647-3.822-6.11-5.27-.095-.055-.15-.137-.152-.23-.004-.1.046-.196.193-.297.56-.393 1.234-.6 1.926-.6a3.43 3.43 0 0 1 .691.069l4.922.994V10.972c0-.663.615-1.203 1.37-1.203s1.373.54 1.373 1.203v9.882h2.953c.273 0 .533.073.757.21l6.257 3.874c.027.017.045.042.07.06.41.296.586.77.426 1.22M4.1 16.614c-.024-.04-.042-.083-.065-.122a8.69 8.69 0 0 1-.509-.953c-.048-.107-.08-.223-.124-.333l-.305-.832c-.058-.202-.09-.416-.136-.624l-.13-.617a9.03 9.03 0 0 1-.094-1.305c0-2.107.714-4.04 1.9-5.56l.43-.5c.764-.84 1.682-1.523 2.71-2 1.058-.49 2.226-.77 3.46-.77s2.402.28 3.46.77c1.03.477 1.947 1.16 2.712 2l.428.5a9 9 0 0 1 1.901 5.559c0 3.577-2.056 6.636-5 8.026h-1.26v-8.882c0-1.067-.822-1.96-1.9-2.16-.15-.028-.304-.044-.463-.044-.22 0-.427.037-.628.09-.977.28-1.703 1.198-1.743 2.306v9.178l-1.11-.537C6.18 19.098 4.96 18 4.1 16.614M22.97 24.09l-6.256-3.874c-.102-.063-.218-.098-.33-.144 2.683-1.8 4.354-4.855 4.354-8.243 0-.486-.037-.964-.104-1.43a9.97 9.97 0 0 0-1.57-4.128l-.295-.408-.066-.092a10.05 10.05 0 0 0-.949-1.078c-.342-.334-.708-.643-1.094-.922-1.155-.834-2.492-1.412-3.94-1.65l-.732-.088-.748-.03a9.29 9.29 0 0 0-1.482.119c-1.447.238-2.786.816-3.94 1.65a9.33 9.33 0 0 0-.813.686 9.59 9.59 0 0 0-.845.877l-.385.437-.36.5-.288.468-.418.778-.04.09c-.593 1.28-.93 2.71-.93 4.222 0 3.832 2.182 7.342 5.56 8.938l1.437.68v4.946L5 25.64a4.44 4.44 0 0 0-.888-.086c-.017 0-.034.003-.05.003-.252.004-.503.033-.75.08a5.08 5.08 0 0 0-.237.056c-.193.046-.382.107-.568.18-.075.03-.15.057-.225.1-.25.114-.494.244-.723.405a1.31 1.31 0 0 0-.566 1.122 1.28 1.28 0 0 0 .645 1.051C4 29.925 5.96 31.614 7.473 33.563a5.06 5.06 0 0 0 .434.491c1.086 1.082 2.656 1.713 4.326 1.715h6.697c.748-.001 1.43-.333 1.858-.872.142-.18.256-.38.336-.602l2.757-7.74c.094-.26.13-.53.112-.794s-.088-.52-.203-.76a2.19 2.19 0 0 0-.821-.91" fill-opacity=".6" fill="#000" />\n <path d="M22.444 24.94l-6.257-3.874a1.45 1.45 0 0 0-.757-.211h-2.953v-9.88c0-.663-.616-1.203-1.373-1.203s-1.37.54-1.37 1.203v16.643l-4.922-.994a3.44 3.44 0 0 0-.692-.069 3.35 3.35 0 0 0-1.925.598c-.147.102-.198.198-.194.298.004.094.058.176.153.23 2.462 1.448 4.517 3.22 6.11 5.27.887 1.14 2.373 1.82 3.98 1.82h6.686c.577 0 1.08-.326 1.253-.8l2.76-7.74c.16-.448-.017-.923-.426-1.22-.025-.02-.043-.043-.07-.06z" fill="#fff" />\n <g transform="translate(0 .769)">\n <mask id="B" fill="#fff">\n <use xlink:href="#A" />\n </mask>\n <path d="M23.993 24.992a1.96 1.96 0 0 1-.111.794l-2.758 7.74c-.08.22-.194.423-.336.602-.427.54-1.11.87-1.857.872h-6.698c-1.67-.002-3.24-.633-4.326-1.715-.154-.154-.3-.318-.434-.49C5.96 30.846 4 29.157 1.646 27.773c-.385-.225-.626-.618-.645-1.05a1.31 1.31 0 0 1 .566-1.122 4.56 4.56 0 0 1 .723-.405l.225-.1a4.3 4.3 0 0 1 .568-.18l.237-.056c.248-.046.5-.075.75-.08.018 0 .034-.003.05-.003.303-.001.597.027.89.086l3.722.752V20.68l-1.436-.68c-3.377-1.596-5.56-5.106-5.56-8.938 0-1.51.336-2.94.93-4.222.015-.03.025-.06.04-.09.127-.267.268-.525.418-.778.093-.16.186-.316.288-.468.063-.095.133-.186.2-.277L3.773 5c.118-.155.26-.29.385-.437.266-.3.544-.604.845-.877a9.33 9.33 0 0 1 .813-.686C6.97 2.167 8.31 1.59 9.757 1.35a9.27 9.27 0 0 1 1.481-.119 8.82 8.82 0 0 1 .748.031c.247.02.49.05.733.088 1.448.238 2.786.816 3.94 1.65.387.28.752.588 1.094.922a9.94 9.94 0 0 1 .949 1.078l.066.092c.102.133.203.268.295.408a9.97 9.97 0 0 1 1.571 4.128c.066.467.103.945.103 1.43 0 3.388-1.67 6.453-4.353 8.243.11.046.227.08.33.144l6.256 3.874c.37.23.645.55.82.9.115.24.185.498.203.76m.697-1.195c-.265-.55-.677-1.007-1.194-1.326l-5.323-3.297c2.255-2.037 3.564-4.97 3.564-8.114 0-2.19-.637-4.304-1.84-6.114-.126-.188-.26-.37-.4-.552-.645-.848-1.402-1.6-2.252-2.204C15.472.91 13.393.232 11.238.232A10.21 10.21 0 0 0 5.23 2.19c-.848.614-1.606 1.356-2.253 2.205-.136.18-.272.363-.398.55C1.374 6.756.737 8.87.737 11.06c0 4.218 2.407 8.08 6.133 9.842l.863.41v3.092l-2.525-.51c-.356-.07-.717-.106-1.076-.106a5.45 5.45 0 0 0-3.14.996c-.653.46-1.022 1.202-.99 1.983a2.28 2.28 0 0 0 1.138 1.872c2.24 1.318 4.106 2.923 5.543 4.772 1.26 1.62 3.333 2.59 5.55 2.592h6.698c1.42-.001 2.68-.86 3.134-2.138l2.76-7.74c.272-.757.224-1.584-.134-2.325" fill-opacity=".05" fill="#000" mask="url(#B)" />\n </g>\n </g>\n </g>\n</svg>']);return lP=function(){return e},e}let lN=oJ(lP());function lF(){let e=lL(['\n<svg version="1.1" id="view_x5F_in_x5F_AR_x5F_icon"\n xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px"\n viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">\n<rect id="Bounding_Box" x="0" y="0" fill="none" width="24" height="24"/>\n<g id="Art_layer">\n <path d="M3,4c0-0.55,0.45-1,1-1h2V1H4C2.35,1,1,2.35,1,4v2h2V4z"/>\n <path d="M20,3c0.55,0,1,0.45,1,1v2h2V4c0-1.65-1.35-3-3-3h-2v2H20z"/>\n <path d="M4,21c-0.55,0-1-0.45-1-1v-2H1v2c0,1.65,1.35,3,3,3h2v-2H4z"/>\n <path d="M20,21c0.55,0,1-0.45,1-1v-2h2v2c0,1.65-1.35,3-3,3h-2v-2H20z"/>\n <g>\n <path d="M18.25,7.6l-5.5-3.18c-0.46-0.27-1.04-0.27-1.5,0L5.75,7.6C5.29,7.87,5,8.36,5,8.9v6.35c0,0.54,0.29,1.03,0.75,1.3\n l5.5,3.18c0.46,0.27,1.04,0.27,1.5,0l5.5-3.18c0.46-0.27,0.75-0.76,0.75-1.3V8.9C19,8.36,18.71,7.87,18.25,7.6z M7,14.96v-4.62\n l4,2.32v4.61L7,14.96z M12,10.93L8,8.61l4-2.31l4,2.31L12,10.93z M13,17.27v-4.61l4-2.32v4.62L13,17.27z"/>\n </g>\n</g>\n</svg>']);return lF=function(){return e},e}let lQ=oJ(lF());function lO(){let e=lL(['\n<style>\n:host {\n display: block;\n position: relative;\n contain: strict;\n width: 300px;\n height: 150px;\n}\n\n.container {\n position: relative;\n overflow: hidden;\n}\n\n.userInput {\n width: 100%;\n height: 100%;\n display: none;\n position: relative;\n outline-offset: -1px;\n outline-width: 1px;\n}\n\ncanvas {\n position: absolute;\n display: none;\n pointer-events: none;\n /* NOTE(cdata): Chrome 76 and below apparently have a bug\n * that causes our canvas not to display pixels unless it is\n * on its own render layer\n * @see https://github.com/google/model-viewer/pull/755#issuecomment-536597893\n */\n transform: translateZ(0);\n}\n\n.show {\n display: block;\n}\n\n/* Adapted from HTML5 Boilerplate\n *\n * @see https://github.com/h5bp/html5-boilerplate/blob/ceb4620c78fc82e13534fc44202a3f168754873f/dist/css/main.css#L122-L133 */\n.screen-reader-only {\n border: 0;\n left: 0;\n top: 0;\n clip: rect(0, 0, 0, 0);\n height: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n pointer-events: none;\n}\n\n.slot {\n position: absolute;\n pointer-events: none;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n\n.slot > * {\n pointer-events: initial;\n}\n\n.annotation-wrapper ::slotted(*) {\n opacity: var(--max-hotspot-opacity, 1);\n transition: opacity 0.3s;\n}\n\n.pointer-tumbling .annotation-wrapper ::slotted(*) {\n pointer-events: none;\n}\n\n.annotation-wrapper ::slotted(*) {\n pointer-events: initial;\n}\n\n.annotation-wrapper.hide ::slotted(*) {\n opacity: var(--min-hotspot-opacity, 0.25);\n}\n\n.slot.poster {\n display: none;\n background-color: inherit;\n}\n\n.slot.poster.show {\n display: inherit;\n}\n\n.slot.poster > * {\n pointer-events: initial;\n}\n\n.slot.poster:not(.show) > * {\n pointer-events: none;\n}\n\n#default-poster {\n width: 100%;\n height: 100%;\n /* The default poster is a <button> so we need to set display\n * to prevent it from being affected by text-align: */\n display: block;\n position: absolute;\n border: none;\n padding: 0;\n background-size: contain;\n background-repeat: no-repeat;\n background-position: center;\n background-color: #fff0;\n}\n\n#default-progress-bar {\n display: block;\n position: relative;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: hidden;\n}\n\n#default-progress-bar > .bar {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: var(--progress-bar-height, 5px);\n background-color: var(--progress-bar-color, rgba(0, 0, 0, 0.4));\n transition: transform 0.09s;\n transform-origin: top left;\n transform: scaleX(0);\n overflow: hidden;\n}\n\n#default-progress-bar > .bar.hide {\n transition: opacity 0.3s 1s;\n opacity: 0;\n}\n\n.centered {\n align-items: center;\n justify-content: center;\n}\n\n.cover {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\n.slot.interaction-prompt {\n display: var(--interaction-prompt-display, flex);\n overflow: hidden;\n opacity: 0;\n will-change: opacity;\n transition: opacity 0.3s;\n}\n\n.slot.interaction-prompt.visible {\n opacity: 1;\n}\n\n.animated-container {\n will-change: transform, opacity;\n opacity: 0;\n transition: opacity 0.3s;\n}\n\n.slot.interaction-prompt > * {\n pointer-events: none;\n}\n\n.slot.ar-button {\n -moz-user-select: none;\n -webkit-tap-highlight-color: transparent;\n user-select: none;\n\n display: var(--ar-button-display, block);\n}\n\n.slot.ar-button:not(.enabled) {\n display: none;\n}\n\n.fab {\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: 40px;\n height: 40px;\n cursor: pointer;\n background-color: #fff;\n box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.15);\n border-radius: 100px;\n}\n\n.fab > * {\n opacity: 0.87;\n}\n\n#default-ar-button {\n position: absolute;\n bottom: 16px;\n right: 16px;\n transform: scale(var(--ar-button-scale, 1));\n transform-origin: bottom right;\n}\n\n.slot.pan-target {\n display: block;\n position: absolute;\n width: 0;\n height: 0;\n left: 50%;\n top: 50%;\n transform: translate3d(-50%, -50%, 0);\n background-color: transparent;\n opacity: 0;\n transition: opacity 0.3s;\n}\n\n#default-pan-target {\n width: 6px;\n height: 6px;\n border-radius: 6px;\n border: 1px solid white;\n box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.8);\n}\n\n.slot.default {\n pointer-events: none;\n}\n\n.slot.progress-bar {\n pointer-events: none;\n}\n\n.slot.exit-webxr-ar-button {\n pointer-events: none;\n}\n\n.slot.exit-webxr-ar-button:not(.enabled) {\n display: none;\n}\n\n#default-exit-webxr-ar-button {\n display: flex;\n align-items: center;\n justify-content: center;\n position: absolute;\n top: env(safe-area-inset-top, 16px);\n right: 16px;\n width: 40px;\n height: 40px;\n box-sizing: border-box;\n}\n\n#default-exit-webxr-ar-button > svg {\n fill: #fff;\n}\n</style>\n<div class="container">\n <div class="userInput" tabindex="0" role="img"\n aria-label="3D model">\n <div class="slot canvas">\n <slot name="canvas">\n <canvas></canvas>\n </slot>\n </div>\n\n </div>\n\n <!-- NOTE(cdata): We need to wrap slots because browsers without ShadowDOM\n will have their <slot> elements removed by ShadyCSS -->\n <div class="slot poster">\n <slot name="poster">\n <button type="button" id="default-poster" aria-hidden="true" aria-label="Loading 3D model"></button>\n </slot>\n </div>\n\n <div class="slot ar-button">\n <slot name="ar-button">\n <a id="default-ar-button" part="default-ar-button" class="fab"\n tabindex="2"\n role="button"\n href="javascript:void(0);"\n aria-label="View in your space">\n ','\n </a>\n </slot>\n </div>\n\n <div class="slot pan-target">\n <slot name="pan-target">\n <div id="default-pan-target">\n </div>\n </slot>\n </div>\n\n <div class="slot interaction-prompt cover centered">\n <div id="prompt" class="animated-container">\n <slot name="interaction-prompt" aria-hidden="true">\n ','\n </slot>\n </div>\n </div>\n\n <div id="finger0" class="animated-container cover">\n <slot name="finger0" aria-hidden="true">\n </slot>\n </div>\n <div id="finger1" class="animated-container cover">\n <slot name="finger1" aria-hidden="true">\n </slot>\n </div>\n\n <div class="slot default">\n <slot></slot>\n\n <div class="slot progress-bar">\n <slot name="progress-bar">\n <div id="default-progress-bar" aria-hidden="true">\n <div class="bar" part="default-progress-bar"></div>\n </div>\n </slot>\n </div>\n\n <div class="slot exit-webxr-ar-button">\n <slot name="exit-webxr-ar-button">\n <a id="default-exit-webxr-ar-button" part="default-exit-webxr-ar-button"\n tabindex="3"\n aria-label="Exit AR"\n aria-hidden="true">\n ','\n </a>\n </slot>\n </div>\n </div>\n</div>\n<div class="screen-reader-only" role="region" aria-label="Live announcements">\n <span id="status" role="status"></span>\n</div>']);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<n.count;e++)t.push(e);e.setIndex(t),i=e.getIndex()}let n=i.count-2,r=[];if(2===t)for(let e=1;e<=n;e++)r.push(i.getX(0)),r.push(i.getX(e)),r.push(i.getX(e+1));else for(let e=0;e<n;e++)e%2==0?(r.push(i.getX(e)),r.push(i.getX(e+1)),r.push(i.getX(e+2))):(r.push(i.getX(e+2)),r.push(i.getX(e+1)),r.push(i.getX(e)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");let a=e.clone();return a.setIndex(r),a.clearGroups(),a}}class lV extends sF{load(e,t,i,n){let r,a=this;if(""!==this.resourcePath)r=this.resourcePath;else if(""!==this.path){let t=s8.extractUrlBase(e);r=s8.resolveURL(t,this.path)}else r=s8.extractUrlBase(e);this.manager.itemStart(e);let s=function(t){n?n(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},o=new sk(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(i){try{a.parse(i,r,function(i){t(i),a.manager.itemEnd(e)},s)}catch(e){s(e)}},i,s)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}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,a={},s={},o=new TextDecoder;if("string"==typeof e)r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(o.decode(new Uint8Array(e,0,4))===he){try{a[lq.KHR_BINARY_GLTF]=new hi(e)}catch(e){n&&n(e);return}r=JSON.parse(a[lq.KHR_BINARY_GLTF].content)}else r=JSON.parse(o.decode(e));else r=e;if(void 0===r.asset||r.asset.version[0]<2){n&&n(Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=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<this.pluginCallbacks.length;e++){let t=this.pluginCallbacks[e](l);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),s[t.name]=t,a[t.name]=!0}if(r.extensionsUsed)for(let e=0;e<r.extensionsUsed.length;++e){let t=r.extensionsUsed[e],i=r.extensionsRequired||[];switch(t){case lq.KHR_MATERIALS_UNLIT:a[t]=new lj;break;case lq.KHR_DRACO_MESH_COMPRESSION:a[t]=new hn(r,this.dracoLoader);break;case lq.KHR_TEXTURE_TRANSFORM:a[t]=new hr;break;case lq.KHR_MESH_QUANTIZATION:a[t]=new ha;break;default:i.indexOf(t)>=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<n;i++){let n=t[i];n.extensions&&n.extensions[this.name]&&void 0!==n.extensions[this.name].light&&e._addNodeRef(this.cache,n.extensions[this.name].light)}}_loadLight(e){let t,i=this.parser,n="light:"+e,r=i.cache.get(n);if(r)return r;let a=i.json,s=((a.extensions&&a.extensions[this.name]||{}).lights||[])[e],o=new t6(0xffffff);void 0!==s.color&&o.setRGB(s.color[0],s.color[1],s.color[2],ec);let l=void 0!==s.range?s.range:0;switch(s.type){case"directional":(t=new s3(o)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new s1(o)).distance=l;break;case"spot":(t=new sK(o)).distance=l,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,t.angle=s.spot.outerConeAngle,t.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return t.position.set(0,0,0),t.decay=2,h_(t,s),void 0!==s.intensity&&(t.intensity=s.intensity),t.name=i.createUniqueName(s.name||"light_"+e),r=Promise.resolve(t),i.cache.add(n,r),r}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){let t=this,i=this.parser,n=i.json.nodes[e],r=(n.extensions&&n.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then(function(e){return i._getNodeRef(t.cache,r,e)})}constructor(e){this.parser=e,this.name=lq.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}}class lj{getMaterialType(){return it}extendParams(e,t,i){let n=[];e.color=new t6(1,1,1),e.opacity=1;let r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){let t=r.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],ec),e.opacity=t[3]}void 0!==r.baseColorTexture&&n.push(i.assignTexture(e,"map",r.baseColorTexture,eh))}return Promise.all(n)}constructor(){this.name=lq.KHR_MATERIALS_UNLIT}}class lY{extendMaterialParams(e,t){let i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let n=i.extensions[this.name].emissiveStrength;return void 0!==n&&(t.emissiveIntensity=n),Promise.resolve()}constructor(e){this.parser=e,this.name=lq.KHR_MATERIALS_EMISSIVE_STRENGTH}}class lK{getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?sf:null}extendMaterialParams(e,t){let i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let r=[],a=n.extensions[this.name];if(void 0!==a.clearcoatFactor&&(t.clearcoat=a.clearcoatFactor),void 0!==a.clearcoatTexture&&r.push(i.assignTexture(t,"clearcoatMap",a.clearcoatTexture)),void 0!==a.clearcoatRoughnessFactor&&(t.clearcoatRoughness=a.clearcoatRoughnessFactor),void 0!==a.clearcoatRoughnessTexture&&r.push(i.assignTexture(t,"clearcoatRoughnessMap",a.clearcoatRoughnessTexture)),void 0!==a.clearcoatNormalTexture&&(r.push(i.assignTexture(t,"clearcoatNormalMap",a.clearcoatNormalTexture)),void 0!==a.clearcoatNormalTexture.scale)){let e=a.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new eM(e,e)}return Promise.all(r)}constructor(e){this.parser=e,this.name=lq.KHR_MATERIALS_CLEARCOAT}}class lJ{getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?sf:null}extendMaterialParams(e,t){let i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let r=[],a=n.extensions[this.name];return void 0!==a.iridescenceFactor&&(t.iridescence=a.iridescenceFactor),void 0!==a.iridescenceTexture&&r.push(i.assignTexture(t,"iridescenceMap",a.iridescenceTexture)),void 0!==a.iridescenceIor&&(t.iridescenceIOR=a.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==a.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=a.iridescenceThicknessMinimum),void 0!==a.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=a.iridescenceThicknessMaximum),void 0!==a.iridescenceThicknessTexture&&r.push(i.assignTexture(t,"iridescenceThicknessMap",a.iridescenceThicknessTexture)),Promise.all(r)}constructor(e){this.parser=e,this.name=lq.KHR_MATERIALS_IRIDESCENCE}}class lZ{getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?sf:null}extendMaterialParams(e,t){let i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let r=[];t.sheenColor=new t6(0,0,0),t.sheenRoughness=0,t.sheen=1;let a=n.extensions[this.name];if(void 0!==a.sheenColorFactor){let e=a.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],ec)}return void 0!==a.sheenRoughnessFactor&&(t.sheenRoughness=a.sheenRoughnessFactor),void 0!==a.sheenColorTexture&&r.push(i.assignTexture(t,"sheenColorMap",a.sheenColorTexture,eh)),void 0!==a.sheenRoughnessTexture&&r.push(i.assignTexture(t,"sheenRoughnessMap",a.sheenRoughnessTexture)),Promise.all(r)}constructor(e){this.parser=e,this.name=lq.KHR_MATERIALS_SHEEN}}class l${getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?sf:null}extendMaterialParams(e,t){let i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let r=[],a=n.extensions[this.name];return void 0!==a.transmissionFactor&&(t.transmission=a.transmissionFactor),void 0!==a.transmissionTexture&&r.push(i.assignTexture(t,"transmissionMap",a.transmissionTexture)),Promise.all(r)}constructor(e){this.parser=e,this.name=lq.KHR_MATERIALS_TRANSMISSION}}class l0{getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?sf:null}extendMaterialParams(e,t){let i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let r=[],a=n.extensions[this.name];t.thickness=void 0!==a.thicknessFactor?a.thicknessFactor:0,void 0!==a.thicknessTexture&&r.push(i.assignTexture(t,"thicknessMap",a.thicknessTexture)),t.attenuationDistance=a.attenuationDistance||1/0;let s=a.attenuationColor||[1,1,1];return t.attenuationColor=new t6().setRGB(s[0],s[1],s[2],ec),Promise.all(r)}constructor(e){this.parser=e,this.name=lq.KHR_MATERIALS_VOLUME}}class l1{getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?sf:null}extendMaterialParams(e,t){let i=this.parser.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();let n=i.extensions[this.name];return t.ior=void 0!==n.ior?n.ior:1.5,Promise.resolve()}constructor(e){this.parser=e,this.name=lq.KHR_MATERIALS_IOR}}class l2{getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?sf:null}extendMaterialParams(e,t){let i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let r=[],a=n.extensions[this.name];t.specularIntensity=void 0!==a.specularFactor?a.specularFactor:1,void 0!==a.specularTexture&&r.push(i.assignTexture(t,"specularIntensityMap",a.specularTexture));let s=a.specularColorFactor||[1,1,1];return t.specularColor=new t6().setRGB(s[0],s[1],s[2],ec),void 0!==a.specularColorTexture&&r.push(i.assignTexture(t,"specularColorMap",a.specularColorTexture,eh)),Promise.all(r)}constructor(e){this.parser=e,this.name=lq.KHR_MATERIALS_SPECULAR}}class l3{getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?sf:null}extendMaterialParams(e,t){let i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let r=[],a=n.extensions[this.name];return t.bumpScale=void 0!==a.bumpFactor?a.bumpFactor:1,void 0!==a.bumpTexture&&r.push(i.assignTexture(t,"bumpMap",a.bumpTexture)),Promise.all(r)}constructor(e){this.parser=e,this.name=lq.EXT_MATERIALS_BUMP}}class l4{getMaterialType(e){let t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?sf:null}extendMaterialParams(e,t){let i=this.parser,n=i.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let r=[],a=n.extensions[this.name];return void 0!==a.anisotropyStrength&&(t.anisotropy=a.anisotropyStrength),void 0!==a.anisotropyRotation&&(t.anisotropyRotation=a.anisotropyRotation),void 0!==a.anisotropyTexture&&r.push(i.assignTexture(t,"anisotropyMap",a.anisotropyTexture)),Promise.all(r)}constructor(e){this.parser=e,this.name=lq.KHR_MATERIALS_ANISOTROPY}}class l5{loadTexture(e){let t=this.parser,i=t.json,n=i.textures[e];if(!n.extensions||!n.extensions[this.name])return null;let r=n.extensions[this.name],a=t.options.ktx2Loader;if(!a)if(!(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=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<n;e++)a.TRANSLATION&&i.fromBufferAttribute(a.TRANSLATION,e),a.ROTATION&&s.fromBufferAttribute(a.ROTATION,e),a.SCALE&&o.fromBufferAttribute(a.SCALE,e),l.setMatrixAt(e,t.compose(i,s,o));for(let t in a)if("_COLOR_0"===t){let e=a[t];l.instanceColor=new aL(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,a[t]);tW.prototype.copy.call(l,e),this.parser.assignFinalMaterial(l),r.push(l)}return t.isGroup?(t.clear(),t.add(...r),t):r[0]}))}constructor(e){this.name=lq.EXT_MESH_GPU_INSTANCING,this.parser=e}}let he="glTF",ht={JSON:0x4e4f534a,BIN:5130562};class hi{constructor(e){this.name=lq.KHR_BINARY_GLTF,this.content=null,this.body=null;let t=new DataView(e,0,12),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==he)throw Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw Error("THREE.GLTFLoader: Legacy binary file detected.");let n=this.header.length-12,r=new DataView(e,12),a=0;for(;a<n;){let t=r.getUint32(a,!0);a+=4;let n=r.getUint32(a,!0);if(a+=4,n===ht.JSON){let n=new Uint8Array(e,12+a,t);this.content=i.decode(n)}else if(n===ht.BIN){let i=12+a;this.body=e.slice(i,i+t)}a+=t}if(null===this.content)throw Error("THREE.GLTFLoader: JSON content not found.")}}class hn{decodePrimitive(e,t){let i=this.json,n=this.dracoLoader,r=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,s={},o={},l={};for(let e in a)s[hp[e]||e.toLowerCase()]=a[e];for(let t in e.attributes){let n=hp[t]||t.toLowerCase();if(void 0!==a[t]){let r=i.accessors[e.attributes[t]],a=hc[r.componentType];l[n]=a.name,o[n]=!0===r.normalized}}return t.getDependency("bufferView",r).then(function(e){return new Promise(function(t,i){n.decodeDracoFile(e,function(e){for(let t in e.attributes){let i=e.attributes[t],n=o[t];void 0!==n&&(i.normalized=n)}t(e)},s,l,ec,i)})})}constructor(e,t){if(!t)throw Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=lq.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}}class hr{extendTexture(e,t){return(void 0===t.texCoord||t.texCoord===e.channel)&&void 0===t.offset&&void 0===t.rotation&&void 0===t.scale||(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}constructor(){this.name=lq.KHR_TEXTURE_TRANSFORM}}class ha{constructor(){this.name=lq.KHR_MESH_QUANTIZATION}}class hs extends sE{copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=e*n*3+n;for(let e=0;e!==n;e++)t[e]=i[r+e];return t}interpolate_(e,t,i,n){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=2*s,l=3*s,h=n-t,c=(i-t)/h,u=c*c,d=u*c,A=e*l,p=A-l,g=-2*d+3*u,m=d-u,f=1-g,v=m-u+c;for(let e=0;e!==s;e++){let t=a[p+e+s],i=a[p+e+o]*h,n=a[A+e+s],l=a[A+e]*h;r[e]=f*t+v*i+g*n+m*l}return r}constructor(e,t,i,n){super(e,t,i,n)}}let ho=new eJ;class hl extends hs{interpolate_(e,t,i,n){let r=super.interpolate_(e,t,i,n);return ho.fromArray(r).normalize().toArray(r),r}}let hh={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},hc={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},hu={9728:1003,9729:1006,9984:1004,9985:1007,9986:1005,9987:1008},hd={33071:1001,33648:1002,10497:1e3},hA={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},hp={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},hg={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},hm={CUBICSPLINE:void 0,LINEAR:2301,STEP:2300},hf={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function hv(e,t,i){for(let n in i.extensions)void 0===e[n]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[n]=i.extensions[n])}function h_(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function hy(e){let t="",i=Object.keys(e).sort();for(let n=0,r=i.length;n<r;n++)t+=i[n]+":"+e[i[n]]+";";return t}function hE(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}let hx=new tv;class hS{setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let i=this,n=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(t){let a={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:i,userData:{}};return hv(r,a,n),h_(a,n),Promise.all(i._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let i=0,n=t.length;i<n;i++){let n=t[i].joints;for(let t=0,i=n.length;t<i;t++)e[n[t]].isBone=!0}for(let t=0,n=e.length;t<n;t++){let n=e[t];void 0!==n.mesh&&(this._addNodeRef(this.meshCache,n.mesh),void 0!==n.skin&&(i[n.mesh].isSkinnedMesh=!0)),void 0!==n.camera&&this._addNodeRef(this.cameraCache,n.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,i){if(e.refs[t]<=1)return i;let n=i.clone(),r=(e,t)=>{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<t.length;i++){let n=e(t[i]);if(n)return n}return null}_invokeAll(e){let t=Object.values(this.plugins);t.unshift(this);let i=[];for(let n=0;n<t.length;n++){let r=e(t[n]);r&&i.push(r)}return i}getDependency(e,t){let i=e+":"+t,n=this.cache.get(i);if(!n){switch(e){case"scene":n=this.loadScene(t);break;case"node":n=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":n=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":n=this.loadAccessor(t);break;case"bufferView":n=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":n=this.loadBuffer(t);break;case"material":n=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":n=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":n=this.loadSkin(t);break;case"animation":n=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":n=this.loadCamera(t);break;default:if(!(n=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(e,t)})))throw Error("Unknown type: "+e)}this.cache.add(i,n)}return n}getDependencies(e){let t=this.cache.get(e);if(!t){let i=this;t=Promise.all((this.json[e+("mesh"===e?"es":"s")]||[]).map(function(t,n){return i.getDependency(e,n)})),this.cache.add(e,t)}return t}loadBuffer(e){let t=this.json.buffers[e],i=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[lq.KHR_BINARY_GLTF].body);let n=this.options;return new Promise(function(e,r){i.load(s8.resolveURL(t.uri,n.path),e,void 0,function(){r(Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){let t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(e){let i=t.byteLength||0,n=t.byteOffset||0;return e.slice(n,n+i)})}loadAccessor(e){let t=this,i=this.json,n=this.json.accessors[e];if(void 0===n.bufferView&&void 0===n.sparse){let e=hA[n.type],t=hc[n.componentType],i=!0===n.normalized;return Promise.resolve(new io(new t(n.count*e),e,i))}let r=[];return void 0!==n.bufferView?r.push(this.getDependency("bufferView",n.bufferView)):r.push(null),void 0!==n.sparse&&(r.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(r).then(function(e){let r,a=e[0],s=hA[n.type],o=hc[n.componentType],l=o.BYTES_PER_ELEMENT,h=l*s,c=n.byteOffset||0,u=void 0!==n.bufferView?i.bufferViews[n.bufferView].byteStride:void 0,d=!0===n.normalized;if(u&&u!==h){let e=Math.floor(c/u),i="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+e+":"+n.count,h=t.cache.get(i);h||(h=new ap(new o(a,e*u,n.count*u/l),u/l),t.cache.add(i,h)),r=new am(h,s,c%u/l,d)}else r=new io(null===a?new o(n.count*s):new o(a,c,n.count*s),s,d);if(void 0!==n.sparse){let t=hA.SCALAR,i=hc[n.sparse.indices.componentType],l=n.sparse.indices.byteOffset||0,h=n.sparse.values.byteOffset||0,c=new i(e[1],l,n.sparse.count*t),u=new o(e[2],h,n.sparse.count*s);null!==a&&(r=new io(r.array.slice(),r.itemSize,r.normalized));for(let e=0,t=c.length;e<t;e++){let t=c[e];if(r.setX(t,u[e*s]),s>=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;a<s;a++){let s=e[a],o=function(e){let t,i=e.extensions&&e.extensions[lq.KHR_DRACO_MESH_COMPRESSION];if(t=i?"draco:"+i.bufferView+":"+i.indices+":"+hy(i.attributes):e.indices+":"+hy(e.attributes)+":"+e.mode,void 0!==e.targets)for(let i=0,n=e.targets.length;i<n;i++)t+=":"+hy(e.targets[i]);return t}(s),l=n[o];if(l)r.push(l.promise);else{let e;e=s.extensions&&s.extensions[lq.KHR_DRACO_MESH_COMPRESSION]?function(e){return i[lq.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(i){return hC(i,e,t)})}(s):hC(new i_,s,t),n[o]={primitive:s,promise:e},r.push(e)}}return Promise.all(r)}loadMesh(e){let t=this,i=this.json,n=this.extensions,r=i.meshes[e],a=r.primitives,s=[];for(let e=0,t=a.length;e<t;e++){var o;let t=void 0===a[e].material?(void 0===(o=this.cache).DefaultMaterial&&(o.DefaultMaterial=new sm({color:0xffffff,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),o.DefaultMaterial):this.getDependency("material",a[e].material);s.push(t)}return s.push(t.loadGeometries(a)),Promise.all(s).then(function(i){let s=i.slice(0,i.length-1),o=i[i.length-1],l=[];for(let i=0,h=o.length;i<h;i++){let h,c=o[i],u=a[i],d=s[i];if(u.mode===hh.TRIANGLES||u.mode===hh.TRIANGLE_STRIP||u.mode===hh.TRIANGLE_FAN||void 0===u.mode)!0===(h=!0===r.isSkinnedMesh?new aM(c,d):new iF(c,d)).isSkinnedMesh&&h.normalizeSkinWeights(),u.mode===hh.TRIANGLE_STRIP?h.geometry=lz(h.geometry,1):u.mode===hh.TRIANGLE_FAN&&(h.geometry=lz(h.geometry,2));else if(u.mode===hh.LINES)h=new aK(c,d);else if(u.mode===hh.LINE_STRIP)h=new aX(c,d);else if(u.mode===hh.LINE_LOOP)h=new aJ(c,d);else if(u.mode===hh.POINTS)h=new a3(c,d);else throw Error("THREE.GLTFLoader: Primitive mode unsupported: "+u.mode);Object.keys(h.geometry.morphAttributes).length>0&&function(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let i=0,n=t.weights.length;i<n;i++)e.morphTargetInfluences[i]=t.weights[i];if(t.extras&&Array.isArray(t.extras.targetNames)){let i=t.extras.targetNames;if(e.morphTargetInfluences.length===i.length){e.morphTargetDictionary={};for(let t=0,n=i.length;t<n;t++)e.morphTargetDictionary[i[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}(h,r),h.name=t.createUniqueName(r.name||"mesh_"+e),h_(h,r),u.extensions&&hv(n,h,u),t.assignFinalMaterial(h),l.push(h)}for(let i=0,n=l.length;i<n;i++)t.associations.set(l[i],{meshes:e,primitives:i});if(1===l.length)return r.extensions&&hv(n,l[0],r),l[0];let h=new an;r.extensions&&hv(n,h,r),t.associations.set(h,{meshes:e});for(let e=0,t=l.length;e<t;e++)h.add(l[e]);return h})}loadCamera(e){let t,i=this.json.cameras[e],n=i[i.type];return n?("perspective"===i.type?t=new iY(eI.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===i.type&&(t=new nu(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),h_(t,i),Promise.resolve(t)):void console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){let t=this.json.skins[e],i=[];for(let e=0,n=t.joints.length;e<n;e++)i.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?i.push(this.getDependency("accessor",t.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(e){let i=e.pop(),n=[],r=[];for(let a=0,s=e.length;a<s;a++){let s=e[a];if(s){n.push(s);let e=new tv;null!==i&&e.fromArray(i.array,16*a),r.push(e)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[a])}return new aR(n,r)})}loadAnimation(e){let t=this.json,i=this,n=t.animations[e],r=n.name?n.name:"animation_"+e,a=[],s=[],o=[],l=[],h=[];for(let e=0,t=n.channels.length;e<t;e++){let t=n.channels[e],i=n.samplers[t.sampler],r=t.target,c=r.node,u=void 0!==n.parameters?n.parameters[i.input]:i.input,d=void 0!==n.parameters?n.parameters[i.output]:i.output;void 0!==r.node&&(a.push(this.getDependency("node",c)),s.push(this.getDependency("accessor",u)),o.push(this.getDependency("accessor",d)),l.push(i),h.push(r))}return Promise.all([Promise.all(a),Promise.all(s),Promise.all(o),Promise.all(l),Promise.all(h)]).then(function(e){let t=e[0],n=e[1],a=e[2],s=e[3],o=e[4],l=[];for(let e=0,r=t.length;e<r;e++){let r=t[e],h=n[e],c=a[e],u=s[e],d=o[e];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();let A=i._createAnimationTracks(r,h,c,u,d);if(A)for(let e=0;e<A.length;e++)l.push(A[e])}return new sD(r,void 0,l)})}createNodeMesh(e){let t=this.json,i=this,n=t.nodes[e];return void 0===n.mesh?null:i.getDependency("mesh",n.mesh).then(function(e){let t=i._getNodeRef(i.meshCache,n.mesh,e);return void 0!==n.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,i=n.weights.length;t<i;t++)e.morphTargetInfluences[t]=n.weights[t]}),t})}loadNode(e){let t=this.json.nodes[e],i=this._loadNodeShallow(e),n=[],r=t.children||[];for(let e=0,t=r.length;e<t;e++)n.push(this.getDependency("node",r[e]));let a=void 0===t.skin?Promise.resolve(null):this.getDependency("skin",t.skin);return Promise.all([i,Promise.all(n),a]).then(function(e){let t=e[0],i=e[1],n=e[2];null!==n&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(n,hx)});for(let e=0,n=i.length;e<n;e++)t.add(i[e]);return t})}_loadNodeShallow(e){let t=this.json,i=this.extensions,n=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];let r=t.nodes[e],a=r.name?n.createUniqueName(r.name):"",s=[],o=n._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return o&&s.push(o),void 0!==r.camera&&s.push(n.getDependency("camera",r.camera).then(function(e){return n._getNodeRef(n.cameraCache,r.camera,e)})),n._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){s.push(e)}),this.nodeCache[e]=Promise.all(s).then(function(t){let s;if((s=!0===r.isBone?new aw:t.length>1?new an:1===t.length?t[0]:new tW)!==t[0])for(let e=0,i=t.length;e<i;e++)s.add(t[e]);if(r.name&&(s.userData.name=r.name,s.name=a),h_(s,r),r.extensions&&hv(i,s,r),void 0!==r.matrix){let e=new tv;e.fromArray(r.matrix),s.applyMatrix4(e)}else void 0!==r.translation&&s.position.fromArray(r.translation),void 0!==r.rotation&&s.quaternion.fromArray(r.rotation),void 0!==r.scale&&s.scale.fromArray(r.scale);return n.associations.has(s)||n.associations.set(s,{}),n.associations.get(s).nodes=e,s}),this.nodeCache[e]}loadScene(e){let t=this.extensions,i=this.json.scenes[e],n=this,r=new an;i.name&&(r.name=n.createUniqueName(i.name)),h_(r,i),i.extensions&&hv(t,r,i);let a=i.nodes||[],s=[];for(let e=0,t=a.length;e<t;e++)s.push(n.getDependency("node",a[e]));return Promise.all(s).then(function(e){for(let t=0,i=e.length;t<i;t++)r.add(e[t]);return n.associations=(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<i;e++){let i=new a(l[e]+"."+hg[r.path],t.array,c,h);"CUBICSPLINE"===n.interpolation&&this._createCubicSplineTrackInterpolant(i),s.push(i)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){let e=hE(t.constructor),i=new Float32Array(t.length);for(let n=0,r=t.length;n<r;n++)i[n]=t[n]*e;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof sB?hl:hs)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new lW,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,n=!1,r=-1;"undefined"!=typeof navigator&&(i=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),r=(n=navigator.userAgent.indexOf("Firefox")>-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<r;n++){let r=a[n];if(void 0!==r.POSITION){let n=i.json.accessors[r.POSITION],a=n.min,s=n.max;if(void 0!==a&&void 0!==s){if(t.setX(Math.max(Math.abs(a[0]),Math.abs(s[0]))),t.setY(Math.max(Math.abs(a[1]),Math.abs(s[1]))),t.setZ(Math.max(Math.abs(a[2]),Math.abs(s[2]))),n.normalized){let e=hE(hc[n.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(e)}e.boundingBox=r;let s=new th;r.getCenter(s.center),s.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=s}(e,t,i),Promise.all(r).then(function(){return void 0!==t.targets?function(e,t,i){let n=!1,r=!1,a=!1;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(void 0!==i.POSITION&&(n=!0),void 0!==i.NORMAL&&(r=!0),void 0!==i.COLOR_0&&(a=!0),n&&r&&a)break}if(!n&&!r&&!a)return Promise.resolve(e);let s=[],o=[],l=[];for(let h=0,c=t.length;h<c;h++){let c=t[h];if(n){let t=void 0!==c.POSITION?i.getDependency("accessor",c.POSITION):e.attributes.position;s.push(t)}if(r){let t=void 0!==c.NORMAL?i.getDependency("accessor",c.NORMAL):e.attributes.normal;o.push(t)}if(a){let t=void 0!==c.COLOR_0?i.getDependency("accessor",c.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(s),Promise.all(o),Promise.all(l)]).then(function(t){let i=t[0],s=t[1],o=t[2];return n&&(e.morphAttributes.position=i),r&&(e.morphAttributes.normal=s),a&&(e.morphAttributes.color=o),e.morphTargetsRelative=!0,e})}(e,t.targets,i):e})}class hI{_initWorker(e){if(!this.workers[e]){let t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return -1}_onMessage(e,t){let i=this.workersResolve[e];if(i&&i(t),this.queue.length){let{resolve:t,msg:i,transfer:n}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(i,n)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(i=>{let n=this._getIdleWorker();-1!==n?(this._initWorker(n),this.workerStatus|=1<<n,this.workersResolve[n]=i,this.workers[n].postMessage(e,t)):this.queue.push({resolve:i,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>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&&n<e;)n++,this._offset++;return n<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+i,n)}constructor(e,t,i,n){this._dataView=new DataView(e.buffer,e.byteOffset+t,i),this._littleEndian=n,this._offset=0}}new Uint8Array([0]);let hT=[171,75,84,88,32,50,48,187,13,10,26,10];function hB(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):hM.Buffer.from(e).toString("utf8")}let hR={env:{emscripten_notify_memory_growth:function(e){r=new Uint8Array(n.exports.memory.buffer)}}};class hL{init(){return i||(i="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+hD).then(e=>e.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="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",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;t<a;t++)i.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});let A=new hb(e,s,o,!0),p={vendorId:A._skip(4)._nextUint16(),descriptorType:A._nextUint16(),versionNumber:A._nextUint16(),descriptorBlockSize:A._nextUint16(),colorModel:A._nextUint8(),colorPrimaries:A._nextUint8(),transferFunction:A._nextUint8(),flags:A._nextUint8(),texelBlockDimension:[A._nextUint8(),A._nextUint8(),A._nextUint8(),A._nextUint8()],bytesPlane:[A._nextUint8(),A._nextUint8(),A._nextUint8(),A._nextUint8(),A._nextUint8(),A._nextUint8(),A._nextUint8(),A._nextUint8()],samples:[]},g=(p.descriptorBlockSize/4-6)/4;for(let e=0;e<g;e++){let t={bitOffset:A._nextUint16(),bitLength:A._nextUint8(),channelType:A._nextUint8(),samplePosition:[A._nextUint8(),A._nextUint8(),A._nextUint8(),A._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=A._nextInt32(),t.sampleUpper=A._nextInt32()):(t.sampleLower=A._nextUint32(),t.sampleUpper=A._nextUint32()),p.samples[e]=t}i.dataFormatDescriptor.length=0,i.dataFormatDescriptor.push(p);let m=new hb(e,l,h,!0);for(;m._offset<h;){let e=m._nextUint32(),t=m._scan(e),n=hB(t),r=m._scan(e-t.byteLength);i.keyValue[n]=n.match(/^ktx/i)?hB(r):r,m._offset%4&&m._skip(4-m._offset%4)}if(u<=0)return i;let f=new hb(e,c,u,!0),v=f._nextUint16(),_=f._nextUint16(),y=f._nextUint32(),E=f._nextUint32(),x=f._nextUint32(),S=f._nextUint32(),C=[];for(let e=0;e<a;e++)C.push({imageFlags:f._nextUint32(),rgbSliceByteOffset:f._nextUint32(),rgbSliceByteLength:f._nextUint32(),alphaSliceByteOffset:f._nextUint32(),alphaSliceByteLength:f._nextUint32()});let I=c+f._offset,M=I+y,w=M+E,b=w+x,T=new Uint8Array(e.buffer,e.byteOffset+I,y),B=new Uint8Array(e.buffer,e.byteOffset+M,E);return i.globalData={endpointCount:v,selectorCount:_,imageDescs:C,endpointsData:T,selectorsData:B,tablesData:new Uint8Array(e.buffer,e.byteOffset+w,x),extendedData:new Uint8Array(e.buffer,e.byteOffset+b,S)},i}(new Uint8Array(e));if(0!==i.vkFormat)return hk(i);let n=this.init().then(()=>this.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;n<d.length;n++){let r=d[n];if(e[r.if]&&r.basisFormat.includes(t)&&(!c||!(r.transcoderFormat.length<2))&&(!r.needsPowerOfTwo||h(i)&&h(s)))return{transcoderFormat:u=r.transcoderFormat[+!!c],engineFormat:r.engineFormat[+!!c]}}return console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),{transcoderFormat:u=r.RGBA32,engineFormat:n.RGBAFormat}}(u,d,A,f);if(!d||!A||!g)throw c(),Error("THREE.KTX2Loader: Invalid texture");if(!s.startTranscoding())throw c(),Error("THREE.KTX2Loader: .startTranscoding failed");let E=[],x=[];for(let e=0;e<m;e++){let t=[];for(let i=0;i<g;i++){let n,r,a=[];for(let t=0;t<p;t++){let o=s.getImageLevelInfo(i,t,e);0===e&&0===i&&0===t&&(o.origWidth%4!=0||o.origHeight%4!=0)&&console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),g>1?(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<e.length;i++)t+=e[i].byteLength;let i=new Uint8Array(t),n=0;for(let t=0;t<e.length;t++){let r=e[t];i.set(r,n),n+=r.byteLength}return i}(a);t.push({data:o,width:n,height:r}),x.push(o.buffer)}E.push({mipmaps:t,width:d,height:A,format:y})}return c(),{faces:E,buffers:x,width:d,height:A,hasAlpha:f,format:y,dfdFlags:v}}(c.buffer);self.postMessage({type:"transcode",id:c.id,faces:t,width:u,height:d,hasAlpha:A,format:p,dfdFlags:g},s)}catch(e){console.error(e),self.postMessage({type:"error",id:c.id,error:e.message})}})}});let s=[{if:"astcSupported",basisFormat:[a.UASTC_4x4],transcoderFormat:[r.ASTC_4x4,r.ASTC_4x4],engineFormat:[n.RGBA_ASTC_4x4_Format,n.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.BC7_M5,r.BC7_M5],engineFormat:[n.RGBA_BPTC_Format,n.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.BC1,r.BC3],engineFormat:[n.RGB_S3TC_DXT1_Format,n.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.ETC1,r.ETC2],engineFormat:[n.RGB_ETC2_Format,n.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.ETC1],engineFormat:[n.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[a.ETC1S,a.UASTC_4x4],transcoderFormat:[r.PVRTC1_4_RGB,r.PVRTC1_4_RGBA],engineFormat:[n.RGB_PVRTC_4BPPV1_Format,n.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],o=s.sort(function(e,t){return e.priorityETC1S-t.priorityETC1S}),l=s.sort(function(e,t){return e.priorityUASTC-t.priorityUASTC});function h(e){return e<=2||(e&e-1)==0&&0!==e}};let hF=new Set([1023,1030,1028]),hQ={109:1023,97:1023,37:1023,43:1023,103:1030,83:1030,16:1030,22:1030,100:1028,76:1028,15:1028,9:1028,166:37812,165:37812},hO={109:1015,97:1016,37:1009,43:1009,103:1015,83:1016,16:1009,22:1009,100:1015,76:1016,15:1009,9:1009,166:1009,165:1009};async function hk(e){let t,i,{vkFormat:n}=e;if(void 0===hQ[n])throw Error("THREE.KTX2Loader: Unsupported vkFormat.");2===e.supercompressionScheme&&(a||(a=new Promise(async e=>{let t=new hL;await t.init(),e(t)})),t=await a);let r=[];for(let i=0;i<e.levels.length;i++){let a,s,o=Math.max(1,e.pixelWidth>>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]))for(let e=this[hz].length-1;e>=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<e.attributes.length;i++){let n=e.attributes[i],r=n.name,a=n.array,s=new io(a,n.itemSize);"color"===r&&(this._assignVertexColorSpace(s,n.vertexColorSpace),s.normalized=a instanceof Float32Array==!1),t.setAttribute(r,s)}return t}_assignVertexColorSpace(e,t){if(t!==eh)return;let i=new t6;for(let t=0,n=e.count;t<n;t++)i.fromBufferAttribute(e,t).convertSRGBToLinear(),e.setXYZ(t,i.r,i.g,i.b)}_loadLibrary(e,t){let i=new sk(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((t,n)=>{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.length<this.workerLimit){let e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){let i=t.data;switch(i.type){case"decode":e._callbacks[i.id].resolve(i);break;case"error":e._callbacks[i.id].reject(i);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort(function(e,t){return e._taskLoad>t._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<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}},h0=new hN,h1=Symbol("loader"),h2=Symbol("evictionPolicy"),h3=Symbol("GLTFInstance");class h4 extends ef{static setDRACODecoderLocation(e){s=e,h$.setDecoderPath(e)}static getDRACODecoderLocation(){return s}static setKTX2TranscoderLocation(e){o=e,h0.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return o}static setMeshoptDecoderLocation(e){l!==e&&(l=e,h=new Promise((t,i)=>{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<r;n++)e(t.children[n],i,l)}(e,e,t),function(e){let t=(function(e){let t=[];return e.traverse(function(e){e.isCSS2DObject&&t.push(e)}),t})(e).sort(function(e,t){return e.renderOrder!==t.renderOrder?t.renderOrder-e.renderOrder:s.objects.get(e).distanceToCameraSquared-s.objects.get(t).distanceToCameraSquared}),i=t.length;for(let e=0,n=t.length;e<n;e++)t[e].element.style.zIndex=i-e}(e)},this.setSize=function(e,a){t=e,i=a,n=t/2,r=i/2,o.style.width=e+"px",o.style.height=a+"px"}}}function ci(e,t,i){let n=i,r=new eZ;return e.updateWorldMatrix(!0,!0),e.traverseVisible(e=>{let{geometry:i}=e;if(void 0!==i){let{position:a}=i.attributes;if(void 0!==a)for(let i=0,s=a.count;i<s;i++)e.isMesh?e.getVertexPosition(i,r):r.fromBufferAttribute(a,i),e.isSkinnedMesh||r.applyMatrix4(e.matrixWorld),n=t(n,r)}}),n}function cn(e){let t=arguments.length>1&&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;e<t;e++)a.push(this.pluginCallbacks[e](r));r.setPlugins(a),r.write(e,t,n).catch(i)}parseAsync(e,t){let i=this;return new Promise(function(n,r){i.parse(e,n,r,t)})}constructor(){this.pluginCallbacks=[],this.register(function(e){return new cf(e)}),this.register(function(e){return new cv(e)}),this.register(function(e){return new cE(e)}),this.register(function(e){return new cx(e)}),this.register(function(e){return new cS(e)}),this.register(function(e){return new cC(e)}),this.register(function(e){return new c_(e)}),this.register(function(e){return new cy(e)}),this.register(function(e){return new cI(e)}),this.register(function(e){return new cM(e)}),this.register(function(e){return new cw(e)}),this.register(function(e){return new cb(e)}),this.register(function(e){return new cT(e)})}}let cs={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},co="KHR_mesh_quantization",cl={};cl[1003]=cs.NEAREST,cl[1004]=cs.NEAREST_MIPMAP_NEAREST,cl[1005]=cs.NEAREST_MIPMAP_LINEAR,cl[1006]=cs.LINEAR,cl[1007]=cs.LINEAR_MIPMAP_NEAREST,cl[1008]=cs.LINEAR_MIPMAP_LINEAR,cl[1001]=cs.CLAMP_TO_EDGE,cl[1e3]=cs.REPEAT,cl[1002]=cs.MIRRORED_REPEAT;let ch={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},cc=new t6;function cu(e,t){return e.length===t.length&&e.every(function(e,i){return e===t[i]})}function cd(e){return 4*Math.ceil(e/4)}function cA(e){let t=arguments.length>1&&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;r<i;r++)n[r]=t;return n.buffer}return e}function cp(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function cg(e,t){let i;return void 0!==e.toBlob?new Promise(i=>e.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;i<n;i++)if(Math.abs(t.fromBufferAttribute(e,i).length()-1)>5e-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;e<t;e++)n.fromBufferAttribute(i,e),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),i.setXYZ(e,n.x,n.y,n.z);return t.attributesNormalized.set(e,i),i}applyTextureTransform(e,t){let i=!1,n={};(0!==t.offset.x||0!==t.offset.y)&&(n.offset=t.offset.toArray(),i=!0),0!==t.rotation&&(n.rotation=t.rotation,i=!0),(1!==t.repeat.x||1!==t.repeat.y)&&(n.scale=t.repeat.toArray(),i=!0),i&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(e,t){if(e===t)return e;function i(e){return e.colorSpace===eh?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),e instanceof a8&&(e=cn(e)),t instanceof a8&&(t=cn(t));let n=e?e.image:null,r=t?t.image:null,a=Math.max(n?n.width:0,r?r.width:0),s=Math.max(n?n.height:0,r?r.height:0),o=cp();o.width=a,o.height=s;let l=o.getContext("2d");l.fillStyle="#00ffff",l.fillRect(0,0,a,s);let h=l.getImageData(0,0,a,s);if(n){l.drawImage(n,0,0,a,s);let t=i(e),r=l.getImageData(0,0,a,s).data;for(let e=2;e<r.length;e+=4)h.data[e]=256*t(r[e]/256)}if(r){l.drawImage(r,0,0,a,s);let e=i(t),n=l.getImageData(0,0,a,s).data;for(let t=1;t<n.length;t+=4)h.data[t]=256*e(n[t]/256)}l.putImageData(h,0,0);let c=(e||t).clone();return c.source=new eH(o),c.colorSpace="",c.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),c}processBuffer(e){let t=this.json,i=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),i.push(e),0}processBufferView(e,t,i,n,r){let a,s=this.json;switch(!s.bufferViews&&(s.bufferViews=[]),t){case cs.BYTE:case cs.UNSIGNED_BYTE:a=1;break;case cs.SHORT:case cs.UNSIGNED_SHORT:a=2;break;default:a=4}let o=e.itemSize*a;r===cs.ARRAY_BUFFER&&(o=4*Math.ceil(o/4));let l=cd(n*o),h=new DataView(new ArrayBuffer(l)),c=0;for(let r=i;r<i+n;r++){for(let i=0;i<e.itemSize;i++){let n;e.itemSize>4?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;r<t+i;r++)for(let t=0;t<e.itemSize;t++){let i;e.itemSize>4?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;t<i.length;t+=4)i[t+0]=e.data[t+0],i[t+1]=e.data[t+1],i[t+2]=e.data[t+2],i[t+3]=e.data[t+3];A.putImageData(new ImageData(i,e.width,e.height),0,0)}else if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)A.drawImage(e,0,0,d.width,d.height);else throw Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");!0===o.binary?l.push(cg(d,n).then(e=>r.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;t<i;t++)r.push(e.material[t].uuid);else r.push(e.material.uuid);let a=r.join(":");if(i.meshes.has(a))return i.meshes.get(a);let s=e.geometry;t=e.isLineSegments?cs.LINES:e.isLineLoop?cs.LINE_LOOP:e.isLine?cs.LINE_STRIP:e.isPoints?cs.POINTS:e.material.wireframe?cs.LINES:cs.TRIANGLES;let o={},l={},h=[],c=[],u={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},d=s.getAttribute("normal");void 0===d||this.isNormalizedNormalAttribute(d)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),s.setAttribute("normal",this.createNormalizedNormalAttribute(d)));let A=null;for(let e in s.attributes){if("morph"===e.slice(0,5))continue;let t=s.attributes[e];if(e=u[e]||e.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(e)||(e="_"+e),i.attributes.has(this.getUID(t))){l[e]=i.attributes.get(this.getUID(t));continue}A=null;let n=t.array;"JOINTS_0"!==e||n instanceof Uint16Array||n instanceof Uint8Array||(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),A=new io(new Uint16Array(n),t.itemSize,t.normalized));let r=this.processAccessor(A||t,s);null!==r&&(e.startsWith("_")||this.detectMeshQuantization(e,t),l[e]=r,i.attributes.set(this.getUID(t),r))}if(void 0!==d&&s.setAttribute("normal",d),0===Object.keys(l).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){let t=[],n=[],r={};if(void 0!==e.morphTargetDictionary)for(let t in e.morphTargetDictionary)r[e.morphTargetDictionary[t]]=t;for(let a=0;a<e.morphTargetInfluences.length;++a){let o={},l=!1;for(let e in s.morphAttributes){if("position"!==e&&"normal"!==e){l||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),l=!0);continue}let t=s.morphAttributes[e][a],n=e.toUpperCase(),r=s.attributes[e];if(i.attributes.has(this.getUID(t,!0))){o[n]=i.attributes.get(this.getUID(t,!0));continue}let h=t.clone();if(!s.morphTargetsRelative)for(let e=0,i=t.count;e<i;e++)for(let i=0;i<t.itemSize;i++)0===i&&h.setX(e,t.getX(e)-r.getX(e)),1===i&&h.setY(e,t.getY(e)-r.getY(e)),2===i&&h.setZ(e,t.getZ(e)-r.getZ(e)),3===i&&h.setW(e,t.getW(e)-r.getW(e));o[n]=this.processAccessor(h,s),i.attributes.set(this.getUID(r,!0),o[n])}c.push(o),t.push(e.morphTargetInfluences[a]),void 0!==e.morphTargetDictionary&&n.push(r[a])}o.weights=t,n.length>0&&(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;t<i;t++)e[t]=t;s.setIndex(e),g=!0}let m=p?e.material:[e.material],f=p?s.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,n=f.length;e<n;e++){let n={mode:t,attributes:l};if(this.serializeUserData(s,n),c.length>0&&(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;e<r.length;++e){let i,o=r[e],l=oo.parseTrackName(o.name),h=oo.findNode(t,l.nodeName),c=ch[l.propertyName];if("bones"===l.objectName&&(h=!0===h.isSkinnedMesh?h.skeleton.getBoneByName(l.objectIndex):void 0),!h||!c)return console.warn('THREE.GLTFExporter: Could not export animation track "%s".',o.name),null;let u=o.values.length/o.times.length;c===ch.morphTargetInfluences&&(u/=h.morphTargetInfluences.length),!0===o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(i="CUBICSPLINE",u/=3):i=2300===o.getInterpolation()?"STEP":"LINEAR",s.push({input:this.processAccessor(new io(o.times,1)),output:this.processAccessor(new io(o.values,u)),interpolation:i}),a.push({sampler:s.length-1,target:{node:n.get(h),path:c}})}return i.animations.push({name:e.name||"clip_"+i.animations.length,samplers:s,channels:a}),i.animations.length-1}processSkin(e){let t=this.json,i=this.nodeMap,n=t.nodes[i.get(e)],r=e.skeleton;if(void 0===r)return null;let a=e.skeleton.bones[0];if(void 0===a)return null;let s=[],o=new Float32Array(16*r.bones.length),l=new tv;for(let t=0;t<r.bones.length;++t)s.push(i.get(r.bones[t])),l.copy(r.boneInverses[t]),l.multiply(e.bindMatrix).toArray(o,16*t);return void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new io(o,16)),joints:s,skeleton:i.get(a)}),n.skin=t.skins.length-1}processNode(e){let t=this.json,i=this.options,n=this.nodeMap;t.nodes||(t.nodes=[]);let r={};if(i.trs){let t=e.quaternion.toArray(),i=e.position.toArray(),n=e.scale.toArray();cu(t,[0,0,0,1])||(r.rotation=t),cu(i,[0,0,0])||(r.translation=i),cu(n,[1,1,1])||(r.scale=n)}else e.matrixAutoUpdate&&e.updateMatrix(),!1===cu(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(r.matrix=e.matrix.elements);if(""!==e.name&&(r.name=String(e.name)),this.serializeUserData(e,r),e.isMesh||e.isLine||e.isPoints){let t=this.processMesh(e);null!==t&&(r.mesh=t)}else e.isCamera&&(r.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){let t=[];for(let n=0,r=e.children.length;n<r;n++){let r=e.children[n];if(r.visible||!1===i.onlyVisible){let e=this.processNode(r);null!==e&&t.push(e)}}t.length>0&&(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;t<n;t++){let n=e.children[t];if(n.visible||!1===i.onlyVisible){let e=this.processNode(n);null!==e&&r.push(e)}}r.length>0&&(n.nodes=r),this.serializeUserData(e,n)}processObjects(e){let t=new aA;t.name="AuxScene";for(let i=0;i<e.length;i++)t.children.push(e[i]);this.processScene(t)}processInput(e){let t=this.options;e=e instanceof Array?e:[e],this._invokeAll(function(t){t.beforeParse&&t.beforeParse(e)});let i=[];for(let t=0;t<e.length;t++)e[t]instanceof aA?this.processScene(e[t]):i.push(e[t]);i.length>0&&this.processObjects(i);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let i=0;i<t.animations.length;++i)this.processAnimation(t.animations[i],e[0]);this._invokeAll(function(t){t.afterParse&&t.afterParse(e)})}_invokeAll(e){for(let t=0,i=this.plugins.length;t<i;t++)e(this.plugins[t])}constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}}class cf{writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight)return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);let i=this.writer,n=i.json,r=i.extensionsUsed,a={};e.name&&(a.name=e.name),a.color=e.color.toArray(),a.intensity=e.intensity,e.isDirectionalLight?a.type="directional":e.isPointLight?(a.type="point",e.distance>0&&(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;t<e.count;t++)e.getMatrixAt(t,s),s.decompose(o,l,h),o.toArray(n,3*t),l.toArray(r,4*t),h.toArray(a,3*t);let c={TRANSLATION:i.processAccessor(new io(n,3)),ROTATION:i.processAccessor(new io(r,4)),SCALE:i.processAccessor(new io(a,3))};e.instanceColor&&(c._COLOR_0=i.processAccessor(e.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:c},i.extensionsUsed[this.name]=!0,i.extensionsRequired[this.name]=!0}constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}}ca.Utils={insertKeyframe:function(e,t){let i,n=e.getValueSize(),r=new e.TimeBufferType(e.times.length+1),a=new e.ValueBufferType(e.values.length+n),s=e.createInterpolant(new e.ValueBufferType(n));if(0===e.times.length){r[0]=t;for(let e=0;e<n;e++)a[e]=0;i=0}else if(t<e.times[0]){if(.001>Math.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;o<e.times.length;o++){if(.001>Math.abs(e.times[o]-t))return o;if(e.times[o]<t&&e.times[o+1]>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;e<r.length;++e){let a,s=r[e],o=oo.parseTrackName(s.name),l=oo.findNode(t,o.nodeName);if("morphTargetInfluences"!==o.propertyName||void 0===o.propertyIndex){i.push(s);continue}if(s.createInterpolant!==s.InterpolantFactoryMethodDiscrete&&s.createInterpolant!==s.InterpolantFactoryMethodLinear){if(s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),(s=s.clone()).setInterpolation(2301)}let h=l.morphTargetInfluences.length,c=l.morphTargetDictionary[o.propertyIndex];if(void 0===c)throw Error("THREE.GLTFExporter: Morph target name not found: "+o.propertyIndex);if(void 0===n[l.uuid]){let e=new(a=s.clone()).ValueBufferType(h*a.times.length);for(let t=0;t<a.times.length;t++)e[t*h+c]=a.values[t];a.name=(o.nodeName||"")+".morphTargetInfluences",a.values=e,n[l.uuid]=a,i.push(a);continue}let u=s.createInterpolant(new s.ValueBufferType(1));a=n[l.uuid];for(let e=0;e<a.times.length;e++)a.values[e*h+c]=u.evaluate(a.times[e]);for(let e=0;e<s.times.length;e++){let t=this.insertKeyframe(a,s.times[e]);a.values[t*h+c]=s.values[e]}}return e.tracks=i,e}};let cB=e=>void 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)<r*Math.abs(n)&&c*a>=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<h-2;e+=2)n.push(e,e+1,e+3,e,e+3,e+2);let c=h-2;n.push(c,c+1,1,c,1,0),i.setAttribute("position",new ic(r,3)),i.setIndex(n),super(i),this.side=t;let u=this.material;switch(u.side=2,u.transparent=!0,u.opacity=0,this.goalOpacity=0,this.opacityDamper=new cP,this.hitPlane=new iF(new i9(2*(o+.2),2*(l+.2))),this.hitPlane.visible=!1,this.hitPlane.material.side=2,this.add(this.hitPlane),s.getCenter(this.position),t){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=s.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=s.min.z,this.position.z=this.shadowHeight}e.target.add(this),this.offsetHeight=0}}let ck=(e,t)=>({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<e.keyframes.length;++r){let a=e.keyframes[r],{value:s,frames:o}=a,l=uE(n,s,a.ease||uy);t.push(l),i.push(o),n=s}return((e,t)=>{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<t.children.length;r++)e(t.children[r],i.children[r],n)}(e,n,function(e,n){t.set(n,e),i.set(e,n)}),n.traverse(function(e){if(!e.isSkinnedMesh)return;let n=t.get(e),r=n.skeleton.bones;e.skeleton=n.skeleton.clone(),e.bindMatrix.copy(n.bindMatrix),e.skeleton.bones=r.map(function(e){return i.get(e)}),e.bind(e.skeleton,e.bindMatrix)}),n}(this.scene);dM(t,this.scene);let i=[t],n=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:i,userData:n})}constructor(e){this[dS]=e}}let dM=(e,t)=>{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<e.children.length;n++)dw(e.children[n],t.children[n],i)},db=Symbol("threeGLTF"),dT=Symbol("gltf"),dB=Symbol("gltfElementMap"),dR=Symbol("threeObjectMap"),dL=Symbol("parallelTraverseThreeScene"),dD=Symbol("correlateOriginalThreeGLTF"),dU=Symbol("correlateCloneThreeGLTF");class dP{static from(e,t){return null!=t?this[dU](e,t):this[dD](e)}static[dD](e){let t=e.parser.json,i=e.parser.associations,n=new Map,r={name:"Default"},a={index:-1};for(let e of i.keys())e instanceof ie&&null==i.get(e)&&(a.index<0&&(null==t.materials&&(t.materials=[]),a.index=t.materials.length,t.materials.push(r)),e.name=r.name,i.set(e,{materials:a.index}));for(let[e,r]of i)for(let i in r&&(e.userData=e.userData||{},e.userData.associations=r),r)if(null!=i&&"primitives"!==i){let a=(t[i]||[])[r[i]];if(null==a)continue;let s=n.get(a);null==s&&(s=new Set,n.set(a,s)),s.add(e)}return new dP(e,t,i,n)}static[dU](e,t){let i=t.threeGLTF,n=JSON.parse(JSON.stringify(t.gltf)),r=new Map,a=new Map;for(let s=0;s<i.scenes.length;s++)this[dL](i.scenes[s],e.scenes[s],(e,i)=>{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<e.material.length;++n)i(e.material[n],t.material[n]);else i(e.material,t.material);for(let i=0;i<e.children.length;++i)n(e.children[i],t.children[i])}};n(e,t)}get threeGLTF(){return this[db]}get gltf(){return this[dT]}get gltfElementMap(){return this[dB]}get threeObjectMap(){return this[dR]}constructor(e,t,i,n){this[db]=e,this[dT]=t,this[dB]=n,this[dR]=i}}let dN=Symbol("correlatedSceneGraph");class dF extends dI{static[dx](e){let t=super[dx](e);null==t[dN]&&(t[dN]=dP.from(t));let{scene:i}=t,n=new th(void 0,1/0);return i.traverse(e=>{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]*?)</").concat(t,">"),"i").exec(e);if(r){let e=r[1].match(/<rdf:li>([^<]*)<\/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(;o<s;){if(++l>250)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<h+12*l;e+=12)45057===a.getUint16(e,!n)&&(c=a.getUint32(e+8,!n));let u=o+2+12*l+4,d=[];for(let e=u;e<u+16*c;e+=16){let t={MPType:a.getUint32(e,!n),size:a.getUint32(e+4,!n),dataOffset:a.getUint32(e+8,!n),dependantImages:a.getUint32(e+12,!n),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=r+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,d.push(t)}if(this.options.extractNonFII&&d.length){let e=new Blob([a]),i=[];for(let t of d){if(t.isFII&&!this.options.extractFII)continue;let n=e.slice(t.start,t.end+1,"image/jpeg");i.push(n)}t(i)}}}o+=2+a.getUint16(o+2)}})}constructor(e){this.options={debug:!!e&&void 0!==e.debug&&e.debug,extractFII:!e||void 0===e.extractFII||e.extractFII,extractNonFII:!e||void 0===e.extractNonFII||e.extractNonFII}}}let dW=async e=>{let t=(e=>{let t,i=(t="undefined"!=typeof TextDecoder?new TextDecoder().decode(e):e.toString()).indexOf("<x:xmpmeta");for(;-1!==i;){let e=t.indexOf("x:xmpmeta>",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("<x:xmpmeta",e)}})(e);if(!t)throw new dH("Gain map XMP metadata not found");let i=new dV({extractFII:!0,extractNonFII:!0}),n=await i.extract(e);if(2!==n.length)throw new dG("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:t}},dq=e=>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<t&&n<e.byteLength;)s+=o,a+=o.length,n+=128,o+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(n,n+128)));return -1<r&&(!1!==i&&(e.pos+=a+r+1),s+o.slice(0,r))},s=new Uint8Array(e);s.pos=0;let o=function(e){let t,i,n=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*FORMAT=(\S+)\s*$/,l=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,h={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};for(!(e.pos>=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&&s<e.byteLength;){s+4>e.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(;i<o&&s<e.byteLength;){let t=(u=e[s++])>128;if(t&&(u-=128),(0===u||i+u>o)&&r(3,"bad scanline data"),t){let t=e[s++];for(let e=0;e<u;e++)h[i++]=t}else h.set(e.subarray(s,s+u),i),i+=u,s+=u}for(let e=0;e<t;e++){let i=0;n[a]=h[e+i],i+=t,n[a+1]=h[e+i],i+=t,n[a+2]=h[e+i],i+=t,n[a+3]=h[e+i],a+=4}c--}return n}(s.subarray(s.pos),l,h);switch(this.type){case 1015:let u=new Float32Array(4*(n=c.length/4));for(let e=0;e<n;e++)!function(e,t,i,n){let r=Math.pow(2,e[t+3]-128)/255;i[n+0]=e[t+0]*r,i[n+1]=e[t+1]*r,i[n+2]=e[t+2]*r,i[n+3]=1}(c,4*e,u,4*e);t=u,i=1015;break;case 1016:let d=new Uint16Array(4*(n=c.length/4));for(let e=0;e<n;e++)!function(e,t,i,n){let r=Math.pow(2,e[t+3]-128)/255;i[n+0]=ir.toHalfFloat(Math.min(e[t+0]*r,65504)),i[n+1]=ir.toHalfFloat(Math.min(e[t+1]*r,65504)),i[n+2]=ir.toHalfFloat(Math.min(e[t+2]*r,65504)),i[n+3]=ir.toHalfFloat(1)}(c,4*e,d,4*e);t=d,i=1016;break;default:throw Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:l,height:h,data:t,header:o.string,gamma:o.gamma,exposure:o.exposure,type:i}}setDataType(e){return this.type=e,this}load(e,t,i,n){return super.load(e,function(e,i){switch(e.type){case 1015:case 1016:e.colorSpace=ec,e.minFilter=1006,e.magFilter=1006,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,i)},i,n)}constructor(e){super(e),this.type=1016}}let dK={topLight:{intensity:500,position:[.418,16.199,.3]},room:{position:[-.757,13.219,.717],scale:[31.713,28.305,28.591]},boxes:[{position:[-10.906,2.009,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,.857,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:50,position:[-16.116,14.37,8.208],scale:[.1,2.428,2.739]},{intensity:50,position:[-16.109,18.021,-8.207],scale:[.1,2.425,2.751]},{intensity:17,position:[14.904,12.198,-1.832],scale:[.15,4.265,6.331]},{intensity:43,position:[-.462,8.89,14.52],scale:[4.38,5.441,.088]},{intensity:20,position:[3.235,11.486,-12.541],scale:[2.5,2,.1]},{intensity:100,position:[0,20,0],scale:[1,.1,1]}]},dJ={topLight:{intensity:400,position:[.5,14,.5]},room:{position:[0,13.2,0],scale:[31.5,28.5,31.5]},boxes:[{position:[-10.906,-1,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,-.16,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:80,position:[-14,10,8],scale:[.1,2.5,2.5]},{intensity:80,position:[-14,14,-4],scale:[.1,2.5,2.5]},{intensity:23,position:[14,12,0],scale:[.1,5,5]},{intensity:16,position:[0,9,14],scale:[5,5,.1]},{intensity:80,position:[7,8,-14],scale:[2.5,2.5,.1]},{intensity:80,position:[-7,16,-14],scale:[2.5,2.5,.1]},{intensity:1,position:[0,20,0],scale:[.1,.1,.1]}]};class dZ extends aA{createAreaLightMaterial(e){let t=new it;return t.color.setScalar(e),t}constructor(e){super(),this.position.y=-3.5;let t=new iO;t.deleteAttribute("uv");let i=new sm({metalness:0,side:1}),n=new sm({metalness:0}),r="legacy"==e?dK:dJ,a=new s1(0xffffff,r.topLight.intensity,28,2);a.position.set(...r.topLight.position),this.add(a);let s=new iF(t,i);for(let e of(s.position.set(...r.room.position),s.scale.set(...r.room.scale),this.add(s),r.boxes)){let i=new iF(t,n);i.position.set(...e.position),i.rotation.set(0,e.rotation,0),i.scale.set(...e.scale),this.add(i)}for(let e of r.lights){let i=new iF(t,this.createAreaLightMaterial(e.intensity));i.position.set(...e.position),i.scale.set(...e.scale),this.add(i)}}}let d$=/\.hdr(\.js)?$/;class d0{get ldrLoader(){return null==this._ldrLoader&&(this._ldrLoader=new sz),this._ldrLoader.setWithCredentials(this.withCredentials),this._ldrLoader}get imageLoader(){return null==this._imageLoader&&(this._imageLoader=new dj(this.threeRenderer)),this._imageLoader.setWithCredentials(this.withCredentials),this._imageLoader}get hdrLoader(){return null==this._hdrLoader&&(this._hdrLoader=new dY,this._hdrLoader.setDataType(1016)),this._hdrLoader.setWithCredentials(this.withCredentials),this._hdrLoader}async getLottieLoader(){if(null==this._lottieLoader){let{LottieLoader:e}=await import(this.lottieLoaderUrl);this._lottieLoader=new e}return this._lottieLoader.setWithCredentials(this.withCredentials),this._lottieLoader}async loadImage(e){let t=await new Promise((t,i)=>this.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<o&&(h+=2*i)}for(let e=0;e<l.length;e++)l[e]=l[e]/h;let c=this.blurMaterial.uniforms;c.envMap.value=e.texture,c.samples.value=o,c.weights.value=l,c.latitudinal.value="latitudinal"===n,c.dTheta.value=a,new iK(.1,100,t).update(this.threeRenderer,this.blurScene)}getBlurShader(e){let t=new Float32Array(e);return new iV({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:new eZ(0,1,0)}},vertexShader:"\n \n varying vec3 vOutputDirection;\n \n void main() {\n \n vOutputDirection = vec3( position );\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n }\n ",fragmentShader:"\n varying vec3 vOutputDirection;\n \n uniform samplerCube envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform vec3 poleAxis;\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 vec3( textureCube( envMap, sampleDirection ) );\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 ",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(;t<d1.length&&!(d1[t]<e);)++t;this.lastStep=t-1}registerScene(e){this.scenes.add(e),e.forceRescale();let t=new eM;this.threeRenderer.getSize(t),e.canvas.width=t.x,e.canvas.height=t.y,this.canRender&&this.scenes.size>0&&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;t<r.count;++t)if(a.fromBufferAttribute(r,t),a.y<0){let i=-(3*e)/2,n=a.y<i?-e/a.y:1-a.y*a.y/(3*i*i);a.multiplyScalar(n),a.toArray(r.array,3*t)}return r.needsUpdate=!0,n}(e,t,i)))}constructor(){super(void 0,new it({depthWrite:!1})),this.height=0,this.radius=0,this.resolution=0,this.userData.noHit=!0}}let ph=new eZ,pc=new eZ,pu=new eZ,pd=new ew,pA=new t2,pp=new eJ;class pg extends h5{get facingCamera(){return!this.element.classList.contains("hide")}show(){this.facingCamera&&this.initialized||this.updateVisibility(!0)}hide(){(this.facingCamera||!this.initialized)&&this.updateVisibility(!1)}increment(){this.referenceCount++}decrement(){return this.referenceCount>0&&--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;n<r;n++)op(e[n],this,i,t);return i.sort(oA),i}constructor(e,t,i=0,n=1/0){this.ray=new tf(e,t),this.near=i,this.far=n,this.camera=null,this.layers=new tT,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}},pS=new eZ,pC=new eM;class pI extends aA{get context(){return this.canvas.getContext("2d")}getCamera(){return null!=this.xrCamera?this.xrCamera:this.camera}queueRender(){this.isDirty=!0}shouldRender(){return this.isDirty}hasRendered(){this.isDirty=!1}forceRescale(){this.scaleStep=-1,this.queueRender()}async setObject(e){this.reset(),this._model=e,this.target.add(e),await this.setupScene()}async setSource(e){let t,i=arguments.length>1&&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<e.y+this.size.y/100)||!(i.min.x<=e.x)||!(i.max.x>=t.x)||!(i.min.z<=e.z)||!(i.max.z>=t.z))&&(i.min.z<e.z+this.size.z/100&&i.min.x<=e.x&&i.max.x>=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&&t<r.length&&(a=r[t])}null==a&&(a=r[0]);try{let{currentAnimationAction:e}=this,r=this.mixer.clipAction(a,this);this.currentAnimationAction=r,this.element.paused?this.mixer.stopAllAction():(r.paused=!1,null!=e&&r!==e?r.crossFadeFrom(e,t,!1):this.animationTimeScale>0&&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<n;i++){let n=t[i];n instanceof pg&&e(n)}}initializeSurface(e){if(null!=e.surface&&null==e.mesh){let t=cG(e.surface)[0].terms;if(8!=t.length)return void console.warn(e.surface+" does not have exactly 8 numbers.");let i=this.element.model[A5](t[0].number,t[1].number),n=new eZ(t[2].number,t[3].number,t[4].number);if(null==i)return void console.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");let r=i.mesh.geometry.attributes.position.count;if(n.x>=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("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&console.warn("<model-viewer> 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<<e[n-1];for(var r=new gg(i[30]),n=1;n<30;++n)for(var a=i[n];a<i[n+1];++a)r[a]=a-i[n]<<5|n;return{b:i,r:r}},gy=g_(gm,2),gE=gy.b,gx=gy.r;gE[28]=258,gx[258]=28;for(var gS=g_(gf,0),gC=gS.b,gI=gS.r,gM=new gp(32768),gw=0;gw<32768;++gw){var gb=(43690&gw)>>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<r;++a)e[a]&&++s[e[a]-1];var o=new gp(t);for(a=1;a<t;++a)o[a]=o[a-1]+s[a-1]<<1;if(i){n=new gp(1<<t);var l=15-t;for(a=0;a<r;++a)if(e[a])for(var h=a<<4|e[a],c=t-e[a],u=o[e[a]-1]++<<c,d=u|(1<<c)-1;u<=d;++u)n[gM[u]>>l]=h}else for(a=0,n=new gp(r);a<r;++a)e[a]&&(n[a]=gM[o[e[a]-1]++]>>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;i<e.length;++i)e[i]>t&&(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<y;++C)S[gv[C]]=gF(e,u+3*C,7);u+=3*y;for(var I=gN(S),M=(1<<I)-1,w=gT(S,I,1),C=0;C<E;){var b=w[gF(e,u,M)];u+=15&b;var T=b>>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<<g)-1,F=(1<<m)-1,Q=u;;Q=u){var B=A[gQ(e,u)&N],O=B>>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<<G)-1)+gE[C],u+=G}var H=p[gQ(e,u)&F],z=H>>4;H||gH(3),u+=15&H;var D=gC[z];if(z>3){var G=gf[z];D+=gQ(e,u)&(1<<G)-1,u+=G}if(u>f){l&&gH(0);break}o&&h(d+131072);var V=d+k;if(d<D){var W=a-D,q=Math.min(D,V);for(W+d<0&&gH(3);d<q;++d)i[d]=n[W+d]}for(;d<V;++d)i[d]=i[d-D]}}t.l=A,t.p=Q,t.b=d,t.f=c,A&&(c=1,t.m=g,t.d=p,t.n=m)}while(!c)return d!=i.length&&s?gk(i,0,d):i.subarray(0,d)},gV=function(e,t,i){i<<=7&t;var n=t/8|0;e[n]|=i,e[n+1]|=i>>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;n<e.length;++n)e[n]&&i.push({s:n,f:e[n]});var r=i.length,a=i.slice();if(!r)return{t:g$,l:0};if(1==r){var s=new gA(i[0].s+1);return s[i[0].s]=1,{t:s,l:1}}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var o=i[0],l=i[1],h=0,c=1,u=2;for(i[0]={s:-1,f:o.f+l.f,l:o,r:l};c!=r-1;)o=i[i[h].f<i[u].f?h++:u++],l=i[h!=c&&i[h].f<i[u].f?h++:u++],i[c++]={s:-1,f:o.f+l.f,l:o,r:l};for(var d=a[0].s,n=1;n<r;++n)a[n].s>d&&(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<<m;for(a.sort(function(e,t){return A[t.s]-A[e.s]||e.f-t.f});n<r;++n){var v=a[n].s;if(A[v]>t)g+=f-(1<<p-A[v]),A[v]=t;else break}for(g>>=m;g>0;){var _=a[n].s;A[_]<t?g-=1<<t-A[_]++-1:++n}for(;n>=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<t.length;++n)i+=e[n]*t[n];return i},gK=function(e,t,i){var n=i.length,r=gO(t+2);e[r]=255&n,e[r+1]=n>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var a=0;a<n;++a)e[r+a+4]=i[a];return(r+4+n)*8},gJ=function(e,t,i,n,r,a,s,o,l,h,c){gV(t,c++,i),++r[256];for(var u,d,A,p,g=gq(r,15),m=g.t,f=g.l,v=gq(a,15),_=v.t,y=v.l,E=gj(m),x=E.c,S=E.n,C=gj(_),I=C.c,M=C.n,w=new gp(19),b=0;b<x.length;++b)++w[31&x[b]];for(var b=0;b<I.length;++b)++w[31&I[b]];for(var T=gq(w,7),B=T.t,R=T.l,L=19;L>4&&!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+(P<U)),c+=2,P<U){u=gT(m,f,0),d=m,A=gT(_,y,0),p=_;var N=gT(B,R,0);gV(t,c,S-257),gV(t,c+5,M-1),gV(t,c+10,L-4),c+=14;for(var b=0;b<L;++b)gV(t,c+3*b,B[gv[b]]);c+=3*L;for(var F=[x,I],Q=0;Q<2;++Q)for(var O=F[Q],b=0;b<O.length;++b){var k=31&O[b];gV(t,c,N[k]),c+=B[k],k>15&&(gV(t,c,O[b]>>5&127),c+=O[b]>>12)}}else u=gL,d=gB,A=gU,p=gR;for(var b=0;b<o;++b){var G=n[b];if(G>255){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<<i)-1,g=a.p||new gp(32768),m=a.h||new gp(p+1),f=Math.ceil(i/3),v=2*f,_=function(t){return(e[t]^e[t+1]<<f^e[t+2]<<v)&p},y=new gg(25e3),E=new gp(288),x=new gp(32),S=0,C=0,I=a.i||0,M=0,w=a.w||0,b=0;I+2<s;++I){var T=_(I),B=32767&I,R=m[T];if(g[B]=R,m[T]=B,w<=I){var L=s-I;if((S>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;G<k&&e[I+G]==e[I+G-F];++G);if(G>U){if(U=G,P=F,G>Q)break;for(var H=Math.min(F,G-2),z=0,D=0;D<H;++D){var V=I-F+D&32767,W=g[V],q=V-W&32767;q>z&&(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;++I)y[M++]=e[I],++E[e[I]];c=gJ(e,l,h,y,E,x,C,M,b,I-b,c),h||(a.r=7&c|l[c/8|0]<<3,c-=7,a.h=m,a.p=g,a.i=I,a.w=w)}else{for(var I=a.w||0;I<s+h;I+=65535){var Y=I+65535;Y>=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<t.length;++n)i=g1[255&i^t[n]]^i>>>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<o;++s)r+=n+=i[s];n=(65535&n)+15*(n>>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<n.length;++s){var o=n[s],l=a[s];if("function"==typeof o){t+=";"+l+"=";var h=o.toString();if(o.prototype)if(-1!=h.indexOf("[native code]")){var c=h.indexOf(" ",8)+1;t+=h.slice(c,h.indexOf("(",c))}else for(var u in t+=h,o.prototype)t+=";"+l+".prototype."+u+"="+o.prototype[u].toString();else t+=h}else i[l]=o}return t},g6=[],g9=function(e){var t=[];for(var i in e)e[i].buffer&&t.push((e[i]=new e[i].constructor(e[i])).buffer);return t},g7=function(e,t,i,n){if(!g6[i]){for(var r="",a={},s=e.length-1,o=0;o<s;++o)r=g8(e[o],r,a);g6[i]={c:g8(e[s],r,a),e:a}}var l=g5({},g6[i].e);return gd(g6[i].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",i,l,g9(l),n)},me=function(){return[gA,gp,gg,gm,gf,gv,gE,gC,gD,gP,gM,gG,gT,gN,gF,gQ,gO,gk,gH,gz,mC,mr,ma]},mt=function(){return[gA,gp,gg,gm,gf,gv,gx,gI,gL,gB,gU,gR,gM,gZ,g$,gT,gV,gW,gq,gX,gj,gY,gK,gJ,gO,gk,g0,g4,mE,mr]},mi=function(){return[mA,mp]},mn=function(){return[mf]},mr=function(e){return postMessage(e,[e.buffer])},ma=function(e){return e&&{out:e.size&&new gA(e.size),dictionary:e.dictionary}},ms=function(e){return e.ondata=function(e,t){return postMessage([e,t],[e.buffer])},function(t){t.data.length?(e.push(t.data[0],t.data[1]),postMessage([t.data[0].length])):e.flush()}},mo=function(e,t,i,n,r,a,s){var o,l=g7(e,n,r,function(e,i){e?(l.terminate(),t.ondata.call(t,e)):Array.isArray(i)?1==i.length?(t.queuedSize-=i[0],t.ondrain&&t.ondrain(i[0])):(i[1]&&l.terminate(),t.ondata.call(t,e,i[0],i[1])):s(i)});l.postMessage(i),t.queuedSize=0,t.push=function(e,i){t.ondata||gH(5),o&&t.ondata(gH(4,0,1),null,!!i),t.queuedSize+=e.length,l.postMessage([e,o=i],[e.buffer])},t.terminate=function(){l.terminate()},a&&(t.flush=function(){l.postMessage([])})},ml=function(e,t){return e[t]|e[t+1]<<8},mh=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>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<e.length;++n)i[n]=e.charCodeAt(n);return i}if(mR)return mR.encode(e);for(var r=e.length,a=new gA(e.length+(e.length>>1)),s=0,o=function(e){a[s++]=e},n=0;n<r;++n){if(s+5>a.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;e<i.length;e++){var n=i[e];t.ondata(null,n,!1)}h=[]},u=this.d;this.d=0;var d=this.u.length,A=g5(e,{f:i,u:s,o:a,t:function(){e.terminate&&e.terminate()},r:function(){if(c(),u){var e=t.u[d+1];e?e.r():t.d=1}u=1}}),p=0;e.ondata=function(i,n,r){if(i)t.ondata(i,n,r),t.terminate();else if(p+=n.length,h.push(n),r){var a=new gA(16);mu(a,0,0x8074b50),mu(a,4,e.crc),mu(a,8,p),mu(a,12,e.size),h.push(a),A.c=p,A.b=o+p+16,A.crc=e.crc,A.size=e.size,u&&A.r(),u=1}else u&&c()},this.u.push(A)}},e.prototype.end=function(){var e=this;if(2&this.d)return void this.ondata(gH(4+(1&this.d)*8,0,1),null,!0);this.d?this.e():this.u.push({r:function(){1&e.d&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e.prototype.e=function(){for(var e=0,t=0,i=0,n=0,r=this.u;n<r.length;n++){var a=r[n];i+=46+a.f.length+mQ(a.extra)+(a.o?a.o.length:0)}for(var s=new gA(i+22),o=0,l=this.u;o<l.length;o++){var a=l[o];mO(s,e,a,a.f,a.u,-a.c-2,t,a.o),e+=46+a.f.length+mQ(a.extra)+(a.o?a.o.length:0),t+=a.b}mk(s,e,this.u.length,i,t),this.ondata(null,s,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2}}();var mH=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}();!function(){function e(){var e=this;this.i=new mx(function(t,i){e.ondata(null,t,i)})}e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(e){this.ondata(e,null,t)}},e.compression=8}(),function(){function e(e,t){var i=this;t<32e4?this.i=new mx(function(e,t){i.ondata(null,e,t)}):(this.i=new mS(function(e,t,n){i.ondata(e,t,n)}),this.terminate=this.i.terminate)}e.prototype.push=function(e,t){this.i.terminate&&(e=gk(e,0)),this.i.push(e,t)},e.compression=8}(),function(){function e(e){this.onfile=e,this.k=[],this.o={0:mH},this.p=g$}e.prototype.push=function(e,t){var i=this;if(this.onfile||gH(5),this.p||gH(4),this.c>0){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;s<h-4&&"break"!==function(){var e=mh(l,s);if(0x4034b50==e){a=1,o=s,d.d=null,d.c=0;var t=ml(l,s+6),n=ml(l,s+8),r=8&t,u=ml(l,s+26),A=ml(l,s+28);if(h>s+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<e.length;n+=16384)i+=String.fromCharCode.apply(null,e.subarray(n,n+16384));return i}if(mL)return mL.decode(e);var r=mU(e),a=r.s,i=r.r;return i.length&&gH(8),a}(l.subarray(s+30,s+=30+u),!(2048&t));0xffffffff==f?(f=(p=r?[-2]:mF(l,s))[0],v=p[1]):r&&(f=-1),s+=A,d.c=f;var y={name:_,compression:n,start:function(){if(y.ondata||gH(5),f){var e=i.o[n];e||y.ondata(gH(14,"unknown compression type "+n,1),null,!1),(g=f<0?new e(_):new e(_,f,v)).ondata=function(e,t,i){y.ondata(e,t,i)};for(var t=0;t<m.length;t++){var r=m[t];g.push(r,!1)}i.k[0]==m&&i.c?i.d=g:g.push(g$,!0)}else y.ondata(null,g$,!0)},terminate:function(){g&&g.terminate&&g.terminate()}};f>=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;e<t.count;e++)i.push(t.getX(e));else{let t=e.attributes.position.count;for(let e=0;e<t;e++)i.push(e)}return i.join(", ")}(e),"]\n normal3f[] normals = [").concat(mX(i.normal,n),'] (\n interpolation = "vertex"\n )\n point3f[] points = [').concat(mX(i.position,n),"]\n").concat(function(e){let t="";for(let i=0;i<4;i++){let n=i>0?i:"",r=e["uv"+n];void 0!==r&&(t+="\n texCoord2f[] primvars:st".concat(n," = [").concat(function(e){let t=[];for(let i=0;i<e.count;i++){let n=e.getX(i),r=e.getY(i);t.push("(".concat(n.toPrecision(7),", ").concat(1-r.toPrecision(7),")"))}return t.join(", ")}(r),'] (\n interpolation = "vertex"\n )'))}let i=e.color;if(void 0!==i){let e=i.count;t+="\n color3f[] primvars:displayColor = [".concat(mX(i,e),'] (\n interpolation = "vertex"\n )')}return t}(i),'\n uniform token subdivisionScheme = "none"\n }\n')}(e);return'\ndef "Geometry"\n{\n'.concat(t,"\n}\n")}(i);n[o]=(t=r,mP(e=mV()+t))}r.uuid in s||(s[r.uuid]=r),a+=function(e,t,i){let n="Object_"+e.id,r=mW(e.matrixWorld);return 0>e.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@</Geometry>\n prepend apiSchemas = ["MaterialBindingAPI"]\n)\n{\n matrix4d xformOp:transform = ').concat(r,'\n uniform token[] xformOpOrder = ["xformOp:transform"]\n\n rel material:binding = </Materials/Material_').concat(i.id,">\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 = </Materials/Material_').concat(e.id,"/PrimvarReader_").concat(r,".outputs:result>\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 = </Materials/Material_").concat(e.id,"/Transform2d_").concat(r,".outputs:result>\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 = </Materials/Material_").concat(e.id,"/Texture_").concat(e.map.id,"_diffuse.outputs:rgb>")),e.transparent?n.push("".concat(" ","float inputs:opacity.connect = </Materials/Material_").concat(e.id,"/Texture_").concat(e.map.id,"_diffuse.outputs:a>")):e.alphaTest>0&&(n.push("".concat(" ","float inputs:opacity.connect = </Materials/Material_").concat(e.id,"/Texture_").concat(e.map.id,"_diffuse.outputs:a>")),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 = </Materials/Material_").concat(e.id,"/Texture_").concat(e.emissiveMap.id,"_emissive.outputs:rgb>")),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 = </Materials/Material_").concat(e.id,"/Texture_").concat(e.normalMap.id,"_normal.outputs:rgb>")),r.push(a(e.normalMap,"normal"))),null!==e.aoMap&&(n.push("".concat(" ","float inputs:occlusion.connect = </Materials/Material_").concat(e.id,"/Texture_").concat(e.aoMap.id,"_occlusion.outputs:r>")),r.push(a(e.aoMap,"occlusion"))),null!==e.roughnessMap&&1===e.roughness?(n.push("".concat(" ","float inputs:roughness.connect = </Materials/Material_").concat(e.id,"/Texture_").concat(e.roughnessMap.id,"_roughness.outputs:g>")),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 = </Materials/Material_").concat(e.id,"/Texture_").concat(e.metalnessMap.id,"_metallic.outputs:b>")),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 = </Materials/Material_").concat(e.id,"/Texture_").concat(e.alphaMap.id,"_opacity.outputs:r>")),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 = </Materials/Material_").concat(e.id,"/PreviewSurface.outputs:surface>\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<n.length;++S){var u=n[S];mO(y,u.o,u,u.f,u.u,u.c.length);var C=30+u.f.length+mQ(u.extra);y.set(u.c,u.o+C),mO(y,r,u,u.f,u.u,u.c.length,u.o,u.m),r+=16+C+(u.m?u.m.length:0)}return mk(y,r,n.length,x,E),y}(n,{level:0})}}function mV(){return'#usda 1.0\n(\n customLayerData = {\n string creator = "Three.js USDZExporter"\n }\n defaultPrim = "Root"\n metersPerUnit = 1\n upAxis = "Y"\n)\n\n'}function mW(e){let t=e.elements;return"( ".concat(mq(t,0),", ").concat(mq(t,4),", ").concat(mq(t,8),", ").concat(mq(t,12)," )")}function mq(e,t){return"(".concat(e[t+0],", ").concat(e[t+1],", ").concat(e[t+2],", ").concat(e[t+3],")")}function mX(e,t){if(void 0===e)return console.warn("USDZExporter: Normals missing."),Array(t).fill("(0, 0, 0)").join(", ");let i=[];for(let t=0;t<e.count;t++){let n=e.getX(t),r=e.getY(t),a=e.getZ(t);i.push("(".concat(n.toPrecision(7),", ").concat(r.toPrecision(7),", ").concat(a.toPrecision(7),")"))}return i.join(", ")}function mj(e){return"(".concat(e.r,", ").concat(e.g,", ").concat(e.b,")")}function mY(e){return"(".concat(e.x,", ").concat(e.y,")")}var mK=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 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<this.children.length;++e)this[gl](this.children[e]);let{ShadyDOM:e}=self;null==e?this[go].observe(this,{childList:!0}):this[go]=e.observeChildren(this,this[gs])}disconnectedCallback(){super.disconnectedCallback();let{ShadyDOM:e}=self;null==e?this[go].disconnect():e.unobserveChildren(this[go])}[(t=ga,i=gs,n=go,p0)](e,t){super[p0](e,t);let i=this[pZ],{annotationRenderer:n}=i,r=i.getCamera();i.shouldRender()&&(i.updateSurfaceHotspots(),i.updateHotspotsVisibility(r.position),n.domElement.style.display="",n.render(i,r))}updateHotspot(e){let t=this[ga].get(e.name);null!=t&&(t.updatePosition(e.position),t.updateNormal(e.normal),t.surface=e.surface,this[p$]())}queryHotspot(e){let t=this[ga].get(e);if(null==t)return null;let i=p9(t.position),n=p9(t.normal),r=t.facingCamera,a=this[pZ],s=a.getCamera(),o=new eZ;o.setFromMatrixPosition(t.matrixWorld),o.project(s);let l=a.width/2,h=a.height/2;o.x=o.x*l+l,o.y=-(o.y*h)+h;let c=p9(new eZ(o.x,o.y,o.z));return Number.isFinite(c.x)&&Number.isFinite(c.y)?{position:i,normal:n,canvasPosition:c,facingCamera:r}:null}positionAndNormalFromPoint(e,t){let i=this[pZ],n=i.getNDC(e,t),r=i.positionAndNormalFromPoint(n);if(null==r)return null;gc.copy(i.target.matrixWorld).invert();let a=p9(r.position.applyMatrix4(gc)),s=p9(r.normal.transformDirection(gc)),o=null;return null!=r.uv&&(o=p7(r.uv)),{position:a,normal:s,uv:o}}surfaceFromPoint(e,t){let i=this[pZ],n=i.getNDC(e,t);return i.surfaceFromPoint(n)}[gl](e){if(!(e instanceof HTMLElement&&0===e.slot.indexOf("hotspot")))return;let t=this[ga].get(e.slot);null!=t?t.increment():(t=new pg({name:e.slot,position:e.dataset.position,normal:e.dataset.normal,surface:e.dataset.surface}),this[ga].set(e.slot,t),this[pZ].addHotspot(t)),this[pZ].queueRender()}[gh](e){if(!(e instanceof HTMLElement))return;let t=this[ga].get(e.slot);t&&(t.decrement()&&(this[pZ].removeHotspot(t),this[ga].delete(e.slot)),this[pZ].queueRender())}constructor(){super(...arguments),this[t]=new Map,this[i]=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;a<n;a++)r[a]=arguments[a];null==i&&(e(...r),i=self.setTimeout(()=>i=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))}]); |