PageSourceSearch

https://governances.app/assets/vendor-3d-h4bRncFc.js

js governances.app collected 2026-10-04 12:33:49 UTC 776,773 bytes, 4,230 lines download raw bytes

1var gp=Object.defineProperty;var vp=(r,e,t)=>e in r?gp(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Vt=(r,e,t)=>vp(r,typeof e!="symbol"?e+"":e,t);import{as as la}from"./vendor-core-x-1-NXdt.js";/**
2 * @license
3 * Copyright 2010-2026 Three.js Authors
4 * SPDX-License-Identifier: MIT
5 */const $r="184",_p={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},yp={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},gd=0,Sc=1,vd=2,xp=3,Mp=0,Sr=1,_d=2,Bs=3,un=0,pi=1,Fi=2,zi=0,ss=1,bc=2,Tc=3,wc=4,yd=5,Sp=6,En=100,xd=101,Md=102,Sd=103,bd=104,Td=200,wd=201,Ed=202,Ad=203,so=204,ro=205,Cd=206,Rd=207,Id=208,Pd=209,Ld=210,Ud=211,Nd=212,Dd=213,Od=214,ao=0,oo=1,lo=2,os=3,co=4,ho=5,uo=6,fo=7,Kr=0,Fd=1,Bd=2,ki=0,Hc=1,Gc=2,Wc=3,Xc=4,qc=5,Yc=6,Zc=7,Ec="attached",zd="detached",In=300,Qi=301,Pn=302,br=303,Tr=304,Js=306,Ur=1e3,Gt=1001,Nr=1002,Zt=1003,Jc=1004,bp=1004,zs=1005,Tp=1005,wt=1006,wr=1007,wp=1007,$i=1008,Ac=1008,ii=1009,Ko=1010,Qo=1011,Gs=1012,Qr=1013,Ci=1014,Ft=1015,Jt=1016,jo=1017,el=1018,Ws=1020,$c=35902,Kc=35899,Qc=1021,jc=1022,Kt=1023,ji=1026,An=1027,jr=1028,ea=1029,Ln=1030,tl=1031,Ep=1032,il=1033,Er=33776,Ar=33777,Cr=33778,Rr=33779,po=35840,mo=35841,go=35842,vo=35843,_o=36196,yo=37492,xo=37496,Mo=37488,So=37489,Dr=37490,bo=37491,To=37808,wo=37809,Eo=37810,Ao=37811,Co=37812,Ro=37813,Io=37814,Po=37815,Lo=37816,Uo=37817,No=37818,Do=37819,Oo=37820,Fo=37821,Bo=36492,zo=36494,ko=36495,Vo=36283,Ho=36284,Or=36285,Go=36286,kd=2200,Vd=2201,Hd=2202,Fr=2300,Wo=2301,to=2302,Cc=2303,es=2400,ts=2401,Br=2402,nl=2500,eh=2501,Ap=0,Cp=1,Rp=2,Gd=3200,Ip=3201,Pp=3202,Lp=3203,dn=0,Wd=1,ln="",di="srgb",Un="srgb-linear",zr="linear",It="srgb",Up="",Np="rg",Dp="ga",Op=0,Qn=7680,Fp=7681,Bp=7682,zp=7683,kp=34055,Vp=34056,Hp=5386,Gp=512,Wp=513,Xp=514,qp=515,Yp=516,Zp=517,Jp=518,Rc=519,Xd=512,qd=513,Yd=514,sl=515,Zd=516,Jd=517,rl=518,$d=519,kr=35044,$p=35048,Kp=35040,Qp=35045,jp=35049,em=35041,tm=35046,im=35050,nm=35042,sm="100",Ic="300 es",wi=2e3,ls=2001,rm={COMPUTE:"compute",RENDER:"render"},am={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},om={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"},lm={TEXTURE_COMPARE:"depthTextureCompare"};function cm(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const hm={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function ks(r,e){return new hm[r](e)}function Kd(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function Vr(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Qd(){const r=Vr("canvas");return r.style.display="block",r}const Bh={};let Nn=null;function um(r){Nn=r}function dm(){return Nn}function Hr(...r){const e="THREE."+r.shift();Nn?Nn("log",e,...r):console.log(e,...r)}function jd(r){const e=r[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=r[1];t&&t.isStackTrace?r[0]+=" "+t.getLocation():r[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return r}function Re(...r){r=jd(r);const e="THREE."+r.shift();if(Nn)Nn("warn",e,...r);else{const t=r[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...r)}}function Ze(...r){r=jd(r);const e="THREE."+r.shift();if(Nn)Nn("error",e,...r);else{const t=r[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...r)}}function Xo(...r){const e=r.join(" ");e in Bh||(Bh[e]=!0,Re(...r))}function fm(r,e,t){return new Promise(function(i,n){function s(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:n();break;case r.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}const pm={[ao]:oo,[lo]:uo,[co]:fo,[os]:ho,[oo]:ao,[uo]:lo,[fo]:co,[ho]:os};class Hi{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i===void 0?!1:i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners;if(i===void 0)return;const n=i[e];if(n!==void 0){const s=n.indexOf(t);s!==-1&&n.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const i=t[e.type];if(i!==void 0){e.target=this;const n=i.slice(0);for(let s=0,a=n.length;s<a;s++)n[s].call(this,e);e.target=null}}}const si=["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","5
55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let zh=1234567;const rs=Math.PI/180,Xs=180/Math.PI;function Ei(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(si[r&255]+si[r>>8&255]+si[r>>16&255]+si[r>>24&255]+"-"+si[e&255]+si[e>>8&255]+"-"+si[e>>16&15|64]+si[e>>24&255]+"-"+si[t&63|128]+si[t>>8&255]+"-"+si[t>>16&255]+si[t>>24&255]+si[i&255]+si[i>>8&255]+si[i>>16&255]+si[i>>24&255]).toLowerCase()}function rt(r,e,t){return Math.max(e,Math.min(t,r))}function th(r,e){return(r%e+e)%e}function mm(r,e,t,i,n){return i+(r-e)*(n-i)/(t-e)}function gm(r,e,t){return r!==e?(t-r)/(e-r):0}function Ir(r,e,t){return(1-t)*r+t*e}function vm(r,e,t,i){return Ir(r,e,1-Math.exp(-t*i))}function _m(r,e=1){return e-Math.abs(th(r,e*2)-e)}function ym(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function xm(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function Mm(r,e){return r+Math.floor(Math.random()*(e-r+1))}function Sm(r,e){return r+Math.random()*(e-r)}function bm(r){return r*(.5-Math.random())}function Tm(r){r!==void 0&&(zh=r);let e=zh+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function wm(r){return r*rs}function Em(r){return r*Xs}function Am(r){return(r&r-1)===0&&r!==0}function Cm(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Rm(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Im(r,e,t,i,n){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+i)/2),u=a((e+i)/2),d=s((e-i)/2),h=a((e-i)/2),f=s((i-e)/2),p=a((i-e)/2);switch(n){case"XYX":r.set(o*u,l*d,l*h,o*c);break;case"YZY":r.set(l*h,o*u,l*d,o*c);break;case"ZXZ":r.set(l*d,l*h,o*u,o*c);break;case"XZX":r.set(o*u,l*p,l*f,o*c);break;case"YXY":r.set(l*f,o*u,l*p,o*c);break;case"ZYZ":r.set(l*p,l*f,o*u,o*c);break;default:Re("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+n)}}function fi(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function gt(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const Pm={DEG2RAD:rs,RAD2DEG:Xs,generateUUID:Ei,clamp:rt,euclideanModulo:th,mapLinear:mm,inverseLerp:gm,lerp:Ir,damp:vm,pingpong:_m,smoothstep:ym,smootherstep:xm,randInt:Mm,randFloat:Sm,randFloatSpread:bm,seededRandom:Tm,degToRad:wm,radToDeg:Em,isPowerOfTwo:Am,ceilPowerOfTwo:Cm,floorPowerOfTwo:Rm,setQuaternionFromProperEuler:Im,normalize:gt,denormalize:fi},Lh=class Lh{constructor(e=0,t=0){this.x=e,this.y=t}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 new 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 new 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}
vendor: 52,012 bytes, line 5
5sub(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){const 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=rt(this.x,e.x,t.x),this.y=rt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=rt(this.x,e,t),this.y=rt(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(rt(i,e,t))}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){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(rt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const 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,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=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){const i=Math.cos(t),n=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*n+e.x,this.y=s*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}};Lh.prototype.isVector2=!0;let se=Lh;class mi{constructor(e=0,t=0,i=0,n=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=n}static slerpFlat(e,t,i,n,s,a,o){let l=i[n+0],c=i[n+1],u=i[n+2],d=i[n+3],h=s[a+0],f=s[a+1],p=s[a+2],v=s[a+3];if(d!==v||l!==h||c!==f||u!==p){let g=l*h+c*f+u*p+d*v;g<0&&(h=-h,f=-f,p=-p,v=-v,g=-g);let m=1-o;if(g<.9995){const _=Math.acos(g),x=Math.sin(_);m=Math.sin(m*_)/x,o=Math.sin(o*_)/x,l=l*m+h*o,c=c*m+f*o,u=u*m+p*o,d=d*m+v*o}else{l=l*m+h*o,c=c*m+f*o,u=u*m+p*o,d=d*m+v*o;const _=1/Math.sqrt(l*l+c*c+u*u+d*d);l*=_,c*=_,u*=_,d*=_}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d}static multiplyQuaternionsFlat(e,t,i,n,s,a){const o=i[n],l=i[n+1],c=i[n+2],u=i[n+3],d=s[a],h=s[a+1],f=s[a+2],p=s[a+3];return e[t]=o*p+u*d+l*f-c*h,e[t+1]=l*p+u*h+c*d-o*f,e[t+2]=c*p+u*f+o*h-l*d,e[t+3]=u*p-o*d-l*h-c*f,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,t=!0){const i=e._x,n=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),u=o(n/2),d=o(s/2),h=l(i/2),f=l(n/2),p=l(s/2);switch(a){case"XYZ":this._x=h*u*d+c*f*p,this._y=c*f*d-h*u*p,this._z=c*u*p+h*f*d,this._w=c*u*d-h*f*p;break;case"YXZ":this._x=h*u*d+c*f*p,this._y=c*f*d-h*u*p,this._z=c*u*p-h*f*d,this._w=c*u*d+h*f*p;break;case"ZXY":this._x=h*u*d-c*f*p,this._y=c*f*d+h*u*p,this._z=c*u*p+h*f*d,this._w=c*u*d-h*f*p;break;case"ZYX":this._x=h*u*d-c*f*p,this._y=c*f*d+h*u*p,this._z=c*u*p-h*f*d,this._w=c*u*d+h*f*p;break;case"YZX":this._x=h*u*d+c*f*p,this._y=c*f*d+h*u*p,this._z=c*u*p-h*f*d,this._w=c*u*d-h*f*p;break;case"XZY":this._x=h*u*d-c*f*p,this._y=c*f*d-h*u*p,this._z=c*u*p+h*f*d,this._w=c*u*d+h*f*p;break;default:Re("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const 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){const t=e.elements,i=t[0],n=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],d=t[10],h=i+o+d;if(h>0){const f=.5/Math.sqrt(h+1);this._w=.25/f,this._x=(u-l)*f,this._y=(s-c)*f,this._z=(a-n)*f}else if(i>o&&i>d){const f=2*Math.sqrt(1+i-o-d);this._w=(u-l)/f,this._x=.25*f,this._y=(n+a)/f,this._z=(s+c)/f}else if(o>d){const f=2*Math.sqrt(1+o-i-d);this._w=(s-c)/f,this._x=(n+a)/f,this._y=.25*f,this._z=(l+u)/f}else{const f=2*Math.sqrt(1+d-i-o);this._w=(a-n)/f,this._x=(s+c)/f,this._y=(l+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<1e-8?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(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(rt(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const 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 e===0?(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){const i=e._x,n=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+a*o+n*c-s*l,this._y=n*u+a*l+s*o-i*c,this._z=s*u+a*c+i*l-n*o,this._w=a*u-i*o-n*l-s*c,this._onChangeCallback(),this}slerp(e,t){let i=e._x,n=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(i=-i,n=-n,s=-s,a=-a,o=-o);let l=1-t;if(o<.9995){const c=Math.acos(o),u=Math.sin(c);l=Math.sin(l*c)/u,t=Math.sin(t*c)/u,this._x=this._x*l+i*t,this._y=this._y*l+n*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this._onChangeCallback()}else this._x=this._x*l+i*t,this._y=this._y*l+n*t,this._z=this._z*l+s*t,this._w=this._w*l+a*t,this.normalize();return this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(n*Math.sin(e),n*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=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(e=[],t=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}}const Uh=class Uh{constructor(e=0,t=0,i=0){this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(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 new 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 new 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(kh.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(kh.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,n=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*n,this.y=s[1]*t+s[4]*i+s[7]*n,this.z=s[2]*t+s[5]*i+s[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,n=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*n+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*n+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*n+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*n+s[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,n=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*n-o*i),u=2*(o*t-s*n),d=2*(s*i-a*t);return this.x=t+l*c+a*d-o*u,this.y=i+l*u+o*c-s*d,this.z=n+l*d+s*u-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,n=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*n,this.y=s[1]*t+s[5]*i+s[9]*n,this.z=s[2]*t+s[6]*i+s[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=rt(this.x,e.x,t.x),this.y=rt(this.y,e.y,t.y),this.z=rt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=rt(this.x,e,t),this.y=rt(this.y,e,t),this.z=rt(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(rt(i,e,t))}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){const i=e.x,n=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=n*l-s*o,this.y=s*a-i*l,this.z=i*o-n*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Ll.copy(this).projectOnVector(e),this.sub(Ll)}reflect(e){return this.sub(Ll.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(rt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const 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){const 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){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const 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,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}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,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=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(){const e=Math.random()*Math.PI*2,t=Math.random()*2-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}};Uh.prototype.isVector3=!0;let P=Uh;const Ll=new P,kh=new mi,Nh=class Nh{constructor(e,t,i,n,s,a,o,l,c){this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,n,s,a,o,l,c)}set(e,t,i,n,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=n,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const 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){const 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){const i=e.elements,n=t.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],u=i[4],d=i[7],h=i[2],f=i[5],p=i[8],v=n[0],g=n[3],m=n[6],_=n[1],x=n[4],M=n[7],R=n[2],E=n[5],I=n[8];return s[0]=a*v+o*_+l*R,s[3]=a*g+o*x+l*E,s[6]=a*m+o*M+l*I,s[1]=c*v+u*_+d*R,s[4]=c*g+u*x+d*E,s[7]=c*m+u*M+d*I,s[2]=h*v+f*_+p*R,s[5]=h*g+f*x+p*E,s[8]=h*m+f*M+p*I,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],i=e[1],n=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-i*s*u+i*o*l+n*s*c-n*a*l}invert(){const e=this.elements,t=e[0],i=e[1],n=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=u*a-o*c,h=o*l-u*s,f=c*s-a*l,p=t*d+i*h+n*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/p;return e[0]=d*v,e[1]=(n*c-u*i)*v,e[2]=(o*i-n*a)*v,e[3]=h*v,e[4]=(u*t-n*l)*v,e[5]=(n*s-o*t)*v,e[6]=f*v,e[7]=(i*l-c*t)*v,e[8]=(a*t-i*s)*v,this}transpose(){let e;const 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){const 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,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-n*c,n*l,-n*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Ul.makeScale(e,t)),this}rotate(e){return this.premultiply(Ul.makeRotation(-e)),this}translate(e,t){return this.premultiply(Ul.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){const 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){const t=this.elements,i=e.elements;for(let n=0;n<9;n++)if(t[n]!==i[n])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const 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)}};Nh.prototype.isMatrix3=!0;let ft=Nh;const Ul=new ft,Vh=new ft().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Hh=new ft().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Lm(){const r={enabled:!0,workingColorSpace:Un,spaces:{},convert:function(n,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===It&&(n.r=hn(n.r),n.g=hn(n.g),n.b=hn(n.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(n.applyMatrix3(this.spaces[s].toXYZ),n.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===It&&(n.r=Hs(n.r),n.g=Hs(n.g),n.b=Hs(n.b))),n},workingToColorSpace:function(n,s){return this.convert(n,this.workingColorSpace,s)},colorSpaceToWorking:function(n,s){return this.convert(n,s,this.workingColorSpace)},getPrimaries:function(n){return this.spaces[n].primaries},getTransfer:function(n){return n===ln?zr:this.spaces[n].transfer},getToneMappingMode:function(n){return this.spaces[n].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(n,s=this.workingColorSpace){return n.fromArray(this.spaces[s].luminanceCoefficients)},define:function(n){Object.assign(this.spaces,n)},_getMatrix:function(n,s,a){return n.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(n){return this.spaces[n].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(n=this.workingColorSpace){return this.spaces[n].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(n,s){return Xo("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(n,s)},toWorkingColorSpace:function(n,s){return Xo("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(n,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return r.define({[Un]:{primaries:e,whitePoint:i,transfer:zr,toXYZ:Vh,fromXYZ:Hh,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:di},outputColorSpaceConfig:{drawingBufferColorSpace:di}},[di]:{primaries:e,whitePoint:i,transfer:It,toXYZ:Vh,fromXYZ:Hh,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:di}}}),r}const bt=Lm();function hn(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Hs(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let vs;class ef{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let i;if(e instanceof HTMLCanvasElement)i=e;else{vs===void 0&&(vs=Vr("canvas")),vs.width=e.width,vs.height=e.height;const n=vs.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),i=vs}return i.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Vr("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const n=i.getImageData(0,0,e.width,e.height),s=n.data;for(let a=0;a<s.length;a++)s[a]=hn(s[a]/255)*255;return i.putImageData(n,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(hn(t[i]/255)*255):t[i]=hn(t[i]);return{data:t,width:e.width,height:e.height}}else return Re("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Um=0;class Cn{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Um++}),this.uuid=Ei(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},n=this.data;if(n!==null){let s;if(Array.isArray(n)){s=[];for(let a=0,o=n.length;a<o;a++)n[a].isDataTexture?s.push(Nl(n[a].image)):s.push(Nl(n[a]))}else s=Nl(n);i.url=s}return t||(e.images[this.uuid]=i),i}}function Nl(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?ef.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(Re("Texture: Unable to serialize Texture."),{})}let Nm=0;const Dl=new P;class Lt extends Hi{constructor(e=Lt.DEFAULT_IMAGE,t=Lt.DEFAULT_MAPPING,i=Gt,n=Gt,s=wt,a=$i,o=Kt,l=ii,c=Lt.DEFAULT_ANISOTROPY,u=ln){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Nm++}),this.uuid=Ei(),this.name="",this.source=new Cn(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=n,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new se(0,0),this.repeat=new se(1,1),this.center=new se(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ft,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(Dl).x}get height(){return this.source.getSize(Dl).y}get depth(){return this.source.getSize(Dl).z}get image(){return this.source.data}set image(e){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)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}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.normalized=e.normalized,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.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const i=e[t];if(i===void 0){Re(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const n=this[t];if(n===void 0){Re(`Texture.setValues(): property '${t}' does not exist.`);continue}n&&i&&n.isVector2&&i.isVector2||n&&i&&n.isVector3&&i.isVector3||n&&i&&n.isMatrix3&&i.isMatrix3?n.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.7,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,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};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(this.mapping!==In)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ur:e.x=e.x-Math.floor(e.x);break;case Gt:e.x=e.x<0?0:1;break;case Nr:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Ur:e.y=e.y-Math.floor(e.y);break;case Gt:e.y=e.y<0?0:1;break;case Nr:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Lt.DEFAULT_IMAGE=null;Lt.DEFAULT_MAPPING=In;Lt.DEFAULT_ANISOTROPY=1;const Dh=class Dh{constructor(e=0,t=0,i=0,n=1){this.x=e,this.y=t,this.z=i,this.w=n}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 new 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 new 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=e.w!==void 0?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){const t=this.x,i=this.y,n=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*n+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*n+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*n+a[14]*s,this.w=a[3]*t+a[7]*i+a[11]*n+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const 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,s;const l=e.elements,c=l[0],u=l[4],d=l[8],h=l[1],f=l[5],p=l[9],v=l[2],g=l[6],m=l[10];if(Math.abs(u-h)<.01&&Math.abs(d-v)<.01&&Math.abs(p-g)<.01){if(Math.abs(u+h)<.1&&Math.abs(d+v)<.1&&Math.abs(p+g)<.1&&Math.abs(c+f+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(c+1)/2,M=(f+1)/2,R=(m+1)/2,E=(u+h)/4,I=(d+v)/4,y=(p+g)/4;return x>M&&x>R?x<.01?(i=0,n=.707106781,s=.707106781):(i=Math.sqrt(x),n=E/i,s=I/i):M>R?M<.01?(i=.707106781,n=0,s=.707106781):(n=Math.sqrt(M),i=E/n,s=y/n):R<.01?(i=.707106781,n=.707106781,s=0):(s=Math.sqrt(R),i=I/s,n=y/s),this.set(i,n,s,t),this}let _=Math.sqrt((g-p)*(g-p)+(d-v)*(d-v)+(h-u)*(h-u));return Math.abs(_)<.001&&(_=1),this.x=(g-p)/_,this.y=(d-v)/_,this.z=(h-u)/_,this.w=Math.acos((c+f+m-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],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=rt(this.x,e.x,t.x),this.y=rt(this.y,e.y,t.y),this.z=rt(this.z,e.z,t.z),this.w=rt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=rt(this.x,e,t),this.y=rt(this.y,e,t),this.z=rt(this.z,e,t),this.w=rt(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(rt(i,e,t))}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,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=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}};Dh.prototype.isVector4=!0;let Pt=Dh;class ih extends Hi{constructor(e=1,t=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:wt,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=i.depth,this.scissor=new Pt(0,0,e,t),this.scissorTest=!1,this.viewport=new Pt(0,0,e,t),this.textures=[];const n={width:e,height:t,depth:i.depth},s=new Lt(n),a=i.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(e={}){const t={minFilter:wt,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let n=0,s=this.textures.length;n<s;n++)this.textures[n].image.width=e,this.textures[n].image.height=t,this.textures[n].image.depth=i,this.textures[n].isData3DTexture!==!0&&(this.textures[n].isArrayTexture=this.textures[n].image.depth>1);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,this.textures[t].renderTarget=this;const n=Object.assign({},e.textures[t].image);this.textures[t].source=new Cn(n)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this.multiview=e.multiview,this}dispose(){this.dispatchEvent({type:"dispose"})}}class gi extends ih{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class al extends Lt{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=Zt,this.minFilter=Zt,this.wrapR=Gt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Dm extends gi{constructor(e=1,t=1,i=1,n={}){super(e,t,n),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new al(null,e,t,i),this._setTextureOptions(n),this.texture.isRenderTargetTexture=!0}}class ol extends Lt{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=Zt,this.minFilter=Zt,this.wrapR=Gt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Om extends gi{constructor(e=1,t=1,i=1,n={}){super(e,t,n),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new ol(null,e,t,i),this._setTextureOptions(n),this.texture.isRenderTargetTexture=!0}}const $o=class $o{constructor(e,t,i,n,s,a,o,l,c,u,d,h,f,p,v,g){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,n,s,a,o,l,c,u,d,h,f,p,v,g)}set(e,t,i,n,s,a,o,l,c,u,d,h,f,p,v,g){const m=this.elements;return m[0]=e,m[4]=t,m[8]=i,m[12]=n,m[1]=s,m[5]=a,m[9]=o,m[13]=l,m[2]=c,m[6]=u,m[10]=d,m[14]=h,m[3]=f,m[7]=p,m[11]=v,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 $o().fromArray(this.elements)}copy(e){const 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){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const 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 this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),i.set(0,0,1),this):(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){if(e.determinant()===0)return this.identity();const t=this.elements,i=e.elements,n=1/_s.setFromMatrixColumn(e,0).length(),s=1/_s.setFromMatrixColumn(e,1).length(),a=1/_s.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]*s,t[5]=i[5]*s,t[6]=i[6]*s,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){const t=this.elements,i=e.x,n=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(n),c=Math.sin(n),u=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const h=a*u,f=a*d,p=o*u,v=o*d;t[0]=l*u,t[4]=-l*d,t[8]=c,t[1]=f+p*c,t[5]=h-v*c,t[9]=-o*l,t[2]=v-h*c,t[6]=p+f*c,t[10]=a*l}else if(e.order==="YXZ"){const h=l*u,f=l*d,p=c*u,v=c*d;t[0]=h+v*o,t[4]=p*o-f,t[8]=a*c,t[1]=a*d,t[5]=a*u,t[9]=-o,t[2]=f*o-p,t[6]=v+h*o,t[10]=a*l}else if(e.order==="ZXY"){const h=l*u,f=l*d,p=c*u,v=c*d;t[0]=h-v*o,t[4]=-a*d,t[8]=p+f*o,t[1]=f+p*o,t[5]=a*u,t[9]=v-h*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const h=a*u,f=a*d,p=o*u,v=o*d;t[0]=l*u,t[4]=p*c-f,t[8]=h*c+v,t[1]=l*d,t[5]=v*c+h,t[9]=f*c-p,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const h=a*l,f=a*c,p=o*l,v=o*c;t[0]=l*u,t[4]=v-h*d,t[8]=p*d+f,t[1]=d,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=f*d+p,t[10]=h-v*d}else if(e.order==="XZY"){const h=a*l,f=a*c,p=o*l,v=o*c;t[0]=l*u,t[4]=-d,t[8]=c*u,t[1]=h*d+v,t[5]=a*u,t[9]=f*d-p,t[2]=p*d-f,t[6]=o*u,t[10]=v*d+h}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(Fm,e,Bm)}lookAt(e,t,i){const n=this.elements;return bi.subVectors(e,t),bi.lengthSq()===0&&(bi.z=1),bi.normalize(),_n.crossVectors(i,bi),_n.lengthSq()===0&&(Math.abs(i.z)===1?bi.x+=1e-4:bi.z+=1e-4,bi.normalize(),_n.crossVectors(i,bi)),_n.normalize(),ca.crossVectors(bi,_n),n[0]=_n.x,n[4]=ca.x,n[8]=bi.x,n[1]=_n.y,n[5]=ca.y,n[9]=bi.y,n[2]=_n.z,n[6]=ca.z,n[10]=bi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,n=t.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],u=i[1],d=i[5],h=i[9],f=i[13],p=i[2],v=i[6],g=i[10],m=i[14],_=i[3],x=i[7],M=i[11],R=i[15],E=n[0],I=n[4],y=n[8],w=n[12],U=n[1],L=n[5],O=n[9],q=n[13],W=n[2],B=n[6],k=n[10],Y=n[14],re=n[3],le=n[7],de=n[11],De=n[15];return s[0]=a*E+o*U+l*W+c*re,s[4]=a*I+o*L+l*B+c*le,s[8]=a*y+o*O+l*k+c*de,s[12]=a*w+o*q+l*Y+c*De,s[1]=u*E+d*U+h*W+f*re,s[5]=u*I+d*L+h*B+f*le,s[9]=u*y+d*O+h*k+f*de,s[13]=u*w+d*q+h*Y+f*De,s[2]=p*E+v*U+g*W+m*re,s[6]=p*I+v*L+g*B+m*le,s[10]=p*y+v*O+g*k+m*de,s[14]=p*w+v*q+g*Y+m*De,s[3]=_*E+x*U+M*W+R*re,s[7]=_*I+x*L+M*B+R*le,s[11]=_*y+x*O+M*k+R*de,s[15]=_*w+x*q+M*Y+R*De,this}multiplyScalar(e){const 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(){const e=this.elements,t=e[0],i=e[4],n=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],d=e[6],h=e[10],f=e[14],p=e[3],v=e[7],g=e[11],m=e[15],_=l*f-c*h,x=o*f-c*d,M=o*h-l*d,R=a*f-c*u,E=a*h-l*u,I=a*d-o*u;return t*(v*_-g*x+m*M)-i*(p*_-g*R+m*E)+n*(p*x-v*R+m*I)-s*(p*M-v*E+g*I)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const 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(){const e=this.elements,t=e[0],i=e[1],n=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=e[9],h=e[10],f=e[11],p=e[12],v=e[13],g=e[14],m=e[15],_=t*o-i*a,x=t*l-n*a,M=t*c-s*a,R=i*l-n*o,E=i*c-s*o,I=n*c-s*l,y=u*v-d*p,w=u*g-h*p,U=u*m-f*p,L=d*g-h*v,O=d*m-f*v,q=h*m-f*g,W=_*q-x*O+M*L+R*U-E*w+I*y;if(W===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const B=1/W;return e[0]=(o*q-l*O+c*L)*B,e[1]=(n*O-i*q-s*L)*B,e[2]=(v*I-g*E+m*R)*B,e[3]=(h*E-d*I-f*R)*B,e[4]=(l*U-a*q-c*w)*B,e[5]=(t*q-n*U+s*w)*B,e[6]=(g*M-p*I-m*x)*B,e[7]=(u*I-h*M+f*x)*B,e[8]=(a*O-o*U+c*y)*B,e[9]=(i*U-t*O-s*y)*B,e[10]=(p*E-v*M+m*_)*B,e[11]=(d*M-u*E-f*_)*B,e[12]=(o*w-a*L-l*y)*B,e[13]=(t*L-i*w+n*y)*B,e[14]=(v*x-p*R-g*_)*B,e[15]=(u*R-d*x+h*_)*B,this}scale(e){const t=this.elements,i=e.x,n=e.y,s=e.z;return t[0]*=i,t[4]*=n,t[8]*=s,t[1]*=i,t[5]*=n,t[9]*=s,t[2]*=i,t[6]*=n,t[10]*=s,t[3]*=i,t[7]*=n,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,n))}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){const 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){const 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){const 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){const i=Math.cos(t),n=Math.sin(t),s=1-i,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+i,c*o-n*l,c*l+n*o,0,c*o+n*l,u*o+i,u*l-n*a,0,c*l-n*o,u*l+n*a,s*l*l+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,s,a){return this.set(1,i,s,0,e,1,a,0,t,n,1,0,0,0,0,1),this}compose(e,t,i){const n=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,d=o+o,h=s*c,f=s*u,p=s*d,v=a*u,g=a*d,m=o*d,_=l*c,x=l*u,M=l*d,R=i.x,E=i.y,I=i.z;return n[0]=(1-(v+m))*R,n[1]=(f+M)*R,n[2]=(p-x)*R,n[3]=0,n[4]=(f-M)*E,n[5]=(1-(h+m))*E,n[6]=(g+_)*E,n[7]=0,n[8]=(p+x)*I,n[9]=(g-_)*I,n[10]=(1-(h+v))*I,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,i){const n=this.elements;e.x=n[12],e.y=n[13],e.z=n[14];const s=this.determinant();if(s===0)return i.set(1,1,1),t.identity(),this;let a=_s.set(n[0],n[1],n[2]).length();const o=_s.set(n[4],n[5],n[6]).length(),l=_s.set(n[8],n[9],n[10]).length();s<0&&(a=-a),Ui.copy(this);const c=1/a,u=1/o,d=1/l;return Ui.elements[0]*=c,Ui.elements[1]*=c,Ui.elements[2]*=c,Ui.elements[4]*=u,Ui.elements[5]*=u,Ui.elements[6]*=u,Ui.elements[8]*=d,Ui.elements[9]*=d,Ui.elements[10]*=d,t.setFromRotationMatrix(Ui),i.x=a,i.y=o,i.z=l,this}makePerspective(e,t,i,n,s,a,o=wi,l=!1){const c=this.elements,u=2*s/(t-e),d=2*s/(i-n),h=(t+e)/(t-e),f=(i+n)/(i-n);let p,v;if(l)p=s/(a-s),v=a*s/(a-s);else if(o===wi)p=-(a+s)/(a-s),v=-2*a*s/(a-s);else if(o===ls)p=-a/(a-s),v=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=u,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=d,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=p,c[14]=v,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,n,s,a,o=wi,l=!1){const c=this.elements,u=2/(t-e),d=2/(i-n),h=-(t+e)/(t-e),f=-(i+n)/(i-n);let p,v;if(l)p=1/(a-s),v=a/(a-s);else if(o===wi)p=-2/(a-s),v=-(a+s)/(a-s);else if(o===ls)p=-1/(a-s),v=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=u,c[4]=0,c[8]=0,c[12]=h,c[1]=0,c[5]=d,c[9]=0,c[13]=f,c[2]=0,c[6]=0,c[10]=p,c[14]=v,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let n=0;n<16;n++)if(t[n]!==i[n])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const 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}};$o.prototype.isMatrix4=!0;let ct=$o;const _s=new P,Ui=new ct,Fm=new P(0,0,0),Bm=new P(1,1,1),_n=new P,ca=new P,bi=new P,Gh=new ct,Wh=new mi;class Vi{constructor(e=0,t=0,i=0,n=Vi.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=n}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,n=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,t=this._order,i=!0){const n=e.elements,s=n[0],a=n[4],o=n[8],l=n[1],c=n[5],u=n[9],d=n[2],h=n[6],f=n[10];switch(t){case"XYZ":this._y=Math.asin(rt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-rt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(rt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-d,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-rt(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(h,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(rt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-rt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,f),this._y=0);break;default:Re("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return Gh.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Gh,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Wh.setFromEuler(this),this.setFromQuaternion(Wh,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],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=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}}Vi.DEFAULT_ORDER="XYZ";class ll{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let zm=0;const Xh=new P,ys=new mi,tn=new ct,ha=new P,nr=new P,km=new P,Vm=new mi,qh=new P(1,0,0),Yh=new P(0,1,0),Zh=new P(0,0,1),Jh={type:"added"},Hm={type:"removed"},xs={type:"childadded",child:null},Ol={type:"childremoved",child:null};class Ct extends Hi{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:zm++}),this.uuid=Ei(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ct.DEFAULT_UP.clone();const e=new P,t=new Vi,i=new mi,n=new P(1,1,1);function s(){i.setFromEuler(t,!1)}function a(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(a),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 ct},normalMatrix:{value:new ft}}),this.matrix=new ct,this.matrixWorld=new ct,this.matrixAutoUpdate=Ct.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ct.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new ll,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(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 ys.setFromAxisAngle(e,t),this.quaternion.multiply(ys),this}rotateOnWorldAxis(e,t){return ys.setFromAxisAngle(e,t),this.quaternion.premultiply(ys),this}rotateX(e){return this.rotateOnAxis(qh,e)}rotateY(e){return this.rotateOnAxis(Yh,e)}rotateZ(e){return this.rotateOnAxis(Zh,e)}translateOnAxis(e,t){return Xh.copy(e).applyQuaternion(this.quaternion),this.position.add(Xh.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(qh,e)}translateY(e){return this.translateOnAxis(Yh,e)}translateZ(e){return this.translateOnAxis(Zh,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(tn.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?ha.copy(e):ha.set(e,t,i);const n=this.parent;this.updateWorldMatrix(!0,!1),nr.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?tn.lookAt(nr,ha,this.up):tn.lookAt(ha,nr,this.up),this.quaternion.setFromRotationMatrix(tn),n&&(tn.extractRotation(n.matrixWorld),ys.setFromRotationMatrix(tn),this.quaternion.premultiply(ys.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Ze("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Jh),xs.child=e,this.dispatchEvent(xs),xs.child=null):Ze("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Hm),Ol.child=e,this.dispatchEvent(Ol),Ol.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),tn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),tn.multiply(e.parent.matrixWorld)),e.applyMatrix4(tn),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Jh),xs.
vendor: 2,494 bytes, line 5
5child=e,this.dispatchEvent(xs),xs.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++){const a=this.children[i].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const n=this.children;for(let s=0,a=n.length;s<a;s++)n[s].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(nr,e,km),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(nr,Vm,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,i=e.y,n=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*i-s[8]*n,s[13]+=i-s[1]*t-s[5]*i-s[9]*n,s[14]+=n-s[2]*t-s[6]*i-s[10]*n}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].updateMatrixWorld(e)}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const n=this.children;for(let s=0,a=n.length;s<a;s++)n[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const n={};
vendor: 28,767 bytes, line 5
5n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.castShadow===!0&&(n.castShadow=!0),this.receiveShadow===!0&&(n.receiveShadow=!0),this.visible===!1&&(n.visible=!1),this.frustumCulled===!1&&(n.frustumCulled=!1),this.renderOrder!==0&&(n.renderOrder=this.renderOrder),this.static!==!1&&(n.static=this.static),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(),this.pivot!==null&&(n.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(n.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(n.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(n.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(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.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),n.instanceInfo=this._instanceInfo.map(o=>({...o})),n.availableInstanceIds=this._availableInstanceIds.slice(),n.availableGeometryIds=this._availableGeometryIds.slice(),n.nextIndexStart=this._nextIndexStart,n.nextVertexStart=this._nextVertexStart,n.geometryCount=this._geometryCount,n.maxInstanceCount=this._maxInstanceCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.matricesTexture=this._matricesTexture.toJSON(e),n.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(n.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(n.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(n.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(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&&this.environment.isRenderTargetTexture!==!0&&(n.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const d=l[c];s(e.shapes,d)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));n.material=o}else n.material=s(e.materials,this.material);if(this.children.length>0){n.children=[];for(let o=0;o<this.children.length;o++)n.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){n.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];n.animations.push(s(e.animations,l))}}if(t){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),u=a(e.images),d=a(e.shapes),h=a(e.skeletons),f=a(e.animations),p=a(e.nodes);o.length>0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),d.length>0&&(i.shapes=d),h.length>0&&(i.skeletons=h),f.length>0&&(i.animations=f),p.length>0&&(i.nodes=p)}return i.object=n,i;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){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.pivot=e.pivot!==null?e.pivot.clone():null,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.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const n=e.children[i];this.add(n.clone())}return this}}Ct.DEFAULT_UP=new P(0,1,0);Ct.DEFAULT_MATRIX_AUTO_UPDATE=!0;Ct.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Vs extends Ct{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Gm={type:"move"};class io{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Vs,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Vs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new P,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new P),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Vs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new P,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new P,this._grip.eventsEnabled=!1),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const 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}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let n=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const v of e.hand.values()){const g=t.getJointPose(v,i),m=this._getHandJoint(c,v);g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=g.radius),m.visible=g!==null}const u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],h=u.position.distanceTo(d.position),f=.02,p=.005;c.inputState.pinching&&h>f+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=f-p&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1,l.eventsEnabled&&l.dispatchEvent({type:"gripUpdated",data:e,target:this})));o!==null&&(n=t.getPose(e.targetRaySpace,i),n===null&&s!==null&&(n=s),n!==null&&(o.matrix.fromArray(n.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,n.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(n.linearVelocity)):o.hasLinearVelocity=!1,n.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(n.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Gm)))}return o!==null&&(o.visible=n!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new Vs;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const tf={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},yn={h:0,s:0,l:0},ua={h:0,s:0,l:0};function Fl(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class He{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const n=e;n&&n.isColor?this.copy(n):typeof n=="number"?this.setHex(n):typeof n=="string"&&this.setStyle(n)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=di){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,bt.colorSpaceToWorking(this,t),this}setRGB(e,t,i,n=bt.workingColorSpace){return this.r=e,this.g=t,this.b=i,bt.colorSpaceToWorking(this,n),this}setHSL(e,t,i,n=bt.workingColorSpace){if(e=th(e,1),t=rt(t,0,1),i=rt(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=Fl(a,s,e+1/3),this.g=Fl(a,s,e),this.b=Fl(a,s,e-1/3)}return bt.colorSpaceToWorking(this,n),this}setStyle(e,t=di){function i(s){s!==void 0&&parseFloat(s)<1&&Re("Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=n[1],o=n[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Re("Color: Unknown color model "+e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=n[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);Re("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=di){const i=tf[e.toLowerCase()];return i!==void 0?this.setHex(i,t):Re("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=hn(e.r),this.g=hn(e.g),this.b=hn(e.b),this}copyLinearToSRGB(e){return this.r=Hs(e.r),this.g=Hs(e.g),this.b=Hs(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=di){return bt.workingToColorSpace(ri.copy(this),e),Math.round(rt(ri.r*255,0,255))*65536+Math.round(rt(ri.g*255,0,255))*256+Math.round(rt(ri.b*255,0,255))}getHexString(e=di){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=bt.workingColorSpace){bt.workingToColorSpace(ri.copy(this),t);const i=ri.r,n=ri.g,s=ri.b,a=Math.max(i,n,s),o=Math.min(i,n,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const d=a-o;switch(c=u<=.5?d/(a+o):d/(2-a-o),a){case i:l=(n-s)/d+(n<s?6:0);break;case n:l=(s-i)/d+2;break;case s:l=(i-n)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=bt.workingColorSpace){return bt.workingToColorSpace(ri.copy(this),t),e.r=ri.r,e.g=ri.g,e.b=ri.b,e}getStyle(e=di){bt.workingToColorSpace(ri.copy(this),e);const t=ri.r,i=ri.g,n=ri.b;return e!==di?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(n*255)})`}offsetHSL(e,t,i){return this.getHSL(yn),this.setHSL(yn.h+e,yn.s+t,yn.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){this.getHSL(yn),e.getHSL(ua);const i=Ir(yn.h,ua.h,t),n=Ir(yn.s,ua.s,t),s=Ir(yn.l,ua.l,t);return this.setHSL(i,n,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,n=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*n,this.g=s[1]*t+s[4]*i+s[7]*n,this.b=s[2]*t+s[5]*i+s[8]*n,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=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}}const ri=new He;He.NAMES=tf;class cl{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new He(e),this.density=t}clone(){return new cl(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class hl{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new He(e),this.near=t,this.far=i}clone(){return new hl(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class nh extends Ct{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 Vi,this.environmentIntensity=1,this.environmentRotation=new Vi,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(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),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const Ni=new P,nn=new P,Bl=new P,sn=new P,Ms=new P,Ss=new P,$h=new P,zl=new P,kl=new P,Vl=new P,Hl=new Pt,Gl=new Pt,Wl=new Pt;class Si{constructor(e=new P,t=new P,i=new P){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,n){n.subVectors(i,t),Ni.subVectors(e,t),n.cross(Ni);const s=n.lengthSq();return s>0?n.multiplyScalar(1/Math.sqrt(s)):n.set(0,0,0)}static getBarycoord(e,t,i,n,s){Ni.subVectors(n,t),nn.subVectors(i,t),Bl.subVectors(e,t);const a=Ni.dot(Ni),o=Ni.dot(nn),l=Ni.dot(Bl),c=nn.dot(nn),u=nn.dot(Bl),d=a*c-o*o;if(d===0)return s.set(0,0,0),null;const h=1/d,f=(c*l-o*u)*h,p=(a*u-o*l)*h;return s.set(1-f-p,p,f)}static containsPoint(e,t,i,n){return this.getBarycoord(e,t,i,n,sn)===null?!1:sn.x>=0&&sn.y>=0&&sn.x+sn.y<=1}static getInterpolation(e,t,i,n,s,a,o,l){return this.getBarycoord(e,t,i,n,sn)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,sn.x),l.addScaledVector(a,sn.y),l.addScaledVector(o,sn.z),l)}static getInterpolatedAttribute(e,t,i,n,s,a){return Hl.setScalar(0),Gl.setScalar(0),Wl.setScalar(0),Hl.fromBufferAttribute(e,t),Gl.fromBufferAttribute(e,i),Wl.fromBufferAttribute(e,n),a.setScalar(0),a.addScaledVector(Hl,s.x),a.addScaledVector(Gl,s.y),a.addScaledVector(Wl,s.z),a}static isFrontFacing(e,t,i,n){return Ni.subVectors(i,t),nn.subVectors(e,t),Ni.cross(nn).dot(n)<0}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 Ni.subVectors(this.c,this.b),nn.subVectors(this.a,this.b),Ni.cross(nn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Si.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Si.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,n,s){return Si.getInterpolation(e,this.a,this.b,this.c,t,i,n,s)}containsPoint(e){return Si.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Si.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,n=this.b,s=this.c;let a,o;Ms.subVectors(n,i),Ss.subVectors(s,i),zl.subVectors(e,i);const l=Ms.dot(zl),c=Ss.dot(zl);if(l<=0&&c<=0)return t.copy(i);kl.subVectors(e,n);const u=Ms.dot(kl),d=Ss.dot(kl);if(u>=0&&d<=u)return t.copy(n);const h=l*d-u*c;if(h<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(i).addScaledVector(Ms,a);Vl.subVectors(e,s);const f=Ms.dot(Vl),p=Ss.dot(Vl);if(p>=0&&f<=p)return t.copy(s);const v=f*c-l*p;if(v<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(i).addScaledVector(Ss,o);const g=u*p-f*d;if(g<=0&&d-u>=0&&f-p>=0)return $h.subVectors(s,n),o=(d-u)/(d-u+(f-p)),t.copy(n).addScaledVector($h,o);const m=1/(g+v+h);return a=v*m,o=h*m,t.copy(i).addScaledVector(Ms,a).addScaledVector(Ss,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class oi{constructor(e=new P(1/0,1/0,1/0),t=new P(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}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(Di.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Di.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){const i=Di.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!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=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(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,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Di):Di.fromBufferAttribute(s,a),Di.applyMatrix4(e.matrixWorld),this.expandByPoint(Di);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),da.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),da.copy(i.boundingBox)),da.applyMatrix4(e.matrixWorld),this.union(da)}const n=e.children;for(let s=0,a=n.length;s<a;s++)this.expandByObject(n[s],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,Di),Di.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(sr),fa.subVectors(this.max,sr),bs.subVectors(e.a,sr),Ts.subVectors(e.b,sr),ws.subVectors(e.c,sr),xn.subVectors(Ts,bs),Mn.subVectors(ws,Ts),kn.subVectors(bs,ws);let t=[0,-xn.z,xn.y,0,-Mn.z,Mn.y,0,-kn.z,kn.y,xn.z,0,-xn.x,Mn.z,0,-Mn.x,kn.z,0,-kn.x,-xn.y,xn.x,0,-Mn.y,Mn.x,0,-kn.y,kn.x,0];return!Xl(t,bs,Ts,ws,fa)||(t=[1,0,0,0,1,0,0,0,1],!Xl(t,bs,Ts,ws,fa))?!1:(pa.crossVectors(xn,Mn),t=[pa.x,pa.y,pa.z],Xl(t,bs,Ts,ws,fa))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Di).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Di).length()*.5),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()?this:(rn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),rn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),rn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),rn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),rn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),rn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),rn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),rn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(rn),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)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const rn=[new P,new P,new P,new P,new P,new P,new P,new P],Di=new P,da=new oi,bs=new P,Ts=new P,ws=new P,xn=new P,Mn=new P,kn=new P,sr=new P,fa=new P,pa=new P,Vn=new P;function Xl(r,e,t,i,n){for(let s=0,a=r.length-3;s<=a;s+=3){Vn.fromArray(r,s);const o=n.x*Math.abs(Vn.x)+n.y*Math.abs(Vn.y)+n.z*Math.abs(Vn.z),l=e.dot(Vn),c=t.dot(Vn),u=i.dot(Vn);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const cn=Wm();function Wm(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),i=new Uint32Array(512),n=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,n[l]=24,n[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,n[l]=-c-1,n[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,n[l]=13,n[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,n[l]=24,n[l|256]=24):(i[l]=31744,i[l|256]=64512,n[l]=13,n[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)===0;)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:n,mantissaTable:s,exponentTable:a,offsetTable:o}}function Mi(r){Math.abs(r)>65504&&Re("DataUtils.toHalfFloat(): Value out of range."),r=rt(r,-65504,65504),cn.floatView[0]=r;const e=cn.uint32View[0],t=e>>23&511;return cn.baseTable[t]+((e&8388607)>>cn.shiftTable[t])}function yr(r){const e=r>>10;return cn.uint32View[0]=cn.mantissaTable[cn.offsetTable[e]+(r&1023)]+cn.exponentTable[e],cn.floatView[0]}class is{static toHalfFloat(e){return Mi(e)}static fromHalfFloat(e){return yr(e)}}const $t=new P,ma=new se;let Xm=0;class Ut extends Hi{constructor(e,t,i=!1){if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Xm++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=kr,this.updateRanges=[],this.gpuType=Ft,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}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;
vendor: 5,948 bytes, line 5
5for(let n=0,s=this.itemSize;n<s;n++)this.array[e+n]=t.array[i+n];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)ma.fromBufferAttribute(this,t),ma.applyMatrix3(e),this.setXY(t,ma.x,ma.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)$t.fromBufferAttribute(this,t),$t.applyMatrix3(e),this.setXYZ(t,$t.x,$t.y,$t.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)$t.fromBufferAttribute(this,t),$t.applyMatrix4(e),this.setXYZ(t,$t.x,$t.y,$t.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)$t.fromBufferAttribute(this,t),$t.applyNormalMatrix(e),this.setXYZ(t,$t.x,$t.y,$t.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)$t.fromBufferAttribute(this,t),$t.transformDirection(e),this.setXYZ(t,$t.x,$t.y,$t.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=fi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=gt(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=fi(t,this.array)),t}setX(e,t){return this.normalized&&(t=gt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=fi(t,this.array)),t}setY(e,t){return this.normalized&&(t=gt(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=fi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=gt(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=fi(t,this.array)),t}setW(e,t){return this.normalized&&(t=gt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=gt(t,this.array),i=gt(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=gt(t,this.array),i=gt(i,this.array),n=gt(n,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this}setXYZW(e,t,i,n,s){return e*=this.itemSize,this.normalized&&(t=gt(t,this.array),i=gt(i,this.array),n=gt(n,this.array),s=gt(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==kr&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class qm extends Ut{constructor(e,t,i){super(new Int8Array(e),t,i)}}class Ym extends Ut{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class Zm extends Ut{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class Jm extends Ut{constructor(e,t,i){super(new Int16Array(e),t,i)}}class sh extends Ut{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class $m extends Ut{constructor(e,t,i){super(new Int32Array(e),t,i)}}class rh extends Ut{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class Km extends Ut{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=yr(this.array[e*this.itemSize]);return this.normalized&&(t=fi(t,this.array)),t}setX(e,t){return this.normalized&&(t=gt(t,this.array)),this.array[e*this.itemSize]=Mi(t),this}getY(e){let t=yr(this.array[e*this.itemSize+1]);return this.normalized&&(t=fi(t,this.array)),t}setY(e,t){return this.normalized&&(t=gt(t,this.array)),this.array[e*this.itemSize+1]=Mi(t),this}getZ(e){let t=yr(this.array[e*this.itemSize+2]);return this.normalized&&(t=fi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=gt(t,this.array)),this.array[e*this.itemSize+2]=Mi(t),this}getW(e){let t=yr(this.array[e*this.itemSize+3]);return this.normalized&&(t=fi(t,this.array)),t}setW(e,t){return this.normalized&&(t=gt(t,this.array)),this.array[e*this.itemSize+3]=Mi(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=gt(t,this.array),i=gt(i,this.array)),this.array[e+0]=Mi(t),this.array[e+1]=Mi(i),this}setXYZ(e,t,i,n){return e*=this.itemSize,this.normalized&&(t=gt(t,this.array),i=gt(i,this.array),n=gt(n,this.array)),this.array[e+0]=Mi(t),this.array[e+1]=Mi(i),this.array[e+2]=Mi(n),this}setXYZW(e,t,i,n,s){return e*=this.itemSize,this.normalized&&(t=gt(t,this.array),i=gt(i,this.array),n=gt(n,this.array),s=gt(s,this.array)),this.array[e+0]=Mi(t),this.array[e+1]=Mi(i),this.array[e+2]=Mi(n),this.array[e+3]=Mi(s),this}}class Ge extends Ut{constructor(e,t,i){super(new Float32Array(e),t,i)}}const Qm=new oi,rr=new P,ql=new P;class ni{constructor(e=new P,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):Qm.setFromPoints(e).getCenter(i);let n=0;for(let s=0,a=e.length;s<a;s++)n=Math.max(n,i.distanceToSquared(e[s]));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){const 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){const 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):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}
vendor: 18,236 bytes, line 5
5applyMatrix4(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;rr.subVectors(e,this.center);const t=rr.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),n=(i-this.radius)*.5;this.center.addScaledVector(rr,n/i),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(ql.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(rr.copy(e.center).add(ql)),this.expandByPoint(rr.copy(e.center).sub(ql))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let jm=0;const Ri=new ct,Yl=new Ct,Es=new P,Ti=new oi,ar=new oi,ei=new P;class mt extends Hi{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:jm++}),this.uuid=Ei(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(cm(e)?rh:sh)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}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 this.attributes[e]!==void 0}addGroup(e,t,i=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){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new ft().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const n=this.attributes.tangent;return n!==void 0&&(n.transformDirection(e),n.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ri.makeRotationFromQuaternion(e),this.applyMatrix4(Ri),this}rotateX(e){return Ri.makeRotationX(e),this.applyMatrix4(Ri),this}rotateY(e){return Ri.makeRotationY(e),this.applyMatrix4(Ri),this}rotateZ(e){return Ri.makeRotationZ(e),this.applyMatrix4(Ri),this}translate(e,t,i){return Ri.makeTranslation(e,t,i),this.applyMatrix4(Ri),this}scale(e,t,i){return Ri.makeScale(e,t,i),this.applyMatrix4(Ri),this}lookAt(e){return Yl.lookAt(e),Yl.updateMatrix(),this.applyMatrix4(Yl.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Es).negate(),this.translate(Es.x,Es.y,Es.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const i=[];for(let n=0,s=e.length;n<s;n++){const a=e[n];i.push(a.x,a.y,a.z||0)}this.setAttribute("position",new Ge(i,3))}else{const i=Math.min(e.length,t.count);for(let n=0;n<i;n++){const s=e[n];t.setXYZ(n,s.x,s.y,s.z||0)}e.length>t.count&&Re("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new oi);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ze("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new P(-1/0,-1/0,-1/0),new P(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,n=t.length;i<n;i++){const s=t[i];Ti.setFromBufferAttribute(s),this.morphTargetsRelative?(ei.addVectors(this.boundingBox.min,Ti.min),this.boundingBox.expandByPoint(ei),ei.addVectors(this.boundingBox.max,Ti.max),this.boundingBox.expandByPoint(ei)):(this.boundingBox.expandByPoint(Ti.min),this.boundingBox.expandByPoint(Ti.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Ze('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ni);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Ze("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new P,1/0);return}if(e){const i=this.boundingSphere.center;if(Ti.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];ar.setFromBufferAttribute(o),this.morphTargetsRelative?(ei.addVectors(Ti.min,ar.min),Ti.expandByPoint(ei),ei.addVectors(Ti.max,ar.max),Ti.expandByPoint(ei)):(Ti.expandByPoint(ar.min),Ti.expandByPoint(ar.max))}Ti.getCenter(i);let n=0;for(let s=0,a=e.count;s<a;s++)ei.fromBufferAttribute(e,s),n=Math.max(n,i.distanceToSquared(ei));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],l=this.morphTargetsRelative;for(let c=0,u=o.count;c<u;c++)ei.fromBufferAttribute(o,c),l&&(Es.fromBufferAttribute(e,c),ei.add(Es)),n=Math.max(n,i.distanceToSquared(ei))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&Ze('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Ze("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,n=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ut(new Float32Array(4*i.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let y=0;y<i.count;y++)o[y]=new P,l[y]=new P;const c=new P,u=new P,d=new P,h=new se,f=new se,p=new se,v=new P,g=new P;function m(y,w,U){c.fromBufferAttribute(i,y),u.fromBufferAttribute(i,w),d.fromBufferAttribute(i,U),h.fromBufferAttribute(s,y),f.fromBufferAttribute(s,w),p.fromBufferAttribute(s,U),u.sub(c),d.sub(c),f.sub(h),p.sub(h);const L=1/(f.x*p.y-p.x*f.y);isFinite(L)&&(v.copy(u).multiplyScalar(p.y).addScaledVector(d,-f.y).multiplyScalar(L),g.copy(d).multiplyScalar(f.x).addScaledVector(u,-p.x).multiplyScalar(L),o[y].add(v),o[w].add(v),o[U].add(v),l[y].add(g),l[w].add(g),l[U].add(g))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let y=0,w=_.length;y<w;++y){const U=_[y],L=U.start,O=U.count;for(let q=L,W=L+O;q<W;q+=3)m(e.getX(q+0),e.getX(q+1),e.getX(q+2))}const x=new P,M=new P,R=new P,E=new P;function I(y){R.fromBufferAttribute(n,y),E.copy(R);const w=o[y];x.copy(w),x.sub(R.multiplyScalar(R.dot(w))).normalize(),M.crossVectors(E,w);const L=M.dot(l[y])<0?-1:1;a.setXYZW(y,x.x,x.y,x.z,L)}for(let y=0,w=_.length;y<w;++y){const U=_[y],L=U.start,O=U.count;for(let q=L,W=L+O;q<W;q+=3)I(e.getX(q+0)),I(e.getX(q+1)),I(e.getX(q+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new Ut(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let h=0,f=i.count;h<f;h++)i.setXYZ(h,0,0,0);const n=new P,s=new P,a=new P,o=new P,l=new P,c=new P,u=new P,d=new P;if(e)for(let h=0,f=e.count;h<f;h+=3){const p=e.getX(h+0),v=e.getX(h+1),g=e.getX(h+2);n.fromBufferAttribute(t,p),s.fromBufferAttribute(t,v),a.fromBufferAttribute(t,g),u.subVectors(a,s),d.subVectors(n,s),u.cross(d),o.fromBufferAttribute(i,p),l.fromBufferAttribute(i,v),c.fromBufferAttribute(i,g),o.add(u),l.add(u),c.add(u),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(v,l.x,l.y,l.z),i.setXYZ(g,c.x,c.y,c.z)}else for(let h=0,f=t.count;h<f;h+=3)n.fromBufferAttribute(t,h+0),s.fromBufferAttribute(t,h+1),a.fromBufferAttribute(t,h+2),u.subVectors(a,s),d.subVectors(n,s),u.cross(d),i.setXYZ(h+0,u.x,u.y,u.z),i.setXYZ(h+1,u.x,u.y,u.z),i.setXYZ(h+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)ei.fromBufferAttribute(e,t),ei.normalize(),e.setXYZ(t,ei.x,ei.y,ei.z)}toNonIndexed(){function e(o,l){const c=o.array,u=o.itemSize,d=o.normalized,h=new c.constructor(l.length*u);let f=0,p=0;for(let v=0,g=l.length;v<g;v++){o.isInterleavedBufferAttribute?f=l[v]*o.data.stride+o.offset:f=l[v]*u;for(let m=0;m<u;m++)h[p++]=c[f++]}return new Ut(h,u,d)}if(this.index===null)return Re("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new mt,i=this.index.array,n=this.attributes;for(const o in n){const l=n[o],c=e(l,i);t.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let u=0,d=c.length;u<d;u++){const h=c[u],f=e(h,i);l.push(f)}t.morphAttributes[o]=l}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,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),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const n={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let d=0,h=c.length;d<h;d++){const f=c[d];u.push(f.toJSON(e.data))}u.length>0&&(n[l]=u,s=!0)}s&&(e.data.morphAttributes=n,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),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;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone());const n=e.attributes;for(const c in n){const u=n[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],d=s[c];for(let h=0,f=d.length;h<f;h++)u.push(d[h].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,u=a.length;c<u;c++){const d=a[c];this.addGroup(d.start,d.count,d.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ul{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=kr,this.updateRanges=[],this.version=0,this.uuid=Ei()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}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,s=this.stride;n<s;n++)this.array[e+n]=t.array[i+n];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ei()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const 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 e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Ei()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(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}}}const hi=new P;class cs{constructor(e,t,i,n=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=n}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++)hi.fromBufferAttribute(this,t),hi.applyMatrix4(e),this.setXYZ(t,hi.x,hi.y,hi.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)hi.fromBufferAttribute(this,t),hi.applyNormalMatrix(e),this.setXYZ(t,hi.x,hi.y,hi.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)hi.fromBufferAttribute(this,t),hi.transformDirection(e),this.setXYZ(t,hi.x,hi.y,hi.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=fi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=gt(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=gt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=gt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=gt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=gt(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=fi(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=fi(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=fi(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=fi(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=gt(t,this.array),i=gt(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=gt(t,this.array),i=gt(i,this.array),n=gt(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,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=gt(t,this.array),i=gt(i,this.array),n=gt(n,this.array),s=gt(s,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]=s,this}clone(e){if(e===void 0){Hr("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const n=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[n+s])}return new Ut(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new cs(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){Hr("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const n=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[n+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}let eg=0;class li extends Hi{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:eg++}),this.uuid=Ei(),this.name="",this.type="Material",this.blending=ss,this.side=un,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=so,this.blendDst=ro,this.blendEquation=En,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new He(0,0,0),this.blendAlpha=0,this.depthFunc=os,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Rc,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Qn,this.stencilZFail=Qn,this.stencilZPass=Qn,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){Re(`Material: parameter '${t}' has value of undefined.`);continue}const n=this[t];if(n===void 0){Re(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
vendor: 15,188 bytes, line 5
5i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(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()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(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),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(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,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==ss&&(i.blending=this.blending),this.side!==un&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==so&&(i.blendSrc=this.blendSrc),this.blendDst!==ro&&(i.blendDst=this.blendDst),this.blendEquation!==En&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==os&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Rc&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Qn&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Qn&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Qn&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.allowOverride===!1&&(i.allowOverride=!1),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function n(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=n(e.textures),a=n(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}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;const t=e.clippingPlanes;let i=null;if(t!==null){const n=t.length;i=new Array(n);for(let s=0;s!==n;++s)i[s]=t[s].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.allowOverride=e.allowOverride,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){e===!0&&this.version++}}class ah extends li{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new He(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let As;const or=new P,Cs=new P,Rs=new P,Is=new se,lr=new se,nf=new ct,ga=new P,cr=new P,va=new P,Kh=new se,Zl=new se,Qh=new se;class sf extends Ct{constructor(e=new ah){if(super(),this.isSprite=!0,this.type="Sprite",As===void 0){As=new mt;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new ul(t,5);As.setIndex([0,1,2,0,2,3]),As.setAttribute("position",new cs(i,3,0,!1)),As.setAttribute("uv",new cs(i,2,3,!1))}this.geometry=As,this.material=e,this.center=new se(.5,.5),this.count=1}raycast(e,t){e.camera===null&&Ze('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Cs.setFromMatrixScale(this.matrixWorld),nf.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Rs.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Cs.multiplyScalar(-Rs.z);const i=this.material.rotation;let n,s;i!==0&&(s=Math.cos(i),n=Math.sin(i));const a=this.center;_a(ga.set(-.5,-.5,0),Rs,a,Cs,n,s),_a(cr.set(.5,-.5,0),Rs,a,Cs,n,s),_a(va.set(.5,.5,0),Rs,a,Cs,n,s),Kh.set(0,0),Zl.set(1,0),Qh.set(1,1);let o=e.ray.intersectTriangle(ga,cr,va,!1,or);if(o===null&&(_a(cr.set(-.5,.5,0),Rs,a,Cs,n,s),Zl.set(0,1),o=e.ray.intersectTriangle(ga,va,cr,!1,or),o===null))return;const l=e.ray.origin.distanceTo(or);l<e.near||l>e.far||t.push({distance:l,point:or.clone(),uv:Si.getInterpolation(or,ga,cr,va,Kh,Zl,Qh,new se),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function _a(r,e,t,i,n,s){Is.subVectors(r,t).addScalar(.5).multiply(i),n!==void 0?(lr.x=s*Is.x-n*Is.y,lr.y=n*Is.x+s*Is.y):lr.copy(Is),r.copy(e),r.x+=lr.x,r.y+=lr.y,r.applyMatrix4(nf)}const ya=new P,jh=new P;class rf extends Ct{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,n=t.length;i<n;i++){const s=t[i];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,i=0){t=Math.abs(t);const n=this.levels;let s;for(s=0;s<n.length&&!(t<n[s].distance);s++);return n.splice(s,0,{distance:t,hysteresis:i,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let i=0;i<t.length;i++)if(t[i].distance===e){const n=t.splice(i,1);return this.remove(n[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let i,n;for(i=1,n=t.length;i<n;i++){let s=t[i].distance;if(t[i].object.visible&&(s-=s*t[i].hysteresis),e<s)break}return t[i-1].object}return null}raycast(e,t){if(this.levels.length>0){ya.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(ya);this.getObjectForDistance(n).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){ya.setFromMatrixPosition(e.matrixWorld),jh.setFromMatrixPosition(this.matrixWorld);const i=ya.distanceTo(jh)/e.zoom;t[0].object.visible=!0;let n,s;for(n=1,s=t.length;n<s;n++){let a=t[n].distance;if(t[n].object.visible&&(a-=a*t[n].hysteresis),i>=a)t[n-1].object.visible=!1,t[n].object.visible=!0;else break}for(this._currentLevel=n-1;n<s;n++)t[n].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const i=this.levels;for(let n=0,s=i.length;n<s;n++){const a=i[n];t.object.levels.push({object:a.object.uuid,distance:a.distance,hysteresis:a.hysteresis})}return t}}const an=new P,Jl=new P,xa=new P,Sn=new P,$l=new P,Ma=new P,Kl=new P;class $s{constructor(e=new P,t=new P(0,0,-1)){this.origin=e,this.direction=t}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,an)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const 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){const t=an.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(an.copy(this.origin).addScaledVector(this.direction,t),an.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){Jl.copy(e).add(t).multiplyScalar(.5),xa.copy(t).sub(e).normalize(),Sn.copy(this.origin).sub(Jl);const s=e.distanceTo(t)*.5,a=-this.direction.dot(xa),o=Sn.dot(this.direction),l=-Sn.dot(xa),c=Sn.lengthSq(),u=Math.abs(1-a*a);let d,h,f,p;if(u>0)if(d=a*l-o,h=a*o-l,p=s*u,d>=0)if(h>=-p)if(h<=p){const v=1/u;d*=v,h*=v,f=d*(d+a*h+2*o)+h*(a*d+h+2*l)+c}else h=s,d=Math.max(0,-(a*h+o)),f=-d*d+h*(h+2*l)+c;else h=-s,d=Math.max(0,-(a*h+o)),f=-d*d+h*(h+2*l)+c;else h<=-p?(d=Math.max(0,-(-a*s+o)),h=d>
vendor: 16,459 bytes, line 5
50?-s:Math.min(Math.max(-s,-l),s),f=-d*d+h*(h+2*l)+c):h<=p?(d=0,h=Math.min(Math.max(-s,-l),s),f=h*(h+2*l)+c):(d=Math.max(0,-(a*s+o)),h=d>0?s:Math.min(Math.max(-s,-l),s),f=-d*d+h*(h+2*l)+c);else h=a>0?-s:s,d=Math.max(0,-(a*h+o)),f=-d*d+h*(h+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,d),n&&n.copy(Jl).addScaledVector(xa,h),f}intersectSphere(e,t){an.subVectors(e.center,this.origin);const i=an.dot(this.direction),n=an.dot(an)-i*i,s=e.radius*e.radius;if(n>s)return null;const a=Math.sqrt(s-n),o=i-a,l=i+a;return l<0?null:o<0?this.at(l,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,n,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,d=1/this.direction.z,h=this.origin;return c>=0?(i=(e.min.x-h.x)*c,n=(e.max.x-h.x)*c):(i=(e.max.x-h.x)*c,n=(e.min.x-h.x)*c),u>=0?(s=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),i>a||s>n||((s>i||isNaN(i))&&(i=s),(a<n||isNaN(n))&&(n=a),d>=0?(o=(e.min.z-h.z)*d,l=(e.max.z-h.z)*d):(o=(e.max.z-h.z)*d,l=(e.min.z-h.z)*d),i>l||o>n)||((o>i||i!==i)&&(i=o),(l<n||n!==n)&&(n=l),n<0)?null:this.at(i>=0?i:n,t)}intersectsBox(e){return this.intersectBox(e,an)!==null}intersectTriangle(e,t,i,n,s){$l.subVectors(t,e),Ma.subVectors(i,e),Kl.crossVectors($l,Ma);let a=this.direction.dot(Kl),o;if(a>0){if(n)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Sn.subVectors(this.origin,e);const l=o*this.direction.dot(Ma.crossVectors(Sn,Ma));if(l<0)return null;const c=o*this.direction.dot($l.cross(Sn));if(c<0||l+c>a)return null;const u=-o*Sn.dot(Kl);return u<0?null:this.at(u/a,s)}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)}}class fn extends li{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new He(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Vi,this.combine=Kr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}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}}const eu=new ct,Hn=new $s,Sa=new ni,tu=new P,ba=new P,Ta=new P,wa=new P,Ql=new P,Ea=new P,iu=new P,Aa=new P;class kt extends Ct{constructor(e=new mt,t=new fn){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const n=t[i[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=n.length;s<a;s++){const o=n[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const i=this.geometry,n=i.attributes.position,s=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(n,e);const o=this.morphTargetInfluences;if(s&&o){Ea.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=o[l],d=s[l];u!==0&&(Ql.fromBufferAttribute(d,e),a?Ea.addScaledVector(Ql,u):Ea.addScaledVector(Ql.sub(t),u))}t.add(Ea)}return t}raycast(e,t){const i=this.geometry,n=this.material,s=this.matrixWorld;n!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Sa.copy(i.boundingSphere),Sa.applyMatrix4(s),Hn.copy(e.ray).recast(e.near),!(Sa.containsPoint(Hn.origin)===!1&&(Hn.intersectSphere(Sa,tu)===null||Hn.origin.distanceToSquared(tu)>(e.far-e.near)**2))&&(eu.copy(s).invert(),Hn.copy(e.ray).applyMatrix4(eu),!(i.boundingBox!==null&&Hn.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Hn)))}_computeIntersections(e,t,i){let n;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,d=s.attributes.normal,h=s.groups,f=s.drawRange;if(o!==null)if(Array.isArray(a))for(let p=0,v=h.length;p<v;p++){const g=h[p],m=a[g.materialIndex],_=Math.max(g.start,f.start),x=Math.min(o.count,Math.min(g.start+g.count,f.start+f.count));for(let M=_,R=x;M<R;M+=3){const E=o.getX(M),I=o.getX(M+1),y=o.getX(M+2);n=Ca(this,m,e,i,c,u,d,E,I,y),n&&(n.faceIndex=Math.floor(M/3),n.face.materialIndex=g.materialIndex,t.push(n))}}else{const p=Math.max(0,f.start),v=Math.min(o.count,f.start+f.count);for(let g=p,m=v;g<m;g+=3){const _=o.getX(g),x=o.getX(g+1),M=o.getX(g+2);n=Ca(this,a,e,i,c,u,d,_,x,M),n&&(n.faceIndex=Math.floor(g/3),t.push(n))}}else if(l!==void 0)if(Array.isArray(a))for(let p=0,v=h.length;p<v;p++){const g=h[p],m=a[g.materialIndex],_=Math.max(g.start,f.start),x=Math.min(l.count,Math.min(g.start+g.count,f.start+f.count));for(let M=_,R=x;M<R;M+=3){const E=M,I=M+1,y=M+2;n=Ca(this,m,e,i,c,u,d,E,I,y),n&&(n.faceIndex=Math.floor(M/3),n.face.materialIndex=g.materialIndex,t.push(n))}}else{const p=Math.max(0,f.start),v=Math.min(l.count,f.start+f.count);for(let g=p,m=v;g<m;g+=3){const _=g,x=g+1,M=g+2;n=Ca(this,a,e,i,c,u,d,_,x,M),n&&(n.faceIndex=Math.floor(g/3),t.push(n))}}}}function tg(r,e,t,i,n,s,a,o){let l;if(e.side===pi?l=i.intersectTriangle(a,s,n,!0,o):l=i.intersectTriangle(n,s,a,e.side===un,o),l===null)return null;Aa.copy(o),Aa.applyMatrix4(r.matrixWorld);const c=t.ray.origin.distanceTo(Aa);return c<t.near||c>t.far?null:{distance:c,point:Aa.clone(),object:r}}function Ca(r,e,t,i,n,s,a,o,l,c){r.getVertexPosition(o,ba),r.getVertexPosition(l,Ta),r.getVertexPosition(c,wa);const u=tg(r,e,t,i,ba,Ta,wa,iu);if(u){const d=new P;Si.getBarycoord(iu,ba,Ta,wa,d),n&&(u.uv=Si.getInterpolatedAttribute(n,o,l,c,d,new se)),s&&(u.uv1=Si.getInterpolatedAttribute(s,o,l,c,d,new se)),a&&(u.normal=Si.getInterpolatedAttribute(a,o,l,c,d,new P),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const h={a:o,b:l,c,normal:new P,materialIndex:0};Si.getNormal(ba,Ta,wa,h.normal),u.face=h,u.barycoord=d}return u}const hr=new Pt,nu=new Pt,su=new Pt,ig=new Pt,ru=new ct,Ra=new P,jl=new ni,au=new ct,ec=new $s;class af extends kt{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Ec,this.bindMatrix=new ct,this.bindMatrixInverse=new ct,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new oi),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Ra),this.boundingBox.expandByPoint(Ra)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new ni),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,Ra),this.boundingSphere.expandByPoint(Ra)}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,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const i=this.material,n=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),jl.copy(this.boundingSphere),jl.applyMatrix4(n),e.ray.intersectsSphere(jl)!==!1&&(au.copy(n).invert(),ec.copy(e.ray).applyMatrix4(au),!(this.boundingBox!==null&&ec.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,ec)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new Pt,t=this.geometry.attributes.skinWeight;for(let i=0,n=t.count;i<n;i++){e.fromBufferAttribute(t,i);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===Ec?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===zd?this.bindMatrixInverse.copy(this.bindMatrix).invert():Re("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,n=this.geometry;nu.fromBufferAttribute(n.attributes.skinIndex,e),su.fromBufferAttribute(n.attributes.skinWeight,e),t.isVector4?(hr.copy(t),t.set(0,0,0,0)):(hr.set(...t,1),t.set(0,0,0)),hr.applyMatrix4(this.bindMatrix);for(let s=0;s<4;s++){const a=su.getComponent(s);if(a!==0){const o=nu.getComponent(s);ru.multiplyMatrices(i.bones[o].matrixWorld,i.boneInverses[o]),t.addScaledVector(ig.copy(hr).applyMatrix4(ru),a)}}return t.isVector4&&(t.w=hr.w),t.applyMatrix4(this.bindMatrixInverse)}}class oh extends Ct{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Ii extends Lt{constructor(e=null,t=1,i=1,n,s,a,o,l,c=Zt,u=Zt,d,h){super(null,a,o,l,c,u,n,s,d,h),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const ou=new ct,ng=new ct;class dl{constructor(e=[],t=[]){this.uuid=Ei(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){Re("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,n=this.bones.length;i<n;i++)this.boneInverses.push(new ct)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new ct;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,n=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:ng;ou.multiplyMatrices(o,t[s]),ou.toArray(i,s*16)}n!==null&&(n.needsUpdate=!0)}clone(){return new dl(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const i=new Ii(t,e,e,Kt,Ft);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){const n=this.bones[t];if(n.name===e)return n}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,n=e.bones.length;i<n;i++){const s=e.bones[i];let a=t[s];a===void 0&&(Re("Skeleton: No bone found with UUID:",s),a=new oh),this.bones.push(a),this.boneInverses.push(new ct().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,i=this.boneInverses;for(let n=0,s=t.length;n<s;n++){const a=t[n];e.bones.push(a.uuid);const o=i[n];e.boneInverses.push(o.toArray())}return e}}class qs extends Ut{constructor(e,t,i,n=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Ps=new ct,lu=new ct,Ia=[],cu=new oi,sg=new ct,ur=new kt,dr=new ni;class of extends kt{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new qs(new Float32Array(i*16),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let n=0;n<i;n++)this.setMatrixAt(n,sg)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new oi),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Ps),cu.copy(e.boundingBox).applyMatrix4(Ps),this.boundingBox.union(cu)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new ni),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Ps),dr.copy(e.boundingSphere).applyMatrix4(Ps),this.boundingSphere.union(dr)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.previousInstanceMatrix!==null&&(this.previousInstanceMatrix=e.previousInstanceMatrix.clone()),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){return this.instanceColor===null?t.setRGB(1,1,1):t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){return t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const i=t.morphTargetInfluences,n=this.morphTexture.source.data.data,s=i.length+1,a=e*s+1;for(let o=0;o<i.length;o++)i[o]=n[a+o]}raycast(e,t){const i=this.matrixWorld,n=this.count;if(ur.geometry=this.geometry,ur.material=this.material,ur.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),dr.copy(this.boundingSphere),dr.applyMatrix4(i),e.ray.intersectsSphere(dr)!==!1))for(let s=0;s<n;s++){this.getMatrixAt(s,Ps),lu.multiplyMatrices(i,Ps),ur.matrixWorld=lu,ur.raycast(e,Ia);for(let a=0,o=Ia.length;a<o;a++){const l=Ia[a];l.instanceId=s,l.object=this,t.push(l)}Ia.length=0}}setColorAt(e,t){return this.instanceColor===null&&(this.instanceColor=new qs(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3),this}setMatrixAt(e,t){return t.toArray(this.instanceMatrix.array,e*16),this}setMorphAt(e,t){const i=t.morphTargetInfluences,n=i.length+1;this.morphTexture===null&&(this.morphTexture=new Ii(new Float32Array(n*this.count),n,this.count,jr,Ft));const s=this.morphTexture.source.data.data;let a=0;for(let c=0;c<i.length;c++)a+=i[c];const o=this.geometry.morphTargetsRelative?1:1-a,l=n*e;return s[l]=o,s.set(i,l+1),this}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const tc=new P,rg=new P,ag=new ft;class wn{constructor(e=new P(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}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}
vendor: 7,621 bytes, line 5
5setFromCoplanarPoints(e,t,i){const n=tc.subVectors(i,t).cross(rg.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const 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,i=!0){const n=e.delta(tc),s=this.normal.dot(n);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/s;return i===!0&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(n,a)}intersectsLine(e){const 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){const i=t||ag.getNormalMatrix(e),n=this.coplanarPoint(tc).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(s),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)}}const Gn=new ni,og=new se(.5,.5),Pa=new P;class Ks{constructor(e=new wn,t=new wn,i=new wn,n=new wn,s=new wn,a=new wn){this.planes=[e,t,i,n,s,a]}set(e,t,i,n,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(n),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=wi,i=!1){const n=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],u=s[4],d=s[5],h=s[6],f=s[7],p=s[8],v=s[9],g=s[10],m=s[11],_=s[12],x=s[13],M=s[14],R=s[15];if(n[0].setComponents(c-a,f-u,m-p,R-_).normalize(),n[1].setComponents(c+a,f+u,m+p,R+_).normalize(),n[2].setComponents(c+o,f+d,m+v,R+x).normalize(),n[3].setComponents(c-o,f-d,m-v,R-x).normalize(),i)n[4].setComponents(l,h,g,M).normalize(),n[5].setComponents(c-l,f-h,m-g,R-M).normalize();else if(n[4].setComponents(c-l,f-h,m-g,R-M).normalize(),t===wi)n[5].setComponents(c+l,f+h,m+g,R+M).normalize();else if(t===ls)n[5].setComponents(l,h,g,M).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Gn.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Gn.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Gn)}intersectsSprite(e){Gn.center.set(0,0,0);const t=og.distanceTo(e.center);return Gn.radius=.7071067811865476+t,Gn.applyMatrix4(e.matrixWorld),this.intersectsSphere(Gn)}intersectsSphere(e){const t=this.planes,i=e.center,n=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<n)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const n=t[i];if(Pa.x=n.normal.x>0?e.max.x:e.min.x,Pa.y=n.normal.y>0?e.max.y:e.min.y,Pa.z=n.normal.z>0?e.max.z:e.min.z,n.distanceToPoint(Pa)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const qi=new ct,Yi=new Ks;class fl{constructor(){this.coordinateSystem=wi}intersectsObject(e,t){if(!t.isArrayCamera||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const n=t.cameras[i];if(qi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),Yi.setFromProjectionMatrix(qi,n.coordinateSystem,n.reversedDepth),Yi.intersectsObject(e))return!0}return!1}intersectsSprite(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const n=t.cameras[i];if(qi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),Yi.setFromProjectionMatrix(qi,n.coordinateSystem,n.reversedDepth),Yi.intersectsSprite(e))return!0}return!1}intersectsSphere(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const n=t.cameras[i];if(qi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),Yi.setFromProjectionMatrix(qi,n.coordinateSystem,n.reversedDepth),Yi.intersectsSphere(e))return!0}return!1}intersectsBox(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const n=t.cameras[i];if(qi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),Yi.setFromProjectionMatrix(qi,n.coordinateSystem,n.reversedDepth),Yi.intersectsBox(e))return!0}return!1}containsPoint(e,t){if(!t||!t.cameras||t.cameras.length===0)return!1;for(let i=0;i<t.cameras.length;i++){const n=t.cameras[i];if(qi.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),Yi.setFromProjectionMatrix(qi,n.coordinateSystem,n.reversedDepth),Yi.containsPoint(e))return!0}return!1}clone(){return new fl}}function ic(r,e){return r-e}function lg(r,e){return r.z-e.z}function cg(r,e){return e.z-r.z}class hg{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,i,n){const s=this.pool,a=this.list;this.index>=s.length&&s.push({start:-1,count:-1,z:-1,index:-1});const o=s[this.index];a.push(o),this.index++,o.start=e,o.count=t,o.z=i,o.index=n}reset(){this.list.length=0,this.index=0}}const xi=new ct,ug=new He(1,1,1),hu=new Ks,dg=new fl,La=new oi,Wn=new ni,fr=new P,uu=new P,fg=new P,nc=new hg,ai=new kt,Ua=[];function pg(r,e,t=0){const i=e.itemSize;if(r.isInterleavedBufferAttribute||r.array.constructor!==e.array.constructor){const n=r.count;for(let s=0;s<n;s++)for(let a=0;a<i;a++)e.setComponent(s+t,a,r.getComponent(s,a))}else e.array.set(r.array,t*i);e.needsUpdate=!0}function Xn(r,e){if(r.constructor!==e.constructor){const t=Math.min(r.length,e.length);for(let i=0;i<t;i++)e[i]=r[i]}else{const t=Math.min(r.length,e.length);e.set(new r.constructor(r.buffer,0,t))}}class lf extends kt{constructor(e,t,i=t*2,n){super(new mt,n),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=i,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(this._maxInstanceCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),i=new Ii(t,e,e,Kt,Ft);this._matricesTexture=i}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),i=new Ii(t,e,e,ea,Ci);this._indirectTexture=i}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),i=new Ii(t,e,e,Kt,Ft);
5i.colorSpace=bt.workingColorSpace,this._colorsTexture=i}_initializeGeometry(e){const t=this.geometry,i=this._maxVertexCount,n=this._maxIndexCount;if(this._geometryInitialized===!1){for(const s in e.attributes){const a=e.getAttribute(s),{array:o,itemSize:l,normalized:c}=a,u=new o.constructor(i*l),d=new Ut(u,l,c);t.setAttribute(s,d)}if(e.getIndex()!==null){const s=i>65535?new Uint32Array(n):new Uint16Array(n);t.setIndex(new Ut(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const i in t.attributes){if(!e.hasAttribute(i))throw new Error(`THREE.BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const n=e.getAttribute(i),s=t.getAttribute(i);if(n.itemSize!==s.itemSize||n.normalized!==s.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||t[e].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new oi);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let i=0,n=t.length;i<n;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,xi),this.getBoundingBoxAt(s,La).applyMatrix4(xi),e.union(La)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ni);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let i=0,n=t.length;i<n;i++){if(t[i].active===!1)continue;const s=t[i].geometryIndex;this.getMatrixAt(i,xi),this.getBoundingSphereAt(s,Wn).applyMatrix4(xi),e.union(Wn)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const i={visible:!0,active:!0,geometryIndex:e};let n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(ic),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=i):(n=this._instanceInfo.length,this._instanceInfo.push(i));const s=this._matricesTexture;xi.identity().toArray(s.image.data,n*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(ug.toArray(a.image.data,n*4),a.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(e,t=-1,i=-1){this._initializeGeometry(e),this._validateGeometry(e);const n={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},s=this._geometryInfo;n.vertexStart=this._nextVertexStart,n.reservedVertexCount=t===-1?e.getAttribute("position").count:t;const a=e.getIndex();if(a!==null&&(n.indexStart=this._nextIndexStart,n.reservedIndexCount=i===-1?a.count:i),n.indexStart!==-1&&n.indexStart+n.reservedIndexCount>this._maxIndexCount||n.vertexStart+n.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let l;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(ic),l=this._availableGeometryIds.shift(),s[l]=n):(l=this._geometryCount,this._geometryCount++,s.push(n)),this.setGeometryAt(l,e),this._nextIndexStart=n.indexStart+n.reservedIndexCount,this._nextVertexStart=n.vertexStart+n.reservedVertexCount,l}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const i=this.geometry,n=i.getIndex()!==null,s=i.getIndex(),a=t.getIndex(),o=this._geometryInfo[e];if(n&&a.count>o.reservedIndexCount||t.attributes.position.count>o.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const l=o.vertexStart,c=o.reservedVertexCount;o.vertexCount=t.getAttribute("position").count;for(const u in i.attributes){const d=t.getAttribute(u),h=i.getAttribute(u);pg(d,h,l);const f=d.itemSize;
vendor: 4,834 bytes, line 5
5for(let p=d.count,v=c;p<v;p++){const g=l+p;for(let m=0;m<f;m++)h.setComponent(g,m,0)}h.needsUpdate=!0,h.addUpdateRange(l*f,c*f)}if(n){const u=o.indexStart,d=o.reservedIndexCount;o.indexCount=t.getIndex().count;for(let h=0;h<a.count;h++)s.setX(u+h,l+a.getX(h));for(let h=a.count,f=d;h<f;h++)s.setX(u+h,l);s.needsUpdate=!0,s.addUpdateRange(u,o.reservedIndexCount)}return o.start=n?o.indexStart:o.vertexStart,o.count=n?o.indexCount:o.vertexCount,o.boundingBox=null,t.boundingBox!==null&&(o.boundingBox=t.boundingBox.clone()),o.boundingSphere=null,t.boundingSphere!==null&&(o.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||t[e].active===!1)return this;const i=this._instanceInfo;for(let n=0,s=i.length;n<s;n++)i[n].active&&i[n].geometryIndex===e&&this.deleteInstance(n);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const i=this._geometryInfo,n=i.map((a,o)=>o).sort((a,o)=>i[a].vertexStart-i[o].vertexStart),s=this.geometry;for(let a=0,o=i.length;a<o;a++){const l=n[a],c=i[l];if(c.active!==!1){if(s.index!==null){if(c.indexStart!==t){const{indexStart:u,vertexStart:d,reservedIndexCount:h}=c,f=s.index,p=f.array,v=e-d;for(let g=u;g<u+h;g++)p[g]=p[g]+v;f.array.copyWithin(t,u,u+h),f.addUpdateRange(t,h),f.needsUpdate=!0,c.indexStart=t}t+=c.reservedIndexCount}if(c.vertexStart!==e){const{vertexStart:u,reservedVertexCount:d}=c,h=s.attributes;for(const f in h){const p=h[f],{array:v,itemSize:g}=p;v.copyWithin(e*g,u*g,(u+d)*g),p.addUpdateRange(e*g,d*g),p.needsUpdate=!0}c.vertexStart=e}e+=c.reservedVertexCount,c.start=s.index?c.indexStart:c.vertexStart}}return this._nextIndexStart=t,this._nextVertexStart=e,this._visibilityChanged=!0,this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const i=this.geometry,n=this._geometryInfo[e];if(n.boundingBox===null){const s=new oi,a=i.index,o=i.attributes.position;for(let l=n.start,c=n.start+n.count;l<c;l++){let u=l;a&&(u=a.getX(u)),s.expandByPoint(fr.fromBufferAttribute(o,u))}n.boundingBox=s}return t.copy(n.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const i=this.geometry,n=this._geometryInfo[e];if(n.boundingSphere===null){const s=new ni;this.getBoundingBoxAt(e,La),La.getCenter(s.center);const a=i.index,o=i.attributes.position;let l=0;for(let c=n.start,u=n.start+n.count;c<u;c++){let d=c;a&&(d=a.getX(d)),fr.fromBufferAttribute(o,d),l=Math.max(l,s.center.distanceToSquared(fr))}s.radius=Math.sqrt(l),n.boundingSphere=s}return t.copy(n.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const i=this._matricesTexture,n=this._matricesTexture.image.data;return t.toArray(n,e*16),i.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,e*16)}setColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,e*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),this._colorsTexture===null?t.isVector4?t.set(1,1,1,1):t.setRGB(1,1,1):t.fromArray(this._colorsTexture.image.data,e*4)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t?this:(this._instanceInfo[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const i=this._geometryInfo[e];return t.vertexStart=i.vertexStart,t.vertexCount=i.vertexCount,t.reservedVertexCount=i.reservedVertexCount,t.indexStart=i.indexStart,t.indexCount=i.indexCount,t.reservedIndexCount=i.reservedIndexCount,t.start=i.start,t.count=i.count,t}setInstanceCount(e){const t=this._availableInstanceIds,i=this._instanceInfo;for(t.sort(ic);t[t.length-1]===i.length-1;)i.pop(),t.pop();if(e<i.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const n=new Int32Array(e),s=new Int32Array(e);Xn(this._multiDrawCounts,n),Xn(this._multiDrawStarts,s),this._multiDrawCounts=n,this._multiDrawStarts=s,this._maxInstanceCount=e;const a=this._indirectTexture,o=this._matricesTexture,l=this._colorsTexture;a.dispose(),this._initIndirectTexture(),Xn(a.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),Xn(o.image.data,this._matricesTexture.image.data),l&&(l.dis
vendor: 16,478 bytes, line 5
5pose(),this._initColorsTexture(),Xn(l.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const i=[...this._geometryInfo].filter(o=>o.active);if(Math.max(...i.map(o=>o.vertexStart+o.reservedVertexCount))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...i.map(l=>l.indexStart+l.reservedIndexCount))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const s=this.geometry;s.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new mt,this._initializeGeometry(s));const a=this.geometry;s.index&&Xn(s.index.array,a.index.array);for(const o in s.attributes)Xn(s.attributes[o].array,a.attributes[o].array)}raycast(e,t){const i=this._instanceInfo,n=this._geometryInfo,s=this.matrixWorld,a=this.geometry;ai.material=this.material,ai.geometry.index=a.index,ai.geometry.attributes=a.attributes,ai.geometry.boundingBox===null&&(ai.geometry.boundingBox=new oi),ai.geometry.boundingSphere===null&&(ai.geometry.boundingSphere=new ni);for(let o=0,l=i.length;o<l;o++){if(!i[o].visible||!i[o].active)continue;const c=i[o].geometryIndex,u=n[c];ai.geometry.setDrawRange(u.start,u.count),this.getMatrixAt(o,ai.matrixWorld).premultiply(s),this.getBoundingBoxAt(c,ai.geometry.boundingBox),this.getBoundingSphereAt(c,ai.geometry.boundingSphere),ai.raycast(e,Ua);for(let d=0,h=Ua.length;d<h;d++){const f=Ua[d];f.object=this,f.batchId=o,t.push(f)}Ua.length=0}ai.material=null,ai.geometry.index=null,ai.geometry.attributes={},ai.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox!==null?t.boundingBox.clone():null,boundingSphere:t.boundingSphere!==null?t.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(t=>({...t})),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,i,n,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=n.getIndex();let o=a===null?1:a.array.BYTES_PER_ELEMENT,l=1;s.wireframe&&(l=2,o=n.attributes.position.count>65535?4:2);const c=this._instanceInfo,u=this._multiDrawStarts,d=this._multiDrawCounts,h=this._geometryInfo,f=this.perObjectFrustumCulled,p=this._indirectTexture,v=p.image.data,g=i.isArrayCamera?dg:hu;f&&!i.isArrayCamera&&(xi.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),hu.setFromProjectionMatrix(xi,i.coordinateSystem,i.reversedDepth));let m=0;if(this.sortObjects){xi.copy(this.matrixWorld).invert(),fr.setFromMatrixPosition(i.matrixWorld).applyMatrix4(xi),uu.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(xi);for(let M=0,R=c.length;M<R;M++)if(c[M].visible&&c[M].active){const E=c[M].geometryIndex;this.getMatrixAt(M,xi),this.getBoundingSphereAt(E,Wn).applyMatrix4(xi);let I=!1;if(f&&(I=!g.intersectsSphere(Wn,i)),!I){const y=h[E],w=fg.subVectors(Wn.center,fr).dot(uu);nc.push(y.start,y.count,w,M)}}const _=nc.list,x=this.customSort;x===null?_.sort(s.transparent?cg:lg):x.call(this,_,i);for(let M=0,R=_.length;M<R;M++){const E=_[M];u[m]=E.start*o*l,d[m]=E.count*l,v[m]=E.index,m++}nc.reset()}else for(let _=0,x=c.length;_<x;_++)if(c[_].visible&&c[_].active){const M=c[_].geometryIndex;let R=!1;if(f&&(this.getMatrixAt(_,xi),this.getBoundingSphereAt(M,Wn).applyMatrix4(xi),R=!g.intersectsSphere(Wn,i)),!R){const E=h[M];u[m]=E.start*o*l,d[m]=E.count*l,v[m]=_,m++}}p.needsUpdate=!0,this._multiDrawCount=m,this._visibilityChanged=!1}onBeforeShadow(e,t,i,n,s,a){this.onBeforeRender(e,null,n,s,a)}}class _i extends li{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new He(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}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}}const qo=new P,Yo=new P,du=new ct,pr=new $s,Na=new ni,sc=new P,fu=new P;class Dn extends Ct{constructor(e=new mt,t=new _i){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}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(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let n=1,s=t.count;n<s;n++)qo.fromBufferAttribute(t,n-1),Yo.fromBufferAttribute(t,n),i[n]=i[n-1],i[n]+=qo.distanceTo(Yo);e.setAttribute("lineDistance",new Ge(i,1))}else Re("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,n=this.matrixWorld,s=e.params.Line.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Na.copy(i.boundingSphere),Na.applyMatrix4(n),Na.radius+=s,e.ray.intersectsSphere(Na)===!1)return;du.copy(n).invert(),pr.copy(e.ray).applyMatrix4(du);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=this.isLineSegments?2:1,u=i.index,h=i.attributes.position;if(u!==null){const f=Math.max(0,a.start),p=Math.min(u.count,a.start+a.count);for(let v=f,g=p-1;v<g;v+=c){const m=u.getX(v),_=u.getX(v+1),x=Da(this,e,pr,l,m,_,v);x&&t.push(x)}if(this.isLineLoop){const v=u.getX(p-1),g=u.getX(f),m=Da(this,e,pr,l,v,g,p-1);m&&t.push(m)}}else{const f=Math.max(0,a.start),p=Math.min(h.count,a.start+a.count);for(let v=f,g=p-1;v<g;v+=c){const m=Da(this,e,pr,l,v,v+1,v);m&&t.push(m)}if(this.isLineLoop){const v=Da(this,e,pr,l,p-1,f,p-1);v&&t.push(v)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const n=t[i[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=n.length;s<a;s++){const o=n[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function Da(r,e,t,i,n,s,a){const o=r.geometry.attributes.position;if(qo.fromBufferAttribute(o,n),Yo.fromBufferAttribute(o,s),t.distanceSqToSegment(qo,Yo,sc,fu)>i)return;sc.applyMatrix4(r.matrixWorld);const c=e.ray.origin.distanceTo(sc);if(!(c<e.near||c>e.far))return{distance:c,point:fu.clone().applyMatrix4(r.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:r}}const pu=new P,mu=new P;class en extends Dn{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let n=0,s=t.count;n<s;n+=2)pu.fromBufferAttribute(t,n),mu.fromBufferAttribute(t,n+1),i[n]=n===0?0:i[n-1],i[n+1]=i[n]+pu.distanceTo(mu);e.setAttribute("lineDistance",new Ge(i,1))}else Re("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class cf extends Dn{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class lh extends li{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new He(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}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}}const gu=new ct,Pc=new $s,Oa=new ni,Fa=new P;class hf extends Ct{constructor(e=new mt,t=new lh){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}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){const i=this.geometry,n=this.matrixWorld,s=e.params.Points.threshold,a=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),Oa.copy(i.boundingSphere),Oa.applyMatrix4(n),Oa.radius+=s,e.ray.intersectsSphere(Oa)===!1)return;gu.copy(n).invert(),Pc.copy(e.ray).applyMatrix4(gu);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=o*o,c=i.index,d=i.attributes.position;if(c!==null){const h=Math.max(0,a.start),f=Math.min(c.count,a.start+a.count);for(let p=h,v=f;p<v;p++){const g=c.getX(p);Fa.fromBufferAttribute(d,g),vu(Fa,g,l,n,e,t,this)}}else{const h=Math.max(0,a.start),f=Math.min(d.count,a.start+a.count);for(let p=h,v=f;p<v;p++)Fa.fromBufferAttribute(d,p),vu(Fa,p,l,n,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const n=t[i[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=n.length;s<a;s++){const o=n[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function vu(r,e,t,i,n,s,a){const o=Pc.distanceSqToPoint(r);if(o<t){const l=new P;Pc.closestPointToPoint(r,l),l.applyMatrix4(i);const c=n.ray.origin.distanceTo(l);if(c<n.near||c>n.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class uf extends Lt{constructor(e,t,i,n,s=wt,a=wt,o,l,c){super(e,t,i,n,s,a,o,l,c),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const u=this;function d(){u.needsUpdate=!0,u._requestVideoFrameCallbackId=e.requestVideoFrameCallback(d)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(d))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class mg extends uf{constructor(e,t,i,n,s,a,o,l){super({},e,t,i,n,s,a,o,l),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class gg extends Lt{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Zt,this.minFilter=Zt,this.generateMipmaps=!1,this.needsUpdate=!0}}class pl extends Lt{constructor(e,t,i,n,s,a,o,l,c,u,d,h){super(null,a,o,l,c,u,n,s,d,h),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class vg extends pl{constructor(e,t,i,n,s,a){super(e,t,i,s,a),this.isCompressedArrayTexture=!0,this.image.depth=n,this.wrapR=Gt,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class _g extends pl{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,Qi),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class ta extends Lt{constructor(e=[],t=Qi,i,n,s,a,o,l,c,u){super(e,t,i,n,s,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class yg extends Lt{constructor(e,t,i,n,s,a,o,l,c){super(e,t,i,n,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class xg extends Lt{constructor(e,t,i,n,s,a,o,l,c){super(e,t,i,n,s,a,o,l,c),this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;const u=e?e.parentNode:null;u!==null&&"requestPaint"in u&&(u.onpaint=()=>{this.needsUpdate=!0},u.requestPaint())}dispose(){const e=this.image?this.image.parentNode:null;e!==null&&"onpaint"in e&&(e.onpaint=null),super.dispose()}}class hs extends Lt{constructor(e,t,i=Ci,n,s,a,o=Zt,l=Zt,c,u=ji,d=1){if(u!==ji&&u!==An)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const h={width:e,height:t,depth:d};super(h,n,s,a,o,l,u,i,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Cn(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class df extends hs{constructor(e,t=Ci,i=Qi,n,s,a=Zt,o=Zt,l,c=ji){const u={width:e,height:e,depth:1},d=[u,u,u,u,u,u];super(e,e,t,i,n,s,a,o,l,c),this.image=d,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class ch extends Lt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class ds extends mt{constructor(e=1,t=1,i=1,n=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:s,depthSegments:a};const o=this;n=Math.floor(n),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],u=[],d=[];let h=0,f=0;p("z","y","x",-1,-1,i,t,e,a,s,0),p("z","y","x",1,-1,i,t,-e,a,s,1),p("x","z","y",1,1,e,i,t,n,a,2),p("x","z","y",1,-1,e,i,-t,n,a,3),p("x","y","z",1,-1,e,t,i,n,s,4),p("x","y","z",-1,-1,e,t,-i,n,s,5),this.setIndex(l),this.setAttribute("position",new Ge(c,3)),this.setAttribute("normal",new Ge(u,3)),this.setAttribute("uv",new Ge(d,2));function p(v,g,m,_,x,M,R,E,I,y,w){const U=M/I,L=R/y,O=M/2,q=R/2,W=E/2,B=I+1,k=y+1;let Y=0,re=0;const le=new P;for(let de=0;de<k;de++){const De=de*L-q;for(let Ue=0;Ue<B;Ue++){const Ke=Ue*U-O;le[v]=Ke*_,le[g]=De*x,le[m]=W,c.push(le.x,le.y,le.z),le[v]=0,le[g]=0,le[m]=E>0?1:-1,u.push(le.x,le.y,le.z),d.push(Ue/I),d.push(1-de/y),Y+=1}}for(let de=0;de<y;de++)for(let De=0;De<I;De++){const Ue=h+De+B*de,Ke=h+De+B*(de+1),yt=h+(De+1)+B*(de+1),ot=h+(De+1)+B*de;l.push(Ue,Ke,ot),l.push(Ke,yt,ot),re+=6}o.addGroup(f,re,w),f+=re,h+=Y}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ds(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class ml extends mt{constructor(e=1,t=1,i=4,n=8,s=1){super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:i,radialSegments:n,heightSegments:s},t=Math.max(0,t),i=Math.max(1,Math.floor(i)),n=Math.max(3,Math.floor(n)),s=Math.max(1,Math.floor(s));const a=[],o=[],l=[],c=[],u=t/2,d=Math.PI/2*e,h=t,f=2*d+h,p=i*2+s,v=n+1,g=new P,m=new P;for(let _=0;_<=p;_++){let x=0,M=0,R=0,E=0;if(_<=i){const w=_/i,U=w*Math.PI/2;M=-u-e*Math.cos(U),R=e*Math.sin(U),E=-e*Math.cos(U),x=w*d}else if(_<=i+s){const w=(_-i)/s;M=-u+w*t,R=e,E=0,x=d+w*h}else{const w=(_-i-s)/i,U=w*Math.PI/2;M=u+e*Math.sin(U),R=e*Math.cos(U),E=e*Math.sin(U),x=d+h+w*d}const I=Math.max(0,Math.min(1,x/f));let y=0;_===0?y=.5/n:_===p&&(y=-.5/n);for(let w=0;w<=n;w++){const U=w/n,L=U*Math.PI*2,O=Math.sin(L),q=Math.cos(L);m.x=-R*q,m.y=M,m.z=R*O,o.push(m.x,m.y,m.z),g.set(-R*q,E,R*O),g.normalize(),l.push(g.x,g.y,g.z),c.push(U+y,I)}if(_>0){const w=(_-1)*v;for(let U=0;U<n;U++){const L=w+U,O=w+U+1,q=_*v+U,W=_*v+U+1;a.push(L,O,q),a.push(O,W,q)}}}this.setIndex(a),this.setAttribute("position",new Ge(o,3)),this.setAttribute("normal",new Ge(l,3)),this.setAttribute("uv",new Ge(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}
vendor: 2,654 bytes, line 5
5static fromJSON(e){return new ml(e.radius,e.height,e.capSegments,e.radialSegments,e.heightSegments)}}class gl extends mt{constructor(e=1,t=32,i=0,n=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:n},t=Math.max(3,t);const s=[],a=[],o=[],l=[],c=new P,u=new se;a.push(0,0,0),o.push(0,0,1),l.push(.5,.5);for(let d=0,h=3;d<=t;d++,h+=3){const f=i+d/t*n;c.x=e*Math.cos(f),c.y=e*Math.sin(f),a.push(c.x,c.y,c.z),o.push(0,0,1),u.x=(a[h]/e+1)/2,u.y=(a[h+1]/e+1)/2,l.push(u.x,u.y)}for(let d=1;d<=t;d++)s.push(d,d+1,0);this.setIndex(s),this.setAttribute("position",new Ge(a,3)),this.setAttribute("normal",new Ge(o,3)),this.setAttribute("uv",new Ge(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gl(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class ia extends mt{constructor(e=1,t=1,i=1,n=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:n,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;n=Math.floor(n),s=Math.floor(s);const u=[],d=[],h=[],f=[];let p=0;const v=[],g=i/2;let m=0;_(),a===!1&&(e>0&&x(!0),t>0&&x(!1)),this.setIndex(u),this.setAttribute("position",new Ge(d,3)),this.setAttribute("normal",new Ge(h,3)),this.setAttribute("uv",new Ge(f,2));function _(){const M=new P,R=new P;let E=0;const I=(t-e)/i;for(let y=0;y<=s;y++){const w=[],U=y/s,L=U*(t-e)+e;for(let O=0;O<=n;O++){const q=O/n,W=q*l+o,B=Math.sin(W),k=Math.cos(W);R.x=L*B,R.y=-U*i+g,R.z=L*k,d.push(R.x,R.y,R.z),M.set(B,I,k).normalize(),h.push(M.x,M.y,M.z),f.push(q,1-U),w.push(p++)}v.push(w)}for(let y=0;y<n;y++)for(let w=0;w<s;w++){const U=v[w][y],L=v[w+1][y],O=v[w+1][y+1],q=v[w][y+1];(e>0||w!==0)&&(u.push(U,L,q),E+=3),(t>0||w!==s-1)&&(u.push(L,O,q),E+=3)}c.addGroup(m,E,0),m+=E}function x(M){const R=p,E=new se,I=new P;let y=0;const w=M===!0?e:t,U=M===!0?1:-1;for(let O=1;O<=n;O++)d.push(0,g*U,0),h.push(0,U,0),f.push(.5,.5),p++;const L=p;for(let O=0;O<=n;O++){const W=O/n*l+o,B=Math.cos(W),k=Math.sin(W);I.x=w*k,I.y=g*U,I.z=w*B,d.push(I.x,I.y,I.z),h.push(0,U,0),E.x=B*.5+.5,E.y=k*.5*U+.5,f.push(E.x,E.y),p++}for(let O=0;O<n;O++){const q=R+O,W=L+O;M===!0?u.push(W,W+1,q):u.push(W+1,W,q),y+=3}c.addGroup(m,y,M===!0?1:2),m+=y}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ia(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class na extends ia{constructor(e=1,t=1,i=32,n=1,s=!1,a=0,o=Math.PI*2){super(0,e,t,i,n,s,a,o),this.type="C
5oneGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:n,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new na(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class On extends mt{constructor(e=[],t=[],i=1,n=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:n};const s=[],a=[];o(n),c(i),u(),this.setAttribute("position",new Ge(s,3)),this.setAttribute("normal",new Ge(s.slice(),3)),this.setAttribute("uv",new Ge(a,2)),n===0?this.computeVertexNormals():this.normalizeNormals();function o(_){const x=new P,M=new P,R=new P;for(let E=0;E<t.length;E+=3)f(t[E+0],x),f(t[E+1],M),f(t[E+2],R),l(x,M,R,_)}function l(_,x,M,R){const E=R+1,I=[];for(let y=0;y<=E;y++){I[y]=[];const w=_.clone().lerp(M,y/E),U=x.clone().lerp(M,y/E),L=E-y;for(let O=0;O<=L;O++)O===0&&y===E?I[y][O]=w:I[y][O]=w.clone().lerp(U,O/L)}for(let y=0;y<E;y++)for(let w=0;w<2*(E-y)-1;w++){const U=Math.floor(w/2);w%2===0?(h(I[y][U+1]),h(I[y+1][U]),h(I[y][U])):(h(I[y][U+1]),h(I[y+1][U+1]),h(I[y+1][U]))}}function c(_){const x=new P;for(let M=0;M<s.length;M+=3)x.x=s[M+0],x.y=s[M+1],x.z=s[M+2],x.normalize().multiplyScalar(_),s[M+0]=x.x,s[M+1]=x.y,s[M+2]=x.z}function u(){const _=new P;for(let x=0;x<s.length;x+=3){_.x=s[x+0],_.y=s[x+1],_.z=s[x+2];const M=g(_)/2/Math.PI+.5,R=m(_)/Math.PI+.5;a.push(M,1-R)}p(),d()}function d(){for(let _=0;_<a.length;_+=6){const x=a[_+0],M=a[_+2],R=a[_+4],E=Math.max(x,M,R),I=Math.min(x,M,R);E>.9&&I<.1&&(x<.2&&(a[_+0]+=1),M<.2&&(a[_+2]+=1),R<.2&&(a[_+4]+=1))}}function h(_){s.push(_.x,_.y,_.z)}function f(_,x){const M=_*3;x.x=e[M+0],x.y=e[M+1],x.z=e[M+2]}function p(){const _=new P,x=new P,M=new P,R=new P,E=new se,I=new se,y=new se;for(let w=0,U=0;w<s.length;w+=9,U+=6){_.set(s[w+0],s[w+1],s[w+2]),x.set(s[w+3],s[w+4],s[w+5]),M.set(s[w+6],s[w+7],s[w+8]),E.set(a[U+0],a[U+1]),I.set(a[U+2],a[U+3]),y.set(a[U+4],a[U+5]),R.copy(_).add(x).add(M).divideScalar(3);const L=g(R);v(E,U+0,_,L),v(I,U+2,x,L),v(y,U+4,M,L)}}function v(_,x,M,R){R<0&&_.x===1&&(a[x]=_.x-1),M.x===0&&M.z===0&&(a[x]=R/2/Math.PI+.5)}function g(_){return Math.atan2(_.z,-_.x)}function m(_){return Math.atan2(-_.y,Math.sqrt(_.x*_.x+_.z*_.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new On(e.vertices,e.indices,e.radius,e.detail)}}class vl extends On{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,n=1/i,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-i,0,-n,i,0,n,-i,0,n,i,-n,-i,0,-n,i,0,n,-i,0,n,i,0,-i,0,-n,i,0,-n,-i,0,n,i,0,n],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,
vendor: 11,306 bytes, line 5
519,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,a,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new vl(e.radius,e.detail)}}const Ba=new P,za=new P,rc=new P,ka=new Si;class ff extends mt{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const n=Math.pow(10,4),s=Math.cos(rs*t),a=e.getIndex(),o=e.getAttribute("position"),l=a?a.count:o.count,c=[0,0,0],u=["a","b","c"],d=new Array(3),h={},f=[];for(let p=0;p<l;p+=3){a?(c[0]=a.getX(p),c[1]=a.getX(p+1),c[2]=a.getX(p+2)):(c[0]=p,c[1]=p+1,c[2]=p+2);const{a:v,b:g,c:m}=ka;if(v.fromBufferAttribute(o,c[0]),g.fromBufferAttribute(o,c[1]),m.fromBufferAttribute(o,c[2]),ka.getNormal(rc),d[0]=`${Math.round(v.x*n)},${Math.round(v.y*n)},${Math.round(v.z*n)}`,d[1]=`${Math.round(g.x*n)},${Math.round(g.y*n)},${Math.round(g.z*n)}`,d[2]=`${Math.round(m.x*n)},${Math.round(m.y*n)},${Math.round(m.z*n)}`,!(d[0]===d[1]||d[1]===d[2]||d[2]===d[0]))for(let _=0;_<3;_++){const x=(_+1)%3,M=d[_],R=d[x],E=ka[u[_]],I=ka[u[x]],y=`${M}_${R}`,w=`${R}_${M}`;w in h&&h[w]?(rc.dot(h[w].normal)<=s&&(f.push(E.x,E.y,E.z),f.push(I.x,I.y,I.z)),h[w]=null):y in h||(h[y]={index0:c[_],index1:c[x],normal:rc.clone()})}}for(const p in h)if(h[p]){const{index0:v,index1:g}=h[p];Ba.fromBufferAttribute(o,v),za.fromBufferAttribute(o,g),f.push(Ba.x,Ba.y,Ba.z),f.push(za.x,za.y,za.z)}this.setAttribute("position",new Ge(f,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Gi{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Re("Curve: .getPoint() not implemented.")}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,n=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)i=this.getPoint(a/e),s+=i.distanceTo(n),t.push(s),n=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const i=this.getLengths();let n=0;const s=i.length;let a;t?a=t:a=e*i[s-1];let o=0,l=s-1,c;for(;o<=l;)if(n=Math.floor(o+(l-o)/2),c=i[n]-a,c<0)o=n+1;else if(c>0)l=n-1;else{l=n;break}if(n=l,i[n]===a)return n/(s-1);const u=i[n],h=i[n+1]-u,f=(a-u)/h;return(n+f)/(s-1)}getTangent(e,t){let n=e-1e-4,s=e+1e-4;n<0&&(n=0),s>1&&(s=1);const a=this.getPoint(n),o=this.getPoint(s),l=t||(a.isVector2?new se:new P);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t=!1){const i=new P,n=[],s=[],a=[],o=new P,l=new ct;for(let f=0;f<=e;f++){const p=f/e;n[f]=this.getTangentAt(p,new P)}s[0]=new P,a[0]=new P;let c=Number.MAX_VALUE;const u=Math.abs(n[0].x),d=Math.abs(n[0].y),h=Math.abs(n[0].z);u<=c&&(c=u,i.set(1,0,0)),d<=c&&(c=d,i.set(0,1,0)),h<=c&&i.set(0,0,1),o.crossVectors(n[0],i).normalize(),s[0].crossVectors(n[0],o),a[0].crossVectors(n[0],s[0]);for(let f=1;f<=e;f++){if(s[f]=s[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(n[f-1],n[f]),o.length()>Number.EPSILON){o.normalize();const p=Math.acos(rt(n[f-1].dot(n[f]),-1,1));s[f].applyMatrix4(l.makeRotationAxis(o,p))}a[f].crossVectors(n[f],s[f])}if(t===!0){let f=Math.acos(rt(s[0].dot(s[e]),-1,1));f/=e,n[0].dot(o.crossVectors(s[0],s[e]))>0&&(f=-f);for(let p=1;p<=e;p++)s[p].applyMatrix4(l.makeRotationAxis(n[p],f*p)),a[p].crossVectors(n[p],s[p])}return{tangents:n,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class _l extends Gi{constructor(e=0,t=0,i=1,n=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=n,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t=new se){const i=t,n=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=n;for(;s>n;)s-=n;s<Number.EPSILON&&(a?s=0:s=n),this.aClockwise===!0&&!a&&(s===n?s=-n:s=s-n);const o=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const u=Math.cos(this.aRotation),d=Math.sin(this.aRotation),h=l-this.aX,f=c-this.aY;l=h*u-f*d+this.aX,c=h*d+f*u+this.aY}return i.set(l,c)}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(){const 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}}class pf extends _l{constructor(e,t,i,n,s,a){super(e,t,i,i,n,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function hh(){let r=0,e=0,t=0,i=0;function n(s,a,o,l){r=s,e=o,t=-3*s+3*a-2*o-l,i=2*s-2*a+o+l}return{initCatmullRom:function(s,a,o,l,c){n(a,o,c*(o-s),c*(l-a))},initNonuniformCatmullRom:function(s,a,o,l,c,u,d){let h=(a-s)/c-(o-s)/(c+u)+(o-a)/u,f=(o-a)/u-(l-a)/(u+d)+(l-o)/d;h*=u,f*=u,n(a,o,h,f)},calc:function(s){const a=s*s,o=a*s;return r+e*s+t*a+i*o}}}const _u=new P,yu=new P,ac=new hh,oc=new hh,lc=new hh;class mf extends Gi{constructor(e=[],t=!1,i="centripetal",n=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=n}getPoint(e,t=new P){const i=t,n=this.points,s=n.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),l=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,u;this.closed||o>0?c=n[(o-1)%s]:(yu.subVectors(n[0],n[1]).add(n[0]),c=yu);const d=n[o%s],h=n[(o+1)%s];if(this.closed||o+2<s?u=n[(o+2)%s]:(_u.subVectors(n[s-1],n[s-2]).add(n[s-1]),u=_u),this.curveType==="centripetal"||this.curveType==="chordal"){const f=this.curveType==="chordal"?.5:.25;let p=Math.pow(c.distanceToSquared(d),f),v=Math.pow(d.distanceToSquared(h),f),g=Math.pow(h.distanceToSquared(u),f);v<1e-4&&(v=1),p<1e-4&&(p=v),g<1e-4&&(g=v),ac.initNonuniformCatmullRom(c.x,d.x,h.x,u.x,p,v,g),oc.initNonuniformCatmullRom(c.y,d.y,h.y,u.y,p,v,g),lc.initNonuniformCatmullRom(c.z,d.z,h.z,u.z,p,v,g)}else this.curveType==="catmullrom"&&(ac.initCatmullRom(c.x,d.x,h.x,u.x,this.tension),oc.initCatmullRom(c.y,d.y,h.y,u.y,this.tension),lc.initCatmullRom(c.z,d.z,h.z,u.z,this.tension));return i.set(ac.calc(l),oc.calc(l),lc.calc(l)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const n=e.points[t];this.points.push(new P().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function xu(r,e,t,i,n){const s=(i-e)*.5,a=(n-t)*.5,o=r*r,l=r*o;return(2*t-2*i+s+a)*l+(-3*t+3*i-2*s-a)*o+s*r+t}function Mg(r,e){const t=1-r;return t*t*e}function Sg(r,e){return 2*(1-r)*r*e}function bg(r,e){return r*r*e}function Pr(r,e,t,i){return Mg(r,e)+Sg(r,t)+bg(r,i)}function Tg(r,e){const t=1-r;return t*t*t*e}function wg(r,e){const t=1-r;return 3*t*t*r*e}function Eg(r,e){return 3*(1-r)*r*r*e}function Ag(r,e){return r*r*r*e}function Lr(r,e,t,i,n){return Tg(r,e)+wg(r,t)+Eg(r,i)+Ag(r,n)}class uh extends Gi{constructor(e=new se,t=new se,i=new se,n=new se){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=n}getPoint(e,t=new se){const i=t,n=this.v0,s=this.v1,a=this.v2,o=this.v3;return i.set(Lr(e,n.x,s.x,a.x,o.x),Lr(e,n.y,s.y,a.y,o.y)),i}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(){const 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}}class gf extends Gi{constructor(e=new P,t=new P,i=new P,n=new P){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=n}getPoint(e,t=new P){const i=t,n=this.v0,s=this.v1,a=this.v2,o=this.v3;return i.set(Lr(e,n.x,s.x,a.x,o.x),Lr(e,n.y,s.y,a.y,o.y),Lr(e,n.z,s.z,a.z,o.z)),i}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(){const 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}}class dh extends Gi{constructor(e=new se,t=new se){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new se){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new se){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(){const 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}}class vf extends Gi{constructor(e=new P,t=new P){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new P){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new P){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(){const 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}}class fh extends Gi{constructor(e=new se,t=new se,i=new se){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}
vendor: 12,767 bytes, line 5
5getPoint(e,t=new se){const i=t,n=this.v0,s=this.v1,a=this.v2;return i.set(Pr(e,n.x,s.x,a.x),Pr(e,n.y,s.y,a.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const 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}}class ph extends Gi{constructor(e=new P,t=new P,i=new P){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new P){const i=t,n=this.v0,s=this.v1,a=this.v2;return i.set(Pr(e,n.x,s.x,a.x),Pr(e,n.y,s.y,a.y),Pr(e,n.z,s.z,a.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const 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}}class mh extends Gi{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new se){const i=t,n=this.points,s=(n.length-1)*e,a=Math.floor(s),o=s-a,l=n[a===0?a:a-1],c=n[a],u=n[a>n.length-2?n.length-1:a+1],d=n[a>n.length-3?n.length-1:a+2];return i.set(xu(o,l.x,c.x,u.x,d.x),xu(o,l.y,c.y,u.y,d.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const n=e.points[t];this.points.push(n.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const n=e.points[t];this.points.push(new se().fromArray(n))}return this}}var Zo=Object.freeze({__proto__:null,ArcCurve:pf,CatmullRomCurve3:mf,CubicBezierCurve:uh,CubicBezierCurve3:gf,EllipseCurve:_l,LineCurve:dh,LineCurve3:vf,QuadraticBezierCurve:fh,QuadraticBezierCurve3:ph,SplineCurve:mh});class _f extends Gi{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Zo[i](t,e))}return this}getPoint(e,t){const i=e*this.getLength(),n=this.getCurveLengths();let s=0;for(;s<n.length;){if(n[s]>=i){const a=n[s]-i,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,n=this.curves.length;i<n;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let i;for(let n=0,s=this.curves;n<s.length;n++){const a=s[n],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,l=a.getPoints(o);for(let c=0;c<l.length;c++){const u=l[c];i&&i.equals(u)||(t.push(u),i=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){const n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const n=e.curves[t];this.curves.push(new Zo[n.type]().fromJSON(n))}return this}}class Jo extends _f{constructor(e){super(),this.type="Path",this.currentPoint=new se,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const i=new dh(this.currentPoint.clone(),new se(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,n){const s=new fh(this.currentPoint.clone(),new se(e,t),new se(i,n));return this.curves.push(s),this.currentPoint.set(i,n),this}bezierCurveTo(e,t,i,n,s,a){const o=new uh(this.currentPoint.clone(),new se(e,t),new se(i,n),new se(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new mh(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,n,s,a){const o=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+o,t+l,i,n,s,a),this}absarc(e,t,i,n,s,a){return this.absellipse(e,t,i,i,n,s,a),this}ellipse(e,t,i,n,s,a,o,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,i,n,s,a,o,l),this}absellipse(e,t,i,n,s,a,o,l){const c=new _l(e,t,i,n,s,a,o,l);if(this.curves.length>0){const d=c.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class as extends Jo{constructor(e){super(e),this.uuid=Ei(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,n=this.holes.length;i<n;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){const n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const n=e.holes[t];this.holes.push(new Jo().fromJSON(n))}return this}}function Cg(r,e,t=2){const i=e&&e.length,n=i?e[0]*t:r.length;let s=yf(r,0,n,t,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c;if(i&&(s=Ug(r,e,s,t)),r.length>80*t){o=r[0],l=r[1];let u=o,d=l;for(let h=t;h<n;h+=t){const f=r[h],p=r[h+1];f<o&&(o=f),p<l&&(l=p),f>u&&(u=f),p>d&&(d=p)}c=Math.max(u-o,d-l),c=c!==0?32767/c:0}return Gr(s,a,t,o,l,c,0),a}function yf(r,e,t,i,n){let s;if(n===Wg(r,e,t,i)>0)for(let a=e;a<t;a+=i)s=Mu(a/i|0,r[a],r[a+1],s);else for(let a=t-i;a>=e;a-=i)s=Mu(a/i|0,r[a],r[a+1],s);return s&&Ys(s,s.next)&&(Xr(s),s=s.next),s}function us(r,e){if(!r)return r;e||(e=r);let t=r,i;do if(i=!1,!t.steiner&&(Ys(t,t.next)||zt(t.prev,t,t.next)===0)){if(Xr(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Gr(r,e,t,i,n,s,a){if(!r)return;!a&&s&&Bg(r,i,n,s);let o=r;for(;r.prev!==r.next;){const l=r.prev,c=r.next;if(s?Ig(r,i,n,s):Rg(r)){e.push(l.i,r.i,c.i),Xr(r),r=c.next,o=c.next;continue}if(r=c,r===o){a?a===1?(r=Pg(us(r),e),Gr(r,e,t,i,n,s,2)):a===2&&Lg(r,e,t,i,n,s):Gr(us(r),e,t,i,n,s,1);break}}}function Rg(r){const e=r.prev,t=r,i=r.next;if(zt(e,t,i)>=0)return!1;const n=e.x,s=t.x,a=i.x,o=e.y,l=t.y,c=i.y,u=Math.min(n,s,a),d=Math.min(o,l,c),h=Math.max(n,s,a),f=Math.max(o,l,c);let p=i.next;for(;p!==e;){if(p.x>=u&&p.x<=h&&p.y>=d&&p.y<=f&&xr(n,o,s,l,a,c,p.x,p.y)&&zt(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Ig(r,e,t,i){const n=r.prev,s=r,a=r.next;if(zt(n,s,a)>=0)return!1;const o=n.x,l=s.x,c=a.x,u=n.y,d=s.y,h=a.y,f=Math.min(o,l,c),p=Math.min(u,d,h),v=Math.max(o,l,c),g=Math.max(u,d,h),m=Lc(f,p,e,t,i),_=Lc(v,g,e,t,i);let x=r.prevZ,M=r.nextZ;for(;x&&x.z>=m&&M&&M.z<=_;){if(x.x>=f&&x.x<=v&&x.y>=p&&x.y<=g&&x!==n&&x!==a&&xr(o,u,l,d,c,h,x.x,x.y)&&zt(x.prev,x,x.next)>=0||(x=x.prevZ,M.x>=f&&M.x<=v&&M.y>=p&&M.y<=g&&M!==n&&M!==a&&xr(o,u,l,d,c,h,M.x,M.y)&&zt(M.prev,M,M.next)>=0))return!1;M=M.nextZ}for(;x&&x.z>=m;){if(x.x>=f&&x.x<=v&&x.y>=p&&x.y<=g&&x!==n&&x!==a&&xr(o,u,l,d,c,h,x.x,x.y)&&zt(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;M&&M.z<=_;){if(M.x>=f&&M.x<=v&&M.y>=p&&M.y<=g&&M!==n&&M!==a&&xr(o,u,l,d,c,h,M.x,M.y)&&zt(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function Pg(r,e){let t=r;do{const i=t.prev,n=t.next.next;!Ys(i,n)&&Mf(i,t,t.next,n)&&Wr(i,n)&&Wr(n,i)&&(e.push(i.i,t.i,n.i),Xr(t),Xr(t.next),t=r=n),t=t.next}while(t!==r);return us(t)}function Lg(r,e,t,i,n,s){let a=r;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&Vg(a,o)){let l=Sf(a,o);a=us(a,a.next),l=us(l,l.next),Gr(a,e,t,i,n,s,0),Gr(l,e,t,i,n,s,0);return}o=o.next}a=a.next}while(a!==r)}function Ug(r,e,t,i){const n=[];for(let s=0,a=e.length;s<a;s++){const o=e[s]*i,l=s<a-1?e[s+1]*i:r.length,c=yf(r,o,l,i,!1);c===c.next&&(c.steiner=!0),n.push(kg(c))}n.sort(Ng);for(let s=0;s<n.length;s++)t=Dg(n[s],t);return t}function Ng(r,e){let t=r.x-e.x;if(t===0&&(t=r.y-e.y,t===0)){const i=(r.next.y-r.y)/(r.next.x-r.x),n=(e.next.y-e.y)/(e.next.x-e.x);t=i-n}return t}function Dg(r,e){const t=Og(r,e);if(!t)return e;const i=Sf(t,r);return us(i,i.next),us(t,t.next)}function Og(r,e){let t=e;const i=r.x,n=r.y;let s=-1/0,a;if(Ys(r,t))return t;do{if(Ys(r,t.next))return t.next;if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){const d=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=i&&d>s&&(s=d,a=t.x<t.next.x?t:t.next,d===i))return a}t=t.next}while(t!==e);if(!a)return null;const o=a,l=a.x,c=a.y;let u=1/0;t=a;do{if(i>=t.x&&t.x>=l&&i!==t.x&&xf(n<c?i:s,n,l,c,n<c?s:i,n,t.x,t.y)){const d=Math.abs(n-t.y)/(i-t.x);Wr(t,r)&&(d<u||d===u&&(t.x>a.x||t.x===a.x&&Fg(a,t)))&&(a=t,u=d)}t=t.next}while(t!==o);return a}function Fg(r,e){return zt(r.prev,r,e.prev)<0&&zt(e.next,r,r.next)<0}function Bg(r,e,t,i){let n=r;do n.z===0&&(n.z=Lc(n.x,n.y,e,t,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==r);n.prevZ.nextZ=null,n.prevZ=null,zg(n)}function zg(r){let e,t=1;do{let i=r,n;r=null;let s=null;for(e=0;i;){e++;let a=i,o=0;for(let c=0;c<t&&(o++,a=a.nextZ,!!a);c++);let l=t;for(;o>0||l>0&&a;)o!==0&&(l===0||!a||i.z<=a.z)?(n=i,i=i.nextZ,o--):(n=a,a=a.nextZ,l--),s?s.nextZ=n:r=n,n.prevZ=s,s=n;i=a}s.nextZ=null,t*=2}while(e>1);return r}function Lc(r,e,t,i,n){return r=(r-t)*n|0,e=(e-i)*n|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function kg(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function xf(r,e,t,i,n,s,a,o){return(n-a)*(e-o)>=(r-a)*(s-o)&&(r-a)*(i-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(n-a)*(i-o)}function xr(r,e,t,i,n,s,a,o){return!(r===a&&e===o)&&xf(r,e,t,i,n,s,a,o)}function Vg(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!Hg(r,e)&&(Wr(r,e)&&Wr(e,r)&&Gg(r,e)&&(zt(r.prev,r,e.prev)||zt(r,e.prev,e))||Ys(r,e)&&zt(r.prev,r,r.next)>0&&zt(e.prev,e,e.next)>0)}function zt(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Ys(r,e){return r.x===e.x&&r.y===e.y}function Mf(r,e,t,i){const n=Ha(zt(r,e,t)),s=Ha(zt(r,e,i)),a=Ha(zt(t,i,r)),o=Ha(zt(t,i,e));return!!(n!==s&&a!==o||n===0&&Va(r,t,e)||s===0&&Va(r,i,e)||a===0&&Va(t,r,i)||o===0&&Va(t,e,i))}function Va(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Ha(r){return r>0?1:r<0?-1:0}function Hg(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&Mf(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Wr(r,e){return zt(r.prev,r,r.next)<0?zt(r,e,r.next)>=0&&zt(r,r.prev,e)>=0:zt(r,e,r.prev)<0||zt(r,r.next,e)<0}function Gg(r,e){let t=r,i=!1;const n=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&n<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==r);return i}function Sf(r,e){const t=Uc(r.i,r.x,r.y),i=Uc(e.i,e.x,e.y),n=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=n,n.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function Mu(r,e,t,i){const n=Uc(r,e,t);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function Xr(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Uc(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Wg(r,e,t,i){let n=0;for(let s=e,a=t-i;s<t;s+=i)n+=(r[a]-r[s])*(r[s+1]+r[a+1]),a=s;return n}class Xg{static triangulate(e,t,i=2){return Cg(e,t,i)}}class Bi{static area(e){const t=e.length;let i=0;for(let n=t-1,s=0;s<t;n=s++)i+=e[n].x*e[s].y-e[s].x*e[n].y;return i*.5}static isClockWise(e){return Bi.area(e)<0}
vendor: 45,925 bytes, lines 5-9
5static triangulateShape(e,t){const i=[],n=[],s=[];Su(e),bu(i,e);let a=e.length;t.forEach(Su);for(let l=0;l<t.length;l++)n.push(a),a+=t[l].length,bu(i,t[l]);const o=Xg.triangulate(i,n);for(let l=0;l<o.length;l+=3)s.push(o.slice(l,l+3));return s}}function Su(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function bu(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class yl extends mt{constructor(e=new as([new se(.5,.5),new se(-.5,.5),new se(-.5,-.5),new se(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,n=[],s=[];for(let o=0,l=e.length;o<l;o++){const c=e[o];a(c)}this.setAttribute("position",new Ge(n,3)),this.setAttribute("uv",new Ge(s,2)),this.computeVertexNormals();function a(o){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,d=t.depth!==void 0?t.depth:1;let h=t.bevelEnabled!==void 0?t.bevelEnabled:!0,f=t.bevelThickness!==void 0?t.bevelThickness:.2,p=t.bevelSize!==void 0?t.bevelSize:f-.1,v=t.bevelOffset!==void 0?t.bevelOffset:0,g=t.bevelSegments!==void 0?t.bevelSegments:3;const m=t.extrudePath,_=t.UVGenerator!==void 0?t.UVGenerator:qg;let x,M=!1,R,E,I,y;if(m){x=m.getSpacedPoints(u),M=!0,h=!1;const ie=m.isCatmullRomCurve3?m.closed:!1;R=m.computeFrenetFrames(u,ie),E=new P,I=new P,y=new P}h||(g=0,f=0,p=0,v=0);const w=o.extractPoints(c);let U=w.shape;const L=w.holes;if(!Bi.isClockWise(U)){U=U.reverse();for(let ie=0,me=L.length;ie<me;ie++){const ae=L[ie];Bi.isClockWise(ae)&&(L[ie]=ae.reverse())}}function q(ie){const ae=10000000000000001e-36;let Fe=ie[0];for(let Pe=1;Pe<=ie.length;Pe++){const at=Pe%ie.length,N=ie[at],ht=N.x-Fe.x,We=N.y-Fe.y,it=ht*ht+We*We,_e=Math.max(Math.abs(N.x),Math.abs(N.y),Math.abs(Fe.x),Math.abs(Fe.y)),Et=ae*_e*_e;if(it<=Et){ie.splice(at,1),Pe--;continue}Fe=N}}q(U),L.forEach(q);const W=L.length,B=U;for(let ie=0;ie<W;ie++){const me=L[ie];U=U.concat(me)}function k(ie,me,ae){return me||Ze("ExtrudeGeometry: vec does not exist"),ie.clone().addScaledVector(me,ae)}const Y=U.length;function re(ie,me,ae){let Fe,Pe,at;const N=ie.x-me.x,ht=ie.y-me.y,We=ae.x-ie.x,it=ae.y-ie.y,_e=N*N+ht*ht,Et=N*it-ht*We;if(Math.abs(Et)>Number.EPSILON){const C=Math.sqrt(_e),b=Math.sqrt(We*We+it*it),X=me.x-ht/C,ee=me.y+N/C,oe=ae.x-it/b,xe=ae.y+We/b,Se=((oe-X)*it-(xe-ee)*We)/(N*it-ht*We);Fe=X+N*Se-ie.x,Pe=ee+ht*Se-ie.y;const $=Fe*Fe+Pe*Pe;if($<=2)return new se(Fe,Pe);at=Math.sqrt($/2)}else{let C=!1;N>Number.EPSILON?We>Number.EPSILON&&(C=!0):N<-Number.EPSILON?We<-Number.EPSILON&&(C=!0):Math.sign(ht)===Math.sign(it)&&(C=!0),C?(Fe=-ht,Pe=N,at=Math.sqrt(_e)):(Fe=N,Pe=ht,at=Math.sqrt(_e/2))}return new se(Fe/at,Pe/at)}const le=[];for(let ie=0,me=B.length,ae=me-1,Fe=ie+1;ie<me;ie++,ae++,Fe++)ae===me&&(ae=0),Fe===me&&(Fe=0),le[ie]=re(B[ie],B[ae],B[Fe]);const de=[];let De,Ue=le.concat();for(let ie=0,me=W;ie<me;ie++){const ae=L[ie];De=[];for(let Fe=0,Pe=ae.length,at=Pe-1,N=Fe+1;Fe<Pe;Fe++,at++,N++)at===Pe&&(at=0),N===Pe&&(N=0),De[Fe]=re(ae[Fe],ae[at],ae[N]);de.push(De),Ue=Ue.concat(De)}let Ke;if(g===0)Ke=Bi.triangulateShape(B,L);else{const ie=[],me=[];for(let ae=0;ae<g;ae++){const Fe=ae/g,Pe=f*Math.cos(Fe*Math.PI/2),at=p*Math.sin(Fe*Math.PI/2)+v;for(let N=0,ht=B.length;N<ht;N++){const We=k(B[N],le[N],at);qe(We.x,We.y,-Pe),Fe===0&&ie.push(We)}for(let N=0,ht=W;N<ht;N++){const We=L[N];De=de[N];const it=[];for(let _e=0,Et=We.length;_e<Et;_e++){const C=k(We[_e],De[_e],at);qe(C.x,C.y,-Pe),Fe===0&&it.push(C)}Fe===0&&me.push(it)}}Ke=Bi.triangulateShape(ie,me)}const yt=Ke.length,ot=p+v;for(let ie=0;ie<Y;ie++){const me=h?k(U[ie],Ue[ie],ot):U[ie];M?(I.copy(R.normals[0]).multiplyScalar(me.x),E.copy(R.binormals[0]).multiplyScalar(me.y),y.copy(x[0]).add(I).add(E),qe(y.x,y.y,y.z)):qe(me.x,me.y,0)}for(let ie=1;ie<=u;ie++)for(let me=0;me<Y;me++){const ae=h?k(U[me],Ue[me],ot):U[me];M?(I.copy(R.normals[ie]).multiplyScalar(ae.x),E.copy(R.binormals[ie]).multiplyScalar(ae.y),y.copy(x[ie]).add(I).add(E),qe(y.x,y.y,y.z)):qe(ae.x,ae.y,d/u*ie)}for(let ie=g-1;ie>=0;ie--){const me=ie/g,ae=f*Math.cos(me*Math.PI/2),Fe=p*Math.sin(me*Math.PI/2)+v;for(let Pe=0,at=B.length;Pe<at;Pe++){const N=k(B[Pe],le[Pe],Fe);qe(N.x,N.y,d+ae)}for(let Pe=0,at=L.length;Pe<at;Pe++){const N=L[Pe];De=de[Pe];for(let ht=0,We=N.length;ht<We;ht++){const it=k(N[ht],De[ht],Fe);M?qe(it.x,it.y+x[u-1].y,x[u-1].x+ae):qe(it.x,it.y,d+ae)}}}J(),Ie();function J(){const ie=n.length/3;if(h){let me=0,ae=Y*me;for(let Fe=0;Fe<yt;Fe++){const Pe=Ke[Fe];et(Pe[2]+ae,Pe[1]+ae,Pe[0]+ae)}me=u+g*2,ae=Y*me;for(let Fe=0;Fe<yt;Fe++){const Pe=Ke[Fe];et(Pe[0]+ae,Pe[1]+ae,Pe[2]+ae)}}else{for(let me=0;me<yt;me++){const ae=Ke[me];et(ae[2],ae[1],ae[0])}for(let me=0;me<yt;me++){const ae=Ke[me];et(ae[0]+Y*u,ae[1]+Y*u,ae[2]+Y*u)}}i.addGroup(ie,n.length/3-ie,0)}function Ie(){const ie=n.length/3;let me=0;ve(B,me),me+=B.length;for(let ae=0,Fe=L.length;ae<Fe;ae++){const Pe=L[ae];ve(Pe,me),me+=Pe.length}i.addGroup(ie,n.length/3-ie,1)}function ve(ie,me){let ae=ie.length;for(;--ae>=0;){const Fe=ae;let Pe=ae-1;Pe<0&&(Pe=ie.length-1);for(let at=0,N=u+g*2;at<N;at++){const ht=Y*at,We=Y*(at+1),it=me+Fe+ht,_e=me+Pe+ht,Et=me+Pe+We,C=me+Fe+We;Qe(it,_e,Et,C)}}}function qe(ie,me,ae){l.push(ie),l.push(me),l.push(ae)}function et(ie,me,ae){Tt(ie),Tt(me),Tt(ae);const Fe=n.length/3,Pe=_.generateTopUV(i,n,Fe-3,Fe-2,Fe-1);tt(Pe[0]),tt(Pe[1]),tt(Pe[2])}function Qe(ie,me,ae,Fe){Tt(ie),Tt(me),Tt(Fe),Tt(me),Tt(ae),Tt(Fe);const Pe=n.length/3,at=_.generateSideWallUV(i,n,Pe-6,Pe-3,Pe-2,Pe-1);tt(at[0]),tt(at[1]),tt(at[3]),tt(at[1]),tt(at[2]),tt(at[3])}function Tt(ie){n.push(l[ie*3+0]),n.push(l[ie*3+1]),n.push(l[ie*3+2])}function tt(ie){s.push(ie.x),s.push(ie.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return Yg(t,i,e)}static fromJSON(e,t){const i=[];for(let s=0,a=e.shapes.length;s<a;s++){const o=t[e.shapes[s]];i.push(o)}const n=e.options.extrudePath;return n!==void 0&&(e.options.extrudePath=new Zo[n.type]().fromJSON(n)),new yl(i,e.options)}}const qg={generateTopUV:function(r,e,t,i,n){const s=e[t*3],a=e[t*3+1],o=e[i*3],l=e[i*3+1],c=e[n*3],u=e[n*3+1];return[new se(s,a),new se(o,l),new se(c,u)]},generateSideWallUV:function(r,e,t,i,n,s){const a=e[t*3],o=e[t*3+1],l=e[t*3+2],c=e[i*3],u=e[i*3+1],d=e[i*3+2],h=e[n*3],f=e[n*3+1],p=e[n*3+2],v=e[s*3],g=e[s*3+1],m=e[s*3+2];return Math.abs(o-u)<Math.abs(a-c)?[new se(a,1-l),new se(c,1-d),new se(h,1-p),new se(v,1-m)]:[new se(o,1-l),new se(u,1-d),new se(f,1-p),new se(g,1-m)]}};function Yg(r,e,t){if(t.shapes=[],Array.isArray(r))for(let i=0,n=r.length;i<n;i++){const s=r[i];t.shapes.push(s.uuid)}else t.shapes.push(r.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class sa extends On{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,n=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(n,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new sa(e.radius,e.detail)}}class xl extends mt{constructor(e=[new se(0,-.5),new se(.5,0),new se(0,.5)],t=12,i=0,n=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:n},t=Math.floor(t),n=rt(n,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],u=1/t,d=new P,h=new se,f=new P,p=new P,v=new P;let g=0,m=0;for(let _=0;_<=e.length-1;_++)switch(_){case 0:g=e[_+1].x-e[_].x,m=e[_+1].y-e[_].y,f.x=m*1,f.y=-g,f.z=m*0,v.copy(f),f.normalize(),l.push(f.x,f.y,f.z);break;case e.length-1:l.push(v.x,v.y,v.z);break;default:g=e[_+1].x-e[_].x,m=e[_+1].y-e[_].y,f.x=m*1,f.y=-g,f.z=m*0,p.copy(f),f.x+=v.x,f.y+=v.y,f.z+=v.z,f.normalize(),l.push(f.x,f.y,f.z),v.copy(p)}for(let _=0;_<=t;_++){const x=i+_*u*n,M=Math.sin(x),R=Math.cos(x);for(let E=0;E<=e.length-1;E++){d.x=e[E].x*M,d.y=e[E].y,d.z=e[E].x*R,a.push(d.x,d.y,d.z),h.x=_/t,h.y=E/(e.length-1),o.push(h.x,h.y);const I=l[3*E+0]*M,y=l[3*E+1],w=l[3*E+0]*R;c.push(I,y,w)}}for(let _=0;_<t;_++)for(let x=0;x<e.length-1;x++){const M=x+_*e.length,R=M,E=M+e.length,I=M+e.length+1,y=M+1;s.push(R,E,y),s.push(I,y,E)}this.setIndex(s),this.setAttribute("position",new Ge(a,3)),this.setAttribute("uv",new Ge(o,2)),this.setAttribute("normal",new Ge(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new xl(e.points,e.segments,e.phiStart,e.phiLength)}}class ra extends On{constructor(e=1,t=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],n=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(i,n,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new ra(e.radius,e.detail)}}class Fn extends mt{constructor(e=1,t=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n};const s=e/2,a=t/2,o=Math.floor(i),l=Math.floor(n),c=o+1,u=l+1,d=e/o,h=t/l,f=[],p=[],v=[],g=[];for(let m=0;m<u;m++){const _=m*h-a;for(let x=0;x<c;x++){const M=x*d-s;p.push(M,-_,0),v.push(0,0,1),g.push(x/o),g.push(1-m/l)}}for(let m=0;m<l;m++)for(let _=0;_<o;_++){const x=_+c*m,M=_+c*(m+1),R=_+1+c*(m+1),E=_+1+c*m;f.push(x,M,E),f.push(M,R,E)}this.setIndex(f),this.setAttribute("position",new Ge(p,3)),this.setAttribute("normal",new Ge(v,3)),this.setAttribute("uv",new Ge(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Fn(e.width,e.height,e.widthSegments,e.heightSegments)}}class Ml extends mt{constructor(e=.5,t=1,i=32,n=1,s=0,a=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:n,thetaStart:s,thetaLength:a},i=Math.max(3,i),n=Math.max(1,n);const o=[],l=[],c=[],u=[];let d=e;const h=(t-e)/n,f=new P,p=new se;for(let v=0;v<=n;v++){for(let g=0;g<=i;g++){const m=s+g/i*a;f.x=d*Math.cos(m),f.y=d*Math.sin(m),l.push(f.x,f.y,f.z),c.push(0,0,1),p.x=(f.x/t+1)/2,p.y=(f.y/t+1)/2,u.push(p.x,p.y)}d+=h}for(let v=0;v<n;v++){const g=v*(i+1);for(let m=0;m<i;m++){const _=m+g,x=_,M=_+i+1,R=_+i+2,E=_+1;o.push(x,M,E),o.push(M,R,E)}}this.setIndex(o),this.setAttribute("position",new Ge(l,3)),this.setAttribute("normal",new Ge(c,3)),this.setAttribute("uv",new Ge(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ml(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Sl extends mt{constructor(e=new as([new se(0,.5),new se(-.5,-.5),new se(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],n=[],s=[],a=[];let o=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(o,l,u),o+=l,l=0;this.setIndex(i),this.setAttribute("position",new Ge(n,3)),this.setAttribute("normal",new Ge(s,3)),this.setAttribute("uv",new Ge(a,2));function c(u){const d=n.length/3,h=u.extractPoints(t);let f=h.shape;const p=h.holes;Bi.isClockWise(f)===!1&&(f=f.reverse());for(let g=0,m=p.length;g<m;g++){const _=p[g];Bi.isClockWise(_)===!0&&(p[g]=_.reverse())}const v=Bi.triangulateShape(f,p);for(let g=0,m=p.length;g<m;g++){const _=p[g];f=f.concat(_)}for(let g=0,m=f.length;g<m;g++){const _=f[g];n.push(_.x,_.y,0),s.push(0,0,1),a.push(_.x,_.y)}for(let g=0,m=v.length;g<m;g++){const _=v[g],x=_[0]+d,M=_[1]+d,R=_[2]+d;i.push(x,M,R),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return Zg(t,e)}static fromJSON(e,t){const i=[];for(let n=0,s=e.shapes.length;n<s;n++){const a=t[e.shapes[n]];i.push(a)}return new Sl(i,e.curveSegments)}}function Zg(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,i=r.length;t<i;t++){const n=r[t];e.shapes.push(n.uuid)}else e.shapes.push(r.uuid);return e}class aa extends mt{constructor(e=1,t=32,i=16,n=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:n,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(a+o,Math.PI);let c=0;const u=[],d=new P,h=new P,f=[],p=[],v=[],g=[];for(let m=0;m<=i;m++){const _=[],x=m/i;let M=0;m===0&&a===0?M=.5/t:m===i&&l===Math.PI&&(M=-.5/t);for(let R=0;R<=t;R++){const E=R/t;d.x=-e*Math.cos(n+E*s)*Math.sin(a+x*o),d.y=e*Math.cos(a+x*o),d.z=e*Math.sin(n+E*s)*Math.sin(a+x*o),p.push(d.x,d.y,d.z),h.copy(d).normalize(),v.push(h.x,h.y,h.z),g.push(E+M,1-x),_.push(c++)}u.push(_)}for(let m=0;m<i;m++)for(let _=0;_<t;_++){const x=u[m][_+1],M=u[m][_],R=u[m+1][_],E=u[m+1][_+1];(m!==0||a>0)&&f.push(x,M,E),(m!==i-1||l<Math.PI)&&f.push(M,R,E)}this.setIndex(f),this.setAttribute("position",new Ge(p,3)),this.setAttribute("normal",new Ge(v,3)),this.setAttribute("uv",new Ge(g,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new aa(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class bl extends On{constructor(e=1,t=0){const i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],n=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,n,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new bl(e.radius,e.detail)}}class Tl extends mt{constructor(e=1,t=.4,i=12,n=48,s=Math.PI*2,a=0,o=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:n,arc:s,thetaStart:a,thetaLength:o},i=Math.floor(i),n=Math.floor(n);const l=[],c=[],u=[],d=[],h=new P,f=new P,p=new P;for(let v=0;v<=i;v++){const g=a+v/i*o;for(let m=0;m<=n;m++){const _=m/n*s;f.x=(e+t*Math.cos(g))*Math.cos(_),f.y=(e+t*Math.cos(g))*Math.sin(_),f.z=t*Math.sin(g),c.push(f.x,f.y,f.z),h.x=e*Math.cos(_),h.y=e*Math.sin(_),p.subVectors(f,h).normalize(),u.push(p.x,p.y,p.z),d.push(m/n),d.push(v/i)}}for(let v=1;v<=i;v++)for(let g=1;g<=n;g++){const m=(n+1)*v+g-1,_=(n+1)*(v-1)+g-1,x=(n+1)*(v-1)+g,M=(n+1)*v+g;l.push(m,_,M),l.push(_,x,M)}this.setIndex(l),this.setAttribute("position",new Ge(c,3)),this.setAttribute("normal",new Ge(u,3)),this.setAttribute("uv",new Ge(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Tl(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class wl extends mt{constructor(e=1,t=.4,i=64,n=8,s=2,a=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:n,p:s,q:a},i=Math.floor(i),n=Math.floor(n);const o=[],l=[],c=[],u=[],d=new P,h=new P,f=new P,p=new P,v=new P,g=new P,m=new P;for(let x=0;x<=i;++x){const M=x/i*s*Math.PI*2;_(M,s,a,e,f),_(M+.01,s,a,e,p),g.subVectors(p,f),m.addVectors(p,f),v.crossVectors(g,m),m.crossVectors(v,g),v.normalize(),m.normalize();for(let R=0;R<=n;++R){const E=R/n*Math.PI*2,I=-t*Math.cos(E),y=t*Math.sin(E);d.x=f.x+(I*m.x+y*v.x),d.y=f.y+(I*m.y+y*v.y),d.z=f.z+(I*m.z+y*v.z),l.push(d.x,d.y,d.z),h.subVectors(d,f).normalize(),c.push(h.x,h.y,h.z),u.push(x/i),u.push(R/n)}}for(let x=1;x<=i;x++)for(let M=1;M<=n;M++){const R=(n+1)*(x-1)+(M-1),E=(n+1)*x+(M-1),I=(n+1)*x+M,y=(n+1)*(x-1)+M;o.push(R,E,y),o.push(E,I,y)}this.setIndex(o),this.setAttribute("position",new Ge(l,3)),this.setAttribute("normal",new Ge(c,3)),this.setAttribute("uv",new Ge(u,2));function _(x,M,R,E,I){const y=Math.cos(x),w=Math.sin(x),U=R/M*x,L=Math.cos(U);I.x=E*(2+L)*.5*y,I.y=E*(2+L)*w*.5,I.z=E*Math.sin(U)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new wl(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class El extends mt{constructor(e=new ph(new P(-1,-1,0),new P(-1,1,0),new P(1,1,0)),t=64,i=1,n=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:n,closed:s};const a=e.computeFrenetFrames(t,s);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const o=new P,l=new P,c=new se;let u=new P;const d=[],h=[],f=[],p=[];v(),this.setIndex(p),this.setAttribute("position",new Ge(d,3)),this.setAttribute("normal",new Ge(h,3)),this.setAttribute("uv",new Ge(f,2));function v(){for(let x=0;x<t;x++)g(x);g(s===!1?t:0),_(),m()}function g(x){u=e.getPointAt(x/t,u);const M=a.normals[x],R=a.binormals[x];for(let E=0;E<=n;E++){const I=E/n*Math.PI*2,y=Math.sin(I),w=-Math.cos(I);l.x=w*M.x+y*R.x,l.y=w*M.y+y*R.y,l.z=w*M.z+y*R.z,l.normalize(),h.push(l.x,l.y,l.z),o.x=u.x+i*l.x,o.y=u.y+i*l.y,o.z=u.z+i*l.z,d.push(o.x,o.y,o.z)}}function m(){for(let x=1;x<=t;x++)for(let M=1;M<=n;M++){const R=(n+1)*(x-1)+(M-1),E=(n+1)*x+(M-1),I=(n+1)*x+M,y=(n+1)*(x-1)+M;p.push(R,E,y),p.push(E,I,y)}}function _(){for(let x=0;x<=t;x++)for(let M=0;M<=n;M++)c.x=x/t,c.y=M/n,f.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new El(new Zo[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class bf extends mt{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,n=new P,s=new P;if(e.index!==null){const a=e.attributes.position,o=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:o.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const d=l[c],h=d.start,f=d.count;for(let p=h,v=h+f;p<v;p+=3)for(let g=0;g<3;g++){const m=o.getX(p+g),_=o.getX(p+(g+1)%3);n.fromBufferAttribute(a,m),s.fromBufferAttribute(a,_),Tu(n,s,i)===!0&&(t.push(n.x,n.y,n.z),t.push(s.x,s.y,s.z))}}}else{const a=e.attributes.position;for(let o=0,l=a.count/3;o<l;o++)for(let c=0;c<3;c++){const u=3*o+c,d=3*o+(c+1)%3;n.fromBufferAttribute(a,u),s.fromBufferAttribute(a,d),Tu(n,s,i)===!0&&(t.push(n.x,n.y,n.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new Ge(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function Tu(r,e,t){const i=`${r.x},${r.y},${r.z}-${e.x},${e.y},${e.z}`,n=`${e.x},${e.y},${e.z}-${r.x},${r.y},${r.z}`;return t.has(i)===!0||t.has(n)===!0?!1:(t.add(i),t.add(n),!0)}var wu=Object.freeze({__proto__:null,BoxGeometry:ds,CapsuleGeometry:ml,CircleGeometry:gl,ConeGeometry:na,CylinderGeometry:ia,DodecahedronGeometry:vl,EdgesGeometry:ff,ExtrudeGeometry:yl,IcosahedronGeometry:sa,LatheGeometry:xl,OctahedronGeometry:ra,PlaneGeometry:Fn,PolyhedronGeometry:On,RingGeometry:Ml,ShapeGeometry:Sl,SphereGeometry:aa,TetrahedronGeometry:bl,TorusGeometry:Tl,TorusKnotGeometry:wl,TubeGeometry:El,WireframeGeometry:bf});class Tf extends li{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new He(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}function Zs(r){const e={};for(const t in r){e[t]={};for(const i in r[t]){const n=r[t][i];if(Eu(n))n.isRenderTargetTexture?(Re("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=n.clone();else if(Array.isArray(n))if(Eu(n[0])){const s=[];for(let a=0,o=n.length;a<o;a++)s[a]=n[a].clone();e[t][i]=s}else e[t][i]=n.slice();else e[t][i]=n}}return e}function ui(r){const e={};for(let t=0;t<r.length;t++){const i=Zs(r[t]);for(const n in i)e[n]=i[n]}return e}function Eu(r){return r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)}function Jg(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function wf(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:bt.workingColorSpace}const Ef={clone:Zs,merge:ui};var $g=`void main() {
6	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
7}`,Kg=`void main() {
8	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
9}`;class vi extends li{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=$g,this.fragmentShader=Kg,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,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Zs(e.uniforms),this.uniformsGroups=Jg(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.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const n in this.uniforms){const a=this.uniforms[n].value;a&&a.isTexture?t.uniforms[n]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[n]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[n]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[n]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[n]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[n]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[n]={type:"m4",value:a.toArray()}:t.uniforms[n]={value:a}}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;const i={};for(const n in this.extensions)this.extensions[n]===!0&&(i[n]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class gh extends vi{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class vh extends li{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new He(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=dn,this.normalScale=new se(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 Vi,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}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}}class Af extends vh{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 se(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return rt(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new He(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 He(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new He(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}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 dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=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.dispersion=e.dispersion,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}}class Cf extends li{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new He(16777215),this.specular=new He(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=dn,this.normalScale=new se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Vi,this.combine=Kr,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,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.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.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,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}}class Rf extends li{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new He(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=dn,this.normalScale=new se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,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.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class If extends li{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=dn,this.normalScale=new se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),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.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Pf extends li{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new He(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=dn,this.normalScale=new se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Vi,this.combine=Kr,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}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.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.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.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,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}}class _h extends li{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Gd,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}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}}class yh extends li{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)}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}}class Lf extends li{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new He(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=dn,this.normalScale=new se(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,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.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Uf extends _i{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function ns(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function Nf(r){function e(n,s){return r[n]-r[s]}const t=r.length,i=new Array(t);for(let n=0;n!==t;++n)i[n]=n;return i.sort(e),i}function Nc(r,e,t){const i=r.length,n=new r.constructor(i);for(let s=0,a=0;a!==i;++s){const o=t[s]*e;for(let l=0;l!==e;++l)n[a++]=r[o+l]}return n}function xh(r,e,t,i){let n=1,s=r[0];for(;s!==void 0&&s[i]===void 0;)s=r[n++];if(s===void 0)return;let a=s[i];if(a!==void 0)if(Array.isArray(a))do a=s[i],a!==void 0&&(e.push(s.time),t.push(...a)),s=r[n++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[i],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=r[n++];while(s!==void 0);else do a=s[i],a!==void 0&&(e.push(s.time),t.push(a)),s=r[n++];while(s!==void 0)}function Qg(r,e,t,i,n=30){const s=r.clone();s.name=e;const a=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],u=c.getValueSize(),d=[],h=[];for(let f=0;f<c.times.length;++f){const p=c.times[f]*n;if(!(p<t||p>=i)){d.push(c.times[f]);for(let v=0;v<u;++v)h.push(c.values[f*u+v])}}d.length!==0&&(c.times=ns(d,c.times.constructor),c.values=ns(h,c.values.constructor),a.push(c))}s.tracks=a;let o=1/0;for(let l=0;l<s.tracks.length;++l)o>s.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*o);return s.resetDuration(),s}function jg(r,e=0,t=r,i=30){i<=0&&(i=30);const n=t.tracks.length,s=e/i;for(let a=0;a<n;++a){const o=t.tracks[a],l=o.ValueTypeName;if(l==="bool"||l==="string")continue;const c=r.tracks.find(function(m){return m.name===o.name&&m.ValueTypeName===l});if(c===void 0)continue;let u=0;const d=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=d/3);let h=0;const f=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(h=f/3);const p=o.times.length-1;let v;if(s<=o.times[0]){const m=u,_=d-u;v=o.values.slice(m,_)}else if(s>=o.times[p]){const m=p*d+u,_=m+d-u;v=o.values.slice(m,_)}else{const m=o.createInterpolant(),_=u,x=d-u;m.evaluate(s),v=m.resultBuffer.slice(_,x)}l==="quaternion"&&new mi().fromArray(v).normalize().conjugate().toArray(v);const g=c.times.length;for(let m=0;m<g;++m){const _=m*f+h;if(l==="quaternion")mi.multiplyQuaternionsFlat(c.values,_,v,0,c.values,_);else{const x=f-h*2;for(let M=0;M<x;++M)c.values[_+M]-=v[M]}}}return r.blendMode=eh,r}class ev{static convertArray(e,t){return ns(e,t)}static isTypedArray(e){return Kd(e)}static getKeyframeOrder(e){return Nf(e)}static sortedArray(e,t,i){return Nc(e,t,i)}static flattenJSON(e,t,i,n){xh(e,t,i,n)}static subclip(e,t,i,n,s=30){return Qg(e,t,i,n,s)}static makeClipAdditive(e,t=0,i=e,n=30){return jg(e,t,i,n)}}class Qs{constructor(e,t,i,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=n!==void 0?n:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,n=t[i],s=t[i-1];e:{t:{let a;i:{n:if(!(e<n)){for(let o=i+2;;){if(n===void 0){if(e<s)break n;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===o)break;if(s=n,n=t[++i],e<n)break t}a=t.length;break i}if(!(e>=s)){const o=t[1];e<o&&(i=2,s=o);for(let l=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(n=s,s=t[--i-1],e>=s)break t}a=i,i=0;break i}break e}for(;i<a;){const o=i+a>>>1;e<t[o]?a=o:i=o+1}if(n=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,n)}return this.interpolate_(i,s,e,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,s=e*n;for(let a=0;a!==n;++a)t[a]=i[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Df extends Qs{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:es,endingEnd:es}}intervalChanged_(e,t,i){const n=this.parameterPositions;let s=e-2,a=e+1,o=n[s],l=n[a];if(o===void 0)switch(this.getSettings_().endingStart){case ts:s=e,o=2*t-i;break;case Br:s=n.length-2,o=t+n[s]-n[s+1];break;default:s=e,o=i}if(l===void 0)switch(this.getSettings_().endingEnd){case ts:a=e,l=2*i-t;break;case Br:a=1,l=i+n[1]-n[0];break;default:a=e-1,l=t}const c=(i-t)*.5,u=this.valueSize;this._weightPrev=c/(t-o),this._weightNext=c/(l-i),this._offsetPrev=s*u,this._offsetNext=a*u}interpolate_(e,t,i,n){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=this._offsetPrev,d=this._offsetNext,h=this._weightPrev,f=this._weightNext,p=(i-t)/(n-t),v=p*p,g=v*p,m=-h*g+2*h*v-h*p,_=(1+h)*g+(-1.5-2*h)*v+(-.5+h)*p+1,x=(-1-f)*g+(1.5+f)*v+.5*p,M=f*g-f*v;for(let R=0;R!==o;++R)s[R]=m*a[u+R]+_*a[c+R]+x*a[l+R]+M*a[d+R];return s}}class Mh extends Qs{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=(i-t)/(n-t),d=1-u;for(let h=0;h!==o;++h)s[h]=a[c+h]*d+a[l+h]*u;return s}}class Of extends Qs{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e){return this.copySampleValue_(e-1)}}class Ff extends Qs{interpolate_(e,t,i,n){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=e*o,c=l-o,u=this.settings||this.DefaultSettings_,d=u.inTangents,h=u.outTangents;if(!d||!h){const v=(i-t)/(n-t),g=1-v;for(let m=0;m!==o;++m)s[m]=a[c+m]*g+a[l+m]*v;return s}const f=o*2,p=e-1;for(let v=0;v!==o;++v){const g=a[c+v],m=a[l+v],_=p*f+v*2,x=h[_],M=h[_+1],R=e*f+v*2,E=d[R],I=d[R+1];let y=(i-t)/(n-t),w,U,L,O,q;for(let W=0;W<8;W++){w=y*y,U=w*y,L=1-y,O=L*L,q=O*L;const k=q*t+3*O*y*x+3*L*w*E+U*n-i;if(Math.abs(k)<1e-10)break;const Y=3*O*(x-t)+6*L*y*(E-x)+3*w*(n-E);if(Math.abs(Y)<1e-10)break;y=y-k/Y,y=Math.max(0,Math.min(1,y))}s[v]=q*g+3*O*y*M+3*L*w*I+U*m}return s}}class Pi{constructor(e,t,i,n){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=ns(t,this.TimeBufferType),this.values=ns(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:ns(e.times,Array),values:ns(e.values,Array)};const n=e.getInterpolation();n!==e.DefaultInterpolation&&(i.interpolation=n)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new Of(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Mh(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Df(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){const t=new Ff(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.settings=this.settings),t}setInterpolation(e){let t;switch(e){case Fr:t=this.InterpolantFactoryMethodDiscrete;break;case Wo:t=this.InterpolantFactoryMethodLinear;break;case to:t=this.InterpolantFactoryMethodSmooth;break;case Cc:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){const i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return Re("KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Fr;case this.InterpolantFactoryMethodLinear:return Wo;case this.InterpolantFactoryMethodSmooth:return to;case this.InterpolantFactoryMethodBezier:return Cc}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,n=t.length;i!==n;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,n=t.length;i!==n;++i)t[i]*=e}return this}trim(e,t){const i=this.times,n=i.length;let s=0,a=n-1;for(;s!==n&&i[s]<e;)++s;for(;a!==-1&&i[a]>t;)--a;if(++a,s!==0||a!==n){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=i.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(Ze("KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,n=this.values,s=i.length;s===0&&(Ze("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=i[o];if(typeof l=="number"&&isNaN(l)){Ze("KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){Ze("KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(n!==void 0&&Kd(n))for(let o=0,l=n.length;o!==l;++o){const c=n[o];if(isNaN(c)){Ze("KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),n=this.getInterpolation()===to,s=e.length-1;let a=1;for(let o=1;o<s;++o){let l=!1;const c=e[o],u=e[o+1];if(c!==u&&(o!==1||c!==e[0]))if(n)l=!0;else{const d=o*i,h=d-i,f=d+i;for(let p=0;p!==i;++p){const v=t[d+p];if(v!==t[h+p]||v!==t[f+p]){l=!0;break}}}if(l){if(o!==a){e[a]=e[o];const d=o*i,h=a*i;for(let f=0;f!==i;++f)t[h+f]=t[d+f]}++a}}if(s>0){e[a]=e[s];for(let o=s*i,l=a*i,c=0;c!==i;++c)t[l+c]=t[o+c];++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(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,n=new i(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}Pi.prototype.ValueTypeName="";Pi.prototype.TimeBufferType=Float32Array;Pi.prototype.ValueBufferType=Float32Array;Pi.prototype.DefaultInterpolation=Wo;class fs extends Pi{constructor(e,t,i){super(e,t,i)}}fs.prototype.ValueTypeName="bool";fs.prototype.ValueBufferType=Array;fs.prototype.DefaultInterpolation=Fr;fs.prototype.InterpolantFactoryMethodLinear=void 0;fs.prototype.InterpolantFactoryMethodSmooth=void 0;class Sh extends Pi{constructor(e,t,i,n){super(e,t,i,n)}}Sh.prototype.ValueTypeName="color";class qr extends Pi{constructor(e,t,i,n){super(e,t,i,n)}}qr.prototype.ValueTypeName="number";class Bf extends Qs{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(i-t)/(n-t);let c=e*o;for(let u=c+o;c!==u;
vendor: 4,492 bytes, line 9
9c+=4)mi.slerpFlat(s,0,a,c-o,a,c,l);return s}}class oa extends Pi{constructor(e,t,i,n){super(e,t,i,n)}InterpolantFactoryMethodLinear(e){return new Bf(this.times,this.values,this.getValueSize(),e)}}oa.prototype.ValueTypeName="quaternion";oa.prototype.InterpolantFactoryMethodSmooth=void 0;class ps extends Pi{constructor(e,t,i){super(e,t,i)}}ps.prototype.ValueTypeName="string";ps.prototype.ValueBufferType=Array;ps.prototype.DefaultInterpolation=Fr;ps.prototype.InterpolantFactoryMethodLinear=void 0;ps.prototype.InterpolantFactoryMethodSmooth=void 0;class Yr extends Pi{constructor(e,t,i,n){super(e,t,i,n)}}Yr.prototype.ValueTypeName="vector";class Zr{constructor(e="",t=-1,i=[],n=nl){this.name=e,this.tracks=i,this.duration=t,this.blendMode=n,this.uuid=Ei(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,n=1/(e.fps||1);for(let a=0,o=i.length;a!==o;++a)t.push(iv(i[a]).scale(n));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){const t=[],i=e.tracks,n={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,a=i.length;s!==a;++s)t.push(Pi.toJSON(i[s]));return n}static CreateFromMorphTargetSequence(e,t,i,n){const s=t.length,a=[];for(let o=0;o<s;o++){let l=[],c=[];l.push((o+s-1)%s,o,(o+1)%s),c.push(0,1,0);const u=Nf(l);l=Nc(l,1,u),c=Nc(c,1,u),!n&&l[0]===0&&(l.push(s),c.push(c[0])),a.push(new qr(".morphTargetInfluences["+t[o].name+"]",l,c).scale(1/i))}return new this(e,-1,a)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const n=e;i=n.geometry&&n.geometry.animations||n.animations}for(let n=0;n<i.length;n++)if(i[n].name===t)return i[n];return null}static CreateClipsFromMorphTargetSequences(e,t,i){const n={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,l=e.length;o<l;o++){const c=e[o],u=c.name.match(s);if(u&&u.length>1){const d=u[1];let h=n[d];h||(n[d]=h=[]),h.push(c)}}const a=[];for(const o in n)a.push(this.CreateFromMorphTargetSequence(o,n[o],t,i));return a}static parseAnimation(e,t){if(Re("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Ze("AnimationClip: No animation in JSONLoader data."),null;const i=function(d,h,f,p,v){if(f.length!==0){const g=[],m=[];xh(f,g,m,p),g.length!==0&&v.push(new d(h,g,m))}},n=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let d=0;d<c.length;d++){const h=c[d].keys;if(!(!h||h.length===0))if(h[0].morphTargets){const f={};let p;for(p=0;p<h.length;p++)if(h[p].morphTargets)for(let v=0;v<h[p].morphTargets.length;v++)f[h[p].morphTargets[v]]=-1;for(const v in f){const g=[],m=[];for(let _=0;_!==h[p].morphTargets.length;++_){const x=h[p];g.push(x.time),m.push(x.morphTarget===v?1:0)}n.push(new qr(".morphTargetInfluence["+v+"]",g,m))}l=f.length*a}else{const f=".bones["+t[d].name+"]";i(Yr,f+".position",h,"pos",n),i(oa,f+".quaternion",h,"rot",n),i(Yr,f+".scale",h,"scl",n)}}return n.length===0?null:new this(s,l,n,o)}resetDuration(){const e=this.tracks;let t=0;for(let i=0,n=e.length;i!==n;++i){const s=this.tracks[i];t=Math.max(t,s.times[s.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(){const e=[];for(let i=0;i<this.tracks.length;i++)e.push(this.tracks[i].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function tv(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return qr;case"vector":case"vector2":case"vector3":case"vector4":return Yr;case"color":return Sh;case"quaternion":return oa;case"bool":case"boolean":return fs;case"string":return ps}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function iv(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=tv(r.type);if(r.times===void 0){const t=[],i=[];xh(r.keys,t,i,"value"),r.times=t,r.values=i}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const Ki={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(Au(r)||(this.files[r]=e))}
vendor: 7,021 bytes, line 9
9,get:function(r){if(this.enabled!==!1&&!Au(r))return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};function Au(r){try{const e=r.slice(r.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class Al{constructor(e,t,i){const n=this;let s=!1,a=0,o=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this._abortController=null,this.itemStart=function(u){o++,s===!1&&n.onStart!==void 0&&n.onStart(u,a,o),s=!0},this.itemEnd=function(u){a++,n.onProgress!==void 0&&n.onProgress(u,a,o),a===o&&(s=!1,n.onLoad!==void 0&&n.onLoad())},this.itemError=function(u){n.onError!==void 0&&n.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,d){return c.push(u,d),this},this.removeHandler=function(u){const d=c.indexOf(u);return d!==-1&&c.splice(d,2),this},this.getHandler=function(u){for(let d=0,h=c.length;d<h;d+=2){const f=c[d],p=c[d+1];if(f.global&&(f.lastIndex=0),f.test(u))return p}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const zf=new Al;class yi{constructor(e){this.manager=e!==void 0?e:zf,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){const i=this;return new Promise(function(n,s){i.load(e,n,t,s)})}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}abort(){return this}}yi.DEFAULT_MATERIAL_NAME="__DEFAULT";const on={};class nv extends Error{constructor(e,t){super(e),this.response=t}}class Ai extends yi{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,i,n){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Ki.get(`file:${e}`);if(s!==void 0){this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0);return}if(on[e]!==void 0){on[e].push({onLoad:t,onProgress:i,onError:n});return}on[e]=[],on[e].push({onLoad:t,onProgress:i,onError:n});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,l=this.responseType;fetch(a).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&Re("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=on[e],d=c.body.getReader(),h=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),f=h?parseInt(h):0,p=f!==0;let v=0;const g=new ReadableStream({start(m){_();function _(){d.read().then(({done:x,value:M})=>{if(x)m.close();else{v+=M.byteLength;const R=new ProgressEvent("progress",{lengthComputable:p,loaded:v,total:f});for(let E=0,I=u.length;E<I;E++){const y=u[E];y.onProgress&&y.onProgress(R)}m.enqueue(M),_()}},x=>{m.error(x)})}}});return new Response(g)}else throw new nv(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,o));case"json":return c.json();default:if(o==="")return c.text();{const d=/charset="?([^;"\s]*)"?/i.exec(o),h=d&&d[1]?d[1].toLowerCase():void 0,f=new TextDecoder(h);return c.arrayBuffer().then(p=>f.decode(p))}}}).then(c=>{Ki.add(`file:${e}`,c);const u=on[e];delete on[e];for(let d=0,h=u.length;d<h;d++){const f=u[d];f.onLoad&&f.onLoad(c)}}).catch(c=>{const u=on[e];if(u===void 0)throw this.manager.itemError(e),c;delete on[e];for(let d=0,h=u.length;d<h;d++){const f=u[d];f.onError&&f.onError(c)}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}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class sv extends yi{constructor(e){super(e)}load(e,t,i,n){const s=this,a=new Ai(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){n?n(l):Ze(l),s.manager.itemError(e)}},i,n)}parse(e){const t=[];for(let i=0;i<e.length;i++){const n=Zr.parse(e[i]);t.push(n)}return t}}class rv extends yi{constructor(e){super(e)}load(e,t,i,n){const s=this,a=[],o=new pl,l=new Ai(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function u(d){l.load(e[d],function(h){const f=s.parse(h,!0);a[d]={width:f.width,height:f.height,format:f.format,mipmaps:f.mipmaps},c+=1,c===6&&(f.mipmapCount===1&&(o.minFilter=wt),o.image=a,o.format=f.format,o.needsUpdate=!0,t&&t(o))},i,n)}if(Array.isArray(e))for(let d=0,h=e.length;d<h;++d)u(d);else l.load(e,function(d){const h=s.parse(d,!0);if(h.isCubemap){const f=h.mipmaps.length/h.mipmapCount;for(let p=0;p<f;p++){a[p]={mipmaps:[]};for(let v=0;v<h.mipmapCount;v++)a[p].mipmaps.push(h.mipmaps[p*h.mipmapCount+v]),a[p].format=h.format,a[p].width=h.width,a[p].height=h.height}o.image=a}else o.image.width=h.width,o.image.height=h.height,o.mipmaps=h.mipmaps;h.mipmapCount===1&&(o.minFilter=wt),o.format=h.format,o.needsUpdate=!0,t&&t(o)},i,n);return o}}const Ls=new WeakMap;class Jr extends yi{constructor(e){super(e)}load(e,t,i,n){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Ki.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0);else{let d=Ls.get(a);d===void 0&&(d=[],Ls.set(a,d)),d.push({onLoad:t,onError:n})}return a}const o=Vr("img");function l(){u(),t&&t(this);const d=Ls.get(this)||[];for(let h=0;h<d.length;h++){const f=d[h];f.onLoad&&f.onLoad(this)}Ls.delete(this),s.manager.itemEnd(e)}function c(d){u(),n&&n(d),Ki.remove(`image:${e}`);const h=Ls.get(this)||[];for(let f=0;f<h.length;f++){const p=h[f];p.onError&&p.onError(d)}Ls.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){o.removeEventListener("load",l,!1),o.removeEventListener("error",c,!1)}return o.addEventListener("load",l,!1),o.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),Ki.add(`image:${e}`,o),s.manager.itemStart(e),o.src=e,o}}class av extends yi{constructor(e){super(e)}load(e,t,i,n){const s=new ta;
vendor: 5,912 bytes, line 9
9s.colorSpace=di;const a=new Jr(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);let o=0;function l(c){a.load(e[c],function(u){s.images[c]=u,o++,o===6&&(s.needsUpdate=!0,t&&t(s))},void 0,n)}for(let c=0;c<e.length;++c)l(c);return s}}class bh extends yi{constructor(e){super(e)}load(e,t,i,n){const s=this,a=new Ii,o=new Ai(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(l){let c;try{c=s.parse(l)}catch(u){n!==void 0?n(u):Ze(u);return}c.image!==void 0?a.image=c.image:c.data!==void 0&&(a.image.width=c.width,a.image.height=c.height,a.image.data=c.data),a.wrapS=c.wrapS!==void 0?c.wrapS:Gt,a.wrapT=c.wrapT!==void 0?c.wrapT:Gt,a.magFilter=c.magFilter!==void 0?c.magFilter:wt,a.minFilter=c.minFilter!==void 0?c.minFilter:wt,a.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(a.colorSpace=c.colorSpace),c.flipY!==void 0&&(a.flipY=c.flipY),c.format!==void 0&&(a.format=c.format),c.type!==void 0&&(a.type=c.type),c.mipmaps!==void 0&&(a.mipmaps=c.mipmaps,a.minFilter=$i),c.mipmapCount===1&&(a.minFilter=wt),c.generateMipmaps!==void 0&&(a.generateMipmaps=c.generateMipmaps),a.needsUpdate=!0,t&&t(a,c)},i,n),a}}class ov extends yi{constructor(e){super(e)}load(e,t,i,n){const s=new Lt,a=new Jr(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},i,n),s}}class Bn extends Ct{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new He(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class kf extends Bn{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Ct.DEFAULT_UP),this.updateMatrix(),this.groundColor=new He(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){const t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}const cc=new ct,Cu=new P,Ru=new P;class Th{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new se(512,512),this.mapType=ii,this.map=null,this.mapPass=null,this.matrix=new ct,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ks,this._frameExtents=new se(1,1),this._viewportCount=1,this._viewports=[new Pt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;Cu.setFromMatrixPosition(e.matrixWorld),t.position.copy(Cu),Ru.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(Ru),t.updateMatrixWorld(),cc.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(cc,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===ls||t.reversedDepth?i.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(cc)}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.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const Ga=new P,Wa=new mi,Zi=new P;class Cl extends Ct{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ct,this.projectionMatrix=new ct,this.projectionMatrixInverse=new ct,this.coordinateSystem=wi,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}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.matrixWorld.decompose(Ga,Wa,Zi),Zi.x===1&&Zi.y===1&&Zi.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Ga,Wa,Zi.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(Ga,Wa,Zi),Zi.x===1&&Zi.y===1&&Zi.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Ga,Wa,Zi.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const bn=new P,Iu=new se,Pu=new se;class ti extends Cl{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()}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=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Xs*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(rs*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 4,977 bytes, line 9
9getEffectiveFOV(){return Xs*2*Math.atan(Math.tan(rs*.5*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){bn.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(bn.x,bn.y).multiplyScalar(-e/bn.z),bn.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(bn.x,bn.y).multiplyScalar(-e/bn.z)}getViewSize(e,t){return this.getViewBounds(e,Iu,Pu),t.subVectors(Pu,Iu)}setViewOffset(e,t,i,n,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(rs*.5*this.fov)/this.zoom,i=2*t,n=this.aspect*i,s=-.5*n;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*n/l,t-=a.offsetY*i/c,n*=a.width/l,i*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+n,t,t-i,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const 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,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class lv extends Th{constructor(){super(new ti(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,i=Xs*2*e.angle*this.focus,n=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(i!==t.fov||n!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=n,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Vf extends Bn{constructor(e,t,i=0,n=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Ct.DEFAULT_UP),this.updateMatrix(),this.target=new Ct,this.distance=i,this.angle=n,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new lv}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.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.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class cv extends Th{constructor(){super(new ti(90,1,.5,500)),this.isPointLightShadow=!0}}class Hf extends Bn{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 cv}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.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}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class js extends Cl{constructor(e=-1,t=1,i=1,n=-1,s=.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=s,this.far=a,this.updateProjectionMatrix()}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=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,n,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const 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;let s=i-e,a=i+e,o=n+t,l=n-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}
vendor: 19,279 bytes, line 9
9this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const 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,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class hv extends Th{constructor(){super(new js(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Gf extends Bn{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ct.DEFAULT_UP),this.updateMatrix(),this.target=new Ct,this.shadow=new hv}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class Wf extends Bn{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Xf extends Bn{constructor(e,t,i=10,n=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=n}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class wh{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new P)}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){const i=e.x,n=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*n),t.addScaledVector(a[2],.488603*s),t.addScaledVector(a[3],.488603*i),t.addScaledVector(a[4],1.092548*(i*n)),t.addScaledVector(a[5],1.092548*(n*s)),t.addScaledVector(a[6],.315392*(3*s*s-1)),t.addScaledVector(a[7],1.092548*(i*s)),t.addScaledVector(a[8],.546274*(i*i-n*n)),t}getIrradianceAt(e,t){const i=e.x,n=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*n),t.addScaledVector(a[2],2*.511664*s),t.addScaledVector(a[3],2*.511664*i),t.addScaledVector(a[4],2*.429043*i*n),t.addScaledVector(a[5],2*.429043*n*s),t.addScaledVector(a[6],.743125*s*s-.247708),t.addScaledVector(a[7],2*.429043*i*s),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,t=0){const i=this.coefficients;for(let n=0;n<9;n++)i[n].fromArray(e,t+n*3);return this}toArray(e=[],t=0){const i=this.coefficients;for(let n=0;n<9;n++)i[n].toArray(e,t+n*3);return e}static getBasisAt(e,t){const i=e.x,n=e.y,s=e.z;t[0]=.282095,t[1]=.488603*n,t[2]=.488603*s,t[3]=.488603*i,t[4]=1.092548*i*n,t[5]=1.092548*n*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*i*s,t[8]=.546274*(i*i-n*n)}}class qf extends Bn{constructor(e=new wh,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class Rl extends yi{constructor(e){super(e),this.textures={}}load(e,t,i,n){const s=this,a=new Ai(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){n?n(l):Ze(l),s.manager.itemError(e)}},i,n)}parse(e){const t=this.textures;function i(s){return t[s]===void 0&&Re("MaterialLoader: Undefined texture",s),t[s]}const n=this.createMaterialFromType(e.type);if(e.uuid!==void 0&&(n.uuid=e.uuid),e.name!==void 0&&(n.name=e.name),e.color!==void 0&&n.color!==void 0&&n.color.setHex(e.color),e.roughness!==void 0&&(n.roughness=e.roughness),e.metalness!==void 0&&(n.metalness=e.metalness),e.sheen!==void 0&&(n.sheen=e.sheen),e.sheenColor!==void 0&&(n.sheenColor=new He().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(n.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&n.emissive!==void 0&&n.emissive.setHex(e.emissive),e.specular!==void 0&&n.specular!==void 0&&n.specular.setHex(e.specular),e.specularIntensity!==void 0&&(n.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&n.specularColor!==void 0&&n.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(n.shininess=e.shininess),e.clearcoat!==void 0&&(n.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=e.clearcoatRoughness),e.dispersion!==void 0&&(n.dispersion=e.dispersion),e.iridescence!==void 0&&(n.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(n.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(n.transmission=e.transmission),e.thickness!==void 0&&(n.thickness=e.thickness),e.attenuationDistance!==void 0&&(n.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&n.attenuationColor!==void 0&&n.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(n.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(n.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(n.fog=e.fog),e.flatShading!==void 0&&(n.flatShading=e.flatShading),e.blending!==void 0&&(n.blending=e.blending),e.combine!==void 0&&(n.combine=e.combine),e.side!==void 0&&(n.side=e.side),e.shadowSide!==void 0&&(n.shadowSide=e.shadowSide),e.opacity!==void 0&&(n.opacity=e.opacity),e.transparent!==void 0&&(n.transparent=e.transparent),e.alphaTest!==void 0&&(n.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(n.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(n.depthFunc=e.depthFunc),e.depthTest!==void 0&&(n.depthTest=e.depthTest),e.depthWrite!==void 0&&(n.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(n.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(n.blendSrc=e.blendSrc),e.blendDst!==void 0&&(n.blendDst=e.blendDst),e.blendEquation!==void 0&&(n.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(n.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(n.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(n.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&n.blendColor!==void 0&&n.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(n.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(n.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(n.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(n.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(n.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(n.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(n.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(n.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(n.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(n.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(n.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(n.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(n.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(n.rotation=e.rotation),e.linewidth!==void 0&&(n.linewidth=e.linewidth),e.dashSize!==void 0&&(n.dashSize=e.dashSize),e.gapSize!==void 0&&(n.gapSize=e.gapSize),e.scale!==void 0&&(n.scale=e.scale),e.polygonOffset!==void 0&&(n.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(n.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(n.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(n.dithering=e.dithering),e.alphaToCoverage!==void 0&&(n.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(n.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(n.forceSinglePass=e.forceSinglePass),e.allowOverride!==void 0&&(n.allowOverride=e.allowOverride),e.visible!==void 0&&(n.visible=e.visible),e.toneMapped!==void 0&&(n.toneMapped=e.toneMapped),e.userData!==void 0&&(n.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?n.vertexColors=e.vertexColors>0:n.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.uniforms[s];switch(n.uniforms[s]={},a.type){case"t":n.uniforms[s].value=i(a.value);break;case"c":n.uniforms[s].value=new He().setHex(a.value);break;case"v2":n.uniforms[s].value=new se().fromArray(a.value);break;case"v3":n.uniforms[s].value=new P().fromArray(a.value);break;case"v4":n.uniforms[s].value=new Pt().fromArray(a.value);break;case"m3":n.uniforms[s].value=new ft().fromArray(a.value);break;case"m4":n.uniforms[s].value=new ct().fromArray(a.value);break;default:n.uniforms[s].value=a.value}}if(e.defines!==void 0&&(n.defines=e.defines),e.vertexShader!==void 0&&(n.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(n.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(n.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)n.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(n.lights=e.lights),e.clipping!==void 0&&(n.clipping=e.clipping),e.size!==void 0&&(n.size=e.size),e.sizeAttenuation!==void 0&&(n.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(n.map=i(e.map)),e.matcap!==void 0&&(n.matcap=i(e.matcap)),e.alphaMap!==void 0&&(n.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(n.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(n.bumpScale=e.bumpScale),e.normalMap!==void 0&&(n.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(n.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),n.normalScale=new se().fromArray(s)}return e.displacementMap!==void 0&&(n.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(n.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(n.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(n.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(n.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(n.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(n.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(n.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(n.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(n.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(n.envMap=i(e.envMap)),e.envMapRotation!==void 0&&n.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(n.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(n.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(n.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(n.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(n.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(n.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(n.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(n.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(n.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(n.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(n.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(n.clearcoatNormalScale=new se().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(n.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(n.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(n.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(n.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(n.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(n.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(n.sheenRoughnessMap=i(e.sheenRoughnessMap)),n}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Rl.createMaterialFromType(e)}static createMaterialFromType(e){const t={ShadowMaterial:Tf,SpriteMaterial:ah,RawShaderMaterial:gh,ShaderMaterial:vi,PointsMaterial:lh,MeshPhysicalMaterial:Af,MeshStandardMaterial:vh,MeshPhongMaterial:Cf,MeshToonMaterial:Rf,MeshNormalMaterial:If,MeshLambertMaterial:Pf,MeshDepthMaterial:_h,MeshDistanceMaterial:yh,MeshBasicMaterial:fn,MeshMatcapMaterial:Lf,LineDashedMaterial:Uf,LineBasicMaterial:_i,Material:li};return new t[e]}}class Dc{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||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 Yf extends mt{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Zf extends yi{constructor(e){super(e)}load(e,t,i,n){const s=this,a=new Ai(s.manager);a.setPath(s.path),a.setRequestHeader(s.requestHeader),a.setWithCredentials(s.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){n?n(l):Ze(l),s.manager.itemError(e)}},i,n)}parse(e){const t={},i={};function n(f,p){if(t[p]!==void 0)return t[p];const g=f.interleavedBuffers[p],m=s(f,g.buffer),_=ks(g.type,m),x=new ul(_,g.stride);return x.uuid=g.uuid,t[p]=x,x}function s(f,p){if(i[p]!==void 0)return i[p];const g=f.arrayBuffers[p],m=new Uint32Array(g).buffer;return i[p]=m,m}const a=e.isInstancedBufferGeometry?new Yf:new mt,o=e.data.index;if(o!==void 0){const f=ks(o.type,o.array);a.setIndex(new Ut(f,1))}const l=e.data.attributes;for(const f in l){const p=l[f];let v;if(p.isInterleavedBufferAttribute){const g=n(e.data,p.data);v=new cs(g,p.itemSize,p.offset,p.normalized)}else{const g=ks(p.type,p.array),m=p.isInstancedBufferAttribute?qs:Ut;v=new m(g,p.itemSize,p.normalized)}p.name!==void 0&&(v.name=p.name),p.usage!==void 0&&v.setUsage(p.usage),a.setAttribute(f,v)}const c=e.data.morphAttributes;if(c)for(const f in c){const p=c[f],v=[];for(let g=0,m=p.length;g<m;g++){const _=p[g];let x;if(_.isInterleavedBufferAttribute){const M=n(e.data,_.data);x=new cs(M,_.itemSize,_.offset,_.normalized)}else{const M=ks(_.type,_.array);x=new Ut(M,_.itemSize,_.normalized)}_.name!==void 0&&(x.name=_.name),v.push(x)}a.morphAttributes[f]=v}e.data.morphTargetsRelative&&(a.morphTargetsRelative=!0);const d=e.data.groups||e.data.drawcalls||e.data.offsets;if(d!==void 0)for(let f=0,p=d.length;f!==p;++f){const v=d[f];a.addGroup(v.start,v.count,v.materialIndex)}const h=e.data.boundingSphere;return h!==void 0&&(a.boundingSphere=new ni().fromJSON(h)),e.name&&(a.name=e.name),e.userData&&(a.userData=e.userData),a}}const hc={};class uv extends yi{constructor(e){super(e)}load(e,t,i,n){const s=this,a=this.path===""?Dc.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;const o=new Ai(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(d){n!==void 0&&n(d),Ze("ObjectLoader: Can't parse "+e+".",d.message);return}const u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){n!==void 0&&n(new Error("THREE.ObjectLoader: Can't load "+e)),Ze("ObjectLoader: Can't load "+e);return}s.parse(c,t)},i,n)}async loadAsync(e,t){const i=this,n=this.path===""?Dc.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||n;const s=new Ai(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const a=await s.loadAsync(e,t);let o;try{o=JSON.parse(a)}catch(c){throw new Error("ObjectLoader: Can't parse "+e+". "+c.message)}const l=o.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await i.parseAsync(o)}parse(e,t){const i=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,n),a=this.parseImages(e.images,function(){t!==void 0&&t(c)}),o=this.parseTextures(e.textures,a),l=this.parseMaterials(e.materials,o),c=this.parseObject(e.object,s,l,o,i),u=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,u),this.bindLightTargets(c),t!==void 0){let d=!1;for(const h in a)if(a[h].data instanceof HTMLImageElement){d=!0;break}d===!1&&t(c)}return c}async parseAsync(e){const t=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),n=this.parseGeometries(e.geometries,i),s=await this.parseImagesAsync(e.images),a=this.parseTextures(e.textures,s),o=this.parseMaterials(e.materials,a),l=this.parseObject(e.object,n,o,a,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),this.bindLightTargets(l),l}static registerGeometry(e,t){hc[e]=t}parseShapes(e){const t={};if(e!==void 0)for(let i=0,n=e.length;i<n;i++){const s=new as().fromJSON(e[i]);t[s.uuid]=s}return t}parseSkeletons(e,t){const i={},n={};if(t.traverse(function(s){s.isBone&&(n[s.uuid]=s)}),e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=new dl().fromJSON(e[s],n);i[o.uuid]=o}return i}parseGeometries(e,t){const i={};if(e!==void 0){const n=new Zf;for(let s=0,a=e.length;s<a;s++){let o;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":o=n.parse(l);break;default:l.type in wu?o=wu[l.type].fromJSON(l,t):l.type in hc?o=hc[l.type].fromJSON(l,t):Re(`ObjectLoader: Unknown geometry type "${l.type}". Use .registerGeometry() before starting the deserialization process.`)}o.uuid=l.uuid,l.name!==void 0&&(o.name=l.name),l.userData!==void 0&&(o.userData=l.userData),i[l.uuid]=o}}return i}parseMaterials(e,t){const i={},n={};if(e!==void 0){const s=new Rl;s.setTextures(t);for(let a=0,o=e.length;a<o;a++){const l=e[a];i[l.uuid]===void 0&&(i[l.uuid]=s.parse(l)),n[l.uuid]=i[l.uuid]}}return n}parseAnimations(e){const t={};if(e!==void 0)for(let i=0;i<e.length;i++){const n=e[i],s=Zr.parse(n);t[s.uuid]=s}return t}parseImages(e,t){const i=this,n={};let s;function a(l){return i.manager.itemStart(l),s.load(l,function(){i.manager.itemEnd(l)},void 0,function(){i.manager.itemError(l),i.manager.itemEnd(l)})}function o(l){if(typeof l=="string"){const c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:i.resourcePath+c;return a(u)}else return l.data?{data:ks(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new Al(t);s=new Jr(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){const d=e[c],h=d.url;if(Array.isArray(h)){const f=[];for(let p=0,v=h.length;p<v;p++){const g=h[p],m=o(g);m!==null&&(m instanceof HTMLImageElement?f.push(m):f.push(new Ii(m.data,m.width,m.height)))}n[d.uuid]=new Cn(f)}else{const f=o(d.url);n[d.uuid]=new Cn(f)}}}return n}async parseImagesAsync(e){const t=this,i={};let n;
vendor: 10,055 bytes, line 9
9async function s(a){if(typeof a=="string"){const o=a,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(o)?o:t.resourcePath+o;return await n.loadAsync(l)}else return a.data?{data:ks(a.type,a.data),width:a.width,height:a.height}:null}if(e!==void 0&&e.length>0){n=new Jr(this.manager),n.setCrossOrigin(this.crossOrigin);for(let a=0,o=e.length;a<o;a++){const l=e[a],c=l.url;if(Array.isArray(c)){const u=[];for(let d=0,h=c.length;d<h;d++){const f=c[d],p=await s(f);p!==null&&(p instanceof HTMLImageElement?u.push(p):u.push(new Ii(p.data,p.width,p.height)))}i[l.uuid]=new Cn(u)}else{const u=await s(l.url);i[l.uuid]=new Cn(u)}}}return i}parseTextures(e,t){function i(s,a){return typeof s=="number"?s:(Re("ObjectLoader.parseTexture: Constant should be in numeric form.",s),a[s])}const n={};if(e!==void 0)for(let s=0,a=e.length;s<a;s++){const o=e[s];o.image===void 0&&Re('ObjectLoader: No "image" specified for',o.uuid),t[o.image]===void 0&&Re("ObjectLoader: Undefined image",o.image);const l=t[o.image],c=l.data;let u;Array.isArray(c)?(u=new ta,c.length===6&&(u.needsUpdate=!0)):(c&&c.data?u=new Ii:u=new Lt,c&&(u.needsUpdate=!0)),u.source=l,u.uuid=o.uuid,o.name!==void 0&&(u.name=o.name),o.mapping!==void 0&&(u.mapping=i(o.mapping,dv)),o.channel!==void 0&&(u.channel=o.channel),o.offset!==void 0&&u.offset.fromArray(o.offset),o.repeat!==void 0&&u.repeat.fromArray(o.repeat),o.center!==void 0&&u.center.fromArray(o.center),o.rotation!==void 0&&(u.rotation=o.rotation),o.wrap!==void 0&&(u.wrapS=i(o.wrap[0],Lu),u.wrapT=i(o.wrap[1],Lu)),o.format!==void 0&&(u.format=o.format),o.internalFormat!==void 0&&(u.internalFormat=o.internalFormat),o.type!==void 0&&(u.type=o.type),o.colorSpace!==void 0&&(u.colorSpace=o.colorSpace),o.minFilter!==void 0&&(u.minFilter=i(o.minFilter,Uu)),o.magFilter!==void 0&&(u.magFilter=i(o.magFilter,Uu)),o.anisotropy!==void 0&&(u.anisotropy=o.anisotropy),o.flipY!==void 0&&(u.flipY=o.flipY),o.generateMipmaps!==void 0&&(u.generateMipmaps=o.generateMipmaps),o.premultiplyAlpha!==void 0&&(u.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(u.unpackAlignment=o.unpackAlignment),o.compareFunction!==void 0&&(u.compareFunction=o.compareFunction),o.normalized!==void 0&&(u.normalized=o.normalized),o.userData!==void 0&&(u.userData=o.userData),n[o.uuid]=u}return n}parseObject(e,t,i,n,s){let a;function o(h){return t[h]===void 0&&Re("ObjectLoader: Undefined geometry",h),t[h]}function l(h){if(h!==void 0){if(Array.isArray(h)){const f=[];for(let p=0,v=h.length;p<v;p++){const g=h[p];i[g]===void 0&&Re("ObjectLoader: Undefined material",g),f.push(i[g])}return f}return i[h]===void 0&&Re("ObjectLoader: Undefined material",h),i[h]}}function c(h){return n[h]===void 0&&Re("ObjectLoader: Undefined texture",h),n[h]}let u,d;switch(e.type){case"Scene":a=new nh,e.background!==void 0&&(Number.isInteger(e.background)?a.background=new He(e.background):a.background=c(e.background)),e.environment!==void 0&&(a.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?a.fog=new hl(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(a.fog=new cl(e.fog.color,e.fog.density)),e.fog.name!==""&&(a.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(a.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(a.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&a.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(a.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&a.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":a=new ti(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(a.focus=e.focus),e.zoom!==void 0&&(a.zoom=e.zoom),e.filmGauge!==void 0&&(a.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(a.filmOffset=e.filmOffset),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"OrthographicCamera":a=new js(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(a.zoom=e.zoom),e.view!==void 0&&(a.view=Object.assign({},e.view));break;case"AmbientLight":a=new Wf(e.color,e.intensity);break;case"DirectionalLight":a=new Gf(e.color,e.intensity),a.target=e.target||"";break;case"PointLight":a=new Hf(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":a=new Xf(e.color,e.intensity,e.width,e.height);break;case"SpotLight":a=new Vf(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),a.target=e.target||"";break;case"HemisphereLight":a=new kf(e.color,e.groundColor,e.intensity);break;case"LightProbe":const h=new wh().fromArray(e.sh);a=new qf(h,e.intensity);break;case"SkinnedMesh":u=o(e.geometry),d=l(e.material),a=new af(u,d),e.bindMode!==void 0&&(a.bindMode=e.bindMode),e.bindMatrix!==void 0&&a.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(a.skeleton=e.skeleton);break;case"Mesh":u=o(e.geometry),d=l(e.material),a=new kt(u,d);break;case"InstancedMesh":u=o(e.geometry),d=l(e.material);const f=e.count,p=e.instanceMatrix,v=e.instanceColor;a=new of(u,d,f),a.instanceMatrix=new qs(new Float32Array(p.array),16),v!==void 0&&(a.instanceColor=new qs(new Float32Array(v.array),v.itemSize));break;case"BatchedMesh":u=o(e.geometry),d=l(e.material),a=new lf(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,d),a.geometry=u,a.perObjectFrustumCulled=e.perObjectFrustumCulled,a.sortObjects=e.sortObjects,a._drawRanges=e.drawRanges,a._reservedRanges=e.reservedRanges,a._geometryInfo=e.geometryInfo.map(g=>{let m=null,_=null;return g.boundingBox!==void 0&&(m=new oi().fromJSON(g.boundingBox)),g.boundingSphere!==void 0&&(_=new ni().fromJSON(g.boundingSphere)),{...g,boundingBox:m,boundingSphere:_}}),a._instanceInfo=e.instanceInfo,a._availableInstanceIds=e._availableInstanceIds,a._availableGeometryIds=e._availableGeometryIds,a._nextIndexStart=e.nextIndexStart,a._nextVertexStart=e.nextVertexStart,a._geometryCount=e.geometryCount,a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._matricesTexture=c(e.matricesTexture.uuid),a._indirectTexture=c(e.indirectTexture.uuid),e.colorsTexture!==void 0&&(a._colorsTexture=c(e.colorsTexture.uuid)),e.boundingSphere!==void 0&&(a.boundingSphere=new ni().fromJSON(e.boundingSphere)),e.boundingBox!==void 0&&(a.boundingBox=new oi().fromJSON(e.boundingBox));break;case"LOD":a=new rf;break;case"Line":a=new Dn(o(e.geometry),l(e.material));break;case"LineLoop":a=new cf(o(e.geometry),l(e.material));break;case"LineSegments":a=new en(o(e.geometry),l(e.material));break;case"PointCloud":case"Points":a=new hf(o(e.geometry),l(e.material));break;case"Sprite":a=new sf(l(e.material));break;case"Group":a=new Vs;break;case"Bone":a=new oh;break;default:a=new Ct}if(a.uuid=e.uuid,e.name!==void 0&&(a.name=e.name),e.matrix!==void 0?(a.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(e.position!==void 0&&a.position.fromArray(e.position),e.rotation!==void 0&&a.rotation.fromArray(e.rotation),e.quaternion!==void 0&&a.quaternion.fromArray(e.quaternion),e.scale!==void 0&&a.scale.fromArray(e.scale)),e.up!==void 0&&a.up.fromArray(e.up),e.pivot!==void 0&&(a.pivot=new P().fromArray(e.pivot)),e.morphTargetDictionary!==void 0&&(a.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),e.morphTargetInfluences!==void 0&&(a.morphTargetInfluences=e.morphTargetInfluences.slice()),e.castShadow!==void 0&&(a.castShadow=e.castShadow),e.receiveShadow!==void 0&&(a.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.intensity!==void 0&&(a.shadow.intensity=e.shadow.intensity),e.shadow.bias!==void 0&&(a.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(a.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(a.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&a.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(a.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(a.visible=e.visible),e.frustumCulled!==void 0&&(a.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(a.renderOrder=e.renderOrder),e.static!==void 0&&(a.static=e.static),e.userData!==void 0&&(a.userData=e.userData),e.layers!==void 0&&(a.layers.mask=e.layers),e.children!==void 0){const h=e.children;for(let f=0;f<h.length;f++)a.add(this.parseObject(h[f],t,i,n,s))}if(e.animations!==void 0){const h=e.animations;for(let f=0;f<h.length;f++){const p=h[f];a.animations.push(s[p])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(a.autoUpdate=e.autoUpdate);const h=e.levels;for(let f=0;f<h.length;f++){const p=h[f],v=a.getObjectByProperty("uuid",p.object);v!==void 0&&a.addLevel(v,p.distance,p.hysteresis)}}return a}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(i){if(i.isSkinnedMesh===!0&&i.skeleton!==void 0){const n=t[i.skeleton];n===void 0?Re("ObjectLoader: No skeleton found with UUID:",i.skeleton):i.bind(n,i.bindMatrix)}})}bindLightTargets(e){e.traverse(function(t){if(t.isDirectionalLight||t.isSpotLight){const i=t.target,n=e.getObjectByProperty("uuid",i);n!==void 0?t.target=n:t.target=new Ct}})}}const dv={UVMapping:In,CubeReflectionMapping:Qi,CubeRefractionMapping:Pn,EquirectangularReflectionMapping:br,EquirectangularRefractionMapping:Tr,CubeUVReflectionMapping:Js},Lu={RepeatWrapping:Ur,ClampToEdgeWrapping:Gt,MirroredRepeatWrapping:Nr},Uu={NearestFilter:Zt,NearestMipmapNearestFilter:Jc,NearestMipmapLinearFilter:zs,LinearFilter:wt,LinearMipmapNearestFilter:wr,LinearMipmapLinearFilter:$i},uc=new WeakMap;class fv extends yi{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&Re("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&Re("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,i,n){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Ki.get(`image-bitmap:${e}`);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(c=>
9{uc.has(a)===!0?(n&&n(uc.get(a)),s.manager.itemError(e),s.manager.itemEnd(e)):(t&&t(c),s.manager.itemEnd(e))});return}setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0);return}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const l=fetch(e,o).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){Ki.add(`image-bitmap:${e}`,c),t&&t(c),s.manager.itemEnd(e)}).catch(function(c){n&&n(c),uc.set(l,c),Ki.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});Ki.add(`image-bitmap:${e}`,l),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Xa;class Eh{static getContext(){return Xa===void 0&&(Xa=new(window.AudioContext||window.webkitAudioContext)),Xa}static setContext(e){Xa=e}}class pv extends yi{constructor(e){super(e)}load(e,t,i,n){const s=this,a=new Ai(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{const c=l.slice(0),u=Eh.getContext(),d=e+"#decode";s.manager.itemStart(d),u.decodeAudioData(c,function(h){t(h),s.manager.itemEnd(d)}).catch(function(h){o(h),s.manager.itemEnd(d)})}catch(c){o(c)}},i,n);function o(l){n?n(l):Ze(l),s.manager.itemError(e)}}}const Nu=new ct,Du=new ct,qn=new ct;class mv{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ti,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ti,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,qn.copy(e.projectionMatrix);const n=t.eyeSep/2,s=n*t.near/t.focus,a=t.near*Math.tan(rs*t.fov*.5)/t.zoom;let o,l;Du.elements[12]=-n,Nu.elements[12]=n,o=-a*t.aspect+s,l=a*t.aspect+s,qn.elements[0]=2*t.near/(l-o),qn.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(qn),o=-a*t.aspect-s,l=a*t.aspect-s,qn.elements[0]=2*t.near/(l-o),qn.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(qn)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Du),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Nu)}}const Us=-90,Ns=1;class Jf extends Ct{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const n=new ti(Us,Ns,e,t);n.layers=this.layers,this.add(n);const s=new ti(Us,Ns,e,t);s.layers=this.layers,this.add(s);const a=new ti(Us,Ns,e,t);a.layers=this.layers,this.add(a);const o=new ti(Us,Ns,e,t);o.layers=this.layers,this.add(o);const l=new ti(Us,Ns,e,t);l.layers=this.layers,this.add(l);const c=new ti(Us,Ns,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,n,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===wi)i.up.set(0,1,0),i.lookAt(1,0,0),n.up.set(0,1,0),n.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===ls)i.up.set(0,-1,0),i.lookAt(-1,0,0),n.up.set(0,-1,0),n.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:n}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,u]=this.children,d=e.getRenderTarget(),h=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const v=i.texture.generateMipmaps;i.texture.generateMipmaps=!1;let g=!1;e.isWebGLRenderer===!0?g=e.state.buffers.depth.getReversed():g=e.reversedDepthBuffer,e.setRenderTarget(i,0,n),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(i,1,n),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(i,2,n),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(i,3,n),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),e.setRenderTarget(i,4,n),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),i.texture.generateMipmaps=v,e.setRenderTarget(i,5,n),g&&e.autoClear===!1&&e.clearDepth(),e.render(t,u),e.setRenderTarget(d,h,f),e.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class $f extends ti{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Kf{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,e.hidden!==void 0&&(this._pageVisibilityHandler=gv.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(e!==void 0?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}
vendor: 1,063 bytes, line 9
9function gv(){this._document.hidden===!1&&this.reset()}const Yn=new P,dc=new mi,vv=new P,Zn=new P,Jn=new P;class _v extends Ct{constructor(){super(),this.type="AudioListener",this.context=Eh.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new Kf}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update(
vendor: 4,318 bytes, line 9
9);const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(Yn,dc,vv),Zn.set(0,0,-1).applyQuaternion(dc),Jn.set(0,1,0).applyQuaternion(dc),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Yn.x,i),t.positionY.linearRampToValueAtTime(Yn.y,i),t.positionZ.linearRampToValueAtTime(Yn.z,i),t.forwardX.linearRampToValueAtTime(Zn.x,i),t.forwardY.linearRampToValueAtTime(Zn.y,i),t.forwardZ.linearRampToValueAtTime(Zn.z,i),t.upX.linearRampToValueAtTime(Jn.x,i),t.upY.linearRampToValueAtTime(Jn.y,i),t.upZ.linearRampToValueAtTime(Jn.z,i)}else t.setPosition(Yn.x,Yn.y,Yn.z),t.setOrientation(Zn.x,Zn.y,Zn.z,Jn.x,Jn.y,Jn.z)}}class Qf extends Ct{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){Re("Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){Re("Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){Re("Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(e=0){if(this.hasPlaybackControl===!1){Re("Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){Re("Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}
vendor: 14,241 bytes, line 9
9getLoop(){return this.hasPlaybackControl===!1?(Re("Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){Re("Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),e.sourceType!=="buffer"?(Re("Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const $n=new P,Ou=new mi,yv=new P,Kn=new P;class xv extends Qf{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,i){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=i,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose($n,Ou,yv),Kn.set(0,0,1).applyQuaternion(Ou);const t=this.panner;if(t.positionX){const i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime($n.x,i),t.positionY.linearRampToValueAtTime($n.y,i),t.positionZ.linearRampToValueAtTime($n.z,i),t.orientationX.linearRampToValueAtTime(Kn.x,i),t.orientationY.linearRampToValueAtTime(Kn.y,i),t.orientationZ.linearRampToValueAtTime(Kn.z,i)}else t.setPosition($n.x,$n.y,$n.z),t.setOrientation(Kn.x,Kn.y,Kn.z)}}class Mv{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let i=0;i<t.length;i++)e+=t[i];return e/t.length}}class jf{constructor(e,t,i){this.binding=e,this.valueSize=i;let n,s,a;switch(t){case"quaternion":n=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":n=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:n=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const i=this.buffer,n=this.valueSize,s=e*n+n;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==n;++o)i[s+o]=i[o];a=t}else{a+=t;const o=t/a;this._mixBufferRegion(i,s,0,o,n)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,i=this.valueSize,n=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,n,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,i=this.buffer,n=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(i,n,l,1-s,t)}a>0&&this._mixBufferRegionAdditive(i,n,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){o.setValue(i,n);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,n=i*this._origIndex;e.getValue(t,n);for(let s=i,a=n;s!==a;++s)t[s]=t[n+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const 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(){const 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,s){if(n>=.5)for(let a=0;a!==s;++a)e[t+a]=e[i+a]}_slerp(e,t,i,n){mi.slerpFlat(e,t,e,t,e,i,n)}_slerpAdditive(e,t,i,n,s){const a=this._workIndex*s;mi.multiplyQuaternionsFlat(e,a,e,t,e,i),mi.slerpFlat(e,t,e,t,e,a,n)}_lerp(e,t,i,n,s){const a=1-n;for(let o=0;o!==s;++o){const l=t+o;e[l]=e[l]*a+e[i+o]*n}}_lerpAdditive(e,t,i,n,s){for(let a=0;a!==s;++a){const o=t+a;e[o]=e[o]+e[i+a]*n}}}const Ah="\\[\\]\\.:\\/",Sv=new RegExp("["+Ah+"]","g"),Ch="[^"+Ah+"]",bv="[^"+Ah.replace("\\.","")+"]",Tv=/((?:WC+[\/:])*)/.source.replace("WC",Ch),wv=/(WCOD+)?/.source.replace("WCOD",bv),Ev=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ch),Av=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ch),Cv=new RegExp("^"+Tv+wv+Ev+Av+"$"),Rv=["material","materials","bones","map"];class Iv{constructor(e,t,i){const n=i||At.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,n=this._bindings[i];n!==void 0&&n.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,s=i.length;n!==s;++n)i[n].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class At{constructor(e,t,i){this.path=t,this.parsedPath=i||At.parseTrackName(t),this.node=At.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new At.Composite(e,t,i):new At(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Sv,"")}static parseTrackName(e){const t=Cv.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(n!==void 0&&n!==-1){const s=i.nodeName.substring(n+1);Rv.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===t||o.uuid===t)return o;const l=i(o.children);if(l)return l}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){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++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){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++n)i[n]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let n=0,s=i.length;n!==s;++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;const t=this.parsedPath,i=t.objectName,n=t.propertyName;let s=t.propertyIndex;if(e||(e=At.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Re("PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let c=t.objectIndex;switch(i){case"materials":if(!e.material){Ze("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Ze("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Ze("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Ze("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Ze("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){Ze("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(c!==void 0){if(e[c]===void 0){Ze("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const a=e[n];if(a===void 0){const c=t.nodeName;Ze("PropertyBinding: Trying to update property for track: "+c+"."+n+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?o=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(n==="morphTargetInfluences"){if(!e.geometry){Ze("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Ze("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(l=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=n;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}At.Composite=Iv;At.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};At.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};At.prototype.GetterByBindingType=[At.prototype._getValue_direct,At.prototype._getValue_array,At.prototype._getValue_arrayElement,At.prototype._getValue_toArray];At.prototype.SetterByBindingTypeAndVersioning=[[At.prototype._setValue_direct,At.prototype._setValue_direct_setNeedsUpdate,At.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[At.prototype._setValue_array,At.prototype._setValue_array_setNeedsUpdate,At.prototype._setValue_array_setMatrixWorldNeedsUpdate],[At.prototype._setValue_arrayElement,At.prototype._setValue_arrayElement_setNeedsUpdate,At.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[At.prototype._setValue_fromArray,At.prototype._setValue_fromArray_setNeedsUpdate,At.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Pv{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Ei(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let i=0,n=arguments.length;i!==n;++i)e[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,i=this._paths,n=this._parsedPaths,s=this._bindings,a=s.length;let o,l=e.length,c=this.nCachedObjects_;for(let u=0,d=arguments.length;u!==d;++u){const h=arguments[u],f=h.uuid;let p=t[f];if(p===void 0){p=l++,t[f]=p,e.push(h);for(let v=0,g=a;v!==g;++v)s[v].push(new At(h,i[v],n[v]))}else if(p<c){o=e[p];const v=--c,g=e[v];t[g.uuid]=p,e[p]=g,t[f]=v,e[v]=h;for(let m=0,_=a;m!==_;++m){const x=s[m],M=x[v];let R=x[p];x[p]=M,R===void 0&&(R=new At(h,i[m],n[m])),x[v]=R}}else e[p]!==o&&Ze("AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastru
9cture when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,n=i.length;let s=this.nCachedObjects_;for(let a=0,o=arguments.length;a!==o;++a){const l=arguments[a],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){const d=s++,h=e[d];t[h.uuid]=u,e[u]=h,t[c]=d,e[d]=l;for(let f=0,p=n;f!==p;++f){const v=i[f],g=v[d],m=v[u];v[u]=g,v[d]=m}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,n=i.length;let s=this.nCachedObjects_,a=e.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],u=c.uuid,d=t[u];if(d!==void 0)if(delete t[u],d<s){const h=--s,f=e[h],p=--a,v=e[p];t[f.uuid]=d,e[d]=f,t[v.uuid]=h,e[h]=v,e.pop();for(let g=0,m=n;g!==m;++g){const _=i[g],x=_[h],M=_[p];_[d]=x,_[h]=M,_.pop()}}else{const h=--a,f=e[h];h>0&&(t[f.uuid]=d),e[d]=f,e.pop();for(let p=0,v=n;p!==v;++p){const g=i[p];g[d]=g[h],g.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let n=i[e];const s=this._bindings;if(n!==void 0)return s[n];const a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,d=new Array(c);n=s.length,i[e]=n,a.push(e),o.push(t),s.push(d);for(let h=u,f=l.length;h!==f;++h){const p=l[h];d[h]=new At(p,e,t)}return d}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const n=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=e[o];t[c]=i,a[i]=l,a.pop(),s[i]=s[o],s.pop(),n[i]=n[o],n.pop()}}}class ep{constructor(e,t,i=null,n=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=n;const s=t.tracks,a=s.length,o=new Array(a),l={endingStart:es,endingEnd:es};for(let c=0;c!==a;++c){const u=s[c].createInterpolant(null);o[c]=u,u.settings&&Object.assign(l,u.settings),u.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Vd,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(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=!1){if(e.fadeOut(t),this.fadeIn(t),i===!0){const n=this._clip.duration,s=e._clip.duration,a=s/n,o=n/s;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,i=!1){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(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){const n=this._mixer,s=n.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=n._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+i,c[0]=e/a,c[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(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){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case eh:for(let u=0,d=l.length;u!==d;++u)l[u].evaluate(a),c[u].accumulateAdditive(o);break;case nl:default:for(let u=0,d=l.length;u!==d;++u)l[u].evaluate(a),c[u].accumulate(n,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const n=i.evaluate(e)[0];t*=n,e>i.parameterPositions[1]&&(this.stopFading(),n===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const n=i.evaluate(e)[0];t*=n,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let n=this.time+e,s=this._loopCount;const a=i===Hd;if(e===0)return s===-1?n:a&&(s&1)===1?t-n:n;if(i===kd){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(n>=t)n=t;else if(n<0)n=0;else{this.time=n;break e}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(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),n>=t||n<0){const o=Math.floor(n/t);n-=t*o,s+=Math.abs(o);const l=this.repetitions-s;if(l<=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(l===1){const c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this._loopCount=s,this.time=n;
vendor: 9,102 bytes, line 9
9if(a&&(s&1)===1)return t-n}return n}_setEndings(e,t,i){const n=this._interpolantSettings;i?(n.endingStart=ts,n.endingEnd=ts):(e?n.endingStart=this.zeroSlopeAtStart?ts:es:n.endingStart=Br,t?n.endingEnd=this.zeroSlopeAtEnd?ts:es:n.endingEnd=Br)}_scheduleFading(e,t,i){const n=this._mixer,s=n.time;let a=this._weightInterpolant;a===null&&(a=n._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=t,o[1]=s+e,l[1]=i,this}}const Lv=new Float32Array(1);class Uv extends Hi{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const i=e._localRoot||this._root,n=e._clip.tracks,s=n.length,a=e._propertyBindings,o=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let d=0;d!==s;++d){const h=n[d],f=h.name;let p=u[f];if(p!==void 0)++p.referenceCount,a[d]=p;else{if(p=a[d],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,l,f));continue}const v=t&&t._propertyBindings[d].binding.parsedPath;p=new jf(At.create(i,f,v),h.ValueTypeName,h.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,f),a[d]=p}o[d].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,n=e._clip.uuid,s=this._actionsByClip[n];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,n,i)}const t=e._propertyBindings;for(let i=0,n=t.length;i!==n;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,n=t.length;i!==n;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const 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){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,i){const n=this._actions,s=this._actionsByClip;let a=s[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=a;else{const o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=n.length,n.push(e),a.actionByRoot[i]=e}_removeInactiveAction(e){const t=this._actions,i=t[t.length-1],n=e._cacheIndex;i._cacheIndex=n,t[n]=i,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,a=this._actionsByClip,o=a[s],l=o.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;const d=o.actionByRoot,h=(e._localRoot||this._root).uuid;delete d[h],l.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let i=0,n=t.length;i!==n;++i){const s=t[i];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,i=e._cacheIndex,n=this._nActiveActions++,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=i,t[i]=s}_takeBackAction(e){const t=this._actions,i=e._cacheIndex,n=--this._nActiveActions,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=i,t[i]=s}_addInactiveBinding(e,t,i){const n=this._bindingsByRootAndName,s=this._bindings;let a=n[t];a===void 0&&(a={},n[t]=a),a[i]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,i=e.binding,n=i.rootNode.uuid,s=i.path,a=this._bindingsByRootAndName,o=a[n],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete o[s],Object.keys(o).length===0&&delete a[n]}_lendBinding(e){const t=this._bindings,i=e._cacheIndex,n=this._nActiveBindings++,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=i,t[i]=s}_takeBackBinding(e){const t=this._bindings,i=e._cacheIndex,n=--this._nActiveBindings,s=t[n];e._cacheIndex=n,t[n]=e,s._cacheIndex=i,t[i]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let i=e[t];return i===void 0&&(i=new Mh(new Float32Array(2),new Float32Array(2),1,Lv),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){const t=this._controlInterpolants,i=e.__cacheIndex,n=--this._nActiveControlInterpolants,s=t[n];e.__cacheIndex=n,t[n]=e,s.__cacheIndex=i,t[i]=s}clipAction(e,t,i){const n=t||this._root,s=n.uuid;let a=typeof e=="string"?Zr.findByName(n,e):e;const o=a!==null?a.uuid:e,l=this._actionsByClip[o];let c=null;if(i===void 0&&(a!==null?i=a.blendMode:i=nl),l!==void 0){const d=l.actionByRoot[s];if(d!==void 0&&d.blendMode===i)return d;c=l.knownActions[0],a===null&&(a=c._clip)}if(a===null)return null;const u=new ep(this,a,t,i);return this._bindAction(u,c),this._addInactiveAction(u,o,s),u}existingAction(e,t){const i=t||this._root,n=i.uuid,s=typeof e=="string"?Zr.findByName(i,e):e,a=s?s.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[n]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,n=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(n,e,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,i=e.uuid,n=this._actionsByClip,s=n[i];if(s!==void 0){const a=s.knownActions;for(let o=0,l=a.length;o!==l;++o){const c=a[o];this._deactivateAction(c);const u=c._cacheIndex,d=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,d._cacheIndex=u,t[u]=d,t.pop(),this._removeInactiveBindingsForAction(c)}delete n[i]}}uncacheRoot(e){const t=e.uuid,i=this._actionsByClip;for(const a in i){const o=i[a].actionByRoot,l=o[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const n=this._bindingsByRootAndName,s=n[t];if(s!==void 0)for(const a in s){const o=s[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){const i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class Nv extends ih{constructor(e=1,t=1,i=1,n={}){super(e,t,n),this.isRenderTarget3D=!0,this.depth=i,this.texture=new ol(null,e,t,i),this._setTextureOptions(n),this.texture.isRenderTargetTexture=!0}}class Rh{constructor(e){this.value=e}clone(){return new Rh(this.value.clone===void 0?this.value:this.value.clone())}}let Dv=0;class Ov extends Hi{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:Dv++}),this.name="",this.usage=kr,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let i=0,n=t.length;i<n;i++){const s=Array.isArray(t[i])?t[i]:[t[i]];for(let a=0;a<s.length;a++)this.uniforms.push(s[a].clone())}return this}clone(){return new this.constructor().copy(this)}}class Fv extends ul{constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class Bv{constructor(e,t,i,n,s,a=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=i,this.elementSize=n,this.count=s,this.normalized=a,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const Fu=new ct;class zv{constructor(e,t,i=0,n=1/0){this.ray=new $s(e,t),this.near=i,this.far=n,this.camera=null,this.layers=new ll,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}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):Ze("Raycaster: 
9Unsupported camera type: "+t.type)}setFromXRController(e){return Fu.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Fu),this}intersectObject(e,t=!0,i=[]){return Oc(e,this,i,t),i.sort(Bu),i}intersectObjects(e,t=!0,i=[]){for(let n=0,s=e.length;n<s;n++)Oc(e[n],this,i,t);return i.sort(Bu),i}}function Bu(r,e){return r.distance-e.distance}function Oc(r,e,t,i){let n=!0;if(r.layers.test(e.layers)&&r.raycast(e,t)===!1&&(n=!1),n===!0&&i===!0){const s=r.children;for(let a=0,o=s.length;a<o;a++)Oc(s[a],e,t,!0)}}class kv{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,Re("Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}class Vv{constructor(e=1,t=0,i=0){this.radius=e,this.phi=t,this.theta=i}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=rt(this.phi,1e-6,Math.PI-1e-6),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),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(rt(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class Hv{constructor(e=1,t=0,i=0){this.radius=e,this.theta=t,this.y=i}set(e,t,i){return this.radius=e,this.theta=t,this.y=i,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+i*i),this.theta=Math.atan2(e,i),this.y=t,this}clone(){return new this.constructor().copy(this)}}const Oh=class Oh{constructor(e,t,i,n){this.elements=[1,0,0,1],e!==void 0&&this.set(e,t,i,n)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let i=0;i<4;i++)this.elements[i]=e[i+t];return this}set(e,t,i,n){const s=this.elements;return s[0]=e,s[2]=t,s[1]=i,s[3]=n,this}};Oh.prototype.isMatrix2=!0;let Fc=Oh;const zu=new se;class Gv{constructor(e=new se(1/0,1/0),t=new se(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=zu.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}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=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(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}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}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}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))}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}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,zu).distanceTo(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}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)}}
vendor: 5,066 bytes, line 9
9const ku=new P,qa=new P,Ds=new P,Os=new P,fc=new P,Wv=new P,Xv=new P;class qv{constructor(e=new P,t=new P){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){ku.subVectors(e,this.start),qa.subVectors(this.end,this.start);const i=qa.dot(qa);if(i===0)return 0;let s=qa.dot(ku)/i;return t&&(s=rt(s,0,1)),s}closestPointToPoint(e,t,i){const n=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(n).add(this.start)}distanceSqToLine3(e,t=Wv,i=Xv){const n=10000000000000001e-32;let s,a;const o=this.start,l=e.start,c=this.end,u=e.end;Ds.subVectors(c,o),Os.subVectors(u,l),fc.subVectors(o,l);const d=Ds.dot(Ds),h=Os.dot(Os),f=Os.dot(fc);if(d<=n&&h<=n)return t.copy(o),i.copy(l),t.sub(i),t.dot(t);if(d<=n)s=0,a=f/h,a=rt(a,0,1);else{const p=Ds.dot(fc);if(h<=n)a=0,s=rt(-p/d,0,1);else{const v=Ds.dot(Os),g=d*h-v*v;g!==0?s=rt((v*f-p*h)/g,0,1):s=0,a=(v*s+f)/h,a<0?(a=0,s=rt(-p/d,0,1)):a>1&&(a=1,s=rt((v-p)/d,0,1))}}return t.copy(o).addScaledVector(Ds,s),i.copy(l).addScaledVector(Os,a),t.distanceToSquared(i)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const Vu=new P;class Yv extends Ct{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new mt,n=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,l=32;a<l;a++,o++){const c=a/l*Math.PI*2,u=o/l*Math.PI*2;n.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}i.setAttribute("position",new Ge(n,3));const s=new _i({fog:!1,toneMapped:!1});this.cone=new en(i,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Vu.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Vu),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const Tn=new P,Ya=new ct,pc=new ct;class Zv extends en{constructor(e){const t=tp(e),i=new mt,n=[],s=[];for(let c=0;c<t.length;c++){const u=t[c];u.parent&&u.parent.isBone&&(n.push(0,0,0),n.push(0,0,0),s.push(0,0,0),s.push(0,0,0))}i.setAttribute("position",new Ge(n,3)),i.setAttribute("color",new Ge(s,3));const a=new _i({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,a),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1;const o=new He(255),l=new He(65280);this.setColors(o,l)}updateMatrixWorld(e){const t=this.bones,i=this.geometry,n=i.getAttribute("position");pc.copy(this.root.matrixWorld).invert();for(let s=0,a=0;s<t.length;s++){const o=t[s];o.parent&&o.parent.isBone&&(Ya.multiplyMatrices(pc,o.matrixWorld),Tn.setFromMatrixPosition(Ya),n.setXYZ(a,Tn.x,Tn.y,Tn.z),Ya.multiplyMatrices(pc,o.parent.matrixWorld),Tn.setFromMatrixPosition(Ya),n.setXYZ(a+1,Tn.x,Tn.y,Tn.z),a+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}setColors(e,t){const n=this.geometry.getAttribute("color");for(let s=0;s<n.count;s+=2)n.setXYZ(s,e.r,e.g,e.b),n.setXYZ(s+1,t.r,t.g,t.b);return n.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function tp(r){const e=[];r.isBone===!0&&e.push(r);for(let t=0;t<r.children.length;t++)e.push(...tp(r.children[t]));return e}class Jv extends kt{constructor(e,t,i){const n=new aa(t,4,2),s=new fn({wireframe:!0,fog:!1,toneMapped:!1});super(n,s),this.light=e,this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const $v=new P,Hu=new He,Gu=new He;class Kv extends Ct{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const n=new ra(t);n.rotateY(Math.PI*.5),this.material=new fn({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=n.getAttribute("position"),a=new Float32Array(s.count*3);
vendor: 3,546 bytes, line 9
9n.setAttribute("color",new Ut(a,3)),this.add(new kt(n,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Hu.copy(this.light.color),Gu.copy(this.light.groundColor);for(let i=0,n=t.count;i<n;i++){const s=i<n/2?Hu:Gu;t.setXYZ(i,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt($v.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Qv extends en{constructor(e=10,t=10,i=4473924,n=8947848){i=new He(i),n=new He(n);const s=t/2,a=e/t,o=e/2,l=[],c=[];for(let h=0,f=0,p=-o;h<=t;h++,p+=a){l.push(-o,0,p,o,0,p),l.push(p,0,-o,p,0,o);const v=h===s?i:n;v.toArray(c,f),f+=3,v.toArray(c,f),f+=3,v.toArray(c,f),f+=3,v.toArray(c,f),f+=3}const u=new mt;u.setAttribute("position",new Ge(l,3)),u.setAttribute("color",new Ge(c,3));const d=new _i({vertexColors:!0,toneMapped:!1});super(u,d),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class jv extends en{constructor(e=10,t=16,i=8,n=64,s=4473924,a=8947848){s=new He(s),a=new He(a);const o=[],l=[];if(t>1)for(let d=0;d<t;d++){const h=d/t*(Math.PI*2),f=Math.sin(h)*e,p=Math.cos(h)*e;o.push(0,0,0),o.push(f,0,p);const v=d&1?s:a;l.push(v.r,v.g,v.b),l.push(v.r,v.g,v.b)}for(let d=0;d<i;d++){const h=d&1?s:a,f=e-e/i*d;for(let p=0;p<n;p++){let v=p/n*(Math.PI*2),g=Math.sin(v)*f,m=Math.cos(v)*f;o.push(g,0,m),l.push(h.r,h.g,h.b),v=(p+1)/n*(Math.PI*2),g=Math.sin(v)*f,m=Math.cos(v)*f,o.push(g,0,m),l.push(h.r,h.g,h.b)}}const c=new mt;c.setAttribute("position",new Ge(o,3)),c.setAttribute("color",new Ge(l,3));const u=new _i({vertexColors:!0,toneMapped:!1});super(c,u),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Wu=new P,Za=new P,Xu=new P;class e_ extends Ct{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",t===void 0&&(t=1);let n=new mt;n.setAttribute("position",new Ge([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new _i({fog:!1,toneMapped:!1});this.lightPlane=new Dn(n,s),this.add(this.lightPlane),n=new mt,n.setAttribute("position",new Ge([0,0,0,0,0,1],3)),this.targetLine=new Dn(n,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),Wu.setFromMatrixPosition(this.light.matrixWorld),Za.setFromMatrixPosition(this.light.target.matrixWorld),Xu.subVectors(Za,Wu),this.lightPlane.lookAt(Za),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Za),this.targetLine.scale.z=Xu.length()}}const Ja=new P,Ht=new Cl;class t_ extends en{constructor(e){const t=new mt,i=new _i({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],s=[],a={};o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4");function o(p,v){l(p),l(v)}
vendor: 17,138 bytes, lines 9-72
9function l(p){n.push(0,0,0),s.push(0,0,0),a[p]===void 0&&(a[p]=[]),a[p].push(n.length/3-1)}t.setAttribute("position",new Ge(n,3)),t.setAttribute("color",new Ge(s,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update();const c=new He(16755200),u=new He(16711680),d=new He(43775),h=new He(16777215),f=new He(3355443);this.setColors(c,u,d,h,f)}setColors(e,t,i,n,s){const o=this.geometry.getAttribute("color");return o.setXYZ(0,e.r,e.g,e.b),o.setXYZ(1,e.r,e.g,e.b),o.setXYZ(2,e.r,e.g,e.b),o.setXYZ(3,e.r,e.g,e.b),o.setXYZ(4,e.r,e.g,e.b),o.setXYZ(5,e.r,e.g,e.b),o.setXYZ(6,e.r,e.g,e.b),o.setXYZ(7,e.r,e.g,e.b),o.setXYZ(8,e.r,e.g,e.b),o.setXYZ(9,e.r,e.g,e.b),o.setXYZ(10,e.r,e.g,e.b),o.setXYZ(11,e.r,e.g,e.b),o.setXYZ(12,e.r,e.g,e.b),o.setXYZ(13,e.r,e.g,e.b),o.setXYZ(14,e.r,e.g,e.b),o.setXYZ(15,e.r,e.g,e.b),o.setXYZ(16,e.r,e.g,e.b),o.setXYZ(17,e.r,e.g,e.b),o.setXYZ(18,e.r,e.g,e.b),o.setXYZ(19,e.r,e.g,e.b),o.setXYZ(20,e.r,e.g,e.b),o.setXYZ(21,e.r,e.g,e.b),o.setXYZ(22,e.r,e.g,e.b),o.setXYZ(23,e.r,e.g,e.b),o.setXYZ(24,t.r,t.g,t.b),o.setXYZ(25,t.r,t.g,t.b),o.setXYZ(26,t.r,t.g,t.b),o.setXYZ(27,t.r,t.g,t.b),o.setXYZ(28,t.r,t.g,t.b),o.setXYZ(29,t.r,t.g,t.b),o.setXYZ(30,t.r,t.g,t.b),o.setXYZ(31,t.r,t.g,t.b),o.setXYZ(32,i.r,i.g,i.b),o.setXYZ(33,i.r,i.g,i.b),o.setXYZ(34,i.r,i.g,i.b),o.setXYZ(35,i.r,i.g,i.b),o.setXYZ(36,i.r,i.g,i.b),o.setXYZ(37,i.r,i.g,i.b),o.setXYZ(38,n.r,n.g,n.b),o.setXYZ(39,n.r,n.g,n.b),o.setXYZ(40,s.r,s.g,s.b),o.setXYZ(41,s.r,s.g,s.b),o.setXYZ(42,s.r,s.g,s.b),o.setXYZ(43,s.r,s.g,s.b),o.setXYZ(44,s.r,s.g,s.b),o.setXYZ(45,s.r,s.g,s.b),o.setXYZ(46,s.r,s.g,s.b),o.setXYZ(47,s.r,s.g,s.b),o.setXYZ(48,s.r,s.g,s.b),o.setXYZ(49,s.r,s.g,s.b),o.needsUpdate=!0,this}update(){const e=this.geometry,t=this.pointMap,i=1,n=1;let s,a;if(Ht.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)s=1,a=0;else if(this.camera.coordinateSystem===wi)s=-1,a=1;else if(this.camera.coordinateSystem===ls)s=0,a=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);Yt("c",t,e,Ht,0,0,s),Yt("t",t,e,Ht,0,0,a),Yt("n1",t,e,Ht,-i,-n,s),Yt("n2",t,e,Ht,i,-n,s),Yt("n3",t,e,Ht,-i,n,s),Yt("n4",t,e,Ht,i,n,s),Yt("f1",t,e,Ht,-i,-n,a),Yt("f2",t,e,Ht,i,-n,a),Yt("f3",t,e,Ht,-i,n,a),Yt("f4",t,e,Ht,i,n,a),Yt("u1",t,e,Ht,i*.7,n*1.1,s),Yt("u2",t,e,Ht,-i*.7,n*1.1,s),Yt("u3",t,e,Ht,0,n*2,s),Yt("cf1",t,e,Ht,-i,0,a),Yt("cf2",t,e,Ht,i,0,a),Yt("cf3",t,e,Ht,0,-n,a),Yt("cf4",t,e,Ht,0,n,a),Yt("cn1",t,e,Ht,-i,0,s),Yt("cn2",t,e,Ht,i,0,s),Yt("cn3",t,e,Ht,0,-n,s),Yt("cn4",t,e,Ht,0,n,s),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Yt(r,e,t,i,n,s,a){Ja.set(n,s,a).unproject(i);const o=e[r];if(o!==void 0){const l=t.getAttribute("position");for(let c=0,u=o.length;c<u;c++)l.setXYZ(o[c],Ja.x,Ja.y,Ja.z)}}const $a=new oi;class i_ extends en{constructor(e,t=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=new Float32Array(24),s=new mt;s.setIndex(new Ut(i,1)),s.setAttribute("position",new Ut(n,3)),super(s,new _i({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&$a.setFromObject(this.object),$a.isEmpty())return;const e=$a.min,t=$a.max,i=this.geometry.attributes.position,n=i.array;n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=e.x,n[4]=t.y,n[5]=t.z,n[6]=e.x,n[7]=e.y,n[8]=t.z,n[9]=t.x,n[10]=e.y,n[11]=t.z,n[12]=t.x,n[13]=t.y,n[14]=e.z,n[15]=e.x,n[16]=t.y,n[17]=e.z,n[18]=e.x,n[19]=e.y,n[20]=e.z,n[21]=t.x,n[22]=e.y,n[23]=e.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class n_ extends en{constructor(e,t=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),n=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new mt;s.setIndex(new Ut(i,1)),s.setAttribute("position",new Ge(n,3)),super(s,new _i({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class s_ extends Dn{constructor(e,t=1,i=16776960){const n=i,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],a=new mt;a.setAttribute("position",new Ge(s,3)),a.computeBoundingSphere(),super(a,new _i({color:n,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new mt;l.setAttribute("position",new Ge(o,3)),l.computeBoundingSphere(),this.add(new kt(l,new fn({color:n,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const qu=new P;let Ka,mc;class r_ extends Ct{constructor(e=new P(0,0,1),t=new P(0,0,0),i=1,n=16776960,s=i*.2,a=s*.2){super(),this.type="ArrowHelper",Ka===void 0&&(Ka=new mt,Ka.setAttribute("position",new Ge([0,0,0,0,1,0],3)),mc=new na(.5,1,5,1),mc.translate(0,-.5,0)),this.position.copy(t),this.line=new Dn(Ka,new _i({color:n,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new kt(mc,new fn({color:n,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,s,a)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{qu.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(qu,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class a_ extends en{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],n=new mt;n.setAttribute("position",new Ge(t,3)),n.setAttribute("color",new Ge(i,3));const s=new _i({vertexColors:!0,toneMapped:!1});super(n,s),this.type="AxesHelper"}setColors(e,t,i){const n=new He,s=this.geometry.attributes.color.array;return n.set(e),n.toArray(s,0),n.toArray(s,3),n.set(t),n.toArray(s,6),n.toArray(s,9),n.set(i),n.toArray(s,12),n.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class o_{constructor(){this.type="ShapePath",this.color=new He,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Jo,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,n){return this.currentPath.quadraticCurveTo(e,t,i,n),this}bezierCurveTo(e,t,i,n,s,a){return this.currentPath.bezierCurveTo(e,t,i,n,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(m){const _=[];for(let x=0,M=m.length;x<M;x++){const R=m[x],E=new as;E.curves=R.curves,_.push(E)}return _}function i(m,_){const x=_.length;let M=!1;for(let R=x-1,E=0;E<x;R=E++){let I=_[R],y=_[E],w=y.x-I.x,U=y.y-I.y;if(Math.abs(U)>Number.EPSILON){if(U<0&&(I=_[E],w=-w,y=_[R],U=-U),m.y<I.y||m.y>y.y)continue;if(m.y===I.y){if(m.x===I.x)return!0}else{const L=U*(m.x-I.x)-w*(m.y-I.y);if(L===0)return!0;if(L<0)continue;M=!M}}else{if(m.y!==I.y)continue;if(y.x<=m.x&&m.x<=I.x||I.x<=m.x&&m.x<=y.x)return!0}}return M}const n=Bi.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,l;const c=[];if(s.length===1)return o=s[0],l=new as,l.curves=o.curves,c.push(l),c;let u=!n(s[0].getPoints());u=e?!u:u;const d=[],h=[];let f=[],p=0,v;h[p]=void 0,f[p]=[];for(let m=0,_=s.length;m<_;m++)o=s[m],v=o.getPoints(),a=n(v),a=e?!a:a,a?(!u&&h[p]&&p++,h[p]={s:new as,p:v},h[p].s.curves=o.curves,u&&p++,f[p]=[]):f[p].push({h:o,p:v[0]});if(!h[0])return t(s);if(h.length>1){let m=!1,_=0;for(let x=0,M=h.length;x<M;x++)d[x]=[];for(let x=0,M=h.length;x<M;x++){const R=f[x];for(let E=0;E<R.length;E++){const I=R[E];let y=!0;for(let w=0;w<h.length;w++)i(I.p,h[w].p)&&(x!==w&&_++,y?(y=!1,d[w].push(I)):m=!0);y&&d[x].push(I)}}_>0&&m===!1&&(f=d)}let g;for(let m=0,_=h.length;m<_;m++){l=h[m].s,c.push(l),g=f[m];for(let x=0,M=g.length;x<M;x++)l.holes.push(g[x].h)}return c}}class l_ extends Hi{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){if(e===void 0){Re("Controls: connect() now requires an element.");return}this.domElement!==null&&this.disconnect(),this.domElement=e}disconnect(){}dispose(){}update(){}}function c_(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2):(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0),r}function h_(r,e){const t=r.image&&r.image.width?r.image.width/r.image.height:1;return t>e?(r.repeat.x=e/t,r.repeat.y=1,r.offset.x=(1-r.repeat.x)/2,r.offset.y=0):(r.repeat.x=1,r.repeat.y=t/e,r.offset.x=0,r.offset.y=(1-r.repeat.y)/2),r}function u_(r){return r.repeat.x=1,r.repeat.y=1,r.offset.x=0,r.offset.y=0,r}function Bc(r,e,t,i){const n=d_(i);switch(t){case Qc:return r*e;case jr:return r*e/n.components*n.byteLength;case ea:return r*e/n.components*n.byteLength;case Ln:return r*e*2/n.components*n.byteLength;case tl:return r*e*2/n.components*n.byteLength;case jc:return r*e*3/n.components*n.byteLength;case Kt:return r*e*4/n.components*n.byteLength;case il:return r*e*4/n.components*n.byteLength;case Er:case Ar:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Cr:case Rr:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case mo:case vo:return Math.max(r,16)*Math.max(e,8)/4;case po:case go:return Math.max(r,8)*Math.max(e,8)/2;case _o:case yo:case Mo:case So:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case xo:case Dr:case bo:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case To:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case wo:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Eo:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Ao:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case Co:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Ro:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Io:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case Po:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Lo:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Uo:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case No:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case Do:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Oo:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Fo:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case Bo:case zo:case ko:return Math.ceil(r/4)*Math.ceil(e/4)*16;case Vo:case Ho:return Math.ceil(r/4)*Math.ceil(e/4)*8;case Or:case Go:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function d_(r){switch(r){case ii:case Ko:return{byteLength:1,components:1};case Gs:case Qo:case Jt:return{byteLength:2,components:1};case jo:case el:return{byteLength:2,components:4};case Ci:case Qr:case Ft:return{byteLength:4,components:1};case $c:case Kc:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}class f_{static contain(e,t){return c_(e,t)}static cover(e,t){return h_(e,t)}static fill(e){return u_(e)}static getByteLength(e,t,i,n){return Bc(e,t,i,n)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:$r}}));typeof window<"u"&&(window.__THREE__?Re("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=$r);/**
10 * @license
11 * Copyright 2010-2026 Three.js Authors
12 * SPDX-License-Identifier: MIT
13 */function ip(){let r=null,e=!1,t=null,i=null;function n(s,a){t(s,a),i=r.requestAnimationFrame(n)}return{start:function(){e!==!0&&t!==null&&r!==null&&(i=r.requestAnimationFrame(n),e=!0)},stop:function(){r!==null&&r.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function p_(r){const e=new WeakMap;function t(o,l){const c=o.array,u=o.usage,d=c.byteLength,h=r.createBuffer();r.bindBuffer(l,h),r.bufferData(l,c,u),o.onUploadCallback();let f;if(c instanceof Float32Array)f=r.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)f=r.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?f=r.HALF_FLOAT:f=r.UNSIGNED_SHORT;else if(c instanceof Int16Array)f=r.SHORT;else if(c instanceof Uint32Array)f=r.UNSIGNED_INT;else if(c instanceof Int32Array)f=r.INT;else if(c instanceof Int8Array)f=r.BYTE;else if(c instanceof Uint8Array)f=r.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)f=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:h,type:f,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:d}}function i(o,l,c){const u=l.array,d=l.updateRanges;if(r.bindBuffer(c,o),d.length===0)r.bufferSubData(c,0,u);else{d.sort((f,p)=>f.start-p.start);let h=0;for(let f=1;f<d.length;f++){const p=d[h],v=d[f];v.start<=p.start+p.count+1?p.count=Math.max(p.count,v.start+v.count-p.start):(++h,d[h]=v)}d.length=h+1;for(let f=0,p=d.length;f<p;f++){const v=d[f];r.bufferSubData(c,v.start*u.BYTES_PER_ELEMENT,u,v.start,v.count)}l.clearUpdateRanges()}l.onUploadCallback()}function n(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(r.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const u=e.get(o);(!u||u.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,t(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(c.buffer,o,l),c.version=o.version}}return{get:n,remove:s,update:a}}var m_=`#ifdef USE_ALPHAHASH
14	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
15#endif`,g_=`#ifdef USE_ALPHAHASH
16	const float ALPHA_HASH_SCALE = 0.05;
17	float hash2D( vec2 value ) {
18		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
19	}
20	float hash3D( vec3 value ) {
21		return hash2D( vec2( hash2D( value.xy ), value.z ) );
22	}
23	float getAlphaHashThreshold( vec3 position ) {
24		float maxDeriv = max(
25			length( dFdx( position.xyz ) ),
26			length( dFdy( position.xyz ) )
27		);
28		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
29		vec2 pixScales = vec2(
30			exp2( floor( log2( pixScale ) ) ),
31			exp2( ceil( log2( pixScale ) ) )
32		);
33		vec2 alpha = vec2(
34			hash3D( floor( pixScales.x * position.xyz ) ),
35			hash3D( floor( pixScales.y * position.xyz ) )
36		);
37		float lerpFactor = fract( log2( pixScale ) );
38		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
39		float a = min( lerpFactor, 1.0 - lerpFactor );
40		vec3 cases = vec3(
41			x * x / ( 2.0 * a * ( 1.0 - a ) ),
42			( x - 0.5 * a ) / ( 1.0 - a ),
43			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
44		);
45		float threshold = ( x < ( 1.0 - a ) )
46			? ( ( x < a ) ? cases.x : cases.y )
47			: cases.z;
48		return clamp( threshold , 1.0e-6, 1.0 );
49	}
50#endif`,v_=`#ifdef USE_ALPHAMAP
51	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
52#endif`,__=`#ifdef USE_ALPHAMAP
53	uniform sampler2D alphaMap;
54#endif`,y_=`#ifdef USE_ALPHATEST
55	#ifdef ALPHA_TO_COVERAGE
56	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
57	if ( diffuseColor.a == 0.0 ) discard;
58	#else
59	if ( diffuseColor.a < alphaTest ) discard;
60	#endif
61#endif`,x_=`#ifdef USE_ALPHATEST
62	uniform float alphaTest;
63#endif`,M_=`#ifdef USE_AOMAP
64	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
65	reflectedLight.indirectDiffuse *= ambientOcclusion;
66	#if defined( USE_CLEARCOAT ) 
67		clearcoatSpecularIndirect *= ambientOcclusion;
68	#endif
69	#if defined( USE_SHEEN ) 
70		sheenSpecularIndirect *= ambientOcclusion;
71	#endif
72	#if defined( USE_ENVMAP ) && defined( STANDARD )
73		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
74		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
75	#endif
76#endif`,S_=`#ifdef USE_AOMAP
77	uniform sampler2D aoMap;
78	uniform float aoMapIntensity;
79#endif`,b_=`#ifdef USE_BATCHING
80	#if ! defined( GL_ANGLE_multi_draw )
81	#define gl_DrawID _gl_DrawID
82	uniform int _gl_DrawID;
83	#endif
84	uniform highp sampler2D batchingTexture;
85	uniform highp usampler2D batchingIdTexture;
86	mat4 getBatchingMatrix( const in float i ) {
87		int size = textureSize( batchingTexture, 0 ).x;
88		int j = int( i ) * 4;
89		int x = j % size;
90		int y = j / size;
91		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
92		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
93		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
94		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
95		return mat4( v1, v2, v3, v4 );
96	}
97	float getIndirectIndex( const in int i ) {
98		int size = textureSize( batchingIdTexture, 0 ).x;
99		int x = i % size;
100		int y = i / size;
101		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
102	}
103#endif
104#ifdef USE_BATCHING_COLOR
105	uniform sampler2D batchingColorTexture;
106	vec4 getBatchingColor( const in float i ) {
107		int size = textureSize( batchingColorTexture, 0 ).x;
108		int j = int( i );
109		int x = j % size;
110		int y = j / size;
111		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
112	}
113#endif`,T_=`#ifdef USE_BATCHING
114	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
115#endif`,w_=`vec3 transformed = vec3( position );
116#ifdef USE_ALPHAHASH
117	vPosition = vec3( position );
118#endif`,E_=`vec3 objectNormal = vec3( normal );
119#ifdef USE_TANGENT
120	vec3 objectTangent = vec3( tangent.xyz );
121#endif`,A_=`float G_BlinnPhong_Implicit( ) {
122	return 0.25;
123}
124float D_BlinnPhong( const in float shininess, const in float dotNH ) {
125	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
126}
127vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
128	vec3 halfDir = normalize( lightDir + viewDir );
129	float dotNH = saturate( dot( normal, halfDir ) );
130	float dotVH = saturate( dot( viewDir, halfDir ) );
131	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
132	float G = G_BlinnPhong_Implicit( );
133	float D = D_BlinnPhong( shininess, dotNH );
134	return F * ( G * D );
135} // validated`,C_=`#ifdef USE_IRIDESCENCE
136	const mat3 XYZ_TO_REC709 = mat3(
137		 3.2404542, -0.9692660,  0.0556434,
138		-1.5371385,  1.8760108, -0.2040259,
139		-0.4985314,  0.0415560,  1.0572252
140	);
141	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
142		vec3 sqrtF0 = sqrt( fresnel0 );
143		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
144	}
145	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
146		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
147	}
148	float IorToFresnel0( float transmittedIor, float incidentIor ) {
149		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
150	}
151	vec3 evalSensitivity( float OPD, vec3 shift ) {
152		float phase = 2.0 * PI * OPD * 1.0e-9;
153		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
154		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
155		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
156		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
157		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 ) );
158		xyz /= 1.0685e-7;
159		vec3 rgb = XYZ_TO_REC709 * xyz;
160		return rgb;
161	}
162	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
163		vec3 I;
164		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
165		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
166		float cosTheta2Sq = 1.0 - sinTheta2Sq;
167		if ( cosTheta2Sq < 0.0 ) {
168			return vec3( 1.0 );
169		}
170		float cosTheta2 = sqrt( cosTheta2Sq );
171		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
172		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
173		float T121 = 1.0 - R12;
174		float phi12 = 0.0;
175		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
176		float phi21 = PI - phi12;
177		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
178		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
179		vec3 phi23 = vec3( 0.0 );
180		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
181		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
182		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
183		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
184		vec3 phi = vec3( phi21 ) + phi23;
185		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
186		vec3 r123 = sqrt( R123 );
187		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
188		vec3 C0 = R12 + Rs;
189		I = C0;
190		vec3 Cm = Rs - T121;
191		for ( int m = 1; m <= 2; ++ m ) {
192			Cm *= r123;
193			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
194			I += Cm * Sm;
195		}
196		return max( I, vec3( 0.0 ) );
197	}
198#endif`,R_=`#ifdef USE_BUMPMAP
199	uniform sampler2D bumpMap;
200	uniform float bumpScale;
201	vec2 dHdxy_fwd() {
202		vec2 dSTdx = dFdx( vBumpMapUv );
203		vec2 dSTdy = dFdy( vBumpMapUv );
204		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
205		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
206		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
207		return vec2( dBx, dBy );
208	}
209	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
210		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
211		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
212		vec3 vN = surf_norm;
213		vec3 R1 = cross( vSigmaY, vN );
214		vec3 R2 = cross( vN, vSigmaX );
215		float fDet = dot( vSigmaX, R1 ) * faceDirection;
216		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
217		return normalize( abs( fDet ) * surf_norm - vGrad );
218	}
219#endif`,I_=`#if NUM_CLIPPING_PLANES > 0
220	vec4 plane;
221	#ifdef ALPHA_TO_COVERAGE
222		float distanceToPlane, distanceGradient;
223		float clipOpacity = 1.0;
224		#pragma unroll_loop_start
225		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
226			plane = clippingPlanes[ i ];
227			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
228			distanceGradient = fwidth( distanceToPlane ) / 2.0;
229			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
230			if ( clipOpacity == 0.0 ) discard;
231		}
232		#pragma unroll_loop_end
233		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
234			float unionClipOpacity = 1.0;
235			#pragma unroll_loop_start
236			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
237				plane = clippingPlanes[ i ];
238				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
239				distanceGradient = fwidth( distanceToPlane ) / 2.0;
240				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
241			}
242			#pragma unroll_loop_end
243			clipOpacity *= 1.0 - unionClipOpacity;
244		#endif
245		diffuseColor.a *= clipOpacity;
246		if ( diffuseColor.a == 0.0 ) discard;
247	#else
248		#pragma unroll_loop_start
249		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
250			plane = clippingPlanes[ i ];
251			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
252		}
253		#pragma unroll_loop_end
254		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
255			bool clipped = true;
256			#pragma unroll_loop_start
257			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
258				plane = clippingPlanes[ i ];
259				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
260			}
261			#pragma unroll_loop_end
262			if ( clipped ) discard;
263		#endif
264	#endif
265#endif`,P_=`#if NUM_CLIPPING_PLANES > 0
266	varying vec3 vClipPosition;
267	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
268#endif`,L_=`#if NUM_CLIPPING_PLANES > 0
269	varying vec3 vClipPosition;
270#endif`,U_=`#if NUM_CLIPPING_PLANES > 0
271	vClipPosition = - mvPosition.xyz;
272#endif`,N_=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
273	diffuseColor *= vColor;
274#endif`,D_=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
275	varying vec4 vColor;
276#endif`,O_=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
277	varying vec4 vColor;
278#endif`,F_=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
279	vColor = vec4( 1.0 );
280#endif
281#ifdef USE_COLOR_ALPHA
282	vColor *= color;
283#elif defined( USE_COLOR )
284	vColor.rgb *= color;
285#endif
286#ifdef USE_INSTANCING_COLOR
287	vColor.rgb *= instanceColor.rgb;
288#endif
289#ifdef USE_BATCHING_COLOR
290	vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
291#endif`,B_=`#define PI 3.141592653589793
292#define PI2 6.283185307179586
293#define PI_HALF 1.5707963267948966
294#define RECIPROCAL_PI 0.3183098861837907
295#define RECIPROCAL_PI2 0.15915494309189535
296#define EPSILON 1e-6
297#ifndef saturate
298#define saturate( a ) clamp( a, 0.0, 1.0 )
299#endif
300#define whiteComplement( a ) ( 1.0 - saturate( a ) )
301float pow2( const in float x ) { return x*x; }
302vec3 pow2( const in vec3 x ) { return x*x; }
303float pow3( const in float x ) { return x*x*x; }
304float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
305float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
306float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
307highp float rand( const in vec2 uv ) {
308	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
309	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
310	return fract( sin( sn ) * c );
311}
312#ifdef HIGH_PRECISION
313	float precisionSafeLength( vec3 v ) { return length( v ); }
314#else
315	float precisionSafeLength( vec3 v ) {
316		float maxComponent = max3( abs( v ) );
317		return length( v / maxComponent ) * maxComponent;
318	}
319#endif
320struct IncidentLight {
321	vec3 color;
322	vec3 direction;
323	bool visible;
324};
325struct ReflectedLight {
326	vec3 directDiffuse;
327	vec3 directSpecular;
328	vec3 indirectDiffuse;
329	vec3 indirectSpecular;
330};
331#ifdef USE_ALPHAHASH
332	varying vec3 vPosition;
333#endif
334vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
335	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
336}
337vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
338	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
339}
340bool isPerspectiveMatrix( mat4 m ) {
341	return m[ 2 ][ 3 ] == - 1.0;
342}
343vec2 equirectUv( in vec3 dir ) {
344	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
345	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
346	return vec2( u, v );
347}
348vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
349	return RECIPROCAL_PI * diffuseColor;
350}
351vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
352	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
353	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
354}
355float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
356	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
357	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
358} // validated`,z_=`#ifdef ENVMAP_TYPE_CUBE_UV
359	#define cubeUV_minMipLevel 4.0
360	#define cubeUV_minTileSize 16.0
361	float getFace( vec3 direction ) {
362		vec3 absDirection = abs( direction );
363		float face = - 1.0;
364		if ( absDirection.x > absDirection.z ) {
365			if ( absDirection.x > absDirection.y )
366				face = direction.x > 0.0 ? 0.0 : 3.0;
367			else
368				face = direction.y > 0.0 ? 1.0 : 4.0;
369		} else {
370			if ( absDirection.z > absDirection.y )
371				face = direction.z > 0.0 ? 2.0 : 5.0;
372			else
373				face = direction.y > 0.0 ? 1.0 : 4.0;
374		}
375		return face;
376	}
377	vec2 getUV( vec3 direction, float face ) {
378		vec2 uv;
379		if ( face == 0.0 ) {
380			uv = vec2( direction.z, direction.y ) / abs( direction.x );
381		} else if ( face == 1.0 ) {
382			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
383		} else if ( face == 2.0 ) {
384			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
385		} else if ( face == 3.0 ) {
386			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
387		} else if ( face == 4.0 ) {
388			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
389		} else {
390			uv = vec2( direction.x, direction.y ) / abs( direction.z );
391		}
392		return 0.5 * ( uv + 1.0 );
393	}
394	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
395		float face = getFace( direction );
396		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
397		mipInt = max( mipInt, cubeUV_minMipLevel );
398		float faceSize = exp2( mipInt );
399		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
400		if ( face > 2.0 ) {
401			uv.y += faceSize;
402			face -= 3.0;
403		}
404		uv.x += face * faceSize;
405		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
406		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
407		uv.x *= CUBEUV_TEXEL_WIDTH;
408		uv.y *= CUBEUV_TEXEL_HEIGHT;
409		#ifdef texture2DGradEXT
410			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
411		#else
412			return texture2D( envMap, uv ).rgb;
413		#endif
414	}
415	#define cubeUV_r0 1.0
416	#define cubeUV_m0 - 2.0
417	#define cubeUV_r1 0.8
418	#define cubeUV_m1 - 1.0
419	#define cubeUV_r4 0.4
420	#define cubeUV_m4 2.0
421	#define cubeUV_r5 0.305
422	#define cubeUV_m5 3.0
423	#define cubeUV_r6 0.21
424	#define cubeUV_m6 4.0
425	float roughnessToMip( float roughness ) {
426		float mip = 0.0;
427		if ( roughness >= cubeUV_r1 ) {
428			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
429		} else if ( roughness >= cubeUV_r4 ) {
430			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
431		} else if ( roughness >= cubeUV_r5 ) {
432			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
433		} else if ( roughness >= cubeUV_r6 ) {
434			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
435		} else {
436			mip = - 2.0 * log2( 1.16 * roughness );		}
437		return mip;
438	}
439	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
440		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
441		float mipF = fract( mip );
442		float mipInt = floor( mip );
443		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
444		if ( mipF == 0.0 ) {
445			return vec4( color0, 1.0 );
446		} else {
447			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
448			return vec4( mix( color0, color1, mipF ), 1.0 );
449		}
450	}
451#endif`,k_=`vec3 transformedNormal = objectNormal;
452#ifdef USE_TANGENT
453	vec3 transformedTangent = objectTangent;
454#endif
455#ifdef USE_BATCHING
456	mat3 bm = mat3( batchingMatrix );
457	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
458	transformedNormal = bm * transformedNormal;
459	#ifdef USE_TANGENT
460		transformedTangent = bm * transformedTangent;
461	#endif
462#endif
463#ifdef USE_INSTANCING
464	mat3 im = mat3( instanceMatrix );
465	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
466	transformedNormal = im * transformedNormal;
467	#ifdef USE_TANGENT
468		transformedTangent = im * transformedTangent;
469	#endif
470#endif
471transformedNormal = normalMatrix * transformedNormal;
472#ifdef FLIP_SIDED
473	transformedNormal = - transformedNormal;
474#endif
475#ifdef USE_TANGENT
476	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
477	#ifdef FLIP_SIDED
478		transformedTangent = - transformedTangent;
479	#endif
480#endif`,V_=`#ifdef USE_DISPLACEMENTMAP
481	uniform sampler2D displacementMap;
482	uniform float displacementScale;
483	uniform float displacementBias;
484#endif`,H_=`#ifdef USE_DISPLACEMENTMAP
485	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
485placementBias );
486#endif`,G_=`#ifdef USE_EMISSIVEMAP
487	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
488	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
489		emissiveColor = sRGBTransferEOTF( emissiveColor );
490	#endif
491	totalEmissiveRadiance *= emissiveColor.rgb;
492#endif`,W_=`#ifdef USE_EMISSIVEMAP
493	uniform sampler2D emissiveMap;
494#endif`,X_="gl_FragColor = linearToOutputTexel( gl_FragColor );",q_=`vec4 LinearTransferOETF( in vec4 value ) {
495	return value;
496}
497vec4 sRGBTransferEOTF( in vec4 value ) {
498	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
499}
500vec4 sRGBTransferOETF( in vec4 value ) {
501	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 );
502}`,Y_=`#ifdef USE_ENVMAP
503	#ifdef ENV_WORLDPOS
504		vec3 cameraToFrag;
505		if ( isOrthographic ) {
506			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
507		} else {
508			cameraToFrag = normalize( vWorldPosition - cameraPosition );
509		}
510		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
511		#ifdef ENVMAP_MODE_REFLECTION
512			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
513		#else
514			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
515		#endif
516	#else
517		vec3 reflectVec = vReflect;
518	#endif
519	#ifdef ENVMAP_TYPE_CUBE
520		vec4 envColor = textureCube( envMap, envMapRotation * reflectVec );
521		#ifdef ENVMAP_BLENDING_MULTIPLY
522			outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
523		#elif defined( ENVMAP_BLENDING_MIX )
524			outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
525		#elif defined( ENVMAP_BLENDING_ADD )
526			outgoingLight += envColor.xyz * specularStrength * reflectivity;
527		#endif
528	#endif
529#endif`,Z_=`#ifdef USE_ENVMAP
530	uniform float envMapIntensity;
531	uniform mat3 envMapRotation;
532	#ifdef ENVMAP_TYPE_CUBE
533		uniform samplerCube envMap;
534	#else
535		uniform sampler2D envMap;
536	#endif
537#endif`,J_=`#ifdef USE_ENVMAP
538	uniform float reflectivity;
539	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
540		#define ENV_WORLDPOS
541	#endif
542	#ifdef ENV_WORLDPOS
543		varying vec3 vWorldPosition;
544		uniform float refractionRatio;
545	#else
546		varying vec3 vReflect;
547	#endif
548#endif`,$_=`#ifdef USE_ENVMAP
549	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
550		#define ENV_WORLDPOS
551	#endif
552	#ifdef ENV_WORLDPOS
553		
554		varying vec3 vWorldPosition;
555	#else
556		varying vec3 vReflect;
557		uniform float refractionRatio;
558	#endif
559#endif`,K_=`#ifdef USE_ENVMAP
560	#ifdef ENV_WORLDPOS
561		vWorldPosition = worldPosition.xyz;
562	#else
563		vec3 cameraToVertex;
564		if ( isOrthographic ) {
565			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
566		} else {
567			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
568		}
569		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
570		#ifdef ENVMAP_MODE_REFLECTION
571			vReflect = reflect( cameraToVertex, worldNormal );
572		#else
573			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
574		#endif
575	#endif
576#endif`,Q_=`#ifdef USE_FOG
577	vFogDepth = - mvPosition.z;
578#endif`,j_=`#ifdef USE_FOG
579	varying float vFogDepth;
580#endif`,e0=`#ifdef USE_FOG
581	#ifdef FOG_EXP2
582		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
583	#else
584		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
585	#endif
586	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
587#endif`,t0=`#ifdef USE_FOG
588	uniform vec3 fogColor;
589	varying float vFogDepth;
590	#ifdef FOG_EXP2
591		uniform float fogDensity;
592	#else
593		uniform float fogNear;
594		uniform float fogFar;
595	#endif
596#endif`,i0=`#ifdef USE_GRADIENTMAP
597	uniform sampler2D gradientMap;
598#endif
599vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
600	float dotNL = dot( normal, lightDirection );
601	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
602	#ifdef USE_GRADIENTMAP
603		return vec3( texture2D( gradientMap, coord ).r );
604	#else
605		vec2 fw = fwidth( coord ) * 0.5;
606		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
607	#endif
608}`,n0=`#ifdef USE_LIGHTMAP
609	uniform sampler2D lightMap;
610	uniform float lightMapIntensity;
611#endif`,s0=`LambertMaterial material;
612material.diffuseColor = diffuseColor.rgb;
613material.specularStrength = specularStrength;`,r0=`varying vec3 vViewPosition;
614struct LambertMaterial {
615	vec3 diffuseColor;
616	float specularStrength;
617};
618void 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 ) {
619	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
620	vec3 irradiance = dotNL * directLight.color;
621	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
622}
623void 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 ) {
624	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
625}
626#define RE_Direct				RE_Direct_Lambert
627#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,a0=`uniform bool receiveShadow;
628uniform vec3 ambientLightColor;
629#if defined( USE_LIGHT_PROBES )
630	uniform vec3 lightProbe[ 9 ];
631#endif
632vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
633	float x = normal.x, y = normal.y, z = normal.z;
634	vec3 result = shCoefficients[ 0 ] * 0.886227;
635	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
636	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
637	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
638	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
639	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
640	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
641	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
642	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
643	return result;
644}
645vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
646	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
647	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
648	return irradiance;
649}
650vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
651	vec3 irradiance = ambientLightColor;
652	return irradiance;
653}
654float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
655	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
656	if ( cutoffDistance > 0.0 ) {
657		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
658	}
659	return distanceFalloff;
660}
661float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
662	return smoothstep( coneCosine, penumbraCosine, angleCosine );
663}
664#if NUM_DIR_LIGHTS > 0
665	struct DirectionalLight {
666		vec3 direction;
667		vec3 color;
668	};
669	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
670	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
671		light.color = directionalLight.color;
672		light.direction = directionalLight.direction;
673		light.visible = true;
674	}
675#endif
676#if NUM_POINT_LIGHTS > 0
677	struct PointLight {
678		vec3 position;
679		vec3 color;
680		float distance;
681		float decay;
682	};
683	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
684	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
685		vec3 lVector = pointLight.position - geometryPosition;
686		light.direction = normalize( lVector );
687		float lightDistance = length( lVector );
688		light.color = pointLight.color;
689		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
690		light.visible = ( light.color != vec3( 0.0 ) );
691	}
692#endif
693#if NUM_SPOT_LIGHTS > 0
694	struct SpotLight {
695		vec3 position;
696		vec3 direction;
697		vec3 color;
698		float distance;
699		float decay;
700		float coneCos;
701		float penumbraCos;
702	};
703	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
704	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
705		vec3 lVector = spotLight.position - geometryPosition;
706		light.direction = normalize( lVector );
707		float angleCos = dot( light.direction, spotLight.direction );
708		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
709		if ( spotAttenuation > 0.0 ) {
710			float lightDistance = length( lVector );
711			light.color = spotLight.color * spotAttenuation;
712			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
713			light.visible = ( light.color != vec3( 0.0 ) );
714		} else {
715			light.color = vec3( 0.0 );
716			light.visible = false;
717		}
718	}
719#endif
720#if NUM_RECT_AREA_LIGHTS > 0
721	struct RectAreaLight {
722		vec3 color;
723		vec3 position;
724		vec3 halfWidth;
725		vec3 halfHeight;
726	};
727	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
728	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
729#endif
730#if NUM_HEMI_LIGHTS > 0
731	struct HemisphereLight {
732		vec3 direction;
733		vec3 skyColor;
734		vec3 groundColor;
735	};
736	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
737	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
738		float dotNL = dot( normal, hemiLight.direction );
739		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
740		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
741		return irradiance;
742	}
743#endif
744#include <lightprobes_pars_fragment>`,o0=`#ifdef USE_ENVMAP
745	vec3 getIBLIrradiance( const in vec3 normal ) {
746		#ifdef ENVMAP_TYPE_CUBE_UV
747			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
748			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
749			return PI * envMapColor.rgb * envMapIntensity;
750		#else
751			return vec3( 0.0 );
752		#endif
753	}
754	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
755		#ifdef ENVMAP_TYPE_CUBE_UV
756			vec3 reflectVec = reflect( - viewDir, normal );
757			reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
758			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
759			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
760			return envMapColor.rgb * envMapIntensity;
761		#else
762			return vec3( 0.0 );
763		#endif
764	}
765	#ifdef USE_ANISOTROPY
766		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
767			#ifdef ENVMAP_TYPE_CUBE_UV
768				vec3 bentNormal = cross( bitangent, viewDir );
769				bentNormal = normalize( cross( bentNormal, bitangent ) );
770				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
771				return getIBLRadiance( viewDir, bentNormal, roughness );
772			#else
773				return vec3( 0.0 );
774			#endif
775		}
776	#endif
777#endif`,l0=`ToonMaterial material;
778material.diffuseColor = diffuseColor.rgb;`,c0=`varying vec3 vViewPosition;
779struct ToonMaterial {
780	vec3 diffuseColor;
781};
782void 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 ) {
783	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
784	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
785}
786void 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 ) {
787	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
788}
789#define RE_Direct				RE_Direct_Toon
790#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,h0=`BlinnPhongMaterial material;
791material.diffuseColor = diffuseColor.rgb;
792material.specularColor = specular;
793material.specularShininess = shininess;
794material.specularStrength = specularStrength;`,u0=`varying vec3 vViewPosition;
795struct BlinnPhongMaterial {
796	vec3 diffuseColor;
797	vec3 specularColor;
798	float specularShininess;
799	float specularStrength;
800};
801void 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 ) {
802	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
803	vec3 irradiance = dotNL * directLight.color;
804	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
805	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
806}
807void 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 ) {
808	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
809}
810#define RE_Direct				RE_Direct_BlinnPhong
811#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,d0=`PhysicalMaterial material;
812material.diffuseColor = diffuseColor.rgb;
813material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
814material.metalness = metalnessFactor;
815vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
816float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
817material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
818material.roughness = min( material.roughness, 1.0 );
819#ifdef IOR
820	material.ior = ior;
821	#ifdef USE_SPECULAR
822		float specularIntensityFactor = specularIntensity;
823		vec3 specularColorFactor = specularColor;
824		#ifdef USE_SPECULAR_COLORMAP
825			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
826		#endif
827		#ifdef USE_SPECULAR_INTENSITYMAP
828			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
829		#endif
830		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
831	#else
832		float specularIntensityFactor = 1.0;
833		vec3 specularColorFactor = vec3( 1.0 );
834		material.specularF90 = 1.0;
835	#endif
836	material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
837	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
838#else
839	material.specularColor = vec3( 0.04 );
840	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
841	material.specularF90 = 1.0;
842#endif
843#ifdef USE_CLEARCOAT
844	material.clearcoat = clearcoat;
845	material.clearcoatRoughness = clearcoatRoughness;
846	material.clearcoatF0 = vec3( 0.04 );
847	material.clearcoatF90 = 1.0;
848	#ifdef USE_CLEARCOATMAP
849		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
850	#endif
851	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
852		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
853	#endif
854	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
855	material.clearcoatRoughness += geometryRoughness;
856	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
857#endif
858#ifdef USE_DISPERSION
859	material.dispersion = dispersion;
860#endif
861#ifdef USE_IRIDESCENCE
862	material.iridescence = iridescence;
863	material.iridescenceIOR = iridescenceIOR;
864	#ifdef USE_IRIDESCENCEMAP
865		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
866	#endif
867	#ifdef USE_IRIDESCENCE_THICKNESSMAP
868		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
869	#else
870		material.iridescenceThickness = iridescenceThicknessMaximum;
871	#endif
872#endif
873#ifdef USE_SHEEN
874	material.sheenColor = sheenColor;
875	#ifdef USE_SHEEN_COLORMAP
876		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
877	#endif
878	material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
879	#ifdef USE_SHEEN_ROUGHNESSMAP
880		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
881	#endif
882#endif
883#ifdef USE_ANISOTROPY
884	#ifdef USE_ANISOTROPYMAP
885		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
886		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
887		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
888	#else
889		vec2 anisotropyV = anisotropyVector;
890	#endif
891	material.anisotropy = length( anisotropyV );
892	if( material.anisotropy == 0.0 ) {
893		anisotropyV = vec2( 1.0, 0.0 );
894	} else {
895		anisotropyV /= material.anisotropy;
896		material.anisotropy = saturate( material.anisotropy );
897	}
898	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
899	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
900	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
901#endif`,f0=`uniform sampler2D dfgLUT;
902struct PhysicalMaterial {
903	vec3 diffuseColor;
904	vec3 diffuseContribution;
905	vec3 specularColor;
906	vec3 specularColorBlended;
907	float roughness;
908	float metalness;
909	float specularF90;
910	float dispersion;
911	#ifdef USE_CLEARCOAT
912		float clearcoat;
913		float clearcoatRoughness;
914		vec3 clearcoatF0;
915		float clearcoatF90;
916	#endif
917	#ifdef USE_IRIDESCENCE
918		float iridescence;
919		float iridescenceIOR;
920		float iridescenceThickness;
921		vec3 iridescenceFresnel;
922		vec3 iridescenceF0;
923		vec3 iridescenceFresnelDielectric;
924		vec3 iridescenceFresnelMetallic;
925	#endif
926	#ifdef USE_SHEEN
927		vec3 sheenColor;
928		float sheenRoughness;
929	#endif
930	#ifdef IOR
931		float ior;
932	#endif
933	#ifdef USE_TRANSMISSION
934		float transmission;
935		float transmissionAlpha;
936		float thickness;
937		float attenuationDistance;
938		vec3 attenuationColor;
939	#endif
940	#ifdef USE_ANISOTROPY
941		float anisotropy;
942		float alphaT;
943		vec3 anisotropyT;
944		vec3 anisotropyB;
945	#endif
946};
947vec3 clearcoatSpecularDirect = vec3( 0.0 );
948vec3 clearcoatSpecularIndirect = vec3( 0.0 );
949vec3 sheenSpecularDirect = vec3( 0.0 );
950vec3 sheenSpecularIndirect = vec3(0.0 );
951vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
952    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
953    float x2 = x * x;
954    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
955    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
956}
957float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
958	float a2 = pow2( alpha );
959	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
960	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
961	return 0.5 / max( gv + gl, EPSILON );
962}
963float D_GGX( const in float alpha, const in float dotNH ) {
964	float a2 = pow2( alpha );
965	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
966	return RECIPROCAL_PI * a2 / pow2( denom );
967}
968#ifdef USE_ANISOTROPY
969	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 ) {
970		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
971		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
972		return 0.5 / max( gv + gl, EPSILON )
vendor: 7,372 bytes, lines 972-1131
972;
973	}
974	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
975		float a2 = alphaT * alphaB;
976		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
977		highp float v2 = dot( v, v );
978		float w2 = a2 / v2;
979		return RECIPROCAL_PI * a2 * pow2 ( w2 );
980	}
981#endif
982#ifdef USE_CLEARCOAT
983	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
984		vec3 f0 = material.clearcoatF0;
985		float f90 = material.clearcoatF90;
986		float roughness = material.clearcoatRoughness;
987		float alpha = pow2( roughness );
988		vec3 halfDir = normalize( lightDir + viewDir );
989		float dotNL = saturate( dot( normal, lightDir ) );
990		float dotNV = saturate( dot( normal, viewDir ) );
991		float dotNH = saturate( dot( normal, halfDir ) );
992		float dotVH = saturate( dot( viewDir, halfDir ) );
993		vec3 F = F_Schlick( f0, f90, dotVH );
994		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
995		float D = D_GGX( alpha, dotNH );
996		return F * ( V * D );
997	}
998#endif
999vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1000	vec3 f0 = material.specularColorBlended;
1001	float f90 = material.specularF90;
1002	float roughness = material.roughness;
1003	float alpha = pow2( roughness );
1004	vec3 halfDir = normalize( lightDir + viewDir );
1005	float dotNL = saturate( dot( normal, lightDir ) );
1006	float dotNV = saturate( dot( normal, viewDir ) );
1007	float dotNH = saturate( dot( normal, halfDir ) );
1008	float dotVH = saturate( dot( viewDir, halfDir ) );
1009	vec3 F = F_Schlick( f0, f90, dotVH );
1010	#ifdef USE_IRIDESCENCE
1011		F = mix( F, material.iridescenceFresnel, material.iridescence );
1012	#endif
1013	#ifdef USE_ANISOTROPY
1014		float dotTL = dot( material.anisotropyT, lightDir );
1015		float dotTV = dot( material.anisotropyT, viewDir );
1016		float dotTH = dot( material.anisotropyT, halfDir );
1017		float dotBL = dot( material.anisotropyB, lightDir );
1018		float dotBV = dot( material.anisotropyB, viewDir );
1019		float dotBH = dot( material.anisotropyB, halfDir );
1020		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1021		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1022	#else
1023		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1024		float D = D_GGX( alpha, dotNH );
1025	#endif
1026	return F * ( V * D );
1027}
1028vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1029	const float LUT_SIZE = 64.0;
1030	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1031	const float LUT_BIAS = 0.5 / LUT_SIZE;
1032	float dotNV = saturate( dot( N, V ) );
1033	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1034	uv = uv * LUT_SCALE + LUT_BIAS;
1035	return uv;
1036}
1037float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1038	float l = length( f );
1039	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1040}
1041vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1042	float x = dot( v1, v2 );
1043	float y = abs( x );
1044	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1045	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1046	float v = a / b;
1047	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1048	return cross( v1, v2 ) * theta_sintheta;
1049}
1050vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1051	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1052	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1053	vec3 lightNormal = cross( v1, v2 );
1054	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1055	vec3 T1, T2;
1056	T1 = normalize( V - N * dot( V, N ) );
1057	T2 = - cross( N, T1 );
1058	mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
1059	vec3 coords[ 4 ];
1060	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1061	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1062	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1063	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1064	coords[ 0 ] = normalize( coords[ 0 ] );
1065	coords[ 1 ] = normalize( coords[ 1 ] );
1066	coords[ 2 ] = normalize( coords[ 2 ] );
1067	coords[ 3 ] = normalize( coords[ 3 ] );
1068	vec3 vectorFormFactor = vec3( 0.0 );
1069	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1070	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1071	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1072	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1073	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1074	return vec3( result );
1075}
1076#if defined( USE_SHEEN )
1077float D_Charlie( float roughness, float dotNH ) {
1078	float alpha = pow2( roughness );
1079	float invAlpha = 1.0 / alpha;
1080	float cos2h = dotNH * dotNH;
1081	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1082	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1083}
1084float V_Neubelt( float dotNV, float dotNL ) {
1085	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1086}
1087vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1088	vec3 halfDir = normalize( lightDir + viewDir );
1089	float dotNL = saturate( dot( normal, lightDir ) );
1090	float dotNV = saturate( dot( normal, viewDir ) );
1091	float dotNH = saturate( dot( normal, halfDir ) );
1092	float D = D_Charlie( sheenRoughness, dotNH );
1093	float V = V_Neubelt( dotNV, dotNL );
1094	return sheenColor * ( D * V );
1095}
1096#endif
1097float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1098	float dotNV = saturate( dot( normal, viewDir ) );
1099	float r2 = roughness * roughness;
1100	float rInv = 1.0 / ( roughness + 0.1 );
1101	float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
1102	float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
1103	float DG = exp( a * dotNV + b );
1104	return saturate( DG );
1105}
1106vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1107	float dotNV = saturate( dot( normal, viewDir ) );
1108	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1109	return specularColor * fab.x + specularF90 * fab.y;
1110}
1111#ifdef USE_IRIDESCENCE
1112void 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 ) {
1113#else
1114void 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 ) {
1115#endif
1116	float dotNV = saturate( dot( normal, viewDir ) );
1117	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1118	#ifdef USE_IRIDESCENCE
1119		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1120	#else
1121		vec3 Fr = specularColor;
1122	#endif
1123	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1124	float Ess = fab.x + fab.y;
1125	float Ems = 1.0 - Ess;
1126	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1127	singleScatter += FssEss;
1128	multiScatter += Fms * Ems;
1129}
1130vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1131	vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
vendor: 8,354 bytes, lines 1132-1261
1132	float dotNL = saturate( dot( normal, lightDir ) );
1133	float dotNV = saturate( dot( normal, viewDir ) );
1134	vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;
1135	vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;
1136	vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;
1137	vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;
1138	float Ess_V = dfgV.x + dfgV.y;
1139	float Ess_L = dfgL.x + dfgL.y;
1140	float Ems_V = 1.0 - Ess_V;
1141	float Ems_L = 1.0 - Ess_L;
1142	vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;
1143	vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
1144	float compensationFactor = Ems_V * Ems_L;
1145	vec3 multiScatter = Fms * compensationFactor;
1146	return singleScatter + multiScatter;
1147}
1148#if NUM_RECT_AREA_LIGHTS > 0
1149	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 ) {
1150		vec3 normal = geometryNormal;
1151		vec3 viewDir = geometryViewDir;
1152		vec3 position = geometryPosition;
1153		vec3 lightPos = rectAreaLight.position;
1154		vec3 halfWidth = rectAreaLight.halfWidth;
1155		vec3 halfHeight = rectAreaLight.halfHeight;
1156		vec3 lightColor = rectAreaLight.color;
1157		float roughness = material.roughness;
1158		vec3 rectCoords[ 4 ];
1159		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1160		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1161		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1162		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1163		vec4 t1 = texture2D( ltc_1, uv );
1164		vec4 t2 = texture2D( ltc_2, uv );
1165		mat3 mInv = mat3(
1166			vec3( t1.x, 0, t1.y ),
1167			vec3(    0, 1,    0 ),
1168			vec3( t1.z, 0, t1.w )
1169		);
1170		vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
1171		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1172		reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1173		#ifdef USE_CLEARCOAT
1174			vec3 Ncc = geometryClearcoatNormal;
1175			vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
1176			vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
1177			vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
1178			mat3 mInvClearcoat = mat3(
1179				vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
1180				vec3(             0, 1,             0 ),
1181				vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
1182			);
1183			vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
1184			clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
1185		#endif
1186	}
1187#endif
1188void 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 ) {
1189	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1190	vec3 irradiance = dotNL * directLight.color;
1191	#ifdef USE_CLEARCOAT
1192		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1193		vec3 ccIrradiance = dotNLcc * directLight.color;
1194		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1195	#endif
1196	#ifdef USE_SHEEN
1197 
1198 		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1199 
1200 		float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1201 		float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
1202 
1203 		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
1204 
1205 		irradiance *= sheenEnergyComp;
1206 
1207 	#endif
1208	reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
1209	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );
1210}
1211void 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 ) {
1212	vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );
1213	#ifdef USE_SHEEN
1214		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1215		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1216		diffuse *= sheenEnergyComp;
1217	#endif
1218	reflectedLight.indirectDiffuse += diffuse;
1219}
1220void 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) {
1221	#ifdef USE_CLEARCOAT
1222		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1223	#endif
1224	#ifdef USE_SHEEN
1225		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
1226 	#endif
1227	vec3 singleScatteringDielectric = vec3( 0.0 );
1228	vec3 multiScatteringDielectric = vec3( 0.0 );
1229	vec3 singleScatteringMetallic = vec3( 0.0 );
1230	vec3 multiScatteringMetallic = vec3( 0.0 );
1231	#ifdef USE_IRIDESCENCE
1232		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1233		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1234	#else
1235		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1236		computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1237	#endif
1238	vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
1239	vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
1240	vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
1241	vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
1242	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1243	vec3 indirectSpecular = radiance * singleScattering;
1244	indirectSpecular += multiScattering * cosineWeightedIrradiance;
1245	vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
1246	#ifdef USE_SHEEN
1247		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1248		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1249		indirectSpecular *= sheenEnergyComp;
1250		indirectDiffuse *= sheenEnergyComp;
1251	#endif
1252	reflectedLight.indirectSpecular += indirectSpecular;
1253	reflectedLight.indirectDiffuse += indirectDiffuse;
1254}
1255#define RE_Direct				RE_Direct_Physical
1256#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1257#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1258#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1259float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1260	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1261}`,
1261p0=`
1262vec3 geometryPosition = - vViewPosition;
1263vec3 geometryNormal = normal;
1264vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1265vec3 geometryClearcoatNormal = vec3( 0.0 );
1266#ifdef USE_CLEARCOAT
1267	geometryClearcoatNormal = clearcoatNormal;
1268#endif
1269#ifdef USE_IRIDESCENCE
1270	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1271	if ( material.iridescenceThickness == 0.0 ) {
1272		material.iridescence = 0.0;
1273	} else {
1274		material.iridescence = saturate( material.iridescence );
1275	}
1276	if ( material.iridescence > 0.0 ) {
1277		material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1278		material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
1279		material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );
1280		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1281	}
1282#endif
1283IncidentLight directLight;
1284#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1285	PointLight pointLight;
1286	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1287	PointLightShadow pointLightShadow;
1288	#endif
1289	#pragma unroll_loop_start
1290	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1291		pointLight = pointLights[ i ];
1292		getPointLightInfo( pointLight, geometryPosition, directLight );
1293		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
1294		pointLightShadow = pointLightShadows[ i ];
1295		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1296		#endif
1297		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1298	}
1299	#pragma unroll_loop_end
1300#endif
1301#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1302	SpotLight spotLight;
1303	vec4 spotColor;
1304	vec3 spotLightCoord;
1305	bool inSpotLightMap;
1306	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1307	SpotLightShadow spotLightShadow;
1308	#endif
1309	#pragma unroll_loop_start
1310	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1311		spotLight = spotLights[ i ];
1312		getSpotLightInfo( spotLight, geometryPosition, directLight );
1313		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1314		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1315		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1316		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1317		#else
1318		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1319		#endif
1320		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1321			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1322			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1323			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1324			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1325		#endif
1326		#undef SPOT_LIGHT_MAP_INDEX
1327		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1328		spotLightShadow = spotLightShadows[ i ];
1329		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1330		#endif
1331		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1332	}
1333	#pragma unroll_loop_end
1334#endif
1335#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1336	DirectionalLight directionalLight;
1337	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1338	DirectionalLightShadow directionalLightShadow;
1339	#endif
1340	#pragma unroll_loop_start
1341	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1342		directionalLight = directionalLights[ i ];
1343		getDirectionalLightInfo( directionalLight, directLight );
1344		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1345		directionalLightShadow = directionalLightShadows[ i ];
1346		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1347		#endif
1348		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1349	}
1350	#pragma unroll_loop_end
1351#endif
1352#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1353	RectAreaLight rectAreaLight;
1354	#pragma unroll_loop_start
1355	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1356		rectAreaLight = rectAreaLights[ i ];
1357		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1358	}
1359	#pragma unroll_loop_end
1360#endif
1361#if defined( RE_IndirectDiffuse )
1362	vec3 iblIrradiance = vec3( 0.0 );
1363	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1364	#if defined( USE_LIGHT_PROBES )
1365		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1366	#endif
1367	#if ( NUM_HEMI_LIGHTS > 0 )
1368		#pragma unroll_loop_start
1369		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1370			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1371		}
1372		#pragma unroll_loop_end
1373	#endif
1374	#ifdef USE_LIGHT_PROBES_GRID
1375		vec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;
1376		vec3 probeWorldNormal = inverseTransformDirection( geometryNormal, viewMatrix );
1377		irradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );
1378	#endif
1379#endif
1380#if defined( RE_IndirectSpecular )
1381	vec3 radiance = vec3( 0.0 );
1382	vec3 clearcoatRadiance = vec3( 0.0 );
1383#endif`,m0=`#if defined( RE_IndirectDiffuse )
1384	#ifdef USE_LIGHTMAP
1385		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1386		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1387		irradiance += lightMapIrradiance;
1388	#endif
1389	#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
1390		#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
1391			iblIrradiance += getIBLIrradiance( geometryNormal );
1392		#endif
1393	#endif
1394#endif
1395#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1396	#ifdef USE_ANISOTROPY
1397		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1398	#else
1399		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1400	#endif
1401	#ifdef USE_CLEARCOAT
1402		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1403	#endif
1404#endif`,g0=`#if defined( RE_IndirectDiffuse )
1405	#if defined( LAMBERT ) || defined( PHONG )
1406		irradiance += iblIrradiance;
1407	#endif
1408	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1409#endif
1410#if defined( RE_IndirectSpecular )
1411	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1412#endif`,v0=`#ifdef USE_LIGHT_PROBES_GRID
1413uniform highp sampler3D probesSH;
1414uniform vec3 probesMin;
1415uniform vec3 probesMax;
1416uniform vec3 probesResolution;
1417vec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {
1418	vec3 res = probesResolution;
1419	vec3 gridRange = probesMax - probesMin;
1420	vec3 resMinusOne = res - 1.0;
1421	vec3 probeSpacing = gridRange / resMinusOne;
1422	vec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;
1423	vec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );
1424	uvw = uvw * resMinusOne / res + 0.5 / res;
1425	float nz          = res.z;
1426	float paddedSlices = nz + 2.0;
1427	float atlasDepth  = 7.0 * paddedSlices;
1428	float uvZBase     = uvw.z * nz + 1.0;
1429	vec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase                       ) / atlasDepth ) );
1430	vec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase +       paddedSlices   ) / atlasDepth ) );
1431	vec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices   ) / atlasDepth ) );
1432	vec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices   ) / atlasDepth ) );
1433	vec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices   ) / atlasDepth ) );
1434	vec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices   ) / atlasDepth ) );
1435	vec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices   ) / atlasDepth ) );
1436	vec3 c0 = s0.xyz;
1437	vec3 c1 = vec3( s0.w, s1.xy );
1438	vec3 c2 = vec3( s1.zw, s2.x );
1439	vec3 c3 = s2.yzw;
1440	vec3 c4 = s3.xyz;
1441	vec3 c5 = vec3( s3.w, s4.xy );
1442	vec3 c6 = vec3( s4.zw, s5.x );
1443	vec3 c7 = s5.yzw;
1444	vec3 c8 = s6.xyz;
1445	float x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;
1446	vec3 result = c0 * 0.886227;
1447	result += c1 * 2.0 * 0.511664 * y;
1448	result += c2 * 2.0 * 0.511664 * z;
1449	result += c3 * 2.0 * 0.511664 * x;
1450	result += c4 * 2.0 * 0.429043 * x * y;
1451	result += c5 * 2.0 * 0.429043 * y * z;
1452	result += c6 * ( 0.743125 * z * z - 0.247708 );
1453	result += c7 * 2.0 * 0.429043 * x * z;
1454	result += c8 * 0.429043 * ( x * x - y * y );
1455	return max( result, vec3( 0.0 ) );
1456}
1457#endif`,_0=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1458	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1459#endif`,y0=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1460	uniform float logDepthBufFC;
1461	varying float vFragDepth;
1462	varying float vIsPerspective;
1463#endif`,x0=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1464	varying float vFragDepth;
1465	varying float vIsPerspective;
1466#endif`,M0=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1467	vFragDepth = 1.0 + gl_Position.w;
1468	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1469#endif`,S0=`#ifdef USE_MAP
1470	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1471	#ifdef DECODE_VIDEO_TEXTURE
1472		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1473	#endif
1474	diffuseColor *= sampledDiffuseColor;
1475#endif`,b0=`#ifdef USE_MAP
1476	uniform sampler2D map;
1477#endif`,T0=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1478	#if defined( USE_POINTS_UV )
1479		vec2 uv = vUv;
1480	#else
1481		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1482	#endif
1483#endif
1484#ifdef USE_MAP
1485	diffuseColor *= texture2D( map, uv );
1486#endif
1487#ifdef USE_ALPHAMAP
1488	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1489#endif`,w0=`#if defined( USE_POINTS_UV )
1490	varying vec2 vUv;
1491#else
1492	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1493		uniform mat3 uvTransform;
1494	#endif
1495#endif
1496#ifdef USE_MAP
1497	uniform sampler2D map;
1498#endif
1499#ifdef USE_ALPHAMAP
1500	uniform sampler2D alphaMap;
1501#endif`,E0=`float metalnessFactor = metalness;
1502#ifdef USE_METALNESSMAP
1503	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1504	metalnessFactor *= texelMetalness.b;
1505#endif`,A0=`#ifdef USE_METALNESSMAP
1506	uniform sampler2D metalnessMap;
1507#endif`,C0=`#ifdef USE_INSTANCING_MORPH
1508	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1509	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1510	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1511		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1512	}
1513#endif`,R0=`#if defined( USE_MORPHCOLORS )
1514	vColor *= morphTargetBaseInfluence;
1515	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1516		#if defined( USE_COLOR_ALPHA )
1517			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1518		#elif defined( USE_COLOR )
1519			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1520		#endif
1521	}
1522#endif`,I0=`#ifdef USE_MORPHNORMALS
1523	objectNormal *= morphTargetBaseInfluence;
1524	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1525		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1526	}
1527#endif`,P0=`#ifdef USE_MORPHTARGETS
1528	#ifndef USE_INSTANCING_MORPH
1529		uniform float morphTargetBaseInfluence;
1530		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1531	#endif
1532	uniform sampler2DArray morphTargetsTexture;
1533	uniform ivec2 morphTargetsTextureSize;
1534	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1535		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1536		int y = texelIndex / morphTargetsTextureSize.x;
1537		int x = texelIndex - y * morphTargetsTextureSize.x;
1538		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1539		return texelFetch( morphTargetsTexture, morphUV, 0 );
1540	}
1541#endif`,L0=`#ifdef USE_MORPHTARGETS
1542	transformed *= morphTargetBaseInfluence;
1543	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1544		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1545	}
1546#endif`,U0=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1547#ifdef FLAT_SHADED
1548	vec3 fdx = dFdx( vViewPosition );
1549	vec3 fdy = dFdy( vViewPosition );
1550	vec3 normal = normalize( cross( fdx, fdy ) );
1551#else
1552	vec3 normal = normalize( vNormal );
1553	#ifdef DOUBLE_SIDED
1554		normal *= faceDirection;
1555	#endif
1556#endif
1557#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1558	#ifdef USE_TANGENT
1559		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1560	#else
1561		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1562		#if defined( USE_NORMALMAP )
1563			vNormalMapUv
1564		#elif defined( USE_CLEARCOAT_NORMALMAP )
1565			vClearcoatNormalMapUv
1566		#else
1567			vUv
1568		#endif
1569		);
1570	#endif
1571	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1572		tbn[0] *= faceDirection;
1573		tbn[1] *= faceDirection;
1574	#endif
1575#endif
1576#ifdef USE_CLEARCOAT_NORMALMAP
1577	#ifdef USE_TANGENT
1578		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1579	#else
1580		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1581	#endif
1582	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1583		tbn2[0] *= faceDirection;
1584		tbn2[1] *= faceDirection;
1585	#endif
1586#endif
1587vec3 nonPerturbedNormal = normal;`,N0=`#ifdef USE_NORMALMAP_OBJECTSPACE
1588	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1589	#ifdef FLIP_SIDED
1590		normal = - normal;
1591	#endif
1592	#ifdef DOUBLE_SIDED
1593		normal = normal * faceDirection;
1594	#endif
1595	normal = normalize( normalMatrix * normal );
1596#elif defined( USE_NORMALMAP_TANGENTSPACE )
1597	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1598	#if defined( USE_PACKED_NORMALMAP )
1599		mapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );
1600	#endif
1601	mapN.xy *= normalScale;
1602	normal = normalize( tbn * mapN );
1603#elif defined( USE_BUMPMAP )
1604	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1605#endif`,D0=`#ifndef FLAT_SHADED
1606	varying vec3 vNormal;
1607	#ifdef USE_TANGENT
1608		varying vec3 vTangent;
1609		varying vec3 vBitangent;
1610	#endif
1611#endif`,O0=`#ifndef FLAT_SHADED
1612	varying vec3 vNormal;
1613	#ifdef USE_TANGENT
1614		varying vec3 vTangent;
1615		varying vec3 vBitangent;
1616	#endif
1617#endif`,F0=`#ifndef FLAT_SHADED
1618	vNormal = normalize( transformedNormal );
1619	#ifdef USE_TANGENT
1620		vTangent = normalize( transformedTangent );
1621		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1622	#endif
1623#endif`,B0=`#ifdef USE_NORMALMAP
1624	uniform sampler2D normalMap;
1625	uniform vec2 normalScale;
1626#endif
1627#ifdef USE_NORMALMAP_OBJECTSPACE
1628	uniform mat3 normalMatrix;
1629#endif
1630#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1631	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1632		vec3 q0 = dFdx( eye_pos.xyz );
1633		vec3 q1 = dFdy( eye_pos.xyz );
1634		vec2 st0 = dFdx( uv.st );
1635		vec2 st1 = dFdy( uv.st );
1636		vec3 N = surf_norm;
1637		vec3 q1perp = cross( q1, N );
1638		vec3 q0perp = cross( N, q0 );
1639		vec3 T = q1perp * st0.x + q0perp * st1.x;
1640		vec3 B = q1perp * st0.y + q0perp * st1.y;
1641		float det = max( dot( T, T ), dot( B, B ) );
1642		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1643		return mat3( T * scale, B * scale, N );
1644	}
1645#endif`,z0=`#ifdef USE_CLEARCOAT
1646	vec3 clearcoatNormal = nonPerturbedNormal;
1647#endif`,k0=`#ifdef USE_CLEARCOAT_NORMALMAP
1648	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1649	clearcoatMapN.xy *= clearcoatNormalScale;
1650	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1651#endif`,V0=`#ifdef USE_CLEARCOATMAP
1652	uniform sampler2D clearcoatMap;
1653#endif
1654#ifdef USE_CLEARCOAT_NORMALMAP
1655	uniform sampler2D clearcoatNormalMap;
1656	uniform vec2 clearcoatNormalScale;
1657#endif
1658#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1659	uniform sampler2D clearcoatRoughnessMap;
1660#endif`,H0=`#ifdef USE_IRIDESCENCEMAP
1661	uniform sampler2D iridescenceMap;
1662#endif
1663#ifdef USE_IRIDESCENCE_THICKNESSMAP
1664	uniform sampler2D iridescenceThicknessMap;
1665#endif`,G0=`#ifdef OPAQUE
1666diffuseColor.a = 1.0;
1667#endif
1668#ifdef USE_TRANSMISSION
1669diffuseColor.a *= material.transmissionAlpha;
1670#endif
1671gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,W0=`vec3 packNormalToRGB( const in vec3 normal ) {
1672	return normalize( normal ) * 0.5 + 0.5;
1673}
1674vec3 unpackRGBToNormal( const in vec3 rgb ) {
1675	return 2.0 * rgb.xyz - 1.0;
1676}
1677const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1678const float Inv255 = 1. / 255.;
1679const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1680const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1681const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1682const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1683vec4 packDepthToRGBA( const in float v ) {
1684	if( v <= 0.0 )
1685		return vec4( 0., 0., 0., 0. );
1686	if( v >= 1.0 )
1687		return vec4( 1., 1., 1., 1. );
1688	float vuf;
1689	float af = modf( v * PackFactors.a, vuf );
1690	float bf = modf( vuf * ShiftRight8, vuf );
1691	float gf = modf( vuf * ShiftRight8, vuf );
1692	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1693}
1694vec3 packDepthToRGB( const in float v ) {
1695	if( v <= 0.0 )
1696		return vec3( 0., 0., 0. );
1697	if( v >= 1.0 )
1698		return vec3( 1., 1., 1. );
1699	float vuf;
1700	float bf = modf( v * PackFactors.b, vuf );
1701	float gf = modf( vuf * ShiftRight8, vuf );
1702	return vec3( vuf * Inv255, gf * PackUpscale, bf );
1703}
1704vec2 packDepthToRG( const in float v ) {
1705	if( v <= 0.0 )
1706		return vec2( 0., 0. );
1707	if( v >= 1.0 )
1708		return vec2( 1., 1. );
1709	float vuf;
1710	float gf = modf( v * 256., vuf );
1711	return vec2( vuf * Inv255, gf );
1712}
1713float unpackRGBAToDepth( const in vec4 v ) {
1714	return dot( v, UnpackFactors4 );
1715}
1716float unpackRGBToDepth( const in vec3 v ) {
1717	return dot( v, UnpackFactors3 );
1718}
1719float unpackRGToDepth( const in vec2 v ) {
1720	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1721}
1722vec4 pack2HalfToRGBA( const in vec2 v ) {
1723	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1724	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1725}
1726vec2 unpackRGBATo2Half( const in vec4 v ) {
1727	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1728}
1729float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1730	return ( viewZ + near ) / ( near - far );
1731}
1732float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1733	#ifdef USE_REVERSED_DEPTH_BUFFER
1734	
1735		return depth * ( far - near ) - far;
1736	#else
1737		return depth * ( near - far ) - near;
1738	#endif
1739}
1740float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1741	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1742}
1743float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1744	
1745	#ifdef USE_REVERSED_DEPTH_BUFFER
1746		return ( near * far ) / ( ( near - far ) * depth - near );
1747	#else
1748		return ( near * far ) / ( ( far - near ) * depth - far );
1749	#endif
1750}`,X0=`#ifdef PREMULTIPLIED_ALPHA
1751	gl_FragColor.rgb *= gl_FragColor.a;
1752#endif`,q0=`vec4 mvPosition = vec4( transformed, 1.0 );
1753#ifdef USE_BATCHING
1754	mvPosition = batchingMatrix * mvPosition;
1755#endif
1756#ifdef USE_INSTANCING
1757	mvPosition = instanceMatrix * mvPosition;
1758#endif
1759mvPosition = modelViewMatrix * mvPosition;
1760gl_Position = projectionMatrix * mvPosition;`,Y0=`#ifdef DITHERING
1761	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1762#endif`,Z0=`#ifdef DITHERING
1763	vec3 dithering( vec3 color ) {
1764		float grid_position = rand( gl_FragCoord.xy );
1765		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1766		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1767		return color + dither_shift_RGB;
1768	}
1769#endif`,J0=`float roughnessFactor = roughness;
1770#ifdef USE_ROUGHNESSMAP
1771	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1772	roughnessFactor *= texelRoughness.g;
1773#endif`,$0=`#ifdef USE_ROUGHNESSMAP
1774	uniform sampler2D roughnessMap;
1775#endif`,K0=`#if NUM_SPOT_LIGHT_COORDS > 0
1776	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1777#endif
1778#if NUM_SPOT_LIGHT_MAPS > 0
1779	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1780#endif
1781#ifdef USE_SHADOWMAP
1782	#if NUM_DIR_LIGHT_SHADOWS > 0
1783		#if defined( SHADOWMAP_TYPE_PCF )
1784			uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1785		#else
1786			uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1787		#endif
1788		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1789		struct DirectionalLightShadow {
1790			float shadowIntensity;
1791			float shadowBias;
1792			float shadowNormalBias;
1793			float shadowRadius;
1794			vec2 shadowMapSize;
1795		};
1796		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1797	#endif
1798	#if NUM_SPOT_LIGHT_SHADOWS > 0
1799		#if defined( SHADOWMAP_TYPE_PCF )
1800			uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1801		#else
1802			uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1803		#endif
1804		struct SpotLightShadow {
1805			float shadowIntensity;
1806			float shadowBias;
1807			float shadowNormalBias;
1808			float shadowRadius;
1809			vec2 shadowMapSize;
1810		};
1811		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1812	#endif
1813	#if NUM_POINT_LIGHT_SHADOWS > 0
1814		#if defined( SHADOWMAP_TYPE_PCF )
1815			uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1816		#elif defined( SHADOWMAP_TYPE_BASIC )
1817			uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1818		#endif
1819		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1820		struct PointLightShadow {
1821			float shadowIntensity;
1822			float shadowBias;
1823			float shadowNormalBias;
1824			float shadowRadius;
1825			vec2 shadowMapSize;
1826			float shadowCameraNear;
1827			float shadowCameraFar;
1828		};
1829		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1830	#endif
1831	#if defined( SHADOWMAP_TYPE_PCF )
1832		float interleavedGradientNoise( vec2 position ) {
1833			return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
1834		}
1835		vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
1836			const float goldenAngle = 2.399963229728653;
1837			float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
1838			float theta = float( sampleIndex ) * goldenAngle + phi;
1839			return vec2( cos( theta ), sin( theta ) ) * r;
1840		}
1841	#endif
1842	#if defined( SHADOWMAP_TYPE_PCF )
1843		float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1844			float shadow = 1.0;
1845			shadowCoord.xyz /= shadowCoord.w;
1846			shadowCoord.z += shadowBias;
1847			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1848			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1849			if ( frustumTest ) {
1850				vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1851				float radius = shadowRadius * texelSize.x;
1852				float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1853				shadow = (
1854					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
1855					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
1856					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
1857					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
1858					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
1859				) * 0.2;
1860			}
1861			return mix( 1.0, shadow, shadowIntensity );
1862		}
1863	#elif defined( SHADOWMAP_TYPE_VSM )
1864		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1865			float shadow = 1.0;
1866			shadowCoord.xyz /= shadowCoord.w;
1867			#ifdef USE_REVERSED_DEPTH_BUFFER
1868				shadowCoord.z -= shadowBias;
1869			#else
1870				shadowCoord.z += shadowBias;
1871			#endif
1872			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1873			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1874			if ( frustumTest ) {
1875				vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
1876				float mean = distribution.x;
1877				float variance = distribution.y * distribution.y;
1878				#ifdef USE_REVERSED_DEPTH_BUFFER
1879					float hard_shadow = step( mean, shadowCoord.z );
1880				#else
1881					float hard_shadow = step( shadowCoord.z, mean );
1882				#endif
1883				
1884				if ( hard_shadow == 1.0 ) {
1885					shadow = 1.0;
1886				} else {
1887					variance = max( variance, 0.0000001 );
1888					float d = shadowCoord.z - mean;
1889					float p_max = variance / ( variance + d * d );
1890					p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
1891					shadow = max( hard_shadow, p_max );
1892				}
1893			}
1894			return mix( 1.0, shadow, shadowIntensity );
1895		}
1896	#else
1897		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1898			float shadow = 1.0;
1899			shadowCoord.xyz /= shadowCoord.w;
1900			#ifdef USE_REVERSED_DEPTH_BUFFER
1901				shadowCoord.z -= shadowBias;
1902			#else
1903				shadowCoord.z += shadowBias;
1904			#endif
1905			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1906			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1907			if ( frustumTest ) {
1908				float depth = texture2D( shadowMap, shadowCoord.xy ).r;
1909				#ifdef USE_REVERSED_DEPTH_BUFFER
1910					shadow = step( depth, shadowCoord.z );
1911				#else
1912					shadow = step( shadowCoord.z, depth );
1913				#endif
1914			}
1915			return mix( 1.0, shadow, shadowIntensity );
1916		}
1917	#endif
1918	#if NUM_POINT_LIGHT_SHADOWS > 0
1919	#if defined( SHADOWMAP_TYPE_PCF )
1920	float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1921		float shadow = 1.0;
1922		vec3 lightToPosition = shadowCoord.xyz;
1923		vec3 bd3D = normalize( lightToPosition );
1924		vec3 absVec = abs( lightToPosition );
1925		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1926		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1927			#ifdef USE_REVERSED_DEPTH_BUFFER
1928				float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1929				dp -= shadowBias;
1930			#else
1931				float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1932				dp += shadowBias;
1933			#endif
1934			float texelSize = shadowRadius / shadowMapSize.x;
1935			vec3 absDir = abs( bd3D );
1936			vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
1937			tangent = normalize( cross( bd3D, tangent ) );
1938			vec3 bitangent = cross( bd3D, tangent );
1939			float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1940			vec2 sample0 = vogelDiskSample( 0, 5, phi );
1941			vec2 sample1 = vogelDiskSample( 1, 5, phi );
1942			vec2 sample2 = vogelDiskSample( 2, 5, phi );
1943			vec2 sample3 = vogelDiskSample( 3, 5, phi );
1944			vec2 sample4 = vogelDiskSample( 4, 5, phi );
1945			shadow = (
1946				texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
1947				texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
1948				texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
1949				texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
1950				texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
1951			) * 0.2;
1952		}
1953		return mix( 1.0, shadow, shadowIntensity );
1954	}
1955	#elif defined( SHADOWMAP_TYPE_BASIC )
1956	float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1957		float shadow = 1.0;
1958		vec3 lightToPosition = shadowCoord.xyz;
1959		vec3 absVec = abs( lightToPosition );
1960		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1961		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1962			float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1963			dp += shadowBias;
1964			vec3 bd3D = normalize( lightToPosition );
1965			float depth = textureCube( shadowMap, bd3D ).r;
1966			#ifdef USE_REVERSED_DEPTH_BUFFER
1967				depth = 1.0 - depth;
1968			#endif
1969			shadow = step( dp, depth );
1970		}
1971		return mix( 1.0, shadow, shadowIntensity );
1972	}
1973	#endif
1974	#endif
1975#endif`,Q0=`#if NUM_SPOT_LIGHT_COORDS > 0
1976	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1977	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1978#endif
1979#ifdef USE_SHADOWMAP
1980	#if NUM_DIR_LIGHT_SHADOWS > 0
1981		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1982		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1983		struct DirectionalLightShadow {
1984			float shadowIntensity;
1985			float shadowBias;
1986			float shadowNormalBias;
1987			float shadowRadius;
1988			vec2 shadowMapSize;
1989		};
1990		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1991	#endif
1992	#if NUM_SPOT_LIGHT_SHADOWS > 0
1993		struct SpotLightShadow {
1994			float shadowIntensity;
1995			float shadowBias;
1996			float shadowNormalBias;
1997			float shadowRadius;
1998			vec2 shadowMapSize;
1999		};
2000		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
2001	#endif
2002	#if NUM_POINT_LIGHT_SHADOWS > 0
2003		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
2004		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
2005		struct PointLightShadow {
2006			float shadowIntensity;
2007			float shadowBias;
2008			float shadowNormalBias;
2009			float shadowRadius;
2010			vec2 shadowMapSize;
2011			float shadowCameraNear;
2012			float shadowCameraFar;
2013		};
2014		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2015	#endif
2016#endif`,j0=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2017	#ifdef HAS_NORMAL
2018		vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
2019	#else
2020		vec3 shadowWorldNormal = vec3( 0.0 );
2021	#endif
2022	vec4 shadowWorldPosition;
2023#endif
2024#if defined( USE_SHADOWMAP )
2025	#if NUM_DIR_LIGHT_SHADOWS > 0
2026		#pragma unroll_loop_start
2027		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2028			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
2029			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
2030		}
2031		#pragma unroll_loop_end
2032	#endif
2033	#if NUM_POINT_LIGHT_SHADOWS > 0
2034		#pragma unroll_loop_start
2035		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2036			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
2037			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
2038		}
2039		#pragma unroll_loop_end
2040	#endif
2041#endif
2042#if NUM_SPOT_LIGHT_COORDS > 0
2043	#pragma unroll_loop_start
2044	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
2045		shadowWorldPosition = worldPosition;
2046		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
2047			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
2048		#endif
2049		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2050	}
2051	#pragma unroll_loop_end
2052#endif`,ey=`float getShadowMask() {
2053	float shadow = 1.0;
2054	#ifdef USE_SHADOWMAP
2055	#if NUM_DIR_LIGHT_SHADOWS > 0
2056	DirectionalLightShadow directionalLight;
2057	#pragma unroll_loop_start
2058	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2059		directionalLight = directionalLightShadows[ i ];
2060		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
2061	}
2062	#pragma unroll_loop_end
2063	#endif
2064	#if NUM_SPOT_LIGHT_SHADOWS > 0
2065	SpotLightShadow spotLight;
2066	#pragma unroll_loop_start
2067	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
2068		spotLight = spotLightShadows[ i ];
2069		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
2070	}
2071	#pragma unroll_loop_end
2072	#endif
2073	#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
2074	PointLightShadow pointLight;
2075	#pragma unroll_loop_start
2076	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2077		pointLight = pointLightShadows[ i ];
2078		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
2079	}
2080	#pragma unroll_loop_end
2081	#endif
2082	#endif
2083	return shadow;
2084}`,ty=`#ifdef USE_SKINNING
2085	mat4 boneMatX = getBoneMatrix( skinIndex.x );
2086	mat4 boneMatY = getBoneMatrix( skinIndex.y );
2087	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2088	mat4 boneMatW = getBoneMatrix( skinIndex.w );
2089#endif`,iy=`#ifdef USE_SKINNING
2090	uniform mat4 bindMatrix;
2091	uniform mat4 bindMatrixInverse;
2092	uniform highp sampler2D boneTexture;
2093	mat4 getBoneMatrix( const in float i ) {
2094		int size = textureSize( boneTexture, 0 ).x;
2095		int j = int( i ) * 4;
2096		int x = j % size;
2097		int y = j / size;
2098		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2099		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2100		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2101		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2102		return mat4( v1, v2, v3, v4 );
2103	}
2104#endif`,ny=`#ifdef USE_SKINNING
2105	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2106	vec4 skinned = vec4( 0.0 );
2107	skinned += boneMatX * skinVertex * skinWeight.x;
2108	skinned += boneMatY * skinVertex * skinWeight.y;
2109	skinned += boneMatZ * skinVertex * skinWeight.z;
2110	skinned += boneMatW * skinVertex * skinWeight.w;
2111	transformed = ( bindMatrixInverse * skinned ).xyz;
2112#endif`,sy=`#ifdef USE_SKINNING
2113	mat4 skinMatrix = mat4( 0.0 );
2114	skinMatrix += skinWeight.x * boneMatX;
2115	skinMatrix += skinWeight.y * boneMatY;
2116	skinMatrix += skinWeight.z * boneMatZ;
2117	skinMatrix += skinWeight.w * boneMatW;
2118	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2119	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2120	#ifdef USE_TANGENT
2121		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2122	#endif
2123#endif`,ry=`float specularStrength;
2124#ifdef USE_SPECULARMAP
2125	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2126	specularStrength = texelSpecular.r;
2127#else
2128	specularStrength = 1.0;
2129#endif`,ay=`#ifdef USE_SPECULARMAP
2130	uniform sampler2D specularMap;
2131#endif`,oy=`#if defined( TONE_MAPPING )
2132	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2133#endif`,ly=`#ifndef saturate
2134#define saturate( a ) clamp( a, 0.0, 1.0 )
2135#endif
2136uniform float toneMappingExposure;
2137vec3 LinearToneMapping( vec3 color ) {
2138	return saturate( toneMappingExposure * color );
2139}
2140vec3 ReinhardToneMapping( vec3 color ) {
2141	color *= toneMappingExposure;
2142	return saturate( color / ( vec3( 1.0 ) + color ) );
2143}
2144vec3 CineonToneMapping( vec3 color ) {
2145	color *= toneMappingExposure;
2146	color = max( vec3( 0.0 ), color - 0.004 );
2147	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2148}
2149vec3 RRTAndODTFit( vec3 v ) {
2150	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2151	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2152	return a / b;
2153}
2154vec3 ACESFilmicToneMapping( vec3 color ) {
2155	const mat3 ACESInputMat = mat3(
2156		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2157		vec3( 0.04823, 0.01566, 0.83777 )
2158	);
2159	const mat3 ACESOutputMat = mat3(
2160		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2161		vec3( -0.07367, -0.00605,  1.07602 )
2162	);
2163	color *= toneMappingExposure / 0.6;
2164	color = ACESInputMat * color;
2165	color = RRTAndODTFit( color );
2166	color = ACESOutputMat * color;
2167	return saturate( color );
2168}
2169const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2170	vec3( 1.6605, - 0.1246, - 0.0182 ),
2171	vec3( - 0.5876, 1.1329, - 0.1006 ),
2172	vec3( - 0.0728, - 0.0083, 1.1187 )
2173);
2174const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2175	vec3( 0.6274, 0.0691, 0.0164 ),
2176	vec3( 0.3293, 0.9195, 0.0880 ),
2177	vec3( 0.0433, 0.0113, 0.8956 )
2178);
2179vec3 agxDefaultContrastApprox( vec3 x ) {
2180	vec3 x2 = x * x;
2181	vec3 x4 = x2 * x2;
2182	return + 15.5 * x4 * x2
2183		- 40.14 * x4 * x
2184		+ 31.96 * x4
2185		- 6.868 * x2 * x
2186		+ 0.4298 * x2
2187		+ 0.1191 * x
2188		- 0.00232;
2189}
2190vec3 AgXToneMapping( vec3 color ) {
2191	const mat3 AgXInsetMatrix = mat3(
2192		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2193		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2194		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2195	);
2196	const mat3 AgXOutsetMatrix = mat3(
2197		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2198		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2199		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2200	);
2201	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2202	color *= toneMappingExposure;
2203	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2204	color = AgXInsetMatrix * color;
2205	color = max( color, 1e-10 );	color = log2( color );
2206	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2207	color = clamp( color, 0.0, 1.0 );
2208	color = agxDefaultContrastApprox( color );
2209	color = AgXOutsetMatrix * color;
2210	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2211	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2212	color = clamp( color, 0.0, 1.0 );
2213	return color;
2214}
2215vec3 NeutralToneMapping( vec3 color ) {
2216	const float StartCompression = 0.8 - 0.04;
2217	const float Desaturation = 0.15;
2218	color *= toneMappingExposure;
2219	float x = min( color.r, min( color.g, color.b ) );
2220	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2221	color -= offset;
2222	float peak = max( color.r, max( color.g, color.b ) );
2223	if ( peak < StartCompression ) return color;
2224	float d = 1. - StartCompression;
2225	float newPeak = 1. - d * d / ( peak + d - StartCompression );
2226	color *= newPeak / peak;
2227	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2228	return mix( color, vec3( newPeak ), g );
2229}
2230vec3 CustomToneMapping( vec3 color ) { return color; }`,cy=`#ifdef USE_TRANSMISSION
2231	material.transmission = transmission;
2232	material.transmissionAlpha = 1.0;
2233	material.thickness = thickness;
2234	material.attenuationDistance = attenuationDistance;
2235	material.attenuationColor = attenuationColor;
2236	#ifdef USE_TRANSMISSIONMAP
2237		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2238	#endif
2239	#ifdef USE_THICKNESSMAP
2240		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2241	#endif
2242	vec3 pos = vWorldPosition;
2243	vec3 v = normalize( cameraPosition - pos );
2244	vec3 n = inverseTransformDirection( normal, viewMatrix );
2245	vec4 transmitted = getIBLVolumeRefraction(
2246		n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
2247		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2248		material.attenuationColor, material.attenuationDistance );
2249	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2250	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2251#endif`,hy=`#ifdef USE_TRANSMISSION
2252	uniform float transmission;
2253	uniform float thickness;
2254	uniform float attenuationDistance;
2255	uniform vec3 attenuationColor;
2256	#ifdef USE_TRANSMISSIONMAP
2257		uniform sampler2D transmissionMap;
2258	#endif
2259	#ifdef USE_THICKNESSMAP
2260		uniform sampler2D thicknessMap;
2261	#endif
2262	uniform vec2 transmissionSamplerSize;
2263	uniform sampler2D transmissionSamplerMap;
2264	uniform mat4 modelMatrix;
2265	uniform mat4 projectionMatrix;
2266	varying vec3 vWorldPosition;
2267	float w0( float a ) {
2268		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2269	}
2270	float w1( float a ) {
2271		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2272	}
2273	float w2( float a ){
2274		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2275	}
2276	float w3( float a ) {
2277		return ( 1.0 / 6.0 ) * ( a * a * a );
2278	}
2279	float g0( float a ) {
2280		return w0( a ) + w1( a );
2281	}
2282	float g1( float a ) {
2283		return w2( a ) + w3( a );
2284	}
2285	float h0( float a ) {
2286		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2287	}
2288	float h1( float a ) {
2289		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2290	}
2291	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2292		uv = uv * texelSize.zw + 0.5;
2293		vec2 iuv = floor( uv );
2294		vec2 fuv = fract( uv );
2295		float g0x = g0( fuv.x );
2296		float g1x = g1( fuv.x );
2297		float h0x = h0( fuv.x );
2298		float h1x = h1( fuv.x );
2299		float h0y = h0( fuv.y );
2300		float h1y = h1( fuv.y );
2301		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2302		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2303		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2304		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2305		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2306			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2307	}
2308	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2309		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2310		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2311		vec2 fLodSizeInv = 1.0 / fLodSize;
2312		vec2 cLodSizeInv = 1.0 / cLodSize;
2313		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2314		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2315		return mix( fSample, cSample, fract( lod ) );
2316	}
2317	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2318		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2319		vec3 modelScale;
2320		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2321		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2322		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2323		return normalize( refractionVector ) * thickness * modelScale;
2324	}
2325	float applyIorToRoughness( const in float roughness, const in float ior ) {
2326		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2327	}
2328	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2329		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2330		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2331	}
2332	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2333		if ( isinf( attenuationDistance ) ) {
2334			return vec3( 1.0 );
2335		} else {
2336			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2337			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2338		}
2339	}
2340	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2341		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2342		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2343		const in vec3 attenuationColor, const in float attenuationDistance ) {
2344		vec4 transmittedLight;
2345		vec3 transmittance;
2346		#ifdef USE_DISPERSION
2347			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2348			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2349			for ( int i = 0; i < 3; i ++ ) {
2350				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2351				vec3 refractedRayExit = position + transmissionRay;
2352				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2353				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2354				refractionCoords += 1.0;
2355				refractionCoords /= 2.0;
2356				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2357				transmittedLight[ i ] = transmissionSample[ i ];
2358				transmittedLight.a += transmissionSample.a;
2359				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2360			}
2361			transmittedLight.a /= 3.0;
2362		#else
2363			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2364			vec3 refractedRayExit = position + transmissionRay;
2365			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2366			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2367			refractionCoords += 1.0;
2368			refractionCoords /= 2.0;
2369			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2370			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2371		#endif
2372		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2373		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2374		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2375		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2376	}
2377#endif`,uy=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2378	varying vec2 vUv;
2379#endif
2380#ifdef USE_MAP
2381	varying vec2 vMapUv;
2382#endif
2383#ifdef USE_ALPHAMAP
2384	varying vec2 vAlphaMapUv;
2385#endif
2386#ifdef USE_LIGHTMAP
2387	varying vec2 vLightMapUv;
2388#endif
2389#ifdef USE_AOMAP
2390	varying vec2 vAoMapUv;
2391#endif
2392#ifdef USE_BUMPMAP
2393	varying vec2 vBumpMapUv;
2394#endif
2395#ifdef USE_NORMALMAP
2396	varying vec2 vNormalMapUv;
2397#endif
2398#ifdef USE_EMISSIVEMAP
2399	varying vec2 vEmissiveMapUv;
2400#endif
2401#ifdef USE_METALNESSMAP
2402	varying vec2 vMetalnessMapUv;
2403#endif
2404#ifdef USE_ROUGHNESSMAP
2405	varying vec2 vRoughnessMapUv;
2406#endif
2407#ifdef USE_ANISOTROPYMAP
2408	varying vec2 vAnisotropyMapUv;
2409#endif
2410#ifdef USE_CLEARCOATMAP
2411	varying vec2 vClearcoatMapUv;
2412#endif
2413#ifdef USE_CLEARCOAT_NORMALMAP
2414	varying vec2 vClearcoatNormalMapUv;
2415#endif
2416#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2417	varying vec2 vClearcoatRoughnessMapUv;
2418#endif
2419#ifdef USE_IRIDESCENCEMAP
2420	varying vec2 vIridescenceMapUv;
2421#endif
2422#ifdef USE_IRIDESCENCE_THICKNESSMAP
2423	varying vec2 vIridescenceThicknessMapUv;
2424#endif
2425#ifdef USE_SHEEN_COLORMAP
2426	varying vec2 vSheenColorMapUv;
2427#endif
2428#ifdef USE_SHEEN_ROUGHNESSMAP
2429	varying vec2 vSheenRoughnessMapUv;
2430#endif
2431#ifdef USE_SPECULARMAP
2432	varying vec2 vSpecularMapUv;
2433#endif
2434#ifdef USE_SPECULAR_COLORMAP
2435	varying vec2 vSpecularColorMapUv;
2436#endif
2437#ifdef USE_SPECULAR_INTENSITYMAP
2438	varying vec2 vSpecularIntensityMapUv;
2439#endif
2440#ifdef USE_TRANSMISSIONMAP
2441	uniform mat3 transmissionMapTransform;
2442	varying vec2 vTransmissionMapUv;
2443#endif
2444#ifdef USE_THICKNESSMAP
2445	uniform mat3 thicknessMapTransform;
2446	varying vec2 vThicknessMapUv;
2447#endif`,dy=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2448	varying vec2 vUv;
2449#endif
2450#ifdef USE_MAP
2451	uniform mat3 mapTransform;
2452	varying vec2 vMapUv;
2453#endif
2454#ifdef USE_ALPHAMAP
2455	uniform mat3 alphaMapTransform;
2456	varying vec2 vAlphaMapUv;
2457#endif
2458#ifdef USE_LIGHTMAP
2459	uniform mat3 lightMapTransform;
2460	varying vec2 vLightMapUv;
2461#endif
2462#ifdef USE_AOMAP
2463	uniform mat3 aoMapTransform;
2464	varying vec2 vAoMapUv;
2465#endif
2466#ifdef USE_BUMPMAP
2467	uniform mat3 bumpMapTransform;
2468	varying vec2 vBumpMapUv;
2469#endif
2470#ifdef USE_NORMALMAP
2471	uniform mat3 normalMapTransform;
2472	varying vec2 vNormalMapUv;
2473#endif
2474#ifdef USE_DISPLACEMENTMAP
2475	uniform mat3 displacementMapTransform;
2476	varying vec2 vDisplacementMapUv;
2477#endif
2478#ifdef USE_EMISSIVEMAP
2479	uniform mat3 emissiveMapTransform;
2480	varying vec2 vEmissiveMapUv;
2481#endif
2482#ifdef USE_METALNESSMAP
2483	uniform mat3 metalnessMapTransform;
2484	varying vec2 vMetalnessMapUv;
2485#endif
2486#ifdef USE_ROUGHNESSMAP
2487	uniform mat3 roughnessMapTransform;
2488	varying vec2 vRoughnessMapUv;
2489#endif
2490#ifdef USE_ANISOTROPYMAP
2491	uniform mat3 anisotropyMapTransform;
2492	varying vec2 vAnisotropyMapUv;
2493#endif
2494#ifdef USE_CLEARCOATMAP
2495	uniform mat3 clearcoatMapTransform;
2496	varying vec2 vClearcoatMapUv;
2497#endif
2498#ifdef USE_CLEARCOAT_NORMALMAP
2499	uniform mat3 clearcoatNormalMapTransform;
2500	varying vec2 vClearcoatNormalMapUv;
2501#endif
2502#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2503	uniform mat3 clearcoatRoughnessMapTransform;
2504	varying vec2 vClearcoatRoughnessMapUv;
2505#endif
2506#ifdef USE_SHEEN_COLORMAP
2507	uniform mat3 sheenColorMapTransform;
2508	varying vec2 vSheenColorMapUv;
2509#endif
2510#ifdef USE_SHEEN_ROUGHNESSMAP
2511	uniform mat3 sheenRoughnessMapTransform;
2512	varying vec2 vSheenRoughnessMapUv;
2513#endif
2514#ifdef USE_IRIDESCENCEMAP
2515	uniform mat3 iridescenceMapTransform;
2516	varying vec2 vIridescenceMapUv;
2517#endif
2518#ifdef USE_IRIDESCENCE_THICKNESSMAP
2519	uniform mat3 iridescenceThicknessMapTransform;
2520	varying vec2 vIridescenceThicknessMapUv;
2521#endif
2522#ifdef USE_SPECULARMAP
2523	uniform mat3 specularMapTransform;
2524	varying vec2 vSpecularMapUv;
2525#endif
2526#ifdef USE_SPECULAR_COLORMAP
2527	uniform mat3 specularColorMapTransform;
2528	varying vec2 vSpecularColorMapUv;
2529#endif
2530#ifdef USE_SPECULAR_INTENSITYMAP
2531	uniform mat3 specularIntensityMapTransform;
2532	varying vec2 vSpecularIntensityMapUv;
2533#endif
2534#ifdef USE_TRANSMISSIONMAP
2535	uniform mat3 transmissionMapTransform;
2536	varying vec2 vTransmissionMapUv;
2537#endif
2538#ifdef USE_THICKNESSMAP
2539	uniform mat3 thicknessMapTransform;
2540	varying vec2 vThicknessMapUv;
2541#endif`,fy=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2542	vUv = vec3( uv, 1 ).xy;
2543#endif
2544#ifdef USE_MAP
2545	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2546#endif
2547#ifdef USE_ALPHAMAP
2548	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2549#endif
2550#ifdef USE_LIGHTMAP
2551	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2552#endif
2553#ifdef USE_AOMAP
2554	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2555#endif
2556#ifdef USE_BUMPMAP
2557	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2558#endif
2559#ifdef USE_NORMALMAP
2560	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2561#endif
2562#ifdef USE_DISPLACEMENTMAP
2563	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2564#endif
2565#ifdef USE_EMISSIVEMAP
2566	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2567#endif
2568#ifdef USE_METALNESSMAP
2569	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2570#endif
2571#ifdef USE_ROUGHNESSMAP
2572	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2573#endif
2574#ifdef USE_ANISOTROPYMAP
2575	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2576#endif
2577#ifdef USE_CLEARCOATMAP
2578	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2579#endif
2580#ifdef USE_CLEARCOAT_NORMALMAP
2581	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2582#endif
2583#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2584	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2585#endif
2586#ifdef USE_IRIDESCENCEMAP
2587	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2588#endif
2589#ifdef USE_IRIDESCENCE_THICKNESSMAP
2590	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2591#endif
2592#ifdef USE_SHEEN_COLORMAP
2593	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2594#endif
2595#ifdef USE_SHEEN_ROUGHNESSMAP
2596	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2597#endif
2598#ifdef USE_SPECULARMAP
2599	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2600#endif
2601#ifdef USE_SPECULAR_COLORMAP
2602	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2603#endif
2604#ifdef USE_SPECULAR_INTENSITYMAP
2605	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2606#endif
2607#ifdef USE_TRANSMISSIONMAP
2608	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2609#endif
2610#ifdef USE_THICKNESSMAP
2611	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2612#endif`,py=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2613	vec4 worldPosition = vec4( transformed, 1.0 );
2614	#ifdef USE_BATCHING
2615		worldPosition = batchingMatrix * worldPosition;
2616	#endif
2617	#ifdef USE_INSTANCING
2618		worldPosition = instanceMatrix * worldPosition;
2619	#endif
2620	worldPosition = modelMatrix * worldPosition;
2621#endif`;const my=`varying vec2 vUv;
2622uniform mat3 uvTransform;
2623void main() {
2624	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2625	gl_Position = vec4( position.xy, 1.0, 1.0 );
2626}`,gy=`uniform sampler2D t2D;
2627uniform float backgroundIntensity;
2628varying vec2 vUv;
2629void main() {
2630	vec4 texColor = texture2D( t2D, vUv );
2631	#ifdef DECODE_VIDEO_TEXTURE
2632		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 );
2633	#endif
2634	texColor.rgb *= backgroundIntensity;
2635	gl_FragColor = texColor;
2636	#include <tonemapping_fragment>
2637	#include <colorspace_fragment>
2638}`,vy=`varying vec3 vWorldDirection;
2639#include <common>
2640void main() {
2641	vWorldDirection = transformDirection( position, modelMatrix );
2642	#include <begin_vertex>
2643	#include <project_vertex>
2644	gl_Position.z = gl_Position.w;
2645}`,_y=`#ifdef ENVMAP_TYPE_CUBE
2646	uniform samplerCube envMap;
2647#elif defined( ENVMAP_TYPE_CUBE_UV )
2648	uniform sampler2D envMap;
2649#endif
2650uniform float backgroundBlurriness;
2651uniform float backgroundIntensity;
2652uniform mat3 backgroundRotation;
2653varying vec3 vWorldDirection;
2654#include <cube_uv_reflection_fragment>
2655void main() {
2656	#ifdef ENVMAP_TYPE_CUBE
2657		vec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );
2658	#elif defined( ENVMAP_TYPE_CUBE_UV )
2659		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2660	#else
2661		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2662	#endif
2663	texColor.rgb *= backgroundIntensity;
2664	gl_FragColor = texColor;
2665	#include <tonemapping_fragment>
2666	#include <colorspace_fragment>
2667}`,yy=`varying vec3 vWorldDirection;
2668#include <common>
2669void main() {
2670	vWorldDirection = transformDirection( position, modelMatrix );
2671	#include <begin_vertex>
2672	#include <project_vertex>
2673	gl_Position.z = gl_Position.w;
2674}`,xy=`uniform samplerCube tCube;
2675uniform float tFlip;
2676uniform float opacity;
2677varying vec3 vWorldDirection;
2678void main() {
2679	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2680	gl_FragColor = texColor;
2681	gl_FragColor.a *= opacity;
2682	#include <tonemapping_fragment>
2683	#include <colorspace_fragment>
2684}`,My=`#include <common>
2685#include <batching_pars_vertex>
2686#include <uv_pars_vertex>
2687#include <displacementmap_pars_vertex>
2688#include <morphtarget_pars_vertex>
2689#include <skinning_pars_vertex>
2690#include <logdepthbuf_pars_vertex>
2691#include <clipping_planes_pars_vertex>
2692varying vec2 vHighPrecisionZW;
2693void main() {
2694	#include <uv_vertex>
2695	#include <batching_vertex>
2696	#include <skinbase_vertex>
2697	#include <morphinstance_vertex>
2698	#ifdef USE_DISPLACEMENTMAP
2699		#include <beginnormal_vertex>
2700		#include <morphnormal_vertex>
2701		#include <skinnormal_vertex>
2702	#endif
2703	#include <begin_vertex>
2704	#include <morphtarget_vertex>
2705	#include <skinning_vertex>
2706	#include <displacementmap_vertex>
2707	#include <project_vertex>
2708	#include <logdepthbuf_vertex>
2709	#include <clipping_planes_vertex>
2710	vHighPrecisionZW = gl_Position.zw;
2711}`,Sy=`#if DEPTH_PACKING == 3200
2712	uniform float opacity;
2713#endif
2714#include <common>
2715#include <packing>
2716#include <uv_pars_fragment>
2717#include <map_pars_fragment>
2718#include <alphamap_pars_fragment>
2719#include <alphatest_pars_fragment>
2720#include <alphahash_pars_fragment>
2721#include <logdepthbuf_pars_fragment>
2722#include <clipping_planes_pars_fragment>
2723varying vec2 vHighPrecisionZW;
2724void main() {
2725	vec4 diffuseColor = vec4( 1.0 );
2726	#include <clipping_planes_fragment>
2727	#if DEPTH_PACKING == 3200
2728		diffuseColor.a = opacity;
2729	#endif
2730	#include <map_fragment>
2731	#include <alphamap_fragment>
2732	#include <alphatest_fragment>
2733	#include <alphahash_fragment>
2734	#include <logdepthbuf_fragment>
2735	#ifdef USE_REVERSED_DEPTH_BUFFER
2736		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
2737	#else
2738		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
2739	#endif
2740	#if DEPTH_PACKING == 3200
2741		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2742	#elif DEPTH_PACKING == 3201
2743		gl_FragColor = packDepthToRGBA( fragCoordZ );
2744	#elif DEPTH_PACKING == 3202
2745		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2746	#elif DEPTH_PACKING == 3203
2747		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2748	#endif
2749}`,by=`#define DISTANCE
2750varying vec3 vWorldPosition;
2751#include <common>
2752#include <batching_pars_vertex>
2753#include <uv_pars_vertex>
2754#include <displacementmap_pars_vertex>
2755#include <morphtarget_pars_vertex>
2756#include <skinning_pars_vertex>
2757#include <clipping_planes_pars_vertex>
2758void main() {
2759	#include <uv_vertex>
2760	#include <batching_vertex>
2761	#include <skinbase_vertex>
2762	#include <morphinstance_vertex>
2763	#ifdef USE_DISPLACEMENTMAP
2764		#include <beginnormal_vertex>
2765		#include <morphnormal_vertex>
2766		#include <skinnormal_vertex>
2767	#endif
2768	#include <begin_vertex>
2769	#include <morphtarget_vertex>
2770	#include <skinning_vertex>
2771	#include <displacementmap_vertex>
2772	#include <project_vertex>
2773	#include <worldpos_vertex>
2774	#include <clipping_planes_vertex>
2775	vWorldPosition = worldPosition.xyz;
2776}`,Ty=`#define DISTANCE
2777uniform vec3 referencePosition;
2778uniform float nearDistance;
2779uniform float farDistance;
2780varying vec3 vWorldPosition;
2781#include <common>
2782#include <uv_pars_fragment>
2783#include <map_pars_fragment>
2784#include <alphamap_pars_fragment>
2785#include <alphatest_pars_fragment>
2786#include <alphahash_pars_fragment>
2787#include <clipping_planes_pars_fragment>
2788void main () {
2789	vec4 diffuseColor = vec4( 1.0 );
2790	#include <clipping_planes_fragment>
2791	#include <map_fragment>
2792	#include <alphamap_fragment>
2793	#include <alphatest_fragment>
2794	#include <alphahash_fragment>
2795	float dist = length( vWorldPosition - referencePosition );
2796	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2797	dist = saturate( dist );
2798	gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
2799}`,wy=`varying vec3 vWorldDirection;
2800#include <common>
2801void main() {
2802	vWorldDirection = transformDirection( position, modelMatrix );
2803	#include <begin_vertex>
2804	#include <project_vertex>
2805}`,Ey=`uniform sampler2D tEquirect;
2806varying vec3 vWorldDirection;
2807#include <common>
2808void main() {
2809	vec3 direction = normalize( vWorldDirection );
2810	vec2 sampleUV = equirectUv( direction );
2811	gl_FragColor = texture2D( tEquirect, sampleUV );
2812	#include <tonemapping_fragment>
2813	#include <colorspace_fragment>
2814}`,Ay=`uniform float scale;
2815attribute float lineDistance;
2816varying float vLineDistance;
2817#include <common>
2818#include <uv_pars_vertex>
2819#include <color_pars_vertex>
2820#include <fog_pars_vertex>
2821#include <morphtarget_pars_vertex>
2822#include <logdepthbuf_pars_vertex>
2823#include <clipping_planes_pars_vertex>
2824void main() {
2825	vLineDistance = scale * lineDistance;
2826	#include <uv_vertex>
2827	#include <color_vertex>
2828	#include <morphinstance_vertex>
2829	#include <morphcolor_vertex>
2830	#include <begin_vertex>
2831	#include <morphtarget_vertex>
2832	#include <project_vertex>
2833	#include <logdepthbuf_vertex>
2834	#include <clipping_planes_vertex>
2835	#include <fog_vertex>
2836}`,Cy=`uniform vec3 diffuse;
2837uniform float opacity;
2838uniform float dashSize;
2839uniform float totalSize;
2840varying float vLineDistance;
2841#include <common>
2842#include <color_pars_fragment>
2843#include <uv_pars_fragment>
2844#include <map_pars_fragment>
2845#include <fog_pars_fragment>
2846#include <logdepthbuf_pars_fragment>
2847#include <clipping_planes_pars_fragment>
2848void main() {
2849	vec4 diffuseColor = vec4( diffuse, opacity );
2850	#include <clipping_planes_fragment>
2851	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2852		discard;
2853	}
2854	vec3 outgoingLight = vec3( 0.0 );
2855	#include <logdepthbuf_fragment>
2856	#include <map_fragment>
2857	#include <color_fragment>
2858	outgoingLight = diffuseColor.rgb;
2859	#include <opaque_fragment>
2860	#include <tonemapping_fragment>
2861	#include <colorspace_fragment>
2862	#include <fog_fragment>
2863	#include <premultiplied_alpha_fragment>
2864}`,Ry=`#include <common>
2865#include <batching_pars_vertex>
2866#include <uv_pars_vertex>
2867#include <envmap_pars_vertex>
2868#include <color_pars_vertex>
2869#include <fog_pars_vertex>
2870#include <morphtarget_pars_vertex>
2871#include <skinning_pars_vertex>
2872#include <logdepthbuf_pars_vertex>
2873#include <clipping_planes_pars_vertex>
2874void main() {
2875	#include <uv_vertex>
2876	#include <color_vertex>
2877	#include <morphinstance_vertex>
2878	#include <morphcolor_vertex>
2879	#include <batching_vertex>
2880	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2881		#include <beginnormal_vertex>
2882		#include <morphnormal_vertex>
2883		#include <skinbase_vertex>
2884		#include <skinnormal_vertex>
2885		#include <defaultnormal_vertex>
2886	#endif
2887	#include <begin_vertex>
2888	#include <morphtarget_vertex>
2889	#include <skinning_vertex>
2890	#include <project_vertex>
2891	#include <logdepthbuf_vertex>
2892	#include <clipping_planes_vertex>
2893	#include <worldpos_vertex>
2894	#include <envmap_vertex>
2895	#include <fog_vertex>
2896}`,Iy=`uniform vec3 diffuse;
2897uniform float opacity;
2898#ifndef FLAT_SHADED
2899	varying vec3 vNormal;
2900#endif
2901#include <common>
2902#include <dithering_pars_fragment>
2903#include <color_pars_fragment>
2904#include <uv_pars_fragment>
2905#include <map_pars_fragment>
2906#include <alphamap_pars_fragment>
2907#include <alphatest_pars_fragment>
2908#include <alphahash_pars_fragment>
2909#include <aomap_pars_fragment>
2910#include <lightmap_pars_fragment>
2911#include <envmap_common_pars_fragment>
2912#include <envmap_pars_fragment>
2913#include <fog_pars_fragment>
2914#include <specularmap_pars_fragment>
2915#include <logdepthbuf_pars_fragment>
2916#include <clipping_planes_pars_fragment>
2917void main() {
2918	vec4 diffuseColor = vec4( diffuse, opacity );
2919	#include <clipping_planes_fragment>
2920	#include <logdepthbuf_fragment>
2921	#include <map_fragment>
2922	#include <color_fragment>
2923	#include <alphamap_fragment>
2924	#include <alphatest_fragment>
2925	#include <alphahash_fragment>
2926	#include <specularmap_fragment>
2927	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2928	#ifdef USE_LIGHTMAP
2929		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2930		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2931	#else
2932		reflectedLight.indirectDiffuse += vec3( 1.0 );
2933	#endif
2934	#include <aomap_fragment>
2935	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2936	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2937	#include <envmap_fragment>
2938	#include <opaque_fragment>
2939	#include <tonemapping_fragment>
2940	#include <colorspace_fragment>
2941	#include <fog_fragment>
2942	#include <premultiplied_alpha_fragment>
2943	#include <dithering_fragment>
2944}`,Py=`#define LAMBERT
2945varying vec3 vViewPosition;
2946#include <common>
2947#include <batching_pars_vertex>
2948#include <uv_pars_vertex>
2949#include <displacementmap_pars_vertex>
2950#include <envmap_pars_vertex>
2951#include <color_pars_vertex>
2952#include <fog_pars_vertex>
2953#include <normal_pars_vertex>
2954#include <morphtarget_pars_vertex>
2955#include <skinning_pars_vertex>
2956#include <shadowmap_pars_vertex>
2957#include <logdepthbuf_pars_vertex>
2958#include <clipping_planes_pars_vertex>
2959void main() {
2960	#include <uv_vertex>
2961	#include <color_vertex>
2962	#include <morphinstance_vertex>
2963	#include <morphcolor_vertex>
2964	#include <batching_vertex>
2965	#include <beginnormal_vertex>
2966	#include <morphnormal_vertex>
2967	#include <skinbase_vertex>
2968	#include <skinnormal_vertex>
2969	#include <defaultnormal_vertex>
2970	#include <normal_vertex>
2971	#include <begin_vertex>
2972	#include <morphtarget_vertex>
2973	#include <skinning_vertex>
2974	#include <displacementmap_vertex>
2975	#include <project_vertex>
2976	#include <logdepthbuf_vertex>
2977	#include <clipping_planes_vertex>
2978	vViewPosition = - mvPosition.xyz;
2979	#include <worldpos_vertex>
2980	#include <envmap_vertex>
2981	#include <shadowmap_vertex>
2982	#include <fog_vertex>
2983}`,Ly=`#define LAMBERT
2984uniform vec3 diffuse;
2985uniform vec3 emissive;
2986uniform float opacity;
2987#include <common>
2988#include <dithering_pars_fragment>
2989#include <color_pars_fragment>
2990#include <uv_pars_fragment>
2991#include <map_pars_fragment>
2992#include <alphamap_pars_fragment>
2993#include <alphatest_pars_fragment>
2994#include <alphahash_pars_fragment>
2995#include <aomap_pars_fragment>
2996#include <lightmap_pars_fragment>
2997#include <emissivemap_pars_fragment>
2998#include <cube_uv_reflection_fragment>
2999#include <envmap_common_pars_fragment>
3000#include <envmap_pars_fragment>
3001#include <envmap_physical_pars_fragment>
3002#include <fog_pars_fragment>
3003#include <bsdfs>
3004#include <lights_pars_begin>
3005#include <normal_pars_fragment>
3006#include <lights_lambert_pars_fragment>
3007#include <shadowmap_pars_fragment>
3008#include <bumpmap_pars_fragment>
3009#include <normalmap_pars_fragment>
3010#include <specularmap_pars_fragment>
3011#include <logdepthbuf_pars_fragment>
3012#include <clipping_planes_pars_fragment>
3013void main() {
3014	vec4 diffuseColor = vec4( diffuse, opacity );
3015	#include <clipping_planes_fragment>
3016	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3017	vec3 totalEmissiveRadiance = emissive;
3018	#include <logdepthbuf_fragment>
3019	#include <map_fragment>
3020	#include <color_fragment>
3021	#include <alphamap_fragment>
3022	#include <alphatest_fragment>
3023	#include <alphahash_fragment>
3024	#include <specularmap_fragment>
3025	#include <normal_fragment_begin>
3026	#include <normal_fragment_maps>
3027	#include <emissivemap_fragment>
3028	#include <lights_lambert_fragment>
3029	#include <lights_fragment_begin>
3030	#include <lights_fragment_maps>
3031	#include <lights_fragment_end>
3032	#include <aomap_fragment>
3033	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3034	#include <envmap_fragment>
3035	#include <opaque_fragment>
3036	#include <tonemapping_fragment>
3037	#include <colorspace_fragment>
3038	#include <fog_fragment>
3039	#include <premultiplied_alpha_fragment>
3040	#include <dithering_fragment>
3041}`,Uy=`#define MATCAP
3042varying vec3 vViewPosition;
3043#include <common>
3044#include <batching_pars_vertex>
3045#include <uv_pars_vertex>
3046#include <color_pars_vertex>
3047#include <displacementmap_pars_vertex>
3048#include <fog_pars_vertex>
3049#include <normal_pars_vertex>
3050#include <morphtarget_pars_vertex>
3051#include <skinning_pars_vertex>
3052#include <logdepthbuf_pars_vertex>
3053#include <clipping_planes_pars_vertex>
3054void main() {
3055	#include <uv_vertex>
3056	#include <color_vertex>
3057	#include <morphinstance_vertex>
3058	#include <morphcolor_vertex>
3059	#include <batching_vertex>
3060	#include <beginnormal_vertex>
3061	#include <morphnormal_vertex>
3062	#include <skinbase_vertex>
3063	#include <skinnormal_vertex>
3064	#include <defaultnormal_vertex>
3065	#include <normal_vertex>
3066	#include <begin_vertex>
3067	#include <morphtarget_vertex>
3068	#include <skinning_vertex>
3069	#include <displacementmap_vertex>
3070	#include <project_vertex>
3071	#include <logdepthbuf_vertex>
3072	#include <clipping_planes_vertex>
3073	#include <fog_vertex>
3074	vViewPosition = - mvPosition.xyz;
3075}`,Ny=`#define MATCAP
3076uniform vec3 diffuse;
3077uniform float opacity;
3078uniform sampler2D matcap;
3079varying vec3 vViewPosition;
3080#include <common>
3081#include <dithering_pars_fragment>
3082#include <color_pars_fragment>
3083#include <uv_pars_fragment>
3084#include <map_pars_fragment>
3085#include <alphamap_pars_fragment>
3086#include <alphatest_pars_fragment>
3087#include <alphahash_pars_fragment>
3088#include <fog_pars_fragment>
3089#include <normal_pars_fragment>
3090#include <bumpmap_pars_fragment>
3091#include <normalmap_pars_fragme
3091nt>
3092#include <logdepthbuf_pars_fragment>
3093#include <clipping_planes_pars_fragment>
3094void main() {
3095	vec4 diffuseColor = vec4( diffuse, opacity );
3096	#include <clipping_planes_fragment>
3097	#include <logdepthbuf_fragment>
3098	#include <map_fragment>
3099	#include <color_fragment>
3100	#include <alphamap_fragment>
3101	#include <alphatest_fragment>
3102	#include <alphahash_fragment>
3103	#include <normal_fragment_begin>
3104	#include <normal_fragment_maps>
3105	vec3 viewDir = normalize( vViewPosition );
3106	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3107	vec3 y = cross( viewDir, x );
3108	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3109	#ifdef USE_MATCAP
3110		vec4 matcapColor = texture2D( matcap, uv );
3111	#else
3112		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3113	#endif
3114	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3115	#include <opaque_fragment>
3116	#include <tonemapping_fragment>
3117	#include <colorspace_fragment>
3118	#include <fog_fragment>
3119	#include <premultiplied_alpha_fragment>
3120	#include <dithering_fragment>
3121}`,Dy=`#define NORMAL
3122#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3123	varying vec3 vViewPosition;
3124#endif
3125#include <common>
3126#include <batching_pars_vertex>
3127#include <uv_pars_vertex>
3128#include <displacementmap_pars_vertex>
3129#include <normal_pars_vertex>
3130#include <morphtarget_pars_vertex>
3131#include <skinning_pars_vertex>
3132#include <logdepthbuf_pars_vertex>
3133#include <clipping_planes_pars_vertex>
3134void main() {
3135	#include <uv_vertex>
3136	#include <batching_vertex>
3137	#include <beginnormal_vertex>
3138	#include <morphinstance_vertex>
3139	#include <morphnormal_vertex>
3140	#include <skinbase_vertex>
3141	#include <skinnormal_vertex>
3142	#include <defaultnormal_vertex>
3143	#include <normal_vertex>
3144	#include <begin_vertex>
3145	#include <morphtarget_vertex>
3146	#include <skinning_vertex>
3147	#include <displacementmap_vertex>
3148	#include <project_vertex>
3149	#include <logdepthbuf_vertex>
3150	#include <clipping_planes_vertex>
3151#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3152	vViewPosition = - mvPosition.xyz;
3153#endif
3154}`,Oy=`#define NORMAL
3155uniform float opacity;
3156#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3157	varying vec3 vViewPosition;
3158#endif
3159#include <uv_pars_fragment>
3160#include <normal_pars_fragment>
3161#include <bumpmap_pars_fragment>
3162#include <normalmap_pars_fragment>
3163#include <logdepthbuf_pars_fragment>
3164#include <clipping_planes_pars_fragment>
3165void main() {
3166	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3167	#include <clipping_planes_fragment>
3168	#include <logdepthbuf_fragment>
3169	#include <normal_fragment_begin>
3170	#include <normal_fragment_maps>
3171	gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
3172	#ifdef OPAQUE
3173		gl_FragColor.a = 1.0;
3174	#endif
3175}`,Fy=`#define PHONG
3176varying vec3 vViewPosition;
3177#include <common>
3178#include <batching_pars_vertex>
3179#include <uv_pars_vertex>
3180#include <displacementmap_pars_vertex>
3181#include <envmap_pars_vertex>
3182#include <color_pars_vertex>
3183#include <fog_pars_vertex>
3184#include <normal_pars_vertex>
3185#include <morphtarget_pars_vertex>
3186#include <skinning_pars_vertex>
3187#include <shadowmap_pars_vertex>
3188#include <logdepthbuf_pars_vertex>
3189#include <clipping_planes_pars_vertex>
3190void main() {
3191	#include <uv_vertex>
3192	#include <color_vertex>
3193	#include <morphcolor_vertex>
3194	#include <batching_vertex>
3195	#include <beginnormal_vertex>
3196	#include <morphinstance_vertex>
3197	#include <morphnormal_vertex>
3198	#include <skinbase_vertex>
3199	#include <skinnormal_vertex>
3200	#include <defaultnormal_vertex>
3201	#include <normal_vertex>
3202	#include <begin_vertex>
3203	#include <morphtarget_vertex>
3204	#include <skinning_vertex>
3205	#include <displacementmap_vertex>
3206	#include <project_vertex>
3207	#include <logdepthbuf_vertex>
3208	#include <clipping_planes_vertex>
3209	vViewPosition = - mvPosition.xyz;
3210	#include <worldpos_vertex>
3211	#include <envmap_vertex>
3212	#include <shadowmap_vertex>
3213	#include <fog_vertex>
3214}`,By=`#define PHONG
3215uniform vec3 diffuse;
3216uniform vec3 emissive;
3217uniform vec3 specular;
3218uniform float shininess;
3219uniform float opacity;
3220#include <common>
3221#include <dithering_pars_fragment>
3222#include <color_pars_fragment>
3223#include <uv_pars_fragment>
3224#include <map_pars_fragment>
3225#include <alphamap_pars_fragment>
3226#include <alphatest_pars_fragment>
3227#include <alphahash_pars_fragment>
3228#include <aomap_pars_fragment>
3229#include <lightmap_pars_fragment>
3230#include <emissivemap_pars_fragment>
3231#include <cube_uv_reflection_fragment>
3232#include <envmap_common_pars_fragment>
3233#include <envmap_pars_fragment>
3234#include <envmap_physical_pars_fragment>
3235#include <fog_pars_fragment>
3236#include <bsdfs>
3237#include <lights_pars_begin>
3238#include <normal_pars_fragment>
3239#include <lights_phong_pars_fragment>
3240#include <shadowmap_pars_fragment>
3241#include <bumpmap_pars_fragment>
3242#include <normalmap_pars_fragment>
3243#include <specularmap_pars_fragment>
3244#include <logdepthbuf_pars_fragment>
3245#include <clipping_planes_pars_fragment>
3246void main() {
3247	vec4 diffuseColor = vec4( diffuse, opacity );
3248	#include <clipping_planes_fragment>
3249	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3250	vec3 totalEmissiveRadiance = emissive;
3251	#include <logdepthbuf_fragment>
3252	#include <map_fragment>
3253	#include <color_fragment>
3254	#include <alphamap_fragment>
3255	#include <alphatest_fragment>
3256	#include <alphahash_fragment>
3257	#include <specularmap_fragment>
3258	#include <normal_fragment_begin>
3259	#include <normal_fragment_maps>
3260	#include <emissivemap_fragment>
3261	#include <lights_phong_fragment>
3262	#include <lights_fragment_begin>
3263	#include <lights_fragment_maps>
3264	#include <lights_fragment_end>
3265	#include <aomap_fragment>
3266	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3267	#include <envmap_fragment>
3268	#include <opaque_fragment>
3269	#include <tonemapping_fragment>
3270	#include <colorspace_fragment>
3271	#include <fog_fragment>
3272	#include <premultiplied_alpha_fragment>
3273	#include <dithering_fragment>
3274}`,zy=`#define STANDARD
3275varying vec3 vViewPosition;
3276#ifdef USE_TRANSMISSION
3277	varying vec3 vWorldPosition;
3278#endif
3279#include <common>
3280#include <batching_pars_vertex>
3281#include <uv_pars_vertex>
3282#include <displacementmap_pars_vertex>
3283#include <color_pars_vertex>
3284#include <fog_pars_vertex>
3285#include <normal_pars_vertex>
3286#include <morphtarget_pars_vertex>
3287#include <skinning_pars_vertex>
3288#include <shadowmap_pars_vertex>
3289#include <logdepthbuf_pars_vertex>
3290#include <clipping_planes_pars_vertex>
3291void main() {
3292	#include <uv_vertex>
3293	#include <color_vertex>
3294	#include <morphinstance_vertex>
3295	#include <morphcolor_vertex>
3296	#include <batching_vertex>
3297	#include <beginnormal_vertex>
3298	#include <morphnormal_vertex>
3299	#include <skinbase_vertex>
3300	#include <skinnormal_vertex>
3301	#include <defaultnormal_vertex>
3302	#include <normal_vertex>
3303	#include <begin_vertex>
3304	#include <morphtarget_vertex>
3305	#include <skinning_vertex>
3306	#include <displacementmap_vertex>
3307	#include <project_vertex>
3308	#include <logdepthbuf_vertex>
3309	#include <clipping_planes_vertex>
3310	vViewPosition = - mvPosition.xyz;
3311	#include <worldpos_vertex>
3312	#include <shadowmap_vertex>
3313	#include <fog_vertex>
3314#ifdef USE_TRANSMISSION
3315	vWorldPosition = worldPosition.xyz;
3316#endif
3317}`,ky=`#define STANDARD
3318#ifdef PHYSICAL
3319	#define IOR
3320	#define USE_SPECULAR
3321#endif
3322uniform vec3 diffuse;
3323uniform vec3 emissive;
3324uniform float roughness;
3325uniform float metalness;
3326uniform float opacity;
3327#ifdef IOR
3328	uniform float ior;
3329#endif
3330#ifdef USE_SPECULAR
3331	uniform float specularIntensity;
3332	uniform vec3 specularColor;
3333	#ifdef USE_SPECULAR_COLORMAP
3334		uniform sampler2D specularColorMap;
3335	#endif
3336	#ifdef USE_SPECULAR_INTENSITYMAP
3337		uniform sampler2D specularIntensityMap;
3338	#endif
3339#endif
3340#ifdef USE_CLEARCOAT
3341	uniform float clearcoat;
3342	uniform float clearcoatRoughness;
3343#endif
3344#ifdef USE_DISPERSION
3345	uniform float dispersion;
3346#endif
3347#ifdef USE_IRIDESCENCE
3348	uniform float iridescence;
3349	uniform float iridescenceIOR;
3350	uniform float iridescenceThicknessMinimum;
3351	uniform float iridescenceThicknessMaximum;
3352#endif
3353#ifdef USE_SHEEN
3354	uniform vec3 sheenColor;
3355	uniform float sheenRoughness;
3356	#ifdef USE_SHEEN_COLORMAP
3357		uniform sampler2D sheenColorMap;
3358	#endif
3359	#ifdef USE_SHEEN_ROUGHNESSMAP
3360		uniform sampler2D sheenRoughnessMap;
3361	#endif
3362#endif
3363#ifdef USE_ANISOTROPY
3364	uniform vec2 anisotropyVector;
3365	#ifdef USE_ANISOTROPYMAP
3366		uniform sampler2D anisotropyMap;
3367	#endif
3368#endif
3369varying vec3 vViewPosition;
3370#include <common>
3371#include <dithering_pars_fragment>
3372#include <color_pars_fragment>
3373#include <uv_pars_fragment>
3374#include <map_pars_fragment>
3375#include <alphamap_pars_fragment>
3376#include <alphatest_pars_fragment>
3377#include <alphahash_pars_fragment>
3378#include <aomap_pars_fragment>
3379#include <lightmap_pars_fragment>
3380#include <emissivemap_pars_fragment>
3381#include <iridescence_fragment>
3382#include <cube_uv_reflection_fragment>
3383#include <envmap_common_pars_fragment>
3384#include <envmap_physical_pars_fragment>
3385#include <fog_pars_fragment>
3386#include <lights_pars_begin>
3387#include <normal_pars_fragment>
3388#include <lights_physical_pars_fragment>
3389#include <transmission_pars_fragment>
3390#include <shadowmap_pars_fragment>
3391#include <bumpmap_pars_fragment>
3392#include <normalmap_pars_fragment>
3393#include <clearcoat_pars_fragment>
3394#include <iridescence_pars_fragment>
3395#include <roughnessmap_pars_fragment>
3396#include <metalnessmap_pars_fragment>
3397#include <logdepthbuf_pars_fragment>
3398#include <clipping_planes_pars_fragment>
3399void main() {
3400	vec4 diffuseColor = vec4( diffuse, opacity );
3401	#include <clipping_planes_fragment>
3402	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3403	vec3 totalEmissiveRadiance = emissive;
3404	#include <logdepthbuf_fragment>
3405	#include <map_fragment>
3406	#include <color_fragment>
3407	#include <alphamap_fragment>
3408	#include <alphatest_fragment>
3409	#include <alphahash_fragment>
3410	#include <roughnessmap_fragment>
3411	#include <metalnessmap_fragment>
3412	#include <normal_fragment_begin>
3413	#include <normal_fragment_maps>
3414	#include <clearcoat_normal_fragment_begin>
3415	#include <clearcoat_normal_fragment_maps>
3416	#include <emissivemap_fragment>
3417	#include <lights_physical_fragment>
3418	#include <lights_fragment_begin>
3419	#include <lights_fragment_maps>
3420	#include <lights_fragment_end>
3421	#include <aomap_fragment>
3422	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3423	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3424	#include <transmission_fragment>
3425	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3426	#ifdef USE_SHEEN
3427 
3428		outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
3429 
3430 	#endif
3431	#ifdef USE_CLEARCOAT
3432		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3433		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3434		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3435	#endif
3436	#include <opaque_fragment>
3437	#include <tonemapping_fragment>
3438	#include <colorspace_fragment>
3439	#include <fog_fragment>
3440	#include <premultiplied_alpha_fragment>
3441	#include <dithering_fragment>
3442}`,Vy=`#define TOON
3443varying vec3 vViewPosition;
3444#include <common>
3445#include <batching_pars_vertex>
3446#include <uv_pars_vertex>
3447#include <displacementmap_pars_vertex>
3448#include <color_pars_vertex>
3449#include <fog_pars_vertex>
3450#include <normal_pars_vertex>
3451#include <morphtarget_pars_vertex>
3452#include <skinning_pars_vertex>
3453#include <shadowmap_pars_vertex>
3454#include <logdepthbuf_pars_vertex>
3455#include <clipping_planes_pars_vertex>
3456void main() {
3457	#include <uv_vertex>
3458	#include <color_vertex>
3459	#include <morphinstance_vertex>
3460	#include <morphcolor_vertex>
3461	#include <batching_vertex>
3462	#include <beginnormal_vertex>
3463	#include <morphnormal_vertex>
3464	#include <skinbase_vertex>
3465	#include <skinnormal_vertex>
3466	#include <defaultnormal_vertex>
3467	#include <normal_vertex>
3468	#include <begin_vertex>
3469	#include <morphtarget_vertex>
3470	#include <skinning_vertex>
3471	#include <displacementmap_vertex>
3472	#include <project_vertex>
3473	#include <logdepthbuf_vertex>
3474	#include <clipping_planes_vertex>
3475	vViewPosition = - mvPosition.xyz;
3476	#include <worldpos_vertex>
3477	#include <shadowmap_vertex>
3478	#include <fog_vertex>
3479}`,Hy=`#define TOON
3480uniform vec3 diffuse;
3481uniform vec3 emissive;
3482uniform float opacity;
3483#include <common>
3484#include <dithering_pars_fragment>
3485#include <color_pars_fragment>
3486#include <uv_pars_fragment>
3487#include <map_pars_fragment>
3488#include <alphamap_pars_fragment>
3489#include <alphatest_pars_fragment>
3490#include <alphahash_pars_fragment>
3491#include <aomap_pars_fragment>
3492#include <lightmap_pars_fragment>
3493#include <emissivemap_pars_fragment>
3494#include <gradientmap_pars_fragment>
3495#include <fog_pars_fragment>
3496#include <bsdfs>
3497#include <lights_pars_begin>
3498#include <normal_pars_fragment>
3499#include <lights_toon_pars_fragment>
3500#include <shadowmap_pars_fragment>
3501#include <bumpmap_pars_fragment>
3502#include <normalmap_pars_fragment>
3503#include <logdepthbuf_pars_fragment>
3504#include <clipping_planes_pars_fragment>
3505void main() {
3506	vec4 diffuseColor = vec4( diffuse, opacity );
3507	#include <clipping_planes_fragment>
3508	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3509	vec3 totalEmissiveRadiance = emissive;
3510	#include <logdepthbuf_fragment>
3511	#include <map_fragment>
3512	#include <color_fragment>
3513	#include <alphamap_fragment>
3514	#include <alphatest_fragment>
3515	#include <alphahash_fragment>
3516	#include <normal_fragment_begin>
3517	#include <normal_fragment_maps>
3518	#include <emissivemap_fragment>
3519	#include <lights_toon_fragment>
3520	#include <lights_fragment_begin>
3521	#include <lights_fragment_maps>
3522	#include <lights_fragment_end>
3523	#include <aomap_fragment>
3524	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3525	#include <opaque_fragment>
3526	#include <tonemapping_fragment>
3527	#include <colorspace_fragment>
3528	#include <fog_fragment>
3529	#include <premultiplied_alpha_fragment>
3530	#include <dithering_fragment>
3531}`,Gy=`uniform float size;
3532uniform float scale;
3533#include <common>
3534#include <color_pars_vertex>
3535#include <fog_pars_vertex>
3536#include <morphtarget_pars_vertex>
3537#include <logdepthbuf_pars_vertex>
3538#include <clipping_planes_pars_vertex>
3539#ifdef USE_POINTS_UV
3540	varying vec2 vUv;
3541	uniform mat3 uvTransform;
3542#endif
3543void main() {
3544	#ifdef USE_POINTS_UV
3545		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3546	#endif
3547	#include <color_vertex>
3548	#include <morphinstance_vertex>
3549	#include <morphcolor_vertex>
3550	#include <begin_vertex>
3551	#include <morphtarget_vertex>
3552	#include <project_vertex>
3553	gl_PointSize = size;
3554	#ifdef USE_SIZEATTENUATION
3555		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3556		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3557	#endif
3558	#include <logdepthbuf_vertex>
3559	#include <clipping_planes_vertex>
3560	#include <worldpos_vertex>
3561	#include <fog_vertex>
3562}`,Wy=`uniform vec3 diffuse;
3563uniform float opacity;
3564#include <common>
3565#include <color_pars_fragment>
3566#include <map_particle_pars_fragment>
3567#include <alphatest_pars_fragment>
3568#include <alphahash_pars_fragment>
3569#include <fog_pars_fragment>
3570#include <logdepthbuf_pars_fragment>
3571#include <clipping_planes_pars_fragment>
3572void main() {
3573	vec4 diffuseColor = vec4( diffuse, opacity );
3574	#include <clipping_planes_fragment>
3575	vec3 outgoingLight = vec3( 0.0 );
3576	#include <logdepthbuf_fragment>
3577	#include <map_particle_fragment>
3578	#include <color_fragment>
3579	#include <alphatest_fragment>
3580	#include <alphahash_fragment>
3581	outgoingLight = diffuseColor.rgb;
3582	#include <opaque_fragment>
3583	#include <tonemapping_fragment>
3584	#include <colorspace_fragment>
3585	#include <fog_fragment>
3586	#include <premultiplied_alpha_fragment>
3587}`,Xy=`#include <common>
3588#include <batching_pars_vertex>
3589#include <fog_pars_vertex>
3590#include <morphtarget_pars_vertex>
3591#include <skinning_pars_vertex>
3592#include <logdepthbuf_pars_vertex>
3593#include <shadowmap_pars_vertex>
3594void main() {
3595	#include <batching_vertex>
3596	#include <beginnormal_vertex>
3597	#include <morphinstance_vertex>
3598	#include <morphnormal_vertex>
3599	#include <skinbase_vertex>
3600	#include <skinnormal_vertex>
3601	#include <defaultnormal_vertex>
3602	#include <begin_vertex>
3603	#include <morphtarget_vertex>
3604	#include <skinning_vertex>
3605	#include <project_vertex>
3606	#include <logdepthbuf_vertex>
3607	#include <worldpos_vertex>
3608	#include <shadowmap_vertex>
3609	#include <fog_vertex>
3610}`,qy=`uniform vec3 color;
3611uniform float opacity;
3612#include <common>
3613#include <fog_pars_fragment>
3614#include <bsdfs>
3615#include <lights_pars_begin>
3616#include <logdepthbuf_pars_fragment>
3617#include <shadowmap_pars_fragment>
3618#include <shadowmask_pars_fragment>
3619void main() {
3620	#include <logdepthbuf_fragment>
3621	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3622	#include <tonemapping_fragment>
3623	#include <colorspace_fragment>
3624	#include <fog_fragment>
3625	#include <premultiplied_alpha_fragment>
3626}`,Yy=`uniform float rotation;
3627uniform vec2 center;
3628#include <common>
3629#include <uv_pars_vertex>
3630#include <fog_pars_vertex>
3631#include <logdepthbuf_pars_vertex>
3632#include <clipping_planes_pars_vertex>
3633void main() {
3634	#include <uv_vertex>
3635	vec4 mvPosition = modelViewMatrix[ 3 ];
3636	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
3637	#ifndef USE_SIZEATTENUATION
3638		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3639		if ( isPerspective ) scale *= - mvPosition.z;
3640	#endif
3641	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3642	vec2 rotatedPosition;
3643	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3644	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3645	mvPosition.xy += rotatedPosition;
3646	gl_Position = projectionMatrix * mvPosition;
3647	#include <logdepthbuf_vertex>
3648	#include <clipping_planes_vertex>
3649	#include <fog_vertex>
3650}`,Zy=`uniform vec3 diffuse;
3651uniform float opacity;
3652#include <common>
3653#include <uv_pars_fragment>
3654#include <map_pars_fragment>
3655#include <alphamap_pars_fragment>
3656#include <alphatest_pars_fragment>
3657#include <alphahash_pars_fragment>
3658#include <fog_pars_fragment>
3659#include <logdepthbuf_pars_fragment>
3660#include <clipping_planes_pars_fragment>
3661void main() {
3662	vec4 diffuseColor = vec4( diffuse, opacity );
3663	#include <clipping_planes_fragment>
3664	vec3 outgoingLight = vec3( 0.0 );
3665	#include <logdepthbuf_fragment>
3666	#include <map_fragment>
3667	#include <alphamap_fragment>
3668	#include <alphatest_fragment>
3669	#include <alphahash_fragment>
3670	outgoingLight = diffuseColor.rgb;
3671	#include <opaque_fragment>
3672	#include <tonemapping_fragment>
3673	#include <colorspace_fragment>
3674	#include <fog_fragment>
3675}`,_t={alphahash_fragment:m_,alphahash_pars_fragment:g_,alphamap_fragment:v_,alphamap_pars_fragment:__,alphatest_fragment:y_,alphatest_pars_fragment:x_,aomap_fragment:M_,aomap_pars_fragment:S_,batching_pars_vertex:b_,batching_vertex:T_,begin_vertex:w_,beginnormal_vertex:E_,bsdfs:A_,iridescence_fragment:C_,bumpmap_pars_fragment:R_,clipping_planes_fragment:I_,clipping_planes_pars_fragment:P_,clipping_planes_pars_vertex:L_,clipping_planes_vertex:U_,color_fragment:N_,color_pars_fragment:D_,color_pars_vertex:O_,color_vertex:F_,common:B_,cube_uv_reflection_fragment:z_,defaultnormal_vertex:k_,dis
vendor: 12,103 bytes, line 3675
3675placementmap_pars_vertex:V_,displacementmap_vertex:H_,emissivemap_fragment:G_,emissivemap_pars_fragment:W_,colorspace_fragment:X_,colorspace_pars_fragment:q_,envmap_fragment:Y_,envmap_common_pars_fragment:Z_,envmap_pars_fragment:J_,envmap_pars_vertex:$_,envmap_physical_pars_fragment:o0,envmap_vertex:K_,fog_vertex:Q_,fog_pars_vertex:j_,fog_fragment:e0,fog_pars_fragment:t0,gradientmap_pars_fragment:i0,lightmap_pars_fragment:n0,lights_lambert_fragment:s0,lights_lambert_pars_fragment:r0,lights_pars_begin:a0,lights_toon_fragment:l0,lights_toon_pars_fragment:c0,lights_phong_fragment:h0,lights_phong_pars_fragment:u0,lights_physical_fragment:d0,lights_physical_pars_fragment:f0,lights_fragment_begin:p0,lights_fragment_maps:m0,lights_fragment_end:g0,lightprobes_pars_fragment:v0,logdepthbuf_fragment:_0,logdepthbuf_pars_fragment:y0,logdepthbuf_pars_vertex:x0,logdepthbuf_vertex:M0,map_fragment:S0,map_pars_fragment:b0,map_particle_fragment:T0,map_particle_pars_fragment:w0,metalnessmap_fragment:E0,metalnessmap_pars_fragment:A0,morphinstance_vertex:C0,morphcolor_vertex:R0,morphnormal_vertex:I0,morphtarget_pars_vertex:P0,morphtarget_vertex:L0,normal_fragment_begin:U0,normal_fragment_maps:N0,normal_pars_fragment:D0,normal_pars_vertex:O0,normal_vertex:F0,normalmap_pars_fragment:B0,clearcoat_normal_fragment_begin:z0,clearcoat_normal_fragment_maps:k0,clearcoat_pars_fragment:V0,iridescence_pars_fragment:H0,opaque_fragment:G0,packing:W0,premultiplied_alpha_fragment:X0,project_vertex:q0,dithering_fragment:Y0,dithering_pars_fragment:Z0,roughnessmap_fragment:J0,roughnessmap_pars_fragment:$0,shadowmap_pars_fragment:K0,shadowmap_pars_vertex:Q0,shadowmap_vertex:j0,shadowmask_pars_fragment:ey,skinbase_vertex:ty,skinning_pars_vertex:iy,skinning_vertex:ny,skinnormal_vertex:sy,specularmap_fragment:ry,specularmap_pars_fragment:ay,tonemapping_fragment:oy,tonemapping_pars_fragment:ly,transmission_fragment:cy,transmission_pars_fragment:hy,uv_pars_fragment:uy,uv_pars_vertex:dy,uv_vertex:fy,worldpos_vertex:py,background_vert:my,background_frag:gy,backgroundCube_vert:vy,backgroundCube_frag:_y,cube_vert:yy,cube_frag:xy,depth_vert:My,depth_frag:Sy,distance_vert:by,distance_frag:Ty,equirect_vert:wy,equirect_frag:Ey,linedashed_vert:Ay,linedashed_frag:Cy,meshbasic_vert:Ry,meshbasic_frag:Iy,meshlambert_vert:Py,meshlambert_frag:Ly,meshmatcap_vert:Uy,meshmatcap_frag:Ny,meshnormal_vert:Dy,meshnormal_frag:Oy,meshphong_vert:Fy,meshphong_frag:By,meshphysical_vert:zy,meshphysical_frag:ky,meshtoon_vert:Vy,meshtoon_frag:Hy,points_vert:Gy,points_frag:Wy,shadow_vert:Xy,shadow_frag:qy,sprite_vert:Yy,sprite_frag:Zy},Oe={common:{diffuse:{value:new He(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ft},alphaMap:{value:null},alphaMapTransform:{value:new ft},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ft}},envmap:{envMap:{value:null},envMapRotation:{value:new ft},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ft}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ft}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ft},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ft},normalScale:{value:new se(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ft},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ft}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ft}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ft}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new He(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new P},probesMax:{value:new P},probesResolution:{value:new P}},points:{diffuse:{value:new He(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ft},alphaTest:{value:0},uvTransform:{value:new ft}},sprite:{diffuse:{value:new He(16777215)},opacity:{value:1},center:{value:new se(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ft},alphaMap:{value:null},alphaMapTransform:{value:new ft},alphaTest:{value:0}}},Oi={basic:{uniforms:ui([Oe.common,Oe.specularmap,Oe.envmap,Oe.aomap,Oe.lightmap,Oe.fog]),vertexShader:_t.meshbasic_vert,fragmentShader:_t.meshbasic_frag},lambert:{uniforms:ui([Oe.common,Oe.specularmap,Oe.envmap,Oe.aomap,Oe.lightmap,Oe.emissivemap,Oe.bumpmap,Oe.normalmap,Oe.displacementmap,Oe.fog,Oe.lights,{emissive:{value:new He(0)},envMapIntensity:{value:1}}]),vertexShader:_t.meshlambert_vert,fragmentShader:_t.meshlambert_frag},phong:{uniforms:ui([Oe.common,Oe.specularmap,Oe.envmap,Oe.aomap,Oe.lightmap,Oe.emissivemap,Oe.bumpmap,Oe.normalmap,Oe.displacementmap,Oe.fog,Oe.lights,{emissive:{value:new He(0)},specular:{value:new He(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:_t.meshphong_vert,fragmentShader:_t.meshphong_frag},standard:{uniforms:ui([Oe.common,Oe.envmap,Oe.aomap,Oe.lightmap,Oe.emissivemap,Oe.bumpmap,Oe.normalmap,Oe.displacementmap,Oe.roughnessmap,Oe.metalnessmap,Oe.fog,Oe.lights,{emissive:{value:new He(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:_t.meshphysical_vert,fragmentShader:_t.meshphysical_frag},toon:{uniforms:ui([Oe.common,Oe.aomap,Oe.lightmap,Oe.emissivemap,Oe.bumpmap,Oe.normalmap,Oe.displacementmap,Oe.gradientmap,Oe.fog,Oe.lights,{emissive:{value:new He(0)}}]),vertexShader:_t.meshtoon_vert,fragmentShader:_t.meshtoon_frag},matcap:{uniforms:ui([Oe.common,Oe.bumpmap,Oe.normalmap,Oe.displacementmap,Oe.fog,{matcap:{value:null}}]),vertexShader:_t.meshmatcap_vert,fragmentShader:_t.meshmatcap_frag},points:{uniforms:ui([Oe.points,Oe.fog]),vertexShader:_t.points_vert,fragmentShader:_t.points_frag},dashed:{uniforms:ui([Oe.common,Oe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:_t.linedashed_vert,fragmentShader:_t.linedashed_frag},depth:{uniforms:ui([Oe.common,Oe.displacementmap]),vertexShader:_t.depth_vert,fragmentShader:_t.depth_frag},normal:{uniforms:ui([Oe.common,Oe.bumpmap,Oe.normalmap,Oe.displacementmap,{opacity:{value:1}}]),vertexShader:_t.meshnormal_vert,fragmentShader:_t.meshnormal_frag},sprite:{uniforms:ui([Oe.sprite,Oe.fog]),vertexShader:_t.sprite_vert,fragmentShader:_t.sprite_frag},background:{uniforms:{uvTransform:{value:new ft},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:_t.background_vert,fragmentShader:_t.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ft}},vertexShader:_t.backgroundCube_vert,fragmentShader:_t.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:_t.cube_vert,fragmentShader:_t.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:_t.equirect_vert,fragmentShader:_t.equirect_frag},distance:{uniforms:ui([Oe.common,Oe.displacementmap,{referencePosition:{value:new P},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:_t.distance_vert,fragmentShader:_t.distance_frag},shadow:{uniforms:ui([Oe.lights,Oe.fog,{color:{value:new He(0)},opacity:{value:1}}]),vertexShader:_t.shadow_vert,fragmentShader:_t.shadow_frag}};Oi.physical={uniforms:ui([Oi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ft},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ft},clearcoatNormalScale:{value:new se(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ft},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ft},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ft},sheen:{value:0},sheenColor:{value:new He(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ft},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ft},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ft},transmissionSamplerSize:{value:new se},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ft},attenuationDistance:{value:0},attenuationColor:{value:new He(0)},specularColor:{value:new He(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ft},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ft},anisotropyVector:{value:new se},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ft}}]),vertexShader:_t.meshphysical_vert,fragmentShader:_t.meshphysical_frag};const Qa={r:0,b:0,g:0},Jy=new ct,np=new ft;np.set(-1,0,0,0,1,0,0,0,1);function $y(r,e,t,i,n,s){const a=new He(0);let o=n===!0?0:1,l,c,u=null,d=0,h=null;function f(_){let x=_.isScene===!0?_.background:null;if(x&&x.isTexture){const M=_.backgroundBlurriness>0;x=e.get(x,M)}return x}function p(_){let x=!1;const M=f(_);M===null?g(a,o):M&&M.isColor&&(g(M,1),x=!0);const R=r.xr.getEnvironmentBlendMode();R==="additive"?t.buffers.color.setClear(0,0,0,1,s):R==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(r.autoClear||x)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function v(_,x){const M=f(x);M&&(M.isCubeTexture||M.mapping===Js)?(c===void 0&&(c=new kt(new ds(1,1,1),new vi({name:"BackgroundCubeMaterial",uniforms:Zs(Oi.backgroundCube.uniforms),vertexShader:Oi.backgroundCube.vertexShader,fragmentShader:Oi.backgroundCube.fragmentShader,side:pi,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(R,E,I){this.matrixWorld.copyPosition(I.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),c.material.uniforms.envMap.value=M,c.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Jy.makeRotationFromEuler(x.backgroundRotation)).transpose(),M.isCubeTexture&&M.isRenderTargetTexture===!1&&c.material.uniforms.backgroundRotation.value.premultiply(np),c.material.toneMapped=bt.getTransfer(M.colorSpace)!==It,(u!==M||d!==M.version||h!==r.toneMapping)&&(c.material.needsUpdate=!0,u=M,d=M.version,h=r.toneMapping),c.layers.enableAll(),_.unshift(c,c.geometry,c.material,0,0,null)):M&&M.isTexture&&(l===void 0&&(l=new kt(new Fn(2,2),new vi({name:"Backgroun
3675dMaterial",uniforms:Zs(Oi.background.uniforms),vertexShader:Oi.background.vertexShader,fragmentShader:Oi.background.fragmentShader,side:un,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=M,l.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,l.material.toneMapped=bt.getTransfer(M.colorSpace)!==It,M.matrixAutoUpdate===!0&&M.updateMatrix(),l.material.uniforms.uvTransform.value.copy(M.matrix),(u!==M||d!==M.version||h!==r.toneMapping)&&(l.material.needsUpdate=!0,u=M,d=M.version,h=r.toneMapping),l.layers.enableAll(),_.unshift(l,l.geometry,l.material,0,0,null))}function g(_,x){_.getRGB(Qa,wf(r)),t.buffers.color.setClear(Qa.r,Qa.g,Qa.b,x,s)}function m(){c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return a},setClearColor:function(_,x=1){a.set(_),o=x,g(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(_){o=_,g(a,o)},render:p,addToRenderList:v,dispose:m}}function Ky(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),i={},n=h(null);let s=n,a=!1;function o(L,O,q,W,B){let k=!1;const Y=d(L,W,q,O);s!==Y&&(s=Y,c(s.object)),k=f(L,W,q,B),k&&p(L,W,q,B),B!==null&&e.update(B,r.ELEMENT_ARRAY_BUFFER),(k||a)&&(a=!1,M(L,O,q,W),B!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(B).buffer))}function l(){return r.createVertexArray()}function c(L){return r.bindVertexArray(L)}function u(L){return r.deleteVertexArray(L)}function d(L,O,q,W){const B=W.wireframe===!0;let k=i[O.id];k===void 0&&(k={},i[O.id]=k);const Y=L.isInstancedMesh===!0?L.id:0;let re=k[Y];re===void 0&&(re={},k[Y]=re);let le=re[q.id];le===void 0&&(le={},re[q.id]=le);let de=le[B];return de===void 0&&(de=h(l()),le[B]=de),de}function h(L){const O=[],q=[],W=[];for(let B=0;B<t;B++)O[B]=0,q[B]=0,W[B]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:O,enabledAttributes:q,attributeDivisors:W,object:L,attributes:{},index:null}}function f(L,O,q,W){const B=s.attributes,k=O.attributes;let Y=0;const re=q.getAttributes();for(const le in re)if(re[le].location>=0){const De=B[le];let Ue=k[le];if(Ue===void 0&&(le==="instanceMatrix"&&L.instanceMatrix&&(Ue=L.instanceMatrix),le==="instanceColor"&&L.instanceColor&&(Ue=L.instanceColor)),De===void 0||De.attribute!==Ue||Ue&&De.data!==Ue.data)return!0;Y++}return s.attributesNum!==Y||s.index!==W}function p(L,O,q,W){const B={},k=O.attributes;let Y=0;const re=q.getAttributes();for(const le in re)if(re[le].location>=0){let De=k[le];De===void 0&&(le==="instanceMatrix"&&L.instanceMatrix&&(De=L.instanceMatrix),le==="instanceColor"&&L.instanceColor&&(De=L.instanceColor));const Ue={};Ue.attribute=De,De&&De.data&&(Ue.data=De.data),B[le]=Ue,Y++}s.attributes=B,s.attributesNum=Y,s.index=W}function v(){const L=s.newAttributes;for(let O=0,q=L.length;O<q;O++)L[O]=0}function g(L){m(L,0)}function m(L,O){const q=s.newAttributes,W=s.enabledAttributes,B=s.attributeDivisors;q[L]=1,W[L]===0&&(r.enableVertexAttribArray(L),W[L]=1),B[L]!==O&&(r.vertexAttribDivisor(L,O),B[L]=O)}function _(){const L=s.newAttributes,O=s.enabledAttributes;for(let q=0,W=O.length;q<W;q++)O[q]!==L[q]&&(r.disableVertexAttribArray(q),O[q]=0)}function x(L,O,q,W,B,k,Y){Y===!0?r.vertexAttribIPointer(L,O,q,B,k):r.vertexAttribPointer(L,O,q,W,B,k)}function M(L,O,q,W){v();const B=W.attributes,k=q.getAttributes(),Y=O.defaultAttributeValues;for(const re in k){const le=k[re];if(le.location>=0){let de=B[re];if(de===void 0&&(re==="instanceMatrix"&&L.instanceMatrix&&(de=L.instanceMatrix),re==="instanceColor"&&L.instanceColor&&(de=L.instanceColor)),de!==void 0){const De=de.normalized,Ue=de.itemSize,Ke=e.get(de);if(Ke===void 0)continue;const yt=Ke.buffer,ot=Ke.type,J=Ke.bytesPerElement,Ie=ot===r.INT||ot===r.UNSIGNED_INT||de.gpuType===Qr;if(de.isInterleavedBufferAttribute){const ve=de.data,qe=ve.stride,et=de.offset;if(ve.isInstancedInterleavedBuffer){for(let Qe=0;Qe<le.locationSize;Qe++)m(le.location+Qe,ve.meshPerAttribute);L.isInstancedMesh!==!0&&W._maxInstanceCount===void 0&&(W._maxInstanceCount=ve.meshPerAttribute*ve.count)}else for(let Qe=0;Qe<le.locationSize;Qe++)g(le.location+Qe);r.bindBuffer(r.ARRAY_BUFFER,yt);for(let Qe=0;Qe<le.locationSize;Qe++)x(le.location+Qe,Ue/le.locationSize,ot,De,qe*J,(et+Ue/le.locationSize*Qe)*J,Ie)}else{if(de.isInstancedBufferAttribute){for(let ve=0;ve<le.locationSize;ve++)m(le.location+ve,de.meshPerAttribute);L.isInstancedMesh!==!0&&W._maxInstanceCount===void 0&&(W._maxInstanceCount=de.meshPerAttribute*de.count)}else for(let ve=0;ve<le.locationSize;ve++)g(le.location+ve);r.bindBuffer(r.ARRAY_BUFFER,yt);for(let ve=0;ve<le.locationSize;ve++)x(le.location+ve,Ue/le.locationSize,ot,De,Ue*J,Ue/le.locationSize*ve*J,Ie)}}else if(Y!==void 0){const De=Y[re];if(De!==void 0)switch(De.length){case 2:r.vertexAttrib2fv(le.location,De);break;case 3:r.vertexAttrib3fv(le.location,De);break;case 4:r.vertexAttrib4fv(le.location,De);break;default:r.vertexAttrib1fv(le.location,De)}}}}_()}function R(){w();for(const L in i){const O=i[L];for(const q in O){const W=O[q];for(const B in W){const k=W[B];for(const Y in k)u(k[Y].object),delete k[Y];delete W[B]}}delete i[L]}}
vendor: 14,310 bytes, lines 3675-3748
3675function E(L){if(i[L.id]===void 0)return;const O=i[L.id];for(const q in O){const W=O[q];for(const B in W){const k=W[B];for(const Y in k)u(k[Y].object),delete k[Y];delete W[B]}}delete i[L.id]}function I(L){for(const O in i){const q=i[O];for(const W in q){const B=q[W];if(B[L.id]===void 0)continue;const k=B[L.id];for(const Y in k)u(k[Y].object),delete k[Y];delete B[L.id]}}}function y(L){for(const O in i){const q=i[O],W=L.isInstancedMesh===!0?L.id:0,B=q[W];if(B!==void 0){for(const k in B){const Y=B[k];for(const re in Y)u(Y[re].object),delete Y[re];delete B[k]}delete q[W],Object.keys(q).length===0&&delete i[O]}}}function w(){U(),a=!0,s!==n&&(s=n,c(s.object))}function U(){n.geometry=null,n.program=null,n.wireframe=!1}return{setup:o,reset:w,resetDefaultState:U,dispose:R,releaseStatesOfGeometry:E,releaseStatesOfObject:y,releaseStatesOfProgram:I,initAttributes:v,enableAttribute:g,disableUnusedAttributes:_}}function Qy(r,e,t){let i;function n(l){i=l}function s(l,c){r.drawArrays(i,l,c),t.update(c,i,1)}function a(l,c,u){u!==0&&(r.drawArraysInstanced(i,l,c,u),t.update(c,i,u))}function o(l,c,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,l,0,c,0,u);let h=0;for(let f=0;f<u;f++)h+=c[f];t.update(h,i,1)}this.setMode=n,this.render=s,this.renderInstances=a,this.renderMultiDraw=o}function jy(r,e,t,i){let n;function s(){if(n!==void 0)return n;if(e.has("EXT_texture_filter_anisotropic")===!0){const I=e.get("EXT_texture_filter_anisotropic");n=r.getParameter(I.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n}function a(I){return!(I!==Kt&&i.convert(I)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(I){const y=I===Jt&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(I!==ii&&i.convert(I)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&I!==Ft&&!y)}function l(I){if(I==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";I="mediump"}return I==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&&(Re("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const d=t.logarithmicDepthBuffer===!0,h=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control");t.reversedDepthBuffer===!0&&h===!1&&Re("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");const f=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),p=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),v=r.getParameter(r.MAX_TEXTURE_SIZE),g=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),m=r.getParameter(r.MAX_VERTEX_ATTRIBS),_=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),x=r.getParameter(r.MAX_VARYING_VECTORS),M=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),R=r.getParameter(r.MAX_SAMPLES),E=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:d,reversedDepthBuffer:h,maxTextures:f,maxVertexTextures:p,maxTextureSize:v,maxCubemapSize:g,maxAttributes:m,maxVertexUniforms:_,maxVaryings:x,maxFragmentUniforms:M,maxSamples:R,samples:E}}function ex(r){const e=this;let t=null,i=0,n=!1,s=!1;const a=new wn,o=new ft,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,h){const f=d.length!==0||h||i!==0||n;return n=h,i=d.length,f},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,h){t=u(d,h,0)},this.setState=function(d,h,f){const p=d.clippingPlanes,v=d.clipIntersection,g=d.clipShadows,m=r.get(d);if(!n||p===null||p.length===0||s&&!g)s?u(null):c();else{const _=s?0:i,x=_*4;let M=m.clippingState||null;l.value=M,M=u(p,h,x,f);for(let R=0;R!==x;++R)M[R]=t[R];m.clippingState=M,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=_}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(d,h,f,p){const v=d!==null?d.length:0;let g=null;if(v!==0){if(g=l.value,p!==!0||g===null){const m=f+v*4,_=h.matrixWorldInverse;o.getNormalMatrix(_),(g===null||g.length<m)&&(g=new Float32Array(m));for(let x=0,M=f;x!==v;++x,M+=4)a.copy(d[x]).applyMatrix4(_,o),a.normal.toArray(g,M),g[M+3]=a.constant}l.value=g,l.needsUpdate=!0}return e.numPlanes=v,e.numIntersection=0,g}}const Rn=4,Yu=[.125,.215,.35,.446,.526,.582],jn=20,tx=256,mr=new js,Zu=new He;let gc=null,vc=0,_c=0,yc=!1;const ix=new P;class zc{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,i=.1,n=100,s={}){const{size:a=256,position:o=ix}=s;gc=this._renderer.getRenderTarget(),vc=this._renderer.getActiveCubeFace(),_c=this._renderer.getActiveMipmapLevel(),yc=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,i,n,l,o),t>0&&this._blur(l,0,0,t),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=Ku(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=$u(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(gc,vc,_c),this._renderer.xr.enabled=yc,e.scissorTest=!1,Fs(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===Qi||e.mapping===Pn?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),gc=this._renderer.getRenderTarget(),vc=this._renderer.getActiveCubeFace(),_c=this._renderer.getActiveMipmapLevel(),yc=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:wt,minFilter:wt,generateMipmaps:!1,type:Jt,format:Kt,colorSpace:Un,depthBuffer:!1},n=Ju(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=Ju(e,t,i);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=nx(s)),this._blurMaterial=rx(s,e,t),this._ggxMaterial=sx(s,e,t)}return n}_compileMaterial(e){const t=new kt(new mt,e);this._renderer.compile(t,mr)}_sceneToCubeUV(e,t,i,n,s){const l=new ti(90,1,t,i),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],d=this._renderer,h=d.autoClear,f=d.toneMapping;d.getClearColor(Zu),d.toneMapping=ki,d.autoClear=!1,d.state.buffers.depth.getReversed()&&(d.setRenderTarget(n),d.clearDepth(),d.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new kt(new ds,new fn({name:"PMREM.Background",side:pi,depthWrite:!1,depthTest:!1})));const v=this._backgroundBox,g=v.material;let m=!1;const _=e.background;_?_.isColor&&(g.color.copy(_),e.background=null,m=!0):(g.color.copy(Zu),m=!0);for(let x=0;x<6;x++){const M=x%3;M===0?(l.up.set(0,c[x],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[x],s.y,s.z)):M===1?(l.up.set(0,0,c[x]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[x],s.z)):(l.up.set(0,c[x],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[x]));const R=this._cubeSize;Fs(n,M*R,x>2?R:0,R,R),d.setRenderTarget(n),m&&d.render(v,l),d.render(e,l)}d.toneMapping=f,d.autoClear=h,e.background=_}_textureToCubeUV(e,t){const i=this._renderer,n=e.mapping===Qi||e.mapping===Pn;n?(this._cubemapMaterial===null&&(this._cubemapMaterial=Ku()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=$u());const s=n?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;Fs(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(a,mr)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const n=this._lodMeshes.length;for(let s=1;s<n;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=i}_applyGGXFilter(e,t,i){const n=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[i];o.material=a;const l=a.uniforms,c=i/(this._lodMeshes.length-1),u=t/(this._lodMeshes.length-1),d=Math.sqrt(c*c-u*u),h=0+c*1.25,f=d*h,{_lodMax:p}=this,v=this._sizeLods[i],g=3*v*(i>p-Rn?i-p+Rn:0),m=4*(this._cubeSize-v);l.envMap.value=e.texture,l.roughness.value=f,l.mipInt.value=p-t,Fs(s,g,m,3*v,2*v),n.setRenderTarget(s),n.render(o,mr),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=p-i,Fs(e,g,m,3*v,2*v),n.setRenderTarget(e),n.render(o,mr)}_blur(e,t,i,n,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,n,"latitudinal",s),this._halfBlur(a,e,i,i,n,"longitudinal",s)}_halfBlur(e,t,i,n,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&Ze("blur direction must be either latitudinal or longitudinal!");const u=3,d=this._lodMeshes[n];d.material=c;const h=c.uniforms,f=this._sizeLods[i]-1,p=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*jn-1),v=s/p,g=isFinite(s)?1+Math.floor(u*v):jn;g>jn&&Re(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${jn}`);const m=[];let _=0;for(let I=0;I<jn;++I){const y=I/v,w=Math.exp(-y*y/2);m.push(w),I===0?_+=w:I<g&&(_+=2*w)}for(let I=0;I<m.length;I++)m[I]=m[I]/_;h.envMap.value=e.texture,h.samples.value=g,h.weights.value=m,h.latitudinal.value=a==="latitudinal",o&&(h.poleAxis.value=o);const{_lodMax:x}=this;h.dTheta.value=p,h.mipInt.value=x-i;const M=this._sizeLods[n],R=3*M*(n>x-Rn?n-x+Rn:0),E=4*(this._cubeSize-M);Fs(t,R,E,3*M,2*M),l.setRenderTarget(t),l.render(d,mr)}}function nx(r){const e=[],t=[],i=[];let n=r;const s=r-Rn+1+Yu.length;for(let a=0;a<s;a++){const o=Math.pow(2,n);e.push(o);let l=1/o;a>r-Rn?l=Yu[a-r+Rn-1]:a===0&&(l=0),t.push(l);const c=1/(o-2),u=-c,d=1+c,h=[u,u,d,u,d,d,u,u,d,d,u,d],f=6,p=6,v=3,g=2,m=1,_=new Float32Array(v*p*f),x=new Float32Array(g*p*f),M=new Float32Array(m*p*f);for(let E=0;E<f;E++){const I=E%3*2/3-1,y=E>2?0:-1,w=[I,y,0,I+2/3,y,0,I+2/3,y+1,0,I,y,0,I+2/3,y+1,0,I,y+1,0];_.set(w,v*p*E),x.set(h,g*p*E);const U=[E,E,E,E,E,E];M.set(U,m*p*E)}const R=new mt;R.setAttribute("position",new Ut(_,v)),R.setAttribute("uv",new Ut(x,g)),R.setAttribute("faceIndex",new Ut(M,m)),i.push(new kt(R,null)),n>Rn&&n--}return{lodMeshes:i,sizeLods:e,sigmas:t}}function Ju(r,e,t){const i=new gi(r,e,t);return i.texture.mapping=Js,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Fs(r,e,t,i,n){r.viewport.set(e,t,i,n),r.scissor.set(e,t,i,n)}function sx(r,e,t){return new vi({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:tx,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:Il(),fragmentShader:`
3676
3677			precision highp float;
3678			precision highp int;
3679
3680			varying vec3 vOutputDirection;
3681
3682			uniform sampler2D envMap;
3683			uniform float roughness;
3684			uniform float mipInt;
3685
3686			#define ENVMAP_TYPE_CUBE_UV
3687			#include <cube_uv_reflection_fragment>
3688
3689			#define PI 3.14159265359
3690
3691			// Van der Corput radical inverse
3692			float radicalInverse_VdC(uint bits) {
3693				bits = (bits << 16u) | (bits >> 16u);
3694				bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
3695				bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
3696				bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
3697				bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
3698				return float(bits) * 2.3283064365386963e-10; // / 0x100000000
3699			}
3700
3701			// Hammersley sequence
3702			vec2 hammersley(uint i, uint N) {
3703				return vec2(float(i) / float(N), radicalInverse_VdC(i));
3704			}
3705
3706			// GGX VNDF importance sampling (Eric Heitz 2018)
3707			// "Sampling the GGX Distribution of Visible Normals"
3708			// https://jcgt.org/published/0007/04/01/
3709			vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
3710				float alpha = roughness * roughness;
3711
3712				// Section 4.1: Orthonormal basis
3713				vec3 T1 = vec3(1.0, 0.0, 0.0);
3714				vec3 T2 = cross(V, T1);
3715
3716				// Section 4.2: Parameterization of projected area
3717				float r = sqrt(Xi.x);
3718				float phi = 2.0 * PI * Xi.y;
3719				float t1 = r * cos(phi);
3720				float t2 = r * sin(phi);
3721				float s = 0.5 * (1.0 + V.z);
3722				t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
3723
3724				// Section 4.3: Reprojection onto hemisphere
3725				vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
3726
3727				// Section 3.4: Transform back to ellipsoid configuration
3728				return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
3729			}
3730
3731			void main() {
3732				vec3 N = normalize(vOutputDirection);
3733				vec3 V = N; // Assume view direction equals normal for pre-filtering
3734
3735				vec3 prefilteredColor = vec3(0.0);
3736				float totalWeight = 0.0;
3737
3738				// For very low roughness, just sample the environment directly
3739				if (roughness < 0.001) {
3740					gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
3741					return;
3742				}
3743
3744				// Tangent space basis for VNDF sampling
3745				vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
3746				vec3 tangent = normalize(cross(up, N));
3747				vec3 bitangent = cross(N, tangent);
3748
3749				for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
3750					vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
3751
3752					// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
3753					vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
3754
3755					// Transform H back to world space
3756					vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
3757					vec3 L = normalize(2.0 * dot(V, H) * H - V);
3758
3759					float NdotL = max(dot(N, L), 0.0);
3760
3761					if(NdotL > 0.0) {
3762						// Sample environment at fixed mip level
3763						// VNDF importance sampling handles the distribution filtering
3764						vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
3765
3766						// Weight by NdotL for the split-sum approximation
3767						// VNDF PDF naturally accounts for the visible microfacet distribution
3768						prefilteredColor += sampleColor * NdotL;
3769						totalWeight += NdotL;
3770					}
3771				}
3772
3773				if (totalWeight > 0.0) {
3774					prefilteredColor = prefilteredColor / totalWeight;
3775				}
3776
3777				gl_FragColor = vec4(prefilteredColor, 1.0);
3778			}
3779		`,blending:zi,depthTest:!1,depthWrite:!1})}function rx(r,e,t){const i=new Float32Array(jn),n=new P(0,1,0);return new vi({name:"SphericalGaussianBlur",defines:{n:jn,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:n}},vertexShader:Il(),fragmentShader:`
3780
3781			precision mediump float;
3782			precision mediump int;
3783
3784			varying vec3 vOutputDirection;
3785
3786			uniform sampler2D envMap;
3787			uniform int samples;
3788			uniform float weights[ n ];
3789			uniform bool latitudinal;
3790			uniform float dTheta;
3791			uniform float mipInt;
3792			uniform vec3 poleAxis;
3793
3794			#define ENVMAP_TYPE_CUBE_UV
3795			#include <cube_uv_reflection_fragment>
3796
3797			vec3 getSample( float theta, vec3 axis ) {
3798
3799				float cosTheta = cos( theta );
3800				// Rodrigues' axis-angle rotation
3801				vec3 sampleDirection = vOutputDirection * cosTheta
3802					+ cross( axis, vOutputDirection ) * sin( theta )
3803					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3804
3805				return bilinearCubeUV( envMap, sampleDirection, mipInt );
3806
3807			}
3808
3809			void main() {
3810
3811				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3812
3813				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3814
3815					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3816
3817				}
3818
3819				axis = normalize( axis );
3820
3821				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3822				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3823
3824				for ( int i = 1; i < n; i++ ) {
3825
3826					if ( i >= samples ) {
3827
3828						break;
3829
3830					}
3831
3832					float theta = dTheta * float( i );
3833					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3834					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3835
3836				}
3837
3838			}
3839		`,blending:zi,depthTest:!1,depthWrite:!1})}function $u(){return new vi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Il(),fragmentShader:`
3840
3841			precision mediump float;
3842			precision mediump int;
3843
3844			varying vec3 vOutputDirection;
3845
3846			uniform sampler2D envMap;
3847
3848			#include <common>
3849
3850			void main() {
3851
3852				vec3 outputDirection = normalize( vOutputDirection );
3853				vec2 uv = equirectUv( outputDirection );
3854
3855				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3856
3857			}
3858		`,blending:zi,depthTest:!1,depthWrite:!1})}function Ku(){return new vi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Il(),fragmentShader:`
3859
3860			precision mediump float;
3861			precision mediump int;
3862
3863			uniform float flipEnvMap;
3864
3865			varying vec3 vOutputDirection;
3866
3867			uniform samplerCube envMap;
3868
3869			void main() {
3870
3871				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3872
3873			}
3874		`,blending:zi,depthTest:!1,depthWrite:!1})}function Il(){return`
3875
3876		precision mediump float;
3877		precision mediump int;
3878
3879		attribute float faceIndex;
3880
3881		varying vec3 vOutputDirection;
3882
3883		// RH coordinate system; PMREM face-indexing convention
3884		vec3 getDirection( vec2 uv, float face ) {
3885
3886			uv = 2.0 * uv - 1.0;
3887
3888			vec3 direction = vec3( uv, 1.0 );
3889
3890			if ( face == 0.0 ) {
3891
3892				direction = direction.zyx; // ( 1, v, u ) pos x
3893
3894			} else if ( face == 1.0 ) {
3895
3896				direction = direction.xzy;
3897				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3898
3899			} else if ( face == 2.0 ) {
3900
3901				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3902
3903			} else if ( face == 3.0 ) {
3904
3905				direction = direction.zyx;
3906				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3907
3908			} else if ( face == 4.0 ) {
3909
3910				direction = direction.xzy;
3911				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3912
3913			} else if ( face == 5.0 ) {
3914
3915				direction.z *= -1.0; // ( u, v, -1 ) neg z
3916
3917			}
3918
3919			return direction;
3920
3921		}
3922
3923		void main() {
3924
3925			vOutputDirection = getDirection( uv, faceIndex );
3926			gl_Position = vec4( position, 1.0 );
3927
3928		}
3929	`}class Ih extends gi{constructor(e=1,t={}
vendor: 32,319 bytes, lines 3929-4047
3929){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},n=[i,i,i,i,i,i];this.texture=new ta(n),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}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;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
3930
3931				varying vec3 vWorldDirection;
3932
3933				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
3934
3935					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
3936
3937				}
3938
3939				void main() {
3940
3941					vWorldDirection = transformDirection( position, modelMatrix );
3942
3943					#include <begin_vertex>
3944					#include <project_vertex>
3945
3946				}
3947			`,fragmentShader:`
3948
3949				uniform sampler2D tEquirect;
3950
3951				varying vec3 vWorldDirection;
3952
3953				#include <common>
3954
3955				void main() {
3956
3957					vec3 direction = normalize( vWorldDirection );
3958
3959					vec2 sampleUV = equirectUv( direction );
3960
3961					gl_FragColor = texture2D( tEquirect, sampleUV );
3962
3963				}
3964			`},n=new ds(5,5,5),s=new vi({name:"CubemapFromEquirect",uniforms:Zs(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:pi,blending:zi});s.uniforms.tEquirect.value=t;const a=new kt(n,s),o=t.minFilter;return t.minFilter===$i&&(t.minFilter=wt),new Jf(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,i=!0,n=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,n);e.setRenderTarget(s)}}function ax(r){let e=new WeakMap,t=new WeakMap,i=null;function n(h,f=!1){return h==null?null:f?a(h):s(h)}function s(h){if(h&&h.isTexture){const f=h.mapping;if(f===br||f===Tr)if(e.has(h)){const p=e.get(h).texture;return o(p,h.mapping)}else{const p=h.image;if(p&&p.height>0){const v=new Ih(p.height);return v.fromEquirectangularTexture(r,h),e.set(h,v),h.addEventListener("dispose",c),o(v.texture,h.mapping)}else return null}}return h}function a(h){if(h&&h.isTexture){const f=h.mapping,p=f===br||f===Tr,v=f===Qi||f===Pn;if(p||v){let g=t.get(h);const m=g!==void 0?g.texture.pmremVersion:0;if(h.isRenderTargetTexture&&h.pmremVersion!==m)return i===null&&(i=new zc(r)),g=p?i.fromEquirectangular(h,g):i.fromCubemap(h,g),g.texture.pmremVersion=h.pmremVersion,t.set(h,g),g.texture;if(g!==void 0)return g.texture;{const _=h.image;return p&&_&&_.height>0||v&&_&&l(_)?(i===null&&(i=new zc(r)),g=p?i.fromEquirectangular(h):i.fromCubemap(h),g.texture.pmremVersion=h.pmremVersion,t.set(h,g),h.addEventListener("dispose",u),g.texture):null}}}return h}function o(h,f){return f===br?h.mapping=Qi:f===Tr&&(h.mapping=Pn),h}function l(h){let f=0;const p=6;for(let v=0;v<p;v++)h[v]!==void 0&&f++;return f===p}function c(h){const f=h.target;f.removeEventListener("dispose",c);const p=e.get(f);p!==void 0&&(e.delete(f),p.dispose())}function u(h){const f=h.target;f.removeEventListener("dispose",u);const p=t.get(f);p!==void 0&&(t.delete(f),p.dispose())}function d(){e=new WeakMap,t=new WeakMap,i!==null&&(i.dispose(),i=null)}return{get:n,dispose:d}}function ox(r){const e={};function t(i){if(e[i]!==void 0)return e[i];const n=r.getExtension(i);return e[i]=n,n}return{has:function(i){return t(i)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(i){const n=t(i);return n===null&&Xo("WebGLRenderer: "+i+" extension not supported."),n}}}function lx(r,e,t,i){const n={},s=new WeakMap;function a(d){const h=d.target;h.index!==null&&e.remove(h.index);for(const p in h.attributes)e.remove(h.attributes[p]);h.removeEventListener("dispose",a),delete n[h.id];const f=s.get(h);f&&(e.remove(f),s.delete(h)),i.releaseStatesOfGeometry(h),h.isInstancedBufferGeometry===!0&&delete h._maxInstanceCount,t.memory.geometries--}function o(d,h){return n[h.id]===!0||(h.addEventListener("dispose",a),n[h.id]=!0,t.memory.geometries++),h}function l(d){const h=d.attributes;for(const f in h)e.update(h[f],r.ARRAY_BUFFER)}function c(d){const h=[],f=d.index,p=d.attributes.position;let v=0;if(p===void 0)return;if(f!==null){const _=f.array;v=f.version;for(let x=0,M=_.length;x<M;x+=3){const R=_[x+0],E=_[x+1],I=_[x+2];h.push(R,E,E,I,I,R)}}else{const _=p.array;v=p.version;for(let x=0,M=_.length/3-1;x<M;x+=3){const R=x+0,E=x+1,I=x+2;h.push(R,E,E,I,I,R)}}const g=new(p.count>=65535?rh:sh)(h,1);g.version=v;const m=s.get(d);m&&e.remove(m),s.set(d,g)}function u(d){const h=s.get(d);if(h){const f=d.index;f!==null&&h.version<f.version&&c(d)}else c(d);return s.get(d)}return{get:o,update:l,getWireframeAttribute:u}}function cx(r,e,t){let i;function n(d){i=d}let s,a;function o(d){s=d.type,a=d.bytesPerElement}function l(d,h){r.drawElements(i,h,s,d*a),t.update(h,i,1)}function c(d,h,f){f!==0&&(r.drawElementsInstanced(i,h,s,d*a,f),t.update(h,i,f))}function u(d,h,f){if(f===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,h,0,s,d,0,f);let v=0;for(let g=0;g<f;g++)v+=h[g];t.update(v,i,1)}this.setMode=n,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=u}function hx(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,a,o){switch(t.calls++,a){case r.TRIANGLES:t.triangles+=o*(s/3);break;case r.LINES:t.lines+=o*(s/2);break;case r.LINE_STRIP:t.lines+=o*(s-1);break;case r.LINE_LOOP:t.lines+=o*s;break;case r.POINTS:t.points+=o*s;break;default:Ze("WebGLInfo: Unknown draw mode:",a);break}}function n(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:n,update:i}}function ux(r,e,t){const i=new WeakMap,n=new Pt;function s(a,o,l){const c=a.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,d=u!==void 0?u.length:0;let h=i.get(o);if(h===void 0||h.count!==d){let f=function(){y.dispose(),i.delete(o),o.removeEventListener("dispose",f)};h!==void 0&&h.texture.dispose();const p=o.morphAttributes.position!==void 0,v=o.morphAttributes.normal!==void 0,g=o.morphAttributes.color!==void 0,m=o.morphAttributes.position||[],_=o.morphAttributes.normal||[],x=o.morphAttributes.color||[];let M=0;p===!0&&(M=1),v===!0&&(M=2),g===!0&&(M=3);let R=o.attributes.position.count*M,E=1;R>e.maxTextureSize&&(E=Math.ceil(R/e.maxTextureSize),R=e.maxTextureSize);const I=new Float32Array(R*E*4*d),y=new al(I,R,E,d);y.type=Ft,y.needsUpdate=!0;const w=M*4;for(let U=0;U<d;U++){const L=m[U],O=_[U],q=x[U],W=R*E*4*U;for(let B=0;B<L.count;B++){const k=B*w;p===!0&&(n.fromBufferAttribute(L,B),I[W+k+0]=n.x,I[W+k+1]=n.y,I[W+k+2]=n.z,I[W+k+3]=0),v===!0&&(n.fromBufferAttribute(O,B),I[W+k+4]=n.x,I[W+k+5]=n.y,I[W+k+6]=n.z,I[W+k+7]=0),g===!0&&(n.fromBufferAttribute(q,B),I[W+k+8]=n.x,I[W+k+9]=n.y,I[W+k+10]=n.z,I[W+k+11]=q.itemSize===4?n.w:1)}}h={count:d,texture:y,size:new se(R,E)},i.set(o,h),o.addEventListener("dispose",f)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(r,"morphTexture",a.morphTexture,t);else{let f=0;for(let v=0;v<c.length;v++)f+=c[v];const p=o.morphTargetsRelative?1:1-f;l.getUniforms().setValue(r,"morphTargetBaseInfluence",p),l.getUniforms().setValue(r,"morphTargetInfluences",c)}l.getUniforms().setValue(r,"morphTargetsTexture",h.texture,t),l.getUniforms().setValue(r,"morphTargetsTextureSize",h.size)}return{update:s}}function dx(r,e,t,i,n){let s=new WeakMap;function a(c){const u=n.render.frame,d=c.geometry,h=e.get(c,d);if(s.get(h)!==u&&(e.update(h),s.set(h,u)),c.isInstancedMesh&&(c.hasEventListener("dispose",l)===!1&&c.addEventListener("dispose",l),s.get(c)!==u&&(t.update(c.instanceMatrix,r.ARRAY_BUFFER),c.instanceColor!==null&&t.update(c.instanceColor,r.ARRAY_BUFFER),s.set(c,u))),c.isSkinnedMesh){const f=c.skeleton;s.get(f)!==u&&(f.update(),s.set(f,u))}return h}function o(){s=new WeakMap}function l(c){const u=c.target;u.removeEventListener("dispose",l),i.releaseStatesOfObject(u),t.remove(u.instanceMatrix),u.instanceColor!==null&&t.remove(u.instanceColor)}return{update:a,dispose:o}}const fx={[Hc]:"LINEAR_TONE_MAPPING",[Gc]:"REINHARD_TONE_MAPPING",[Wc]:"CINEON_TONE_MAPPING",[Xc]:"ACES_FILMIC_TONE_MAPPING",[Yc]:"AGX_TONE_MAPPING",[Zc]:"NEUTRAL_TONE_MAPPING",[qc]:"CUSTOM_TONE_MAPPING"};function px(r,e,t,i,n){const s=new gi(e,t,{type:r,depthBuffer:i,stencilBuffer:n,depthTexture:i?new hs(e,t):void 0}),a=new gi(e,t,{type:Jt,depthBuffer:!1,stencilBuffer:!1}),o=new mt;o.setAttribute("position",new Ge([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new Ge([0,2,0,0,2,0],2));const l=new gh({uniforms:{tDiffuse:{value:null}},vertexShader:`
3965			precision highp float;
3966
3967			uniform mat4 modelViewMatrix;
3968			uniform mat4 projectionMatrix;
3969
3970			attribute vec3 position;
3971			attribute vec2 uv;
3972
3973			varying vec2 vUv;
3974
3975			void main() {
3976				vUv = uv;
3977				gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3978			}`,fragmentShader:`
3979			precision highp float;
3980
3981			uniform sampler2D tDiffuse;
3982
3983			varying vec2 vUv;
3984
3985			#include <tonemapping_pars_fragment>
3986			#include <colorspace_pars_fragment>
3987
3988			void main() {
3989				gl_FragColor = texture2D( tDiffuse, vUv );
3990
3991				#ifdef LINEAR_TONE_MAPPING
3992					gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
3993				#elif defined( REINHARD_TONE_MAPPING )
3994					gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
3995				#elif defined( CINEON_TONE_MAPPING )
3996					gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
3997				#elif defined( ACES_FILMIC_TONE_MAPPING )
3998					gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
3999				#elif defined( AGX_TONE_MAPPING )
4000					gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
4001				#elif defined( NEUTRAL_TONE_MAPPING )
4002					gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
4003				#elif defined( CUSTOM_TONE_MAPPING )
4004					gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
4005				#endif
4006
4007				#ifdef SRGB_TRANSFER
4008					gl_FragColor = sRGBTransferOETF( gl_FragColor );
4009				#endif
4010			}`,depthTest:!1,depthWrite:!1}),c=new kt(o,l),u=new js(-1,1,1,-1,0,1);let d=null,h=null,f=!1,p,v=null,g=[],m=!1;this.setSize=function(_,x){s.setSize(_,x),a.setSize(_,x);for(let M=0;M<g.length;M++){const R=g[M];R.setSize&&R.setSize(_,x)}},this.setEffects=function(_){g=_,m=g.length>0&&g[0].isRenderPass===!0;const x=s.width,M=s.height;for(let R=0;R<g.length;R++){const E=g[R];E.setSize&&E.setSize(x,M)}},this.begin=function(_,x){if(f||_.toneMapping===ki&&g.length===0)return!1;if(v=x,x!==null){const M=x.width,R=x.height;(s.width!==M||s.height!==R)&&this.setSize(M,R)}return m===!1&&_.setRenderTarget(s),p=_.toneMapping,_.toneMapping=ki,!0},this.hasRenderPass=function(){return m},this.end=function(_,x){_.toneMapping=p,f=!0;let M=s,R=a;for(let E=0;E<g.length;E++){const I=g[E];if(I.enabled!==!1&&(I.render(_,R,M,x),I.needsSwap!==!1)){const y=M;M=R,R=y}}if(d!==_.outputColorSpace||h!==_.toneMapping){d=_.outputColorSpace,h=_.toneMapping,l.defines={},bt.getTransfer(d)===It&&(l.defines.SRGB_TRANSFER="");const E=fx[h];E&&(l.defines[E]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=M.texture,_.setRenderTarget(v),_.render(c,u),v=null,f=!1},this.isCompositing=function(){return f},this.dispose=function(){s.depthTexture&&s.depthTexture.dispose(),s.dispose(),a.dispose(),o.dispose(),l.dispose()}}const sp=new Lt,kc=new hs(1,1),rp=new al,ap=new ol,op=new ta,Qu=[],ju=[],ed=new Float32Array(16),td=new Float32Array(9),id=new Float32Array(4);function er(r,e,t){const i=r[0];if(i<=0||i>0)return r;const n=e*t;let s=Qu[n];if(s===void 0&&(s=new Float32Array(n),Qu[n]=s),e!==0){i.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,r[a].toArray(s,o)}return s}function Qt(r,e){if(r.length!==e.length)return!1;for(let t=0,i=r.length;t<i;t++)if(r[t]!==e[t])return!1;return!0}function jt(r,e){for(let t=0,i=e.length;t<i;t++)r[t]=e[t]}function Pl(r,e){let t=ju[e];t===void 0&&(t=new Int32Array(e),ju[e]=t);for(let i=0;i!==e;++i)t[i]=r.allocateTextureUnit();return t}function mx(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function gx(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Qt(t,e))return;r.uniform2fv(this.addr,e),jt(t,e)}}function vx(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Qt(t,e))return;r.uniform3fv(this.addr,e),jt(t,e)}}function _x(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Qt(t,e))return;r.uniform4fv(this.addr,e),jt(t,e)}}function yx(r,e){const t=this.cache,i=e.elements;if(i===void 0){if(Qt(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),jt(t,e)}else{if(Qt(t,i))return;id.set(i),r.uniformMatrix2fv(this.addr,!1,id),jt(t,i)}}function xx(r,e){const t=this.cache,i=e.elements;if(i===void 0){if(Qt(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),jt(t,e)}else{if(Qt(t,i))return;td.set(i),r.uniformMatrix3fv(this.addr,!1,td),jt(t,i)}}function Mx(r,e){const t=this.cache,i=e.elements;if(i===void 0){if(Qt(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),jt(t,e)}else{if(Qt(t,i))return;ed.set(i),r.uniformMatrix4fv(this.addr,!1,ed),jt(t,i)}}function Sx(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function bx(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Qt(t,e))return;r.uniform2iv(this.addr,e),jt(t,e)}}function Tx(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Qt(t,e))return;r.uniform3iv(this.addr,e),jt(t,e)}}function wx(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Qt(t,e))return;r.uniform4iv(this.addr,e),jt(t,e)}}function Ex(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function Ax(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Qt(t,e))return;r.uniform2uiv(this.addr,e),jt(t,e)}}function Cx(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Qt(t,e))return;r.uniform3uiv(this.addr,e),jt(t,e)}}function Rx(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Qt(t,e))return;r.uniform4uiv(this.addr,e),jt(t,e)}}function Ix(r,e,t){const i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n);let s;this.type===r.SAMPLER_2D_SHADOW?(kc.compareFunction=t.isReversedDepthBuffer()?rl:sl,s=kc):s=sp,t.setTexture2D(e||s,n)}function Px(r,e,t){const i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTexture3D(e||ap,n)}function Lx(r,e,t){const i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTextureCube(e||op,n)}function Ux(r,e,t){const i=this.cache,n=t.allocateTextureUnit();i[0]!==n&&(r.uniform1i(this.addr,n),i[0]=n),t.setTexture2DArray(e||rp,n)}function Nx(r){switch(r){case 5126:return mx;case 35664:return gx;case 35665:return vx;case 35666:return _x;case 35674:return yx;case 35675:return xx;case 35676:return Mx;case 5124:case 35670:return Sx;case 35667:case 35671:return bx;case 35668:case 35672:return Tx;case 35669:case 35673:return wx;case 5125:return Ex;case 36294:return Ax;case 36295:return Cx;case 36296:return Rx;case 35678:case 36198:case 36298:case 36306:case 35682:return Ix;case 35679:case 36299:case 36307:return Px;case 35680:case 36300:case 36308:case 36293:return Lx;case 36289:case 36303:case 36311:case 36292:return Ux}}function Dx(r,e){r.uniform1fv(this.addr,e)}function Ox(r,e){const t=er(e,this.size,2);r.uniform2fv(this.addr,t)}function Fx(r,e){const t=er(e,this.size,3);r.uniform3fv(this.addr,t)}function Bx(r,e){const t=er(e,this.size,4);r.uniform4fv(this.addr,t)}function zx(r,e){const t=er(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function kx(r,e){const t=er(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function Vx(r,e){const t=er(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function Hx(r,e){r.uniform1iv(this.addr,e)}function Gx(r,e){r.uniform2iv(this.addr,e)}function Wx(r,e){r.uniform3iv(this.addr,e)}function Xx(r,e){r.uniform4iv(this.addr,e)}function qx(r,e){r.uniform1uiv(this.addr,e)}function Yx(r,e){r.uniform2uiv(this.addr,e)}function Zx(r,e){r.uniform3uiv(this.addr,e)}function Jx(r,e){r.uniform4uiv(this.addr,e)}function $x(r,e,t){const i=this.cache,n=e.length,s=Pl(t,n);Qt(i,s)||(r.uniform1iv(this.addr,s),jt(i,s));let a;this.type===r.SAMPLER_2D_SHADOW?a=kc:a=sp;for(let o=0;o!==n;++o)t.setTexture2D(e[o]||a,s[o])}function Kx(r,e,t){const i=this.cache,n=e.length,s=Pl(t,n);Qt(i,s)||(r.uniform1iv(this.addr,s),jt(i,s));for(let a=0;a!==n;++a)t.setTexture3D(e[a]||ap,s[a])}function Qx(r,e,t){const i=this.cache,n=e.length,s=Pl(t,n);Qt(i,s)||(r.uniform1iv(this.addr,s),jt(i,s));for(let a=0;a!==n;++a)t.setTextureCube(e[a]||op,s[a])}function jx(r,e,t){const i=this.cache,n=e.length,s=Pl(t,n);Qt(i,s)||(r.uniform1iv(this.addr,s),jt(i,s));for(let a=0;a!==n;++a)t.setTexture2DArray(e[a]||rp,s[a])}function eM(r){switch(r){case 5126:return Dx;case 35664:return Ox;case 35665:return Fx;case 35666:return Bx;case 35674:return zx;case 35675:return kx;case 35676:return Vx;case 5124:case 35670:return Hx;case 35667:case 35671:return Gx;case 35668:case 35672:return Wx;case 35669:case 35673:return Xx;case 5125:return qx;case 36294:return Yx;case 36295:return Zx;case 36296:return Jx;case 35678:case 36198:case 36298:case 36306:case 35682:return $x;case 35679:case 36299:case 36307:return Kx;case 35680:case 36300:case 36308:case 36293:return Qx;case 36289:case 36303:case 36311:case 36292:return jx}}class tM{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=Nx(t.type)}}class iM{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=eM(t.type)}}class nM{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const n=this.seq;for(let s=0,a=n.length;s!==a;++s){const o=n[s];o.setValue(e,t[o.id],i)}}}const xc=/(\w+)(\])?(\[|\.)?/g;function nd(r,e){r.seq.push(e),r.map[e.id]=e}function sM(r,e,t){const i=r.name,n=i.length;for(xc.lastIndex=0;;){const s=xc.exec(i),a=xc.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===n){nd(t,c===void 0?new tM(o,r,e):new iM(o,r,e));break}else{let d=t.map[o];d===void 0&&(d=new nM(o),nd(t,d)),t=d}}}class no{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<i;++a){const o=e.getActiveUniform(t,a),l=e.getUniformLocation(t,o.name);sM(o,l,this)}const n=[],s=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?n.push(a):s.push(a);n.length>0&&(this.seq=n.concat(s))}setValue(e,t,i,n){const s=this.map[t];s!==void 0&&s.setValue(e,i,n)}setOptional(e,t,i){const n=t[i];n!==void 0&&this.setValue(e,i,n)}static upload(e,t,i,n){for(let s=0,a=t.length;s!==a;++s){const o=t[s],l=i[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,n)}}static seqWithValue(e,t){const i=[];for(let n=0,s=e.length;n!==s;++n){const a=e[n];a.id in t&&i.push(a)}return i}}function sd(r,e,t){const i=r.createShader(e);return r.shaderSource(i,t),r.compileShader(i),i}const rM=37297;let aM=0;function oM(r,e){const t=r.split(`
4011`),i=[],n=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=n;a<s;a++){const o=a+1;i.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return i.join(`
4012`)}const rd=new ft;function lM(r){bt._getMatrix(rd,bt.workingColorSpace,r);const e=`mat3( ${rd.elements.map(t=>t.toFixed(4))} )`;switch(bt.getTransfer(r)){case zr:return[e,"LinearTransferOETF"];case It:return[e,"sRGBTransferOETF"];default:return Re("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function ad(r,e,t){const i=r.getShaderParameter(e,r.COMPILE_STATUS),s=(r.getShaderInfoLog(e)||"").trim();if(i&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return t.toUpperCase()+`
4013
4014`+s+`
4015
4016`+oM(r.getShaderSource(e),o)}else return s}function cM(r,e){const t=lM(e);return[`vec4 ${r}( vec4 value ) {`,`	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
4017`)}const hM={[Hc]:"Linear",[Gc]:"Reinhard",[Wc]:"Cineon",[Xc]:"ACESFilmic",[Yc]:"AgX",[Zc]:"Neutral",[qc]:"Custom"};function uM(r,e){const t=hM[e];return t===void 0?(Re("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const ja=new P;function dM(){bt.getLuminanceCoefficients(ja);const r=ja.x.toFixed(4),e=ja.y.toFixed(4),t=ja.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${r}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
4018`)}function fM(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Mr).join(`
4019`)}function pM(r){const e=[];for(const t in r){const i=r[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
4020`)}function mM(r,e){const t={},i=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let n=0;n<i;n++){const s=r.getActiveAttrib(e,n),a=s.name;let o=1;s.type===r.FLOAT_MAT2&&(o=2),s.type===r.FLOAT_MAT3&&(o=3),s.type===r.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:r.getAttribLocation(e,a),locationSize:o}}return t}function Mr(r){return r!==""}function od(r,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function ld(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const gM=/^[ \t]*#include +<([\w\d./]+)>/gm;function Vc(r){return r.replace(gM,_M)}const vM=new Map;function _M(r,e){let t=_t[e];if(t===void 0){const i=vM.get(e);if(i!==void 0)t=_t[i],Re('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return Vc(t)}const yM=/#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 cd(r){return r.replace(yM,xM)}function xM(r,e,t,i){let n="";for(let s=parseInt(e);s<parseInt(t);s++)n+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return n}function hd(r){let e=`precision ${r.precision} float;
4021	precision ${r.precision} int;
4022	precision ${r.precision} sampler2D;
4023	precision ${r.precision} samplerCube;
4024	precision ${r.precision} sampler3D;
4025	precision ${r.precision} sampler2DArray;
4026	precision ${r.precision} sampler2DShadow;
4027	precision ${r.precision} samplerCubeShadow;
4028	precision ${r.precision} sampler2DArrayShadow;
4029	precision ${r.precision} isampler2D;
4030	precision ${r.precision} isampler3D;
4031	precision ${r.precision} isamplerCube;
4032	precision ${r.precision} isampler2DArray;
4033	precision ${r.precision} usampler2D;
4034	precision ${r.precision} usampler3D;
4035	precision ${r.precision} usamplerCube;
4036	precision ${r.precision} usampler2DArray;
4037	`;return r.precision==="highp"?e+=`
4038#define HIGH_PRECISION`:r.precision==="mediump"?e+=`
4039#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
4040#define LOW_PRECISION`),e}const MM={[Sr]:"SHADOWMAP_TYPE_PCF",[Bs]:"SHADOWMAP_TYPE_VSM"};function SM(r){return MM[r.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const bM={[Qi]:"ENVMAP_TYPE_CUBE",[Pn]:"ENVMAP_TYPE_CUBE",[Js]:"ENVMAP_TYPE_CUBE_UV"};function TM(r){return r.envMap===!1?"ENVMAP_TYPE_CUBE":bM[r.envMapMode]||"ENVMAP_TYPE_CUBE"}const wM={[Pn]:"ENVMAP_MODE_REFRACTION"};function EM(r){return r.envMap===!1?"ENVMAP_MODE_REFLECTION":wM[r.envMapMode]||"ENVMAP_MODE_REFLECTION"}const AM={[Kr]:"ENVMAP_BLENDING_MULTIPLY",[Fd]:"ENVMAP_BLENDING_MIX",[Bd]:"ENVMAP_BLENDING_ADD"};function CM(r){return r.envMap===!1?"ENVMAP_BLENDING_NONE":AM[r.combine]||"ENVMAP_BLENDING_NONE"}function RM(r){const e=r.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:i,maxMip:t}}function IM(r,e,t,i){const n=r.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const l=SM(t),c=TM(t),u=EM(t),d=CM(t),h=RM(t),f=fM(t),p=pM(s),v=n.createProgram();let g,m,_=t.glslVersion?"#version "+t.glslVersion+`
4041`:"";t.isRawShaderMaterial?(g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(Mr).join(`
4042`),g.length>0&&(g+=`
4043`),m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(Mr).join(`
4044`),m.length>0&&(m+=`
4045`)):(g=[hd(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexNormals?"#define HAS_NORMAL":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	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","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
4046`].filter(Mr).join(`
4047`),m=[hd(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+d:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IR
4047IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==ki?"#define TONE_MAPPING":"",t.toneMapping!==ki?_t.tonemapping_pars_fragment:"",t.toneMapping!==ki?uM("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",_t.colorspace_pars_fragment,cM("linearToOutputTexel",t.outputColorSpace),dM(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
4048`].filter(Mr).join(`
4049`)),a=Vc(a),a=od(a,t),a=ld(a,t),o=Vc(o),o=od(o,t),o=ld(o,t),a=cd(a),o=cd(o),t.isRawShaderMaterial!==!0&&(_=`#version 300 es
4050`,g=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
4051`)+`
4052`+g,m=["#define varying in",t.glslVersion===Ic?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Ic?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
4053`)+`
4054`+m);const x=_+g+a,M=_+m+o,R=sd(n,n.VERTEX_SHADER,x),E=sd(n,n.FRAGMENT_SHADER,M);n.attachShader(v,R),n.attachShader(v,E),t.index0AttributeName!==void 0?n.bindAttribLocation(v,0,t.index0AttributeName):t.morphTargets===!0&&n.bindAttribLocation(v,0,"position"),n.linkProgram(v);function I(L){if(r.debug.checkShaderErrors){const O=n.getProgramInfoLog(v)||"",q=n.getShaderInfoLog(R)||"",W=n.getShaderInfoLog(E)||"",B=O.trim(),k=q.trim(),Y=W.trim();let re=!0,le=!0;if(n.getProgramParameter(v,n.LINK_STATUS)===!1)if(re=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(n,v,R,E);else{const de=ad(n,R,"vertex"),De=ad(n,E,"fragment");Ze("THREE.WebGLProgram: Shader Error "+n.getError()+" - VALIDATE_STATUS "+n.getProgramParameter(v,n.VALIDATE_STATUS)+`
4055
4056Material Name: `+L.name+`
4057Material Type: `+L.type+`
4058
4059Program Info Log: `+B+`
4060`+de+`
4061`+De)}else B!==""?Re("WebGLProgram: Program Info Log:",B):(k===""||Y==="")&&(le=!1);le&&(L.diagnostics={runnable:re,programLog:B,vertexShader:{log:k,prefix:g},fragmentShader:{log:Y,prefix:m}})}n.deleteShader(R),n.deleteShader(E),y=new no(n,v),w=mM(n,v)}let y;this.getUniforms=function(){return y===void 0&&I(this),y};let w;this.getAttributes=function(){return w===void 0&&I(this),w};let U=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return U===!1&&(U=n.getProgramParameter(v,rM)),U},this.destroy=function(){i.releaseStatesOfProgram(this),n.deleteProgram(v),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=aM++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=R,this.fragmentShader=E,this}let PM=0;class LM{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,n=this._getShaderStage(t),s=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(n)===!1&&(a.add(n),n.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.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){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new UM(e),t.set(e,i)),i}}class UM{constructor(e){this.id=PM++,this.code=e,this.usedTimes=0}}function NM(r){return r===Ln||r===Dr||r===Or}function DM(r,e,t,i,n,s){const a=new ll,o=new LM,l=new Set,c=[],u=new Map,d=i.logarithmicDepthBuffer;let h=i.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function p(y){return l.add(y),y===0?"uv":`uv${y}`}function v(y,w,U,L,O,q){const W=L.fog,B=O.geometry,k=y.isMeshStandardMaterial||y.isMeshLambertMaterial||y.isMeshPhongMaterial?L.environment:null,Y=y.isMeshStandardMaterial||y.isMeshLambertMaterial&&!y.envMap||y.isMeshPhongMaterial&&!y.envMap,re=e.get(y.envMap||k,Y),le=re&&re.mapping===Js?re.image.height:null,de=f[y.type];y.precision!==null&&(h=i.getMaxPrecision(y.precision),h!==y.precision&&Re("WebGLProgram.getParameters:",y.precision,"not supported, using",h,"instead."));const De=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,Ue=De!==void 0?De.length:0;let Ke=0;B.morphAttributes.position!==void 0&&(Ke=1),B.morphAttributes.normal!==void 0&&(Ke=2),B.morphAttributes.color!==void 0&&(Ke=3);let yt,ot,J,Ie;if(de){const pt=Oi[de];yt=pt.vertexShader,ot=pt.fragmentShader}else yt=y.vertexShader,ot=y.fragmentShader,o.update(y),J=o.getVertexShaderID(y),Ie=o.getFragmentShaderID(y);const ve=r.getRenderTarget(),qe=r.state.buffers.depth.getReversed(),et=O.isInstancedMesh===!0,Qe=O.isBatchedMesh===!0,Tt=!!y.map,tt=!!y.matcap,ie=!!re,me=!!y.aoMap,ae=!!y.lightMap,Fe=!!y.bumpMap,Pe=!!y.normalMap,at=!!y.displacementMap,N=!!y.emissiveMap,ht=!!y.metalnessMap,We=!!y.roughnessMap,it=y.anisotropy>0,_e=y.clearcoat>0,Et=y.dispersion>0,C=y.iridescence>0,b=y.sheen>0,X=y.transmission>0,ee=it&&!!y.anisotropyMap,oe=_e&&!!y.clearcoatMap,xe=_e&&!!y.clearcoatNormalMap,Se=_e&&!!y.clearcoatRoughnessMap,$=C&&!!y.iridescenceMap,j=C&&!!y.iridescenceThicknessMap,Be=b&&!!y.sheenColorMap,ze=b&&!!y.sheenRoughnessMap,pe=!!y.specularMap,ce=!!y.specularColorMap,ut=!!y.specularIntensityMap,ne=X&&!!y.transmissionMap,Mt=X&&!!y.thicknessMap,z=!!y.gradientMap,Me=!!y.alphaMap,te=y.alphaTest>0,ke=!!y.alphaHash,be=!!y.extensions;let he=ki;y.toneMapped&&(ve===null||ve.isXRRenderTarget===!0)&&(he=r.toneMapping);const Je={shaderID:de,shaderType:y.type,shaderName:y.name,vertexShader:yt,fragmentShader:ot,defines:y.defines,customVertexShaderID:J,customFragmentShaderID:Ie,isRawShaderMaterial:y.isRawShaderMaterial===!0,glslVersion:y.glslVersion,precision:h,batching:Qe,batchingColor:Qe&&O._colorsTexture!==null,instancing:et,instancingColor:et&&O.instanceColor!==null,instancingMorph:et&&O.morphTexture!==null,outputColorSpace:ve===null?r.outputColorSpace:ve.isXRRenderTarget===!0?ve.texture.colorSpace:bt.workingColorSpace,alphaToCoverage:!!y.alphaToCoverage,map:Tt,matcap:tt,envMap:ie,envMapMode:ie&&re.mapping,envMapCubeUVHeight:le,aoMap:me,lightMap:ae,bumpMap:Fe,normalMap:Pe,displacementMap:at,emissiveMap:N,normalMapObjectSpace:Pe&&y.normalMapType===Wd,normalMapTangentSpace:Pe&&y.normalMapType===dn,packedNormalMap:Pe&&y.normalMapType===dn&&NM(y.normalMap.format),metalnessMap:ht,roughnessMap:We,anisotropy:it,anisotropyMap:ee,clearcoat:_e,clearcoatMap:oe,clearcoatNormalMap:xe,clearcoatRoughnessMap:Se,dispersion:Et,iridescence:C,iridescenceMap:$,iridescenceThicknessMap:j,sheen:b,sheenColorMap:Be,sheenRoughnessMap:ze,specularMap:pe,specularColorMap:ce,specularIntensityMap:ut,transmission:X,transmissionMap:ne,thicknessMap:Mt,gradientMap:z,opaque:y.transparent===!1&&y.blending===ss&&y.alphaToCoverage===!1,alphaMap:Me,alphaTest:te,alphaHash:ke,combine:y.combine,mapUv:Tt&&p(y.map.channel),aoMapUv:me&&p(y.aoMap.channel),lightMapUv:ae&&p(y.lightMap.channel),bumpMapUv:Fe&&p(y.bumpMap.channel),normalMapUv:Pe&&p(y.normalMap.channel),displacementMapUv:at&&p(y.displacementMap.channel),emissiveMapUv:N&&p(y.emissiveMap.channel),metalnessMapUv:ht&&p(y.metalnessMap.channel),roughnessMapUv:We&&p(y.roughnessMap.channel),anisotropyMapUv:ee&&p(y.anisotropyMap.channel),clearcoatMapUv:oe&&p(y.clearcoatMap.channel),clearcoatNormalMapUv:xe&&p(y.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Se&&p(y.clearcoatRoughnessMap.channel),iridescenceMapUv:$&&p(y.iridescenceMap.channel),iridescenceThicknessMapUv:j&&p(y.iridescenceThicknessMap.channel),sheenColorMapUv:Be&&p(y.sheenColorMap.channel),sheenRoughnessMapUv:ze&&p(y.sheenRoughnessMap.channel),specularMapUv:pe&&p(y.specularMap.channel),specularColorMapUv:ce&&p(y.specularColorMap.channel),specularIntensityMapUv:ut&&p(y.specularIntensityMap.channel),transmissionMapUv:ne&&p(y.transmissionMap.channel),thicknessMapUv:Mt&&p(y.thicknessMap.channel),alphaMapUv:Me&&p(y.alphaMap.channel),vertexTangents:!!B.attributes.tangent&&(Pe||it),vertexNormals:!!B.attributes.normal,vertexColors:y.vertexColors,vertexAlphas:y.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,pointsUvs:O.isPoints===!0&&!!B.attributes.uv&&(Tt||Me),fog:!!W,useFog:y.fog===!0,fogExp2:!!W&&W.isFogExp2,flatShading:y.wireframe===!1&&(y.flatShading===!0||B.attributes.normal===void 0&&Pe===!1&&(y.isMeshLambertMaterial||y.isMeshPhongMaterial||y.isMeshStandardMaterial||y.isMeshPhysicalMaterial)),sizeAttenuation:y.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:qe,skinning:O.isSkinnedMesh===!0,morphTargets:B.morphAttributes.position!==void 0,morphNormals:B.morphAttributes.normal!==void 0,morphColors:B.morphAttributes.color!==void 0,morphTargetsCount:Ue,morphTextureStride:Ke,numDirLights:w.directional.length,numPointLights:w.point.length,numSpotLights:w.spot.length,numSpotLightMaps:w.spotLightMap.length,numRectAreaLights:w.rectArea.length,numHemiLights:w.hemi.length,numDirLightShadows:w.directionalShadowMap.length,numPointLightShadows:w.pointShadowMap.length,numSpotLightShadows:w.spotShadowMap.length,numSpotLightShadowsWithMaps:w.numSpotLightShadowsWithMaps,numLightProbes:w.numLightProbes,numLightProbeGrids:q.length,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:y.dithering,shadowMapEnabled:r.shadowMap.enabled&&U.length>0,shadowMapType:r.shadowMap.type,toneMapping:he,decodeVideoTexture:Tt&&y.map.isVideoTexture===!0&&bt.getTransfer(y.map.colorSpace)===It,decodeVideoTextureEmissive:N&&y.emissiveMap.isVideoTexture===!0&&bt.getTransfer(y.emissiveMap.colorSpace)===It,premultipliedAlpha:y.premultipliedAlpha,doubleSided:y.side===Fi,flipSided:y.side===pi,useDepthPacking:y.depthPacking>=0,depthPacking:y.depthPacking||0,index0AttributeName:y.index0AttributeName,extensionCl
vendor: 8,755 bytes, line 4061
4061ipCullDistance:be&&y.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(be&&y.extensions.multiDraw===!0||Qe)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:y.customProgramCacheKey()};return Je.vertexUv1s=l.has(1),Je.vertexUv2s=l.has(2),Je.vertexUv3s=l.has(3),l.clear(),Je}function g(y){const w=[];if(y.shaderID?w.push(y.shaderID):(w.push(y.customVertexShaderID),w.push(y.customFragmentShaderID)),y.defines!==void 0)for(const U in y.defines)w.push(U),w.push(y.defines[U]);return y.isRawShaderMaterial===!1&&(m(w,y),_(w,y),w.push(r.outputColorSpace)),w.push(y.customProgramCacheKey),w.join()}function m(y,w){y.push(w.precision),y.push(w.outputColorSpace),y.push(w.envMapMode),y.push(w.envMapCubeUVHeight),y.push(w.mapUv),y.push(w.alphaMapUv),y.push(w.lightMapUv),y.push(w.aoMapUv),y.push(w.bumpMapUv),y.push(w.normalMapUv),y.push(w.displacementMapUv),y.push(w.emissiveMapUv),y.push(w.metalnessMapUv),y.push(w.roughnessMapUv),y.push(w.anisotropyMapUv),y.push(w.clearcoatMapUv),y.push(w.clearcoatNormalMapUv),y.push(w.clearcoatRoughnessMapUv),y.push(w.iridescenceMapUv),y.push(w.iridescenceThicknessMapUv),y.push(w.sheenColorMapUv),y.push(w.sheenRoughnessMapUv),y.push(w.specularMapUv),y.push(w.specularColorMapUv),y.push(w.specularIntensityMapUv),y.push(w.transmissionMapUv),y.push(w.thicknessMapUv),y.push(w.combine),y.push(w.fogExp2),y.push(w.sizeAttenuation),y.push(w.morphTargetsCount),y.push(w.morphAttributeCount),y.push(w.numDirLights),y.push(w.numPointLights),y.push(w.numSpotLights),y.push(w.numSpotLightMaps),y.push(w.numHemiLights),y.push(w.numRectAreaLights),y.push(w.numDirLightShadows),y.push(w.numPointLightShadows),y.push(w.numSpotLightShadows),y.push(w.numSpotLightShadowsWithMaps),y.push(w.numLightProbes),y.push(w.shadowMapType),y.push(w.toneMapping),y.push(w.numClippingPlanes),y.push(w.numClipIntersection),y.push(w.depthPacking)}function _(y,w){a.disableAll(),w.instancing&&a.enable(0),w.instancingColor&&a.enable(1),w.instancingMorph&&a.enable(2),w.matcap&&a.enable(3),w.envMap&&a.enable(4),w.normalMapObjectSpace&&a.enable(5),w.normalMapTangentSpace&&a.enable(6),w.clearcoat&&a.enable(7),w.iridescence&&a.enable(8),w.alphaTest&&a.enable(9),w.vertexColors&&a.enable(10),w.vertexAlphas&&a.enable(11),w.vertexUv1s&&a.enable(12),w.vertexUv2s&&a.enable(13),w.vertexUv3s&&a.enable(14),w.vertexTangents&&a.enable(15),w.anisotropy&&a.enable(16),w.alphaHash&&a.enable(17),w.batching&&a.enable(18),w.dispersion&&a.enable(19),w.batchingColor&&a.enable(20),w.gradientMap&&a.enable(21),w.packedNormalMap&&a.enable(22),w.vertexNormals&&a.enable(23),y.push(a.mask),a.disableAll(),w.fog&&a.enable(0),w.useFog&&a.enable(1),w.flatShading&&a.enable(2),w.logarithmicDepthBuffer&&a.enable(3),w.reversedDepthBuffer&&a.enable(4),w.skinning&&a.enable(5),w.morphTargets&&a.enable(6),w.morphNormals&&a.enable(7),w.morphColors&&a.enable(8),w.premultipliedAlpha&&a.enable(9),w.shadowMapEnabled&&a.enable(10),w.doubleSided&&a.enable(11),w.flipSided&&a.enable(12),w.useDepthPacking&&a.enable(13),w.dithering&&a.enable(14),w.transmission&&a.enable(15),w.sheen&&a.enable(16),w.opaque&&a.enable(17),w.pointsUvs&&a.enable(18),w.decodeVideoTexture&&a.enable(19),w.decodeVideoTextureEmissive&&a.enable(20),w.alphaToCoverage&&a.enable(21),w.numLightProbeGrids>0&&a.enable(22),y.push(a.mask)}function x(y){const w=f[y.type];let U;if(w){const L=Oi[w];U=Ef.clone(L.uniforms)}else U=y.uniforms;return U}function M(y,w){let U=u.get(w);return U!==void 0?++U.usedTimes:(U=new IM(r,w,y,n),c.push(U),u.set(w,U)),U}function R(y){if(--y.usedTimes===0){const w=c.indexOf(y);c[w]=c[c.length-1],c.pop(),u.delete(y.cacheKey),y.destroy()}}function E(y){o.remove(y)}function I(){o.dispose()}return{getParameters:v,getProgramCacheKey:g,getUniforms:x,acquireProgram:M,releaseProgram:R,releaseShaderCache:E,programs:c,dispose:I}}function OM(){let r=new WeakMap;function e(a){return r.has(a)}function t(a){let o=r.get(a);return o===void 0&&(o={},r.set(a,o)),o}function i(a){r.delete(a)}function n(a,o,l){r.get(a)[o]=l}function s(){r=new WeakMap}return{has:e,get:t,remove:i,update:n,dispose:s}}function FM(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.materialVariant!==e.materialVariant?r.materialVariant-e.materialVariant:r.z!==e.z?r.z-e.z:r.id-e.id}function ud(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function dd(){const r=[];let e=0;const t=[],i=[],n=[];function s(){e=0,t.length=0,i.length=0,n.length=0}function a(h){let f=0;return h.isInstancedMesh&&(f+=2),h.isSkinnedMesh&&(f+=1),f}function o(h,f,p,v,g,m){let _=r[e];return _===void 0?(_={id:h.id,object:h,geometry:f,material:p,materialVariant:a(h),groupOrder:v,renderOrder:h.renderOrder,z:g,group:m},r[e]=_):(_.id=h.id,_.object=h,_.geometry=f,_.material=p,_.materialVariant=a(h),_.groupOrder=v,_.renderOrder=h.renderOrder,_.z=g,_.group=m),e++,_}function l(h,f,p,v,g,m){const _=o(h,f,p,v,g,m);p.transmission>0?i.push(_):p.transparent===!0?n.push(_):t.push(_)}function c(h,f,p,v,g,m){const _=o(h,f,p,v,g,m);p.transmission>0?i.unshift(_):p.transparent===!0?n.unshift(_):t.unshift(_)}function u(h,f){t.length>1&&t.sort(h||FM),i.length>1&&i.sort(f||ud),n.length>1&&n.sort(f||ud)}function d(){for(let h=e,f=r.length;h<f;h++){const p=r[h];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:i,transparent:n,init:s,push:l,unshift:c,finish:d,sort:u}}function BM(){let r=new WeakMap;function e(i,n){const s=r.get(i);let a;return s===void 0?(a=new dd,r.set(i,[a])):n>=s.length?(a=new dd,s.push(a)):a=s[n],a}function t(){r=new WeakMap}return{get:e,dispose:t}}function zM(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new P,color:new He};break;case"SpotLight":t={position:new P,direction:new P,color:new He,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new P,color:new He,distance:0,decay:0};break;case"HemisphereLight":t={direction:new P,skyColor:new He,groundColor:new He};break;case"RectAreaLight":t={color:new He,position:new P,halfWidth:new P,halfHeight:new P};break}return r[e.id]=t,t}}}function kM(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new se};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new se};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new se,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let VM=0;function HM(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function GM(r){const e=new zM,t=kM(),i={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 c=0;c<9;c++)i.probe.push(new P);const n=new P,s=new ct,a=new ct;function o(c){let u=0,d=0,h=0;for(let w=0;w<9;w++)i.probe[w].set(0,0,0);let f=0,p=0,v=0,g=0,m=0,_=0,x=0,M=0,R=0,E=0,I=0;c.sort(HM);for(let w=0,U=c.length;w<U;w++){const L=c[w],O=L.color,q=L.intensity,W=L.distance;let B=null;if(L.shadow&&L.shadow.map&&(L.shadow.map.texture.format===Ln?B=L.shadow.map.texture:B=L.shadow.map.depthTexture||L.shadow.map.texture),L.isAmbientLight)u+=O.r*q,d+=O.g*q,h+=O.b*q;else if(L.isLightProbe){for(let k=0;k<9;k++)i.probe[k].addScaledVector(L.sh.coefficients[k],q);I++}else if(L.isDirectionalLight){const k=e.get(L);if(k.color.copy(L.color).multiplyScalar(L.intensity),L.castShadow){const Y=L.shadow,re=t.get(L);re.shadowIntensity=Y.intensity,re.shadowBias=Y.bias,re.shadowNormalBias=Y.normalBias,re.shadowRadius=Y.radius,re.shadowMapSize=Y.mapSize,i.directionalShadow[f]=re,i.directionalShadowMap[f]=B,i.directionalShadowMatrix[f]=L.shadow.matrix,_++}i.directional[f]=k,f++}else if(L.isSpotLight){const k=e.get(L);k.position.setFromMatrixPosition(L.matrixWorld),k.color.copy(O).multiplyScalar(q),k.distance=W,k.c
vendor: 4,139 bytes, line 4061
4061oneCos=Math.cos(L.angle),k.penumbraCos=Math.cos(L.angle*(1-L.penumbra)),k.decay=L.decay,i.spot[v]=k;const Y=L.shadow;if(L.map&&(i.spotLightMap[R]=L.map,R++,Y.updateMatrices(L),L.castShadow&&E++),i.spotLightMatrix[v]=Y.matrix,L.castShadow){const re=t.get(L);re.shadowIntensity=Y.intensity,re.shadowBias=Y.bias,re.shadowNormalBias=Y.normalBias,re.shadowRadius=Y.radius,re.shadowMapSize=Y.mapSize,i.spotShadow[v]=re,i.spotShadowMap[v]=B,M++}v++}else if(L.isRectAreaLight){const k=e.get(L);k.color.copy(O).multiplyScalar(q),k.halfWidth.set(L.width*.5,0,0),k.halfHeight.set(0,L.height*.5,0),i.rectArea[g]=k,g++}else if(L.isPointLight){const k=e.get(L);if(k.color.copy(L.color).multiplyScalar(L.intensity),k.distance=L.distance,k.decay=L.decay,L.castShadow){const Y=L.shadow,re=t.get(L);re.shadowIntensity=Y.intensity,re.shadowBias=Y.bias,re.shadowNormalBias=Y.normalBias,re.shadowRadius=Y.radius,re.shadowMapSize=Y.mapSize,re.shadowCameraNear=Y.camera.near,re.shadowCameraFar=Y.camera.far,i.pointShadow[p]=re,i.pointShadowMap[p]=B,i.pointShadowMatrix[p]=L.shadow.matrix,x++}i.point[p]=k,p++}else if(L.isHemisphereLight){const k=e.get(L);k.skyColor.copy(L.color).multiplyScalar(q),k.groundColor.copy(L.groundColor).multiplyScalar(q),i.hemi[m]=k,m++}}g>0&&(r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Oe.LTC_FLOAT_1,i.rectAreaLTC2=Oe.LTC_FLOAT_2):(i.rectAreaLTC1=Oe.LTC_HALF_1,i.rectAreaLTC2=Oe.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=d,i.ambient[2]=h;const y=i.hash;(y.directionalLength!==f||y.pointLength!==p||y.spotLength!==v||y.rectAreaLength!==g||y.hemiLength!==m||y.numDirectionalShadows!==_||y.numPointShadows!==x||y.numSpotShadows!==M||y.numSpotMaps!==R||y.numLightProbes!==I)&&(i.directional.length=f,i.spot.length=v,i.rectArea.length=g,i.point.length=p,i.hemi.length=m,i.directionalShadow.length=_,i.directionalShadowMap.length=_,i.pointShadow.length=x,i.pointShadowMap.length=x,i.spotShadow.length=M,i.spotShadowMap.length=M,i.directionalShadowMatrix.length=_,i.pointShadowMatrix.length=x,i.spotLightMatrix.length=M+R-E,i.spotLightMap.length=R,i.numSpotLightShadowsWithMaps=E,i.numLightProbes=I,y.directionalLength=f,y.pointLength=p,y.spotLength=v,y.rectAreaLength=g,y.hemiLength=m,y.numDirectionalShadows=_,y.numPointShadows=x,y.numSpotShadows=M,y.numSpotMaps=R,y.numLightProbes=I,i.version=VM++)}function l(c,u){let d=0,h=0,f=0,p=0,v=0;const g=u.matrixWorldInverse;for(let m=0,_=c.length;m<_;m++){const x=c[m];if(x.isDirectionalLight){const M=i.directional[d];M.direction.setFromMatrixPosition(x.matrixWorld),n.setFromMatrixPosition(x.target.matrixWorld),M.direction.sub(n),M.direction.transformDirection(g),d++}else if(x.isSpotLight){const M=i.spot[f];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(g),M.direction.setFromMatrixPosition(x.matrixWorld),n.setFromMatrixPosition(x.target.matrixWorld),M.direction.sub(n),M.direction.transformDirection(g),f++}else if(x.isRectAreaLight){const M=i.rectArea[p];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(g),a.identity(),s.copy(x.matrixWorld),s.premultiply(g),a.extractRotation(s),M.halfWidth.set(x.width*.5,0,0),M.halfHeight.set(0,x.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),p++}else if(x.isPointLight){const M=i.point[h];M.position.setFromMatrixPosition(x.matrixWorld),M.position.applyMatrix4(g),h++}else if(x.isHemisphereLight){const M=i.hemi[v];M.direction.setFromMatrixPosition(x.matrixWorld),M.direction.transformDirection(g),v++}}}return{setup:o,setupView:l,state:i}}function fd(r){const e=new GM(r),t=[],i=[],n=[];function s(h){d.camera=h,t.length=0,i.length=0,n.length=0}function a(h){t.push(h)}function o(h){i.push(h)}function l(h){n.push(h)}function c(){e.setup(t)}function u(h){e.setupView(t,h)}const d={lightsArray:t,shadowsArray:i,lightProbeGridArray:n,camera:null,lights:e,transmissionRenderTarget:{},textureUnits:0};return{init:s,state:d,setupLights:c,setupLightsView:u,pushLight:a,pushShadow:o,pushLightProbeGrid:l}}function WM(r){let e=new WeakMap;function t(n,s=0){const a=e.get(n);let o;return a===void 0?(o=new fd(r),e.set(n,[o])):s>=a.length?(o=new fd(r),a.push(o)):o=a[s],o}
vendor: 4,076 bytes, lines 4061-4088
4061function i(){e=new WeakMap}return{get:t,dispose:i}}const XM=`void main() {
4062	gl_Position = vec4( position, 1.0 );
4063}`,qM=`uniform sampler2D shadow_pass;
4064uniform vec2 resolution;
4065uniform float radius;
4066void main() {
4067	const float samples = float( VSM_SAMPLES );
4068	float mean = 0.0;
4069	float squared_mean = 0.0;
4070	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
4071	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
4072	for ( float i = 0.0; i < samples; i ++ ) {
4073		float uvOffset = uvStart + i * uvStride;
4074		#ifdef HORIZONTAL_PASS
4075			vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
4076			mean += distribution.x;
4077			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
4078		#else
4079			float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
4080			mean += depth;
4081			squared_mean += depth * depth;
4082		#endif
4083	}
4084	mean = mean / samples;
4085	squared_mean = squared_mean / samples;
4086	float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4087	gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4088}`,YM=[new P(1,0,0),new P(-1,0,0),new P(0,1,0),new P(0,-1,0),new P(0,0,1),new P(0,0,-1)],ZM=[new P(0,-1,0),new P(0,-1,0),new P(0,0,1),new P(0,0,-1),new P(0,-1,0),new P(0,-1,0)],pd=new ct,gr=new P,Mc=new P;function JM(r,e,t){let i=new Ks;const n=new se,s=new se,a=new Pt,o=new _h,l=new yh,c={},u=t.maxTextureSize,d={[un]:pi,[pi]:un,[Fi]:Fi},h=new vi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new se},radius:{value:4}},vertexShader:XM,fragmentShader:qM}),f=h.clone();f.defines.HORIZONTAL_PASS=1;const p=new mt;p.setAttribute("position",new Ut(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new kt(p,h),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Sr;let m=this.type;this.render=function(E,I,y){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||E.length===0)return;this.type===_d&&(Re("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=Sr);const w=r.getRenderTarget(),U=r.getActiveCubeFace(),L=r.getActiveMipmapLevel(),O=r.state;O.setBlending(zi),O.buffers.depth.getReversed()===!0?O.buffers.color.setClear(0,0,0,0):O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);const q=m!==this.type;q&&I.traverse(function(W){W.material&&(Array.isArray(W.material)?W.material.forEach(B=>B.needsUpdate=!0):W.material.needsUpdate=!0)});for(let W=0,B=E.length;W<B;W++){const k=E[W],Y=k.shadow;if(Y===void 0){Re("WebGLShadowMap:",k,"has no shadow.");continue}if(Y.autoUpdate===!1&&Y.needsUpdate===!1)continue;n.copy(Y.mapSize);const re=Y.getFrameExtents();n.multiply(re),s.copy(Y.mapSize),(n.x>u||n.y>u)&&(n.x>u&&(s.x=Math.floor(u/re.x),n.x=s.x*re.x,Y.mapSize.x=s.x),n.y>u&&(s.y=Math.floor(u/re.y),n.y=s.y*re.y,Y.mapSize.y=s.y));const le=r.state.buffers.depth.getReversed();if(Y.camera._reversedDepth=le,Y.map===null||q===!0){if(Y.map!==null&&(Y.map.depthTexture!==null&&(Y.map.depthTexture.dispose(),Y.map.depthTexture=null),Y.map.dispose()),this.type===Bs){if(k.isPointLight){Re("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}Y.map=new gi(n.x,n.y,{format:Ln,type:Jt,minFilter:wt,magFilter:wt,generateMipmaps:!1}),Y.map.texture.name=k.name+".shadowMap",Y.map.depthTexture=new hs(n.x,n.y,Ft),Y.map.depthTexture.name=k.name+".shadowMapDepth",Y.map.depthTexture.format=ji,Y.map.depthTexture.compareFunction=null,Y.map.depthTexture.minFilter=Zt,Y.map.depthTexture.magFilter=Zt}else k.isPointLight?(Y.map=new Ih(n.x),Y.map.depthTexture=new df(n.x,Ci)):(Y.map=new gi(n.x,n.y),Y.map.depthTexture=new hs(n.x,n.y,Ci)),Y.map.depthTexture.name=k.name+".shadowMap",Y.map.depthTexture.format=ji,this.type===Sr?(Y.map.depthTexture.compareFunction=le?rl:sl,Y.map.depthTexture.minFilter=wt,Y.map.depthTexture.magFilter=wt):(Y.map.depthTexture.compareFunction=null,Y.map.depthTexture.minFilter=Zt,Y.map.depthTexture.magFilter=Zt);Y.camera.updateProjectionMatrix()}
vendor: 10,368 bytes, line 4088
4088const de=Y.map.isWebGLCubeRenderTarget?6:1;for(let De=0;De<de;De++){if(Y.map.isWebGLCubeRenderTarget)r.setRenderTarget(Y.map,De),r.clear();else{De===0&&(r.setRenderTarget(Y.map),r.clear());const Ue=Y.getViewport(De);a.set(s.x*Ue.x,s.y*Ue.y,s.x*Ue.z,s.y*Ue.w),O.viewport(a)}if(k.isPointLight){const Ue=Y.camera,Ke=Y.matrix,yt=k.distance||Ue.far;yt!==Ue.far&&(Ue.far=yt,Ue.updateProjectionMatrix()),gr.setFromMatrixPosition(k.matrixWorld),Ue.position.copy(gr),Mc.copy(Ue.position),Mc.add(YM[De]),Ue.up.copy(ZM[De]),Ue.lookAt(Mc),Ue.updateMatrixWorld(),Ke.makeTranslation(-gr.x,-gr.y,-gr.z),pd.multiplyMatrices(Ue.projectionMatrix,Ue.matrixWorldInverse),Y._frustum.setFromProjectionMatrix(pd,Ue.coordinateSystem,Ue.reversedDepth)}else Y.updateMatrices(k);i=Y.getFrustum(),M(I,y,Y.camera,k,this.type)}Y.isPointLightShadow!==!0&&this.type===Bs&&_(Y,y),Y.needsUpdate=!1}m=this.type,g.needsUpdate=!1,r.setRenderTarget(w,U,L)};function _(E,I){const y=e.update(v);h.defines.VSM_SAMPLES!==E.blurSamples&&(h.defines.VSM_SAMPLES=E.blurSamples,f.defines.VSM_SAMPLES=E.blurSamples,h.needsUpdate=!0,f.needsUpdate=!0),E.mapPass===null&&(E.mapPass=new gi(n.x,n.y,{format:Ln,type:Jt})),h.uniforms.shadow_pass.value=E.map.depthTexture,h.uniforms.resolution.value=E.mapSize,h.uniforms.radius.value=E.radius,r.setRenderTarget(E.mapPass),r.clear(),r.renderBufferDirect(I,null,y,h,v,null),f.uniforms.shadow_pass.value=E.mapPass.texture,f.uniforms.resolution.value=E.mapSize,f.uniforms.radius.value=E.radius,r.setRenderTarget(E.map),r.clear(),r.renderBufferDirect(I,null,y,f,v,null)}function x(E,I,y,w){let U=null;const L=y.isPointLight===!0?E.customDistanceMaterial:E.customDepthMaterial;if(L!==void 0)U=L;else if(U=y.isPointLight===!0?l:o,r.localClippingEnabled&&I.clipShadows===!0&&Array.isArray(I.clippingPlanes)&&I.clippingPlanes.length!==0||I.displacementMap&&I.displacementScale!==0||I.alphaMap&&I.alphaTest>0||I.map&&I.alphaTest>0||I.alphaToCoverage===!0){const O=U.uuid,q=I.uuid;let W=c[O];W===void 0&&(W={},c[O]=W);let B=W[q];B===void 0&&(B=U.clone(),W[q]=B,I.addEventListener("dispose",R)),U=B}if(U.visible=I.visible,U.wireframe=I.wireframe,w===Bs?U.side=I.shadowSide!==null?I.shadowSide:I.side:U.side=I.shadowSide!==null?I.shadowSide:d[I.side],U.alphaMap=I.alphaMap,U.alphaTest=I.alphaToCoverage===!0?.5:I.alphaTest,U.map=I.map,U.clipShadows=I.clipShadows,U.clippingPlanes=I.clippingPlanes,U.clipIntersection=I.clipIntersection,U.displacementMap=I.displacementMap,U.displacementScale=I.displacementScale,U.displacementBias=I.displacementBias,U.wireframeLinewidth=I.wireframeLinewidth,U.linewidth=I.linewidth,y.isPointLight===!0&&U.isMeshDistanceMaterial===!0){const O=r.properties.get(U);O.light=y}return U}function M(E,I,y,w,U){if(E.visible===!1)return;if(E.layers.test(I.layers)&&(E.isMesh||E.isLine||E.isPoints)&&(E.castShadow||E.receiveShadow&&U===Bs)&&(!E.frustumCulled||i.intersectsObject(E))){E.modelViewMatrix.multiplyMatrices(y.matrixWorldInverse,E.matrixWorld);const q=e.update(E),W=E.material;if(Array.isArray(W)){const B=q.groups;for(let k=0,Y=B.length;k<Y;k++){const re=B[k],le=W[re.materialIndex];if(le&&le.visible){const de=x(E,le,w,U);E.onBeforeShadow(r,E,I,y,q,de,re),r.renderBufferDirect(y,null,q,de,E,re),E.onAfterShadow(r,E,I,y,q,de,re)}}}else if(W.visible){const B=x(E,W,w,U);E.onBeforeShadow(r,E,I,y,q,B,null),r.renderBufferDirect(y,null,q,B,E,null),E.onAfterShadow(r,E,I,y,q,B,null)}}const O=E.children;for(let q=0,W=O.length;q<W;q++)M(O[q],I,y,w,U)}function R(E){E.target.removeEventListener("dispose",R);for(const y in c){const w=c[y],U=E.target.uuid;U in w&&(w[U].dispose(),delete w[U])}}}function $M(r,e){function t(){let z=!1;const Me=new Pt;let te=null;const ke=new Pt(0,0,0,0);return{setMask:function(be){te!==be&&!z&&(r.colorMask(be,be,be,be),te=be)},setLocked:function(be){z=be},setClear:function(be,he,Je,pt,Bt){Bt===!0&&(be*=pt,he*=pt,Je*=pt),Me.set(be,he,Je,pt),ke.equals(Me)===!1&&(r.clearColor(be,he,Je,pt),ke.copy(Me))},reset:function(){z=!1,te=null,ke.set(-1,0,0,0)}}}function i(){let z=!1,Me=!1,te=null,ke=null,be=null;return{setReversed:function(he){if(Me!==he){const Je=e.get("EXT_clip_control");he?Je.clipControlEXT(Je.LOWER_LEFT_EXT,Je.ZERO_TO_ONE_EXT):Je.clipControlEXT(Je.LOWER_LEFT_EXT,Je.NEGATIVE_ONE_TO_ONE_EXT),Me=he;const pt=be;be=null,this.setClear(pt)}},getReversed:function(){return Me},setTest:function(he){he?ve(r.DEPTH_TEST):qe(r.DEPTH_TEST)},setMask:function(he){te!==he&&!z&&(r.depthMask(he),te=he)},setFunc:function(he){if(Me&&(he=pm[he]),ke!==he){switch(he){case ao:r.depthFunc(r.NEVER);break;case oo:r.depthFunc(r.ALWAYS);break;case lo:r.depthFunc(r.LESS);break;case os:r.depthFunc(r.LEQUAL);break;case co:r.depthFunc(r.EQUAL);break;case ho:r.depthFunc(r.GEQUAL);break;case uo:r.depthFunc(r.GREATER);break;case fo:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}ke=he}},setLocked:function(he){z=he},setClear:function(he){be!==he&&(be=he,Me&&(he=1-he),r.clearDepth(he))},reset:function(){z=!1,te=null,ke=null,be=null,Me=!1}}}function n(){let z=!1,Me=null,te=null,ke=null,be=null,he=null,Je=null,pt=null,Bt=null;return{setTest:function(Rt){z||(Rt?ve(r.STENCIL_TEST):qe(r.STENCIL_TEST))},setMask:function(Rt){Me!==Rt&&!z&&(r.stencilMask(Rt),Me=Rt)},setFunc:function(Rt,Li,ci){(te!==Rt||ke!==Li||be!==ci)&&(r.stencilFunc(Rt,Li,ci),te=Rt,ke=Li,be=ci)},setOp:function(Rt,Li,ci){(he!==Rt||Je!==Li||pt!==ci)&&(r.stencilOp(Rt,Li,ci),he=Rt,Je=Li,pt=ci)},setLocked:function(Rt){z=Rt},setClear:function(Rt){Bt!==Rt&&(r.clearStencil(Rt),Bt=Rt)},reset:function(){z=!1,Me=null,te=null,ke=null,be=null,he=null,Je=null,pt=null,Bt=null}}}const s=new t,a=new i,o=new n,l=new WeakMap,c=new WeakMap;let u={},d={},h={},f=new WeakMap,p=[],v=null,g=!1,m=null,_=null,x=null,M=null,R=null,E=null,I=null,y=new He(0,0,0),w=0,U=!1,L=null,O=null,q=null,W=null,B=null;const k=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Y=!1,re=0;const le=r.getParameter(r.VERSION);le.indexOf("WebGL")!==-1?(re=parseFloat(/^WebGL (\d)/.exec(le)[1]),Y=re>=1):le.indexOf("OpenGL ES")!==-1&&(re=parseFloat(/^OpenGL ES (\d)/.exec(le)[1]),Y=re>=2);let de=null,De={};const Ue=r.getParameter(r.SCISSOR_BOX),Ke=r.getParameter(r.VIEWPORT),yt=new Pt().fromArray(Ue),ot=new Pt().fromArray(Ke);function J(z,Me,te,ke){const be=new Uint8Array(4),he=r.createTexture();r.bindTexture(z,he),r.texParameteri(z,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(z,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let Je=0;Je<te;Je++)z===r.TEXTURE_3D||z===r.TEXTURE_2D_ARRAY?r.texImage3D(Me,0,r.RGBA,1,1,ke,0,r.RGBA,r.UNSIGNED_BYTE,be):r.texImage2D(Me+Je,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,be);return he}const Ie={};Ie[r.TEXTURE_2D]=J(r.TEXTURE_2D,r.TEXTURE_2D,1),Ie[r.TEXTURE_CUBE_MAP]=J(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),Ie[r.TEXTURE_2D_ARRAY]=J(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),Ie[r.TEXTURE_3D]=J(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),ve(r.DEPTH_TEST),a.setFunc(os),Fe(!1),Pe(Sc),ve(r.CULL_FACE),me(zi);function ve(z){u[z]!==!0&&(r.enable(z),u[z]=!0)}function qe(z){u[z]!==!1&&(r.disable(z),u[z]=!1)}function et(z,Me){return h[z]!==Me?(r.bindFramebuffer(z,Me),h[z]=Me,z===r.DRAW_FRAMEBUFFER&&(h[r.FRAMEBUFFER]=Me),z===r.FRAMEBUFFER&&(h[r.DRAW_FRAMEBUFFER]=Me),!0):!1}function Qe(z,Me){let te=p,ke=!1;if(z){te=f.get(Me),te===void 0&&(te=[],f.set(Me,te));const be=z.textures;if(te.length!==be.length||te[0]!==r.COLOR_ATTACHMENT0){for(let he=0,Je=be.length;he<Je;he++)te[he]=r.COLOR_ATTACHMENT0+he;te.length=be.length,ke=!0}}else te[0]!==r.BACK&&(te[0]=r.BACK,ke=!0);ke&&r.drawBuffers(te)}function Tt(z){return v!==z?(r.useProgram(z),v=z,!0):!1}const tt={[En]:r.FUNC_ADD,[xd]:r.FUNC_SUBTRACT,[Md]:r.FUNC_REVERSE_SUBTRACT};tt[Sd]=r.MIN,tt[bd]=r.MAX;const ie={[Td]:r.ZERO,[wd]:r.ONE,[Ed]:r.SRC_COLOR,[so]:r.SRC_ALPHA,[Ld]:r.SRC_ALPHA_SATURATE,[Id]:r.DST_COLOR,[Cd]:r.DST_ALPHA,[Ad]:r.ONE_MINUS_SRC_COLOR,[ro]:r.ONE_MINUS_SRC_ALPHA,[Pd]:r.ONE_MINUS_DST_COLOR,[Rd]:r.ONE_MINUS_DST_ALPHA,[Ud]:r.CONSTANT_COLOR,[Nd]:r.ONE_MINUS_CONSTANT_COLOR,[Dd]:r.CONSTANT_ALPHA,[Od]:r.ONE_MINUS_CONSTANT_ALPHA};function me(z,Me,te,ke,be,he,Je,pt,Bt,Rt){if(z===zi){g===!0&&(qe(r.BLEND),g=!1);return}if(g===!1&&(ve(r.BLEND),g=!0),z!==yd){if(z!==m||Rt!==U){if((_!==En||R!==En)&&(r.blendEquation(r.FUNC_ADD),_=En,R=En),Rt)switch(z){case ss:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case bc:r.blendFunc(r.ONE,r.ONE);break;case Tc:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case wc:r.blendFuncSeparate(r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ZERO,r.ONE);break;default:Ze("WebGLState: Invalid blending: ",z);break}else switch(z){case ss:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case bc:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE,r.ONE,r.ONE);break;case Tc:Ze("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case wc:Ze("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Ze("WebGLState: Invalid blending: ",z);break}x=null,M=null,E=null,I=null,y.set(0,0,0),w=0,m=z,U=Rt}return}be=be||Me,he=he||te,Je=Je||ke,(Me!==_||be!==R)&&(r.blendEquationSeparate(tt[Me],tt[be]),_=Me,R=be),(te!==x||ke!==M||he!==E||Je!==I)&&(r.blendFuncSeparate(ie[te],ie[ke],ie[he],ie[Je]),x=te,M=ke,E=he,I=Je),(pt.equals(y)===!1||Bt!==w)&&(r.blendColor(pt.r,pt.g,pt.b,Bt),y.copy(pt),w=Bt),m=z,U=!1}function ae(z,Me){z.side===Fi?qe(r.CULL_FACE):ve(r.CULL_FACE);let te=z.side===pi;Me&&(te=!te),Fe(te),z.blending===ss&&z.transparent===!1?me(zi):me(z.blending,z.blendEquation,z.blendSrc,z.blendDst,z.blendEquationAlpha,z.blendSrcAlpha,z.blendDstAlpha,z.blendColor,z.blendAlpha,z.premultipliedAlpha),a.setFunc(z.depthFunc),a.setTest(z.depthTest),a.setMask(z.depthWrite),s.setMask(z.colorWrite);const ke=z.stencilWrite;o.setTest(ke),ke&&(o.setMask(z.stencilWriteMask),o.setFunc(z.stencilFunc,z.stencilRef,z.stencilFuncMask),o.setOp(z.stencilFail,z.stencilZFail,z.stencilZPass)),N(z.polygonOffset,z.polygonOffsetFactor,z.polygonOffsetUnits),z.alphaToCoverage===!0?ve(r.SAMPLE_ALPHA_TO_COVERAGE):qe(r.SAMPLE_ALPHA_TO_COVERAGE)}function Fe(z){L!==z&&(z?r.frontFace(r.CW):r.frontFace(r.CCW),L=z)}function Pe(z){z!==gd?(ve(r.CULL_FACE),z!==O&&(z===Sc?r.cullFace(r.BACK):z===vd?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):qe(r.CULL_FACE),O=z}function at(z){z!==q&&(Y&&r.lineWidth(z),q=z)}
vendor: 9,753 bytes, line 4088
4088function N(z,Me,te){z?(ve(r.POLYGON_OFFSET_FILL),(W!==Me||B!==te)&&(W=Me,B=te,a.getReversed()&&(Me=-Me),r.polygonOffset(Me,te))):qe(r.POLYGON_OFFSET_FILL)}function ht(z){z?ve(r.SCISSOR_TEST):qe(r.SCISSOR_TEST)}function We(z){z===void 0&&(z=r.TEXTURE0+k-1),de!==z&&(r.activeTexture(z),de=z)}function it(z,Me,te){te===void 0&&(de===null?te=r.TEXTURE0+k-1:te=de);let ke=De[te];ke===void 0&&(ke={type:void 0,texture:void 0},De[te]=ke),(ke.type!==z||ke.texture!==Me)&&(de!==te&&(r.activeTexture(te),de=te),r.bindTexture(z,Me||Ie[z]),ke.type=z,ke.texture=Me)}function _e(){const z=De[de];z!==void 0&&z.type!==void 0&&(r.bindTexture(z.type,null),z.type=void 0,z.texture=void 0)}function Et(){try{r.compressedTexImage2D(...arguments)}catch(z){Ze("WebGLState:",z)}}function C(){try{r.compressedTexImage3D(...arguments)}catch(z){Ze("WebGLState:",z)}}function b(){try{r.texSubImage2D(...arguments)}catch(z){Ze("WebGLState:",z)}}function X(){try{r.texSubImage3D(...arguments)}catch(z){Ze("WebGLState:",z)}}function ee(){try{r.compressedTexSubImage2D(...arguments)}catch(z){Ze("WebGLState:",z)}}function oe(){try{r.compressedTexSubImage3D(...arguments)}catch(z){Ze("WebGLState:",z)}}function xe(){try{r.texStorage2D(...arguments)}catch(z){Ze("WebGLState:",z)}}function Se(){try{r.texStorage3D(...arguments)}catch(z){Ze("WebGLState:",z)}}function $(){try{r.texImage2D(...arguments)}catch(z){Ze("WebGLState:",z)}}function j(){try{r.texImage3D(...arguments)}catch(z){Ze("WebGLState:",z)}}function Be(z){return d[z]!==void 0?d[z]:r.getParameter(z)}function ze(z,Me){d[z]!==Me&&(r.pixelStorei(z,Me),d[z]=Me)}function pe(z){yt.equals(z)===!1&&(r.scissor(z.x,z.y,z.z,z.w),yt.copy(z))}function ce(z){ot.equals(z)===!1&&(r.viewport(z.x,z.y,z.z,z.w),ot.copy(z))}function ut(z,Me){let te=c.get(Me);te===void 0&&(te=new WeakMap,c.set(Me,te));let ke=te.get(z);ke===void 0&&(ke=r.getUniformBlockIndex(Me,z.name),te.set(z,ke))}function ne(z,Me){const ke=c.get(Me).get(z);l.get(Me)!==ke&&(r.uniformBlockBinding(Me,ke,z.__bindingPointIndex),l.set(Me,ke))}function Mt(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),a.setReversed(!1),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),r.pixelStorei(r.PACK_ALIGNMENT,4),r.pixelStorei(r.UNPACK_ALIGNMENT,4),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.BROWSER_DEFAULT_WEBGL),r.pixelStorei(r.PACK_ROW_LENGTH,0),r.pixelStorei(r.PACK_SKIP_PIXELS,0),r.pixelStorei(r.PACK_SKIP_ROWS,0),r.pixelStorei(r.UNPACK_ROW_LENGTH,0),r.pixelStorei(r.UNPACK_IMAGE_HEIGHT,0),r.pixelStorei(r.UNPACK_SKIP_PIXELS,0),r.pixelStorei(r.UNPACK_SKIP_ROWS,0),r.pixelStorei(r.UNPACK_SKIP_IMAGES,0),u={},d={},de=null,De={},h={},f=new WeakMap,p=[],v=null,g=!1,m=null,_=null,x=null,M=null,R=null,E=null,I=null,y=new He(0,0,0),w=0,U=!1,L=null,O=null,q=null,W=null,B=null,yt.set(0,0,r.canvas.width,r.canvas.height),ot.set(0,0,r.canvas.width,r.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:ve,disable:qe,bindFramebuffer:et,drawBuffers:Qe,useProgram:Tt,setBlending:me,setMaterial:ae,setFlipSided:Fe,setCullFace:Pe,setLineWidth:at,setPolygonOffset:N,setScissorTest:ht,activeTexture:We,bindTexture:it,unbindTexture:_e,compressedTexImage2D:Et,compressedTexImage3D:C,texImage2D:$,texImage3D:j,pixelStorei:ze,getParameter:Be,updateUBOMapping:ut,uniformBlockBinding:ne,texStorage2D:xe,texStorage3D:Se,texSubImage2D:b,texSubImage3D:X,compressedTexSubImage2D:ee,compressedTexSubImage3D:oe,scissor:pe,viewport:ce,reset:Mt}}function KM(r,e,t,i,n,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new se,u=new WeakMap,d=new Set;let h;const f=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(C,b){return p?new OffscreenCanvas(C,b):Vr("canvas")}function g(C,b,X){let ee=1;const oe=Et(C);if((oe.width>X||oe.height>X)&&(ee=X/Math.max(oe.width,oe.height)),ee<1)if(typeof HTMLImageElement<"u"&&C instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&C instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&C instanceof ImageBitmap||typeof VideoFrame<"u"&&C instanceof VideoFrame){const xe=Math.floor(ee*oe.width),Se=Math.floor(ee*oe.height);h===void 0&&(h=v(xe,Se));const $=b?v(xe,Se):h;return $.width=xe,$.height=Se,$.getContext("2d").drawImage(C,0,0,xe,Se),Re("WebGLRenderer: Texture has been resized from ("+oe.width+"x"+oe.height+") to ("+xe+"x"+Se+")."),$}else return"data"in C&&Re("WebGLRenderer: Image in DataTexture is too big ("+oe.width+"x"+oe.height+")."),C;return C}function m(C){return C.generateMipmaps}function _(C){r.generateMipmap(C)}function x(C){return C.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:C.isWebGL3DRenderTarget?r.TEXTURE_3D:C.isWebGLArrayRenderTarget||C.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function M(C,b,X,ee,oe,xe=!1){if(C!==null){if(r[C]!==void 0)return r[C];Re("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+C+"'")}let Se;ee&&(Se=e.get("EXT_texture_norm16"),Se||Re("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let $=b;if(b===r.RED&&(X===r.FLOAT&&($=r.R32F),X===r.HALF_FLOAT&&($=r.R16F),X===r.UNSIGNED_BYTE&&($=r.R8),X===r.UNSIGNED_SHORT&&Se&&($=Se.R16_EXT),X===r.SHORT&&Se&&($=Se.R16_SNORM_EXT)),b===r.RED_INTEGER&&(X===r.UNSIGNED_BYTE&&($=r.R8UI),X===r.UNSIGNED_SHORT&&($=r.R16UI),X===r.UNSIGNED_INT&&($=r.R32UI),X===r.BYTE&&($=r.R8I),X===r.SHORT&&($=r.R16I),X===r.INT&&($=r.R32I)),b===r.RG&&(X===r.FLOAT&&($=r.RG32F),X===r.HALF_FLOAT&&($=r.RG16F),X===r.UNSIGNED_BYTE&&($=r.RG8),X===r.UNSIGNED_SHORT&&Se&&($=Se.RG16_EXT),X===r.SHORT&&Se&&($=Se.RG16_SNORM_EXT)),b===r.RG_INTEGER&&(X===r.UNSIGNED_BYTE&&($=r.RG8UI),X===r.UNSIGNED_SHORT&&($=r.RG16UI),X===r.UNSIGNED_INT&&($=r.RG32UI),X===r.BYTE&&($=r.RG8I),X===r.SHORT&&($=r.RG16I),X===r.INT&&($=r.RG32I)),b===r.RGB_INTEGER&&(X===r.UNSIGNED_BYTE&&($=r.RGB8UI),X===r.UNSIGNED_SHORT&&($=r.RGB16UI),X===r.UNSIGNED_INT&&($=r.RGB32UI),X===r.BYTE&&($=r.RGB8I),X===r.SHORT&&($=r.RGB16I),X===r.INT&&($=r.RGB32I)),b===r.RGBA_INTEGER&&(X===r.UNSIGNED_BYTE&&($=r.RGBA8UI),X===r.UNSIGNED_SHORT&&($=r.RGBA16UI),X===r.UNSIGNED_INT&&($=r.RGBA32UI),X===r.BYTE&&($=r.RGBA8I),X===r.SHORT&&($=r.RGBA16I),X===r.INT&&($=r.RGBA32I)),b===r.RGB&&(X===r.UNSIGNED_SHORT&&Se&&($=Se.RGB16_EXT),X===r.SHORT&&Se&&($=Se.RGB16_SNORM_EXT),X===r.UNSIGNED_INT_5_9_9_9_REV&&($=r.RGB9_E5),X===r.UNSIGNED_INT_10F_11F_11F_REV&&($=r.R11F_G11F_B10F)),b===r.RGBA){const j=xe?zr:bt.getTransfer(oe);X===r.FLOAT&&($=r.RGBA32F),X===r.HALF_FLOAT&&($=r.RGBA16F),X===r.UNSIGNED_BYTE&&($=j===It?r.SRGB8_ALPHA8:r.RGBA8),X===r.UNSIGNED_SHORT&&Se&&($=Se.RGBA16_EXT),X===r.SHORT&&Se&&($=Se.RGBA16_SNORM_EXT),X===r.UNSIGNED_SHORT_4_4_4_4&&($=r.RGBA4),X===r.UNSIGNED_SHORT_5_5_5_1&&($=r.RGB5_A1)}return($===r.R16F||$===r.R32F||$===r.RG16F||$===r.RG32F||$===r.RGBA16F||$===r.RGBA32F)&&e.get("EXT_color_buffer_float"),$}function R(C,b){let X;return C?b===null||b===Ci||b===Ws?X=r.DEPTH24_STENCIL8:b===Ft?X=r.DEPTH32F_STENCIL8:b===Gs&&(X=r.DEPTH24_STENCIL8,Re("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):b===null||b===Ci||b===Ws?X=r.DEPTH_COMPONENT24:b===Ft?X=r.DEPTH_COMPONENT32F:b===Gs&&(X=r.DEPTH_COMPONENT16),X}function E(C,b){return m(C)===!0||C.isFramebufferTexture&&C.minFilter!==Zt&&C.minFilter!==wt?Math.log2(Math.max(b.width,b.height))+1:C.mipmaps!==void 0&&C.mipmaps.length>0?C.mipmaps.length:C.isCompressedTexture&&Array.isArray(C.image)?b.mipmaps.length:1}function I(C){const b=C.target;b.removeEventListener("dispose",I),w(b),b.isVideoTexture&&u.delete(b),b.isHTMLTexture&&d.delete(b)}function y(C){const b=C.target;b.removeEventListener("dispose",y),L(b)}function w(C){const b=i.get(C);if(b.__webglInit===void 0)return;const X=C.source,ee=f.get(X);if(ee){const oe=ee[b.__cacheKey];oe.usedTimes--,oe.usedTimes===0&&U(C),Object.keys(ee).length===0&&f.delete(X)}i.remove(C)}function U(C){const b=i.get(C);r.deleteTexture(b.__webglTexture);const X=C.source,ee=f.get(X);delete ee[b.__cacheKey],a.memory.textures--}function L(C){const b=i.get(C);if(C.depthTexture&&(C.depthTexture.dispose(),i.remove(C.depthTexture)),C.isWebGLCubeRenderTarget)for(let ee=0;ee<6;ee++){if(Array.isArray(b.__webglFramebuffer[ee]))for(let oe=0;oe<b.__webglFramebuffer[ee].length;oe++)r.deleteFramebuffer(b.__webglFramebuffer[ee][oe]);else r.deleteFramebuffer(b.__webglFramebuffer[ee]);b.__webglDepthbuffer&&r.deleteRenderbuffer(b.__webglDepthbuffer[ee])}else{if(Array.isArray(b.__webglFramebuffer))for(let ee=0;ee<b.__webglFramebuffer.length;ee++)r.deleteFramebuffer(b.__webglFramebuffer[ee]);else r.deleteFramebuffer(b.__webglFramebuffer);if(b.__webglDepthbuffer&&r.deleteRenderbuffer(b.__webglDepthbuffer),b.__webglMultisampledFramebuffer&&r.deleteFramebuffer(b.__webglMultisampledFramebuffer),b.__webglColorRen
vendor: 5,451 bytes, line 4088
4088derbuffer)for(let ee=0;ee<b.__webglColorRenderbuffer.length;ee++)b.__webglColorRenderbuffer[ee]&&r.deleteRenderbuffer(b.__webglColorRenderbuffer[ee]);b.__webglDepthRenderbuffer&&r.deleteRenderbuffer(b.__webglDepthRenderbuffer)}const X=C.textures;for(let ee=0,oe=X.length;ee<oe;ee++){const xe=i.get(X[ee]);xe.__webglTexture&&(r.deleteTexture(xe.__webglTexture),a.memory.textures--),i.remove(X[ee])}i.remove(C)}let O=0;function q(){O=0}function W(){return O}function B(C){O=C}function k(){const C=O;return C>=n.maxTextures&&Re("WebGLTextures: Trying to use "+C+" texture units while this GPU supports only "+n.maxTextures),O+=1,C}function Y(C){const b=[];return b.push(C.wrapS),b.push(C.wrapT),b.push(C.wrapR||0),b.push(C.magFilter),b.push(C.minFilter),b.push(C.anisotropy),b.push(C.internalFormat),b.push(C.format),b.push(C.type),b.push(C.generateMipmaps),b.push(C.premultiplyAlpha),b.push(C.flipY),b.push(C.unpackAlignment),b.push(C.colorSpace),b.join()}function re(C,b){const X=i.get(C);if(C.isVideoTexture&&it(C),C.isRenderTargetTexture===!1&&C.isExternalTexture!==!0&&C.version>0&&X.__version!==C.version){const ee=C.image;if(ee===null)Re("WebGLRenderer: Texture marked for update but no image data found.");else if(ee.complete===!1)Re("WebGLRenderer: Texture marked for update but image is incomplete");else{qe(X,C,b);return}}else C.isExternalTexture&&(X.__webglTexture=C.sourceTexture?C.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,X.__webglTexture,r.TEXTURE0+b)}function le(C,b){const X=i.get(C);if(C.isRenderTargetTexture===!1&&C.version>0&&X.__version!==C.version){qe(X,C,b);return}else C.isExternalTexture&&(X.__webglTexture=C.sourceTexture?C.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,X.__webglTexture,r.TEXTURE0+b)}function de(C,b){const X=i.get(C);if(C.isRenderTargetTexture===!1&&C.version>0&&X.__version!==C.version){qe(X,C,b);return}t.bindTexture(r.TEXTURE_3D,X.__webglTexture,r.TEXTURE0+b)}function De(C,b){const X=i.get(C);if(C.isCubeDepthTexture!==!0&&C.version>0&&X.__version!==C.version){et(X,C,b);return}t.bindTexture(r.TEXTURE_CUBE_MAP,X.__webglTexture,r.TEXTURE0+b)}const Ue={[Ur]:r.REPEAT,[Gt]:r.CLAMP_TO_EDGE,[Nr]:r.MIRRORED_REPEAT},Ke={[Zt]:r.NEAREST,[Jc]:r.NEAREST_MIPMAP_NEAREST,[zs]:r.NEAREST_MIPMAP_LINEAR,[wt]:r.LINEAR,[wr]:r.LINEAR_MIPMAP_NEAREST,[$i]:r.LINEAR_MIPMAP_LINEAR},yt={[Xd]:r.NEVER,[$d]:r.ALWAYS,[qd]:r.LESS,[sl]:r.LEQUAL,[Yd]:r.EQUAL,[rl]:r.GEQUAL,[Zd]:r.GREATER,[Jd]:r.NOTEQUAL};function ot(C,b){if(b.type===Ft&&e.has("OES_texture_float_linear")===!1&&(b.magFilter===wt||b.magFilter===wr||b.magFilter===zs||b.magFilter===$i||b.minFilter===wt||b.minFilter===wr||b.minFilter===zs||b.minFilter===$i)&&Re("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(C,r.TEXTURE_WRAP_S,Ue[b.wrapS]),r.texParameteri(C,r.TEXTURE_WRAP_T,Ue[b.wrapT]),(C===r.TEXTURE_3D||C===r.TEXTURE_2D_ARRAY)&&r.texParameteri(C,r.TEXTURE_WRAP_R,Ue[b.wrapR]),r.texParameteri(C,r.TEXTURE_MAG_FILTER,Ke[b.magFilter]),r.texParameteri(C,r.TEXTURE_MIN_FILTER,Ke[b.minFilter]),b.compareFunction&&(r.texParameteri(C,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(C,r.TEXTURE_COMPARE_FUNC,yt[b.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(b.magFilter===Zt||b.minFilter!==zs&&b.minFilter!==$i||b.type===Ft&&e.has("OES_texture_float_linear")===!1)return;if(b.anisotropy>1||i.get(b).__currentAnisotropy){const X=e.get("EXT_texture_filter_anisotropic");r.texParameterf(C,X.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(b.anisotropy,n.getMaxAnisotropy())),i.get(b).__currentAnisotropy=b.anisotropy}}}function J(C,b){let X=!1;C.__webglInit===void 0&&(C.__webglInit=!0,b.addEventListener("dispose",I));const ee=b.source;let oe=f.get(ee);oe===void 0&&(oe={},f.set(ee,oe));const xe=Y(b);if(xe!==C.__cacheKey){oe[xe]===void 0&&(oe[xe]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,X=!0),oe[xe].usedTimes++;const Se=oe[C.__cacheKey];Se!==void 0&&(oe[C.__cacheKey].usedTimes--,Se.usedTimes===0&&U(b)),C.__cacheKey=xe,C.__webglTexture=oe[xe].texture}return X}function Ie(C,b,X){return Math.floor(Math.floor(C/X)/b)}function ve(C,b,X,ee){const xe=C.updateRanges;if(xe.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,b.width,b.height,X,ee,b.data);else{xe.sort((ze,pe)=>ze.start-pe.start);let Se=0;for(let ze=1;ze<xe.length;ze++){const pe=xe[Se],ce=xe[ze],ut=pe.start+pe.count,ne=Ie(ce.start,b.width,4),Mt=Ie(pe.start,b.width,4);ce.start<=ut+1&&ne===Mt&&Ie(ce.start+ce.count-1,b.width,4)===ne?pe.count=Math.max(pe.count,ce.start+ce.count-pe.start):(++Se,xe[Se]=ce)}xe.length=Se+1;const $=t.getParameter(r.UNPACK_ROW_LENGTH),j=t.getParameter(r.UNPACK_SKIP_PIXELS),Be=t.getParameter(r.UNPACK_SKIP_ROWS);t.pixelStorei(r.UNPACK_ROW_LENGTH,b.width);for(let ze=0,pe=xe.length;ze<pe;ze++){const ce=xe[ze],ut=Math.floor(ce.start/4),ne=Math.ceil(ce.count/4),Mt=ut%b.width,z=Math.floor(ut/b.width),Me=ne,te=1;t.pixelStorei(r.UNPACK_SKIP_PIXELS,Mt),t.pixelStorei(r.UNPACK_SKIP_ROWS,z),t.texSubImage2D(r.TEXTURE_2D,0,Mt,z,Me,te,X,ee,b.data)}C.clearUpdateRanges(),t.pixelStorei(r.UNPACK_ROW_LENGTH,$),t.pixelStorei(r.UNPACK_SKIP_PIXELS,j),t.pixelStorei(r.UNPACK_SKIP_ROWS,Be)}}function qe(C,b,X){let ee=r.TEXTURE_2D;(b.isDataArrayTexture||b.isCompressedArrayTexture)&&(ee=r.TEXTURE_2D_ARRAY),b.isData3DTexture&&(ee=r.TEXTURE_3D);const oe=J(C,b),xe=b.source;t.bindTexture(ee,C.__webglTexture,r.TEXTURE0+X);const Se=i.get(xe);
vendor: 5,413 bytes, line 4088
4088if(xe.version!==Se.__version||oe===!0){if(t.activeTexture(r.TEXTURE0+X),(typeof ImageBitmap<"u"&&b.image instanceof ImageBitmap)===!1){const te=bt.getPrimaries(bt.workingColorSpace),ke=b.colorSpace===ln?null:bt.getPrimaries(b.colorSpace),be=b.colorSpace===ln||te===ke?r.NONE:r.BROWSER_DEFAULT_WEBGL;t.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,b.flipY),t.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),t.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,be)}t.pixelStorei(r.UNPACK_ALIGNMENT,b.unpackAlignment);let j=g(b.image,!1,n.maxTextureSize);j=_e(b,j);const Be=s.convert(b.format,b.colorSpace),ze=s.convert(b.type);let pe=M(b.internalFormat,Be,ze,b.normalized,b.colorSpace,b.isVideoTexture);ot(ee,b);let ce;const ut=b.mipmaps,ne=b.isVideoTexture!==!0,Mt=Se.__version===void 0||oe===!0,z=xe.dataReady,Me=E(b,j);if(b.isDepthTexture)pe=R(b.format===An,b.type),Mt&&(ne?t.texStorage2D(r.TEXTURE_2D,1,pe,j.width,j.height):t.texImage2D(r.TEXTURE_2D,0,pe,j.width,j.height,0,Be,ze,null));else if(b.isDataTexture)if(ut.length>0){ne&&Mt&&t.texStorage2D(r.TEXTURE_2D,Me,pe,ut[0].width,ut[0].height);for(let te=0,ke=ut.length;te<ke;te++)ce=ut[te],ne?z&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,ce.width,ce.height,Be,ze,ce.data):t.texImage2D(r.TEXTURE_2D,te,pe,ce.width,ce.height,0,Be,ze,ce.data);b.generateMipmaps=!1}else ne?(Mt&&t.texStorage2D(r.TEXTURE_2D,Me,pe,j.width,j.height),z&&ve(b,j,Be,ze)):t.texImage2D(r.TEXTURE_2D,0,pe,j.width,j.height,0,Be,ze,j.data);else if(b.isCompressedTexture)if(b.isCompressedArrayTexture){ne&&Mt&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Me,pe,ut[0].width,ut[0].height,j.depth);for(let te=0,ke=ut.length;te<ke;te++)if(ce=ut[te],b.format!==Kt)if(Be!==null)if(ne){if(z)if(b.layerUpdates.size>0){const be=Bc(ce.width,ce.height,b.format,b.type);for(const he of b.layerUpdates){const Je=ce.data.subarray(he*be/ce.data.BYTES_PER_ELEMENT,(he+1)*be/ce.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,he,ce.width,ce.height,1,Be,Je)}b.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,0,ce.width,ce.height,j.depth,Be,ce.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,te,pe,ce.width,ce.height,j.depth,0,ce.data,0,0);else Re("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else ne?z&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,te,0,0,0,ce.width,ce.height,j.depth,Be,ze,ce.data):t.texImage3D(r.TEXTURE_2D_ARRAY,te,pe,ce.width,ce.height,j.depth,0,Be,ze,ce.data)}else{ne&&Mt&&t.texStorage2D(r.TEXTURE_2D,Me,pe,ut[0].width,ut[0].height);for(let te=0,ke=ut.length;te<ke;te++)ce=ut[te],b.format!==Kt?Be!==null?ne?z&&t.compressedTexSubImage2D(r.TEXTURE_2D,te,0,0,ce.width,ce.height,Be,ce.data):t.compressedTexImage2D(r.TEXTURE_2D,te,pe,ce.width,ce.height,0,ce.data):Re("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ne?z&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,ce.width,ce.height,Be,ze,ce.data):t.texImage2D(r.TEXTURE_2D,te,pe,ce.width,ce.height,0,Be,ze,ce.data)}else if(b.isDataArrayTexture)if(ne){if(Mt&&t.texStorage3D(r.TEXTURE_2D_ARRAY,Me,pe,j.width,j.height,j.depth),z)if(b.layerUpdates.size>0){const te=Bc(j.width,j.height,b.format,b.type);for(const ke of b.layerUpdates){const be=j.data.subarray(ke*te/j.data.BYTES_PER_ELEMENT,(ke+1)*te/j.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,ke,j.width,j.height,1,Be,ze,be)}b.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,j.width,j.height,j.depth,Be,ze,j.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,pe,j.width,j.height,j.depth,0,Be,ze,j.data);else if(b.isData3DTexture)ne?(Mt&&t.texStorage3D(r.TEXTURE_3D,Me,pe,j.width,j.height,j.depth),z&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,j.width,j.height,j.depth,Be,ze,j.data)):t.texImage3D(r.TEXTURE_3D,0,pe,j.width,j.height,j.depth,0,Be,ze,j.data);else if(b.isFramebufferTexture){if(Mt)if(ne)t.texStorage2D(r.TEXTURE_2D,Me,pe,j.width,j.height);else{let te=j.width,ke=j.height;for(let be=0;be<Me;be++)t.texImage2D(r.TEXTURE_2D,be,pe,te,ke,0,Be,ze,null),te>>=1,ke>>=1}}else if(b.isHTMLTexture){if("texElementImage2D"in r){const te=r.canvas;if(te.hasAttribute("layoutsubtree")||te.setAttribute("layoutsubtree","true"),j.parentNode!==te){te.appendChild(j),d.add(b),te.onpaint=pt=>{const Bt=pt.changedElements;for(const Rt of d)Bt.includes(Rt.image)&&(Rt.needsUpdate=!0)},te.requestPaint();return}const ke=0,be=r.RGBA,he=r.RGBA,Je=r.UNSIGNED_BYTE;r.texElementImage2D(r.TEXTURE_2D,ke,be,he,Je,j),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE)}}else if(ut.length>0){if(ne&&Mt){const te=Et(ut[0]);t.texStorage2D(r.TEXTURE_2D,Me,pe,te.width,te.height)}for(let te=0,ke=ut.length;te<ke;te++)ce=ut[te],ne?z&&t.texSubImage2D(r.TEXTURE_2D,te,0,0,Be,ze,ce):t.texImage2D(r.TEXTURE_2D,te,pe,Be,ze,ce);b.generateMipmaps=!1}else if(ne){if(Mt){const te=Et(j);t.texStorage2D(r.TEXTURE_2D,Me,pe,te.width,te.height)}z&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,Be,ze,j)}else t.texImage2D(r.TEXTURE_2D,0,pe,Be,ze,j);m(b)&&_(ee),Se.__version=xe.version,b.onUpdate&&b.onUpdate(b)}C.__version=b.version}function et(C,b,X){if(b.image.length!==6)return;const ee=J(C,b),oe=b.source;t.bindTexture(r.TEXTURE_CUBE_MAP,C.__webglTexture,r.TEXTURE0+X);const xe=i.get(oe);if(oe.version!==xe.__version||ee===!0){t.activeTexture(r.TEXTURE0+X);
vendor: 28,743 bytes, lines 4088-4112
4088const Se=bt.getPrimaries(bt.workingColorSpace),$=b.colorSpace===ln?null:bt.getPrimaries(b.colorSpace),j=b.colorSpace===ln||Se===$?r.NONE:r.BROWSER_DEFAULT_WEBGL;t.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,b.flipY),t.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.premultiplyAlpha),t.pixelStorei(r.UNPACK_ALIGNMENT,b.unpackAlignment),t.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,j);const Be=b.isCompressedTexture||b.image[0].isCompressedTexture,ze=b.image[0]&&b.image[0].isDataTexture,pe=[];for(let he=0;he<6;he++)!Be&&!ze?pe[he]=g(b.image[he],!0,n.maxCubemapSize):pe[he]=ze?b.image[he].image:b.image[he],pe[he]=_e(b,pe[he]);const ce=pe[0],ut=s.convert(b.format,b.colorSpace),ne=s.convert(b.type),Mt=M(b.internalFormat,ut,ne,b.normalized,b.colorSpace),z=b.isVideoTexture!==!0,Me=xe.__version===void 0||ee===!0,te=oe.dataReady;let ke=E(b,ce);ot(r.TEXTURE_CUBE_MAP,b);let be;if(Be){z&&Me&&t.texStorage2D(r.TEXTURE_CUBE_MAP,ke,Mt,ce.width,ce.height);for(let he=0;he<6;he++){be=pe[he].mipmaps;for(let Je=0;Je<be.length;Je++){const pt=be[Je];b.format!==Kt?ut!==null?z?te&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,Je,0,0,pt.width,pt.height,ut,pt.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,Je,Mt,pt.width,pt.height,0,pt.data):Re("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):z?te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,Je,0,0,pt.width,pt.height,ut,ne,pt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,Je,Mt,pt.width,pt.height,0,ut,ne,pt.data)}}}else{if(be=b.mipmaps,z&&Me){be.length>0&&ke++;const he=Et(pe[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,ke,Mt,he.width,he.height)}for(let he=0;he<6;he++)if(ze){z?te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,0,0,pe[he].width,pe[he].height,ut,ne,pe[he].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,Mt,pe[he].width,pe[he].height,0,ut,ne,pe[he].data);for(let Je=0;Je<be.length;Je++){const Bt=be[Je].image[he].image;z?te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,Je+1,0,0,Bt.width,Bt.height,ut,ne,Bt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,Je+1,Mt,Bt.width,Bt.height,0,ut,ne,Bt.data)}}else{z?te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,0,0,ut,ne,pe[he]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,0,Mt,ut,ne,pe[he]);for(let Je=0;Je<be.length;Je++){const pt=be[Je];z?te&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,Je+1,0,0,ut,ne,pt.image[he]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+he,Je+1,Mt,ut,ne,pt.image[he])}}}m(b)&&_(r.TEXTURE_CUBE_MAP),xe.__version=oe.version,b.onUpdate&&b.onUpdate(b)}C.__version=b.version}function Qe(C,b,X,ee,oe,xe){const Se=s.convert(X.format,X.colorSpace),$=s.convert(X.type),j=M(X.internalFormat,Se,$,X.normalized,X.colorSpace),Be=i.get(b),ze=i.get(X);if(ze.__renderTarget=b,!Be.__hasExternalTextures){const pe=Math.max(1,b.width>>xe),ce=Math.max(1,b.height>>xe);oe===r.TEXTURE_3D||oe===r.TEXTURE_2D_ARRAY?t.texImage3D(oe,xe,j,pe,ce,b.depth,0,Se,$,null):t.texImage2D(oe,xe,j,pe,ce,0,Se,$,null)}t.bindFramebuffer(r.FRAMEBUFFER,C),We(b)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,ee,oe,ze.__webglTexture,0,ht(b)):(oe===r.TEXTURE_2D||oe>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&oe<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,ee,oe,ze.__webglTexture,xe),t.bindFramebuffer(r.FRAMEBUFFER,null)}function Tt(C,b,X){if(r.bindRenderbuffer(r.RENDERBUFFER,C),b.depthBuffer){const ee=b.depthTexture,oe=ee&&ee.isDepthTexture?ee.type:null,xe=R(b.stencilBuffer,oe),Se=b.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;We(b)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,ht(b),xe,b.width,b.height):X?r.renderbufferStorageMultisample(r.RENDERBUFFER,ht(b),xe,b.width,b.height):r.renderbufferStorage(r.RENDERBUFFER,xe,b.width,b.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,Se,r.RENDERBUFFER,C)}else{const ee=b.textures;for(let oe=0;oe<ee.length;oe++){const xe=ee[oe],Se=s.convert(xe.format,xe.colorSpace),$=s.convert(xe.type),j=M(xe.internalFormat,Se,$,xe.normalized,xe.colorSpace);We(b)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,ht(b),j,b.width,b.height):X?r.renderbufferStorageMultisample(r.RENDERBUFFER,ht(b),j,b.width,b.height):r.renderbufferStorage(r.RENDERBUFFER,j,b.width,b.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function tt(C,b,X){const ee=b.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(r.FRAMEBUFFER,C),!(b.depthTexture&&b.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const oe=i.get(b.depthTexture);if(oe.__renderTarget=b,(!oe.__webglTexture||b.depthTexture.image.width!==b.width||b.depthTexture.image.height!==b.height)&&(b.depthTexture.image.width=b.width,b.depthTexture.image.height=b.height,b.depthTexture.needsUpdate=!0),ee){if(oe.__webglInit===void 0&&(oe.__webglInit=!0,b.depthTexture.addEventListener("dispose",I)),oe.__webglTexture===void 0){oe.__webglTexture=r.createTexture(),t.bindTexture(r.TEXTURE_CUBE_MAP,oe.__webglTexture),ot(r.TEXTURE_CUBE_MAP,b.depthTexture);const Be=s.convert(b.depthTexture.format),ze=s.convert(b.depthTexture.type);let pe;b.depthTexture.format===ji?pe=r.DEPTH_COMPONENT24:b.depthTexture.format===An&&(pe=r.DEPTH24_STENCIL8);for(let ce=0;ce<6;ce++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ce,0,pe,b.width,b.height,0,Be,ze,null)}}else re(b.depthTexture,0);const xe=oe.__webglTexture,Se=ht(b),$=ee?r.TEXTURE_CUBE_MAP_POSITIVE_X+X:r.TEXTURE_2D,j=b.depthTexture.format===An?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;if(b.depthTexture.format===ji)We(b)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,j,$,xe,0,Se):r.framebufferTexture2D(r.FRAMEBUFFER,j,$,xe,0);else if(b.depthTexture.format===An)We(b)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,j,$,xe,0,Se):r.framebufferTexture2D(r.FRAMEBUFFER,j,$,xe,0);else throw new Error("Unknown depthTexture format")}function ie(C){const b=i.get(C),X=C.isWebGLCubeRenderTarget===!0;if(b.__boundDepthTexture!==C.depthTexture){const ee=C.depthTexture;if(b.__depthDisposeCallback&&b.__depthDisposeCallback(),ee){const oe=()=>{delete b.__boundDepthTexture,delete b.__depthDisposeCallback,ee.removeEventListener("dispose",oe)};ee.addEventListener("dispose",oe),b.__depthDisposeCallback=oe}b.__boundDepthTexture=ee}if(C.depthTexture&&!b.__autoAllocateDepthBuffer)if(X)for(let ee=0;ee<6;ee++)tt(b.__webglFramebuffer[ee],C,ee);else{const ee=C.texture.mipmaps;ee&&ee.length>0?tt(b.__webglFramebuffer[0],C,0):tt(b.__webglFramebuffer,C,0)}else if(X){b.__webglDepthbuffer=[];for(let ee=0;ee<6;ee++)if(t.bindFramebuffer(r.FRAMEBUFFER,b.__webglFramebuffer[ee]),b.__webglDepthbuffer[ee]===void 0)b.__webglDepthbuffer[ee]=r.createRenderbuffer(),Tt(b.__webglDepthbuffer[ee],C,!1);else{const oe=C.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,xe=b.__webglDepthbuffer[ee];r.bindRenderbuffer(r.RENDERBUFFER,xe),r.framebufferRenderbuffer(r.FRAMEBUFFER,oe,r.RENDERBUFFER,xe)}}else{const ee=C.texture.mipmaps;if(ee&&ee.length>0?t.bindFramebuffer(r.FRAMEBUFFER,b.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,b.__webglFramebuffer),b.__webglDepthbuffer===void 0)b.__webglDepthbuffer=r.createRenderbuffer(),Tt(b.__webglDepthbuffer,C,!1);else{const oe=C.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,xe=b.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,xe),r.framebufferRenderbuffer(r.FRAMEBUFFER,oe,r.RENDERBUFFER,xe)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function me(C,b,X){const ee=i.get(C);b!==void 0&&Qe(ee.__webglFramebuffer,C,C.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),X!==void 0&&ie(C)}function ae(C){const b=C.texture,X=i.get(C),ee=i.get(b);C.addEventListener("dispose",y);const oe=C.textures,xe=C.isWebGLCubeRenderTarget===!0,Se=oe.length>1;if(Se||(ee.__webglTexture===void 0&&(ee.__webglTexture=r.createTexture()),ee.__version=b.version,a.memory.textures++),xe){X.__webglFramebuffer=[];for(let $=0;$<6;$++)if(b.mipmaps&&b.mipmaps.length>0){X.__webglFramebuffer[$]=[];for(let j=0;j<b.mipmaps.length;j++)X.__webglFramebuffer[$][j]=r.createFramebuffer()}else X.__webglFramebuffer[$]=r.createFramebuffer()}else{if(b.mipmaps&&b.mipmaps.length>0){X.__webglFramebuffer=[];for(let $=0;$<b.mipmaps.length;$++)X.__webglFramebuffer[$]=r.createFramebuffer()}else X.__webglFramebuffer=r.createFramebuffer();if(Se)for(let $=0,j=oe.length;$<j;$++){const Be=i.get(oe[$]);Be.__webglTexture===void 0&&(Be.__webglTexture=r.createTexture(),a.memory.textures++)}if(C.samples>0&&We(C)===!1){X.__webglMultisampledFramebuffer=r.createFramebuffer(),X.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,X.__webglMultisampledFramebuffer);for(let $=0;$<oe.length;$++){const j=oe[$];X.__webglColorRenderbuffer[$]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,X.__webglColorRenderbuffer[$]);const Be=s.convert(j.format,j.colorSpace),ze=s.convert(j.type),pe=M(j.internalFormat,Be,ze,j.normalized,j.colorSpace,C.isXRRenderTarget===!0),ce=ht(C);r.renderbufferStorageMultisample(r.RENDERBUFFER,ce,pe,C.width,C.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+$,r.RENDERBUFFER,X.__webglColorRenderbuffer[$])}r.bindRenderbuffer(r.RENDERBUFFER,null),C.depthBuffer&&(X.__webglDepthRenderbuffer=r.createRenderbuffer(),Tt(X.__webglDepthRenderbuffer,C,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(xe){t.bindTexture(r.TEXTURE_CUBE_MAP,ee.__webglTexture),ot(r.TEXTURE_CUBE_MAP,b);for(let $=0;$<6;$++)if(b.mipmaps&&b.mipmaps.length>0)for(let j=0;j<b.mipmaps.length;j++)Qe(X.__webglFramebuffer[$][j],C,b,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+$,j);else Qe(X.__webglFramebuffer[$],C,b,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+$,0);m(b)&&_(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(Se){for(let $=0,j=oe.length;$<j;$++){const Be=oe[$],ze=i.get(Be);let pe=r.TEXTURE_2D;(C.isWebGL3DRenderTarget||C.isWebGLArrayRenderTarget)&&(pe=C.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(pe,ze.__webglTexture),ot(pe,Be),Qe(X.__webglFramebuffer,C,Be,r.COLOR_ATTACHMENT0+$,pe,0),m(Be)&&_(pe)}t.unbindTexture()}else{let $=r.TEXTURE_2D;if((C.isWebGL3DRenderTarget||C.isWebGLArrayRenderTarget)&&($=C.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture($,ee.__webglTexture),ot($,b),b.mipmaps&&b.mipmaps.length>0)for(let j=0;j<b.mipmaps.length;j++)Qe(X.__webglFramebuffer[j],C,b,r.COLOR_ATTACHMENT0,$,j);else Qe(X.__webglFramebuffer,C,b,r.COLOR_ATTACHMENT0,$,0);m(b)&&_($),t.unbindTexture()}C.depthBuffer&&ie(C)}function Fe(C){const b=C.textures;for(let X=0,ee=b.length;X<ee;X++){const oe=b[X];if(m(oe)){const xe=x(C),Se=i.get(oe).__webglTexture;t.bindTexture(xe,Se),_(xe),t.unbindTexture()}}}const Pe=[],at=[];function N(C){if(C.samples>0){if(We(C)===!1){const b=C.textures,X=C.width,ee=C.height;let oe=r.COLOR_BUFFER_BIT;const xe=C.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Se=i.get(C),$=b.length>1;if($)for(let Be=0;Be<b.length;Be++)t.bindFramebuffer(r.FRAMEBUFFER,Se.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Be,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,Se.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Be,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,Se.__webglMultisampledFramebuffer);const j=C.texture.mipmaps;j&&j.length>0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Se.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Se.__webglFramebuffer);for(let Be=0;Be<b.length;Be++){if(C.resolveDepthBuffer&&(C.depthBuffer&&(oe|=r.DEPTH_BUFFER_BIT),C.stencilBuffer&&C.resolveStencilBuffer&&(oe|=r.STENCIL_BUFFER_BIT)),$){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Se.__webglColorRenderbuffer[Be]);const ze=i.get(b[Be]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,ze,0)}r.blitFramebuffer(0,0,X,ee,0,0,X,ee,oe,r.NEAREST),l===!0&&(Pe.length=0,at.length=0,Pe.push(r.COLOR_ATTACHMENT0+Be),C.depthBuffer&&C.resolveDepthBuffer===!1&&(Pe.push(xe),at.push(xe),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,at)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,Pe))}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),$)for(let Be=0;Be<b.length;Be++){t.bindFramebuffer(r.FRAMEBUFFER,Se.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Be,r.RENDERBUFFER,Se.__webglColorRenderbuffer[Be]);const ze=i.get(b[Be]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,Se.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Be,r.TEXTURE_2D,ze,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,Se.__webglMultisampledFramebuffer)}else if(C.depthBuffer&&C.resolveDepthBuffer===!1&&l){const b=C.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[b])}}}function ht(C){return Math.min(n.maxSamples,C.samples)}function We(C){const b=i.get(C);return C.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&b.__useRenderToTexture!==!1}function it(C){const b=a.render.frame;u.get(C)!==b&&(u.set(C,b),C.update())}function _e(C,b){const X=C.colorSpace,ee=C.format,oe=C.type;return C.isCompressedTexture===!0||C.isVideoTexture===!0||X!==Un&&X!==ln&&(bt.getTransfer(X)===It?(ee!==Kt||oe!==ii)&&Re("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Ze("WebGLTextures: Unsupported texture color space:",X)),b}function Et(C){return typeof HTMLImageElement<"u"&&C instanceof HTMLImageElement?(c.width=C.naturalWidth||C.width,c.height=C.naturalHeight||C.height):typeof VideoFrame<"u"&&C instanceof VideoFrame?(c.width=C.displayWidth,c.height=C.displayHeight):(c.width=C.width,c.height=C.height),c}this.allocateTextureUnit=k,this.resetTextureUnits=q,this.getTextureUnits=W,this.setTextureUnits=B,this.setTexture2D=re,this.setTexture2DArray=le,this.setTexture3D=de,this.setTextureCube=De,this.rebindTextures=me,this.setupRenderTarget=ae,this.updateRenderTargetMipmap=Fe,this.updateMultisampleRenderTarget=N,this.setupDepthRenderbuffer=ie,this.setupFrameBufferTexture=Qe,this.useMultisampledRTT=We,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function lp(r,e){function t(i,n=ln){let s;const a=bt.getTransfer(n);if(i===ii)return r.UNSIGNED_BYTE;if(i===jo)return r.UNSIGNED_SHORT_4_4_4_4;if(i===el)return r.UNSIGNED_SHORT_5_5_5_1;if(i===$c)return r.UNSIGNED_INT_5_9_9_9_REV;if(i===Kc)return r.UNSIGNED_INT_10F_11F_11F_REV;if(i===Ko)return r.BYTE;if(i===Qo)return r.SHORT;if(i===Gs)return r.UNSIGNED_SHORT;if(i===Qr)return r.INT;if(i===Ci)return r.UNSIGNED_INT;if(i===Ft)return r.FLOAT;if(i===Jt)return r.HALF_FLOAT;if(i===Qc)return r.ALPHA;if(i===jc)return r.RGB;if(i===Kt)return r.RGBA;if(i===ji)return r.DEPTH_COMPONENT;if(i===An)return r.DEPTH_STENCIL;if(i===jr)return r.RED;if(i===ea)return r.RED_INTEGER;if(i===Ln)return r.RG;if(i===tl)return r.RG_INTEGER;if(i===il)return r.RGBA_INTEGER;if(i===Er||i===Ar||i===Cr||i===Rr)if(a===It)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Er)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Ar)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Cr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Rr)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Er)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Ar)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Cr)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Rr)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===po||i===mo||i===go||i===vo)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===po)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===mo)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===go)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===vo)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===_o||i===yo||i===xo||i===Mo||i===So||i===Dr||i===bo)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===_o||i===yo)return a===It?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===xo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(i===Mo)return s.COMPRESSED_R11_EAC;if(i===So)return s.COMPRESSED_SIGNED_R11_EAC;if(i===Dr)return s.COMPRESSED_RG11_EAC;if(i===bo)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(i===To||i===wo||i===Eo||i===Ao||i===Co||i===Ro||i===Io||i===Po||i===Lo||i===Uo||i===No||i===Do||i===Oo||i===Fo)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===To)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===wo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===Eo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===Ao)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Co)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Ro)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Io)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===Po)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Lo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Uo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===No)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Do)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Oo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Fo)return a===It?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Bo||i===zo||i===ko)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===Bo)return a===It?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===zo)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===ko)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===Vo||i===Ho||i===Or||i===Go)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===Vo)return s.COMPRESSED_RED_RGTC1_EXT;if(i===Ho)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Or)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Go)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===Ws?r.UNSIGNED_INT_24_8:r[i]!==void 0?r[i]:null}return{convert:t}}const QM=`
4089void main() {
4090
4091	gl_Position = vec4( position, 1.0 );
4092
4093}`,jM=`
4094uniform sampler2DArray depthColor;
4095uniform float depthWidth;
4096uniform float depthHeight;
4097
4098void main() {
4099
4100	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
4101
4102	if ( coord.x >= 1.0 ) {
4103
4104		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
4105
4106	} else {
4107
4108		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
4109
4110	}
4111
4112}`;class eS{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const i=new ch(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new vi({vertexShader:QM,fragmentShader:jM,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new kt(new Fn(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class tS extends Hi{constructor(e,t){super();const i=this;let n=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,d=null,h=null,f=null,p=null;const v=typeof XRWebGLBinding<"u",g=new eS,m={},_=t.getContextAttributes();let x=null,M=null;const R=[],E=[],I=new se;let y=null;const w=new ti;w.viewport=new Pt;const U=new ti;U.viewport=new Pt;const L=[w,U],O=new $f;let q=null,W=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(J){let Ie=R[J];return Ie===void 0&&(Ie=new io,R[J]=Ie),Ie.getTargetRaySpace()},this.getControllerGrip=function(J){let Ie=R[J];return Ie===void 0&&(Ie=new io,R[J]=Ie),Ie.getGripSpace()},this.getHand=function(J){let Ie=R[J];return Ie===void 0&&(Ie=new io,R[J]=Ie),Ie.getHandSpace()};function B(J){const Ie=E.indexOf(J.inputSource);if(Ie===-1)return;const ve=R[Ie];ve!==void 0&&(ve.update(J.inputSource,J.frame,c||a),ve.dispatchEvent({type:J.type,data:J.inputSource}))}function k(){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",k),n.removeEventListener("inputsourceschange",Y);for(let J=0;J<R.length;J++){const Ie=E[J];Ie!==null&&(E[J]=null,R[J].disconnect(Ie))}q=null,W=null,g.reset();for(const J in m)delete m[J];e.setRenderTarget(x),f=null,h=null,d=null,n=null,M=null,ot.stop(),i.isPresenting=!1,e.setPixelRatio(y),e.setSize(I.width,I.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(J){s=J,i.isPresenting===!0&&Re("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(J){o=J,i.isPresenting===!0&&Re("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(J){c=J},this.getBaseLayer=function(){return h!==null?h:f},this.getBinding=function(){return d===null&&v&&(d=new XRWebGLBinding(n,t)),d},this.getFrame=function(){return p},this.getSession=function(){return n},this.setSession=async function(J){if(n=J,n!==null){if(x=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",k),n.addEventListener("inputsourceschange",Y),_.xrCompatible!==!0&&await t.makeXRCompatible(),y=e.getPixelRatio(),e.getSize(I),v&&"createProjectionLayer"in XRWebGLBinding.prototype){let ve=null,qe=null,et=null;_.depth&&(et=_.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,ve=_.stencil?An:ji,qe=_.stencil?Ws:Ci);const Qe={colorFormat:t.RGBA8,depthFormat:et,scaleFactor:s};d=this.getBinding(),h=d.createProjectionLayer(Qe),n.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),M=new gi(h.textureWidth,h.textureHeight,{format:Kt,type:ii,depthTexture:new hs(h.textureWidth,h.textureHeight,qe,void 0,void 0,void 0,void 0,void 0,void 0,ve),stencilBuffer:_.stencil,colorSpace:e.outputColorSpace,samples:_.antialias?4:0,resolveDepthBuffer:h.ignoreDepthValues===!1,resolveStencilBuffer:h.ignoreDepthValues===!1})}else{const ve={antialias:_.antialias,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(n,t,ve),n.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),M=new gi(f.framebufferWidth,f.framebufferHeight,{format:Kt,type:ii,colorSpace:e.outputColorSpace,stencilBuffer:_.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}M.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await n.requestReferenceSpace(o),ot.setContext(n),ot.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(n!==null)return n.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};function Y(J){for(let Ie=0;Ie<J.removed.length;Ie++){const ve=J.removed[Ie],qe=E.indexOf(ve);qe>=0&&(E[qe]=null,R[qe].disconnect(ve))}for(let Ie=0;Ie<J.added.length;Ie++){const ve=J.added[Ie];let qe=E.indexOf(ve);if(qe===-1){for(let Qe=0;Qe<R.length;Qe++)if(Qe>=E.length){E.push(ve),qe=Qe;break}else if(E[Qe]===null){E[Qe]=ve,qe=Qe;break}if(qe===-1)break}const et=R[qe];et&&et.connect(ve)}}const re=new P,le=new P;function de(J,Ie,ve){re.setFromMatrixPosition(Ie.matrixWorld),le.setFromMatrixPosition(ve.matrixWorld);const qe=re.distanceTo(le),et=Ie.projectionMatrix.elements,Qe=ve.projectionMatrix.elements,Tt=et[14]/(et[10]-1),tt=et[14]/(et[10]+1),ie=(et[9]+1)/et[5],me=(et[9]-1)/et[5],ae=(et[8]-1)/et[0],Fe=(Qe[8]+1)/Qe[0],Pe=Tt*ae,at=Tt*Fe,N=qe/(-ae+Fe),ht=N*-ae;if(Ie.matrixWorld.decompose(J.position,J.quaternion,J.scale),J.translateX(ht),J.translateZ(N),J.matrixWorld.compose(J.position,J.quaternion,J.scale),J.matrixWorldInverse.copy(J.matrixWorld).invert(),et[10]===-1)J.projectionMatrix.copy(Ie.projectionMatrix),J.projectionMatrixInverse.copy(Ie.projectionMatrixInverse);else{const We=Tt+N,it=tt+N,_e=Pe-ht,Et=at+(qe-ht),C=ie*tt/it*We,b=me*tt/it*We;J.projectionMatrix.makePerspective(_e,Et,C,b,We,it),J.projectionMatrixInverse.copy(J.projectionMatrix).invert()}}function De(J,Ie){Ie===null?J.matrixWorld.copy(J.matrix):J.matrixWorld.multiplyMatrices(Ie.matrixWorld,J.matrix),J.matrixWorldInverse.copy(J.matrixWorld).invert()}this.updateCamera=function(J){if(n===null)return;let Ie=J.near,ve=J.far;g.texture!==null&&(g.depthNear>0&&(Ie=g.depthNear),g.depthFar>0&&(ve=g.depthFar)),O.near=U.near=w.near=Ie,O.far=U.far=w.far=ve,(q!==O.near||W!==O.far)&&(n.updateRenderState({depthNear:O.near,depthFar:O.far}),q=O.near,W=O.far),O.layers.mask=J.layers.mask|6,w.layers.mask=O.layers.mask&-5,U.layers.mask=O.layers.mask&-3;const qe=J.parent,et=O.cameras;De(O,qe);for(let Qe=0;Qe<et.length;Qe++)De(et[Qe],qe);et.length===2?de(O,w,U):O.projectionMatrix.copy(w.projectionMatrix),Ue(J,O,qe)};function Ue(J,Ie,ve){ve===null?J.matrix.copy(Ie.matrixWorld):(J.matrix.copy(ve.matrixWorld),J.matrix.invert(),J.matrix.multiply(Ie.matrixWorld)),J.matrix.decompose(J.position,J.quaternion,J.scale),J.updateMatrixWorld(!0),J.projectionMatrix.copy(Ie.projectionMatrix),J.projectionMatrixInverse.copy(Ie.projectionMatrixInverse),J.isPerspectiveCamera&&(J.fov=Xs*2*Math.atan(1/J.projectionMatrix.elements[5]),J.zoom=1)}this.getCamera=function(){return O},this.getFoveation=function(){if(!(h===null&&f===null))return l},this.setFoveation=function(J){l=J,h!==null&&(h.fixedFoveation=J),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=J)},this.hasDepthSensing=function(){return g.texture!==null},this.getDepthSensingMesh=function(){return g.getMesh(O)},this.getCameraTexture=function(J){return m[J]};let Ke=null;function yt(J,Ie){if(u=Ie.getViewerPose(c||a),p=Ie,u!==null){const ve=u.views;f!==null&&(e.setRenderTargetFramebuffer(M,f.framebuffer),e.setRenderTarget(M));let qe=!1;ve.length!==O.cameras.length&&(O.cameras.length=0,qe=!0);for(let tt=0;tt<ve.length;tt++){const ie=ve[tt];let me=null;if(f!==null)me=f.getViewport(ie);else{const Fe=d.getViewSubImage(h,ie);me=Fe.viewport,tt===0&&(e.setRenderTargetTextures(M,Fe.colorTexture,Fe.depthStencilTexture),e.setRenderTarget(M))}let ae=L[tt];ae===void 0&&(ae=new ti,ae.layers.enable(tt),ae.viewport=new Pt,L[tt]=ae),ae.matrix.fromArray(ie.transform.matrix),ae.matrix.decompose(ae.position,ae.quaternion,ae.scale),ae.projectionMatrix.fromArray(ie.projectionMatrix),ae.projectionMatrixInverse.copy(ae.projectionMatrix).invert(),ae.viewport.set(me.x,me.y,me.width,me.height),tt===0&&(O.matrix.copy(ae.matrix),O.matrix.decompose(O.position,O.quaternion,O.scale)),qe===!0&&O.cameras.push(ae)}const et=n.enabledFeatures;if(et&&et.includes("depth-sensing")&&n.depthUsage=="gpu-optimized"&&v){d=i.getBinding();const tt=d.getDepthInformation(ve[0]);tt&&tt.isValid&&tt.texture&&g.init(tt,n.renderState)}if(et&&et.includes("camera-access")&&v){e.state.unbindTexture(),d=i.getBinding();for(let tt=0;tt<ve.length;tt++){const ie=ve[tt].camera;if(ie){let me=m[ie];me||(me=new ch,m[ie]=me);const ae=d.getCameraImage(ie);me.sourceTexture=ae}}}}for(let ve=0;ve<R.length;ve++){const qe=E[ve],et=R[ve];qe!==null&&et!==void 0&&et.update(qe,Ie,c||a)}Ke&&Ke(J,Ie),Ie.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:Ie}),p=null}const ot=new ip;ot.setAnimationLoop(yt),this.setAnimationLoop=function(J){Ke=J},this.dispose=function(){}}}const iS=new ct,cp=new ft;cp.set(-1,0,0,0,1,0,0,0,1);function nS(r,e){function t(g,m){g.matrixAutoUpdate===!0&&g.updateMatrix(),m.value.copy(g.matrix)}function i(g,m){m.color.getRGB(g.fogColor.value,wf(r)),m.isFog?(g.fogNear.value=m.near,g.fogFar.value=m.far):m.isFogExp2&&(g.fogDensity.value=m.density)}function n(g,m,_,x,M){m.isNodeMaterial?m.uniformsNeedUpdate=!1:m.isMeshBasicMaterial?s(g,m):m.isMeshLambertMaterial?(s(g,m),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)):m.isMeshToonMaterial?(s(g,m),d(g,m)):m.isMeshPhongMaterial?(s(g,m),u(g,m),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)):m.isMeshStandardMaterial?(s(g,m),h(g,m),m.isMeshPhysicalMaterial&&f(g,m,M)):m.isMeshMat
vendor: 2,136 bytes, line 4112
4112capMaterial?(s(g,m),p(g,m)):m.isMeshDepthMaterial?s(g,m):m.isMeshDistanceMaterial?(s(g,m),v(g,m)):m.isMeshNormalMaterial?s(g,m):m.isLineBasicMaterial?(a(g,m),m.isLineDashedMaterial&&o(g,m)):m.isPointsMaterial?l(g,m,_,x):m.isSpriteMaterial?c(g,m):m.isShadowMaterial?(g.color.value.copy(m.color),g.opacity.value=m.opacity):m.isShaderMaterial&&(m.uniformsNeedUpdate=!1)}function s(g,m){g.opacity.value=m.opacity,m.color&&g.diffuse.value.copy(m.color),m.emissive&&g.emissive.value.copy(m.emissive).multiplyScalar(m.emissiveIntensity),m.map&&(g.map.value=m.map,t(m.map,g.mapTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.bumpMap&&(g.bumpMap.value=m.bumpMap,t(m.bumpMap,g.bumpMapTransform),g.bumpScale.value=m.bumpScale,m.side===pi&&(g.bumpScale.value*=-1)),m.normalMap&&(g.normalMap.value=m.normalMap,t(m.normalMap,g.normalMapTransform),g.normalScale.value.copy(m.normalScale),m.side===pi&&g.normalScale.value.negate()),m.displacementMap&&(g.displacementMap.value=m.displacementMap,t(m.displacementMap,g.displacementMapTransform),g.displacementScale.value=m.displacementScale,g.displacementBias.value=m.displacementBias),m.emissiveMap&&(g.emissiveMap.value=m.emissiveMap,t(m.emissiveMap,g.emissiveMapTransform)),m.specularMap&&(g.specularMap.value=m.specularMap,t(m.specularMap,g.specularMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest);const _=e.get(m),x=_.envMap,M=_.envMapRotation;x&&(g.envMap.value=x,g.envMapRotation.value.setFromMatrix4(iS.makeRotationFromEuler(M)).transpose(),x.isCubeTexture&&x.isRenderTargetTexture===!1&&g.envMapRotation.value.premultiply(cp),g.reflectivity.value=m.reflectivity,g.ior.value=m.ior,g.refractionRatio.value=m.refractionRatio),m.lightMap&&(g.lightMap.value=m.lightMap,g.lightMapIntensity.value=m.lightMapIntensity,t(m.lightMap,g.lightMapTransform)),m.aoMap&&(g.aoMap.value=m.aoMap,g.aoMapIntensity.value=m.aoMapIntensity,t(m.aoMap,g.aoMapTransform))}function a(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform))}function o(g,m){g.dashSize.value=m.dashSize,g.totalSize.value=m.dashSize
vendor: 26,111 bytes, line 4112
4112+m.gapSize,g.scale.value=m.scale}function l(g,m,_,x){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.size.value=m.size*_,g.scale.value=x*.5,m.map&&(g.map.value=m.map,t(m.map,g.uvTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function c(g,m){g.diffuse.value.copy(m.color),g.opacity.value=m.opacity,g.rotation.value=m.rotation,m.map&&(g.map.value=m.map,t(m.map,g.mapTransform)),m.alphaMap&&(g.alphaMap.value=m.alphaMap,t(m.alphaMap,g.alphaMapTransform)),m.alphaTest>0&&(g.alphaTest.value=m.alphaTest)}function u(g,m){g.specular.value.copy(m.specular),g.shininess.value=Math.max(m.shininess,1e-4)}function d(g,m){m.gradientMap&&(g.gradientMap.value=m.gradientMap)}function h(g,m){g.metalness.value=m.metalness,m.metalnessMap&&(g.metalnessMap.value=m.metalnessMap,t(m.metalnessMap,g.metalnessMapTransform)),g.roughness.value=m.roughness,m.roughnessMap&&(g.roughnessMap.value=m.roughnessMap,t(m.roughnessMap,g.roughnessMapTransform)),m.envMap&&(g.envMapIntensity.value=m.envMapIntensity)}function f(g,m,_){g.ior.value=m.ior,m.sheen>0&&(g.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),g.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(g.sheenColorMap.value=m.sheenColorMap,t(m.sheenColorMap,g.sheenColorMapTransform)),m.sheenRoughnessMap&&(g.sheenRoughnessMap.value=m.sheenRoughnessMap,t(m.sheenRoughnessMap,g.sheenRoughnessMapTransform))),m.clearcoat>0&&(g.clearcoat.value=m.clearcoat,g.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(g.clearcoatMap.value=m.clearcoatMap,t(m.clearcoatMap,g.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,t(m.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(g.clearcoatNormalMap.value=m.clearcoatNormalMap,t(m.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===pi&&g.clearcoatNormalScale.value.negate())),m.dispersion>0&&(g.dispersion.value=m.dispersion),m.iridescence>0&&(g.iridescence.value=m.iridescence,g.iridescenceIOR.value=m.iridescenceIOR,g.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(g.iridescenceMap.value=m.iridescenceMap,t(m.iridescenceMap,g.iridescenceMapTransform)),m.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=m.iridescenceThicknessMap,t(m.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),m.transmission>0&&(g.transmission.value=m.transmission,g.transmissionSamplerMap.value=_.texture,g.transmissionSamplerSize.value.set(_.width,_.height),m.transmissionMap&&(g.transmissionMap.value=m.transmissionMap,t(m.transmissionMap,g.transmissionMapTransform)),g.thickness.value=m.thickness,m.thicknessMap&&(g.thicknessMap.value=m.thicknessMap,t(m.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=m.attenuationDistance,g.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(g.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(g.anisotropyMap.value=m.anisotropyMap,t(m.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=m.specularIntensity,g.specularColor.value.copy(m.specularColor),m.specularColorMap&&(g.specularColorMap.value=m.specularColorMap,t(m.specularColorMap,g.specularColorMapTransform)),m.specularIntensityMap&&(g.specularIntensityMap.value=m.specularIntensityMap,t(m.specularIntensityMap,g.specularIntensityMapTransform))}function p(g,m){m.matcap&&(g.matcap.value=m.matcap)}function v(g,m){const _=e.get(m).light;g.referencePosition.value.setFromMatrixPosition(_.matrixWorld),g.nearDistance.value=_.shadow.camera.near,g.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:n}}function sS(r,e,t,i){let n={},s={},a=[];const o=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function l(_,x){const M=x.program;i.uniformBlockBinding(_,M)}function c(_,x){let M=n[_.id];M===void 0&&(p(_),M=u(_),n[_.id]=M,_.addEventListener("dispose",g));const R=x.program;i.updateUBOMapping(_,R);const E=e.render.frame;s[_.id]!==E&&(h(_),s[_.id]=E)}function u(_){const x=d();_.__bindingPointIndex=x;const M=r.createBuffer(),R=_.__size,E=_.usage;return r.bindBuffer(r.UNIFORM_BUFFER,M),r.bufferData(r.UNIFORM_BUFFER,R,E),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,x,M),M}function d(){for(let _=0;_<o;_++)if(a.indexOf(_)===-1)return a.push(_),_;return Ze("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function h(_){const x=n[_.id],M=_.uniforms,R=_.__cache;r.bindBuffer(r.UNIFORM_BUFFER,x);for(let E=0,I=M.length;E<I;E++){const y=Array.isArray(M[E])?M[E]:[M[E]];for(let w=0,U=y.length;w<U;w++){const L=y[w];if(f(L,E,w,R)===!0){const O=L.__offset,q=Array.isArray(L.value)?L.value:[L.value];let W=0;for(let B=0;B<q.length;B++){const k=q[B],Y=v(k);typeof k=="number"||typeof k=="boolean"?(L.__data[0]=k,r.bufferSubData(r.UNIFORM_BUFFER,O+W,L.__data)):k.isMatrix3?(L.__data[0]=k.elements[0],L.__data[1]=k.elements[1],L.__data[2]=k.elements[2],L.__data[3]=0,L.__data[4]=k.elements[3],L.__data[5]=k.elements[4],L.__data[6]=k.elements[5],L.__data[7]=0,L.__data[8]=k.elements[6],L.__data[9]=k.elements[7],L.__data[10]=k.elements[8],L.__data[11]=0):ArrayBuffer.isView(k)?L.__data.set(new k.constructor(k.buffer,k.byteOffset,L.__data.length)):(k.toArray(L.__data,W),W+=Y.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,O,L.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function f(_,x,M,R){const E=_.value,I=x+"_"+M;if(R[I]===void 0)return typeof E=="number"||typeof E=="boolean"?R[I]=E:ArrayBuffer.isView(E)?R[I]=E.slice():R[I]=E.clone(),!0;{const y=R[I];if(typeof E=="number"||typeof E=="boolean"){if(y!==E)return R[I]=E,!0}else{if(ArrayBuffer.isView(E))return!0;if(y.equals(E)===!1)return y.copy(E),!0}}return!1}function p(_){const x=_.uniforms;let M=0;const R=16;for(let I=0,y=x.length;I<y;I++){const w=Array.isArray(x[I])?x[I]:[x[I]];for(let U=0,L=w.length;U<L;U++){const O=w[U],q=Array.isArray(O.value)?O.value:[O.value];for(let W=0,B=q.length;W<B;W++){const k=q[W],Y=v(k),re=M%R,le=re%Y.boundary,de=re+le;M+=le,de!==0&&R-de<Y.storage&&(M+=R-de),O.__data=new Float32Array(Y.storage/Float32Array.BYTES_PER_ELEMENT),O.__offset=M,M+=Y.storage}}}const E=M%R;return E>0&&(M+=R-E),_.__size=M,_.__cache={},this}function v(_){const x={boundary:0,storage:0};return typeof _=="number"||typeof _=="boolean"?(x.boundary=4,x.storage=4):_.isVector2?(x.boundary=8,x.storage=8):_.isVector3||_.isColor?(x.boundary=16,x.storage=12):_.isVector4?(x.boundary=16,x.storage=16):_.isMatrix3?(x.boundary=48,x.storage=48):_.isMatrix4?(x.boundary=64,x.storage=64):_.isTexture?Re("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(_)?(x.boundary=16,x.storage=_.byteLength):Re("WebGLRenderer: Unsupported uniform value type.",_),x}function g(_){const x=_.target;x.removeEventListener("dispose",g);const M=a.indexOf(x.__bindingPointIndex);a.splice(M,1),r.deleteBuffer(n[x.id]),delete n[x.id],delete s[x.id]}function m(){for(const _ in n)r.deleteBuffer(n[_]);a=[],n={},s={}}return{bind:l,update:c,dispose:m}}const rS=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Ji=null;function aS(){return Ji===null&&(Ji=new Ii(rS,16,16,Ln,Jt),Ji.name="DFG_LUT",Ji.minFilter=wt,Ji.magFilter=wt,Ji.wrapS=Gt,Ji.wrapT=Gt,Ji.generateMipmaps=!1,Ji.needsUpdate=!0),Ji}class hp{constructor(e={}){const{canvas:t=Qd(),context:i=null,depth:n=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1,reversedDepthBuffer:h=!1,outputBufferType:f=ii}=e;this.isWebGLRenderer=!0;let p;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=i.getContextAttributes().alpha}else p=a;const v=f,g=new Set([il,tl,ea]),m=new Set([ii,Ci,Gs,Ws,jo,el]),_=new Uint32Array(4),x=new Int32Array(4),M=new P;let R=null,E=null;const I=[],y=[];let w=null;this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=ki,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const U=this;let L=!1,O=null;this._outputColorSpace=di;let q=0,W=0,B=null,k=-1,Y=null;const re=new Pt,le=new Pt;let de=null;const De=new He(0);let Ue=0,Ke=t.width,yt=t.height,ot=1,J=null,Ie=null;const ve=new Pt(0,0,Ke,yt),qe=new Pt(0,0,Ke,yt);let et=!1;const Qe=new Ks;let Tt=!1,tt=!1;const ie=new ct,me=new P,ae=new Pt,Fe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Pe=!1;function at(){return B===null?ot:1}let N=i;function ht(T,D){return t.getContext(T,D)}try{const T={alpha:!0,depth:n,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${$r}`),t.addEventListener("webglcontextlost",he,!1),t.addEventListener("webglcontextrestored",Je,!1),t.addEventListener("webglcontextcreationerror",pt,!1),N===null){const D="webgl2";if(N=ht(D,T),N===null)throw ht(D)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(T){throw Ze("WebGLRenderer: "+T.message),T}let We,it,_e,Et,C,b,X,ee,oe,xe,Se,$,j,Be,ze,pe,ce,ut,ne,Mt,z,Me,te;function ke(){We=new ox(N),We.init(),z=new lp(N,We),it=new jy(N,We,e,z),_e=new $M(N,We),it.reversedDepthBuffer&&h&&_e.buffers.depth.setReversed(!0),Et=new hx(N),C=new OM,b=new KM(N,We,_e,C,it,z,Et),X=new ax(U),ee=new p_(N),Me=new Ky(N,ee),oe=new lx(N,ee,Et,Me),xe=new dx(N,oe,ee,Me,Et),ut=new ux(N,it,b),ze=new ex(C),Se=new DM(U,X,We,it,Me,ze),$=new nS(U,C),j=new BM,Be=new WM(We),ce=new $y(U,X,_e,xe,p,l),pe=new JM(U,xe,it),te=new sS(N,Et,it,_e),ne=new Qy(N,We,Et),Mt=new cx(N,We,Et),Et.programs=Se.programs,U.capabilities=it,U.extensions=We,U.properties=C,U.renderLists=j,U.shadowMap=pe,U.state=_e,U.info=Et}ke(),v!==ii&&(w=new px(v,t.width,t.height,n,s));const be=new tS(U,N);this.xr=be,this.getContext=function(){return N},this.getContextAttributes=function(){return N.getContextAttributes()},this.forceContextLoss=function(){const T=We.get("WEBGL_lose_context");T&&T.loseContext()},this.forceContextRestore=function(){const T=We.get("WEBGL_lose_context");T&&T.restoreContext()},this.getPixelRatio=function(){return ot},this.setPixelRatio=function(T){T!==void 0&&(ot=T,this.setSize(Ke,yt,!1))},this.getSize=function(T){return T.set(Ke,yt)},this.setSize=function(T,D,V=!0){if(be.isPresenting){Re("WebGLRenderer: Can't change size while VR device is presenting.");return}Ke=T,yt=D,t.width=Math.floor(T*ot),t.height=Math.floor(D*ot),V===!0&&(t.style.width=T+"px",t.style.height=D+"px"),w!==null&&w.setSize(t.width,t.height),this.setViewport(0,0,T,D)},this.getDrawingBufferSize=function(T){return T.set(Ke*ot,yt*ot).floor()},this.setDrawingBufferSize=function(T,D,V){Ke=T,yt=D,ot=V,t.width=Math.floor(T*V),t.height=Math.floor(D*V),this.setViewport(0,0,T,D)},this.setEffects=function(T){if(v===ii){Ze("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(T){for(let D=0;D<T.length;D++)if(T[D].isOutputPass===!0){Re("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}w.setEffects(T||[])},this.getCurrentViewport=function(T){return T.copy(re)},this.getViewport=function(T){return T.copy(ve)},this.setViewport=function(T,D,V,H){T.isVector4?ve.set(T.x,T.y,T.z,T.w):ve.set(T,D,V,H),_e.viewport(re.copy(ve).multiplyScalar(ot).round())},this.getScissor=function(T){return T.copy(qe)},this.setScissor=function(T,D,V,H){T.isVector4?qe.set(T.x,T.y,T.z,T.w):qe.set(T,D,V,H),_e.scissor(le.copy(qe).multiplyScalar(ot).round())},this.getScissorTest=function(){return et},this.setScissorTest=function(T){_e.setScissorTest(et=T)},this.setOpaqueSort=function(T){J=T},this.setTransparentSort=function(T){Ie=T},this.getClearColor=function(T){return T.copy(ce.getClearColor())},this.setClearColor=function(){ce.setClearColor(...arguments)},this.getClearAlpha=function(){return ce.getClearAlpha()},this.setClearAlpha=function(){ce.setClearAlpha(...arguments)},this.clear=function(T=!0,D=!0,V=!0){let H=0;if(T){let G=!1;if(B!==null){const ge=B.texture.format;G=g.has(ge)}if(G){const ge=B.texture.type,Ce=m.has(ge),ue=ce.getClearColor(),Ve=ce.getClearAlpha(),Ee=ue.r,Ye=ue.g,nt=ue.b;Ce?(_[0]=Ee,_[1]=Ye,_[2]=nt,_[3]=Ve,N.clearBufferuiv(N.COLOR,0,_)):(x[0]=Ee,x[1]=Ye,x[2]=nt,x[3]=Ve,N.clearBufferiv(N.COLOR,0,x))}else H|=N.COLOR_BUFFER_BIT}D&&(H|=N.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),V&&(H|=N.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),H!==0&&N.clear(H)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(T){T.setRenderer(this),O=T},this.dispose=function(){t.removeEventListener("webglcontextlost",he,!1),t.removeEventListener("webglcontextrestored",Je,!1),t.removeEventListener("webglcontextcreationerror",pt,!1),ce.dispose(),j.dispose(),Be.dispose(),C.dispose(),X.dispose(),xe.dispose(),Me.dispose(),te.dispose(),Se.dispose(),be.dispose(),be.removeEventListener("sessionstart",pn),be.removeEventListener("sessionend",St),Wi.stop()};function he(T){T.preventDefault(),Hr("WebGLRenderer: Context Lost."),L=!0}function Je(){Hr("WebGLRenderer: Context Restored."),L=!1;const T=Et.autoReset,D=pe.enabled,V=pe.autoUpdate,H=pe.needsUpdate,G=pe.type;ke(),Et.autoReset=T,pe.enabled=D,pe.autoUpdate=V,pe.needsUpdate=H,pe.type=G}function pt(T){Ze("WebGLRenderer: A WebGL context could not be created. Reason: ",T.statusMessage)}function Bt(T){const D=T.target;D.removeEventListener("dispose",Bt),Rt(D)}function Rt(T){Li(T),C.remove(T)}function Li(T){const D=C.get(T).programs;D!==void 0&&(D.forEach(function(V){Se.releaseProgram(V)}),T.isShaderMaterial&&Se.releaseShaderCache(T))}this.renderBufferDirect=function(T,D,V,H,G,ge){D===null&&(D=Fe);const Ce=G.isMesh&&G.matrixWorld.determinant()<0,ue=Ae(T,D,V,H,G);_e.setMaterial(H,Ce);let Ve=V.index,Ee=1;if(H.wireframe===!0){if(Ve=oe.getWireframeAttribute(V),Ve===void 0)return;Ee=2}const Ye=V.drawRange,nt=V.attributes.position;let Xe=Ye.start*Ee,vt=(Ye.start+Ye.count)*Ee;ge!==null&&(Xe=Math.max(Xe,ge.start*Ee),vt=Math.min(vt,(ge.start+ge.count)*Ee)),Ve!==null?(Xe=Math.max(Xe,0),vt=Math.min(vt,Ve.count)):nt!=null&&(Xe=Math.max(Xe,0),vt=Math.min(vt,nt.count));const st=vt-Xe;if(st<0||st===1/0)return;Me.setup(G,H,ue,V,Ve);let xt,je=ne;if(Ve!==null&&(xt=ee.get(Ve),je=Mt,je.setIndex(xt)),G.isMesh)H.wireframe===!0?(_e.setLineWidth(H.wireframeLinewidth*at()),je.setMode(N.LINES)):je.setMode(N.TRIANGLES);else if(G.isLine){let dt=H.linewidth;dt===void 0&&(dt=1),_e.setLineWidth(dt*at()),G.isLineSegments?je.setMode(N.LINES):G.isLineLoop?je.setMode(N.LINE_LOOP):je.setMode(N.LINE_STRIP)}else G.isPoints?je.setMode(N.POINTS):G.isSprite&&je.setMode(N.TRIANGLES);if(G.isBatchedMesh)if(We.get("WEBGL_multi_draw"))je.renderMultiDraw(G._multiDrawStarts,G._multiDrawCounts,G._multiDrawCount);else{const dt=G._multiDrawStarts,Ne=G._multiDrawCounts,Wt=G._multiDrawCount,lt=Ve?ee.get(Ve).bytesPerElement:1,Xt=C.get(H).currentProgram.getUniforms();for(let Xi=0;Xi<Wt;Xi++)Xt.setValue(N,"_gl_DrawID",Xi),je.render(dt[Xi]/lt,Ne[Xi])}else if(G.isInstancedMesh)je.renderInstances(Xe,st,G.count);else if(V.isInstancedBufferGeometry){const dt=V._maxInstanceCount!==void 0?V._maxInstanceCount:1/0,Ne=Math.min(V.instanceCount,dt);je.renderInstances(Xe,st,Ne)}else je.render(Xe,st)};function ci(T,D,V){T.transparent===!0&&T.side===Fi&&T.forceSinglePass===!1?(T.side=pi,T.needsUpdate=!0,K(T,D,V),T.side=un,T.needsUpdate=!0,K(T,D,V),T.side=Fi):K(T,D,V)}this.compile=function(T,D,V=null){V===null&&(V=T),E=Be.get(V),E.init(D),y.push(E),V.traverseVisible(function(G){G.isLight&&G.layers.test(D.layers)&&(E.pushLight(G),G.castShadow&&E.pushShadow(G))}),T!==V&&T.traverseVisible(function(G){G.isLight&&G.layers.test(D.layers)&&(E.pushLight(G),G.castShadow&&E.pushShadow(G))}),E.setupLights();const H=new Set;return T.traverse(function(G){if(!(G.isMesh||G.isPoints||G.isLine||G.isSprite))return;const ge=G.material;if(ge)if(Array.isArray(ge))for(let Ce=0;Ce<ge.length;Ce++){const ue=ge[Ce];ci(ue,V,G),H.add(ue)}else ci(ge,V,G),H.add(ge)}),E=y.pop(),H},this.compileAsync=function(T,D,V=null){const H=this.compile(T,D,V);return new Promise(G=>{function ge(){if(H.forEach(function(Ce){C.get(Ce).currentProgram.isReady()&&H.delete(Ce)}),H.size===0){G(T);return}setTimeout(ge,10)}We.get("KHR_parallel_shader_compile")!==null?ge():setTimeout(ge,10)})};let tr=null;function zn(T){tr&&tr(T)}function pn(){Wi.stop()}function St(){Wi.start()}const Wi=new ip;Wi.setAnimationLoop(zn),typeof self<"u"&&Wi.setContext(self),this.setAnimationLoop=function(T){tr=T,be.setAnimationLoop(T),T===null?Wi.stop():Wi.start()},be.addEventListener("sessionstart",pn),be.addEventListener("sessionend",St),this.render=function(T,D){if(D!==void 0&&D.isCamera!==!0){Ze("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;O!==null&&O.renderStart(T,D);const V=be.enabled===!0&&be.isPresenting===!0,H=w!==null&&(B===null||V)&&w.begin(U,B);if(T.matrixWorldAutoUpdate===!0&&T.updateMatrixWorld(),D.parent===null&&D.matrixWorldAutoUpdate===!0&&D.updateMatrixWorld(),be.enabled===!0&&be.isPresenting===!0&&(w===null||w.isCompositing()===!1)&&(be.cameraAutoUpdate===!0&&be.updateCamera(D),D=be.getCamera()),T.isScene===!0&&T.onBeforeRender(U,T,D,B),E=Be.get(T,y.length),E.init(D),E.state.textureUnits=b.getTextureUnits(),y.push(E),ie.multiplyMatrices(D.projectionMatrix,D.matrixWorldInverse),Qe.setFromProjectionMatrix(ie,wi,D.reversedDepth),tt=this.localClippingEnabled,Tt=ze.init(this.clippingPlanes,tt),R=j.get(T,I.length),R.init(),I.push(R),be.enabled===!0&&be.isPresenting===!0){const Ce=U.xr.getDepthSensingMesh();Ce!==null&&ir(Ce,D,-1/0,U.sortObjects)}ir(T,D,0,U.sortObjects),R.finish(),U.sortObjects===!0&&R.sort(J,Ie),Pe=be.enabled===!1||be.isPresenting===!1||be.hasDepthSensing()===!1,Pe&&ce.addToRenderList(R,T),this.info.render.frame++,Tt===!0&&ze.beginShadows();const G=E.state.shadowsArray;if(pe.render(G,T,D),Tt===!0&&ze.endShadows(),this.info.autoReset===!0&&this.info.reset(),(H&&w.hasRenderPass())===!1){const Ce=R.opaque,ue=R.transmissive;if(E.setupLights(),D.isArrayCamera){const Ve=D.cameras;if(ue.length>0)for(let Ee=0,Ye=Ve.length;Ee<Ye;Ee++){const nt=Ve[Ee];A(Ce,ue,T,nt)}Pe&&ce.render(T);for(let Ee=0,Ye=Ve.length;Ee<Ye;Ee++){const nt=Ve[Ee];S(R,T,nt,nt.viewport)}}else ue.length>0&&A(Ce,ue,T,D),Pe&&ce.render(T),S(R,T,D)}B!==null&&W===0&&(b.updateMultisampleRenderTarget(B),b.updateRenderTargetMipmap(B)),H&&w.end(U),T.isScene===!0&&T.onAfterRender(U,T,D),Me.resetDefaultState(),k=-1,Y=null,y.pop(),y.length>0?(E=y[y.length-1],b.setTextureUnits(E.state.textureUnits),Tt===!0&&ze.setGlobalState(U.clippingPlanes,E.state.camera)):E=null,I.pop(),I.length>0?R=I[I.length-1]:R=null,O!==null&&O.renderEnd()};function ir(T,D,V,H){if(T.visible===!1)return;if(T.layers.test(D.layers)){if(T.isGroup)V=T.renderOrder;else if(T.isLOD)T.autoUpdate===!0&&T.update(D);else if(T.isLightProbeGrid)E.pushLightProbeGrid(T);else if(T.isLight)E.pushLight(T),T.castShadow&&E.pushShadow(T);else if(T.isSprite){if(!T.frustumCulled||Qe.intersectsSprite(T)){H&&ae.setFromMatrixPosition(T.matrixWorld).applyMatrix4(ie);const Ce=xe.update(T),ue=T.material;ue.visible&&R.push(T,Ce,ue,V,ae.z,null)}}else if((T.isMesh||T.isLine||T.isPoints)&&(!T.frustumCulled||Qe.intersectsObject(T))){const Ce=xe.update(T),ue=T.material;if(H&&(T.boundingSphere!==void 0?(T.boundingSphere===null&&T.computeBoundingSphere(),ae.copy(T.boundingSphere.center)):(Ce.boundingSphere===null&&Ce.computeBoundingSphere(),ae.copy(Ce.boundingSphere.center)),ae.applyMatrix4(T.matrixWorld).applyMatrix4(ie)),Array.isArray(ue)){const Ve=Ce.groups;for(let Ee=0,Ye=Ve.length;Ee<Ye;Ee++){const nt=Ve[Ee],Xe=ue[nt.materialIndex];Xe&&Xe.visible&&R.push(T,Ce,Xe,V,ae.z,nt)}}else ue.visible&&R.push(T,Ce,ue,V,ae.z,null)}}const ge=T.children;for(let Ce=0,ue=ge.length;Ce<ue;Ce++)ir(ge[Ce],D,V,H)}function S(T,D,V,H){const{opaque:G,transmissive:ge,transparent:Ce}=T;E.setupLightsView(V),Tt===!0&&ze.setGlobalState(U.clippingPlanes,V),H&&_e.viewport(re.copy(H)),G.length>0&&F(G,D,V),ge.length>0&&F(ge,D,V),Ce.length>0&&F(Ce,D,V),_e.buffers.depth.setTest(!0),_e.buffers.depth.setMask(!0),_e.buffers.color.setMask(!0),_e.setPolygonOffset(!1)}function A(T,D,V,H){if((V.isScene===!0?V.overrideMaterial:null)!==null)return;if(E.state.transmissionRenderTarget[H.id]===void 0){const Xe=We.has("EXT_color_buffer_half_float")||We.has("EXT_color_buffer_float");E.state.transmissionRenderTarget[H.id]=new gi(1,1,{generateMipmaps:!0,type:Xe?Jt:ii,minFilter:$i,samples:Math.max(4,it.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:bt.workingColorSpace})}const ge=E.state.transmissionRenderTarget[H.id],Ce=H.viewport||re;ge.setSize(Ce.z*U.transmissionResolutionScale,Ce.w*U.transmissionResolutionScale);const ue=U.getRenderTarget(),Ve=U.getActiveCubeFace(),Ee=U.getActiveMipmapLevel();U.setRenderTarget(ge),U.getClearColor(De),Ue=U.getClearAlpha(),Ue<1&&U.setClearColor(16777215,.5),U.clear(),Pe&&ce.render(V);const Ye=U.toneMapping;U.toneMapping=ki;const nt=H.viewport;if(H.viewport!==void 0&&(H.viewport=void 0),E.setupLightsView(H),Tt===!0&&ze.setGlobalState(U.clippingPlanes,H),F(T,V,H),b.updateMultisampleRenderTarget(ge),b.updateRenderTargetMipmap(ge),We.has("WEBGL_multisampled_render_to_texture")===!1){let Xe=!1;for(let vt=0,st=D.length;vt<st;vt++){const xt=D[vt],{object:je,geometry:dt,material:Ne,group:Wt}=xt;if(Ne.side===Fi&&je.layers.test(H.layers)){const lt=Ne.side;Ne.side=pi,Ne.needsUpdate=!0,Z(je,V,H,dt,Ne,Wt),Ne.side=lt,Ne.needsUpdate=!0,Xe=!0}}Xe===!0&&(b.updateMultisampleRenderTarget(ge),b.updateRenderTargetMipmap(ge))}U.setRenderTarget(ue,Ve,Ee),U.setClearColor(De,Ue),nt!==void 0&&(H.viewport=nt),U.toneMapping=Ye}function F(T,D,V){const H=D.isScene===!0?D.overrideMaterial:null;for(let G=0,ge=T.length;G<ge;G++){const Ce=T[G],{object:ue,geometry:Ve,group:Ee}=Ce;let Ye=Ce.material;Ye.allowOverride===!0&&H!==null&&(Ye=H),ue.layers.test(V.layers)&&Z(ue,D,V,Ve,Ye,Ee)}}function Z(T,D,V,H,G,ge){T.onBeforeRender(U,D,V,H,G,ge),T.modelViewMatrix.multiplyMatrices(V.matrixWorldInverse,T.matrixWorld),T.normalMatrix.getNormalMatrix(T.modelViewMatrix),G.onBeforeRender(U,D,V,H,T,ge),G.transparent===!0&&G.side===Fi&&G.forceSinglePass===!1?(G.side=pi,G.needsUpdate=!0,U.renderBufferDirect(V,D,H,G,T,ge),G.side=un,G.needsUpdate=!0,U.renderBufferDirect(V,D,H,G,T,ge),G.side=Fi):U.renderBufferDirect(V,D,H,G,T,ge),T.onAfterRender(U,D,V,H,G,ge)}function K(T,D,V){D.isScene!==!0&&(D=Fe);const H=C.get(T),G=E.state.lights,ge=E.state.shadowsArray,Ce=G.state.ver
vendor: 10,055 bytes, line 4112
4112sion,ue=Se.getParameters(T,G.state,ge,D,V,E.state.lightProbeGridArray),Ve=Se.getProgramCacheKey(ue);let Ee=H.programs;H.environment=T.isMeshStandardMaterial||T.isMeshLambertMaterial||T.isMeshPhongMaterial?D.environment:null,H.fog=D.fog;const Ye=T.isMeshStandardMaterial||T.isMeshLambertMaterial&&!T.envMap||T.isMeshPhongMaterial&&!T.envMap;H.envMap=X.get(T.envMap||H.environment,Ye),H.envMapRotation=H.environment!==null&&T.envMap===null?D.environmentRotation:T.envMapRotation,Ee===void 0&&(T.addEventListener("dispose",Bt),Ee=new Map,H.programs=Ee);let nt=Ee.get(Ve);if(nt!==void 0){if(H.currentProgram===nt&&H.lightsStateVersion===Ce)return ye(T,ue),nt}else ue.uniforms=Se.getUniforms(T),O!==null&&T.isNodeMaterial&&O.build(T,V,ue),T.onBeforeCompile(ue,U),nt=Se.acquireProgram(ue,Ve),Ee.set(Ve,nt),H.uniforms=ue.uniforms;const Xe=H.uniforms;return(!T.isShaderMaterial&&!T.isRawShaderMaterial||T.clipping===!0)&&(Xe.clippingPlanes=ze.uniform),ye(T,ue),H.needsLights=Le(T),H.lightsStateVersion=Ce,H.needsLights&&(Xe.ambientLightColor.value=G.state.ambient,Xe.lightProbe.value=G.state.probe,Xe.directionalLights.value=G.state.directional,Xe.directionalLightShadows.value=G.state.directionalShadow,Xe.spotLights.value=G.state.spot,Xe.spotLightShadows.value=G.state.spotShadow,Xe.rectAreaLights.value=G.state.rectArea,Xe.ltc_1.value=G.state.rectAreaLTC1,Xe.ltc_2.value=G.state.rectAreaLTC2,Xe.pointLights.value=G.state.point,Xe.pointLightShadows.value=G.state.pointShadow,Xe.hemisphereLights.value=G.state.hemi,Xe.directionalShadowMatrix.value=G.state.directionalShadowMatrix,Xe.spotLightMatrix.value=G.state.spotLightMatrix,Xe.spotLightMap.value=G.state.spotLightMap,Xe.pointShadowMatrix.value=G.state.pointShadowMatrix),H.lightProbeGrid=E.state.lightProbeGridArray.length>0,H.currentProgram=nt,H.uniformsList=null,nt}function Q(T){if(T.uniformsList===null){const D=T.currentProgram.getUniforms();T.uniformsList=no.seqWithValue(D.seq,T.uniforms)}return T.uniformsList}function ye(T,D){const V=C.get(T);V.outputColorSpace=D.outputColorSpace,V.batching=D.batching,V.batchingColor=D.batchingColor,V.instancing=D.instancing,V.instancingColor=D.instancingColor,V.instancingMorph=D.instancingMorph,V.skinning=D.skinning,V.morphTargets=D.morphTargets,V.morphNormals=D.morphNormals,V.morphColors=D.morphColors,V.morphTargetsCount=D.morphTargetsCount,V.numClippingPlanes=D.numClippingPlanes,V.numIntersection=D.numClipIntersection,V.vertexAlphas=D.vertexAlphas,V.vertexTangents=D.vertexTangents,V.toneMapping=D.toneMapping}function fe(T,D){if(T.length===0)return null;if(T.length===1)return T[0].texture!==null?T[0]:null;M.setFromMatrixPosition(D.matrixWorld);for(let V=0,H=T.length;V<H;V++){const G=T[V];if(G.texture!==null&&G.boundingBox.containsPoint(M))return G}return null}function Ae(T,D,V,H,G){D.isScene!==!0&&(D=Fe),b.resetTextureUnits();const ge=D.fog,Ce=H.isMeshStandardMaterial||H.isMeshLambertMaterial||H.isMeshPhongMaterial?D.environment:null,ue=B===null?U.outputColorSpace:B.isXRRenderTarget===!0?B.texture.colorSpace:bt.workingColorSpace,Ve=H.isMeshStandardMaterial||H.isMeshLambertMaterial&&!H.envMap||H.isMeshPhongMaterial&&!H.envMap,Ee=X.get(H.envMap||Ce,Ve),Ye=H.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,nt=!!V.attributes.tangent&&(!!H.normalMap||H.anisotropy>0),Xe=!!V.morphAttributes.position,vt=!!V.morphAttributes.normal,st=!!V.morphAttributes.color;let xt=ki;H.toneMapped&&(B===null||B.isXRRenderTarget===!0)&&(xt=U.toneMapping);const je=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,dt=je!==void 0?je.length:0,Ne=C.get(H),Wt=E.state.lights;if(Tt===!0&&(tt===!0||T!==Y)){const Dt=T===Y&&H.id===k;ze.setState(H,T,Dt)}let lt=!1;H.version===Ne.__version?(Ne.needsLights&&Ne.lightsStateVersion!==Wt.state.version||Ne.outputColorSpace!==ue||G.isBatchedMesh&&Ne.batching===!1||!G.isBatchedMesh&&Ne.batching===!0||G.isBatchedMesh&&Ne.batchingColor===!0&&G.colorTexture===null||G.isBatchedMesh&&Ne.batchingColor===!1&&G.colorTexture!==null||G.isInstancedMesh&&Ne.instancing===!1||!G.isInstancedMesh&&Ne.instancing===!0||G.isSkinnedMesh&&Ne.skinning===!1||!G.isSkinnedMesh&&Ne.skinning===!0||G.isInstancedMesh&&Ne.instancingColor===!0&&G.instanceColor===null||G.isInstancedMesh&&Ne.instancingColor===!1&&G.instanceColor!==null||G.isInstancedMesh&&Ne.instancingMorph===!0&&G.morphTexture===null||G.isInstancedMesh&&Ne.instancingMorph===!1&&G.morphTexture!==null||Ne.envMap!==Ee||H.fog===!0&&Ne.fog!==ge||Ne.numClippingPlanes!==void 0&&(Ne.numClippingPlanes!==ze.numPlanes||Ne.numIntersection!==ze.numIntersection)||Ne.vertexAlphas!==Ye||Ne.vertexTangents!==nt||Ne.morphTargets!==Xe||Ne.morphNormals!==vt||Ne.morphColors!==st||Ne.toneMapping!==xt||Ne.morphTargetsCount!==dt||!!Ne.lightProbeGrid!=E.state.lightProbeGridArray.length>0)&&(lt=!0):(lt=!0,Ne.__version=H.version);let Xt=Ne.currentProgram;lt===!0&&(Xt=K(H,D,G),O&&H.isNodeMaterial&&O.onUpdateProgram(H,Xt,Ne));let Xi=!1,mn=!1,ms=!1;const Nt=Xt.getUniforms(),qt=Ne.uniforms;if(_e.useProgram(Xt.program)&&(Xi=!0,mn=!0,ms=!0),H.id!==k&&(k=H.id,mn=!0),Ne.needsLights){const Dt=fe(E.state.lightProbeGridArray,G);Ne.lightProbeGrid!==Dt&&(Ne.lightProbeGrid=Dt,mn=!0)}if(Xi||Y!==T){_e.buffers.depth.getReversed()&&T.reversedDepth!==!0&&(T._reversedDepth=!0,T.updateProjectionMatrix()),Nt.setValue(N,"projectionMatrix",T.projectionMatrix),Nt.setValue(N,"viewMatrix",T.matrixWorldInverse);const vn=Nt.map.cameraPosition;vn!==void 0&&vn.setValue(N,me.setFromMatrixPosition(T.matrixWorld)),it.logarithmicDepthBuffer&&Nt.setValue(N,"logDepthBufFC",2/(Math.log(T.far+1)/Math.LN2)),(H.isMeshPhongMaterial||H.isMeshToonMaterial||H.isMeshLambertMaterial||H.isMeshBasicMaterial||H.isMeshStandardMaterial||H.isShaderMaterial)&&Nt.setValue(N,"isOrthographic",T.isOrthographicCamera===!0),Y!==T&&(Y=T,mn=!0,ms=!0)}if(Ne.needsLights&&(Wt.state.directionalShadowMap.length>0&&Nt.setValue(N,"directionalShadowMap",Wt.state.directionalShadowMap,b),Wt.state.spotShadowMap.length>0&&Nt.setValue(N,"spotShadowMap",Wt.state.spotShadowMap,b),Wt.state.pointShadowMap.length>0&&Nt.setValue(N,"pointShadowMap",Wt.state.pointShadowMap,b)),G.isSkinnedMesh){Nt.setOptional(N,G,"bindMatrix"),Nt.setOptional(N,G,"bindMatrixInverse");const Dt=G.skeleton;Dt&&(Dt.boneTexture===null&&Dt.computeBoneTexture(),Nt.setValue(N,"boneTexture",Dt.boneTexture,b))}G.isBatchedMesh&&(Nt.setOptional(N,G,"batchingTexture"),Nt.setValue(N,"batchingTexture",G._matricesTexture,b),Nt.setOptional(N,G,"batchingIdTexture"),Nt.setValue(N,"batchingIdTexture",G._indirectTexture,b),Nt.setOptional(N,G,"batchingColorTexture"),G._colorsTexture!==null&&Nt.setValue(N,"batchingColorTexture",G._colorsTexture,b));const gn=V.morphAttributes;if((gn.position!==void 0||gn.normal!==void 0||gn.color!==void 0)&&ut.update(G,V,Xt),(mn||Ne.receiveShadow!==G.receiveShadow)&&(Ne.receiveShadow=G.receiveShadow,Nt.setValue(N,"receiveShadow",G.receiveShadow)),(H.isMeshStandardMaterial||H.isMeshLambertMaterial||H.isMeshPhongMaterial)&&H.envMap===null&&D.environment!==null&&(qt.envMapIntensity.value=D.environmentIntensity),qt.dfgLUT!==void 0&&(qt.dfgLUT.value=aS()),mn){if(Nt.setValue(N,"toneMappingExposure",U.toneMappingExposure),Ne.needsLights&&we(qt,ms),ge&&H.fog===!0&&$.refreshFogUniforms(qt,ge),$.refreshMaterialUniforms(qt,H,ot,yt,E.state.transmissionRenderTarget[T.id]),Ne.needsLights&&Ne.lightProbeGrid){const Dt=Ne.lightProbeGrid;qt.probesSH.value=Dt.texture,qt.probesMin.value.copy(Dt.boundingBox.min),qt.probesMax.value.copy(Dt.boundingBox.max),qt.probesResolution.value.copy(Dt.resolution)}no.upload(N,Q(Ne),qt,b)}if(H.isShaderMaterial&&H.uniformsNeedUpdate===!0&&(no.upload(N,Q(Ne),qt,b),H.uniformsNeedUpdate=!1),H.isSpriteMaterial&&Nt.setValue(N,"center",G.center),Nt.setValue(N,"modelViewMatrix",G.modelViewMatrix),Nt.setValue(N,"normalMatrix",G.normalMatrix),Nt.setValue(N,"modelMatrix",G.matrixWorld),H.uniformsGroups!==void 0){const Dt=H.uniformsGroups;for(let vn=0,gs=Dt.length;vn<gs;vn++){const Fh=Dt[vn];te.update(Fh,Xt),te.bind(Fh,Xt)}}return Xt}function we(T,D){T.ambientLightColor.needsUpdate=D,T.lightProbe.needsUpdate=D,T.directionalLights.needsUpdate=D,T.directionalLightShadows.needsUpdate=D,T.pointLights.needsUpdate=D,T.pointLightShadows.needsUpdate=D,T.spotLights.needsUpdate=D,T.spotLightShadows.needsUpdate=D,T.rectAreaLights.needsUpdate=D,T.hemisphereLights.needsUpdate=D}function Le(T){return T.isMeshLambertMaterial||T.isMeshToonMaterial||T.isMeshPhongMaterial||T.isMeshStandardMaterial||T.isShadowMaterial||T.isShaderMaterial&&T.lights===!0}this.getActiveCubeFace=function(){return q},this.getActiveMipmapLevel=function(){return W},this.getRenderTarget=function(){return B},this.setRenderTargetTextures=function(T,D,V){const H=C.get(T);H.__autoAllocateDepthBuffer=T.resolveDepthBuffer===!1,H.__autoAllocateDepthBuffer===!1&&(H.__useRenderToTexture=!1),C.get(T.texture).__webglTexture=D,C.get(T.depthTexture).__webglTexture=H.__autoAllocateDepthBuffer?void 0:V,H.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(T,D){const V=C.get(T);V.__webglFramebuffer=D,V.__useDefaultFramebuffer=D===void 0};const Te=N.createFramebuffer();this.setRenderTarget=function(T,D=0,V=0){B=T,q=D,W=V;let H=null,G=!1,ge=!1;if(T){const ue=C.get(T);if(ue.__useDefaultFramebuffer!==void 0){_e.bindFramebuffer(N.FRAMEBUFFER,ue.__webglFramebuffer),re.copy(T.viewport),le.copy(T.scissor),de=T.scissorTest,_e.viewport(re),_e.scissor(le),_e.setScissorTest(de),k=-1;return}else if(ue.__webglFramebuffer===void 0)b.setupRenderTarget(T);else if(ue.__hasExternalTextures)b.rebindTextures(T,C.get(T.texture).__webglTexture,C.get(T.depthTexture).__webglTexture);else if(T.depthBuffer){const Ye=T.depthTexture;if(ue.__boundDepthTexture!==Ye){if(Ye!==null&&C.has(Ye)&&(T.width!==Ye.image.width||T.height!==Ye.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");b.setupDepthRenderbuffer(T)}}const Ve=T.texture;(Ve.isData3DTexture||Ve.isDataArrayTexture||Ve.isCompressedArrayTexture)&&(ge=!0);const Ee=C.get(T).__webglFramebuffer;
vendor: 10,378 bytes, line 4112
4112T.isWebGLCubeRenderTarget?(Array.isArray(Ee[D])?H=Ee[D][V]:H=Ee[D],G=!0):T.samples>0&&b.useMultisampledRTT(T)===!1?H=C.get(T).__webglMultisampledFramebuffer:Array.isArray(Ee)?H=Ee[V]:H=Ee,re.copy(T.viewport),le.copy(T.scissor),de=T.scissorTest}else re.copy(ve).multiplyScalar(ot).floor(),le.copy(qe).multiplyScalar(ot).floor(),de=et;if(V!==0&&(H=Te),_e.bindFramebuffer(N.FRAMEBUFFER,H)&&_e.drawBuffers(T,H),_e.viewport(re),_e.scissor(le),_e.setScissorTest(de),G){const ue=C.get(T.texture);N.framebufferTexture2D(N.FRAMEBUFFER,N.COLOR_ATTACHMENT0,N.TEXTURE_CUBE_MAP_POSITIVE_X+D,ue.__webglTexture,V)}else if(ge){const ue=D;for(let Ve=0;Ve<T.textures.length;Ve++){const Ee=C.get(T.textures[Ve]);N.framebufferTextureLayer(N.FRAMEBUFFER,N.COLOR_ATTACHMENT0+Ve,Ee.__webglTexture,V,ue)}}else if(T!==null&&V!==0){const ue=C.get(T.texture);N.framebufferTexture2D(N.FRAMEBUFFER,N.COLOR_ATTACHMENT0,N.TEXTURE_2D,ue.__webglTexture,V)}k=-1},this.readRenderTargetPixels=function(T,D,V,H,G,ge,Ce,ue=0){if(!(T&&T.isWebGLRenderTarget)){Ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ve=C.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&Ce!==void 0&&(Ve=Ve[Ce]),Ve){_e.bindFramebuffer(N.FRAMEBUFFER,Ve);try{const Ee=T.textures[ue],Ye=Ee.format,nt=Ee.type;if(T.textures.length>1&&N.readBuffer(N.COLOR_ATTACHMENT0+ue),!it.textureFormatReadable(Ye)){Ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!it.textureTypeReadable(nt)){Ze("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}D>=0&&D<=T.width-H&&V>=0&&V<=T.height-G&&N.readPixels(D,V,H,G,z.convert(Ye),z.convert(nt),ge)}finally{const Ee=B!==null?C.get(B).__webglFramebuffer:null;_e.bindFramebuffer(N.FRAMEBUFFER,Ee)}}},this.readRenderTargetPixelsAsync=async function(T,D,V,H,G,ge,Ce,ue=0){if(!(T&&T.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Ve=C.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&Ce!==void 0&&(Ve=Ve[Ce]),Ve)if(D>=0&&D<=T.width-H&&V>=0&&V<=T.height-G){_e.bindFramebuffer(N.FRAMEBUFFER,Ve);const Ee=T.textures[ue],Ye=Ee.format,nt=Ee.type;if(T.textures.length>1&&N.readBuffer(N.COLOR_ATTACHMENT0+ue),!it.textureFormatReadable(Ye))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!it.textureTypeReadable(nt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Xe=N.createBuffer();N.bindBuffer(N.PIXEL_PACK_BUFFER,Xe),N.bufferData(N.PIXEL_PACK_BUFFER,ge.byteLength,N.STREAM_READ),N.readPixels(D,V,H,G,z.convert(Ye),z.convert(nt),0);const vt=B!==null?C.get(B).__webglFramebuffer:null;_e.bindFramebuffer(N.FRAMEBUFFER,vt);const st=N.fenceSync(N.SYNC_GPU_COMMANDS_COMPLETE,0);return N.flush(),await fm(N,st,4),N.bindBuffer(N.PIXEL_PACK_BUFFER,Xe),N.getBufferSubData(N.PIXEL_PACK_BUFFER,0,ge),N.deleteBuffer(Xe),N.deleteSync(st),ge}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(T,D=null,V=0){const H=Math.pow(2,-V),G=Math.floor(T.image.width*H),ge=Math.floor(T.image.height*H),Ce=D!==null?D.x:0,ue=D!==null?D.y:0;b.setTexture2D(T,0),N.copyTexSubImage2D(N.TEXTURE_2D,V,0,0,Ce,ue,G,ge),_e.unbindTexture()};const Ot=N.createFramebuffer(),$e=N.createFramebuffer();this.copyTextureToTexture=function(T,D,V=null,H=null,G=0,ge=0){let Ce,ue,Ve,Ee,Ye,nt,Xe,vt,st;const xt=T.isCompressedTexture?T.mipmaps[ge]:T.image;if(V!==null)Ce=V.max.x-V.min.x,ue=V.max.y-V.min.y,Ve=V.isBox3?V.max.z-V.min.z:1,Ee=V.min.x,Ye=V.min.y,nt=V.isBox3?V.min.z:0;else{const qt=Math.pow(2,-G);Ce=Math.floor(xt.width*qt),ue=Math.floor(xt.height*qt),T.isDataArrayTexture?Ve=xt.depth:T.isData3DTexture?Ve=Math.floor(xt.depth*qt):Ve=1,Ee=0,Ye=0,nt=0}H!==null?(Xe=H.x,vt=H.y,st=H.z):(Xe=0,vt=0,st=0);const je=z.convert(D.format),dt=z.convert(D.type);let Ne;D.isData3DTexture?(b.setTexture3D(D,0),Ne=N.TEXTURE_3D):D.isDataArrayTexture||D.isCompressedArrayTexture?(b.setTexture2DArray(D,0),Ne=N.TEXTURE_2D_ARRAY):(b.setTexture2D(D,0),Ne=N.TEXTURE_2D),_e.activeTexture(N.TEXTURE0),_e.pixelStorei(N.UNPACK_FLIP_Y_WEBGL,D.flipY),_e.pixelStorei(N.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),_e.pixelStorei(N.UNPACK_ALIGNMENT,D.unpackAlignment);const Wt=_e.getParameter(N.UNPACK_ROW_LENGTH),lt=_e.getParameter(N.UNPACK_IMAGE_HEIGHT),Xt=_e.getParameter(N.UNPACK_SKIP_PIXELS),Xi=_e.getParameter(N.UNPACK_SKIP_ROWS),mn=_e.getParameter(N.UNPACK_SKIP_IMAGES);_e.pixelStorei(N.UNPACK_ROW_LENGTH,xt.width),_e.pixelStorei(N.UNPACK_IMAGE_HEIGHT,xt.height),_e.pixelStorei(N.UNPACK_SKIP_PIXELS,Ee),_e.pixelStorei(N.UNPACK_SKIP_ROWS,Ye),_e.pixelStorei(N.UNPACK_SKIP_IMAGES,nt);const ms=T.isDataArrayTexture||T.isData3DTexture,Nt=D.isDataArrayTexture||D.isData3DTexture;if(T.isDepthTexture){const qt=C.get(T),gn=C.get(D),Dt=C.get(qt.__renderTarget),vn=C.get(gn.__renderTarget);_e.bindFramebuffer(N.READ_FRAMEBUFFER,Dt.__webglFramebuffer),_e.bindFramebuffer(N.DRAW_FRAMEBUFFER,vn.__webglFramebuffer);for(let gs=0;gs<Ve;gs++)ms&&(N.framebufferTextureLayer(N.READ_FRAMEBUFFER,N.COLOR_ATTACHMENT0,C.get(T).__webglTexture,G,nt+gs),N.framebufferTextureLayer(N.DRAW_FRAMEBUFFER,N.COLOR_ATTACHMENT0,C.get(D).__webglTexture,ge,st+gs)),N.blitFramebuffer(Ee,Ye,Ce,ue,Xe,vt,Ce,ue,N.DEPTH_BUFFER_BIT,N.NEAREST);_e.bindFramebuffer(N.READ_FRAMEBUFFER,null),_e.bindFramebuffer(N.DRAW_FRAMEBUFFER,null)}else if(G!==0||T.isRenderTargetTexture||C.has(T)){const qt=C.get(T),gn=C.get(D);_e.bindFramebuffer(N.READ_FRAMEBUFFER,Ot),_e.bindFramebuffer(N.DRAW_FRAMEBUFFER,$e);for(let Dt=0;Dt<Ve;Dt++)ms?N.framebufferTextureLayer(N.READ_FRAMEBUFFER,N.COLOR_ATTACHMENT0,qt.__webglTexture,G,nt+Dt):N.framebufferTexture2D(N.READ_FRAMEBUFFER,N.COLOR_ATTACHMENT0,N.TEXTURE_2D,qt.__webglTexture,G),Nt?N.framebufferTextureLayer(N.DRAW_FRAMEBUFFER,N.COLOR_ATTACHMENT0,gn.__webglTexture,ge,st+Dt):N.framebufferTexture2D(N.DRAW_FRAMEBUFFER,N.COLOR_ATTACHMENT0,N.TEXTURE_2D,gn.__webglTexture,ge),G!==0?N.blitFramebuffer(Ee,Ye,Ce,ue,Xe,vt,Ce,ue,N.COLOR_BUFFER_BIT,N.NEAREST):Nt?N.copyTexSubImage3D(Ne,ge,Xe,vt,st+Dt,Ee,Ye,Ce,ue):N.copyTexSubImage2D(Ne,ge,Xe,vt,Ee,Ye,Ce,ue);_e.bindFramebuffer(N.READ_FRAMEBUFFER,null),_e.bindFramebuffer(N.DRAW_FRAMEBUFFER,null)}else Nt?T.isDataTexture||T.isData3DTexture?N.texSubImage3D(Ne,ge,Xe,vt,st,Ce,ue,Ve,je,dt,xt.data):D.isCompressedArrayTexture?N.compressedTexSubImage3D(Ne,ge,Xe,vt,st,Ce,ue,Ve,je,xt.data):N.texSubImage3D(Ne,ge,Xe,vt,st,Ce,ue,Ve,je,dt,xt):T.isDataTexture?N.texSubImage2D(N.TEXTURE_2D,ge,Xe,vt,Ce,ue,je,dt,xt.data):T.isCompressedTexture?N.compressedTexSubImage2D(N.TEXTURE_2D,ge,Xe,vt,xt.width,xt.height,je,xt.data):N.texSubImage2D(N.TEXTURE_2D,ge,Xe,vt,Ce,ue,je,dt,xt);_e.pixelStorei(N.UNPACK_ROW_LENGTH,Wt),_e.pixelStorei(N.UNPACK_IMAGE_HEIGHT,lt),_e.pixelStorei(N.UNPACK_SKIP_PIXELS,Xt),_e.pixelStorei(N.UNPACK_SKIP_ROWS,Xi),_e.pixelStorei(N.UNPACK_SKIP_IMAGES,mn),ge===0&&D.generateMipmaps&&N.generateMipmap(Ne),_e.unbindTexture()},this.initRenderTarget=function(T){C.get(T).__webglFramebuffer===void 0&&b.setupRenderTarget(T)},this.initTexture=function(T){T.isCubeTexture?b.setTextureCube(T,0):T.isData3DTexture?b.setTexture3D(T,0):T.isDataArrayTexture||T.isCompressedArrayTexture?b.setTexture2DArray(T,0):b.setTexture2D(T,0),_e.unbindTexture()},this.resetState=function(){q=0,W=0,B=null,_e.reset(),Me.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return wi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=bt._getDrawingBufferColorSpace(e),t.unpackColorSpace=bt._getUnpackColorSpace()}}const _S=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Xc,AddEquation:En,AddOperation:Bd,AdditiveAnimationBlendMode:eh,AdditiveBlending:bc,AgXToneMapping:Yc,AlphaFormat:Qc,AlwaysCompare:$d,AlwaysDepth:oo,AlwaysStencilFunc:Rc,AmbientLight:Wf,AnimationAction:ep,AnimationClip:Zr,AnimationLoader:sv,AnimationMixer:Uv,AnimationObjectGroup:Pv,AnimationUtils:ev,ArcCurve:pf,ArrayCamera:$f,ArrowHelper:r_,AttachedBindMode:Ec,Audio:Qf,AudioAnalyser:Mv,AudioContext:Eh,AudioListener:_v,AudioLoader:pv,AxesHelper:a_,BackSide:pi,BasicDepthPacking:Gd,BasicShadowMap:Mp,BatchedMesh:lf,BezierInterpolant:Ff,Bone:oh,BooleanKeyframeTrack:fs,Box2:Gv,Box3:oi,Box3Helper:n_,BoxGeometry:ds,BoxHelper:i_,BufferAttribute:Ut,BufferGeometry:mt,BufferGeometryLoader:Zf,ByteType:Ko,Cache:Ki,Camera:Cl,CameraHelper:t_,CanvasTexture:yg,CapsuleGeometry:ml,CatmullRomCurve3:mf,CineonToneMapping:Wc,CircleGeometry:gl,ClampToEdgeWrapping:Gt,Clock:kv,Color:He,ColorKeyframeTrack:Sh,ColorManagement:bt,Compatibility:lm,CompressedArrayTexture:vg,CompressedCubeTexture:_g,CompressedTexture:pl,CompressedTextureLoader:rv,ConeGeometry:na,ConstantAlphaFactor:Dd,ConstantColorFactor:Ud,Controls:l_,CubeCamera:Jf,CubeDepthTexture:df,CubeReflectionMapping:Qi,CubeRefractionMapping:Pn,CubeTexture:ta,CubeTextureLoader:av,CubeUVReflectionMapping:Js,CubicBezierCurve:uh,CubicBezierCurve3:gf,CubicInterpolant:Df,CullFaceBack:Sc,CullFaceFront:vd,CullFaceFrontBack:xp,CullFaceNone:gd,Curve:Gi,CurvePath:_f,CustomBlending:yd,CustomToneMapping:qc,CylinderGeometry:ia,Cylindrical:Hv,Data3DTexture:ol,DataArrayTexture:al,DataTexture:Ii,DataTextureLoader:bh,DataUtils:is,DecrementStencilOp:zp,DecrementWrapStencilOp:Vp,DefaultLoadingManager:zf,DepthFormat:ji,DepthStencilFormat:An,DepthTexture:hs,DetachedBindMode:zd,DirectionalLight:Gf,DirectionalLightHelper:e_,DiscreteInterpolant:Of,DodecahedronGeometry:vl,DoubleSide:Fi,DstAlphaFactor:Cd,DstColorFactor:Id,DynamicCopyUsage:im,DynamicDrawUsage:$p,DynamicReadUsage:jp,EdgesGeometry:ff,EllipseCurve:_l,EqualCompare:Yd,EqualDepth:co,EqualStencilFunc:Xp,EquirectangularReflectionMapping:br,EquirectangularRefractionMapping:Tr,Euler:Vi,EventDispatcher:Hi,ExternalTexture:ch,ExtrudeGeometry:yl,FileLoader:Ai,Float16BufferAttribute:Km,Float32BufferAttribute:Ge,FloatType:Ft,Fog:hl,FogExp2:cl,FramebufferTexture:gg,FrontSide:un,Frustum:Ks,FrustumArray:fl,GLBufferAttribute:Bv,G
4112LSL1:sm,GLSL3:Ic,GreaterCompare:Zd,GreaterDepth:uo,GreaterEqualCompare:rl,GreaterEqualDepth:ho,GreaterEqualStencilFunc:Jp,GreaterStencilFunc:Yp,GridHelper:Qv,Group:Vs,HTMLTexture:xg,HalfFloatType:Jt,HemisphereLight:kf,HemisphereLightHelper:Kv,IcosahedronGeometry:sa,ImageBitmapLoader:fv,ImageLoader:Jr,ImageUtils:ef,IncrementStencilOp:Bp,IncrementWrapStencilOp:kp,InstancedBufferAttribute:qs,InstancedBufferGeometry:Yf,InstancedInterleavedBuffer:Fv,InstancedMesh:of,Int16BufferAttribute:Jm,Int32BufferAttribute:$m,Int8BufferAttribute:qm,IntType:Qr,InterleavedBuffer:ul,InterleavedBufferAttribute:cs,Interpolant:Qs,InterpolateBezier:Cc,InterpolateDiscrete:Fr,InterpolateLinear:Wo,InterpolateSmooth:to,InterpolationSamplingMode:om,InterpolationSamplingType:am,InvertStencilOp:Hp,KeepStencilOp:Qn,KeyframeTrack:Pi,LOD:rf,LatheGeometry:xl,Layers:ll,LessCompare:qd,LessDepth:lo,LessEqualCompare:sl,LessEqualDepth:os,LessEqualStencilFunc:qp,LessStencilFunc:Wp,Light:Bn,LightProbe:qf,Line:Dn,Line3:qv,LineBasicMaterial:_i,LineCurve:dh,LineCurve3:vf,LineDashedMaterial:Uf,LineLoop:cf,LineSegments:en,LinearFilter:wt,LinearInterpolant:Mh,LinearMipMapLinearFilter:Ac,LinearMipMapNearestFilter:wp,LinearMipmapLinearFilter:$i,LinearMipmapNearestFilter:wr,LinearSRGBColorSpace:Un,LinearToneMapping:Hc,LinearTransfer:zr,Loader:yi,LoaderUtils:Dc,LoadingManager:Al,LoopOnce:kd,LoopPingPong:Hd,LoopRepeat:Vd,MOUSE:_p,Material:li,MaterialBlending:Sp,MaterialLoader:Rl,MathUtils:Pm,Matrix2:Fc,Matrix3:ft,Matrix4:ct,MaxEquation:bd,Mesh:kt,MeshBasicMaterial:fn,MeshDepthMaterial:_h,MeshDistanceMaterial:yh,MeshLambertMaterial:Pf,MeshMatcapMaterial:Lf,MeshNormalMaterial:If,MeshPhongMaterial:Cf,MeshPhysicalMaterial:Af,MeshStandardMaterial:vh,MeshToonMaterial:Rf,MinEquation:Sd,MirroredRepeatWrapping:Nr,MixOperation:Fd,MultiplyBlending:wc,MultiplyOperation:Kr,NearestFilter:Zt,NearestMipMapLinearFilter:Tp,NearestMipMapNearestFilter:bp,NearestMipmapLinearFilter:zs,NearestMipmapNearestFilter:Jc,NeutralToneMapping:Zc,NeverCompare:Xd,NeverDepth:ao,NeverStencilFunc:Gp,NoBlending:zi,NoColorSpace:ln,NoNormalPacking:Up,NoToneMapping:ki,NormalAnimationBlendMode:nl,NormalBlending:ss,NormalGAPacking:Dp,NormalRGPacking:Np,NotEqualCompare:Jd,NotEqualDepth:fo,NotEqualStencilFunc:Zp,NumberKeyframeTrack:qr,Object3D:Ct,ObjectLoader:uv,ObjectSpaceNormalMap:Wd,OctahedronGeometry:ra,OneFactor:wd,OneMinusConstantAlphaFactor:Od,OneMinusConstantColorFactor:Nd,OneMinusDstAlphaFactor:Rd,OneMinusDstColorFactor:Pd,OneMinusSrcAlphaFactor:ro,OneMinusSrcColorFactor:Ad,OrthographicCamera:js,PCFShadowMap:Sr,PCFSoftShadowMap:_d,PMREMGenerator:zc,Path:Jo,PerspectiveCamera:ti,Plane:wn,PlaneGeometry:Fn,PlaneHelper:s_,PointLight:Hf,PointLightHelper:Jv,Points:hf,PointsMaterial:lh,PolarGridHelper:jv,PolyhedronGeometry:On,PositionalAudio:xv,PropertyBinding:At,PropertyMixer:jf,QuadraticBezierCurve:fh,QuadraticBezierCurve3:ph,Quaternion:mi,QuaternionKeyframeTrack:oa,QuaternionLinearInterpolant:Bf,R11_EAC_Format:Mo,RED_GREEN_RGTC2_Format:Or,RED_RGT
4112C1_Format:Vo,REVISION:$r,RG11_EAC_Format:Dr,RGBADepthPacking:Ip,RGBAFormat:Kt,RGBAIntegerFormat:il,RGBA_ASTC_10x10_Format:Do,RGBA_ASTC_10x5_Format:Lo,RGBA_ASTC_10x6_Format:Uo,RGBA_ASTC_10x8_Format:No,RGBA_ASTC_12x10_Format:Oo,RGBA_ASTC_12x12_Format:Fo,RGBA_ASTC_4x4_Format:To,RGBA_ASTC_5x4_Format:wo,RGBA_ASTC_5x5_Format:Eo,RGBA_ASTC_6x5_Format:Ao,RGBA_ASTC_6x6_Format:Co,RGBA_ASTC_8x5_Format:Ro,RGBA_ASTC_8x6_Format:Io,RGBA_ASTC_8x8_Format:Po,RGBA_BPTC_Format:Bo,RGBA_ETC2_EAC_Format:xo,RGBA_PVRTC_2BPPV1_Format:vo,RGBA_PVRTC_4BPPV1_Format:go,RGBA_S3TC_DXT1_Format:Ar,RGBA_S3TC_DXT3_Format:Cr,RGBA_S3TC_DXT5_Format:Rr,RGBDepthPacking:Pp,RGBFormat:jc,RGBIntegerFormat:Ep,RGB_BPTC_SIGNED_Format:zo,RGB_BPTC_UNSIGNED_Format:ko,RGB_ETC1_Format:_o,RGB_ETC2_Format:yo,RGB_PVRTC_2BPPV1_Format:mo,RGB_PVRTC_4BPPV1_Format:po,RGB_S3TC_DXT1_Format:Er,RGDepthPacking:Lp,RGFormat:Ln,RGIntegerFormat:tl,RawShaderMaterial:gh,Ray:$s,Raycaster:zv,RectAreaLight:Xf,RedFormat:jr,RedIntegerFormat:ea,ReinhardToneMapping:Gc,RenderTarget:ih,RenderTarget3D:Nv,RepeatWrapping:Ur,ReplaceStencilOp:Fp,ReverseSubtractEquation:Md,RingGeometry:Ml,SIGNED_R11_EAC_Format:So,SIGNED_RED_GREEN_RGTC2_Format:Go,SIGNED_RED_RGTC1_Format:Ho,SIGNED_RG11_EAC_Format:bo,SRGBColorSpace:di,SRGBTransfer:It,Scene:nh,ShaderChunk:_t,ShaderLib:Oi,ShaderMaterial:vi,ShadowMaterial:Tf,Shape:as,ShapeGeometry:Sl,ShapePath:o_,ShapeUtils:Bi,ShortType:Qo,Skeleton:dl,SkeletonHelper:Zv,SkinnedMesh:af,Source:Cn,Sphere:ni,SphereGeometry:aa,Spherical:Vv,SphericalHarmonics3:wh,SplineCurve:mh,SpotLight:Vf,SpotLightHelper:Yv,Sprite:sf,SpriteMaterial:ah,SrcAlphaFactor:so,SrcAlphaSaturateFactor:Ld,SrcColorFactor:Ed,StaticCopyUsage:tm,StaticDrawUsage:kr,StaticReadUsage:Qp,StereoCamera:mv,StreamCopyUsage:nm,StreamDrawUsage:Kp,StreamReadUsage:em,StringKeyframeTrack:ps,SubtractEquation:xd,SubtractiveBlending:Tc,TOUCH:yp,TangentSpaceNormalMap:dn,TetrahedronGeometry:bl,Texture:Lt,TextureLoader:ov,TextureUtils:f_,Timer:Kf,TimestampQuery:rm,TorusGeometry:Tl,TorusKnotGeometry:wl,Triangle:Si,TriangleFanDrawMode:Rp,TriangleStripDrawMode:Cp,TrianglesDrawMode:Ap,TubeGeometry:El,UVMapping:In,Uint16BufferAttribute:sh,Uint32BufferAttribute:rh,Uint8BufferAttribute:Ym,Uint8ClampedBufferAttribute:Zm,Uniform:Rh,UniformsGroup:Ov,UniformsLib:Oe,UniformsUtils:Ef,UnsignedByteType:ii,UnsignedInt101111Type:Kc,UnsignedInt248Type:Ws,UnsignedInt5999Type:$c,UnsignedIntType:Ci,UnsignedShort4444Type:jo,UnsignedShort5551Type:el,UnsignedShortType:Gs,VSMShadowMap:Bs,Vector2:se,Vector3:P,Vector4:Pt,VectorKeyframeTrack:Yr,VideoFrameTexture:mg,VideoTexture:uf,WebGL3DRenderTarget:Om,WebGLArrayRenderTarget:Dm,WebGLCoordinateSystem:wi,WebGLCubeRenderTarget:Ih,WebGLRenderTarget:gi,WebGLRenderer:hp,WebGLUtils:lp,WebGPUCoordinateSystem:ls,WebXRController:io,WireframeGeometry:bf,WrapAroundEnding:Br,ZeroCurvatureEnding:es,ZeroFactor:Td,ZeroSlopeEnding:ts,ZeroStencilOp:Op,createCanvasElement:Qd,error:Ze,getConsoleFunction:dm,log:Hr,setConsoleFunction:um,warn:Re,warnOnce:Xo},Symbol.toStringTag,{value:"Module"})),up=parseInt($r.replace(/\D+/g,"")),oS=r=>r&&r.isCubeTexture;class yS extends kt{constructor(e,t){var i,n;const s=oS(e),o=((n=s?(i=e.image[0])==null?void 0:i.width:e.image.width)!=null?n:1024)/4,l=Math.floor(Math.log2(o)),c=Math.pow(2,l),u=3*Math.max(c,112),d=4*c,h=[s?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/u}`,`#define CUBEUV_TEXEL_HEIGHT ${1/d}`,`#define CUBEUV_MAX_MIP ${l}.0`],f=`
4113        varying vec3 vWorldPosition;
4114        void main() 
4115        {
4116            vec4 worldPosition = ( modelMatrix * vec4( position, 1.0 ) );
4117            vWorldPosition = worldPosition.xyz;
4118            
4119            gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
4120        }
4121        `,p=h.join(`
4122`)+`
4123        #define ENVMAP_TYPE_CUBE_UV
4124        varying vec3 vWorldPosition;
4125        uniform float radius;
4126        uniform float height;
4127        uniform float angle;
4128        #ifdef ENVMAP_TYPE_CUBE
4129            uniform samplerCube map;
4130        #else
4131            uniform sampler2D map;
4132        #endif
4133        // From: https://www.shadertoy.com/view/4tsBD7
4134        float diskIntersectWithBackFaceCulling( vec3 ro, vec3 rd, vec3 c, vec3 n, float r ) 
4135        {
4136            float d = dot ( rd, n );
4137            
4138            if( d > 0.0 ) { return 1e6; }
4139            
4140            vec3  o = ro - c;
4141            float t = - dot( n, o ) / d;
4142            vec3  q = o + rd * t;
4143            
4144            return ( dot( q, q ) < r * r ) ? t : 1e6;
4145        }
4146        // From: https://www.iquilezles.org/www/articles/intersectors/intersectors.htm
4147        float sphereIntersect( vec3 ro, vec3 rd, vec3 ce, float ra ) 
4148        {
4149            vec3 oc = ro - ce;
4150            float b = dot( oc, rd );
4151            float c = dot( oc, oc ) - ra * ra;
4152            float h = b * b - c;
4153            
4154            if( h < 0.0 ) { return -1.0; }
4155            
4156            h = sqrt( h );
4157            
4158            return - b + h;
4159        }
4160        vec3 project() 
4161        {
4162            vec3 p = normalize( vWorldPosition );
4163            vec3 camPos = cameraPosition;
4164            camPos.y -= height;
4165            float intersection = sphereIntersect( camPos, p, vec3( 0.0 ), radius );
4166            if( intersection > 0.0 ) {
4167                
4168                vec3 h = vec3( 0.0, - height, 0.0 );
4169                float intersection2 = diskIntersectWithBackFaceCulling( camPos, p, h, vec3( 0.0, 1.0, 0.0 ), radius );
4170                p = ( camPos + min( intersection, intersection2 ) * p ) / radius;
4171            } else {
4172                p = vec3( 0.0, 1.0, 0.0 );
4173            }
4174            return p;
4175        }
4176        #include <common>
4177        #include <cube_uv_reflection_fragment>
4178        void main() 
4179        {
4180            vec3 projectedWorldPosition = project();
4181            
4182            #ifdef ENVMAP_TYPE_CUBE
4183                vec3 outcolor = textureCube( map, projectedWorldPosition ).rgb;
4184            #else
4185                vec3 direction = normalize( projectedWorldPosition );
4186                vec2 uv = equirectUv( direction );
4187                vec3 outcolor = texture2D( map, uv ).rgb;
4188            #endif
4189            gl_FragColor = vec4( outcolor, 1.0 );
4190            #include <tonemapping_fragment>
4191            #include <${up>=154?"colorspace_fragment":"encodings_fragment"}>
4192        }
4193        `,v={map:{value:e},height:{value:(t==null?void 0:t.height)||15},radius:{value:(t==null?void 0:t.radius)||100}},g=new sa(1,16),m=new vi({uniforms:v,fragmentShader:p,vertexShader:f,side:Fi});super(g,m)}set radius(e){this.material.uniforms.radius.value=e}get radius(){return this.material.uniforms.radius.value}set height(e){this.material.uniforms.height.value=e}get height(){return this.material.uniforms.height.value}}class xS extends bh{constructor(e){super(e),this.type=Jt}parse(e){const a=function(y,w){switch(y){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(w||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(w||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(w||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(w||""))}},d=function(y,w,U){w=w||1024;let O=y.pos,q=-1,W=0,B="",k=String.fromCharCode.apply(null,new Uint16Array(y.subarray(O,O+128)));for(;0>(q=k.indexOf(`
4194`))&&W<w&&O<y.byteLength;)B+=k,W+=k.length,O+=128,k+=String.fromCharCode.apply(null,new Uint16Array(y.subarray(O,O+128)));return-1<q?(y.pos+=W+q+1,B+k.slice(0,q)):!1},h=function(y){const w=/^#\?(\S+)/,U=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,L=/^\s*EXPOSURE\s*=\s
vendor: 22,053 bytes, lines 4194-4197
4194*(\d+(\.\d+)?)\s*$/,O=/^\s*FORMAT=(\S+)\s*$/,q=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,W={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let B,k;for((y.pos>=y.byteLength||!(B=d(y)))&&a(1,"no header found"),(k=B.match(w))||a(3,"bad initial token"),W.valid|=1,W.programtype=k[1],W.string+=B+`
4195`;B=d(y),B!==!1;){if(W.string+=B+`
4196`,B.charAt(0)==="#"){W.comments+=B+`
4197`;continue}if((k=B.match(U))&&(W.gamma=parseFloat(k[1])),(k=B.match(L))&&(W.exposure=parseFloat(k[1])),(k=B.match(O))&&(W.valid|=2,W.format=k[1]),(k=B.match(q))&&(W.valid|=4,W.height=parseInt(k[1],10),W.width=parseInt(k[2],10)),W.valid&2&&W.valid&4)break}return W.valid&2||a(3,"missing format specifier"),W.valid&4||a(3,"missing image size specifier"),W},f=function(y,w,U){const L=w;if(L<8||L>32767||y[0]!==2||y[1]!==2||y[2]&128)return new Uint8Array(y);L!==(y[2]<<8|y[3])&&a(3,"wrong scanline width");const O=new Uint8Array(4*w*U);O.length||a(4,"unable to allocate buffer space");let q=0,W=0;const B=4*L,k=new Uint8Array(4),Y=new Uint8Array(B);let re=U;for(;re>0&&W<y.byteLength;){W+4>y.byteLength&&a(1),k[0]=y[W++],k[1]=y[W++],k[2]=y[W++],k[3]=y[W++],(k[0]!=2||k[1]!=2||(k[2]<<8|k[3])!=L)&&a(3,"bad rgbe scanline format");let le=0,de;for(;le<B&&W<y.byteLength;){de=y[W++];const Ue=de>128;if(Ue&&(de-=128),(de===0||le+de>B)&&a(3,"bad scanline data"),Ue){const Ke=y[W++];for(let yt=0;yt<de;yt++)Y[le++]=Ke}else Y.set(y.subarray(W,W+de),le),le+=de,W+=de}const De=L;for(let Ue=0;Ue<De;Ue++){let Ke=0;O[q]=Y[Ue+Ke],Ke+=L,O[q+1]=Y[Ue+Ke],Ke+=L,O[q+2]=Y[Ue+Ke],Ke+=L,O[q+3]=Y[Ue+Ke],q+=4}re--}return O},p=function(y,w,U,L){const O=y[w+3],q=Math.pow(2,O-128)/255;U[L+0]=y[w+0]*q,U[L+1]=y[w+1]*q,U[L+2]=y[w+2]*q,U[L+3]=1},v=function(y,w,U,L){const O=y[w+3],q=Math.pow(2,O-128)/255;U[L+0]=is.toHalfFloat(Math.min(y[w+0]*q,65504)),U[L+1]=is.toHalfFloat(Math.min(y[w+1]*q,65504)),U[L+2]=is.toHalfFloat(Math.min(y[w+2]*q,65504)),U[L+3]=is.toHalfFloat(1)},g=new Uint8Array(e);g.pos=0;const m=h(g),_=m.width,x=m.height,M=f(g.subarray(g.pos),_,x);let R,E,I;switch(this.type){case Ft:I=M.length/4;const y=new Float32Array(I*4);for(let U=0;U<I;U++)p(M,U*4,y,U*4);R=y,E=Ft;break;case Jt:I=M.length/4;const w=new Uint16Array(I*4);for(let U=0;U<I;U++)v(M,U*4,w,U*4);R=w,E=Jt;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:_,height:x,data:R,header:m.string,gamma:m.gamma,exposure:m.exposure,type:E}}setDataType(e){return this.type=e,this}load(e,t,i,n){function s(a,o){switch(a.type){case Ft:case Jt:"colorSpace"in a?a.colorSpace="srgb-linear":a.encoding=3e3,a.minFilter=wt,a.magFilter=wt,a.generateMipmaps=!1,a.flipY=!0;break}t&&t(a,o)}return super.load(e,s,i,n)}}const vr=up>=152;class MS extends bh{constructor(e){super(e),this.type=Jt}parse(e){const w=Math.pow(2.7182818,2.2);function U(S,A){for(var F=0,Z=0;Z<65536;++Z)(Z==0||S[Z>>3]&1<<(Z&7))&&(A[F++]=Z);for(var K=F-1;F<65536;)A[F++]=0;return K}function L(S){for(var A=0;A<16384;A++)S[A]={},S[A].len=0,S[A].lit=0,S[A].p=null}const O={l:0,c:0,lc:0};function q(S,A,F,Z,K){for(;F<S;)A=A<<8|Be(Z,K),F+=8;F-=S,O.l=A>>F&(1<<S)-1,O.c=A,O.lc=F}const W=new Array(59);function B(S){for(var A=0;A<=58;++A)W[A]=0;for(var A=0;A<65537;++A)W[S[A]]+=1;for(var F=0,A=58;A>0;--A){var Z=F+W[A]>>1;W[A]=F,F=Z}for(var A=0;A<65537;++A){var K=S[A];K>0&&(S[A]=K|W[K]++<<6)}}function k(S,A,F,Z,K,Q,ye){for(var fe=F,Ae=0,we=0;K<=Q;K++){if(fe.value-F.value>Z)return!1;q(6,Ae,we,S,fe);var Le=O.l;if(Ae=O.c,we=O.lc,ye[K]=Le,Le==63){if(fe.value-F.value>Z)throw"Something wrong with hufUnpackEncTable";q(8,Ae,we,S,fe);var Te=O.l+6;if(Ae=O.c,we=O.lc,K+Te>Q+1)throw"Something wrong with hufUnpackEncTable";for(;Te--;)ye[K++]=0;K--}else if(Le>=59){var Te=Le-59+2;if(K+Te>Q+1)throw"Something wrong with hufUnpackEncTable";for(;Te--;)ye[K++]=0;K--}}B(ye)}function Y(S){return S&63}function re(S){return S>>6}function le(S,A,F,Z){for(;A<=F;A++){var K=re(S[A]),Q=Y(S[A]);if(K>>Q)throw"Invalid table entry";if(Q>14){var ye=Z[K>>Q-14];if(ye.len)throw"Invalid table entry";if(ye.lit++,ye.p){var fe=ye.p;ye.p=new Array(ye.lit);for(var Ae=0;Ae<ye.lit-1;++Ae)ye.p[Ae]=fe[Ae]}else ye.p=new Array(1);ye.p[ye.lit-1]=A}else if(Q)for(var we=0,Ae=1<<14-Q;Ae>0;Ae--){var ye=Z[(K<<14-Q)+we];if(ye.len||ye.p)throw"Invalid table entry";ye.len=Q,ye.lit=A,we++}}return!0}const de={c:0,lc:0};function De(S,A,F,Z){S=S<<8|Be(F,Z),A+=8,de.c=S,de.lc=A}const Ue={c:0,lc:0};function Ke(S,A,F,Z,K,Q,ye,fe,Ae,we){if(S==A){Z<8&&(De(F,Z,K,ye),F=de.c,Z=de.lc),Z-=8;var Le=F>>Z,Le=new Uint8Array([Le])[0];if(Ae.value+Le>we)return!1;for(var Te=fe[Ae.value-1];Le-- >0;)fe[Ae.value++]=Te}else if(Ae.value<we)fe[Ae.value++]=S;else return!1;Ue.c=F,Ue.lc=Z}function yt(S){return S&65535}function ot(S){var A=yt(S);return A>32767?A-65536:A}const J={a:0,b:0};function Ie(S,A){var F=ot(S),Z=ot(A),K=Z,Q=F+(K&1)+(K>>1),ye=Q,fe=Q-K;J.a=ye,J.b=fe}function ve(S,A){var F=yt(S),Z=yt(A),K=F-(Z>>1)&65535,Q=Z+K-32768&65535;J.a=Q,J.b=K}function qe(S,A,F,Z,K,Q,ye){for(var fe=ye<16384,Ae=F>K?K:F,we=1,Le;we<=Ae;)we<<=1;for(we>>=1,Le=we,we>>=1;we>=1;){for(var Te=0,Ot=Te+Q*(K-Le),$e=Q*we,T=Q*Le,D=Z*we,V=Z*Le,H,G,ge,Ce;Te<=Ot;Te+=T){for(var ue=Te,Ve=Te+Z*(F-Le);ue<=Ve;ue+=V){var Ee=ue+D,Ye=ue+$e,nt=Ye+D;fe?(Ie(S[ue+A],S[Ye+A]),H=J.a,ge=J.b,Ie(S[Ee+A],S[nt+A]),G=J.a,Ce=J.b,Ie(H,G),S[ue+A]=J.a,S[Ee+A]=J.b,Ie(ge,Ce),S[Ye+A]=J.a,S[nt+A]=J.b):(ve(S[ue+A],S[Ye+A]),H=J.a,ge=J.b,ve(S[Ee+A],S[nt+A]),G=J.a,Ce=J.b,ve(H,G),S[ue+A]=J.a,S[Ee+A]=J.b,ve(ge,Ce),S[Ye+A]=J.a,S[nt+A]=J.b)}if(F&we){var Ye=ue+$e;fe?Ie(S[ue+A],S[Ye+A]):ve(S[ue+A],S[Ye+A]),H=J.a,S[Ye+A]=J.b,S[ue+A]=H}}if(K&we)for(var ue=Te,Ve=Te+Z*(F-Le);ue<=Ve;ue+=V){var Ee=ue+D;fe?Ie(S[ue+A],S[Ee+A]):ve(S[ue+A],S[Ee+A]),H=J.a,S[Ee+A]=J.b,S[ue+A]=H}Le=we,we>>=1}return Te}function et(S,A,F,Z,K,Q,ye,fe,Ae,we){for(var Le=0,Te=0,Ot=fe,$e=Math.trunc(K.value+(Q+7)/8);K.value<$e;)for(De(Le,Te,F,K),Le=de.c,Te=de.lc;Te>=14;){var T=Le>>Te-14&16383,D=A[T];if(D.len)Te-=D.len,Ke(D.lit,ye,Le,Te,F,Z,K,Ae,we,Ot),Le=Ue.c,Te=Ue.lc;else{if(!D.p)throw"hufDecode issues";var V;for(V=0;V<D.lit;V++){for(var H=Y(S[D.p[V]]);Te<H&&K.value<$e;)De(Le,Te,F,K),Le=de.c,Te=de.lc;if(Te>=H&&re(S[D.p[V]])==(Le>>Te-H&(1<<H)-1)){Te-=H,Ke(D.p[V],ye,Le,Te,F,Z,K,Ae,we,Ot),Le=Ue.c,Te=Ue.lc;break}}if(V==D.lit)throw"hufDecode issues"}}var G=8-Q&7;for(Le>>=G,Te-=G;Te>0;){var D=A[Le<<14-Te&16383];if(D.len)Te-=D.len,Ke(D.lit,ye,Le,Te,F,Z,K,Ae,we,Ot),Le=Ue.c,Te=Ue.lc;else throw"hufDecode issues"}return!0}function Qe(S,A,F,Z,K,Q){var ye={value:0},fe=F.value,Ae=j(A,F),we=j(A,F);F.value+=4;var Le=j(A,F);if(F.value+=4,Ae<0||Ae>=65537||we<0||we>=65537)throw"Something wrong with HUF_ENCSIZE";var Te=new Array(65537),Ot=new Array(16384);L(Ot);var $e=Z-(F.value-fe);if(k(S,A,F,$e,Ae,we,Te),Le>8*(Z-(F.value-fe)))throw"Something wrong with hufUncompress";le(Te,Ae,we,Ot),et(Te,Ot,S,A,F,Le,we,Q,K,ye)}function Tt(S,A,F){for(var Z=0;Z<F;++Z)A[Z]=S[A[Z]]}function tt(S){for(var A=1;A<S.length;A++){var F=S[A-1]+S[A]-128;S[A]=F}}function ie(S,A){for(var F=0,Z=Math.floor((S.length+1)/2),K=0,Q=S.length-1;!(K>Q||(A[K++]=S[F++],K>Q));)A[K++]=S[Z++]}function me(S){for(var A=S.byteLength,F=new Array,Z=0,K=new DataView(S);A>0;){var Q=K.getInt8(Z++);if(Q<0){var ye=-Q;A-=ye+1;for(var fe=0;fe<ye;fe++)F.push(K.getUint8(Z++))}else{var ye=Q;A-=2;for(var Ae=K.getUint8(Z++),fe=0;fe<ye+1;fe++)F.push(Ae)}}return F}function ae(S,A,F,Z,K,Q){var Ee=new DataView(Q.buffer),ye=F[S.idx[0]].width,fe=F[S.idx[0]].height,Ae=3,we=Math.floor(ye/8),Le=Math.ceil(ye/8),Te=Math.ceil(fe/8),Ot=ye-(Le-1)*8,$e=fe-(Te-1)*8,T={value:0},D=new Array(Ae),V=new Array(Ae),H=new Array(Ae),G=new Array(Ae),ge=new Array(Ae);for(let st=0;st<Ae;++st)ge[st]=A[S.idx[st]],D[st]=st<1?0:D[st-1]+Le*Te,V[st]=new Float32Array(64),H[st]=new Uint16Array(64),G[st]=new Uint16Array(Le*64);for(let st=0;st<Te;++st){var Ce=8;st==Te-1&&(Ce=$e);var ue=8;for(let je=0;je<Le;++je){je==Le-1&&(ue=Ot);for(let dt=0;dt<Ae;++dt)H[dt].fill(0),H[dt][0]=K[D[dt]++],Fe(T,Z,H[dt]),Pe(H[dt],V[dt]),at(V[dt]);N(V);for(let dt=0;dt<Ae;++dt)ht(V[dt],G[dt],je*64)}let xt=0;for(let je=0;je<Ae;++je){const dt=F[S.idx[je]].type;for(let Ne=8*st;Ne<8*st+Ce;++Ne){xt=ge[je][Ne];for(let Wt=0;Wt<we;++Wt){const lt=Wt*64+(Ne&7)*8;Ee.setUint16(xt+0*dt,G[je][lt+0],!0),Ee.setUint16(xt+2*dt,G[je][lt+1],!0),Ee.setUint16(xt+4*dt,G[je][lt+2],!0),Ee.setUint16(xt+6*dt,G[je][lt+3],!0),Ee.setUint16(xt+8*dt,G[je][lt+4],!0),Ee.setUint16(xt+10*dt,G[je][lt+5],!0),Ee.setUint16(xt+12*dt,G[je][lt+6],!0),Ee.setUint16(xt+14*dt,G[je][lt+7],!0),xt+=16*dt}}if(we!=Le)for(let Ne=8*st;Ne<8*st+Ce;++Ne){const Wt=ge[je][Ne]+8*we*2*dt,lt=we*64+(Ne&7)*8;for(let Xt=0;Xt<ue;++Xt)Ee.setUint16(Wt+Xt*2*dt,G[je][lt+Xt],!0)}}}for(var Ve=new Uint16Array(ye),Ee=new DataView(Q.buffer),Ye=0;Ye<Ae;++Ye){F[S.idx[Ye]].decoded=!0;var nt=F[S.idx[Ye]].type;if(F[Ye].type==2)for(var Xe=0;Xe<fe;++Xe){const st=ge[Ye][Xe];for(var vt=0;vt<ye;++vt)Ve[vt]=Ee.getUint16(st+vt*2*nt,!0);for(var vt=0;vt<ye;++vt)Ee.setFloat32(st+vt*2*nt,ne(Ve[vt]),!0)}}}function Fe(S,A,F){for(var Z,K=1;K<64;)Z=A[S.value],Z==65280?K=64:Z>>8==255?K+=Z&255:(F[K]=Z,K++),S.value++}function Pe(S,A){A[0]=ne(S[0]),A[1]=ne(S[1]),A[2]=ne(S[5]),A[3]=ne(S[6]),A[4]=ne(S[14]),A[5]=ne(S[15]),A[6]=ne(S[27]),A[7]=ne(S[28]),A[8]=ne(S[2]),A[9]=ne(S[4]),A[10]=ne(S[7]),A[11]=ne(S[13]),A[12]=ne(S[16]),A[13]=ne(S[26]),A[14]=ne(S[29]),A[15]=ne(S[42]),A[16]=ne(S[3]),A[17]=ne(S[8]),A[18]=ne(S[12]),A[19]=ne(S[17]),A[20]=ne(S[25]),A[21]=ne(S[30]),A[22]=ne(S[41]),A[23]=ne(S[43]),A[24]=ne(S[9]),A[25]=ne(S[11]),A[26]=ne(S[18]),A[27]=ne(S[24]),A[28]=ne(S[31]),A[29]=ne(S[40]),A[30]=ne(S[44]),A[31]=ne(S[53]),A[32]=ne(S[10]),A[33]=ne(S[19]),A[34]=ne(S[23]),A[35]=ne(S[32]),A[36]=ne(S[39]),A[37]=ne(S[45]),A[38]=ne(S[52]),A[39]=ne(S[54]),A[40]=ne(S[20]),A[41]=ne(S[22]),A[42]=ne(S[33]),A[43]=ne(S[38]),A[44]=ne(S[46]),A[45]=ne(S[51]),A[46]=ne(S[55]),A[47]=ne(S[60]),A[48]=ne(S[21]),A[49]=ne(S[34]),A[50]=ne(S[37]),A[51]=ne(S[47]),A[52]=ne(S[50]),A[53]=ne(S[56]),A[54]=ne(S[59]),A[55]=ne(S[61]),A[56]=ne(S[35]),A[57]=ne(S[36]),A[58]=ne(S[48]),A[59]=ne(S[49]),A[60]=ne(S[57]),A[61]=ne(S[58]),A[62]=ne(S[62]),A[63]=ne(S[63])}function at(S){const A=.5*Math.cos(.7853975),F=.5*Math.cos(3.14159/16),Z=.5*Math.cos(3.14159/8),K=.5*Math.cos(3*3.14159/16),Q=.5*Math.cos(5*3.14159/16),ye=.5*Math.cos(3*3.14159/8),fe=.5*Math.cos(7*3.14159/16);for(var Ae=new Array(4),we=new Array(4),Le=new Array(4),Te=new Array(4),Ot=0;Ot<8;++Ot){var $e=Ot*8;Ae[0]=Z*S[$e+2],Ae[1]=ye*S[$e+2],Ae[2]=Z*S[$e+6],Ae[3]=ye*S[$e+6],we[0]=F*S[$e+1]+K*S[$e+3]+Q*S[$e+5]+fe*S[$e+7],we[1]=K*S[$e+1]-fe*S[$e+3]-F*S[$e+5]-Q*S[$e+7],we[2]=Q*S[$e+1]-F*S[$e+3]+fe*S[$e+5]+K*S[$e+7],we[3]=fe*S[$e+1]-Q*S[$e+3]+K*S[$e+5]-F*S[$e+7],Le[0]=A*(S[$e+0]+S[$e+4]),Le[3]=A*(S[$e+0]-S[$e+4]),Le[1]=Ae[0]+Ae[3],Le[2]=Ae[1]-Ae[2],Te[0]=Le[0]+Le[1],Te[1]=Le[3]+Le[2],Te[2]=Le[3]-Le[2],Te[3]=Le[0]-Le[1],S[$e+0]=Te[0]+we[0],S[$e+1]=Te[1]+we[1],S[$e+2]=Te[2]+we[2],S[$e+3]=Te[3]+we[3],S[$e+4]=Te[3]-we[3],S[$e+5]=Te[2]-we[2],S[$e+6]=Te[1]-we[1],S[$e+7]=Te[0]-we[0]}for(var T=0;T<8;++T)Ae[0]=Z*S[16+T],Ae[1]=ye*S[16+T],Ae[2]=Z*S[48+T],Ae[3]=ye*S[48+T],we[0]=F*S[8+T]+K*S[24+T]+Q*S[40+T]+fe*S[56+T],we[1]=K*S[8+T]-fe*S[24+T]-F*S[40+T]-Q*S[56+T],we[2]=Q*S[8+T]-F*S[24+T]+fe*S[40+T]+K*S[56+T],we[3]=fe*S[8+T]-Q*S[24+T]+K*S[40+T]-F*S[56+T],Le[0]=A*(S[T]+S[32+T]),Le[3]=A*(S[T]-S[32+T]),Le[1]=Ae[0]+Ae[3],Le[2]=Ae[1]-Ae[2],Te[0]=Le[0]+Le[1],Te[1]=Le[3]+Le[2],Te[2]=Le[3]-Le[2],Te[3]=Le[0]-Le[1],S[0+T]=Te[0]+we[0],S[8+T]=Te[1]+we[1],S[16+T]=Te[2]+we[2],S[24+T]=Te[3]+we[3],S[32+T]=Te[3]-we[3],S[40+T]=Te[2]-we[2],S[48+T]=Te[1]-we[1],S[56+T]=Te[0]-we[0]}function N(S){for(var A=0;A<64;++A){var F=S[0][A],Z=S[1][A],K=S[2][A];S[0][A]=F+1.5747*K,S[1][A]=F-.1873*Z-.4682*K,S[2][A]=F+1.8556*Z}}function ht(S,A,F){for(var Z=0;Z<64;++Z)A[F+Z]=is.toHalfFloat(We(S[Z]))}function We(S){return S<=1?Math.sign(S)*Math.pow(Math.abs(S),2.2):Math.sign(S)*Math.pow(w,Math.abs(S)-1)}function it(S){return new DataView(S.array.buffer,S.offset.value,S.size)}function _e(S){var A=S.viewer.buffer.slice(S.offset.value,S.offset.value+S.size),F=new Uint8Array(me(A)),Z=new Uint8Array(F.length);return tt(F),ie(F,Z),new DataView(Z.buffer)}function Et(S){var A=S.array.slice(S.offset.value,S.offset.value+S.size),F=la(A),Z=new Uint8Array(F.length);return tt(F),ie(F,Z),new DataView(Z.buffer)}function C(S){for(var A=S.viewer,F={value:S.offset.value},Z=new Uint16Array(S.width*S.scanlineBlockSize*(S.channels*S.type)),K=new Uint8Array(8192),Q=0,ye=new Array(S.channels),fe=0;fe<S.channels;fe++)ye[fe]={},ye[fe].start=Q,ye[fe].end=ye[fe].start,ye[fe].nx=S.width,ye[fe].ny=S.lines,ye[fe].size=S.type,Q+=ye[fe].nx*ye[fe].ny*ye[fe].size;var Ae=Mt(A,F),we=Mt(A,F);if(we>=8192)throw"Something is wrong with PIZ_COMPRESSION BITMAP_SIZE";if(Ae<=we)for(var fe=0;fe<we-Ae+1;fe++)K[fe+Ae]=ze(A,F);var Le=new Uint16Array(65536),Te=U(K,Le),Ot=j(A,F);Qe(S.array,A,F,Ot,Z,Q);for(var fe=0;fe<S.channels;++fe)for(var $e=ye[fe],T=0;T<ye[fe].size;++T)qe(Z,$e.start+T,$e.nx,$e.size,$e.ny,$e.nx*$e.size,Te);Tt(Le,Z,Q);for(var D=0,V=new Uint8Array(Z.buffer.byteLength),H=0;H<S.lines;H++)for(var G=0;G<S.channels;G++){var $e=ye[G],ge=$e.nx*$e.size,Ce=new Uint8Array(Z.buffer,$e.end*2,ge*2);V.set(Ce,D),D+=ge*2,$e.end+=ge}return new DataView(V.buffer)}function b(S){var A=S.array.slice(S.offset.value,S.offset.value+S.size),F=la(A);const Z=S.lines*S.channels*S.width,K=S.type==1?new Uint16Array(Z):new Uint32Array(Z);let Q=0,ye=0;const fe=new Array(4);for(let Ae=0;Ae<S.lines;Ae++)for(let we=0;we<S.channels;we++){let Le=0;switch(S.type){case 1:fe[0]=Q,fe[1]=fe[0]+S.width,Q=fe[1]+S.width;for(let Te=0;Te<S.width;++Te){const Ot=F[fe[0]++]<<8|F[fe[1]++];Le+=Ot,K[ye]=Le,ye++}break;case 2:fe[0]=Q,fe[1]=fe[0]+S.width,fe[2]=fe[1]+S.width,Q=fe[2]+S.width;for(let Te=0;Te<S.width;++Te){const Ot=F[fe[0]++]<<24|F[fe[1]++]<<16|F[fe[2]++]<<8;Le+=Ot,K[ye]=Le,ye++}break}}return new DataView(K.buffer)}function X(S){var A=S.viewer,F={value:S.offset.value},Z=new Uint8Array(S.width*S.lines*(S.channels*S.type*2)),K={version:pe(A,F),unknownUncompressedSize:pe(A,F),unknownCompressedSize:pe(A,F),acCompressedSize:pe(A,F),dcCompressedSize:pe(A,F),rleCompressedSize:pe(A,F),rleUncompressedSize:pe(A,F),rleRawSize:pe(A,F),totalAcUncompressedCount:pe(A,F),totalDcUncompressedCount:pe(A,F),acCompression:pe(A,F)};if(K.version<2)throw"EXRLoader.parse: "+pn.compression+" version "+K.version+" is unsupported";for(var Q=new Array,ye=Mt(A,F)-2;ye>0;){var fe=ee(A.buffer,F),Ae=ze(A,F),we=Ae>>2&3,Le=(Ae>>4)-1,Te=new Int8Array([Le])[0],Ot=ze(A,F);Q.push({name:fe,index:Te,type:Ot,compression:we}),ye-=fe.length+3}for(var $e=pn.channels,T=new Array(S.channels),D=0;D<S.channels;++D){var V=T[D]={},H=$e[D];V.name=H.name,V.compression=0,V.decoded=!1,V.type=H.pixelType,V.pLinear=H.pLinear,V.width=S.width,V.height=S.lines}for(var G={idx:new Array(3)},ge=0;ge<S.channels;++ge)for(var V=T[ge],D=0;D<Q.length;++D){var Ce=Q[D];V.name==Ce.name&&(V.compression=Ce.compression,Ce.index>=0&&(G.idx[Ce.index]=ge),V.offset=ge)}if(K.acCompressedSize>0)switch(K.acCompression){case 0:var Ee=new Uint16Array(K.totalAcUncompressedCount);Qe(S.array,A,F,K.acCompressedSize,Ee,K.totalAcUncompressedCount);break;case 1:var ue=S.array.slice(F.value,F.value+K.totalAcUncompressedCount),Ve=la(ue),Ee=new Uint16Array(Ve.buffer);F.value+=K.totalAcUncompressedCount;break}if(K.dcCompressedSize>0){var Ye={array:S.array,offset:F,size:K.dcCompressedSize},nt=new Uint16Array(Et(Ye).buffer);F.value+=K.dcCompressedSize}if(K.rleRawSize>0){var ue=S.array.slice(F.value,F.value+K.rleCompressedSize),Ve=la(ue),Xe=me(Ve.buffer);F.value+=K.rleCompressedSize}for(var vt=0,st=new Array(T.length),D=0;D<st.length;++D)st[D]=new Array;for(var xt=0;xt<S.lines;++xt)for(var je=0;je<T.length;++je)st[je].push(vt),vt+=T[je].width*S.type*2;ae(G,st,T,Ee,nt,Z);for(var D=0;D<T.length;++D){var V=T[D];if(!V.decoded)switch(V.compression){case 2:for(var dt=0,Ne=0,xt=0;xt<S.lines;++xt){for(var Wt=st[D][dt],lt=0;lt<V.width;++lt){for(var Xt=0;Xt<2*V.type;++Xt)Z[Wt++]=Xe[Ne+Xt*V.width*V.height];Ne++}dt++}break;case 1:default:throw"EXRLoader.parse: unsupported channel compression"}}return new DataView(Z.buffer)}function ee(S,A){for(var F=new Uint8Array(S),Z=0;F[A.value+Z]!=0;)Z+=1;var K=new TextDecoder().decode(F.slice(A.value,A.value+Z));return A.value=A.value+Z+1,K}function oe(S,A,F){var Z=new TextDecoder().decode(new Uint8Array(S).slice(A.value,A.value+F));return A.value=A.value+F,Z}function xe(S,A){var F=$(S,A),Z=j(S,A);return[F,Z]}function Se(S,A){var F=j(S,A),Z=j(S,A);return[F,Z]}function $(S,A){var F=S.getInt32(A.value,!0);return A.value=A.value+4,F}function j(S,A){var F=S.getUint32(A.value,!0);return A.value=A.value+4,F}function Be(S,A){var F=S[A.value];return A.value=A.value+1,F}function ze(S,A){var F=S.getUint8(A.value);return A.value=A.value+1,F}const pe=function(S,A){let F;return"getBigInt64"in DataView.prototype?F=Number(S.getBigInt64(A.value,!0)):F=S.getUint32(A.value+4,!0)+Number(S.getUint32(A.value,!0)<<32),A.value+=8,F};function ce(S,A){var F=S.getFloat32(A.value,!0);return A.value+=4,F}function ut(S,A){return is.toHalfFloat(ce(S,A))}function ne(S){var A=(S&31744)>>10,F=S&1023;return(S>>15?-1:1)*(A?A===31?F?NaN:1/0:Math.pow(2,A-15)*(1+F/1024):6103515625e-14*(F/1024))}function Mt(S,A){var F=S.getUint16(A.value,!0);return A.value+=2,F}function z(S,A){return ne(Mt(S,A))}function Me(S,A,F,Z){for(var K=F.value,Q=[];F.value<K+Z-1;){var ye=ee(A,F),fe=$(S,F),Ae=ze(S,F);F.value+=3;var we=$(S,F),Le=$(S,F);Q.push({name:ye,pixelType:fe,pLinear:Ae,xSampling:we,ySampling:Le})}return F.value+=1,Q}function te(S,A){var F=ce(S,A),Z=ce(S,A),K=ce(S,A),Q=ce(S,A),ye=ce(S,A),fe=ce(S,A),Ae=ce(S,A),we=ce(S,A);return{redX:F,redY:Z,greenX:K,greenY:Q,blueX:ye,blueY:fe,whiteX:Ae,whiteY:we}}function ke(S,A){var F=["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"],Z=ze(S,A);return F[Z]}function be(S,A){var F=j(S,A),Z=j(S,A),K=j(S,A),Q=j(S,A);return{xMin:F,yMin:Z,xMax:K,yMax:Q}}function he(S,A){var F=["INCREASING_Y"],Z=ze(S,A);return F[Z]}function Je(S,A){var F=ce(S,A),Z=ce(S,A);return[F,Z]}function pt(S,A){var F=ce(S,A),Z=ce(S,A),K=ce(S,A);return[F,Z,K]}function Bt(S,A,F,Z,K){if(Z==="string"||Z==="stringvector"||Z==="iccProfile")return oe(A,F,K);if(Z==="chlist")return Me(S,A,F,K);if(Z==="chromaticities")return te(S,F);if(Z==="compression")return ke(S,F);if(Z==="box2i")return be(S,F);if(Z==="lineOrder")return he(S,F);if(Z==="float")return ce(S,F);if(Z==="v2f")return Je(S,F);if(Z==="v3f")return pt(S,F);if(Z==="int")return $(S,F);if(Z==="rational")return xe(S,F);if(Z==="timecode")return Se(S,F);if(Z==="preview")return F.value+=K,"skipped";F.value+=K}function Rt(S,A,F){const Z={};if(S.getUint32(0,!0)!=20000630)throw"THREE.EXRLoader: provided file doesn't appear to be in OpenEXR format.";Z.version=S.getUint8(4);const K=S.getUint8(5);Z.spec={singleTile:!!(K&2),longName:!!(K&4),deepFormat:!!(K&8),multiPart:!!(K&16)},F.value=8;for(var Q=!0;Q;){var ye=ee(A,F);if(ye==0)Q=!1;else{var fe=ee(A,F),Ae=j(S,F),we=Bt(S,A,F,fe,Ae);we===void 0?console.warn(`EXRLoader.parse: skipped unknown header attribute type '${fe}'.`):Z[ye]=we}}if((K&-5)!=0)throw console.error("EXRHeader:",Z),"THREE.EXRLoader: provided file is currently unsupported.";return Z}function Li(S,A,F,Z,K){const Q={size:0,viewer:A,array:F,offset:Z,width:S.dataWindow.xMax-S.dataWindow.xMin+1,height:S.dataWindow.yMax-S.dataWindow.yMin+1,channels:S.channels.length,bytesPerLine:null,lines:null,inputSize:null,type:S.channels[0].pixelType,uncompress:null,getter:null,format:null,[vr?"colorSpace":"encoding"]:null};switch(S.compression){case"NO_COMPRESSION":Q.lines=1,Q.uncompress=it;break;case"RLE_COMPRESSION":Q.lines=1,Q.uncompress=_e;break;case"ZIPS_COMPRESSION":Q.lines=1,Q.uncompress=Et;break;case"ZIP_COMPRESSION":Q.lines=16,Q.uncompress=Et;break;case"PIZ_COMPRESSION":Q.lines=32,Q.uncompress=C;break;case"PXR24_COMPRESSION":Q.lines=16,Q.uncompress=b;break;case"DWAA_COMPRESSION":Q.lines=32,Q.uncompress=X;break;case"DWAB_COMPRESSION":Q.lines=256,Q.uncompress=X;break;default:throw"EXRLoader.parse: "+S.compression+" is unsupported"}if(Q.scanlineBlockSize=Q.lines,Q.type==1)switch(K){case Ft:Q.getter=z,Q.inputSize=2;break;case Jt:Q.getter=Mt,Q.inputSize=2;break}else if(Q.type==2)switch(K){case Ft:Q.getter=ce,Q.inputSize=4;break;case Jt:Q.getter=ut,Q.inputSize=4}else throw"EXRLoader.parse: unsupported pixelType "+Q.type+" for "+S.compression+".";Q.blockCount=(S.dataWindow.yMax+1)/Q.scanlineBlockSize;for(var ye=0;ye<Q.blockCount;ye++)pe(A,Z);Q.outputChannels=Q.channels==3?4:Q.channels;const fe=Q.width*Q.height*Q.outputChannels;switch(K){case Ft:Q.byteArray=new Float32Array(fe),Q.channels<Q.outputChannels&&Q.byteArray.fill(1,0,fe);break;case Jt:Q.byteArray=new Uint16Array(fe),Q.channels<Q.outputChannels&&Q.byteArray.fill(15360,0,fe);break;default:console.error("THREE.EXRLoader: unsupported type: ",K);break}return Q.bytesPerLine=Q.width*Q.inputSize*Q.channels,Q.outputChannels==4?Q.format=Kt:Q.format=jr,vr?Q.colorSpace="srgb-linear":Q.encoding=3e3,Q}const ci=new DataView(e),tr=new Uint8Array(e),zn={value:0},pn=Rt(ci,e,zn),St=Li(pn,ci,tr,zn,this.type),Wi={value:0},ir={R:0,G:1,B:2,A:3,Y:0};for(let S=0;S<St.height/St.scanlineBlockSize;S++){const A=j(ci,zn);St.size=j(ci,zn),St.lines=A+St.scanlineBlockSize>St.height?St.height-A:St.scanlineBlockSize;const Z=St.size<St.lines*St.bytesPerLine?St.uncompress(St):it(St);zn.value+=St.size;for(let K=0;K<St.scanlineBlockSize;K++){const Q=K+S*St.scanlineBlockSize;if(Q>=St.height)break;for(let ye=0;ye<St.channels;ye++){const fe=ir[pn.channels[ye].name];for(let Ae=0;Ae<St.width;Ae++){Wi.value=(K*(St.channels*St.width)+ye*St.width+Ae)*St.inputSize;const we=(St.height-1-Q)*(St.width*St.outputChannels)+Ae*St.outputChannels+fe;St.byteArray[we]=St.getter(Z,Wi)}}}}return{header:pn,width:St.width,height:St.height,data:St.byteArray,format:St.format,[vr?"colorSpace":"encoding"]:St[vr?"colorSpace":"encoding"],type:this.type}}setDataType(e){return this.type=e,this}load(e,t,i,n){function s(a,o){vr?a.colorSpace
4197=o.colorSpace:a.encoding=o.encoding,a.minFilter=wt,a.magFilter=wt,a.generateMipmaps=!1,a.flipY=!1,t&&t(a,o)}return super.load(e,s,i,n)}}const dp=(r,e,t)=>{let i;switch(r){case ii:i=new Uint8ClampedArray(e*t*4);break;case Jt:i=new Uint16Array(e*t*4);break;case Ci:i=new Uint32Array(e*t*4);break;case Ko:i=new Int8Array(e*t*4);break;case Qo:i=new Int16Array(e*t*4);break;case Qr:i=new Int32Array(e*t*4);break;case Ft:i=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return i};let eo;const lS=(r,e,t,i)=>{if(eo!==void 0)return eo;const n=new gi(1,1,i);e.setRenderTarget(n);const s=new kt(new Fn,new fn({color:16777215}));e.render(s,t),e.setRenderTarget(null);const a=dp(r,n.width,n.height);return e.readRenderTargetPixels(n,0,0,n.width,n.height,a),n.dispose(),s.geometry.dispose(),s.material.dispose(),eo=a[0]!==0,eo};class Ph{constructor(e){Vt(this,"_renderer");Vt(this,"_rendererIsDisposable",!1);Vt(this,"_material");Vt(this,"_scene");Vt(this,"_camera");Vt(this,"_quad");Vt(this,"_renderTarget");Vt(this,"_width");Vt(this,"_height");Vt(this,"_type");Vt(this,"_colorSpace");Vt(this,"_supportsReadPixels",!0);Vt(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)});var i,n,s,a,o,l,c,u,d,h,f,p,v,g,m,_;this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace
vendor: 7,954 bytes, line 4197
4197=e.colorSpace;const t={format:Kt,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:((i=e.renderTargetOptions)==null?void 0:i.anisotropy)!==void 0?(n=e.renderTargetOptions)==null?void 0:n.anisotropy:1,generateMipmaps:((s=e.renderTargetOptions)==null?void 0:s.generateMipmaps)!==void 0?(a=e.renderTargetOptions)==null?void 0:a.generateMipmaps:!1,magFilter:((o=e.renderTargetOptions)==null?void 0:o.magFilter)!==void 0?(l=e.renderTargetOptions)==null?void 0:l.magFilter:wt,minFilter:((c=e.renderTargetOptions)==null?void 0:c.minFilter)!==void 0?(u=e.renderTargetOptions)==null?void 0:u.minFilter:wt,samples:((d=e.renderTargetOptions)==null?void 0:d.samples)!==void 0?(h=e.renderTargetOptions)==null?void 0:h.samples:void 0,wrapS:((f=e.renderTargetOptions)==null?void 0:f.wrapS)!==void 0?(p=e.renderTargetOptions)==null?void 0:p.wrapS:Gt,wrapT:((v=e.renderTargetOptions)==null?void 0:v.wrapT)!==void 0?(g=e.renderTargetOptions)==null?void 0:g.wrapT:Gt};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=Ph.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new nh,this._camera=new js,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(),!lS(this._type,this._renderer,this._camera,t)){let x;switch(this._type){case Jt:x=this._renderer.extensions.has("EXT_color_buffer_float")?Ft:void 0;break}x!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${Ft}`),this._type=x):(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 kt(new Fn,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new gi(this.width,this.height,t),this._renderTarget.texture.mapping=((m=e.renderTargetOptions)==null?void 0:m.mapping)!==void 0?(_=e.renderTargetOptions)==null?void 0:_.mapping:In}static instantiateRenderer(){const e=new hp;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=dp(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new Ii(this.toArray(),this.width,this.height,Kt,this._type,(e==null?void 0:e.mapping)||In,(e==null?void 0:e.wrapS)||Gt,(e==null?void 0:e.wrapT)||Gt,(e==null?void 0:e.magFilter)||wt,(e==null?void 0:e.minFilter)||wt,(e==null?void 0:e.anisotropy)||1,Un);return t.generateMipmaps=(e==null?void 0:e.generateMipmaps)!==void 0?e==null?void 0:e.generateMipmaps:!1,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 vi&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof Lt&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof Lt&&t.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}}class fp extends Error{}class pp extends Error{}const _r=(r,e,t)=>{const i=new RegExp(`${e}="([^"]*)"`,"i").exec(r);if(i)return i[1];const n=new RegExp(`<${e}[^>]*>([\\s\\S]*?)</${e}>`,"i").exec(r);if(n){const s=n[1].match(/<rdf:li>([^<]*)<\/rdf:li>/g);return s&&s.length===3?s.map(a=>a.replace(/<\/?rdf:li>/g,"")):n[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},cS=r=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(r):e=r.toString();let t=e.indexOf("<x:xmpmeta");for(;t!==-1;){const i=e.indexOf("x:xmpmeta>",t),n=e.slice(t,i+10);try{const s=_r(n,"hdrgm:GainMapMin","0"),a=_r(n,"hdrgm:GainMapMax"),o=_r(n,"hdrgm:Gamma","1"),l=_r(n,"hdrgm:OffsetSDR","0.015625"),c=_r(n,"hdrgm:OffsetHDR","0.015625"),u=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(n),d=u?u[1]:"0",h=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(n);if(!h)throw new Error("Incomplete gainmap metadata");const f=h[1];return{gainMapMin:Array.isArray(s)?s.map(p=>parseFloat(p)):[parseFloat(s),parseFloat(s),parseFloat(s)],gainMapMax:Array.isArray(a)?a.map(p=>parseFloat(p)):[parseFloat(a),parseFloat(a),parseFloat(a)],gamma:Array.isArray(o)?o.map(p=>parseFloat(p)):[parseFloat(o),parseFloat(o),parseFloat(o)],offsetSdr:Array.isArray(l)?l.map(p=>parseFloat(p)):[parseFloat(l),parseFloat(l),parseFloat(l)],offsetHdr:Array.isArray(c)?c.map(p=>parseFloat(p)):[parseFloat(c),parseFloat(c),parseFloat(c)],hdrCapacityMin:parseFloat(d),hdrCapacityMax:parseFloat(f)}}catch{}t=e.indexOf("<x:xmpmeta",i)}};class hS{constructor(e){Vt(this,"options");this.options={debug:e&&e.debug!==void 0?e.debug:!1,extractFII:e&&e.extractFII!==void 0?e.extractFII:!0,extractNonFII:e&&e.extractNonFII!==void 0?e.extractNonFII:!0}}extract(e){return new Promise((t,i)=>{const n=this.options.debug,s=new DataView(e.buffer);if(s.getUint16(0)!==65496){i(new Error("Not a valid jpeg"));return}const a=s.byteLength;let o=2,l=0,c;for(;o<a;){if(++l>250){i(new Error(`Found no marker after ${l} loops 😵`));return}if(s.getUint8(o)!==255){i(new Error(`Not a valid marker at offset 0x${o.toString(16)}, found: 0x${s.getUint8(o).toString(16)}`));return}if(c=s.getUint8(o+1),n&&console.log(`Marker: ${c.toString(16)}`),c===226){n&&console.log("Found APP2 marker (0xffe2)");const u=o+4;if(s.getUint32(u)===1297106432){const d=u+4;let h;if(s.getUint16(d)===18761)h=!1;else if(s.getUint16(d)===19789)h=!0;else{i(new Error("No valid endianness marker found in TIFF header"));return}if(s.getUint16(d+2,!h)!==42){i(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const f=s.getUint32(d+4,!h);if(f<8){i(new Error("Not valid TIFF data! (First offset less than 8)"));return}const p=d+f,v=s.getUint16(p,!h),g=p+2;let m=0;for(let R=g;R<g+12*v;R+=12)s.getUint16(R,!h)===45057&&(m=s.getUint32(R+8,!h));const x=p+2+v*12+4,M=[];for(let R=x;R<x+m*16;R+=16){const E={MPType:s.getUint32(R,!h),size:s.getUint32(R+4,!h),dataOffset:s.getUint32(R+8,!h),dependantImages:s.getUint32(R+12,!h),start:-1,end:-1,isFII:!1};E.dataOffset?(E.start=d+E.dataOffset,E.isFII=!1):(E.start=0,E.isFII=!0),E.end=E.start+E.size,M.push(E)}if(this.options.extractNonFII&&M.length){const R=new Blob([s]),E=[];for(const I of M){if(I.isFII&&!this.options.extractFII)continue;const y=R.slice(I.start,I.end+1,"image/jpeg");E.push(y)}t(E)}}}o+=2+s.getUint16(o+2)}})}}const uS=async r=>{const e=cS(r);if(!e)throw new pp("Gain map XMP metadata not found");const i=await new hS({extractFII:!0,extractNonFII:!0}).extract(r);if(i.length!==2)throw new fp("Gain map recovery image not found");return{sdr:new Uint8Array(await i[0].arrayBuffer()),gainMap:new Uint8Array(await i[1].arrayBuffer()),metadata:e}},md=r=>new Promise((e,t)=>{const i=document.createElement("img");i.onload=()=>{e(i)},i.onerror=n=>{t(n)},i.src=URL.createObjectURL(r)});class dS extends yi{constructor(t,i){super(i);Vt(this,"_renderer");Vt(this,"_renderTargetOptions");Vt(this,"_internalLoadingManager");Vt(this,"_config");this._config=t,t.renderer&&(this._renderer=t.renderer),this._internalLoadingManager=new Al}setRenderer(t){return this._renderer=t,this}setRenderTargetOptions(t){return this._renderTargetOptions=t,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loa
4197der 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.");const t=this._config.createMaterial({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 Lt,sdr:new Lt});return this._config.createQuadRenderer({width:16,height:16,type:Jt,colorSpace:Un,material:t,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(t,i,n){const s=i?new Blob([i],{type:"image/jpeg"}):void 0,a=new Blob([t],{type:"image/jpeg"});let o,l,c=!1;if(typeof createImageBitmap>"u"){const u=await Promise.all([s?md(s):Promise.resolve(void 0),md(a)]);l=u[0],o=u[1],c=n==="flipY"}else{const u=await Promise.all([s?createImageBitmap(s,{imageOrientation:n||"flipY"}):Promise.resolve(void 0),createImageBitmap(a,{imageOrientation:n||"flipY"})]);l=u[0],o=u[1]}return{sdrImage:o,gainMapImage:l,needsFlip:c}}createTextures(t,i,n){const s=new Lt(i||new ImageData(2,2),In,Gt,Gt,wt,Ac,Kt,ii,1,Un);s.flipY=n,s.needsUpdate=!0;const a=new Lt(t,In,Gt,Gt,wt,Ac,Kt,ii,1,di);return a.flipY=n,a.needsUpdate=!0,{gainMap:s,sdr:a}}updateQuadRenderer(t,i,n,s,a){t.width=i.width,t.height=i.height,t.material.gainMap=n,t.material.sdr=s,t.material.gainMapMin=a.gainMapMin,t.material.gainMapMax=a.gainMapMax,t.material.offsetHdr=a.offsetHdr,t.material.offsetSdr=a.offsetSdr,t.material.gamma=a.gamma,t.material.hdrCapacityMin=a.hdrCapacityMin,t.material.hdrCapacityMax=a.hdrCapacityMax,t.material.maxDisplayBoost=Math.pow(2,a.hdrCapacityMax),t.material.needsUpdate=!0}}const fS=`
4198varying vec2 vUv;
4199
4200void main() {
4201  vUv = uv;
4202  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
4203}
4204`,pS=`
4205// min half float value
4206#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )
4207// max half float value
4208#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )
4209
4210uniform sampler2D sdr;
4211uniform sampler2D gainMap;
4212uniform vec3 gamma;
4213uniform vec3 offsetHdr;
4214uniform vec3 offsetSdr;
4215uniform vec3 gainMapMin;
4216uniform vec3 gainMapMax;
4217uniform float weightFactor;
4218
4219varying vec2 vUv;
4220
4221void main() {
4222  vec3 rgb = texture2D( sdr, vUv ).rgb;
4223  vec3 recovery = texture2D( gainMap, vUv ).rgb;
4224  vec3 logRecovery = pow( recovery, gamma );
4225  vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;
4226  vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;
4227  vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));
4228  gl_FragColor = vec4( clampedHdrColor , 1.0 );
4229}
4230`;class mS extends vi{constructor({gamma:t,offsetHdr:i,offsetSdr:n,gainMapMin:s,gainMapMax:a,maxDisplayBoost:o,hdrCapacityMin:l,hdrCapacityMax:c,sdr:u,gainMap:d}){super({name:"GainMapDecoderMaterial",vertexShader:fS,fragmentShader:pS,uniforms:{sdr:{value:u},gainMap:{value:d},gamma:{value:new P(1/t[0],1/t[1],1/t[2])},offsetHdr:{value:new P().fromArray(i)},offsetSdr:{value:new P().fromArray(n)},gainMapMin:{value:new P().fromArray(s)},gainMapMax:{value:new P().fromArray(a)},weightFactor:{value:(Math.log2(o)-l)/(c-l)}},blending:zi,depthTest:!1,depthWrite:!1});Vt(this,"_maxDisplayBoost");Vt(this,"_hdrCapacityMin");Vt(this,"_hdrCapacityMax");this._maxDisplayBoost=o,this._hdrCapacityMin=l,this._hdrCapacityMax=c,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(t){this.uniforms.sdr.value=t}get gainMap(){return this.uniforms.gainMap.value}set gainMap(t){this.uniforms.gainMap.value=t}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(t){this.uniforms.offsetHdr.value.fromArray(t)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(t){this.uniforms.offsetSdr.value.fromArray(t)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(t){this.uniforms.gainMapMin.value.fromArray(t)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(t){this.uniforms.gainMapMax.value.fromArray(t)}get gamma(){const t=this.uniforms.gamma.value;return[1/t.x,1/t.y,1/t.z]}set gamma(t){const i=this.uniforms.gamma.value;i.x=1/t[0],i.y=1/t[1],i.z=1/t[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(t){this._hdrCapacityMin=t,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(t){this._hdrCapacityMax=t,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(t){this._maxDisplayBoost=Math.max(1,Math.min(65504,t)),this.calculateWeight()}calculateWeight(){const t=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,t))}}class mp extends dS{constructor(e,t){super({renderer:e,createMaterial:i=>new mS(i),createQuadRenderer:i=>new Ph(i)},t)}
vendor: 3,482 bytes, line 4230
4230async render(e,t,i,n){const{sdrImage:s,gainMapImage:a,needsFlip:o}=await this.processImages(i,n,"flipY"),{gainMap:l,sdr:c}=this.createTextures(s,a,o);this.updateQuadRenderer(e,s,l,c,t),e.render()}}class SS extends mp{load([e,t,i],n,s,a){const o=this.prepareQuadRenderer();let l,c,u;const d=async()=>{if(l&&c&&u){try{await this.render(o,u,l,c)}catch(w){this.manager.itemError(e),this.manager.itemError(t),this.manager.itemError(i),typeof a=="function"&&a(w),o.disposeOnDemandRenderer();return}typeof n=="function"&&n(o),this.manager.itemEnd(e),this.manager.itemEnd(t),this.manager.itemEnd(i),o.disposeOnDemandRenderer()}};let h=!0,f=0,p=0,v=!0,g=0,m=0,_=!0,x=0,M=0;const R=()=>{if(typeof s=="function"){const w=f+g+x,U=p+m+M,L=h&&v&&_;s(new ProgressEvent("progress",{lengthComputable:L,loaded:U,total:w}))}};this.manager.itemStart(e),this.manager.itemStart(t),this.manager.itemStart(i);const E=new Ai(this._internalLoadingManager);E.setResponseType("arraybuffer"),E.setRequestHeader(this.requestHeader),E.setPath(this.path),E.setWithCredentials(this.withCredentials),E.load(e,async w=>{if(typeof w=="string")throw new Error("Invalid sdr buffer");l=w,await d()},w=>{h=w.lengthComputable,p=w.loaded,f=w.total,R()},w=>{this.manager.itemError(e),typeof a=="function"&&a(w)});const I=new Ai(this._internalLoadingManager);I.setResponseType("arraybuffer"),I.setRequestHeader(this.requestHeader),I.setPath(this.path),I.setWithCredentials(this.withCredentials),I.load(t,async w=>{if(typeof w=="string")throw new Error("Invalid gainmap buffer");c=w,await d()},w=>{v=w.lengthComputable,m=w.loaded,g=w.total,R()},w=>{this.manager.itemError(t),typeof a=="function"&&a(w)});const y=new Ai(this._internalLoadingManager);return y.setRequestHeader(this.requestHeader),y.setPath(this.path),y.setWithCredentials(this.withCredentials),y.load(i,async w=>{if(typeof w!="string")throw new Error("Invalid metadata string");u=JSON.parse(w),await d()},w=>{_=w.lengthComputable,M=w.loaded,x=w.total,R()},w=>{this.manager.itemError(i),typeof a=="function"&&a(w)}),o}}class bS extends mp{load(e,t,i,n){const s=this.prepareQuadRenderer(),a=new Ai(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 o=>{if(typeof o=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const l=new Uint8Array(o);let c,u,d;try{const h=await uS(l);c=h.sdr,u=h.gainMap,d=h.metadata}catch(h){if(h instanceof pp||h instanceof fp)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),d={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},c=l;else throw h}try{await this.render(s,d,c.buffer,u==null?void 0:u.buffer)}catch(h){this.manager.itemError(e),typeof n=="function"&&n(h),s.disposeOnDemandRenderer();return}typeof t=="function"&&t(s),this.manager.itemEnd(e),s.disposeOnDemandRenderer()},i,o=>{this.manager.itemError(e),typeof n=="function"&&n(o)}),s}}export{Xc as A,Mp as B,He as C,br as E,SS as G,bS as H,ll as L,Af as M,ki as N,js as O,ti as P,Kt as R,vi as S,_S as T,ii as U,se as V,hp as W,di as a,zv as b,P as c,kv as d,nh as e,_d as f,Bs as g,Sr as h,bt as i,Un as j,$r as k,Pm as l,Qi as m,av as n,xS as o,MS as p,Ih as q,Jt as r,yS as s,bc as t,Vv as u,Jf as v};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.