PageSourceSearch

https://chuddome.vercel.app/assets/index-DVMp7Pyy.js

js chuddome.vercel.app collected 2026-10-03 05:15:46 UTC 890,271 bytes, 3,660 lines download raw bytes

1(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const r of s)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(s){const r={};return s.integrity&&(r.integrity=s.integrity),s.referrerPolicy&&(r.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?r.credentials="include":s.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(s){if(s.ep)return;s.ep=!0;const r=t(s);fetch(s.href,r)}})();var El={},Rr={},ou;function Z0(){if(ou)return Rr;ou=1,Rr.byteLength=a,Rr.toByteArray=l,Rr.fromByteArray=d;for(var n=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,r=i.length;s<r;++s)n[s]=i[s],e[i.charCodeAt(s)]=s;e[45]=62,e[95]=63;function o(f){var p=f.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var b=f.indexOf("=");b===-1&&(b=p);var w=b===p?0:4-b%4;return[b,w]}function a(f){var p=o(f),b=p[0],w=p[1];return(b+w)*3/4-w}function c(f,p,b){return(p+b)*3/4-b}function l(f){var p,b=o(f),w=b[0],v=b[1],y=new t(c(f,w,v)),E=0,L=v>0?w-4:w,C;for(C=0;C<L;C+=4)p=e[f.charCodeAt(C)]<<18|e[f.charCodeAt(C+1)]<<12|e[f.charCodeAt(C+2)]<<6|e[f.charCodeAt(C+3)],y[E++]=p>>16&255,y[E++]=p>>8&255,y[E++]=p&255;return v===2&&(p=e[f.charCodeAt(C)]<<2|e[f.charCodeAt(C+1)]>>4,y[E++]=p&255),v===1&&(p=e[f.charCodeAt(C)]<<10|e[f.charCodeAt(C+1)]<<4|e[f.charCodeAt(C+2)]>>2,y[E++]=p>>8&255,y[E++]=p&255),y}function u(f){return n[f>>18&63]+n[f>>12&63]+n[f>>6&63]+n[f&63]}function h(f,p,b){for(var w,v=[],y=p;y<b;y+=3)w=(f[y]<<16&16711680)+(f[y+1]<<8&65280)+(f[y+2]&255),v.push(u(w));return v.join("")}function d(f){for(var p,b=f.length,w=b%3,v=[],y=16383,E=0,L=b-w;E<L;E+=y)v.push(h(f,E,E+y>L?L:E+y));return w===1?(p=f[b-1],v.push(n[p>>2]+n[p<<4&63]+"==")):w===2&&(p=(f[b-2]<<8)+f[b-1],v.push(n[p>>10]+n[p>>4&63]+n[p<<2&63]+"=")),v.join("")}return Rr}var Do={};var au;function K0(){return au||(au=1,Do.read=function(n,e,t,i,s){var r,o,a=s*8-i-1,c=(1<<a)-1,l=c>>1,u=-7,h=t?s-1:0,d=t?-1:1,f=n[e+h];for(h+=d,r=f&(1<<-u)-1,f>>=-u,u+=a;u>0;r=r*256+n[e+h],h+=d,u-=8);for(o=r&(1<<-u)-1,r>>=-u,u+=i;u>0;o=o*256+n[e+h],h+=d,u-=8);if(r===0)r=1-l;else{if(r===c)return o?NaN:(f?-1:1)*(1/0);o=o+Math.pow(2,i),r=r-l}return(f?-1:1)*o*Math.pow(2,r-i)},Do.write=function(n,e,t,i,s,r){var o,a,c,l=r*8-s-1,u=(1<<l)-1,h=u>>1,d=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:r-1,p=i?1:-1,b=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+h>=1?e+=d/c:e+=d*Math.pow(2,1-h),e*c>=2&&(o++,c/=2),o+h>=u?(a=0,o=u):o+h>=1?(a=(e*c-1)*Math.pow(2,s),o=o+h):(a=e*Math.pow(2,h-1)*Math.pow(2,s),o=0));s>=8;n[t+f]=a&255,f+=p,a/=256,s-=8);for(o=o<<s|a,l+=s;l>0;n[t+f]=o&255,f+=p,o/=256,l-=8);n[t+f-p]|=b*128}),Do}var lu;function J0(){return lu||(lu=1,(function(n){const e=Z0(),t=K0(),i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=a,n.SlowBuffer=y,n.INSPECT_MAX_BYTES=50;const s=2147483647;n.kMaxLength=s,a.TYPED_ARRAY_SUPPORT=r(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function r(){try{const M=new Uint8Array(1),g={foo:function(){return 42}};return Object.setPrototypeOf(g,Uint8Array.prototype),Object.setPrototypeOf(M,g),M.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(M){if(M>s)throw new RangeError('The value "'+M+'" is invalid for option "size"');const g=new Uint8Array(M);return Object.setPrototypeOf(g,a.prototype),g}function a(M,g,x){if(typeof M=="number"){if(typeof g=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(M)}return c(M,g,x)}a.poolSize=8192;
vendor: 17,564 bytes, line 1
1function c(M,g,x){if(typeof M=="string")return d(M,g);if(ArrayBuffer.isView(M))return p(M);if(M==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof M);if(me(M,ArrayBuffer)||M&&me(M.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(me(M,SharedArrayBuffer)||M&&me(M.buffer,SharedArrayBuffer)))return b(M,g,x);if(typeof M=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const T=M.valueOf&&M.valueOf();if(T!=null&&T!==M)return a.from(T,g,x);const I=w(M);if(I)return I;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof M[Symbol.toPrimitive]=="function")return a.from(M[Symbol.toPrimitive]("string"),g,x);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof M)}a.from=function(M,g,x){return c(M,g,x)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function l(M){if(typeof M!="number")throw new TypeError('"size" argument must be of type number');if(M<0)throw new RangeError('The value "'+M+'" is invalid for option "size"')}function u(M,g,x){return l(M),M<=0?o(M):g!==void 0?typeof x=="string"?o(M).fill(g,x):o(M).fill(g):o(M)}a.alloc=function(M,g,x){return u(M,g,x)};function h(M){return l(M),o(M<0?0:v(M)|0)}a.allocUnsafe=function(M){return h(M)},a.allocUnsafeSlow=function(M){return h(M)};function d(M,g){if((typeof g!="string"||g==="")&&(g="utf8"),!a.isEncoding(g))throw new TypeError("Unknown encoding: "+g);const x=E(M,g)|0;let T=o(x);const I=T.write(M,g);return I!==x&&(T=T.slice(0,I)),T}function f(M){const g=M.length<0?0:v(M.length)|0,x=o(g);for(let T=0;T<g;T+=1)x[T]=M[T]&255;return x}function p(M){if(me(M,Uint8Array)){const g=new Uint8Array(M);return b(g.buffer,g.byteOffset,g.byteLength)}return f(M)}function b(M,g,x){if(g<0||M.byteLength<g)throw new RangeError('"offset" is outside of buffer bounds');if(M.byteLength<g+(x||0))throw new RangeError('"length" is outside of buffer bounds');let T;return g===void 0&&x===void 0?T=new Uint8Array(M):x===void 0?T=new Uint8Array(M,g):T=new Uint8Array(M,g,x),Object.setPrototypeOf(T,a.prototype),T}function w(M){if(a.isBuffer(M)){const g=v(M.length)|0,x=o(g);return x.length===0||M.copy(x,0,0,g),x}if(M.length!==void 0)return typeof M.length!="number"||We(M.length)?o(0):f(M);if(M.type==="Buffer"&&Array.isArray(M.data))return f(M.data)}function v(M){if(M>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return M|0}function y(M){return+M!=M&&(M=0),a.alloc(+M)}a.isBuffer=function(g){return g!=null&&g._isBuffer===!0&&g!==a.prototype},a.compare=function(g,x){if(me(g,Uint8Array)&&(g=a.from(g,g.offset,g.byteLength)),me(x,Uint8Array)&&(x=a.from(x,x.offset,x.byteLength)),!a.isBuffer(g)||!a.isBuffer(x))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(g===x)return 0;let T=g.length,I=x.length;for(let G=0,Y=Math.min(T,I);G<Y;++G)if(g[G]!==x[G]){T=g[G],I=x[G];break}return T<I?-1:I<T?1:0},a.isEncoding=function(g){switch(String(g).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(g,x){if(!Array.isArray(g))throw new TypeError('"list" argument must be an Array of Buffers');if(g.length===0)return a.alloc(0);let T;if(x===void 0)for(x=0,T=0;T<g.length;++T)x+=g[T].length;const I=a.allocUnsafe(x);let G=0;for(T=0;T<g.length;++T){let Y=g[T];if(me(Y,Uint8Array))G+Y.length>I.length?(a.isBuffer(Y)||(Y=a.from(Y)),Y.copy(I,G)):Uint8Array.prototype.set.call(I,Y,G);else if(a.isBuffer(Y))Y.copy(I,G);else throw new TypeError('"list" argument must be an Array of Buffers');G+=Y.length}return I};function E(M,g){if(a.isBuffer(M))return M.length;if(ArrayBuffer.isView(M)||me(M,ArrayBuffer))return M.byteLength;if(typeof M!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof M);const x=M.length,T=arguments.length>2&&arguments[2]===!0;if(!T&&x===0)return 0;let I=!1;for(;;)switch(g){case"ascii":case"latin1":case"binary":return x;case"utf8":case"utf-8":return P(M).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x*2;case"hex":return x>>>1;case"base64":return te(M).length;default:if(I)return T?-1:P(M).length;g=(""+g).toLowerCase(),I=!0}}a.byteLength=E;function L(M,g,x){let T=!1;if((g===void 0||g<0)&&(g=0),g>this.length||((x===void 0||x>this.length)&&(x=this.length),x<=0)||(x>>>=0,g>>>=0,x<=g))return"";for(M||(M="utf8");;)switch(M){case"hex":return re(this,g,x);case"utf8":case"utf-8":return O(this,g,x);case"ascii":return ne(this,g,x);case"latin1":case"binary":return ce(this,g,x);case"base64":return k(this,g,x);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ge(this,g,x);default:if(T)throw new TypeError("Unknown encoding: "+M);M=(M+"").toLowerCase(),T=!0}}a.prototype._isBuffer=!0;function C(M,g,x){const T=M[g];M[g]=M[x],M[x]=T}a.prototype.swap16=function(){const g=this.length;if(g%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let x=0;x<g;x+=2)C(this,x,x+1);return this},a.prototype.swap32=function(){const g=this.length;if(g%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let x=0;x<g;x+=4)C(this,x,x+3),C(this,x+1,x+2);return this},a.prototype.swap64=function(){const g=this.length;if(g%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let x=0;x<g;x+=8)C(this,x,x+7),C(this,x+1,x+6),C(this,x+2,x+5),C(this,x+3,x+4);return this},a.prototype.toString=function(){const g=this.length;return g===0?"":arguments.length===0?O(this,0,g):L.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(g){if(!a.isBuffer(g))throw new TypeError("Argument must be a Buffer");return this===g?!0:a.compare(this,g)===0},a.prototype.inspect=function(){let g="";const x=n.INSPECT_MAX_BYTES;return g=this.toString("hex",0,x).replace(/(.{2})/g,"$1 ").trim(),this.length>x&&(g+=" ... "),"<Buffer "+g+">"},i&&(a.prototype[i]=a.prototype.inspect),a.prototype.compare=function(g,x,T,I,G){if(me(g,Uint8Array)&&(g=a.from(g,g.offset,g.byteLength)),!a.isBuffer(g))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof g);if(x===void 0&&(x=0),T===void 0&&(T=g?g.length:0),I===void 0&&(I=0),G===void 0&&(G=this.length),x<0||T>g.length||I<0||G>this.length)throw new RangeError("out of range index");if(I>=G&&x>=T)return 0;if(I>=G)return-1;if(x>=T)return 1;if(x>>>=0,T>>>=0,I>>>=0,G>>>=0,this===g)return 0;let Y=G-I,be=T-x;const Ze=Math.min(Y,be),Ve=this.slice(I,G),ut=g.slice(x,T);for(let tt=0;tt<Ze;++tt)if(Ve[tt]!==ut[tt]){Y=Ve[tt],be=ut[tt];break}return Y<be?-1:be<Y?1:0};function _(M,g,x,T,I){if(M.length===0)return-1;if(typeof x=="string"?(T=x,x=0):x>2147483647?x=2147483647:x<-2147483648&&(x=-2147483648),x=+x,We(x)&&(x=I?0:M.length-1),x<0&&(x=M.length+x),x>=M.length){if(I)return-1;x=M.length-1}else if(x<0)if(I)x=0;else return-1;if(typeof g=="string"&&(g=a.from(g,T)),a.isBuffer(g))return g.length===0?-1:D(M,g,x,T,I);if(typeof g=="number")return g=g&255,typeof Uint8Array.prototype.indexOf=="function"?I?Uint8Array.prototype.indexOf.call(M,g,x):Uint8Array.prototype.lastIndexOf.call(M,g,x):D(M,[g],x,T,I);throw new TypeError("val must be string, number or Buffer")}function D(M,g,x,T,I){let G=1,Y=M.length,be=g.length;if(T!==void 0&&(T=String(T).toLowerCase(),T==="ucs2"||T==="ucs-2"||T==="utf16le"||T==="utf-16le")){if(M.length<2||g.length<2)return-1;G=2,Y/=2,be/=2,x/=2}function Ze(ut,tt){return G===1?ut[tt]:ut.readUInt16BE(tt*G)}let Ve;if(I){let ut=-1;for(Ve=x;Ve<Y;Ve++)if(Ze(M,Ve)===Ze(g,ut===-1?0:Ve-ut)){if(ut===-1&&(ut=Ve),Ve-ut+1===be)return ut*G}else ut!==-1&&(Ve-=Ve-ut),ut=-1}else for(x+be>Y&&(x=Y-be),Ve=x;Ve>=0;Ve--){let ut=!0;for(let tt=0;tt<be;tt++)if(Ze(M,Ve+tt)!==Ze(g,tt)){ut=!1;break}if(ut)return Ve}return-1}a.prototype.includes=function(g,x,T){return this.indexOf(g,x,T)!==-1},a.prototype.indexOf=function(g,x,T){return _(this,g,x,T,!0)},a.prototype.lastIndexOf=function(g,x,T){return _(this,g,x,T,!1)};function F(M,g,x,T){x=Number(x)||0;const I=M.length-x;T?(T=Number(T),T>I&&(T=I)):T=I;const G=g.length;T>G/2&&(T=G/2);let Y;for(Y=0;Y<T;++Y){const be=parseInt(g.substr(Y*2,2),16);if(We(be))return Y;M[x+Y]=be}return Y}function H(M,g,x,T){return he(P(g,M.length-x),M,x,T)}function W(M,g,x,T){return he(R(g),M,x,T)}function Z(M,g,x,T){return he(te(g),M,x,T)}function q(M,g,x,T){return he(ee(g,M.length-x),M,x,T)}a.prototype.write=function(g,x,T,I){if(x===void 0)I="utf8",T=this.length,x=0;else if(T===void 0&&typeof x=="string")I=x,T=this.length,x=0;else if(isFinite(x))x=x>>>0,isFinite(T)?(T=T>>>0,I===void 0&&(I="utf8")):(I=T,T=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const G=this.length-x;if((T===void 0||T>G)&&(T=G),g.length>0&&(T<0||x<0)||x>this.length)throw new RangeError("Attempt to write outside buffer bounds");I||(I="utf8");let Y=!1;for(;;)switch(I){case"hex":return F(this,g,x,T);case"utf8":case"utf-8":return H(this,g,x,T);case"ascii":case"latin1":case"binary":return W(this,g,x,T);case"base64":return Z(this,g,x,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,g,x,T);default:if(Y)throw new TypeError("Unknown encoding: "+I);I=(""+I).toLowerCase(),Y=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function k(M,g,x){return g===0&&x===M.length?e.fromByteArray(M):e.fromByteArray(M.slice(g,x))}function O(M,g,x){x=Math.min(M.length,x);const T=[];let I=g;for(;I<x;){const G=M[I];let Y=null,be=G>239?4:G>223?3:G>191?2:1;if(I+be<=x){let Ze,Ve,ut,tt;switch(be){case 1:G<128&&(Y=G);break;case 2:Ze=M[I+1],(Ze&192)===128&&(tt=(G&31)<<6|Ze&63,tt>127&&(Y=tt));break;case 3:Ze=M[I+1],Ve=M[I+2],(Ze&192)===128&&(Ve&192)===128&&(tt=(G&15)<<12|(Ze&63)<<6|Ve&63,tt>2047&&(tt<55296||tt>57343)&&(Y=tt));break;case 4:Ze=M[I+1],Ve=M[I+2],ut=M[I+3],(Ze&192)===128&&(Ve&192)===128&&(ut&192)===128&&(tt=(G&15)<<18|(Ze&63)<<12|(Ve&63)<<6|ut&63,tt>65535&&tt<1114112&&(Y=tt))}}Y===null?(Y=65533,be=1):Y>65535&&(Y-=65536,T.push(Y>>>10&1023|55296),Y=56320|Y&1023),T.push(Y),I+=be}return z(T)}const U=4096;function z(M){const g=M.length;if(g<=U)return String.fromCharCode.apply(String,M);let x="",T=0;for(;T<g;)x+=String.fromCharCode.apply(String,M.slice(T,T+=U));return x}function ne(M,g,x){let T="";x=Math.min(M.length,x);for(let I=g;I<x;++I)T+=String.fromCharCode(M[I]&127);return T}function ce(M,g,x){let T="";x=Math.min(M.length,x);for(let I=g;I<x;++I)T+=String.fromCharCode(M[I]);return T}function re(M,g,x){const T=M.length;(!g||g<0)&&(g=0),(!x||x<0||x>T)&&(x=T);let I="";for(let G=g;G<x;++G)I+=Ee[M[G]];return I}function ge(M,g,x){const T=M.slice(g,x);let I="";for(let G=0;G<T.length-1;G+=2)I+=String.fromCharCode(T[G]+T[G+1]*256);return I}a.prototype.slice=function(g,x){const T=this.length;g=~~g,x=x===void 0?T:~~x,g<0?(g+=T,g<0&&(g=0)):g>T&&(g=T),x<0?(x+=T,x<0&&(x=0)):x>T&&(x=T),x<g&&(x=g);const I=this.subarray(g,x);return Object.setPrototypeOf(I,a.prototype),I};function ie(M,g,x){if(M%1!==0||M<0)throw new RangeError("offset is not uint");if(M+g>x)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(g,x,T){g=g>>>0,x=x>>>0,T||ie(g,x,this.length);let I=this[g],G=1,Y=0;for(;++Y<x&&(G*=256);)I+=this[g+Y]*G;return I},a.prototype.readUintBE=a.prototype.readUIntBE=function(g,x,T){g=g>>>0,x=x>>>0,T||ie(g,x,this.length);let I=this[g+--x],G=1;for(;x>0&&(G*=256);)I+=this[g+--x]*G;return I},a.prototype.readUint8=a.prototype.readUInt8=function(g,x){return g=g>>>0,x||ie(g,1,this.length),this[g]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(g,x){return g=g>>>0,x||ie(g,2,this.length),this[g]|this[g+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(g,x){return g=g>>>0,x||ie(g,2,this.length),this[g]<<8|this[g+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(g,x){return g=g>>>0,x||ie(g,4,this.length),(this[g]|this[g+1]<<8|this[g+2]<<16)+this[g+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(g,x){return g=g>>>0,x||ie(g,4,this.length),this[g]*16777216+(this[g+1]<<16|this[g+2]<<8|this[g+3])},a.prototype.readBigUInt64LE=N(function(g){g=g>>>0,oe(g,"offset");const x=this[g],T=this[g+7];(x===void 0||T===void 0)&&le(g,this.length-8);const I=x+this[++g]*2**8+this[++g]*2**16+this[++g]*2**24,G=this[++g]+this[++g]*2**8+this[++g]*2**16+T*2**24;return BigInt(I)+(BigInt(G)<<BigInt(32))}),a.prototype.readBigUInt64BE=N(function(g){g=g>>>0,oe(g,"offset");const x=this[g],T=this[g+7];(x===void 0||T===void 0)&&le(g,this.length-8);const I=x*2**24+this[++g]*2**16+this[++g]*2**8+this[++g],G=this[++g]*2**24+this[++g]*2**16+this[++g]*2**8+T;return(BigInt(I)<<BigInt(32))+BigInt(G)}),a.prototype.readIntLE=function(g,x,T){g=g>>>0,x=x>>>0,T||ie(g,x,this.length);let I=this[g],G=1,Y=0;for(;++Y<x&&(G*=256);)I+=this[g+Y]*G;return G*=128,I>=G&&(I-=Math.pow(2,8*x)),I},a.prototype.readIntBE=function(g,x,T){g=g>>>0,x=x>>>0,T||ie(g,x,this.length);let I=x,G=1,Y=this[g+--I];for(;I>0&&(G*=256);)Y+=this[g+--I]*G;return G*=128,Y>=G&&(Y-=Math.pow(2,8*x)),Y},a.prototype.readInt8=function(g,x){return g=g>>>0,x||ie(g,1,this.length),this[g]&128?(255-this[g]+1)*-1:this[g]},a.prototype.readInt16LE=function(g,x){g=g>>>0,x||ie(g,2,this.length);const T=this[g]|this[g+1]<<8;return T&32768?T|4294901760:T},a.prototype.readInt16BE=function(g,x){g=g>>>0,x||ie(g,2,this.length);const T=this[g+1]|this[g]<<8;return T&32768?T|4294901760:T},a.prototype.readInt32LE=function(g,x){return g=g>>>0,x||ie(g,4,this.length),this[g]|this[g+1]<<8|this[g+2]<<16|this[g+3]<<24},a.prototype.readInt32BE=function(g,x){return g=g>>>0,x||ie(g,4,this.length),this[g]<<24|this[g+1]<<16|this[g+2]<<8|this[g+3]},a.prototype.readBigInt64LE=N(function(g){g=g>>>0,oe(g,"offset");const x=this[g],T=this[g+7];(x===void 0||T===void 0)&&le(g,this.length-8);const I=this[g+4]+this[g+5]*2**8+this[g+6]*2**16+(T<<24);return(BigInt(I)<<BigInt(32))+BigInt(x+this[++g]*2**8+this[++g]*2**16+this[++g]*2**24)}),a.prototype.readBigInt64BE=N(function(g){g=g>>>0,oe(g,"offset");const x=this[g],T=this[g+7];(x===void 0||T===void 0)&&le(g,this.length-8);const I=(x<<24)+this[++g]*2**16+this[++g]*2**8+this[++g];return(BigInt(I)<<BigInt(32))+BigInt(this[++g]*2**24+this[++g]*2**16+this[++g]*2**8+T)}),a.prototype.readFloatLE=function(g,x){return g=g>>>0,x||ie(g,4,this.length),t.read(this,g,!0,23,4)},a.prototype.readFloatBE=function(g,x){return g=g>>>0,x||ie(g,4,this.length),t.read(this,g,!1,23,4)},a.prototype.readDoubleLE=function(g,x){return g=g>>>0,x||ie(g,8,this.length),t.read(this,g,!0,52,8)},a.prototype.readDoubleBE=function(g,x){return g=g>>>0,x||ie(g,8,this.length),t.read(this,g,!1,52,8)};function ye(M,g,x,T,I,G){if(!a.isBuffer(M))throw new TypeError('"buffer" argument must be a Buffer instance');if(g>I||g<G)throw new RangeError('"value" argument is out of bounds');if(x+T>M.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(g,x,T,I){if(g=+g,x=x>>>0,T=T>>>0,!I){const be=Math.pow(2,8*T)-1;ye(this,g,x,T,be,0)}let G=1,Y=0;for(this[x]=g&255;++Y<T&&(G*=256);)this[x+Y]=g/G&255;return x+T},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(g,x,T,I){if(g=+g,x=x>>>0,T=T>>>0,!I){const be=Math.pow(2,8*T)-1;ye(this,g,x,T,be,0)}let G=T-1,Y=1;for(this[x+G]=g&255;--G>=0&&(Y*=256);)this[x+G]=g/Y&255;return x+T},a.prototype.writeUint8=a.prototype.writeUInt8=function(g,x,T){return g=+g,x=x>>>0,T||ye(this,g,x,1,255,0),this[x]=g&255,x+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(g,x,T){return g=+g,x=x>>>0,T||ye(this,g,x,2,65535,0),this[x]=g&255,this[x+1]=g>>>8,x+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(g,x,T){return g=+g,x=x>>>0,T||ye(this,g,x,2,65535,0),this[x]=g>>>8,this[x+1]=g&255,x+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(g,x,T){return g=+g,x=x>>>0,T||ye(this,g,x,4,4294967295,0),this[x+3]=g>>>24,this[x+2]=g>>>16,this[x+1]=g>>>8,this[x]=g&255,x+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(g,x,T){return g=+g,x=x>>>0,T||ye(this,g,x,4,4294967295,0),this[x]=g>>>24,this[x+1]=g>>>16,this[x+2]=g>>>8,this[x+3]=g&255,x+4};function Se(M,g,x,T,I){se(g,T,I,M,x,7);let G=Number(g&BigInt(4294967295));M[x++]=G,G=G>>8,M[x++]=G,G=G>>8,M[x++]=G,G=G>>8,M[x++]=G;let Y=Number(g>>BigInt(32)&BigInt(4294967295));return M[x++]=Y,Y=Y>>8,M[x++]=Y,Y=Y>>8,M[x++]=Y,Y=Y>>8,M[x++]=Y,x}function Q(M,g,x,T,I){se(g,T,I,M,x,7);let G=Number(g&BigInt(4294967295));M[x+7]=G,G=G>>8,M[x+6]=G,G=G>>8,M[x+5]=G,G=G>>8,M[x+4]=G;let Y=Number(g>>BigInt(32)&BigInt(4294967295));return M[x+3]=Y,Y=Y>>8,M[x+2]=Y,Y=Y>>8,M[x+1]=Y,Y=Y>>8,M[x]=Y,x+8}a.prototype.writeBigUInt64LE=N(function(g,x=0){return Se(this,g,x,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=N(function(g,x=0){return Q(this,g,x,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(g,x,T,I){if(g=+g,x=x>>>0,!I){const Ze=Math.pow(2,8*T-1);ye(this,g,x,T,Ze-1,-Ze)}let G=0,Y=1,be=0;for(this[x]=g&255;++G<T&&(Y*=256);)g<0&&be===0&&this[x+G-1]!==0&&(be=1),this[x+G]=(g/Y>>0)-be&255;return x+T},a.prototype.writeIntBE=function(g,x,T,I){if(g=+g,x=x>>>0,!I){const Ze=Math.pow(2,8*T-1);ye(this,g,x,T,Ze-1,-Ze)}let G=T-1,Y=1,be=0;for(this[x+G]=g&255;--G>=0&&(Y*=256);
vendor: 4,915 bytes, line 1
1)g<0&&be===0&&this[x+G+1]!==0&&(be=1),this[x+G]=(g/Y>>0)-be&255;return x+T},a.prototype.writeInt8=function(g,x,T){return g=+g,x=x>>>0,T||ye(this,g,x,1,127,-128),g<0&&(g=255+g+1),this[x]=g&255,x+1},a.prototype.writeInt16LE=function(g,x,T){return g=+g,x=x>>>0,T||ye(this,g,x,2,32767,-32768),this[x]=g&255,this[x+1]=g>>>8,x+2},a.prototype.writeInt16BE=function(g,x,T){return g=+g,x=x>>>0,T||ye(this,g,x,2,32767,-32768),this[x]=g>>>8,this[x+1]=g&255,x+2},a.prototype.writeInt32LE=function(g,x,T){return g=+g,x=x>>>0,T||ye(this,g,x,4,2147483647,-2147483648),this[x]=g&255,this[x+1]=g>>>8,this[x+2]=g>>>16,this[x+3]=g>>>24,x+4},a.prototype.writeInt32BE=function(g,x,T){return g=+g,x=x>>>0,T||ye(this,g,x,4,2147483647,-2147483648),g<0&&(g=4294967295+g+1),this[x]=g>>>24,this[x+1]=g>>>16,this[x+2]=g>>>8,this[x+3]=g&255,x+4},a.prototype.writeBigInt64LE=N(function(g,x=0){return Se(this,g,x,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=N(function(g,x=0){return Q(this,g,x,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function et(M,g,x,T,I,G){if(x+T>M.length)throw new RangeError("Index out of range");if(x<0)throw new RangeError("Index out of range")}function Ue(M,g,x,T,I){return g=+g,x=x>>>0,I||et(M,g,x,4),t.write(M,g,x,T,23,4),x+4}a.prototype.writeFloatLE=function(g,x,T){return Ue(this,g,x,!0,T)},a.prototype.writeFloatBE=function(g,x,T){return Ue(this,g,x,!1,T)};function Te(M,g,x,T,I){return g=+g,x=x>>>0,I||et(M,g,x,8),t.write(M,g,x,T,52,8),x+8}a.prototype.writeDoubleLE=function(g,x,T){return Te(this,g,x,!0,T)},a.prototype.writeDoubleBE=function(g,x,T){return Te(this,g,x,!1,T)},a.prototype.copy=function(g,x,T,I){if(!a.isBuffer(g))throw new TypeError("argument should be a Buffer");if(T||(T=0),!I&&I!==0&&(I=this.length),x>=g.length&&(x=g.length),x||(x=0),I>0&&I<T&&(I=T),I===T||g.length===0||this.length===0)return 0;if(x<0)throw new RangeError("targetStart out of bounds");if(T<0||T>=this.length)throw new RangeError("Index out of range");if(I<0)throw new RangeError("sourceEnd out of bounds");I>this.length&&(I=this.length),g.length-x<I-T&&(I=g.length-x+T);const G=I-T;return this===g&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(x,T,I):Uint8Array.prototype.set.call(g,this.subarray(T,I),x),G},a.prototype.fill=function(g,x,T,I){if(typeof g=="string"){if(typeof x=="string"?(I=x,x=0,T=this.length):typeof T=="string"&&(I=T,T=this.length),I!==void 0&&typeof I!="string")throw new TypeError("encoding must be a string");if(typeof I=="string"&&!a.isEncoding(I))throw new TypeError("Unknown encoding: "+I);if(g.length===1){const Y=g.charCodeAt(0);(I==="utf8"&&Y<128||I==="latin1")&&(g=Y)}}else typeof g=="number"?g=g&255:typeof g=="boolean"&&(g=Number(g));if(x<0||this.length<x||this.length<T)throw new RangeError("Out of range index");if(T<=x)return this;x=x>>>0,T=T===void 0?this.length:T>>>0,g||(g=0);let G;if(typeof g=="number")for(G=x;G<T;++G)this[G]=g;else{const Y=a.isBuffer(g)?g:a.from(g,I),be=Y.length;if(be===0)throw new TypeError('The value "'+g+'" is invalid for argument "value"');for(G=0;G<T-x;++G)this[G+x]=Y[G%be]}return this};const Me={};function Ge(M,g,x){Me[M]=class extends x{constructor(){super(),Object.defineProperty(this,"message",{value:g.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${M}]`,this.stack,delete this.name}get code(){return M}set code(I){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:I,writable:!0})}toString(){return`${this.name} [${M}]: ${this.message}`}}}Ge("ERR_BUFFER_OUT_OF_BOUNDS",function(M){return M?`${M} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Ge("ERR_INVALID_ARG_TYPE",function(M,g){return`The "${M}" argument must be of type number. Received type ${typeof g}`},TypeError),Ge("ERR_OUT_OF_RANGE",function(M,g,x){let T=`The value of "${M}" is out of range.`,I=x;return Number.isInteger(x)&&Math.abs(x)>2**32?I=Be(String(x)):typeof x=="bigint"&&(I=String(x),(x>BigInt(2)**BigInt(32)||x<-(BigInt(2)**BigInt(32)))&&(I=Be(I)),I+="n"),T+=` It must be ${g}. Received ${I}`,T},RangeError);function Be(M){let g="",x=M.length;const T=M[0]==="-"?1:0;for(;x>=T+4;x-=3)g=`_${M.slice(x-3,x)}${g}`;return`${M.slice(0,x)}${g}`}function Oe(M,g,x){oe(g,"offset"),(M[g]===void 0||M[g+x]===void 0)&&le(g,M.length-(x+1))}function se(M,g,x,T,I,G){if(M>x||M<g){const Y=typeof g=="bigint"?"n":"";let be;throw g===0||g===BigInt(0)?be=`>= 0${Y} and < 2${Y} ** ${(G+1)*8}${Y}`:be=`>= -(2${Y} ** ${(G+1)*8-1}${Y}) and < 2 ** ${(G+1)*8-1}${Y}`,new Me.ERR_OUT_OF_RANGE("value",be,M)}Oe(T,I,G)}function oe(M,g){if(typeof M!="number")throw new Me.ERR_INVALID_ARG_TYPE(g,"number",M)}function le(M,g,x){throw Math.floor(M)!==M?(oe(M,x),new Me.ERR_OUT_OF_RANGE("offset","an integer",M)):g<0?new Me.ERR_BUFFER_OUT_OF_BOUNDS:new Me.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${g}`,M)}const we=/[^+/0-9A-Za-z-_]/g;
1function fe(M){if(M=M.split("=")[0],M=M.trim().replace(we,""),M.length<2)return"";for(;M.length%4!==0;)M=M+"=";return M}function P(M,g){g=g||1/0;let x;const T=M.length;let I=null;const G=[];for(let Y=0;Y<T;++Y){if(x=M.charCodeAt(Y),x>55295&&x<57344){if(!I){if(x>56319){(g-=3)>-1&&G.push(239,191,189);continue}else if(Y+1===T){(g-=3)>-1&&G.push(239,191,189);continue}I=x;continue}if(x<56320){(g-=3)>-1&&G.push(239,191,189),I=x;continue}x=(I-55296<<10|x-56320)+65536}else I&&(g-=3)>-1&&G.push(239,191,189);if(I=null,x<128){if((g-=1)<0)break;G.push(x)}else if(x<2048){if((g-=2)<0)break;G.push(x>>6|192,x&63|128)}else if(x<65536){if((g-=3)<0)break;G.push(x>>12|224,x>>6&63|128,x&63|128)}else if(x<1114112){if((g-=4)<0)break;G.push(x>>18|240,x>>12&63|128,x>>6&63|128,x&63|128)}else throw new Error("Invalid code point")}return G}function R(M){const g=[];for(let x=0;x<M.length;++x)g.push(M.charCodeAt(x)&255);return g}function ee(M,g){let x,T,I;const G=[];for(let Y=0;Y<M.length&&!((g-=2)<0);++Y)x=M.charCodeAt(Y),T=x>>8,I=x%256,G.push(I),G.push(T);return G}function te(M){return e.toByteArray(fe(M))}function he(M,g,x,T){let I;for(I=0;I<T&&!(I+x>=g.length||I>=M.length);++I)g[I+x]=M[I];return I}function me(M,g){return M instanceof g||M!=null&&M.constructor!=null&&M.constructor.name!=null&&M.constructor.name===g.name}function We(M){return M!==M}const Ee=(function(){const M="0123456789abcdef",g=new Array(256);for(let x=0;x<16;++x){const T=x*16;for(let I=0;I<16;++I)g[T+I]=M[x]+M[I]}return g})();function N(M){return typeof BigInt>"u"?ae:M}function ae(){throw new Error("BigInt not supported")}})(El)),El}var Q0=J0();const ep="128",$0=0,cu=1,eg=2,Zc=1,tp=2,Yr=3,_o=0,Pt=1,yt=2,np=1,ki=0,Qr=1,_c=2,hu=3,uu=4,tg=5,Gs=100,ng=101,ig=102,du=103,fu=104,sg=200,rg=201,og=202,ag=203,ip=204,sp=205,lg=206,cg=207,hg=208,ug=209,dg=210,fg=0,pg=1,mg=2,Sc=3,gg=4,xg=5,yg=6,vg=7,$a=0,bg=1,wg=2,Qs=0,Mg=1,_g=2,Sg=3,Kc=4,Tg=5,rp=300,Jc=301,Qc=302,pu=303,mu=304,el=306,$c=307,Hi=1e3,mn=1001,La=1002,vt=1003,Tc=1004,Ec=1005,St=1006,op=1007,yr=1008,So=1009,Eg=1010,Ag=1011,Ca=1012,Lg=1013,_a=1014,Pi=1015,Ra=1016,Cg=1017,Rg=1018,Pg=1019,$r=1020,Ig=1021,Wn=1022,Jt=1023,ap=1024,Bg=1025,Dg=Jt,$s=1026,ao=1027,kg=1028,Ng=1029,zg=1030,Fg=1031,Og=1032,Hg=1033,gu=33776,xu=33777,yu=33778,vu=33779,bu=35840,wu=35841,Mu=35842,_u=35843,Ug=36196,Su=37492,Tu=37496,Gg=37808,Wg=37809,Vg=37810,qg=37811,jg=37812,Xg=37813,Yg=37814,Zg=37815,Kg=37816,Jg=37817,Qg=37818,$g=37819,ex=37820,tx=37821,nx=36492,ix=37840,sx=37841,rx=37842,ox=37843,ax=37844,lx=37845,cx=37846,hx=37847,ux=37848,dx=37849,fx=37850,px=37851,mx=37852,gx=37853,xx=2200,yx=2201,vx=2202,lo=2300,or=2301,Al=2302,Vs=2400,qs=2401,Pa=2402,eh=2500,lp=2501,bx=0,wx=1,cp=2,an=3e3,Cn=3001,th=3007,nh=3002,Mx=3003,hp=3004,up=3005,dp=3006,_x=3200,Sx=3201,fs=0,Tx=1,Ll=7680,Ex=519,co=35044,Ia=35048,Eu="300 es";class ps{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){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const s=this._listeners[e];if(s!==void 0){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const s=i.slice(0);for(let r=0,o=s.length;r<o;r++)s[r].call(this,e);e.target=null}}}const Ft=[];for(let n=0;n<256;n++)Ft[n]=(n<16?"0":"")+n.toString(16);let ko=1234567;const eo=Math.PI/180,ho=180/Math.PI;function xn(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Ft[n&255]+Ft[n>>8&255]+Ft[n>>16&255]+Ft[n>>24&255]+"-"+Ft[e&255]+Ft[e>>8&255]+"-"+Ft[e>>16&15|64]+Ft[e>>24&255]+"-"+Ft[t&63|128]+Ft[t>>8&255]+"-"+Ft[t>>16&255]+Ft[t>>24&255]+Ft[i&255]+Ft[i>>8&255]+Ft[i>>16&255]+Ft[i>>24&255]).toUpperCase()}function nn(n,e,t){return Math.max(e,Math.min(t,n))}function ih(n,e){return(n%e+e)%e}function Ax(n,e,t,i,s){return i+(n-e)*(s-i)/(t-e)}
1function Lx(n,e,t){return n!==e?(t-n)/(e-n):0}function to(n,e,t){return(1-t)*n+t*e}function Cx(n,e,t,i){return to(n,e,1-Math.exp(-t*i))}function Rx(n,e=1){return e-Math.abs(ih(n,e*2)-e)}function Px(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Ix(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Bx(n,e){return n+Math.floor(Math.random()*(e-n+1))}function Dx(n,e){return n+Math.random()*(e-n)}function kx(n){return n*(.5-Math.random())}function Nx(n){return n!==void 0&&(ko=n%2147483647),ko=ko*16807%2147483647,(ko-1)/2147483646}function zx(n){return n*eo}function Fx(n){return n*ho}function Ac(n){return(n&n-1)===0&&n!==0}function fp(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function pp(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Ox(n,e,t,i,s){const r=Math.cos,o=Math.sin,a=r(t/2),c=o(t/2),l=r((e+i)/2),u=o((e+i)/2),h=r((e-i)/2),d=o((e-i)/2),f=r((i-e)/2),p=o((i-e)/2);switch(s){case"XYX":n.set(a*u,c*h,c*d,a*l);break;case"YZY":n.set(c*d,a*u,c*h,a*l);break;case"ZXZ":n.set(c*h,c*d,a*u,a*l);break;case"XZX":n.set(a*u,c*p,c*f,a*l);break;case"YXY":n.set(c*f,a*u,c*p,a*l);break;case"ZYZ":n.set(c*p,c*f,a*u,a*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}var Hx=Object.freeze({__proto__:null,DEG2RAD:eo,RAD2DEG:ho,generateUUID:xn,clamp:nn,euclideanModulo:ih,mapLinear:Ax,inverseLerp:Lx,lerp:to,damp:Cx,pingpong:Rx,smoothstep:Px,smootherstep:Ix,randInt:Bx,randFloat:Dx,randFloatSpread:kx,seededRandom:Nx,degToRad:zx,radToDeg:Fx,isPowerOfTwo:Ac,ceilPowerOfTwo:fp,floorPowerOfTwo:pp,setQuaternionFromProperEuler:Ox});class ${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,t){return t!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e,t){return t!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(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,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6],this.y=s[1]*t+s[4]*i+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(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}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,i){return i!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this}
vendor: 2,515 bytes, line 1
1rotateAround(e,t){const i=Math.cos(t),s=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*i-o*s+e.x,this.y=r*s+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}}$.prototype.isVector2=!0;class Ht{constructor(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(e,t,i,s,r,o,a,c,l){const u=this.elements;return u[0]=e,u[1]=s,u[2]=a,u[3]=t,u[4]=r,u[5]=c,u[6]=i,u[7]=o,u[8]=l,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,s=t.elements,r=this.elements,o=i[0],a=i[3],c=i[6],l=i[1],u=i[4],h=i[7],d=i[2],f=i[5],p=i[8],b=s[0],w=s[3],v=s[6],y=s[1],E=s[4],L=s[7],C=s[2],_=s[5],D=s[8];return r[0]=o*b+a*y+c*C,r[3]=o*w+a*E+c*_,r[6]=o*v+a*L+c*D,r[1]=l*b+u*y+h*C,r[4]=l*w+u*E+h*_,r[7]=l*v+u*L+h*D,r[2]=d*b+f*y+p*C,r[5]=d*w+f*E+p*_,r[8]=d*v+f*L+p*D,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],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8];return t*o*u-t*a*l-i*r*u+i*a*c+s*r*l-s*o*c}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=u*o-a*l,d=a*c-u*r,f=l*r-o*c,p=t*h+i*d+s*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const b=1/p;return e[0]=h*b,e[1]=(s*l-u*i)*b,e[2]=(a*i-s*o)*b,e[3]=d*b,e[4]=(u*t-s*c)*b,e[5]=(s*r-a*t)*b,e[6]=f*b,e[7]=(i*c-l*t)*b,e[8]=(o*t-i*r)*b,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,s,r,o,a){const c=Math.cos(r),l=Math.sin(r);return this.set(i*c,i*l,-i*(c*o+l*a)+o+e,-s*l,s*c,-s*(-l*o+c*a)+a+t,0,0,1),this}scale(e,t){const i=this.elements;
1return i[0]*=e,i[3]*=e,i[6]*=e,i[1]*=t,i[4]*=t,i[7]*=t,this}rotate(e){const t=Math.cos(e),i=Math.sin(e),s=this.elements,r=s[0],o=s[3],a=s[6],c=s[1],l=s[4],u=s[7];return s[0]=t*r+i*c,s[3]=t*o+i*l,s[6]=t*a+i*u,s[1]=-i*r+t*c,s[4]=-i*o+t*l,s[7]=-i*a+t*u,this}translate(e,t){const i=this.elements;return i[0]+=e*i[2],i[3]+=e*i[5],i[6]+=e*i[8],i[1]+=t*i[2],i[4]+=t*i[5],i[7]+=t*i[8],this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<9;s++)if(t[s]!==i[s])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)}}Ht.prototype.isMatrix3=!0;let Ms;class vr{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Ms===void 0&&(Ms=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Ms.width=e.width,Ms.height=e.height;const i=Ms.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Ms}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}}let Ux=0;class kt extends ps{constructor(e=kt.DEFAULT_IMAGE,t=kt.DEFAULT_MAPPING,i=mn,s=mn,r=St,o=yr,a=Jt,c=So,l=1,u=an){super(),Object.defineProperty(this,"id",{value:Ux++}),this.uuid=xn(),this.name="",this.image=e,this.mipmaps=[],this.mapping=t,this.wrapS=i,this.wrapT=s,this.magFilter=r,this.minFilter=o,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=c,this.offset=new $(0,0),this.repeat=new $(1,1),this.center=new $(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ht,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=u,this.version=0,this.onUpdate=null}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this}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.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(this.image!==void 0){const s=this.image;if(s.uuid===void 0&&(s.uuid=xn()),!t&&e.images[s.uuid]===void 0){let r;if(Array.isArray(s)){r=[];for(let o=0,a=s.length;o<a;o++)s[o].isDataTexture?r.push(Cl(s[o].image)):r.push(Cl(s[o]))}else r=Cl(s);e.images[s.uuid]={uuid:s.uuid,url:r}}i.image=s.uuid}return t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==rp)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Hi:e.x=e.x-Math.floor(e.x);break;case mn:e.x=e.x<0?0:1;break;case La: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 Hi:e.y=e.y-Math.floor(e.y);break;case mn:e.y=e.y<0?0:1;break;case La: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++}}kt.DEFAULT_IMAGE=void 0;kt.DEFAULT_MAPPING=rp;kt.prototype.isTexture=!0;function Cl(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?vr.getDataURL(n):n.data?{data:Array.prototype.slice.call(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}class at{constructor(e=0,t=0,i=0,s=1){this.x=e,this.y=t,this.z=i,this.w=s}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,s){return this.x=e,this.y=t,this.z=i,this.w=s,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,t){return t!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(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,t){return t!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.
vendor: 8,740 bytes, line 1
1y,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,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*s+o[12]*r,this.y=o[1]*t+o[5]*i+o[9]*s+o[13]*r,this.z=o[2]*t+o[6]*i+o[10]*s+o[14]*r,this.w=o[3]*t+o[7]*i+o[11]*s+o[15]*r,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,s,r;const c=e.elements,l=c[0],u=c[4],h=c[8],d=c[1],f=c[5],p=c[9],b=c[2],w=c[6],v=c[10];if(Math.abs(u-d)<.01&&Math.abs(h-b)<.01&&Math.abs(p-w)<.01){if(Math.abs(u+d)<.1&&Math.abs(h+b)<.1&&Math.abs(p+w)<.1&&Math.abs(l+f+v-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const E=(l+1)/2,L=(f+1)/2,C=(v+1)/2,_=(u+d)/4,D=(h+b)/4,F=(p+w)/4;return E>L&&E>C?E<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(E),s=_/i,r=D/i):L>C?L<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(L),i=_/s,r=F/s):C<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(C),i=D/r,s=F/r),this.set(i,s,r,t),this}let y=Math.sqrt((w-p)*(w-p)+(h-b)*(h-b)+(d-u)*(d-u));return Math.abs(y)<.001&&(y=1),this.x=(w-p)/y,this.y=(h-b)/y,this.z=(d-u)/y,this.w=Math.acos((l+f+v-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(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,i){return i!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),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}}at.prototype.isVector4=!0;class on extends ps{constructor(e,t,i){super(),this.width=e,this.height=t,this.depth=1,this.scissor=new at(0,0,e,t),this.scissorTest=!1,this.viewport=new at(0,0,e,t),i=i||{},this.texture=new kt(void 0,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=1,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:St,this.depthBuffer=i.depthBuffer!==void 0?i.depthBuffer:!0,this.stencilBuffer=i.stencilBuffer!==void 0?i.stencilBuffer:!1,this.depthTexture=i.depthTexture!==void 0?i.depthTexture:null}setTexture(e){e.image={width:this.width,height:this.height,depth:this.depth},this.texture=e}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this}dispose(){this.dispatchEvent({type:"dispose"})}}on.prototype.isWebGLRenderTarget=!0;class Gx extends on{constructor(e,t,i){super(e,t,i),this.samples=4}copy(e){return super.copy.call(this,e),this.samples=e.samples,this}}Gx.prototype.isWebGLMultisampleRenderTarget=!0;class Dt{constructor(e=0,t=0,i=0,s=1){this._x=e,this._y=t,this._z=i,this._w=s}static slerp(e,t,i,s){return console.warn("THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead."),i.slerpQuaternions(e,t,s)}static slerpFlat(e,t,i,s,r,o,a){let c=i[s+0],l=i[s+1],u=i[s+2],h=i[s+3];const d=r[o+0],f=r[o+1],p=r[o+2],b=r[o+3];if(a===0){e[t+0]=c,e[t+1]=l,e[t+2]=u,e[t+3]=h;return}if(a===1){e[t+0]=d,e[t+1]=f,e[t+2]=p,e[t+3]=b;return}if(h!==b||c!==d||l!==f||u!==p){let w=1-a;const v=c*d+l*f+u*p+h*b,y=v>=0?1:-1,E=1-v*v;if(E>Number.EPSILON){const C=Math.sqrt(E),_=Math.atan2(C,v*y);w=Math.sin(w*_)/C,a=Math.sin(a*_)/C}const L=a*y;if(c=c*w+d*L,l=l*w+f*L,u=u*w+p*L,h=h*w+b*L,w===1-a){const C=1/Math.sqrt(c*c+l*l+u*u+h*h);c*=C,l*=C,u*=C,h*=C}}e[t]=c,e[t+1]=l,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,s,r,o){const a=i[s],c=i[s+1],l=i[s+2],u=i[s+3],h=r[o],d=r[o+1],f=r[o+2],p=r[o+3];return e[t]=a*p+u*h+c*f-l*d,e[t+1]=c*p+u*d+l*h-a*f,e[t+2]=l*p+u*f+a*d-c*h,e[t+3]=u*p-a*h-c*d-l*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,s){return this._x=e,this._y=t,this._z=i,this._w=s,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){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const i=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,c=Math.sin,l=a(i/2),u=a(s/2),h=a(r/2),d=c(i/2),f=c(s/2),p=c(r/2);switch(o){case"XYZ":this._x=d*u*h+l*f*p,this._y=l*f*h-d*u*p,this._z=l*u*p+d*f*h,this._w=l*u*h-d*f*p;break;case"YXZ":this._x=d*u*h+l*f*p,this._y=l*f*h-d*u*p,this._z=l*u*p-d*f*h,this._w=l*u*h+d*f*p;break;case"ZXY":this._x=d*u*h-l*f*p,this._y=l*f*h+d*u*p,this._z=l*u*p+d*f*h,this._w=l*u*h-d*f*p;break;case"ZYX":this._x=d*u*h-l*f*p,this._y=l*f*h+d*u*p,this._z=l*u*p-d*f*h,this._w=l*u*h+d*f*p;break;case"YZX":this._x=d*u*h+l*f*p,this._y=l*f*h+d*u*p,this._z=l*u*p-d*f*h,this._w=l*u*h-d*f*p;break;case"XZY":this._x=d*u*h-l*f*p,this._y=l*f*h-d*u*p,this._z=l*u*p+d*f*h,this._w=l*u*h+d*f*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],s=t[4],r=t[8],o=t[1],a=t[5],c=t[9],l=t[2],u=t[6],h=t[10],d=i+a+h;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(u-c)*f,this._y=(r-l)*f,this._z=(o-s)*f}else if(i>
vendor: 10,209 bytes, line 1
1a&&i>h){const f=2*Math.sqrt(1+i-a-h);this._w=(u-c)/f,this._x=.25*f,this._y=(s+o)/f,this._z=(r+l)/f}else if(a>h){const f=2*Math.sqrt(1+a-i-h);this._w=(r-l)/f,this._x=(s+o)/f,this._y=.25*f,this._z=(c+u)/f}else{const f=2*Math.sqrt(1+h-i-a);this._w=(o-s)/f,this._x=(r+l)/f,this._y=(c+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._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(nn(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,t/i);return this.slerp(e,s),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,t){return t!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,s=e._y,r=e._z,o=e._w,a=t._x,c=t._y,l=t._z,u=t._w;return this._x=i*u+o*a+s*l-r*c,this._y=s*u+o*c+r*a-i*l,this._z=r*u+o*l+i*c-s*a,this._w=o*u-i*a-s*c-r*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,s=this._y,r=this._z,o=this._w;let a=o*e._w+i*e._x+s*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=s,this._z=r,this;const c=1-a*a;if(c<=Number.EPSILON){const f=1-t;return this._w=f*o+t*this._w,this._x=f*i+t*this._x,this._y=f*s+t*this._y,this._z=f*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(c),u=Math.atan2(l,a),h=Math.sin((1-t)*u)/l,d=Math.sin(t*u)/l;return this._w=o*h+this._w*d,this._x=i*h+this._x*d,this._y=s*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,i){this.copy(e).slerp(t,i)}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}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}Dt.prototype.isQuaternion=!0;class S{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,t){return t!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(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,t){return t!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(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,t){return t!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(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 e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Au.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Au.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*s,this.y=r[1]*t+r[4]*i+r[7]*s,this.z=r[2]*t+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=e.elements,o=1/(r[3]*t+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*s+r[12])*o,this.y=(r[1]*t+r[5]*i+r[9]*s+r[13])*o,this.z=(r[2]*t+r[6]*i+r[10]*s+r[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z,c=e.w,l=c*t+o*s-a*i,u=c*i+a*t-r*s,h=c*s+r*i-o*t,d=-r*t-o*i-a*s;return this.x=l*c+d*-r+u*-a-h*-o,this.y=u*c+d*-o+h*-r-l*-a,this.z=h*c+d*-a+l*-o-u*-r,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,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*s,this.y=r[1]*t+r[5]*i+r[9]*s,this.z=r[2]*t+r[6]*i+r[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(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,t){return t!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,s=e.y,r=e.z,o=t.x,a=t.y,c=t.z;return this.x=s*c-r*a,this.y=r*o-i*c,this.z=i*a-s*o,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 Rl.copy(this).projectOnVector(e),this.sub(Rl)}reflect(e){return this.sub(Rl.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(nn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return t*t+i*i+s*s}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 s=Math.sin(t)*e;return this.x=s*Math.sin(i),this.y=Math.cos(t)*e,this.z=s*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(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}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,i){return i!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),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}}S.prototype.isVector3=!0;const Rl=new S,Au=new Dt;
vendor: 19,188 bytes, line 1
1class Yt{constructor(e=new S(1/0,1/0,1/0),t=new S(-1/0,-1/0,-1/0)){this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,i=1/0,s=1/0,r=-1/0,o=-1/0,a=-1/0;for(let c=0,l=e.length;c<l;c+=3){const u=e[c],h=e[c+1],d=e[c+2];u<t&&(t=u),h<i&&(i=h),d<s&&(s=d),u>r&&(r=u),h>o&&(o=h),d>a&&(a=d)}return this.min.set(t,i,s),this.max.set(r,o,a),this}setFromBufferAttribute(e){let t=1/0,i=1/0,s=1/0,r=-1/0,o=-1/0,a=-1/0;for(let c=0,l=e.count;c<l;c++){const u=e.getX(c),h=e.getY(c),d=e.getZ(c);u<t&&(t=u),h<i&&(i=h),d<s&&(s=d),u>r&&(r=u),h>o&&(o=h),d>a&&(a=d)}return this.min.set(t,i,s),this.max.set(r,o,a),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=Pr.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e){return this.makeEmpty(),this.expandByObject(e)}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 e===void 0&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new S),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return e===void 0&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new S),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){e.updateWorldMatrix(!1,!1);const t=e.geometry;t!==void 0&&(t.boundingBox===null&&t.computeBoundingBox(),Pl.copy(t.boundingBox),Pl.applyMatrix4(e.matrixWorld),this.union(Pl));const i=e.children;for(let s=0,r=i.length;s<r;s++)this.expandByObject(i[s]);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===void 0&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new S),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,Pr),Pr.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(Ir),No.subVectors(this.max,Ir),_s.subVectors(e.a,Ir),Ss.subVectors(e.b,Ir),Ts.subVectors(e.c,Ir),yi.subVectors(Ss,_s),vi.subVectors(Ts,Ss),Yi.subVectors(_s,Ts);let t=[0,-yi.z,yi.y,0,-vi.z,vi.y,0,-Yi.z,Yi.y,yi.z,0,-yi.x,vi.z,0,-vi.x,Yi.z,0,-Yi.x,-yi.y,yi.x,0,-vi.y,vi.x,0,-Yi.y,Yi.x,0];return!Il(t,_s,Ss,Ts,No)||(t=[1,0,0,0,1,0,0,0,1],!Il(t,_s,Ss,Ts,No))?!1:(zo.crossVectors(yi,vi),t=[zo.x,zo.y,zo.z],Il(t,_s,Ss,Ts,No))}clampPoint(e,t){return t===void 0&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new S),t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return Pr.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return e===void 0&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=this.getSize(Pr).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:(Zn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Zn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Zn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Zn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Zn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Zn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Zn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Zn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Zn),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)}}Yt.prototype.isBox3=!0;const Zn=[new S,new S,new S,new S,new S,new S,new S,new S],Pr=new S,Pl=new Yt,_s=new S,Ss=new S,Ts=new S,yi=new S,vi=new S,Yi=new S,Ir=new S,No=new S,zo=new S,Zi=new S;function Il(n,e,t,i,s){for(let r=0,o=n.length-3;r<=o;r+=3){Zi.fromArray(n,r);const a=s.x*Math.abs(Zi.x)+s.y*Math.abs(Zi.y)+s.z*Math.abs(Zi.z),c=e.dot(Zi),l=t.dot(Zi),u=i.dot(Zi);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>a)return!1}return!0}const Wx=new Yt,Lu=new S,Bl=new S,Dl=new S;class ms{constructor(e=new S,t=-1){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):Wx.setFromPoints(e).getCenter(i);let s=0;for(let r=0,o=e.length;r<o;r++)s=Math.max(s,i.distanceToSquared(e[r]));return this.radius=Math.sqrt(s),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===void 0&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new S),t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return e===void 0&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new Yt),this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){Dl.subVectors(e,this.center);const t=Dl.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),s=(i-this.radius)*.5;this.center.add(Dl.multiplyScalar(s/i)),this.radius+=s}return this}union(e){return Bl.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(Lu.copy(e.center).add(Bl)),this.expandByPoint(Lu.copy(e.center).sub(Bl)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Kn=new S,kl=new S,Fo=new S,bi=new S,Nl=new S,Oo=new S,zl=new S;class gs{constructor(e=new S,t=new S(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===void 0&&(console.warn("THREE.Ray: .at() target is now required"),t=new S),t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Kn)),this}closestPointToPoint(e,t){t===void 0&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new S),t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Kn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Kn.copy(this.direction).multiplyScalar(t).add(this.origin),Kn.distanceToSquared(e))}distanceSqToSegment(e,t,i,s){kl.copy(e).add(t).multiplyScalar(.5),Fo.copy(t).sub(e).normalize(),bi.copy(this.origin).sub(kl);const r=e.distanceTo(t)*.5,o=-this.direction.dot(Fo),a=bi.dot(this.direction),c=-bi.dot(Fo),l=bi.lengthSq(),u=Math.abs(1-o*o);let h,d,f,p;if(u>0)if(h=o*c-a,d=o*a-c,p=r*u,h>=0)if(d>=-p)if(d<=p){const b=1/u;h*=b,d*=b,f=h*(h+o*d+2*a)+d*(o*h+d+2*c)+l}else d=r,h=Math.max(0,-(o*d+a)),f=-h*h+d*(d+2*c)+l;else d=-r,h=Math.max(0,-(o*d+a)),f=-h*h+d*(d+2*c)+l;else d<=-p?(h=Math.max(0,-(-o*r+a)),d=h>0?-r:Math.min(Math.max(-r,-c),r),f=-h*h+d*(d+2*c)+l):d<=p?(h=0,d=Math.min(Math.max(-r,-c),r),f=d*(d+2*c)+l):(h=Math.max(0,-(o*r+a)),d=h>0?r:Math.min(Math.max(-r,-c),r),f=-h*h+d*(d+2*c)+l);else d=o>0?-r:r,h=Math.max(0,-(o*d+a)),f=-h*h+d*(d+2*c)+l;return i&&i.copy(this.direction).multiplyScalar(h).add(this.origin),s&&s.copy(Fo).multiplyScalar(d).add(kl),f}intersectSphere(e,t){Kn.subVectors(e.center,this.origin);const i=Kn.dot(this.direction),s=Kn.dot(Kn)-i*i,r=e.radius*e.radius;if(s>r)return null;const o=Math.sqrt(r-s),a=i-o,c=i+o;return a<0&&c<0?null:a<0?this.at(c,t):this.at(a,t)}intersectsSphere(e){return 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,s,r,o,a,c;const l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(i=(e.min.x-d.x)*l,s=(e.max.x-d.x)*l):(i=(e.max.x-d.x)*l,s=(e.min.x-d.x)*l),u>=0?(r=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(r=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),i>o||r>s||((r>i||i!==i)&&(i=r),(o<s||s!==s)&&(s=o),h>=0?(a=(e.min.z-d.z)*h,c=(e.max.z-d.z)*h):(a=(e.max.z-d.z)*h,c=(e.min.z-d.z)*h),i>c||a>s)||((a>i||i!==i)&&(i=a),(c<s||s!==s)&&(s=c),s<0)?null:this.at(i>=0?i:s,t)}intersectsBox(e){return this.intersectBox(e,Kn)!==null}intersectTriangle(e,t,i,s,r){Nl.subVectors(t,e),Oo.subVectors(i,e),zl.crossVectors(Nl,Oo);let o=this.direction.dot(zl),a;if(o>0){if(s)return null;a=1}else if(o<0)a=-1,o=-o;else return null;bi.subVectors(this.origin,e);const c=a*this.direction.dot(Oo.crossVectors(bi,Oo));if(c<0)return null;const l=a*this.direction.dot(Nl.cross(bi));if(l<0||c+l>o)return null;const u=-a*bi.dot(zl);return u<0?null:this.at(u/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ve{constructor(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(e,t,i,s,r,o,a,c,l,u,h,d,f,p,b,w){const v=this.elements;return v[0]=e,v[4]=t,v[8]=i,v[12]=s,v[1]=r,v[5]=o,v[9]=a,v[13]=c,v[2]=l,v[6]=u,v[10]=h,v[14]=d,v[3]=f,v[7]=p,v[11]=b,v[15]=w,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 ve().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 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){const t=this.elements,i=e.elements,s=1/Es.setFromMatrixColumn(e,0).length(),r=1/Es.setFromMatrixColumn(e,1).length(),o=1/Es.setFromMatrixColumn(e,2).length();return t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const t=this.elements,i=e.x,s=e.y,r=e.z,o=Math.cos(i),a=Math.sin(i),c=Math.cos(s),l=Math.sin(s),u=Math.cos(r),h=Math.sin(r);if(e.order==="XYZ"){const d=o*u,f=o*h,p=a*u,b=a*h;t[0]=c*u,t[4]=-c*h,t[8]=l,t[1]=f+p*l,t[5]=d-b*l,t[9]=-a*c,t[2]=b-d*l,t[6]=p+f*l,t[10]=o*c}else if(e.order==="YXZ"){const d=c*u,f=c*h,p=l*u,b=l*h;t[0]=d+b*a,t[4]=p*a-f,t[8]=o*l,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=f*a-p,t[6]=b+d*a,t[10]=o*c}else if(e.order==="ZXY"){const d=c*u,f=c*h,p=l*u,b=l*h;t[0]=d-b*a,t[4]=-o*h,t[8]=p+f*a,t[1]=f+p*a,t[5]=o*u,t[9]=b-d*a,t[2]=-o*l,t[6]=a,t[10]=o*c}else if(e.order==="ZYX"){const d=o*u,f=o*h,p=a*u,b=a*h;t[0]=c*u,t[4]=p*l-f,t[8]=d*l+b,t[1]=c*h,t[5]=b*l+d,t[9]=f*l-p,t[2]=-l,t[6]=a*c,t[10]=o*c}else if(e.order==="YZX"){const d=o*c,f=o*l,p=a*c,b=a*l;t[0]=c*u,t[4]=b-d*h,t[8]=p*h+f,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-l*u,t[6]=f*h+p,t[10]=d-b*h}else if(e.order==="XZY"){const d=o*c,f=o*l,p=a*c,b=a*l;t[0]=c*u,t[4]=-h,t[8]=l*u,t[1]=d*h+b,t[5]=o*u,t[9]=f*h-p,t[2]=p*h-f,t[6]=a*u,t[10]=b*h+d}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(Vx,e,qx)}lookAt(e,t,i){const s=this.elements;return ln.subVectors(e,t),ln.lengthSq()===0&&(ln.z=1),ln.normalize(),wi.crossVectors(i,ln),wi.lengthSq()===0&&(Math.abs(i.z)===1?ln.x+=1e-4:ln.z+=1e-4,ln.normalize(),wi.crossVectors(i,ln)),wi.normalize(),Ho.crossVectors(ln,wi),s[0]=wi.x,s[4]=Ho.x,s[8]=ln.x,s[1]=wi.y,s[5]=Ho.y,s[9]=ln.y,s[2]=wi.z,s[6]=Ho.z,s[10]=ln.z,this}multiply(e,t){return t!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[4],c=i[8],l=i[12],u=i[1],h=i[5],d=i[9],f=i[13],p=i[2],b=i[6],w=i[10],v=i[14],y=i[3],E=i[7],L=i[11],C=i[15],_=s[0],D=s[4],F=s[8],H=s[12],W=s[1],Z=s[5],q=s[9],k=s[13],O=s[2],U=s[6],z=s[10],ne=s[14],ce=s[3],re=s[7],ge=s[11],ie=s[15];return r[0]=o*_+a*W+c*O+l*ce,r[4]=o*D+a*Z+c*U+l*re,r[8]=o*F+a*q+c*z+l*ge,r[12]=o*H+a*k+c*ne+l*ie,r[1]=u*_+h*W+d*O+f*ce,r[5]=u*D+h*Z+d*U+f*re,r[9]=u*F+h*q+d*z+f*ge,r[13]=u*H+h*k+d*ne+f*ie,r[2]=p*_+b*W+w*O+v*ce,r[6]=p*D+b*Z+w*U+v*re,r[10]=p*F+b*q+w*z+v*ge,r[14]=p*H+b*k+w*ne+v*ie,r[3]=y*_+E*W+L*O+C*ce,r[7]=y*D+E*Z+L*U+C*re,r[11]=y*F+E*q+L*z+C*ge,r[15]=y*H+E*k+L*ne+C*ie,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],s=e[8],r=e[12],o=e[1],a=e[5],c=e[9],l=e[13],u=e[2],h=e[6],d=e[10],f=e[14],p=e[3],b=e[7],w=e[11],v=e[15];return p*(+r*c*h-s*l*h-r*a*d+i*l*d+s*a*f-i*c*f)+b*(+t*c*f-t*l*d+r*o*d-s*o*f+s*l*u-r*c*u)+w*(+t*l*h-t*a*f-r*o*h+i*o*f+r*a*u-i*l*u)+v*(-s*a*u-t*c*h+t*a*d+s*o*h-i*o*d+i*c*u)}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 s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],d=e[10],f=e[11],p=e[12],b=e[13],w=e[14],v=e[15],y=h*w*l-b*d*l+b*c*f-a*w*f-h*c*v+a*d*v,E=p*d*l-u*w*l-p*c*f+o*w*f+u*c*v-o*d*v,L=u*b*l-p*h*l+p*a*f-o*b*f-u*a*v+o*h*v,C=p*h*c-u*b*c-p*a*d+o*b*d+u*a*w-o*h*w,_=t*y+i*E+s*L+r*C;if(_===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const D=1/_;return e[0]=y*D,e[1]=(b*d*r-h*w*r-b*s*f+i*w*f+h*s*v-i*d*v)*D,e[2]=(a*w*r-b*c*r+b*s*l-i*w*l-a*s*v+i*c*v)*D,e[3]=(h*c*r-a*d*r-h*s*l+i*d*l+a*s*f-i*c*f)*D,e[4]=E*D,e[5]=(u*w*r-p*d*r+p*s*f-t*w*f-u*s*v+t*d*v)*D,e[6]=(p*c*r-o*w*r-p*s*l+t*w*l+o*s*v-t*c*v)*D,e[7]=(o*d*r-u*c*r+u*s*l-t*d*l-o*s*f+t*c*f)*D,e[8]=L*D,e[9]=(p*h*r-u*b*r-p*i*f+t*b*f+u*i*v-t*h*v)*D,e[10]=(o*b*r-p*a*r+p*i*l-t*b*l-o*i*v+t*a*v)*D,e[11]=(u*a*r-o*h*r-u*i*l+t*h*l+o*i*f-t*a*f)*D,e[12]=C*D,e[13]=(u*b*s-p*h*s+p*i*d-t*b*d-u*i*w+t*h*w)*D,e[14]=(p*a*s-o*b*s-p*i*c+t*b*c+o*i*w-t*a*w)*D,e[15]=(o*h*s-u*a*s+u*i*c-t*h*c-o*i*d+t*a*d)*D,this}scale(e){const t=this.elements,i=e.x,s=e.y,r=e.z;return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,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],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,s))}makeTranslation(e,t,i){return 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),s=Math.sin(t),r=1-i,o=e.x,a=e.y,c=e.z,l=r*o,u=r*a;return this.set(l*o+i,l*a-s*c,l*c+s*a,0,l*a+s*c,u*a+i,u*c-s*o,0,l*c-s*a,u*c+s*o,r*c*c+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){return this.set(1,t,i,0,e,1,i,0,e,t,1,0,0,0,0,1),this}compose(e,t,i){const s=this.elements,r=t._x,o=t._y,a=t._z,c=t._w,l=r+r,u=o+o,h=a+a,d=r*l,f=r*u,p=r*h,b=o*u,w=o*h,v=a*h,y=c*l,E=c*u,L=c*h,C=i.x,_=i.y,D=i.z;return s[0]=(1-(b+v))*C,s[1]=(f+L)*C,s[2]=(p-E)*C,s[3]=0,s[4]=(f-L)*_,s[5]=(1-(d+v))*_,s[6]=(w+y)*_,s[7]=0,s[8]=(p+E)*D,s[9]=(w-y)*D,s[10]=(1-(d+b))*D,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,i){const s=this.elements;let r=Es.set(s[0],s[1],s[2]).length();const o=Es.set(s[4],s[5],s[6]).length(),a=Es.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],bn.copy(this);const l=1/r,u=1/o,h=1/a;return bn.elements[0]*=l,bn.elements[1]*=l,bn.elements[2]*=l,bn.elements[4]*=u,bn.elements[5]*=u,bn.elements[6]*=u,bn.elements[8]*=h,bn.elements[9]*=h,bn.elements[10]*=h,t.setFromRotationMatrix(bn),i.x=r,i.y=o,i.z=a,this}makePerspective(e,t,i,s,r,o){o===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a 
1new signature. Please check the docs.");const a=this.elements,c=2*r/(t-e),l=2*r/(i-s),u=(t+e)/(t-e),h=(i+s)/(i-s),d=-(o+r)/(o-r),f=-2*o*r/(o-r);return a[0]=c,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=l,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=f,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,i,s,r,o){const a=this.elements,c=1/(t-e),l=1/(i-s),u=1/(o-r),h=(t+e)*c,d=(i+s)*l,f=(o+r)*u;return a[0]=2*c,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*l,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-f,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<16;s++)if(t[s]!==i[s])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}}ve.prototype.isMatrix4=!0;const Es=new S,bn=new ve,Vx=new S(0,0,0),qx=new S(1,1,1),wi=new S,Ho=new S,ln=new S,Cu=new ve,Ru=new Dt;class xs{constructor(e=0,t=0,i=0,s=xs.DefaultOrder){this._x=e,this._y=t,this._z=i,this._order=s}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,s){return this._x=e,this._y=t,this._z=i,this._order=s||this._order,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,i){const s=e.elements,r=s[0],o=s[4],a=s[8],c=s[1],l=s[5],u=s[9],h=s[2],d=s[6],f=s[10];switch(t=t||this._order,t){case"XYZ":this._y=Math.asin(nn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-nn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,f),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(nn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,f),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,r));break;case"ZYX":this._y=Math.asin(-nn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(c,r)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(nn(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,f));break;case"XZY":this._z=Math.asin(-nn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-u,f),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i!==!1&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return Cu.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Cu,t,i)}setFromVector3(e,t){return this.set(e.x,e.y,e.z,t||this._order)}reorder(e){return Ru.setFromEuler(this),this.setFromQuaternion(Ru,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}toVector3(e){return e?e.set(this._x,this._y,this._z):new S(this._x,this._y,this._z)}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}}xs.prototype.isEuler=!0;xs.DefaultOrder="XYZ";xs.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class mp{constructor(){this.mask=1}set(e){this.mask=1<<e|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}}let jx=0;const Pu=new S,As=new Dt,Jn=new ve,Uo=new S,Br=new S,Xx=new S,Yx=new Dt,Iu=new S(1,0,0),Bu=new S(0,1,0),Du=new S(0,0,1),Zx={type:"added"},ku={type:"removed"};class $e extends ps{constructor(){super(),Object.defineProperty(this,"id",{value:jx++}),this.uuid=xn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=$e.DefaultUp.clone();const e=new S,t=new xs,i=new Dt,s=new S(1,1,1);function r(){i.setFromEuler(t,!1)}function o(){t.setFromQuaternion(i,void 0,!1)}t._onChange(r),i._onChange(o),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:s},modelViewMatrix:{value:new ve},normalMatrix:{value:new Ht}}),this.matrix=new ve,this.matrixWorld=new ve,this.matrixAutoUpdate=$e.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new mp,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}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)}
vendor: 8,760 bytes, line 1
1setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return As.setFromAxisAngle(e,t),this.quaternion.multiply(As),this}rotateOnWorldAxis(e,t){return As.setFromAxisAngle(e,t),this.quaternion.premultiply(As),this}rotateX(e){return this.rotateOnAxis(Iu,e)}rotateY(e){return this.rotateOnAxis(Bu,e)}rotateZ(e){return this.rotateOnAxis(Du,e)}translateOnAxis(e,t){return Pu.copy(e).applyQuaternion(this.quaternion),this.position.add(Pu.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Iu,e)}translateY(e){return this.translateOnAxis(Bu,e)}translateZ(e){return this.translateOnAxis(Du,e)}localToWorld(e){return e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return e.applyMatrix4(Jn.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Uo.copy(e):Uo.set(e,t,i);const s=this.parent;this.updateWorldMatrix(!0,!1),Br.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Jn.lookAt(Br,Uo,this.up):Jn.lookAt(Uo,Br,this.up),this.quaternion.setFromRotationMatrix(Jn),s&&(Jn.extractRotation(s.matrixWorld),As.setFromRotationMatrix(Jn),this.quaternion.premultiply(As.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(Zx)):console.error("THREE.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(ku)),this}clear(){for(let e=0;e<this.children.length;e++){const t=this.children[e];t.parent=null,t.dispatchEvent(ku)}return this.children.length=0,this}attach(e){return this.updateWorldMatrix(!0,!1),Jn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Jn.multiply(e.parent.matrixWorld)),e.applyMatrix4(Jn),this.add(e),e.updateWorldMatrix(!1,!0),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,s=this.children.length;i<s;i++){const o=this.children[i].getObjectByProperty(e,t);if(o!==void 0)return o}}getWorldPosition(e){return e===void 0&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new S),this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return e===void 0&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),e=new Dt),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Br,e,Xx),e}getWorldScale(e){return e===void 0&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),e=new S),this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Br,Yx,e),e}getWorldDirection(e){e===void 0&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new S),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,s=t.length;i<s;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,s=t.length;i<s;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),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(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,s=t.length;i<s;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.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const s=this.children;for(let r=0,o=s.length;r<o;r++)s[r].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{}},i.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});const s={};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON()));function r(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.uuid}if(this.isMesh||this.isLine||this.isPoints){s.geometry=r(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const c=a.shapes;if(Array.isArray(c))for(let l=0,u=c.length;l<u;l++){const h=c[l];r(e.shapes,h)}else r(e.shapes,c)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(r(e.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let c=0,l=this.material.length;c<l;c++)a.push(r(e.materials,this.material[c]));s.material=a}else s.material=r(e.materials,this.material);if(this.children.length>0){s.children=[];for(let a=0;a<this.children.length;a++)s.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){s.animations=[];for(let a=0;a<this.animations.length;a++){const c=this.animations[a];s.animations.push(r(e.animations,c))}}if(t){const a=o(e.geometries),c=o(e.materials),l=o(e.textures),u=o(e.images),h=o(e.shapes),d=o(e.skeletons),f=o(e.animations);a.length>0&&(i.geometries=a),c.length>0&&(i.materials=c),l.length>0&&(i.textures=l),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),d.length>0&&(i.skeletons=d),f.length>0&&(i.animations=f)}return i.object=s,i;function o(a){const c=[];for(const l in a){const u=a[l];delete u.metadata,c.push(u)}return c}}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.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,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.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){const s=e.children[i];this.add(s.clone())}return this}}$e.DefaultUp=new S(0,1,0);$e.DefaultMatrixAutoUpdate=!0;$e.prototype.isObject3D=!0;const Fl=new S,Kx=new S,Jx=new Ht;class Sn{constructor(e=new S(1,0,0),t=0){this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,s){return this.normal.set(e,t,i),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const s=Fl.subVectors(i,t).cross(Kx.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(s,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===void 0&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new S),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){t===void 0&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new S);const i=e.delta(Fl),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;
1const r=-(e.start.dot(this.normal)+this.constant)/s;return r<0||r>1?null:t.copy(i).multiplyScalar(r).add(e.start)}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===void 0&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new S),e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||Jx.getNormalMatrix(e),s=this.coplanarPoint(Fl).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}Sn.prototype.isPlane=!0;const wn=new S,Qn=new S,Ol=new S,$n=new S,Ls=new S,Cs=new S,Nu=new S,Hl=new S,Ul=new S,Gl=new S;class Bt{constructor(e=new S,t=new S,i=new S){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,s){s===void 0&&(console.warn("THREE.Triangle: .getNormal() target is now required"),s=new S),s.subVectors(i,t),wn.subVectors(e,t),s.cross(wn);const r=s.lengthSq();return r>0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,i,s,r){wn.subVectors(s,t),Qn.subVectors(i,t),Ol.subVectors(e,t);const o=wn.dot(wn),a=wn.dot(Qn),c=wn.dot(Ol),l=Qn.dot(Qn),u=Qn.dot(Ol),h=o*l-a*a;if(r===void 0&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new S),h===0)return r.set(-2,-1,-1);const d=1/h,f=(l*c-a*u)*d,p=(o*u-a*c)*d;return r.set(1-f-p,p,f)}static containsPoint(e,t,i,s){return this.getBarycoord(e,t,i,s,$n),$n.x>=0&&$n.y>=0&&$n.x+$n.y<=1}static getUV(e,t,i,s,r,o,a,c){return this.getBarycoord(e,t,i,s,$n),c.set(0,0),c.addScaledVector(r,$n.x),c.addScaledVector(o,$n.y),c.addScaledVector(a,$n.z),c}static isFrontFacing(e,t,i,s){return wn.subVectors(i,t),Qn.subVectors(e,t),wn.cross(Qn).dot(s)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,s){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[s]),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 wn.subVectors(this.c,this.b),Qn.subVectors(this.a,this.b),wn.cross(Qn).length()*.5}getMidpoint(e){return e===void 0&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new S),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Bt.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e===void 0&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new Sn),e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Bt.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,s,r){return Bt.getUV(e,this.a,this.b,this.c,t,i,s,r)}containsPoint(e){return Bt.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Bt.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){t===void 0&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new S);const i=this.a,s=this.b,r=this.c;let o,a;Ls.subVectors(s,i),Cs.subVectors(r,i),Hl.subVectors(e,i);const c=Ls.dot(Hl),l=Cs.dot(Hl);if(c<=0&&l<=0)return t.copy(i);Ul.subVectors(e,s);const u=Ls.dot(Ul),h=Cs.dot(Ul);if(u>=0&&h<=u)return t.copy(s);const d=c*h-u*l;if(d<=0&&c>=0&&u<=0)return o=c/(c-u),t.copy(i).addScaledVector(Ls,o);Gl.subVectors(e,r);const f=Ls.dot(Gl),p=Cs.dot(Gl);if(p>=0&&f<=p)return t.copy(r);const b=f*l-c*p;if(b<=0&&l>=0&&p<=0)return a=l/(l-p),t.copy(i).addScaledVector(Cs,a);const w=u*p-f*h;if(w<=0&&h-u>=0&&f-p>=0)return Nu.subVectors(r,s),a=(h-u)/(h-u+(f-p)),t.copy(s).addScaledVector(Nu,a);const v=1/(w+b+d);return o=b*v,a=d*v,t.copy(i).addScaledVector(Ls,o).addScaledVector(Cs,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let Qx=0;function Lt(){Object.defineProperty(this,"id",{value:Qx++}),this.uuid=xn(),this.name="",this.type="Material",this.fog=!0,this.blending=Qr,this.side=_o,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=ip,this.blendDst=sp,this.blendEquation=Gs,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Sc,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Ex,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ll,this.stencilZFail=Ll,this.stencilZPass=Ll,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.alphaTest=0,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0}Lt.prototype=Object.assign(Object.create(ps.prototype),{constructor:Lt,isMaterial:!0,onBuild:function(){},onBeforeCompile:function(){},customProgramCacheKey:function(){return this.onBeforeCompile.toString()},setValues:function(n){if(n!==void 0)for(const e in n){const t=n[e];if(t===void 0){console.warn("THREE.Material: '"+e+"' parameter is undefined.");continue}if(e==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=t===np;continue}const i=this[e];if(i===void 0){console.warn("THREE."+this.type+": '"+e+"' is not a property of this material.");continue}i&&i.isColor?i.set(t):i&&i.isVector3&&t&&t.isVector3?i.copy(t):this[e]=t}},toJSON:function(n){const e=n===void 0||typeof n=="string";e&&(n={textures:{},images:{}});const t={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};
1t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),this.color&&this.color.isColor&&(t.color=this.color.getHex()),this.roughness!==void 0&&(t.roughness=this.roughness),this.metalness!==void 0&&(t.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(t.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(t.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(t.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(t.specular=this.specular.getHex()),this.shininess!==void 0&&(t.shininess=this.shininess),this.clearcoat!==void 0&&(t.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(t.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(t.clearcoatMap=this.clearcoatMap.toJSON(n).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(t.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(n).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(t.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(n).uuid,t.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(t.map=this.map.toJSON(n).uuid),this.matcap&&this.matcap.isTexture&&(t.matcap=this.matcap.toJSON(n).uuid),this.alphaMap&&this.alphaMap.isTexture&&(t.alphaMap=this.alphaMap.toJSON(n).uuid),this.lightMap&&this.lightMap.isTexture&&(t.lightMap=this.lightMap.toJSON(n).uuid,t.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(t.aoMap=this.aoMap.toJSON(n).uuid,t.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(t.bumpMap=this.bumpMap.toJSON(n).uuid,t.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(t.normalMap=this.normalMap.toJSON(n).uuid,t.normalMapType=this.normalMapType,t.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(t.displacementMap=this.displacementMap.toJSON(n).uuid,t.displacementScale=this.displacementScale,t.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(t.roughnessMap=this.roughnessMap.toJSON(n).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(t.metalnessMap=this.metalnessMap.toJSON(n).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(t.emissiveMap=this.emissiveMap.toJSON(n).uuid),this.specularMap&&this.specularMap.isTexture&&(t.specularMap=this.specularMap.toJSON(n).uuid),this.envMap&&this.envMap.isTexture&&(t.envMap=this.envMap.toJSON(n).uuid,this.combine!==void 0&&(t.combine=this.combine)),this.envMapIntensity!==void 0&&(t.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(t.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(t.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(t.gradientMap=this.gradientMap.toJSON(n).uuid),this.size!==void 0&&(t.size=this.size),this.shadowSide!==null&&(t.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(t.sizeAttenuation=this.sizeAttenuation),this.blending!==Qr&&(t.blending=this.blending),this.side!==_o&&(t.side=this.side),this.vertexColors&&(t.vertexColors=!0),this.opacity<1&&(t.opacity=this.opacity),this.transparent===!0&&(t.transparent=this.transparent),t.depthFunc=this.depthFunc,t.depthTest=this.depthTest,t.depthWrite=this.depthWrite,t.colorWrite=this.colorWrite,t.stencilWrite=this.stencilWrite,t.stencilWriteMask=this.stencilWriteMask,t.stencilFunc=this.stencilFunc,t.stencilRef=this.stencilRef,t.stencilFuncMask=this.stencilFuncMask,t.stencilFail=this.stencilFail,t.stencilZFail=this.stencilZFail,t.stencilZPass=this.stencilZPass,this.rotation&&this.rotation!==0&&(t.rotation=this.rotation),this.polygonOffset===!0&&(t.polygonOffset=!0),this.polygonOffsetFactor!==0&&(t.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(t.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&this.linewidth!==1&&(t.linewidth=this.linewidth),this.dashSize!==void 0&&(t.dashSize=this.dashSize),this.gapSize!==void 0&&(t.gapSize=this.gapSize),this.scale!==void 0&&(t.scale=this.scale),this.dithering===!0&&(t.dithering=!0),this.alphaTest>0&&(t.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(t.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(t.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(t.wireframe=this.wireframe),this.wireframeLinewidth>1&&(t.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(t.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(t.wireframeLinejoin=this.wireframeLinejoin),this.morphTargets===!0&&(t.morphTargets=!0),this.morphNormals===!0&&(t.morphNormals=!0),this.skinning===!0&&(t.skinning=!0),this.flatShading===!0&&(t.flatShading=this.flatShading),this.visible===!1&&(t.visible=!1),this.toneMapped===!1&&(t.toneMapped=!1),JSON.stringify(this.userData)!=="{}"&&(t.userData=this.userData);function i(s){const r=[];for(const o in s){const a=s[o];delete a.metadata,r.push(a)}return r}if(e){const s=i(n.textures),r=i(n.images);s.length>0&&(t.textures=s),r.length>0&&(t.images=r)}return t},clone:function(){return new this.constructor().copy(this)},copy:function(n){this.name=n.name,this.fog=n.fog,this.blending=n.blending,this.side=n.side,this.vertexColors=n.vertexColors,this.opacity=n.opacity,this.transparent=n.transparent,this.blendSrc=n.blendSrc,this.blendDst=n.blendDst,this.blendEquation=n.blendEquation,this.blendSrcAlpha=n.blendSrcAlpha,this.blendDstAlpha=n.blendDstAlpha,this.blendEquationAlpha=n.blendEquationAlpha,this.depthFunc=n.depthFunc,this.depthTest=n.depthTest,this.depthWrite=n.depthWrite,this.stencilWriteMask=n.stencilWriteMask,this.stencilFunc=n.stencilFunc,this.stencilRef=n.stencilRef,this.stencilFuncMask=n.stencilFuncMask,this.stencilFail=n.stencilFail,this.stencilZFail=n.stencilZFail,this.stencilZPass=n.stencilZPass,this.stencilWrite=n.stencilWrite;const e=n.clippingPlanes;let t=null;if(e!==null){const i=e.length;t=new Array(i);for(let s=0;s!==i;++s)t[s]=e[s].clone()}return this.clippingPlanes=t,this.clipIntersection=n.clipIntersection,this.clipShadows=n.clipShadows,this.shadowSide=n.shadowSide,this.colorWrite=n.colorWrite,this.precision=n.precision,this.polygonOffset=n.polygonOffset,this.polygonOffsetFactor=n.polygonOffsetFactor,this.polygonOffsetUnits=n.polygonOffsetUnits,this.dithering=n.dithering,this.alphaTest=n.alphaTest,this.alphaToCoverage=n.alphaToCoverage,this.premultipliedAlpha=n.premultipliedAlpha,this.visible=n.visible,this.toneMapped=n.toneMapped,this.userData=JSON.parse(JSON.stringify(n.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}});Object.defineProperty(Lt.prototype,"needsUpdate",{set:function(n){n===!0&&this.version++}});const gp={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},Mn={h:0,s:0,l:0},Go={h:0,s:0,l:0};function Wl(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}function Vl(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}
1function ql(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}class pe{constructor(e,t,i){return t===void 0&&i===void 0?this.set(e):this.setRGB(e,t,i)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this}setRGB(e,t,i){return this.r=e,this.g=t,this.b=i,this}setHSL(e,t,i){if(e=ih(e,1),t=nn(t,0,1),i=nn(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,r=2*i-s;this.r=Wl(r,s,e+1/3),this.g=Wl(r,s,e),this.b=Wl(r,s,e-1/3)}return this}setStyle(e){function t(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let s;const r=i[1],o=i[2];switch(r){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,t(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,t(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o)){const a=parseFloat(s[1])/360,c=parseInt(s[2],10)/100,l=parseInt(s[3],10)/100;return t(s[4]),this.setHSL(a,c,l)}break}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],r=s.length;if(r===3)return this.r=parseInt(s.charAt(0)+s.charAt(0),16)/255,this.g=parseInt(s.charAt(1)+s.charAt(1),16)/255,this.b=parseInt(s.charAt(2)+s.charAt(2),16)/255,this;if(r===6)return this.r=parseInt(s.charAt(0)+s.charAt(1),16)/255,this.g=parseInt(s.charAt(2)+s.charAt(3),16)/255,this.b=parseInt(s.charAt(4)+s.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this}setColorName(e){const t=gp[e.toLowerCase()];return t!==void 0?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copyGammaToLinear(e,t=2){return this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this}copyLinearToGamma(e,t=2){const i=t>0?1/t:1;return this.r=Math.pow(e.r,i),this.g=Math.pow(e.g,i),this.b=Math.pow(e.b,i),this}convertGammaToLinear(e){return this.copyGammaToLinear(this,e),this}convertLinearToGamma(e){return this.copyLinearToGamma(this,e),this}copySRGBToLinear(e){return this.r=Vl(e.r),this.g=Vl(e.g),this.b=Vl(e.b),this}copyLinearToSRGB(e){return this.r=ql(e.r),this.g=ql(e.g),this.b=ql(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){return this.r*255<<16^this.g*255<<8^this.b*255<<0}getHexString(){return("000000"+this.getHex().toString(16)).slice(-6)}getHSL(e){e===void 0&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});const t=this.r,i=this.g,s=this.b,r=Math.max(t,i,s),o=Math.min(t,i,s);let a,c;const l=(o+r)/2;if(o===r)a=0,c=0;else{const u=r-o;switch(c=l<=.5?u/(r+o):u/(2-r-o),r){case t:a=(i-s)/u+(i<s?6:0);break;case i:a=(s-t)/u+2;break;case s:a=(t-i)/u+4;break}a/=6}return e.h=a,e.s=c,e.l=l,e}getStyle(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"}offsetHSL(e,t,i){return this.getHSL(Mn),Mn.h+=e,Mn.s+=t,Mn.l+=i,this.setHSL(Mn.h,Mn.s,Mn.l),this}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(Mn),e.getHSL(Go);const i=to(Mn.h,Go.h,t),s=to(Mn.s,Go.s,t),r=to(Mn.l,Go.l,t);return this.setHSL(i,s,r),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),e.normalized===!0&&(this.r/=255,this.g/=255,this.b/=255),this}toJSON(){return this.getHex()}}pe.NAMES=gp;pe.prototype.isColor=!0;pe.prototype.r=1;pe.prototype.g=1;pe.prototype.b=1;class _e extends Lt{constructor(e){super(),this.type="MeshBasicMaterial",this.color=new pe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=$a,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,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.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.skinning=e.skinning,this.morphTargets=e.morphTargets,this}}_e.prototype.isMeshBasicMaterial=!0;const ht=new S,Wo=new $;class xt{constructor(e,t,i){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i===!0,this.usage=co,this.updateRange={offset:0,count:-1},this.version=0,this.onUploadCallback=function(){}}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;
1for(let s=0,r=this.itemSize;s<r;s++)this.array[e+s]=t.array[i+s];return this}copyArray(e){return this.array.set(e),this}copyColorsArray(e){const t=this.array;let i=0;for(let s=0,r=e.length;s<r;s++){let o=e[s];o===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",s),o=new pe),t[i++]=o.r,t[i++]=o.g,t[i++]=o.b}return this}copyVector2sArray(e){const t=this.array;let i=0;for(let s=0,r=e.length;s<r;s++){let o=e[s];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",s),o=new $),t[i++]=o.x,t[i++]=o.y}return this}copyVector3sArray(e){const t=this.array;let i=0;for(let s=0,r=e.length;s<r;s++){let o=e[s];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",s),o=new S),t[i++]=o.x,t[i++]=o.y,t[i++]=o.z}return this}copyVector4sArray(e){const t=this.array;let i=0;for(let s=0,r=e.length;s<r;s++){let o=e[s];o===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",s),o=new at),t[i++]=o.x,t[i++]=o.y,t[i++]=o.z,t[i++]=o.w}return this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Wo.fromBufferAttribute(this,t),Wo.applyMatrix3(e),this.setXY(t,Wo.x,Wo.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)ht.fromBufferAttribute(this,t),ht.applyMatrix3(e),this.setXYZ(t,ht.x,ht.y,ht.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)ht.x=this.getX(t),ht.y=this.getY(t),ht.z=this.getZ(t),ht.applyMatrix4(e),this.setXYZ(t,ht.x,ht.y,ht.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)ht.x=this.getX(t),ht.y=this.getY(t),ht.z=this.getZ(t),ht.applyNormalMatrix(e),this.setXYZ(t,ht.x,ht.y,ht.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)ht.x=this.getX(t),ht.y=this.getY(t),ht.z=this.getZ(t),ht.transformDirection(e),this.setXYZ(t,ht.x,ht.y,ht.z);return this}set(e,t=0){return this.array.set(e,t),this}getX(e){return this.array[e*this.itemSize]}setX(e,t){return this.array[e*this.itemSize]=t,this}getY(e){return this.array[e*this.itemSize+1]}setY(e,t){return this.array[e*this.itemSize+1]=t,this}getZ(e){return this.array[e*this.itemSize+2]}setZ(e,t){return this.array[e*this.itemSize+2]=t,this}getW(e){return this.array[e*this.itemSize+3]}setW(e,t){return this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,s){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=s,this}setXYZW(e,t,i,s,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=s,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==co&&(e.usage=this.usage),(this.updateRange.offset!==0||this.updateRange.count!==-1)&&(e.updateRange=this.updateRange),e}}xt.prototype.isBufferAttribute=!0;class xp extends xt{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class yp extends xt{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class $x extends xt{constructor(e,t,i){super(new Uint16Array(e),t,i)}}$x.prototype.isFloat16BufferAttribute=!0;class Ne extends xt{constructor(e,t,i){super(new Float32Array(e),t,i)}}function vp(n){if(n.length===0)return-1/0;let e=n[0];for(let t=1,i=n.length;t<i;++t)n[t]>e&&(e=n[t]);return e}let ey=0;const In=new ve,jl=new $e,Rs=new S,cn=new Yt,Dr=new Yt,Nt=new S;class qe extends ps{constructor(){super(),Object.defineProperty(this,"id",{value:ey++}),this.uuid=xn(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(vp(e)>65535?yp:xp)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}
vendor: 1,599 bytes, line 1
1addGroup(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 r=new Ht().getNormalMatrix(e);i.applyNormalMatrix(r),i.needsUpdate=!0}const s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(e),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}rotateX(e){return In.makeRotationX(e),this.applyMatrix4(In),this}rotateY(e){return In.makeRotationY(e),this.applyMatrix4(In),this}rotateZ(e){return In.makeRotationZ(e),this.applyMatrix4(In),this}translate(e,t,i){return In.makeTranslation(e,t,i),this.applyMatrix4(In),this}scale(e,t,i){return In.makeScale(e,t,i),this.applyMatrix4(In),this}lookAt(e){return jl.lookAt(e),jl.updateMatrix(),this.applyMatrix4(jl.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Rs).negate(),this.translate(Rs.x,Rs.y,Rs.z),this}setFromPoints(e){const t=[];for(let i=0,s=e.length;i<s;i++){const r=e[i];t.push(r.x,r.y,r.z||0)}return this.setAttribute("position",new Ne(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Yt);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "fal
1se".',this),this.boundingBox.set(new S(-1/0,-1/0,-1/0),new S(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,s=t.length;i<s;i++){const r=t[i];cn.setFromBufferAttribute(r),this.morphTargetsRelative?(Nt.addVectors(this.boundingBox.min,cn.min),this.boundingBox.expandByPoint(Nt),Nt.addVectors(this.boundingBox.max,cn.max),this.boundingBox.expandByPoint(Nt)):(this.boundingBox.expandByPoint(cn.min),this.boundingBox.expandByPoint(cn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ms);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "fal
1se".',this),this.boundingSphere.set(new S,1/0);return}if(e){const i=this.boundingSphere.center;if(cn.setFromBufferAttribute(e),t)for(let r=0,o=t.length;r<o;r++){const a=t[r];Dr.setFromBufferAttribute(a),this.morphTargetsRelative?(Nt.addVectors(cn.min,Dr.min),cn.expandByPoint(Nt),Nt.addVectors(cn.max,Dr.max),cn.expandByPoint(Nt)):(cn.expandByPoint(Dr.min),cn.expandByPoint(Dr.max))}cn.getCenter(i);let s=0;for(let r=0,o=e.count;r<o;r++)Nt.fromBufferAttribute(e,r),s=Math.max(s,i.distanceToSquared(Nt));if(t)for(let r=0,o=t.length;r<o;r++){const a=t[r],c=this.morphTargetsRelative;for(let l=0,u=a.count;l<u;l++)Nt.fromBufferAttribute(a,l),c&&(Rs.fromBufferAttribute(e,l),Nt.add(Rs)),s=Math.max(s,i.distanceToSquared(Nt))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeFaceNormals(){}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=e.array,s=t.position.array,r=t.normal.array,o=t.uv.array,a=s.length/3;t.tangent===void 0&&this.setAttribute("tangent",new xt(new Float32Array(4*a),4));const c=t.tangent.array,l=[],u=[];for(let W=0;W<a;W++)l[W]=new S,u[W]=new S;const h=new S,d=new S,f=new S,p=new $,b=new $,w=new $,v=new S,y=new S;function E(W,Z,q){h.fromArray(s,W*3),d.fromArray(s,Z*3),f.fromArray(s,q*3),p.fromArray(o,W*2),b.fromArray(o,Z*2),w.fromArray(o,q*2),d.sub(h),f.sub(h),b.sub(p),w.sub(p);const k=1/(b.x*w.y-w.x*b.y);isFinite(k)&&(v.copy(d).multiplyScalar(w.y).addScaledVector(f,-b.y).multiplyScalar(k),y.copy(f).multiplyScalar(b.x).addScaledVector(d,-w.x).multiplyScalar(k),l[W].add(v),l[Z].add(v),l[q].add(v),u[W].add(y),u[Z].add(y),u[q].add(y))}let L=this.groups;L.length===0&&(L=[{start:0,count:i.length}]);for(let W=0,Z=L.length;W<Z;++W){const q=L[W],k=q.start,O=q.count;for(let U=k,z=k+O;U<z;U+=3)E(i[U+0],i[U+1],i[U+2])}const C=new S,_=new S,D=new S,F=new S;function H(W){D.fromArray(r,W*3),F.copy(D);const Z=l[W];C.copy(Z),C.sub(D.multiplyScalar(D.dot(Z))).normalize(),_.crossVectors(F,Z);const k=_.dot(u[W])<0?-1:1;c[W*4]=C.x,c[W*4+1]=C.y,c[W*4+2]=C.z,c[W*4+3]=k}for(let W=0,Z=L.length;W<Z;++W){const q=L[W],k=q.start,O=q.count;for(let U=k,z=k+O;U<z;U+=3)H(i[U+0]),H(i[U+1]),H(i[U+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 xt(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let d=0,f=i.count;d<f;d++)i.setXYZ(d,0,0,0);const s=new S,r=new S,o=new S,a=new S,c=new S,l=new S,u=new S,h=new S;if(e)for(let d=0,f=e.count;d<f;d+=3){const p=e.getX(d+0),b=e.getX(d+1),w=e.getX(d+2);s.fromBufferAttribute(t,p),r.fromBufferAttribute(t,b),o.fromBufferAttribute(t,w),u.subVectors(o,r),h.subVectors(s,r),u.cross(h),a.fromBufferAttribute(i,p),c.fromBufferAttribute(i,b),l.fromBufferAttribute(i,w),a.add(u),c.add(u),l.add(u),i.setXYZ(p,a.x,a.y,a.z),i.setXYZ(b,c.x,c.y,c.z),i.setXYZ(w,l.x,l.y,l.z)}else for(let d=0,f=t.count;d<f;d+=3)s.fromBufferAttribute(t,d+0),r.fromBufferAttribute(t,d+1),o.fromBufferAttribute(t,d+2),u.subVectors(o,r),h.subVectors(s,r),u.cross(h),i.setXYZ(d+0,u.x,u.y,u.z),i.setXYZ(d+1,u.x,u.y,u.z),i.setXYZ(d+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}merge(e,t){if(!(e&&e.isBufferGeometry)){console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);return}t===void 0&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));const i=this.attributes;for(const s in i){if(e.attributes[s]===void 0)continue;const o=i[s].array,a=e.attributes[s],c=a.array,l=a.itemSize*t,u=Math.min(c.length,o.length-l);for(let h=0,d=l;h<u;h++,d++)o[d]=c[h]}return this}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Nt.fromBufferAttribute(e,t),Nt.normalize(),e.setXYZ(t,Nt.x,Nt.y,Nt.z)}toNonIndexed(){function e(a,c){const l=a.array,u=a.itemSize,h=a.normalized,d=new l.constructor(c.length*u);let f=0,p=0;for(let b=0,w=c.length;b<w;b++){f=c[b]*u;for(let v=0;v<u;v++)d[p++]=l[f++]}return new xt(d,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new qe,i=this.index.array,s=this.attributes;for(const a in s){const c=s[a],l=e(c,i);t.setAttribute(a,l)}const r=this.morphAttributes;for(const a in r){const c=[],l=r[a];for(let u=0,h=l.length;u<h;u++){const d=l[u],f=e(d,i);c.push(f)}t.morphAttributes[a]=c}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,c=o.length;a<c;a++){const l=o[a];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){const e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};
1if(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 c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);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 c in i){const l=i[c];e.data.attributes[c]=l.toJSON(e.data)}const s={};let r=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],u=[];for(let h=0,d=l.length;h<d;h++){const f=l[h];u.push(f.toJSON(e.data))}u.length>0&&(s[c]=u,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new qe().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(t));const s=e.attributes;for(const l in s){const u=s[l];this.setAttribute(l,u.clone(t))}const r=e.morphAttributes;for(const l in r){const u=[],h=r[l];for(let d=0,f=h.length;d<f;d++)u.push(h[d].clone(t));this.morphAttributes[l]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let l=0,u=o.length;l<u;l++){const h=o[l];this.addGroup(h.start,h.count,h.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}qe.prototype.isBufferGeometry=!0;const zu=new ve,Ps=new gs,Xl=new ms,Mi=new S,_i=new S,Si=new S,Yl=new S,Zl=new S,Kl=new S,Vo=new S,qo=new S,jo=new S,Xo=new $,Yo=new $,Zo=new $,Jl=new S,Ko=new S;class X extends $e{constructor(e=new qe,t=new _e){super(),this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,i=Object.keys(t);if(i.length>0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){const a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}raycast(e,t){const i=this.geometry,s=this.material,r=this.matrixWorld;if(s===void 0||(i.boundingSphere===null&&i.computeBoundingSphere(),Xl.copy(i.boundingSphere),Xl.applyMatrix4(r),e.ray.intersectsSphere(Xl)===!1)||(zu.copy(r).invert(),Ps.copy(e.ray).applyMatrix4(zu),i.boundingBox!==null&&Ps.intersectsBox(i.boundingBox)===!1))return;let o;if(i.isBufferGeometry){const a=i.index,c=i.attributes.position,l=i.morphAttributes.position,u=i.morphTargetsRelative,h=i.attributes.uv,d=i.attributes.uv2,f=i.groups,p=i.drawRange;if(a!==null)if(Array.isArray(s))for(let b=0,w=f.length;b<w;b++){const v=f[b],y=s[v.materialIndex],E=Math.max(v.start,p.start),L=Math.min(v.start+v.count,p.start+p.count);for(let C=E,_=L;C<_;C+=3){const D=a.getX(C),F=a.getX(C+1),H=a.getX(C+2);o=Jo(this,y,e,Ps,c,l,u,h,d,D,F,H),o&&(o.faceIndex=Math.floor(C/3),o.face.materialIndex=v.materialIndex,t.push(o))}}else{const b=Math.max(0,p.start),w=Math.min(a.count,p.start+p.count);for(let v=b,y=w;v<y;v+=3){const E=a.getX(v),L=a.getX(v+1),C=a.getX(v+2);o=Jo(this,s,e,Ps,c,l,u,h,d,E,L,C),o&&(o.faceIndex=Math.floor(v/3),t.push(o))}}else if(c!==void 0)if(Array.isArray(s))for(let b=0,w=f.length;b<w;b++){const v=f[b],y=s[v.materialIndex],E=Math.max(v.start,p.start),L=Math.min(v.start+v.count,p.start+p.count);for(let C=E,_=L;C<_;C+=3){const D=C,F=C+1,H=C+2;o=Jo(this,y,e,Ps,c,l,u,h,d,D,F,H),o&&(o.faceIndex=Math.floor(C/3),o.face.materialIndex=v.materialIndex,t.push(o))}}else{const b=Math.max(0,p.start),w=Math.min(c.count,p.start+p.count);for(let v=b,y=w;v<y;v+=3){const E=v,L=v+1,C=v+2;o=Jo(this,s,e,Ps,c,l,u,h,d,E,L,C),o&&(o.faceIndex=Math.floor(v/3),t.push(o))}}}else i.isGeometry&&console.error("THREE.Mesh.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}}X.prototype.isMesh=!0;function ty(n,e,t,i,s,r,o,a){let c;if(e.side===Pt?c=i.intersectTriangle(o,r,s,!0,a):c=i.intersectTriangle(s,r,o,e.side!==yt,a),c===null)return null;Ko.copy(a),Ko.applyMatrix4(n.matrixWorld);const l=t.ray.origin.distanceTo(Ko);return l<t.near||l>t.far?null:{distance:l,point:Ko.clone(),object:n}}function Jo(n,e,t,i,s,r,o,a,c,l,u,h){Mi.fromBufferAttribute(s,l),_i.fromBufferAttribute(s,u),Si.fromBufferAttribute(s,h);const d=n.morphTargetInfluences;if(e.morphTargets&&r&&d){Vo.set(0,0,0),qo.set(0,0,0),jo.set(0,0,0);for(let p=0,b=r.length;p<b;p++){const w=d[p],v=r[p];w!==0&&(Yl.fromBufferAttribute(v,l),Zl.fromBufferAttribute(v,u),Kl.fromBufferAttribute(v,h),o?(Vo.addScaledVector(Yl,
vendor: 5,980 bytes, lines 1-5
1w),qo.addScaledVector(Zl,w),jo.addScaledVector(Kl,w)):(Vo.addScaledVector(Yl.sub(Mi),w),qo.addScaledVector(Zl.sub(_i),w),jo.addScaledVector(Kl.sub(Si),w)))}Mi.add(Vo),_i.add(qo),Si.add(jo)}n.isSkinnedMesh&&e.skinning&&(n.boneTransform(l,Mi),n.boneTransform(u,_i),n.boneTransform(h,Si));const f=ty(n,e,t,i,Mi,_i,Si,Jl);if(f){a&&(Xo.fromBufferAttribute(a,l),Yo.fromBufferAttribute(a,u),Zo.fromBufferAttribute(a,h),f.uv=Bt.getUV(Jl,Mi,_i,Si,Xo,Yo,Zo,new $)),c&&(Xo.fromBufferAttribute(c,l),Yo.fromBufferAttribute(c,u),Zo.fromBufferAttribute(c,h),f.uv2=Bt.getUV(Jl,Mi,_i,Si,Xo,Yo,Zo,new $));const p={a:l,b:u,c:h,normal:new S,materialIndex:0};Bt.getNormal(Mi,_i,Si,p.normal),f.face=p}return f}class wt extends qe{constructor(e=1,t=1,i=1,s=1,r=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:s,heightSegments:r,depthSegments:o};const a=this;s=Math.floor(s),r=Math.floor(r),o=Math.floor(o);const c=[],l=[],u=[],h=[];let d=0,f=0;p("z","y","x",-1,-1,i,t,e,o,r,0),p("z","y","x",1,-1,i,t,-e,o,r,1),p("x","z","y",1,1,e,i,t,s,o,2),p("x","z","y",1,-1,e,i,-t,s,o,3),p("x","y","z",1,-1,e,t,i,s,r,4),p("x","y","z",-1,-1,e,t,-i,s,r,5),this.setIndex(c),this.setAttribute("position",new Ne(l,3)),this.setAttribute("normal",new Ne(u,3)),this.setAttribute("uv",new Ne(h,2));function p(b,w,v,y,E,L,C,_,D,F,H){const W=L/D,Z=C/F,q=L/2,k=C/2,O=_/2,U=D+1,z=F+1;let ne=0,ce=0;const re=new S;for(let ge=0;ge<z;ge++){const ie=ge*Z-k;for(let ye=0;ye<U;ye++){const Se=ye*W-q;re[b]=Se*y,re[w]=ie*E,re[v]=O,l.push(re.x,re.y,re.z),re[b]=0,re[w]=0,re[v]=_>0?1:-1,u.push(re.x,re.y,re.z),h.push(ye/D),h.push(1-ge/F),ne+=1}}for(let ge=0;ge<F;ge++)for(let ie=0;ie<D;ie++){const ye=d+ie+U*ge,Se=d+ie+U*(ge+1),Q=d+(ie+1)+U*(ge+1),et=d+(ie+1)+U*ge;c.push(ye,Se,et),c.push(Se,Q,et),ce+=6}a.addGroup(f,ce,H),f+=ce,d+=ne}}}function ar(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const s=n[t][i];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?e[t][i]=s.clone():Array.isArray(s)?e[t][i]=s.slice():e[t][i]=s}}return e}function Wt(n){const e={};for(let t=0;t<n.length;t++){const i=ar(n[t]);for(const s in i)e[s]=i[s]}return e}const ss={clone:ar,merge:Wt};var ny=`void main() {
2	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3}`,iy=`void main() {
4	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
5}`;class Ut extends Lt{constructor(e){super(),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=ny,this.fragmentShader=iy,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&(e.attributes!==void 0&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ar(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const s in this.uniforms){const o=this.uniforms[s].value;o&&o.isTexture?t.uniforms[s]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[s]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[s]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[s]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[s]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[s]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[s]={type:"m4",value:o.toArray()}:t.uniforms[s]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}Ut.prototype.isShaderMaterial=!0;class sh extends $e{constructor(){super(),this.type="Camera",this.matrixWorldInverse=new ve,this.projectionMatrix=new ve,this.projectionMatrixInverse=new ve}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){e===void 0&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new S),this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}sh.prototype.isCamera=!0;class Ot extends sh{constructor(e=50,t=1,i=.1,s=2e3){super(),this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,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=ho*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(eo*.5*this.fov);return .5*this.getFilmHeight()/e}
5getEffectiveFOV(){return ho*2*Math.atan(Math.tan(eo*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,s,r,o){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=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(eo*.5*this.fov)/this.zoom,i=2*t,s=this.aspect*i,r=-.5*s;const o=this.view;if(this.view!==null&&this.view.enabled){const c=o.fullWidth,l=o.fullHeight;r+=o.offsetX*s/c,t-=o.offsetY*i/l,s*=o.width/c,i*=o.height/l}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,t,t-i,e,this.far),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}}Ot.prototype.isPerspectiveCamera=!0;const Is=90,Bs=1;class rh extends $e{constructor(e,t,i){if(super(),this.type="CubeCamera",i.isWebGLCubeRenderTarget!==!0){console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");return}this.renderTarget=i;const s=new Ot(Is,Bs,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new S(1,0,0)),this.add(s);const r=new Ot(Is,Bs,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new S(-1,0,0)),this.add(r);const o=new Ot(Is,Bs,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new S(0,1,0)),this.add(o);const a=new Ot(Is,Bs,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new S(0,-1,0)),this.add(a);const c=new Ot(Is,Bs,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new S(0,0,1)),this.add(c);const l=new Ot(Is,Bs,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new S(0,0,-1)),this.add(l)}update(e,t){this.parent===null&&this.updateMatrixWorld();const i=this.renderTarget,[s,r,o,a,c,l]=this.children,u=e.xr.enabled,h=e.getRenderTarget();e.xr.enabled=!1;const d=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,s),e.setRenderTarget(i,1),e.render(t,r),e.setRenderTarget(i,2),e.render(t,o),e.setRenderTarget(i,3),e.render(t,a),e.setRenderTarget(i,4),e.render(t,c),i.texture.generateMipmaps=d,e.setRenderTarget(i,5),e.render(t,l),e.setRenderTarget(h),e.xr.enabled=u}}class tl extends kt{constructor(e,t,i,s,r,o,a,c,l,u){e=e!==void 0?e:[],t=t!==void 0?t:Jc,a=a!==void 0?a:Wn,super(e,t,i,s,r,o,a,c,l,u),this._needsFlipEnvMap=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}tl.prototype.isCubeTexture=!0;class bp extends on{constructor(e,t,i){Number.isInteger(t)&&(console.warn("THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )"),t=i),super(e,e,t),t=t||{},this.texture=new tl(void 0,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:St,this.texture._needsFlipEnvMap=!1}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.format=Jt,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
6
7				varying vec3 vWorldDirection;
8
9				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
10
11					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
12
13				}
14
15				void main() {
16
17					vWorldDirection = transformDirection( position, modelMatrix );
18
19					#include <begin_vertex>
20					#include <project_vertex>
21
22				}
23			`,fragmentShader:`
24
25				uniform sampler2D tEquirect;
26
27				varying vec3 vWorldDirection;
28
29				#include <common>
30
31				void main() {
32
33					vec3 direction = normalize( vWorldDirection );
34
35					vec2 sampleUV = equirectUv( direction );
36
37					gl_FragColor = texture2D( tEquirect, sampleUV );
38
39				}
40			`}
40,s=new wt(5,5,5),r=new Ut({name:"CubemapFromEquirect",uniforms:ar(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Pt,blending:ki});r.uniforms.tEquirect.value=t;const o=new X(s,r),a=t.minFilter;return t.minFilter===yr&&(t.minFilter=St),new rh(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,s){const r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,s);e.setRenderTarget(r)}}bp.prototype.isWebGLCubeRenderTarget=!0;class oh extends kt{constructor(e,t,i,s,r,o,a,c,l,u,h,d){super(null,o,a,c,l,u,s,r,h,d),this.image={data:e||null,width:t||1,height:i||1},this.magFilter=l!==void 0?l:vt,this.minFilter=u!==void 0?u:vt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}oh.prototype.isDataTexture=!0;const Ds=new ms,Qo=new S;class nl{constructor(e=new Sn,t=new Sn,i=new Sn,s=new Sn,r=new Sn,o=new Sn){this.planes=[e,t,i,s,r,o]}set(e,t,i,s,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){const t=this.planes,i=e.elements,s=i[0],r=i[1],o=i[2],a=i[3],c=i[4],l=i[5],u=i[6],h=i[7],d=i[8],f=i[9],p=i[10],b=i[11],w=i[12],v=i[13],y=i[14],E=i[15];return t[0].setComponents(a-s,h-c,b-d,E-w).normalize(),t[1].setComponents(a+s,h+c,b+d,E+w).normalize(),t[2].setComponents(a+r,h+l,b+f,E+v).normalize(),t[3].setComponents(a-r,h-l,b-f,E-v).normalize(),t[4].setComponents(a-o,h-u,b-p,E-y).normalize(),t[5].setComponents(a+o,h+u,b+p,E+y).normalize(),this}intersectsObject(e){const t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),Ds.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Ds)}intersectsSprite(e){return Ds.center.set(0,0,0),Ds.radius=.7071067811865476,Ds.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ds)}intersectsSphere(e){const t=this.planes,i=e.center,s=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(i)<s)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const s=t[i];if(Qo.x=s.normal.x>0?e.max.x:e.min.x,Qo.y=s.normal.y>0?e.max.y:e.min.y,Qo.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(Qo)<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)}}function wp(){let n=null,e=!1,t=null,i=null;function s(r,o){t(r,o),i=n.requestAnimationFrame(s)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(s),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){n=r}}}function sy(n,e){const t=e.isWebGL2,i=new WeakMap;function s(l,u){const h=l.array,d=l.usage,f=n.createBuffer();n.bindBuffer(u,f),n.bufferData(u,h,d),l.onUploadCallback();let p=5126;return h instanceof Float32Array?p=5126:h instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):h instanceof Uint16Array?l.isFloat16BufferAttribute?t?p=5131:console.warn("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2."):p=5123:h instanceof Int16Array?p=5122:h instanceof Uint32Array?p=5125:h instanceof Int32Array?p=5124:h instanceof Int8Array?p=5120:h instanceof Uint8Array&&(p=5121),{buffer:f,type:p,bytesPerElement:h.BYTES_PER_ELEMENT,version:l.version}}function r(l,u,h){const d=u.array,f=u.updateRange;n.bindBuffer(h,l),f.count===-1?n.bufferSubData(h,0,d):(t?n.bufferSubData(h,f.offset*d.BYTES_PER_ELEMENT,d,f.offset,f.count):n.bufferSubData(h,f.offset*d.BYTES_PER_ELEMENT,d.subarray(f.offset,f.offset+f.count)),f.count=-1)}function o(l){return l.isInterleavedBufferAttribute&&(l=l.data),i.get(l)}function a(l){l.isInterleavedBufferAttribute&&(l=l.data);const u=i.get(l);u&&(n.deleteBuffer(u.buffer),i.delete(l))}function c(l,u){if(l.isGLBufferAttribute){const d=i.get(l);(!d||d.version<l.version)&&i.set(l,{buffer:l.buffer,type:l.type,bytesPerElement:l.elementSize,version:l.version});return}l.isInterleavedBufferAttribute&&(l=l.data);const h=i.get(l);h===void 0?i.set(l,s(l,u)):h.version<l.version&&(r(h.buffer,l,u),h.version=l.version)}return{get:o,remove:a,update:c}}class Qt extends qe{constructor(e=1,t=1,i=1,s=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:s};const r=e/2,o=t/2,a=Math.floor(i),c=Math.floor(s),l=a+1,u=c+1,h=e/a,d=t/c,f=[],p=[],b=[],w=[];for(let v=0;v<u;v++){const y=v*d-o;for(let E=0;E<l;E++){const L=E*h-r;
vendor: 3,927 bytes, lines 40-116
40p.push(L,-y,0),b.push(0,0,1),w.push(E/a),w.push(1-v/c)}}for(let v=0;v<c;v++)for(let y=0;y<a;y++){const E=y+l*v,L=y+l*(v+1),C=y+1+l*(v+1),_=y+1+l*v;f.push(E,L,_),f.push(L,C,_)}this.setIndex(f),this.setAttribute("position",new Ne(p,3)),this.setAttribute("normal",new Ne(b,3)),this.setAttribute("uv",new Ne(w,2))}}var ry=`#ifdef USE_ALPHAMAP
41	diffuseColor.a *= texture2D( alphaMap, vUv ).g;
42#endif`,oy=`#ifdef USE_ALPHAMAP
43	uniform sampler2D alphaMap;
44#endif`,ay=`#ifdef ALPHATEST
45	if ( diffuseColor.a < ALPHATEST ) discard;
46#endif`,ly=`#ifdef USE_AOMAP
47	float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
48	reflectedLight.indirectDiffuse *= ambientOcclusion;
49	#if defined( USE_ENVMAP ) && defined( STANDARD )
50		float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
51		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );
52	#endif
53#endif`,cy=`#ifdef USE_AOMAP
54	uniform sampler2D aoMap;
55	uniform float aoMapIntensity;
56#endif`,hy="vec3 transformed = vec3( position );",uy=`vec3 objectNormal = vec3( normal );
57#ifdef USE_TANGENT
58	vec3 objectTangent = vec3( tangent.xyz );
59#endif`,dy=`vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {
60	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
61	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
62	vec4 r = roughness * c0 + c1;
63	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
64	return vec2( -1.04, 1.04 ) * a004 + r.zw;
65}
66float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
67#if defined ( PHYSICALLY_CORRECT_LIGHTS )
68	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
69	if( cutoffDistance > 0.0 ) {
70		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
71	}
72	return distanceFalloff;
73#else
74	if( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
75		return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );
76	}
77	return 1.0;
78#endif
79}
80vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {
81	return RECIPROCAL_PI * diffuseColor;
82}
83vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {
84	float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );
85	return ( 1.0 - specularColor ) * fresnel + specularColor;
86}
87vec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {
88	float fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );
89	vec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;
90	return Fr * fresnel + F0;
91}
92float G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {
93	float a2 = pow2( alpha );
94	float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
95	float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
96	return 1.0 / ( gl * gv );
97}
98float G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
99	float a2 = pow2( alpha );
100	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
101	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
102	return 0.5 / max( gv + gl, EPSILON );
103}
104float D_GGX( const in float alpha, const in float dotNH ) {
105	float a2 = pow2( alpha );
106	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
107	return RECIPROCAL_PI * a2 / pow2( denom );
108}
109vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {
110	float alpha = pow2( roughness );
111	vec3 halfDir = normalize( incidentLight.direction + viewDir );
112	float dotNL = saturate( dot( normal, incidentLight.direction ) );
113	float dotNV = saturate( dot( normal, viewDir ) );
114	float dotNH = saturate( dot( normal, halfDir ) );
115	float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
116	vec3 F = F_Schlick( specularColor, dotLH );
117	float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );
118	float D = D_GGX( alpha, dotNH );
119	return F * ( G * D );
120}
121vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
122	const float LUT_SIZE = 64.0;
123	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
124	const float LUT_BIAS = 0.5 / LUT_SIZE;
125	float dotNV = saturate( dot( N, V ) );
126	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
127	uv = uv * LUT_SCALE + LUT_BIAS;
128	return uv;
129}
130float LTC_ClippedSphereFormFactor( const in vec3 f ) {
131	float l = length( f );
132	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
133}
134vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
135	float x = dot( v1, v2 );
136	float y = abs( x );
137	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
138	float b = 3.4175940 + ( 4.1616724 + y ) * y;
139	float v = a / b;
140	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
141	return cross( v1, v2 ) * theta_sintheta;
142}
143vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
144	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
145	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
146	vec3 lightNormal = cross( v1, v2 );
147	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
148	vec3 T1, T2;
149	T1 = normalize( V - N * dot( V, N ) );
150	T2 = - cross( N, T1 );
151	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
152	vec3 coords[ 4 ];
153	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
154	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
155	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
156	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
157	coords[ 0 ] = normalize( coords[ 0 ] );
158	coords[ 1 ] = normalize( coords[ 1 ] );
159	coords[ 2 ] = normalize( coords[ 2 ] );
160	coords[ 3 ] = normalize( coords[ 3 ] );
161	vec3 vectorFormFactor = vec3( 0.0 );
162	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
163	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
164	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
165	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
166	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
167	return vec3( result );
168}
169vec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {
170	float dotNV = saturate( dot( normal, viewDir ) );
171	vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
172	return specularColor * brdf.x + brdf.y;
173}
174void BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
175	float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
176	vec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );
177	vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
178	vec3 FssEss = F * brdf.x + brdf.y;
179	float Ess = brdf.x + brdf.y;
180	float Ems = 1.0 - Ess;
181	vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
182	singleScatter += FssEss;
183	multiScatter += Fms * Ems;
184}
185float G_BlinnPhong_Implicit( ) {
186	return 0.25;
187}
188float D_BlinnPhong( const in float shininess, const in float dotNH ) {
189	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
190}
191vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {
192	vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
193	float dotNH = saturate( dot( geometry.normal, halfDir ) );
194	float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
195	vec3 F = F_Schlick( specularColor, dotLH );
196	float G = G_BlinnPhong_Implicit( );
197	float D = D_BlinnPhong( shininess, dotNH );
198	return F * ( G * D );
199}
200float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {
201	return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );
202}
203float BlinnExponentToGGXRoughness( const in float blinnExponent ) {
204	return sqrt( 2.0 / ( blinnExponent + 2.0 ) );
205}
206#if defined( USE_SHEEN )
207float D_Charlie(float roughness, float NoH) {
208	float invAlpha = 1.0 / roughness;
209	float cos2h = NoH * NoH;
210	float sin2h = max(1.0 - cos2h, 0.0078125);	return (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);
211}
212float V_Neubelt(float NoV, float NoL) {
213	return saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));
214}
215vec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {
216	vec3 N = geometry.normal;
217	vec3 V = geometry.viewDir;
218	vec3 H = normalize( V + L );
219	float dotNH = saturate( dot( N, H ) );
220	return specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );
221}
222#endif`,fy=`#ifdef USE_BUMPMAP
223	uniform sampler2D bumpMap;
224	uniform float bumpScale;
225	vec2 dHdxy_fwd() {
226		vec2 dSTdx = dFdx( vUv );
227		vec2 dSTdy = dFdy( vUv );
228		float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
229		float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
230		float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
231		return vec2( dBx, dBy );
232	}
233	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
234		vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );
235		vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );
236		vec3 vN = surf_norm;
237		vec3 R1 = cross( vSigmaY, vN );
238		vec3 R2 = cross( vN, vSigmaX );
239		float fDet = dot( vSigmaX, R1 ) * faceDirection;
240		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
241		return normalize( abs( fDet ) * surf_norm - vGrad );
242	}
243#endif`,py=`#if NUM_CLIPPING_PLANES > 0
244	vec4 plane;
245	#pragma unroll_loop_start
246	for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
247		plane = clippingPlanes[ i ];
248		if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
249	}
250	#pragma unroll_loop_end
251	#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
252		bool clipped = true;
253		#pragma unroll_loop_start
254		for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
255			plane = clippingPlanes[ i ];
256			clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
257		}
258		#pragma unroll_loop_end
259		if ( clipped ) discard;
260	#endif
261#endif`,my=`#if NUM_CLIPPING_PLANES > 0
262	varying vec3 vClipPosition;
263	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
264#endif`,gy=`#if NUM_CLIPPING_PLANES > 0
265	varying vec3 vClipPosition;
266#endif`,xy=`#if NUM_CLIPPING_PLANES > 0
267	vClipPosition = - mvPosition.xyz;
268#endif`,yy=`#if defined( USE_COLOR_ALPHA )
269	diffuseColor *= vColor;
270#elif defined( USE_COLOR )
271	diffuseColor.rgb *= vColor;
272#endif`,vy=`#if defined( USE_COLOR_ALPHA )
273	varying vec4 vColor;
274#elif defined( USE_COLOR )
275	varying vec3 vColor;
276#endif`,by=`#if defined( USE_COLOR_ALPHA )
277	varying vec4 vColor;
278#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
279	varying vec3 vColor;
280#endif`,wy=`#if defined( USE_COLOR_ALPHA )
281	vColor = vec4( 1.0 );
282#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
283	vColor = vec3( 1.0 );
284#endif
285#ifdef USE_COLOR
286	vColor *= color;
287#endif
288#ifdef USE_INSTANCING_COLOR
289	vColor.xyz *= instanceColor.xyz;
290#endif`,My=`#define PI 3.141592653589793
291#define PI2 6.283185307179586
292#define PI_HALF 1.5707963267948966
293#define RECIPROCAL_PI 0.3183098861837907
294#define RECIPROCAL_PI2 0.15915494309189535
295#define EPSILON 1e-6
296#ifndef saturate
297#define saturate(a) clamp( a, 0.0, 1.0 )
298#endif
299#define whiteComplement(a) ( 1.0 - saturate( a ) )
300float pow2( const in float x ) { return x*x; }
301float pow3( const in float x ) { return x*x*x; }
302float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
303float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
304highp float rand( const in vec2 uv ) {
305	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
306	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
307	return fract(sin(sn) * c);
308}
309#ifdef HIGH_PRECISION
310	float precisionSafeLength( vec3 v ) { return length( v ); }
311#else
312	float max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }
313	float precisionSafeLength( vec3 v ) {
314		float maxComponent = max3( abs( v ) );
315		return length( v / maxComponent ) * maxComponent;
316	}
317#endif
318struct IncidentLight {
319	vec3 color;
320	vec3 direction;
321	bool visible;
322};
323struct ReflectedLight {
324	vec3 directDiffuse;
325	vec3 directSpecular;
326	vec3 indirectDiffuse;
327	vec3 indirectSpecular;
328};
329struct GeometricContext {
330	vec3 position;
331	vec3 normal;
332	vec3 viewDir;
333#ifdef CLEARCOAT
334	vec3 clearcoatNormal;
335#endif
336};
337vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
338	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
339}
340vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
341	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
342}
343vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
344	float distance = dot( planeNormal, point - pointOnPlane );
345	return - distance * planeNormal + point;
346}
347float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
348	return sign( dot( point - pointOnPlane, planeNormal ) );
349}
350vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {
351	return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;
352}
353mat3 transposeMat3( const in mat3 m ) {
354	mat3 tmp;
355	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
356	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
357	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
358	return tmp;
359}
360float linearToRelativeLuminance( const in vec3 color ) {
361	vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );
362	return dot( weights, color.rgb );
363}
364bool isPerspectiveMatrix( mat4 m ) {
365	return m[ 2 ][ 3 ] == - 1.0;
366}
367vec2 equirectUv( in vec3 dir ) {
368	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
369	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
370	return vec2( u, v );
371}`,_y=`#ifdef ENVMAP_TYPE_CUBE_UV
372	#define cubeUV_maxMipLevel 8.0
373	#define cubeUV_minMipLevel 4.0
374	#define cubeUV_maxTileSize 256.0
375	#define cubeUV_minTileSize 16.0
376	float getFace( vec3 direction ) {
377		vec3 absDirection = abs( direction );
378		float face = - 1.0;
379		if ( absDirection.x > absDirection.z ) {
380			if ( absDirection.x > absDirection.y )
381				face = direction.x > 0.0 ? 0.0 : 3.0;
382			else
383				face = direction.y > 0.0 ? 1.0 : 4.0;
384		} else {
385			if ( absDirection.z > absDirection.y )
386				face = direction.z > 0.0 ? 2.0 : 5.0;
387			else
388				face = direction.y > 0.0 ? 1.0 : 4.0;
389		}
390		return face;
391	}
392	vec2 getUV( vec3 direction, float face ) {
393		vec2 uv;
394		if ( face == 0.0 ) {
395			uv = vec2( direction.z, direction.y ) / abs( direction.x );
396		} else if ( face == 1.0 ) {
397			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
398		} else if ( face == 2.0 ) {
399			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
400		} else if ( face == 3.0 ) {
401			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
402		} else if ( face == 4.0 ) {
403			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
404		} else {
405			uv = vec2( direction.x, direction.y ) / abs( direction.z );
406		}
407		return 0.5 * ( uv + 1.0 );
408	}
409	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
410		float face = getFace( direction );
411		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
412		mipInt = max( mipInt, cubeUV_minMipLevel );
413		float faceSize = exp2( mipInt );
414		float texelSize = 1.0 / ( 3.0 * cubeUV_maxTileSize );
415		vec2 uv = getUV( direction, face ) * ( faceSize - 1.0 );
416		vec2 f = fract( uv );
417		uv += 0.5 - f;
418		if ( face > 2.0 ) {
419			uv.y += faceSize;
420			face -= 3.0;
421		}
422		uv.x += face * faceSize;
423		if ( mipInt < cubeUV_maxMipLevel ) {
424			uv.y += 2.0 * cubeUV_maxTileSize;
425		}
426		uv.y += filterInt * 2.0 * cubeUV_minTileSize;
427		uv.x += 3.0 * max( 0.0, cubeUV_maxTileSize - 2.0 * faceSize );
428		uv *= texelSize;
429		vec3 tl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
430		uv.x += texelSize;
431		vec3 tr = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
432		uv.y += texelSize;
433		vec3 br = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
434		uv.x -= texelSize;
435		vec3 bl = envMapTexelToLinear( texture2D( envMap, uv ) ).rgb;
436		vec3 tm = mix( tl, tr, f.x );
437		vec3 bm = mix( bl, br, f.x );
438		return mix( tm, bm, f.y );
439	}
440	#define r0 1.0
441	#define v0 0.339
442	#define m0 - 2.0
443	#define r1 0.8
444	#define v1 0.276
445	#define m1 - 1.0
446	#define r4 0.4
447	#define v4 0.046
448	#define m4 2.0
449	#define r5 0.305
450	#define v5 0.016
451	#define m5 3.0
452	#define r6 0.21
453	#define v6 0.0038
454	#define m6 4.0
455	float roughnessToMip( float roughness ) {
456		float mip = 0.0;
457		if ( roughness >= r1 ) {
458			mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;
459		} else if ( roughness >= r4 ) {
460			mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;
461		} else if ( roughness >= r5 ) {
462			mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;
463		} else if ( roughness >= r6 ) {
464			mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;
465		} else {
466			mip = - 2.0 * log2( 1.16 * roughness );		}
467		return mip;
468	}
469	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
470		float mip = clamp( roughnessToMip( roughness ), m0, cubeUV_maxMipLevel );
471		float mipF = fract( mip );
472		float mipInt = floor( mip );
473		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
474		if ( mipF == 0.0 ) {
475			return vec4( color0, 1.0 );
476		} else {
477			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
478			return vec4( mix( color0, color1, mipF ), 1.0 );
479		}
480	}
481#endif`,Sy=`vec3 transformedNormal = objectNormal;
482#ifdef USE_INSTANCING
483	mat3 m = mat3( instanceMatrix );
484	transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
485	transformedNormal = m * transformedNormal;
486#endif
487transformedNormal = normalMatrix * transformedNormal;
488#ifdef FLIP_SIDED
489	transformedNormal = - transformedNormal;
490#endif
491#ifdef USE_TANGENT
492	vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
493	#ifdef FLIP_SIDED
494		transformedTangent = - transformedTangent;
495	#endif
496#endif`,Ty=`#ifdef USE_DISPLACEMENTMAP
497	uniform sampler2D displacementMap;
498	uniform float displacementScale;
499	uniform float displacementBias;
500#endif`,Ey=`#ifdef USE_DISPLACEMENTMAP
501	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
502#endif`,Ay=`#ifdef USE_EMISSIVEMAP
503	vec4 emissiveColor = texture2D( emissiveMap, vUv );
504	emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;
505	totalEmissiveRadiance *= emissiveColor.rgb;
506#endif`,Ly=`#ifdef USE_EMISSIVEMAP
507	uniform sampler2D emissiveMap;
508#endif`,Cy="gl_FragColor = linearToOutputTexel( gl_FragColor );",Ry=`
509vec4 LinearToLinear( in vec4 value ) {
510	return value;
511}
512vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {
513	return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );
514}
515vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {
516	return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );
517}
518vec4 sRGBToLinear( in vec4 value ) {
519	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 );
520}
521vec4 LinearTosRGB( in vec4 value ) {
522	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 );
523}
524vec4 RGBEToLinear( in vec4 value ) {
525	return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );
526}
527vec4 LinearToRGBE( in vec4 value ) {
528	float maxComponent = max( max( value.r, value.g ), value.b );
529	float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );
530	return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );
531}
532vec4 RGBMToLinear( in vec4 value, in float maxRange ) {
533	return vec4( value.rgb * value.a * maxRange, 1.0 );
534}
535vec4 LinearToRGBM( in vec4 value, in float maxRange ) {
536	float maxRGB = max( value.r, max( value.g, value.b ) );
537	float M = clamp( maxRGB / maxRange, 0.0, 1.0 );
538	M = ceil( M * 255.0 ) / 255.0;
539	return vec4( value.rgb / ( M * maxRange ), M );
540}
541vec4 RGBDToLinear( in vec4 value, in float maxRange ) {
542	return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );
543}
544vec4 LinearToRGBD( in vec4 value, in float maxRange ) {
545	float maxRGB = max( value.r, max( value.g, value.b ) );
546	float D = max( maxRange / maxRGB, 1.0 );
547	D = clamp( floor( D ) / 255.0, 0.0, 1.0 );
548	return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );
549}
550const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );
551vec4 LinearToLogLuv( in vec4 value ) {
552	vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;
553	Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );
554	vec4 vResult;
555	vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;
556	float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;
557	vResult.w = fract( Le );
558	vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;
559	return vResult;
560}
561const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );
562vec4 LogLuvToLinear( in vec4 value ) {
563	float Le = value.z * 255.0 + value.w;
564	vec3 Xp_Y_XYZp;
565	Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );
566	Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;
567	Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;
568	vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;
569	return vec4( max( vRGB, 0.0 ), 1.0 );
570}`,Py=`#ifdef USE_ENVMAP
571	#ifdef ENV_WORLDPOS
572		vec3 cameraToFrag;
573		if ( isOrthographic ) {
574			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
575		} else {
576			cameraToFrag = normalize( vWorldPosition - cameraPosition );
577		}
578		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
579		#ifdef ENVMAP_MODE_REFLECTION
580			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
581		#else
582			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
583		#endif
584	#else
585		vec3 reflectVec = vReflect;
586	#endif
587	#ifdef ENVMAP_TYPE_CUBE
588		vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
589	#elif defined( ENVMAP_TYPE_CUBE_UV )
590		vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );
591	#else
592		vec4 envColor = vec4( 0.0 );
593	#endif
594	#ifndef ENVMAP_TYPE_CUBE_UV
595		envColor = envMapTexelToLinear( envColor );
596	#endif
597	#ifdef ENVMAP_BLENDING_MULTIPLY
598		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
599	#elif defined( ENVMAP_BLENDING_MIX )
600		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
601	#elif defined( ENVMAP_BLENDING_ADD )
602		outgoingLight += envColor.xyz * specularStrength * reflectivity;
603	#endif
604#endif`,Iy=`#ifdef USE_ENVMAP
605	uniform float envMapIntensity;
606	uniform float flipEnvMap;
607	uniform int maxMipLevel;
608	#ifdef ENVMAP_TYPE_CUBE
609		uniform samplerCube envMap;
610	#else
611		uniform sampler2D envMap;
612	#endif
613	
614#endif`,By=`#ifdef USE_ENVMAP
615	uniform float reflectivity;
616	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
617		#define ENV_WORLDPOS
618	#endif
619	#ifdef ENV_WORLDPOS
620		varying vec3 vWorldPosition;
621		uniform float refractionRatio;
622	#else
623		varying vec3 vReflect;
624	#endif
625#endif`,Dy=`#ifdef USE_ENVMAP
626	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )
627		#define ENV_WORLDPOS
628	#endif
629	#ifdef ENV_WORLDPOS
630		
631		varying vec3 vWorldPosition;
632	#else
633		varying vec3 vReflect;
634		uniform float refractionRatio;
635	#endif
636#endif`,ky=`#ifdef USE_ENVMAP
637	#ifdef ENV_WORLDPOS
638		vWorldPosition = worldPosition.xyz;
639	#else
640		vec3 cameraToVertex;
641		if ( isOrthographic ) {
642			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
643		} else {
644			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
645		}
646		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
647		#ifdef ENVMAP_MODE_REFLECTION
648			vReflect = reflect( cameraToVertex, worldNormal );
649		#else
650			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
651		#endif
652	#endif
653#endif`,Ny=`#ifdef USE_FOG
654	fogDepth = - mvPosition.z;
655#endif`,zy=`#ifdef USE_FOG
656	varying float fogDepth;
657#endif`,Fy=`#ifdef USE_FOG
658	#ifdef FOG_EXP2
659		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );
660	#else
661		float fogFactor = smoothstep( fogNear, fogFar, fogDepth );
662	#endif
663	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
664#endif`,Oy=`#ifdef USE_FOG
665	uniform vec3 fogColor;
666	varying float fogDepth;
667	#ifdef FOG_EXP2
668		uniform float fogDensity;
669	#else
670		uniform float fogNear;
671		uniform float fogFar;
672	#endif
673#endif`,Hy=`#ifdef USE_GRADIENTMAP
674	uniform sampler2D gradientMap;
675#endif
676vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
677	float dotNL = dot( normal, lightDirection );
678	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
679	#ifdef USE_GRADIENTMAP
680		return texture2D( gradientMap, coord ).rgb;
681	#else
682		return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
683	#endif
684}`,Uy=`#ifdef USE_LIGHTMAP
685	vec4 lightMapTexel= texture2D( lightMap, vUv2 );
686	reflectedLight.indirectDiffuse += PI * lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
687#endif`,Gy=`#ifdef USE_LIGHTMAP
688	uniform sampler2D lightMap;
689	uniform float lightMapIntensity;
690#endif`,Wy=`vec3 diffuse = vec3( 1.0 );
691GeometricContext geometry;
692geometry.position = mvPosition.xyz;
693geometry.normal = normalize( transformedNormal );
694geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
695GeometricContext backGeometry;
696backGeometry.position = geometry.position;
697backGeometry.normal = -geometry.normal;
698backGeometry.viewDir = geometry.viewDir;
699vLightFront = vec3( 0.0 );
700vIndirectFront = vec3( 0.0 );
701#ifdef DOUBLE_SIDED
702	vLightBack = vec3( 0.0 );
703	vIndirectBack = vec3( 0.0 );
704#endif
705IncidentLight directLight;
706float dotNL;
707vec3 directLightColor_Diffuse;
708vIndirectFront += getAmbientLightIrradiance( ambientLightColor );
709vIndirectFront += getLightProbeIrradiance( lightProbe, geometry );
710#ifdef DOUBLE_SIDED
711	vIndirectBack += getAmbientLightIrradiance( ambientLightColor );
712	vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry );
713#endif
714#if NUM_POINT_LIGHTS > 0
715	#pragma unroll_loop_start
716	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
717		getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );
718		dotNL = dot( geometry.normal, directLight.direction );
719		directLightColor_Diffuse = PI * directLight.color;
720		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
721		#ifdef DOUBLE_SIDED
722			vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
723		#endif
724	}
725	#pragma unroll_loop_end
726#endif
727#if NUM_SPOT_LIGHTS > 0
728	#pragma unroll_loop_start
729	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
730		getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );
731		dotNL = dot( geometry.normal, directLight.direction );
732		directLightColor_Diffuse = PI * directLight.color;
733		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
734		#ifdef DOUBLE_SIDED
735			vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
736		#endif
737	}
738	#pragma unroll_loop_end
739#endif
740#if NUM_DIR_LIGHTS > 0
741	#pragma unroll_loop_start
742	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
743		getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );
744		dotNL = dot( geometry.normal, directLight.direction );
745		directLightColor_Diffuse = PI * directLight.color;
746		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
747		#ifdef DOUBLE_SIDED
748			vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
749		#endif
750	}
751	#pragma unroll_loop_end
752#endif
753#if NUM_HEMI_LIGHTS > 0
754	#pragma unroll_loop_start
755	for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
756		vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
757		#ifdef DOUBLE_SIDED
758			vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );
759		#endif
760	}
761	#pragma unroll_loop_end
762#endif`,Vy=`uniform bool receiveShadow;
763uniform vec3 ambientLightColor;
764uniform vec3 lightProbe[ 9 ];
765vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
766	float x = normal.x, y = normal.y, z = normal.z;
767	vec3 result = shCoefficients[ 0 ] * 0.886227;
768	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
769	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
770	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
771	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
772	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
773	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
774	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
775	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
776	return result;
777}
778vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {
779	vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
780	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
781	return irradiance;
782}
783vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
784	vec3 irradiance = ambientLightColor;
785	#ifndef PHYSICALLY_CORRECT_LIGHTS
786		irradiance *= PI;
787	#endif
788	return irradiance;
789}
790#if NUM_DIR_LIGHTS > 0
791	struct DirectionalLight {
792		vec3 direction;
793		vec3 color;
794	};
795	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
796	void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {
797		directLight.color = directionalLight.color;
798		directLight.direction = directionalLight.direction;
799		directLight.visible = true;
800	}
801#endif
802#if NUM_POINT_LIGHTS > 0
803	struct PointLight {
804		vec3 position;
805		vec3 color;
806		float distance;
807		float decay;
808	};
809	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
810	void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {
811		vec3 lVector = pointLight.position - geometry.position;
812		directLight.direction = normalize( lVector );
813		float lightDistance = length( lVector );
814		directLight.color = pointLight.color;
815		directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );
816		directLight.visible = ( directLight.color != vec3( 0.0 ) );
817	}
818#endif
819#if NUM_SPOT_LIGHTS > 0
820	struct SpotLight {
821		vec3 position;
822		vec3 direction;
823		vec3 color;
824		float distance;
825		float decay;
826		float coneCos;
827		float penumbraCos;
828	};
829	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
830	void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {
831		vec3 lVector = spotLight.position - geometry.position;
832		directLight.direction = normalize( lVector );
833		float lightDistance = length( lVector );
834		float angleCos = dot( directLight.direction, spotLight.direction );
835		if ( angleCos > spotLight.coneCos ) {
836			float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );
837			directLight.color = spotLight.color;
838			directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );
839			directLight.visible = true;
840		} else {
841			directLight.color = vec3( 0.0 );
842			directLight.visible = false;
843		}
844	}
845#endif
846#if NUM_RECT_AREA_LIGHTS > 0
847	struct RectAreaLight {
848		vec3 color;
849		vec3 position;
850		vec3 halfWidth;
851		vec3 halfHeight;
852	};
853	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
854	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
855#endif
856#if NUM_HEMI_LIGHTS > 0
857	struct HemisphereLight {
858		vec3 direction;
859		vec3 skyColor;
860		vec3 groundColor;
861	};
862	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
863	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {
864		float dotNL = dot( geometry.normal, hemiLight.direction );
865		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
866		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
867		#ifndef PHYSICALLY_CORRECT_LIGHTS
868			irradiance *= PI;
869		#endif
870		return irradiance;
871	}
872#endif`,qy=`#if defined( USE_ENVMAP )
873	#ifdef ENVMAP_MODE_REFRACTION
874		uniform float refractionRatio;
875	#endif
876	vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {
877		vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
878		#ifdef ENVMAP_TYPE_CUBE
879			vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );
880			#ifdef TEXTURE_LOD_EXT
881				vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );
882			#else
883				vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );
884			#endif
885			envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
886		#elif defined( ENVMAP_TYPE_CUBE_UV )
887			vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
888		#else
889			vec4 envMapColor = vec4( 0.0 );
890		#endif
891		return PI * envMapColor.rgb * envMapIntensity;
892	}
893	float getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {
894		float maxMIPLevelScalar = float( maxMIPLevel );
895		float sigma = PI * roughness * roughness / ( 1.0 + roughness );
896		float desiredMIPLevel = maxMIPLevelScalar + log2( sigma );
897		return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );
898	}
899	vec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {
900		#ifdef ENVMAP_MODE_REFLECTION
901			vec3 reflectVec = reflect( -viewDir, normal );
902			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
903		#else
904			vec3 reflectVec = refract( -viewDir, normal, refractionRatio );
905		#endif
906		reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
907		float specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );
908		#ifdef ENVMAP_TYPE_CUBE
909			vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );
910			#ifdef TEXTURE_LOD_EXT
911				vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );
912			#else
913				vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );
914			#endif
915			envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
916		#elif defined( ENVMAP_TYPE_CUBE_UV )
917			vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
918		#endif
919		return envMapColor.rgb * envMapIntensity;
920	}
921#endif`,jy=`ToonMaterial material;
922material.diffuseColor = diffuseColor.rgb;`,Xy=`varying vec3 vViewPosition;
923#ifndef FLAT_SHADED
924	varying vec3 vNormal;
925#endif
926struct ToonMaterial {
927	vec3 diffuseColor;
928};
929void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
930	vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
931	#ifndef PHYSICALLY_CORRECT_LIGHTS
932		irradiance *= PI;
933	#endif
934	reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
935}
936void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
937	reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
938}
939#define RE_Direct				RE_Direct_Toon
940#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon
941#define Material_LightProbeLOD( material )	(0)`,Yy=`BlinnPhongMaterial material;
942material.diffuseColor = diffuseColor.rgb;
943material.specularColor = specular;
944material.specularShininess = shininess;
945material.specularStrength = specularStrength;`,Zy=`varying vec3 vViewPosition;
946#ifndef FLAT_SHADED
947	varying vec3 vNormal;
948#endif
949struct BlinnPhongMaterial {
950	vec3 diffuseColor;
951	vec3 specularColor;
952	float specularShininess;
953	float specularStrength;
954};
955void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
956	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
957	vec3 irradiance = dotNL * directLight.color;
958	#ifndef PHYSICALLY_CORRECT_LIGHTS
959		irradiance *= PI;
960	#endif
961	reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
962	reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;
963}
964void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
965	reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
966}
967#define RE_Direct				RE_Direct_BlinnPhong
968#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong
969#define Material_LightProbeLOD( material )	(0)`,Ky=`PhysicalMaterial material;
970material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
971vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
972float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
973material.specularRoughness = max( roughnessFactor, 0.0525 );material.specularRoughness += geometryRoughness;
974material.specularRoughness = min( material.specularRoughness, 1.0 );
975#ifdef REFLECTIVITY
976	material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );
977#else
978	material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );
979#endif
980#ifdef CLEARCOAT
981	material.clearcoat = clearcoat;
982	material.clearcoatRoughness = clearcoatRoughness;
983	#ifdef USE_CLEARCOATMAP
984		material.clearcoat *= texture2D( clearcoatMap, vUv ).x;
985	#endif
986	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
987		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;
988	#endif
989	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
990	material.clearcoatRoughness += geometryRoughness;
991	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
992#endif
993#ifdef USE_SHEEN
994	material.sheenColor = sheen;
995#endif`,Jy=`struct PhysicalMaterial {
996	vec3 diffuseColor;
997	float specularRoughness;
998	vec3 specularColor;
999#ifdef CLEARCOAT
1000	float clearcoat;
1001	float clearcoatRoughness;
1002#endif
1003#ifdef USE_SHEEN
1004	vec3 sheenColor;
1005#endif
1006};
1007#define MAXIMUM_SPECULAR_COEFFICIENT 0.16
1008#define DEFAULT_SPECULAR_COEFFICIENT 0.04
1009float clearcoatDHRApprox( const in float roughness, const in float dotNL ) {
1010	return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );
1011}
1012#if NUM_RECT_AREA_LIGHTS > 0
1013	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1014		vec3 normal = geometry.normal;
1015		vec3 viewDir = geometry.viewDir;
1016		vec3 position = geometry.position;
1017		vec3 lightPos = rectAreaLight.position;
1018		vec3 halfWidth = rectAreaLight.halfWidth;
1019		vec3 halfHeight = rectAreaLight.halfHeight;
1020		vec3 lightColor = rectAreaLight.color;
1021		float roughness = material.specularRoughness;
1022		vec3 rectCoords[ 4 ];
1023		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1024		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1025		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1026		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1027		vec4 t1 = texture2D( ltc_1, uv );
1028		vec4 t2 = texture2D( ltc_2, uv );
1029		mat3 mInv = mat3(
1030			vec3( t1.x, 0, t1.y ),
1031			vec3(    0, 1,    0 ),
1032			vec3( t1.z, 0, t1.w )
1033		);
1034		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
1035		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1036		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1037	}
1038#endif
1039void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1040	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
1041	vec3 irradiance = dotNL * directLight.color;
1042	#ifndef PHYSICALLY_CORRECT_LIGHTS
1043		irradiance *= PI;
1044	#endif
1045	#ifdef CLEARCOAT
1046		float ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
1047		vec3 ccIrradiance = ccDotNL * directLight.color;
1048		#ifndef PHYSICALLY_CORRECT_LIGHTS
1049			ccIrradiance *= PI;
1050		#endif
1051		float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );
1052		reflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );
1053	#else
1054		float clearcoatDHR = 0.0;
1055	#endif
1056	#ifdef USE_SHEEN
1057		reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(
1058			material.specularRoughness,
1059			directLight.direction,
1060			geometry,
1061			material.sheenColor
1062		);
1063	#else
1064		reflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);
1065	#endif
1066	reflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
1067}
1068void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1069	reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
1070}
1071void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
1072	#ifdef CLEARCOAT
1073		float ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );
1074		reflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );
1075		float ccDotNL = ccDotNV;
1076		float clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );
1077	#else
1078		float clearcoatDHR = 0.0;
1079	#endif
1080	float clearcoatInv = 1.0 - clearcoatDHR;
1081	vec3 singleScattering = vec3( 0.0 );
1082	vec3 multiScattering = vec3( 0.0 );
1083	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1084	BRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );
1085	vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );
1086	reflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;
1087	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
1088	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
1089}
1090#define RE_Direct				RE_Direct_Physical
1091#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1092#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1093#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1094float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1095	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1096}`,Qy=`
1097GeometricContext geometry;
1098geometry.position = - vViewPosition;
1099geometry.normal = normal;
1100geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1101#ifdef CLEARCOAT
1102	geometry.clearcoatNormal = clearcoatNormal;
1103#endif
1104IncidentLight directLight;
1105#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1106	PointLight pointLight;
1107	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1108	PointLightShadow pointLightShadow;
1109	#endif
1110	#pragma unroll_loop_start
1111	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1112		pointLight = pointLights[ i ];
1113		getPointDirectLightIrradiance( pointLight, geometry, directLight );
1114		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
1115		pointLightShadow = pointLightShadows[ i ];
1116		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1117		#endif
1118		RE_Direct( directLight, geometry, material, reflectedLight );
1119	}
1120	#pragma unroll_loop_end
1121#endif
1122#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1123	SpotLight spotLight;
1124	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1125	SpotLightShadow spotLightShadow;
1126	#endif
1127	#pragma unroll_loop_start
1128	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1129		spotLight = spotLights[ i ];
1130		getSpotDirectLightIrradiance( spotLight, geometry, directLight );
1131		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1132		spotLightShadow = spotLightShadows[ i ];
1133		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
1134		#endif
1135		RE_Direct( directLight, geometry, material, reflectedLight );
1136	}
1137	#pragma unroll_loop_end
1138#endif
1139#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1140	DirectionalLight directionalLight;
1141	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1142	DirectionalLightShadow directionalLightShadow;
1143	#endif
1144	#pragma unroll_loop_start
1145	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1146		directionalLight = directionalLights[ i ];
1147		getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );
1148		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1149		directionalLightShadow = directionalLightShadows[ i ];
1150		directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1151		#endif
1152		RE_Direct( directLight, geometry, material, reflectedLight );
1153	}
1154	#pragma unroll_loop_end
1155#endif
1156#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1157	RectAreaLight rectAreaLight;
1158	#pragma unroll_loop_start
1159	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1160		rectAreaLight = rectAreaLights[ i ];
1161		RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
1162	}
1163	#pragma unroll_loop_end
1164#endif
1165#if defined( RE_IndirectDiffuse )
1166	vec3 iblIrradiance = vec3( 0.0 );
1167	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1168	irradiance += getLightProbeIrradiance( lightProbe, geometry );
1169	#if ( NUM_HEMI_LIGHTS > 0 )
1170		#pragma unroll_loop_start
1171		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1172			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
1173		}
1174		#pragma unroll_loop_end
1175	#endif
1176#endif
1177#if defined( RE_IndirectSpecular )
1178	vec3 radiance = vec3( 0.0 );
1179	vec3 clearcoatRadiance = vec3( 0.0 );
1180#endif`,$y=`#if defined( RE_IndirectDiffuse )
1181	#ifdef USE_LIGHTMAP
1182		vec4 lightMapTexel= texture2D( lightMap, vUv2 );
1183		vec3 lightMapIrradiance = lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
1184		#ifndef PHYSICALLY_CORRECT_LIGHTS
1185			lightMapIrradiance *= PI;
1186		#endif
1187		irradiance += lightMapIrradiance;
1188	#endif
1189	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1190		iblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );
1191	#endif
1192#endif
1193#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1194	radiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );
1195	#ifdef CLEARCOAT
1196		clearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );
1197	#endif
1198#endif`,ev=`#if defined( RE_IndirectDiffuse )
1199	RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
1200#endif
1201#if defined( RE_IndirectSpecular )
1202	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
1203#endif`,tv=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
1204	gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1205#endif`,nv=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
1206	uniform float logDepthBufFC;
1207	varying float vFragDepth;
1208	varying float vIsPerspective;
1209#endif`,iv=`#ifdef USE_LOGDEPTHBUF
1210	#ifdef USE_LOGDEPTHBUF_EXT
1211		varying float vFragDepth;
1212		varying float vIsPerspective;
1213	#else
1214		uniform float logDepthBufFC;
1215	#endif
1216#endif`,sv=`#ifdef USE_LOGDEPTHBUF
1217	#ifdef USE_LOGDEPTHBUF_EXT
1218		vFragDepth = 1.0 + gl_Position.w;
1219		vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1220	#else
1221		if ( isPerspectiveMatrix( projectionMatrix ) ) {
1222			gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
1223			gl_Position.z *= gl_Position.w;
1224		}
1225	#endif
1226#endif`,rv=`#ifdef USE_MAP
1227	vec4 texelColor = texture2D( map, vUv );
1228	texelColor = mapTexelToLinear( texelColor );
1229	diffuseColor *= texelColor;
1230#endif`,ov=`#ifdef USE_MAP
1231	uniform sampler2D map;
1232#endif`,av=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1233	vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1234#endif
1235#ifdef USE_MAP
1236	vec4 mapTexel = texture2D( map, uv );
1237	diffuseColor *= mapTexelToLinear( mapTexel );
1238#endif
1239#ifdef USE_ALPHAMAP
1240	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1241#endif`,lv=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1242	uniform mat3 uvTransform;
1243#endif
1244#ifdef USE_MAP
1245	uniform sampler2D map;
1246#endif
1247#ifdef USE_ALPHAMAP
1248	uniform sampler2D alphaMap;
1249#endif`,cv=`float metalnessFactor = metalness;
1250#ifdef USE_METALNESSMAP
1251	vec4 texelMetalness = texture2D( metalnessMap, vUv );
1252	metalnessFactor *= texelMetalness.b;
1253#endif`,hv=`#ifdef USE_METALNESSMAP
1254	uniform sampler2D metalnessMap;
1255#endif`,uv=`#ifdef USE_MORPHNORMALS
1256	objectNormal *= morphTargetBaseInfluence;
1257	objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
1258	objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
1259	objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
1260	objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
1261#endif`,dv=`#ifdef USE_MORPHTARGETS
1262	uniform float morphTargetBaseInfluence;
1263	#ifndef USE_MORPHNORMALS
1264		uniform float morphTargetInfluences[ 8 ];
1265	#else
1266		uniform float morphTargetInfluences[ 4 ];
1267	#endif
1268#endif`,fv=`#ifdef USE_MORPHTARGETS
1269	transformed *= morphTargetBaseInfluence;
1270	transformed += morphTarget0 * morphTargetInfluences[ 0 ];
1271	transformed += morphTarget1 * morphTargetInfluences[ 1 ];
1272	transformed += morphTarget2 * morphTargetInfluences[ 2 ];
1273	transformed += morphTarget3 * morphTargetInfluences[ 3 ];
1274	#ifndef USE_MORPHNORMALS
1275		transformed += morphTarget4 * morphTargetInfluences[ 4 ];
1276		transformed += morphTarget5 * morphTargetInfluences[ 5 ];
1277		transformed += morphTarget6 * morphTargetInfluences[ 6 ];
1278		transformed += morphTarget7 * morphTargetInfluences[ 7 ];
1279	#endif
1280#endif`,pv=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1281#ifdef FLAT_SHADED
1282	vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
1283	vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
1284	vec3 normal = normalize( cross( fdx, fdy ) );
1285#else
1286	vec3 normal = normalize( vNormal );
1287	#ifdef DOUBLE_SIDED
1288		normal = normal * faceDirection;
1289	#endif
1290	#ifdef USE_TANGENT
1291		vec3 tangent = normalize( vTangent );
1292		vec3 bitangent = normalize( vBitangent );
1293		#ifdef DOUBLE_SIDED
1294			tangent = tangent * faceDirection;
1295			bitangent = bitangent * faceDirection;
1296		#endif
1297		#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
1298			mat3 vTBN = mat3( tangent, bitangent, normal );
1299		#endif
1300	#endif
1301#endif
1302vec3 geometryNormal = normal;`,mv=`#ifdef OBJECTSPACE_NORMALMAP
1303	normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
1304	#ifdef FLIP_SIDED
1305		normal = - normal;
1306	#endif
1307	#ifdef DOUBLE_SIDED
1308		normal = normal * faceDirection;
1309	#endif
1310	normal = normalize( normalMatrix * normal );
1311#elif defined( TANGENTSPACE_NORMALMAP )
1312	vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
1313	mapN.xy *= normalScale;
1314	#ifdef USE_TANGENT
1315		normal = normalize( vTBN * mapN );
1316	#else
1317		normal = perturbNormal2Arb( -vViewPosition, normal, mapN, faceDirection );
1318	#endif
1319#elif defined( USE_BUMPMAP )
1320	normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd(), faceDirection );
1321#endif`,gv=`#ifdef USE_NORMALMAP
1322	uniform sampler2D normalMap;
1323	uniform vec2 normalScale;
1324#endif
1325#ifdef OBJECTSPACE_NORMALMAP
1326	uniform mat3 normalMatrix;
1327#endif
1328#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
1329	vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
1330		vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
1331		vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
1332		vec2 st0 = dFdx( vUv.st );
1333		vec2 st1 = dFdy( vUv.st );
1334		vec3 N = surf_norm;
1335		vec3 q1perp = cross( q1, N );
1336		vec3 q0perp = cross( N, q0 );
1337		vec3 T = q1perp * st0.x + q0perp * st1.x;
1338		vec3 B = q1perp * st0.y + q0perp * st1.y;
1339		float det = max( dot( T, T ), dot( B, B ) );
1340		float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );
1341		return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
1342	}
1343#endif`,xv=`#ifdef CLEARCOAT
1344	vec3 clearcoatNormal = geometryNormal;
1345#endif`,yv=`#ifdef USE_CLEARCOAT_NORMALMAP
1346	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
1347	clearcoatMapN.xy *= clearcoatNormalScale;
1348	#ifdef USE_TANGENT
1349		clearcoatNormal = normalize( vTBN * clearcoatMapN );
1350	#else
1351		clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );
1352	#endif
1353#endif`,vv=`#ifdef USE_CLEARCOATMAP
1354	uniform sampler2D clearcoatMap;
1355#endif
1356#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1357	uniform sampler2D clearcoatRoughnessMap;
1358#endif
1359#ifdef USE_CLEARCOAT_NORMALMAP
1360	uniform sampler2D clearcoatNormalMap;
1361	uniform vec2 clearcoatNormalScale;
1362#endif`,bv=`vec3 packNormalToRGB( const in vec3 normal ) {
1363	return normalize( normal ) * 0.5 + 0.5;
1364}
1365vec3 unpackRGBToNormal( const in vec3 rgb ) {
1366	return 2.0 * rgb.xyz - 1.0;
1367}
1368const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
1369const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
1370const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
1371const float ShiftRight8 = 1. / 256.;
1372vec4 packDepthToRGBA( const in float v ) {
1373	vec4 r = vec4( fract( v * PackFactors ), v );
1374	r.yzw -= r.xyz * ShiftRight8;	return r * PackUpscale;
1375}
1376float unpackRGBAToDepth( const in vec4 v ) {
1377	return dot( v, UnpackFactors );
1378}
1379vec4 pack2HalfToRGBA( vec2 v ) {
1380	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ));
1381	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w);
1382}
1383vec2 unpackRGBATo2Half( vec4 v ) {
1384	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1385}
1386float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1387	return ( viewZ + near ) / ( near - far );
1388}
1389float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
1390	return linearClipZ * ( near - far ) - near;
1391}
1392float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1393	return (( near + viewZ ) * far ) / (( far - near ) * viewZ );
1394}
1395float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
1396	return ( near * far ) / ( ( far - near ) * invClipZ - far );
1397}`,wv=`#ifdef PREMULTIPLIED_ALPHA
1398	gl_FragColor.rgb *= gl_FragColor.a;
1399#endif`,Mv=`vec4 mvPosition = vec4( transformed, 1.0 );
1400#ifdef USE_INSTANCING
1401	mvPosition = instanceMatrix * mvPosition;
1402#endif
1403mvPosition = modelViewMatrix * mvPosition;
1404gl_Position = projectionMatrix * mvPosition;`,_v=`#ifdef DITHERING
1405	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1406#endif`,Sv=`#ifdef DITHERING
1407	vec3 dithering( vec3 color ) {
1408		float grid_position = rand( gl_FragCoord.xy );
1409		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1410		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1411		return color + dither_shift_RGB;
1412	}
1413#endif`,Tv=`float roughnessFactor = roughness;
1414#ifdef USE_ROUGHNESSMAP
1415	vec4 texelRoughness = texture2D( roughnessMap, vUv );
1416	roughnessFactor *= texelRoughness.g;
1417#endif`,Ev=`#ifdef USE_ROUGHNESSMAP
1418	uniform sampler2D roughnessMap;
1419#endif`,Av
vendor: 8,456 bytes, lines 1419-1593
1419=`#ifdef USE_SHADOWMAP
1420	#if NUM_DIR_LIGHT_SHADOWS > 0
1421		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1422		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1423		struct DirectionalLightShadow {
1424			float shadowBias;
1425			float shadowNormalBias;
1426			float shadowRadius;
1427			vec2 shadowMapSize;
1428		};
1429		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1430	#endif
1431	#if NUM_SPOT_LIGHT_SHADOWS > 0
1432		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1433		varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
1434		struct SpotLightShadow {
1435			float shadowBias;
1436			float shadowNormalBias;
1437			float shadowRadius;
1438			vec2 shadowMapSize;
1439		};
1440		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1441	#endif
1442	#if NUM_POINT_LIGHT_SHADOWS > 0
1443		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1444		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1445		struct PointLightShadow {
1446			float shadowBias;
1447			float shadowNormalBias;
1448			float shadowRadius;
1449			vec2 shadowMapSize;
1450			float shadowCameraNear;
1451			float shadowCameraFar;
1452		};
1453		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1454	#endif
1455	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
1456		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
1457	}
1458	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
1459		return unpackRGBATo2Half( texture2D( shadow, uv ) );
1460	}
1461	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
1462		float occlusion = 1.0;
1463		vec2 distribution = texture2DDistribution( shadow, uv );
1464		float hard_shadow = step( compare , distribution.x );
1465		if (hard_shadow != 1.0 ) {
1466			float distance = compare - distribution.x ;
1467			float variance = max( 0.00000, distribution.y * distribution.y );
1468			float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
1469		}
1470		return occlusion;
1471	}
1472	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1473		float shadow = 1.0;
1474		shadowCoord.xyz /= shadowCoord.w;
1475		shadowCoord.z += shadowBias;
1476		bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
1477		bool inFrustum = all( inFrustumVec );
1478		bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
1479		bool frustumTest = all( frustumTestVec );
1480		if ( frustumTest ) {
1481		#if defined( SHADOWMAP_TYPE_PCF )
1482			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1483			float dx0 = - texelSize.x * shadowRadius;
1484			float dy0 = - texelSize.y * shadowRadius;
1485			float dx1 = + texelSize.x * shadowRadius;
1486			float dy1 = + texelSize.y * shadowRadius;
1487			float dx2 = dx0 / 2.0;
1488			float dy2 = dy0 / 2.0;
1489			float dx3 = dx1 / 2.0;
1490			float dy3 = dy1 / 2.0;
1491			shadow = (
1492				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
1493				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
1494				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
1495				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
1496				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
1497				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
1498				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
1499				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
1500				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
1501				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
1502				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
1503				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
1504				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
1505				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
1506				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
1507				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
1508				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
1509			) * ( 1.0 / 17.0 );
1510		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
1511			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1512			float dx = texelSize.x;
1513			float dy = texelSize.y;
1514			vec2 uv = shadowCoord.xy;
1515			vec2 f = fract( uv * shadowMapSize + 0.5 );
1516			uv -= f * texelSize;
1517			shadow = (
1518				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
1519				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
1520				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
1521				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
1522				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), 
1523					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
1524					 f.x ) +
1525				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), 
1526					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
1527					 f.x ) +
1528				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), 
1529					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
1530					 f.y ) +
1531				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), 
1532					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
1533					 f.y ) +
1534				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), 
1535						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
1536						  f.x ),
1537					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), 
1538						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
1539						  f.x ),
1540					 f.y )
1541			) * ( 1.0 / 9.0 );
1542		#elif defined( SHADOWMAP_TYPE_VSM )
1543			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
1544		#else
1545			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
1546		#endif
1547		}
1548		return shadow;
1549	}
1550	vec2 cubeToUV( vec3 v, float texelSizeY ) {
1551		vec3 absV = abs( v );
1552		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
1553		absV *= scaleToCube;
1554		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
1555		vec2 planar = v.xy;
1556		float almostATexel = 1.5 * texelSizeY;
1557		float almostOne = 1.0 - almostATexel;
1558		if ( absV.z >= almostOne ) {
1559			if ( v.z > 0.0 )
1560				planar.x = 4.0 - v.x;
1561		} else if ( absV.x >= almostOne ) {
1562			float signX = sign( v.x );
1563			planar.x = v.z * signX + 2.0 * signX;
1564		} else if ( absV.y >= almostOne ) {
1565			float signY = sign( v.y );
1566			planar.x = v.x + 2.0 * signY + 2.0;
1567			planar.y = v.z * signY - 2.0;
1568		}
1569		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
1570	}
1571	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1572		vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
1573		vec3 lightToPosition = shadowCoord.xyz;
1574		float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );		dp += shadowBias;
1575		vec3 bd3D = normalize( lightToPosition );
1576		#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
1577			vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
1578			return (
1579				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
1580				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
1581				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
1582				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
1583				texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
1584				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
1585				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
1586				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
1587				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
1588			) * ( 1.0 / 9.0 );
1589		#else
1590			return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
1591		#endif
1592	}
1593#endif`,
1593Lv=`#ifdef USE_SHADOWMAP
1594	#if NUM_DIR_LIGHT_SHADOWS > 0
1595		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1596		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1597		struct DirectionalLightShadow {
1598			float shadowBias;
1599			float shadowNormalBias;
1600			float shadowRadius;
1601			vec2 shadowMapSize;
1602		};
1603		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1604	#endif
1605	#if NUM_SPOT_LIGHT_SHADOWS > 0
1606		uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];
1607		varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];
1608		struct SpotLightShadow {
1609			float shadowBias;
1610			float shadowNormalBias;
1611			float shadowRadius;
1612			vec2 shadowMapSize;
1613		};
1614		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1615	#endif
1616	#if NUM_POINT_LIGHT_SHADOWS > 0
1617		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1618		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1619		struct PointLightShadow {
1620			float shadowBias;
1621			float shadowNormalBias;
1622			float shadowRadius;
1623			vec2 shadowMapSize;
1624			float shadowCameraNear;
1625			float shadowCameraFar;
1626		};
1627		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1628	#endif
1629#endif`,Cv=`#ifdef USE_SHADOWMAP
1630	#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0
1631		vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
1632		vec4 shadowWorldPosition;
1633	#endif
1634	#if NUM_DIR_LIGHT_SHADOWS > 0
1635	#pragma unroll_loop_start
1636	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1637		shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
1638		vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
1639	}
1640	#pragma unroll_loop_end
1641	#endif
1642	#if NUM_SPOT_LIGHT_SHADOWS > 0
1643	#pragma unroll_loop_start
1644	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
1645		shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );
1646		vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;
1647	}
1648	#pragma unroll_loop_end
1649	#endif
1650	#if NUM_POINT_LIGHT_SHADOWS > 0
1651	#pragma unroll_loop_start
1652	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1653		shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
1654		vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
1655	}
1656	#pragma unroll_loop_end
1657	#endif
1658#endif`,Rv=`float getShadowMask() {
1659	float shadow = 1.0;
1660	#ifdef USE_SHADOWMAP
1661	#if NUM_DIR_LIGHT_SHADOWS > 0
1662	DirectionalLightShadow directionalLight;
1663	#pragma unroll_loop_start
1664	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
1665		directionalLight = directionalLightShadows[ i ];
1666		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1667	}
1668	#pragma unroll_loop_end
1669	#endif
1670	#if NUM_SPOT_LIGHT_SHADOWS > 0
1671	SpotLightShadow spotLight;
1672	#pragma unroll_loop_start
1673	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
1674		spotLight = spotLightShadows[ i ];
1675		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
1676	}
1677	#pragma unroll_loop_end
1678	#endif
1679	#if NUM_POINT_LIGHT_SHADOWS > 0
1680	PointLightShadow pointLight;
1681	#pragma unroll_loop_start
1682	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
1683		pointLight = pointLightShadows[ i ];
1684		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
1685	}
1686	#pragma unroll_loop_end
1687	#endif
1688	#endif
1689	return shadow;
1690}`,Pv=`#ifdef USE_SKINNING
1691	mat4 boneMatX = getBoneMatrix( skinIndex.x );
1692	mat4 boneMatY = getBoneMatrix( skinIndex.y );
1693	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
1694	mat4 boneMatW = getBoneMatrix( skinIndex.w );
1695#endif`,Iv=`#ifdef USE_SKINNING
1696	uniform mat4 bindMatrix;
1697	uniform mat4 bindMatrixInverse;
1698	#ifdef BONE_TEXTURE
1699		uniform highp sampler2D boneTexture;
1700		uniform int boneTextureSize;
1701		mat4 getBoneMatrix( const in float i ) {
1702			float j = i * 4.0;
1703			float x = mod( j, float( boneTextureSize ) );
1704			float y = floor( j / float( boneTextureSize ) );
1705			float dx = 1.0 / float( boneTextureSize );
1706			float dy = 1.0 / float( boneTextureSize );
1707			y = dy * ( y + 0.5 );
1708			vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
1709			vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
1710			vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
1711			vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
1712			mat4 bone = mat4( v1, v2, v3, v4 );
1713			return bone;
1714		}
1715	#else
1716		uniform mat4 boneMatrices[ MAX_BONES ];
1717		mat4 getBoneMatrix( const in float i ) {
1718			mat4 bone = boneMatrices[ int(i) ];
1719			return bone;
1720		}
1721	#endif
1722#endif`,Bv=`#ifdef USE_SKINNING
1723	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
1724	vec4 skinned = vec4( 0.0 );
1725	skinned += boneMatX * skinVertex * skinWeight.x;
1726	skinned += boneMatY * skinVertex * skinWeight.y;
1727	skinned += boneMatZ * skinVertex * skinWeight.z;
1728	skinned += boneMatW * skinVertex * skinWeight.w;
1729	transformed = ( bindMatrixInverse * skinned ).xyz;
1730#endif`,Dv=`#ifdef USE_SKINNING
1731	mat4 skinMatrix = mat4( 0.0 );
1732	skinMatrix += skinWeight.x * boneMatX;
1733	skinMatrix += skinWeight.y * boneMatY;
1734	skinMatrix += skinWeight.z * boneMatZ;
1735	skinMatrix += skinWeight.w * boneMatW;
1736	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
1737	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
1738	#ifdef USE_TANGENT
1739		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
1740	#endif
1741#endif`,kv=`float specularStrength;
1742#ifdef USE_SPECULARMAP
1743	vec4 texelSpecular = texture2D( specularMap, vUv );
1744	specularStrength = texelSpecular.r;
1745#else
1746	specularStrength = 1.0;
1747#endif`,Nv=`#ifdef USE_SPECULARMAP
1748	uniform sampler2D specularMap;
1749#endif`,zv=`#if defined( TONE_MAPPING )
1750	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
1751#endif`,Fv=`#ifndef saturate
1752#define saturate(a) clamp( a, 0.0, 1.0 )
1753#endif
1754uniform float toneMappingExposure;
1755vec3 LinearToneMapping( vec3 color ) {
1756	return toneMappingExposure * color;
1757}
1758vec3 ReinhardToneMapping( vec3 color ) {
1759	color *= toneMappingExposure;
1760	return saturate( color / ( vec3( 1.0 ) + color ) );
1761}
1762vec3 OptimizedCineonToneMapping( vec3 color ) {
1763	color *= toneMappingExposure;
1764	color = max( vec3( 0.0 ), color - 0.004 );
1765	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
1766}
1767vec3 RRTAndODTFit( vec3 v ) {
1768	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
1769	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
1770	return a / b;
1771}
1772vec3 ACESFilmicToneMapping( vec3 color ) {
1773	const mat3 ACESInputMat = mat3(
1774		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
1775		vec3( 0.04823, 0.01566, 0.83777 )
1776	);
1777	const mat3 ACESOutputMat = mat3(
1778		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
1779		vec3( -0.07367, -0.00605,  1.07602 )
1780	);
1781	color *= toneMappingExposure / 0.6;
1782	color = ACESInputMat * color;
1783	color = RRTAndODTFit( color );
1784	color = ACESOutputMat * color;
1785	return saturate( color );
1786}
1787vec3 CustomToneMapping( vec3 color ) { return color; }`,Ov=`#ifdef USE_TRANSMISSIONMAP
1788	totalTransmission *= texture2D( transmissionMap, vUv ).r;
1789#endif`,Hv=`#ifdef USE_TRANSMISSIONMAP
1790	uniform sampler2D transmissionMap;
1791#endif`,Uv=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
1792	varying vec2 vUv;
1793#endif`,Gv=`#ifdef USE_UV
1794	#ifdef UVS_VERTEX_ONLY
1795		vec2 vUv;
1796	#else
1797		varying vec2 vUv;
1798	#endif
1799	uniform mat3 uvTransform;
1800#endif`,Wv=`#ifdef USE_UV
1801	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
1802#endif`,Vv=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
1803	varying vec2 vUv2;
1804#endif`,qv=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
1805	attribute vec2 uv2;
1806	varying vec2 vUv2;
1807	uniform mat3 uv2Transform;
1808#endif`,jv=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
1809	vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
1810#endif`,Xv=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )
1811	vec4 worldPosition = vec4( transformed, 1.0 );
1812	#ifdef USE_INSTANCING
1813		worldPosition = instanceMatrix * worldPosition;
1814	#endif
1815	worldPosition = modelMatrix * worldPosition;
1816#endif`,Yv=`uniform sampler2D t2D;
1817varying vec2 vUv;
1818void main() {
1819	vec4 texColor = texture2D( t2D, vUv );
1820	gl_FragColor = mapTexelToLinear( texColor );
1821	#include <tonemapping_fragment>
1822	#include <encodings_fragment>
1823}`,Zv=`varying vec2 vUv;
1824uniform mat3 uvTransform;
1825void main() {
1826	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
1827	gl_Position = vec4( position.xy, 1.0, 1.0 );
1828}`,Kv=`#include <envmap_common_pars_fragment>
1829uniform float opacity;
1830varying vec3 vWorldDirection;
1831#include <cube_uv_reflection_fragment>
1832void main() {
1833	vec3 vReflect = vWorldDirection;
1834	#include <envmap_fragment>
1835	gl_FragColor = envColor;
1836	gl_FragColor.a *= opacity;
1837	#include <tonemapping_fragment>
1838	#include <encodings_fragment>
1839}`,Jv=`varying vec3 vWorldDirection;
1840#include <common>
1841void main() {
1842	vWorldDirection = transformDirection( position, modelMatrix );
1843	#include <begin_vertex>
1844	#include <project_vertex>
1845	gl_Position.z = gl_Position.w;
1846}`,Qv=`#if DEPTH_PACKING == 3200
1847	uniform float opacity;
1848#endif
1849#include <common>
1850#include <packing>
1851#include <uv_pars_fragment>
1852#include <map_pars_fragment>
1853#include <alphamap_pars_fragment>
1854#include <logdepthbuf_pars_fragment>
1855#include <clipping_planes_pars_fragment>
1856varying vec2 vHighPrecisionZW;
1857void main() {
1858	#include <clipping_planes_fragment>
1859	vec4 diffuseColor = vec4( 1.0 );
1860	#if DEPTH_PACKING == 3200
1861		diffuseColor.a = opacity;
1862	#endif
1863	#include <map_fragment>
1864	#include <alphamap_fragment>
1865	#include <alphatest_fragment>
1866	#include <logdepthbuf_fragment>
1867	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
1868	#if DEPTH_PACKING == 3200
1869		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
1870	#elif DEPTH_PACKING == 3201
1871		gl_FragColor = packDepthToRGBA( fragCoordZ );
1872	#endif
1873}`,$v=`#include <common>
1874#include <uv_pars_vertex>
1875#include <displacementmap_pars_vertex>
1876#include <morphtarget_pars_vertex>
1877#include <skinning_pars_vertex>
1878#include <logdepthbuf_pars_vertex>
1879#include <clipping_planes_pars_vertex>
1880varying vec2 vHighPrecisionZW;
1881void main() {
1882	#include <uv_vertex>
1883	#include <skinbase_vertex>
1884	#ifdef USE_DISPLACEMENTMAP
1885		#include <beginnormal_vertex>
1886		#include <morphnormal_vertex>
1887		#include <skinnormal_vertex>
1888	#endif
1889	#include <begin_vertex>
1890	#include <morphtarget_vertex>
1891	#include <skinning_vertex>
1892	#include <displacementmap_vertex>
1893	#include <project_vertex>
1894	#include <logdepthbuf_vertex>
1895	#include <clipping_planes_vertex>
1896	vHighPrecisionZW = gl_Position.zw;
1897}`,eb=`#define DISTANCE
1898uniform vec3 referencePosition;
1899uniform float nearDistance;
1900uniform float farDistance;
1901varying vec3 vWorldPosition;
1902#include <common>
1903#include <packing>
1904#include <uv_pars_fragment>
1905#include <map_pars_fragment>
1906#include <alphamap_pars_fragment>
1907#include <clipping_planes_pars_fragment>
1908void main () {
1909	#include <clipping_planes_fragment>
1910	vec4 diffuseColor = vec4( 1.0 );
1911	#include <map_fragment>
1912	#include <alphamap_fragment>
1913	#include <alphatest_fragment>
1914	float dist = length( vWorldPosition - referencePosition );
1915	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
1916	dist = saturate( dist );
1917	gl_FragColor = packDepthToRGBA( dist );
1918}`,tb=`#define DISTANCE
1919varying vec3 vWorldPosition;
1920#include <common>
1921#include <uv_pars_vertex>
1922#include <displacementmap_pars_vertex>
1923#include <morphtarget_pars_vertex>
1924#include <skinning_pars_vertex>
1925#include <clipping_planes_pars_vertex>
1926void main() {
1927	#include <uv_vertex>
1928	#include <skinbase_vertex>
1929	#ifdef USE_DISPLACEMENTMAP
1930		#include <beginnormal_vertex>
1931		#include <morphnormal_vertex>
1932		#include <skinnormal_vertex>
1933	#endif
1934	#include <begin_vertex>
1935	#include <morphtarget_vertex>
1936	#include <skinning_vertex>
1937	#include <displacementmap_vertex>
1938	#include <project_vertex>
1939	#include <worldpos_vertex>
1940	#include <clipping_planes_vertex>
1941	vWorldPosition = worldPosition.xyz;
1942}`,nb=`uniform sampler2D tEquirect;
1943varying vec3 vWorldDirection;
1944#include <common>
1945void main() {
1946	vec3 direction = normalize( vWorldDirection );
1947	vec2 sampleUV = equirectUv( direction );
1948	vec4 texColor = texture2D( tEquirect, sampleUV );
1949	gl_FragColor = mapTexelToLinear( texColor );
1950	#include <tonemapping_fragment>
1951	#include <encodings_fragment>
1952}`,ib=`varying vec3 vWorldDirection;
1953#include <common>
1954void main() {
1955	vWorldDirection = transformDirection( position, modelMatrix );
1956	#include <begin_vertex>
1957	#include <project_vertex>
1958}`,sb=`uniform vec3 diffuse;
1959uniform float opacity;
1960uniform float dashSize;
1961uniform float totalSize;
1962varying float vLineDistance;
1963#include <common>
1964#include <color_pars_fragment>
1965#include <fog_pars_fragment>
1966#include <logdepthbuf_pars_fragment>
1967#include <clipping_planes_pars_fragment>
1968void main() {
1969	#include <clipping_planes_fragment>
1970	if ( mod( vLineDistance, totalSize ) > dashSize ) {
1971		discard;
1972	}
1973	vec3 outgoingLight = vec3( 0.0 );
1974	vec4 diffuseColor = vec4( diffuse, opacity );
1975	#include <logdepthbuf_fragment>
1976	#include <color_fragment>
1977	outgoingLight = diffuseColor.rgb;
1978	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
1979	#include <tonemapping_fragment>
1980	#include <encodings_fragment>
1981	#include <fog_fragment>
1982	#include <premultiplied_alpha_fragment>
1983}`,rb=`uniform float scale;
1984attribute float lineDistance;
1985varying float vLineDistance;
1986#include <common>
1987#include <color_pars_vertex>
1988#include <fog_pars_vertex>
1989#include <morphtarget_pars_vertex>
1990#include <logdepthbuf_pars_vertex>
1991#include <clipping_planes_pars_vertex>
1992void main() {
1993	vLineDistance = scale * lineDistance;
1994	#include <color_vertex>
1995	#include <begin_vertex>
1996	#include <morphtarget_vertex>
1997	#include <project_vertex>
1998	#include <logdepthbuf_vertex>
1999	#include <clipping_planes_vertex>
2000	#include <fog_vertex>
2001}`,ob=`uniform vec3 diffuse;
2002uniform float opacity;
2003#ifndef FLAT_SHADED
2004	varying vec3 vNormal;
2005#endif
2006#include <common>
2007#include <dithering_pars_fragment>
2008#include <color_pars_fragment>
2009#include <uv_pars_fragment>
2010#include <uv2_pars_fragment>
2011#include <map_pars_fragment>
2012#include <alphamap_pars_fragment>
2013#include <aomap_pars_fragment>
2014#include <lightmap_pars_fragment>
2015#include <envmap_common_pars_fragment>
2016#include <envmap_pars_fragment>
2017#include <cube_uv_reflection_fragment>
2018#include <fog_pars_fragment>
2019#include <specularmap_pars_fragment>
2020#include <logdepthbuf_pars_fragment>
2021#include <clipping_planes_pars_fragment>
2022void main() {
2023	#include <clipping_planes_fragment>
2024	vec4 diffuseColor = vec4( diffuse, opacity );
2025	#include <logdepthbuf_fragment>
2026	#include <map_fragment>
2027	#include <color_fragment>
2028	#include <alphamap_fragment>
2029	#include <alphatest_fragment>
2030	#include <specularmap_fragment>
2031	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2032	#ifdef USE_LIGHTMAP
2033	
2034		vec4 lightMapTexel= texture2D( lightMap, vUv2 );
2035		reflectedLight.indirectDiffuse += lightMapTexelToLinear( lightMapTexel ).rgb * lightMapIntensity;
2036	#else
2037		reflectedLight.indirectDiffuse += vec3( 1.0 );
2038	#endif
2039	#include <aomap_fragment>
2040	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2041	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2042	#include <envmap_fragment>
2043	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
2044	#include <tonemapping_fragment>
2045	#include <encodings_fragment>
2046	#include <fog_fragment>
2047	#include <premultiplied_alpha_fragment>
2048	#include <dithering_fragment>
2049}`,ab=`#include <common>
2050#include <uv_pars_vertex>
2051#include <uv2_pars_vertex>
2052#include <envmap_pars_vertex>
2053#include <color_pars_vertex>
2054#include <fog_pars_vertex>
2055#include <morphtarget_pars_vertex>
2056#include <skinning_pars_vertex>
2057#include <logdepthbuf_pars_vertex>
2058#include <clipping_planes_pars_vertex>
2059void main() {
2060	#include <uv_vertex>
2061	#include <uv2_vertex>
2062	#include <color_vertex>
2063	#include <skinbase_vertex>
2064	#ifdef USE_ENVMAP
2065	#include <beginnormal_vertex>
2066	#include <morphnormal_vertex>
2067	#include <skinnormal_vertex>
2068	#include <defaultnormal_vertex>
2069	#endif
2070	#include <begin_vertex>
2071	#include <morphtarget_vertex>
2072	#include <skinning_vertex>
2073	#include <project_vertex>
2074	#include <logdepthbuf_v
2074ertex>
2075	#include <worldpos_vertex>
2076	#include <clipping_planes_vertex>
2077	#include <envmap_vertex>
2078	#include <fog_vertex>
2079}`,lb=`uniform vec3 diffuse;
2080uniform vec3 emissive;
2081uniform float opacity;
2082varying vec3 vLightFront;
2083varying vec3 vIndirectFront;
2084#ifdef DOUBLE_SIDED
2085	varying vec3 vLightBack;
2086	varying vec3 vIndirectBack;
2087#endif
2088#include <common>
2089#include <packing>
2090#include <dithering_pars_fragment>
2091#include <color_pars_fragment>
2092#include <uv_pars_fragment>
2093#include <uv2_pars_fragment>
2094#include <map_pars_fragment>
2095#include <alphamap_pars_fragment>
2096#include <aomap_pars_fragment>
2097#include <lightmap_pars_fragment>
2098#include <emissivemap_pars_fragment>
2099#include <envmap_common_pars_fragment>
2100#include <envmap_pars_fragment>
2101#include <cube_uv_reflection_fragment>
2102#include <bsdfs>
2103#include <lights_pars_begin>
2104#include <fog_pars_fragment>
2105#include <shadowmap_pars_fragment>
2106#include <shadowmask_pars_fragment>
2107#include <specularmap_pars_fragment>
2108#include <logdepthbuf_pars_fragment>
2109#include <clipping_planes_pars_fragment>
2110void main() {
2111	#include <clipping_planes_fragment>
2112	vec4 diffuseColor = vec4( diffuse, opacity );
2113	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2114	vec3 totalEmissiveRadiance = emissive;
2115	#include <logdepthbuf_fragment>
2116	#include <map_fragment>
2117	#include <color_fragment>
2118	#include <alphamap_fragment>
2119	#include <alphatest_fragment>
2120	#include <specularmap_fragment>
2121	#include <emissivemap_fragment>
2122	#ifdef DOUBLE_SIDED
2123		reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;
2124	#else
2125		reflectedLight.indirectDiffuse += vIndirectFront;
2126	#endif
2127	#include <lightmap_fragment>
2128	reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );
2129	#ifdef DOUBLE_SIDED
2130		reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
2131	#else
2132		reflectedLight.directDiffuse = vLightFront;
2133	#endif
2134	reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();
2135	#include <aomap_fragment>
2136	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2137	#include <envmap_fragment>
2138	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
2139	#include <tonemapping_fragment>
2140	#include <encodings_fragment>
2141	#include <fog_fragment>
2142	#include <premultiplied_alpha_fragment>
2143	#include <dithering_fragment>
2144}`,cb=`#define LAMBERT
2145varying vec3 vLightFront;
2146varying vec3 vIndirectFront;
2147#ifdef DOUBLE_SIDED
2148	varying vec3 vLightBack;
2149	varying vec3 vIndirectBack;
2150#endif
2151#include <common>
2152#include <uv_pars_vertex>
2153#include <uv2_pars_vertex>
2154#include <envmap_pars_vertex>
2155#include <bsdfs>
2156#include <lights_pars_begin>
2157#include <color_pars_vertex>
2158#include <fog_pars_vertex>
2159#include <morphtarget_pars_vertex>
2160#include <skinning_pars_vertex>
2161#include <shadowmap_pars_vertex>
2162#include <logdepthbuf_pars_vertex>
2163#include <clipping_planes_pars_vertex>
2164void main() {
2165	#include <uv_vertex>
2166	#include <uv2_vertex>
2167	#include <color_vertex>
2168	#include <beginnormal_vertex>
2169	#include <morphnormal_vertex>
2170	#include <skinbase_vertex>
2171	#include <skinnormal_vertex>
2172	#include <defaultnormal_vertex>
2173	#include <begin_vertex>
2174	#include <morphtarget_vertex>
2175	#include <skinning_vertex>
2176	#include <project_vertex>
2177	#include <logdepthbuf_vertex>
2178	#include <clipping_planes_vertex>
2179	#include <worldpos_vertex>
2180	#include <envmap_vertex>
2181	#include <lights_lambert_vertex>
2182	#include <shadowmap_vertex>
2183	#include <fog_vertex>
2184}`,hb=`#define MATCAP
2185uniform vec3 diffuse;
2186uniform float opacity;
2187uniform sampler2D matcap;
2188varying vec3 vViewPosition;
2189#ifndef FLAT_SHADED
2190	varying vec3 vNormal;
2191#endif
2192#include <common>
2193#include <dithering_pars_fragment>
2194#include <color_pars_fragment>
2195#include <uv_pars_fragment>
2196#include <map_pars_fragment>
2197#include <alphamap_pars_fragment>
2198#include <fog_pars_fragment>
2199#include <bumpmap_pars_fragment>
2200#include <normalmap_pars_fragment>
2201#include <logdepthbuf_pars_fragment>
2202#include <clipping_planes_pars_fragment>
2203void main() {
2204	#include <clipping_planes_fragment>
2205	vec4 diffuseColor = vec4( diffuse, opacity );
2206	#include <logdepthbuf_fragment>
2207	#include <map_fragment>
2208	#include <color_fragment>
2209	#include <alphamap_fragment>
2210	#include <alphatest_fragment>
2211	#include <normal_fragment_begin>
2212	#include <normal_fragment_maps>
2213	vec3 viewDir = normalize( vViewPosition );
2214	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
2215	vec3 y = cross( viewDir, x );
2216	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
2217	#ifdef USE_MATCAP
2218		vec4 matcapColor = texture2D( matcap, uv );
2219		matcapColor = matcapTexelToLinear( matcapColor );
2220	#else
2221		vec4 matcapColor = vec4( 1.0 );
2222	#endif
2223	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
2224	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
2225	#include <tonemapping_fragment>
2226	#include <encodings_fragment>
2227	#include <fog_fragment>
2228	#include <premultiplied_alpha_fragment>
2229	#include <dithering_fragment>
2230}`,ub=`#define MATCAP
2231varying vec3 vViewPosition;
2232#ifndef FLAT_SHADED
2233	varying vec3 vNormal;
2234#endif
2235#include <common>
2236#include <uv_pars_vertex>
2237#include <color_pars_vertex>
2238#include <displacementmap_pars_vertex>
2239#include <fog_pars_vertex>
2240#include <morphtarget_pars_vertex>
2241#include <skinning_pars_vertex>
2242#include <logdepthbuf_pars_vertex>
2243#include <clipping_planes_pars_vertex>
2244void main() {
2245	#include <uv_vertex>
2246	#include <color_vertex>
2247	#include <beginnormal_vertex>
2248	#include <morphnormal_vertex>
2249	#include <skinbase_vertex>
2250	#include <skinnormal_vertex>
2251	#include <defaultnormal_vertex>
2252	#ifndef FLAT_SHADED
2253		vNormal = normalize( transformedNormal );
2254	#endif
2255	#include <begin_vertex>
2256	#include <morphtarget_vertex>
2257	#include <skinning_vertex>
2258	#include <displacementmap_vertex>
2259	#include <project_vertex>
2260	#include <logdepthbuf_vertex>
2261	#include <clipping_planes_vertex>
2262	#include <fog_vertex>
2263	vViewPosition = - mvPosition.xyz;
2264}`,db=`#define TOON
2265uniform vec3 diffuse;
2266uniform vec3 emissive;
2267uniform float opacity;
2268#include <common>
2269#include <packing>
2270#include <dithering_pars_fragment>
2271#include <color_pars_fragment>
2272#include <uv_pars_fragment>
2273#include <uv2_pars_fragment>
2274#include <map_pars_fragment>
2275#include <alphamap_pars_fragment>
2276#include <aomap_pars_fragment>
2277#include <lightmap_pars_fragment>
2278#include <emissivemap_pars_fragment>
2279#include <gradientmap_pars_fragment>
2280#include <fog_pars_fragment>
2281#include <bsdfs>
2282#include <lights_pars_begin>
2283#include <lights_toon_pars_fragment>
2284#include <shadowmap_pars_fragment>
2285#include <bumpmap_pars_fragment>
2286#include <normalmap_pars_fragment>
2287#include <logdepthbuf_pars_fragment>
2288#include <clipping_planes_pars_fragment>
2289void main() {
2290	#include <clipping_planes_fragment>
2291	vec4 diffuseColor = vec4( diffuse, opacity );
2292	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2293	vec3 totalEmissiveRadiance = emissive;
2294	#include <logdepthbuf_fragment>
2295	#include <map_fragment>
2296	#include <color_fragment>
2297	#include <alphamap_fragment>
2298	#include <alphatest_fragment>
2299	#include <normal_fragment_begin>
2300	#include <normal_fragment_maps>
2301	#include <emissivemap_fragment>
2302	#include <lights_toon_fragment>
2303	#include <lights_fragment_begin>
2304	#include <lights_fragment_maps>
2305	#include <lights_fragment_end>
2306	#include <aomap_fragment>
2307	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
2308	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
2309	#include <tonemapping_fragment>
2310	#include <encodings_fragment>
2311	#include <fog_fragment>
2312	#include <premultiplied_alpha_fragment>
2313	#include <dithering_fragment>
2314}`,fb=`#define TOON
2315varying vec3 vViewPosition;
2316#ifndef FLAT_SHADED
2317	varying vec3 vNormal;
2318#endif
2319#include <common>
2320#include <uv_pars_vertex>
2321#include <uv2_pars_vertex>
2322#include <displacementmap_pars_vertex>
2323#include <color_pars_vertex>
2324#include <fog_pars_vertex>
2325#include <morphtarget_pars_vertex>
2326#include <skinning_pars_vertex>
2327#include <shadowmap_pars_vertex>
2328#include <logdepthbuf_pars_vertex>
2329#include <clipping_planes_pars_vertex>
2330void main() {
2331	#include <uv_vertex>
2332	#include <uv2_vertex>
2333	#include <color_vertex>
2334	#include <beginnormal_vertex>
2335	#include <morphnormal_vertex>
2336	#include <skinbase_vertex>
2337	#include <skinnormal_vertex>
2338	#include <defaultnormal_vertex>
2339#ifndef FLAT_SHADED
2340	vNormal = normalize( transformedNormal );
2341#endif
2342	#include <begin_vertex>
2343	#include <morphtarget_vertex>
2344	#include <skinning_vertex>
2345	#include <displacementmap_vertex>
2346	#include <project_vertex>
2347	#include <logdepthbuf_vertex>
2348	#include <clipping_planes_vertex>
2349	vViewPosition = - mvPosition.xyz;
2350	#include <worldpos_vertex>
2351	#include <shadowmap_vertex>
2352	#include <fog_vertex>
2353}`,pb=`#define PHONG
2354uniform vec3 diffuse;
2355uniform vec3 emissive;
2356uniform vec3 specular;
2357uniform float shininess;
2358uniform float opacity;
2359#include <common>
2360#include <packing>
2361#include <dithering_pars_fragment>
2362#include <color_pars_fragment>
2363#include <uv_pars_fragment>
2364#include <uv2_pars_fragment>
2365#include <map_pars_fragment>
2366#include <alphamap_pars_fragment>
2367#include <aomap_pars_fragment>
2368#include <lightmap_pars_fragment>
2369#include <emissivemap_pars_fragment>
2370#include <envmap_common_pars_fragment>
2371#include <envmap_pars_fragment>
2372#include <cube_uv_reflection_fragment>
2373#include <fog_pars_fragment>
2374#include <bsdfs>
2375#include <lights_pars_begin>
2376#include <lights_phong_pars_fragment>
2377#include <shadowmap_pars_fragment>
2378#include <bumpmap_pars_fragment>
2379#include <normalmap_pars_fragment>
2380#include <specularmap_pars_fragment>
2381#include <logdepthbuf_pars_fragment>
2382#include <clipping_planes_pars_fragment>
2383void main() {
2384	#include <clipping_planes_fragment>
2385	vec4 diffuseColor = vec4( diffuse, opacity );
2386	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2387	vec3 totalEmissiveRadiance = emissive;
2388	#include <logdepthbuf_fragment>
2389	#include <map_fragment>
2390	#include <color_fragment>
2391	#include <alphamap_fragment>
2392	#include <alphatest_fragment>
2393	#include <specularmap_fragment>
2394	#include <normal_fragment_begin>
2395	#include <normal_fragment_maps>
2396	#include <emissivemap_fragment>
2397	#include <lights_phong_fragment>
2398	#include <lights_fragment_begin>
2399	#include <lights_fragment_maps>
2400	#include <lights_fragment_end>
2401	#include <aomap_fragment>
2402	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
2403	#include <envmap_fragment>
2404	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
2405	#include <tonemapping_fragment>
2406	#include <encodings_fragment>
2407	#include <fog_fragment>
2408	#include <premultiplied_alpha_fragment>
2409	#include <dithering_fragment>
2410}`,mb=`#define PHONG
2411varying vec3 vViewPosition;
2412#ifndef FLAT_SHADED
2413	varying vec3 vNormal;
2414#endif
2415#include <common>
2416#include <uv_pars_vertex>
2417#include <uv2_pars_vertex>
2418#include <displacementmap_pars_vertex>
2419#include <envmap_pars_vertex>
2420#include <color_pars_vertex>
2421#include <fog_pars_vertex>
2422#include <morphtarget_pars_vertex>
2423#include <skinning_pars_vertex>
2424#include <shadowmap_pars_vertex>
2425#include <logdepthbuf_pars_vertex>
2426#include <clipping_planes_pars_vertex>
2427void main() {
2428	#include <uv_vertex>
2429	#include <uv2_vertex>
2430	#include <color_vertex>
2431	#include <beginnormal_vertex>
2432	#include <morphnormal_vertex>
2433	#include <skinbase_vertex>
2434	#include <skinnormal_vertex>
2435	#include <defaultnormal_vertex>
2436#ifndef FLAT_SHADED
2437	vNormal = normalize( transformedNormal );
2438#endif
2439	#include <begin_vertex>
2440	#include <morphtarget_vertex>
2441	#include <skinning_vertex>
2442	#include <displacementmap_vertex>
2443	#include <project_vertex>
2444	#include <logdepthbuf_vertex>
2445	#include <clipping_planes_vertex>
2446	vViewPosition = - mvPosition.xyz;
2447	#include <worldpos_vertex>
2448	#include <envmap_vertex>
2449	#include <shadowmap_vertex>
2450	#include <fog_vertex>
2451}`,gb=`#define STANDARD
2452#ifdef PHYSICAL
2453	#define REFLECTIVITY
2454	#define CLEARCOAT
2455	#define TRANSMISSION
2456#endif
2457uniform vec3 diffuse;
2458uniform vec3 emissive;
2459uniform float roughness;
2460uniform float metalness;
2461uniform float opacity;
2462#ifdef TRANSMISSION
2463	uniform float transmission;
2464#endif
2465#ifdef REFLECTIVITY
2466	uniform float reflectivity;
2467#endif
2468#ifdef CLEARCOAT
2469	uniform float clearcoat;
2470	uniform float clearcoatRoughness;
2471#endif
2472#ifdef USE_SHEEN
2473	uniform vec3 sheen;
2474#endif
2475varying vec3 vViewPosition;
2476#ifndef FLAT_SHADED
2477	varying vec3 vNormal;
2478	#ifdef USE_TANGENT
2479		varying vec3 vTangent;
2480		varying vec3 vBitangent;
2481	#endif
2482#endif
2483#include <common>
2484#include <packing>
2485#include <dithering_pars_fragment>
2486#include <color_pars_fragment>
2487#include <uv_pars_fragment>
2488#include <uv2_pars_fragment>
2489#include <map_pars_fragment>
2490#include <alphamap_pars_fragment>
2491#include <aomap_pars_fragment>
2492#include <lightmap_pars_fragment>
2493#include <emissivemap_pars_fragment>
2494#include <transmissionmap_pars_fragment>
2495#include <bsdfs>
2496#include <cube_uv_reflection_fragment>
2497#include <envmap_common_pars_fragment>
2498#include <envmap_physical_pars_fragment>
2499#include <fog_pars_fragment>
2500#include <lights_pars_begin>
2501#include <lights_physical_pars_fragment>
2502#include <shadowmap_pars_fragment>
2503#include <bumpmap_pars_fragment>
2504#include <normalmap_pars_fragment>
2505#include <clearcoat_pars_fragment>
2506#include <roughnessmap_pars_fragment>
2507#include <metalnessmap_pars_fragment>
2508#include <logdepthbuf_pars_fragment>
2509#include <clipping_planes_pars_fragment>
2510void main() {
2511	#include <clipping_planes_fragment>
2512	vec4 diffuseColor = vec4( diffuse, opacity );
2513	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2514	vec3 totalEmissiveRadiance = emissive;
2515	#ifdef TRANSMISSION
2516		float totalTransmission = transmission;
2517	#endif
2518	#include <logdepthbuf_fragment>
2519	#include <map_fragment>
2520	#include <color_fragment>
2521	#include <alphamap_fragment>
2522	#include <alphatest_fragment>
2523	#include <roughnessmap_fragment>
2524	#include <metalnessmap_fragment>
2525	#include <normal_fragment_begin>
2526	#include <normal_fragment_maps>
2527	#include <clearcoat_normal_fragment_begin>
2528	#include <clearcoat_normal_fragment_maps>
2529	#include <emissivemap_fragment>
2530	#include <transmissionmap_fragment>
2531	#include <lights_physical_fragment>
2532	#include <lights_fragment_begin>
2533	#include <lights_fragment_maps>
2534	#include <lights_fragment_end>
2535	#include <aomap_fragment>
2536	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
2537	#ifdef TRANSMISSION
2538		diffuseColor.a *= mix( saturate( 1. - totalTransmission + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) ), 1.0, metalness );
2539	#endif
2540	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
2541	#include <tonemapping_fragment>
2542	#include <encodings_fragment>
2543	#include <fog_fragment>
2544	#include <premultiplied_alpha_fragment>
2545	#include <dithering_fragment>
2546}`,xb=`#define STANDARD
2547varying vec3 vViewPosition;
2548#ifndef FLAT_SHADED
2549	varying vec3 vNormal;
2550	#ifdef USE_TANGENT
2551		varying vec3 vTangent;
2552		varying vec3 vBitangent;
2553	#endif
2554#endif
2555#include <common>
2556#include <uv_pars_vertex>
2557#include <uv2_pars_vertex>
2558#include <displacementmap_pars_vertex>
2559#include <color_pars_vertex>
2560#include <fog_pars_vertex>
2561#include <morphtarget_pars_vertex>
2562#include <skinning_pars_vertex>
2563#include <shadowmap_pars_vertex>
2564#include <logdepthbuf_pars_vertex>
2565#include <clipping_planes_pars_vertex>
2566void main() {
2567	#include <uv_vertex>
2568	#include <uv2_vertex>
2569	#include <color_vertex>
2570	#include <beginnormal_vertex>
2571	#include <morphnormal_vertex>
2572	#include <skinbase_vertex>
2573	#include <skinnormal_vertex>
2574	#include <defaultnormal_vertex>
2575#ifndef FLAT_SHADED
2576	vNormal = normalize( transformedNormal );
2577	#ifdef USE_TANGENT
2578		vTangent = normalize( transformedTangent );
2579		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
2580	#endif
2581#endif
2582	#include <begin_vertex>
2583	#include <morphtarget_vertex>
2584	#include <skinning_vertex>
2585	#include <displacementmap_vertex>
2586	#include <project_vertex>
2587	#include <logdepthbuf_vertex>
2588	#include <clipping_planes_vertex>
2589	vViewPosition = - mvPosition.xyz;
2590	#include <worldpos_vertex>
2591	#include <shadowmap_vertex>
2592	#include <fog_vertex>
2593}
2593`,yb=`#define NORMAL
2594uniform float opacity;
2595#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
2596	varying vec3 vViewPosition;
2597#endif
2598#ifndef FLAT_SHADED
2599	varying vec3 vNormal;
2600	#ifdef USE_TANGENT
2601		varying vec3 vTangent;
2602		varying vec3 vBitangent;
2603	#endif
2604#endif
2605#include <packing>
2606#include <uv_pars_fragment>
2607#include <bumpmap_pars_fragment>
2608#include <normalmap_pars_fragment>
2609#include <logdepthbuf_pars_fragment>
2610#include <clipping_planes_pars_fragment>
2611void main() {
2612	#include <clipping_planes_fragment>
2613	#include <logdepthbuf_fragment>
2614	#include <normal_fragment_begin>
2615	#include <normal_fragment_maps>
2616	gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
2617}`,vb=`#define NORMAL
2618#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
2619	varying vec3 vViewPosition;
2620#endif
2621#ifndef FLAT_SHADED
2622	varying vec3 vNormal;
2623	#ifdef USE_TANGENT
2624		varying vec3 vTangent;
2625		varying vec3 vBitangent;
2626	#endif
2627#endif
2628#include <common>
2629#include <uv_pars_vertex>
2630#include <displacementmap_pars_vertex>
2631#include <morphtarget_pars_vertex>
2632#include <skinning_pars_vertex>
2633#include <logdepthbuf_pars_vertex>
2634#include <clipping_planes_pars_vertex>
2635void main() {
2636	#include <uv_vertex>
2637	#include <beginnormal_vertex>
2638	#include <morphnormal_vertex>
2639	#include <skinbase_vertex>
2640	#include <skinnormal_vertex>
2641	#include <defaultnormal_vertex>
2642#ifndef FLAT_SHADED
2643	vNormal = normalize( transformedNormal );
2644	#ifdef USE_TANGENT
2645		vTangent = normalize( transformedTangent );
2646		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
2647	#endif
2648#endif
2649	#include <begin_vertex>
2650	#include <morphtarget_vertex>
2651	#include <skinning_vertex>
2652	#include <displacementmap_vertex>
2653	#include <project_vertex>
2654	#include <logdepthbuf_vertex>
2655	#include <clipping_planes_vertex>
2656#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )
2657	vViewPosition = - mvPosition.xyz;
2658#endif
2659}`,bb=`uniform vec3 diffuse;
2660uniform float opacity;
2661#include <common>
2662#include <color_pars_fragment>
2663#include <map_particle_pars_fragment>
2664#include <fog_pars_fragment>
2665#include <logdepthbuf_pars_fragment>
2666#include <clipping_planes_pars_fragment>
2667void main() {
2668	#include <clipping_planes_fragment>
2669	vec3 outgoingLight = vec3( 0.0 );
2670	vec4 diffuseColor = vec4( diffuse, opacity );
2671	#include <logdepthbuf_fragment>
2672	#include <map_particle_fragment>
2673	#include <color_fragment>
2674	#include <alphatest_fragment>
2675	outgoingLight = diffuseColor.rgb;
2676	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
2677	#include <tonemapping_fragment>
2678	#include <encodings_fragment>
2679	#include <fog_fragment>
2680	#include <premultiplied_alpha_fragment>
2681}`,wb=`uniform float size;
2682uniform float scale;
2683#include <common>
2684#include <color_pars_vertex>
2685#include <fog_pars_vertex>
2686#include <morphtarget_pars_vertex>
2687#include <logdepthbuf_pars_vertex>
2688#include <clipping_planes_pars_vertex>
2689void main() {
2690	#include <color_vertex>
2691	#include <begin_vertex>
2692	#include <morphtarget_vertex>
2693	#include <project_vertex>
2694	gl_PointSize = size;
2695	#ifdef USE_SIZEATTENUATION
2696		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
2697		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
2698	#endif
2699	#include <logdepthbuf_vertex>
2700	#include <clipping_planes_vertex>
2701	#include <worldpos_vertex>
2702	#include <fog_vertex>
2703}`,Mb=`uniform vec3 color;
2704uniform float opacity;
2705#include <common>
2706#include <packing>
2707#include <fog_pars_fragment>
2708#include <bsdfs>
2709#include <lights_pars_begin>
2710#include <shadowmap_pars_fragment>
2711#include <shadowmask_pars_fragment>
2712void main() {
2713	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
2714	#include <tonemapping_fragment>
2715	#include <encodings_fragment>
2716	#include <fog_fragment>
2717}`,_b=`#include <common>
2718#include <fog_pars_vertex>
2719#include <shadowmap_pars_vertex>
2720void main() {
2721	#include <begin_vertex>
2722	#include <project_vertex>
2723	#include <worldpos_vertex>
2724	#include <beginnormal_vertex>
2725	#include <morphnormal_vertex>
2726	#include <skinbase_vertex>
2727	#include <skinnormal_vertex>
2728	#include <defaultnormal_vertex>
2729	#include <shadowmap_vertex>
2730	#include <fog_vertex>
2731}`,Sb=`uniform vec3 diffuse;
2732uniform float opacity;
2733#include <common>
2734#include <uv_pars_fragment>
2735#include <map_pars_fragment>
2736#include <alphamap_pars_fragment>
2737#include <fog_pars_fragment>
2738#include <logdepthbuf_pars_fragment>
2739#include <clipping_planes_pars_fragment>
2740void main() {
2741	#include <clipping_planes_fragment>
2742	vec3 outgoingLight = vec3( 0.0 );
2743	vec4 diffuseColor = vec4( diffuse, opacity );
2744	#include <logdepthbuf_fragment>
2745	#include <map_fragment>
2746	#include <alphamap_fragment>
2747	#include <alphatest_fragment>
2748	outgoingLight = diffuseColor.rgb;
2749	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
2750	#include <tonemapping_fragment>
2751	#include <encodings_fragment>
2752	#include <fog_fragment>
2753}`,Tb=`uniform float rotation;
2754uniform vec2 center;
2755#include <common>
2756#include <uv_pars_vertex>
2757#include <fog_pars_vertex>
2758#include <logdepthbuf_pars_vertex>
2759#include <clipping_planes_pars_vertex>
2760void main() {
2761	#include <uv_vertex>
2762	vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
2763	vec2 scale;
2764	scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
2765	scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
2766	#ifndef USE_SIZEATTENUATION
2767		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
2768		if ( isPerspective ) scale *= - mvPosition.z;
2769	#endif
2770	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
2771	vec2 rotatedPosition;
2772	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
2773	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
2774	mvPosition.xy += rotatedPosition;
2775	gl_Position = projectionMatrix * mvPosition;
2776	#include <logdepthbuf_vertex>
2777	#include <clipping_planes_vertex>
2778	#include <fog_vertex>
2779}`;const He={alphamap_fragment:ry,alphamap_pars_fragment:oy,alphatest_fragment:ay,aomap_fragment:ly,aomap_pars_fragment:cy,begin_vertex:hy,beginnormal_vertex:uy,bsdfs:dy,bumpmap_pars_fragment:fy,clipping_planes_fragment:py,clipping_planes_pars_fragment:my,clipping_planes_pars_vertex:gy,clipping_planes_vertex:xy,color_fragment:yy,color_pars_fragment:vy,color_pars_vertex:by,color_vertex:wy,common:My,cube_uv_reflection_fragment:_y,defaultnormal_vertex:Sy,displacementmap_pars_vertex:Ty,displacementmap_vertex:Ey,emissivemap_fragment:Ay,emissivemap_pars_fragment:Ly,encodings_fragment:Cy,encodings_pars_fragment:Ry,envmap_fragment:Py,envmap_common_pars_fragment:Iy,envmap_pars_fragment:By,envmap_pars_vertex:Dy,envmap_physical_pars_fragment:qy,envmap_vertex:ky,fog_vertex:Ny,fog_pars_vertex:zy,fog_fragment:Fy,fog_pars_fragment:Oy,gradientmap_pars_fragment:Hy,lightmap_fragment:Uy,lightmap_pars_fragment:Gy,lights_lambert_vertex:Wy,lights_pars_begin:Vy,lights_toon_fragment:jy,lights_toon_pars_fragment:Xy,lights_phong_fragment:Yy,lights_phong_pars_fragment:Zy,lights_physical_fragment:Ky,lights_physical_pars_fragment:Jy,lights_fragment_begin:Qy,lights_fragment_maps:$y,lights_fragment_end:ev,logdepthbuf_fragment:tv,logdepthbuf_pars_fragment:nv,logdepthbuf_pars_vertex:iv,logdepthbuf_vertex:sv,map_fragment:rv,map_pars_fragment:ov,map_particle_fragment:av,map_particle_pars_fragment:lv,metalnessmap_fragment:cv,metalnessmap_pars_fragment:hv,morphnormal_vertex:uv,morphtarget_pars_vertex:dv,morphtarget_vertex:fv,normal_fragment_begin:pv,normal_fragment_maps:mv,normalmap_pars_fragment:gv,clearcoat_normal_fragment_begin:xv,clearcoat_normal_fragment_maps:yv,clearcoat_pars_fragment:vv,packing:bv,premultiplied_alpha_fragment:wv,project_vertex:Mv,dithering_fragment:_v,dithering_pars_fragment:Sv,roughnessmap_fragment:Tv,roughnessmap_pars_fragment:Ev,shadowmap_pars_fragment:Av,shadowmap_pars_vertex:Lv,shadowmap_vertex:Cv,shadowmask_pars_fragment:Rv,skinbase_vertex:Pv,skinning_pars_vertex:Iv,skinning_vertex:Bv,skinnormal_vertex:Dv,specularmap_fragment:kv,specularmap_pars_fragment:Nv,tonemapping_fragment:zv,tonemapping_pars_fragment:Fv,transmissionmap_fragment:Ov,transmissionmap_pars_fragment:Hv,uv_pars_fragment:Uv,uv_pars_vertex:Gv,uv_vertex:Wv,uv2_pars_fragment:Vv,uv2_pars_vertex:qv,uv2_vertex:jv,worldpos_vertex:Xv,background_frag:Yv,background_vert:Zv,cube_frag:Kv,cube_vert:Jv,depth_frag:Qv,depth_vert:$v,distanceRGBA_frag:eb,distanceRGBA_vert:tb,equirect_frag:nb,equirect_vert:ib,linedashed_frag:sb,linedashed_vert:rb,meshbasic_frag:ob,meshbasic_vert:ab,meshlambert_frag:lb,meshlambert_vert:cb,meshmatcap_frag:hb,meshmatcap_vert:ub,meshtoon_frag:db,meshtoon_vert:fb,meshphong_frag:pb,meshphong_vert:mb,meshphysical_frag:gb,meshphysical_vert:xb,normal_frag:yb,normal_vert:vb,points_frag:bb,points_vert:wb,shadow_frag:Mb,shadow_vert:_b,sprite_frag:Sb,sprite_vert:Tb},ue={common:{diffuse:{value:new pe(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new Ht},uv2Transform:{value:new Ht},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new $(1,1)}}
vendor: 5,307 bytes, line 2779
2779,displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new pe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new pe(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Ht}},sprite:{diffuse:{value:new pe(15658734)},opacity:{value:1},center:{value:new $(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new Ht}}},zn={basic:{uniforms:Wt([ue.common,ue.specularmap,ue.envmap,ue.aomap,ue.lightmap,ue.fog]),vertexShader:He.meshbasic_vert,fragmentShader:He.meshbasic_frag},lambert:{uniforms:Wt([ue.common,ue.specularmap,ue.envmap,ue.aomap,ue.lightmap,ue.emissivemap,ue.fog,ue.lights,{emissive:{value:new pe(0)}}]),vertexShader:He.meshlambert_vert,fragmentShader:He.meshlambert_frag},phong:{uniforms:Wt([ue.common,ue.specularmap,ue.envmap,ue.aomap,ue.lightmap,ue.emissivemap,ue.bumpmap,ue.normalmap,ue.displacementmap,ue.fog,ue.lights,{emissive:{value:new pe(0)},specular:{value:new pe(1118481)},shininess:{value:30}}]),vertexShader:He.meshphong_vert,fragmentShader:He.meshphong_frag},standard:{uniforms:Wt([ue.common,ue.envmap,ue.aomap,ue.lightmap,ue.emissivemap,ue.bumpmap,ue.normalmap,ue.displacementmap,ue.roughnessmap,ue.metalnessmap,ue.fog,ue.lights,{emissive:{value:new pe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:He.meshphysical_vert,fragmentShader:He.meshphysical_frag},toon:{uniforms:Wt([ue.common,ue.aomap,ue.lightmap,ue.emissivemap,ue.bumpmap,ue.normalmap,ue.displacementmap,ue.gradientmap,ue.fog,ue.lights,{emissive:{value:new pe(0)}}]),vertexShader:He.meshtoon_vert,fragmentShader:He.meshtoon_frag},matcap:{uniforms:Wt([ue.common,ue.bumpmap,ue.normalmap,ue.displacementmap,ue.fog,{matcap:{value:null}}]),vertexShader:He.meshmatcap_vert,fragmentShader:He.meshmatcap_frag},points:{uniforms:Wt([ue.points,ue.fog]),vertexShader:He.points_vert,fragmentShader:He.points_frag},dashed:{uniforms:Wt([ue.common,ue.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:He.linedashed_vert,fragmentShader:He.linedashed_frag},depth:{uniforms:Wt([ue.common,ue.displacementmap]),vertexShader:He.depth_vert,fragmentShader:He.depth_frag},normal:{uniforms:Wt([ue.common,ue.bumpmap,ue.normalmap,ue.displacementmap,{opacity:{value:1}}]),vertexShader:He.normal_vert,fragmentShader:He.normal_frag},sprite:{uniforms:Wt([ue.sprite,ue.fog]),vertexShader:He.sprite_vert,fragmentShader:He.sprite_frag},background:{uniforms:{uvTransform:{value:new Ht},t2D:{value:null}},vertexShader:He.background_vert,fragmentShader:He.background_frag},cube:{uniforms:Wt([ue.envmap,{opacity:{value:1}}]),vertexShader:He.cube_vert,fragmentShader:He.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:He.equirect_vert,fragmentShader:He.equirect_frag},distanceRGBA:{uniforms:Wt([ue.common,ue.displacementmap,{referencePosition:{value:new S},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:He.distanceRGBA_vert,fragmentShader:He.distanceRGBA_frag},shadow:{uniforms:Wt([ue.lights,ue.fog,{color:{value:new pe(0)},opacity:{value:1}}]),vertexShader:He.shadow_vert,fragmentShader:He.shadow_frag}};zn.physical={uniforms:Wt([zn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new $(1,1)},clearcoatNormalMap:{value:null},sheen:{value:new pe(0)},transmission:{value:0},transmissionMap:{value:null}}]),vertexShader:He.meshphysical_vert,fragmentShader:He.meshphysical_frag};function Eb(n,e,t,i,s){const r=new pe(0);let o=0,a,c,l=null,u=0,h=null;function d(p,b,w,v){let y=b.isScene===!0?b.background:null;y&&y.isTexture&&(y=e.get(y));const E=n.xr,L=E.getSession&&E.getSession();L&&L.environmentBlendMode==="additive"&&(y=null),y===null?f(r,o):y&&y.isColor&&(f(y,1),v=!0),(n.autoClear||v)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),y&&(y.isCubeTexture||y.mapping===el)?(c===void 0&&(c=new X(new wt(1,1,1),new Ut({name:"Backgroun
2779dCubeMaterial",uniforms:ar(zn.cube.uniforms),vertexShader:zn.cube.vertexShader,fragmentShader:zn.cube.fragmentShader,side:Pt,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(C,_,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),c.material.uniforms.envMap.value=y,c.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y._needsFlipEnvMap?-1:1,(l!==y||u!==y.version||h!==n.toneMapping)&&(c.material.needsUpdate=!0,l=y,u=y.version,h=n.toneMapping),p.unshift(c,c.geometry,c.material,0,0,null)):y&&y.isTexture&&(a===void 0&&(a=new X(new Qt(2,2),new Ut({name:"BackgroundMaterial",uniforms:ar(zn.background.uniforms),vertexShader:zn.background.vertexShader,fragmentShader:zn.background.fragmentShader,side:_o,depthTest:!1,depthWrite:!1,fog:!1})),a.geometry.deleteAttribute("normal"),Object.defineProperty(a.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(a)),a.material.uniforms.t2D.value=y,y.matrixAutoUpdate===!0&&y.updateMatrix(),a.material.uniforms.uvTransform.value.copy(y.matrix),(l!==y||u!==y.version||h!==n.toneMapping)&&(a.material.needsUpdate=!0,l=y,u=y.version,h=n.toneMapping),p.unshift(a,a.geometry,a.material,0,0,null))}function f(p,b){t.buffers.color.setClear(p.r,p.g,p.b,b,s)}return{getClearColor:function(){return r},setClearColor:function(p,b=1){r.set(p),o=b,f(r,o)},getClearAlpha:function(){return o},setClearAlpha:function(p){o=p,f(r,o)},render:d}}
2779function Ab(n,e,t,i){const s=n.getParameter(34921),r=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||r!==null,a={},c=b(null);let l=c;function u(k,O,U,z,ne){let ce=!1;if(o){const re=p(z,U,O);l!==re&&(l=re,d(l.object)),ce=w(z,ne),ce&&v(z,ne)}else{const re=O.wireframe===!0;(l.geometry!==z.id||l.program!==U.id||l.wireframe!==re)&&(l.geometry=z.id,l.program=U.id,l.wireframe=re,ce=!0)}k.isInstancedMesh===!0&&(ce=!0),ne!==null&&t.update(ne,34963),ce&&(D(k,O,U,z),ne!==null&&n.bindBuffer(34963,t.get(ne).buffer))}function h(){return i.isWebGL2?n.createVertexArray():r.createVertexArrayOES()}function d(k){return i.isWebGL2?n.bindVertexArray(k):r.bindVertexArrayOES(k)}function f(k){return i.isWebGL2?n.deleteVertexArray(k):r.deleteVertexArrayOES(k)}function p(k,O,U){const z=U.wireframe===!0;let ne=a[k.id];ne===void 0&&(ne={},a[k.id]=ne);let ce=ne[O.id];ce===void 0&&(ce={},ne[O.id]=ce);let re=ce[z];return re===void 0&&(re=b(h()),ce[z]=re),re}function b(k){const O=[],U=[],z=[];for(let ne=0;ne<s;ne++)O[ne]=0,U[ne]=0,z[ne]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:O,enabledAttributes:U,attributeDivisors:z,object:k,attributes:{},index:null}}function w(k,O){const U=l.attributes,z=k.attributes;let ne=0;for(const ce in z){const re=U[ce],ge=z[ce];if(re===void 0||re.attribute!==ge||re.data!==ge.data)return!0;ne++}return l.attributesNum!==ne||l.index!==O}function v(k,O){const U={},z=k.attributes;let ne=0;for(const ce in z){const re=z[ce],ge={};ge.attribute=re,re.data&&(ge.data=re.data),U[ce]=ge,ne++}l.attributes=U,l.attributesNum=ne,l.index=O}function y(){const k=l.newAttributes;for(let O=0,U=k.length;O<U;O++)k[O]=0}function E(k){L(k,0)}function L(k,O){const U=l.newAttributes,z=l.enabledAttributes,ne=l.attributeDivisors;U[k]=1,z[k]===0&&(n.enableVertexAttribArray(k),z[k]=1),ne[k]!==O&&((i.isWebGL2?n:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](k,O),ne[k]=O)}function C(){const k=l.newAttributes,O=l.enabledAttributes;for(let U=0,z=O.length;U<z;U++)O[U]!==k[U]&&(n.disableVertexAttribArray(U),O[U]=0)}function _(k,O,U,z,ne,ce){i.isWebGL2===!0&&(U===5124||U===5125)?n.vertexAttribIPointer(k,O,U,ne,ce):n.vertexAttribPointer(k,O,U,z,ne,ce)}
2779function D(k,O,U,z){if(i.isWebGL2===!1&&(k.isInstancedMesh||z.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;y();const ne=z.attributes,ce=U.getAttributes(),re=O.defaultAttributeValues;for(const ge in ce){const ie=ce[ge];if(ie>=0){const ye=ne[ge];if(ye!==void 0){const Se=ye.normalized,Q=ye.itemSize,et=t.get(ye);if(et===void 0)continue;const Ue=et.buffer,Te=et.type,Me=et.bytesPerElement;if(ye.isInterleavedBufferAttribute){const Ge=ye.data,Be=Ge.stride,Oe=ye.offset;Ge&&Ge.isInstancedInterleavedBuffer?(L(ie,Ge.meshPerAttribute),z._maxInstanceCount===void 0&&(z._maxInstanceCount=Ge.meshPerAttribute*Ge.count)):E(ie),n.bindBuffer(34962,Ue),_(ie,Q,Te,Se,Be*Me,Oe*Me)}else ye.isInstancedBufferAttribute?(L(ie,ye.meshPerAttribute),z._maxInstanceCount===void 0&&(z._maxInstanceCount=ye.meshPerAttribute*ye.count)):E(ie),n.bindBuffer(34962,Ue),_(ie,Q,Te,Se,0,0)}else if(ge==="instanceMatrix"){const Se=t.get(k.instanceMatrix);if(Se===void 0)continue;const Q=Se.buffer,et=Se.type;L(ie+0,1),L(ie+1,1),L(ie+2,1),L(ie+3,1),n.bindBuffer(34962,Q),n.vertexAttribPointer(ie+0,4,et,!1,64,0),n.vertexAttribPointer(ie+1,4,et,!1,64,16),n.vertexAttribPointer(ie+2,4,et,!1,64,32),n.vertexAttribPointer(ie+3,4,et,!1,64,48)}else if(ge==="instanceColor"){const Se=t.get(k.instanceColor);if(Se===void 0)continue;const Q=Se.buffer,et=Se.type;L(ie,1),n.bindBuffer(34962,Q),n.vertexAttribPointer(ie,3,et,!1,12,0)}else if(re!==void 0){const Se=re[ge];if(Se!==void 0)switch(Se.length){case 2:n.vertexAttrib2fv(ie,Se);break;case 3:n.vertexAttrib3fv(ie,Se);break;case 4:n.vertexAttrib4fv(ie,Se);break;default:n.vertexAttrib1fv(ie,Se)}}}}C()}function F(){Z();for(const k in a){const O=a[k];for(const U in O){const z=O[U];for(const ne in z)f(z[ne].object),delete z[ne];delete O[U]}delete a[k]}}function H(k){if(a[k.id]===void 0)return;const O=a[k.id];for(const U in O){const z=O[U];for(const ne in z)f(z[ne].object),delete z[ne];delete O[U]}delete a[k.id]}function W(k){for(const O in a){const U=a[O];if(U[k.id]===void 0)continue;const z=U[k.id];for(const ne in z)f(z[ne].object),delete z[ne];delete U[k.id]}}function Z(){q(),l!==c&&(l=c,d(l.object))}function q(){c.geometry=null,c.program=null,c.wireframe=!1}return{setup:u,reset:Z,resetDefaultState:q,dispose:F,releaseStatesOfGeometry:H,releaseStatesOfProgram:W,initAttributes:y,enableAttribute:E,disableUnusedAttributes:C}}function Lb(n,e,t,i){const s=i.isWebGL2;let r;function o(l){r=l}function a(l,u){n.drawArrays(r,l,u),t.update(u,r,1)}function c(l,u,h){if(h===0)return;let d,f;if(s)d=n,f="drawArraysInstanced";else if(d=e.get("ANGLE_instanced_arrays"),f="drawArraysInstancedANGLE",d===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}d[f](r,l,u,h),t.update(u,r,h)}this.setMode=o,this.render=a,this.renderInstances=c}function Cb(n,e,t){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const _=e.get("EXT_texture_filter_anisotropic");i=n.getParameter(_.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function r(_){if(_==="highp"){if(n.getShaderPrecisionFormat(35633,36338).precision>0&&n.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";_="mediump"}return _==="mediump"&&n.getShaderPrecisionFormat(35633,36337).precision>0&&n.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext<"u"&&n instanceof WebGL2ComputeRenderingContext;let a=t.precision!==void 0?t.precision:"highp";const c=r(a);c!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",c,"instead."),a=c);const l=t.logarithmicDepthBuffer===!0,u=n.getParameter(34930),h=n.getParameter(35660),d=n.getParameter(3379),f=n.getParameter(34076),p=n.getParameter(34921),b=n.getParameter(36347),w=n.getParameter(36348),v=n.getParameter(36349),y=h>0,E=o||e.has("OES_texture_float"),L=y&&E,C=o?n.getParameter(36183):0;return{isWebGL2:o,getMaxAnisotropy:s,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:l,maxTextures:u,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:f,maxAttributes:p,maxVertexUniforms:b,maxVaryings:w,maxFragmentUniforms:v,vertexTextures:y,floatFragmentTextures:E,floatVertexTextures:L,maxSamples:C}}function Rb(n){const e=this;let t=null,i=0,s=!1,r=!1;const o=new Sn,a=new Ht,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d,f){const p=h.length!==0||d||i!==0||s;return s=d,t=u(h,f,0),i=h.length,p},this.beginShadows=function(){r=!0,u(null)}
vendor: 8,174 bytes, line 2779
2779,this.endShadows=function(){r=!1,l()},this.setState=function(h,d,f){const p=h.clippingPlanes,b=h.clipIntersection,w=h.clipShadows,v=n.get(h);if(!s||p===null||p.length===0||r&&!w)r?u(null):l();else{const y=r?0:i,E=y*4;let L=v.clippingState||null;c.value=L,L=u(p,d,E,f);for(let C=0;C!==E;++C)L[C]=t[C];v.clippingState=L,this.numIntersection=b?this.numPlanes:0,this.numPlanes+=y}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(h,d,f,p){const b=h!==null?h.length:0;let w=null;if(b!==0){if(w=c.value,p!==!0||w===null){const v=f+b*4,y=d.matrixWorldInverse;a.getNormalMatrix(y),(w===null||w.length<v)&&(w=new Float32Array(v));for(let E=0,L=f;E!==b;++E,L+=4)o.copy(h[E]).applyMatrix4(y,a),o.normal.toArray(w,L),w[L+3]=o.constant}c.value=w,c.needsUpdate=!0}return e.numPlanes=b,e.numIntersection=0,w}}function Pb(n){let e=new WeakMap;function t(o,a){return a===pu?o.mapping=Jc:a===mu&&(o.mapping=Qc),o}function i(o){if(o&&o.isTexture){const a=o.mapping;if(a===pu||a===mu)if(e.has(o)){const c=e.get(o).texture;return t(c,o.mapping)}else{const c=o.image;if(c&&c.height>0){const l=n.getRenderTarget(),u=new bp(c.height/2);return u.fromEquirectangularTexture(n,o),e.set(o,u),n.setRenderTarget(l),o.addEventListener("dispose",s),t(u.texture,o.mapping)}else return null}}return o}function s(o){const a=o.target;a.removeEventListener("dispose",s);const c=e.get(a);c!==void 0&&(e.delete(a),c.dispose())}function r(){e=new WeakMap}return{get:i,dispose:r}}function Ib(n){const e={};function t(i){if(e[i]!==void 0)return e[i];let s;switch(i){case"WEBGL_depth_texture":s=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":s=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":s=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":s=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:s=n.getExtension(i)}return e[i]=s,s}return{has:function(i){return t(i)!==null},init:function(i){i.isWebGL2?t("EXT_color_buffer_float"):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float")},get:function(i){const s=t(i);return s===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),s}}}function Bb(n,e,t,i){const s={},r=new WeakMap;function o(h){const d=h.target;d.index!==null&&e.remove(d.index);for(const p in d.attributes)e.remove(d.attributes[p]);d.removeEventListener("dispose",o),delete s[d.id];const f=r.get(d);f&&(e.remove(f),r.delete(d)),i.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function a(h,d){return s[d.id]===!0||(d.addEventListener("dispose",o),s[d.id]=!0,t.memory.geometries++),d}function c(h){const d=h.attributes;for(const p in d)e.update(d[p],34962);const f=h.morphAttributes;for(const p in f){const b=f[p];for(let w=0,v=b.length;w<v;w++)e.update(b[w],34962)}}function l(h){const d=[],f=h.index,p=h.attributes.position;let b=0;if(f!==null){const y=f.array;b=f.version;for(let E=0,L=y.length;E<L;E+=3){const C=y[E+0],_=y[E+1],D=y[E+2];d.push(C,_,_,D,D,C)}}else{const y=p.array;b=p.version;for(let E=0,L=y.length/3-1;E<L;E+=3){const C=E+0,_=E+1,D=E+2;d.push(C,_,_,D,D,C)}}const w=new(vp(d)>65535?yp:xp)(d,1);w.version=b;const v=r.get(h);v&&e.remove(v),r.set(h,w)}function u(h){const d=r.get(h);if(d){const f=h.index;f!==null&&d.version<f.version&&l(h)}else l(h);return r.get(h)}return{get:a,update:c,getWireframeAttribute:u}}function Db(n,e,t,i){const s=i.isWebGL2;let r;function o(d){r=d}let a,c;function l(d){a=d.type,c=d.bytesPerElement}function u(d,f){n.drawElements(r,f,a,d*c),t.update(f,r,1)}function h(d,f,p){if(p===0)return;let b,w;if(s)b=n,w="drawElementsInstanced";else if(b=e.get("ANGLE_instanced_arrays"),w="drawElementsInstancedANGLE",b===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}b[w](r,f,a,d*c,p),t.update(f,r,p)}this.setMode=o,this.setIndex=l,this.render=u,this.renderInstances=h}function kb(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(r,o,a){switch(t.calls++,o){case 4:t.triangles+=a*(r/3);break;case 1:t.lines+=a*(r/2);break;case 3:t.lines+=a*(r-1);break;case 2:t.lines+=a*r;break;case 0:t.points+=a*r;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function s(){t.frame++,t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:s,update:i}}function Nb(n,e){return n[0]-e[0]}function zb(n,e){return Math.abs(e[1])-Math.abs(n[1])}function Fb(n){const e={},t=new Float32Array(8),i=[];for(let r=0;r<8;r++)i[r]=[r,0];function s(r,o,a,c){const l=r.morphTargetInfluences,u=l===void 0?0:l.length;let h=e[o.id];if(h===void 0){h=[];for(let w=0;w<u;w++)h[w]=[w,0];e[o.id]=h}for(let w=0;w<u;w++){const v=h[w];v[0]=w,v[1]=l[w]}h.sort(zb);for(let w=0;w<8;w++)w<u&&h[w][1]?(i[w][0]=h[w][0],i[w][1]=h[w][1]):(i[w][0]=Number.MAX_SAFE_INTEGER,i[w][1]=0);i.sort(Nb);const d=a.morphTargets&&o.morphAttributes.position,f=a.morphNormals&&o.morphAttributes.normal;let p=0;for(let w=0;w<8;w++){const v=i[w],y=v[0],E=v[1];y!==Number.MAX_SAFE_INTEGER&&E?(d&&o.getAttribute("morphTarget"+w)!==d[y]&&o.setAttribute("morphTarget"+w,d[y]),f&&o.getAttribute("morphNormal"+w)!==f[y]&&o.setAttribute("morphNormal"+w,f[y]),t[w]=E,p+=E):(d&&o.hasAttribute("morphTarget"+w)===!0&&o.deleteAttribute("morphTarget"+w),f&&o.hasAttribute("morphNormal"+w)===!0&&o.deleteAttribute("morphNormal"+w),t[w]=0)}const b=o.morphTargetsRelative?1:1-p;c.getUniforms().setValue(n,"morphTargetBaseInfluence",b),c.getUniforms().setValue(n,"morphTargetInfluences",t)}return{update:s}}function Ob(n,e,t,i){let s=new WeakMap;function r(c){const l=i.render.frame,u=c.geometry,h=e.get(c,u);return s.get(h)!==l&&(e.update(h),s.set(h,l)),c.isInstancedMesh&&(c.hasEventListener("dispose",a)===!1&&c.addEventListener("dispose",a),t.update(c.instanceMatrix,34962),c.instanceColor!==null&&t.update(c.instanceColor,34962)),h}function o(){s=new WeakMap}function a(c){const l=c.target;l.removeEventListener("dispose",a),t.remove(l.instanceMatrix),l.instanceColor!==null&&t.remove(l.instanceColor)}return{update:r,dispose:o}}class Mp extends kt{constructor(e=null,t=1,i=1,s=1){super(null),this.image={data:e,width:t,height:i,depth:s},this.magFilter=vt,this.minFilter=vt,this.wrapR=mn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}Mp.prototype.isDataTexture2DArray=!0;class _p extends kt{constructor(e=null,t=1,i=1,s=1){super(null),this.image={data:e,width:t,height:i,depth:s},this.magFilter=vt,this.minFilter=vt,this.wrapR=mn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}_p.prototype.isDataTexture3D=!0;const Sp=new kt,Hb=new Mp,Ub=new _p,Tp=new tl,Fu=[],Ou=[],Hu=new Float32Array(16),Uu=new Float32Array(9),Gu=new Float32Array(4);function br(n,e,t){const i=n[0];if(i<=0||i>0)return n;const s=e*t;let r=Fu[s];if(r===void 0&&(r=new Float32Array(s),Fu[s]=r),e!==0){i.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(r,a)}return r}function en(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function Xt(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function Ep(n,e){let t=Ou[e];t===void 0&&(t=new Int32Array(e),Ou[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function Gb(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function Wb(n,e){const t=this.cache;
2779if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(en(t,e))return;n.uniform2fv(this.addr,e),Xt(t,e)}}function Vb(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.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)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(en(t,e))return;n.uniform3fv(this.addr,e),Xt(t,e)}}function qb(n,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)&&(n.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(en(t,e))return;n.uniform4fv(this.addr,e),Xt(t,e)}}function jb(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(en(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),Xt(t,e)}else{if(en(t,i))return;Gu.set(i),n.uniformMatrix2fv(this.addr,!1,Gu),Xt(t,i)}}function Xb(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(en(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),Xt(t,e)}else{if(en(t,i))return;Uu.set(i),n.uniformMatrix3fv(this.addr,!1,Uu),Xt(t,i)}}function Yb(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(en(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),Xt(t,e)}else{if(en(t,i))return;Hu.set(i),n.uniformMatrix4fv(this.addr,!1,Hu),Xt(t,i)}}function Zb(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function Kb(n,e){const t=this.cache;en(t,e)||(n.uniform2iv(this.addr,e),Xt(t,e))}function Jb(n,e){const t=this.cache;en(t,e)||(n.uniform3iv(this.addr,e),Xt(t,e))}function Qb(n,e){const t=this.cache;en(t,e)||(n.uniform4iv(this.addr,e),Xt(t,e))}function $b(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function ew(n,e){const t=this.cache;en(t,e)||(n.uniform2uiv(this.addr,e),Xt(t,e))}function tw(n,e){const t=this.cache;en(t,e)||(n.uniform3uiv(this.addr,e),Xt(t,e))}function nw(n,e){const t=this.cache;en(t,e)||(n.uniform4uiv(this.addr,e),Xt(t,e))}function iw(n,e,t){const i=this.cache,s=t.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s),t.safeSetTexture2D(e||Sp,s)}function sw(n,e,t){const i=this.cache,s=t.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s),t.setTexture3D(e||Ub,s)}function rw(n,e,t){const i=this.cache,s=t.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s),t.safeSetTextureCube(e||Tp,s)}function ow(n,e,t){const i=this.cache,s=t.allocateTextureUnit();i[0]!==s&&(n.uniform1i(this.addr,s),i[0]=s),t.setTexture2DArray(e||Hb,s)}function aw(n){switch(n){case 5126:return Gb;case 35664:return Wb;case 35665:return Vb;case 35666:return qb;case 35674:return jb;case 35675:return Xb;case 35676:return Yb;case 5124:case 35670:return Zb;case 35667:case 35671:return Kb;case 35668:case 35672:return Jb;case 35669:case 35673:return Qb;case 5125:return $b;case 36294:return ew;case 36295:return tw;case 36296:return nw;case 35678:case 36198:case 36298:case 36306:case 35682:return iw;case 35679:case 36299:case 36307:return sw;case 35680:case 36300:case 36308:case 36293:return rw;case 36289:case 36303:case 36311:case 36292:return ow}}function lw(n,e){n.uniform1fv(this.addr,e)}function cw(n,e){const t=br(e,this.size,2);n.uniform2fv(this.addr,t)}function hw(n,e){const t=br(e,this.size,3);n.uniform3fv(this.addr,t)}function uw(n,e){const t=br(e,this.size,4);n.uniform4fv(this.addr,t)}function dw(n,e){const t=br(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function fw(n,e){const t=br(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function pw(n,e){const t=br(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function mw(n,e){n.uniform1iv(this.addr,e)}function gw(n,e){n.uniform2iv(this.addr,e)}function xw(n,e){n.uniform3iv(this.addr,e)}function yw(n,e){n.uniform4iv(this.addr,e)}function vw(n,e){n.uniform1uiv(this.addr,e)}function bw(n,e){n.uniform2uiv(this.addr,e)}function ww(n,e){n.uniform3uiv(this.addr,e)}function Mw(n,e){n.uniform4uiv(this.addr,e)}function _w(n,e,t){const i=e.length,s=Ep(t,i);n.uniform1iv(this.addr,s);for(let r=0;r!==i;++r)t.safeSetTexture2D(e[r]||Sp,s[r])}function Sw(n,e,t){const i=e.length,s=Ep(t,i);n.uniform1iv(this.addr,s);for(let r=0;r!==i;++r)t.safeSetTextureCube(e[r]||Tp,s[r])}function Tw(n){switch(n){case 5126:return lw;case 35664:return cw;case 35665:return hw;case 35666:return uw;case 35674:return dw;case 35675:return fw;case 35676:return pw;case 5124:case 35670:return mw;case 35667:case 35671:return gw;case 35668:case 35672:return xw;case 35669:case 35673:return yw;case 5125:return vw;case 36294:return bw;case 36295:return ww;case 36296:return Mw;case 35678:case 36198:case 36298:case 36306:case 35682:return _w;case 35680:case 36300:case 36308:case 36293:return Sw}}function Ew(n,e,t){this.id=n,this.addr=t,this.cache=[],this.setValue=aw(e.type)}function Ap(n,e,t){this.id=n,this.addr=t,this.cache=[],this.size=e.size,this.setValue=Tw(e.type)}Ap.prototype.updateCache=function(n){const e=this.cache;n instanceof Float32Array&&e.length!==n.length&&(this.cache=new Float32Array(n.length)),Xt(e,n)};function Lp(n){this.id=n,this.seq=[],this.map={}}Lp.prototype.setValue=function(n,e,t){const i=this.seq;for(let s=0,r=i.length;s!==r;++s){const o=i[s];o.setValue(n,e[o.id],t)}};const Ql=/(\w+)(\])?(\[|\.)?/g;function Wu(n,e){n.seq.push(e),n.map[e.id]=e}function Aw(n,e,t){const i=n.name,s=i.length;for(Ql.lastIndex=0;;){const r=Ql.exec(i),o=Ql.lastIndex;let a=r[1];const c=r[2]==="]",l=r[3];if(c&&(a=a|0),l===void 0||l==="["&&o+2===s){Wu(t,l===void 0?new Ew(a,n,e):new Ap(a,n,e));break}else{let h=t.map[a];h===void 0&&(h=new Lp(a),Wu(t,h)),t=h}}}function Ni(n,e){this.seq=[],this.map={};
2779const t=n.getProgramParameter(e,35718);for(let i=0;i<t;++i){const s=n.getActiveUniform(e,i),r=n.getUniformLocation(e,s.name);Aw(s,r,this)}}Ni.prototype.setValue=function(n,e,t,i){const s=this.map[e];s!==void 0&&s.setValue(n,t,i)};Ni.prototype.setOptional=function(n,e,t){const i=e[t];i!==void 0&&this.setValue(n,t,i)};Ni.upload=function(n,e,t,i){for(let s=0,r=e.length;s!==r;++s){const o=e[s],a=t[o.id];a.needsUpdate!==!1&&o.setValue(n,a.value,i)}};Ni.seqWithValue=function(n,e){const t=[];for(let i=0,s=n.length;i!==s;++i){const r=n[i];r.id in e&&t.push(r)}return t};function Vu(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}let Lw=0;function Cw(n){const e=n.split(`
2780`);for(let t=0;t<e.length;t++)e[t]=t+1+": "+e[t];return e.join(`
2781`)}function Cp(n){switch(n){case an:return["Linear","( value )"];case Cn:return["sRGB","( value )"];case nh:return["RGBE","( value )"];case hp:return["RGBM","( value, 7.0 )"];case up:return["RGBM","( value, 16.0 )"];case dp:return["RGBD","( value, 256.0 )"];case th:return["Gamma","( value, float( GAMMA_FACTOR ) )"];case Mx:return["LogLuv","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",n),["Linear","( value )"]}}function qu(n,e,t){const i=n.getShaderParameter(e,35713),s=n.getShaderInfoLog(e).trim();if(i&&s==="")return"";const r=n.getShaderSource(e);return"THREE.WebGLShader: gl.getShaderInfoLog() "+t+`
2782`+s+Cw(r)}function kr(n,e){const t=Cp(e);return"vec4 "+n+"( vec4 value ) { return "+t[0]+"ToLinear"+t[1]+"; }"}function Rw(n,e){const t=Cp(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function Pw(n,e){let t;switch(e){case Mg:t="Linear";break;case _g:t="Reinhard";break;case Sg:t="OptimizedCineon";break;case Kc:t="ACESFilmic";break;case Tg:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Iw(n){return[n.extensionDerivatives||n.envMapCubeUV||n.bumpMap||n.tangentSpaceNormalMap||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Zr).join(`
2783`)}function Bw(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
2784`)}function Dw(n,e){const t={},i=n.getProgramParameter(e,35721);for(let s=0;s<i;s++){const o=n.getActiveAttrib(e,s).name;t[o]=n.getAttribLocation(e,o)}return t}function Zr(n){return n!==""}function ju(n,e){return n.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Xu(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const kw=/^[ \t]*#include +<([\w\d./]+)>/gm;function Lc(n){return n.replace(kw,Nw)}function Nw(n,e){const t=He[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return Lc(t)}const zw=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,Fw=/#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 Yu(n){return n.replace(Fw,Rp).replace(zw,Ow)}function Ow(n,e,t,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Rp(n,e,t,i)}function Rp(n,e,t,i){let s="";for(let r=parseInt(e);r<parseInt(t);r++)s+=i.replace(/\[\s*i\s*\]/g,"[ "+r+" ]").replace(/UNROLLED_LOOP_INDEX/g,r);return s}function Zu(n){let e="precision "+n.precision+` float;
2785precision `+n.precision+" int;";return n.precision==="highp"?e+=`
2786#define HIGH_PRECISION`:n.precision==="mediump"?e+=`
2787#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
2788#define LOW_PRECISION`),e}function Hw(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===Zc?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===tp?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===Yr&&(e="SHADOWMAP_TYPE_VSM"),e}function Uw(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case Jc:case Qc:e="ENVMAP_TYPE_CUBE";break;case el:case $c:e="ENVMAP_TYPE_CUBE_UV";break}return e}function Gw(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case Qc:case $c:e="ENVMAP_MODE_REFRACTION";break}return e}function Ww(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case $a:e="ENVMAP_BLENDING_MULTIPLY";break;case bg:e="ENVMAP_BLENDING_MIX";break;case wg:e="ENVMAP_BLENDING_ADD";break}return e}function Vw(n,e,t,i){const s=n.getContext(),r=t.defines;let o=t.vertexShader,a=t.fragmentShader;const c=Hw(t),l=Uw(t),u=Gw(t),h=Ww(t),d=n.gammaFactor>0?n.gammaFactor:1,f=t.isWebGL2?"":Iw(t),p=Bw(r),b=s.createProgram();let w,v,y=t.glslVersion?"#version "+t.glslVersion+`
2789`:"";t.isRawShaderMaterial?(w=[p].filter(Zr).join(`
2790`),w.length>0&&(w+=`
2791`),v=[f,p].filter(Zr).join(`
2792`),v.length>0&&(v+=`
2793`)):(w=[Zu(t),"#define SHADER_NAME "+t.shaderName,p,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+d,"#define MAX_BONES "+t.maxBones,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.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.useVertexTexture?"#define BONE_TEXTURE":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#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_MORPHTARGETS","	attribute vec3 morphTarget0;","	attribute vec3 morphTarget1;","	attribute vec3 morphTarget2;","	attribute vec3 morphTarget3;","	#ifdef USE_MORPHNORMALS","		attribute vec3 morphNormal0;","		attribute vec3 morphNormal1;","		attribute vec3 morphNormal2;","		attribute vec3 morphNormal3;","	#else","		attribute vec3 morphTarget4;","		attribute vec3 morphTarget5;","		attribute vec3 morphTarget6;","		attribute vec3 morphTarget7;","	#endif","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
2794`].filter(Zr).join(`
2795`),v=[f,Zu(t),"#define SHADER_NAME "+t.shaderName,p,t.alphaTest?"#define ALPHATEST "+t.alphaTest+(t.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+d,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.sheen?"#define USE_SHEEN":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",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 "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"",(t.extensionShaderTextureLOD||t.envMap)&&t.rendererExtensionShaderTextureLod?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Qs?"#define TONE_MAPPING":"",t.toneMapping!==Qs?He.tonemapping_pars_fragment:"",t.toneMapping!==Qs?Pw("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",He.encodings_pars_fragment,t.map?kr("mapTexelToLinear",t.mapEncoding):"",t.matcap?kr("matcapTexelToLinear",t.matcapEncoding):"",t.envMap?kr("envMapTexelToLinear",t.envMapEncoding):"",t.emissiveMap?kr("emissiveMapTexelToLinear",t.emissiveMapEncoding):"",t.lightMap?kr("lightMapTexelToLinear",t.lightMapEncoding):"",Rw("linearToOutputTexel",t.outputEncoding),t.depthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
2796`].filter(Zr).join(`
2797`)),o=Lc(o),o=ju(o,t),o=Xu(o,t),a=Lc(a),a=ju(a,t),a=Xu(a,t),o=Yu(o),a=Yu(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es
2798`,w=["#define attribute in","#define varying out","#define texture2D texture"].join(`
2799`)+`
2800`+w,v=["#define varying in",t.glslVersion===Eu?"":"out highp vec4 pc_fragColor;",t.glslVersion===Eu?"":"#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(`
2801`)+`
2802`+v);const E=y+w+o,L=y+v+a,C=Vu(s,35633,E),_=Vu(s,35632,L);if(s.attachShader(b,C),s.attachShader(b,_),t.index0AttributeName!==void 0?s.bindAttribLocation(b,0,t.index0AttributeName):t.morphTargets===!0&&s.bindAttribLocation(b,0,"position"),s.linkProgram(b),n.debug.checkSha
2802derErrors){const H=s.getProgramInfoLog(b).trim(),W=s.getShaderInfoLog(C).trim(),Z=s.getShaderInfoLog(_).trim();let q=!0,k=!0;if(s.getProgramParameter(b,35714)===!1){q=!1;const O=qu(s,C,"vertex"),U=qu(s,_,"fragment");console.error("THREE.WebGLProgram: shader error: ",s.getError(),"35715",s.getProgramParameter(b,35715),"gl.getProgramInfoLog",H,O,U)}else H!==""?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",H):(W===""||Z==="")&&(k=!1);k&&(this.diagnostics={runnable:q,programLog:H,vertexShader:{log:W,prefix:w},fragmentShader:{log:Z,prefix:v}})}s.deleteShader(C),s.deleteShader(_);let D;this.getUniforms=function(){return D===void 0&&(D=new Ni(s,b)),D};let F;return this.getAttributes=function(){return F===void 0&&(F=Dw(s,b)),F},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(b),this.program=void 0},this.name=t.shaderName,this.id=Lw++,this.cacheKey=e,this.usedTimes=1,this.program=b,this.vertexShader=C,this.fragmentShader=_,this}function qw(n,e,t,i,s,r){const o=[],a=i.isWebGL2,c=i.logarithmicDepthBuffer,l=i.floatVertexTextures,u=i.maxVertexUniforms,h=i.vertexTextures;let d=i.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},p=["precision","isWebGL2","supportsVertexTextures","outputEncoding","instancing","instancingColor","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","envMapCubeUV","lightMap","lightMapEncoding","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","tangentSpaceNormalMap","clearcoatMap","clearcoatRoughnessMap","clearcoatNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexAlphas","vertexTangents","vertexUvs","uvsVertexOnly","fog","useFog","fogExp2","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","numDirLightShadows","numPointLightShadows","numSpotLightShadows","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering","sheen","transmissionMap"];function b(_){const F=_.skeleton.bones;if(l)return 1024;{const W=Math.floor((u-20)/4),Z=Math.min(W,F.length);return Z<F.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+F.length+" bones. This GPU supports "+Z+"."),0):Z}}function w(_){let D;return _&&_.isTexture?D=_.encoding:_&&_.isWebGLRenderTarget?(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),D=_.texture.encoding):D=an,D}function v(_,D,F,H,W){const Z=H.fog,q=_.isMeshStandardMaterial?H.environment:null,k=e.get(_.envMap||q),O=f[_.type],U=W.isSkinnedMesh?b(W):0;_.precision!==null&&(d=i.getMaxPrecision(_.precision),d!==_.precision&&console.warn("THREE.WebGLProgram.getParameters:",_.precision,"not supported, using",d,"instead."));let z,ne;if(O){const ge=zn[O];z=ge.vertexShader,ne=ge.fragmentShader}else z=_.vertexShader,ne=_.fragmentShader;const ce=n.getRenderTarget();return{isWebGL2:a,shaderID:O,shaderName:_.type,vertexShader:z,fragmentShader:ne,defines:_.defines,isRawShaderMaterial:_.isRawShaderMaterial===!0,glslVersion:_.glslVersion,precision:d,instancing:W.isInstancedMesh===!0,instancingColor:W.isInstancedMesh===!0&&W.instanceColor!==null,supportsVertexTextures:h,outputEncoding:ce!==null?w(ce.texture):n.outputEncoding,map:!!_.map,mapEncoding:w(_.map),matcap:!!_.matcap,matcapEncoding:w(_.matcap),envMap:!!k,envMapMode:k&&k.mapping,envMapEncoding:w(k),envMapCubeUV:!!k&&(k.mapping===el||k.mapping===$c),lightMap:!!_.lightMap,lightMapEncoding:w(_.lightMap),aoMap:!!_.aoMap,emissiveMap:!!_.emissiveMap,emissiveMapEncoding:w(_.emissiveMap),bumpMap:!!_.bumpMap,normalMap:!!_.normalMap,objectSpaceNormalMap:_.normalMapType===Tx,tangentSpaceNormalMap:_.normalMapType===fs,clearcoatMap:!!_.clearcoatMap,clearcoatRoughnessMap:!!_.clearcoatRoughnessMap,clearcoatNormalMap:!!_.clearcoatNormalMap,displacementMap:!!_.displacementMap,roughnessMap:!!_.roughnessMap,metalnessMap:!!_.metalnessMap,specularMap:!!_.specularMap,alph
2802aMap:!!_.alphaMap,gradientMap:!!_.gradientMap,sheen:!!_.sheen,transmissionMap:!!_.transmissionMap,combine:_.combine,vertexTangents:_.normalMap&&_.vertexTangents,vertexColors:_.vertexColors,vertexAlphas:_.vertexColors===!0&&W.geometry&&W.geometry.attributes.color&&W.geometry.attributes.color.itemSize===4,vertexUvs:!!_.map||!!_.bumpMap||!!_.normalMap||!!_.specularMap||!!_.alphaMap||!!_.emissiveMap||!!_.roughnessMap||!!_.metalnessMap||!!_.clearcoatMap||!!_.clearcoatRoughnessMap||!!_.clearcoatNormalMap||!!_.displacementMap||!!_.transmissionMap,uvsVertexOnly:!(_.map||_.bumpMap||_.normalMap||_.specularMap||_.alphaMap||_.emissiveMap||_.roughnessMap||_.metalnessMap||_.clearcoatNormalMap||_.transmissionMap)&&!!_.displacementMap,fog:!!Z,useFog:_.fog,fogExp2:Z&&Z.isFogExp2,flatShading:!!_.flatShading,sizeAttenuation:_.sizeAttenuation,logarithmicDepthBuffer:c,skinning:_.skinning&&U>0,maxBones:U,useVertexTexture:l,morphTargets:_.morphTargets,morphNormals:_.morphNormals,numDirLights:D.directional.length,numPointLights:D.point.length,numSpotLights:D.spot.length,numRectAreaLights:D.rectArea.length,numHemiLights:D.hemi.length,numDirLightShadows:D.directionalShadowMap.length,numPointLightShadows:D.pointShadowMap.length,numSpotLightShadows:D.spotShadowMap.length,numClippingPlanes:r.numPlanes,numClipIntersection:r.numIntersection,dithering:_.dithering,shadowMapEnabled:n.shadowMap.enabled&&F.length>0,shadowMapType:n.shadowMap.type,toneMapping:_.toneMapped?n.toneMapping:Qs,physicallyCorrectLights:n.physicallyCorrectLights,premultipliedAlpha:_.premultipliedAlpha,alphaTest:_.alphaTest,doubleSided:_.side===yt,flipSided:_.side===Pt,depthPacking:_.depthPacking!==void 0?_.depthPacking:!1,index0AttributeName:_.index0AttributeName,extensionDerivatives:_.extensions&&_.extensions.derivatives,extensionFragDepth:_.extensions&&_.extensions.fragDepth,extensionDrawBuffers:_.extensions&&_.extensions.drawBuffers,extensionShaderTextureLOD:_.extensions&&_.extensions.shaderTextureLOD,rendererExtensionFragDepth:a||t.has("EXT_frag_depth"),rendererExtensionDrawBuffers:a||t.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:a||t.has("EXT_shader_texture_lod"),customProgramCacheKey:_.customProgramCacheKey()}}function y(_){const D=[];if(_.shaderID?D.push(_.shaderID):(D.push(_.fragmentShader),D.push(_.vertexShader)),_.defines!==void 0)for(const F in _.defines)D.push(F),D.push(_.defines[F]);if(_.isRawShaderMaterial===!1){for(let F=0;F<p.length;F++)D.push(_[p[F]]);D.push(n.outputEncoding),D.push(n.gammaFactor)}return D.push(_.customProgramCacheKey),D.join()}function E(_){const D=f[_.type];let F;if(D){const H=zn[D];F=ss.clone(H.uniforms)}else F=_.uniforms;return F}function L(_,D){let F;for(let H=0,W=o.length;H<W;H++){const Z=o[H];if(Z.cacheKey===D){F=Z,++F.usedTimes;break}}return F===void 0&&(F=new Vw(n,D,_,s),o.push(F)),F}function C(_){if(--_.usedTimes===0){const D=o.indexOf(_);o[D]=o[o.length-1],o.pop(),_.destroy()}}return{getParameters:v,getProgramCacheKey:y,getUniforms:E,acquireProgram:L,releaseProgram:C,programs:o}}function jw(){let n=new WeakMap;function e(r){let o=n.get(r);return o===void 0&&(o={},n.set(r,o)),o}function t(r){n.delete(r)}function i(r,o,a){n.get(r)[o]=a}function s(){n=new WeakMap}return{get:e,remove:t,update:i,dispose:s}}function Xw(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.program!==e.program?n.program.id-e.program.id:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function Yw(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function Ku(n){const e=[];let t=0;const i=[],s=[],r={id:-1};function o(){t=0,i.length=0,s.length=0}function a(d,f,p,b,w,v){let y=e[t];const E=n.get(p);return y===void 0?(y={id:d.id,object:d,geometry:f,material:p,program:E.program||r,groupOrder:b,renderOrder:d.renderOrder,z:w,group:v},e[t]=y):(y.id=d.id,y.object=d,y.geometry=f,y.material=p,y.program=E.program||r,y.groupOrder=b,y.renderOrder=d.renderOrder,y.z=w,y.group=v),t++,y}function c(d,f,p,b,w,v){const y=a(d,f,p,b,w,v);(p.transparent===!0?s:i).push(y)}function l(d,f,p,b,w,v){const y=a(d,f,p,b,w,v);(p.transparent===!0?s:i).unshift(y)}function u(d,f){i.length>1&&i.sort(d||Xw),s.length>1&&s.sort(f||Yw)}function h(){for(let d=t,f=e.length;d<f;d++){const p=e[d];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.program=null,p.group=null}}return{opaque:i,transparent:s,init:o,push:c,unshift:l,finish:h,sort:u}}function Zw(n){let e=new WeakMap;function t(s,r){let o;return e.has(s)===!1?(o=new Ku(n),e.set(s,[o])):r>=e.get(s).length?(o=new Ku(n),e.get(s).push(o)):o=e.get(s)[r],o}
vendor: 5,593 bytes, line 2802
2802function i(){e=new WeakMap}return{get:t,dispose:i}}function Kw(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new S,color:new pe};break;case"SpotLight":t={position:new S,direction:new S,color:new pe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new S,color:new pe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new S,skyColor:new pe,groundColor:new pe};break;case"RectAreaLight":t={color:new pe,position:new S,halfWidth:new S,halfHeight:new S};break}return n[e.id]=t,t}}}function Jw(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let Qw=0;function $w(n,e){return(e.castShadow?1:0)-(n.castShadow?1:0)}function e1(n,e){const t=new Kw,i=Jw(),s={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let u=0;u<9;u++)s.probe.push(new S);const r=new S,o=new ve,a=new ve;function c(u){let h=0,d=0,f=0;for(let D=0;D<9;D++)s.probe[D].set(0,0,0);let p=0,b=0,w=0,v=0,y=0,E=0,L=0,C=0;u.sort($w);for(let D=0,F=u.length;D<F;D++){const H=u[D],W=H.color,Z=H.intensity,q=H.distance,k=H.shadow&&H.shadow.map?H.shadow.map.texture:null;if(H.isAmbientLight)h+=W.r*Z,d+=W.g*Z,f+=W.b*Z;else if(H.isLightProbe)for(let O=0;O<9;O++)s.probe[O].addScaledVector(H.sh.coefficients[O],Z);else if(H.isDirectionalLight){const O=t.get(H);if(O.color.copy(H.color).multiplyScalar(H.intensity),H.castShadow){const U=H.shadow,z=i.get(H);z.shadowBias=U.bias,z.shadowNormalBias=U.normalBias,z.shadowRadius=U.radius,z.shadowMapSize=U.mapSize,s.directionalShadow[p]=z,s.directionalShadowMap[p]=k,s.directionalShadowMatrix[p]=H.shadow.matrix,E++}s.directional[p]=O,p++}else if(H.isSpotLight){const O=t.get(H);if(O.position.setFromMatrixPosition(H.matrixWorld),O.color.copy(W).multiplyScalar(Z),O.distance=q,O.coneCos=Math.cos(H.angle),O.penumbraCos=Math.cos(H.angle*(1-H.penumbra)),O.decay=H.decay,H.castShadow){const U=H.shadow,z=i.get(H);z.shadowBias=U.bias,z.shadowNormalBias=U.normalBias,z.shadowRadius=U.radius,z.shadowMapSize=U.mapSize,s.spotShadow[w]=z,s.spotShadowMap[w]=k,s.spotShadowMatrix[w]=H.shadow.matrix,C++}s.spot[w]=O,w++}else if(H.isRectAreaLight){const O=t.get(H);O.color.copy(W).multiplyScalar(Z),O.halfWidth.set(H.width*.5,0,0),O.halfHeight.set(0,H.height*.5,0),s.rectArea[v]=O,v++}else if(H.isPointLight){const O=t.get(H);if(O.color.copy(H.color).multiplyScalar(H.intensity),O.distance=H.distance,O.decay=H.decay,H.castShadow){const U=H.shadow,z=i.get(H);z.shadowBias=U.bias,z.shadowNormalBias=U.normalBias,z.shadowRadius=U.radius,z.shadowMapSize=U.mapSize,z.shadowCameraNear=U.camera.near,z.shadowCameraFar=U.camera.far,s.pointShadow[b]=z,s.pointShadowMap[b]=k,s.pointShadowMatrix[b]=H.shadow.matrix,L++}s.point[b]=O,b++}else if(H.isHemisphereLight){const O=t.get(H);O.skyColor.copy(H.color).multiplyScalar(Z),O.groundColor.copy(H.groundColor).multiplyScalar(Z),s.hemi[y]=O,y++}}v>0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=ue.LTC_FLOAT_1,s.rectAreaLTC2=ue.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(s.rectAreaLTC1=ue.LTC_HALF_1,s.rectAreaLTC2=ue.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=h,s.ambient[1]=d,s.ambient[2]=f;const _=s.hash;(_.directionalLength!==p||_.pointLength!==b||_.spotLength!==w||_.rectAreaLength!==v||_.hemiLength!==y||_.numDirectionalShadows!==E||_.numPointShadows!==L||_.numSpotShadows!==C)&&(s.directional.length=p,s.spot.length=w,s.rectArea.length=v,s.point.length=b,s.hemi.length=y,s.directionalShadow.length=E,s.directionalShadowMap.length=E,s.pointShadow.length=L,s.pointShadowMap.length=L,s.spotShadow.length=C,s.spotShadowMap.length=C,s.directionalShadowMatrix.length=E,s.pointShadowMatrix.length=L,s.spotShadowMatrix.length=C,_.directionalLength=p,_.pointLength=b,_.spotLength=w,_.rectAreaLength=v,_.hemiLength=y,_.numDirectionalShadows=E,_.numPointShadows=L,_.numSpotShadows=C,s.version=Qw++)}function l(u,h){let d=0,f=0,p=0,b=0,w=0;const v=h.matrixWorldInverse;for(let y=0,E=u.length;y<E;y++){const L=u[y];if(L.isDirectionalLight){const C=s.directional[d];C.direction.setFromMatrixPosition(L.matrixWorld),r.setFromMatrixPosition(L.target.matrixWorld),C.direction.sub(r),C.direction.transformDirection(v),d++}else if(L.isSpotLight){const C=s.spot[p];C.position.setFromMatrixPosition(L.matrixWorld),C.position.applyMatrix4(v),C.direction.setFromMatrixPosition(L.matrixWorld),r.setFromMatrixPosition(L.target.matrixWorld),C.direction.sub(r),C.direction.transformDirection(v),p++}else if(L.isRectAreaLight){const C=s.rectArea[b];C.position.setFromMatrixPosition(L.matrixWorld),C.position.applyMatrix4(v),a.identity(),o.copy(L.matrixWorld),o.premultiply(v),a.extractRotation(o),C.halfWidth.set(L.width*.5,0,0),C.halfHeight.set(0,L.height*.5,0),
2802C.halfWidth.applyMatrix4(a),C.halfHeight.applyMatrix4(a),b++}else if(L.isPointLight){const C=s.point[f];C.position.setFromMatrixPosition(L.matrixWorld),C.position.applyMatrix4(v),f++}else if(L.isHemisphereLight){const C=s.hemi[w];C.direction.setFromMatrixPosition(L.matrixWorld),C.direction.transformDirection(v),C.direction.normalize(),w++}}}return{setup:c,setupView:l,state:s}}function Ju(n,e){const t=new e1(n,e),i=[],s=[];function r(){i.length=0,s.length=0}function o(h){i.push(h)}function a(h){s.push(h)}function c(){t.setup(i)}function l(h){t.setupView(i,h)}return{init:r,state:{lightsArray:i,shadowsArray:s,lights:t},setupLights:c,setupLightsView:l,pushLight:o,pushShadow:a}}function t1(n,e){let t=new WeakMap;function i(r,o=0){let a;return t.has(r)===!1?(a=new Ju(n,e),t.set(r,[a])):o>=t.get(r).length?(a=new Ju(n,e),t.get(r).push(a)):a=t.get(r)[o],a}function s(){t=new WeakMap}return{get:i,dispose:s}}class Pp extends Lt{constructor(e){super(),this.type="MeshDepthMaterial",this.depthPacking=_x,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,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}}Pp.prototype.isMeshDepthMaterial=!0;class Ip extends Lt{constructor(e){super(),this.type="MeshDistanceMaterial",this.referencePosition=new S,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}Ip.prototype.isMeshDistanceMaterial=!0;var n1=`uniform sampler2D shadow_pass;
2803uniform vec2 resolution;
2804uniform float radius;
2805#include <packing>
2806void main() {
2807	float mean = 0.0;
2808	float squared_mean = 0.0;
2809	float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy ) / resolution ) );
2810	for ( float i = -1.0; i < 1.0 ; i += SAMPLE_RATE) {
2811		#ifdef HORIZONTAL_PASS
2812			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( i, 0.0 ) * radius ) / resolution ) );
2813			mean += distribution.x;
2814			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
2815		#else
2816			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, i ) * radius ) / resolution ) );
2817			mean += depth;
2818			squared_mean += depth * depth;
2819		#endif
2820	}
2821	mean = mean * HALF_SAMPLE_RATE;
2822	squared_mean = squared_mean * HALF_SAMPLE_RATE;
2823	float std_dev = sqrt( squared_mean - mean * mean );
2824	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
2825}`,i1=`void main() {
2826	gl_Position = vec4( position, 1.0 );
2827}`;function Bp(n,e,t){let i=new nl;const s=new $,r=new $,o=new at,a=[],c=[],l={},u=t.maxTextureSize,h={0:Pt,1:_o,2:yt},d=new Ut({defines:{SAMPLE_RATE:2/8,HALF_SAMPLE_RATE:1/8},uniforms:{shadow_pass:{value:null},resolution:{value:new $},radius:{value:4}},vertexShader:i1,fragmentShader:n1}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const p=new qe;p.setAttribute("position",new xt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const b=new X(p,d),w=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Zc,this.render=function(_,D,F){if(w.enabled===!1||w.autoUpdate===!1&&w.needsUpdate===!1||_.length===0)return;const H=n.getRenderTarget(),W=n.getActiveCubeFace(),Z=n.getActiveMipmapLevel(),q=n.state;q.setBlending(ki),q.buffers.color.setClear(1,1,1,1),q.buffers.depth.setTest(!0),q.setScissorTest(!1);for(let k=0,O=_.length;k<O;k++){const U=_[k],z=U.shadow;if(z===void 0){console.warn("THREE.WebGLShadowMap:",U,"has no shadow.");continue}if(z.autoUpdate===!1&&z.needsUpdate===!1)continue;s.copy(z.mapSize);const ne=z.getFrameExtents();if(s.multiply(ne),r.copy(z.mapSize),(s.x>u||s.y>u)&&(s.x>u&&(r.x=Math.floor(u/ne.x),s.x=r.x*ne.x,z.mapSize.x=r.x),s.y>u&&(r.y=Math.floor(u/ne.y),s.y=r.y*ne.y,z.mapSize.y=r.y)),z.map===null&&!z.isPointLightShadow&&this.type===Yr){const re={minFilter:St,magFilter:St,format:Jt};z.map=new on(s.x,s.y,re),z.map.texture.name=U.name+".shadowMap",z.mapPass=new on(s.x,s.y,re),z.camera.updateProjectionMatrix()}if(z.map===null){const re={minFilter:vt,magFilter:vt,format:Jt};z.map=new on(s.x,s.y,re),z.map.texture.name=U.name+".shadowMap",z.camera.updateProjectionMatrix()}n.setRenderTarget(z.map),n.clear();const ce=z.getViewportCount();for(let re=0;re<ce;re++){const ge=z.getViewport(re);o.set(r.x*ge.x,r.y*ge.y,r.x*ge.z,r.y*ge.w),q.viewport(o),z.updateMatrices(U,re),i=z.getFrustum(),C(D,F,z.camera,U,this.type)}!z.isPointLightShadow&&this.type===Yr&&v(z,F),z.needsUpdate=!1}w.needsUpdate=!1,n.setRenderTarget(H,W,Z)};function v(_,D){const F=e.update(b);d.uniforms.shadow_pass.value=_.map.texture,d.uniforms.resolution.value=_.mapSize,d.uniforms.radius.value=_.radiu
2827s,n.setRenderTarget(_.mapPass),n.clear(),n.renderBufferDirect(D,null,F,d,b,null),f.uniforms.shadow_pass.value=_.mapPass.texture,f.uniforms.resolution.value=_.mapSize,f.uniforms.radius.value=_.radius,n.setRenderTarget(_.map),n.clear(),n.renderBufferDirect(D,null,F,f,b,null)}function y(_,D,F){const H=_<<0|D<<1|F<<2;let W=a[H];return W===void 0&&(W=new Pp({depthPacking:Sx,morphTargets:_,skinning:D}),a[H]=W),W}function E(_,D,F){const H=_<<0|D<<1|F<<2;let W=c[H];return W===void 0&&(W=new Ip({morphTargets:_,skinning:D}),c[H]=W),W}function L(_,D,F,H,W,Z,q){let k=null,O=y,U=_.customDepthMaterial;if(H.isPointLight===!0&&(O=E,U=_.customDistanceMaterial),U===void 0){let z=!1;F.morphTargets===!0&&(z=D.morphAttributes&&D.morphAttributes.position&&D.morphAttributes.position.length>0);let ne=!1;_.isSkinnedMesh===!0&&(F.skinning===!0?ne=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",_));const ce=_.isInstancedMesh===!0;k=O(z,ne,ce)}else k=U;if(n.localClippingEnabled&&F.clipShadows===!0&&F.clippingPlanes.length!==0){const z=k.uuid,ne=F.uuid;let ce=l[z];ce===void 0&&(ce={},l[z]=ce);let re=ce[ne];re===void 0&&(re=k.clone(),ce[ne]=re),k=re}return k.visible=F.visible,k.wireframe=F.wireframe,q===Yr?k.side=F.shadowSide!==null?F.shadowSide:F.side:k.side=F.shadowSide!==null?F.shadowSide:h[F.side],k.clipShadows=F.clipShadows,k.clippingPlanes=F.clippingPlanes,k.clipIntersection=F.clipIntersection,k.wireframeLinewidth=F.wireframeLinewidth,k.linewidth=F.linewidth,H.isPointLight===!0&&k.isMeshDistanceMaterial===!0&&(k.referencePosition.setFromMatrixPosition(H.matrixWorld),k.nearDistance=W,k.farDistance=Z),k}function C(_,D,F,H,W){if(_.visible===!1)return;if(_.layers.test(D.layers)&&(_.isMesh||_.isLine||_.isPoints)&&(_.castShadow||_.receiveShadow&&W===Yr)&&(!_.frustumCulled||i.intersectsObject(_))){_.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,_.matrixWorld);const k=e.update(_),O=_.material;if(Array.isArray(O)){const U=k.groups;for(let z=0,ne=U.length;z<ne;z++){const ce=U[z],re=O[ce.materialIndex];if(re&&re.visible){const ge=L(_,k,re,H,F.near,F.far,W);n.renderBufferDirect(F,null,k,ge,_,ce)}}}else if(O.visible){const U=L(_,k,O,H,F.near,F.far,W);n.renderBufferDirect(F,null,k,U,_,null)}}const q=_.children;for(let k=0,O=q.length;k<O;k++)C(q[k],D,F,H,W)}}function s1(n,e,t){const i=t.isWebGL2;function s(){let N=!1;const ae=new at;let M=null;const g=new at(0,0,0,0);return{setMask:function(x){M!==x&&!N&&(n.colorMask(x,x,x,x),M=x)},setLocked:function(x){N=x},setClear:function(x,T,I,G,Y){Y===!0&&(x*=G,T*=G,I*=G),ae.set(x,T,I,G),g.equals(ae)===!1&&(n.clearColor(x,T,I,G),g.copy(ae))},reset:function(){N=!1,M=null,g.set(-1,0,0,0)}}}function r(){let N=!1,ae=null,M=null,g=null;return{setTest:function(x){x?ye(2929):Se(2929)},setMask:function(x){ae!==x&&!N&&(n.depthMask(x),ae=x)},setFunc:function(x){if(M!==x){if(x)switch(x){case fg:n.depthFunc(512);break;case pg:n.depthFunc(519);break;case mg:n.depthFunc(513);break;case Sc:n.depthFunc(515);break;case gg:n.depthFunc(514);break;case xg:n.depthFunc(518);break;case yg:n.depthFunc(516);break;case vg:n.depthFunc(517);break;default:n.depthFunc(515)}else n.depthFunc(515);M=x}},setLocked:function(x){N=x},setClear:function(x){g!==x&&(n.clearDepth(x),g=x)},reset:function(){N=!1,ae=null,M=null,g=null}}}function o(){let N=!1,ae=null,M=null,g=null,x=null,T=null,I=null,G=null,Y=null;return{setTest:function(be){N||(be?ye(2960):Se(2960))},setMask:function(be){ae!==be&&!N&&(n.stencilMask(be),ae=be)},setFunc:function(be,Ze,Ve){(M!==be||g!==Ze||x!==Ve)&&(n.stencilFunc(be,Ze,Ve),M=be,g=Ze,x=Ve)},setOp:function(be,Ze,Ve){(T!==be||I!==Ze||G!==Ve)&&(n.stencilOp(be,Ze,Ve),T=be,I=Ze,G=Ve)},setLocked:function(be){N=be},setClear:function(be){Y!==be&&(n.clearStencil(be),Y=be)},reset:function(){N=!1,ae=null,M=null,g=null,x=null,T=null,I=null,G=null,Y=null}}}const a=new s,c=new r,l=new o;let u={},h=null,d={},f=null,p=!1,b=null,w=null,v=null,y=null,E=null,L=null,C=null,_=!1,D=null,F=null,H=null,W=null,Z=null;const q=n.getParameter(35661);let k=!1,O=0;const U=n.getParameter(7938);U.indexOf("WebGL")!==-1?(O=parseFloat(/^WebGL (\d)/.exec(U)[1]),k=O>=1):U.indexOf("OpenGL ES")!==-1&&(O=parseFloat(/^OpenGL ES (\d)/.exec(U)[1]),k=O>=2);let z=null,ne={};const ce=new at(0,0,n.canvas.width,n.canvas.height),re=new at(0,0,n.canvas.width,n.canvas.height);function ge(N,ae,M){const g=new Uint8Array(4),x=n.createTexture();n.bindTexture(N,x),n.texParameteri(N,10241,9728),n.texParameteri(N,10240,9728);for(let T=0;T<M;T++)n.texImage2D(ae+T,0,6408,1,1,0,6408,5121,g);return x}const ie={};ie[3553]=ge(3553,3553,1),ie[34067]=ge(34067,34069,6),a.setClear(0,0,0,1),c.setClear(1),l.setClear(0),ye(2929),c.setFunc(Sc),Oe(!1),se(cu),ye(2884),Ge(ki);function ye(N){u[N]!==!0&&(n.enable(N),u[N]=!0)}function Se(N){u[N]!==!1&&(n.disable(N),u[N]=!1)}function Q(N){N!==h&&(n.bindFramebuffer(36160,N),h=N)}function et(N,ae){ae===null&&h!==null&&(ae=h),d[N]!==ae&&(n.bindFramebuffer(N,ae),d[N]=ae,i&&(N===36009&&(d[36160]=ae),N===36160&&(d[36009]=ae)))}function Ue(N){return f!==N?(n.useProgram(N),f=N,!0):!1}const Te={[Gs]:32774,[ng]:32778,[ig]:32779};if(i)Te[du]=32775,Te[fu]=32776;else{const N=e.get("EXT_blend_minmax");N!==null&&(Te[du]=N.MIN_EXT,Te[fu]=N.MAX_EXT)}const Me={[sg]:0,[rg]:1,[og]:768,[ip]:770,[dg]:776,[hg]:774,[lg]:772,[ag]:769,[sp]:771,[ug]:775,[cg]:773};function Ge(N,ae,M,g,x,T,I,G){if(N===ki){p===!0&&(Se(3042),p=!1);return}if(p===!1&&(ye(3042),p=!0),N!==tg){if(N!==b||G!==_){if((w!==Gs||E!==Gs)&&(n.blendEquation(32774),w=Gs,E=Gs),G)switch(N){case Qr:n.blendFuncSeparate(1,771,1,771);break;case _c:n.blendFunc(1,1);break;case hu:n.blendFuncSeparate(0,0,769,771);break;case uu:n.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",N);break}else switch(N){case Qr:n.blendFuncSeparate(770,771,1,771);break;case _c:n.blendFunc(770,1);break;case hu:n.blendFunc(0,769);break;case uu:n.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",N);break}v=null,y=null,L=null,C=null,b=N,_=G}return}x=x||ae,T=T||M,I=I||g,(ae!==w||x!==E)&&(n.blendEquationSeparate(Te[ae],Te[x]),w=ae,E=x),(M!==v||g!==y||T!==L||I!==C)&&(n.blendFuncSeparate(Me[M],Me[g],Me[T],Me[I]),v=M,y=g,L=T,C=I),b=N,_=null}function Be(N,ae){N.side===yt?Se(2884):ye(2884);let M=N.side===Pt;ae&&(M=!M),Oe(M),N.blending===Qr&&N.transparent===!1?Ge(ki):Ge(N.blending,N.blendEquation,N.blendSrc,N.blendDst,N.blendEquationAlpha,N.blendSrcAlpha,N.blendDstAlpha,N.premultipliedAlpha),c.setFunc(N.depthFunc),c.setTest(N.depthTest),c.setMask(N.depthWrite),a.setMask(N.colorWrite);const g=N.stencilWrite;
2827l.setTest(g),g&&(l.setMask(N.stencilWriteMask),l.setFunc(N.stencilFunc,N.stencilRef,N.stencilFuncMask),l.setOp(N.stencilFail,N.stencilZFail,N.stencilZPass)),le(N.polygonOffset,N.polygonOffsetFactor,N.polygonOffsetUnits),N.alphaToCoverage===!0?ye(32926):Se(32926)}function Oe(N){D!==N&&(N?n.frontFace(2304):n.frontFace(2305),D=N)}function se(N){N!==$0?(ye(2884),N!==F&&(N===cu?n.cullFace(1029):N===eg?n.cullFace(1028):n.cullFace(1032))):Se(2884),F=N}function oe(N){N!==H&&(k&&n.lineWidth(N),H=N)}function le(N,ae,M){N?(ye(32823),(W!==ae||Z!==M)&&(n.polygonOffset(ae,M),W=ae,Z=M)):Se(32823)}function we(N){N?ye(3089):Se(3089)}function fe(N){N===void 0&&(N=33984+q-1),z!==N&&(n.activeTexture(N),z=N)}function P(N,ae){z===null&&fe();let M=ne[z];M===void 0&&(M={type:void 0,texture:void 0},ne[z]=M),(M.type!==N||M.texture!==ae)&&(n.bindTexture(N,ae||ie[N]),M.type=N,M.texture=ae)}function R(){const N=ne[z];N!==void 0&&N.type!==void 0&&(n.bindTexture(N.type,null),N.type=void 0,N.texture=void 0)}function ee(){try{n.compressedTexImage2D.apply(n,arguments)}catch(N){console.error("THREE.WebGLState:",N)}}function te(){try{n.texImage2D.apply(n,arguments)}catch(N){console.error("THREE.WebGLState:",N)}}function he(){try{n.texImage3D.apply(n,arguments)}catch(N){console.error("THREE.WebGLState:",N)}}function me(N){ce.equals(N)===!1&&(n.scissor(N.x,N.y,N.z,N.w),ce.copy(N))}function We(N){re.equals(N)===!1&&(n.viewport(N.x,N.y,N.z,N.w),re.copy(N))}function Ee(){n.disable(3042),n.disable(2884),n.disable(2929),n.disable(32823),n.disable(3089),n.disable(2960),n.disable(32926),n.blendEquation(32774),n.blendFunc(1,0),n.blendFuncSeparate(1,0,1,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(513),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(519,0,4294967295),n.stencilOp(7680,7680,7680),n.clearStencil(0),n.cullFace(1029),n.frontFace(2305),n.polygonOffset(0,0),n.activeTexture(33984),n.bindFramebuffer(36160,null),i===!0&&(n.bindFramebuffer(36009,null),n.bindFramebuffer(36008,null)),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),u={},z=null,ne={},h=null,d={},f=null,p=!1,b=null,w=null,v=null,y=null,E=null,L=null,C=null,_=!1,D=null,F=null,H=null,W=null,Z=null,ce.set(0,0,n.canvas.width,n.canvas.height),re.set(0,0,n.canvas.width,n.canvas.height),a.reset(),c.reset(),l.reset()}return{buffers:{color:a,depth:c,stencil:l},enable:ye,disable:Se,bindFramebuffer:et,bindXRFramebuffer:Q,useProgram:Ue,setBlending:Ge,setMaterial:Be,setFlipSided:Oe,
2827setCullFace:se,setLineWidth:oe,setPolygonOffset:le,setScissorTest:we,activeTexture:fe,bindTexture:P,unbindTexture:R,compressedTexImage2D:ee,texImage2D:te,texImage3D:he,scissor:me,viewport:We,reset:Ee}}function r1(n,e,t,i,s,r,o){const a=s.isWebGL2,c=s.maxTextures,l=s.maxCubemapSize,u=s.maxTextureSize,h=s.maxSamples,d=new WeakMap;let f,p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(P,R){return p?new OffscreenCanvas(P,R):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function w(P,R,ee,te){let he=1;if((P.width>te||P.height>te)&&(he=te/Math.max(P.width,P.height)),he<1||R===!0)if(typeof HTMLImageElement<"u"&&P instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&P instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&P instanceof ImageBitmap){const me=R?pp:Math.floor,We=me(he*P.width),Ee=me(he*P.height);f===void 0&&(f=b(We,Ee));const N=ee?b(We,Ee):f;return N.width=We,N.height=Ee,N.getContext("2d").drawImage(P,0,0,We,Ee),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+P.width+"x"+P.height+") to ("+We+"x"+Ee+")."),N}else return"data"in P&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+P.width+"x"+P.height+")."),P;return P}function v(P){return Ac(P.width)&&Ac(P.height)}function y(P){return a?!1:P.wrapS!==mn||P.wrapT!==mn||P.minFilter!==vt&&P.minFilter!==St}function E(P,R){return P.generateMipmaps&&R&&P.minFilter!==vt&&P.minFilter!==St}function L(P,R,ee,te){n.generateMipmap(P);const he=i.get(R);he.__maxMipLevel=Math.log2(Math.max(ee,te))}function C(P,R,ee){if(a===!1)return R;if(P!==null){if(n[P]!==void 0)return n[P];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let te=R;return R===6403&&(ee===5126&&(te=33326),ee===5131&&(te=33325),ee===5121&&(te=33321)),R===6407&&(ee===5126&&(te=34837),ee===5131&&(te=34843),ee===5121&&(te=32849)),R===6408&&(ee===5126&&(te=34836),ee===5131&&(te=34842),ee===5121&&(te=32856)),(te===33325||te===33326||te===34842||te===34836)&&e.get("EXT_color_buffer_float"),te}function _(P){return P===vt||P===Tc||P===Ec?9728:9729}function D(P){const R=P.target;R.removeEventListener("dispose",D),H(R),R.isVideoTexture&&d.delete(R),o.memory.textures--}function F(P){const R=P.target;R.removeEventListener("dispose",F),W(R),o.memory.textures--}function H(P){const R=i.get(P);R.__webglInit!==void 0&&(n.deleteTexture(R.__webglTexture),i.remove(P))}function W(P){const R=P.texture,ee=i.get(P),te=i.get(R);if(P){if(te.__webglTexture!==void 0&&n.deleteTexture(te.__webglTexture),P.depthTexture&&P.depthTexture.dispose(),P.isWebGLCubeRenderTarget)for(let he=0;he<6;he++)n.deleteFramebuffer(ee.__webglFramebuffer[he]),ee.__webglDepthbuffer&&n.deleteRenderbuffer(ee.__webglDepthbuffer[he]);else n.deleteFramebuffer(ee.__webglFramebuffer),ee.__webglDepthbuffer&&n.deleteRenderbuffer(ee.__webglDepthbuffer),ee.__webglMultisampledFramebuffer&&n.deleteFramebuffer(ee.__webglMultisampledFramebuffer),ee.__webglColorRenderbuffer&&n.deleteRenderbuffer(ee.__webglColorRenderbuffer),ee.__webglDepthRenderbuffer&&n.deleteRenderbuffer(ee.__webglDepthRenderbuffer);i.remove(R),i.remove(P)}}let Z=0;function q(){Z=0}function k(){const P=Z;return P>=c&&console.warn("THREE.WebGLTextures: Trying to use "+P+" texture units while this GPU supports only "+c),Z+=1,P}function O(P,R){const ee=i.get(P);if(P.isVideoTexture&&se(P),P.version>0&&ee.__version!==P.version){const te=P.image;if(te===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(te.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ye(ee,P,R);return}}t.activeTexture(33984+R),t.bindTexture(3553,ee.__webglTexture)}function U(P,R){const ee=i.get(P);if(P.version>0&&ee.__version!==P.version){ye(ee,P,R);return}t.activeTexture(33984+R),t.bindTexture(35866,ee.__webglTexture)}function z(P,R){const ee=i.get(P);if(P.version>0&&ee.__version!==P.version){ye(ee,P,R);return}t.activeTexture(33984+R),t.bindTexture(32879,ee.__webglTexture)}function ne(P,R){const ee=i.get(P);if(P.version>0&&ee.__version!==P.version){Se(ee,P,R);return}t.activeTexture(33984+R),t.bindTexture(34067,ee.__webglTexture)}const ce={[Hi]:10497,[mn]:33071,[La]:33648},re={[vt]:9728,[Tc]:9984,[Ec]:9986,[St]:9729,[op]:9985,[yr]:9987};function ge(P,R,ee){if(ee?(n.texParameteri(P,10242,ce[R.wrapS]),n.texParameteri(P,10243,ce[R.wrapT]),(P===32879||P===35866)&&n.texParameteri(P,32882,ce[R.wrapR]),n.texParameteri(P,10240,re[R.magFilter]),n.texParameteri(P,10241,re[R.minFilter])):(n.texParameteri(P,10242,33071),n.texParameteri(P,10243,33071),(P===32879||P===35866)&&n.texParameteri(P,32882,33071),(R.wrapS!==mn||R.wrapT!==mn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(P,10240,_(R.magFilter)),n.texParameteri(P,10241,_(R.minFilter)),R.minFilter!==vt&&R.minFilter!==St&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const te=e.get("EXT_texture_filter_anisotropic");if(R.type===Pi&&e.has("OES_texture_float_linear")===!1||a===!1&&R.type===Ra&&e.has("OES_texture_half_float_linear")===!1)return;(R.anisotropy>1||i.get(R).__currentAnisotropy)&&(n.texParameterf(P,te.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(R.anisotropy,s.getMaxAnisotropy())),i.get(R).__currentAnisotropy=R.anisotropy)}}function ie(P,R){P.__webglInit===void 0&&(P.__webglInit=!0,R.addEventListener("dispose",D),P.__webglTexture=n.createTexture(),o.memory.textures++)}function ye(P,R,ee){let te=3553;R.isDataTexture2DArray&&(te=35866),R.isDataTexture3D&&(te=32879),ie(P,R),t.activeTexture(33984+ee),t.bindTexture(te,P.__webglTexture),n.pixelStorei(37440,R.flipY),n.pixelStorei(37441,R.premultiplyAlpha),n.pixelStorei(3317,R.unpackAlignment),n.pixelStorei(37443,0);const he=y(R)&&v(R.image)===!1,me=w(R.image,he,!1,u),We=v(me)||a,Ee=r.convert(R.format);let N=r.convert(R.type),ae=C(R.internalFormat,Ee,N);ge(te,R,We);let M;const g=R.mipmaps;if(R.isDepthTexture)ae=6402,a?R.type===Pi?ae=36012:R.type===_a?ae=33
2827190:R.type===$r?ae=35056:ae=33189:R.type===Pi&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),R.format===$s&&ae===6402&&R.type!==Ca&&R.type!==_a&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),R.type=Ca,N=r.convert(R.type)),R.format===ao&&ae===6402&&(ae=34041,R.type!==$r&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),R.type=$r,N=r.convert(R.type))),t.texImage2D(3553,0,ae,me.width,me.height,0,Ee,N,null);else if(R.isDataTexture)if(g.length>0&&We){for(let x=0,T=g.length;x<T;x++)M=g[x],t.texImage2D(3553,x,ae,M.width,M.height,0,Ee,N,M.data);R.generateMipmaps=!1,P.__maxMipLevel=g.length-1}else t.texImage2D(3553,0,ae,me.width,me.height,0,Ee,N,me.data),P.__maxMipLevel=0;else if(R.isCompressedTexture){for(let x=0,T=g.length;x<T;x++)M=g[x],R.format!==Jt&&R.format!==Wn?Ee!==null?t.compressedTexImage2D(3553,x,ae,M.width,M.height,0,M.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):t.texImage2D(3553,x,ae,M.width,M.height,0,Ee,N,M.data);P.__maxMipLevel=g.length-1}else if(R.isDataTexture2DArray)t.texImage3D(35866,0,ae,me.width,me.height,me.depth,0,Ee,N,me.data),P.__maxMipLevel=0;else if(R.isDataTexture3D)t.texImage3D(32879,0,ae,me.width,me.height,me.depth,0,Ee,N,me.data),P.__maxMipLevel=0;else if(g.length>0&&We){for(let x=0,T=g.length;x<T;x++)M=g[x],t.texImage2D(3553,x,ae,Ee,N,M);R.generateMipmaps=!1,P.__maxMipLevel=g.length-1}else t.texImage2D(3553,0,ae,Ee,N,me),P.__maxMipLevel=0;E(R,We)&&L(te,R,me.width,me.height),P.__version=R.version,R.onUpdate&&R.onUpdate(R)}function Se(P,R,ee){if(R.image.length!==6)return;ie(P,R),t.activeTexture(33984+ee),t.bindTexture(34067,P.__webglTexture),n.pixelStorei(37440,R.flipY),n.pixelStorei(37441,R.premultiplyAlpha),n.pixelStorei(3317,R.unpackAlignment),n.pixelStorei(37443,0);const te=R&&(R.isCompressedTexture||R.image[0].isCompressedTexture),he=R.image[0]&&R.image[0].isDataTexture,me=[];for(let x=0;x<6;x++)!te&&!he?me[x]=w(R.image[x],!1,!0,l):me[x]=he?R.image[x].image:R.image[x];const We=me[0],Ee=v(We)||a,N=r.convert(R.format),ae=r.convert(R.type),M=C(R.internalFormat,N,ae);ge(34067,R,Ee);let g;if(te){for(let x=0;x<6;x++){g=me[x].mipmaps;for(let T=0;T<g.length;T++){const I=g[T];R.format!==Jt&&R.format!==Wn?N!==null?t.compressedTexImage2D(34069+x,T,M,I.width,I.height,0,I.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):t.texImage2D(34069+x,T,M,I.width,I.height,0,N,ae,I.data)}}P.__maxMipLevel=g.length-1}else{g=R.mipmaps;for(let x=0;x<6;x++)if(he){t.texImage2D(34069+x,0,M,me[x].width,me[x].height,0,N,ae,me[x].data);for(let T=0;T<g.length;T++){const G=g[T].image[x].image;t.texImage2D(34069+x,T+1,M,G.width,G.height,0,N,ae,G.data)}}else{t.texImage2D(34069+x,0,M,N,ae,me[x]);for(let T=0;T<g.length;T++){const I=g[T];t.texImage2D(34069+x,T+1,M,N,ae,I.image[x])}}P.__maxMipLevel=g.length}E(R,Ee)&&L(34067,R,We.width,We.height),P.__version=R.version,R.onUpdate&&R.onUpdate(R)}function Q(P,R,ee,te){const he=R.texture,me=r.convert(he.format),We=r.convert(he.type),Ee=C(he.internalFormat,me,We);te===32879||te===35866?t.texImage3D(te,0,Ee,R.width,R.height,R.depth,0,me,We,null):t.texImage2D(te,0,Ee,R.width,R.height,0,me,We,null),t.bindFramebuffer(36160,P),n.framebufferTexture2D(36160,ee,te,i.get(he).__webglTexture,0),t.bindFramebuffer(36160,null)}function et(P,R,ee){if(n.bindRenderbuffer(36161,P),R.depthBuffer&&!R.stencilBuffer){let te=33189;if(ee){const he=R.depthTexture;he&&he.isDepthTexture&&(he.type===Pi?te=36012:he.type===_a&&(te=33190));const me=Oe(R);n.renderbufferStorageMultisample(36161,me,te,R.width,R.height)}else n.renderbufferStorage(36161,te,R.width,R.height);n.framebufferRenderbuffer(36160,36096,36161,P)}else if(R.depthBuffer&&R.stencilBuffer){if(ee){const te=Oe(R);n.renderbufferStorageMultisample(36161,te,35056,R.width,R.height)}else n.renderbufferStorage(36161,34041,R.width,R.height);n.framebufferRenderbuffer(36160,33306,36161,P)}else{const te=R.texture,he=r.convert(te.format),me=r.convert(te.type),We=C(te.internalFormat,he,me);if(ee){const Ee=Oe(R);n.renderbufferStorageMultisample(36161,Ee,We,R.width,R.height)}else n.renderbufferStorage(36161,We,R.width,R.height)}n.bindRenderbuffer(36161,null)}
2827function Ue(P,R){if(R&&R.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(36160,P),!(R.depthTexture&&R.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(R.depthTexture).__webglTexture||R.depthTexture.image.width!==R.width||R.depthTexture.image.height!==R.height)&&(R.depthTexture.image.width=R.width,R.depthTexture.image.height=R.height,R.depthTexture.needsUpdate=!0),O(R.depthTexture,0);const te=i.get(R.depthTexture).__webglTexture;if(R.depthTexture.format===$s)n.framebufferTexture2D(36160,36096,3553,te,0);else if(R.depthTexture.format===ao)n.framebufferTexture2D(36160,33306,3553,te,0);else throw new Error("Unknown depthTexture format")}function Te(P){const R=i.get(P),ee=P.isWebGLCubeRenderTarget===!0;if(P.depthTexture){if(ee)throw new Error("target.depthTexture not supported in Cube render targets");Ue(R.__webglFramebuffer,P)}else if(ee){R.__webglDepthbuffer=[];for(let te=0;te<6;te++)t.bindFramebuffer(36160,R.__webglFramebuffer[te]),R.__webglDepthbuffer[te]=n.createRenderbuffer(),et(R.__webglDepthbuffer[te],P,!1)}else t.bindFramebuffer(36160,R.__webglFramebuffer),R.__webglDepthbuffer=n.createRenderbuffer(),et(R.__webglDepthbuffer,P,!1);t.bindFramebuffer(36160,null)}function Me(P){const R=P.texture,ee=i.get(P),te=i.get(R);P.addEventListener("dispose",F),te.__webglTexture=n.createTexture(),te.__version=R.version,o.memory.textures++;const he=P.isWebGLCubeRenderTarget===!0,me=P.isWebGLMultisampleRenderTarget===!0,We=R.isDataTexture3D||R.isDataTexture2DArray,Ee=v(P)||a;if(a&&R.format===Wn&&(R.type===Pi||R.type===Ra)&&(R.format=Jt,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),he){ee.__webglFramebuffer=[];for(let N=0;N<6;N++)ee.__webglFramebuffer[N]=n.createFramebuffer()}else if(ee.__webglFramebuffer=n.createFramebuffer(),me)if(a){ee.__webglMultisampledFramebuffer=n.createFramebuffer(),ee.__webglColorRenderbuffer=n.createRenderbuffer(),n.bindRenderbuffer(36161,ee.__webglColorRenderbuffer);const N=r.convert(R.format),ae=r.convert(R.type),M=C(R.internalFormat,N,ae),g=Oe(P);n.renderbufferStorageMultisample(36161,g,M,P.width,P.height),t.bindFramebuffer(36160,ee.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(36160,36064,36161,ee.__webglColorRenderbuffer),n.bindRenderbuffer(36161,null),P.depthBuffer&&(ee.__webglDepthRenderbuffer=n.createRenderbuffer(),et(ee.__webglDepthRenderbuffer,P,!0)),t.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(he){t.bindTexture(34067,te.__webglTexture),ge(34067,R,Ee);for(let N=0;N<6;N++)Q(ee.__webglFramebuffer[N],P,36064,34069+N);E(R,Ee)&&L(34067,R,P.width,P.height),t.bindTexture(34067,null)}else{let N=3553;We&&(a?N=R.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),t.bindTexture(N,te.__webglTexture),ge(N,R,Ee),Q(ee.__webglFramebuffer,P,36064,N),E(R,Ee)&&L(3553,R,P.width,P.height),t.bindTexture(3553,null)}P.depthBuffer&&Te(P)}function Ge(P){const R=P.texture,ee=v(P)||a;if(E(R,ee)){const te=P.isWebGLCubeRenderTarget?34067:3553,he=i.get(R).__webglTexture;t.bindTexture(te,he),L(te,R,P.width,P.height),t.bindTexture(te,null)}}function Be(P){if(P.isWebGLMultisampleRenderTarget)if(a){const R=P.width,ee=P.height;let te=16384;P.depthBuffer&&(te|=256),P.stencilBuffer&&(te|=1024);const he=i.get(P);t.bindFramebuffer(36008,he.__webglMultisampledFramebuffer),t.bindFramebuffer(36009,he.__webglFramebuffer),n.blitFramebuffer(0,0,R,ee,0,0,R,ee,te,9728),t.bindFramebuffer(36008,null),t.bindFramebuffer(36009,he.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function Oe(P){return a&&P.isWebGLMultisampleRenderTarget?Math.min(h,P.samples):0}function se(P){const R=o.render.frame;d.get(P)!==R&&(d.set(P,R),P.update())}let oe=!1,le=!1;function we(P,R){P&&P.isWebGLRenderTarget&&(oe===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),oe=!0),P=P.texture),O(P,R)}
2827function fe(P,R){P&&P.isWebGLCubeRenderTarget&&(le===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),le=!0),P=P.texture),ne(P,R)}this.allocateTextureUnit=k,this.resetTextureUnits=q,this.setTexture2D=O,this.setTexture2DArray=U,this.setTexture3D=z,this.setTextureCube=ne,this.setupRenderTarget=Me,this.updateRenderTargetMipmap=Ge,this.updateMultisampleRenderTarget=Be,this.safeSetTexture2D=we,this.safeSetTextureCube=fe}function o1(n,e,t){const i=t.isWebGL2;function s(r){let o;if(r===So)return 5121;if(r===Cg)return 32819;if(r===Rg)return 32820;if(r===Pg)return 33635;if(r===Eg)return 5120;if(r===Ag)return 5122;if(r===Ca)return 5123;if(r===Lg)return 5124;if(r===_a)return 5125;if(r===Pi)return 5126;if(r===Ra)return i?5131:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(r===Ig)return 6406;if(r===Wn)return 6407;if(r===Jt)return 6408;if(r===ap)return 6409;if(r===Bg)return 6410;if(r===$s)return 6402;if(r===ao)return 34041;if(r===kg)return 6403;if(r===Ng)return 36244;if(r===zg)return 33319;if(r===Fg)return 33320;if(r===Og)return 36248;if(r===Hg)return 36249;if(r===gu||r===xu||r===yu||r===vu)if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(r===gu)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===xu)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===yu)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===vu)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===bu||r===wu||r===Mu||r===_u)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(r===bu)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===wu)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===Mu)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===_u)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===Ug)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if((r===Su||r===Tu)&&(o=e.get("WEBGL_compressed_texture_etc"),o!==null)){if(r===Su)return o.COMPRESSED_RGB8_ETC2;if(r===Tu)return o.COMPRESSED_RGBA8_ETC2_EAC}if(r===Gg||r===Wg||r===Vg||r===qg||r===jg||r===Xg||r===Yg||r===Zg||r===Kg||r===Jg||r===Qg||r===$g||r===ex||r===tx||r===ix||r===sx||r===rx||r===ox||r===ax||r===lx||r===cx||r===hx||r===ux||r===dx||r===fx||r===px||r===mx||r===gx)return o=e.get("WEBGL_compressed_texture_astc"),o!==null?r:null;if(r===nx)return o=e.get("EXT_texture_compression_bptc"),o!==null?r:null;if(r===$r)return i?34042:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null)}return{convert:s}}class Dp extends Ot{constructor(e=[]){super(),this.cameras=e}}Dp.prototype.isArrayCamera=!0;class Fe extends $e{constructor(){super(),this.type="Group"}}Fe.prototype.isGroup=!0;const a1={type:"move"};class $l{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Fe,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 Fe,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new S,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new S),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Fe,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new S,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new S),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}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 s=null,r=null,o=null;const a=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred")if(a!==null&&(s=t.getPose(e.targetRaySpace,i),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(a1))),l&&e.hand){o=!0;for(const b of e.hand.values()){const w=t.getJointPose(b,i);if(l.joints[b.jointName]===void 0){const y=new Fe;y.matrixAutoUpdate=!1,y.visible=!1,l.joints[b.jointName]=y,l.add(y)}const v=l.joints[b.jointName];w!==null&&(v.matrix.fromArray(w.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),v.jointRadius=w.radius),v.visible=w!==null}const u=l.joints["index-finger-tip"],h=l.joints["thumb-tip"],d=u.position.distanceTo(h.position),f=.02,p=.005;l.inputState.pinching&&d>f+p?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=f-p&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,i),r!==null&&(c.matrix.fromArray(r.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),r.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(r.linearVelocity)):c.hasLinearVelocity=!1,r.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(r.angularVelocity)):c.hasAngularVelocity=!1));return a!==null&&(a.visible=s!==null),c!==null&&(c.visible=r!==null),l!==null&&(l.visible=o!==null),this}}class l1 extends ps{constructor(e,t){super();const i=this,s=e.state;let r=null,o=1,a=null,c="local-floor",l=null;const u=[],h=new Map,d=new Ot;d.layers.enable(1),d.viewport=new at;const f=new Ot;f.layers.enable(2),f.viewport=new at;const p=[d,f],b=new Dp;b.layers.enable(1),b.layers.enable(2);let w=null,v=null;this.enabled=!1,this.isPresenting=!1,this.getController=function(q){let k=u[q];return k===void 0&&(k=new $l,u[q]=k),k.getTargetRaySpace()},this.getControllerGrip=function(q){let k=u[q];return k===void 0&&(k=new $l,u[q]=k),k.getGripSpace()},this.getHand=function(q){let k=u[q];return k===void 0&&(k=new $l,u[q]=k),k.getHandSpace()};function y(q){const k=h.get(q.inputSource);k&&k.dispatchEvent({type:q.type,data:q.inputSource})}function E(){h.forEach(function(q,k){q.disconnect(k)}),h.clear(),w=null,v=null,s.bindXRFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),Z.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(q){o=q,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(q){c=q,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return a}
2827,this.getSession=function(){return r},this.setSession=async function(q){if(r=q,r!==null){r.addEventListener("select",y),r.addEventListener("selectstart",y),r.addEventListener("selectend",y),r.addEventListener("squeeze",y),r.addEventListener("squeezestart",y),r.addEventListener("squeezeend",y),r.addEventListener("end",E),r.addEventListener("inputsourceschange",L);const k=t.getContextAttributes();k.xrCompatible!==!0&&await t.makeXRCompatible();const O={antialias:k.antialias,alpha:k.alpha,depth:k.depth,stencil:k.stencil,framebufferScaleFactor:o},U=new XRWebGLLayer(r,t,O);r.updateRenderState({baseLayer:U}),a=await r.requestReferenceSpace(c),Z.setContext(r),Z.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};function L(q){const k=r.inputSources;for(let O=0;O<u.length;O++)h.set(k[O],u[O]);for(let O=0;O<q.removed.length;O++){const U=q.removed[O],z=h.get(U);z&&(z.dispatchEvent({type:"disconnected",data:U}),h.delete(U))}for(let O=0;O<q.added.length;O++){const U=q.added[O],z=h.get(U);z&&z.dispatchEvent({type:"connected",data:U})}}const C=new S,_=new S;function D(q,k,O){C.setFromMatrixPosition(k.matrixWorld),_.setFromMatrixPosition(O.matrixWorld);const U=C.distanceTo(_),z=k.projectionMatrix.elements,ne=O.projectionMatrix.elements,ce=z[14]/(z[10]-1),re=z[14]/(z[10]+1),ge=(z[9]+1)/z[5],ie=(z[9]-1)/z[5],ye=(z[8]-1)/z[0],Se=(ne[8]+1)/ne[0],Q=ce*ye,et=ce*Se,Ue=U/(-ye+Se),Te=Ue*-ye;k.matrixWorld.decompose(q.position,q.quaternion,q.scale),q.translateX(Te),q.translateZ(Ue),q.matrixWorld.compose(q.position,q.quaternion,q.scale),q.matrixWorldInverse.copy(q.matrixWorld).invert();const Me=ce+Ue,Ge=re+Ue,Be=Q-Te,Oe=et+(U-Te),se=ge*re/Ge*Me,oe=ie*re/Ge*Me;q.projectionMatrix.makePerspective(Be,Oe,se,oe,Me,Ge)}function F(q,k){k===null?q.matrixWorld.copy(q.matrix):q.matrixWorld.multiplyMatrices(k.matrixWorld,q.matrix),q.matrixWorldInverse.copy(q.matrixWorld).invert()}this.getCamera=function(q){b.near=f.near=d.near=q.near,b.far=f.far=d.far=q.far,(w!==b.near||v!==b.far)&&(r.updateRenderState({depthNear:b.near,depthFar:b.far}),w=b.near,v=b.far);const k=q.parent,O=b.cameras;F(b,k);for(let z=0;z<O.length;z++)F(O[z],k);q.matrixWorld.copy(b.matrixWorld),q.matrix.copy(b.matrix),q.matrix.decompose(q.position,q.quaternion,q.scale);const U=q.children;for(let z=0,ne=U.length;z<ne;z++)U[z].updateMatrixWorld(!0);return O.length===2?D(b,d,f):b.projectionMatrix.copy(d.projectionMatrix),b};let H=null;function W(q,k){if(l=k.getViewerPose(a),l!==null){const U=l.views,z=r.renderState.baseLayer;s.bindXRFramebuffer(z.framebuffer);let ne=!1;U.length!==b.cameras.length&&(b.cameras.length=0,ne=!0);for(let ce=0;ce<U.length;ce++){const re=U[ce],ge=z.getViewport(re),ie=p[ce];ie.matrix.fromArray(re.transform.matrix),ie.projectionMatrix.fromArray(re.projectionMatrix),ie.viewport.set(ge.x,ge.y,ge.width,ge.height),ce===0&&b.matrix.copy(ie.matrix),ne===!0&&b.cameras.push(ie)}}const O=r.inputSources;for(let U=0;U<u.length;U++){const z=u[U],ne=O[U];z.update(ne,k,a)}H&&H(q,k)}const Z=new wp;Z.setAnimationLoop(W),this.setAnimationLoop=function(q){H=q},this.dispose=function(){}}}function c1(n){function e(v,y){v.fogColor.value.copy(y.color),y.isFog?(v.fogNear.value=y.near,v.fogFar.value=y.far):y.isFogExp2&&(v.fogDensity.value=y.density)}function t(v,y,E,L){y.isMeshBasicMaterial?i(v,y):y.isMeshLambertMaterial?(i(v,y),c(v,y)):y.isMeshToonMaterial?(i(v,y),u(v,y)):y.isMeshPhongMaterial?(i(v,y),l(v,y)):y.isMeshStandardMaterial?(i(v,y),y.isMeshPhysicalMaterial?d(v,y):h(v,y)):y.isMeshMatcapMaterial?(i(v,y),f(v,y)):y.isMeshDepthMaterial?(i(v,y),p(v,y)):y.isMeshDistanceMaterial?(i(v,y),b(v,y)):y.isMeshNormalMaterial?(i(v,y),w(v,y)):y.isLineBasicMaterial?(s(v,y),y.isLineDashedMaterial&&r(v,y)):y.isPointsMaterial?o(v,y,E,L):y.isSpriteMaterial?a(v,y):y.isShadowMaterial?(v.color.value.copy(y.color),v.opacity.value=y.opacity):y.isShaderMaterial&&(y.uniformsNeedUpdate=!1)}function i(v,y){v.opacity.value=y.opacity,y.color&&v.diffuse.value.copy(y.color),y.emissive&&v.emissive.value.copy(y.emissive).multiplyScalar(y.emissiveIntensity),y.map&&(v.map.value=y.map),y.alphaMap&&(v.alphaMap.value=y.alphaMap),y.specularMap&&(v.specularMap.value=y.specularMap);const E=n.get(y).envMap;if(E){v.envMap.value=E,v.flipEnvMap.value=E.isCubeTexture&&E._needsFlipEnvMap?-1:1,v.reflectivity.value=y.reflectivity,v.refractionRatio.value=y.refractionRatio;const _=n.get(E).__maxMipLevel;_!==void 0&&(v.maxMipLevel.value=_)}y.lightMap&&(v.lightMap.value=y.lightMap,v.lightMapIntensity.value=y.lightMapIntensity),y.aoMap&&(v.aoMap.value=y.aoMap,v.aoMapIntensity.value=y.aoMapIntensity);let L;y.map?L=y.map:y.specularMap?L=y.specularMap:y.displacementMap?L=y.displacementMap:y.normalMap?L=y.normalMap:y.bumpMap?L=y.bumpMap:y.roughnessMap?L=y.roughnessMap:y.metalnessMap?L=y.metalnessMap:y.alphaMap?L=y.alphaMap:y.emissiveMap?L=y.emissiveMap:y.clearcoatMap?L=y.clearcoatMap:y.clearcoatNormalMap?L=y.clearcoatNormalMap:y.clearcoatRoughnessMap&&(L=y.clearcoatRoughnessMap),L!==void 0&&(L.isWebG
2827LRenderTarget&&(L=L.texture),L.matrixAutoUpdate===!0&&L.updateMatrix(),v.uvTransform.value.copy(L.matrix));let C;y.aoMap?C=y.aoMap:y.lightMap&&(C=y.lightMap),C!==void 0&&(C.isWebGLRenderTarget&&(C=C.texture),C.matrixAutoUpdate===!0&&C.updateMatrix(),v.uv2Transform.value.copy(C.matrix))}function s(v,y){v.diffuse.value.copy(y.color),v.opacity.value=y.opacity}function r(v,y){v.dashSize.value=y.dashSize,v.totalSize.value=y.dashSize+y.gapSize,v.scale.value=y.scale}function o(v,y,E,L){v.diffuse.value.copy(y.color),v.opacity.value=y.opacity,v.size.value=y.size*E,v.scale.value=L*.5,y.map&&(v.map.value=y.map),y.alphaMap&&(v.alphaMap.value=y.alphaMap);let C;y.map?C=y.map:y.alphaMap&&(C=y.alphaMap),C!==void 0&&(C.matrixAutoUpdate===!0&&C.updateMatrix(),v.uvTransform.value.copy(C.matrix))}function a(v,y){v.diffuse.value.copy(y.color),v.opacity.value=y.opacity,v.rotation.value=y.rotation,y.map&&(v.map.value=y.map),y.alphaMap&&(v.alphaMap.value=y.alphaMap);let E;y.map?E=y.map:y.alphaMap&&(E=y.alphaMap),E!==void 0&&(E.matrixAutoUpdate===!0&&E.updateMatrix(),v.uvTransform.value.copy(E.matrix))}function c(v,y){y.emissiveMap&&(v.emissiveMap.value=y.emissiveMap)}function l(v,y){v.specular.value.copy(y.specular),v.shininess.value=Math.max(y.shininess,1e-4),y.emissiveMap&&(v.emissiveMap.value=y.emissiveMap),y.bumpMap&&(v.bumpMap.value=y.bumpMap,v.bumpScale.value=y.bumpScale,y.side===Pt&&(v.bumpScale.value*=-1)),y.normalMap&&(v.normalMap.value=y.normalMap,v.normalScale.value.copy(y.normalScale),y.side===Pt&&v.normalScale.value.negate()),y.displacementMap&&(v.displacementMap.value=y.displacementMap,v.displacementScale.value=y.displacementScale,v.displacementBias.value=y.displacementBias)}function u(v,y){y.gradientMap&&(v.gradientMap.value=y.gradientMap),y.emissiveMap&&(v.emissiveMap.value=y.emissiveMap),y.bumpMap&&(v.bumpMap.value=y.bumpMap,v.bumpScale.value=y.bumpScale,y.side===Pt&&(v.bumpScale.value*=-1)),y.normalMap&&(v.normalMap.value=y.normalMap,v.normalScale.value.copy(y.normalScale),y.side===Pt&&v.normalScale.value.negate()),y.displacementMap&&(v.displacementMap.value=y.displacementMap,v.displacementScale.value=y.displacementScale,v.displacementBias.value=y.displacementBias)}function h(v,y){v.roughness.value=y.roughness,v.metalness.value=y.metalness,y.roughnessMap&&(v.roughnessMap.value=y.roughnessMap),y.metalnessMap&&(v.metalnessMap.value=y.metalnessMap),y.emissiveMap&&(v.emissiveMap.value=y.emissiveMap),y.bumpMap&&(v.bumpMap.value=y.bumpMap,v.bumpScale.value=y.bumpScale,y.side===Pt&&(v.bumpScale.value*=-1)),y.normalMap&&(v.normalMap.value=y.normalMap,v.normalScale.value.copy(y.normalScale),y.side===Pt&&v.normalScale.value.negate()),y.displacementMap&&(v.displacementMap.value=y.displacementMap,v.displacementScale.value=y.displacementScale,v.displacementBias.value=y.displacementBias),n.get(y).envMap&&(v.envMapIntensity.value=y.envMapIntensity)}function d(v,y){h(v,y),v.reflectivity.value=y.reflectivity,v.clearcoat.value=y.clearcoat,v.clearcoatRoughness.value=y.clearcoatRoughness,y.sheen&&v.sheen.value.copy(y.sheen),y.clearcoatMap&&(v.clearcoatMap.value=y.clearcoatMap),y.clearcoatRoughnessMap&&(v.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap),y.clearcoatNormalMap&&(v.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),v.clearcoatNormalMap.value=y.clearcoatNormalMap,y.side===Pt&&v.clearcoatNormalScale.value.negate()),v.transmission.value=y.transmission,y.transmissionMap&&(v.transmissionMap.value=y.transmissionMap)}function f(v,y){y.matcap&&(v.matcap.value=y.matcap),y.bumpMap&&(v.bumpMap.value=y.bumpMap,v.bumpScale.value=y.bumpScale,y.side===Pt&&(v.bumpScale.value*=-1)),y.normalMap&&(v.normalMap.value=y.normalMap,v.normalScale.value.copy(y.normalScale),y.side===Pt&&v.normalScale.value.negate()),y.displacementMap&&(v.displacementMap.value=y.displacementMap,v.displacementScale.value=y.displacementScale,v.displacementBias.value=y.displacementBias)}function p(v,y){y.displacementMap&&(v.displacementMap.value=y.displacementMap,v.displacementScale.value=y.displacementScale,v.displacementBias.value=y.displacementBias)}function b(v,y){y.displacementMap&&(v.displacementMap.value=y.displacementMap,v.displacementScale.value=y.displacementScale,v.displacementBias.value=y.displacementBias),v.referencePosition.value.copy(y.referencePosition),v.nearDistance.value=y.nearDistance,v.farDistance.value=y.farDistance}function w(v,y){y.bumpMap&&(v.bumpMap.value=y.bumpMap,v.bumpScale.value=y.bumpScale,y.side===Pt&&(v.bumpScale.value*=-1)),y.normalMap&&(v.normalMap.value=y.normalMap,v.normalScale.value.copy(y.normalScale),y.side===Pt&&v.normalScale.value.negate()),y.displacementMap&&(v.displacementMap.value=y.displacementMap,v.displacementScale.value=y.displacementScale,v.displacementBias.value=y.displacementBias)}return{refreshFogUniforms:e,refreshMaterialUniforms:t}}function h1(){const n=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return n.style.display="block",n}function ot(n){n=n||{};const e=n.canvas!==void 0?n.canvas:h1(),t=n.context!==void 0?n.context:null,i=n.alpha!==void 0?n.alph
2827a:!1,s=n.depth!==void 0?n.depth:!0,r=n.stencil!==void 0?n.stencil:!0,o=n.antialias!==void 0?n.antialias:!1,a=n.premultipliedAlpha!==void 0?n.premultipliedAlpha:!0,c=n.preserveDrawingBuffer!==void 0?n.preserveDrawingBuffer:!1,l=n.powerPreference!==void 0?n.powerPreference:"default",u=n.failIfMajorPerformanceCaveat!==void 0?n.failIfMajorPerformanceCaveat:!1;let h=null,d=null;const f=[],p=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=an,this.physicallyCorrectLights=!1,this.toneMapping=Qs,this.toneMappingExposure=1;const b=this;let w=!1,v=0,y=0,E=null,L=-1,C=null;const _=new at,D=new at;let F=null,H=e.width,W=e.height,Z=1,q=null,k=null;const O=new at(0,0,H,W),U=new at(0,0,H,W);let z=!1;const ne=new nl;let ce=!1,re=!1;const ge=new ve,ie=new S,ye={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Se(){return E===null?Z:1}let Q=t;function et(A,j){for(let V=0;V<A.length;V++){const J=A[V],de=e.getContext(J,j);if(de!==null)return de}return null}try{const A={alpha:i,depth:s,stencil:r,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(e.addEventListener("webglcontextlost",T,!1),e.addEventListener("webglcontextrestored",I,!1),Q===null){const j=["webgl2","webgl","experimental-webgl"];if(b.isWebGL1Renderer===!0&&j.shift(),Q=et(j,A),Q===null)throw et(j)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}Q.getShaderPrecisionFormat===void 0&&(Q.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(A){throw console.error("THREE.WebGLRenderer: "+A.message),A}let Ue,Te,Me,Ge,Be,Oe,se,oe,le,we,fe,P,R,ee,te,he,me,We,Ee,N,ae,M;function g(){Ue=new Ib(Q),Te=new Cb(Q,Ue,n),Ue.init(Te),ae=new o1(Q,Ue,Te),Me=new s1(Q,Ue,Te),Ge=new kb,Be=new jw,Oe=new r1(Q,Ue,Me,Be,Te,ae,Ge),se=new Pb(b),oe=new sy(Q,Te),M=new Ab(Q,Ue,oe,Te),le=new Bb(Q,oe,Ge,M),we=new Ob(Q,le,oe,Ge),We=new Fb(Q),te=new Rb(Be),fe=new qw(b,se,Ue,Te,M,te),P=new c1(Be),R=new Zw(Be),ee=new t1(Ue,Te),me=new Eb(b,se,Me,we,a),he=new Bp(b,we,Te),Ee=new Lb(Q,Ue,Ge,Te),N=new Db(Q,Ue,Ge,Te),Ge.programs=fe.programs,b.capabilities=Te,b.extensions=Ue,b.properties=Be,b.renderLists=R,b.shadowMap=he,b.state=Me,b.info=Ge}g();const x=new l1(b,Q);this.xr=x,this.getContext=function(){return Q},this.getContextAttributes=function(){return Q.getContextAttributes()},this.forceContextLoss=function(){const A=Ue.get("WEBGL_lose_context");A&&A.loseContext()},this.forceContextRestore=function(){const A=Ue.get("WEBGL_lose_context");A&&A.restoreContext()},this.getPixelRatio=function(){return Z},this.setPixelRatio=function(A){A!==void 0&&(Z=A,this.setSize(H,W,!1))},this.getSize=function(A){return A===void 0&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),A=new $),A.set(H,W)},this.setSize=function(A,j,V){if(x.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}H=A,W=j,e.width=Math.floor(A*Z),e.height=Math.floor(j*Z),V!==!1&&(e.style.width=A+"px",e.style.height=j+"px"),this.setViewport(0,0,A,j)},this.getDrawingBufferSize=function(A){return A===void 0&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),A=new $),A.set(H*Z,W*Z).floor()},this.setDrawingBufferSize=function(A,j,V){H=A,W=j,Z=V,e.width=Math.floor(A*V),e.height=Math.floor(j*V),this.setViewport(0,0,A,j)},this.getCurrentViewport=function(A){return A===void 0&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),A=new at),A.copy(_)},this.getViewport=function(A){return A.copy(O)},this.setViewport=function(A,j,V,J){A.isVector4?O.set(A.x,A.y,A.z,A.w):O.set(A,j,V,J),Me.viewport(_.copy(O).multiplyScalar(Z).floor())},this.getScissor=function(A){return A.copy(U)},this.setScissor=function(A,j,V,J){A.isVector4?U.set(A.x,A.y,A.z,A.w):U.set(A,j,V,J),Me.scissor(D.copy(U).multiplyScalar(Z).floor())}
2827,this.getScissorTest=function(){return z},this.setScissorTest=function(A){Me.setScissorTest(z=A)},this.setOpaqueSort=function(A){q=A},this.setTransparentSort=function(A){k=A},this.getClearColor=function(A){return A===void 0&&(console.warn("WebGLRenderer: .getClearColor() now requires a Color as an argument"),A=new pe),A.copy(me.getClearColor())},this.setClearColor=function(){me.setClearColor.apply(me,arguments)},this.getClearAlpha=function(){return me.getClearAlpha()},this.setClearAlpha=function(){me.setClearAlpha.apply(me,arguments)},this.clear=function(A,j,V){let J=0;(A===void 0||A)&&(J|=16384),(j===void 0||j)&&(J|=256),(V===void 0||V)&&(J|=1024),Q.clear(J)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",T,!1),e.removeEventListener("webglcontextrestored",I,!1),R.dispose(),ee.dispose(),Be.dispose(),se.dispose(),we.dispose(),M.dispose(),x.dispose(),x.removeEventListener("sessionstart",tt),x.removeEventListener("sessionend",eu),qi.stop()};function T(A){A.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),w=!0}function I(){console.log("THREE.WebGLRenderer: Context Restored."),w=!1;const A=Ge.autoReset,j=he.enabled,V=he.autoUpdate,J=he.needsUpdate,de=he.type;g(),Ge.autoReset=A,he.enabled=j,he.autoUpdate=V,he.needsUpdate=J,he.type=de}function G(A){const j=A.target;j.removeEventListener("dispose",G),Y(j)}function Y(A){be(A),Be.remove(A)}function be(A){const j=Be.get(A).programs;j!==void 0&&j.forEach(function(V){fe.releaseProgram(V)})}function Ze(A,j){A.render(function(V){b.renderBufferImmediate(V,j)})}this.renderBufferImmediate=function(A,j){M.initAttributes();const V=Be.get(A);A.hasPositions&&!V.position&&(V.position=Q.createBuffer()),A.hasNormals&&!V.normal&&(V.normal=Q.createBuffer()),A.hasUvs&&!V.uv&&(V.uv=Q.createBuffer()),A.hasColors&&!V.color&&(V.color=Q.createBuffer());const J=j.getAttributes();A.hasPositions&&(Q.bindBuffer(34962,V.position),Q.bufferData(34962,A.positionArray,35048),M.enableAttribute(J.position),Q.vertexAttribPointer(J.position,3,5126,!1,0,0)),A.hasNormals&&
2827(Q.bindBuffer(34962,V.normal),Q.bufferData(34962,A.normalArray,35048),M.enableAttribute(J.normal),Q.vertexAttribPointer(J.normal,3,5126,!1,0,0)),A.hasUvs&&(Q.bindBuffer(34962,V.uv),Q.bufferData(34962,A.uvArray,35048),M.enableAttribute(J.uv),Q.vertexAttribPointer(J.uv,2,5126,!1,0,0)),A.hasColors&&(Q.bindBuffer(34962,V.color),Q.bufferData(34962,A.colorArray,35048),M.enableAttribute(J.color),Q.vertexAttribPointer(J.color,3,5126,!1,0,0)),M.disableUnusedAttributes(),Q.drawArrays(4,0,A.count),A.count=0},this.renderBufferDirect=function(A,j,V,J,de,Xe){j===null&&(j=ye);const Le=de.isMesh&&de.matrixWorld.determinant()<0,Ie=ru(A,j,J,de);Me.setMaterial(J,Le);let lt=V.index;const Re=V.attributes.position;if(lt===null){if(Re===void 0||Re.count===0)return}else if(lt.count===0)return;let Ke=1;J.wireframe===!0&&(lt=le.getWireframeAttribute(V),Ke=2),(J.morphTargets||J.morphNormals)&&We.update(de,V,J,Ie),M.setup(de,J,Ie,V,lt);let Ce,it=Ee;lt!==null&&(Ce=oe.get(lt),it=N,it.setIndex(Ce));const Pn=lt!==null?lt.count:Re.count,Zt=V.drawRange.start*Ke,ji=V.drawRange.count*Ke,Ct=Xe!==null?Xe.start*Ke:0,Xi=Xe!==null?Xe.count*Ke:1/0,Tt=Math.max(Zt,Ct),Tl=Math.min(Pn,Zt+ji,Ct+Xi)-1,tn=Math.max(0,Tl-Tt+1);if(tn!==0){if(de.isMesh)J.wireframe===!0?(Me.setLineWidth(J.wireframeLinewidth*Se()),it.setMode(1)):it.setMode(4);else if(de.isLine){let Yn=J.linewidth;Yn===void 0&&(Yn=1),Me.setLineWidth(Yn*Se()),de.isLineSegments?it.setMode(1):de.isLineLoop?it.setMode(2):it.setMode(3)}else de.isPoints?it.setMode(0):de.isSprite&&it.setMode(4);if(de.isInstancedMesh)it.renderInstances(Tt,tn,de.count);else if(V.isInstancedBufferGeometry){const Yn=Math.min(V.instanceCount,V._maxInstanceCount);it.renderInstances(Tt,tn,Yn)}else it.render(Tt,tn)}},this.compile=function(A,j){d=ee.get(A),d.init(),A.traverseVisible(function(V){V.isLight&&V.layers.test(j.layers)&&(d.pushLight(V),V.castShadow&&d.pushShadow(V))}),d.setupLights(),A.traverse(function(V){const J=V.material;if(J)if(Array.isArray(J))for(let de=0;de<J.length;de++){const Xe=J[de];Sl(Xe,A,V)}else Sl(J,A,V)})};let Ve=null;function ut(A){Ve&&Ve(A)}function tt(){qi.stop()}function eu(){qi.start()}const qi=new wp;qi.setAnimationLoop(ut),typeof window<"u"&&qi.setContext(window),this.setAnimationLoop=function(A){Ve=A,x.setAnimationLoop(A),A===null?qi.stop():qi.start()},x.addEventListener("sessionstart",tt),x.addEventListener("sessionend",eu),this.render=function(A,j){let V,J;if(arguments[2]!==void 0&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),V=arguments[2]),arguments[3]!==void 0&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),J=arguments[3]),j!==void 0&&j.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(w===!0)return;A.autoUpdate===!0&&A.updateMatrixWorld(),j.parent===null&&j.updateMatrixWorld(),x.enabled===!0&&x.isPresenting===!0&&(j=x.getCamera(j)),A.isScene===!0&&A.onBeforeRender(b,A,j,V||E),d=ee.get(A,p.length),d.init(),p.push(d),ge.multiplyMatrices(j.projectionMatrix,j.matrixWorldInverse),ne.setFromProjectionMatrix(ge),re=this.localClippingEnabled,ce=te.init(this.clippingPlanes,re,j),h=R.get(A,f.length),h.init(),f.push(h),tu(A,j,0,b.sortObjects),h.finish(),b.sortObjects===!0&&h.sort(q,k),ce===!0&&te.beginShadows();const de=d.state.shadowsArray;he.render(de,A,j),d.setupLights(),d.setupLightsView(j),ce===!0&&te.endShadows(),this.info.autoReset===!0&&this.info.reset(),V!==void 0&&this.setRenderTarget(V),me.render(h,A,j,J);const Xe=h.opaque,Le=h.transparent;Xe.length>0&&nu(Xe,A,j),Le.length>0&&nu(Le,A,j),E!==null&&(Oe.updateRenderTargetMipmap(E),Oe.updateMultisampleRenderTarget(E)),A.isScene===!0&&A.onAfterRender(b,A,j),Me.buffers.depth.setTest(!0),Me.buffers.depth.setMask(!0),Me.buffers.color.setMask(!0),Me.setPolygonOffset(!1),M.resetDefaultState(),L=-1,C=null,p.pop(),p.length>0?d=p[p.length-1]:d=null,f.pop(),f.length>0?h=f[f.length-1]:h=null};function tu(A,j,V,J){if(A.visible===!1)return;if(A.layers.test(j.layers)){if(A.isGroup)V=A.renderOrder;else if(A.isLOD)A.autoUpdate===!0&&A.update(j);else if(A.isLight)d.pushLight(A),A.castShadow&&d.pushShadow(A);else if(A.isSprite){if(!A.frustumCulled||ne.intersectsSprite(A)){J&&ie.setFromMatrixPosition(A.matrixWorld).applyMatrix4(ge);const Le=we.update(A),Ie=A.material;Ie.visible&&h.push(A,Le,Ie,V,ie.z,null)}}else if(A.isImmediateRenderObject)J&&ie.setFromMatrixPosition(A.matrixWorld).applyMatrix4(ge),h.push(A,null,A.material,V,ie.z,null);else if((A.isMesh||A.isLine||A.isPoints)&&(A.isSkinnedMesh&&A.skeleton.frame!==Ge.render.frame&&(A.skeleton.update(),A.skeleton.frame=Ge.render.frame),!A.frustumCulled||ne.intersectsObject(A))){J&&ie.setFromMatrixPosition(A.matrixWorld).applyMatrix4(ge);const Le=we.update(A),Ie=A.material;if(Array.isArray(Ie)){const lt=Le.groups;for(let Re=0,Ke=lt.length;Re<Ke;Re++){const Ce=lt[Re],it=Ie[Ce.materialIndex];it&&it.visible&&h.push(A,Le,it,V,ie.z,Ce)}}else Ie.visible&&h.push(A,Le,Ie,V,ie.z,null)}}const Xe=A.children;for(let Le=0,Ie=Xe.length;Le<Ie;Le++)tu(Xe[Le],j,V,J)}function nu(A,j,V){const J=j.isScene===!0?j.overrideMaterial:null;for(let de=0,Xe=A.length;de<Xe;de++){const Le=A[de],Ie=Le.object,lt=Le.geometry,Re=J===null?Le.material:J,Ke=Le.group;if(V.isArrayCamera){const Ce=V.cameras;for(let it=0,Pn=Ce.length;it<Pn;it++){const Zt=Ce[it];Ie.layers.test(Zt.layers)&&(Me.viewport(_.copy(Zt.viewport)),d.setupLightsView(Zt),iu(Ie,j,Zt,lt,Re,Ke))}}else iu(Ie,j,V,lt,Re,Ke)}}function iu(A,j,V,J,de,Xe){if(A.onBeforeRender(b,j,V,J,de,Xe),A.modelViewMatrix.multiplyMatrices(V.matrixWorldInverse,A.matrixWorld),A.normalMatrix.getNormalMatrix(A.modelViewMatrix),A.isImmediateRenderObject){const Le=ru(V,j,de,A);Me.setMaterial(de),M.reset(),Ze(A,Le)}else b.renderBufferDirect(V,j,J,de,A,Xe);A.onAfterRender(b,j,V,J,de,Xe)}function Sl(A,j,V){j.isScene!==!0&&(j=ye);const J=Be.get(A),de=d.state.lights,Xe=d.state.shadowsArray,Le=de.state.ver
2827sion,Ie=fe.getParameters(A,de.state,Xe,j,V),lt=fe.getProgramCacheKey(Ie);let Re=J.programs;J.environment=A.isMeshStandardMaterial?j.environment:null,J.fog=j.fog,J.envMap=se.get(A.envMap||J.environment),Re===void 0&&(A.addEventListener("dispose",G),Re=new Map,J.programs=Re);let Ke=Re.get(lt);if(Ke!==void 0){if(J.currentProgram===Ke&&J.lightsStateVersion===Le)return su(A,Ie),Ke}else Ie.uniforms=fe.getUniforms(A),A.onBuild(Ie,b),A.onBeforeCompile(Ie,b),Ke=fe.acquireProgram(Ie,lt),Re.set(lt,Ke),J.uniforms=Ie.uniforms;const Ce=J.uniforms;(!A.isShaderMaterial&&!A.isRawShaderMaterial||A.clipping===!0)&&(Ce.clippingPlanes=te.uniform),su(A,Ie),J.needsLights=X0(A),J.lightsStateVersion=Le,J.needsLights&&(Ce.ambientLightColor.value=de.state.ambient,Ce.lightProbe.value=de.state.probe,Ce.directionalLights.value=de.state.directional,Ce.directionalLightShadows.value=de.state.directionalShadow,Ce.spotLights.value=de.state.spot,Ce.spotLightShadows.value=de.state.spotShadow,Ce.rectAreaLights.value=de.state.rectArea,Ce.ltc_1.value=de.state.rectAreaLTC1,Ce.ltc_2.value=de.state.rectAreaLTC2,Ce.pointLights.value=de.state.point,Ce.pointLightShadows.value=de.state.pointShadow,Ce.hemisphereLights.value=de.state.hemi,Ce.directionalShadowMap.value=de.state.directionalShadowMap,Ce.directionalShadowMatrix.value=de.state.directionalShadowMatrix,Ce.spotShadowMap.value=de.state.spotShadowMap,Ce.spotShadowMatrix.value=de.state.spotShadowMatrix,Ce.pointShadowMap.value=de.state.pointShadowMap,Ce.pointShadowMatrix.value=de.state.pointShadowMatrix);const it=Ke.getUniforms(),Pn=Ni.seqWithValue(it.seq,Ce);return J.currentProgram=Ke,J.uniformsList=Pn,Ke}function su(A,j){const V=Be.get(A);V.outputEncoding=j.outputEncoding,V.instancing=j.instancing,V.numClippingPlanes=j.numClippingPlanes,V.numIntersection=j.numClipIntersection,V.vertexAlphas=j.vertexAlphas}function ru(A,j,V,J){j.isScene!==!0&&(j=ye),Oe.resetTextureUnits();const de=j.fog,Xe=V.isMeshStandardMaterial?j.environment:null,Le=E===null?b.outputEncoding:E.texture.encoding,Ie=se.get(V.envMap||Xe),lt=V.vertexColors===!0&&J.geometry&&J.geometry.attributes.color&&J.geometry.attributes.color.itemSize===4,Re=Be.get(V),Ke=d.state.lights;if(ce===!0&&(re===!0||A!==C)){const Tt=A===C&&V.id===L;te.setState(V,A,Tt)}let Ce=!1;V.version===Re.__version?(Re.needsLights&&Re.lightsStateVersion!==Ke.state.version||Re.outputEncoding!==Le||J.isInstancedMesh&&Re.instancing===!1||!J.isInstancedMesh&&Re.instancing===!0||Re.envMap!==Ie||V.fog&&Re.fog!==de||Re.numClippingPlanes!==void 0&&(Re.numClippingPlanes!==te.numPlanes||Re.numIntersection!==te.numIntersection)||Re.vertexAlphas!==lt)&&(Ce=!0):(Ce=!0,Re.__version=V.version);let it=Re.currentProgram;Ce===!0&&(it=Sl(V,j,J));let Pn=!1,Zt=!1,ji=!1;const Ct=it.getUniforms(),Xi=Re.uniforms;if(Me.useProgram(it.program)&&(Pn=!0,Zt=!0,ji=!0),V.id!==L&&(L=V.id,Zt=!0),Pn||C!==A){if(Ct.setValue(Q,"projectionMatrix",A.projectionMatrix),Te.logarithmicDepthBuffer&&Ct.setValue(Q,"logDepthBufFC",2/(Math.log(A.far+1)/Math.LN2)),C!==A&&(C=A,Zt=!0,ji=!0),V.isShaderMaterial||V.isMeshPhongMaterial||V.isMeshToonMaterial||V.isMeshStandardMaterial||V.envMap){const Tt=Ct.map.cameraPosition;Tt!==void 0&&Tt.setValue(Q,ie.setFromMatrixPosition(A.matrixWorld))}(V.isMeshPhongMaterial||V.isMeshToonMaterial||V.isMeshLambertMaterial||V.isMeshBasicMaterial||V.isMeshStandardMaterial||V.isShaderMaterial)&&Ct.setValue(Q,"isOrthographic",A.isOrthographicCamera===!0),(V.isMeshPhongMaterial||V.isMeshToonMaterial||V.isMeshLambertMaterial||V.isMeshBasicMaterial||V.isMeshStandardMaterial||V.isShaderMaterial||V.isShadowMaterial||V.skinning)&&Ct.setValue(Q,"viewMatrix",A.matrixWorldInverse)}if(V.skinning){Ct.setOptional(Q,J,"bindMatrix"),Ct.setOptional(Q,J,"bindMatrixInverse");const Tt=J.skeleton;if(Tt){const Tl=Tt.bones;if(Te.floatVertexTextures){if(Tt.boneTexture===null){let tn=Math.sqrt(Tl.length*4);tn=fp(tn),tn=Math.max(tn,4);const Yn=new Float32Array(tn*tn*4);Yn.set(Tt.boneMatrices);const Y0=new oh(Yn,tn,tn,Jt,Pi);Tt.boneMatrices=Yn,Tt.boneTexture=Y0,Tt.boneTextureSize=tn}Ct.setValue(Q,"boneTexture",Tt.boneTexture,Oe),Ct.setValue(Q,"boneTextureSize",Tt.boneTextureSize)}else Ct.setOptional(Q,Tt,"boneMatrices")}}
2827return(Zt||Re.receiveShadow!==J.receiveShadow)&&(Re.receiveShadow=J.receiveShadow,Ct.setValue(Q,"receiveShadow",J.receiveShadow)),Zt&&(Ct.setValue(Q,"toneMappingExposure",b.toneMappingExposure),Re.needsLights&&j0(Xi,ji),de&&V.fog&&P.refreshFogUniforms(Xi,de),P.refreshMaterialUniforms(Xi,V,Z,W),Ni.upload(Q,Re.uniformsList,Xi,Oe)),V.isShaderMaterial&&V.uniformsNeedUpdate===!0&&(Ni.upload(Q,Re.uniformsList,Xi,Oe),V.uniformsNeedUpdate=!1),V.isSpriteMaterial&&Ct.setValue(Q,"center",J.center),Ct.setValue(Q,"modelViewMatrix",J.modelViewMatrix),Ct.setValue(Q,"normalMatrix",J.normalMatrix),Ct.setValue(Q,"modelMatrix",J.matrixWorld),it}function j0(A,j){A.ambientLightColor.needsUpdate=j,A.lightProbe.needsUpdate=j,A.directionalLights.needsUpdate=j,A.directionalLightShadows.needsUpdate=j,A.pointLights.needsUpdate=j,A.pointLightShadows.needsUpdate=j,A.spotLights.needsUpdate=j,A.spotLightShadows.needsUpdate=j,A.rectAreaLights.needsUpdate=j,A.hemisphereLights.needsUpdate=j}function X0(A){return A.isMeshLambertMaterial||A.isMeshToonMaterial||A.isMeshPhongMaterial||A.isMeshStandardMaterial||A.isShadowMaterial||A.isShaderMaterial&&A.lights===!0}this.getActiveCubeFace=function(){return v},this.getActiveMipmapLevel=function(){return y},this.getRenderTarget=function(){return E},this.setRenderTarget=function(A,j=0,V=0){E=A,v=j,y=V,A&&Be.get(A).__webglFramebuffer===void 0&&Oe.setupRenderTarget(A);let J=null,de=!1,Xe=!1;if(A){const Le=A.texture;(Le.isDataTexture3D||Le.isDataTexture2DArray)&&(Xe=!0);const Ie=Be.get(A).__webglFramebuffer;A.isWebGLCubeRenderTarget?(J=Ie[j],de=!0):A.isWebGLMultisampleRenderTarget?J=Be.get(A).__webglMultisampledFramebuffer:J=Ie,_.copy(A.viewport),D.copy(A.scissor),F=A.scissorTest}else _.copy(O).multiplyScalar(Z).floor(),D.copy(U).multiplyScalar(Z).floor(),F=z;if(Me.bindFramebuffer(36160,J),Me.viewport(_),Me.scissor(D),Me.setScissorTest(F),de){const Le=Be.get(A.texture);Q.framebufferTexture2D(36160,36064,34069+j,Le.__webglTexture,V)}else if(Xe){const Le=Be.get(A.texture),Ie=j||0;Q.framebufferTextureLayer(36160,36064,Le.__webglTexture,V||0,Ie)}},this.readRenderTargetPixels=function(A,j,V,J,de,Xe,Le){if(!(A&&A.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ie=Be.get(A).__webglFramebuffer;if(A.isWebGLCubeRenderTarget&&Le!==void 0&&(Ie=Ie[Le]),Ie){Me.bindFramebuffer(36160,Ie);try{const lt=A.texture,Re=lt.format,Ke=lt.type;if(Re!==Jt&&ae.convert(Re)!==Q.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ce=Ke===Ra&&(Ue.has("EXT_color_buffer_half_float")||Te.isWebGL2&&Ue.has("EXT_color_buffer_float"));if(Ke!==So&&ae.convert(Ke)!==Q.getParameter(35738)&&!(Ke===Pi&&(Te.isWebGL2||Ue.has("OES_texture_float")||Ue.has("WEBGL_color_buffer_float")))&&!Ce){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Q.checkFramebufferStatus(36160)===36053?j>=0&&j<=A.width-J&&V>=0&&V<=A.height-de&&Q.readPixels(j,V,J,de,ae.convert(Re),ae.convert(Ke),Xe):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const lt=E!==null?Be.get(E).__webglFramebuffer:null;Me.bindFramebuffer(36160,lt)}}},this.copyFramebufferToTexture=function(A,j,V=0){const J=Math.pow(2,-V),de=Math.floor(j.image.width*J),Xe=Math.floor(j.image.height*J),Le=ae.convert(j.format);Oe.setTexture2D(j,0),Q.copyTexImage2D(3553,V,Le,A.x,A.y,de,Xe,0),Me.unbindTexture()},this.copyTextureToTexture=function(A,j,V,J=0){const de=j.image.width,Xe=j.image.height,Le=ae.convert(V.format),Ie=ae.convert(V.type);Oe.setTexture2D(V,0),Q.pixelStorei(37440,V.flipY),Q.pixelStorei(37441,V.premultiplyAlpha),Q.pixelStorei(3317,V.unpackAlignment),j.isDataTexture?Q.texSubImage2D(3553,J,A.x,A.y,de,Xe,Le,Ie,j.image.data):j.isCompressedTexture?Q.compressedTexSubImage2D(3553,J,A.x,A.y,j.mipmaps[0].width,j.mipmaps[0].height,Le,j.mipmaps[0].data):Q.texSubImage2D(3553,J,A.x,A.y,Le,Ie,j.image),J===0&&V.generateMipmaps&&Q.generateMipmap(3553),Me.unbindTexture()},this.copyTextureToTexture3D=function(A,j,V,J,de=0){if(b.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const{width:Xe,height:Le,data:Ie}=V.image,lt=ae.convert(J.format),Re=ae.convert(J.type);let Ke;if(J.isDataTexture3D)Oe.setTexture3D(J,0),Ke=32879;else if(J.isDataTexture2DArray)Oe.setTexture2DArray(J,0),Ke=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Q.pixelStorei(37440,J.flipY),Q.pixelStorei(37441,J.premultiplyAlpha),Q.pixelStorei(3317,J.unpackAlignment);const Ce=Q.getParameter(3314),it=Q.getParameter(32878),Pn=Q.getParameter(3316),Zt=Q.getParameter(3315),ji=Q.getParameter(32877);Q.pixelStorei(3314,Xe),Q.pixelStorei(32878,Le),Q.pixelStorei(3316,A.min.x),Q.pixelStorei(3315,A.min.y),Q.pixelStorei(32877,A.min.z),Q.texSubImage3D(Ke,de,j.x,j.y,j.z,A.max.x-A.min.x+1,A.max.y-A.min.y+1,A.max.z-A.min.z+1,lt,Re,Ie),Q.pixelStorei(3314,Ce),Q.pixelStorei(32878,it),Q.pixelStorei(3316,Pn),Q.pixelStorei(3315,Zt),Q.pixelStorei(32877,ji),de===0&&J.generateMipmaps&&Q.generateMipmap(Ke),Me.unbindTexture()},this.initTexture=function(A){Oe.setTexture2D(A,0),Me.unbindTexture()},this.resetState=function(){v=0,y=0,E=null,Me.reset(),M.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class u1 extends ot{}u1.prototype.isWebGL1Renderer=!0;class il{constructor(e,t=1,i=1e3){this.name="",this.color=new pe(e),this.near=t,this.far=i}clone(){return new il(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}il.prototype.isFog=!0;class To extends $e{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,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()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.background!==null&&(t.object.background=this.background.toJSON(e)),this.environment!==null&&(t.object.environment=this.environment.toJSON(e)),this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}}To.prototype.isScene=!0;class Vi{constructor(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=co,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=xn(),this.onUploadCallback=function(){}}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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 s=0,r=this.stride;s<r;s++)this.array[e+s]=t.array[i+s];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=xn()),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 Vi(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=xn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}Vi.prototype.isInterleavedBuffer=!0;const Mt=new S;class lr{constructor(e,t,i,s){this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=s===!0}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++)Mt.x=this.getX(t),Mt.y=this.getY(t),Mt.z=this.getZ(t),Mt.applyMatrix4(e),this.setXYZ(t,Mt.x,Mt.y,Mt.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Mt.x=this.getX(t),Mt.y=this.getY(t),Mt.z=this.getZ(t),Mt.applyNormalMatrix(e),this.setXYZ(t,Mt.x,Mt.y,Mt.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Mt.x=this.getX(t),Mt.y=this.getY(t),Mt.z=this.getZ(t),Mt.transformDirection(e),this.setXYZ(t,Mt.x,Mt.y,Mt.z);return this}setX(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){return this.data.array[e*this.data.stride+this.offset]}getY(e){return this.data.array[e*this.data.stride+this.offset+1]}getZ(e){return this.data.array[e*this.data.stride+this.offset+2]}getW(e){return this.data.array[e*this.data.stride+this.offset+3]}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,s){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=s,this}setXYZW(e,t,i,s,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=s,this.data.array[e+3]=r,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const s=i*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[s+r])}return new xt(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 lr(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const s=i*this.data.stride+this.offset;for(let r=0;r<this.itemSize;r++)t.push(this.data.array[s+r])}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}}}lr.prototype.isInterleavedBufferAttribute=!0;class Eo extends Lt{constructor(e){super(),this.type="SpriteMaterial",this.color=new pe(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!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}}Eo.prototype.isSpriteMaterial=!0;let ks;const Nr=new S,Ns=new S,zs=new S,Fs=new $,zr=new $,kp=new ve,$o=new S,Fr=new S,ea=new S,Qu=new $,ec=new $,$u=new $;class sl extends $e{constructor(e){if(super(),this.type="Sprite",ks===void 0){ks=new qe;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 Vi(t,5);ks.setIndex([0,1,2,0,2,3]),ks.setAttribute("position",new lr(i,3,0,!1)),ks.setAttribute("uv",new lr(i,2,3,!1))}
2827this.geometry=ks,this.material=e!==void 0?e:new Eo,this.center=new $(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ns.setFromMatrixScale(this.matrixWorld),kp.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),zs.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Ns.multiplyScalar(-zs.z);const i=this.material.rotation;let s,r;i!==0&&(r=Math.cos(i),s=Math.sin(i));const o=this.center;ta($o.set(-.5,-.5,0),zs,o,Ns,s,r),ta(Fr.set(.5,-.5,0),zs,o,Ns,s,r),ta(ea.set(.5,.5,0),zs,o,Ns,s,r),Qu.set(0,0),ec.set(1,0),$u.set(1,1);let a=e.ray.intersectTriangle($o,Fr,ea,!1,Nr);if(a===null&&(ta(Fr.set(-.5,.5,0),zs,o,Ns,s,r),ec.set(0,1),a=e.ray.intersectTriangle($o,ea,Fr,!1,Nr),a===null))return;const c=e.ray.origin.distanceTo(Nr);c<e.near||c>e.far||t.push({distance:c,point:Nr.clone(),uv:Bt.getUV(Nr,$o,Fr,ea,Qu,ec,$u,new $),face:null,object:this})}copy(e){return super.copy(e),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}sl.prototype.isSprite=!0;function ta(n,e,t,i,s,r){Fs.subVectors(n,t).addScalar(.5).multiply(i),s!==void 0?(zr.x=r*Fs.x-s*Fs.y,zr.y=s*Fs.x+r*Fs.y):zr.copy(Fs),n.copy(e),n.x+=zr.x,n.y+=zr.y,n.applyMatrix4(kp)}const ed=new S,td=new at,nd=new at,d1=new S,id=new ve;class ah extends X{constructor(e,t){super(e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new ve,this.bindMatrixInverse=new ve}copy(e){return super.copy(e),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,this}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 at,t=this.geometry.attributes.skinWeight;for(let i=0,s=t.count;i<s;i++){e.x=t.getX(i),e.y=t.getY(i),e.z=t.getZ(i),e.w=t.getW(i);const r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(e,t){const i=this.skeleton,s=this.geometry;td.fromBufferAttribute(s.attributes.skinIndex,e),nd.fromBufferAttribute(s.attributes.skinWeight,e),ed.fromBufferAttribute(s.attributes.position,e).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let r=0;r<4;r++){const o=nd.getComponent(r);if(o!==0){const a=td.getComponent(r);id.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(d1.copy(ed).applyMatrix4(id),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}ah.prototype.isSkinnedMesh=!0;class lh extends $e{constructor(){super(),this.type="Bone"}}lh.prototype.isBone=!0;const sd=new ve,f1=new ve;class ch{constructor(e=[],t=[]){this.uuid=xn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,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){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,s=this.bones.length;i<s;i++)this.boneInverses.push(new ve)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new ve;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,s=this.boneTexture;for(let r=0,o=e.length;r<o;r++){const a=e[r]?e[r].matrixWorld:f1;sd.multiplyMatrices(a,t[r]),sd.toArray(i,r*16)}s!==null&&(s.needsUpdate=!0)}clone(){return new ch(this.bones,this.boneInverses)}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){const s=this.bones[t];if(s.name===e)return s}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,s=e.bones.length;i<s;
2827i++){const r=e.bones[i];let o=t[r];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",r),o=new lh),this.bones.push(o),this.boneInverses.push(new ve().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){const e={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,i=this.boneInverses;for(let s=0,r=t.length;s<r;s++){const o=t[s];e.bones.push(o.uuid);const a=i[s];e.boneInverses.push(a.toArray())}return e}}const rd=new ve,od=new ve,na=[],Or=new X;class p1 extends X{constructor(e,t,i){super(e,t),this.instanceMatrix=new xt(new Float32Array(i*16),16),this.instanceColor=null,this.count=i,this.frustumCulled=!1}copy(e){return super.copy(e),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}raycast(e,t){const i=this.matrixWorld,s=this.count;if(Or.geometry=this.geometry,Or.material=this.material,Or.material!==void 0)for(let r=0;r<s;r++){this.getMatrixAt(r,rd),od.multiplyMatrices(i,rd),Or.matrixWorld=od,Or.raycast(e,na);for(let o=0,a=na.length;o<a;o++){const c=na[o];c.instanceId=r,c.object=this,t.push(c)}na.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new xt(new Float32Array(this.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}p1.prototype.isInstancedMesh=!0;class wr extends Lt{constructor(e){super(),this.type="LineBasicMaterial",this.color=new pe(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.morphTargets=e.morphTargets,this}}wr.prototype.isLineBasicMaterial=!0;const ad=new S,ld=new S,cd=new ve,tc=new gs,ia=new ms;class rl extends $e{constructor(e=new qe,t=new wr){super(),this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,i=[0];for(let s=1,r=t.count;s<r;s++)ad.fromBufferAttribute(t,s-1),ld.fromBufferAttribute(t,s),i[s]=i[s-1],i[s]+=ad.distanceTo(ld);e.setAttribute("lineDistance",new Ne(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(e,t){const i=this.geometry,s=this.matrixWorld,r=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),ia.copy(i.boundingSphere),ia.applyMatrix4(s),ia.radius+=r,e.ray.intersectsSphere(ia)===!1)return;cd.copy(s).invert(),tc.copy(e.ray).applyMatrix4(cd);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a,l=new S,u=new S,h=new S,d=new S,f=this.isLineSegments?2:1;if(i.isBufferGeometry){const p=i.index,w=i.attributes.position;if(p!==null){const v=Math.max(0,o.start),y=Math.min(p.count,o.start+o.count);for(let E=v,L=y-1;E<L;E+=f){const C=p.getX(E),_=p.getX(E+1);if(l.fromBufferAttribute(w,C),u.fromBufferAttribute(w,_),tc.distanceSqToSegment(l,u,d,h)>c)continue;d.applyMatrix4(this.matrixWorld);const F=e.ray.origin.distanceTo(d);F<e.near||F>e.far||t.push({distance:F,point:h.clone().applyMatrix4(this.matrixWorld),index:E,face:null,faceIndex:null,object:this})}}else{const v=Math.max(0,o.start),y=Math.min(w.count,o.start+o.count);for(let E=v,L=y-1;E<L;E+=f){if(l.fromBufferAttribute(w,E),u.fromBufferAttribute(w,E+1),tc.distanceSqToSegment(l,u,d,h)>c)continue;d.applyMatrix4(this.matrixWorld);const _=e.ray.origin.distanceTo(d);_<e.near||_>e.far||t.push({distance:_,point:h.clone().applyMatrix4(this.matrixWorld),index:E,face:null,faceIndex:null,object:this})}}}else i.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,i=Object.keys(t);if(i.length>0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){const a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}rl.prototype.isLine=!0;const hd=new S,ud=new S;class ol extends rl{constructor(e,t){super(e,t),this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.isBufferGeometry)if(e.index===null){const t=e.attributes.position,i=[];for(let s=0,r=t.count;s<r;s+=2)hd.fromBufferAttribute(t,s),ud.fromBufferAttribute(t,s+1),i[s]=s===0?0:i[s-1],i[s+1]=i[s]+hd.distanceTo(ud);e.setAttribute("lineDistance",new Ne(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else e.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() n
2827o longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}ol.prototype.isLineSegments=!0;class Np extends rl{constructor(e,t){super(e,t),this.type="LineLoop"}}Np.prototype.isLineLoop=!0;class hh extends Lt{constructor(e){super(),this.type="PointsMaterial",this.color=new pe(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,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.morphTargets=e.morphTargets,this}}hh.prototype.isPointsMaterial=!0;const dd=new ve,Cc=new gs,sa=new ms,ra=new S;class zp extends $e{constructor(e=new qe,t=new hh){super(),this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e){return super.copy(e),this.material=e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,s=this.matrixWorld,r=e.params.Points.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),sa.copy(i.boundingSphere),sa.applyMatrix4(s),sa.radius+=r,e.ray.intersectsSphere(sa)===!1)return;dd.copy(s).invert(),Cc.copy(e.ray).applyMatrix4(dd);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),c=a*a;if(i.isBufferGeometry){const l=i.index,h=i.attributes.position;if(l!==null){const d=Math.max(0,o.start),f=Math.min(l.count,o.start+o.count);for(let p=d,b=f;p<b;p++){const w=l.getX(p);ra.fromBufferAttribute(h,w),fd(ra,w,c,s,e,t,this)}}else{const d=Math.max(0,o.start),f=Math.min(h.count,o.start+o.count);for(let p=d,b=f;p<b;p++)ra.fromBufferAttribute(h,p),fd(ra,p,c,s,e,t,this)}}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const e=this.geometry;if(e.isBufferGeometry){const t=e.morphAttributes,i=Object.keys(t);if(i.length>0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r<o;r++){const a=s[r].name||String(r);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=r}}}}else{const t=e.morphTargets;t!==void 0&&t.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}zp.prototype.isPoints=!0;function fd(n,e,t,i,s,r,o){const a=Cc.distanceSqToPoint(n);if(a<t){const c=new S;Cc.closestPointToPoint(n,c),c.applyMatrix4(i);const l=s.ray.origin.distanceTo(c);if(l<s.near||l>s.far)return;r.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:e,face:null,object:o})}}class m1 extends kt{constructor(e,t,i,s,r,o,a,c,l){super(e,t,i,s,r,o,a,c,l),this.format=a!==void 0?a:Wn,this.minFilter=o!==void 0?o:St,this.magFilter=r!==void 0?r:St,this.generateMipmaps=!1;const u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}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)}}m1.prototype.isVideoTexture=!0;class g1 extends kt{constructor(e,t,i,s,r,o,a,c,l,u,h,d){super(null,o,a,c,l,u,s,r,h,d),this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}g1.prototype.isCompressedTexture=!0;class jn extends kt{constructor(e,t,i,s,r,o,a,c,l){super(e,t,i,s,r,o,a,c,l),this.needsUpdate=!0}}jn.prototype.isCanvasTexture=!0;class x1 extends kt{constructor(e,t,i,s,r,o,a,c,l,u){if(u=u!==void 0?u:$s,u!==$s&&u!==ao)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===$s&&(i=Ca),i===void 0&&u===ao&&(i=$r),super(null,s,r,o,a,c,u,i,l),this.image={width:e,height:t},this.magFilter=a!==void 0?a:vt,this.minFilter=c!==void 0?c:vt,this.flipY=!1,this.generateMipmaps=!1}}x1.prototype.isDepthTexture=!0;class ys extends qe{constructor(e=1,t=8,i=0,s=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:s},t=Math.max(3,t);const r=[],o=[],a=[],c=[],l=new S,u=new $;o.push(0,0,0),a.push(0,0,1),c.push(.5,.5);for(let h=0,d=3;h<=t;h++,d+=3){const f=i+h/t*s;l.x=e*Math.cos(f),l.y=e*Math.sin(f),o.push(l.x,l.y,l.z),a.push(0,0,1),u.x=(o[d]/e+1)/2,u.y=(o[d+1]/e+1)/2,c.push(u.x,u.y)}for(let h=1;h<=t;h++)r.push(h,h+1,0);this.setIndex(r),this.setAttribute("position",new Ne(o,3)),this.setAttribute("normal",new Ne(a,3)),this.setAttribute("uv",new Ne(c,2))}}class dn extends qe{constructor(e=1,t=1,i=1,s=8,r=1,o=!1,a=0,c=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiu
vendor: 1,391 bytes, line 2827
2827sTop:e,radiusBottom:t,height:i,radialSegments:s,heightSegments:r,openEnded:o,thetaStart:a,thetaLength:c};const l=this;s=Math.floor(s),r=Math.floor(r);const u=[],h=[],d=[],f=[];let p=0;const b=[],w=i/2;let v=0;y(),o===!1&&(e>0&&E(!0),t>0&&E(!1)),this.setIndex(u),this.setAttribute("position",new Ne(h,3)),this.setAttribute("normal",new Ne(d,3)),this.setAttribute("uv",new Ne(f,2));function y(){const L=new S,C=new S;let _=0;const D=(t-e)/i;for(let F=0;F<=r;F++){const H=[],W=F/r,Z=W*(t-e)+e;for(let q=0;q<=s;q++){const k=q/s,O=k*c+a,U=Math.sin(O),z=Math.cos(O);C.x=Z*U,C.y=-W*i+w,C.z=Z*z,h.push(C.x,C.y,C.z),L.set(U,D,z).normalize(),d.push(L.x,L.y,L.z),f.push(k,1-W),H.push(p++)}b.push(H)}for(let F=0;F<s;F++)for(let H=0;H<r;H++){const W=b[H][F],Z=b[H+1][F],q=b[H+1][F+1],k=b[H][F+1];u.push(W,Z,k),u.push(Z,q,k),_+=6}l.addGroup(v,_,0),v+=_}function E(L){const C=p,_=new $,D=new S;let F=0;const H=L===!0?e:t,W=L===!0?1:-1;for(let q=1;q<=s;q++)h.push(0,w*W,0),d.push(0,W,0),f.push(.5,.5),p++;const Z=p;for(let q=0;q<=s;q++){const O=q/s*c+a,U=Math.cos(O),z=Math.sin(O);D.x=H*z,D.y=w*W,D.z=H*U,h.push(D.x,D.y,D.z),d.push(0,W,0),_.x=U*.5+.5,_.y=z*.5*W+.5,f.push(_.x,_.y),p++}for(let q=0;q<s;q++){const k=C+q,O=Z+q;L===!0?u.push(O,O+1,k):u.push(O+1,O,k),F+=3}l.addGroup(v,F,L===!0?1:2),v+=F}}}class Tn extends dn{constructor(e=1,t=1,i=8,s=1,r=!1,o=0,a=Math.PI*2){super(0,e,t,i,s,r,o,a),this.type="C
2827oneGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:s,openEnded:r,thetaStart:o,thetaLength:a}}}class uh extends qe{constructor(e,t,i=1,s=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:s};const r=[],o=[];a(s),l(i),u(),this.setAttribute("position",new Ne(r,3)),this.setAttribute("normal",new Ne(r.slice(),3)),this.setAttribute("uv",new Ne(o,2)),s===0?this.computeVertexNormals():this.normalizeNormals();function a(y){const E=new S,L=new S,C=new S;for(let _=0;_<t.length;_+=3)f(t[_+0],E),f(t[_+1],L),f(t[_+2],C),c(E,L,C,y)}function c(y,E,L,C){const _=C+1,D=[];for(let F=0;F<=_;F++){D[F]=[];const H=y.clone().lerp(L,F/_),W=E.clone().lerp(L,F/_),Z=_-F;for(let q=0;q<=Z;q++)q===0&&F===_?D[F][q]=H:D[F][q]=H.clone().lerp(W,q/Z)}for(let F=0;F<_;F++)for(let H=0;H<2*(_-F)-1;H++){const W=Math.floor(H/2);H%2===0?(d(D[F][W+1]),d(D[F+1][W]),d(D[F][W])):(d(D[F][W+1]),d(D[F+1][W+1]),d(D[F+1][W]))}}function l(y){const E=new S;for(let L=0;L<r.length;L+=3)E.x=r[L+0],E.y=r[L+1],E.z=r[L+2],E.normalize().multiplyScalar(y),r[L+0]=E.x,r[L+1]=E.y,r[L+2]=E.z}function u(){const y=new S;for(let E=0;E<r.length;E+=3){y.x=r[E+0],y.y=r[E+1],y.z=r[E+2];const L=w(y)/2/Math.PI+.5,C=v(y)/Math.PI+.5;o.push(L,1-C)}p(),h()}function h(){for(let y=0;y<o.length;y+=6){const E=o[y+0],L=o[y+2],C=o[y+4],_=Math.max(E,L,C),D=Math.min(E,L,C);_>.9&&D<.1&&(E<.2&&(o[y+0]+=1),L<.2&&(o[y+2]+=1),C<.2&&(o[y+4]+=1))}}function d(y){r.push(y.x,y.y,y.z)}function f(y,E){const L=y*3;E.x=e[L+0],E.y=e[L+1],E.z=e[L+2]}function p(){const y=new S,E=new S,L=new S,C=new S,_=new $,D=new $,F=new $;for(let H=0,W=0;H<r.length;H+=9,W+=6){y.set(r[H+0],r[H+1],r[H+2]),E.set(r[H+3],r[H+4],r[H+5]),L.set(r[H+6],r[H+7],r[H+8]),_.set(o[W+0],o[W+1]),D.set(o[W+2],o[W+3]),F.set(o[W+4],o[W+5]),C.copy(y).add(E).add(L).divideScalar(3);const Z=w(C);b(_,W+0,y,Z),b(D,W+2,E,Z),b(F,W+4,L,Z)}}function b(y,E,L,C){C<0&&y.x===1&&(o[E]=y.x-1),L.x===0&&L.z===0&&(o[E]=C/2/Math.PI+.5)}function w(y){return Math.atan2(y.z,-y.x)}function v(y){return Math.atan2(-y.y,Math.sqrt(y.x*y.x+y.z*y.z))}}}const y1={triangulate:function(n,e,t){t=t||2;const i=e&&e.length,s=i?e[0]*t:n.length;let r=Fp(n,0,s,t,!0);const o=[];if(!r||r.next===r.prev)return o;let a,c,l,u,h,d,f;if(i&&(r=_1(n,e,r,t)),n.length>80*t){a=l=n[0],c=u=n[1];for(let p=t;p<s;p+=t)h=n[p],d=n[p+1],h<a&&(a=h),d<c&&(c=d),h>l&&(l=h),d>u&&(u=d);f=Math.max(l-a,u-c),f=f!==0?1/f:0}return uo(r,o,t,a,c,f),o}};function Fp(n,e,t,i,s){let r,o;if(s===D1(n,e,t,i)>0)for(r=e;r<t;r+=i)o=pd(r,n[r],n[r+1],o);else for(r=t-i;r>=e;r-=i)o=pd(r,n[r],n[r+1],o);return o&&al(o,o.next)&&(po(o),o=o.next),o}function Ui(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(al(t,t.next)||mt(t.prev,t,t.next)===0)){if(po(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function uo(n,e,t,i,s,r,o){if(!n)return;!o&&r&&L1(n,i,s,r);let a=n,c,l;for(;n.prev!==n.next;){if(c=n.prev,l=n.next,r?b1(n,i,s,r):v1(n)){e.push(c.i/t),e.push(n.i/t),e.push(l.i/t),po(n),n=l.next,a=l.next;continue}if(n=l,n===a){o?o===1?(n=w1(Ui(n),e,t),uo(n,e,t,i,s,r,2)):o===2&&M1(n,e,t,i,s,r):uo(Ui(n),e,t,i,s,r,1);break}}}function v1(n){const e=n.prev,t=n,i=n.next;if(mt(e,t,i)>=0)return!1;let s=n.next.next;for(;s!==n.prev;){if(js(e.x,e.y,t.x,t.y,i.x,i.y,s.x,s.y)&&mt(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function b1(n,e,t,i){const s=n.prev,r=n,o=n.next;if(mt(s,r,o)>=0)return!1;const a=s.x<r.x?s.x<o.x?s.x:o.x:r.x<o.x?r.x:o.x,c=s.y<r.y?s.y<o.y?s.y:o.y:r.y<o.y?r.y:o.y,l=s.x>r.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,u=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,h=Rc(a,c,e,t,i),d=Rc(l,u,e,t,i);let f=n.prevZ,p=n.nextZ;for(;f&&f.z>=h&&p&&p.z<=d;){if(f!==n.prev&&f!==n.next&&js(s.x,s.y,r.x,r.y,o.x,o.y,f.x,f.y)&&mt(f.prev,f,f.next)>=0||(f=f.prevZ,p!==n.prev&&p!==n.next&&js(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&mt(p.prev,p,p.next)>=0))return!1;p=p.nextZ}for(;f&&f.z>=h;){if(f!==n.prev&&f!==n.next&&js(s.x,s.y,r.x,r.y,o.x,o.y,f.x,f.y)&&mt(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;p&&p.z<=d;){if(p!==n.prev&&p!==n.next&&js(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&mt(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function w1(n,e,t){let i=n;do{const s=i.prev,r=i.next.next;!al(s,r)&&Op(s,i,i.next,r)&&fo(s,r)&&fo(r,s)&&(e.push(s.i/t),e.push(i.i/t),e.push(r.i/t),po(i),po(i.next),i=n=r),i=i.next}while(i!==n);return Ui(i)}function M1(n,e,t,i,s,r){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&P1(o,a)){let c=Hp(o,a);o=Ui(o,o.next),c=Ui(c,c.next),uo(o,e,t,i,s,r),uo(c,e,t,i,s,r);return}a=a.next}o=o.next}while(o!==n)}function _1(n,e,t,i){const s=[];let r,o,a,c,l;
2827for(r=0,o=e.length;r<o;r++)a=e[r]*i,c=r<o-1?e[r+1]*i:n.length,l=Fp(n,a,c,i,!1),l===l.next&&(l.steiner=!0),s.push(R1(l));for(s.sort(S1),r=0;r<s.length;r++)T1(s[r],t),t=Ui(t,t.next);return t}function S1(n,e){return n.x-e.x}function T1(n,e){if(e=E1(n,e),e){const t=Hp(e,n);Ui(e,e.next),Ui(t,t.next)}}function E1(n,e){let t=e;const i=n.x,s=n.y;let r=-1/0,o;do{if(s<=t.y&&s>=t.next.y&&t.next.y!==t.y){const d=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=i&&d>r){if(r=d,d===i){if(s===t.y)return t;if(s===t.next.y)return t.next}o=t.x<t.next.x?t:t.next}}t=t.next}while(t!==e);if(!o)return null;if(i===r)return o;const a=o,c=o.x,l=o.y;let u=1/0,h;t=o;do i>=t.x&&t.x>=c&&i!==t.x&&js(s<l?i:r,s,c,l,s<l?r:i,s,t.x,t.y)&&(h=Math.abs(s-t.y)/(i-t.x),fo(t,n)&&(h<u||h===u&&(t.x>o.x||t.x===o.x&&A1(o,t)))&&(o=t,u=h)),t=t.next;while(t!==a);return o}function A1(n,e){return mt(n.prev,n,e.prev)<0&&mt(e.next,n,n.next)<0}function L1(n,e,t,i){let s=n;do s.z===null&&(s.z=Rc(s.x,s.y,e,t,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,C1(s)}function C1(n){let e,t,i,s,r,o,a,c,l=1;do{for(t=n,n=null,r=null,o=0;t;){for(o++,i=t,a=0,e=0;e<l&&(a++,i=i.nextZ,!!i);e++);for(c=l;a>0||c>0&&i;)a!==0&&(c===0||!i||t.z<=i.z)?(s=t,t=t.nextZ,a--):(s=i,i=i.nextZ,c--),r?r.nextZ=s:n=s,s.prevZ=r,r=s;t=i}r.nextZ=null,l*=2}while(o>1);return n}function Rc(n,e,t,i,s){return n=32767*(n-t)*s,e=32767*(e-i)*s,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function R1(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function js(n,e,t,i,s,r,o,a){return(s-o)*(e-a)-(n-o)*(r-a)>=0&&(n-o)*(i-a)-(t-o)*(e-a)>
vendor: 10,528 bytes, line 2827
2827=0&&(t-o)*(r-a)-(s-o)*(i-a)>=0}function P1(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!I1(n,e)&&(fo(n,e)&&fo(e,n)&&B1(n,e)&&(mt(n.prev,n,e.prev)||mt(n,e.prev,e))||al(n,e)&&mt(n.prev,n,n.next)>0&&mt(e.prev,e,e.next)>0)}function mt(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function al(n,e){return n.x===e.x&&n.y===e.y}function Op(n,e,t,i){const s=aa(mt(n,e,t)),r=aa(mt(n,e,i)),o=aa(mt(t,i,n)),a=aa(mt(t,i,e));return!!(s!==r&&o!==a||s===0&&oa(n,t,e)||r===0&&oa(n,i,e)||o===0&&oa(t,n,i)||a===0&&oa(t,e,i))}function oa(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function aa(n){return n>0?1:n<0?-1:0}function I1(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&Op(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function fo(n,e){return mt(n.prev,n,n.next)<0?mt(n,e,n.next)>=0&&mt(n,n.prev,e)>=0:mt(n,e,n.prev)<0||mt(n,n.next,e)<0}function B1(n,e){let t=n,i=!1;const s=(n.x+e.x)/2,r=(n.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&s<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function Hp(n,e){const t=new Pc(n.i,n.x,n.y),i=new Pc(e.i,e.x,e.y),s=n.next,r=e.prev;return n.next=e,e.prev=n,t.next=s,s.prev=t,i.next=t,t.prev=i,r.next=i,i.prev=r,i}function pd(n,e,t,i){const s=new Pc(n,e,t);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function po(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Pc(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function D1(n,e,t,i){let s=0;for(let r=e,o=t-i;r<t;r+=i)s+=(n[o]-n[r])*(n[r+1]+n[o+1]),o=r;return s}class zi{static area(e){const t=e.length;let i=0;for(let s=t-1,r=0;r<t;s=r++)i+=e[s].x*e[r].y-e[r].x*e[s].y;return i*.5}static isClockWise(e){return zi.area(e)<0}static triangulateShape(e,t){const i=[],s=[],r=[];md(e),gd(i,e);let o=e.length;t.forEach(md);for(let c=0;c<t.length;c++)s.push(o),o+=t[c].length,gd(i,t[c]);const a=y1.triangulate(i,s);for(let c=0;c<a.length;c+=3)r.push(a.slice(c,c+3));return r}}function md(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function gd(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class ll extends qe{constructor(e,t){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,s=[],r=[];for(let a=0,c=e.length;a<c;a++){const l=e[a];o(l)}this.setAttribute("position",new Ne(s,3)),this.setAttribute("uv",new Ne(r,2)),this.computeVertexNormals();function o(a){const c=[],l=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1;let h=t.depth!==void 0?t.depth:100,d=t.bevelEnabled!==void 0?t.bevelEnabled:!0,f=t.bevelThickness!==void 0?t.bevelThickness:6,p=t.bevelSize!==void 0?t.bevelSize:f-2,b=t.bevelOffset!==void 0?t.bevelOffset:0,w=t.bevelSegments!==void 0?t.bevelSegments:3;const v=t.extrudePath,y=t.UVGenerator!==void 0?t.UVGenerator:k1;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),h=t.amount);let E,L=!1,C,_,D,F;v&&(E=v.getSpacedPoints(u),L=!0,d=!1,C=v.computeFrenetFrames(u,!1),_=new S,D=new S,F=new S),d||(w=0,f=0,p=0,b=0);const H=a.extractPoints(l);let W=H.shape;const Z=H.holes;if(!zi.isClockWise(W)){W=W.reverse();for(let se=0,oe=Z.length;se<oe;se++){const le=Z[se];zi.isClockWise(le)&&(Z[se]=le.reverse())}}const k=zi.triangulateShape(W,Z),O=W;for(let se=0,oe=Z.length;se<oe;se++){const le=Z[se];W=W.concat(le)}function U(se,oe,le){return oe||console.error("THREE.ExtrudeGeometry: vec does not exist"),oe.clone().multiplyScalar(le).add(se)}const z=W.length,ne=k.length;function ce(se,oe,le){let we,fe,P;const R=se.x-oe.x,ee=se.y-oe.y,te=le.x-se.x,he=le.y-se.y,me=R*R+ee*ee,We=R*he-ee*te;if(Math.abs(We)>Number.EPSILON){const Ee=Math.sqrt(me),N=Math.sqrt(te*te+he*he),ae=oe.x-ee/Ee,M=oe.y+R/Ee,g=le.x-he/N,x=le.y+te/N,T=((g-ae)*he-(x-M)*te)/(R*he-ee*te);we=ae+R*T-se.x,fe=M+ee*T-se.y;const I=we*we+fe*fe;if(I<=2)return new $(we,fe);P=Math.sqrt(I/2)}else{let Ee=!1;R>Number.EPSILON?te>Number.EPSILON&&(Ee=!0):R<-Number.EPSILON?te<-Number.EPSILON&&(Ee=!0):Math.sign(ee)===Math.sign(he)&&(Ee=!0),Ee?(we=-ee,fe=R,P=Math.sqrt(me)):(we=R,fe=ee,P=Math.sqrt(me/2))}return new $(we/P,fe/P)}const re=[];for(let se=0,oe=O.length,le=oe-1,we=se+1;se<oe;se++,le++,we++)le===oe&&(le=0),we===oe&&(we=0),re[se]=ce(O[se],O[le],O[we]);const ge=[];let ie,ye=re.concat();for(let se=0,oe=Z.length;se<oe;se++){const le=Z[se];ie=[];for(let we=0,fe=le.length,P=fe-1,R=we+1;we<fe;we++,P++,R++)P===fe&&(P=0),R===fe&&(R=0),ie[we]=ce(le[we],le[P],le[R]);ge.push(ie),ye=ye.concat(ie)}for(let se=0;se<w;se++){const oe=se/w,le=f*Math.cos(oe*Math.PI/2),we=p*Math.sin(oe*Math.PI/2)+b;for(let fe=0,P=O.length;fe<P;fe++){const R=U(O[fe],re[fe],we);Te(R.x,R.y,-le)}for(let fe=0,P=Z.length;fe<P;fe++){const R=Z[fe];ie=ge[fe];for(let ee=0,te=R.length;ee<te;ee++){const he=U(R[ee],ie[ee],we);Te(he.x,he.y,-le)}}}const Se=p+b;for(let se=0;se<z;se++){const oe=d?U(W[se],ye[se],Se):W[se];L?(D.copy(C.normals[0]).multiplyScalar(oe.x),_.copy(C.binormals[0]).multiplyScalar(oe.y),F.copy(E[0]).add(D).add(_),Te(F.x,F.y,F.z)):Te(oe.x,oe.y,0)}for(let se=1;se<=u;se++)for(let oe=0;oe<z;oe++){const le=d?U(W[oe],ye[oe],Se):W[oe];L?(D.copy(C.normals[se]).multiplyScalar(le.x),_.copy(C.binormals[se]).multiplyScalar(le.y),F.copy(E[se]).add(D).add(_),Te(F.x,F.y,F.z)):Te(le.x,le.y,h/u*se)}for(let se=w-1;se>=0;se--){const oe=se/w,le=f*Math.cos(oe*Math.PI/2),we=p*Math.sin(oe*Math.PI/2)+b;for(let fe=0,P=O.length;fe<P;fe++){const R=U(O[fe],re[fe],we);Te(R.x,R.y,h+le)}for(let fe=0,P=Z.length;fe<P;fe++){const R=Z[fe];ie=ge[fe];for(let ee=0,te=R.length;ee<te;ee++){const he=U(R[ee],ie[ee],we);L?Te(he.x,he.y+E[u-1].y,E[u-1].x+le):Te(he.x,he.y,h+le)}}}Q(),et();function Q(){const se=s.length/3;if(d){let oe=0,le=z*oe;for(let we=0;we<ne;we++){const fe=k[we];Me(fe[2]+le,fe[1]+le,fe[0]+le)}oe=u+w*2,le=z*oe;for(let we=0;we<ne;we++){const fe=k[we];Me(fe[0]+le,fe[1]+le,fe[2]+le)}}else{for(let oe=0;oe<ne;oe++){const le=k[oe];Me(le[2],le[1],le[0])}for(let oe=0;oe<ne;oe++){const le=k[oe];Me(le[0]+z*u,le[1]+z*u,le[2]+z*u)}}i.addGroup(se,s.length/3-se,0)}function et(){const se=s.length/3;let oe=0;Ue(O,oe),oe+=O.length;for(let le=0,we=Z.length;le<we;le++){const fe=Z[le];Ue(fe,oe),oe+=fe.length}i.addGroup(se,s.length/3-se,1)}function Ue(se,oe){let le=se.length;for(;--le>=0;){const we=le;let fe=le-1;fe<0&&(fe=se.length-1);for(let P=0,R=u+w*2;P<R;P++){const ee=z*P,te=z*(P+1),he=oe+we+ee,me=oe+fe+ee,We=oe+fe+te,Ee=oe+we+te;Ge(he,me,We,Ee)}}}function Te(se,oe,le){c.push(se),c.push(oe),c.push(le)}function Me(se,oe,le){Be(se),Be(oe),Be(le);const we=s.length/3,fe=y.generateTopUV(i,s,we-3,we-2,we-1);Oe(fe[0]),Oe(fe[1]),Oe(fe[2])}function Ge(se,oe,le,we){Be(se),Be(oe),Be(we),Be(oe),Be(le),Be(we);const fe=s.length/3,P=y.generateSideWallUV(i,s,fe-6,fe-3,fe-2,fe-1);Oe(P[0]),Oe(P[1]),Oe(P[3]),Oe(P[1]),Oe(P[2]),Oe(P[3])}function Be(se){s.push(c[se*3+0]),s.push(c[se*3+1]),s.push(c[se*3+2])}function Oe(se){r.push(se.x),r.push(se.y)}}}toJSON(){const e=qe.prototype.toJSON.call(this),t=this.parameters.shapes,i=this.parameters.options;return N1(t,i,e)}}const k1={generateTopUV:function(n,e,t,i,s){const r=e[t*3],o=e[t*3+1],a=e[i*3],c=e[i*3+1],l=e[s*3],u=e[s*3+1];return[new $(r,o),new $(a,c),new $(l,u)]},generateSideWallUV:function(n,e,t,i,s,r){const o=e[t*3],a=e[t*3+1],c=e[t*3+2],l=e[i*3],u=e[i*3+1],h=e[i*3+2],d=e[s*3],f=e[s*3+1],p=e[s*3+2],b=e[r*3],w=e[r*3+1],v=e[r*3+2];return Math.abs(a-u)<.01?[new $(o,1-c),new $(l,1-h),new $(d,1-p),new $(b,1-v)]:[new $(a,1-c),new $(u,1-h),new $(f,1-p),new $(w,1-v)]}};function N1(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,s=n.length;i<s;i++){const r=n[i];t.shapes.push(r.uuid)}else t.shapes.push(n.uuid);return e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class dh extends uh{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,s=[-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],r=[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(s,r,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}}class Ba extends uh{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],s=[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,s,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}}class gi extends qe{constructor(e=.5,t=1,i=8,s=1,r=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:s,thetaStart:r,thetaLength:o},i=Math.max(3,i),s=Math.max(1,s);const a=[],c=[],l=[],u=[];let h=e;const d=(t-e)/s,f=new S,p=new $;for(let b=0;b<=s;b++){for(let w=0;w<=i;w++){const v=r+w/i*o;f.x=h*Math.cos(v),f.y=h*Math.sin(v),c.push(f.x,f.y,f.z),l.push(0,0,1),p.x=(f.x/t+1)/2,p.y=(f.y/t+1)/2,u.push(p.x,p.y)}h+=d}for(let b=0;b<s;b++){const w=b*(i+1);for(let v=0;v<i;v++){const y=v+w,E=y,L=y+i+1,C=y+i+2,_=y+1;a.push(E,L,_),a.push(L,C,_)}}this.setIndex(a),this.setAttribute("position",new Ne(c,3)),this.setAttribute("normal",new Ne(l,3)),this.setAttribute("uv",new Ne(u,2))}}class z1 extends qe{constructor(e,t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],s=[],r=[],o=[];let a=0,c=0;if(Array.isArray(e)===!1)l(e);else for(let u=0;u<e.length;u++)l(e[u]),this.addGroup(a,c,u),a+=c,c=0;this.setIndex(i),this.setAttribute("position",new Ne(s,3)),this.setAttribute("normal",new Ne(r,3)),this.setAttribute("uv",new Ne(o,2));function l(u){const h=s.length/3,d=u.extractPoints(t);let f=d.shape;const p=d.holes;zi.isClockWise(f)===!1&&(f=f.reverse());for(let w=0,v=p.length;w<v;w++){const y=p[w];zi.isClockWise(y)===!0&&(p[w]=y.reverse())}const b=zi.triangulateShape(f,p);for(let w=0,v=p.length;w<v;w++){const y=p[w];f=f.concat(y)}for(let w=0,v=f.length;w<v;w++){const y=f[w];s.push(y.x,y.y,0),r.push(0,0,1),o.push(y.x,y.y)}for(let w=0,v=b.length;w<v;w++){const y=b[w],E=y[0]+h,L=y[1]+h,C=y[2]+h;i.push(E,L,C),c+=3}}}toJSON(){const e=qe.prototype.toJSON.call(this),t=this.parameters.shapes;return F1(t,e)}}function F1(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const s=n[t];e.shapes.push(s.uuid)}else e.shapes.push(n.uuid);return e}class At extends qe{constructor(e=1,t=8,i=6,s=0,r=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radiu
2827s:e,widthSegments:t,heightSegments:i,phiStart:s,phiLength:r,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const c=Math.min(o+a,Math.PI);let l=0;const u=[],h=new S,d=new S,f=[],p=[],b=[],w=[];for(let v=0;v<=i;v++){const y=[],E=v/i;let L=0;v==0&&o==0?L=.5/t:v==i&&c==Math.PI&&(L=-.5/t);for(let C=0;C<=t;C++){const _=C/t;h.x=-e*Math.cos(s+_*r)*Math.sin(o+E*a),h.y=e*Math.cos(o+E*a),h.z=e*Math.sin(s+_*r)*Math.sin(o+E*a),p.push(h.x,h.y,h.z),d.copy(h).normalize(),b.push(d.x,d.y,d.z),w.push(_+L,1-E),y.push(l++)}u.push(y)}for(let v=0;v<i;v++)for(let y=0;y<t;y++){const E=u[v][y+1],L=u[v][y],C=u[v+1][y],_=u[v+1][y+1];(v!==0||o>0)&&f.push(E,L,_),(v!==i-1||c<Math.PI)&&f.push(L,C,_)}this.setIndex(f),this.setAttribute("position",new Ne(p,3)),this.setAttribute("normal",new Ne(b,3)),this.setAttribute("uv",new Ne(w,2))}}class fh extends uh{constructor(e=1,t=0){const i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],s=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,s,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}}class Up extends qe{constructor(e=1,t=.4,i=8,s=6,r=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:s,arc:r},i=Math.floor(i),s=Math.floor(s);const o=[],a=[],c=[],l=[],u=new S,h=new S,d=new S;for(let f=0;f<=i;f++)for(let p=0;p<=s;p++){const b=p/s*r,w=f/i*Math.PI*2;h.x=(e+t*Math.cos(w))*Math.cos(b),h.y=(e+t*Math.cos(w))*Math.sin(b),h.z=t*Math.sin(w),a.push(h.x,h.y,h.z),u.x=e*Math.cos(b),u.y=e*Math.sin(b),d.subVectors(h,u).normalize(),c.push(d.x,d.y,d.z),l.push(p/s),l.push(f/i)}for(let f=1;f<=i;f++)for(let p=1;p<=s;p++){const b=(s+1)*f+p-1,w=(s+1)*(f-1)+p-1,v=(s+1)*(f-1)+p,y=(s+1)*f+p;o.push(b,w,y),o.push(w,v,y)}this.setIndex(o),this.setAttribute("position",new Ne(a,3)),this.setAttribute("normal",new Ne(c,3)),this.setAttribute("uv",new Ne(l,2))}}class O1 extends Lt{constructor(e){super(),this.type="ShadowMaterial",this.color=new pe(0),this.transparent=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this}}O1.prototype.isShadowMaterial=!0;class cl extends Ut{constructor(e){super(e),this.type="RawShaderMaterial"}}cl.prototype.isRawShaderMaterial=!0;class Ao extends Lt{constructor(e){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new pe(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 pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fs,this.normalScale=new $(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.vertexTangents=!1,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.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this.vertexTangents=e.vertexTangents,this}}Ao.prototype.isMeshStandardMaterial=!0;class ph extends Ao{constructor(e){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new $(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(t){this.reflectivity=nn(2.5*(t-1)/(t+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},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.reflectivity=e.reflectivity,e.sheen?this.sheen=(this.sheen||new pe).copy(e.sheen):this.sheen=null,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this}}ph.prototype.isMeshPhysicalMaterial=!0;class H1 extends Lt{constructor(e){super(),this.type="MeshPhongMaterial",this.color=new pe(16777215),this.specular=new pe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fs,this.normalScale=new $(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=$a,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,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.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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this}}H1.prototype.isMeshPhongMaterial=!0;class mh extends Lt{constructor(e){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new pe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fs,this.normalScale=new $(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.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this}}mh.prototype.isMeshToonMaterial=!0;class U1 extends Lt{constructor(e){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fs,this.normalScale=new $(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this}}U1.prototype.isMeshNormalMaterial=!0;class G1 extends Lt{constructor(e){super(),this.type="MeshLambertMaterial",this.color=new pe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=$a,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,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.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this}}G1.prototype.isMeshLambertMaterial=!0;class W1 extends Lt{constructor(e){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new pe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=fs,this.normalScale=new $(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.flatShading=e.flatShading,this}}
2827W1.prototype.isMeshMatcapMaterial=!0;class V1 extends wr{constructor(e){super(),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}}V1.prototype.isLineDashedMaterial=!0;const dt={arraySlice:function(n,e,t){return dt.isTypedArray(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)},convertArray:function(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)},isTypedArray:function(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)},getKeyframeOrder:function(n){function e(s,r){return n[s]-n[r]}const t=n.length,i=new Array(t);for(let s=0;s!==t;++s)i[s]=s;return i.sort(e),i},sortedArray:function(n,e,t){const i=n.length,s=new n.constructor(i);for(let r=0,o=0;o!==i;++r){const a=t[r]*e;for(let c=0;c!==e;++c)s[o++]=n[a+c]}return s},flattenJSON:function(n,e,t,i){let s=1,r=n[0];for(;r!==void 0&&r[i]===void 0;)r=n[s++];if(r===void 0)return;let o=r[i];if(o!==void 0)if(Array.isArray(o))do o=r[i],o!==void 0&&(e.push(r.time),t.push.apply(t,o)),r=n[s++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[i],o!==void 0&&(e.push(r.time),o.toArray(t,t.length)),r=n[s++];while(r!==void 0);else do o=r[i],o!==void 0&&(e.push(r.time),t.push(o)),r=n[s++];while(r!==void 0)},subclip:function(n,e,t,i,s=30){const r=n.clone();r.name=e;const o=[];for(let c=0;c<r.tracks.length;++c){const l=r.tracks[c],u=l.getValueSize(),h=[],d=[];for(let f=0;f<l.times.length;++f){const p=l.times[f]*s;if(!(p<t||p>=i)){h.push(l.times[f]);for(let b=0;b<u;++b)d.push(l.values[f*u+b])}}h.length!==0&&(l.times=dt.convertArray(h,l.times.constructor),l.values=dt.convertArray(d,l.values.constructor),o.push(l))}r.tracks=o;let a=1/0;for(let c=0;c<r.tracks.length;++c)a>r.tracks[c].times[0]&&(a=r.tracks[c].times[0]);for(let c=0;c<r.tracks.length;++c)r.tracks[c].shift(-1*a);return r.resetDuration(),r},makeClipAdditive:function(n,e=0,t=n,i=30){i<=0&&(i=30);const s=t.tracks.length,r=e/i;for(let o=0;o<s;++o){const a=t.tracks[o],c=a.ValueTypeName;
vendor: 11,610 bytes, line 2827
2827if(c==="bool"||c==="string")continue;const l=n.tracks.find(function(v){return v.name===a.name&&v.ValueTypeName===c});if(l===void 0)continue;let u=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let d=0;const f=l.getValueSize();l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(d=f/3);const p=a.times.length-1;let b;if(r<=a.times[0]){const v=u,y=h-u;b=dt.arraySlice(a.values,v,y)}else if(r>=a.times[p]){const v=p*h+u,y=v+h-u;b=dt.arraySlice(a.values,v,y)}else{const v=a.createInterpolant(),y=u,E=h-u;v.evaluate(r),b=dt.arraySlice(v.resultBuffer,y,E)}c==="quaternion"&&new Dt().fromArray(b).normalize().conjugate().toArray(b);const w=l.times.length;for(let v=0;v<w;++v){const y=v*f+d;if(c==="quaternion")Dt.multiplyQuaternionsFlat(l.values,y,b,0,l.values,y);else{const E=f-d*2;for(let L=0;L<E;++L)l.values[y+L]-=b[L]}}}return n.blendMode=lp,n}};class hi{constructor(e,t,i,s){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=s!==void 0?s: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,s=t[i],r=t[i-1];e:{t:{let o;n:{i:if(!(e<s)){for(let a=i+2;;){if(s===void 0){if(e<r)break i;return i=t.length,this._cachedIndex=i,this.afterEnd_(i-1,e,r)}if(i===a)break;if(r=s,s=t[++i],e<s)break t}o=t.length;break n}if(!(e>=r)){const a=t[1];e<a&&(i=2,r=a);for(let c=i-2;;){if(r===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,s);if(i===c)break;if(s=r,r=t[--i-1],e>=r)break t}o=i,i=0;break n}break e}for(;i<o;){const a=i+o>>>1;e<t[a]?o=a:i=a+1}if(s=t[i],r=t[i-1],r===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,s);if(s===void 0)return i=t.length,this._cachedIndex=i,this.afterEnd_(i-1,r,e)}this._cachedIndex=i,this.intervalChanged_(i,r,s)}return this.interpolate_(i,r,e,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,s=this.valueSize,r=e*s;for(let o=0;o!==s;++o)t[o]=i[r+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}hi.prototype.beforeStart_=hi.prototype.copySampleValue_;hi.prototype.afterEnd_=hi.prototype.copySampleValue_;class q1 extends hi{constructor(e,t,i,s){super(e,t,i,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Vs,endingEnd:Vs}}intervalChanged_(e,t,i){const s=this.parameterPositions;let r=e-2,o=e+1,a=s[r],c=s[o];if(a===void 0)switch(this.getSettings_().endingStart){case qs:r=e,a=2*t-i;break;case Pa:r=s.length-2,a=t+s[r]-s[r+1];break;default:r=e,a=i}if(c===void 0)switch(this.getSettings_().endingEnd){case qs:o=e,c=2*i-t;break;case Pa:o=1,c=i+s[1]-s[0];break;default:o=e-1,c=t}const l=(i-t)*.5,u=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(c-i),this._offsetPrev=r*u,this._offsetNext=o*u}interpolate_(e,t,i,s){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,u=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,f=this._weightNext,p=(i-t)/(s-t),b=p*p,w=b*p,v=-d*w+2*d*b-d*p,y=(1+d)*w+(-1.5-2*d)*b+(-.5+d)*p+1,E=(-1-f)*w+(1.5+f)*b+.5*p,L=f*w-f*b;for(let C=0;C!==a;++C)r[C]=v*o[u+C]+y*o[l+C]+E*o[c+C]+L*o[h+C];return r}}class Gp extends hi{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e,t,i,s){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,u=(i-t)/(s-t),h=1-u;for(let d=0;d!==a;++d)r[d]=o[l+d]*h+o[c+d]*u;return r}}class j1 extends hi{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e){return this.copySampleValue_(e-1)}}class Xn{constructor(e,t,i,s){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=dt.convertArray(t,this.TimeBufferType),this.values=dt.convertArray(i,this.ValueBufferType),this.setInterpolation(s||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:dt.convertArray(e.times,Array),values:dt.convertArray(e.values,Array)};const s=e.getInterpolation();s!==e.DefaultInterpolation&&(i.interpolation=s)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new j1(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Gp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new q1(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case lo:t=this.InterpolantFactoryMethodDiscrete;break;case or:t=this.InterpolantFactoryMethodLinear;break;case Al:t=this.InterpolantFactoryMethodSmooth;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 console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return lo;case this.InterpolantFactoryMethodLinear:return or;case this.InterpolantFactoryMethodSmooth:return Al}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,s=t.length;i!==s;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,s=t.length;i!==s;++i)t[i]*=e}return this}trim(e,t){const i=this.times,s=i.length;let r=0,o=s-1;for(;r!==s&&i[r]<e;)++r;for(;o!==-1&&i[o]>t;)--o;if(++o,r!==0||o!==s){r>=o&&(o=Math.max(o,1),r=o-1);const a=this.getValueSize();this.times=dt.arraySlice(i,r,o),this.values=dt.arraySlice(this.values,r*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,s=this.values,r=i.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){const c=i[a];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(o!==null&&o>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,c,o),e=!1;break}o=c}if(s!==void 0&&dt.isTypedArray(s))for(let a=0,c=s.length;a!==c;++a){const l=s[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e}optimize(){const e=dt.arraySlice(this.times),t=dt.arraySlice(this.values),i=this.getValueSize(),s=this.getInterpolation()===Al,r=e.length-1;let o=1;for(let a=1;a<r;++a){let c=!1;const l=e[a],u=e[a+1];if(l!==u&&(a!==1||l!==e[0]))if(s)c=!0;else{const h=a*i,d=h-i,f=h+i;for(let p=0;p!==i;++p){const b=t[h+p];if(b!==t[d+p]||b!==t[f+p]){c=!0;break}}}if(c){if(a!==o){e[o]=e[a];const h=a*i,d=o*i;for(let f=0;f!==i;++f)t[d+f]=t[h+f]}++o}}if(r>0){e[o]=e[r];for(let a=r*i,c=o*i,l=0;l!==i;++l)t[c+l]=t[a+l];++o}return o!==e.length?(this.times=dt.arraySlice(e,0,o),this.values=dt.arraySlice(t,0,o*i)):(this.times=e,this.values=t),this}clone(){const e=dt.arraySlice(this.times,0),t=dt.arraySlice(this.values,0),i=this.constructor,s=new i(this.name,e,t);return s.createInterpolant=this.createInterpolant,s}}Xn.prototype.TimeBufferType=Float32Array;Xn.prototype.ValueBufferType=Float32Array;Xn.prototype.DefaultInterpolation=or;class Mr extends Xn{}Mr.prototype.ValueTypeName="bool";Mr.prototype.ValueBufferType=Array;Mr.prototype.DefaultInterpolation=lo;Mr.prototype.InterpolantFactoryMethodLinear=void 0;Mr.prototype.InterpolantFactoryMethodSmooth=void 0;class Wp extends Xn{}Wp.prototype.ValueTypeName="color";class mo extends Xn{}mo.prototype.ValueTypeName="number";class X1 extends hi{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e,t,i,s){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(i-t)/(s-t);let l=e*a;for(let u=l+a;l!==u;l+=4)Dt.slerpFlat(r,0,o,l-a,o,l,c);return r}}class vs extends Xn{InterpolantFactoryMethodLinear(e){return new X1(this.times,this.values,this.getValueSize(),e)}}vs.prototype.ValueTypeName="quaternion";vs.prototype.DefaultInterpolation=or;vs.prototype.InterpolantFactoryMethodSmooth=void 0;class _r extends Xn{}_r.prototype.ValueTypeName="string";_r.prototype.ValueBufferType=Array;_r.prototype.DefaultInterpolation=lo;_r.prototype.InterpolantFactoryMethodLinear=void 0;_r.prototype.InterpolantFactoryMethodSmooth=void 0;class cr extends Xn{}cr.prototype.ValueTypeName="vector";class Da{constructor(e,t=-1,i,s=eh){this.name=e,this.tracks=i,this.duration=t,this.blendMode=s,this.uuid=xn(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,s=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(Z1(i[o]).scale(s));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],i=e.tracks,s={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,o=i.length;r!==o;++r)t.push(Xn.toJSON(i[r]));return s}static CreateFromMorphTargetSequence(e,t,i,s){const r=t.length,o=[];for(let a=0;a<r;a++){let c=[],l=[];c.push((a+r-1)%r,a,(a+1)%r),l.push(0,1,0);const u=dt.getKeyframeOrder(c);c=dt.sortedArray(c,1,u),l=dt.sortedArray(l,1,u),!s&&c[0]===0&&(c.push(r),l.push(l[0])),o.push(new mo(".morphTargetInfluences["+t[a].name+"]",c,l).scale(1/i))}return new this(e,-1,o)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const s=e;i=s.geometry&&s.geometry.animations||s.animations}for(let s=0;s<i.length;s++)if(i[s].name===t)return i[s];return null}static CreateClipsFromMorphTargetSequences(e,t,i){const s={},r=/^([\w-]*?)([\d]+)$/;for(let a=0,c=e.length;a<c;a++){const l=e[a],u=l.name.match(r);if(u&&u.length>1){const h=u[1];let d=s[h];d||(s[h]=d=[]),d.push(l)}}const o=[];for(const a in s)o.push(this.CreateFromMorphTargetSequence(a,s[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(h,d,f,p,b){if(f.length!==0){const w=[],v=[];dt.flattenJSON(f,w,v,p),w.length!==0&&b.push(new h(d,w,v))}},s=[],r=e.name||"default",o=e.fps||30,a=e.blendMode;let c=e.length||-1;const l=e.hierarchy||[];for(let h=0;h<l.length;h++){const d=l[h].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const f={};let p;for(p=0;p<d.length;p++)if(d[p].morphTargets)for(let b=0;b<d[p].morphTargets.length;b++)f[d[p].morphTargets[b]]=-1;for(const b in f){const w=[],v=[];for(let y=0;y!==d[p].morphTargets.length;++y){const E=d[p];w.push(E.time),v.push(E.morphTarget===b?1:0)}s.push(new mo(".morphTargetInfluence["+b+"]",w,v))}c=f.length*o}else{const f=".bones["+t[h].name+"]";i(cr,f+".position",d,"pos",s),i(vs,f+".quaternion",d,"rot",s),i(cr,f+".scale",d,"scl",s)}}return s.length===0?null:new this(r,c,s,a)}resetDuration(){const e=this.tracks;let t=0;for(let i=0,s=e.length;i!==s;++i){const r=this.tracks[i];t=Math.max(t,r.times[r.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 t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Y1(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return mo;
2827case"vector":case"vector2":case"vector3":case"vector4":return cr;case"color":return Wp;case"quaternion":return vs;case"bool":case"boolean":return Mr;case"string":return _r}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function Z1(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Y1(n.type);if(n.times===void 0){const t=[],i=[];dt.flattenJSON(n.keys,t,i,"value"),n.times=t,n.values=i}return e.parse!==void 0?e.parse(n):new e(n.name,n.times,n.values,n.interpolation)}const hr={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(this.files[n]=e)},get:function(n){if(this.enabled!==!1)return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};class K1{constructor(e,t,i){const s=this;let r=!1,o=0,a=0,c;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(u){a++,r===!1&&s.onStart!==void 0&&s.onStart(u,o,a),r=!0},this.itemEnd=function(u){o++,s.onProgress!==void 0&&s.onProgress(u,o,a),o===a&&(r=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(u){s.onError!==void 0&&s.onError(u)},this.resolveURL=function(u){return c?c(u):u},this.setURLModifier=function(u){return c=u,this},this.addHandler=function(u,h){return l.push(u,h),this},this.removeHandler=function(u){const h=l.indexOf(u);return h!==-1&&l.splice(h,2),this},this.getHandler=function(u){for(let h=0,d=l.length;h<d;h+=2){const f=l[h],p=l[h+1];if(f.global&&(f.lastIndex=0),f.test(u))return p}return null}}}const J1=new K1;class xi{constructor(e){this.manager=e!==void 0?e:J1,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const i=this;return new Promise(function(s,r){i.load(e,s,t,r)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}const _n={};class gh extends xi{constructor(e){super(e)}load(e,t,i,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=hr.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;if(_n[e]!==void 0){_n[e].push({onLoad:t,onProgress:i,onError:s});return}const a=/^data:(.*?)(;base64)?,(.*)$/,c=e.match(a);let l;if(c){const u=c[1],h=!!c[2];let d=c[3];d=decodeURIComponent(d),h&&(d=atob(d));try{let f;const p=(this.responseType||"").toLowerCase();switch(p){case"arraybuffer":case"blob":const b=new Uint8Array(d.length);for(let v=0;v<d.length;v++)b[v]=d.charCodeAt(v);p==="blob"?f=new Blob([b.buffer],{type:u}):f=b.buffer;break;case"document":f=new DOMParser().parseFromString(d,u);break;case"json":f=JSON.parse(d);break;default:f=d;break}setTimeout(function(){t&&t(f),r.manager.itemEnd(e)},0)}catch(f){setTimeout(function(){s&&s(f),r.manager.itemError(e),r.manager.itemEnd(e)},0)}}else{_n[e]=[],_n[e].push({onLoad:t,onProgress:i,onError:s}),l=new XMLHttpRequest,l.open("GET",e,!0),l.addEventListener("load",function(u){const h=this.response,d=_n[e];if(delete _n[e],this.status===200||this.status===0){this.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),hr.add(e,h);for(let f=0,p=d.length;f<p;f++){const b=d[f];b.onLoad&&b.onLoad(h)}r.manager.itemEnd(e)}else{for(let f=0,p=d.length;f<p;f++){const b=d[f];b.onError&&b.onError(u)}r.manager.itemError(e),r.manager.itemEnd(e)}},!1),l.addEventListener("progress",function(u){const h=_n[e];for(let d=0,f=h.length;d<f;d++){const p=h[d];p.onProgress&&p.onProgress(u)}},!1),l.addEventListener("error",function(u){const h=_n[e];delete _n[e];for(let d=0,f=h.length;d<f;d++){const p=h[d];p.onError&&p.onError(u)}r.manager.itemError(e),r.manager.itemEnd(e)},!1),l.addEventListener("abort",function(u){const h=_n[e];delete _n[e];for(let d=0,f=h.length;d<f;d++){const p=h[d];p.onError&&p.onError(u)}r.manager.itemError(e),r.manager.itemEnd(e)},!1),this.responseType!==void 0&&(l.responseType=this.responseType),this.withCredentials!==void 0&&(l.withCredentials=this.withCredentials),l.overrideMimeType&&l.overrideMimeType(this.mimeType!==void 0?this.mimeType:"text/plain");for(const u in this.requestHeader)l.setRequestHeader(u,this.requestHeader[u]);l.send(null)}return r.manager.itemStart(e),l}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Vp extends xi{constructor(e){super(e)}load(e,t,i,s){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=hr.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a=document.createElementNS("http://www.w3.org/1999/xhtml","img");function c(){a.removeEventListener("load",c,!1),a.removeEventListener("error",l,!1),hr.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(u){a.removeEventListener("load",c,!1),a.removeEventListener("error",l,!1),s&&s(u),r.manager.itemError(e),r.manager.itemEnd(e)}return a.addEventListener("load",c,!1),a.addEventListener("error",l,!1),e.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class Q1 extends xi{constructor(e){super(e)}load(e,t,i,s){const r=new tl,o=new Vp(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function c(l){o.load(e[l],function(u){r.images[l]=u,a++,a===6&&(r.needsUpdate=!0,t&&t(r))},void 0,s)}for(let l=0;l<e.length;++l)c(l);return r}}class hl extends xi{constructor(e){super(e)}load(e,t,i,s){const r=new kt,o=new Vp(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){r.image=a;const c=e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0;r.format=c?Wn:Jt,r.needsUpdate=!0,t!==void 0&&t(r)},i,s),r}}class vn{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}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,s=this.getPoint(0),r=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),r+=i.distanceTo(s),t.push(r),s=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let s=0;const r=i.length;let o;t?o=t:o=e*i[r-1];let a=0,c=r-1,l;for(;a<=c;)if(s=Math.floor(a+(c-a)/2),l=i[s]-o,l<0)a=s+1;else if(l>0)c=s-1;else{c=s;break}if(s=c,i[s]===o)return s/(r-1);const u=i[s],d=i[s+1]-u,f=(o-u)/d;return(s+f)/(r-1)}getTangent(e,t){let s=e-1e-4,r=e+1e-4;s<0&&(s=0),r>1&&(r=1);const o=this.getPoint(s),a=this.getPoint(r),c=t||(o.isVector2?new $:new S);return c.copy(a).sub(o).normalize(),c}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new S,s=[],r=[],o=[],a=new S,c=new ve;for(let f=0;f<=e;f++){const p=f/e;s[f]=this.getTangentAt(p,new S),s[f].normalize()}r[0]=new S,o[0]=new S;let l=Number.MAX_VALUE;const u=Math.abs(s[0].x),h=Math.abs(s[0].y),d=Math.abs(s[0].z);u<=l&&(l=u,i.set(1,0,0)),h<=l&&(l=h,i.set(0,1,0)),d<=l&&i.set(0,0,1),a.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],a),o[0].crossVectors(s[0],r[0]);for(let f=1;f<=e;f++){if(r[f]=r[f-1].clone(),o[f]=o[f-1].clone(),a.crossVectors(s[f-1],s[f]),a.length()>Number.EPSILON){a.normalize();const p=Math.acos(nn(s[f-1].dot(s[f]),-1,1));r[f].applyMatrix4(c.makeRotationAxis(a,p))}o[f].crossVectors(s[f],r[f])}if(t===!0){let f=Math.acos(nn(r[0].dot(r[e]),-1,1));f/=e,s[0].dot(a.crossVectors(r[0],r[e]))>0&&(f=-f);for(let p=1;p<=e;p++)r[p].applyMatrix4(c.makeRotationAxis(s[p],f*p)),o[p].crossVectors(s[p],r[p])}return{tangents:s,normals:r,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.t
2827ype,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class ul extends vn{constructor(e=0,t=0,i=1,s=1,r=0,o=Math.PI*2,a=!1,c=0){super(),this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=c}getPoint(e,t){const i=t||new $,s=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=s;for(;r>s;)r-=s;r<Number.EPSILON&&(o?r=0:r=s),this.aClockwise===!0&&!o&&(r===s?r=-s:r=r-s);const a=this.aStartAngle+e*r;let c=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),d=c-this.aX,f=l-this.aY;c=d*u-f*h+this.aX,l=d*h+f*u+this.aY}return i.set(c,l)}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}}ul.prototype.isEllipseCurve=!0;class qp extends ul{constructor(e,t,i,s,r,o){super(e,t,i,i,s,r,o),this.type="ArcCurve"}}qp.prototype.isArcCurve=!0;function xh(){let n=0,e=0,t=0,i=0;function s(r,o,a,c){n=r,e=a,t=-3*r+3*o-2*a-c,i=2*r-2*o+a+c}return{initCatmullRom:function(r,o,a,c,l){s(o,a,l*(a-r),l*(c-o))},initNonuniformCatmullRom:function(r,o,a,c,l,u,h){let d=(o-r)/l-(a-r)/(l+u)+(a-o)/u,f=(a-o)/u-(c-o)/(u+h)+(c-a)/h;d*=u,f*=u,s(o,a,d,f)},calc:function(r){const o=r*r,a=o*r;return n+e*r+t*o+i*a}}}const la=new S,nc=new xh,ic=new xh,sc=new xh;
vendor: 18,069 bytes, line 2827
2827class jp extends vn{constructor(e=[],t=!1,i="centripetal",s=.5){super(),this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=s}getPoint(e,t=new S){const i=t,s=this.points,r=s.length,o=(r-(this.closed?0:1))*e;let a=Math.floor(o),c=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/r)+1)*r:c===0&&a===r-1&&(a=r-2,c=1);let l,u;this.closed||a>0?l=s[(a-1)%r]:(la.subVectors(s[0],s[1]).add(s[0]),l=la);const h=s[a%r],d=s[(a+1)%r];if(this.closed||a+2<r?u=s[(a+2)%r]:(la.subVectors(s[r-1],s[r-2]).add(s[r-1]),u=la),this.curveType==="centripetal"||this.curveType==="chordal"){const f=this.curveType==="chordal"?.5:.25;let p=Math.pow(l.distanceToSquared(h),f),b=Math.pow(h.distanceToSquared(d),f),w=Math.pow(d.distanceToSquared(u),f);b<1e-4&&(b=1),p<1e-4&&(p=b),w<1e-4&&(w=b),nc.initNonuniformCatmullRom(l.x,h.x,d.x,u.x,p,b,w),ic.initNonuniformCatmullRom(l.y,h.y,d.y,u.y,p,b,w),sc.initNonuniformCatmullRom(l.z,h.z,d.z,u.z,p,b,w)}else this.curveType==="catmullrom"&&(nc.initCatmullRom(l.x,h.x,d.x,u.x,this.tension),ic.initCatmullRom(l.y,h.y,d.y,u.y,this.tension),sc.initCatmullRom(l.z,h.z,d.z,u.z,this.tension));return i.set(nc.calc(c),ic.calc(c),sc.calc(c)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const s=e.points[t];this.points.push(s.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 s=this.points[t];e.points.push(s.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 s=e.points[t];this.points.push(new S().fromArray(s))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}jp.prototype.isCatmullRomCurve3=!0;function xd(n,e,t,i,s){const r=(i-e)*.5,o=(s-t)*.5,a=n*n,c=n*a;return(2*t-2*i+r+o)*c+(-3*t+3*i-2*r-o)*a+r*n+t}function $1(n,e){const t=1-n;return t*t*e}function eM(n,e){return 2*(1-n)*n*e}function tM(n,e){return n*n*e}function no(n,e,t,i){return $1(n,e)+eM(n,t)+tM(n,i)}function nM(n,e){const t=1-n;return t*t*t*e}function iM(n,e){const t=1-n;return 3*t*t*n*e}function sM(n,e){return 3*(1-n)*n*n*e}function rM(n,e){return n*n*n*e}function io(n,e,t,i,s){return nM(n,e)+iM(n,t)+sM(n,i)+rM(n,s)}class yh extends vn{constructor(e=new $,t=new $,i=new $,s=new $){super(),this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=s}getPoint(e,t=new $){const i=t,s=this.v0,r=this.v1,o=this.v2,a=this.v3;return i.set(io(e,s.x,r.x,o.x,a.x),io(e,s.y,r.y,o.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.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}}yh.prototype.isCubicBezierCurve=!0;class Xp extends vn{constructor(e=new S,t=new S,i=new S,s=new S){super(),this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=s}getPoint(e,t=new S){const i=t,s=this.v0,r=this.v1,o=this.v2,a=this.v3;return i.set(io(e,s.x,r.x,o.x,a.x),io(e,s.y,r.y,o.y,a.y),io(e,s.z,r.z,o.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.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}}Xp.prototype.isCubicBezierCurve3=!0;class dl extends vn{constructor(e=new $,t=new $){super(),this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new $){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){const i=t||new $;return i.copy(this.v2).sub(this.v1).normalize(),i}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}}dl.prototype.isLineCurve=!0;class oM extends vn{constructor(e=new S,t=new S){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=e,this.v2=t}getPoint(e,t=new S){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)}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 vh extends vn{constructor(e=new $,t=new $,i=new $){super(),this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new $){const i=t,s=this.v0,r=this.v1,o=this.v2;return i.set(no(e,s.x,r.x,o.x),no(e,s.y,r.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}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}}vh.prototype.isQuadraticBezierCurve=!0;class Yp extends vn{constructor(e=new S,t=new S,i=new S){super(),this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new S){const i=t,s=this.v0,r=this.v1,o=this.v2;return i.set(no(e,s.x,r.x,o.x),no(e,s.y,r.y,o.y),no(e,s.z,r.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}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}}Yp.prototype.isQuadraticBezierCurve3=!0;class bh extends vn{constructor(e=[]){super(),this.type="SplineCurve",this.points=e}getPoint(e,t=new $){const i=t,s=this.points,r=(s.length-1)*e,o=Math.floor(r),a=r-o,c=s[o===0?o:o-1],l=s[o],u=s[o>s.length-2?s.length-1:o+1],h=s[o>s.length-3?s.length-1:o+2];return i.set(xd(a,c.x,l.x,u.x,h.x),xd(a,c.y,l.y,u.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const s=e.points[t];this.points.push(s.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const s=this.points[t];e.points.push(s.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const s=e.points[t];this.points.push(new $().fromArray(s))}return this}}bh.prototype.isSplineCurve=!0;var aM=Object.freeze({__proto__:null,ArcCurve:qp,CatmullRomCurve3:jp,CubicBezierCurve:yh,CubicBezierCurve3:Xp,EllipseCurve:ul,LineCurve:dl,LineCurve3:oM,QuadraticBezierCurve:vh,QuadraticBezierCurve3:Yp,SplineCurve:bh});class lM extends vn{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);e.equals(t)||this.curves.push(new dl(t,e))}getPoint(e){const t=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=t){const r=i[s]-t,o=this.curves[s],a=o.getLength(),c=a===0?0:1-r/a;return o.getPointAt(c)}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,s=this.curves.length;i<s;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 s=0,r=this.curves;s<r.length;s++){const o=r[s],a=o&&o.isEllipseCurve?e*2:o&&(o.isLineCurve||o.isLineCurve3)?1:o&&o.isSplineCurve?e*o.points.length:e,c=o.getPoints(a);for(let l=0;l<c.length;l++){const u=c[l];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 s=e.curves[t];this.curves.push(s.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 s=this.curves[t];e.curves.push(s.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 s=e.curves[t];this.curves.push(new aM[s.type]().fromJSON(s))}return this}}class Ic extends lM{constructor(e){super(),this.type="Path",this.currentPoint=new $,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 dl(this.currentPoint.clone(),new $(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,s){const r=new vh(this.currentPoint.clone(),new $(e,t),new $(i,s));return this.curves.push(r),this.currentPoint.set(i,s),this}bezierCurveTo(e,t,i,s,r,o){const a=new yh(this.currentPoint.clone(),new $(e,t),new $(i,s),new $(r,o));return this.curves.push(a),this.currentPoint.set(r,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new bh(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,s,r,o){const a=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+a,t+c,i,s,r,o),this}absarc(e,t,i,s,r,o){return this.absellipse(e,t,i,i,s,r,o),this}ellipse(e,t,i,s,r,o,a,c){const l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,i,s,r,o,a,c),this}absellipse(e,t,i,s,r,o,a,c){const l=new ul(e,t,i,s,r,o,a,c);if(this.curves.length>0){const h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);const u=l.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 wh extends Ic{constructor(e){super(e),this.uuid=xn(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,s=this.holes.length;i<s;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 s=e.holes[t];this.holes.push(s.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 s=this.holes[t];e.holes.push(s.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 s=e.holes[t];this.holes.push(new Ic().fromJSON(s))}return this}}class qn extends $e{constructor(e,t=1){super(),this.type="Light",this.color=new pe(e),this.intensity=t}dispose(){}copy(e){return super.copy(e),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,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}qn.prototype.isLight=!0;class Mh extends qn{constructor(e,t,i){super(e,i),this.type="HemisphereLight",this.position.copy($e.DefaultUp),this.updateMatrix(),this.groundColor=new pe(t)}copy(e){return qn.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}}Mh.prototype.isHemisphereLight=!0;const yd=new ve,vd=new S,bd=new S;class _h{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new $(512,512),this.map=null,this.mapPass=null,this.matrix=new ve,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new nl,this._frameExtents=new $(1,1),this._viewportCount=1,this._viewports=[new at(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;vd.setFromMatrixPosition(e.matrixWorld),t.position.copy(vd),bd.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(bd),t.updateMatrixWorld(),yd.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(yd),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(t.projectionMatrix),i.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return 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}}class Zp extends _h{constructor(){super(new Ot(50,1,.5,500)),this.focus=1}updateMatrices(e){const t=this.camera,i=ho*2*e.angle*this.focus,s=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(i!==t.fov||s!==t.aspect||r!==t.far)&&(t.fov=i,t.aspect=s,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}Zp.prototype.isSpotLightShadow=!0;class Kp extends qn{constructor(e,t,i=0,s=Math.PI/3,r=0,o=1){super(e,t),this.type="SpotLight",this.position.copy($e.DefaultUp),this.updateMatrix(),this.target=new $e,this.distance=i,this.angle=s,this.penumbra=r,this.decay=o,this.shadow=new Zp}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}Kp.prototype.isSpotLight=!0;const wd=new ve,Hr=new S,rc=new S;class Jp extends _h{constructor(){super(new Ot(90,1,.5,500)),this._frameExtents=new $(4,2),this._viewportCount=6,this._viewports=[new at(2,1,1,1),new at(0,1,1,1),new at(3,1,1,1),new at(1,1,1,1),new at(3,0,1,1),new at(1,0,1,1)],this._cubeDirections=[new S(1,0,0),new S(-1,0,0),new S(0,0,1),new S(0,0,-1),new S(0,1,0),new S(0,-1,0)],this._cubeUps=[new S(0,1,0),new S(0,1,0),new S(0,1,0),new S(0,1,0),new S(0,0,1),new S(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,s=this.matrix,r=e.distance||i.far;r!==i.far&&(i.far=r,i.updateProjectionMatrix()),Hr.setFromMatrixPosition(e.matrixWorld),i.position.copy(Hr),rc.copy(i.position),rc.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(rc),i.updateMatrixWorld(),s.makeTranslation(-Hr.x,-Hr.y,-Hr.z),wd.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(wd)}}Jp.prototype.isPointLightShadow=!0;class Qp extends qn{constructor(e,t,i=0,s=1){super(e,t),this.type="PointLight",this.distance=i,this.decay=s,this.shadow=new Jp}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}Qp.prototype.isPointLight=!0;class Sr extends sh{constructor(e=-1,t=1,i=1,s=-1,r=.1,o=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=s,this.near=r,this.far=o,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,s,r,o){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=s,this.view.width=r,this.view.height=o,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,s=(this.top+this.bottom)/2;let r=i-e,o=i+e,a=s+t,c=s-t;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=l*this.view.offsetX,o=r+l*this.view.width,a-=u*this.view.offsetY,c=a-u*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,c,this.near,this.far),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}}Sr.prototype.isOrthographicCamera=!0;class $p extends _h{constructor(){super(new Sr(-5,5,5,-5,.5,500))}}$p.prototype.isDirectionalLightShadow=!0;class ur extends qn{constructor(e,t){super(e,t),this.type="DirectionalLight",this.position.copy($e.DefaultUp),this.updateMatrix(),this.target=new $e,this.shadow=new $p}
2827dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}ur.prototype.isDirectionalLight=!0;class cM extends qn{constructor(e,t){super(e,t),this.type="AmbientLight"}}cM.prototype.isAmbientLight=!0;class hM extends qn{constructor(e,t,i=10,s=10){super(e,t),this.type="RectAreaLight",this.width=i,this.height=s}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}}hM.prototype.isRectAreaLight=!0;class em{constructor(){this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new S)}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,s=e.y,r=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*s),t.addScaledVector(o[2],.488603*r),t.addScaledVector(o[3],.488603*i),t.addScaledVector(o[4],1.092548*(i*s)),t.addScaledVector(o[5],1.092548*(s*r)),t.addScaledVector(o[6],.315392*(3*r*r-1)),t.addScaledVector(o[7],1.092548*(i*r)),t.addScaledVector(o[8],.546274*(i*i-s*s)),t}getIrradianceAt(e,t){const i=e.x,s=e.y,r=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*s),t.addScaledVector(o[2],2*.511664*r),t.addScaledVector(o[3],2*.511664*i),t.addScaledVector(o[4],2*.429043*i*s),t.addScaledVector(o[5],2*.429043*s*r),t.addScaledVector(o[6],.743125*r*r-.247708),t.addScaledVector(o[7],2*.429043*i*r),t.addScaledVector(o[8],.429043*(i*i-s*s)),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 s=0;s<9;s++)i[s].fromArray(e,t+s*3);return this}toArray(e=[],t=0){const i=this.coefficients;for(let s=0;s<9;s++)i[s].toArray(e,t+s*3);return e}static getBasisAt(e,t){const i=e.x,s=e.y,r=e.z;t[0]=.282095,t[1]=.488603*s,t[2]=.488603*r,t[3]=.488603*i,t[4]=1.092548*i*s,t[5]=1.092548*s*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*i*r,t[8]=.546274*(i*i-s*s)}}em.prototype.isSphericalHarmonics3=!0;class Sh extends qn{constructor(e=new em,t=1){super(void 0,t),this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}Sh.prototype.isLightProbe=!0;class er{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,s=e.length;i<s;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.substr(0,t+1)}}class uM extends qe{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){const e=super.toJSON(this);return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}uM.prototype.isInstancedBufferGeometry=!0;class dM extends xt{constructor(e,t,i,s){typeof i=="number"&&(s=i,i=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(e,t,i),this.meshPerAttribute=s||1}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}}dM.prototype.isInstancedBufferAttribute=!0;class tm extends xi{constructor(e){super(e),typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,s){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=hr.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(c){hr.add(e,c),t&&t(c),r.manager.itemEnd(e)}).catch(function(c){s&&s(c),r.manager.itemError(e),r.manager.itemEnd(e)}),r.manager.itemStart(e)}}tm.prototype.isImageBitmapLoader=!0;let ca;const fM={getContext:function(){return ca===void 0&&(ca=new(window.AudioContext||window.webkitAudioContext)),ca},setContext:function(n){ca=n}};class pM extends xi{constructor(e){super(e)}load(e,t,i,s){const r=this,o=new gh(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{const c=a.slice(0);fM.getContext().decodeAudioData(c,function(u){t(u)})}catch(c){s?s(c):console.error(c),r.manager.itemError(e)}},i,s)}}class mM extends Sh{constructor(e,t,i=1){super(void 0,i);const s=new pe().set(e),r=new pe().set(t),o=new S(s.r,s.g,s.b),a=new S(r.r,r.g,r.b),c=Math.sqrt(Math.PI),l=c*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(c),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(l)}}mM.prototype.isHemisphereLightProbe=!0;class gM extends Sh{constructor(e,t=1){super(void 0,t);const i=new pe().set(e);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}}gM.prototype.isAmbientLightProbe=!0;class nm{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Md(),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=Md();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Md(){return(typeof performance>"u"?Date:performance).now()}class xM extends $e{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
vendor: 26,397 bytes, line 2827
2827=!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){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.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){console.warn("THREE.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(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source.stop(),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.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){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!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){console.warn("THREE.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}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.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}}class yM{constructor(e,t,i){this.binding=e,this.valueSize=i;let s,r,o;switch(t){case"quaternion":s=this._slerp,r=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":s=this._select,r=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:s=this._lerp,r=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=s,this._mixBufferRegionAdditive=r,this._setIdentity=o,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,s=this.valueSize,r=e*s+s;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==s;++a)i[r+a]=i[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(i,r,0,a,s)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,i=this.valueSize,s=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,s,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,i=this.buffer,s=e*t+t,r=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const c=t*this._origIndex;this._mixBufferRegion(i,s,c,1-r,t)}o>0&&this._mixBufferRegionAdditive(i,s,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(i[c]!==i[c+t]){a.setValue(i,s);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,s=i*this._origIndex;e.getValue(t,s);for(let r=i,o=s;r!==o;++r)t[r]=t[s+r%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,s,r){if(s>=.5)for(let o=0;o!==r;++o)e[t+o]=e[i+o]}_slerp(e,t,i,s){Dt.slerpFlat(e,t,e,t,e,i,s)}_slerpAdditive(e,t,i,s,r){const o=this._workIndex*r;Dt.multiplyQuaternionsFlat(e,o,e,t,e,i),Dt.slerpFlat(e,t,e,t,e,o,s)}_lerp(e,t,i,s,r){const o=1-s;for(let a=0;a!==r;++a){const c=t+a;e[c]=e[c]*o+e[i+a]*s}}_lerpAdditive(e,t,i,s,r){for(let o=0;o!==r;++o){const a=t+o;e[a]=e[a]+e[i+o]*s}}}const Th="\\[\\]\\.:\\/",vM=new RegExp("["+Th+"]","g"),Eh="[^"+Th+"]",bM="[^"+Th.replace("\\.","")+"]",wM=/((?:WC+[\/:])*)/.source.replace("WC",Eh),MM=/(WCOD+)?/.source.replace("WCOD",bM),_M=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Eh),SM=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Eh),TM=new RegExp("^"+wM+MM+_M+SM+"$"),EM=["material","materials","bones"];class AM{constructor(e,t,i){const s=i||nt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,s=this._bindings[i];s!==void 0&&s.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=i.length;s!==r;++s)i[s].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 nt{constructor(e,t,i){this.path=t,this.parsedPath=i||nt.parseTrackName(t),this.node=nt.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new nt.Composite(e,t,i):new nt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(vM,"")}static parseTrackName(e){const t=TM.exec(e);if(!t)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]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){const r=i.nodeName.substring(s+1);EM.indexOf(r)!==-1&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=r)}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||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(r){for(let o=0;o<r.length;o++){const a=r[o];if(a.name===t||a.uuid===t)return a;const c=i(a.children);if(c)return c}return null},s=i(e.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.node[this.propertyName]}_getValue_array(e,t){const i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)e[t++]=i[s]}_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 s=0,r=i.length;s!==r;++s)i[s]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)i[s]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let s=0,r=i.length;s!==r;++s)i[s]=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,s=t.propertyName;let r=t.propertyIndex;if(e||(e=nt.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(i){let l=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.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){console.error("THREE.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===l){l=u;break}break;default:if(e[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(l!==void 0){if(e[l]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}const o=e[s];if(o===void 0){const l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+s+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(r!==void 0){if(s==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[r]!==void 0&&(r=e.morphTargetDictionary[r])}else{console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);return}}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=r}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=s;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}nt.Composite=AM;nt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};nt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};nt.prototype.GetterByBindingType=[nt.prototype._getValue_direct,nt.prototype._getValue_array,nt.prototype._getValue_arrayElement,nt.prototype._getValue_toArray];nt.prototype.SetterByBindingTypeAndVersioning=[[nt.prototype._setValue_direct,nt.prototype._setValue_direct_setNeedsUpdate,nt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[nt.prototype._setValue_array,nt.prototype._setValue_array_setNeedsUpdate,nt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[nt.prototype._setValue_arrayElement,nt.prototype._setValue_arrayElement_setNeedsUpdate,nt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[nt.prototype._setValue_fromArray,nt.prototype._setValue_fromArray_setNeedsUpdate,nt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class LM{constructor(e,t,i=null,s=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=s;const r=t.tracks,o=r.length,a=new Array(o),c={endingStart:Vs,endingEnd:Vs};for(let l=0;l!==o;++l){const u=r[l].createInterpolant(null);a[l]=u,u.settings=c}this._interpolantSettings=c,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=yx,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){if(e.fadeOut(t),this.fadeIn(t),i){const s=this._clip.duration,r=e._clip.duration,o=r/s,a=s/r;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i){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 s=this._mixer,r=s.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=s._lendControlInterpolant(),this._timeScaleInterpolant=a);const c=a.parameterPositions,l=a.sampleValues;return c[0]=r,c[1]=r+i,l[0]=e/o,l[1]=t/o,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,s){if(!this.enabled){this._updateWeight(e);return}const r=this._startTime;if(r!==null){const c=(e-r)*i;if(c<0||i===0)return;this._startTime=null,t=i*c}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case lp:for(let u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulateAdditive(a);break;case eh:default:for(let u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulate(s,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const s=i.evaluate(e)[0];t*=s,e>i.parameterPositions[1]&&(this.stopFading(),s===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 s=i.evaluate(e)[0];t*=s,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 s=this.time+e,r=this._loopCount;const o=i===vx;if(e===0)return r===-1?s:o&&(r&1)===1?t-s:s;if(i===xx){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(s>=t)s=t;else if(s<0)s=0;else{this.time=s;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),s>=t||s<0){const a=Math.floor(s/t);s-=t*a,r+=Math.abs(a);const c=this.repetitions-r;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=e>0?t:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const l=e<0;this._setEndings(l,!l,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=s;if(o&&(r&1)===1)return t-s}return s}_setEndings(e,t,i){const s=this._interpolantSettings;i?(s.endingStart=qs,s.endingEnd=qs):(e?s.endingStart=this.zeroSlopeAtStart?qs:Vs:s.endingStart=Pa,t?s.endingEnd=this.zeroSlopeAtEnd?qs:Vs:s.endingEnd=Pa)}_scheduleFading(e,t,i){const s=this._mixer,r=s.time;let o=this._weightInterpolant;o===null&&(o=s._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,c=o.sampleValues;return a[0]=r,c[0]=t,a[1]=r+e,c[1]=i,this}}class Ah extends ps{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,s=e._clip.tracks,r=s.length,o=e._propertyBindings,a=e._interpolants,c=i.uuid,l=this._bindingsByRootAndName;let u=l[c];u===void 0&&(u={},l[c]=u);for(let h=0;h!==r;++h){const d=s[h],f=d.name;let p=u[f];if(p!==void 0)o[h]=p;else{if(p=o[h],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,c,f));continue}const b=t&&t._propertyBindings[h].binding.parsedPath;p=new yM(nt.create(i,f,b),d.ValueTypeName,d.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,c,f),o[h]=p}a[h].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,s=e._clip.uuid,r=this._actionsByClip[s];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,s,i)}const t=e._propertyBindings;for(let i=0,s=t.length;i!==s;++i){const r=t[i];r.useCount++===0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,s=t.length;i!==s;++i){const r=t[i];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}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 s=this._actions,r=this._actionsByClip;let o=r[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=s.length,s.push(e),o.actionByRoot[i]=e}_removeInactiveAction(e){const t=this._actions,i=t[t.length-1],s=e._cacheIndex;i._cacheIndex=s,t[s]=i,t.pop(),e._cacheIndex=null;const r=e._clip.uuid,o=this._actionsByClip,a=o[r],c=a.knownActions,l=c[c.length-1],u=e._byClipCacheIndex;l._byClipCacheIndex=u,c[u]=l,c.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,d=(e._localRoot||this._root).uuid;delete h[d],c.length===0&&delete o[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let i=0,s=t.length;i!==s;++i){const r=t[i];--r.referenceCount===0&&this._removeInactiveBinding(r)}}_lendAction(e){const t=this._actions,i=e._cacheIndex,s=this._nActiveActions++,r=t[s];e._cacheIndex=s,t[s]=e,r._cacheIndex=i,t[i]=r}_takeBackAction(e){const t=this._actions,i=e._cacheIndex,s=--this._nActiveActions,r=t[s];e._cacheIndex=s,t[s]=e,r._cacheIndex=i,t[i]=r}_addInactiveBinding(e,t,i){const s=this._bindingsByRootAndName,r=this._bindings;let o=s[t];o===void 0&&(o={},s[t]=o),o[i]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,i=e.binding,s=i.rootNode.uuid,r=i.path,o=this._bindingsByRootAndName,a=o[s],c=t[t.length-1],l=e._cacheIndex;c._cacheIndex=l,t[l]=c,t.pop(),delete a[r],Object.keys(a).length===0&&delete o[s]}_lendBinding(e){const t=this._bindings,i=e._cacheIndex,s=this._nActiveBindings++,r=t[s];e._cacheIndex=s,t[s]=e,r._cacheIndex=i,t[i]=r}_takeBackBinding(e){const t=this._bindings,i=e._cacheIndex,s=--this._nActiveBindings,r=t[s];e._cacheIndex=s,t[s]=e,r._cacheIndex=i,t[i]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let i=e[t];return i===void 0&&(i=new Gp(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){const t=this._controlInterpolants,i=e.__cacheIndex,s=--this._nActiveControlInterpolants,r=t[s];e.__cacheIndex=s,t[s]=e,r.__cacheIndex=i,t[i]=r}clipAction(e,t,i){const s=t||this._root,r=s.uuid;let o=typeof e=="string"?Da.findByName(s,e):e;const a=o!==null?o.uuid:e,c=this._actionsByClip[a];let l=null;if(i===void 0&&(o!==null?i=o.blendMode:i=eh),c!==void 0){const h=c.actionByRoot[r];if(h!==void 0&&h.blendMode===i)return h;l=c.knownActions[0],o===null&&(o=l._clip)}if(o===null)return null;const u=new LM(this,o,t,i);return this._bindAction(u,l),this._addInactiveAction(u,a,r),u}existingAction(e,t){const i=t||this._root,s=i.uuid,r=typeof e=="string"?Da.findByName(i,e):e,o=r?r.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[s]||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,s=this.time+=e,r=Math.sign(e),o=this._accuIndex^=1;for(let l=0;l!==i;++l)t[l]._update(s,e,r,o);const a=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)a[l].apply(o);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,s=this._actionsByClip,r=s[i];if(r!==void 0){const o=r.knownActions;for(let a=0,c=o.length;a!==c;++a){const l=o[a];this._deactivateAction(l);const u=l._cacheIndex,h=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(l)}delete s[i]}}uncacheRoot(e){const t=e.uuid,i=this._actionsByClip;for(const o in i){const a=i[o].actionByRoot,c=a[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}const s=this._bindingsByRootAndName,r=s[t];if(r!==void 0)for(const o in r){const a=r[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}}Ah.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class CM extends Vi{constructor(e,t,i=1){super(e,t),this.meshPerAttribute=i||1}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}}CM.prototype.isInstancedInterleavedBuffer=!0;class RM{constructor(e,t,i=0,s=1/0){this.ray=new gs(e,t),this.near=i,this.far=s,this.camera=null,this.layers=new mp,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){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&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: 
2827Unsupported camera type: "+t.type)}intersectObject(e,t=!1,i=[]){return Bc(e,this,i,t),i.sort(_d),i}intersectObjects(e,t=!1,i=[]){for(let s=0,r=e.length;s<r;s++)Bc(e[s],this,i,t);return i.sort(_d),i}}function _d(n,e){return n.distance-e.distance}function Bc(n,e,t,i){if(n.layers.test(e.layers)&&n.raycast(e,t),i===!0){const s=n.children;for(let r=0,o=s.length;r<o;r++)Bc(s[r],e,t,!0)}}class PM extends $e{constructor(e){super(),this.material=e,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}}PM.prototype.isImmediateRenderObject=!0;const Ti=new S,ha=new ve,oc=new ve;class im extends ol{constructor(e){const t=sm(e),i=new qe,s=[],r=[],o=new pe(0,0,1),a=new pe(0,1,0);for(let l=0;l<t.length;l++){const u=t[l];u.parent&&u.parent.isBone&&(s.push(0,0,0),s.push(0,0,0),r.push(o.r,o.g,o.b),r.push(a.r,a.g,a.b))}i.setAttribute("position",new Ne(s,3)),i.setAttribute("color",new Ne(r,3));const c=new wr({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,c),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,i=this.geometry,s=i.getAttribute("position");oc.copy(this.root.matrixWorld).invert();for(let r=0,o=0;r<t.length;r++){const a=t[r];a.parent&&a.parent.isBone&&(ha.multiplyMatrices(oc,a.matrixWorld),Ti.setFromMatrixPosition(ha),s.setXYZ(o,Ti.x,Ti.y,Ti.z),ha.multiplyMatrices(oc,a.parent.matrixWorld),Ti.setFromMatrixPosition(ha),s.setXYZ(o+1,Ti.x,Ti.y,Ti.z),o+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}}function sm(n){const e=[];n&&n.isBone&&e.push(n);for(let t=0;t<n.children.length;t++)e.push.apply(e,sm(n.children[t]));return e}class IM extends ol{constructor(e=10,t=10,i=4473924,s=8947848){i=new pe(i),s=new pe(s);const r=t/2,o=e/t,a=e/2,c=[],l=[];for(let d=0,f=0,p=-a;d<=t;d++,p+=o){c.push(-a,0,p,a,0,p),c.push(p,0,-a,p,0,a);const b=d===r?i:s;b.toArray(l,f),f+=3,b.toArray(l,f),f+=3,b.toArray(l,f),f+=3,b.toArray(l,f),f+=3}const u=new qe;u.setAttribute("position",new Ne(c,3)),u.setAttribute("color",new 
2827Ne(l,3));const h=new wr({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}}const BM=new Float32Array(1);new Int32Array(BM.buffer);const tr=4,Fi=8,Bn=Math.pow(2,Fi),rm=[.125,.215,.35,.446,.526,.582],om=Fi-tr+1+rm.length,Os=20,Un={[an]:0,[Cn]:1,[nh]:2,[hp]:3,[up]:4,[dp]:5,[th]:6},Qi=new _e({side:Pt,depthWrite:!1,depthTest:!1}),DM=new X(new wt,Qi),ac=new Sr,{_lodPlanes:Ur,_sizeLods:Sd,_sigmas:ua}=zM(),Td=new pe;let lc=null;const $i=(1+Math.sqrt(5))/2,Hs=1/$i,Ed=[new S(1,1,1),new S(-1,1,1),new S(1,1,-1),new S(-1,1,-1),new S(0,$i,Hs),new S(0,$i,-Hs),new S(Hs,0,$i),new S(-Hs,0,$i),new S($i,Hs,0),new S(-$i,Hs,0)];function Ad(n){const e=Math.max(n.r,n.g,n.b),t=Math.min(Math.max(Math.ceil(Math.log2(e)),-128),127);return n.multiplyScalar(Math.pow(2,-t)),(t+128)/255}class kM{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._blurMaterial=FM(Os),this._equirectShader=null,this._cubemapShader=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,s=100){lc=this._renderer.getRenderTarget();const r=this._allocateTargets();return this._sceneToCubeUV(e,i,s,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e){return this._fromTexture(e)}fromCubemap(e){return this._fromTexture(e)}compileCubemapShader(){this._cubemapShader===null&&(this._cubemapShader=Rd(),this._compileMaterial(this._cubemapShader))}compileEquirectangularShader(){this._equirectShader===null&&(this._equirectShader=Cd(),this._compileMaterial(this._equirectShader))}dispose(){this._blurMaterial.dispose(),this._cubemapShader!==null&&this._cubemapShader.dispose(),this._equirectShader!==null&&this._equirectShader.dispose();for(let e=0;e<Ur.length;e++)Ur[e].dispose()}_cleanup(e){this._pingPongRenderTarget.dispose(),this._renderer.setRenderTarget(lc),e.scissorTest=!1,da(e,0,0,e.width,e.height)}_fromTexture(e){lc=this._renderer.getRenderTarget();const t=this._allocateTargets(e);return this._textureToCubeUV(e,t),this._applyPMREM(t),this._cleanup(t),t}_allocateTargets(e){const t={magFilter:vt,minFilter:vt,generateMipmaps:!1,type:So,format:Dg,encoding:NM(e)?e.encoding:nh,depthBuffer:!1},i=Ld(t);return i.depthBuffer=!e,this._pingPongRenderTarget=Ld(t),i}_compileMaterial(e){const t=new X(Ur[0],e);this._renderer.compile(t,ac)}_sceneToCubeUV(e,t,i,s){const a=new Ot(90,1,t,i),c=[1,-1,1,1,1,1],l=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,d=u.outputEncoding,f=u.toneMapping;u.getClearColor(Td),u.toneMapping=Qs,u.outputEncoding=an,u.autoClear=!1;let p=!1;const b=e.background;if(b){if(b.isColor){Qi.color.copy(b).convertSRGBToLinear(),e.background=null;const w=Ad(Qi.color);Qi.opacity=w,p=!0}}else{Qi.color.copy(Td).convertSRGBToLinear();const w=Ad(Qi.color);Qi.opacity=w,p=!0}for(let w=0;w<6;w++){const v=w%3;v==0?(a.up.set(0,c[w],0),a.lookAt(l[w],0,0)):v==1?(a.up.set(0,0,c[w]),a.lookAt(0,l[w],0)):(a.up.set(0,c[w],0),a.lookAt(0,0,l[w])),da(s,v*Bn,w>2?Bn:0,Bn,Bn),u.setRenderTarget(s),p&&u.render(DM,a),u.render(e,a)}u.toneMapping=f,u.outputEncoding=d,u.autoClear=h}_textureToCubeUV(e,t){const i=this._renderer;e.isCubeTexture?this._cubemapShader==null&&(this._cubemapShader=Rd()):this._equirectShader==null&&(this._equirectShader=Cd());const s=e.isCubeTexture?this._cubemapShader:this._equirectShader,r=new X(Ur[0],s),o=s.uniforms;o.envMap.value=e,e.isCubeTexture||o.texelSize.value.set(1/e.image.width,1/e.image.height),o.inputEncoding.value=Un[e.encoding],o.outputEncoding.value=Un[t.texture.encoding],da(t,0,0,3*Bn,2*Bn),i.setRenderTarget(t),i.render(r,ac)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let s=1;s<om;s++){const r=Math.sqrt(ua[s]*ua[s]-ua[s-1]*ua[s-1]),o=Ed[(s-1)%Ed.length];this._blur(e,s-1,s,r,o)}t.autoClear=i}_blur(e,t,i,s,r){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,i,s,"latitudinal",r),this._halfBlur(o,e,i,i,s,"longitudinal",r)}_halfBlur(e,t,i,s,r,o,a){const c=this._renderer,l=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,h=new X(Ur[s],l),d=l.uniforms,f=Sd[i]-1,p=isFinite(r)?Math.PI/(2*f):2*Math.PI/(2*Os-1),b=r/p,w=isFinite(r)?1+Math.floor(u*b):Os;w>Os&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${w} samples when the maximum is set to ${Os}`);const v=[];let y=0;for(let _=0;_<Os;++_){const D=_/b,F=Math.exp(-D*D/2);v.push(F),_==0?y+=F:_<w&&(y+=2*F)}for(let _=0;_<v.length;_++)v[_]=v[_]/y;d.envMap.value=e.texture,d.samples.value=w,d.weights.value=v,d.latitudinal.value=o==="latitudinal",a&&(d.poleAxis.value=a),d.dTheta.value=p,d.mipInt.value=Fi-i,d.inputEncoding.value=Un[e.texture.encoding],d.outputEncoding.value=Un[e.texture.encoding];const E=Sd[s],L=3*Math.max(0,Bn-2*E),C=(s===0?0:2*Bn)+2*E*(s>Fi-tr?s-Fi+tr:0);da(t,L,C,3*E,2*E),c.setRenderTarget(t),c.render(h,ac)}}function NM(n){return n===void 0||n.type!==So?!1:n.encoding===an||n.encoding===Cn||n.encoding===th}function zM(){const n=[],e=[],t=[];let i=Fi;for(let s=0;s<om;s++){const r=Math.pow(2,i);e.push(r);let o=1/r;s>Fi-tr?o=rm[s-Fi+tr-1]:s==0&&(o=0),t.push(o);const a=1/(r-1),c=-a/2,l=1+a/2,u=[c,c,l,c,l,l,c,c,l,l,c,l],h=6,d=6,f=3,p=2,b=1,w=new Float32Array(f*d*h),v=new Float32Array(p*d*h),y=new Float32Array(b*d*h);for(let L=0;L<h;L++){const C=L%3*2/3-1,_=L>2?0:-1,D=[C,_,0,C+2/3,_,0,C+2/3,_+1,0,C,_,0,C+2/3,_+1,0,C,_+1,0];w.set(D,f*d*L),v.set(u,p*d*L);const F=[L,L,L,L,L,L];y.set(F,b*d*L)}const E=new qe;E.setAttribute("position",new xt(w,f)),E.setAttribute("uv",new xt(v,p)),E.setAttribute("faceIndex",new xt(y,b)),n.push(E),i>tr&&i--}return{_lodPlanes:n,_sizeLods:e,_sigmas:t}}function Ld(n){const e=new on(3*Bn,3*Bn,n);return e.texture.mapping=el,e.texture.name="PMREM.cubeUv",e.scissorTest=!0,e}function da(n,e,t,i,s){n.viewport.set(e,t,i,s),n.scissor.set(e,t,i,s)}function FM(n){const e=new Float32Array(n),t=new S(0,1,0);return new cl({name:"SphericalGaussianBlur",defines:{n},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:t}
2827,inputEncoding:{value:Un[an]},outputEncoding:{value:Un[an]}},vertexShader:Lh(),fragmentShader:`
2828
2829			precision mediump float;
2830			precision mediump int;
2831
2832			varying vec3 vOutputDirection;
2833
2834			uniform sampler2D envMap;
2835			uniform int samples;
2836			uniform float weights[ n ];
2837			uniform bool latitudinal;
2838			uniform float dTheta;
2839			uniform float mipInt;
2840			uniform vec3 poleAxis;
2841
2842			${Ch()}
2843
2844			#define ENVMAP_TYPE_CUBE_UV
2845			#include <cube_uv_reflection_fragment>
2846
2847			vec3 getSample( float theta, vec3 axis ) {
2848
2849				float cosTheta = cos( theta );
2850				// Rodrigues' axis-angle rotation
2851				vec3 sampleDirection = vOutputDirection * cosTheta
2852					+ cross( axis, vOutputDirection ) * sin( theta )
2853					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
2854
2855				return bilinearCubeUV( envMap, sampleDirection, mipInt );
2856
2857			}
2858
2859			void main() {
2860
2861				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
2862
2863				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
2864
2865					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
2866
2867				}
2868
2869				axis = normalize( axis );
2870
2871				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2872				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
2873
2874				for ( int i = 1; i < n; i++ ) {
2875
2876					if ( i >= samples ) {
2877
2878						break;
2879
2880					}
2881
2882					float theta = dTheta * float( i );
2883					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
2884					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
2885
2886				}
2887
2888				gl_FragColor = linearToOutputTexel( gl_FragColor );
2889
2890			}
2891		`,blending:ki,depthTest:!1,depthWrite:!1})}function Cd(){const n=new $(1,1);return new cl({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null},texelSize:{value:n},inputEncoding:{value:Un[an]},outputEncoding:{value:Un[an]}},vertexShader:Lh(),fragmentShader:`
2892
2893			precision mediump float;
2894			precision mediump int;
2895
2896			varying vec3 vOutputDirection;
2897
2898			uniform sampler2D envMap;
2899			uniform vec2 texelSize;
2900
2901			${Ch()}
2902
2903			#include <common>
2904
2905			void main() {
2906
2907				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2908
2909				vec3 outputDirection = normalize( vOutputDirection );
2910				vec2 uv = equirectUv( outputDirection );
2911
2912				vec2 f = fract( uv / texelSize - 0.5 );
2913				uv -= f * texelSize;
2914				vec3 tl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
2915				uv.x += texelSize.x;
2916				vec3 tr = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
2917				uv.y += texelSize.y;
2918				vec3 br = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
2919				uv.x -= texelSize.x;
2920				vec3 bl = envMapTexelToLinear( texture2D ( envMap, uv ) ).rgb;
2921
2922				vec3 tm = mix( tl, tr, f.x );
2923				vec3 bm = mix( bl, br, f.x );
2924				gl_FragColor.rgb = mix( tm, bm, f.y );
2925
2926				gl_FragColor = linearToOutputTexel( gl_FragColor );
2927
2928			}
2929		`,blending:ki,depthTest:!1,depthWrite:!1})}function Rd(){return new cl({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},inputEncoding:{value:Un[an]},outputEncoding:{value:Un[an]}},vertexShader:Lh(),fragmentShader:`
2930
2931			precision mediump float;
2932			precision mediump int;
2933
2934			varying vec3 vOutputDirection;
2935
2936			uniform samplerCube envMap;
2937
2938			${Ch()}
2939
2940			void main() {
2941
2942				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2943				gl_FragColor.rgb = envMapTexelToLinear( textureCube( envMap, vec3( - vOutputDirection.x, vOutputDirection.yz ) ) ).rgb;
2944				gl_FragColor = linearToOutputTexel( gl_FragColor );
2945
2946			}
2947		`,blending:ki,depthTest:!1,depthWrite:!1})}function Lh(){return`
2948
2949		precision mediump float;
2950		precision mediump int;
2951
2952		attribute vec3 position;
2953		attribute vec2 uv;
2954		attribute float faceIndex;
2955
2956		varying vec3 vOutputDirection;
2957
2958		// RH coordinate system; PMREM face-indexing convention
2959		vec3 getDirection( vec2 uv, float face ) {
2960
2961			uv = 2.0 * uv - 1.0;
2962
2963			vec3 direction = vec3( uv, 1.0 );
2964
2965			if ( face == 0.0 ) {
2966
2967				direction = direction.zyx; // ( 1, v, u ) pos x
2968
2969			} else if ( face == 1.0 ) {
2970
2971				direction = direction.xzy;
2972				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
2973
2974			} else if ( face == 2.0 ) {
2975
2976				direction.x *= -1.0; // ( -u, v, 1 ) pos z
2977
2978			} else if ( face == 3.0 ) {
2979
2980				direction = direction.zyx;
2981				direction.xz *= -1.0; // ( -1, v, -u ) neg x
2982
2983			} else if ( face == 4.0 ) {
2984
2985				direction = direction.xzy;
2986				direction.xy *= -1.0; // ( -u, -1, v ) neg y
2987
2988			} else if ( face == 5.0 ) {
2989
2990				direction.z *= -1.0; // ( u, v, -1 ) neg z
2991
2992			}
2993
2994			return direction;
2995
2996		}
2997
2998		void main() {
2999
3000			vOutputDirection = getDirection( uv, faceIndex );
3001			gl_Position = vec4( position, 1.0 );
3002
3003		}
3004	`}function Ch(){return`
3005
3006		uniform int inputEncoding;
3007		uniform int outputEncoding;
3008
3009		#include <encodings_pars_fragment>
3010
3011		vec4 inputTexelToLinear( vec4 value ) {
3012
3013			if ( inputEncoding == 0 ) {
3014
3015				return value;
3016
3017			} else if ( inputEncoding == 1 ) {
3018
3019				return sRGBToLinear( value );
3020
3021			} else if ( inputEncoding == 2 ) {
3022
3023				return RGBEToLinear( value );
3024
3025			} else if ( inputEncoding == 3 ) {
3026
3027				return RGBMToLinear( value, 7.0 );
3028
3029			} else if ( inputEncoding == 4 ) {
3030
3031				return RGBMToLinear( value, 16.0 );
3032
3033			} else if ( inputEncoding == 5 ) {
3034
3035				return RGBDToLinear( value, 256.0 );
3036
3037			} else {
3038
3039				return GammaToLinear( value, 2.2 );
3040
3041			}
3042
3043		}
3044
3045		vec4 linearToOutputTexel( vec4 value ) {
3046
3047			if ( outputEncoding == 0 ) {
3048
3049				return value;
3050
3051			} else if ( outputEncoding == 1 ) {
3052
3053				return LinearTosRGB( value );
3054
3055			} else if ( outputEncoding == 2 ) {
3056
3057				return LinearToRGBE( value );
3058
3059			} else if ( outputEncoding == 3 ) {
3060
3061				return LinearToRGBM( value, 7.0 );
3062
3063			} else if ( outputEncoding == 4 ) {
3064
3065				return LinearToRGBM( value, 16.0 );
3066
3067			} else if ( outputEncoding == 5 ) {
3068
3069				return LinearToRGBD( value, 256.0 );
3070
3071			} else {
3072
3073				return LinearToGamma( value, 2.2 );
3074
3075			}
3076
3077		}
3078
3079		vec4 envMapTexelToLinear( vec4 color ) {
3080
3081			return inputTexelToLinear( color );
3082
3083		}
3084	`}vn.create=function(n,e){return console.log("THREE.Curve.create() has been deprecated"),n.prototype=Object.create(vn.prototype),n.prototype.constructor=n,n.prototype.getPoint=e,n};Ic.prototype.fromPoints=function(n){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(n)};IM.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};im.prototype.update=function(){console.error("THREE.SkeletonHelper: update(
3084) no longer needs to be called.")};xi.prototype.extractUrlBase=function(n){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),er.extractUrlBase(n)};xi.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}};Yt.prototype.center=function(n){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(n)};Yt.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()};Yt.prototype.isIntersectionBox=function(n){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(n)};Yt.prototype.isIntersectionSphere=function(n){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(n)};Yt.prototype.size=function(n){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(n)};ms.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()};nl.prototype.setFromMatrix=function(n){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(n)};Ht.prototype.flattenToArrayOffset=function(n,e){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(n,e)};Ht.prototype.multiplyVector3=function(n){return console.warn("THREE.Matrix3: .multiplyVector3(
3084) has been removed. Use vector.applyMatrix3( matrix ) instead."),n.applyMatrix3(this)};Ht.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")};Ht.prototype.applyToBufferAttribute=function(n){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),n.applyMatrix3(this)};Ht.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")};Ht.prototype.getInverse=function(n){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(n).invert()};ve.prototype.extractPosition=function(n){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(n)};ve.prototype.flattenToArrayOffset=function(n,e){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(n,e)};ve.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new S().setFromMatrixColumn(this,3)};ve.prototype.setRotationFromQuaternion=function(n){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(n)};ve.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")};ve.prototype.multiplyVector3=function(n){return console.warn("THREE.Matrix4: .multiplyVector3(
3084) has been removed. Use vector.applyMatrix4( matrix ) instead."),n.applyMatrix4(this)};ve.prototype.multiplyVector4=function(n){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),n.applyMatrix4(this)};ve.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")};ve.prototype.rotateAxis=function(n){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),n.transformDirection(this)};ve.prototype.crossVector=function(n){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),n.applyMatrix4(this)};ve.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")};ve.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")};ve.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")};ve.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")};ve.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")};ve.prototype.applyToBufferAttribute=function(n){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),n.applyMatrix4(this)};ve.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")};ve.prototype.makeFrustum=function(n,e,t,i,s,r){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(n,e,i,t,s,r)};ve.prototype.getInverse=function(n){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(n).invert()};Sn.prototype.isIntersectionLine=function(n){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(n)};Dt.prototype.multiplyVector3=function(n){return console.warn("THREE.Quaternion: .multiplyVector3(
3084) has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),n.applyQuaternion(this)};Dt.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()};gs.prototype.isIntersectionBox=function(n){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(n)};gs.prototype.isIntersectionPlane=function(n){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(n)};gs.prototype.isIntersectionSphere=function(n){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(n)};Bt.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()};Bt.prototype.barycoordFromPoint=function(n,e){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(n,e)};Bt.prototype.midpoint=function(n){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(n)};Bt.prototypenormal=function(n){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(n)};Bt.prototype.plane=function(n){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(n)};Bt.barycoordFromPoint=function(n,e,t,i,s){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),Bt.getBarycoord(n,e,t,i,s)};Bt.normal=function(n,e,t,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),Bt.getNormal(n,e,t,i)};wh.prototype.extractAllPoints=function(n){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(n)};wh.prototype.extrude=function(n){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new ll(this,n)};wh.prototype.makeGeometry=function(n){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new z1(this,n)};$.prototype.fromAttribute=function(n,e,t){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(n,e,t)};$.prototype.distanceToManhattan=function(n){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(n)};$.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};S.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")};S.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")};S.prototype.getPositionFromMatrix=function(n){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(n)};S.prototype.getScaleFromMatrix=function(n){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(n)};S.prototype.getColumnFromMatrix=function(n,e){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(e,n)};S.prototype.applyProjection=function(n){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(n)};S.prototype.fromAttribute=function(n,e,t){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(n,e,t)};S.prototype.distanceToManhattan=function(n){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(n)};S.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};at.prototype.fromAttribute=function(n,e,t){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(n,e,t)};at.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()};$e.prototype.getChildByName=function(n){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(n)};$e.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")};$e.prototype.translate=function(n,e){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(e,n)};$e.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")};
3084$e.prototype.applyMatrix=function(n){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(n)};Object.defineProperties($e.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(n){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=n}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});X.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")};Object.defineProperties(X.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),bx},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}});ah.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};Ot.prototype.setLens=function(n,e){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),e!==void 0&&(this.filmGauge=e),this.setFocalLength(n)};Object.defineProperties(qn.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(n){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=n}},shadowCameraLeft:{set:function(n){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=n}},shadowCameraRight:{set:function(n){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=n}},shadowCameraTop:{set:function(n){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=n}},shadowCameraBottom:{set:function(n){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=n}},shadowCameraNear:{set:function(n){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=n}},shadowCameraFar:{set:function(n){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=n}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(n){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=n}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(n){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=n}},shadowMapHeight:{set:function(n){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=n}}});Object.defineProperties(xt.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===Ia},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(Ia)}}});xt.prototype.setDynamic=function(n){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(n===!0?Ia:co),this};xt.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},xt.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};qe.prototype.addIndex=function(n){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(n)};qe.prototype.addAttribute=function(n,e){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),!(e&&e.isBufferAttribute)&&!(e&&e.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(n,new xt(arguments[1],arguments[2]))):n==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(e),this):this.setAttribute(n,e)};qe.prototype.addDrawCall=function(n,e,t){t!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(n,e)};qe.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()};qe.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")};qe.prototype.removeAttribute=function(n){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(n)};
3084qe.prototype.applyMatrix=function(n){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(n)};Object.defineProperties(qe.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}});Vi.prototype.setDynamic=function(n){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(n===!0?Ia:co),this};Vi.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")};ll.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")};ll.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")};ll.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")};To.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")};Object.defineProperties(Lt.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")}
3084,set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new pe}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(n){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===np}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(n){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=n}}});Object.defineProperties(Ut.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(n){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=n}}});ot.prototype.clearTarget=function(n,e,t,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(n),this.clear(e,t,i)};ot.prototype.animate=function(n){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(n)};ot.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()};ot.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()};ot.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision};ot.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()};ot.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")};ot.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")};ot.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")};ot.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")};ot.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")};ot.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")};ot.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures};ot.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")};ot.prototype.enableScissorTest=function(n){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(n)};ot.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")};ot.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")};ot.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")};ot.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")};ot.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling(
3084) has been removed.")};ot.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")};ot.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")};ot.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")};ot.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")};ot.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()};Object.defineProperties(ot.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(n){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=n}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(n){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=n}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(n){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=n===!0?Cn:an}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}});Object.defineProperties(Bp.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});Object.defineProperties(on.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(n){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=n}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(n){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=n}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(n){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=n}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(n){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=n}
3084},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(n){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=n}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(n){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=n}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(n){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=n}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(n){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=n}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(n){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=n}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(n){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=n}}});xM.prototype.load=function(n){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const e=this;return new pM().load(n,function(i){e.setBuffer(i)}),this};rh.prototype.updateCubeMap=function(n,e){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update(
3084)."),this.update(n,e)};rh.prototype.clear=function(n,e,t,i){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(n,e,t,i)};vr.crossOrigin=void 0;vr.loadTexture=function(n,e,t,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const s=new hl;s.setCrossOrigin(this.crossOrigin);const r=s.load(n,t,void 0,i);return e&&(r.mapping=e),r};vr.loadTextureCube=function(n,e,t,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const s=new Q1;s.setCrossOrigin(this.crossOrigin);const r=s.load(n,t,void 0,i);return e&&(r.mapping=e),r};vr.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};vr.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ep}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ep);const am=/Android|iPhone|iPad|iPod|Mobile/i.test(navigator.userAgent)||/[?&]mobile=1/.test(location.search),Gt=new ot({antialias:!0,preserveDrawingBuffer:!0,powerPreference:"high-performance"});Gt.setSize(innerWidth,innerHeight);Gt.setPixelRatio(Math.min(devicePixelRatio,am?1.4:2));Gt.shadowMap.enabled=!0;Gt.shadowMap.type=am?Zc:tp;Gt.outputEncoding=Cn;Gt.toneMapping=Kc;Gt.toneMappingExposure=.84;Gt.domElement.className="game";document.body.appendChild(Gt.domElement);const lm=(()=>{const n=new Uint8Array([95,150,205,240]),e=new oh(n,4,1,ap);return e.minFilter=vt,e.magFilter=vt,e.needsUpdate=!0,e})(),bt=new Ot(48,innerWidth/innerHeight,.1,400);addEventListener("resize",()=>{bt.aspect=innerWidth/innerHeight,bt.updateProjectionMatrix(),Gt.setSize(innerWidth,innerHeight)});function cm(){return new X(new At(220,16,12),new Ut({side:Pt,depthWrite:!1,uniforms:{top:{value:new pe(4169704)},mid:{value:new pe(12773367)},bot:{value:new pe(15661567)}},vertexShader:"varying vec3 vP; void main(){ vP=position; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0); }",fragmentShader:`varying vec3 vP; uniform vec3 top; uniform vec3 mid; uniform vec3 bot;
3085      void main(){ float h = normalize(vP).y;
3086        vec3 c = h>0.0 ? mix(mid, top, pow(h,0.55)) : mix(mid, bot, pow(-h,0.7));
3087        gl_FragColor = vec4(c,1.0); }`}))}function OM(){const n=new To;n.add(cm());const e=new X(new Qt(60,40),new _e({color:16774880}));e.position.set(40,55,25),e.lookAt(0,0,0),n.add(e);const t=new X(new Qt(50,30),new _e({color:11066608}));t.position.set(-45,30,-30),t.lookAt(0,0,0),n.add(t);const i=new kM(Gt),s=i.fromScene(n,.05).texture;return i.dispose(),s}const HM=OM();var ka={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
3088
3089		varying vec2 vUv;
3090
3091		void main() {
3092
3093			vUv = uv;
3094			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3095
3096		}`,fragmentShader:`
3097
3098		uniform float opacity;
3099
3100		uniform sampler2D tDiffuse;
3101
3102		varying vec2 vUv;
3103
3104		void main() {
3105
3106			vec4 texel = texture2D( tDiffuse, vUv );
3107			gl_FragColor = opacity * texel;
3108
3109		}`};class Tr{constructor(){this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}const UM=new Sr(-1,1,1,-1,0,1),Rh=new qe;Rh.setAttribute("position",new Ne([-1,3,0,-1,-1,0,3,-1,0],3));Rh.setAttribute("uv",new Ne([0,2,0,0,2,0],2));class Ph{constructor(e){this._mesh=new X(Rh,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,UM)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class Na extends Tr{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof Ut?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=ss.clone(e.uniforms),this.material=new Ut({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new Ph(this.material)}render(e,t,i){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=i.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}}class Pd extends Tr{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,i){const s=e.getContext(),r=e.state;r.buffers.color.setMask(!1),r.buffers.depth.setMask(!1),r.buffers.color.setLocked(!0),r.buffers.depth.setLocked(!0);let o,a;this.inverse?(o=0,a=1):(o=1,a=0),r.buffers.stencil.setTest(!0),r.buffers.stencil.setOp(s.REPLACE,s.REPLACE,s.REPLACE),r.buffers.stencil.setFunc(s.ALWAYS,o,4294967295),r.buffers.stencil.setClear(a),r.buffers.stencil.setLocked(!0),e.setRenderTarget(i),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),r.buffers.color.setLocked(!1),r.buffers.depth.setLocked(!1),r.buffers.stencil.setLocked(!1),r.buffers.stencil.setFunc(s.EQUAL,1,4294967295),r.buffers.stencil.setOp(s.KEEP,s.KEEP,s.KEEP),r.buffers.stencil.setLocked(!0)}}class GM extends Tr{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class WM{constructor(e,t){if(this.renderer=e,t===void 0){const i={minFilter:St,magFilter:St,format:Jt},s=e.getSize(new $);this._pixelRatio=e.getPixelRatio(),this._width=s.width,this._height=s.height,t=new on(this._width*this._pixelRatio,this._height*this._pixelRatio,i),t.texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],ka===void 0&&console.error("THREE.EffectComposer relies on CopyShader"),Na===void 0&&console.error("THREE.EffectComposer relies on ShaderPass"),this.copyPass=new Na(ka),this.clock=new nm}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t<this.passes.length;t++)if(this.passes[t].enabled)return!1;return!0}render(e){e===void 0&&(e=this.clock.getDelta());const t=this.renderer.getRenderTarget();let i=!1;for(let s=0,r=this.passes.length;s<r;s++){const o=this.passes[s];if(o.enabled!==!1){if(o.renderToScreen=this.renderToScreen&&this.isLastEnabledPass(s),o.render(this.renderer,this.writeBuffer,this.readBuffer,e,i),o.needsSwap){if(i){const a=this.renderer.getContext(),c=this.renderer.state.buffers.stencil;c.setFunc(a.NOTEQUAL,1,4294967295),this.copyPass.render(this.renderer,this.writeBuffer,this.readBuffer,e),c.setFunc(a.EQUAL,1,4294967295)}this.swapBuffers()}Pd!==void 0&&(o instanceof Pd?i=!0:o instanceof GM&&(i=!1))}}this.renderer.setRenderTarget(t)}reset(e){if(e===void 0){const t=this.renderer.getSize(new $);this._pixelRatio=this.renderer.getPixelRatio(),this._width=t.width,this._height=t.height,e=this.renderTarget1.clone(),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}this.renderTarget1.dispose(),this.renderTarget2.dispose(),this.renderTarget1=e,this.renderTarget2=e.clone(),this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2}setSize(e,t){this._width=e,this._height=t;const i=this._width*this._pixelRatio,s=this._height*this._pixelRatio;this.renderTarget1.setSize(i,s),this.renderTarget2.setSize(i,s);for(let r=0;r<this.passes.length;r++)this.passes[r].setSize(i,s)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}}new Sr(-1,1,1,-1,0,1);const hm=new qe;hm.setAttribute("position",new Ne([-1,3,0,-1,-1,0,3,-1,0],3));hm.setAttribute("uv",new Ne([0,2,0,0,2,0],2));class VM extends Tr{constructor(e,t,i,s,r){super(),this.scene=e,this.camera=t,this.overrideMaterial=i,this.clearColor=s,this.clearAlpha=r!==void 0?r:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new pe}render(e,t,i){const s=e.autoClear;e.autoClear=!1;let r,o;this.overrideMaterial!==void 0&&(o=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),r=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:i),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,r),this.overrideMaterial!==void 0&&(this.scene.overrideMaterial=o),e.autoClear=s}}const Id={uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new pe(0)},defaultOpacity:{value:0}},vertexShader:`
3110
3111		varying vec2 vUv;
3112
3113		void main() {
3114
3115			vUv = uv;
3116
3117			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3118
3119		}`,fragmentShader:`
3120
3121		uniform sampler2D tDiffuse;
3122		uniform vec3 defaultColor;
3123		uniform float defaultOpacity;
3124		uniform float luminosityThreshold;
3125		uniform float smoothWidth;
3126
3127		varying vec2 vUv;
3128
3129		void main() {
3130
3131			vec4 texel = texture2D( tDiffuse, vUv );
3132
3133			vec3 luma = vec3( 0.299, 0.587, 0.114 );
3134
3135			float v = dot( texel.xyz, luma );
3136
3137			vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );
3138
3139			float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );
3140
3141			gl_FragColor = mix( outputColor, texel, alpha );
3142
3143		}`};class dr extends Tr{constructor(e,t,i,s){super(),this.strength=t!==void 0?t:1,this.radius=i,this.threshold=s,this.resolution=e!==void 0?new $(e.x,e.y):new $(256,256),this.clearColor=new pe(0,0,0);const r={minFilter:St,magFilter:St,format:Jt};this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let o=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);this.renderTargetBright=new on(o,a,r),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let d=0;d<this.nMips;d++){const f=new on(o,a,r);f.texture.name="UnrealBloomPass.h"+d,f.texture.generateMipmaps=!1,this.renderTargetsHorizontal.push(f);const p=new on(o,a,r);p.texture.name="UnrealBloomPass.v"+d,p.texture.generateMipmaps=!1,this.renderTargetsVertical.push(p),o=Math.round(o/2),a=Math.round(a/2)}Id===void 0&&console.error("THREE.UnrealBloomPass relies on LuminosityHighPassSha
3143der");const c=Id;this.highPassUniforms=ss.clone(c.uniforms),this.highPassUniforms.luminosityThreshold.value=s,this.highPassUniforms.smoothWidth.value=.01,this.materialHighPassFilter=new Ut({uniforms:this.highPassUniforms,vertexShader:c.vertexShader,fragmentShader:c.fragmentShader,defines:{}}),this.separableBlurMaterials=[];const l=[3,5,7,9,11];o=Math.round(this.resolution.x/2),a=Math.round(this.resolution.y/2);for(let d=0;d<this.nMips;d++)this.separableBlurMaterials.push(this.getSeperableBlurMaterial(l[d])),this.separableBlurMaterials[d].uniforms.texSize.value=new $(o,a),o=Math.round(o/2),a=Math.round(a/2);this.compositeMaterial=this.getCompositeMaterial(this.nMips),this.compositeMaterial.uniforms.blurTexture1.value=this.renderTargetsVertical[0].texture,this.compositeMaterial.uniforms.blurTexture2.value=this.renderTargetsVertical[1].texture,this.compositeMaterial.uniforms.blurTexture3.value=this.renderTargetsVertical[2].texture,this.compositeMaterial.uniforms.blurTexture4.value=this.renderTargetsVertical[3].texture,this.compositeMaterial.uniforms.blurTexture5.value=this.renderTargetsVertical[4].texture,this.compositeMaterial.uniforms.bloomStrength.value=t,this.compositeMaterial.uniforms.bloomRadius.value=.1,this.compositeMaterial.needsUpdate=!0;const u=[1,.8,.6,.4,.2];this.compositeMaterial.uniforms.bloomFactors.value=u,this.bloomTintColors=[new S(1,1,1),new S(1,1,1),new S(1,1,1),new S(1,1,1),new S(1,1,1)],this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,ka===void 0&&console.error("THREE.UnrealBloomPass relies on CopyShader");const h=ka;this.copyUniforms=ss.clone(h.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new Ut({uniforms:this.copyUniforms,vertexShader:h.vertexShader,fragmentShader:h.fragmentShader,blending:_c,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new pe,this.oldClearAlpha=1,this.basic=new _e,this.fsQuad=new Ph(null)}dispose(){for(let e=0;e<this.renderTargetsHorizontal.length;e++)this.renderTargetsHorizontal[e].dispose();for(let e=0;e<this.renderTargetsVertical.length;e++)this.renderTargetsVertical[e].dispose();this.renderTargetBright.dispose()}setSize(e,t){let i=Math.round(e/2),s=Math.round(t/2);this.renderTargetBright.setSize(i,s);for(let r=0;r<this.nMips;r++)this.renderTargetsHorizontal[r].setSize(i,s),this.renderTargetsVertical[r].setSize(i,s),this.separableBlurMaterials[r].uniforms.texSize.value=new $(i,s),i=Math.round(i/2),s=Math.round(s/2)}render(e,t,i,s,r){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const o=e.autoClear;e.autoClear=!1,e.setClearColor(this.clearColor,0),r&&e.state.buffers.stencil.setTest(!1),this.renderToScreen&&(this.fsQuad.material=this.basic,this.basic.map=i.texture,e.setRenderTarget(null),e.clear(),this.fsQuad.render(e)),this.highPassUniforms.tDiffuse.value=i.texture,this.highPassUniforms.luminosityThreshold.value=this.threshold,this.fsQuad.material=this.materialHighPassFilter,e.setRenderTarget(this.renderTargetBright),e.clear(),this.fsQuad.render(e);let a=this.renderTargetBright;for(let c=0;c<this.nMips;c++)this.fsQuad.material=this.separableBlurMaterials[c],this.separableBlurMaterials[c].uniforms.colorTexture.value=a.texture,this.separableBlurMaterials[c].uniforms.direction.value=dr.BlurDirectionX,e.setRenderTarget(this.renderTargetsHorizontal[c]),e.clear(),this.fsQuad.render(e),this.separableBlurMaterials[c].uniforms.colorTexture.value=this.renderTargetsHorizontal[c].texture,this.separableBlurMaterials[c].uniforms.direction.value=dr.BlurDirectionY,e.setRenderTarget(this.renderTargetsVertical[c]),e.clear(),this.fsQuad.render(e),a=this.renderTargetsVertical[c];this.fsQuad.material=this.compositeMaterial,this.compositeMaterial.uniforms.bloomStrength.value=this.strength,this.compositeMaterial.uniforms.bloomRadius.value=this.radius,this.compositeMaterial.uniforms.bloomTintColors.value=this.bloomTintColors,e.setRenderTarget(this.renderTargetsHorizontal[0]),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetsHorizontal[0].texture,r&&e.state.buffers.stencil.setTest(!0),this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(i),this.fsQuad.render(e)),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=o}getSeperableBlurMaterial(e){return new Ut({defines:{KERNEL_RADIUS:e,SIGMA:e},uniforms:{colorTexture:{value:null},texSize:{value:new $(.5,.5)},direction:{value:new $(.5,.5)}},vertexShader:`varying vec2 vUv;
3144				void main() {
3145					vUv = uv;
3146					gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3147				}`,fragmentShader:`#include <common>
3148				varying vec2 vUv;
3149				uniform sampler2D colorTexture;
3150				uniform vec2 texSize;
3151				uniform vec2 direction;
3152
3153				float gaussianPdf(in float x, in float sigma) {
3154					return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;
3155				}
3156				void main() {
3157					vec2 invSize = 1.0 / texSize;
3158					float fSigma = float(SIGMA);
3159					float weightSum = gaussianPdf(0.0, fSigma);
3160					vec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum;
3161					for( int i = 1; i < KERNEL_RADIUS; i ++ ) {
3162						float x = float(i);
3163						float w = gaussianPdf(x, fSigma);
3164						vec2 uvOffset = direction * invSize * x;
3165						vec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb;
3166						vec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb;
3167						diffuseSum += (sample1 + sample2) * w;
3168						weightSum += 2.0 * w;
3169					}
3170					gl_FragColor = vec4(diffuseSum/weightSum, 1.0);
3171				}`})}getCompositeMaterial(e){return new Ut({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},dirtTexture:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`varying vec2 vUv;
3172				void main() {
3173					vUv = uv;
3174					gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3175				}`,fragmentShader:`varying vec2 vUv;
3176				uniform sampler2D blurTexture1;
3177				uniform sampler2D blurTexture2;
3178				uniform sampler2D blurTexture3;
3179				uniform sampler2D blurTexture4;
3180				uniform sampler2D blurTexture5;
3181				uniform sampler2D dirtTexture;
3182				uniform float bloomStrength;
3183				uniform float bloomRadius;
3184				uniform float bloomFactors[NUM_MIPS];
3185				uniform vec3 bloomTintColors[NUM_MIPS];
3186
3187				float lerpBloomFactor(const in float factor) {
3188					float mirrorFactor = 1.2 - factor;
3189					return mix(factor, mirrorFactor, bloomRadius);
3190				}
3191
3192				void main() {
3193					gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +
3194						lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +
3195						lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +
3196						lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +
3197						lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0
3197) * texture2D(blurTexture5, vUv) );
3198				}`})}}dr.BlurDirectionX=new $(1,0);dr.BlurDirectionY=new $(0,1);const Gr={defines:{SMAA_THRESHOLD:"0.1"},uniforms:{tDiffuse:{value:null},resolution:{value:new $(1/1024,1/512)}},vertexShader:`
3199
3200		uniform vec2 resolution;
3201
3202		varying vec2 vUv;
3203		varying vec4 vOffset[ 3 ];
3204
3205		void SMAAEdgeDetectionVS( vec2 texcoord ) {
3206			vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0,  1.0 ); // WebGL port note: Changed sign in W component
3207			vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4(  1.0, 0.0, 0.0, -1.0 ); // WebGL port note: Changed sign in W component
3208			vOffset[ 2 ] = texcoord.xyxy + resolution.xyxy * vec4( -2.0, 0.0, 0.0,  2.0 ); // WebGL port note: Changed sign in W component
3209		}
3210
3211		void main() {
3212
3213			vUv = uv;
3214
3215			SMAAEdgeDetectionVS( vUv );
3216
3217			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3218
3219		}`,fragmentShader:`
3220
3221		uniform sampler2D tDiffuse;
3222
3223		varying vec2 vUv;
3224		varying vec4 vOffset[ 3 ];
3225
3226		vec4 SMAAColorEdgeDetectionPS( vec2 texcoord, vec4 offset[3], sampler2D colorTex ) {
3227			vec2 threshold = vec2( SMAA_THRESHOLD, SMAA_THRESHOLD );
3228
3229			// Calculate color deltas:
3230			vec4 delta;
3231			vec3 C = texture2D( colorTex, texcoord ).rgb;
3232
3233			vec3 Cleft = texture2D( colorTex, offset[0].xy ).rgb;
3234			vec3 t = abs( C - Cleft );
3235			delta.x = max( max( t.r, t.g ), t.b );
3236
3237			vec3 Ctop = texture2D( colorTex, offset[0].zw ).rgb;
3238			t = abs( C - Ctop );
3239			delta.y = max( max( t.r, t.g ), t.b );
3240
3241			// We do the usual threshold:
3242			vec2 edges = step( threshold, delta.xy );
3243
3244			// Then discard if there is no edge:
3245			if ( dot( edges, vec2( 1.0, 1.0 ) ) == 0.0 )
3246				discard;
3247
3248			// Calculate right and bottom deltas:
3249			vec3 Cright = texture2D( colorTex, offset[1].xy ).rgb;
3250			t = abs( C - Cright );
3251			delta.z = max( max( t.r, t.g ), t.b );
3252
3253			vec3 Cbottom  = texture2D( colorTex, offset[1].zw ).rgb;
3254			t = abs( C - Cbottom );
3255			delta.w = max( max( t.r, t.g ), t.b );
3256
3257			// Calculate the maximum delta in the direct neighborhood:
3258			float maxDelta = max( max( max( delta.x, delta.y ), delta.z ), delta.w );
3259
3260			// Calculate left-left and top-top deltas:
3261			vec3 Cleftleft  = texture2D( colorTex, offset[2].xy ).rgb;
3262			t = abs( C - Cleftleft );
3263			delta.z = max( max( t.r, t.g ), t.b );
3264
3265			vec3 Ctoptop = texture2D( colorTex, offset[2].zw ).rgb;
3266			t = abs( C - Ctoptop );
3267			delta.w = max( max( t.r, t.g ), t.b );
3268
3269			// Calculate the final maximum delta:
3270			maxDelta = max( max( maxDelta, delta.z ), delta.w );
3271
3272			// Local contrast adaptation in action:
3273			edges.xy *= step( 0.5 * maxDelta, delta.xy );
3274
3275			return vec4( edges, 0.0, 0.0 );
3276		}
3277
3278		void main() {
3279
3280			gl_FragColor = SMAAColorEdgeDetectionPS( vUv, vOffset, tDiffuse );
3281
3282		}`},fa={defines:{SMAA_MAX_SEARCH_STEPS:"8",SMAA_AREATEX_MAX_DISTANCE:"16",SMAA_AREATEX_PIXEL_SIZE:"( 1.0 / vec2( 160.0, 560.0 ) )",SMAA_AREATEX_SUBTEX_SIZE:"( 1.0 / 7.0 )"},uniforms:{tDiffuse:{value:null},tArea:{value:null},tSearch:{value:null},resolution:{value:new $(1/1024,1/512)}},vertexShader:`
3283
3284		uniform vec2 resolution;
3285
3286		varying vec2 vUv;
3287		varying vec4 vOffset[ 3 ];
3288		varying vec2 vPixcoord;
3289
3290		void SMAABlendingWeightCalculationVS( vec2 texcoord ) {
3291			vPixcoord = texcoord / resolution;
3292
3293			// We will use these offsets for the searches later on (see @PSEUDO_GATHER4):
3294			vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.25, 0.125, 1.25, 0.125 ); // WebGL port note: Changed sign in Y and W components
3295			vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( -0.125, 0.25, -0.125, -1.25 ); // WebGL port note: Changed sign in Y and W components
3296
3297			// And these for the searches, they indicate the ends of the loops:
3298			vOffset[ 2 ] = vec4( vOffset[ 0 ].xz, vOffset[ 1 ].yw ) + vec4( -2.0, 2.0, -2.0, 2.0 ) * resolution.xxyy * float( SMAA_MAX_SEARCH_STEPS );
3299
3300		}
3301
3302		void main() {
3303
3304			vUv = uv;
3305
3306			SMAABlendingWeightCalculationVS( vUv );
3307
3308			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3309
3310		}`,fragmentShader:`
3311
3312		#define SMAASampleLevelZeroOffset( tex, coord, offset ) texture2D( tex, coord + float( offset ) * resolution, 0.0 )
3313
3314		uniform sampler2D tDiffuse;
3315		uniform sampler2D tArea;
3316		uniform sampler2D tSearch;
3317		uniform vec2 resolution;
3318
3319		varying vec2 vUv;
3320		varying vec4 vOffset[3];
3321		varying vec2 vPixcoord;
3322
3323		#if __VERSION__ == 100
3324		vec2 round( vec2 x ) {
3325			return sign( x ) * floor( abs( x ) + 0.5 );
3326		}
3327		#endif
3328
3329		float SMAASearchLength( sampler2D searchTex, vec2 e, float bias, float scale ) {
3330			// Not required if searchTex accesses are set to point:
3331			// float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0);
3332			// e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE +
3333			//     e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE;
3334			e.r = bias + e.r * scale;
3335			return 255.0 * texture2D( searchTex, e, 0.0 ).r;
3336		}
3337
3338		float SMAASearchXLeft( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {
3339			/**
3340				* @PSEUDO_GATHER4
3341				* This texcoord has been offset by (-0.25, -0.125) in the vertex shader to
3342				* sample between edge, thus fetching four edges in a row.
3343				* Sampling with different offsets in each direction allows to disambiguate
3344				* which edges are active from the four fetched ones.
3345				*/
3346			vec2 e = vec2( 0.0, 1.0 );
3347
3348			for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) { // WebGL port note: Changed while to for
3349				e = texture2D( edgesTex, texcoord, 0.0 ).rg;
3350				texcoord -= vec2( 2.0, 0.0 ) * resolution;
3351				if ( ! ( texcoord.x > end && e.g > 0.8281 && e.r == 0.0 ) ) break;
3352			}
3353
3354			// We correct the previous (-0.25, -0.125) offset we applied:
3355			texcoord.x += 0.25 * resolution.x;
3356
3357			// The searches are bias by 1, so adjust the coords accordingly:
3358			texcoord.x += resolution.x;
3359
3360			// Disambiguate the length added by the last step:
3361			texcoord.x += 2.0 * resolution.x; // Undo last step
3362			texcoord.x -= resolution.x * SMAASearchLength(searchTex, e, 0.0, 0.5);
3363
3364			return texcoord.x;
3365		}
3366
3367		float SMAASearchXRight( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {
3368			vec2 e = vec2( 0.0, 1.0 );
3369
3370			for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) { // WebGL port note: Changed while to for
3371				e = texture2D( edgesTex, texcoord, 0.0 ).rg;
3372				texcoord += vec2( 2.0, 0.0 ) * resolution;
3373				if ( ! ( texcoord.x < end && e.g > 0.8281 && e.r == 0.0 ) ) break;
3374			}
3375
3376			texcoord.x -= 0.25 * resolution.x;
3377			texcoord.x -= resolution.x;
3378			texcoord.x -= 2.0 * resolution.x;
3379			texcoord.x += resolution.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );
3380
3381			return texcoord.x;
3382		}
3383
3384		float SMAASearchYUp( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {
3385			vec2 e = vec2( 1.0, 0.0 );
3386
3387			for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) { // WebGL port note: Changed while to for
3388				e = texture2D( edgesTex, texcoord, 0.0 ).rg;
3389				texcoord += vec2( 0.0, 2.0 ) * resolution; // WebGL port note: Changed sign
3390				if ( ! ( texcoord.y > end && e.r > 0.8281 && e.g == 0.0 ) ) break;
3391			}
3392
3393			texcoord.y -= 0.25 * resolution.y; // WebGL port note: Changed sign
3394			texcoord.y -= resolution.y; // WebGL port note: Changed sign
3395			texcoord.y -= 2.0 * resolution.y; // WebGL port note: Changed sign
3396			texcoord.y += resolution.y * SMAASearchLength( searchTex, e.gr, 0.0, 0.5 ); // WebGL port note: Changed sign
3397
3398			return texcoord.y;
3399		}
3400
3401		float SMAASearchYDown( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {
3402			vec2 e = vec2( 1.0, 0.0 );
3403
3404			for ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) { // WebGL port note: Changed while to for
3405				e = texture2D( edgesTex, texcoord, 0.0 ).rg;
3406				texcoord -= vec2( 0.0, 2.0 ) * resolution; // WebGL port note: Changed sign
3407				if ( ! ( texcoord.y < end && e.r > 0.8281 && e.g == 0.0 ) ) break;
3408			}
3409
3410			texcoord.y += 0.25 * resolution.y; // WebGL port note: Changed sign
3411			texcoord.y += resolution.y; // WebGL port note: Changed sign
3412			texcoord.y += 2.0 * resolution.y; // WebGL port note: Changed sign
3413			texcoord.y -= resolution.y * SMAASearchLength( searchTex, e.gr, 0.5, 0.5 ); // WebGL port note: Changed sign
3414
3415			return texcoord.y;
3416		}
3417
3418		vec2 SMAAArea( sampler2D areaTex, vec2 dist, float e1, float e2, float offset ) {
3419			// Rounding prevents precision errors of bilinear filtering:
3420			vec2 texcoord = float( SMAA_AREATEX_MAX_DISTANCE ) * round( 4.0 * vec2( e
34201, e2 ) ) + dist;
3421
3422			// We do a scale and bias for mapping to texel space:
3423			texcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + ( 0.5 * SMAA_AREATEX_PIXEL_SIZE );
3424
3425			// Move to proper place, according to the subpixel offset:
3426			texcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;
3427
3428			return texture2D( areaTex, texcoord, 0.0 ).rg;
3429		}
3430
3431		vec4 SMAABlendingWeightCalculationPS( vec2 texcoord, vec2 pixcoord, vec4 offset[ 3 ], sampler2D edgesTex, sampler2D areaTex, sampler2D searchTex, ivec4 subsampleIndices ) {
3432			vec4 weights = vec4( 0.0, 0.0, 0.0, 0.0 );
3433
3434			vec2 e = texture2D( edgesTex, texcoord ).rg;
3435
3436			if ( e.g > 0.0 ) { // Edge at north
3437				vec2 d;
3438
3439				// Find the distance to the left:
3440				vec2 coords;
3441				coords.x = SMAASearchXLeft( edgesTex, searchTex, offset[ 0 ].xy, offset[ 2 ].x );
3442				coords.y = offset[ 1 ].y; // offset[1].y = texcoord.y - 0.25 * resolution.y (@CROSSING_OFFSET)
3443				d.x = coords.x;
3444
3445				// Now fetch the left crossing edges, two at a time using bilinear
3446				// filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to
3447				// discern what value each edge has:
3448				float e1 = texture2D( edgesTex, coords, 0.0 ).r;
3449
3450				// Find the distance to the right:
3451				coords.x = SMAASearchXRight( edgesTex, searchTex, offset[ 0 ].zw, offset[ 2 ].y );
3452				d.y = coords.x;
3453
3454				// We want the distances to be in pixel units (doing this here allow to
3455				// better interleave arithmetic and memory accesses):
3456				d = d / resolution.x - pixcoord.x;
3457
3458				// SMAAArea below needs a sqrt, as the areas texture is compressed
3459				// quadratically:
3460				vec2 sqrt_d = sqrt( abs( d ) );
3461
3462				// Fetch the right crossing edges:
3463				coords.y -= 1.0 * resolution.y; // WebGL port note: Added
3464				float e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 1, 0 ) ).r;
3465
3466				// Ok, we know how this pattern looks like, now it is time for getting
3467				// the actual area:
3468				weights.rg = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.y ) );
3469			}
3470
3471			if ( e.r > 0.0 ) { // Edge at west
3472				vec2 d;
3473
3474				// Find the distance to the top:
3475				vec2 coords;
3476
3477				coords.y = SMAASearchYUp( edgesTex, searchTex, offset[ 1 ].xy, offset[ 2 ].z );
3478				coords.x = offset[ 0 ].x; // offset[1].x = texcoord.x - 0.25 * resolution.x;
3479				d.x = coords.y;
3480
3481				// Fetch the top crossing edges:
3482				float e1 = texture2D( edgesTex, coords, 0.0 ).g;
3483
3484				// Find the distance to the bottom:
3485				coords.y = SMAASearchYDown( edgesTex, searchTex, offset[ 1 ].zw, offset[ 2 ].w );
3486				d.y = coords.y;
3487
3488				// We want the distances to be in pixel units:
3489				d = d / resolution.y - pixcoord.y;
3490
3491				// SMAAArea below needs a sqrt, as the areas texture is compressed
3492				// quadratically:
3493				vec2 sqrt_d = sqrt( abs( d ) );
3494
3495				// Fetch the bottom crossing edges:
3496				coords.y -= 1.0 * resolution.y; // WebGL port note: Added
3497				float e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 0, 1 ) ).g;
3498
3499				// Get the area for this direction:
3500				weights.ba = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.x ) );
3501			}
3502
3503			return weights;
3504		}
3505
3506		void main() {
3507
3508			gl_FragColor = SMAABlendingWeightCalculationPS( vUv, vPixcoord, vOffset, tDiffuse, tArea, tSearch, ivec4( 0.0 ) );
3509
3510		}`},cc={uniforms:{tDiffuse:{value:null},tColor:{value:null},resolution:{value:new $(1/1024,1/512)}},vertexShader:`
3511
3512		uniform vec2 resolution;
3513
3514		varying vec2 vUv;
3515		varying vec4 vOffset[ 2 ];
3516
3517		void SMAANeighborhoodBlendingVS( vec2 texcoord ) {
3518			vOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 ); // WebGL port note: Changed sign in W component
3519			vOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 ); // WebGL port note: Changed sign in W component
3520		}
3521
3522		void main() {
3523
3524			vUv = uv;
3525
3526			SMAANeighborhoodBlendingVS( vUv );
3527
3528			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3529
3530		}`,fragmentShader:`
3531
3532		uniform sampler2D tDiffuse;
3533		uniform sampler2D tColor;
3534		uniform vec2 resolution;
3535
3536		varying vec2 vUv;
3537		varying vec4 vOffset[ 2 ];
3538
3539		vec4 SMAANeighborhoodBlendingPS( vec2 texcoord, vec4 offset[ 2 ], sampler2D colorTex, sampler2D blendTex ) {
3540			// Fetch the blending weights for current pixel:
3541			vec4 a;
3542			a.xz = texture2D( blendTex, texcoord ).xz;
3543			a.y = texture2D( blendTex, offset[ 1 ].zw ).g;
3544			a.w = texture2D( blendTex, offset[ 1 ].xy ).a;
3545
3546			// Is there any blending weight with a value greater than 0.0?
3547			if ( dot(a, vec4( 1.0, 1.0, 1.0, 1.0 )) < 1e-5 ) {
3548				return texture2D( colorTex, texcoord, 0.0 );
3549			} else {
3550				// Up to 4 lines can be crossing a pixel (one through each edge). We
3551				// favor blending by choosing the line with the maximum weight for each
3552				// direction:
3553				vec2 offset;
3554				offset.x = a.a > a.b ? a.a : -a.b; // left vs. right
3555				offset.y = a.g > a.r ? -a.g : a.r; // top vs. bottom // WebGL port note: Changed signs
3556
3557				// Then we go in the direction that has the maximum weight:
3558				if ( abs( offset.x ) > abs( offset.y )) { // horizontal vs. vertical
3559					offset.y = 0.0;
3560				} else {
3561					offset.x = 0.0;
3562				}
3563
3564				// Fetch the opposite color and lerp by hand:
3565				vec4 C = texture2D( colorTex, texcoord, 0.0 );
3566				texcoord += sign( offset ) * resolution;
3567				vec4 Cop = texture2D( colorTex, texcoord, 0.0 );
3568				float s = abs( offset.x ) > abs( offset.y ) ? abs( offset.x ) : abs( offset.y );
3569
3570				// WebGL port note: Added gamma correction
3571				C.xyz = pow(C.xyz, vec3(2.2));
3572				Cop.xyz = pow(Cop.xyz, vec3(2.2));
3573				vec4 mixed = mix(C, Cop, s);
3574				mixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));
3575
3576				return mixed;
3577			}
3578		}
3579
3580		void main() {
3581
3582			gl_FragColor = SMAANeighborhoodBlendingPS( vUv, vOffset, tColor, tDiffuse );
3583
3584		}`};class qM extends Tr{constructor(e,t){super(),this.edgesRT=new on(e,t,{depthBuffer:!1,generateMipmaps:!1,minFilter:St,format:Wn}),this.edgesRT.texture.name="SMAAPass.edges",this.weightsRT=new on(e,t,{depthBuffer:!1,generateMipmaps:!1,minFilter:St,format:Jt}),this.weightsRT.texture.name="SMAAPass.weights";const i=this,s=new Image;s.src=this.getAreaTexture(),s.onload=function(){i.areaTexture.needsUpdate=!0},this.areaTexture=new kt,this.areaTexture.name="SMAAPass.area",this.areaTexture.image=s,this.areaTexture.format=Wn,this.areaTexture.minFilter=St,this.areaTexture.generateMipmaps=!1,this.areaTexture.flipY=!1;const r=new Image;r.src=this.getSearchTexture(),r.onload=function(){i.searchTexture.needsUpdate=!0},this.searchTexture=new kt,this.searchTexture.name="SMAAPass.search",this.searchTexture.image=r,this.searchTexture.magFilter=vt,this.searchTexture.minFilter=vt,this.searchTexture.generateMipmaps=!1,this.searchTexture.flipY=!1,Gr===void 0&&console.error("THREE.SMAAPass relies on SMAAShader"),this.uniformsEdges=ss.clone(Gr.uniforms),this.uniformsEdges.resolution.value.set(1/e,1/t),this.materialEdges=new Ut({defines:Object.assign({},Gr.defines),uniforms:this.uniformsEdges,vertexShader:Gr.vertexShader,fragmentShader:Gr.fragmentShader}),this.uniformsWeights=ss.clone(fa.uniforms),this.uniformsWeights.resolution.value.set(1/e,1/t),this.uniformsWeights.tDiffuse.value=this.edgesRT.texture,this.uniformsWeights.tArea.value=this.areaTexture,this.uniformsWeights.tSearch.value=this.searchTexture,this.materialWeights=new Ut({defines:Object.assign({},fa.defines),uniforms:this.uniformsWeights,vertexShader:fa.vertexShader,fragmentShader:fa.fragmentShader}),this.uniformsBlend=ss.clone(cc.uniforms),this.uniformsBlend.resolution.value.set(1/e,1/t),this.uniformsBlend.tDiffuse.value=this.weightsRT.texture,this.materialBlend=new Ut({uniforms:this.uniformsBlend,vertexShader:cc.vertexShader,fragmentShader:cc.fragmentShader}),this.needsSwap=!1,this.fsQuad=new Ph(null)}render(e,t,i){this.uniformsEdges.tDiffuse.value=i.texture,this.fsQuad.material=this.materialEdges,e.setRenderTarget(this.edgesRT),this.clear&&e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.materialWeights,e.setRenderTarget(this.weightsRT),this.clear&&e.clear(),this.fsQuad.render(e),this.uniformsBlend.tColor.value=i.texture,this.fsQuad.material=this.materialBlend,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(),this.fsQuad.render(e))}setSize(e,t){this.edgesRT.setSize(e,t),this.weightsRT.setSize(e,t),this.materialEdges.uniforms.resolution.value.set(1/e,1/t),this.materialWeights.uniforms.resolution.value.set(1/e,1/t),this.materialBlend.uniforms.resolution.value.set(1/e,1/t)}getAreaTexture
vendor: 44,306 bytes, line 3584
3584(){return"data:image/png;base64,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"}
3584getSearchTexture(){return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAAhCAAAAABIXyLAAAAAOElEQVRIx2NgGAWjYBSMglEwEICREYRgFBZBqDCSLA2MGPUIVQETE9iNUAqLR5gIeoQKRgwXjwAAGn4AtaFeYLEAAAAASUVORK5CYII="}}const jM={uniforms:{tDiffuse:{value:null}},vertexShader:`
3585
3586		varying vec2 vUv;
3587
3588		void main() {
3589
3590			vUv = uv;
3591			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3592
3593		}`,fragmentShader:`
3594
3595		uniform sampler2D tDiffuse;
3596
3597		varying vec2 vUv;
3598
3599		void main() {
3600
3601			vec4 tex = texture2D( tDiffuse, vUv );
3602
3603			gl_FragColor = LinearTosRGB( tex ); // optional: LinearToGamma( tex, float( GAMMA_FACTOR ) );
3604
3605		}`};let ni=null,Dc=null,Bd=null;const XM={uniforms:{tDiffuse:{value:null},uSat:{value:1.18},uCon:{value:1.1},uWarm:{value:.02},uVig:{value:.46}},vertexShader:"varying vec2 vUv; void main(){ vUv=uv; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0); }",fragmentShader:`
3606    uniform sampler2D tDiffuse; uniform float uSat; uniform float uCon; uniform float uWarm; uniform float uVig;
3607    varying vec2 vUv;
3608    void main(){
3609      vec4 c = texture2D(tDiffuse, vUv);
3610      float l = dot(c.rgb, vec3(0.299,0.587,0.114));
3611      c.rgb = mix(vec3(l), c.rgb, uSat);              // saturation
3612      c.rgb = (c.rgb - 0.5) * uCon + 0.5;             // contrast
3613      c.rgb += vec3(uWarm, uWarm*0.35, -uWarm*0.6);   // gentle warm tint
3614      float d = length(vUv - 0.5);                     // vignette
3615      c.rgb *= 1.0 - smoothstep(0.55, 1.05, d) * uVig;
3616      gl_FragColor = vec4(clamp(c.rgb, 0.0, 1.0), c.a);
3617    }`};function YM(){ni=new WM(Gt),Dc=new VM(null,bt),ni.addPass(Dc),Bd=new dr(new $(innerWidth,innerHeight),.42,.6,.85),ni.addPass(Bd),ni.addPass(new Na(jM)),ni.addPass(new Na(XM));const n=new qM(innerWidth*Gt.getPixelRatio(),innerHeight*Gt.getPixelRatio());ni.addPass(n),addEventListener("resize",()=>{ni.setSize(innerWidth,innerHeight)})}function um(n){if(!ni)return Gt.render(n,bt);Dc.scene=n,ni.render()}const pt={alon:{arch:"melee",face:"🚀",name:"ALON",role:"Melee Duelist",hp:240,speed:9.4,range:2.8,dmg:22,atkCd:.45,qCd:6,qName:"Hostile Takeover",basicName:"Jab",stats:{dmg:.75,spd:.7,hpS:.85}},remus:{arch:"melee",face:"🐺",name:"REMUS",role:"Melee Skirmisher",hp:255,speed:9,range:3,dmg:24,atkCd:.5,qCd:6,qName:"100% Sell",basicName:"Maul",stats:{dmg:.8,spd:.6,hpS:.9}},troll:{arch:"melee",face:"🧌",name:"TROLL",role:"Melee Tank",hp:285,speed:8,range:3.1,dmg:27,atkCd:.6,qCd:6,qName:"Rage Bait",basicName:"Club Smash",stats:{dmg:.9,spd:.45,hpS:1}},wizard:{arch:"mage",face:"🧙",name:"SMOKING WIZARD",role:"Ranged Mage",hp:185,speed:7.8,range:11.5,dmg:21,atkCd:.6,qCd:7,qName:"Smoke Bomb",basicName:"Smoke Puff",stats:{dmg:.9,spd:.4,hpS:.5}},spligga:{arch:"mage",face:"🍃",name:"SPLIGGA",role:"Ranged Mage",hp:175,speed:8.2,range:10.8,dmg:17,atkCd:.5,qCd:7,qName:"Rugged",basicName:"Purp Dart",stats:{dmg:.85,spd:.5,hpS:.55},hover:!0},degen:{arch:"mage",face:"🥷",name:"TOSHI",role:"Ranged Assassin",hp:180,speed:8,range:11.5,dmg:21,atkCd:.65,qCd:7,qName:"All In",basicName:"Shuriken",stats:{dmg:.95,spd:.6,hpS:.45},eCd:6,eName:"Shadowstep"},chillhouse:{arch:"ranged",face:"🧊",name:"CHILLHOUSE",role:"Ranged Marksman",hp:170,speed:9.6,range:8.8,dmg:13,atkCd:.32,qCd:5,qName:"Cold Snap",basicName:"Ice Cube",stats:{dmg:.62,spd:.9,hpS:.5}},chudhouse:{arch:"ranged",face:"🏚️",name:"CHUDHOUSE",role:"Ranged Marksman",hp:170,speed:9.2,range:8.6,dmg:12,atkCd:.34,qCd:6,qName:"Brick Rain",basicName:"Brick Toss",stats:{dmg:.6,spd:.85,hpS:.5},eCd:10,eName:"Eviction Slam"},chud:{arch:"ranged",face:"🧽",name:"CHUDBOB",role:"Ranged Assassin",hp:172,speed:10.2,range:9,dmg:10,atkCd:.3,qCd:5,qName:"Seethe Dash",basicName:"Cope Shot",stats:{dmg:.5,spd:1,hpS:.4}},jester:{arch:"ranged",face:"🤡",name:"JESTER",role:"Ranged Trickster",hp:172,speed:9.3,range:9,dmg:12,atkCd:.34,qCd:6,qName:"House of Cards",basicName:"Card Toss",stats:{dmg:.62,spd:.85,hpS:.5}},taxes:{arch:"ranged",face:"💸",name:"TAXES",role:"Ranged Marksman",hp:175,speed:9,range:8.8,dmg:11,atkCd:.34,qCd:7,qName:"Write-Off",basicName:"Dollar Toss",stats:{dmg:.6,spd:.8,hpS:.5}}
3617,pocket:{arch:"mage",face:"😼",name:"POCKET HITLERS",role:"Ranged Mage",hp:185,speed:8,range:11.5,dmg:20,atkCd:.55,qCd:8,qName:"Final Flash",basicName:"Ki Blast",stats:{dmg:1,spd:.5,hpS:.5}},hash:{arch:"melee",face:"💀",name:"HASH",role:"Melee Assassin",hp:230,speed:9.6,range:2.9,dmg:24,atkCd:.45,qCd:6,qName:"Soul Reap",basicName:"Slash",stats:{dmg:.8,spd:.75,hpS:.7}},turtle:{arch:"melee",face:"🐢",name:"MISTER TURTLE",role:"Melee Tank",hp:290,speed:7.8,range:3,dmg:26,atkCd:.6,qCd:6,qName:"Shellshock",basicName:"Shell Bash",stats:{dmg:.85,spd:.4,hpS:1}},ansem:{arch:"melee",face:"🔑",name:"ANSEM",role:"Keyblade Duelist",hp:255,speed:9.2,range:3.3,dmg:25,atkCd:.52,qCd:6,qName:"Send It",basicName:"Keyblade",stats:{dmg:.85,spd:.65,hpS:.9}},wapital:{arch:"ranged",face:"🍓",name:"WAPITAL",role:"Ranged Marksman",hp:185,speed:8.6,range:8.8,dmg:13,atkCd:.36,qCd:7,qName:"Jam Session",basicName:"Berry Blast",stats:{dmg:.65,spd:.7,hpS:.62}},ozzie:{arch:"ranged",face:"🔨",name:"OZZY",role:"Launchpad Marksman",hp:180,speed:9,range:9,dmg:13,atkCd:.36,qCd:7,qName:"Launch Pad",basicName:"Feather Shot",stats:{dmg:.66,spd:.72,hpS:.55}}},ls={alon:[{name:"Techno King",cost:0,c:{body:2763315,belly:12634328,accent:5895136}},{name:"Mars Mode",cost:100,c:{body:11749930,belly:15780008,accent:16747837}},{name:"Doge Mode",cost:250,c:{body:14262363,belly:16115400,accent:16767053}}],remus:[{name:"Lone Wolf",cost:0,c:{body:6975365,belly:14212330,accent:16735596}},{name:"Night Stalker",cost:100,c:{body:2761558,belly:6971344,accent:12868863}},{name:"Alpha",cost:250,c:{body:15790325,belly:13685992,accent:16767053}}],troll:[{name:"Bridge Troll",cost:0,c:{body:5929546,belly:13162664,accent:9067050}},{name:"Cave Troll",cost:100,c:{body:5595258,belly:11057360,accent:5895136}},{name:"Gilded Troll",cost:250,c:{body:9075258,belly:15259800,accent:16767053}}],wizard:[{name:"OG Smoker",cost:0,c:{body:4864618,belly:12101848,accent:10351198}},{name:"Purple Haze",cost:100,c:{body:6961802,belly:13678824,accent:12868863}},{name:"Zaza Master",cost:250,c:{body:2771514,belly:11065528,accent:16767053}}],spligga:[{name:"Backwoods",cost:0,c:{body:3824186,belly:12114088,accent:10351198}},{name:"Kush Cloud",cost:100,c:{body:4876890,belly:13166800,accent:5895136}},{name:"Purp",cost:250,c:{body:5913194,belly:14205160,accent:12868863}}],degen:[{name:"Paper Hands",cost:0,c:{body:9058874,belly:15253696,accent:16735596}},{name:"Diamond Hands",cost:100,c:{body:3828362,belly:12640496,accent:5895136}},{name:"Casino Royale",cost:250,c:{body:2763315,belly:14277096,accent:16767053}}],chillhouse:[{name:"Ice Cold",cost:0,c:{body:6990040,belly:14217471,accent:5895136}},{name:"Deep Freeze",cost:100,c:{body:3824266,belly:12112104,accent:12868863}},{name:"Heat Wave",cost:250,c:{body:14187082,belly:16308408,accent:16767053}}],chudhouse:[{name:"Fixer Upper",cost:0,c:{body:9071178,belly:14205096,accent:16747837}},{name:"Haunted",cost:100,c:{body:4868698,belly:11579592,accent:12868863}},{name:"McMansion",cost:250,c:{body:15261904,belly:16314592,accent:16767053}},{name:"Chudinhood",cost:0,locked:!0,unlockEvm:25e4,model:"chudhood",portrait:"chudhood",c:{body:3824175,belly:14205096,accent:6983482}}],chud:[{name:"OG Chud",cost:0,c:{body:8030826,belly:13686976,accent:16735596}},{name:"Rage Mode",cost:100,c:{body:9058858,belly:14727336,accent:16735530}},{name:"Ascended",cost:250,c:{body:15788248,belly:16775400,accent:16767053}}],jester:[{name:"OG Jester",cost:0,c:{body:11883310,belly:15260088,accent:6983482}},{name:"Wildcard",cost:100,c:{body:2763315,belly:14277096,accent:16726843}},{name:"Harlequin",cost:250,c:{body:5913194,belly:13154536,accent:5895136}}],taxes:[{name:"Audit",cost:0,c:{body:3835592,belly:12640496,accent:16747184}},{name:"Loophole",cost:100,c:{body:2779722,belly:12116168,accent:16767053}},{name:"Offshore",cost:250,c:{body:2763315,belly:12634328,accent:5895136}}],pocket:[{name:"Super Saiyan",cost:0,c:{body:15790325,belly:13685992,accent:11558143}},{name:"Ultra Instinct",cost:100,c:{body:15788248,belly:16775400,accent:5895136}},{name:"Berserk",cost:250,c:{body:2763315,belly:12634328,accent:16726843}}],hash:[{name:"Reaper",cost:0,c:{body:1973798,belly:3816006,accent:16726843}},{name:"Wraith",cost:100,c:{body:2761558,belly:6971344,accent:12868863}},{name:"Soulless",cost:250,c:{body:1315866,belly:2763315,accent:5895136}}],turtle:[{name:"Mister Turtle",cost:0,c:{body:5934922,belly:14723146,accent:3824170}},{name:"Snapper",cost:100,c:{body:3828314,belly:13162664,accent:5895136}},{name:"Ancient One",cost:250,c:{body:9075258,belly:15259800,accent:16767053}}],ansem:[{name:"Organization",cost:0,c:{body:1447452,belly:2763318,accent:16767053}},{name:"Seeker",cost:100,c:{body:2761558,belly:3813728,accent:12868863}},{name:"Gilded Key",cost:250,c:{body:1052690,belly:2236968,accent:16771488}}],wapital:[{name:"Fresh Pick",cost:0,c:{body:14236234,belly:15771824,accent:5882974}},{name:"Blue Razz",cost:100,c:{body:3828441,belly:11061488,accent:5895136}},{name:"Golden Berry",cost:250,c:{body:14263610,belly:15785128,accent:16767053}}],ozzie:[{name:"PONS Dev",cost:0,c:{body:9429066,belly:3828432,accent:5873704}},{name:"Night Build",cost:100,c:{body:4876842,belly:2767450,accent:10351198}},{name:"Golden Ship",cost:250,c:{body:13625498,belly:15788240,accent:16767053}}]},Pe={hw:70,hd:40},st=[3835647,16726843],fn=31,jt=14,fr=[{x:-37,z:jt,hw:8,hd:1.2},{x:0,z:jt,hw:14,hd:1.2},{x:37,z:jt,hw:8,hd:1.2},{x:-37,z:-jt,hw:8,hd:1.2},{x:0,z:-jt,hw:14,hd:1.2},{x:37,z:-jt,hw:8,hd:1.2},{x:0,z:8,hw:7,hd:1},{x:0,z:-8,hw:7,hd:1}],cs=[{x:-18,z:25,hw:4,hd:2.2},{x:18,z:25,hw:4,hd:2.2},{x:-18,z:-25,hw:4,hd:2.2},{x:18,z:-25,hw:4,hd:2.2},{x:21,z:19,hw:3,hd:2.2},{x:-21,z:19,hw:3,hd:2.2},{x:21,z:-19,hw:3,hd:2.2},{x:-21,z:-19,hw:3,hd:2.2},{x:15,z:0,hw:2.5,hd:2},{x:-15,z:0,hw:2.5,hd:2}],dm=[{x:-26,z:-9,type:"dmg"},{x:26,z:-9,type:"dmg"},{x:-26,z:9,type:"spd"},{x:26,z:9,type:"spd"},{x:0,z:-21,type:"elite"},{x:0,z:21,type:"elite"}],za=[];
3617[[-1,0],[1,1]].forEach(([n,e])=>{["top","bot"].forEach(t=>{const i=t==="top"?-fn:fn;za.push({team:e,lane:t,tier:1,x:n*20,z:i,hp:1600}),za.push({team:e,lane:t,tier:2,x:n*45,z:i,hp:2100})})});const is={dmg:{label:"PUMP",desc:"+30% damage",dur:30,color:12868863},spd:{label:"ZOOM",desc:"+25% speed",dur:30,color:5895136},boss:{label:"DUVE",desc:"+25% team dmg",dur:25,color:16767053}},fm=480,ZM=75,KM=40,ri=Object.keys(pt),JM=[{name:"0xShadow",tier:"Diamond",tierColor:"#8fd8ff",skill:.95},{name:"dumpiter",tier:"Diamond",tierColor:"#8fd8ff",skill:.92},{name:"gigachud",tier:"Diamond",tierColor:"#8fd8ff",skill:.9},{name:"trenchGod",tier:"Platinum",tierColor:"#5ee0c8",skill:.87},{name:"sol_samurai",tier:"Platinum",tierColor:"#5ee0c8",skill:.84},{name:"rugsurvivor",tier:"Platinum",tierColor:"#5ee0c8",skill:.82},{name:"candlewick",tier:"Platinum",tierColor:"#5ee0c8",skill:.79},{name:"pumpqueen",tier:"Gold",tierColor:"#ffcf4d",skill:.74},{name:"gmSer_",tier:"Gold",tierColor:"#ffcf4d",skill:.7},{name:"degenDan",tier:"Gold",tierColor:"#ffcf4d",skill:.66},{name:"bagholder",tier:"Gold",tierColor:"#ffcf4d",skill:.63},{name:"ChudEnjoyer",tier:"Silver",tierColor:"#cfd6e6",skill:.57},{name:"jeetdestroyer",tier:"Silver",tierColor:"#cfd6e6",skill:.54},{name:"apeing_in",tier:"Silver",tierColor:"#cfd6e6",skill:.51},{name:"wenLambo",tier:"Silver",tierColor:"#cfd6e6",skill:.48},{name:"moonboi42",tier:"Silver",tierColor:"#cfd6e6",skill:.45},{name:"ngmi_andy",tier:"Bronze",tierColor:"#d08a4a",skill:.38},{name:"copingCarl",tier:"Bronze",tierColor:"#d08a4a",skill:.35},{name:"paperhandz",tier:"Bronze",tierColor:"#d08a4a",skill:.32},{name:"liquidated",tier:"Bronze",tierColor:"#d08a4a",skill:.29}],xe=(n,e={})=>{const t=new mh({color:n,gradientMap:lm});return e.map&&(t.map=e.map),e.emissive!==void 0&&(t.emissive=new pe(e.emissive),t.emissiveIntensity=e.emissiveIntensity??1),e.transparent&&(t.transparent=!0),e.opacity!==void 0&&(t.transparent=!0,t.opacity=e.opacity),e.side!==void 0&&(t.side=e.side),t};function It(n,e,t,i,s){const r=new X(new wt(n,e,t),xe(i,s));return r.castShadow=!0,r}function En(n,e,t,i=5,s){const r=new X(new Tn(n,e,i),xe(t,s));return r.castShadow=!0,r}
3617function gn(n,e,t=7,i){const s=new X(new At(n,t,6),xe(e,i));return s.castShadow=!0,s}function Lo(n){const e=new Fe,t=[7205470,16738922,12868863],i=new X(new Qt(1.8,.22),new _e({color:920352})),s=new X(new Qt(1.7,.14),new _e({color:t[n]}));return s.position.z=.01,e.add(i),e.add(s),e.userData.fg=s,e}function Bi(n,e){const t=n.userData.fg;t.scale.x=Math.max(e,1e-4),t.position.x=-(1-e)*.85}function QM(){const t=document.createElement("canvas");t.width=2560,t.height=1463;const i=t.getContext("2d"),s=h=>(h+Pe.hw)/(Pe.hw*2)*2560,r=h=>(h+Pe.hd)/(Pe.hd*2)*1463,o=h=>h/(Pe.hw*2)*2560,a=h=>h/(Pe.hd*2)*1463;function c(h,d,f,p,b){i.beginPath(),i.moveTo(h+b,d),i.arcTo(h+f,d,h+f,d+p,b),i.arcTo(h+f,d+p,h,d+p,b),i.arcTo(h,d+p,h,d,b),i.arcTo(h,d,h+f,d,b),i.closePath()}const l=i.createRadialGradient(2560/2,1463/2,140,2560/2,1463/2,2560*.62);l.addColorStop(0,"#5fb854"),l.addColorStop(.55,"#4aa44c"),l.addColorStop(1,"#3e9145"),i.fillStyle=l,i.fillRect(0,0,2560,1463);for(let h=0;h<520;h++)i.fillStyle=Math.random()<.5?"rgba(46,110,52,0.07)":"rgba(190,235,150,0.08)",i.beginPath(),i.arc(Math.random()*2560,Math.random()*1463,18+Math.random()*60,0,7),i.fill();for(let h=0;h<26;h++)i.fillStyle="rgba(255,255,255,0.045)",i.beginPath(),i.ellipse(Math.random()*2560,Math.random()*1463,60+Math.random()*120,30+Math.random()*50,Math.random()*3,0,7),i.fill();i.filter="blur(7px)",i.strokeStyle="rgba(160,135,80,0.22)",i.lineWidth=o(2),i.lineCap="round",[[21,12,18,25],[-21,12,-18,25],[21,-12,18,-25],[-21,-12,-18,-25]].forEach(([h,d,f,p])=>{i.beginPath(),i.moveTo(s(h),r(d)),i.lineTo(s(f),r(p)),i.stroke()}),[[20,0,9,0],[-20,0,-9,0]].forEach(([h,d,f,p])=>{i.beginPath(),i.moveTo(s(h),r(d)),i.lineTo(s(f),r(p)),i.stroke()}),i.filter="none",i.fillStyle="rgba(30,100,46,0.40)",i.fillRect(0,r(-jt),2560,a(jt*2));for(let h=0;h<420;h++)i.fillStyle=Math.random()<.5?"rgba(40,130,60,0.12)":"rgba(20,80,40,0.12)",i.beginPath(),i.arc(Math.random()*2560,r(-jt)+Math.random()*a(jt*2),6+Math.random()*26,0,7),i.fill();for(let h=0;h<300;h++){const d=Math.random()*2560,f=r(-jt)+Math.random()*a(jt*2);i.fillStyle=Math.random()<.6?"rgba(60,150,70,0.35)":"rgba(150,190,90,0.3)",i.save(),i.translate(d,f),i.rotate(Math.random()*3),i.beginPath(),i.ellipse(0,0,3.5,1.8,0,0,7),i.fill(),i.restore()}for(let h=0;h<420;h++){const d=Math.random()*2560,f=Math.random()*1463,p=f/1463*Pe.hd*2-Pe.hd;if(Math.abs(Math.abs(p)-fn)<4.2)continue;const b=Math.random()<.5;i.strokeStyle=b?"rgba(36,96,44,0.4)":"rgba(205,250,160,0.4)",i.lineWidth=1.8;for(let w=0;w<5;w++){const v=-Math.PI/2+(w-2)*.3+Math.random()*.12;i.beginPath(),i.moveTo(d,f),i.lineTo(d+Math.cos(v)*(5+Math.random()*5),f+Math.sin(v)*(6+Math.random()*5)),i.stroke()}}for(let h=0;h<150;h++){const d=Math.random()*2560,f=Math.random()*1463,p=f/1463*Pe.hd*2-Pe.hd;if(Math.abs(Math.abs(p)-fn)<4.2||Math.abs(p)<jt)continue;const b=["255,250,240","255,220,120","255,170,200"][Math.random()*3|0];for(let w=0;w<4;w++){const v=w/4*Math.PI*2;i.fillStyle="rgba("+b+",0.75)",i.beginPath(),i.arc(d+Math.cos(v)*2.6,f+Math.sin(v)*2.6,1.7,0,7),i.fill()}i.fillStyle="rgba(255,200,60,0.9)",i.beginPath(),i.arc(d,f,1.6,0,7),i.fill()}i.fillStyle="rgba(226,219,200,0.92)",i.beginPath(),i.ellipse(s(0),r(0),o(12),a(12),0,0,7),i.fill();for(let h=0;h<40;h++){const d=h/40*Math.PI*2,f=d+.12;i.strokeStyle=h%5===0?"rgba(80,185,178,0.6)":h%2?"rgba(200,192,170,0.9)":"rgba(170,162,140,0.9)",i.lineWidth=o(.8),i.beginPath(),i.ellipse(s(0),r(0),o(11.1),a(11.1),0,d,f),i.stroke()}i.strokeStyle="rgba(160,150,125,0.6)",i.lineWidth=4,i.beginPath(),i.ellipse(s(0),r(0),o(12),a(12),0,0,7),i.stroke(),i.strokeStyle="rgba(120,112,90,0.5)",i.lineWidth=2;for(let h=0;h<8;h++){let d=s(0)+(Math.random()*2-1)*o(8),f=r(0)+(Math.random()*2-1)*a(8);i.beginPath(),i.moveTo(d,f);for(let p=0;p<5;p++)d+=(Math.random()*2-1)*22,f+=(Math.random()*2-1)*22,i.lineTo(d,f);i.stroke()}i.fillStyle="#2e4f54",i.beginPath(),i.ellipse(s(0),r(0),o(7.4),a(7.4),0,0,7),i.fill(),i.strokeStyle="rgba(170,100,235,0.6)",i.lineWidth=5,i.beginPath(),i.ellipse(s(0),r(0),o(6.4),a(6.4),0,0,7),i.stroke(),i.setLineDash([12,16]),i.lineWidth=3,i.strokeStyle="rgba(170,100,235,0.4)",i.beginPath(),i.ellipse(s(0),r(0),o(5.1),a(5.1
3617),0,0,7),i.stroke(),i.setLineDash([]);for(let h=0;h<12;h++){const d=h/12*Math.PI*2;i.fillStyle="rgba(170,100,235,0.55)",i.beginPath(),i.arc(s(0)+Math.cos(d)*o(5.8),r(0)+Math.sin(d)*a(5.8),3,0,7),i.fill()}[-fn,fn].forEach(h=>{const d=r(h-3.6),f=a(7.2);i.fillStyle="#d9d2bd",i.fillRect(0,d,2560,f);const p=2,b=f/p;for(let w=0;w<p;w++){let v=-(w%2)*o(2.5);for(;v<2560;){const y=o(3.6+Math.random()*2.4),E=Math.random()*14-7|0,L=v+4,C=d+w*b+4,_=y-8,D=b-8;if(i.fillStyle="rgba("+(238+E)+","+(232+E)+","+(216+E)+",0.95)",c(L,C,_,D,10),i.fill(),i.strokeStyle="rgba(255,255,255,0.5)",i.lineWidth=2,i.beginPath(),i.moveTo(L+8,C+2),i.lineTo(L+_-8,C+2),i.stroke(),i.strokeStyle="rgba(120,112,92,0.45)",i.lineWidth=2.5,i.beginPath(),i.moveTo(L+8,C+D-2),i.lineTo(L+_-8,C+D-2),i.stroke(),Math.random()<.18){i.strokeStyle="rgba(110,102,82,0.55)",i.lineWidth=1.8;let F=L+_*Math.random(),H=C+3;i.beginPath(),i.moveTo(F,H);for(let W=0;W<4;W++)F+=(Math.random()*2-1)*10,H+=D/4,i.lineTo(F,H);i.stroke()}Math.random()<.25&&(i.fillStyle="rgba(150,160,120,0.25)",i.beginPath(),i.arc(L+Math.random()*_,C+Math.random()*D,5+Math.random()*7,0,7),i.fill()),v+=y}}[d-3,d+f-a(.55)+3].forEach(w=>{let v=0;for(;v<2560;){const y=o(1.1);i.fillStyle=(v/y|0)%4===0?"rgba(80,185,178,0.75)":"rgba(196,188,164,0.9)",c(v+1.5,w,y-3,a(.55),3),i.fill(),v+=y}}),i.strokeStyle="rgba(214,178,90,0.5)",i.lineWidth=5,i.setLineDash([34,26]),i.beginPath(),i.moveTo(0,r(h)),i.lineTo(2560,r(h)),i.stroke(),i.setLineDash([])}),[[-1,"230,185,60"],[1,"235,95,110"]].forEach(h=>{const d=h[0],f=h[1],p=s(d*(Pe.hw-5)),b=i.createRadialGradient(p,r(0),10,p,r(0),o(18));b.addColorStop(0,"rgba(232,225,206,0.95)"),b.addColorStop(.7,"rgba(232,225,206,0.5)"),b.addColorStop(1,"rgba(0,0,0,0)"),i.fillStyle=b,i.fillRect(0,0,2560,1463),i.strokeStyle="rgba("+f+",0.55)",i.lineWidth=5,i.beginPath(),i.ellipse(p,r(0),o(7.6),a(7.6),0,0,7),i.stroke()}),i.filter="blur(13px)",i.fillStyle="rgba(30,62,48,0.28)",fr.forEach(h=>i.fillRect(s(h.x-h.hw)-8,r(h.z-h.hd)-8,o(h.hw*2)+16,a(h.hd*2)+16)),i.filter="blur(5px)",i.fillStyle="rgba(25,52,40,0.3)",fr.forEach(h=>i.fillRect(s(h.x-h.hw)-2,r(h.z-h.hd)-2,o(h.hw*2)+4,a(h.hd*2)+4)),i.filter="blur(8px)",i.fillStyle="rgba(28,60,40,0.3)",cs.forEach(h=>{i.beginPath(),i.ellipse(s(h.x),r(h.z),o(h.hw*.95),a(h.hd*1.05),0,0,7),i.fill()}),i.filter="blur(26px)",i.strokeStyle="rgba(25,60,55,0.35)",i.lineWidth=46,i.strokeRect(-20,-20,2600,1503),i.filter="none",dm.forEach(h=>{const d=h.type==="elite",f=h.type==="dmg"?"150,80,220":d?"225,170,40":"40,160,150";if(i.strokeStyle="rgba("+f+",0.55)",i.lineWidth=3,i.beginPath(),i.ellipse(s(h.x),r(h.z),24,16,0,0,7),i.stroke(),i.setLineDash([6,8]),i.beginPath(),i.ellipse(s(h.x),r(h.z),32,22,0,0,7),i.stroke(),i.setLineDash([]),d)for(let p=0;p<4;p++){const b=p/4*Math.PI*2+Math.PI/4;i.save(),i.translate(s(h.x)+Math.cos(b)*40,r(h.z)+Math.sin(b)*27),i.rotate(Math.PI/4),i.fillStyle="rgba("+f+",0.6)",i.fillRect(-4,-4,8,8),i.restore()}}),za.forEach(h=>{const d=h.team===0?"230,185,60":"235,95,110";i.fillStyle="rgba("+d+",0.20)",i.beginPath(),i.ellipse(s(h.x),r(h.z),o(2.8),a(2.8),0,0,7),i.fill(),i.strokeStyle="rgba("+d+",0.55)",i.lineWidth=3,i.beginPath(),i.ellipse(s(h.x),r(h.z),o(2.6),a(2.6),0,0,7),i.stroke()});const u=new jn(t);return u.encoding=Cn,u.anisotropy=Gt.capabilities.getMaxAnisotropy(),u}class pm extends xi{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new n_(t)}),this.register(function(t){return new s_(t)}),this.register(function(t){return new r_(t)}),this.register(function(t){return new i_(t)}),this.register(function(t){return new e_(t)}),this.register(function(t){return new o_(t)})}load(e,t,i,s){const r=this;let o;this.resourcePath!==""?o=this.resourcePath:this.path!==""?o=this.path:o=er.extractUrlBase(e),this.manager.itemStart(e);const a=function(l){s?s(l):console.error(l),r.manager.itemError(e),r.manager.itemEnd(e)},c=new gh(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(l){try{r.parse(l,o,function(u){t(u),r.manager.itemEnd(e)},a)}catch(u){a(u)}},i,a)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,i,s){let r;const o={},a={};if(typeof e=="string")r=e;else if(er.decodeText(new Uint8Array(e,0,4))===mm){try{o[Qe.KHR_BINARY_GLTF]=new a_(e)}catch(h){s&&s(h);return}r=o[Qe.KHR_BINARY_GLTF].content}else r=er.decodeText(new Uint8Array(e));const c=JSON.parse(r);if(c.asset===void 0||c.asset.version[0]<2){s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new x_(c,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u<this.pluginCallbacks.length;u++){const h=this.pluginCallbacks[u](l);a[h.name]=h,o[h.name]=!0}if(c.extensionsUsed)for(let u=0;u<c.extensionsUsed.length;++u){const h=c.extensionsUsed[u],d=c.extensionsRequired||[];switch(h){case Qe.KHR_MATERIALS_UNLIT:o[h]=new t_;break;case Qe.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:o[h]=new h_;break;case Qe.KHR_DRACO_MESH_COMPRESSION:o[h]=new l_(c,this.dracoLoader);break;case Qe.KHR_TEXTURE_TRANSFORM:o[h]=new c_;break;case Qe.KHR_MESH_QUANTIZATION:o[h]=new u_;break;default:d.indexOf(h)>=0&&a[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}l.setExtensions(o),l.setPlugins(a),l.parse(i,s)}}function $M(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const Qe={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};class e_{constructor(e){this.parser=e,this.name=Qe.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,s=t.length;i<s;i++){const r=t[i];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){const t=this.parser,i="light:"+e;let s=t.cache.get(i);if(s)return s;const r=t.json,c=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let l;const u=new pe(16777215);c.color!==void 0&&u.fromArray(c.color);const h=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new ur(u),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new Qp(u),l.distance=h;break;case"spot":l=new Kp(u),l.distance=h,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,l.angle=c.spot.outerConeAngle,l.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return l.position.set(0,0,0),l.decay=2,c.intensity!==void 0&&(l.intensity=c.intensity),l.name=t.createUniqueName(c.name||"light_"+e),s=Promise.resolve(l),t.cache.add(i,s),s}createNodeAttachment(e){const t=this,i=this.parser,r=i.json.nodes[e],a=(r.extensions&&r.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(c){return i._getNodeRef(t.cache,a,c)})}}class t_{constructor(){this.name=Qe.KHR_MATERIALS_UNLIT}getMaterialType(){return _e}extendParams(e,t,i){const s=[];e.color=new pe(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const o=r.baseColorFactor;e.color.fromArray(o),e.opacity=o[3]}r.baseColorTexture!==void 0&&s.push(i.assignTexture(e,"map",r.baseColorTexture))}return Promise.all(s)}}class n_{constructor(e){this.parser=e,this.name=Qe.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:ph}extendMaterialParams(e,t){const i=this.parser,s=i.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],o=s.extensions[this.name];if(o.clearcoatFactor!==void 0&&(t.clearcoat=o.clearcoatFactor),o.clearcoatTexture!==void 0&&r.push(i.assignTexture(t,"clearcoatMap",o.clearcoatTexture)),o.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=o.clearcoatRoughnessFactor),o.clearcoatRoughnessTexture!==void 0&&r.push(i.assignTexture(t,"clearcoatRoughnessMap",o.clearcoatRoughnessTexture)),o.clearcoatNormalTexture!==void 0&&(r.push(i.assignTexture(t,"clearcoatNormalMap",o.clearcoatNormalTexture)),o.clearcoatNormalTexture.scale!==void 0)){const a=o.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new $(a,-a)}return Promise.all(r)}}class i_{constructor(e){this.parser=e,this.name=Qe.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const i=this.parser.json.materials[e];return!i.extensions||!i.extensions[this.name]?null:ph}extendMaterialParams(e,t){const i=this.parser,s=i.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=[],o=s.extensions[this.name];return o.transmissionFactor!==void 0&&(t.transmission=o.transmissionFactor),o.transmissionTexture!==void 0&&r.push(i.assignTexture(t,"transmissionMap",o.transmissionTexture)),Promise.all(r)}}class s_{constructor(e){this.parser=e,this.name=Qe.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,i=t.json,s=i.textures[e];if(!s.extensions||!s.extensions[this.name])return null;const r=s.extensions[this.name],o=i.images[r.source],a=t.options.ktx2Loader;if(!a){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o,a)}}class r_{constructor(e){this.parser=e,this.name=Qe.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,s=i.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;const o=r.extensions[t],a=s.images[o.source];let c=i.textureLoader;if(a.uri){const l=i.options.manager.getHandler(a.uri);l!==null&&(c=l)}return this.detectSupport().then(function(l){if(l)return i.loadTextureImage(e,a,c);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class o_{constructor(e){this.name=Qe.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const s=i.extensions[this.name],r=this.parser.getDependency("buffer",s.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([r,o.ready]).then(function(a){const c=s.byteOffset||0,l=s.byteLength||0,u=s.count,h=s.byteStride,d=new ArrayBuffer(u*h),f=new Uint8Array(a[0],c,l);return o.decodeGltfBuffer(new Uint8Array(d),u,h,f,s.mode,s.filter),d})}else return null}}const mm="glTF",Wr=12,Dd={JSON:1313821514,BIN:5130562};class a_{constructor(e){this.name=Qe.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Wr);if(this.header={magic:er.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==mm)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-Wr,s=new DataView(e,Wr);let r=0;for(;r<i;){const o=s.getUint32(r,!0);r+=4;const a=s.getUint32(r,!0);if(r+=4,a===Dd.JSON){const c=new Uint8Array(e,Wr+r,o);this.content=er.decodeText(c)}else if(a===Dd.BIN){const c=Wr+r;this.body=e.slice(c,c+o)}r+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class l_{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Qe.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const i=this.json,s=this.dracoLoader,r=e.extensions[this.name].bufferView,o=e.extensions[this.name].attributes,a={},c={},l={};for(const u in o){const h=Nc[u]||u.toLowerCase();a[h]=o[u]}for(const u in e.attributes){const h=Nc[u]||u.toLowerCase();if(o[u]!==void 0){const d=i.accessors[e.attributes[u]],f=go[d.componentType];l[h]=f,c[h]=d.normalized===!0}}return t.getDependency("bufferView",r).then(function(u){return new Promise(function(h){s.decodeDracoFile(u,function(d){for(const f in d.attributes){const p=d.attributes[f],b=c[f];b!==void 0&&(p.normalized=b)}h(d)},a,l)})})}}class c_{constructor(){this.name=Qe.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return e=e.clone(),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),t.texCoord!==void 0&&console.warn('THREE.GLTFLoader: Custom UV sets in "'+this.name+'" extension not yet supported.'),e.needsUpdate=!0,e}}class kc extends Ao{constructor(e){super(),this.isGLTFSpecularGlossinessMaterial=!0;const t=["#ifdef USE_SPECULARMAP","	uniform sampler2D specularMap;","#endif"].join(`
3618`),i=["#ifdef USE_GLOSSINESSMAP","	uniform sampler2D glossinessMap;","#endif"].join(`
3619`),s=["vec3 specularFactor = specular;","#ifdef USE_SPECULARMAP","	vec4 texelSpecular = texture2D( specularMap, vUv );","	texelSpecular = sRGBToLinear( texelSpecular );","	// reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture","	specularFactor *= texelSpecular.rgb;","#endif"].join(`
3620`),r=["float glossinessFactor = glossiness;","#ifdef USE_GLOSSINESSMAP","	vec4 texelGlossiness = texture2D( glossinessMap, vUv );","	// reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture","	glossinessFactor *= texelGlossiness.a;","#endif"].join(`
3621`),o=["PhysicalMaterial material;","material.diffuseColor = diffuseColor.rgb * ( 1. - max( specularFactor.r, max( specularFactor.g, specularFactor.b ) ) );","vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
3621","material.specularRoughness = max( 1.0 - glossinessFactor, 0.0525 ); // 0.0525 corresponds to the base mip of a 256 cubemap.","material.specularRoughness += geometryRoughness;","material.specularRoughness = min( material.specularRoughness, 1.0 );","material.specularColor = specularFactor;"].join(`
3622`),a={specular:{value:new pe().setHex(16777215)},glossiness:{value:1},specularMap:{value:null},glossinessMap:{value:null}};this._extraUniforms=a,this.onBeforeCompile=function(c){for(const l in a)c.uniforms[l]=a[l];c.fragmentShader=c.fragmentShader.replace("uniform float roughness;","uniform vec3 specular;").replace("uniform float metalness;","uniform float glossiness;").replace("#include <roughnessmap_pars_fragment>",t).replace("#include <metalnessmap_pars_fragment>",i).replace("#include <roughnessmap_fragment>",s).replace("#include <metalnessmap_fragment>",r).replace("#include <lights_physical_fragment>",o)},Object.defineProperties(this,{specular:{get:function(){return a.specular.value},set:function(c){a.specular.value=c}},specularMap:{get:function(){return a.specularMap.value},set:function(c){a.specularMap.value=c,c?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return a.glossiness.value},set:function(c){a.glossiness.value=c}},glossinessMap:{get:function(){return a.glossinessMap.value},set:function(c){a.glossinessMap.value=c,c?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}copy(e){return super.copy(e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}class h_{constructor(){this.name=Qe.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"]}getMaterialType(){return kc}extendParams(e,t,i){const s=t.extensions[this.name];e.color=new pe(1,1,1),e.opacity=1;const r=[];if(Array.isArray(s.diffuseFactor)){const o=s.diffuseFactor;e.color.fromArray(o),e.opacity=o[3]}if(s.diffuseTexture!==void 0&&r.push(i.assignTexture(e,"map",s.diffuseTexture)),e.emissive=new pe(0,0,0),e.glossiness=s.glossinessFactor!==void 0?s.glossinessFactor:1,e.specular=new pe(1,1,1),Array.isArray(s.specularFactor)&&e.specular.fromArray(s.specularFactor),s.specularGlossinessTexture!==void 0){const o=s.specularGlossinessTexture;r.push(i.assignTexture(e,"glossinessMap",o)),r.push(i.assignTexture(e,"specularMap",o))}return Promise.all(r)}createMaterial(e){const t=new kc(e);return t.fog=!0,t.color=e.color,t.map=e.map===void 0?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=e.aoMap===void 0?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=e.emissiveMap===void 0?null:e.emissiveMap,t.bumpMap=e.bumpMap===void 0?null:e.bumpMap,t.bumpScale=1,t.normalMap=e.normalMap===void 0?null:e.normalMap,t.normalMapType=fs,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=e.specularMap===void 0?null:e.specularMap,t.specular=e.specular,t.glossinessMap=e.glossinessMap===void 0?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=e.envMap===void 0?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}class u_{constructor(){this.name=Qe.KHR_MESH_QUANTIZATION}}class pr extends hi{constructor(e,t,i,s){super(e,t,i,s)}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,s=this.valueSize,r=e*s*3+s;for(let o=0;o!==s;o++)t[o]=i[r+o];return t}}pr.prototype.beforeStart_=pr.prototype.copySampleValue_;pr.prototype.afterEnd_=pr.prototype.copySampleValue_;pr.prototype.interpolate_=function(n,e,t,i){const s=this.resultBuffer,r=this.sampleValues,o=this.valueSize,a=o*2,c=o*3,l=i-e,u=(t-e)/l,h=u*u,d=h*u,f=n*c,p=f-c,b=-2*d+3*h,w=d-h,v=1-b,y=w-h+u;for(let E=0;E!==o;E++){const L=r[p+E+o],C=r[p+E+a]*l,_=r[f+E+o],D=r[f+E]*l;s[E]=v*L+y*C+b*_+w*D}return s};const ei={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},go={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},kd={9728:vt,9729:St,9984:Tc,9985:op,9986:Ec,9987:yr},Nd={33071:mn,33648:La,10497:Hi},zd={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Nc={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Ei={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"}
3622,d_={CUBICSPLINE:void 0,LINEAR:or,STEP:lo},hc={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function Fd(n,e){return typeof n!="string"||n===""?"":(/^https?:\/\//i.test(e)&&/^\//.test(n)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(n)||/^data:.*,.*$/i.test(n)||/^blob:.*$/i.test(n)?n:e+n)}function f_(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new Ao({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:_o})),n.DefaultMaterial}function Vr(n,e,t){for(const i in t.extensions)n[i]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=t.extensions[i])}function es(n,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(n.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function p_(n,e,t){let i=!1,s=!1;for(let a=0,c=e.length;a<c;a++){const l=e[a];if(l.POSITION!==void 0&&(i=!0),l.NORMAL!==void 0&&(s=!0),i&&s)break}if(!i&&!s)return Promise.resolve(n);const r=[],o=[];for(let a=0,c=e.length;a<c;a++){const l=e[a];if(i){const u=l.POSITION!==void 0?t.getDependency("accessor",l.POSITION):n.attributes.position;r.push(u)}if(s){const u=l.NORMAL!==void 0?t.getDependency("accessor",l.NORMAL):n.attributes.normal;o.push(u)}}return Promise.all([Promise.all(r),Promise.all(o)]).then(function(a){const c=a[0],l=a[1];return i&&(n.morphAttributes.position=c),s&&(n.morphAttributes.normal=l),n.morphTargetsRelative=!0,n})}function m_(n,e){if(n.updateMorphTargets(),e.weights!==void 0)for(let t=0,i=e.weights.length;t<i;t++)n.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(n.morphTargetInfluences.length===t.length){n.morphTargetDictionary={};for(let i=0,s=t.length;i<s;i++)n.morphTargetDictionary[t[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function g_(n){const e=n.extensions&&n.extensions[Qe.KHR_DRACO_MESH_COMPRESSION];let t;return e?t="draco:"+e.bufferView+":"+e.indices+":"+Od(e.attributes):t=n.indices+":"+Od(n.attributes)+":"+n.mode,t}function Od(n){let e="";const t=Object.keys(n).sort();for(let i=0,s=t.length;i<s;i++)e+=t[i]+":"+n[t[i]]+";";return e}function zc(n){switch(n){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}class x_{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new $M,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.nodeNamesUsed={},typeof createImageBitmap<"u"&&/Firefox/.test(navigator.userAgent)===!1?this.textureLoader=new tm(this.options.manager):this.textureLoader=new hl(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new gh(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,s=this.json,r=this.extensions;this.cache.removeAll(),this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){const a={scene:o[0][s.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:s.asset,parser:i,userData:{}};Vr(r,a,s),es(a,s),Promise.all(i._invokeAll(function(c){return c.afterRoot&&c.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let s=0,r=t.length;s<r;s++){const o=t[s].joints;for(let a=0,c=o.length;a<c;a++)e[o[a]].isBone=!0}for(let s=0,r=e.length;s<r;s++){const o=e[s];o.mesh!==void 0&&(this._addNodeRef(this.meshCache,o.mesh),o.skin!==void 0&&(i[o.mesh].isSkinnedMesh=!0)),o.camera!==void 0&&this._addNodeRef(this.cameraCache,o.
3622camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,i){if(e.refs[t]<=1)return i;const s=i.clone();return s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i<t.length;i++){const s=e(t[i]);if(s)return s}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const i=[];for(let s=0;s<t.length;s++){const r=e(t[s]);r&&i.push(r)}return i}getDependency(e,t){const i=e+":"+t;let s=this.cache.get(i);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this.loadNode(t);break;case"mesh":s=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(t)});break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(t)});break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(t)});break;case"texture":s=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(t)});break;case"skin":s=this.loadSkin(t);break;case"animation":s=this.loadAnimation(t);break;case"camera":s=this.loadCamera(t);break;default:throw new Error("Unknown type: "+e)}this.cache.add(i,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){const i=this,s=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(s.map(function(r,o){return i.getDependency(e,o)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],i=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Qe.KHR_BINARY_GLTF].body);const s=this.options;return new Promise(function(r,o){i.load(Fd(t.uri,s.path),r,void 0,function(){o(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))})})}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then(function(i){const s=t.byteLength||0,r=t.byteOffset||0;return i.slice(r,r+s)})}loadAccessor(e){const t=this,i=this.json,s=this.json.accessors[e];if(s.bufferView===void 0&&s.sparse===void 0)return Promise.resolve(null);const r=[];return s.bufferView!==void 0?r.push(this.getDependency("bufferView",s.bufferView)):r.push(null),s.sparse!==void 0&&(r.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(r).then(function(o){const a=o[0],c=zd[s.type],l=go[s.componentType],u=l.BYTES_PER_ELEMENT,h=u*c,d=s.byteOffset||0,f=s.bufferView!==void 0?i.bufferViews[s.bufferView].byteStride:void 0,p=s.normalized===!0;let b,w;if(f&&f!==h){const v=Math.floor(d/f),y="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+v+":"+s.count;let E=t.cache.get(y);E||(b=new l(a,v*f,s.count*f/u),E=new Vi(b,f/u),t.cache.add(y,E)),w=new lr(E,c,d%f/u,p)}else a===null?b=new l(s.count*c):b=new l(a,d,s.count*c),w=new xt(b,c,p);if(s.sparse!==void 0){const v=zd.SCALAR,y=go[s.sparse.indices.componentType],E=s.sparse.indices.byteOffset||0,L=s.sparse.values.byteOffset||0,C=new y(o[1],E,s.sparse.count*v),_=new l(o[2],L,s.sparse.count*c);a!==null&&(w=new xt(w.array.slice(),w.itemSize,w.normalized));for(let D=0,F=C.length;D<F;D++){const H=C[D];if(w.setX(H,_[D*c]),c>=2&&w.setY(H,_[D*c+1]),c>=3&&w.setZ(H,_[D*c+2]),c>=4&&w.setW(H,_[D*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return w})}loadTexture(e){const t=this.json,i=this.options,s=t.textures[e],r=t.images[s.source];let o=this.textureLoader;if(r.uri){const a=i.manager.getHandler(r.uri);a!==null&&(o=a)}return this.loadTextureImage(e,r,o)}loadTextureImage(e,t,i){const s=this,r=this.json,o=this.options,a=r.textures[e],c=self.URL||self.webkitURL;let l=t.uri,u=!1,h=!0;if(t.mimeType==="image/jpeg"&&(h=!1),t.bufferView!==void 0)l=s.getDependency("bufferView",t.bufferView).then(function(d){if(t.mimeType==="image/png"){const p=new DataView(d,25,1).getUint8(0,!1);h=p===6||p===4||p===3}u=!0;const f=new Blob([d],{type:t.mimeType});return l=c.createObjectURL(f),l});else if(t.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");return Promise.resolve(l).then(function(d){return new Promise(function(f,p){let b=f;i.isImageBitmapLoader===!0&&(b=function(w){f(new jn(w))}),i.load(Fd(d,o.path),b,void 0,p)})}).then(function(d){u===!0&&c.revokeObjectURL(l),d.flipY=!1,a.name&&(d.name=a.name),h||(d.format=Wn);const p=(r.samplers||{})[a.sampler]||{};return d.magFilter=kd[p.magFilter]||St,d.minFilter=kd[p.minFilter]||yr,d.wrapS=Nd[p.wrapS]||Hi,d.wrapT=Nd[p.wrapT]||Hi,s.associations.set(d,{type:"textures",index:e}),d})}assignTexture(e,t,i){const s=this;return this.getDependency("texture",i.index).then(function(r){if(i.texCoord!==void 0&&i.texCoord!=0&&!(t==="aoMap"&&i.texCoord==1)&&console.warn("THREE.GLTFLoader: Custom UV set "+i.texCoord+" for texture "+t+" not yet supported."),s.extensions[Qe.KHR_TEXTURE_TRANSFORM]){const o=i.extensions!==void 0?i.extensions[Qe.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const a=s.associations.get(r);r=s.extensions[Qe.KHR_TEXTURE_TRANSFORM].extendTexture(r,o),s.associations.set(r,a)}}e[t]=r})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;
3622const s=t.attributes.tangent!==void 0,r=t.attributes.color!==void 0,o=t.attributes.normal===void 0,a=e.isSkinnedMesh===!0,c=Object.keys(t.morphAttributes).length>0,l=c&&t.morphAttributes.normal!==void 0;if(e.isPoints){const u="PointsMaterial:"+i.uuid;let h=this.cache.get(u);h||(h=new hh,Lt.prototype.copy.call(h,i),h.color.copy(i.color),h.map=i.map,h.sizeAttenuation=!1,this.cache.add(u,h)),i=h}else if(e.isLine){const u="LineBasicMaterial:"+i.uuid;let h=this.cache.get(u);h||(h=new wr,Lt.prototype.copy.call(h,i),h.color.copy(i.color),this.cache.add(u,h)),i=h}if(s||r||o||a||c){let u="ClonedMaterial:"+i.uuid+":";i.isGLTFSpecularGlossinessMaterial&&(u+="specular-glossiness:"),a&&(u+="skinning:"),s&&(u+="vertex-tangents:"),r&&(u+="vertex-colors:"),o&&(u+="flat-shading:"),c&&(u+="morph-targets:"),l&&(u+="morph-normals:");let h=this.cache.get(u);h||(h=i.clone(),a&&(h.skinning=!0),r&&(h.vertexColors=!0),o&&(h.flatShading=!0),c&&(h.morphTargets=!0),l&&(h.morphNormals=!0),s&&(h.vertexTangents=!0,h.normalScale&&(h.normalScale.y*=-1),h.clearcoatNormalScale&&(h.clearcoatNormalScale.y*=-1)),this.cache.add(u,h),this.associations.set(h,this.associations.get(i))),i=h}i.aoMap&&t.attributes.uv2===void 0&&t.attributes.uv!==void 0&&t.setAttribute("uv2",t.attributes.uv),e.material=i}getMaterialType(){return Ao}loadMaterial(e){const t=this,i=this.json,s=this.extensions,r=i.materials[e];let o;const a={},c=r.extensions||{},l=[];if(c[Qe.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){const h=s[Qe.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];o=h.getMaterialType(),l.push(h.extendParams(a,r,t))}else if(c[Qe.KHR_MATERIALS_UNLIT]){const h=s[Qe.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),l.push(h.extendParams(a,r,t))}else{const h=r.pbrMetallicRoughness||{};if(a.color=new pe(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){const d=h.baseColorFactor;a.color.fromArray(d),a.opacity=d[3]}h.baseColorTexture!==void 0&&l.push(t.assignTexture(a,"map",h.baseColorTexture)),a.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,a.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(l.push(t.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),l.push(t.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,a)})))}r.doubleSided===!0&&(a.side=yt);const u=r.alphaMode||hc.OPAQUE;return u===hc.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===hc.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&o!==_e&&(l.push(t.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new $(1,-1),r.normalTexture.scale!==void 0&&a.normalScale.set(r.normalTexture.scale,-r.normalTexture.scale)),r.occlusionTexture!==void 0&&o!==_e&&(l.push(t.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&o!==_e&&(a.emissive=new pe().fromArray(r.emissiveFactor)),r.emissiveTexture!==void 0&&o!==_e&&l.push(t.assignTexture(a,"emissiveMap",r.emissiveTexture)),Promise.all(l).then(function(){let h;return o===kc?h=s[Qe.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(a):h=new o(a),r.name&&(h.name=r.name),h.map&&(h.map.encoding=Cn),h.emissiveMap&&(h.emissiveMap.encoding=Cn),es(h,r),t.associations.set(h,{type:"materials",index:e}),r.extensions&&Vr(s,h,r),h})}createUniqueName(e){const t=nt.sanitizeNodeName(e||"");let i=t;for(let s=1;this.nodeNamesUsed[i];++s)i=t+"_"+s;return this.nodeNamesUsed[i]=!0,i}loadGeometries(e){const t=this,i=this.extensions,s=this.primitiveCache;function r(a){return i[Qe.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(c){return Hd(c,a,t)})}const o=[];for(let a=0,c=e.length;a<c;a++){const l=e[a],u=g_(l),h=s[u];if(h)o.push(h.promise);else{let d;l.extensions&&l.extensions[Qe.KHR_DRACO_MESH_COMPRESSION]?d=r(l):d=Hd(new qe,l,t),s[u]={primitive:l,promise:d},o.push(d)}}return Promise.all(o)}loadMesh(e){const t=this,i=this.json,s=this.extensions,r=i.meshes[e],o=r.primitives,a=[];for(let c=0,l=o.length;c<l;c++){const u=o[c].material===void 0?f_(this.cache):this.getDependency("material",o[c].material);a.push(u)}return a.push(t.loadGeometries(o)),Promise.all(a).then(function(c){const l=c.slice(0,c.length-1),u=c[c.length-1],h=[];for(let f=0,p=u.length;f<p;f++){const b=u[f],w=o[f];let v;const y=l[f];if(w.mode===ei.TRIANGLES||w.mode===ei.TRIANGLE_STRIP||w.mode===ei.TRIANGLE_FAN||w.mode===void 0)v=r.isSkinnedMesh===!0?new ah(b,y
3622):new X(b,y),v.isSkinnedMesh===!0&&!v.geometry.attributes.skinWeight.normalized&&v.normalizeSkinWeights(),w.mode===ei.TRIANGLE_STRIP?v.geometry=Ud(v.geometry,wx):w.mode===ei.TRIANGLE_FAN&&(v.geometry=Ud(v.geometry,cp));else if(w.mode===ei.LINES)v=new ol(b,y);else if(w.mode===ei.LINE_STRIP)v=new rl(b,y);else if(w.mode===ei.LINE_LOOP)v=new Np(b,y);else if(w.mode===ei.POINTS)v=new zp(b,y);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+w.mode);Object.keys(v.geometry.morphAttributes).length>0&&m_(v,r),v.name=t.createUniqueName(r.name||"mesh_"+e),es(v,r),w.extensions&&Vr(s,v,w),t.assignFinalMaterial(v),h.push(v)}if(h.length===1)return h[0];const d=new Fe;for(let f=0,p=h.length;f<p;f++)d.add(h[f]);return d})}loadCamera(e){let t;const i=this.json.cameras[e],s=i[i.type];if(!s){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return i.type==="perspective"?t=new Ot(Hx.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):i.type==="orthographic"&&(t=new Sr(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),es(t,i),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],i={joints:t.joints};return t.inverseBindMatrices===void 0?Promise.resolve(i):this.getDependency("accessor",t.inverseBindMatrices).then(function(s){return i.inverseBindMatrices=s,i})}loadAnimation(e){const i=this.json.animations[e],s=[],r=[],o=[],a=[],c=[];for(let l=0,u=i.channels.length;l<u;l++){const h=i.channels[l],d=i.samplers[h.sampler],f=h.target,p=f.node!==void 0?f.node:f.id,b=i.parameters!==void 0?i.parameters[d.input]:d.input,w=i.parameters!==void 0?i.parameters[d.output]:d.output;s.push(this.getDependency("node",p)),r.push(this.getDependency("accessor",b)),o.push(this.getDependency("accessor",w)),a.push(d),c.push(f)}return Promise.all([Promise.all(s),Promise.all(r),Promise.all(o),Promise.all(a),Promise.all(c)]).then(function(l){const u=l[0],h=l[1],d=l[2],f=l[3],p=l[4],b=[];for(let v=0,y=u.length;v<y;v++){const E=u[v],L=h[v],C=d[v],_=f[v],D=p[v];if(E===void 0)continue;E.updateMatrix(),E.matrixAutoUpdate=!0;let F;switch(Ei[D.path]){case Ei.weights:F=mo;break;case Ei.rotation:F=vs;break;case Ei.position:case Ei.scale:default:F=cr;break}const H=E.name?E.name:E.uuid,W=_.interpolation!==void 0?d_[_.interpolation]:or,Z=[];Ei[D.path]===Ei.weights?E.traverse(function(k){k.isMesh===!0&&k.morphTargetInfluences&&Z.push(k.name?k.name:k.uuid)}):Z.push(H);let q=C.array;if(C.normalized){const k=zc(q.constructor),O=new Float32Array(q.length);for(let U=0,z=q.length;U<z;U++)O[U]=q[U]*k;q=O}for(let k=0,O=Z.length;k<O;k++){const U=new F(Z[k]+"."+Ei[D.path],L.array,q,W);_.interpolation==="CUBICSPLINE"&&(U.createInterpolant=function(ne){return new pr(this.times,this.values,this.getValueSize()/3,ne)},U.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0),b.push(U)}}const w=i.name?i.name:"animation_"+e;return new Da(w,void 0,b)})}createNodeMesh(e){const t=this.json,i=this,s=t.nodes[e];return s.mesh===void 0?null:i.getDependency("mesh",s.mesh).then(function(r){const o=i._getNodeRef(i.meshCache,s.mesh,r);return s.weights!==void 0&&o.traverse(function(a){if(a.isMesh)for(let c=0,l=s.weights.length;c<l;c++)a.morphTargetInfluences[c]=s.weights[c]}),o})}loadNode(e){const t=this.json,i=this.extensions,s=this,r=t.nodes[e],o=r.name?s.createUniqueName(r.name):"";return(function(){const a=[],c=s._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});return c&&a.push(c),r.camera!==void 0&&a.push(s.getDependency("camera",r.camera).then(function(l){return s._getNodeRef(s.cameraCache,r.camera,l)})),s._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(e)}).forEach(function(l){a.push(l)}),Promise.all(a)})().then(function(a){let c;if(r.isBone===!0?c=new lh:a.length>1?c=new Fe:a.length===1?c=a[0]:c=new $e,c!==a[0])for(let l=0,u=a.length;l<u;l++)c.add(a[l]);if(r.name&&(c.userData.name=r.name,c.name=o),es(c,r),r.extensions&&Vr(i,c,r),r.matrix!==void 0){const l=new ve;l.fromArray(r.matrix),c.applyMatrix4(l)}else r.translation!==void 0&&c.position.fromArray(r.translation),r.rotation!==void 0&&c.quaternion.fromArray(r.rotation),r.scale!==void 0&&c.scale.fromArray(r.scale);return s.associations.set(c,{type:"nodes",index:e}),c})}loadScene(e){const t=this.json,i=this.extensions,s=this.json.scenes[e],r=this,o=new Fe;s.name&&(o.name=r.createUniqueName(s.name)),es(o,s),s.extensions&&Vr(i,o,s);const a=s.nodes||[],c=[];for(let l=0,u=a.length;l<u;l++)c.push(gm(a[l],o,t,r));return Promise.all(c).then(function(){return o}
3622)}}function gm(n,e,t,i){const s=t.nodes[n];return i.getDependency("node",n).then(function(r){if(s.skin===void 0)return r;let o;return i.getDependency("skin",s.skin).then(function(a){o=a;const c=[];for(let l=0,u=o.joints.length;l<u;l++)c.push(i.getDependency("node",o.joints[l]));return Promise.all(c)}).then(function(a){return r.traverse(function(c){if(!c.isMesh)return;const l=[],u=[];for(let h=0,d=a.length;h<d;h++){const f=a[h];if(f){l.push(f);const p=new ve;o.inverseBindMatrices!==void 0&&p.fromArray(o.inverseBindMatrices.array,h*16),u.push(p)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',o.joints[h])}c.bind(new ch(l,u),c.matrixWorld)}),r})}).then(function(r){e.add(r);const o=[];if(s.children){const a=s.children;for(let c=0,l=a.length;c<l;c++){const u=a[c];o.push(gm(u,r,t,i))}}return Promise.all(o)})}function y_(n,e,t){const i=e.attributes,s=new Yt;if(i.POSITION!==void 0){const a=t.json.accessors[i.POSITION],c=a.min,l=a.max;if(c!==void 0&&l!==void 0){if(s.set(new S(c[0],c[1],c[2]),new S(l[0],l[1],l[2])),a.normalized){const u=zc(go[a.componentType]);s.min.multiplyScalar(u),s.max.multiplyScalar(u)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const r=e.targets;if(r!==void 0){const a=new S,c=new S;for(let l=0,u=r.length;l<u;l++){const h=r[l];if(h.POSITION!==void 0){const d=t.json.accessors[h.POSITION],f=d.min,p=d.max;if(f!==void 0&&p!==void 0){if(c.setX(Math.max(Math.abs(f[0]),Math.abs(p[0]))),c.setY(Math.max(Math.abs(f[1]),Math.abs(p[1]))),c.setZ(Math.max(Math.abs(f[2]),Math.abs(p[2]))),d.normalized){const b=zc(go[d.componentType]);c.multiplyScalar(b)}a.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}s.expandByVector(a)}n.boundingBox=s;const o=new ms;s.getCenter(o.center),o.radius=s.min.distanceTo(s.max)/2,n.boundingSphere=o}function Hd(n,e,t){const i=e.attributes,s=[];function r(o,a){return t.getDependency("accessor",o).then(function(c){n.setAttribute(a,c)})}for(const o in i){const a=Nc[o]||o.toLowerCase();a in n.attributes||s.push(r(i[o],a))}if(e.indices!==void 0&&!n.index){const o=t.getDependency("accessor",e.indices).then(function(a){n.setIndex(a)});s.push(o)}return es(n,e),y_(n,e,t),Promise.all(s).then(function(){return e.targets!==void 0?p_(n,e.targets,t):n})}function Ud(n,e){let t=n.getIndex();if(t===null){const o=[],a=n.getAttribute("position");if(a!==void 0){for(let c=0;c<a.count;c++)o.push(c);n.setIndex(o),t=n.getIndex()}else return console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),n}const i=t.count-2,s=[];if(e===cp)for(let o=1;o<=i;o++)s.push(t.getX(0)),s.push(t.getX(o)),s.push(t.getX(o+1));else for(let o=0;o<i;o++)o%2===0?(s.push(t.getX(o)),s.push(t.getX(o+1)),s.push(t.getX(o+2))):(s.push(t.getX(o+2)),s.push(t.getX(o+1)),s.push(t.getX(o)));s.length/3!==i&&console.error("THREE.GLTFLoader.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const r=n.clone();return r.setIndex(s),r}function xm(n,e=!1){const t=new mh({color:n.color?n.color.clone():new pe(16777215),gradientMap:lm});return n.map&&(t.map=n.map),n.emissive&&(n.emissiveMap&&n.map&&(n.emissiveMap===n.map||n.emissive.getHex()===16777215)||(t.emissive=n.emissive.clone(),t.emissiveIntensity=n.emissiveIntensity,n.emissiveMap&&(t.emissiveMap=n.emissiveMap))),n.vertexColors&&(t.vertexColors=!0),n.transparent&&(t.transparent=!0,t.opacity=n.opacity),t.side=n.side,e&&(t.skinning=!0),t.name=n.name,t}const ym={},Gd={CrystalMint:1.5,CrystalViolet:1.5,MushCap:1.6,LampGlow:2.3,GoalTeam:1.3},v_=new pm;function b_(n){const e=new Fe;e.add(n),n.traverse(r=>{if(r.isMesh){r.castShadow=!0,r.material=xm(r.material,r.isSkinnedMesh);const o=r.material;o.emissive&&Gd[o.name]&&(o.emissiveIntensity=Gd[o.name]),o.name==="BushGrass"&&o.color.setRGB(.62,.92,.55)}});const t=new Yt().setFromObject(e),i=t.getSize(new S),s=t.getCenter(new S);return n.position.x-=s.x,n.position.z-=s.z,n.position.y-=t.min.y,e.userData.height=i.y,e}function w_(){const n=["tree","rock","crystal","mushroom","bush","wall","arch","lamp","cliff","pill","glowfloor","underside"];return Promise.all(n.map(e=>new Promise(t=>{v_.load(`/models/props/${e}.glb`,i=>{ym[e]=b_(i.scene),t()},void 0,()=>{console.warn("prop missing, using procedural fallback:",e),t()})})))}function Fn(n,e,t=!1){const i=ym[n];if(!i)return null;
3622const s=i.clone(!0);return t&&s.traverse(r=>{r.isMesh&&(r.material=r.material.clone())}),s.scale.setScalar(e/(i.userData.height||1)),s}const Ih=[];let Wd=0;function si(n){Ih.push(n)}function vm(n){Wd+=n,Ih.forEach(e=>e(n,Wd))}const Vd=new dh(1,0),qd=new Ba(1,0),uc=[xe(4669553,{}),xe(5655438,{}),xe(4077411,{})];xe(7031359,{});xe(3116891,{}),xe(4173422,{}),xe(5751918,{});function M_(){const e=document.createElement("canvas");e.width=256,e.height=256;const t=e.getContext("2d");t.fillStyle="#d8cabb",t.fillRect(0,0,256,256);const i=8,s=256/i,r=64;for(let a=0;a<i;a++){let c=-(a%2)*r/2;for(;c<256;){const l=Math.random()*24-12|0;t.fillStyle=`rgb(${118+l},${80+(l>>1)},${68+(l>>1)})`,t.fillRect(c+2,a*s+2,r-4,s-4),t.fillStyle="rgba(238,224,208,0.10)",t.fillRect(c+2,a*s+2,r-4,4),t.fillStyle="rgba(70,20,15,0.18)",t.fillRect(c+2,a*s+s-7,r-4,5),Math.random()<.2&&(t.fillStyle="rgba(60,25,20,0.25)",t.fillRect(c+6+Math.random()*40,a*s+4+Math.random()*16,5+Math.random()*9,3)),c+=r}}const o=new jn(e);return o.encoding=Cn,o}const jd=[5217849,6469706,3967535,7588186];function Xd(n){const e=new Fe,t=new X(new dn(.16*n,.3*n,1.5*n,8),xe(7031342,{}));return t.position.y=.72*n,t.castShadow=!0,e.add(t),[[0,2,0,1.05],[-.55,1.78,.22,.74],[.55,1.82,-.2,.72],[.1,2.65,-.05,.62],[-.15,1.6,-.5,.6]].forEach((s,r)=>{const o=new X(new dh(.9,1),xe(jd[r%jd.length],{}));o.scale.setScalar(s[3]*n),o.position.set(s[0]*n,s[1]*n,s[2]*n),o.castShadow=!0,e.add(o)}),e.rotation.y=Math.random()*Math.PI*2,e}function __(){Ih.length=0;const n=new To;n.environment=HM,n.fog=new il(13625845,115,280),n.add(cm()),n.add(new Mh(13625599,6199886,.36));const e=new ur(16773330,1.38);e.position.set(34,48,20),e.castShadow=!0,e.shadow.mapSize.set(4096,4096),e.shadow.bias=-4e-4,e.shadow.radius=4;const t=88;e.shadow.camera.left=-t,e.shadow.camera.right=t,e.shadow.camera.top=t,e.shadow.camera.bottom=-t,n.add(e);const i=new ur(7327999,.52);i.position.set(-30,22,-28),n.add(i);{const a=M_(),c=16,l=3;[{len:(Pe.hw+4)*2,x:0,z:-42.5,rotY:0},{len:(Pe.hw+4)*2,x:0,z:Pe.hd+2.5,rotY:0},{len:(Pe.hd+4)*2,x:-72.5,z:0,rotY:Math.PI/2},{len:(Pe.hd+4)*2,x:Pe.hw+2.5,z:0,rotY:Math.PI/2}].forEach(h=>{const d=a.clone();d.needsUpdate=!0,d.wrapS=d.wrapT=Hi,d.repeat.set(h.len/8.8,c/8);const f=new X(new wt(h.len,c,l),xe(16777215,{map:d}));f.position.set(h.x,c/2-.5,h.z),f.rotation.y=h.rotY,f.receiveShadow=!0,n.add(f)}
3622),[[-1,-1],[1,-1],[-1,1],[1,1]].forEach(([h,d])=>{const f=a.clone();f.needsUpdate=!0,f.wrapS=f.wrapT=Hi,f.repeat.set(1.4,2.4);const p=new X(new dn(3.4,3.8,c+3,12),xe(16777215,{map:f}));p.position.set(h*(Pe.hw+2.5),(c+3)/2-.5,d*(Pe.hd+2.5)),n.add(p);const b=new X(new Tn(4.1,2.6,12),xe(9056036));b.position.set(h*(Pe.hw+2.5),c+3.6,d*(Pe.hd+2.5)),n.add(b)})}const s=new X(new Qt((Pe.hw+8)*2,(Pe.hd+8)*2),xe(4099141));s.rotation.x=-Math.PI/2,s.position.y=-.07,s.receiveShadow=!0,n.add(s);const r=new X(new Qt(Pe.hw*2,Pe.hd*2),xe(16777215,{map:QM()}));r.rotation.x=-Math.PI/2,r.receiveShadow=!0,n.add(r),fr.forEach((a,c)=>{const l=c>=6,u=a.hw>=a.hd,h=Math.max(a.hw,a.hd)*2,d=Fn("wall",4.5);if(d){const p=Math.max(1,Math.round(h/7)),b=h/p;for(let w=0;w<p;w++){const v=(w+.5)/p*h-h/2,y=w===0?d:Fn("wall",4.2+Math.random()*.6,l);l&&y.traverse(C=>{C.isMesh&&C.material.name==="WallStone"&&(w===0&&(C.material=C.material.clone()),C.material.color.setRGB(.66,.48,.98))});const L=new Yt().setFromObject(y).getSize(new S).x;y.scale.x*=b*1.12/Math.max(L,.001),u||(y.rotation.y=Math.PI/2),y.position.set(a.x+(u?v:0),0,a.z+(u?0:v)),n.add(y)}}else{const p=It(a.hw*2,1.5,a.hd*2,l?3878758:4669553,{});p.position.set(a.x,.75,a.z),p.receiveShadow=!0,n.add(p);const b=Math.max(2,Math.round(h/1.6));for(let w=0;w<b;w++){const v=(w+.5)/b*h-h/2,y=new X(Vd,uc[Math.random()*uc.length|0]),E=.85+Math.random()*.6;y.scale.set(E*(.8+Math.random()*.5),E*(1.15+Math.random()*.7),E*(.8+Math.random()*.5)),y.position.set(a.x+(u?v:Math.random()*.6-.3),1+Math.random()*.6,a.z+(u?Math.random()*.6-.3:v)),y.rotation.set(Math.random()*.5,Math.random()*Math.PI,Math.random()*.5),y.castShadow=!0,y.receiveShadow=!0,n.add(y)}}const f=l?12868863:5895136;for(let p=0;p<3;p++){const b=Fn("crystal",.9+Math.random()*.6);if(b){b.position.set(a.x+(Math.random()*2-1)*a.hw*.8,1.8+Math.random()*.3,a.z+(Math.random()*2-1)*a.hd*.7),b.rotation.y=Math.random()*Math.PI*2,n.add(b);continue}const w=new X(qd,xe(f,{emissive:f,emissiveIntensity:l?2:1.4}));w.scale.set(.22+Math.random()*.18,.4+Math.random()*.45,.22+Math.random()*.18),w.position.set(a.x+(Math.random()*2-1)*a.hw*.8,2.2+Math.random()*.5,a.z+(Math.random()*2-1)*a.hd*.7),w.rotation.y=Math.random()*Math.PI,n.add(w)}}),cs.forEach(a=>{const c=Fn("bush",1.85);if(c){c.position.set(a.x,0,a.z),c.rotation.y=(Math.random()-.5)*.5,c.scale.x=a.hw/2.3,c.scale.z=a.hd/1.7,n.add(c);return}for(let l=0;l<16;l++){const u=En(.28+Math.random()*.2,.9+Math.random()*.7,Math.random()<.5?3116891:4173422,5,{emissive:666136,emissiveIntensity:.4});u.position.set(a.x+(Math.random()*2-1)*a.hw,.45,a.z+(Math.random()*2-1)*a.hd),u.rotation.y=Math.random()*6,n.add(u)}});for(let a=0;a<26;a++){const c=(Math.random()*2-1)*48,l=(Math.random()*2-1)*12.5;if(Math.abs(c)<10&&Math.abs(l)<10)continue;const u=Fn("mushroom",.8+Math.random()*.5,!0);if(u){u.position.set(c,0,l),u.rotation.y=Math.random()*Math.PI*2,n.add(u);let b=null;if(u.traverse(w=>{w.isMesh&&w.material.name==="MushCap"&&(b=w.material)}),b){const w=Math.random()*7;si((v,y)=>{b.emissiveIntensity=1.5+1*Math.abs(Math.sin(y*1.3+w))})}continue}const h=It(.12,.5,.12,14209776,{});h.position.set(c,.25,l),n.add(h);const d=Math.random()<.5?5895136:12868863,f=En(.3,.3,d,6,{emissive:d,emissiveIntensity:1.2});f.position.set(c,.55,l),n.add(f);const p=Math.random()*7;si((b,w)=>{f.material.emissiveIntensity=1.4+1*Math.abs(Math.sin(w*1.3+p))})}[-48,-24,0,24,48].forEach(a=>[-35.5,35.5].forEach(c=>{const l=new Fe,u=new X(new dn(.11,.17,2.7,8),xe(3354698,{}));u.position.y=1.35,u.castShadow=!0,l.add(u);const h=new X(new dn(.33,.4,.72,6),xe(2367802,{}));h.position.y=2.78,l.add(h);const d=new X(new Tn(.44,.42,6),xe(2367802,{}));d.position.y=3.28,l.add(d);const f=new X(new At(.27,14,12),xe(16765050,{emissive:16757322,emissiveIntensity:2.3}));f.position.y=2.78,l.add(f),l.position.set(a,0,c),n.add(l);const p=a*.3;si((b,w)=>{f.material.emissiveIntensity=2+.55*Math.sin(w*2+p)})})),[[-11.5,0,Math.PI/2],[11.5,0,Math.PI/2]].forEach(([a,c,l])=>{const u=Fn("arch",4.6);u&&(u.position.set(a,0,c),u.rotation.y=l,n.add(u))});const o=new At(.07,5,4);for(let a=0;a<36;a++){const c=new X(o,new _e({color:14283358,transparent:!0,opacity:.8}));n.add(c);const l=(Math.random()*2-1)*50,u=(Math.random()*2-1)*12.5,h=Math.random()*7,d=.4+Math.random()*.5;si((f,p)=>{c.position.set(l+Math.sin(p*d+h)*2.4,1.1+Math.sin(p*1.3+h*2)*.5,u+Math.cos(p*d*.8+h)*2.4),c.material.opacity=.3+.7*Math.abs(Math.sin(p*1.7+h))})}for(let a=0;a<5;a++){const c=new X(Vd,uc[a%3]);c.scale.setScalar(.28+Math.random()*.35),c.castShadow=!0,n.add(c);const l=3.2+Math.random()*2.2,u=Math.random()*7,h=3.4+Math.random()*1.6,d=.25+Math.random()*.2;si((f,p)=>{const b=p*d+u;c.position.set(Math.cos(b)*l,h+Math.sin(p*.9+u)*.4,Math.sin(b)*l),c.rotation.x+=f*.4,c.rotation.y+=f*.3})}
3622[[-1,0],[1,1]].forEach(a=>{const c=a[0],l=a[1],u=c*(Pe.hw-5),h=new X(new ys(7.5,40),xe(3814504,{}));h.rotation.x=-Math.PI/2,h.position.set(u,.03,0),h.receiveShadow=!0,n.add(h);const d=new X(new gi(6.6,7.1,40),new _e({color:st[l],transparent:!0,opacity:.45,side:yt}));d.rotation.x=-Math.PI/2,d.position.set(u,.06,0),n.add(d),[-1,1].forEach(f=>{const p=f*6.2,b=new X(new dn(.32,.44,3.6,7),xe(5655438,{}));b.position.set(u,1.8,p),b.castShadow=!0,n.add(b);const w=new X(qd,xe(st[l],{emissive:st[l],emissiveIntensity:1.4}));w.scale.setScalar(.34),w.position.set(u,3.95,p),n.add(w);const v=new X(new Qt(1.7,1),xe(st[l],{side:yt,emissive:st[l],emissiveIntensity:.15}));v.position.set(u-c*1.05,3.1,p),n.add(v),si((y,E)=>{v.rotation.y=Math.PI/2+Math.sin(E*2+p)*.18})})});for(let a=-60;a<=60;a+=15)[-1,1].forEach(c=>{const l=Xd(.95+Math.random()*.25);l.position.set(a+(Math.random()-.5)*3,0,c*(Pe.hd+.6)),n.add(l)});return[[-40,11],[40,-11],[-40,-11],[40,11],[12,12],[-12,-12]].forEach(a=>{const c=Xd(.75);c.position.set(a[0],0,a[1]),n.add(c)}),n}let Fc=()=>{};const nr={balance:0,ownedSkins:new Set,earn(n){this.balance+=n,Fc()},spend(n){return this.balance<n?!1:(this.balance-=n,Fc(),!0)}};function S_(n){Fc=n}const T_="modulepreload",E_=function(n){return"/"+n},Yd={},Zd=function(e,t,i){let s=Promise.resolve();if(t&&t.length>0){let c=function(l){return Promise.all(l.map(u=>Promise.resolve(u).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=o?.nonce||o?.getAttribute("nonce");s=c(t.map(l=>{if(l=E_(l),l in Yd)return;Yd[l]=!0;const u=l.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${h}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":T_,u||(d.as="script"),d.crossOrigin="",d.href=l,a&&d.setAttribute("nonce",a),document.head.appendChild(d),u)return new Promise((f,p)=>{d.addEventListener("load",f),d.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function r(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&r(a.reason);return e().catch(r)})},Er="https://chudhouse-mp.chudmode.workers.dev/parties/room/gate",bm="VNo7EjR3XVzvbjUgQrFAXNwSms34fHwHBt1Xoaopump",Kd=1e5,Bh="chud_gate",B={address:null,isAdmin:!1,balance:null,eligible:!1,pass:null,connected:!1,username:null,requireTokens:!1,rp:null,tier:null,tierColor:null,chain:null,skinEligible:!1};function wm(){const n=window.phantom&&window.phantom.solana||window.solana;return n&&n.isPhantom?n:null}function Jd(){return B.pass||""}function Qd(n){return n=n||B.address||"",n?n.slice(0,4)+"…"+n.slice(-4):""}const Mm=n=>{let e="";for(const t of n)e+=String.fromCharCode(t);return btoa(e)},Dh=(n,e)=>`CHUDHOUSE gate sign-in
3623wallet: ${n}
3624ts: ${e}`,A_=()=>/Android/i.test(navigator.userAgent),L_={name:"CHUDHOUSE",uri:typeof location<"u"?location.origin:"https://chudhouse.vercel.app",icon:"/art/icon.svg"};async function C_(){const n=wm();if(n)return R_(n);if(A_())return P_();throw new Error("NO_PHANTOM")}async function R_(n){const e=await n.connect(),t=(e&&e.publicKey?e.publicKey:n.publicKey).toString(),i=Date.now(),s=new TextEncoder().encode(Dh(t,i)),r=await n.signMessage(s,"utf8");return kh(t,i,Mm(r.signature))}async function P_(){const[n,e]=await Promise.all([Zd(()=>import("./index.browser-0w08fuse.js"),[]),Zd(()=>import("./index-CyZExzMO.js"),[])]),t=n.transact,i=e.default||e;let s=null;if(await t(async r=>{const a=(await r.authorize({chain:"solana:mainnet",identity:L_})).accounts[0].address,c=i.encode(Uint8Array.from(atob(a),p=>p.charCodeAt(0))),l=Date.now(),u=new TextEncoder().encode(Dh(c,l)),d=(await r.signMessages({addresses:[a],payloads:[u]}))[0],f=d.length>64?d.slice(d.length-64):d;s={address:c,ts:l,signature:Mm(f)}}),!s)throw new Error("MWA_CANCELLED");return kh(s.address,s.ts,s.signature)}async function kh(n,e,t){B.address=n,B.connected=!0;const s=await(await fetch(Er,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({wallet:n,ts:e,signature:t})})).json();if(s.error&&!s.wallet)throw new Error(s.error);return B.isAdmin=!!s.isAdmin,B.balance=typeof s.balance=="number"?s.balance:null,B.eligible=!!s.eligible,B.pass=s.pass||null,B.username=s.username||null,B.requireTokens=!!s.requireTokens,B.rp=typeof s.rp=="number"?s.rp:null,B.tier=s.tier||null,B.tierColor=s.tierColor||null,B.chain=s.chain||(n&&n.startsWith("0x")?"evm":"solana"),B.skinEligible=!!s.skinEligible,fl(),B}function I_(){return window.phantom&&window.phantom.ethereum||window.ethereum||null}async function B_(){const n=I_();if(!n)throw new Error("NO_EVM");const e=await n.request({method:"eth_requestAccounts"}),t=String(e&&e[0]||"").toLowerCase();if(!/^0x[0-9a-f]{40}$/.test(t))throw new Error("NO_EVM");const i=Date.now(),s=Dh(t,i),r="0x"+Array.from(new TextEncoder().encode(s)).map(a=>a.toString(16).padStart(2,"0")).join(""),o=await n.request({method:"personal_sign",params:[r,t]});return kh(t,i,o)}function xo(n){return String(n||"").normalize("NFKC").replace(/[^A-Za-z0-9 _.\-]/g,"").replace(/\s+/g," ").trim().slice(0,14).trim()}async function D_(n){if(n=xo(n),!B.address||!B.pass)return{ok:!1};if(n.length<2)return{ok:!1,invalid:!0};const t=await(await fetch(Er,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({wallet:B.address,pass:B.pass,setUsername:n})})).json();return B.username=t.username||B.username||null,typeof t.rp=="number"&&(B.rp=t.rp,B.tier=t.tier||null,B.tierColor=t.tierColor||null),fl(),t.needTokens?{ok:!1,needTokens:!0,username:B.username}:t.usernameBusy?{ok:!1,busy:!0,username:B.username}:t.usernameTaken?{ok:!1,taken:!0,username:B.username}:t.usernameInvalid?{ok:!1,invalid:!0,username:B.username}:{ok:!!B.username,username:B.username}}async function _m(n,e,t){if(t=xo(t),t.length<2)return{ok:!1,invalid:!0};const s=await(await fetch(Er,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({guest:!0,uid:n,ref:e,setUsername:t})})).json();return s&&s.pass&&(B.pass=s.pass),B.username=s&&s.username||B.username||null,fl(),s&&s.usernameTaken?{ok:!1,taken:!0,username:B.username}:s&&s.usernameInvalid?{ok:!1,invalid:!0,username:B.username}:{ok:!!B.username,username:B.username}}async function k_(n,e,t,i,s){if(!B.pass)return null;const r=typeof B.rp=="number"?B.rp:null,o=B.tier;try{const c=await(await fetch(Er,{method:"POST",headers:{"content-type":"application/json"},keepalive:!0,body:JSON.stringify({pass:B.pass,ticket:s||void 0,record:{kills:n,deaths:e,won:t,ranked:!!i}})})).json(),l=c&&c.stats;if(!l)return null;typeof l.rp=="number"&&(B.rp=l.rp,B.tier=l.tier||B.tier,B.tierColor=l.tierColor||B.tierColor,fl());const u=r!=null&&typeof l.rp=="number"?l.rp-r:0,h=o&&l.tier&&l.tier!==o;return{ranked:!!i,rp:typeof l.rp=="number"?l.rp:null,tier:l.tier||B.tier,tierColor:l.tierColor||B.tierColor,delta:u,promoted:!!(h&&u>0),demoted:!!(h&&u<0)}}catch{return null}}async function Sm(){try{const n=B.username?"?me="+encodeURIComponent(B.username):"",t=await(await fetch(Er+n,{method:"GET"})).json();return{rows:Array.isArray(t.leaderboard)?t.leaderboard:[],you:t.you||null,season:t.season||null}}catch{return{rows:[],you:null,season:null}}}async function N_(){try{const e=await(await fetch(Er+"?history=1",{method:"GET"})).json();return Array.isArray(e.history)?e.history:[]}catch{return[]}}function z_(){try{const n=wm();n&&n.disconnect&&n.disconnect()}catch{}B.address=null,B.connected=!1,B.isAdmin=!1,B.eligible=!1,B.pass=null,B.balance=null,B.username=null,B.rp=null,B.tier=null,B.tierColor=null,B.chain=null,B.skinEligible=!1;try{localStorage.removeItem(Bh)}catch{}}function fl(){try{localStorage.setItem(Bh,JSON.stringify({a:B.address,p:B.pass,ad:B.isAdmin,el:B.eligible,bal:B.balance,un:B.username,rt:B.requireTokens,rp:B.rp,tr:B.tier,tc:B.tierColor,ch:B.chain,sk:B.skinEligible,exp:Date.now()+11*3600*1e3}))}catch{}}function F_(){try{const n=JSON.parse(localStorage.getItem(Bh)||"null");if(n&&n.p&&n.exp>Date.now())return B.address=n.a,B.pass=n.p,B.isAdmin=!!n.ad,B.eligible=!!n.el,B.balance=n.bal,B.connected=!0,B.username=n.un||null,B.requireTokens=!!n.rt,B.rp=typeof n.rp=="number"?n.rp:null,B.tier=n.tr||null,B.tierColor=n.tc||null,B.chain=n.ch||(n.a&&String(n.a).startsWith("0x")?"evm":"solana"),B.skinEligible=!!n.sk,!0}catch{}return!1}function O_(n){const e=new Fe,t=It(1.1,.9,1.5,n.body);t.position.y=.8,e.add(t);const i=It(1.12,.4,1,n.belly);i.position.set(0,.55,.15),e.add(i);
3624const s=It(.95,.85,.9,n.body);s.position.set(0,1.55,-.55),e.add(s);const r=It(.45,.35,.45,n.belly);r.position.set(0,1.4,-1.05),e.add(r);const o=En(.22,.5,n.body,4);o.position.set(-.32,2.15,-.55),e.add(o);const a=o.clone();a.position.x=.32,e.add(a);const c=It(.12,.12,.05,1314858);c.position.set(-.25,1.68,-1.01),e.add(c);const l=c.clone();l.position.x=.25,e.add(l);const u=En(.18,.7,n.accent,4);u.rotation.x=-1,u.position.set(0,1.2,.85),e.add(u);const h=It(1,.18,.95,n.accent,{});return h.position.set(0,1.15,-.55),e.add(h),[[-.38,.25,-.45],[.38,.25,-.45],[-.38,.25,.5],[.38,.25,.5]].forEach(d=>{const f=It(.28,.5,.28,n.body);f.position.set(...d),e.add(f)}),e}function H_(n){const e=new Fe,t=gn(.95,n.body);t.position.y=.85,t.scale.set(1.1,.85,1),e.add(t);const i=gn(.7,n.belly);i.position.set(0,.7,-.35),i.scale.set(.95,.7,.55),e.add(i);const s=gn(.3,n.body);s.position.set(-.45,1.65,-.25),e.add(s);const r=s.clone();r.position.x=.45,e.add(r);const o=gn(.13,1314858);o.position.set(-.45,1.68,-.5),e.add(o);const a=o.clone();a.position.x=.45,e.add(a);const c=En(.55,1,n.accent,6,{});c.position.set(0,2.3,.05),c.rotation.z=.15,e.add(c);const l=It(1.25,.1,1.25,n.accent,{});return l.position.set(0,1.85,.05),e.add(l),[[-.6,.2,.2],[.6,.2,.2]].forEach(u=>{const h=gn(.32,n.body);h.position.set(...u),h.scale.set(1,.6,1.4),e.add(h)}),e}function U_(n){const e=new Fe,t=It(.9,.85,1.3,n.body);t.position.y=.75,e.add(t);const i=It(.92,.4,.7,n.belly);i.position.set(0,.6,-.3),e.add(i);const s=It(.8,.7,.7,n.body);s.position.set(0,1.45,-.5),e.add(s);const r=En(.18,.45,n.body,4);r.position.set(-.28,1.95,-.5),e.add(r);const o=r.clone();o.position.x=.28,e.add(o);const a=It(.7,.22,.1,n.accent,{emissive:n.accent,emissiveIntensity:.4});a.position.set(0,1.55,-.87),e.add(a);const c=It(.16,.16,1,n.accent);return c.rotation.x=.9,c.position.set(0,1.15,.85),e.add(c),[[-.3,.2,-.4],[.3,.2,-.4],[-.3,.2,.45],[.3,.2,.45]].forEach(l=>{const u=It(.24,.45,.24,n.body);u.position.set(...l),e.add(u)}),e}const Tm={melee:O_,mage:H_,ranged:U_};function G_(n){const e=new Fe;if(n==="dmg"){const t=It(1.3,1.3,1.1,6967198,{});t.position.y=.9,e.add(t);const i=gn(.4,12868863,6,{emissive:12868863,emissiveIntensity:1.2});i.position.set(0,.95,-.58),e.add(i);const s=It(.5,.5,.5,5587070);s.position.set(-.95,.5,0),e.add(s);const r=s.clone();r.position.x=.95,e.add(r);const o=It(1,.2,.2,3483479);o.position.set(0,1.45,-.58),e.add(o)}else{const t=gn(.85,3656116,7,{emissive:870978,emissiveIntensity:.7});t.position.y=.7,t.scale.set(1.15,.8,1.15),e.add(t);const i=gn(.12,1314858);i.position.set(-.28,.95,-.7),e.add(i);const s=i.clone();s.position.x=.28,e.add(s);const r=En(.2,.5,16774084,4,{emissive:16767053,emissiveIntensity:1});r.position.set(0,1.4,0),e.add(r)}return e}function W_(){const n=new Fe,e=gn(1.6,6982911,8,{});e.position.y=1.7,e.scale.set(1.1,.85,1.7),n.add(e);const t=gn(1.2,13490687,8);t.position.set(0,1.3,-.4),t.scale.set(.95,.6,1.2),n.add(t);const i=En(.8,1.4,5929192,4);i.rotation.x=Math.PI/2,i.position.set(0,1.8,2.9),i.scale.set(1.6,1,.4),n.add(i);const s=En(.5,1.1,5929192,4);s.rotation.z=Math.PI/2,s.position.set(-1.8,1.5,0),n.add(s);const r=s.clone();r.rotation.z=-Math.PI/2,r.position.x=1.8,n.add(r);const o=gn(.16,1314858);o.position.set(-.7,2,-1.9),n.add(o);const a=o.clone();a.position.x=.7,n.add(a);const c=En(.5,.7,16767053,6,{emissive:16767053,emissiveIntensity:.4});c.position.set(0,3.1,-1),n.add(c);const l=gn(.2,5895136,5,{emissive:5895136,emissiveIntensity:1.2});return l.position.set(0,3,-.2),n.add(l),n}class V_{static retarget(e,t,i={}){const s=new S,r=new Dt,o=new S,a=new ve,c=new ve,l=new ve;i.preserveMatrix=i.preserveMatrix!==void 0?i.preserveMatrix:!0,i.preservePosition=i.preservePosition!==void 0?i.preservePosition:!0,i.preserveHipPosition=i.preserveHipPosition!==void 0?i.preserveHipPosition:!1,i.useTargetMatrix=i.useTargetMatrix!==void 0?i.useTargetMatrix:!1,i.hip=i.hip!==void 0?i.hip:"hip",i.names=i.names||{};const u=t.isObject3D?t.skeleton.bones:this.getBones(t),h=e.isObject3D?e.skeleton.bones:this.getBones(e);let d,f,p,b,w;if(e.isObject3D?e.skeleton.pose():(i.useTargetMatrix=!0,i.preserveMatrix=!1),i.preservePosition){w=[];for(let v=0;v<h.length;v++)w.push(h[v].position.clone())}if(i.preserveMatrix){e.updateMatrixWorld(),e.matrixWorld.identity();for(let v=0;v<e.children.length;++v)e.children[v].updateMatrixWorld(!0)}if(i.offsets){d=[];for(let v=0;v<h.length;++v)f=h[v],p=i.names[f.name]||f.name,i.offsets&&i.offsets[p]&&(f.matrix.multiply(i.offsets[p]),f.matrix.decompose(f.position,f.quaternion,f.scale),f.updateMatrixWorld()),d.push(f.matrixWorld.clone())}for(let v=0;v<h.length;++v){if(f=h[v],p=i.names[f.name]||f.name,b=this.getBoneByName(p,u),l.copy(f.matrixWorld),b){if(b.updateMatrixWorld(),i.useTargetMatrix?c.c
3624opy(b.matrixWorld):(c.copy(e.matrixWorld).invert(),c.multiply(b.matrixWorld)),o.setFromMatrixScale(c),c.scale(o.set(1/o.x,1/o.y,1/o.z)),l.makeRotationFromQuaternion(r.setFromRotationMatrix(c)),e.isObject3D){const y=h.indexOf(f),E=d?d[y]:a.copy(e.skeleton.boneInverses[y]).invert();l.multiply(E)}l.copyPosition(c)}f.parent&&f.parent.isBone?(f.matrix.copy(f.parent.matrixWorld).invert(),f.matrix.multiply(l)):f.matrix.copy(l),i.preserveHipPosition&&p===i.hip&&f.matrix.setPosition(s.set(0,f.position.y,0)),f.matrix.decompose(f.position,f.quaternion,f.scale),f.updateMatrixWorld()}if(i.preservePosition)for(let v=0;v<h.length;++v)f=h[v],p=i.names[f.name]||f.name,p!==i.hip&&f.position.copy(w[v]);i.preserveMatrix&&e.updateMatrixWorld(!0)}static retargetClip(e,t,i,s={}){s.useFirstFramePosition=s.useFirstFramePosition!==void 0?s.useFirstFramePosition:!1,s.fps=s.fps!==void 0?s.fps:30,s.names=s.names||[],t.isObject3D||(t=this.getHelperFromSkeleton(t));const r=Math.round(i.duration*(s.fps/1e3)*1e3),o=1/s.fps,a=[],c=new Ah(t),l=this.getBones(e.skeleton),u=[];let h,d,f,p,b;c.clipAction(i).play(),c.update(0),t.updateMatrixWorld();for(let w=0;w<r;++w){const v=w*o;this.retarget(e,t,s);for(let y=0;y<l.length;++y)b=s.names[l[y].name]||l[y].name,f=this.getBoneByName(b,t.skeleton),f&&(d=l[y],p=u[y]=u[y]||{bone:d},s.hip===b&&(p.pos||(p.pos={times:new Float32Array(r),values:new Float32Array(r*3)}),s.useFirstFramePosition&&(w===0&&(h=d.position.clone()),d.position.sub(h)),p.pos.times[w]=v,d.position.toArray(p.pos.values,w*3)),p.quat||(p.quat={times:new Float32Array(r),values:new Float32Array(r*4)}),p.quat.times[w]=v,d.quaternion.toArray(p.quat.values,w*4));c.update(o),t.updateMatrixWorld()}for(let w=0;w<u.length;++w)p=u[w],p&&(p.pos&&a.push(new cr(".bones["+p.bone.name+"].position",p.pos.times,p.pos.values)),a.push(new vs(".bones["+p.bone.name+"].quaternion",p.quat.times,p.quat.values)));return c.uncacheAction(i),new Da(i.name,-1,a)}static getHelperFromSkeleton(e){const t=new im(e.bones[0]);return t.skeleton=e,t}static getSkeletonOffsets(e,t,i={}){const s=new S,r=new S,o=new S,a=new S,c=new $,l=new $;i.hip=i.hip!==void 0?i.hip:"hip",i.names=i.names||{},t.isObject3D||(t=this.getHelperFromSkeleton(t));const u=Object.keys(i.names),h=Object.values(i.names),d=t.isObject3D?t.skeleton.bones:this.getBones(t),f=e.isObject3D?e.skeleton.bones:this.getBones(e),p=[];let b,w,v,y;for(e.skeleton.pose(),y=0;y<f.length;++y)if(b=f[y],v=i.names[b.name]||b.name,w=this.getBoneByName(v,d),w&&v!==i.hip){const E=this.getNearestBone(b.parent,u),L=this.getNearestBone(w.parent,h);E.updateMatrixWorld(),L.updateMatrixWorld(),s.setFromMatrixPosition(E.matrixWorld),r.setFromMatrixPosition(b.matrixWorld),o.setFromMatrixPosition(L.matrixWorld),a.setFromMatrixPosition(w.matrixWorld),c.subVectors(new $(r.x,r.y),new $(s.x,s.y)).normalize(),l.subVectors(new $(a.x,a.y),new $(o.x,o.y)).normalize();const C=c.angle()-l.angle(),_=new ve().makeRotationFromEuler(new xs(0,0,C));b.matrix.multiply(_),b.matrix.decompose(b.position,b.quaternion,b.scale),b.updateMatrixWorld(),p[v]=_}return p}static renameBones(e,t){const i=this.getBones(e);for(let s=0;s<i.length;++s){const r=i[s];t[r.name]&&(r.name=t[r.name])}return this}static getBones(e){return Array.isArray(e)?e:e.bones}static getBoneByName(e,t){for(let i=0,s=this.getBones(t);i<s.length;i++)if(e===s[i].name)return s[i]}static getNearestBone(e,t){for(;e.isBone;){if(t.indexOf(e.name)!==-1)return e;e=e.parent}}static findBoneTrackData(e,t){const i=/\[(.*)\]\.(.*)/,s={name:e};for(let r=0;r<t.length;++r){const o=i.exec(t[r].name);o&&e===o[1]&&(s[o[2]]=r)}return s}static getEqualsBonesNames(e,t){const i=this.getBones(e),s=this.getBones(t),r=[];e:for(let o=0;o<i.length;o++){const a=i[o].name;for(let c=0;c<s.length;c++)if(a===s[c].name){r.push(a);continue e}}return r}static clone(e){const t=new Map,i=new Map,s=e.clone();return Em(e,s,function(r,o){t.set(o,r),i.set(r,o)}),s.traverse(function(r){if(!r.isSkinnedMesh)return;const o=r,a=t.get(r),c=a.skeleton.bones;o.skeleton=a.skeleton.clone(),o.bindMatrix.copy(a.bindMatrix),o.skeleton.bones=c.map(function(l){return i.get(l)}),o.bind(o.skeleton,o.bindMatrix)}),s}}function Em(n,e,t){t(n,e);for(let i=0;i<n.children.length;i++)Em(n.children[i],e.children[i],t)}const $t={},q_=new pm;function j_(n){return new Promise((e,t)=>
3624q_.parse(n,"",e,t))}function $d(n){n.updateMatrixWorld(!0);const e=new Yt,t=new S;let i=0;return n.traverse(s=>{s.isBone&&(i++,e.expandByPoint(s.getWorldPosition(t)))}),(i<4||e.isEmpty())&&e.setFromObject(n),e}const X_={remus:2.95,wapital:2.05,chudhood:2.72};function Y_(n,e){const t=new Fe;n.rotation.y=Math.PI,t.add(n);let i=$d(t);const s=i.getSize(new S);n.scale.setScalar((X_[e]||2.3)/Math.max(s.y,1e-4)),i=$d(t);const r=i.getCenter(new S);return n.position.x-=r.x,n.position.z-=r.z,n.position.y-=i.min.y,t}function bs(n){const e=V_.clone(n.root);return e.traverse(t=>{t.isMesh&&(t.castShadow=!0,t.material=t.material.clone(),t.isSkinnedMesh&&(t.frustumCulled=!1))}),e.userData.clips=n.clips,e}function Z_(n){return Promise.all(n.map(e=>fetch(`/models/champions/${e}.glb`).then(t=>{if(!t.ok)throw new Error("absent");return t.arrayBuffer()}).then(t=>K_(e,t)).then(()=>console.log("champion model loaded:",e)).catch(()=>{})))}async function K_(n,e){const t=await j_(e),i=t.scene||t.scenes[0];let s=0;return i.traverse(r=>{if(r.isMesh){r.castShadow=!0,r.material=xm(r.material,r.isSkinnedMesh),r.isSkinnedMesh&&(r.frustumCulled=!1);const o=r.geometry;s+=(o.index?o.index.count:o.attributes.position.count)/3}}),$t[n]={root:Y_(i,n),inner:i,clips:t.animations||[],tris:Math.round(s)},$t[n]}let Ci=null,oi=null,Sa=null,kn=null;function J_(){const n=document.getElementById("champPreview");Ci=new ot({canvas:n,antialias:!0,alpha:!0}),Ci.setSize(230,300,!1),Ci.setPixelRatio(Math.min(devicePixelRatio,2)),Ci.outputEncoding=Cn,Ci.toneMapping=Kc,Ci.toneMappingExposure=1.15,oi=new To,oi.add(new Mh(12375280,2761558,.45));const e=new ur(16773328,.85);e.position.set(3,5,4),oi.add(e);const t=new ur(5895136,.3);t.position.set(-4,3,-3),oi.add(t);const i=new X(new ys(1.7,36),new _e({color:920352,transparent:!0,opacity:.55}));i.rotation.x=-Math.PI/2,oi.add(i),Sa=new Ot(35,230/300,.1,50),Sa.position.set(0,2,5.6),Sa.lookAt(0,1.15,0),Am()}function Oc(n,e){if(!oi)return;kn&&oi.remove(kn);const t=pt[n],i=ls[n][e]||ls[n][0],s=i&&i.model&&$t[i.model]?i.model:n,r=!!$t[s];kn=r?bs($t[s]):Tm[t.arch](i.c),kn.rotation.y=Math.PI,r&&s==="ozzie"&&kn.children[0]&&(kn.children[0].rotation.x=0),oi.add(kn)}function Am(){requestAnimationFrame(Am),Ci&&document.getElementById("lobby").style.display!=="none"&&(kn&&(kn.rotation.y+=.011,kn.position.y=Math.sin(performance.now()*.0018)*.06),Ci.render(oi,Sa))}let Et=null,so=null,Hc=null,Lm=!1;function Ar(){if(Et){Et.state==="suspended"&&Et.resume();return}try{Et=new(window.AudioContext||window.webkitAudioContext)}catch{return}so=Et.createGain(),so.gain.value=.85;const n=Et.createDynamicsCompressor();n.threshold.value=-16,n.knee.value=26,n.ratio.value=12,n.attack.value=.003,n.release.value=.2,so.connect(n),n.connect(Et.destination);const e=Math.floor(Et.sampleRate*.5);Hc=Et.createBuffer(1,e,Et.sampleRate);const t=Hc.getChannelData(0);for(let i=0;i<e;i++)t[i]=Math.random()*2-1}const Cm=()=>Et.currentTime;function ui(n,e,{type:t="triangle",vol:i=.09,glide:s=1,cut:r=6,q:o=.7,delay:a=0}={}){if(!Et||Lm)return;const c=Cm()+a,l=Et.createOscillator(),u=Et.createGain(),h=Et.createBiquadFilter();l.type=t,l.frequency.setValueAtTime(n,c),s!==1&&l.frequency.exponentialRampToValueAtTime(Math.max(30,n*s),c+e),h.type="lowpass",h.frequency.value=Math.min(Et.sampleRate/2-100,n*r),h.Q.value=o,u.gain.setValueAtTime(1e-4,c),u.gain.exponentialRampToValueAtTime(i,c+.006),u.gain.exponentialRampToValueAtTime(6e-4,c+e),l.connect(h),h.connect(u),u.connect(so),l.start(c),l.stop(c+e+.03)}function Nh(n,{band:e=1200,q:t=.8,vol:i=.06,type:s="bandpass",glide:r=1,delay:o=0}={}){if(!Et||Lm)return;const a=Cm()+o,c=Et.createBufferSource();c.buffer=Hc;const l=Et.createBiquadFilter();l.type=s,l.frequency.setValueAtTime(e,a),r!==1&&l.frequency.exponentialRampToValueAtTime(Math.max(80,e*r),a+n),l.Q.value=t;const u=Et.createGain();u.gain.setValueAtTime(i,a),u.gain.exponentialRampToValueAtTime(5e-4,a+n),c.connect(l),l.connect(u),u.connect(so),c.start(a),c.stop(a+n+.02)}function ze(n,e,t){ui(n,e||.1,t)}function hn(n=620){ui(n*1.7,.1,{vol:.07,glide:.55,cut:9,q:1.1}),Nh(.06,{band:n*3,q:1.2,vol:.035,glide:.5})}function Q_(){Nh(.14,{band:2600,q:.6,vol:.05,glide:.35})}function Rm(n=!1){ui(n?90:150,n?.22:.13,{type:"sine",vol:n?.13:.08,glide:.5,cut:4}),Nh(n?.12:.07,{type:"lowpass",band:n?500:900,vol:n?.06:.04,glide:.4})}function $_(){ui(1400,.08,{type:"square",vol:.035,glide:.4,cut:8,q:2})}
3624function yo(n=[523,659,784,1047],e=.07,t=.08){n.forEach((i,s)=>ui(i,.18,{type:"triangle",vol:t,cut:7,delay:s*e}))}function eS(){ui(1180,.09,{type:"triangle",vol:.07}),ui(1760,.14,{type:"triangle",vol:.06,delay:.06})}function tS(n){n?yo([523,659,784,1047,1319],.1,.09):(ui(330,.5,{type:"triangle",vol:.08,glide:.55}),ui(247,.6,{type:"sine",vol:.06,glide:.6,delay:.08}))}const nS="0.65.0",iS={version:nS},rt={selectedChar:Object.keys(pt)[0],selectedSkin:Object.fromEntries(Object.keys(pt).map(n=>[n,0]))},Ta={melee:{label:"MELEE",color:"#ff5d6c"},mage:{label:"MAGE",color:"#c45cff"},ranged:{label:"RANGED",color:"#59f3e0"}};function zh(){document.getElementById("lobbyTokens").textContent=nr.balance,document.getElementById("hudTokens").textContent=nr.balance}function sS(){const n=document.getElementById("roster");n.innerHTML="";const e=document.getElementById("rosterCount");e&&(e.textContent=Object.keys(pt).length);for(const t of Object.keys(Ta)){const i=document.createElement("div");i.className="archGroup";const s=document.createElement("label");s.textContent=Ta[t].label,s.style.color=Ta[t].color,i.appendChild(s);const r=document.createElement("div");r.className="tiles",Object.keys(pt).filter(o=>pt[o].arch===t).forEach(o=>{const a=pt[o],c=document.createElement("div");c.className="tile"+(o===rt.selectedChar?" sel":"");const l=document.createElement("img");l.className="face",l.alt=a.name,l.src=`/art/champions/${o}.jpg`,l.onerror=()=>{const h=document.createElement("span");h.className="face",h.textContent=a.face,l.replaceWith(h)};const u=document.createElement("span");u.className="nm",u.textContent=a.name,c.append(l,u),c.onclick=()=>{rt.selectedChar=o,ws();try{ze(720,.04)}catch{}rt.onPick&&rt.onPick(o)},r.appendChild(c)}),i.appendChild(r),n.appendChild(i)}}let ef=null;function rS(){const n=rt.selectedChar,e=pt[n];document.getElementById("champName").textContent=e.name;const t=document.getElementById("champRole");t.textContent=e.role,t.style.color=Ta[e.arch].color;const i=ef!==n;if(ef=n,i){const r=document.getElementById("previewWrap");r&&(r.classList.remove("pop"),r.offsetWidth,r.classList.add("pop"));for(const o of["statDmg","statSpd","statHp"])document.getElementById(o).style.width="0%";document.getElementById("statDmg").offsetWidth}document.getElementById("statDmg").style.width=e.stats.dmg*100+"%",document.getElementById("statSpd").style.width=e.stats.spd*100+"%",document.getElementById("statHp").style.width=e.stats.hpS*100+"%",document.getElementById("abilBasic").textContent=e.basicName,document.getElementById("abilQ").textContent=e.qName;const s=document.getElementById("abilEWrap");e.eName?(document.getElementById("abilE").textContent=e.eName,s.style.display="flex"):s.style.display="none",Oc(n,rt.selectedSkin[n])}function Pm(){const n=rt.selectedChar,e=document.getElementById("skinRow");
3624e.innerHTML="",ls[n].forEach((t,i)=>{const s=n+":"+t.name,r=!!(t.unlockEvm&&(B.skinEligible||B.chain==="evm"&&(B.balance||0)>=t.unlockEvm)),o=!!t.locked&&!r,a=!o&&(r||nr.ownedSkins.has(s)),c=document.createElement("div");c.className="skin"+(rt.selectedSkin[n]===i&&!o?" sel":"")+(a?"":" locked");const l=t.portrait?`<div class="sw skinPortrait"><img src="/art/champions/${t.portrait}.jpg" alt="${t.name}"></div>`:`<div class="sw">
3625          <i style="background:#${t.c.body.toString(16).padStart(6,"0")}"></i>
3626          <i style="background:#${t.c.belly.toString(16).padStart(6,"0")}"></i>
3627          <i style="background:#${t.c.accent.toString(16).padStart(6,"0")}"></i></div>`;c.innerHTML=l+`<div>${t.name}</div>
3628       <div class="cost">${o?t.unlockEvm?"🔒 "+t.unlockEvm/1e3+"k $CHUDINHOOD":"🔒 LOCKED":a?r?"✅ UNLOCKED":"OWNED":"🔒 "+t.cost+" $Chudhouse"}</div>`,c.onclick=()=>{if(o){Oc(n,i),e.querySelectorAll(".skin").forEach(d=>d.classList.remove("previewing")),c.classList.add("previewing");const h=document.getElementById("skinLockNote");h&&(h.textContent=t.unlockEvm?`👀 Previewing ${t.name} — hold ${t.unlockEvm/1e3}k $CHUDINHOOD on Robinhood Chain (EVM sign-in) to unlock.`:`👀 Previewing ${t.name} — locked for now, can’t equip yet.`,h.style.display="block");return}if(a)rt.selectedSkin[n]=i;else if(nr.spend(t.cost)){nr.ownedSkins.add(s);try{eS()}catch{}rt.selectedSkin[n]=i}else c.animate([{transform:"translateX(0)"},{transform:"translateX(-5px)"},{transform:"translateX(5px)"},{transform:"translateX(0)"}],{duration:200});const u=document.getElementById("skinLockNote");u&&(u.style.display="none"),Pm(),Oc(n,rt.selectedSkin[n])},e.appendChild(c)})}function ws(){sS(),rS(),Pm(),zh()}function oS(){document.getElementById("buildTag").textContent=iS.version;for(const n in ls)ls[n].forEach(e=>{e.locked||nr.ownedSkins.add(n+":"+e.name)});S_(zh),J_(),ws()}const Ye={},pl=new $,Co={down:!1};let Uc=null,Gc=null,Wc=null;function aS(n){Uc=n}function lS(n){Gc=n}function cS(n){Wc=n}const Im=()=>{const n=document.activeElement;return!!n&&(n.tagName==="INPUT"||n.tagName==="TEXTAREA")};addEventListener("keydown",n=>{Im()||(Ye[n.key.toLowerCase()]=!0,n.key.toLowerCase()==="q"&&Uc&&Uc(),n.key.toLowerCase()==="e"&&Gc&&Gc(),n.key==="Escape"&&Wc&&Wc())});addEventListener("keyup",n=>{Im()||(Ye[n.key.toLowerCase()]=!1)});addEventListener("mousemove",n=>pl.set(n.clientX/innerWidth*2-1,-(n.clientY/innerHeight)*2+1));addEventListener("mousedown",n=>{n.button===0&&(Co.down=!0),Ar()});addEventListener("mouseup",n=>{n.button===0&&(Co.down=!1)});addEventListener("contextmenu",n=>n.preventDefault());function Je(n){const e=document.getElementById("feed"),t=document.createElement("div");for(t.className="feedItem",t.textContent=n,e.prepend(t),setTimeout(()=>t.remove(),3600);e.children.length>5;)e.lastChild.remove()}let tf=null;function di(n){const e=document.getElementById("announce");e.textContent=n,e.style.display="block",e.classList.remove("pop"),e.offsetWidth,e.classList.add("pop"),clearTimeout(tf),tf=setTimeout(()=>{e.style.display="none",e.classList.remove("pop")},3e3)}const je=document.getElementById("minimap").getContext("2d");function Bm(n,e,t,i,s,r=0){const c=u=>(u+Pe.hw)/(Pe.hw*2)*200,l=u=>(u+Pe.hd)/(Pe.hd*2)*116;je.fillStyle="#171231",je.fillRect(0,0,200,116),je.fillStyle="#221c45",je.fillRect(0,l(-jt),200,l(jt)-l(-jt)),je.fillStyle="#3a3160",[[-fn],[fn]].forEach(([u])=>je.fillRect(0,l(u-3.5),200,l(u+3.5)-l(u-3.5))),je.fillStyle="#4a4380",fr.forEach(u=>je.fillRect(c(u.x-u.hw),l(u.z-u.hd),c(u.x+u.hw)-c(u.x-u.hw),l(u.z+u.hd)-l(u.z-u.hd))),je.fillStyle="rgba(63,174,110,0.7)",cs.forEach(u=>je.fillRect(c(u.x-u.hw),l(u.z-u.hd),c(u.x+u.hw)-c(u.x-u.hw),l(u.z+u.hd)-l(u.z-u.hd))),n.forEach(u=>{je.fillStyle=u.team===0?"#3a86ff":"#ff3b3b",je.save(),je.translate(c(u.pos.x),l(u.pos.z)),je.rotate(Math.PI/4),je.fillRect(-4,-4,8,8),je.restore()}
3628),i.forEach(u=>{if(u.dead){je.strokeStyle="#555066",je.lineWidth=1,je.strokeRect(c(u.pos.x)-2.5,l(u.pos.z)-2.5,5,5);return}je.fillStyle=u.team===0?"#3a86ff":"#ff3b3b",je.fillRect(c(u.pos.x)-2.5,l(u.pos.z)-2.5,5,5)}),e.forEach(u=>{u.dead||(je.fillStyle=u.isBoss?"#ffd84d":"#c45cff",je.beginPath(),je.arc(c(u.pos.x),l(u.pos.z),u.isBoss?5:3,0,7),je.fill(),u.isBoss&&(je.strokeStyle="#c45cff",je.lineWidth=2,je.stroke()))}),t.forEach(u=>{u.dead||u.team!==r&&!s(u,r)||(je.fillStyle=u.team===0?"#3a86ff":"#ff3b3b",je.beginPath(),je.arc(c(u.pos.x),l(u.pos.z),u.isPlayer?4:3,0,7),je.fill(),u.isPlayer&&(je.strokeStyle="#fff",je.lineWidth=1.5,je.stroke()))})}const Oi=new URLSearchParams(location.search).has("mobile")?!0:matchMedia("(pointer: coarse)").matches&&navigator.maxTouchPoints>0||/Android|iPhone|iPad|iPod/i.test(navigator.userAgent),qt={active:!1,x:0,z:0,attack:!1};function hS({onQ:n,onE:e,onMenu:t,onChat:i,onBase:s}){const r=document.getElementById("stickZone"),o=document.getElementById("stickBase"),a=document.getElementById("stickKnob"),c=48;let l=null,u=0,h=0;const d=(b,w)=>{const v=Math.hypot(b,w)||1,y=Math.min(v,c),E=b/v*y,L=w/v*y;a.style.transform=`translate(${E}px,${L}px)`,qt.x=E/c,qt.z=L/c,qt.active=y>c*.18};r.addEventListener("touchstart",b=>{if(b.preventDefault(),l!==null)return;const w=b.changedTouches[0];l=w.identifier,u=w.clientX,h=w.clientY;const v=r.getBoundingClientRect();o.style.left=u-v.left+"px",o.style.top=h-v.top+"px",o.style.bottom="auto",o.style.opacity="1",d(0,0)},{passive:!1}),r.addEventListener("touchmove",b=>{b.preventDefault();for(const w of b.changedTouches)w.identifier===l&&d(w.clientX-u,w.clientY-h)},{passive:!1});const f=b=>{for(const w of b.changedTouches)w.identifier===l&&(l=null,qt.active=!1,qt.x=qt.z=0,a.style.transform="translate(0,0)",o.style.opacity="0.5")};r.addEventListener("touchend",f),r.addEventListener("touchcancel",f);const p=(b,w,v)=>{const y=document.getElementById(b);y.addEventListener("touchstart",L=>{L.preventDefault(),y.classList.add("on"),w()},{passive:!1});const E=L=>{L.preventDefault(),y.classList.remove("on"),v&&v()};y.addEventListener("touchend",E,{passive:!1}),y.addEventListener("touchcancel",E,{passive:!1})};p("btnAtk",()=>{qt.attack=!0},()=>{qt.attack=!1}),p("btnQ",n),p("btnE",e),p("btnMenu",t),i&&p("btnChat",i),s&&p("btnBase",s)}const Dm="chuddome_settings",nf={controlScheme:"camera"};function uS(){try{return Object.assign({},nf,JSON.parse(localStorage.getItem(Dm)||"{}"))}catch{return Object.assign({},nf)}}const hs=uS();function dS(){try{localStorage.setItem(Dm,JSON.stringify(hs))}catch{}}const m={scene:null,entities:[],projectiles:[],effects:[],delayed:[],crystals:[],goals:[],neutrals:[],minions:[],minionQueue:[],boss:null,player:null,running:!1,preMatch:0,matchTime:0,bossTimer:fm,minionTimer:0,matchStats:null};function ke(n,e){const t=n.x-e.x,i=n.z-e.z;return t*t+i*i}function Lr(n){return n.rootT>0?0:n.slowT>0?n.slowFactor||.55:1}function rn(n,e){n.x=Math.max(-70+e,Math.min(Pe.hw-e,n.x)),n.z=Math.max(-40+e,Math.min(Pe.hd-e,n.z))}function un(n,e){fr.forEach(t=>{const i=Math.max(t.x-t.hw,Math.min(t.x+t.hw,n.x)),s=Math.max(t.z-t.hd,Math.min(t.z+t.hd,n.z)),r=n.x-i,o=n.z-s,a=r*r+o*o;if(a<e*e&&a>1e-4){const c=Math.sqrt(a);n.x+=r/c*(e-c),n.z+=o/c*(e-c)}else a<=1e-4&&(n.x+=e)})}let dc=null;function fS(){if(!dc){const n=new Fe,e=new X(new At(.26,10,7),xe(14260814));e.scale.set(1,.62,1),e.position.y=.12,n.add(e);const t=new X(new dn(.3,.27,.05,9),xe(5227087));t.position.y=.02,n.add(t);const i=new X(new dn(.24,.24,.08,9),xe(7221529));i.position.y=-.04,n.add(i);const s=new X(new At(.24,10,7),xe(15250538));s.scale.set(1,.42,1),s.position.y=-.11,n.add(s);for(let r=0;r<4;r++){const o=new X(new At(.03,4,3),xe(16774084)),a=r/4*Math.PI*2+.4;o.position.set(Math.cos(a)*.12,.25,Math.sin(a)*.12),n.add(o)}dc=gt(n)}return dc.clone()}let fc=null;function pS(){if(!fc){const e=new Fe;[[0,0,0,.22],[.14,.06,.05,.15],[-.12,.04,-.06,.13],[.02,-.1,.08,.11]].forEach(([t,i,s,r])=>{const o=new X(new At(r,8,6),xe(14212322,{transparent:!0,opacity:.8}));o.position.set(t,i,s),e.add(o)}),fc=gt(e)}const n=fc.clone();return n.traverse(e=>{e.isMesh&&(e.material=e.material.clone())}),n}
3628const mS=gt(new wt(.7,.32,.4)),gS=gt(new wt(.5,.5,.5));let xS=null,yS=null,pc=null;function vS(){if(!pc){const n=new Fe,e=new X(new wt(.62,.045,.14),xe(12174036,{emissive:5895136,emissiveIntensity:.15})),t=e.clone();t.rotation.y=Math.PI/2;const i=new X(new dn(.09,.09,.06,8),xe(3817294));n.add(e,t,i),pc=gt(n)}return pc.clone()}let mc=null;function bS(){if(!mc){const n=new Fe,e=new X(new Tn(.09,.5,7),xe(12868863,{emissive:9055202,emissiveIntensity:.5}));n.add(e);const t=new X(new Tn(.14,.18,6),xe(8011728,{transparent:!0,opacity:.9}));t.position.y=-.28,t.rotation.x=Math.PI,n.add(t),mc=gt(n)}return mc.clone()}let gc=null;function wS(){if(!gc){const n=new Fe;n.add(new X(new wt(.34,.85,.34),xe(14825528,{emissive:16719904,emissiveIntensity:.6}))),n.add(new X(new wt(.07,1.4,.07),new _e({color:16743034}))),gc=gt(n)}return gc.clone()}let sf=null;function MS(){const t=document.createElement("canvas");t.width=160,t.height=224;const i=t.getContext("2d"),s=(r,o,a,c,l)=>{i.beginPath(),i.moveTo(r+l,o),i.arcTo(r+a,o,r+a,o+c,l),i.arcTo(r+a,o+c,r,o+c,l),i.arcTo(r,o+c,r,o,l),i.arcTo(r,o,r+a,o,l),i.closePath()};return i.fillStyle="#ffffff",s(6,6,148,212,16),i.fill(),i.lineWidth=7,i.strokeStyle="#d11f1f",i.stroke(),i.lineWidth=2,i.strokeStyle="#f2b8b8",s(17,17,126,190,10),i.stroke(),i.fillStyle="#d11f1f",i.textAlign="center",i.textBaseline="middle",i.font="900 42px Arial",i.fillText("J",32,38),i.font="900 24px Arial",i.fillText("♦",32,68),i.save(),i.translate(128,186),i.rotate(Math.PI),i.font="900 42px Arial",i.fillText("J",0,0),i.font="900 24px Arial",i.fillText("♦",0,30),i.restore(),i.beginPath(),i.moveTo(160/2,56),i.lineTo(160/2+42,224/2),i.lineTo(160/2,168),i.lineTo(160/2-42,224/2),i.closePath(),i.fillStyle="#d11f1f",i.fill(),i.lineWidth=4,i.strokeStyle="#7c0c0c",i.stroke(),new jn(t)}function km(){return sf??=MS(),new X(new Qt(.86,1.2),new _e({map:sf,side:yt,transparent:!0,depthWrite:!1}))}let rf=null;function _S(){const t=document.createElement("canvas");t.width=224,t.height=98;const i=t.getContext("2d");return i.fillStyle="#3f8f55",i.fillRect(0,0,224,98),i.fillStyle="#d6efd9",i.fillRect(6,6,212,86),i.fillStyle="#3f8f55",i.fillRect(13,13,198,72),i.strokeStyle="#16431f",i.lineWidth=3,i.strokeRect(9,9,206,80),i.fillStyle="#effbef",i.beginPath(),i.ellipse(224/2,98/2,31,27,0,0,Math.PI*2),i.fill(),i.strokeStyle="#16431f",i.lineWidth=2,i.stroke(),i.fillStyle="#2f6b3e",i.beginPath(),i.arc(224/2,98/2-3,11,0,Math.PI*2),i.fill(),i.beginPath(),i.ellipse(224/2,98/2+12,15,9,0,Math.PI,0),i.fill(),i.fillStyle="#effbef",i.textAlign="center",i.textBaseline="middle",i.font="900 30px Georgia",i.fillText("$1",34,30),i.fillText("$1",190,70),i.font="800 12px Georgia",i.fillText("ONE",34,70),i.fillText("ONE",190,30),i.font="800 14px Georgia",i.fillText("★ ONE DOLLAR ★",224/2,81),new jn(t)}function Nm(){return rf??=_S(),new X(new Qt(1.06,.46),new _e({map:rf,side:yt,transparent:!0,depthWrite:!1}))}let of=null;function SS(){const e=document.createElement("canvas");e.width=e.height=128;const t=e.getContext("2d"),i=128/2,s=t.createRadialGradient(i,i,0,i,i,i);return s.addColorStop(0,"rgba(255,255,255,1)"),s.addColorStop(.22,"rgba(226,248,255,1)"),s.addColorStop(.46,"rgba(95,205,255,0.92)"),s.addColorStop(.72,"rgba(42,150,240,0.42)"),s.addColorStop(1,"rgba(30,120,210,0)"),t.fillStyle=s,t.fillRect(0,0,128,128),new jn(e)}function TS(){of??=SS();const n=new sl(new Eo({map:of,transparent:!0,depthWrite:!1}));return n.scale.set(1.4,1.4,1),n}let af=null,lf=null;function ES(){af??=gt(xe(15219018,{emissive:11542320,emissiveIntensity:.35})),lf??=gt(xe(5882974,{}));const n=new Fe,e=new X(new At(.3,10,9),af);e.scale.set(1,1.18,1),n.add(e);const t=new X(new Tn(.16,.18,5),lf);return t.position.y=.38,n.add(t),n}let cf=null,hf=null;function AS(){cf??=gt(xe(9429066,{emissive:5939240,emissiveIntensity:.65})),hf??=gt(xe(4156194,{}));const n=new Fe,e=new X(new Tn(.15,.52,6),cf);e.scale.set(1,1,.26),n.add(e);const t=new X(new dn(.022,.01,.58,5),hf);return t.position.y=-.02,n.add(t),n.rotation.z=.18,n}function LS(n,e={}){const t=n==="patty"?fS():n==="berry"?ES():n==="smoke"?pS():n==="shuriken"?vS():n==="candle"?wS():n==="card"?km():n==="bill"?Nm():n==="ki"?TS():n==="dart"?bS():n==="feather"?AS():n==="brick"?new X(mS,xS??=gt(xe(11553328))):n==="ice"?new X(gS,yS??=gt(xe(12577023,{transparent:!0,opacity:.85,emissive:5895136,emissiveIntensity:.35}))):new X(new dh(e.size||.28,0),xe(e.color,{emissive:e.color,emissiveIntensity:1.4}));return t.castShadow=n!=="smoke",t}function Kt(n,e,t,i){const s=LS(i.kind,i);s.position.copy(e),s.position.y=i.y??1.2;const r=t.clone().normalize();(i.kind==="dart"||i.kind==="feather")&&s.quaternion.setFromUnitVectors(new S(0,1,0),r),m.scene.add(s);const o=r.multiplyScalar(i.speed||18);
3628m.projectiles.push({mesh:s,vel:o,team:n.team,owner:n,dmg:i.dmg,life:i.life||1.2,color:i.color,trailT:0,kind:i.kind}),m._projOut&&m._projOut.push({k:i.kind||"",x:s.position.x,y:s.position.y,z:s.position.z,vx:o.x,vz:o.z,c:i.color||16777215,s:i.size||0,l:i.life||1.2,t:n.team})}const uf=new Dt;function Di(n){n.parent.getWorldQuaternion(uf),n.quaternion.copy(uf.invert()).multiply(bt.quaternion)}function yn(n,e,t,i=.35){const s=new X(new gi(e*.5,e,28),new _e({color:t,transparent:!0,opacity:.85,side:yt}));s.rotation.x=-Math.PI/2,s.position.set(n.x,.08,n.z),m.scene.add(s),m.effects.push({mesh:s,life:i,maxLife:i,grow:1.8})}function gt(n){return n&&(n.isObject3D?n.traverse(e=>{e.geometry&&(e.geometry.userData.shared=!0),[].concat(e.material||[]).forEach(t=>{t&&(t.userData.shared=!0)})}):n.userData&&(n.userData.shared=!0),n)}function Fa(n){!n||!n.traverse||n.traverse(e=>{e.geometry&&!e.geometry.userData.shared&&e.geometry.dispose(),[].concat(e.material||[]).forEach(t=>{t&&!t.userData.shared&&t.dispose()})})}const Vc=gt(new fh(.12)),CS=gt(new At(.15,6,5)),RS=gt(new At(.5,7,6));function De(n,e,t=6,i=8){if(!(m.effects.length>320))for(let s=0;s<t;s++){const r=new X(Vc,new _e({color:e,transparent:!0,depthWrite:!1}));r.position.set(n.x,1.1,n.z),m.scene.add(r);const o=Math.random()*Math.PI*2;m.effects.push({mesh:r,life:.3+Math.random()*.2,maxLife:.5,vel:new S(Math.cos(o)*i*(.4+Math.random()*.6),2+Math.random()*3.5,Math.sin(o)*i*(.4+Math.random()*.6))})}}function fi(n,e,t=5){if(!(m.effects.length>320))for(let i=0;i<t;i++){const s=new X(RS,new _e({color:e,transparent:!0,depthWrite:!1}));s.position.set(n.x+(Math.random()-.5)*1.4,.8+Math.random()*.8,n.z+(Math.random()-.5)*1.4),m.scene.add(s),m.effects.push({mesh:s,life:.5+Math.random()*.25,maxLife:.75,grow:2.2,alpha:.5,vel:new S(0,1.2,0),grav:!1})}}const PS=gt(new fh(.26));function vo(n,e,t=8,i=9){if(!(m.effects.length>300))for(let s=0;s<t;s++){const r=new X(PS,xe(e,{}));r.position.set(n.x+(Math.random()-.5)*1.2,.4,n.z+(Math.random()-.5)*1.2),r.scale.setScalar(.55+Math.random()*.95),m.scene.add(r);const o=Math.random()*Math.PI*2,a=.35+Math.random()*.75;m.effects.push({mesh:r,life:.55+Math.random()*.35,maxLife:.9,vel:new S(Math.cos(o)*i*a,4.5+Math.random()*5.5,Math.sin(o)*i*a)})}}function pn(n,e,t,i=.4){const s=new X(new At(1,18,9,0,Math.PI*2,0,Math.PI/2.05),new _e({color:e,transparent:!0,opacity:.4,side:yt,depthWrite:!1}));s.position.set(n.x,.05,n.z),m.scene.add(s),m.effects.push({mesh:s,life:i,maxLife:i,grow:Math.max(t-1,.5),alpha:.4})}function zm(n,e,t,i,s=1.6){for(let r=0;r<t;r++){const o=r/t*Math.PI*2+Math.random()*.4,a=i*(.55+Math.random()*.55),c=s*(.7+Math.random()*.7),l=new X(new Tn(.26,c,5),xe(e,{}));l.position.set(n.x+Math.cos(o)*a,-c*.5,n.z+Math.sin(o)*a),l.rotation.z=(Math.random()-.5)*.5,m.scene.add(l),m.effects.push({mesh:l,life:.42+Math.random()*.18,maxLife:.6,vel:new S(0,c*2.6,0),grav:!1})}}function IS(n,e,t,i=3){const s=Math.atan2(e.z,e.x),r=4.2;for(let o=0;o<i;o++){const a=s+(o-(i-1)/2)*.3,c=new X(new wt(r,.08,.16),new _e({color:t,transparent:!0,opacity:.95,depthWrite:!1}));c.position.set(n.x+Math.cos(a)*r*.5,.12,n.z+Math.sin(a)*r*.5),c.rotation.y=-a,m.scene.add(c),m.effects.push({mesh:c,life:.28,maxLife:.28,grow:.5,alpha:.95})}}function ii(n,e,t=8,i=2.4){for(let s=0;s<t;s++){const r=new X(new At(.55+Math.random()*.55,8,6),new _e({color:e,transparent:!0,opacity:.55,depthWrite:!1}));r.position.set(n.x+(Math.random()-.5)*i,.6+Math.random()*1.3,n.z+(Math.random()-.5)*i),m.scene.add(r),m.effects.push({mesh:r,life:.6+Math.random()*.4,maxLife:1,grow:1.8,alpha:.55,vel:new S((Math.random()-.5)*.7,.9,(Math.random()-.5)*.7),grav:!1})}}let Oa=null,Ha=null,df=null,ff=null;function pf(n,e=!1){Oa??=gt(new wt(.7,1.7,.7)),Ha??=gt(new wt(.09,2.8,.09)),df??=gt(xe(12654616,{emissive:13635600,emissiveIntensity:.35})),ff??=gt(new _e({color:16733525}));const t=new Fe;t.add(new X(Oa,df),new X(Ha,ff)),t.scale.setScalar(e?1.7:1),t.position.set(n.x,7,n.z),m.scene.add(t),m.effects.push({mesh:t,life:.3,maxLife:.3,vel:new S(0,-30,0),grav:!1}),m.delayed.push({t:.2,fn:()=>{De(n,16726843,e?16:9,9),vo(n,10101796,e?8:5,7)}})}function mf(n,e=16724016,t=8){let i=new S(n.x+(Math.random()-.5)*.8,t,n.z+(Math.random()-.5)*.8);const s=6;for(let r=1;r<=s;r++){const o=r/s,a=new S(n.x+(Math.random()-.5)*1.4*(1-o),t*(1-o),n.z+(Math.random()-.5)*1.4*(1-o)),c=i.distanceTo(a),l=new X(new wt(.13,.13,c),new _e({color:e,transparent:!0,opacity:.95,depthWrite:!1}));l.position.copy(i).lerp(a,.5),l.lookAt(a),m.scene.add(l),m.effects.push({mesh:l,life:.16,maxLife:.16,alpha:.95}),i=a}}let gf=null,xf=null;function BS(n,e=10,t=7){gf??=new dn(.27,.27,.07,12),xf??=xe(16764730,{emissive:16756224,emissiveIntensity:.5});for(let i=0;i<e;i++){const s=new X(gf,xf);s.position.set(n.x+(Math.random()-.5)*1.2,1+Math.random()*1.4,n.z+(Math.random()-.5)*1.2),s.rotation.set(Math.random()*3,Math.random()*3,Math.random()*3),m.scene.add(s);const r=Math.random()*Math.PI*2,o=.4+Math.random()*.8;m.effects.push({mesh:s,life:.6+Math.random()*.4,maxLife:1,vel:new S(Math.cos(r)*6*o,t+Math.random()*4,Math.sin(r)*6*o)})}}let yf=null;function vf(n,e=2.3){yf??=new _e({color:12577023,transparent:!0,opacity:.5,depthWrite:!1});const t=new X(new wt(e,e,e),yf);t.position.set(n.x,e*.5,n.z),t.rotation.y=Math.random()*.6,m.scene.add(t),m.effects.push({mesh:t,life:.75,maxLife:.75,alpha:.5}),zm(n,15399167,4,1,1)}let bf=null,wf=null;function DS(n,e=!1){Oa??=gt(new wt(.7,1.7,.7)),Ha??=gt(new wt(.09,2.8,.09)),bf??=xe(1491530,{emissive:1232962,emissiveIntensity:.4}),wf??=new _e({color:7274400});const t=new Fe;t.add(new X(Oa,bf),new X(Ha,wf)),t.scale.setScalar(e?1.7:1),t.position.set(n.x,-1.5,n.z),m.scene.add(t),m.effects.push({mesh:t,life:.4,maxLife:.4,vel:new S(0,9,0),grav:!1})}let Mf=null;function kS(){const e=document.createElement("canvas");e.width=256,e.height=256;const t=e.getContext("2d"),i=(s,r,o,a,c)=>{t.beginPath(),t.moveTo(s+c,r),t.arcTo(s+o,r,s+o,r+a,c),t.arcTo(s+o,r+a,s,r+a,c),t.arcTo(s,r+a,s,r,c),t.arcTo(s,r,s+o,r,c),t.closePath()};return t.fillStyle="#0e0e12",i(16,58,224,140,26),t.fill(),t.fillStyle="#d11f1f",i(20,52,216,138,24),t.fill(),t.lineWidth=8,t.strokeStyle="#7c0c0c",t.stroke(),t.fillStyle="#ff8a8a",i(28,60,200,36,16),t.fill(),t.fillStyle="#ffffff",t.textAlign="center",t.textBaseline="middle",t.font="900 46px Arial",t.fillText("100%",128,104),t.font="900 78px Arial",t.fillText("SELL",128,158),new jn(e)}function _f(n){Mf??=kS();const e=new X(new Qt(3,3),new _e({map:Mf,transparent:!0,side:yt,depthWrite:!1}));e.position.set(n.x,1.8,n.z),e.rotation.z=(Math.random()-.5)*.3,e.scale.setScalar(1.9),m.scene.add(e),m.effects.push({mesh:e,life:.75,maxLife:.75,shrink:1.9,alpha:1}),De(n,16722474,12,9)}let Sf=null;function NS(){return Sf??=new hl().load("/trollface.png"),Sf}function zS(n){const e=new X(new Qt(3.3,3.3),new _e({color:16777215,transparent:!0,side:yt,depthWrite:!1})),t=new X(new Qt(3.2,3.2),new _e({map:NS(),transparent:!0,side:yt,depthWrite:!1}));t.position.z=.02;const i=new Fe;i.add(e,t),i.position.set(n.x,2.6,n.z),i.scale.setScalar(.2),m.scene.add(i),m.effects.push({mesh:i,life:1.5,maxLife:1.5,grow:4.5,alpha:1})}function xc(n,e,t,i=1,s=0){let r;$t[e]?(r=bs($t[e]),r.scale.multiplyScalar(i)):r=t(),r.position.set(n.x,9,n.z),r.rotation.x=s,r.rotation.y=(Math.random()-.5)*.6,m.scene.add(r),m.effects.push({mesh:r,life:.34,maxLife:.34,vel:new S(0,-30,0),grav:!1})}function FS(n,e=3816002){for(let t=0;t<14;t++){const i=t/14;m.delayed.push({t:i*.28,fn:()=>{const s=new X(new At(.5+Math.random()*.55,8,6),new _e({color:e,transparent:!0,opacity:.72,depthWrite:!1}));s.position.set(n.x+(Math.random()-.5)*2.2,.1,n.z+(Math.random()-.5)*2.2),m.scene.add(s),m.effects.push({mesh:s,life:.8+Math.random()*.5,maxLife:1.3,grow:2.4,alpha:.72,vel:new S((Math.random()-.5)*.9,5+Math.random()*3.5,(Math.random()-.5)*.9),grav:!1})}})}}function OS(n,e,t=16){const i=new S(e.x,0,e.z);i.lengthSq()<.01&&i.set(0,0,-1),i.normalize();const s=new X(new At(.7,12,10),new _e({color:10477823,transparent:!0,opacity:.95,depthWrite:!1}));s.position.set(n.x+i.x*1.2,1.4,n.z+i.z*1.2),m.scene.add(s),m.effects.push({mesh:s,life:.16,maxLife:.16,shrink:1.5}),m.delayed.push({t:.12,fn:()=>{const r=(o,a,c)=>{const l=new X(new dn(o,o,t,16),new _e({color:a,transparent:!0,opacity:c,depthWrite:!1}));l.position.set(n.x+i.x*(t/2+1),1.4,n.z+i.z*(t/2+1)),l.quaternion.setFromUnitVectors(new S(0,1,0),i),m.scene.add(l),m.effects.push({mesh:l,life:.42,maxLife:.42,alpha:c,grow:.35})};r(.95,7129343,.8),r(.45,16777215,.95);for(let o=0;o<7;o++)De({x:n.x+i.x*(2+o*2.2),z:n.z+i.z*(2+o*2.2)},10477823,4,6);
3628m.shake=Math.max(m.shake||0,.3),ze(90,.18)}})}function HS(n){const e=km();e.position.set(n.x+(Math.random()-.5)*1.3,6.5+Math.random()*2.5,n.z+(Math.random()-.5)*1.3),e.rotation.set(Math.random()*3,Math.random()*3,Math.random()*3),e.scale.setScalar(1.25),m.scene.add(e),m.effects.push({mesh:e,life:.42+Math.random()*.18,maxLife:.6,vel:new S((Math.random()-.5)*2,-13,(Math.random()-.5)*2),grav:!1})}function US(n,e=11){for(let t=0;t<e;t++){const i=Nm();i.position.set(n.x+(Math.random()-.5)*1.5,1+Math.random()*1.5,n.z+(Math.random()-.5)*1.5),i.rotation.set(Math.random()*3,Math.random()*3,Math.random()*3),m.scene.add(i);const s=Math.random()*Math.PI*2,r=.4+Math.random()*.8;m.effects.push({mesh:i,life:.7+Math.random()*.4,maxLife:1.1,vel:new S(Math.cos(s)*6*r,5+Math.random()*4,Math.sin(s)*6*r)})}}function ml(n,e,t){if(m.effects.length>320||e<1)return;const i=document.createElement("canvas");i.width=128,i.height=64;const s=i.getContext("2d");s.font="800 44px Rubik, Arial",s.textAlign="center",s.textBaseline="middle",s.lineJoin="round",s.lineWidth=9,s.strokeStyle="rgba(15,12,32,0.95)",s.strokeText(Math.round(e),64,32),s.fillStyle=t,s.fillText(Math.round(e),64,32);const r=new jn(i),o=new sl(new Eo({map:r,transparent:!0,depthWrite:!1}));o.scale.set(2.4,1.2,1),o.position.set(n.x+(Math.random()-.5)*.8,2.4,n.z),m.scene.add(o),m.effects.push({mesh:o,life:.75,maxLife:.75,vel:new S((Math.random()-.5)*.8,2.4,0),grav:!1,dispose:r})}function pa(n,e){for(let t=0;t<8;t++){const i=new X(new fh(.22),xe(e,{emissive:e,emissiveIntensity:1.2}));i.position.set(n.x,1,n.z),m.scene.add(i);const s=new S((Math.random()*2-1)*6,Math.random()*7+2,(Math.random()*2-1)*6);m.effects.push({mesh:i,life:.6,maxLife:.6,vel:s})}}(!globalThis.EventTarget||!globalThis.Event)&&console.error(`
3629  PartySocket requires a global 'EventTarget' class to be available!
3630  You can polyfill this global by adding this to your code before any partysocket imports: 
3631  
3632  \`\`\`
3633  import 'partysocket/event-target-polyfill';
3634  \`\`\`
3635  Please file an issue at https://github.com/partykit/partykit if you're still having trouble.
3636`);var Fm=class extends Event{message;error;constructor(n,e){super("error",e),this.message=n.message,this.error=n}},Om=class extends Event{code;reason;wasClean=!0;constructor(n=1e3,e="",t){super("close",t),this.code=n,this.reason=e}};const yc={Event,ErrorEvent:Fm,CloseEvent:Om};function GS(n,e){if(!n)throw new Error(e)}function WS(n){return new n.constructor(n.type,n)}function VS(n){return"data"in n?new MessageEvent(n.type,n):"code"in n||"reason"in n?new Om(n.code||1999,n.reason||"unknown reason",n):"error"in n?new Fm(n.error,n):new Event(n.type,n)}const qS=typeof process<"u"&&typeof process.versions?.node<"u",jS=typeof navigator<"u"&&navigator.product==="ReactNative",ma=qS||jS?VS:WS,Ki={maxReconnectionDelay:1e4,minReconnectionDelay:3e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:Number.POSITIVE_INFINITY,maxEnqueuedMessages:Number.POSITIVE_INFINITY};let Tf=!1;function XS(){}
vendor: 8,324 bytes, lines 3636-3649
3636var YS=class Li extends EventTarget{_ws;_retryCount=-1;_uptimeTimeout;_connectTimeout;_shouldReconnect=!0;_connectLock=!1;_binaryType="blob";_closeCalled=!1;_didWarnAboutClosedSend=!1;_messageQueue=[];_debugLogger=console.log.bind(console);_url;_protocols;_options;constructor(e,t,i={}){super(),this._url=e,this._protocols=t,this._options=i,this._options.startClosed&&(this._shouldReconnect=!1),this._options.debugLogger&&(this._debugLogger=this._options.debugLogger),this._connect()}static get CONNECTING(){return 0}static get OPEN(){return 1}static get CLOSING(){return 2}static get CLOSED(){return 3}get CONNECTING(){return Li.CONNECTING}get OPEN(){return Li.OPEN}get CLOSING(){return Li.CLOSING}get CLOSED(){return Li.CLOSED}get binaryType(){return this._ws?this._ws.binaryType:this._binaryType}set binaryType(e){this._binaryType=e,this._ws&&(this._ws.binaryType=e)}get retryCount(){return Math.max(this._retryCount,0)}get bufferedAmount(){return this._messageQueue.reduce((e,t)=>(typeof t=="string"?e+=t.length:t instanceof Blob?e+=t.size:e+=t.byteLength,e),0)+(this._ws?this._ws.bufferedAmount:0)}get extensions(){return this._ws?this._ws.extensions:""}get protocol(){return this._ws?this._ws.protocol:""}get readyState(){return this._closeCalled?Li.CLOSED:this._ws?this._ws.readyState:this._options.startClosed?Li.CLOSED:Li.CONNECTING}get url(){return this._ws?this._ws.url:""}get shouldReconnect(){return this._shouldReconnect}onclose=null;onerror=null;onmessage=null;onopen=null;close(e=1e3,t){if(this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),!this._ws){this._debug("close enqueued: no ws instance");return}if(this._ws.readyState===this.CLOSED||this._ws.readyState===this.CLOSING){this._debug("close: already closing or closed");return}this._disconnect(e,t)}reconnect(e,t){this._shouldReconnect=!0,this._closeCalled=!1,this._didWarnAboutClosedSend=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED||this._ws.readyState===this.CLOSING?this._connect():(this._disconnect(e,t),this._connect())}send(e){if(this._ws&&this._ws.readyState===this.OPEN)return this._debug("send",e),this._ws.send(e),!0;this._closeCalled&&!this._didWarnAboutClosedSend&&(this._didWarnAboutClosedSend=!0,console.warn("ReconnectingWebSocket: send() was called after close(). The message has been buffered, but it will only be delivered if reconnect() is called on this socket. If this socket has been discarded, the message is lost — this usually means a stale socket reference is being used."));const{maxEnqueuedMessages:t=Ki.maxEnqueuedMessages}=this._options;return this._messageQueue.length<t&&(this._debug("enqueue",e),this._messageQueue.push(e)),!1}drainQueuedMessages(){const e=this._messageQueue;return this._messageQueue=[],e}_debug(...e){this._options.debug&&this._debugLogger("RWS>",...e)}_getNextDelay(){const{reconnectionDelayGrowFactor:e=Ki.reconnectionDelayGrowFactor,minReconnectionDelay:t=Ki.minReconnectionDelay,maxReconnectionDelay:i=Ki.maxReconnectionDelay}=this._options;let s=0;return this._retryCount>0&&(s=t*e**(this._retryCount-1),s>i&&(s=i)),this._debug("next delay",s),s}_wait(){return new Promise(e=>{setTimeout(e,this._getNextDelay())})}_getNextProtocols(e){if(!e)return Promise.resolve(null);if(typeof e=="string"||Array.isArray(e))return Promise.resolve(e);if(typeof e=="function"){const t=e();if(!t)return Promise.resolve(null);if(typeof t=="string"||Array.isArray(t))return Promise.resolve(t);if(t.then)return t}throw Error("Invalid protocols")}_getNextUrl(e){if(typeof e=="string")return Promise.resolve(e);if(typeof e=="function"){const t=e();if(typeof t=="string")return Promise.resolve(t);if(t.then)return t}throw Error("Invalid URL")}_connect(){if(this._connectLock||!this._shouldReconnect)return;this._connectLock=!0;const{maxRetries:e=Ki.maxRetries,connectionTimeout:t=Ki.connectionTimeout}=this._options;if(this._retryCount>=e){this._debug("max retries reached",this._retryCount,">=",e),this._connectLock=!1;return}this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),this._wait().then(()=>Promise.all([this._getNextUrl(this._url),this._getNextProtocols(this._protocols||null)])).then(([i,s])=>{if(this._closeCalled){this._connectLock=!1;return}!this._options.WebSocket&&typeof WebSocket>"u"&&!Tf&&(console.error(`‼️ No WebSocket implementation available. You should define options.WebSocket. 
3637
3638For example, if you're using node.js, run \`npm install ws\`, and then in your code:
3639
3640import PartySocket from 'partysocket';
3641import WS from 'ws';
3642
3643const partysocket = new PartySocket({
3644  host: "127.0.0.1:1999",
3645  room: "test-room",
3646  WebSocket: WS
3647});
3648
3649`),Tf=!0);const r=this._options.WebSocket||WebSocket;this._debug("connect",{url:i,protocols:s}),this._ws=s?new r(i,s):new r(i),this._ws.binaryType=this._binaryType,this._connectLock=!1,this._addListeners(),this._connectTimeout=setTimeout(()=>this._handleTimeout(),t)}).catch(i=>{this._connectLock=!1,this._handleError(new yc.ErrorEvent(Error(i.message),this))})}_handleTimeout(){this._debug("timeout event"),this._handleError(new yc.ErrorEvent(Error("TIMEOUT"),this))}_disconnect(e=1e3,t){if(this._clearTimeouts(),!!this._ws){this._removeListeners();try{(this._ws.readyState===this.OPEN||this._ws.readyState===this.CONNECTING)&&this._ws.close(e,t),this._handleClose(new yc.CloseEvent(e,t,this))}catch{}}}_acceptOpen(){this._debug("accept open"),this._retryCount=0}_handleOpen=e=>{this._debug("open event");const{minUptime:t=Ki.minUptime}=this._options;clearTimeout(this._connectTimeout),this._uptimeTimeout=setTimeout(()=>this._acceptOpen(),t),GS(this._ws,"WebSocket is not defined"),this._ws.binaryType=this._binaryType,this._messageQueue.forEach(i=>{this._ws?.send(i)}),this._messageQueue=[],this.onopen&&this.onopen(e),this.dispatchEvent(ma(e))};_handleMessage=e=>{this._debug("message event"),this.onmessage&&this.onmessage(e),this.dispatchEvent(ma(e))};_handleError=e=>{this._debug("error event",e.message),this._disconnect(void 0,e.message==="TIMEOUT"?"timeout":void 0),this.onerror&&this.onerror(e),this._debug("exec error listeners"),this.dispatchEvent(ma(e)),this._connect()};_handleClose=e=>{this._debug("close event"),this._clearTimeouts(),this._shouldReconnect&&this._connect(),this.onclose&&this.onclose(e),this.dispatchEvent(ma(e))};_removeListeners(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError),this._ws.addEventListener("error",XS))}_addListeners(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))}_clearTimeouts(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)}};const ZS=n=>n[1]!==null&&n[1]!==void 0;function KS(){if(crypto?.randomUUID)return crypto.randomUUID();let n=Date.now(),e=performance?.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){let i=Math.random()*16;return n>0?(i=(n+i)%16|0,n=Math.floor(n/16)):(i=(e+i)%16|0,e=Math.floor(e/16)),(t==="x"?i:i&3|8).toString(16)})}function Hm(n,e,t={}){const{host:i,path:s,protocol:r,room:o,party:a,basePath:c,prefix:l,query:u}=n;let h=i.replace(/^(http|https|ws|wss):\/\//,"");if(h.endsWith("/")&&(h=h.slice(0,-1)),s?.startsWith("/"))throw new Error("path must not start with a slash");const d=a??"main",f=s?`/${s}`:"",p=r||(h.startsWith("localhost:")||h.startsWith("127.0.0.1:")||h.startsWith("192.168.")||h.startsWith("10.")||h.startsWith("172.")&&h.split(".")[1]>="16"&&h.split(".")[1]<="31"||h.startsWith("[::ffff:7f00:1]:")?e:`${e}s`),b=`${p}://${h}/${c||`${l||"parties"}/${d}/${o}`}${f}`,w=(y={})=>`${b}?${new URLSearchParams([...Object.entries(t),...Object.entries(y).filter(ZS)])}`,v=typeof u=="function"?async()=>w(await u()):w(u);return{host:h,path:f,room:o,name:d,protocol:p,partyUrl:b,urlProvider:v}}var Ef=class extends YS{_pk;_pkurl;name;room;host;path;basePath;constructor(n){const e=Af(n);if(super(e.urlProvider,e.protocols,e.socketOptions),this.partySocketOptions=n,this.setWSProperties(e),
3649!n.startClosed&&!this.room&&!this.basePath)throw this.close(),new Error("Either room or basePath must be provided to connect. Use startClosed: true to create a socket and set them via updateProperties before calling reconnect().");n.disableNameValidation||(n.party?.includes("/")&&console.warn(`PartySocket: party name "${n.party}" contains forward slash which may cause routing issues. Consider using a name without forward slashes or set disableNameValidation: true to bypass this warning.`),n.room?.includes("/")&&console.warn(`PartySocket: room name "${n.room}" contains forward slash which may cause routing issues. Consider using a name without forward slashes or set disableNameValidation: true to bypass this warning.`))}updateProperties(n){const e=Af({...this.partySocketOptions,...n,host:n.host??this.host,room:n.room??this.room,path:n.path??this.path,basePath:n.basePath??this.basePath});this._url=e.urlProvider,this._protocols=e.protocols,this._options=e.socketOptions,this.setWSProperties(e)}setWSProperties(n){const{_pk:e,_pkurl:t,name:i,room:s,host:r,path:o,basePath:a}=n;this._pk=e,this._pkurl=t,this.name=i,this.room=s,this.host=r,this.path=o,this.basePath=a}reconnect(n,e){if(!this.host)throw new Error("The host must be set before connecting, use `updateProperties` method to set it or pass it to the constructor.");if(!this.room&&!this.basePath)throw new Error("The room (or basePath) must be set before connecting, use `updateProperties` method to set it or pass it to the constructor.");super.reconnect(n,e)}get id(){return this._pk}get roomUrl(){return this._pkurl}static async fetch(n,e){const t=Hm(n,"http"),i=typeof t.urlProvider=="string"?t.urlProvider:await t.urlProvider();return(n.fetch??fetch)(i,e)}};function Af(n){const{id:e,host:t,path:i,party:s,room:r,protocol:o,query:a,protocols:c,...l}=n,u=e||KS(),h=Hm(n,"ws",{_pk:u});return{_pk:u,_pkurl:h.partyUrl,name:h.name,room:h.room,host:h.host,path:h.path,basePath:n.basePath,protocols:c,socketOptions:l,urlProvider:h.urlProvider}}const Lf="chudhouse-mp.chudmode.workers.dev",JS=["Bronze","Silver","Gold","Platinum","Diamond"],K={socket:null,id:null,roster:[],players:{},room:null,isHost:!1,inMatch:!1,teamSize:1,needHumans:2,publicFill:!1,myChamp:null,myReady:!1,myName:null,myTier:null,myTierColor:null,handlers:{},onLobby:null,onStart:null,onClosed:null,onChat:null,onDraft:null,onQueueEnd:null,onLeft:null,onOppLost:null,onOppBack:null,queuing:!1,autoStart:!1,ranked:!1,matchHumans:null,spectator:!1,_startMsg:null,_left:!1,_leaveTimer:null,_queueSock:null,connect(n,e,t,i=!1){return this.disconnect(),this.spectator=!!i,this.room=n,this.myChamp=e||null,this.myName=t||this.myName||null,this.myReady=!1,this.inMatch=!1,this.socket=new Ef({host:Lf,party:"room",room:n,query:{pass:Jd()}}),this.socket.addEventListener("message",s=>{let r;try{r=JSON.parse(s.data)}catch{return}switch(r.t){case"hello":this.id=r.id,this._elect(),this._ensureSelf(),this._sendSelf(),this.spectator&&(this.send({t:"spec",spectator:!0}),this.send({t:"specJoin"}));break;case"roster":this.roster=r.ids||[],this._elect(),this._prune(),this._sendSelf(),this._lobby(),this._checkLeavers();break;case"pick":this._ensure(r.from).champ=r.champ,this._lobby();break;case"ready":this._ensure(r.from).ready=!!r.ready,this._lobby();break;case"name":this._ensure(r.from).name=r.name,this._lobby();break;case"tier":{const o=this._ensure(r.from);o.tier=JS.includes(r.tier)?r.tier:null,o.tierColor=null,this._lobby()}break;case"spec":this._ensure(r.from).spectator=!!r.spectator,this._elect(),this._lobby();break;case"specJoin":this.isHost&&this.inMatch&&this._startMsg&&this.send({...this._startMsg,to:r.from});break;case"qticket":this.matchTicket=r.ticket||null;break;case"chat":this.onChat&&this.onChat(r);break;case"draft":this.onDraft&&this.onDraft(r);break;case"start":if(r.to&&r.to!==this.id)break;{const o=(this.roster||[]).filter(a=>!(this.players[a]&&this.players[a].spectator)).sort();if(r.from&&o.length&&r.from!==o[0])break}if(!r.to&&!this.spectator&&!(r.slots||[]).some(o=>o.id===this.id))break;this.inMatch=!0,this.matchHumans=(r.slots||[]).filter(o=>o.id).map(o=>o.id),this._left=!1,this.onStart&&this.onStart(r);break;default:this.handlers[r.t]&&this.handlers[r.t](r)}}),this.socket.addEventListener("close",()=>{this.onClosed&&this.onClosed()}),this.socket},_elect(){if(this.spectator){this.isHost=!1;return}const n=(this.roster||[]).filter(e=>!(this.players[e]&&this.players[e].spectator));this.isHost=n.length&&this.id?n.sort()[0]===this.id:!1},_ensure(n){return this.players[n]=this.players[n]||{champ:null,ready:!1,name:null,spectator:!1,tier:null,tierColor:null}}
3649,_ensureSelf(){if(this.id){const n=this._ensure(this.id);n.champ=this.myChamp,n.ready=this.myReady,n.name=this.myName,n.tier=this.myTier,n.tierColor=this.myTierColor}},_prune(){for(const n in this.players)this.roster.includes(n)||delete this.players[n];this._ensureSelf()},_sendSelf(){this.connected()&&this.id&&(this.send({t:"pick",champ:this.myChamp}),this.send({t:"ready",ready:this.myReady}),this.send({t:"name",name:this.myName}),this.send({t:"tier",tier:this.myTier,tierColor:this.myTierColor}))},_lobby(){this.onLobby&&this.onLobby(this.players,this.roster,this.isHost)},setPick(n){this.myChamp=n,this._ensureSelf(),this.send({t:"pick",champ:n}),this._lobby()},setReady(n){this.myReady=n,this._ensureSelf(),this.send({t:"ready",ready:n}),this._lobby()},setName(n){this.myName=n,this._ensureSelf(),this.send({t:"name",name:n}),this._lobby()},setTier(n,e){this.myTier=n||null,this.myTierColor=e||null,this._ensureSelf(),this.send({t:"tier",tier:this.myTier,tierColor:this.myTierColor}),this._lobby()},sendChat(n,e){this.send({t:"chat",name:this.myName||"Player",team:e,text:String(n).slice(0,120),tier:this.myTier,tierColor:this.myTierColor})},allReady(){const n=this.roster.filter(e=>!(this.players[e]&&this.players[e].spectator));return n.length>=(this.needHumans||2)&&n.every(e=>this.players[e]&&this.players[e].ready)},beginMatch(){if(!this.isHost||this.inMatch)return;const n=this.teamSize||1;let e=[...this.roster].sort().filter(c=>!(this.players[c]&&this.players[c].spectator));this.publicFill&&(e=e.filter(c=>this.players[c]&&this.players[c].ready)),e=e.slice(0,2*n);const t=[],i={0:new Set,1:new Set};e.forEach((c,l)=>{const u=l%2,h=Math.floor(l/2)%n;t.push({team:u,slot:h,id:c,champ:this.players[c]&&this.players[c].champ||ri[0],name:this.players[c]&&this.players[c].name||null,tier:this.players[c]&&this.players[c].tier||null,tierColor:this.players[c]&&this.players[c].tierColor||null}),i[u].add(h)});const s=this._recentBots||[],r=[...JM].sort(()=>Math.random()-.5).sort((c,l)=>(s.includes(c.name)?1:0)-(s.includes(l.name)?1:0));let o=0;for(const c of[0,1])for(let l=0;l<n;l++){if(i[c].has(l))continue;const u=r[o++%r.length];t.push({team:c,slot:l,id:null,champ:ri[Math.floor(Math.random()*ri.length)],name:u.name,tier:u.tier,tierColor:u.tierColor,skill:u.skill,bot:!0})}this._recentBots=t.filter(c=>c.bot).map(c=>c.name);const a={t:"start",seed:Date.now()&2147483647,slots:t,hostId:this.id,ranked:!!this.ranked};this.inMatch=!0,this._startMsg=a,this.matchHumans=e.slice(),this._left=!1,this.send(a),this.onStart&&this.onStart(a)},_oppGone(){return this.matchHumans&&this.matchHumans.some(n=>n!==this.id&&!this.roster.includes(n))},_checkLeavers(){if(!this.inMatch||!this.matchHumans||this._left)return;const n=this._oppGone();n&&!this._leaveTimer?(this.onOppLost&&this.onOppLost(),this._leaveTimer=setTimeout(()=>{this._leaveTimer=null,this.inMatch&&!this._left&&this._oppGone()&&(this._left=!0,this.inMatch=!1,this.onLeft&&this.onLeft())},6e3)):!n&&this._leaveTimer&&(clearTimeout(this._leaveTimer),this._leaveTimer=null,this.onOppBack&&this.onOppBack())},findMatch(n,e,t=!1){this.disconnect(),this.myChamp=n||this.myChamp,this.myName=e||this.myName,this.queuing=!0,this.autoStart=!0,this.ranked=!!t;const i=t?"matchmaking-ranked":"matchmaking",s=new Ef({host:Lf,party:"room",room:i,query:{pass:Jd()}});return this._queueSock=s,s.addEventListener("message",r=>{let o;try{o=JSON.parse(r.data)}catch{return}if(o.t==="matched"){this.queuing=!1;try{s.close()}catch{}this._queueSock=null;const a=typeof o.ticket=="string"?o.ticket:null;this.connect(o.room,this.myChamp,this.myName),this.ranked=!!t,this.matchTicket=a}}),s.addEventListener("close",()=>{this.queuing&&(this.queuing=!1,this.onQueueEnd&&this.onQueueEnd())}),s},cancelQueue(){if(this.queuing=!1,this.autoStart=!1,this._queueSock){try{this._queueSock.close()}catch{}this._queueSock=null}},joinQuick(n,e,t){return this.connect(n>=3?"pub-3v3":"pub-1v1",e,t),this.teamSize=n>=3?3:1,this.needHumans=2*this.teamSize,this.publicFill=!0,this.autoStart=!1,this.ranked=!1,this.socket},spectate(n,e){return this.connect(n,null,e,!0)},on(n,e){this.handlers[n]=e},send(n){this.connected()&&(n.from=this.id,this.socket.send(JSON.stringify(n)))},connected(){return this.socket&&this.socket.readyState===1},disconnect(){if(this.socket){try{this.socket.close()}catch{}this.socket=null}if(this._queueSock){try{this._queueSock.close()}catch{}this._queueSock=null}this._leaveTimer&&(clearTimeout(this._leaveTimer),this._leaveTimer=null),this.queuing=!1,this.roster=[],this.players={},this.isHost=!1,this.id=null,this.inMatch=!1,this.matchHumans=null,this.spectator=!1,this._startMsg=null,this._left=!1,this.ranked=!1,this.matchTicket=null,this.teamSize=1,this.needHumans=2,this.publicFill=!1}};typeof window<"u"&&(window.__net=K);const Cf={Bronze:0,Silver:1,Gold:2,Platinum:3,Diamond:4},Um=n=>n&&Cf[n]!=null?Cf[n]:0,QS={Bronze:"#d08a4a",Silver:"#cfd6e6",Gold:"#ffcf4d",Platinum:"#5ee0c8",Diamond:"#8fd8ff"},Gm=n=>QS[n]||null,$S=['<circle cx="12" cy="13.6" r="2.7" fill="#fff"/>','<path d="M7.6 16 L12 11.6 L16.4 16" fill="none" stroke="#fff" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>','<path d="M12 9.1 L13.09 12 L16.18 12.14 L13.76 14.07 L14.59 17.06 L12 15.35 L9.41 17.06 L10.24 14.07 L7.82 12.14 L10.91 12 Z" fill="#fff"/>','<path d="M12 9 L15.6 13.6 L12 18.2 L8.4 13.6 Z" fill="#fff"/>','<path d="M12 8.4 L13.3 12.3 L17.2 13.6 L13.3 14.9 L12 18.8 L10.7 14.9 L6.8 13.6 L10.7 12.3 Z" fill="#fff"/>'];function Ro(n,e,t=18){const i=Gm(n);if(!i)return"";
3649const s=Um(n),r=Math.round(t*28/24);return`<svg class="emblem" viewBox="0 0 24 28" width="${t}" height="${r}" aria-hidden="true" focusable="false"><path d="M12 2 L21 5 L21 14 C21 21 17 24.5 12 26.5 C7 24.5 3 21 3 14 L3 5 Z" fill="${i}" stroke="rgba(0,0,0,.45)" stroke-width="1.3"/><path d="M12 2.2 L20.6 5 L20.6 10 C20.6 10 17 11.8 12 11.8 C7 11.8 3.4 10 3.4 10 L3.4 5 Z" fill="rgba(255,255,255,.28)"/>`+$S[s]+"</svg>"}function eT(n,e,t,i,s,r){const o=Gm(s);if(!o)return;const a=Um(s),c=i,l=i*28/24,u=e-c/2,h=t-l/2,d=c/24,f=l/28,p=(y,E)=>[u+y*d,h+E*f];n.save(),n.lineJoin="round",n.beginPath();let b=p(12,2);n.moveTo(b[0],b[1]),b=p(21,5),n.lineTo(b[0],b[1]),b=p(21,14),n.lineTo(b[0],b[1]);let w=p(21,21),v=p(12,26.5);if(n.quadraticCurveTo(w[0],w[1],v[0],v[1]),w=p(3,21),v=p(3,14),n.quadraticCurveTo(w[0],w[1],v[0],v[1]),b=p(3,5),n.lineTo(b[0],b[1]),n.closePath(),n.fillStyle=o,n.fill(),n.lineWidth=Math.max(1.4,d*1.3),n.strokeStyle="rgba(0,0,0,.55)",n.stroke(),n.beginPath(),b=p(12,2.4),n.moveTo(b[0],b[1]),b=p(20.4,5),n.lineTo(b[0],b[1]),b=p(20.4,9.6),n.lineTo(b[0],b[1]),b=p(12,11.4),n.lineTo(b[0],b[1]),b=p(3.6,9.6),n.lineTo(b[0],b[1]),b=p(3.6,5),n.lineTo(b[0],b[1]),n.closePath(),n.fillStyle="rgba(255,255,255,.28)",n.fill(),n.fillStyle="#fff",n.strokeStyle="#fff",a===0)b=p(12,13.6),n.beginPath(),n.arc(b[0],b[1],2.7*d,0,7),n.fill();else if(a===1)n.lineWidth=2.5*d,n.lineCap="round",n.beginPath(),b=p(7.6,16),n.moveTo(b[0],b[1]),b=p(12,11.6),n.lineTo(b[0],b[1]),b=p(16.4,16),n.lineTo(b[0],b[1]),n.stroke();else{const y=a===2?[[12,9.1],[13.09,12],[16.18,12.14],[13.76,14.07],[14.59,17.06],[12,15.35],[9.41,17.06],[10.24,14.07],[7.82,12.14],[10.91,12]]:a===3?[[12,9],[15.6,13.6],[12,18.2],[8.4,13.6]]:[[12,8.4],[13.3,12.3],[17.2,13.6],[13.3,14.9],[12,18.8],[10.7,14.9],[6.8,13.6],[10.7,12.3]];n.beginPath(),y.forEach((E,L)=>{const C=p(E[0],E[1]);L?n.lineTo(C[0],C[1]):n.moveTo(C[0],C[1])}),n.closePath(),n.fill()}n.restore()}const Ua=new RM,Wm=new Sn(new S(0,1,0),0),_t=new S(5,0,0);function Fh(){if(!m.spectator&&!(m.preMatch>0)){if(m.netGuest){m.netIn.q=!0;return}m.running&&m.player&&!m.player.dead&&(vl(m.player,_t),m.player.aimHoldT=.6)}}function Oh(){if(!m.spectator&&!(m.preMatch>0)){if(m.netGuest){m.netIn.e=!0;return}m.running&&m.player&&!m.player.dead&&(bo(m.player,_t),m.player.aimHoldT=.6)}}const Ga=10,tT=6;function Vm(n){n.dead||n.channeling||(n.recallT||0)>0||(n.channeling=!0,n.channelT=Ga,yn(n.pos,2.2,9418495,.6),ze(660,.08))}function Ri(n){di(n),m.netHost&&K.connected()&&K.send({t:"ann",text:n})}function Wa(n,e,t){if(!n||!n.parentElement)return;if(m[e]&&!t){const s=n.parentElement;s.classList.remove("ready"),s.offsetWidth,s.classList.add("ready")}m[e]=t}const Hh=10;function nT(){const n=document.getElementById("startBanner");n&&(n.style.display="flex");const e=document.getElementById("sbNum");e&&(e.textContent=Hh)}function Uh(){const n=document.getElementById("startBanner");n&&(n.style.display="none")}function qm(){const n=m.player;if(!n){m.spectator&&jm(0);return}bt.position.set(n.pos.x,26,n.pos.z+17),bt.lookAt(n.pos.x,0,n.pos.z-1)}const vc=new S;function jm(n){const e=m.specCam||(m.specCam={x:0,z:0,h:42}),t=Math.max(n,0);let i=0,s=0;if((Ye.a||Ye.arrowleft)&&(i-=1),(Ye.d||Ye.arrowright)&&(i+=1),(Ye.w||Ye.arrowup)&&(s-=1),(Ye.s||Ye.arrowdown)&&(s+=1),i||s){const r=Math.hypot(i,s),o=e.h*1.1*t;e.x+=i/r*o,e.z+=s/r*o}(Ye.e||Ye["="]||Ye["+"])&&(e.h=Math.max(16,e.h-28*t)),(Ye.q||Ye["-"])&&(e.h=Math.min(72,e.h+28*t)),e.x=Math.max(-78,Math.min(Pe.hw+8,e.x)),e.z=Math.max(-48,Math.min(Pe.hd+8,e.z)),vc.set(e.x,e.h,e.z+e.h*.55),n<=0?bt.position.copy(vc):bt.position.lerp(vc,.12),bt.lookAt(e.x,0,e.z-1)}function Xm(){m.spectator=!1,document.body.classList.remove("spectating");const n=document.getElementById("specBar");n&&(n.style.display="none")}function iT(n){const e=Math.ceil(m.preMatch);m.preMatch=Math.max(0,m.preMatch-n);const t=Math.ceil(m.preMatch),i=document.getElementById("sbNum");i&&(i.textContent=t),qm(),t!==e&&t>0&&ze(560+(Hh-t)*40,.07),m.preMatch<=0&&(Uh(),di("⚔️ GO!"),ze(1100,.2))}function Gh(){if(m.spectator||m.preMatch>0)return;
3649if(m.netGuest){m.netIn.rc=!0;return}const n=m.player;if(!(!m.running||!n||n.dead)){if(n.channeling){n.channeling=!1,Je("🏠 Recall cancelled");return}(n.recallT||0)>0||(Vm(n),Je("🏠 Recalling… stay safe for 10s"))}}function Ym(n,e){const t=new X(new gi(e*.74,e,40),new _e({color:st[n],transparent:!0,opacity:.7,side:yt,depthWrite:!1}));return t.rotation.x=-Math.PI/2,t.position.y=.05,t}function Zm(n,e){const t=new X(new gi(e-.45,e,56),new _e({color:st[n],transparent:!0,opacity:0,side:yt,depthWrite:!1}));return t.rotation.x=-Math.PI/2,t.position.y=.07,t.visible=!1,t}const gl=new hl().load("/art/feather.png");gl.encoding=Cn;gl.anisotropy=8;gl.minFilter=yr;const sT=115/150;function Km(n){const e=new Fe,t=new _e({map:gl,transparent:!0,alphaTest:.5,side:yt}),i=new X(new Qt(n*sT,n),t);return e.add(i),si((s,r)=>{e.position.y=Math.sin(r*1.5+n)*.1,e.rotation.z=Math.sin(r*.8+n)*.05}),e}function Rf(n){const e=n===0?-65:Pe.hw-5,t=new Fe;let i;const s=n===1,r=Fn("glowfloor",.42,!0),o=s?Km(5.2):Fn("pill",4.4,!0);if(r&&o)Jm(r,n),Qm(r,n*3),t.add(r),i=new Fe,s?(i.add(o),i.position.y=2.9,i.rotation.x=-.55):(o.position.y=-2.2,i.add(o),i.rotation.z=1.1,i.position.y=2.4),t.add(i);else{const h=En(2.2,1.1,4866944,6,{});h.position.y=.55,t.add(h),i=new X(new Ba(1.6,0),xe(st[n],{emissive:st[n],emissiveIntensity:.5})),i.position.y=2.8,i.castShadow=!0,t.add(i)}const a=new X(new Up(2.1,.07,8,40),xe(st[n],{emissive:st[n],emissiveIntensity:.8}));a.position.y=2.8,a.rotation.x=Math.PI/2.3,t.add(a);const c=[];for(let h=0;h<4;h++){const d=new X(new Ba(.2,0),xe(st[n],{emissive:st[n],emissiveIntensity:1.2}));t.add(d),c.push(d)}si((h,d)=>{a.rotation.z+=h*.5,c.forEach((f,p)=>{const b=d*.9+p*Math.PI/2;f.position.set(Math.cos(b)*2.7,2.8+Math.sin(d*1.6+p)*.35,Math.sin(b)*2.7),f.rotation.y+=h*2})}),t.position.set(e,0,0),t.add(Ym(n,3.4));const l=Zm(n,11);t.add(l);const u=Lo(n);return u.position.y=6,u.scale.set(1.7,1.7,1.7),t.add(u),m.scene.add(t),{team:n,mesh:t,gem:i,bar:u,hp:3400,maxHp:3400,pos:t.position,isCrystal:!0,radius:2.3,dead:!1,flash:0,noSpin:s,zapRange:12.8,zapDmg:41,rangeRing:l}}function Jm(n,e){n.traverse(t=>{t.isMesh&&t.material.name==="GoalTeam"&&(t.material.color.setHex(st[e]),t.material.emissive.setHex(st[e]))})}function Qm(n,e){let t=null;n.traverse(i=>{i.isMesh&&i.material.name==="GoalTeam"&&(t=i.material)}),t&&si((i,s)=>{t.emissiveIntensity=.55+.25*Math.sin(s*2+e)})}function rT(n){const e=new Fe;let t;const i=n.team===1,s=Fn("glowfloor",.3,!0),r=i?Km(3.3):Fn("pill",2.7,!0);if(s&&r)Jm(s,n.team),Qm(s,n.x*.2+n.z),e.add(s),t=new Fe,i?(t.add(r),t.position.y=1.9,t.rotation.x=-.55):(r.position.y=-1.35,t.add(r),t.rotation.z=1.05,t.position.y=1.7),e.add(t);else{const c=new X(new ys(2.6,28),xe(st[n.team],{transparent:!0,opacity:.3,emissive:st[n.team],emissiveIntensity:.25}));c.rotation.x=-Math.PI/2,c.position.y=.05,e.add(c),t=new X(new Ba(.8,0),xe(st[n.team],{emissive:st[n.team],emissiveIntensity:.6})),t.position.y=1.9,t.castShadow=!0,e.add(t)}e.add(Ym(n.team,2.3));const o=Zm(n.team,9);e.add(o);const a=Lo(n.team);return a.position.y=3.7,a.scale.set(1.3,1.3,1.3),e.add(a),e.position.set(n.x,0,n.z),m.scene.add(e),{team:n.team,lane:n.lane,tier:n.tier,isGoal:!0,mesh:e,gem:t,bar:a,noSpin:i,zapRange:12,zapDmg:n.tier===1?23:31,rangeRing:o,pos:e.position,hp:n.hp,maxHp:n.hp,radius:2,dead:!1,flash:0}}function Gi(n){return m.matchTime<t0?!1:n.isGoal?n.tier===1?!0:m.goals.some(e=>e.team===n.team&&e.lane===n.lane&&e.tier===1&&e.dead):n.isCrystal?["top","bot"].some(e=>m.goals.filter(t=>t.team===n.team&&t.lane===e).every(t=>t.dead)):!0}function Pf(n,e){if(!n)return;const t=m.goals.filter(s=>s.team===e),i=t.map(s=>s.lane+s.tier+(s.dead?"d":Gi(s)?"o":"s")).join("");n._sig!==i&&(n._sig=i,n.innerHTML=["top","bot"].map(s=>{const r=t.filter(o=>o.lane===s).sort((o,a)=>o.tier-a.tier).map(o=>`<i class="spip ${o.dead?"dead":Gi(o)?"open":"safe"}" title="${s} ${o.tier===1?"outer":"inner"} goal"></i>`).join("");return`<span class="slane"><em>${s==="top"?"T":"B"}</em>${r}</span>`}).join(""))}function $m(n){Pf(document.getElementById("allyStruct"),n),Pf(document.getElementById("enemyStruct"),n===0?1:0)}function oT(n){const e=m.goals.filter(i=>i.team!==n&&!i.dead&&Gi(i)),t=m.crystals[n===0?1:0];return!t.dead&&Gi(t)&&e.push(t),e}function aT(n){const e=n.type==="elite",t=$t["camp_"+(e?"dmg":n.type)];let i;t?(i=bs(t),i.scale.setScalar(e?1.15:.72)):(i=G_(e?"dmg":n.type),e&&i.scale.setScalar(1.4)),i.position.set(n.x,0,n.z),m.scene.add(i);const s=Lo(2);return s.position.y=e?3.2:2.4,i.add(s),{neutral:!0,kind:n.type,camp:n,mesh:i,bar:s,pos:i.position,hp:e?300:140,maxHp:e?300:140,dmg:e?26:14,atkRange:e?2.6:2,atkCd:.9,atkTimer:0,speed:5.5,leash:e?9:8,state:"idle",target:null,dead:!1,respawnT:0,flash:0,radius:e?1.3:.9,team:2}}function e0(n){let e;const t=$t.duve;t?(e=bs(t),e.scale.setScalar(4.2),e.rotation.order="YXZ"):e=W_(),e.position.set(0,0,0),m.scene.add(e);const i=Lo(2);i.position.y=t?2.5:4.4,i.scale.setScalar(t?.55:2.2),e.add(i),m.boss={neutral:!0,isBoss:!0,kind:"boss",camp:{x:0,z:0},mesh:e,bar:i,pos:e.position,hp:900,maxHp:900,dmg:32,atkRange:3.9,atkCd:1.1,atkTimer:0,atkCount:0,flop:null,
3649speed:3.5,leash:7,state:"idle",target:null,dead:!1,flash:0,radius:2.6,team:2},m.neutrals.push(m.boss),n||(Ri("👑 THE DUVE HAS ENTERED THE PIT"),ze(90,.5))}const t0=14,lT=24,cT=3,hT=40,uT=2.5;function n0(n){const e=new Fe,t=$t[n===0?"thedoge":"lmao"];if(t){const a=bs(t);a.scale.setScalar(.95),e.add(a)}else{const a=n===0?14264426:15778618,c=new X(new At(.55,10,8),xe(a));c.position.y=.55,c.scale.set(1.1,.95,1.2),e.add(c)}const i=st[n],s=new X(new ys(.85,24),new _e({color:i,transparent:!0,opacity:.4,side:yt,depthWrite:!1}));s.rotation.x=-Math.PI/2,s.position.y=.04,e.add(s);const r=new X(new gi(.82,1.02,28),new _e({color:i,transparent:!0,opacity:.95,side:yt,depthWrite:!1}));r.rotation.x=-Math.PI/2,r.position.y=.05,e.add(r);const o=new X(new At(.2,10,8),new _e({color:i}));return o.position.y=2,e.add(o),e}function dT(n,e){const t=e==="top"?-fn:fn,i=n===0?-60:Pe.hw-10,s=n===0?Pe.hw-5:-65;return[new S(i,0,t),new S(0,0,t),new S(s,0,t),new S(s,0,0)]}function fT(n,e){if(m.minions.length>hT)return;const t=n0(n),i=m.crystals[n].pos;t.position.set(i.x+(n===0?2:-2),0,i.z+(e==="top"?-1:1)*2),m.scene.add(t),m.minions.push({isMinion:!0,nid:m._mid=(m._mid||0)+1,team:n,lane:e,mesh:t,pos:t.position,def:{name:"a minion"},hp:70,maxHp:70,dmg:7,range:1.8,atkCd:1,atkTimer:0,speed:4.6,aggro:7,path:dT(n,e),wp:0,dead:!1,flash:0,radius:.6})}function pT(){[0,1].forEach(n=>["top","bot"].forEach(e=>{for(let t=0;t<cT;t++)m.minionQueue.push({team:n,lane:e,t:t*uT})}))}function mT(n){if(m.running){m.minionTimer-=n,m.minionTimer<=0&&(m.minionTimer=lT,pT());for(let e=m.minionQueue.length-1;e>=0;e--)if(m.minionQueue[e].t-=n,m.minionQueue[e].t<=0){const t=m.minionQueue.splice(e,1)[0];fT(t.team,t.lane)}}for(let e=m.minions.length-1;e>=0;e--){const t=m.minions[e];if(t.dead){m.scene.remove(t.mesh),m.minions.splice(e,1);continue}t.atkTimer-=n,t.flash>0&&(t.flash-=n);let i=null,s=t.aggro*t.aggro;m.entities.forEach(r=>{if(r.team!==t.team&&!r.dead&&!(r.invisT>0)){const o=ke(r.pos,t.pos);o<s&&(s=o,i=r)}});for(const r of m.minions)if(r.team!==t.team&&!r.dead){const o=ke(r.pos,t.pos);o<s&&(s=o,i=r)}if(!i){const r=t.team===0?1:0,o=m.goals.filter(c=>c.team!==t.team&&!c.dead&&Gi(c));!m.crystals[r].dead&&Gi(m.crystals[r])&&o.push(m.crystals[r]);let a=(t.aggro+3)*(t.aggro+3);o.forEach(c=>{const l=ke(c.pos,t.pos);l<a&&(a=l,i=c)})}if(i){const r=t.range+(i.isCrystal?2.4:i.isGoal?2.2:i.radius||.6),o=i.pos.x-t.pos.x,a=i.pos.z-t.pos.z,c=Math.hypot(o,a)||1;c>
3649r?(t.pos.x+=o/c*t.speed*n,t.pos.z+=a/c*t.speed*n,t.mesh.rotation.y=Math.atan2(o,a)+Math.PI):t.atkTimer<=0&&(t.atkTimer=t.atkCd,ft(i,t.dmg,t),De(i.pos,st[t.team],2,4))}else{const r=t.path[Math.min(t.wp,t.path.length-1)],o=r.x-t.pos.x,a=r.z-t.pos.z,c=Math.hypot(o,a)||1;c<2&&t.wp<t.path.length-1&&t.wp++,t.pos.x+=o/c*t.speed*n,t.pos.z+=a/c*t.speed*n,t.mesh.rotation.y=Math.atan2(o,a)+Math.PI}rn(t.pos,.6),t.mesh.position.y=Math.abs(Math.sin(performance.now()*.011+e))*.12}}function i0(n,e){const t=n===0?-63:Pe.hw-7;return new S(t,0,(e-1)*4)}function gT(n,e){let t;if(e==="mid"){const i=Math.random()<.5?-1:1,s=i*fn;t=[[-52,0],[-16,0],[16,0],[21,i*19],[20,s],[45,s],[63,0]]}else{const i=e==="top"?-fn:fn;t=[[-52,i],[-20,i],[20,i],[52,i],[63,0]]}return n===1&&(t=t.map(i=>[-i[0],i[1]])),t.map(i=>new S(i[0],0,i[1]))}function Ws(n,e,t,i=!1,s=0,r="mid"){const o=pt[n],a=ls[n][i?s:0]||ls[n][0],c=a.c,l=a.model&&$t[a.model]?a.model:n,u=!!$t[l],h=u?bs($t[l]):Tm[o.arch](c),d=u?h.children[0]:null,f=new X(new gi(.9,1.15,24),new _e({color:st[e],side:yt,transparent:!0,opacity:.85}));f.rotation.x=-Math.PI/2,f.position.y=.03,h.add(f);const p=Lo(e);p.position.y=2.9,h.add(p),h.position.copy(i0(e,t)),e===1&&(h.rotation.y=Math.PI),m.scene.add(h);const b=[];h.traverse(_=>{_.isMesh&&_.material&&_.material.emissive!==void 0&&(i&&(_.material.transparent=!0,_.material.opacity=1),_.material.userData.origEmissive=_.material.emissive.getHex(),b.push(_.material))});let w=null,v=null,y=!1;const E=h.userData.clips;if(E&&E.length){w=new Ah(h);const _=W=>E.find(Z=>W.some(q=>Z.name.toLowerCase().includes(q)))||null,D=_(["idle","stand","breath"]),F=_(["run","walk","move","sprint","gallop"])||D||E[0],H=_(["attack","punch","bite","slash","hit","shoot","kick","swipe"]);y=!D,v={idle:D?w.clipAction(D):null,run:w.clipAction(F),attack:H?w.clipAction(H):null,attackDur:H?Math.min(H.duration,.6):0},v.idle&&v.idle.play()}let L=null;if(w&&AT.has(n)){const _={};h.traverse(F=>{F.isBone&&(_[F.name]=F)});const D=_.RightArm||_.mixamorigRightArm||_.rightArm;D&&(L={arm:D,forearm:_.RightForeArm||_.mixamorigRightForeArm||null})}const C=i?Math.round(o.hp*1.18):o.hp;return{key:n,def:o,team:e,slot:t,isPlayer:i,mesh:h,bar:p,mats:b,inner:d,innerBaseZ:d?d.position.z:0,innerBaseY:d?d.position.y:0,innerScale:d?d.scale.x:1,castAnim:null,walkPhase:0,pos:h.position,hp:C,maxHp:C,baseHp:C,level:1,xp:0,up:{dmg:0,spd:0,atkspd:0,cdr:0,leech:0,dr:0,hp:0,regen:0,block:0},atkTimer:0,qTimer:0,eTimer:0,flash:0,dead:!1,respawnT:0,dash:null,dashHit:null,radius:1,lane:r,path:gT(e,r),wpIndex:0,wanderT:0,wanderOff:new S,bush:-1,retreating:!1,buffs:{dmg:0,spd:0,boss:0},mixer:w,actions:v,restIdle:y,animState:"idle",attackAnimT:0,moving:!1,armBones:L,swingT:0,swingDur:.3,swingSign:1}}const s0={dmg:0,spd:0};function Cr(n){const e=n.up||s0,t=n.level||1;return(n.buffs.dmg>0?1.3:1)*(n.buffs.boss>0?1.25:1)*wT(n.team)*(n.isPlayer&&!m.online?1.12:1)*(1+(t-1)*.06+e.dmg)}function Po(n){const e=n.up||s0;return(n.buffs.spd>0?1.25:1)*(n.shellT>0?1.7:1)*(1+e.spd)}function r0(n){let e=n.def.atkCd*(1-(n.up?n.up.atkspd:0));return n.invisT>0&&(e*=1/1.35),e}function o0(n){return 1-(n.up?n.up.cdr:0)}const ro=9;function Va(n){return 12+(n-1)*8}function a0(n,e){const t=n.maxHp;n.maxHp=Math.round(n.baseHp*(1+((n.level||1)-1)*.08+(n.up?n.up.hp:0))),n.hp+=n.maxHp-t,n.hp>n.maxHp&&(n.hp=n.maxHp)}function ts(n,e){if(!(!n||n.dead||n.neutral||!n.up||n.level>=ro)){for(n.xp+=e;n.level<ro&&n.xp>=Va(n.level);)n.xp-=Va(n.level),xT(n);n.level>=ro&&(n.xp=0)}}function xT(n){n.level++,a0(n);const e={2:0,4:1,6:2,8:3};e[n.level]!==void 0&&yT(n,e[n.level]),n.isPlayer&&(yn(n.pos,2.6,16767053,.5),De(n.pos,16767053,14,10),di(n.level===3?"🔓 Q ABILITY UNLOCKED":"LEVEL "+n.level),yo([659,880,1175]))}const If={melee:[{name:"BLOODLUST",desc:"heal 9% of damage dealt",apply:n=>{n.up.leech+=.09}},{name:"BULK UP",desc:"+14% max HP",apply:n=>{n.up.hp+=.135,a0(n)}},{name:"RAMPAGE",desc:"+9% move speed",apply:n=>{n.up.spd+=.09}},{name:"JUGGERNAUT",desc:"-10% damage taken",apply:n=>{n.up.dr=Math.min(.5,n.up.dr+.1)}}],ranged:[{name:"QUICKDRAW",desc:"+10% attack speed",apply:n=>{n.up.atkspd=Math.min(.5,n.up.atkspd+.1)}},{name:"SHARPSHOT",desc:"+9% damage",apply:n=>{n.up.dmg+=.09}},{name:"RAPID FIRE",desc:"+10% attack speed",apply:n=>{n.up.atkspd=Math.min(.5,n.up.atkspd+.1)}},{name:"EXECUTIONER",desc:"+12% damage",apply:n=>{n.up.dmg+=.12}}],mage:[{name:"QUICKCAST",desc:"-12% ability cooldown",apply:n=>{n.up.cdr=Math.min(.5,n.up.cdr+.12)}}
3649,{name:"MANA WEAVE",desc:"regen 0.9% max HP per sec",apply:n=>{n.up.regen+=.009}},{name:"ARCANE WARD",desc:"block 3 damage per hit",apply:n=>{n.up.block+=3}},{name:"OVERCLOCK",desc:"-12% ability cooldown",apply:n=>{n.up.cdr=Math.min(.5,n.up.cdr+.12)}}]};function yT(n,e){const i=(If[n.def.arch]||If.melee)[e];i&&(i.apply(n),n.isPlayer&&di("⬆ "+i.name+" — "+i.desc))}function l0(){return[]}function vT(){if(m.choosing||!(m.pickQueue>0))return;m.pickQueue--,m.pendingCards=l0();const n=document.getElementById("upgradeCards");n.innerHTML="",m.pendingCards.forEach((e,t)=>{const i=document.createElement("div");i.className="upgradeCard",i.innerHTML=`<div class="uName">${e.name}</div><div class="uDesc">${e.desc}</div><div class="uKey">${t+1}</div>`,i.onclick=()=>c0(t),n.appendChild(i)}),m.choosing=!0,document.getElementById("upgradePick").style.display="flex"}function c0(n){!m.choosing||!m.pendingCards||!m.pendingCards[n]||(m.pendingCards[n].apply(m.player),m.pendingCards=null,m.choosing=!1,document.getElementById("upgradePick").style.display="none",ze(1046,.1),vT())}function bT(n){if(n.draftCards){n.draftQueue=(n.draftQueue||0)+1;return}const e=l0();n.draftCards=e,n.draftT=16,K.send({t:"draft",to:n.netId,cards:e.map(t=>({id:t.id,name:t.name,desc:t.desc}))})}function h0(n,e){if(!n.draftCards)return;(e!=null&&n.draftCards[e]?n.draftCards[e]:n.draftCards[Math.floor(Math.random()*n.draftCards.length)]).apply(n),n.draftCards=null,n.draftT=0,n.draftQueue>0&&(n.draftQueue--,bT(n))}function wT(n){if(n!==0&&n!==1)return 1;const e=m.goals.filter(s=>s.team===n&&s.dead).length,t=m.goals.filter(s=>s.team===(n^1)&&s.dead).length,i=e-t;return i>0?1+Math.min(i,4)*.08:1}function u0(n){for(let e=0;e<cs.length;e++){const t=cs[e];if(Math.abs(n.x-t.x)<=t.hw&&Math.abs(n.z-t.z)<=t.hd)return e}return-1}function qa(n,e){return n.invisT>0&&n.team!==e?!1:n.bush<0?!0:m.entities.some(t=>t.team===e&&!t.dead&&(t.bush===n.bush||ke(t.pos,n.pos)<6.25))}function ga(n,e){n.buffs[e]=is[e].dur,n.isPlayer&&Je(`${is[e].label} buff — ${is[e].desc}`),yn(n.pos,2.2,is[e].color,.5)}function ft(n,e,t){if(!m.vfxOnly&&!n.dead&&!((n.isCrystal||n.isGoal)&&!Gi(n))){if((n.isCrystal||n.isGoal)&&m.overtime&&(e*=m.matchTime>585?6:m.matchTime>555?3.5:2),n.up&&n.up.dr>0&&(e*=1-n.up.dr),n.up&&n.up.block>0&&(e=Math.max(1,e-n.up.block)),n.hp-=e,(n.isGoal||n.isCrystal)&&t&&t.team!==n.team&&(t.team===0||t.team===1)&&m.turretDmg&&(m.turretDmg[t.team]+=e),n.channeling&&(n.channeling=!1,n.isPlayer&&Je("🏠 Recall interrupted!")),t&&t.up&&t.up.leech>0&&!n.isCrystal&&!n.isGoal&&(t.hp=Math.min(t.maxHp,t.hp+e*t.up.leech)),n.flash=.09,ml(n.pos,e,t&&t.isPlayer?"#ffd84d":n.isPlayer?"#ff5d6c":"#f0eaff"),De(n.pos,t&&t.team===0?16767053:16743820,4,6),n.isGoal){if(n.hp<=0){n.hp=0,n.dead=!0,n.bar.visible=!1,n.mesh.traverse(r=>{r.isMesh&&r.material&&r.material.emissive&&(r.material.emissive.setHex(0),r.material.color.setHex(4867680))}),pa(n.pos,st[n.team]),De(n.pos,st[n.team],16,13),fi(n.pos,14209728,7),yn(n.pos,6,st[n.team],.5);const i=n.team===0,s=`${n.lane.toUpperCase()} ${n.tier===1?"OUTER":"INNER"}`;Ri(`${n.team===0?"🔵 BLUE":"🔴 RED"} ${s} GOAL DESTROYED`),t&&!t.neutral&&t.team!==n.team&&ts(t,6),!i&&t&&t.isPlayer&&Je("💥 Goal zone destroyed!"),ze(i?150:620,.3)}return}if(n.isCrystal){if(n.gem.scale.setScalar(.85+.3*(n.hp/n.maxHp)),n.hp<=0){n.hp=0;const i=n.team===0?1:0;m.netHost&&K.send({t:"over",team:i}),Mo(i===(m.player?m.player.team:0))}return}if(n.neutral){if(n.target===null&&t&&!t.neutral&&(n.target=t,n.state="aggro"),n.hp<=0)if(n.hp=0,n.dead=!0,n.mesh.visible=!1,pa(n.pos,n.isBoss?16767053:12868863),n.isBoss){n.flop&&n.flop.tele&&(m.scene.remove(n.flop.tele),n.flop.tele.material.dispose()),m.boss=null,m.bossTimer=ZM;const i=t?t.team:0;m.entities.filter(s=>s.team===i).forEach(s=>{ga(s,"boss"),ts(s,14)}),ft(m.crystals[i===0?1:0],150,t),Ri(`👑 ${i===0?"🔵 BLUE":"🔴 RED"} TEAM SLAYED THE DUVE`),i===0&&Je("👑 The Duve slain — team buffed!"),m.neutrals.splice(m.neutrals.indexOf(n),1),ze(i===0?700:130,.4)}else{const i=n.kind==="elite";n.respawnT=i?75:KM,t&&!t.neutral&&(i?(ga(t,"dmg"),ga(t,"spd")):ga(t,n.kind),ts(t,i?9:4),t.isPlayer&&Je(i?"Elite camp slain!":"Camp cleared!")),ze(i?200:260,i?.2:.1)}return}if(n.isMinion){n.hp<=0&&(n.dead=!0,pa(n.pos,st[n.team]),t&&t.up&&ts(t,3));return}if(n.hp<=0){if(n.hp=0,n.dead=!0,n.mesh.visible=!1,n.respawnT=4+M
3649ath.min(8,m.matchTime/25),n.buffs={dmg:0,spd:0,boss:0},n.invisT=0,n.shellMesh&&(m.scene.remove(n.shellMesh),n.shellMesh=null),n.shellT=0,pa(n.pos,st[n.team]),ze(n.team===1?520:180,.15),n.dash=null,n.dashHit=null,n.deaths=(n.deaths||0)+1,t&&!t.neutral&&!t.isStruct&&t.def&&(t.kills=(t.kills||0)+1),n.team===1&&t&&t.isPlayer&&m.matchStats.kills++,n.isPlayer&&m.matchStats.deaths++,t&&!t.neutral&&(ts(t,7),m.entities.forEach(i=>{i!==t&&i.team===t.team&&!i.dead&&ke(i.pos,n.pos)<225&&ts(i,3)})),!m.firstBlood&&t&&!t.neutral&&!t.isStruct&&(m.firstBlood=!0,Ri("🩸 FIRST BLOOD")),t&&!t.neutral&&!t.isStruct&&t.def){const i=m.matchTime,s=t.isPlayer||n.isPlayer;if((n.spree||0)>=3&&Ri(`💀 SHUTDOWN · ${t.isPlayer?"You":Ai(t)} ended ${Ai(n)}'s spree`),t.multiCount=i-(t.lastKillT??-99)<=10?(t.multiCount||1)+1:1,t.lastKillT=i,t.multiCount>=2&&(Ri({2:"⚔️ DOUBLE KILL",3:"🔥 TRIPLE KILL",4:"💥 QUADRA KILL",5:"🌟 PENTAKILL"}[Math.min(5,t.multiCount)]),s))try{yo([659,880,1175,1568],.06,.09)}catch{}t.spree=(t.spree||0)+1;const r={3:"🗡️ KILLING SPREE",5:"😤 RAMPAGE",7:"⛓️ UNSTOPPABLE",9:"👑 GODLIKE"};if(r[t.spree]&&(Ri(r[t.spree]),s))try{yo([523,659,784,1047,1319],.07,.09)}catch{}}if(n.spree=0,t&&t.isPlayer?Je(`You eliminated ${Ai(n)}`):!t||!t.neutral?Je(`${t?Ai(t):"??"} eliminated ${n.isPlayer?"YOU":Ai(n)}`):Je(`${n.isPlayer?"You were":Ai(n)+" was"} slain by the jungle`),n.isPlayer){document.getElementById("respawnMsg").style.display="block";let i="THE JUNGLE",s="🌲";t&&t.isStruct?(i=Ai(t),s="🏰"):t&&!t.neutral&&t.def&&(i=Ai(t),s=t.def.face||"💀"),i=String(i).replace(/[<>&]/g,"");const r=document.getElementById("killRecap");r&&(r.innerHTML=`<span class="krFace">${s}</span>ELIMINATED BY <b>${i}</b>`,r.style.display="flex")}}}}function xl(){const n=document.getElementById("respawnMsg");n&&(n.style.display="none");const e=document.getElementById("killRecap");e&&(e.style.display="none")}function Ai(n){return n&&n.uname||n&&n.def&&n.def.name||"??"}function d0(n){const e=m.player;if(e&&!e.dead&&m.running){m.rangeRing||(m.rangeRing=new X(new gi(.965,1,56),new _e({transparent:!0,opacity:.14,side:yt,depthWrite:!1})),m.rangeRing.rotation.x=-Math.PI/2,m.rangeRing.renderOrder=1,m.scene.add(m.rangeRing));const t=e.def.range+(e.def.arch==="melee"?.5:0);m.rangeRing.visible=!0,m.rangeRing.position.set(e.pos.x,.04,e.pos.z),m.rangeRing.scale.set(t,t,1),m.rangeRing.material.color.setHex(e.def.arch==="melee"?16764794:9427199),m.rangeRing.material.opacity=.11+.05*Math.sin(performance.now()*.004)}else m.rangeRing&&(m.rangeRing.visible=!1);if(m.reticle){const t=e&&!e.dead&&m.running;m.reticle.visible=t,t&&(m.reticle.position.set(_t.x,.06,_t.z),m.reticle.rotation.y+=n*1.5)}}function Rt(n){return m.entities.filter(e=>e.team!==n&&!e.dead).concat(m.neutrals.filter(e=>!e.dead)).concat(m.minions.filter(e=>e.team!==n&&!e.dead)).concat(m.goals.filter(e=>e.team!==n&&!e.dead)).concat([m.crystals[n===0?1:0]])}const MT={alon:{color:5895136,arc:.7,span:Math.PI/2.8,jab:!0},remus:{color:16735596,arc:.25,span:Math.PI/1.5,claw:!0},troll:{color:10351198,arc:.1,span:Math.PI/1.4,shock:!0,splash:.45},hash:{color:12078591,arc:.3,span:Math.PI/1.6,claw:!0,lifesteal:.3,wisp:!0},turtle:{color:5882099,arc:.2,span:Math.PI/2,knock:1.6,thump:!0},ansem:{color:16771488,arc:.28,span:Math.PI/1.7,knock:1.4,beam:!0}};function _T(n,e,t,i,s,r){const o=MT[r]||{color:16771488,arc:i,span:Math.PI/2},a=new S(e.x-n.pos.x,0,e.z-n.pos.z).normalize();let c=!1;Rt(n.team).forEach(f=>{const p=new S(f.pos.x-n.pos.x,0,f.pos.z-n.pos.z),b=p.length();b<t+(f.isCrystal?1.6:f.radius>1?1:0)&&(b<.8||p.normalize().dot(a)>o.arc)&&(ft(f,s,n),c=!0,o.lifesteal&&!f.isCrystal&&!f.isGoal&&(n.hp=Math.min(n.maxHp,n.hp+s*o.lifesteal)),o.knock&&!f.isCrystal&&!f.isGoal&&!f.isBoss&&b>.1&&(f.pos.x+=p.x/b*o.knock,f.pos.z+=p.z/b*o.knock,rn(f.pos,f.radius||1),un(f.pos,f.radius||1)),o.splash&&Rt(n.team).forEach(w=>{w!==f&&!w.isCrystal&&!w.isGoal&&ke(w.pos,f.pos)<9&&ft(w,s*o.splash,n)}))});const l=o.span,u=l/2,h=new X(new gi(t*.45,t*1.05,20,1,-u,l),new _e({color:o.color,transparent:!0,opacity:.95,side:yt,depthWrite:!1}));if(h.rotation.x=-Math.PI/2,h.position.set(n.pos.x,.5,n.pos.z),h.rotation.z=Math.atan2(-a.z,a.x),m.scene.add(h),m.effects.push({mesh:h,life:o.jab?.12:.18,maxLife:o.jab?.12:.18,grow:o.jab?1.3:1.9}),o.claw)for(const f of[-.32,.32]){const p=h.clone();p.material=h.material.clone(),p.rotation.z+=f,p.scale.setScalar(.82),m.scene.add(p),m.effects.push({mesh:p,life:.16,maxLife:.16,grow:1.7})}if(o.shock&&c){const f={x:n.pos.x+a.x*t*.8,z:n.pos.z+a.z*t*.8};pn(f,10351198,3,.28),vo(f,9405272,5,8),fi(f,11575418,4),m.shake=M
3649ath.max(m.shake||0,.22)}const d={x:n.pos.x+a.x*t*.7,z:n.pos.z+a.z*t*.7};if(De(d,c?o.color:16773824,c?o.jab?4:6:3,o.jab?8:6),o.thump&&c&&(yn(d,t*.9,o.color,.4),pn(d,o.color,2.4,.24),m.shake=Math.max(m.shake||0,.14)),o.wisp&&c)for(let f=0;f<3;f++)De({x:d.x+(Math.random()-.5)*2,z:d.z+(Math.random()-.5)*2},14196991,3,5);if(o.beam){const f=t*1.5,p=new X(new wt(.18,.18,f),new _e({color:16773280,transparent:!0,opacity:.9,depthWrite:!1}));p.position.set(n.pos.x+a.x*f*.5,1,n.pos.z+a.z*f*.5),p.rotation.y=Math.atan2(a.x,a.z),m.scene.add(p),m.effects.push({mesh:p,life:.14,maxLife:.14,grow:1.2}),De({x:n.pos.x+a.x*t,z:n.pos.z+a.z*t},16773280,6,9)}c&&Rm(o.shock||o.knock)}function ST(n,e){const t=new S(n.pos.x,2.6,n.pos.z),i=new S(e.pos.x,1,e.pos.z),s=new X(new wt(.15,.15,t.distanceTo(i)),new _e({color:st[n.team],transparent:!0,opacity:.9,depthWrite:!1}));s.position.copy(t).lerp(i,.5),s.lookAt(i),m.scene.add(s),m.effects.push({mesh:s,life:.12,maxLife:.12}),De(e.pos,st[n.team],4,6)}function ja(n){if(!n.rangeRing)return;const e=m.player,t=e&&!e.dead&&!n.dead&&ke(e.pos,n.pos)<(n.zapRange+5)*(n.zapRange+5);if(n.rangeRing.visible=t,t){const i=ke(e.pos,n.pos)<n.zapRange*n.zapRange;n.rangeRing.material.opacity=i?.5+.2*Math.sin(performance.now()*.012):.22}}function Bf(n,e){if(n.dead||m.matchTime>570)return;const t=n.zapRange,i=n.zapDmg;if(n.zapT=(n.zapT??0)-e,n.zapT>0)return;let s=null,r=t*t;m.minions.forEach(o=>{if(o.team===n.team||o.dead)return;const a=ke(o.pos,n.pos);a<r&&(r=a,s=o)}),m.entities.forEach(o=>{if(o.team===n.team||o.dead||o.invisT>0)return;const a=ke(o.pos,n.pos);a<r&&(r=a,s=o)}),s&&(n.zapT=.8,ft(s,i,{team:n.team,neutral:!1,isStruct:!0,def:{name:n.isCrystal?"THE VAULT":"GOAL ZONE"}}),ST(n,s),n.isCrystal?Rm(!0):$_())}const TT={swing:.26,shoot:.3,slam:.5,thrust:.34,leap:.5,pound:.55,cast:.5,hammer:.36};function ET(n,e){const t=Math.sin(Math.min(e,1)*Math.PI);switch(n){case"swing":return{f:t*.55,sy:1-.07*t,sx:1+.05*t};case"shoot":return{f:e<.3?-(e/.3)*.22:t*.42};case"slam":if(e<.35){const i=e/.35;return{f:-.35*i,sy:1-.12*i,sx:1+.09*i}}{const i=(e-.35)/.65,s=Math.sin(i*Math.PI);return{f:-.35*(1-i)+s*1,sy:1-.16*s,sx:1+.13*s}}case"thrust":if(e<.25)return{f:-.22*(e/.25)};{const i=(e-.25)/.75,s=Math.sin(i*Math.PI);return{f:-.22*(1-i)+s*1.25,sz:1+.25*s,sx:1-.08*s}}case"leap":if(e<.25){const i=e/.25;return{sy:1-.18*i,sx:1+.11*i}}{const i=(e-.25)/.75,s=Math.sin(i*Math.PI);return{up:s*1.5,sy:1+.14*s,sx:1-.07*s}}case"pound":if(e<.45){const i=e/.45;return{up:i*1.3,sy:1+.16*i}}{const i=(e-.45)/.55,s=1-i;return{up:s*1.3,sy:1+.16*s-.22*(1-s),sx:1+.18*(1-s)}}case"cast":return{up:t*.7,sy:1+.09*t};case"hammer":if(e<.32){const i=e/.32;return{f:-.16*i,up:.13*i,rot:-.38*i}}{const i=(e-.32)/.68,s=Math.sin(i*Math.PI);return{f:.52*s,up:-.04*s,rot:.95*s-.38*(1-i)}}}return{}}function f0(n,e){if(!n.inner)return;const t=n.innerScale||1;if(!n.castAnim){n.inner.position.z=n.innerBaseZ,n.inner.position.y=n.innerBaseY,n.inner.scale.setScalar(t),n.inner.rotation.x=0;return}const i=n.castAnim;i.t+=e;const s=i.t/i.dur;if(s>=1){n.castAnim=null,n.inner.position.z=n.innerBaseZ,n.inner.position.y=n.innerBaseY,n.inner.scale.setScalar(t),n.inner.rotation.x=0;return}const r=ET(i.type,s);n.inner.position.z=n.innerBaseZ-(r.f||0),n.inner.position.y=n.innerBaseY+(r.up||0),n.inner.scale.set(t*(r.sx||1),t*(r.sy||1),t*(r.sz||1)),n.inner.rotation.x=r.rot||0}const AT=new Set(["ansem"]),Df=new Dt,xa=new Dt,bc=new S,wc=2.2,kf=.5;function LT(n){if(n<.34){const t=n/.34;return wc*t*t}if(n<.78){const t=(n-.34)/.44;return wc-(wc+kf)*Math.sin(t*Math.PI*.5)}const e=(n-.78)/.22;return-kf*(1-e)}function CT(n){const e=n.armBones;if(!e||!e.arm||!e.arm.parent)return;const t=Math.min(1,1-Math.max(0,n.swingT)/n.swingDur),i=LT(t)*(n.swingSign||1);e.arm.parent.getWorldQuaternion(Df),n.mesh.getWorldQuaternion(xa),bc.set(1,0,0).applyQuaternion(xa),bc.applyQuaternion(Df.invert()).normalize(),xa.setFromAxisAngle(bc,i),e.arm.quaternion.premultiply(xa)}function zt(n,e){n.castAnim={type:e,t:0,dur:TT[e]||.4},n.attackAnimT=n.actions&&n.actions.attack?n.actions.attackDur:0,e==="swing"&&n.armBones&&(n.swingT=n.swingDur)}function p0(n,e){n.def.hover?(n.mesh.position.y=.3+Math.sin(performance.now()*.0015+n.slot*2)*.18,n.mesh.rotation.z=Math.sin(performance.now()*.001+n.slot)*.04):n.moving?(n.walkPhase+=e*11,n.mesh.position.y=Math.abs(Math.sin(n.walkPhase))*.14,n.mesh.rotation.z=Math.sin(n.walkPhase)*.085):(n.mesh.position.y=Math.abs(Math.sin(performance.now()*.002+n.slot*2))*.04,n.mesh.rotation.z*=Math.max(0,1-e*8))}function RT(n){if(n.shellT=10,n.shellPulse=0,n.shellMesh)return;let e;if($t.qshell)e=bs($t.qshell),e.scale.multiplyScalar(.7);else{e=new Fe;const t=new X(new At(1.1,16,10,0,Math.PI*2,0,Math.PI/2),xe(9067050,{}));t.scale.y=.8,t.position.y=.1,e.add(t);const i=new X(new Up(1.05,.18,8,20),xe(7029794,{}));i.rotation.x=Math.PI/2,i.position.y=.18,e.add(i)}e.position.set(n.pos.x,0,n.pos.z),m.scene.add(e),n.shellMesh=e,n.mesh.visible=!1,pn(n.pos,10351198,3,.4),De(n.pos,9429135,12,9),n.isPlayer&&Je("🐢 SHELLSHOCK — spin to win!"),ze(220,.1)}function PT(n,e){if(!(n.shellT>0))return;n.shellT-=e,n.shellMesh&&(n.shellMesh.position.set(n.pos.x,0,n.pos.z),n.shellMesh.rotation.y+=e*16);const t=n.pos.x-(n.shellLastX??n.pos.x),i=n.pos.z-(n.shellLastZ??n.pos.z);
3649if(n.shellLastX=n.pos.x,n.shellLastZ=n.pos.z,n.shellDust=(n.shellDust||0)-e,t*t+i*i>3e-4&&n.shellDust<=0&&m.effects.length<300){n.shellDust=.05;const s=new X(new At(.35,7,6),new _e({color:13483936,transparent:!0,opacity:.32,depthWrite:!1}));s.position.set(n.pos.x-t*5+(Math.random()-.5)*.5,.3,n.pos.z-i*5+(Math.random()-.5)*.5),m.scene.add(s),m.effects.push({mesh:s,life:.4,maxLife:.4,grow:1.7,alpha:.32,vel:new S(0,.7,0),grav:!1})}if(n.shellPulse=(n.shellPulse||0)-e,n.shellPulse<=0){n.shellPulse=.45;const s=Cr(n);Rt(n.team).forEach(r=>{if(ke(r.pos,n.pos)<10&&(ft(r,16*s,n),!r.isCrystal&&!r.isGoal&&!r.isBoss)){const o=r.pos.x-n.pos.x,a=r.pos.z-n.pos.z,c=Math.hypot(o,a)||.1;r.pos.x+=o/c*1.3,r.pos.z+=a/c*1.3,rn(r.pos,r.radius||1),un(r.pos,r.radius||1)}}),De(n.pos,10351198,5,6)}n.shellT<=0&&(n.shellMesh&&(m.scene.remove(n.shellMesh),n.shellMesh=null),n.mesh.visible=!0)}function yl(n,e){if(n.shellT>0||n.dead)return;if(!m.vfxOnly){if(n.atkTimer>0)return;n.atkTimer=r0(n),m._castOut&&m._castOut.push({i:m.entities.indexOf(n),k:"b",ax:e.x,az:e.z})}zt(n,n.key==="ozzie"?"hammer":n.def.arch==="melee"?"swing":"shoot");const t=new S(e.x-n.pos.x,0,e.z-n.pos.z);t.lengthSq()<.001&&t.set(1,0,0);const i=n.def.dmg*Cr(n);n.key==="chudhouse"?(Kt(n,n.pos,t,{kind:"brick",color:12608058,dmg:i,speed:19,life:.6}),hn(300)):n.key==="chillhouse"?(Kt(n,n.pos,t,{kind:"ice",color:12577023,dmg:i,speed:22,life:.6}),hn(700)):n.key==="chud"?(Kt(n,n.pos,t,{kind:"patty",color:14260814,dmg:i,speed:22,life:.6}),hn(540)):n.key==="wizard"?(Kt(n,n.pos,t,{kind:"smoke",color:14212322,dmg:i,speed:20,life:.8,y:1.7}),hn(180)):n.key==="degen"?(Kt(n,n.pos,t,{kind:"shuriken",color:12174036,dmg:i,speed:23,life:.65}),hn(820)):n.key==="spligga"?(Kt(n,n.pos,t,{kind:"dart",color:12868863,dmg:i,speed:22,life:.65}),hn(460)):n.key==="jester"?(Kt(n,n.pos,t,{kind:"card",color:16731469,dmg:i,speed:23,life:.65}),hn(520)):n.key==="taxes"?(Kt(n,n.pos,t,{kind:"bill",color:7131258,dmg:i,speed:21,life:.7}),hn(360)):n.key==="pocket"?(Kt(n,n.pos,t,{kind:"ki",color:5884159,dmg:i,speed:26,life:.7}),hn(760)):n.key==="wapital"?(Kt(n,n.pos,t,{kind:"berry",color:16731498,dmg:i,speed:21,life:.7}),hn(480)):n.key==="ozzie"?(Kt(n,n.pos,t,{kind:"feather",color:9429066,dmg:i,speed:22,life:.7,y:1.4}),hn(600)):n.def.arch==="melee"?(Q_(),_T(n,e,n.def.range,.3,i,n.key)):n.def.arch==="mage"?(Kt(n,n.pos,t,{color:10351198,dmg:i,speed:17,size:.34,life:.9}),hn(220)):(Kt(n,n.pos,t,{color:5895136,dmg:i,speed:24,size:.2,life:.55}),hn(660))}function vl(n,e){if(n.dead)return;if(!m.vfxOnly){if(n.qTimer>0)return;if((n.level||1)<3){n.isPlayer&&Je("🔒 Q unlocks at LEVEL 3");return}n.qTimer=n.def.qCd*o0(n),m._castOut&&m._castOut.push({i:m.entities.indexOf(n),k:"q",ax:e.x,az:e.z})}zt(n,"cast");const t=Cr(n);if(n.key==="chudhouse"){zt(n,"slam");const i=new S(e.x,0,e.z),s=i.clone().sub(n.pos);s.length()>11&&i.copy(n.pos).add(s.normalize().multiplyScalar(11)),xc(i,"qhouse",()=>{const r=new Fe;r.add(new X(new wt(2.4,1.8,2.4),xe(14205088,{})));const o=new X(new Tn(2,1.3,4),xe(11553328,{}));return o.position.y=1.55,o.rotation.y=Math.PI/4,r.add(o),r},1.4),m.delayed.push({t:.32,fn:()=>{pn(i,14205096,4.2,.4),fi(i,14205096,8),De(i,12608058,14,9),vo(i,11029040,12,10),m.shake=Math.max(m.shake||0,.34),Rt(n.team).forEach(r=>{const o=r.isCrystal?7:0;ke(r.pos,i)<11+o&&ft(r,50*t,n)}),n.isPlayer&&Je("🏚️ FORECLOSED!"),ze(90,.16)}}),ze(340,.06);return}if(n.def.arch==="melee"){const i=new S(e.x-n.pos.x,0,e.z-n.pos.z);if(i.lengthSq()<.001&&i.set(1,0,0),i.normalize(),zt(n,n.key==="alon"?"thrust":n.key==="remus"||n.key==="ansem"?"leap":"pound"),n.key==="alon"){const s=Math.min(7.5,Math.max(3.5,Math.sqrt(ke(e,n.pos)))),r={x:n.pos.x+i.x*s*.5,z:n.pos.z+i.z*s*.5};Rt(n.team).forEach(a=>{ke(a.pos,r)<11&&ft(a,40*t,n)});for(let a=0;a<6;a++){const c=a/5;ii({x:n.pos.x+i.x*s*c,z:n.pos.z+i.z*s*c},16751178,2,.8)}n.pos.x+=i.x*s,n.pos.z+=i.z*s,rn(n.pos,n.radius),un(n.pos,n.radius);const o={x:n.pos.x,z:n.pos.z};xc(o,"qrocket",()=>{const a=new Fe;a.add(new X(new dn(.32,.42,1.6,10),xe(15658734)));const c=new X(new Tn(.34,.7,10),xe(16728128));return c.position.y=1.1,a.add(c),[0,1,2].forEach(l=>{const u=new X(new wt(.1,.5,.45),xe(16728128));u.position.set(Math.cos(l*2.1)*.42,-.7,Math.sin(l*2.1)*.42),a.add(u)}),a},.7,Math.PI),m.delayed.push({t:.26,fn:()=>{De(o,16747837,16,11),ii(o,16753226,6,3);for(let a=0;a<5;a++)DS({x:o.x+(Math.random()-.5)*5,z:o.z+(Math.random()-.5)*5},a===0);
3649m.shake=Math.max(m.shake||0,.3),ze(110,.14)}}),ze(700,.1)}else if(n.key==="remus"){const s=Math.min(8,Math.max(3.5,Math.sqrt(ke(e,n.pos))));n.pos.x+=i.x*s,n.pos.z+=i.z*s,rn(n.pos,n.radius),un(n.pos,n.radius);let r=0;Rt(n.team).forEach(o=>{const a=o.isCrystal?6:0;ke(o.pos,n.pos)<22+a&&(ft(o,42*t,n),!o.isCrystal&&!o.isGoal&&!o.isBoss&&(o.slowT=Math.max(o.slowT||0,1.2),o.slowFactor=.6,r<3&&(_f(o.pos),r++)))}),r===0&&_f({x:n.pos.x+i.x*2.2,z:n.pos.z+i.z*2.2}),De(n.pos,16722474,12,11),m.shake=Math.max(m.shake||0,.26),n.isPlayer&&Je("💯 100% SELL!"),ze(220,.12)}else if(n.key==="troll")zS(n.pos),ii(n.pos,10351198,5,2.2),De(n.pos,10351198,12,10),m.shake=Math.max(m.shake||0,.3),Rt(n.team).forEach(r=>{const o=r.isCrystal?8:0;if(ke(r.pos,n.pos)<5.5*5.5+o&&(ft(r,38*t,n),!r.isCrystal&&!r.isGoal&&!r.isBoss)){const a=n.pos.x-r.pos.x,c=n.pos.z-r.pos.z,l=Math.hypot(a,c)||.1,u=Math.min(l-1.2,4);u>0&&(r.pos.x+=a/l*u,r.pos.z+=c/l*u,rn(r.pos,r.radius||1),un(r.pos,r.radius||1)),r.slowT=Math.max(r.slowT||0,1.6),r.slowFactor=.55}}),ze(120,.14);else if(n.key==="hash"){let r=0;Rt(n.team).forEach(o=>{const a=new S(o.pos.x-n.pos.x,0,o.pos.z-n.pos.z),c=a.length();c<6.5+(o.isCrystal?1.6:0)&&(c<1.2||a.clone().normalize().dot(i)>.1)&&(ft(o,46*t,n),r++,!o.isCrystal&&!o.isGoal&&!o.isBoss&&(o.slowT=Math.max(o.slowT||0,1),o.slowFactor=.6))}),n.hp=Math.min(n.maxHp,n.hp+r*16+n.maxHp*.06),IS(n.pos,i,16726843,5),pn({x:n.pos.x+i.x*3,z:n.pos.z+i.z*3},9050650,4,.34),ii(n.pos,2756640,5,2.2),De({x:n.pos.x+i.x*3,z:n.pos.z+i.z*3},16726843,14,11),m.shake=Math.max(m.shake||0,.24),n.isPlayer&&Je("☠️ SOUL REAP!"),ze(160,.13)}else if(n.key==="ansem"){const s=Math.min(6,Math.max(2.5,Math.sqrt(ke(e,n.pos))*.6));n.pos.x+=i.x*s,n.pos.z+=i.z*s,rn(n.pos,n.radius),un(n.pos,n.radius);const r=6;Rt(n.team).forEach(o=>{const a=new S(o.pos.x-n.pos.x,0,o.pos.z-n.pos.z),c=a.length();c<r+(o.isCrystal?1.6:o.radius>1?1:0)&&(c<1.6||a.clone().normalize().dot(i)>-.1)&&(ft(o,46*t,n),!o.isCrystal&&!o.isGoal&&!o.isBoss&&c>.1&&(o.pos.x+=a.x/c*2.5,o.pos.z+=a.z/c*2.5,rn(o.pos,o.radius||1),un(o.pos,o.radius||1)))}),yn(n.pos,r*.7,16767053,.5),pn({x:n.pos.x+i.x*3,z:n.pos.z+i.z*3},16771488,4,.34),De({x:n.pos.x+i.x*2.6,z:n.pos.z+i.z*2.6},16773280,16,11),m.shake=Math.max(m.shake||0,.26),n.isPlayer&&Je("🔑 SEND IT!"),ze(300,.1)}else RT(n)}else if(n.def.arch==="mage"){const i=new S(e.x,0,e.z),s=i.clone().sub(n.pos);s.length()>14&&i.copy(n.pos).add(s.normalize().multiplyScalar(14));const r=(o,a)=>Rt(n.team).forEach(c=>{const l=c.isCrystal?7:0;ke(c.pos,i)<o+l&&ft(c,a*t,n)});if(n.key==="spligga"){zt(n,"cast");const o=i.clone().sub(n.pos);o.lengthSq()<.01&&o.set(0,0,-1),o.normalize();for(let a=0;a<4;a++){const c={x:i.x-o.x*(4-a)*1.3,z:i.z-o.z*(4-a)*1.3};m.delayed.push({t:a*.05,fn:()=>pf(c,!1)})}pf(i,!0),m.delayed.push({t:.18,fn:()=>{mf(i,16722474),mf(i,16743034)}}),m.delayed.push({t:.22,fn:()=>{r(13,58),pn(i,16726843,3.6,.36),De(i,16726843,16,9),m.shake=Math.max(m.shake||0,.26),ze(80,.16)}}),n.isPlayer&&Je("🕯️ RUGGED — get dumped on!")}else if(n.key==="wizard")zt(n,"cast"),FS(i,4473932),m.delayed.push({t:.12,fn:()=>{r(13,48),De(i,10132136,8,5),Rt(n.team).forEach(o=>
3649{!o.isCrystal&&!o.isGoal&&!o.isBoss&&ke(o.pos,i)<13&&(o.slowT=Math.max(o.slowT||0,1.7),o.slowFactor=.55)}),ze(120,.15)}});else if(n.key==="degen"){zt(n,"thrust");const o=i.clone().sub(n.pos);o.lengthSq()<.01&&o.set(1,0,0),o.normalize();for(let a=0;a<7;a++){const c=o.clone().applyAxisAngle(new S(0,1,0),(a-3)*.22);Kt(n,n.pos,c,{kind:"shuriken",color:12174036,dmg:18*t,speed:25,life:.7})}BS(n.pos,14),ii(n.pos,2763328,4,1.6),De(n.pos,16764730,10,9),n.isPlayer&&Je("🎰 ALL IN!"),ze(820,.05)}else{zt(n,"cast");const o=i.clone().sub(n.pos);o.lengthSq()<.01&&o.set(0,0,-1),o.normalize();const a=17;OS(n.pos,o,a),m.delayed.push({t:.12,fn:()=>{Rt(n.team).forEach(c=>{const l=new S(c.pos.x-n.pos.x,0,c.pos.z-n.pos.z),u=l.dot(o);u>0&&u<a+2&&Math.abs(l.x*o.z-l.z*o.x)<(c.isCrystal?4:2.4)&&ft(c,62*t,n)})}}),n.isPlayer&&Je("🔵 FINAL FLASH!")}ze(420,.05)}else if(n.key==="chillhouse"){zt(n,"cast");const i=new S(e.x,0,e.z),s=i.clone().sub(n.pos);s.length()>9&&i.copy(n.pos).add(s.normalize().multiplyScalar(9)),pn(i,10477823,3.6,.4),De(i,15399167,12,8),vf(i,2),Rt(n.team).forEach(r=>{const o=r.isCrystal?6:0;ke(r.pos,i)<14+o&&(ft(r,40*t,n),!r.isCrystal&&!r.isGoal&&!r.isBoss&&(vf(r.pos,2.2),r.rootT=Math.max(r.rootT||0,.8),r.slowT=Math.max(r.slowT||0,1.8),r.slowFactor=.5))}),n.isPlayer&&Je("🧊 COLD STORAGE — frozen assets!"),ze(300,.12)}else if(n.key==="jester"){zt(n,"cast");const i=new S(e.x,0,e.z),s=i.clone().sub(n.pos);s.length()>12&&i.copy(n.pos).add(s.normalize().multiplyScalar(12));for(let r=0;r<16;r++)m.delayed.push({t:r*.03,fn:()=>HS({x:i.x+(Math.random()-.5)*5.5,z:i.z+(Math.random()-.5)*5.5})});m.delayed.push({t:.35,fn:()=>{pn(i,16731469,3.8,.36),De(i,16731469,14,9),Rt(n.team).forEach(r=>{const o=r.isCrystal?7:0;ke(r.pos,i)<13+o&&ft(r,48*t,n)}),m.shake=Math.max(m.shake||0,.22),ze(110,.15)}}),n.isPlayer&&Je("🃏 HOUSE OF CARDS!")}else if(n.key==="taxes")zt(n,"cast"),n.invisT=15,US(n.pos,12),ii(n.pos,7131258,8,2.2),De(n.pos,10351258,12,9),n.isPlayer&&Je("🫥 WRITE-OFF — invisible + 35% attack speed for 15s"),ze(520,.1);else if(n.key==="wapital"){zt(n,"cast");const i=new S(e.x,0,e.z),s=i.clone().sub(n.pos);s.length()>11&&i.copy(n.pos).add(s.normalize().multiplyScalar(11)),xc(i,"qberry",()=>{const r=new Fe,o=new X(new At(1.5,12,10),xe(15219018,{emissive:11542320,emissiveIntensity:.3}));o.scale.set(1,1.15,1),o.position.y=1.5,r.add(o);for(let a=0;a<5;a++){const c=new X(new Tn(.5,.8,5),xe(5882974,{})),l=a/5*Math.PI*2;c.position.set(Math.cos(l)*.55,3.05,Math.sin(l)*.55),c.rotation.z=Math.cos(l)*.7,c.rotation.x=-Math.sin(l)*.7,r.add(c)}return r},1.1),m.delayed.push({t:.32,fn:()=>{pn(i,16735610,4.5,.42),fi(i,16744600,9),De(i,16731498,16,10),vo(i,12721976,10,9),yn(i,4.2,16731498,.6),m.shake=Math.max(m.shake||0,.3),Rt(n.team).forEach(r=>{const o=r.isCrystal?7:0;ke(r.pos,i)<14+o&&(ft(r,46*t,n),!r.isCrystal&&!r.isGoal&&!r.isBoss&&(r.slowT=Math.max(r.slowT||0,2.2),r.slowFactor=.5))}),n.isPlayer&&Je("🍓 JAM SESSION — they're stuck in the jam!"),ze(120,.16)}}),ze(420,.06)}else if(n.key==="ozzie"){zt(n,"hammer");const i=Math.atan2(e.z-n.pos.z,e.x-n.pos.x),s=5,r=.42;for(let o=0;o<s;o++){const a=i+(o-(s-1)/2)*(r/(s-1))*2,c=new S(Math.cos(a),0,Math.sin(a));m.delayed.push({t:.14+o*.03,fn:()=>{n.dead||Kt(n,n.pos,c,{kind:"feather",color:9429066,dmg:16*t,speed:26,life:.85,y:1.4})}})}De(n.pos.clone().setY(1.4),9429066,12,8),n.isPlayer&&Je("🪶 LAUNCH PAD!"),ze(520,.08)}else{zt(n,"thrust");const i=new S(e.x-n.pos.x,0,e.z-n.pos.z);i.lengthSq()<.001&&i.set(1,0,0),n.dash={dir:i.normalize(),t:.16},n.dashHit=new Set,pn(n.pos,16734778,3,.32),ii(n.pos,16739162,8,2.2),De(n.pos,16726826,10,8),n.isPlayer&&Je("😡 SEETHE!"),ze(880,.08)}}function bo(n,e){if(!(!n.def.eCd||n.dead)){if(!m.vfxOnly){if(n.eTimer>0)return;n.eTimer=n.def.eCd*o0(n),m._castOut&&m._castOut.push({i:m.entities.indexOf(n),k:"e",ax:e.x,az:e.z})}if(zt(n,n.key==="chudhouse"?"pound":"thrust"),n.key==="degen"){const t=new S(e.x-n.pos.x,0,e.z-n.pos.z);t.lengthSq()<.001&&t.set(1,0,0),fi(n.pos,3817294,5),n.dash={dir:t.normalize(),t:.18},n.dashHit=new Set,ze(900,.07);return}if(n.key==="chudhouse"){pn(n.pos,16747837,5.5,.36),vo(n.pos,11029040,8,11),De(n.pos,16747837,14,11),fi(n.pos,14205096,5);const t=Cr(n);Rt(n.team).forEach(i=>
3649{if(i.isCrystal||i.isGoal)return;const s=ke(i.pos,n.pos);if(s<20){ft(i,30*t,n);const r=Math.sqrt(s)||.1;i.pos.x+=(i.pos.x-n.pos.x)/r*6,i.pos.z+=(i.pos.z-n.pos.z)/r*6,rn(i.pos,i.radius||1),un(i.pos,i.radius||1)}}),ze(95,.18)}}}function m0(n,e){n.mixer.update(e);let t=n.moving?"run":"idle";if(n.attackAnimT>0&&(n.attackAnimT-=e,n.actions.attack&&(t="attack")),t!==n.animState){const i=n.actions[t],s=n.actions[n.animState];i?(i.reset().fadeIn(.12).play(),s&&s!==i&&s.fadeOut(.12),n.animState=t):t==="idle"&&(s&&s.fadeOut(.18),n.animState="idle")}n.restIdle&&(n.mesh.position.y=!n.moving&&n.animState==="idle"?Math.sin(performance.now()*.002+(n.slot||0)*1.7)*.03:0),n.armBones&&n.swingT>0&&(n.swingT-=e,CT(n))}function IT(n,e){if(n.dash){Wh(n,e);return}n.moving=!1,m.crystals[n.team===0?1:0];let t=null,i=1e9;m.entities.forEach(h=>{if(h.team===n.team||h.dead||!qa(h,n.team))return;const d=ke(h.pos,n.pos);d<i&&d<144&&(i=d,t=h)}),n.hp<n.maxHp*.22&&(n.retreating=!0),n.hp>n.maxHp*.7&&(n.retreating=!1);let s,r=null,o=0;if(n.retreating)s=m.crystals[n.team].pos;else if(t)s=t.pos,r=t.pos,o=n.def.arch==="melee"?n.def.range*.9:n.def.range*.85;else if(m.boss&&BT(n))s=m.boss.pos,ke(m.boss.pos,n.pos)<(n.def.range+2.4)*(n.def.range+2.4)&&(r=m.boss.pos,o=n.def.range+2.2);else{const h=n.path[Math.min(n.wpIndex,n.path.length-1)];ke(h,n.pos)<6&&n.wpIndex<n.path.length-1&&n.wpIndex++,s=n.path[Math.min(n.wpIndex,n.path.length-1)];let d=null,f=1e9;oT(n.team).forEach(p=>{const b=ke(p.pos,n.pos);b<f&&(f=b,d=p)}),d&&f<(n.def.range+2.5)*(n.def.range+2.5)&&(r=d.pos,o=n.def.range+1.8)}n.wanderT-=e,n.wanderT<=0&&(n.wanderT=1.2+Math.random(),n.wanderOff.set((Math.random()*2-1)*2,0,(Math.random()*2-1)*2));const c=new S(s.x,0,s.z).add(n.wanderOff).sub(n.pos.clone().setY(0)),l=r?Math.sqrt(ke(r,n.pos)):1e9;if((!r||l>o)&&c.lengthSq()>.3){c.normalize();const h=n.def.speed*.85*Po(n)*Lr(n);n.pos.x+=c.x*h*e,n.pos.z+=c.z*h*e,n.mesh.rotation.y=Math.atan2(c.x,c.z)+Math.PI,n.moving=!0}m.entities.forEach(h=>{if(h===n||h.dead||h.team!==n.team)return;const d=ke(h.pos,n.pos);if(d<2.4&&d>.001){const f=Math.sqrt(d);n.pos.x+=(n.pos.x-h.pos.x)/f*(1.55-f)*6*e,n.pos.z+=(n.pos.z-h.pos.z)/f*(1.55-f)*6*e}}),rn(n.pos,n.radius),un(n.pos,n.radius);const u=typeof n.skill=="number"?n.skill:.62;if(r&&l<=o+.5&&(n.mesh.rotation.y=Math.atan2(r.x-n.pos.x,r.z-n.pos.z)+Math.PI,Math.random()<.4+.6*u&&yl(n,r)),t&&!n.retreating){const h=Math.sqrt(ke(t.pos,n.pos)),d=n.def.arch==="melee"?n.def.range+3.5:Math.min(n.def.range+2,14);n.qTimer<=0&&(n.level||1)>=3&&h<d&&Math.random()<e*5*u&&(n.mesh.rotation.y=Math.atan2(t.pos.x-n.pos.x,t.pos.z-n.pos.z)+Math.PI,vl(n,t.pos));const f=n.def.arch==="melee"?n.def.range+2.5:n.def.range+1;n.def.eCd&&n.eTimer<=0&&h<f&&Math.random()<e*4*u&&bo(n,t.pos)}else n.retreating&&n.def.eCd&&n.eTimer<=0&&Math.random()<e*3&&bo(n,m.crystals[n.team].pos)}function BT(n){if(n.lane==="mid")return!0;if(m.entities.some(s=>s.team===n.team&&!s.isPlayer&&s.lane==="mid"&&!s.dead))return!1;const e=m.entities.filter(s=>s.team===n.team&&!s.isPlayer&&!s.dead);let t=null,i=1e9;return e.forEach(s=>{const r=ke(s.pos,m.boss.pos);r<i&&(i=r,t=s)}),t===n}function DT(n,e){if(n.dead){n.isBoss||(n.respawnT-=e,n.respawnT<=0&&(n.dead=!1,n.hp=n.maxHp,n.mesh.visible=!0,n.pos.set(n.camp.x,0,n.camp.z),n.state="idle",n.target=null));return}n.atkTimer-=e;const t=n.camp;if(n.flop){const i=n.flop;i.t+=e;const s=.5,r=.5,o=.45,a=.7,c=3.6,l=6,u=h=>h*h*(3-2*h);if(!i.tele&&!i.hit&&(i.tele=new X(new ys(l,36),new _e({color:16735530,transparent:!0,opacity:0,depthWrite:!1})),i.tele.rotation.x=-Math.PI/2,i.tele.position.set(n.pos.x,.06,n.pos.z),m.scene.add(i.tele)),i.t<s){const h=u(i.t/s);n.mesh.rotation.x=.35*h,n.mesh.position.y=-.3*h,i.tele.material.opacity=.22*h,i.tele.scale.setScalar(.4+.6*h)}else if(i.t<s+r){const h=(i.t-s)/r;n.mesh.position.y=-.3*(1-h)+c*4*h*(1-h),n.mesh.rotation.x=.35-1.85*u(h),i.tele.material.opacity=.22+.2*h,i.tele.scale.setScalar(1)}else i.hit?i.t<s+r+o?(n.mesh.rotation.x=-1.5,n.mesh.position.y=0):i.t<s+r+o+a?(n.mesh.rotation.x=-1.5*(1-u((i.t-s-r-o)/a)),n.mesh.position.y=0):(n.mesh.rotation.x=0,n.flop=null,n.atkTimer=.9):(i.hit=!0,n.mesh.rotation.x=-1.5,n.mesh.position.y=0,m.scene.remove(i.tele),i.tele.material.dispose(),i.tele=null,m.entities.forEac
3649h(h=>{!h.dead&&ke(h.pos,n.pos)<l*l&&ft(h,60,n)}),yn(n.pos,l,16767053,.45),yn(n.pos,l*.55,16747837,.3),De(n.pos,16767053,26),fi(n.pos,14208960,10),m.shake=Math.max(m.shake||0,.55),ze(70,.5),ze(45,.4));return}if(n.state==="aggro"&&n.target){if(n.target.dead||ke(n.pos,{x:t.x,z:t.z})>n.leash*n.leash)n.state="return",n.target=null;else if(Math.sqrt(ke(n.target.pos,n.pos))>n.atkRange*.9){const s=new S(n.target.pos.x-n.pos.x,0,n.target.pos.z-n.pos.z).normalize(),r=n.speed*Lr(n);n.pos.x+=s.x*r*e,n.pos.z+=s.z*r*e,n.mesh.rotation.y=Math.atan2(s.x,s.z)+Math.PI}else if(n.atkTimer<=0){if(n.isBoss&&++n.atkCount>=4){n.atkCount=0,n.flop={t:0,hit:!1};return}n.atkTimer=n.atkCd,ft(n.target,n.dmg,n),yn(n.target.pos,1.2,12868863,.2),ze(180,.05)}}else if(n.state==="return"){const i=new S(t.x-n.pos.x,0,t.z-n.pos.z);i.length()<.5?(n.state="idle",n.hp=n.maxHp):(i.normalize(),n.pos.x+=i.x*n.speed*1.4*e,n.pos.z+=i.z*n.speed*1.4*e)}n.mesh.position.y=n.isBoss?Math.abs(Math.sin(performance.now()*.0012))*.12:Math.abs(Math.sin(performance.now()*.003+n.camp.x))*.1}function kT(){const n=new Fe,e=()=>new _e({color:16767053,transparent:!0,opacity:.85,depthWrite:!1,depthTest:!1,side:yt}),t=new X(new gi(.78,.96,36),e());t.rotation.x=-Math.PI/2,n.add(t);const i=new X(new ys(.14,16),e());i.rotation.x=-Math.PI/2,n.add(i);for(let s=0;s<4;s++){const r=new X(new Qt(.1,.34),e());r.rotation.x=-Math.PI/2;const o=s*Math.PI/2;r.position.set(Math.cos(o)*1.12,0,Math.sin(o)*1.12),r.rotation.z=o,n.add(r)}return n.position.y=.06,n.traverse(s=>{s.renderOrder=999}),n}function bl(){m.scene=__(),m.entities=[],m.projectiles=[],m.effects=[],m.delayed=[],m.neutrals=[],m.boss=null,m.minions=[],m.minionQueue=[],m.minionTimer=t0,m.crystals=[Rf(0),Rf(1)],m.goals=za.map(rT),m.matchStats={kills:0,deaths:0},m.matchTime=0,m.bossTimer=fm,m.turretDmg={0:0,1:0},m.overtime=!1,m.firstBlood=!1,m.shake=0,m.choosing=!1,m.pickQueue=0,m.pendingCards=null,document.getElementById("upgradePick").style.display="none",document.getElementById("matchClock").style.color="";const n=m.pendingNet;m.pendingNet=null;const e=m.pendingBackfill;if(m.pendingBackfill=null,m.backfill=!n&&e?e:null,m.online=!!n,m.netHost=m.online&&K.isHost,m.netGuest=m.online&&!K.isHost,m.ranked=!!(n&&n.ranked),m.spectator=m.online&&K.spectator,m.netIn={q:!1,e:!1,rc:!1},m._castOut=m.netHost?[]:null,m._snapAcc=0,m._inAcc=0,m.netMinions=new Map,m.online)QT(),GT(n);else{const s=rt.selectedChar;if(m.player=Ws(s,0,0,!0,rt.selectedSkin[s],"mid"),m.entities.push(m.player),m.backfill)m.entities.push(Ws(ri[Math.floor(Math.random()*ri.length)],1,0,!1,0,"mid")),UT(m.backfill);else{const r=ri.filter(a=>a!==s).sort(()=>Math.random()-.5);m.entities.push(Ws(r[0],0,1,!1,0,"top")),m.entities.push(Ws(r[1],0,2,!1,0,"bot"));const o=["top","bot","mid"];for(let a=0;a<3;a++)m.entities.push(Ws(ri[Math.floor(Math.random()*ri.length)],1,a,!1,0,o[a]))}}const t=m.player?m.player.key:null;dm.forEach(s=>m.neutrals.push(aT(s))),m.bushIndicator=new X(new ys(1,28),new _e({color:13619932,transparent:!0,opacity:.22,depthWrite:!1})),m.bushIndicator.rotation.x=-Math.PI/2,m.bushIndicator.position.y=.04,m.bushIndicator.visible=!1,m.scene.add(m.bushIndicator),m.reticle=kT(),m.reticle.visible=!1,m.scene.add(m.reticle),document.getElementById("lobby").style.display="none",document.getElementById("endScreen").style.display="none",document.getElementById("hud").style.display="block",xl(),document.body.classList.toggle("spectating",!!m.spectator);const i=document.getElementById("specBar");if(m.spectator)m.specCam={x:0,z:0,h:42},i&&(i.style.display="flex");else{i&&(i.style.display="none");{const s=document.getElementById("portraitFace");s.innerHTML="";const r=document.createElement("img");r.src=`/art/champions/${t}.jpg`,r.onerror=()=>{s.textContent=pt[t].face},s.appendChild(r)}document.getElementById("basicName").textContent=pt[t].basicName,document.getElementById("qName").textContent=pt[t].qName,document.getElementById("eBox").style.display=pt[t].eCd?"flex":"none",document.getElementById("btnE").style.display=pt[t].eCd?"flex":"none",pt[t].eCd&&(document.getElementById("eName").textContent=pt[t].eName),zh()}m.preMatch=Hh,document.getElementById("matchClock").textContent=Math.floor(wo/60)+":"+String(wo%60).padStart(2,"0"),nT(),qm(),m.running=!0}function g0(){if(m.running){m.running=!1,m.preMatch=0,Uh(),document.body.classList.remove("lowHp"),m.online=m.netHost=m.netGuest=!1;{const n=document.getElementById("escMenu");n&&(n.style.display="none")}m.ranked=!1,Xm(),K.connected()&&K.disconnect(),m.choosing=!1,m.pickQueue=0,document.getElementById("upgradePick").style.display="none",document.getElementById("hud").style.display="none",xl(),document.getElementById("endScreen").style.display="none",document.getElementById("lobby").style.display="flex"}}const wo=600;
3649function NT(){if(!m.running)return;const n=m.goals.filter(i=>i.team===1&&i.dead).length,e=m.goals.filter(i=>i.team===0&&i.dead).length;let t;n!==e?t=n>e?0:1:t=(m.turretDmg[0]||0)>=(m.turretDmg[1]||0)?0:1,di("⏰ TIME! Winner by turrets"),m.netHost&&K.send({t:"over",team:t}),Mo(t===(m.player?m.player.team:0))}function Mo(n){if(!m.running)return;m.running=!1,m.preMatch=0,Uh(),document.body.classList.remove("lowHp"),m.netHost=m.netGuest=!1;{const o=document.getElementById("escMenu");o&&(o.style.display="none")}const e=m.spectator;Xm(),m.choosing=!1,m.pickQueue=0,document.getElementById("upgradePick").style.display="none";const t=document.getElementById("endTitle");e?(t.textContent="MATCH OVER",t.className="win"):(t.textContent=n?"VICTORY":"REKT",t.className=n?"win":"lose");const i=m.backfill?`<span style="color:var(--dim)">${n?"defeated":"lost to"} <b style="color:${m.backfill.tierColor}">${String(m.backfill.name).replace(/[<>&]/g,"").slice(0,14)}</b> · ${m.backfill.tier}</span><br>`:"";document.getElementById("endStats").innerHTML=i+`Eliminations: <b>${m.matchStats.kills}</b> · Deaths: <b>${m.matchStats.deaths}</b><br><span style="color:var(--dim)">${n?"GG — the dome is yours":"Run it back"}</span>`;const s=document.getElementById("endRank");s&&(s.innerHTML="");const r=document.getElementById("shareBtn");if(m.lastResult=null,!e&&m.player){const o=m.online&&m.ranked;m.lastResult={won:n,champ:m.player.key,kills:m.matchStats.kills,deaths:m.matchStats.deaths,ranked:o,tier:null,tierColor:null,delta:0,promoted:!1,rp:null};const a=m.online?K.matchTicket:null,c=k_(m.matchStats.kills,m.matchStats.deaths,n,o,a);K.matchTicket=null,o&&s&&(s.innerHTML='<span class="rankCalc">updating rank…</span>',Promise.resolve(c).then(l=>{zT(s,l),l&&m.lastResult&&Object.assign(m.lastResult,{tier:l.tier,tierColor:l.tierColor,delta:l.delta,promoted:l.promoted,rp:l.rp})}).catch(()=>{s.innerHTML=""}))}r&&(r.style.display=m.lastResult?"block":"none"),setTimeout(()=>{document.getElementById("endScreen").style.display="flex"},600),tS(n)}function zT(n,e){if(!n)return;if(!e||e.rp==null){n.innerHTML="";return}const t=e.delta>0?"+":"";let s=`<div class="rankRp"><span class="rankDelta" style="color:${e.delta>=0?"#43e36b":"var(--coral)"}">${t}${e.delta} RP</span> · <b style="color:${e.tierColor||"var(--mint)"}">${e.tier||""} · ${e.rp} RP</b></div>`;e.promoted?(s=`<div class="rankUp" style="color:${e.tierColor||"var(--gold)"}">⬆ PROMOTED TO ${String(e.tier||"").toUpperCase()}!</div>`+s,ze(1100,.22),m.shake=Math.max(m.shake||0,.2)):e.demoted&&(s=`<div class="rankDown">⬇ Demoted to ${e.tier||""}</div>`+s),n.innerHTML=s}function Wh(n,e){n.moving=!0;const t=n.dash.spin,i=t?34:46;n.pos.x+=n.dash.dir.x*i*e,n.pos.z+=n.dash.dir.z*i*e,n.dash.t-=e,t&&(n.mesh.rotation.y+=e*32);const s=t?7000170:5895136,r=new X(new wt(.5,.1,.5),xe(s,{emissive:s,emissiveIntensity:1.4}));r.position.set(n.pos.x,.3,n.pos.z),m.scene.add(r),m.effects.push({mesh:r,life:.25,maxLife:.25});const o=Cr(n);Rt(n.team).forEach(a=>{if(!a.isCrystal&&!n.dashHit.has(a)&&ke(a.pos,n.pos)<(t?3:2.3)&&(n.dashHit.add(a),ft(a,(t?40:35)*o,n),De(a.pos,s,8,9),t&&!a.isGoal&&!a.isBoss)){const c=a.pos.x-n.pos.x,l=a.pos.z-n.pos.z,u=Math.hypot(c,l)||.1;a.pos.x+=c/u*3.5,a.pos.z+=l/u*3.5,rn(a.pos,a.radius||1),un(a.pos,a.radius||1)}}),n.dash.t<=0&&(n.dash=null)}const FT=.066,OT=.05,HT=["top","mid","bot"];function x0(n,e,t,i){const s=t?320:256,r=document.createElement("canvas");r.width=s,r.height=64;const o=r.getContext("2d");o.font="bold 34px Rubik, sans-serif",o.textAlign="center",o.textBaseline="middle";const a=t?34:0,c=6,l=s/2,u=o.measureText(n).width,h=a?a+c+u:u,d=l-h/2,f=a?d+a+c+u/2:l;o.lineWidth=6,o.strokeStyle="rgba(0,0,0,0.8)",o.strokeText(n,f,36),o.fillStyle=e===0?"#9ec6ff":e===1?"#ff9b9b":"#ffffff",o.fillText(n,f,36),a&&eT(o,d+a/2,33,a,t);const p=new jn(r);p.anisotropy=4;const b=new sl(new Eo({map:p,transparent:!0,depthTest:!1,depthWrite:!1}));return b.scale.set(3.2*s/256,.8,1),b.position.y=3.45,b.renderOrder=999,b}function UT(n){const e=m.entities.find(t=>t.team===1&&!t.isHuman)||m.entities.find(t=>t.team===1);
3649m.entities.forEach(t=>{let i,s=null;t===m.player?(i=K.myName||"You",s=K.myTier,K.myTierColor):t===e?(i=n.name,s=n.tier,n.tierColor,t.persona=!0,t.skill=n.skill):i=t.def.name,t.uname=String(i).slice(0,14);const r=x0(t.uname,t.team,s);t.mesh.add(r),t.nameSprite=r})}function GT(n){const e={0:new Set,1:new Set};n.slots.forEach(t=>{const i=t.champ&&pt[t.champ]?t.champ:ri[0],s=!!t.id&&t.id===K.id,r=s&&rt.selectedSkin[i]||0,o=Ws(i,t.team,t.slot,s,r,HT[t.slot]||"mid"),a=t.name&&String(t.name).trim()?String(t.name).trim().slice(0,14):pt[i].name;o.uname=a;const c=x0(a,t.team,t.tier||null,t.tierColor);o.mesh.add(c),o.nameSprite=c,t.id?(o.netId=t.id,o.isHuman=!0):t.name&&(o.persona=!0,t.skill!=null&&(o.skill=t.skill)),s?(m.player=o,o.baseHp=o.def.hp,o.maxHp=o.def.hp,o.hp=o.def.hp):t.id&&(o.remote=!0,o.netInput=null),m.entities.push(o),e[t.team].add(t.slot)}),!m.player&&!m.spectator&&(console.warn("[net] no slot matched my id",K.id,"— falling back"),m.player=m.entities.find(t=>t.isHuman)||m.entities[0])}const Us=new S,Ji=new S;function WT(n,e){const t=n.netInput;if(!t){n.moving=!1;return}if(Us.set(t.ax,0,t.az),n.dash)Wh(n,e);else{if(Ji.set(t.mx,0,t.mz),n.moving=Ji.lengthSq()>.001,n.moving){Ji.normalize();const o=n.def.speed*Po(n)*Lr(n);n.pos.x+=Ji.x*o*e,n.pos.z+=Ji.z*o*e,(n.lastDir??=new S).copy(Ji)}n.moveDir=Ji}rn(n.pos,n.radius),un(n.pos,n.radius),t.atk&&(yl(n,Us),n.aimHoldT=.6),t.q&&(t.q=0,vl(n,Us),n.aimHoldT=.6),t.e&&(t.e=0,bo(n,Us),n.aimHoldT=.6),t.rc&&(t.rc=0,Vm(n)),n.aimHoldT=Math.max(0,(n.aimHoldT||0)-e);const i=n.aimHoldT>0||!n.moving,s=i?Us.x-n.pos.x:n.moveDir.x,r=i?Us.z-n.pos.z:n.moveDir.z;(s||r)&&(n.mesh.rotation.y=Math.atan2(s,r)+Math.PI)}const Vt=n=>Math.round(n*100)/100;function VT(){const n=m.entities.map(s=>{let r=0;s.dead&&(r|=1),s.moving&&(r|=2),s.invisT>0&&(r|=4),s.shellT>0&&(r|=8),s.bush>=0&&(r|=16),s.flash>0&&(r|=32),s.slowT>0&&(r|=64),s.rootT>0&&(r|=128),s.channeling&&(r|=256);const o=s.level>=ro?1:Vt((s.xp||0)/Va(s.level||1)),a=s.def.speed*Po(s)*Lr(s);return[Vt(s.pos.x),Vt(s.pos.z),Vt(s.mesh.rotation.y),Math.ceil(s.hp),s.maxHp,s.level||1,r,Vt(Math.max(0,s.qTimer)),Vt(Math.max(0,s.eTimer)),o,Vt(a),Math.max(0,Math.ceil(s.buffs.dmg)),Math.max(0,Math.ceil(s.buffs.spd)),Math.max(0,Math.ceil(s.buffs.boss)),s.kills||0,s.deaths||0]}),e=m.minions.map(s=>[s.nid,s.team,Vt(s.pos.x),Vt(s.pos.z),Math.ceil(s.hp),s.dead?1:0]),t=m.neutrals.map(s=>[Vt(s.pos.x),Vt(s.pos.z),Math.ceil(s.hp),s.maxHp,s.dead?1:0,s.isBoss?1:0]),i={t:"snap",mt:Vt(m.matchTime),ot:m.overtime?1:0,c:[Math.ceil(m.crystals[0].hp),Math.ceil(m.crystals[1].hp)],g:m.goals.map(s=>s.dead?-1:Math.ceil(s.hp)),e:n,m:e,nu:t};return m._castOut&&m._castOut.length&&(i.cast=m._castOut.slice(),m._castOut.length=0),i}function qT(n){m._snapAcc=(m._snapAcc||0)+n,!(m._snapAcc<FT)&&(m._snapAcc=0,K.send(VT()))}function jT(n){m.netSnapAge=0,m.matchTime=n.mt,m.overtime=!!n.ot,n.e.forEach((e,t)=>{const i=m.entities[t];if(!i)return;i.netTarget??={x:e[0],z:e[1],ry:e[2]},i.netTarget.x=e[0],i.netTarget.z=e[1],i.netTarget.ry=e[2];const s=e[6],r=i.dead,o=i.hp==null?e[3]:i.hp,a=i.level||1;if(i.hp=e[3],i.maxHp=e[4],i.level=e[5],i.dead=!!(s&1),i.moving=!!(s&2),i.invisT=s&4?1:0,i.shellT=s&8?1:0,i.netBush=!!(s&16),i.netSlow=!!(s&64),i.netRoot=!!(s&128),i.netChannel=!!(s&256),i.qTimer=e[7]||0,i.eTimer=e[8]||0,i.netXp=e[9]||0,i.netSpeed=e[10],i.netBuffs={dmg:e[11]||0,spd:e[12]||0,boss:e[13]||0},i.kills=e[14]||0,i.deaths=e[15]||0,i===m.player&&(m.matchStats.kills=i.kills,m.matchStats.deaths=i.deaths),i===m.player&&i.level>a&&a>0&&(yn(i.pos,2.6,16767053,.5),De(i.pos,16767053,14,10),di(i.level===3?"🔓 Q ABILITY UNLOCKED":"LEVEL "+i.level),yo(i.level===3?[523,784,1047,1319]:[523,659,880])),!r&&!i.dead&&o-i.hp>.5){const c=o-i.hp;if(De(i.pos,i.team===0?3835647:16735596,5,7),i.mats&&(i.flash=.18),c>=2){const l=m.player?m.player.team:0,u=i===m.player?"#ff5d6c":i.team!==l?"#ffd84d":"#f0eaff";ml(i.pos,Math.round(c),u)}}}),m.crystals[0].hp=n.c[0],m.crystals[1].hp=n.c[1],m.crystals.forEach(e=>e.dead=e.hp<=0),n.g.forEach((e,t)=>{const i=m.goals[t];i&&(e<0?i.dead=!0:(i.hp=e,i.dead=!1))}),YT(n.m),n.nu&&XT(n.nu),n.cast&&(m._castReplays=(m._castReplays||0)+n.cast.length,n.cast.forEach(e
3649=>{const t=m.entities[e.i];if(t){m.vfxOnly=!0;try{const i={x:e.ax,z:e.az};e.k==="b"?yl(t,i):e.k==="q"?vl(t,i):bo(t,i)}catch{}m.vfxOnly=!1}}))}function XT(n){if(n.length>m.neutrals.length)n[n.length-1][5]&&e0(!0);else if(n.length<m.neutrals.length){const e=m.neutrals[m.neutrals.length-1];e&&e.isBoss&&(m.scene.remove(e.mesh),m.neutrals.pop(),m.boss=null)}n.forEach((e,t)=>{const i=m.neutrals[t];if(!i)return;i.netTarget??={x:e[0],z:e[1]},i.netTarget.x=e[0],i.netTarget.z=e[1];const s=i.hp==null?e[2]:i.hp;i.hp=e[2],i.maxHp=e[3],i.dead=!!e[4],!i.dead&&s-i.hp>.5&&(De(i.pos,12868863,4,6),ml(i.pos,Math.round(s-i.hp),"#ffe9a0"))})}function YT(n){const e=new Set;n.forEach(t=>{const i=t[0],s=t[1],r=t[2],o=t[3],a=t[4],c=t[5];e.add(i);let l=m.netMinions.get(i);if(!l){const h=n0(s);h.position.set(r,0,o),m.scene.add(h),l={isMinion:!0,team:s,mesh:h,pos:h.position,netTarget:{x:r,z:o},dead:!1,hp:a},m.netMinions.set(i,l),m.minions.push(l)}const u=l.hp==null?a:l.hp;l.netTarget.x=r,l.netTarget.z=o,l.hp=a,l.dead=!!c,!c&&u-a>.5&&(De(l.pos,s===0?3835647:16735596,3,5),ml(l.pos,Math.round(u-a),"#ffe9a0"))});
3649for(const[t,i]of m.netMinions)if(!e.has(t)){m.scene.remove(i.mesh),m.netMinions.delete(t);const s=m.minions.indexOf(i);s>=0&&m.minions.splice(s,1)}}const y0=new S;function ZT(){Ua.setFromCamera(pl,bt),Ua.ray.intersectPlane(Wm,_t);const n=m.player;if(Oi&&n&&!n.dead){let i=null,s=256;m.entities.forEach(r=>{if(r.team!==n.team&&!r.dead&&r.mesh.visible){const o=ke(r.pos,n.pos);o<s&&(s=o,i=r)}}),i?_t.set(i.pos.x,0,i.pos.z):(n.lastDir??=new S(0,0,-1),_t.set(n.pos.x+n.lastDir.x*6,0,n.pos.z+n.lastDir.z*6))}const e=y0.set(0,0,0),t=hs.controlScheme==="camera";if(Oi)qt.active&&e.set(qt.x,0,qt.z);else if(t)e.set((Ye.d?1:0)-(Ye.a?1:0),0,(Ye.s?1:0)-(Ye.w?1:0));else if(n){const i=new S(_t.x-n.pos.x,0,_t.z-n.pos.z);i.lengthSq()<.001&&i.set(0,0,-1),i.normalize();const s=new S(-i.z,0,i.x);e.addScaledVector(i,(Ye.w?1:0)-(Ye.s?1:0)).addScaledVector(s,(Ye.d?1:0)-(Ye.a?1:0))}return e.lengthSq()>.001&&(e.normalize(),n&&(n.lastDir??=new S).copy(e)),e}function KT(n,e,t){m._inAcc=(m._inAcc||0)+n;const i=m.netIn.q||m.netIn.e||m.netIn.rc;m._inAcc<OT&&!i||(m._inAcc=0,K.send({t:"input",mx:Vt(e.x),mz:Vt(e.z),ax:Vt(_t.x),az:Vt(_t.z),atk:t,q:m.netIn.q?1:0,e:m.netIn.e?1:0,rc:m.netIn.rc?1:0}),m.netIn.q=m.netIn.e=m.netIn.rc=!1)}function JT(n){const e=m.player,t=m.netIn.q,i=m.netIn.e,s=m.spectator?y0.set(0,0,0):ZT(),r=!m.spectator&&(Co.down||qt.attack)?1:0;m.spectator||KT(n,s,r);const o=e?e.team:0,a=Math.min(1,n*14);if(m.netSnapAge=(m.netSnapAge||0)+n,m.netSnapAge>12&&m.running){Je("🚪 Host disconnected"),di("HOST LEFT — MATCH OVER"),Mo(!0);return}if(e)if(e.dead)e.netTarget&&(e.pos.x=e.netTarget.x,e.pos.z=e.netTarget.z);else{if(e.moving=s.lengthSq()>.001,e.dash){const d=e.dash.spin?34:46;e.pos.x+=e.dash.dir.x*d*n,e.pos.z+=e.dash.dir.z*d*n,e.dash.t-=n,e.dash.t<=0&&(e.dash=null,e.dashHit=null)}else if(e.moving){const d=e.netSpeed!=null?e.netSpeed:e.def.speed*Po(e)*Lr(e);e.pos.x+=s.x*d*n,e.pos.z+=s.z*d*n}if(rn(e.pos,e.radius),un(e.pos,e.radius),e.netTarget&&(m.netSnapAge||0)<.5){const d=e.netTarget.x-e.pos.x,f=e.netTarget.z-e.pos.z,p=Math.hypot(d,f);if(p>10)e.pos.x=e.netTarget.x,e.pos.z=e.netTarget.z;else if(!e.moving&&p>.25){const b=Math.min(1,n*8);e.pos.x+=d*b,e.pos.z+=f*b}else if(e.moving&&p>3.5){const b=Math.min(1,n*5);e.pos.x+=d*b,e.pos.z+=f*b}}r&&(e.aimHoldT=.6),e.aimHoldT=Math.max(0,(e.aimHoldT||0)-n);const l=hs.controlScheme==="camera"&&!Oi&&e.aimHoldT<=0&&e.moving&&s.lengthSq()>.001,u=l?s.x:_t.x-e.pos.x,h=l?s.z:_t.z-e.pos.z;(u||h)&&(e.mesh.rotation.y=Math.atan2(u,h)+Math.PI),e._predAtkT=Math.max(0,(e._predAtkT||0)-n),r&&e._predAtkT<=0&&(e._predAtkT=r0(e),zt(e,e.def.arch==="melee"?"swing":"shoot")),t&&e.level>=3&&zt(e,"cast"),i&&e.def.eCd&&zt(e,e.key==="chudhouse"?"pound":"thrust")}m.entities.forEach(l=>{if(l!==e&&l.netTarget){l.pos.x+=(l.netTarget.x-l.pos.x)*a,l.pos.z+=(l.netTarget.z-l.pos.z)*a;let h=l.netTarget.ry-l.mesh.rotation.y;for(;h>Math.PI;)h-=Math.PI*2;for(;h<-Math.PI;)h+=Math.PI*2;l.mesh.rotation.y+=h*a}const u=!m.spectator&&(l.netBush||l.invisT>0)&&l.team!==o;if(l.mesh.visible=!l.dead&&!u&&!(l.shellT>0),l.shellMesh&&(l.shellT>0&&!l.dead?(l.shellMesh.position.set(l.pos.x,0,l.pos.z),l.shellMesh.rotation.y+=n*16):(m.scene.remove(l.shellMesh),l.shellMesh=null)),!l.dead&&(l.flash>
36490&&(l.flash-=n,l.mats&&l.mats.forEach(h=>h.emissive.setHex(l.flash>0?8930372:h.userData.origEmissive||0))),Bi(l.bar,l.maxHp?l.hp/l.maxHp:0),Di(l.bar),l.mixer?(l.mesh.position.y=0,m0(l,n)):p0(l,n),f0(l,n),l===e)){const h=l.netBush;if(l.mats.forEach(d=>d.opacity=l.invisT>0?.3:h?.55:1),m.bushIndicator&&(m.bushIndicator.visible=h,h)){const d=u0(e.pos);if(d>=0){const f=cs[d];m.bushIndicator.position.set(f.x,.04,f.z),m.bushIndicator.scale.set(f.hw+.2,f.hd+.2,1)}}}}),m.minions.forEach(l=>{if(!l.netTarget)return;const u=l.netTarget.x-l.pos.x,h=l.netTarget.z-l.pos.z;l.pos.x+=u*a,l.pos.z+=h*a,u*u+h*h>8e-4&&(l.mesh.rotation.y=Math.atan2(u,h)+Math.PI),l.mesh.position.y=Math.abs(Math.sin(performance.now()*.011))*.12}),m.neutrals.forEach(l=>{l.netTarget&&(l.pos.x+=(l.netTarget.x-l.pos.x)*a,l.pos.z+=(l.netTarget.z-l.pos.z)*a),l.mesh.visible=!l.dead,l.dead||(Bi(l.bar,l.maxHp?l.hp/l.maxHp:0),Di(l.bar),l.isBoss||(l.mesh.position.y=Math.abs(Math.sin(performance.now()*.006+(l.pos.x||0)))*.1))});for(let l=m.projectiles.length-1;l>=0;l--){const u=m.projectiles[l];u.mesh.position.addScaledVector(u.vel,n),u.kind==="shuriken"?u.mesh.rotation.y+=n*26:u.kind==="card"?(u.mesh.rotation.z+=n*18,u.mesh.rotation.x+=n*5):u.kind==="bill"?(u.mesh.rotation.y+=n*10,u.mesh.rotation.z+=n*6):u.kind==="candle"?u.mesh.rotation.y+=n*9:u.kind!=="ki"&&u.kind!=="dart"&&(u.mesh.rotation.x+=n*8,u.mesh.rotation.y+=n*6),u.kind==="smoke"&&u.mesh.scale.multiplyScalar(1+n*1.4),u.life-=n,(u.life<=0||Math.abs(u.mesh.position.x)>Pe.hw+2||Math.abs(u.mesh.position.z)>Pe.hd+2)&&(m.scene.remove(u.mesh),Fa(u.mesh),m.projectiles.splice(l,1))}m.goals.forEach(l=>{l.noSpin||(l.gem.rotation.y+=n*1.2),Bi(l.bar,l.dead?0:l.hp/l.maxHp),Di(l.bar),l.dead?l.mesh.visible=!1:ja(l)}),m.crystals.forEach(l=>{l.noSpin||(l.gem.rotation.y+=n*.8),Bi(l.bar,Math.max(0,l.hp)/l.maxHp),Di(l.bar),ja(l)}),document.querySelector("#allyC i").style.width=Math.max(0,m.crystals[o].hp)/m.crystals[o].maxHp*100+"%",document.querySelector("#enemyC i").style.width=Math.max(0,m.crystals[o===0?1:0].hp)/m.crystals[1].maxHp*100+"%",$m(o);for(let l=m.delayed.length-1;l>=0;l--)if(m.delayed[l].t-=n,m.delayed[l].t<=0){const u=m.delayed[l].fn;m.delayed.splice(l,1),m.vfxOnly=!0;try{u()}catch{}m.vfxOnly=!1}for(let l=m.effects.length-1;l>=0;l--){const u=m.effects[l];u.life-=n;const h=u.life/u.maxLife;u.mesh.material&&(u.mesh.material.transparent=!0,u.mesh.material.opacity=h*(u.alpha||1)),u.grow&&u.mesh.scale.setScalar(1+(1-h)*u.grow),u.shrink&&u.mesh.scale.setScalar(Math.max(h,.01)*u.shrink),u.vel&&(u.mesh.position.addScaledVector(u.vel,n),u.grav!==!1&&(u.vel.y-=20*n,u.mesh.rotation.x+=n*6)),u.life<=0&&(m.scene.remove(u.mesh),Fa(u.mesh),u.dispose&&u.dispose.dispose(),m.effects.splice(l,1))}if(d0(n),e){if(bt.position.lerp(new S(e.pos.x,26,e.pos.z+17),.08),m.shake>
36490){m.shake=Math.max(0,m.shake-n*1.6);const l=m.shake*m.shake*.9;bt.position.x+=(Math.random()-.5)*l,bt.position.z+=(Math.random()-.5)*l}bt.lookAt(e.pos.x,0,e.pos.z-1)}else m.spectator&&jm(n);ir-=n,ir<=0&&(Bm(m.crystals,m.neutrals,m.entities,m.goals,qa,o),ir=.1);const c=Math.max(0,Math.ceil(wo-m.matchTime));if(document.getElementById("matchClock").textContent=Math.floor(c/60)+":"+String(c%60).padStart(2,"0"),e){const l=e.maxHp?e.hp/e.maxHp:0,u=document.getElementById("hpFill");u.style.width=l*100+"%",u.style.background=l<.3?"linear-gradient(90deg,#e23b4e,#ff7d6c)":"",document.body.classList.toggle("lowHp",l>.001&&l<.3&&!e.dead),document.getElementById("hpText").textContent=Math.ceil(e.hp)+" / "+e.maxHp,document.getElementById("lvlBadge").textContent=e.level,document.getElementById("xpFill").style.width=(e.netXp||0)*100+"%";{let f="";const p=e.netBuffs||{};for(const b in p)p[b]>0&&is[b]&&(f+=`<span class="buffChip ${b}">${is[b].label} ${p[b]}s</span>`);document.getElementById("buffs").innerHTML=f}document.getElementById("basicCd").style.height=Math.max(0,(e._predAtkT||0)/e.def.atkCd*100)+"%";const h=e.level<3;document.getElementById("qName").parentElement.classList.toggle("locked",h),document.getElementById("qCd").style.height=h?"100%":Math.max(0,(e.qTimer||0)/e.def.qCd*100)+"%",Wa(document.getElementById("qCd"),"_qReady",h||(e.qTimer||0)>.05),document.getElementById("qCdNum").textContent=h?"L3":(e.qTimer||0)>.05?Math.ceil(e.qTimer):"",e.def.eCd&&(document.getElementById("eCd").style.height=Math.max(0,(e.eTimer||0)/e.def.eCd*100)+"%",Wa(document.getElementById("eCd"),"_eReady",(e.eTimer||0)>.05),document.getElementById("eCdNum").textContent=(e.eTimer||0)>.05?Math.ceil(e.eTimer):"");const d=document.getElementById("recallStatus");if(d&&(e.netChannel?(e._chanActive||(e._chanActive=!0,e._chanT=Ga),e._chanT=Math.max(0,e._chanT-n),d.style.display="flex",document.getElementById("recallText").textContent="🏠 RECALLING "+Math.ceil(e._chanT)+"s — stay safe!",document.getElementById("recallBarFill").style.width=(1-e._chanT/Ga)*100+"%"):(e._chanActive=!1,d.style.display="none")),e.dead){const f=document.getElementById("respawnMsg");f.style.display="block",e._deadSince||(e._deadSince=performance.now(),e._respEst=4+Math.min(8,(m.matchTime||0)/25));const p=Math.max(1,Math.ceil(e._respEst-(performance.now()-e._deadSince)/1e3));f.textContent="REKT — BACK IN ~"+p+"s"}else xl(),e._deadSince=0}}function QT(){K.on("input",n=>{if(!m.netHost)return;const e=m.entities.find(i=>i.netId===n.from);if(!e)return;const t=e.netInput||(e.netInput={mx:0,mz:0,ax:0,az:0,atk:0,q:0,e:0,rc:0});t.mx=n.mx,t.mz=n.mz,t.ax=n.ax,t.az=n.az,t.atk=n.atk,n.q&&(t.q=1),n.e&&(t.e=1),n.rc&&(t.rc=1)}),K.on("pickup",n=>{if(!m.netHost)return;const e=m.entities.find(t=>t.netId===n.from);e&&h0(e,n.idx)}),K.on("snap",n=>{m.netGuest&&jT(n)}),K.on("over",n=>{m.netGuest&&Mo(n.team===(m.player?m.player.team:0))}),K.on("ann",n=>{m.netGuest&&n.text&&di(n.text)}),K.onOppLost=()=>{m.running&&m.online&&Je("⚠ Opponent connection lost…")},K.onOppBack=()=>{m.running&&m.online&&Je("✅ Opponent reconnected")},K.onLeft=()=>{m.running&&m.online&&(Je("🚪 Opponent left"),di("OPPONENT LEFT — YOU WIN"),Mo(!0))}}let ir=0;function v0(n){if(m.preMatch>0){iT(n);return}if(m.netGuest){JT(n);return}if(m.matchTime+=n,m.boss)document.getElementById("bossTimer").textContent="👑 THE DUVE ALIVE — MID PIT";else{m.bossTimer-=n;const o=Math.max(0,Math.ceil(m.bossTimer));document.getElementById("bossTimer").textContent="THE DUVE IN "+Math.floor(o/60)+":"+String(o%60).padStart(2,"0"),m.bossTimer<=0&&e0()}if(Ua.setFromCamera(pl,bt),Ua.ray.intersectPlane(Wm,_t),Oi&&m.player&&!m.player.dead){const o=m.player;let a=null,c=16;Rt(o.team).forEach(l=>{if((l.isGoal||l.isCrystal)&&!Gi(l))return;const u=Math.sqrt(ke(l.pos,o.pos));u<c&&(c=u,a=l)}),a?_t.set(a.pos.x,0,a.pos.z):(o.lastDir||(o.lastDir=new S(0,0,-1)),_t.set(o.pos.x+o.lastDir.x*6,0,o.pos.z+o.lastDir.z*6))}d0(n);const e=m.player;if(!e.dead&&!m.autoPlayer){if(e.dash)Wh(e,n);else{const l=new S,u=hs.controlScheme==="camera";if(Oi)qt.active&&l.set(qt.x,0,qt.z);else if(u)l.set((Ye.d?1:0)-(Ye.a?1:0),0,(Ye.s?1:0)-(Ye.w?1:0));else{const h=new S(_t.x-e.pos.x,0,_t.z-e.pos.z);h.lengthSq()<.001&&h.set(0,0,-1),h.normalize();const d=new S(-h.z,0,h.x);l.addScaledVector(h,(Ye.w?1:0)-(Ye.s?1:0)).addScaledVector(d,(Ye.d?1:0)-(Ye.a?1:0))}if(e.moving=l.lengthSq()>.001,e.moving){l.normalize();const h=e.def.speed*Po(e)*Lr(e);e.pos.x+=l.x*h*n,e.pos.z+=l.z*h*n,(e.lastDir??=new S).copy(l)}e.moveDir=l}rn(e.pos,e.radius),un(e.pos,e.radius),(Co.down||qt.attack)&&(yl(e,_t),e.aimHoldT=.6),e.aimHoldT=Math.max(0,(e.aimHoldT||0)-n);const o=hs.controlScheme==="camera"&&!Oi&&e.aimHoldT<=0&&e.moving&&e.moveDir&&e.moveDir.lengthSq()>.001,a=o?e.moveDir.x:_t.x-e.pos.x,c=o?e.moveDir.z:_t.z-e.pos.z;e.mesh.rotation.y=Math.atan2(a,c)+Math.PI}
3649m.entities.forEach(o=>{if(o.dead){o.respawnT-=n,o.isPlayer&&(document.getElementById("respawnMsg").textContent="REKT — BACK IN "+Math.max(1,Math.ceil(o.respawnT))+"s"),o.respawnT<=0&&(o.dead=!1,o.hp=o.maxHp,o.pos.copy(i0(o.team,o.slot)),o.mesh.visible=!0,o.wpIndex=0,o.retreating=!1,o.isPlayer&&xl());return}if(o.remote?WT(o,n):(!o.isPlayer||m.autoPlayer)&&IT(o,n),ts(o,n*.26),o.atkTimer-=n,o.qTimer-=n,o.eTimer-=n,o.up&&o.up.regen>0&&!o.dead&&o.hp<o.maxHp&&(o.hp=Math.min(o.maxHp,o.hp+o.maxHp*o.up.regen*n)),o.rootT>0&&(o.rootT-=n),o.rootCd>0&&(o.rootCd-=n),o.chillT>0&&(o.chillT-=n,o.chillT<=0&&(o.chillStacks=0)),o.slowT>0&&(o.slowT-=n,Math.random()<n*6&&m.effects.length<320)){const c=new X(Vc,new _e({color:12577023,transparent:!0,depthWrite:!1}));c.position.set(o.pos.x+(Math.random()-.5)*1.2,1.8,o.pos.z+(Math.random()-.5)*1.2),m.scene.add(c),m.effects.push({mesh:c,life:.5,maxLife:.5,vel:new S(0,-1.6,0),grav:!1,shrink:1})}for(const c in o.buffs)o.buffs[c]>0&&(o.buffs[c]-=n);if(o.recallT>0&&(o.recallT-=n),o.invisT>0&&(o.invisT-=n),o.draftCards&&(o.draftT-=n,o.draftT<=0&&h0(o,null)),PT(o,n),o.channeling&&(o.channelT-=n,Math.random()<n*3&&yn(o.pos,1.5,9418495,.5),o.channelT<=0)){o.channeling=!1,o.recallT=tT,ii(o.pos,9418495,6,1.6),De(o.pos,5895136,12,9);const c=m.crystals[o.team].pos;o.pos.x=c.x+(o.team===0?3:-3),o.pos.z=c.z,o.dash=null,ii(o.pos,9418495,6,1.6),De(o.pos,5895136,12,9),ze(880,.12),o.isPlayer&&Je("🏠 Recalled to base")}o.bush=u0(o.pos);let a=!1;if(ke(o.pos,m.crystals[o.team].pos)<64&&o.hp<o.maxHp?(o.hp=Math.min(o.maxHp,o.hp+24*n),a=!0):o.hp<o.maxHp&&m.goals.some(c=>c.team===o.team&&!c.dead&&ke(o.pos,c.pos)<25)&&(o.hp=Math.min(o.maxHp,o.hp+12*n),a=!0),a&&Math.random()<n*4&&m.effects.length<320){const c=new X(Vc,new _e({color:8254106,transparent:!0,depthWrite:!1}));c.position.set(o.pos.x+(Math.random()-.5)*1.4,.6,o.pos.z+(Math.random()-.5)*1.4),m.scene.add(c),m.effects.push({mesh:c,life:.7,maxLife:.7,vel:new S(0,1.8,0),grav:!1,shrink:1})}if(o.flash>0&&(o.flash-=n,o.mats.forEach(c=>c.emissive.setHex(o.flash>0?8930372:c.userData.origEmissive||0))),Bi(o.bar,o.hp/o.maxHp),Di(o.bar),o.mixer?(o.mesh.position.y=0,m0(o,n)):p0(o,n),f0(o,n),o.isPlayer){const c=o.bush>=0;if(o.mats.forEach(l=>l.opacity=o.invisT>0?.3:c?.55:1),m.bushIndicator.visible=c,c){const l=cs[o.bush];m.bushIndicator.position.set(l.x,.04,l.z),m.bushIndicator.scale.set(l.hw+.2,l.hd+.2,1)}}else if(o.team!==(m.player?m.player.team:0)){const c=m.player?m.player.team:0;o.mesh.visible=!o.dead&&qa(o,c)&&!(o.shellT>0)}}),mT(n),m.neutrals.forEach(o=>{DT(o,n),o.rootT>0&&(o.rootT-=n),o.rootCd>0&&(o.rootCd-=n),o.chillT>0&&(o.chillT-=n,o.chillT<=0&&(o.chillStacks=0)),o.slowT>0&&(o.slowT-=n),o.dead||(o.flash>0&&(o.flash-=n),Bi(o.bar,o.hp/o.maxHp),Di(o.bar))}),m.goals.forEach(o=>{o.dead||(o.noSpin||(o.gem.rotation.y+=n*1.2),Bi(o.bar,o.hp/o.maxHp),Di(o.bar),Bf(o,n),ja(o))}),m.crystals.forEach(o=>{o.noSpin||(o.gem.rotation.y+=n*.8),Bi(o.bar,o.hp/o.maxHp),Di(o.bar),Bf(o,n),ja(o)}),document.querySelector("#allyC i").style.width=m.crystals[0].hp/m.crystals[0].maxHp*100+"%",document.querySelector("#enemyC i").style.width=m.crystals[1].hp/m.crystals[1].maxHp*100+"%",$m(m.player?m.player.team:0);for(let o=m.projectiles.length-1;o>=0;o--){const a=m.projectiles[o];if(a.mesh.position.addScaledVector(a.vel,n),a.kind==="shuriken"?a.mesh.rotation.y+=n*26:a.kind==="candle"?a.mesh.rotation.y+=n*9:a.kind==="card"?(a.mesh.rotation.z+=n*18,a.mesh.rotation.x+=n*5):a.kind==="bill"?(a.mesh.rotation.y+=n*10,a.mesh.rotation.z+=n*6):a.kind==="ki"||a.kind==="dart"||(a.mesh.rotation.x+=n*8,a.mesh.rotation.y+=n*6),a.kind==="smoke"&&(a.mesh.scale.multiplyScalar(1+n*1.4),a.mesh.traverse(l=>{l.isMesh&&(l.material.opacity=Math.max(.25,l.material.opacity-n*.55))})),a.life-=n,a.trailT-=n,a.trailT<=0&&m.effects.length<320){a.trailT=.035;const l=new X(CS,new _e({color:a.color,transparent:!0,depthWrite:!1}));l.position.copy(a.mesh.position),m.scene.add(l),m.effects.push({mesh:l,life:.28,maxLife:.28,shrink:1,alpha:.6})}let c=a.life<=0||Math.abs(a.mesh.position.x)>Pe.hw+2||Math.abs(a.mesh.position.z)>Pe.hd+2;if(!c){for(const l of Rt(a.team)){const u=l.isCrystal?5.5:l.radius>1?3.4:1.6;if(ke(l.pos,a.mesh.position)<u){ft(l,a.dmg,a.owner),a.kind==="smoke"?fi(a.mesh.position,14212322,3):De(a.mesh.position,a.color,6,7);const h=!l.isCrystal&&!l.isGoal&&!l.dead&&!l.isBoss;a.kind==="ice"&&h?(l.chillT=2.5,l.chillStacks=(l.chillStacks||0)+1,l.chillStacks>=3&&(l.chillStacks=0,l.slowT=2,l.slowFactor=.5,ft(l,18*Cr(a.owner),a.owner),zm(l.pos,125
364977023,6,1.8,1.2),De(l.pos,12577023,12,7),a.owner.isPlayer&&Je("❄ SHATTER — slowed + bonus damage!"))):a.kind==="smoke"&&h?(l.slowT=Math.max(l.slowT||0,1.4),l.slowFactor=.62,fi(l.pos,10132136,2)):a.kind==="dart"&&h&&(l.rootCd||0)<=0&&(l.rootT=.4,l.rootCd=3.2,De(l.pos,12868863,7,6),a.owner.isPlayer&&Je("🟣 Snared!")),c=!0;break}}if(!c){for(const l of fr)if(Math.abs(a.mesh.position.x-l.x)<l.hw+.2&&Math.abs(a.mesh.position.z-l.z)<l.hd+.2){De(a.mesh.position,a.color,4,5),c=!0;break}}}c&&(m.scene.remove(a.mesh),Fa(a.mesh),m.projectiles.splice(o,1))}for(let o=m.delayed.length-1;o>=0;o--)m.delayed[o].t-=n,m.delayed[o].t<=0&&(m.delayed[o].fn(),m.delayed.splice(o,1));for(let o=m.effects.length-1;o>=0;o--){const a=m.effects[o];a.life-=n;const c=a.life/a.maxLife;a.mesh.material&&(a.mesh.material.transparent=!0,a.mesh.material.opacity=c*(a.alpha||1)),a.grow&&a.mesh.scale.setScalar(1+(1-c)*a.grow),a.shrink&&a.mesh.scale.setScalar(Math.max(c,.01)*a.shrink),a.vel&&(a.mesh.position.addScaledVector(a.vel,n),a.grav!==!1&&(a.vel.y-=20*n,a.mesh.rotation.x+=n*6)),a.life<=0&&(m.scene.remove(a.mesh),Fa(a.mesh),a.dispose&&a.dispose.dispose(),m.effects.splice(o,1))}const t=new S(e.pos.x,0,e.pos.z);if(bt.position.lerp(new S(t.x,26,t.z+17),.08),m.shake>
36490){m.shake=Math.max(0,m.shake-n*1.6);const o=m.shake*m.shake*.9;bt.position.x+=(Math.random()-.5)*o,bt.position.z+=(Math.random()-.5)*o}bt.lookAt(t.x,0,t.z-1);{const o=Math.max(0,Math.ceil(wo-m.matchTime));if(document.getElementById("matchClock").textContent=Math.floor(o/60)+":"+String(o%60).padStart(2,"0"),!m.overtime&&m.matchTime>510&&(m.overtime=!0,document.getElementById("matchClock").style.color="var(--coral)",Ri("⚡ OVERTIME — STRUCTURES TAKE DOUBLE DAMAGE"),ze(440,.3)),m.matchTime>=wo){NT();return}}{const o=e.hp/e.maxHp,a=document.getElementById("hpFill");a.style.width=o*100+"%",a.style.background=o<.3?"linear-gradient(90deg,#e23b4e,#ff7d6c)":"",document.body.classList.toggle("lowHp",o>.001&&o<.3&&!e.dead)}document.getElementById("hpText").textContent=Math.ceil(e.hp)+" / "+e.maxHp,document.getElementById("lvlBadge").textContent=e.level,document.getElementById("xpFill").style.width=(e.level>=ro?100:e.xp/Va(e.level)*100)+"%",document.getElementById("basicCd").style.height=Math.max(0,e.atkTimer/e.def.atkCd*100)+"%";{const o=e.level<3;document.getElementById("qName").parentElement.classList.toggle("locked",o),document.getElementById("qCd").style.height=o?"100%":Math.max(0,e.qTimer/e.def.qCd*100)+"%",Wa(document.getElementById("qCd"),"_qReady",o||e.qTimer>.05),document.getElementById("qCdNum").textContent=o?"L3":e.qTimer>.05?Math.ceil(e.qTimer):""}e.def.eCd&&(document.getElementById("eCd").style.height=Math.max(0,e.eTimer/e.def.eCd*100)+"%",Wa(document.getElementById("eCd"),"_eReady",e.eTimer>.05),document.getElementById("eCdNum").textContent=e.eTimer>.05?Math.ceil(e.eTimer):"");const i=document.getElementById("buffs");let s="";for(const o in e.buffs)e.buffs[o]>0&&(s+=`<span class="buffChip ${o}">${is[o].label} ${Math.ceil(e.buffs[o])}s</span>`);e.slowT>0&&(s+=`<span class="buffChip" style="border-color:#7fd4ff;color:#7fd4ff">❄ CHILLED ${Math.ceil(e.slowT)}s</span>`),i.innerHTML=s;const r=document.getElementById("recallStatus");r&&(e.channeling?(r.style.display="flex",document.getElementById("recallBarFill").style.width=(1-e.channelT/Ga)*100+"%",document.getElementById("recallText").textContent="🏠 RECALLING "+Math.ceil(e.channelT)+"s — stay safe!"):r.style.display="none"),ir-=n,ir<=0&&(Bm(m.crystals,m.neutrals,m.entities,m.goals,qa,m.player?m.player.team:0),ir=.1),m.netHost&&qT(n)}const b0={};function $T(n){const t=document.createElement("canvas");t.width=t.height=64;const i=t.getContext("2d");if(n==="coin"){const s=i.createRadialGradient(24.32,21.76,4,32,32,30.72);s.addColorStop(0,"#fff3c4"),s.addColorStop(.55,"#ffd84d"),s.addColorStop(1,"#b8860b"),i.fillStyle=s,i.beginPath(),i.arc(64/2,64/2,64*.46,0,7),i.fill(),i.strokeStyle="rgba(120,80,0,.8)",i.lineWidth=3,i.stroke(),i.fillStyle="#8a5a00",i.font="900 34px Rubik, sans-serif",i.textAlign="center",i.textBaseline="middle",i.fillText("C",64/2,64/2+2)}else if(n==="berry"){i.fillStyle="#e8394a",i.beginPath(),i.ellipse(64/2,64*.58,64*.3,64*.34,0,0,7),i.fill(),i.fillStyle="#59c45e";for(const[s,r]of[[-8,-.7],[0,0],[8,.7]])i.save(),i.translate(64/2+s,64*.26),i.rotate(r),i.beginPath(),i.ellipse(0,0,4.5,9,0,0,7),i.fill(),i.restore();i.fillStyle="rgba(255,240,200,.85)";for(let s=0;s<7;s++)i.beginPath(),i.ellipse(64/2+(Math.random()*2-1)*64*.2,64*.58+(Math.random()*2-1)*64*.24,1.6,2.4,0,0,7),i.fill()}else if(n==="key")i.strokeStyle="#ffe9a0",i.fillStyle="#ffe9a0",i.lineWidth=6,i.lineCap="round",i.beginPath(),i.arc(64*.32,64*.34,11,0,7),i.stroke(),i.beginPath(),i.moveTo(64*.4,64*.42),i.lineTo(64*.72,64*.74),i.stroke(),i.beginPath(),i.moveTo(64*.62,64*.76),i.lineTo(64*.7,64*.68),i.stroke(),i.beginPath(),i.moveTo(64*.7,64*.84),i.lineTo(64*.78,64*.76),i.stroke();else{const s=i.createRadialGradient(32,32,1,32,32,25.6);s.addColorStop(0,"rgba(255,230,160,1)"),s.addColorStop(.4,"rgba(196,92,255,.55)"),s.addColorStop(1,"rgba(196,92,255,0)"),i.fillStyle=s,i.fillRect(0,0,64,64)}return t}let Xa=!1,w0=[],sn=null,Nn=null;function M0(n,e,t){const i=Math.random(),s=i<.14?"coin":i<.26?"berry":i<.34?"key":"ember",r=s!=="ember";return{kind:s,x:Math.random()*n,y:t?Math.random()*e:e+40,s:r?14+Math.random()*20:22+Math.random()*42,vy:(r?12+Math.random()*16:6+Math.random()*10)/60,sway:14+Math.random()*22,swaySp:.25+Math.random()*.5,ph:Math.random()*7,rot:
3649Math.random()*7,rotSp:(Math.random()-.5)*.01,a:r?.5+Math.random()*.35:.25+Math.random()*.3}}function _0(n){if(!Xa)return;const e=sn.width,t=sn.height;Nn.clearRect(0,0,e,t);for(const i of w0){i.y-=i.vy*16,i.rot+=i.rotSp*16;const s=i.x+Math.sin(n*.001*i.swaySp+i.ph)*i.sway;i.y<-60&&Object.assign(i,M0(e,t,!1)),Nn.save(),Nn.globalAlpha=i.a,Nn.translate(s,i.y),Nn.rotate(i.kind==="ember"?0:i.rot),Nn.drawImage(b0[i.kind],-i.s/2,-i.s/2,i.s,i.s),Nn.restore()}requestAnimationFrame(_0)}function Nf(){sn&&(sn.width=innerWidth,sn.height=innerHeight)}function Vh(){if(!sn){if(sn=document.getElementById("lobbyFx"),!sn)return;Nn=sn.getContext("2d");for(const e of["coin","berry","key","ember"])b0[e]=$T(e);addEventListener("resize",Nf)}Nf();const n=innerWidth<700?22:40;w0=Array.from({length:n},()=>M0(sn.width,sn.height,!0)),Xa||(Xa=!0,requestAnimationFrame(_0))}function qh(){Xa=!1,Nn&&sn&&Nn.clearRect(0,0,sn.width,sn.height)}const e2="https://chudhouse-mp.chudmode.workers.dev/parties/room/stats";let zf=null;async function Ff(){const n=document.getElementById("lobbyTickerInner");if(!n)return;const e=[];try{const i=await(await fetch(e2,{cache:"no-store"})).json();i.liveNow>0&&e.push(`🔥 ${i.liveNow} degen${i.liveNow===1?"":"s"} in the trenches right now`),i.matchStarts>0&&e.push(`⚔️ ${i.matchStarts.toLocaleString()} matches fought all-time`)}catch{}try{const{rows:i,season:s}=await Sm();i[0]&&e.push(`👑 ${i[0].name} leads the ladder — ${i[0].tier} · ${i[0].rp} RP`),i[1]&&e.push(`🥈 ${i[1].name} is right behind at ${i[1].rp} RP`),s&&e.push(`⏳ Season ${s.n} ends in ${Math.max(1,Math.round(s.endsIn/36e5))}h — climb NOW`)}catch{}e.push("🍓 NEW CHAMPION: WAPITAL — the strawberry stampede"),e.push("💎 Hit DIAMOND and your name goes down in Past Champions forever"),e.push("🏆 Ranked pairs you by RP — win = +20, style points free");const t=e.join("&nbsp;&nbsp;&nbsp;·&nbsp;&nbsp;&nbsp;")+"&nbsp;&nbsp;&nbsp;·&nbsp;&nbsp;&nbsp;";n.innerHTML=`<span>${t}</span><span>${t}</span>`}function t2(){Ff(),zf||(zf=setInterval(Ff,45e3))}const n2="play.chudhouse.fun",Of="https://play.chudhouse.fun";function i2(n){return new Promise(e=>{const t=new Image;t.onload=()=>e(t),t.onerror=()=>e(null),t.src=n})}function Mc(n,e,t,i,s,r){n.beginPath(),n.moveTo(e+r,t),n.arcTo(e+i,t,e+i,t+s,r),n.arcTo(e+i,t+s,e,t+s,r),n.arcTo(e,t+s,e,t,r),n.arcTo(e,t,e+i,t,r),n.closePath()}function s2(n){const e=n.champName||"a CHUD";return n.ranked&&n.tier?n.promoted?`Just hit ${n.tier} 🏆 on CHUDHOUSE — ${n.won?"W":"took an L"} as ${e} (${n.kills}/${n.deaths}, ${n.delta>0?"+":""}${n.delta} RP) 🔥`:n.won?`W as ${e} on CHUDHOUSE — ${n.kills}/${n.deaths}, ${n.delta>0?"+":""}${n.delta} RP 📈 catch these hands`:`Ran it back as ${e} on CHUDHOUSE — ${n.kills}/${n.deaths}, ${n.delta} RP. Come clap me 👊`:n.won?`Dubbed up as ${e} on CHUDHOUSE 🏆 (${n.kills}/${n.deaths})`:`Got rekt as ${e} on CHUDHOUSE — run it back 👊`}async function r2(n){const i=document.createElement("canvas");i.width=1200,i.height=675;const s=i.getContext("2d");try{await document.fonts.ready}catch{}const r=(d,f)=>`${d} ${f}px "Bungee", system-ui, sans-serif`,o=s.createLinearGradient(0,0,1200,675);o.addColorStop(0,"#1a1436"),o.addColorStop(1,"#0d091d"),s.fillStyle=o,s.fillRect(0,0,1200,675),s.fillStyle="#ffd84d",s.fillRect(0,0,1200,10),s.textAlign="left",s.fillStyle="#ffd84d",s.font=r(400,44),s.fillText("CHUDHOUSE",58,92),s.fillStyle="#9a91c4",s.font="600 22px system-ui, sans-serif",s.fillText("the real trenches",60,126);const a=await i2(`/art/champions/${n.champKey}.jpg`),c=58,l=185,u=300;Mc(s,c,l,u,u,26),s.save(),s.clip(),a?s.drawImage(a,c,l,u,u):(s.fillStyle="#2a2350",s.fillRect(c,l,u,u),s.textAlign="center",s.font="150px system-ui",s.fillText(n.face||"🧑",c+u/2,l+u/2+52),s.textAlign="left"),s.restore(),s.lineWidth=5,s.strokeStyle=n.won?"#59f3e0":"#ff5c7a",Mc(s,c,l,u,u,26),s.stroke();const h=410;if(s.fillStyle=n.won?"#59f3e0":"#ff5c7a",s.font=r(400,92),s.fillText(n.won?"VICTORY":"REKT",h,268),s.fillStyle="#ffffff",s.font="800 46px system-ui, sans-serif",s.fillText(((n.username?n.username+" · ":"")+(n.
3649champName||"")).slice(0,26),h,336),s.fillStyle="#e9e4ff",s.font="700 40px system-ui, sans-serif",s.fillText(`${n.kills} / ${n.deaths}  K/D`,h,398),n.ranked&&n.tier){const d=String(n.tier).toUpperCase();s.font=r(400,30);const f=s.measureText(d).width+46;s.fillStyle=n.tierColor||"#d08a4a",Mc(s,h,438,f,54,27),s.fill(),s.fillStyle="#1a1330",s.textAlign="center",s.fillText(d,h+f/2,476),s.textAlign="left";const p=n.delta>0?"#43e36b":n.delta<0?"#ff5c7a":"#9a91c4";s.fillStyle=p,s.font="800 42px system-ui, sans-serif",s.fillText(`${n.delta>0?"+":""}${n.delta} RP`,h+f+28,480),n.promoted&&(s.fillStyle="#ffd84d",s.font=r(400,32),s.fillText(`PROMOTED TO ${d}! 🏆`,h,552))}return s.fillStyle="#9a91c4",s.font="700 30px system-ui, sans-serif",s.fillText(n2,58,631),new Promise(d=>i.toBlob(f=>d(f),"image/png"))}async function o2(n){let e=null;try{e=await r2(n)}catch{}const t=s2(n);if(e&&navigator.canShare){const s=new File([e],"chudhouse.png",{type:"image/png"});if(navigator.canShare({files:[s]}))try{await navigator.share({files:[s],text:t,url:Of});return}catch(r){if(r&&r.name==="AbortError")return}}const i=`https://twitter.com/intent/tweet?text=${encodeURIComponent(t)}&url=${encodeURIComponent(Of)}`;if(window.open(i,"_blank","noopener"),e){const s=document.createElement("a");s.href=URL.createObjectURL(e),s.download="chudhouse-result.png",s.click(),setTimeout(()=>URL.revokeObjectURL(s.href),5e3)}}var a2=()=>{window.va||(window.va=function(...e){window.vaq||(window.vaq=[]),window.vaq.push(e)})},l2="@vercel/analytics",c2="2.0.1";function jh(){return typeof window<"u"}function S0(){try{const n="production"}catch{}return"production"}function h2(n="auto"){if(n==="auto"){window.vam=S0();return}window.vam=n}function T0(){return(jh()?window.vam:S0())||"production"}function Hf(){return T0()==="production"}function wl(){return T0()==="development"}function u2(n,{[n]:e,...t}){return t}function d2(n,e){if(!n)return;let t=n;const i=[];for(const[s,r]of Object.entries(n))typeof r=="object"&&r!==null&&(e.strip?t=u2(s,t):i.push(s));if(i.length>0&&!e.strip)throw Error(`The following properties are not valid: ${i.join(", ")}. Only strings, numbers, booleans, and null are allowed.`);return t}function f2(n){return n.scriptSrc?Xs(n.scriptSrc):wl()?"https://va.vercel-scripts.com/v1/script.debug.js":n.basePath?Xs(`${n.basePath}/insights/script.js`):"/_vercel/insights/script.js"}function p2(n,e){var t;let i=n;if(e)try{i={...(t=JSON.parse(e))==null?void 0:t.analytics,...n}}catch{}h2(i.mode);const s={sdkn:l2+(i.framework?`/${i.framework}`:""),sdkv:c2};return i.disableAutoTrack&&(s.disableAutoTrack="1"),i.viewEndpoint&&(s.viewEndpoint=Xs(i.viewEndpoint)),i.eventEndpoint&&(s.eventEndpoint=Xs(i.eventEndpoint)),i.sessionEndpoint&&(s.sessionEndpoint=Xs(i.sessionEndpoint)),wl()&&i.debug===!1&&(s.debug="false"),i.dsn&&(s.dsn=i.dsn),i.endpoint?s.endpoint=i.endpoint:i.basePath&&(s.endpoint=Xs(`${i.basePath}/insights`)),{beforeSend:i.beforeSend,src:f2(i),dataset:s}}function Xs(n){return n.startsWith("http://")||n.startsWith("https://")||n.startsWith("/")?n:`/${n}`}function m2(n={debug:!0},e){var t;if(!jh())return;const{beforeSend:i,src:s,dataset:r}=p2(n,e);if(a2(),i&&((t=window.va)==null||t.call(window,"beforeSend",i)),document.head.querySelector(`script[src*="${s}"]`))return;const o=document.createElement("script");o.src=s;for(const[a,c]of Object.entries(r))o.dataset[a]=c;o.defer=!0,o.onerror=()=>{const a=wl()?"Please check if any ad blockers are enabled and try again.":"Be sure to enable Web Analytics for your project and deploy again. See https://vercel.com/docs/analytics/quickstart for more information.";console.log(`[Vercel Web Analytics] Failed to load script from ${s}. ${a}`)},document.head.appendChild(o)}function Xh(n,e,t){var i,s;if(!jh()){const r="[Vercel Web Analytics] Please import `track` from `@vercel/analytics/server` when using this function in a server environment";if(Hf())console.warn(r);else throw new Error(r);return}if(!e){(i=window.va)==null||i.call(window,"event",{name:n,options:t});return}try{const r=d2(e,{strip:Hf()});(s=window.va)==null||s.call(window,"event",{name:n,data:r,options:t})}catch(r){r instanceof Error&&wl()&&console.error(r)}}globalThis.Buffer||(globalThis.Buffer=Q0.Buffer);globalThis.global||(globalThis.global=globalThis);m2();Vh();t2();setTimeout(()=>document.getElementById("lobby").classList.remove("boot"),1800);const Io="https://chudhouse-mp.chudmode.workers.dev/parties/room/stats";let li=localStorage.getItem("chud_uid");li||(li=self.crypto&&crypto.randomUUID?crypto.randomUUID():"u"+Date.now()+Math.random().toString(36).slice(2),localStorage.setItem("chud_uid",li));const qr={enabled:!0,id:"seeker-free-2026-07",title:"Solana Seeker — Play Free",body:"Solana Seeker players don’t need to hold CHUDHOUSE to play — it’s free for now. Jump in!"};function g2(){try{if(qr.enabled,localStorage.getItem("chud_ann_seen")===qr.id)return;const n=document.getElementById("annOverlay");if(!n)return;document.getElementById("annTitle").textContent=qr.title,document.getElementById("annBody").textContent=qr.body,n.style.display="flex";const e=()=>{n.style.display="none";try{localStorage.setItem("chud_ann_seen",qr.id)}catch{}};document.getElementById("annOk").onclick=e,n.onclick=t=>{t.target===n&&e()}}catch{}}function x2(){try{if(B&&B.guest)return"seeker";const n=navigator.userAgent||"";return!!(window.matchMedia&&matchMedia("(display-mode: standalone)").matches)&&/Android/i.test(n)?"seeker":/iPhone|iPad|iPod/i.test(n)?"ios":/Android/i.test(n)?"android":/M
3649obile/i.test(n)?"mobile":"desktop"}catch{return"?"}}const y2=()=>"Seeker"+String(li).replace(/[^0-9A-Za-z]/g,"").slice(-4).toUpperCase();function Rn(n,e){try{const t=B&&B.username?B.username:B&&B.guest?y2():null,i=t?"&name="+encodeURIComponent(t):"",s=B&&B.address?"&wallet="+encodeURIComponent(B.address):"";fetch(Io+"?mode="+n+"&uid="+encodeURIComponent(li)+(e?"&playing=1":"")+i+s+"&dev="+x2(),{method:"POST",keepalive:!0})}catch{}}Rn("visit");setInterval(()=>Rn("hb",m.running?1:0),15e3);const Yh=Io.replace("/stats","/gate"),v2=()=>String(document.referrer||"").startsWith("android-app://")||!!(window.matchMedia&&matchMedia("(display-mode: standalone)").matches&&/Android/i.test(navigator.userAgent));document.addEventListener("visibilitychange",()=>{document.hidden||(m.netSnapAge=0)});const b2=document.getElementById("liveText");let ya=8+Math.floor(Math.random()*9);async function E0(){ya=Math.max(6,Math.min(24,ya+(Math.floor(Math.random()*5)-2)));let n={liveNow:0,playingNow:0};try{n=await(await fetch(Io,{cache:"no-store"})).json()}catch{}const e=(n.liveNow||0)+ya,t=(n.playingNow||0)+Math.floor(ya*.45);b2.textContent=`${e} online`+(t?` · ${t} in match`:"")}E0();setInterval(E0,12e3);const Ys=document.getElementById("chatRoom"),ti=document.getElementById("chatRoomLog"),rs=document.getElementById("chatRoomInput"),mr=document.getElementById("chatRoomSend"),va=document.getElementById("chatRoomNote");let Uf=0;function jr(n){va&&(va.textContent=n,va.style.display=n?"block":"none",n&&setTimeout(()=>{va.style.display="none"},4e3))}function A0(n){if(!ti)return;const e=ti.scrollTop+ti.clientHeight>=ti.scrollHeight-24;if(ti.innerHTML="",!n.length){const t=document.createElement("div");t.className="cmEmpty",t.textContent="Quiet in the trenches… say gm.",ti.appendChild(t);return}for(const t of n){const i=document.createElement("div");i.className="cm";const s=document.createElement("b");s.textContent=String(t.n||"??").slice(0,14),s.style.color=t.tc||"#f4a627";const r=document.createTextNode(String(t.t||""));i.appendChild(s),i.appendChild(r),ti.appendChild(i),Uf=Math.max(Uf,t.ts||0)}e&&(ti.scrollTop=ti.scrollHeight)}async function L0(){const n=document.getElementById("lobby").style.display!=="none";if(Ys&&(Ys.style.display=n?"flex":"none"),!(!n||document.hidden)){C0();try{const e=await(await fetch(Yh+"?chat=1",{cache:"no-store"})).json();Array.isArray(e.chat)&&A0(e.chat)}catch{}}}function C0(){const n=!!(B.username&&B.pass);rs&&(rs.disabled=!n,rs.placeholder=n?"Say something…":B.guest?"Create a callsign to chat":"Connect + claim a callsign to chat"),mr&&(mr.disabled=!n)}async function R0(){const n=(rs.value||"").trim();if(!(!n||!B.pass)){mr.disabled=!0;try{const t=await(await fetch(Yh,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({chat:"send",pass:B.pass,text:n})})).json();t.ok?(rs.value="",Array.isArray(t.chat)&&A0(t.chat)):t.error==="no-links"?jr("🚫 Links aren’t allowed in chat."):t.error==="slow-down"?jr("⏳ Easy — one message every few seconds."):t.error==="need-name"?jr("Create a callsign first."):jr("Couldn’t send — try again.")}catch{jr("Couldn’t send — connection hiccup.")}mr.disabled=!1,C0()}}mr&&(mr.onclick=R0);rs&&rs.addEventListener("keydown",n=>{n.key==="Enter"&&(n.preventDefault(),R0())});{const n=document.getElementById("chatRoomHead"),e=(()=>{try{return localStorage.getItem("chud_chat_collapsed")}catch{return null}})();(e!=null?e==="1":matchMedia("(max-width:760px)").matches)&&Ys&&Ys.classList.add("collapsed"),n&&(n.onclick=()=>{Ys.classList.toggle("collapsed");try{localStorage.setItem("chud_chat_collapsed",Ys.classList.contains("collapsed")?"1":"0")}catch{}})}L0();setInterval(L0,6e3);oS();aS(Fh);lS(Oh);function P0(){document.querySelectorAll(".ctrlToggle button").forEach(n=>n.classList.toggle("on",n.dataset.scheme===hs.controlScheme))}document.querySelectorAll(".ctrlToggle button").forEach(n=>{n.onclick=()=>{hs.controlScheme=n.dataset.scheme,dS(),P0()}});P0();const I0=()=>{const n=document.getElementById("escMenu");if(n.style.display==="flex"){n.style.display="none";return}m.running&&(n.style.display="flex")};{const n=document.getElementById("escMenu");cS(I0),document.getElementById("resumeBtn").onclick=()=>{n.style.display="none"},document.getElementById("leaveBtn").onclick=()=>{n.style.display="none",document.getElementById("chatBox").style.display="none",g0(),ws(),Vh()}}Oi&&(document.body.classList.add("mobile"),hS({onQ:Fh,onE:Oh,onMenu:I0,onChat:R2,onBase:Gh}
3649),document.querySelector("#lobby .hint").innerHTML='📱 left thumb — move · ⚔️ — attack (auto-aims) · Q/E — specials · ☰ — menu<br>smash the enemy <b style="color:var(--coral)">goal zones</b> lane by lane to crack their <b style="color:var(--gold)">Vault</b><br>hide in <b style="color:#5ec45e">bushes</b> · jungle camps give buffs · <b style="color:var(--violet)">THE DUVE</b> pumps your whole team');let ai=!1;{const n=document.getElementById("startBtn"),e=document.getElementById("startBtnLabel")||n;n.disabled=!0,e.textContent="LOADING…",Promise.all([w_(),Z_([...Object.keys(pt),"duve","camp_dmg","camp_spd","thedoge","lmao","qrocket","qhouse","qshell","chudhood"])]).finally(()=>{ai=!0,e.textContent="ENTER ARENA",ws(),mi()})}addEventListener("keydown",n=>{m.choosing&&(n.key==="1"||n.key==="2"||n.key==="3")&&c0(+n.key-1)});let oo=null;function B0(n){!oo||!oo[n]||(K.send({t:"pickup",idx:n}),oo=null,document.getElementById("upgradePick").style.display="none")}K.onDraft=n=>{if(!m.netGuest||n.to!==K.id)return;oo=n.cards;const e=document.getElementById("upgradeCards");e.innerHTML="",n.cards.forEach((t,i)=>{const s=document.createElement("div");s.className="upgradeCard",s.innerHTML=`<div class="uName">${t.name}</div><div class="uDesc">${t.desc}</div><div class="uKey">${i+1}</div>`,s.onclick=()=>B0(i),e.appendChild(s)}),document.getElementById("upgradePick").style.display="flex"};addEventListener("keydown",n=>{oo&&(n.key==="1"||n.key==="2"||n.key==="3")&&B0(+n.key-1)});addEventListener("keydown",n=>{const e=document.activeElement&&(document.activeElement.tagName==="INPUT"||document.activeElement.tagName==="TEXTAREA");(n.key==="b"||n.key==="B")&&m.running&&!m.choosing&&!e&&Gh()});document.getElementById("recallBtn").onclick=Gh;const us=document.getElementById("onlineStatus"),pi=document.getElementById("onlineLobby"),w2=document.getElementById("onlinePlayers"),M2=document.getElementById("onlineRoomLine"),ba=document.getElementById("onlineHint"),Kr=document.getElementById("lockBtn"),Jr=document.getElementById("hostStartBtn");function _2(){const n="ABCDEFGHJKLMNPQRSTUVWXYZ23456789";let e="";for(let t=0;t<4;t++)e+=n[Math.floor(Math.random()*n.length)];return e}const S2=n=>n&&pt[n]?pt[n].name:"—",Ae=document.getElementById("username"),qc=`https://pump.fun/coin/${bm}`,os=document.getElementById("brokePopup");{const n=document.getElementById("brokeBuy"),e=document.getElementById("brokeBuyBtn");n&&(n.href=qc),e&&(e.href=qc)}function jc(){if(!os)return;const n=document.getElementById("brokeMsg"),e=document.getElementById("brokeBuyBtn");B.chain==="evm"?(n&&(n.innerHTML="Broke ass detected — you need <b>100k $CHUDINHOOD</b> on Robinhood Chain"),e&&(e.style.display="none")):(n&&(n.innerHTML='Broke ass detected — go buy some <a id="brokeBuy" href="'+qc+'" target="_blank" rel="noopener">$CHUDHOUSE</a>'),e&&(e.style.display="")),os.classList.add("show");try{Ae.blur()}catch{}}function Gf(){os&&os.classList.remove("show")}{const n=document.getElementById("brokeClose");n&&(n.onclick=Gf),os&&os.addEventListener("click",e=>{e.target===os&&Gf()})}async function T2(){if(B.guest){const t=xo(Ae.value);if(!t||t.length<2){Ae.value=B.username||"",!B.username&&ct&&(ct.innerHTML="🚫 Callsign needs 2+ letters/numbers.");return}if(t===B.username){Ae.value=B.username;return}Ae.disabled=!0;let i;try{i=await _m(li,document.referrer,t)}catch{}if(Ae.disabled=!1,i&&i.taken){Ae.value=B.username||"",ct&&(ct.innerHTML=`🚫 <b>${ci(t)}</b> is already taken — pick another.`),Ae.focus();return}if(i&&i.invalid){Ae.value=B.username||"",ct&&(ct.innerHTML="🚫 Use letters, numbers, space, _ . - (2–14 chars)."),Ae.focus();return}Ae.value=B.username||t,B.username&&(K.myName=B.username),K.connected()&&K.setName(K.myName),B.username&&Rn("hb",m.running?1:0),mi();return}const n=xo(Ae.value);if(Ae.value=n,B.connected&&!B.eligible){jc(),Ae.value="";return}if(!B.connected||!n||n===B.username)return;if(n.length<2){ct&&(ct.innerHTML="🚫 Callsign needs 2+ letters/numbers."),Ae.focus();return}Ae.disabled=!0;let e;try{e=await D_(n)}catch{}if(Ae.disabled=!1,e&&e.taken){Ae.value=B.username||"",ct&&(ct.innerHTML=`🚫 <b>${ci(n)}</b> is taken by a current holder — pick another.`),Ae.focus();return}if(e&&e.busy){Ae.value=B.username||"",ct&&(ct.innerHTML=`⏳ Couldn't check <b>${ci(n)}</b> right now — try again in a sec.`),Ae.focus();return}
3649if(e&&e.invalid){Ae.value=B.username||"",ct&&(ct.innerHTML="🚫 Use letters, numbers, space, _ . - (2–14 chars)."),Ae.focus();return}if(e&&e.needTokens){Ae.value="",jc();return}K.myName=B.username||n,K.connected()&&K.setName(K.myName),B.username&&Rn("hb",m.running?1:0),mi()}Ae.addEventListener("keydown",n=>{n.key==="Enter"&&(n.preventDefault(),Ae.blur())});Ae.addEventListener("blur",T2);Ae.addEventListener("focus",()=>{B.connected&&!B.eligible&&jc()});const Bo=document.getElementById("chatBox"),E2=document.getElementById("chatLog"),as=document.getElementById("chatInput"),A2=document.getElementById("chatSend"),L2=document.getElementById("lobbyChatLog"),Ea=document.getElementById("lobbyChatInput"),C2=document.getElementById("lobbyChatSend");function Wf(n,e,t,i,s,r,o){const a=document.createElement("div");a.className="cmsg "+(i===1?"red":"blue");const c=document.createElement("b");r&&(c.innerHTML=Ro(r,o,14)+" "),c.appendChild(document.createTextNode((e||"Player")+": "));const l=document.createElement("span");for(l.textContent=t,a.append(c,l),n.appendChild(a);n.children.length>12;)n.removeChild(n.firstChild);n.scrollTop=n.scrollHeight,s&&setTimeout(()=>{a.style.transition="opacity .6s",a.style.opacity="0",setTimeout(()=>a.remove(),600)},9e3)}function Zh(n,e,t,i,s){Wf(E2,n,e,t,!0,i,s),Wf(L2,n,e,t,!1,i,s)}K.onChat=n=>Zh(n.name,n.text,n.team,n.tier,n.tierColor);function D0(){m.online&&(Bo.classList.add("open"),["w","a","s","d"].forEach(n=>Ye[n]=!1),as.focus())}function Kh(){Bo.classList.remove("open"),as.blur()}function Jh(){const n=as.value.trim();if(n){const e=m.player?m.player.team:0;K.sendChat(n,e),Zh(K.myName||"You",n,e,B.tier,B.tierColor)}as.value="",Kh()}function R2(){Bo.classList.contains("open")?Jh():D0()}A2.onclick=Jh;addEventListener("keydown",n=>{!m.running||!m.online||(n.key==="Enter"?document.activeElement===as?Jh():(D0(),n.preventDefault()):n.key==="Escape"&&document.activeElement===as&&(as.value="",Kh(),n.preventDefault(),n.stopPropagation()))});function k0(){const n=Ea.value.trim();n&&K.connected()&&(K.sendChat(n),Zh(K.myName||"You",n,void 0,B.tier,B.tierColor)),Ea.value="",Ea.focus()}C2.onclick=k0;Ea.addEventListener("keydown",n=>{n.key==="Enter"&&(n.preventDefault(),k0())});K.onLobby=(n,e,t)=>{const i=e.filter(l=>!(n[l]&&n[l].spectator)),s=e.length-i.length,r=[...i].sort()[0],o=K.needHumans||2,a=K.teamSize>=3?"3v3":"1v1",c=K.publicFill?"⚡ Quick Match":`Room <b>${K.room}</b>`;if(M2.innerHTML=`${c} · ${i.length}/${o} players${s?` · 👁 ${s} watching`:""} · ${a}`,w2.innerHTML=i.map(l=>{const u=n[l]||{},h=l===K.id,d=(u.name||(h?"You":"Player")).replace(/[<>&]/g,"")+(h?" (you)":""),f=u.tier?Ro(u.tier,u.tierColor,15):"";return`<div class="olPlayer${h?" me":""}">
3650      <span class="olName">${f}${d}${l===r?" 👑":""}</span>
3651      <span class="olChamp">${S2(u.champ)}</span>
3652      <span class="olReady ${u.ready?"rdy":""}">${u.ready?"✅ ready":"… picking"}</span></div>`}).join(""),K.publicFill){if(Kr.style.display="none",Jr.style.display="none",!Ln)return;const l=i.filter(u=>n[u]&&n[u].ready).length;i.length<o?ba.textContent=`⏳ Waiting for players… ${i.length}/${o} — say hi in chat!`:ba.textContent=K.allReady()?"✅ Everyone in — starting…":`Locking in… ${l}/${o}`,K.myReady||K.setReady(!0),t&&!K.inMatch&&i.length>=o&&K.allReady()&&K.beginMatch();return}if(K.autoStart){if(Kr.style.display="none",Jr.style.display="none",i.length>=2)Vn=!0;else if(Vn&&!K.inMatch){Vn=!1,Ln=!1,An=null,K.cancelQueue(),K.disconnect(),rt.onPick=null,Wi.style.display="none",pi.style.display="none",us.textContent="👋 Opponent left before the match — back to the lobby.";return}if(!Ln){getComputedStyle(Wi).display==="none"&&(pi.style.display="none",_l("onlinePick",(K.ranked?"🏆 RANKED":"⚡ QUICK")+" · OPPONENT FOUND"));return}ba.textContent=K.allReady()?"Both locked in — starting…":"Locked in — waiting for your opponent to pick…",K.myReady||K.setReady(!0),t&&K.allReady()&&K.beginMatch();return}Kr.style.display="block",Kr.textContent=K.myReady?"✖ UNREADY":"✅ LOCK IN",Jr.style.display=t?"block":"none",Jr.disabled=!K.allReady(),ba.textContent=t?K.allReady()?"Everyone locked in — start when ready!":"Waiting for all players to lock in (need 2+)…":"Waiting for the host to start the match…"};K.onStart=n=>
3652{window.__mp=n,m.pendingNet=n,clearTimeout(Ml),clearTimeout(ds),gr=null,Xh("match_start",{mode:"online",champ:rt.selectedChar}),K.isHost?Rn("online",1):Rn("hb",1),K.autoStart=!1,pi.style.display="none",Wi.style.display="none",An=null,Bo.style.display="flex",Kh(),Ar(),qh(),bl()};K.onClosed=()=>{clearTimeout(ds),pi.style.display="none",Bo.style.display="none",rt.onPick=null,Ln=!1,Vn=!1,An==="onlinePick"&&(Wi.style.display="none",An=null),us.textContent="Disconnected from room."};const Xc=document.getElementById("onlineBtn"),Yc=document.getElementById("publicBtn"),Ya=document.getElementById("quick3Btn"),Vf=document.getElementById("rankedBtn"),Wi=document.getElementById("champSelect");let An=null,Ln=!1,Vn=!1,Ml=null,gr=null,ds=null;const P2=1e4;function I2(){K.publicFill&&K.isHost&&K.myReady&&!K.inMatch&&K.connected()&&K.beginMatch()}function _l(n,e){An=n,document.getElementById("csMode").textContent=e||n,Wi.style.display="flex",ws()}function N0(){const n=An==="onlinePick",e=An==="backfill";Wi.style.display="none",An=null,clearTimeout(Ml),clearTimeout(ds),gr=null,n?(K.cancelQueue(),K.disconnect(),rt.onPick=null,pi.style.display="none",Ln=!1,Vn=!1,us.textContent="Left the match lobby."):e&&(us.textContent="Left the match.")}document.getElementById("csBack").onclick=N0;addEventListener("keydown",n=>{n.key==="Escape"&&Wi.style.display==="flex"&&!m.running&&N0()});document.getElementById("lockInBtn").onclick=()=>{const n=An;Wi.style.display="none",An=null,n==="solo"?q2():n==="backfill"?D2():n==="onlinePick"&&(Ln=!0,K.setPick(rt.selectedChar),pi.style.display="flex",K.autoStart&&!K.myReady&&K.setReady(!0),K.publicFill&&(K.setReady(!0),clearTimeout(ds),ds=setTimeout(I2,P2)))};function B2(){if(!B.eligible||!B.username||!ai)return;let n=(prompt("Enter a room code to JOIN a friend, or leave blank to CREATE one:")||"").trim().toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,6);n||(n=_2()),K.autoStart=!1,Ln=!1,Vn=!1,K.myTier=B.tier,K.myTierColor=B.tierColor,K.connect(n,rt.selectedChar,Ae.value.trim()||null),rt.onPick=e=>K.setPick(e),_l("onlinePick","🔒 ROOM "+n)}function D2(){const n=gr;gr=null,m.pendingNet=null,m.pendingBackfill=n,Xh("match_start",{mode:"quick_bf",champ:rt.selectedChar}),Rn("online",1),Ar(),qh(),bl()}function z0(n){!B.eligible||!B.username||!ai||(Ln=!1,Vn=!1,gr=null,clearTimeout(Ml),clearTimeout(ds),K.myTier=B.tier,K.myTierColor=B.tierColor,K.joinQuick(n,rt.selectedChar,Ae.value.trim()||null),rt.onPick=e=>K.setPick(e),_l("onlinePick",n>=3?"⚡ QUICK MATCH · 3v3":"⚡ QUICK MATCH · 1v1"))}Xc.onclick=()=>B2();Yc.onclick=()=>z0(1);Ya&&(Ya.onclick=()=>z0(3));Vf&&(Vf.onclick=()=>{us&&(us.textContent="🏆 Ranked is coming soon — play Quick Match for now.")});K.onQueueEnd=()=>{pi.style.display="none",rt.onPick=null,Ln=!1,Vn=!1};Kr.onclick=()=>K.setReady(!K.myReady);Jr.onclick=()=>K.beginMatch();document.getElementById("leaveRoomBtn").onclick=()=>{K.cancelQueue(),K.disconnect(),clearTimeout(Ml),clearTimeout(ds),gr=null,rt.onPick=null,pi.style.display="none",Ln=!1,Vn=!1};const On=document.getElementById("connectBtn"),Hn=document.getElementById("connectEvmBtn"),qf=document.getElementById("disconnectBtn"),wa=document.getElementById("walletInfo"),jf=document.getElementById("walletStatus"),ct=document.getElementById("gateNote"),ns=document.getElementById("startBtn"),Zs=document.getElementById("spectateBtn"),Ks=document.getElementById("adminBtn"),Ma=n=>n==null?"0":Math.floor(n).toLocaleString("en-US");function mi(){if(B.guest){const s=ai,r=!!(B.username&&B.username.trim());On&&(On.style.display="none"),Hn&&(Hn.style.display="none"),wa&&(wa.style.display="none"),Ae&&(Ae.disabled=!1,Ae.placeholder=r?"Change your callsign":"Create a callsign to play online",document.activeElement!==Ae&&B.username&&(Ae.value=B.username)),ct&&(ct.innerHTML=r?`🎮 Playing as <b>${ci(B.username)}</b> — online is open on Seeker.`:"Pick a <b>callsign</b> + press <b>Enter</b> to create your account and play online."),ns&&(ns.disabled=!s,ns.classList.toggle("locked",!s)),[Yc,Ya,Xc].forEach(o=>{if(o){const a=s&&r;o.disabled=!a,o.classList.toggle("locked",!a)}}),Zs&&(Zs.style.display="none"),Ks&&(Ks.style.display="none"),B.username&&(K.myName=B.username);return}const n=B.connected,e=B.eligible,t=!!(B.username&&B.username.trim()),i=n&&e&&t;if(On&&(On.style.display=n?"none":"block"),Hn&&(Hn.style.display=n?"none":"block"),wa&&(wa.style.display=n?"flex":"none"),n&&jf&&(jf.innerHTML=B.isAdmin?`👑 <b>ADMIN</b> · ${Qd()}`:`✅ ${Qd()}`),Ae&&(Ae.disabled=!n,Ae.placeholder=n?e?"Pick a username":"Hold 100k $CHUDHOUSE to claim a name":"Connect a wallet to play",n&&B.username&&document.activeElement!==Ae&&(Ae.value=B.username)),ct)if(!n)ct.innerHTML="Jump into <b>ENTER ARENA</b> free, or connect a wallet — <b>Solana</b> ($CHUDHOUSE) or <b>EVM</b> ($CHUDINHOOD on Robinhood Chain) — for online play + your account.";else if(!e)ct.innerHTML=B.chain==="evm"?`Need <b>${Ma(Kd)}</b> $CHUDINHOOD on <b>Robinhood Chain</b> for online — you hold ${Ma(B.balance||0)}. (250k also unlocks the Chudinhood skin!)`:`Need <b>${Ma(Kd)}</b> CHUDHOUSE for online — you hold ${Ma(B.balance||0)}. <a href="https://pump.fun/coin/${bm}" target="_blank" rel="noopener">Get $CHUDHOUSE ↗</a>`;else if(!t)ct.innerHTML="Pick a username + press <b>Enter</b> to claim it.";else{const s=B.tier?Ro(B.tier,B.tierColor,15):"",r=B.tier?` · ${s} <b style="color:${B.tierColor||"var(--mint)"}">${B.tier}${B.rp!=null?` ${B.rp} RP`:""}</b>`:"";ct.innerHTML=B.isAdmin?`👑 Logged in as <b>${B.username}</b> (admin)${r}.`:`Logged in as <b>${B.username}</b>${r} — GLHF!`}ns&&(ns.disabled=!ai,ns.classList.toggle("locked",!ai)),[Yc,Ya,Xc].forEac
3652h(s=>{if(s){const r=i&&ai;s.disabled=!r,s.classList.toggle("locked",!r)}}),Zs&&(Zs.style.display=B.isAdmin?"block":"none"),Ks&&(Ks.style.display=B.isAdmin?"inline-block":"none"),B.username&&(K.myName=B.username),K.myTier=B.tier,K.myTierColor=B.tierColor}On&&(On.onclick=async()=>{On.disabled=!0,On.textContent="Connecting…";try{await C_()}catch(n){const e=String(n&&n.message||n);e==="NO_PHANTOM"?ct.innerHTML='No Solana wallet found. On desktop <a href="https://phantom.app/download" target="_blank" rel="noopener">install Phantom ↗</a>; on mobile open CHUDHOUSE with a Solana wallet available.':/reject|cancel|declin|dismiss/i.test(e)?ct.textContent="Connection cancelled — tap Connect to try again.":ct.textContent="Couldn’t connect the wallet — please try again."}On.disabled=!1,On.textContent="🔗 Connect Solana",mi(),B.connected&&!B.username&&Ae&&Ae.focus()});Hn&&(Hn.onclick=async()=>{Hn.disabled=!0,Hn.textContent="Connecting…";try{await B_()}catch(n){const e=String(n&&n.message||n);e==="NO_EVM"?ct.innerHTML='No EVM wallet found — install <a href="https://metamask.io" target="_blank" rel="noopener">MetaMask ↗</a> or enable the Ethereum wallet in Phantom.':/reject|cancel|declin|dismiss|denied/i.test(e)?ct.textContent="Connection cancelled — tap Connect EVM to try again.":ct.textContent="Couldn’t connect the EVM wallet — please try again."}Hn.disabled=!1,Hn.textContent="🏹 Connect EVM",mi(),B.connected&&!B.username&&Ae&&Ae.focus()});qf&&(qf.onclick=()=>{z_(),Ae&&(Ae.value=""),mi()});async function k2(){try{const e=await(await fetch(Yh,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({guest:!0,uid:li,ref:document.referrer})})).json();e&&e.pass&&(B.connected=!0,B.eligible=!0,B.isAdmin=!1,B.guest=!0,B.pass=e.pass,B.requireTokens=!1,B.balance=null,B.address=e.wallet||"seeker:"+li,B.username=e.username||null,B.username&&(K.myName=B.username,Rn("hb",0)))}catch{}mi(),B.guest&&!B.username&&F0()}const Za=document.getElementById("seekerGate"),Ii=document.getElementById("seekerGateInput"),Js=document.getElementById("seekerGateBtn"),Xr=document.getElementById("seekerGateErr");function F0(){Za&&(Za.style.display="flex",setTimeout(()=>{try{Ii.focus()}catch{}},200))}function N2(){Za&&(Za.style.display="none")}async function O0(){if(!Ii)return;const n=xo(Ii.value);if(!n||n.length<2){Xr.textContent="🚫 Needs 2+ letters or numbers.",Ii.focus();return}Js.disabled=!0,Js.textContent="Creating…",Xr.textContent="";let e;try{e=await _m(li,document.referrer,n)}catch{}if(Js.disabled=!1,Js.textContent="ENTER THE TRENCHES",e&&e.taken){Xr.textContent=`🚫 "${n}" is already taken — pick another.`,Ii.focus();return}if(e&&e.invalid){Xr.textContent="🚫 Use letters, numbers, space, _ . - (2–14 chars).",Ii.focus();return}if(!e||!B.username){Xr.textContent="⚠️ Couldn’t reach the server — check your connection and try again.";return}K.myName=B.username,Rn("hb",0),N2(),mi()}Js&&(Js.onclick=O0);Ii&&Ii.addEventListener("keydown",n=>{n.key==="Enter"&&(n.preventDefault(),O0())});function H0(n){B.isAdmin&&(K.autoStart=!1,K.spectate(n,B.username||"Director"),us.textContent=`👁 Spectating room ${n} — waiting for the match…`,pi.style.display="flex")}Zs&&(Zs.onclick=()=>{if(!B.isAdmin)return;const n=(prompt("Enter the room code to SPECTATE:")||"").trim().toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,6);n&&(Ar(),H0(n))});const Qh=document.getElementById("adminPanel"),z2=Io.replace("/stats","/gate"),Xf=n=>String(n).replace(/[<>&]/g,e=>({"<":"&lt;",">":"&gt;","&":"&amp;"})[e]),Yf=n=>n?n.slice(0,4)+"…"+n.slice(-4):"—",F2=n=>({seeker:'<span class="pill t-seeker">SEEKER</span>',admin:'<span class="pill t-admin">ADMIN</span>',holder:'<span class="pill t-holder">HOLDER</span>',anon:'<span class="pill t-anon">GUEST</span>'})[n]||"",O2=n=>({seeker:'<span class="pill d-dev">📱 Seeker</span>',android:'<span class="pill d-dev">🤖 Android</span>',ios:'<span class="pill d-dev">🍎 iOS</span>',mobile:'<span class="pill d-dev">📲 Mobile</span>',desktop:'<span class="pill d-dev">🖥 Desktop</span>'})[n]||'<span class="pill d-dev">? device</span>';async function U0(){if(!B.isAdmin||!B.pass||!Qh)return;const n=document.getElementById("adminLive"),e=document.getElementById("adminAccounts");n.innerHTML='<div class="adminEmpty">loading…</div>',e.innerHTML='<div class="adminEmpty">loading…</div>';
3652try{const t=await(await fetch(Io+"?admin="+encodeURIComponent(B.pass),{cache:"no-store"})).json(),i=Array.isArray(t.live)?t.live:[];document.getElementById("adminLiveCount").textContent="· "+i.length,n.innerHTML=i.length?i.map(s=>`<div class="adminRow">
3653      <span class="${s.name?"nm":"anon"}">${s.name?Xf(s.name):"anonymous"}</span>
3654      <span>${F2(s.type)} ${O2(s.dev)}</span>
3655      <span>${s.playing?'<span class="pill match">IN MATCH</span>':'<span class="pill live">LOBBY</span>'}</span>
3656      <span class="wl">${Yf(s.wallet)} · ${s.agoSec}s ago</span></div>`).join(""):'<div class="adminEmpty">nobody live right now</div>'}catch{n.innerHTML='<div class="adminEmpty">failed to load live</div>'}try{const t=await(await fetch(z2,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({admin:"accounts",pass:B.pass})})).json(),i=Array.isArray(t.accounts)?t.accounts:[];document.getElementById("adminAcctCount").textContent="· "+i.length,e.innerHTML=i.length?i.map(s=>`<div class="adminRow">
3657      <span class="${s.name?"nm":"anon"}">${s.name?Xf(s.name):"(no name)"}</span>
3658      <span class="num">${s.tier||"—"}</span>
3659      <span class="num">${s.games||0}g</span>
3660      <span class="wl">${Yf(s.wallet)} · ${s.wins||0}W/${s.losses||0}L · ${s.kills||0}K</span></div>`).join(""):'<div class="adminEmpty">no registered accounts yet</div>'}catch{e.innerHTML='<div class="adminEmpty">failed to load accounts</div>'}}Ks&&(Ks.onclick=()=>{B.isAdmin&&(Qh.style.display="flex",U0())});{const n=document.getElementById("adminClose");n&&(n.onclick=()=>Qh.style.display="none")}{const n=document.getElementById("adminRefresh");n&&(n.onclick=U0)}const Zf=document.getElementById("specExitBtn");Zf&&(Zf.onclick=()=>{g0(),ws()});const Kf=document.getElementById("leaderboardBtn"),sr=document.getElementById("leaderboard"),Gn=document.getElementById("lbTable"),Ka=document.getElementById("lbSub"),ci=n=>String(n).replace(/[<>&]/g,e=>({"<":"&lt;",">":"&gt;","&":"&amp;"})[e]),H2=n=>{if(n<=0)return"now";const e=Math.floor(n/864e5),t=Math.floor(n%864e5/36e5),i=Math.floor(n%36e5/6e4);return e>0?`${e}d ${t}h`:t>0?`${t}h ${i}m`:`${i}m`};let rr=null,xr="ladder",Aa=new Map;const G0=(n,e=18)=>n.tier?Ro(n.tier,n.tierColor,e):"",Jf=(n,e,t="")=>{const i=e<=3?` top${e}`:"",s=(n.name||"").toLowerCase();return`<div class="lbRow${i}${t}" data-key="${ci(s)}"><span class="lbRank">${e}</span><span class="lbName">${G0(n)}${ci(n.name)}</span><span class="lbRp" style="color:${n.tierColor||"var(--mint)"}">${n.rp!=null?n.rp:"—"}</span><span class="lbWl"><span class="w">${n.wins}</span>-<span class="l">${n.losses}</span></span><span class="lbKd">${n.kdr.toFixed(2)}</span></div>`};async function W0(){if(xr!=="ladder")return;const{rows:n,you:e,season:t}=await Sm();if(sr.style.display==="none"||xr!=="ladder")return;if(Ka&&t&&(Ka.textContent=`⚡ Quick Play · Season ${t.n} · resets in ${H2(t.endsIn)} · tap a player`),!n.length){Gn.innerHTML='<div class="lbEmpty">No quick matches yet.<br>Be the first on the board! ⚡</div>';return}const i=(B.username||"").toLowerCase(),s=Gn.scrollTop;
3660Aa=new Map,n.forEach((c,l)=>Aa.set(c.name.toLowerCase(),{...c,rank:l+1}));const r='<div class="lbHead"><span>#</span><span>Player</span><span style="text-align:right">RP</span><span style="text-align:right">W-L</span><span style="text-align:right">K/D</span></div>',o=new Set(n.map(c=>c.name.toLowerCase()));let a=r+n.map((c,l)=>Jf(c,l+1,i&&c.name.toLowerCase()===i?" me":"")).join("");e&&!o.has((e.name||"").toLowerCase())?(Aa.set((e.name||"").toLowerCase(),{...e}),a+='<div class="lbGap">⋯</div>'+Jf(e,e.rank," me")):B.username&&!e&&!o.has(i)&&(a+=`<div class="lbGap">You're not ranked yet — play a match! 🎮</div>`),Gn.innerHTML=a,Gn.scrollTop=s}let Dn=null;function U2(){Dn&&(Dn.style.display="none")}function G2(n){Dn||(Dn=document.createElement("div"),Dn.id="profileCard",Dn.addEventListener("click",i=>{(i.target===Dn||i.target.classList.contains("pfClose"))&&U2()}),document.body.appendChild(Dn));const e=n.games?Math.round(n.wins/n.games*100):0,t=n.rank?`Rank #${n.rank}`:"Unranked";Dn.innerHTML=`<div class="pfPanel"><div class="pfTier">${n.tier?Ro(n.tier,n.tierColor,52):""}<span class="pfTierName" style="color:${n.tierColor||"#9b92c9"}">${ci(n.tier||"Unranked")}</span></div><h2 class="pfName">${ci(n.name)}</h2><div class="pfRank">${t} · <b style="color:${n.tierColor||"var(--mint)"}">${n.rp!=null?n.rp:"—"} RP</b></div><div class="pfStats"><div class="pfStat"><span>${n.wins}-${n.losses}</span><label>W-L</label></div><div class="pfStat"><span>${e}%</span><label>Win rate</label></div><div class="pfStat"><span>${n.kdr.toFixed(2)}</span><label>K/D</label></div><div class="pfStat"><span>${n.games}</span><label>Games</label></div></div><button class="pfClose">CLOSE</button></div>`,Dn.style.display="flex"}Gn&&Gn.addEventListener("click",n=>{if(xr!=="ladder")return;const e=n.target.closest&&n.target.closest(".lbRow[data-key]");if(!e)return;const t=Aa.get(e.getAttribute("data-key"));t&&G2(t)});async function W2(){Gn.innerHTML='<div class="lbEmpty">Loading…</div>';const n=await N_();if(xr!=="history")return;if(!n.length){Gn.innerHTML='<div class="lbEmpty">No seasons have ended yet.<br>The current season is still live — make history! 🏆</div>';return}const e=["🥇","🥈","🥉"];Gn.innerHTML=n.map(t=>{const i=(t.top||[]).slice(0,3).map((s,r)=>`<div class="chRow"><span class="chMedal">${e[r]}</span><span class="chName">${G0(s)}${ci(s.name)}</span><span class="chRp" style="color:${s.tierColor||"var(--mint)"}">${s.rp!=null?s.rp:"—"} RP</span></div>`).join("");return`<div class="chSeason"><div class="chHead">Season ${t.season}</div>${i||'<div class="lbEmpty">No entrants</div>'}</div>`}).join("")}const Ja=document.getElementById("lbTabLadder"),Qa=document.getElementById("lbTabChamps");function $h(n){xr=n,Ja&&Ja.classList.toggle("on",n==="ladder"),Qa&&Qa.classList.toggle("on",n==="history"),Ka&&(Ka.style.display=n==="ladder"?"":"none"),n==="ladder"?W0():W2()}Ja&&(Ja.onclick=()=>$h("ladder"));Qa&&(Qa.onclick=()=>$h("history"));async function V2(){Gn.innerHTML='<div class="lbEmpty">Loading…</div>',sr.style.display="flex",$h("ladder"),rr&&clearInterval(rr),rr=setInterval(()=>{xr==="ladder"&&W0()},12e3)}function V0(){sr.style.display="none",rr&&(clearInterval(rr),rr=null)}Kf&&(Kf.onclick=V2);const Qf=document.getElementById("lbClose");Qf&&(Qf.onclick=V0);sr&&sr.addEventListener("click",n=>{n.target===sr&&V0()});(function(){F_(),mi(),B.username&&Rn("hb",0),v2()&&!B.connected&&k2();const e=(new URLSearchParams(location.search).get("spectate")||"").trim().toUpperCase().replace(/[^A-Z0-9]/g,"").slice(0,6);B.isAdmin&&e&&(Ar(),H0(e)),g2()})();window.G=m;window.__step=v0;window.__dbg={camera:bt,keys:Ye,mouse:Co,mouseNDC:pl,startMatch:bl,handleQPress:Fh,handleEPress:Oh,lobbyState:rt};window.__render=()=>{m.scene&&(vm(0),um(m.scene))};window.__glcanvas=Gt.domElement;function q2(){ai&&(m.pendingNet=null,Xh("match_start",{mode:"solo",champ:rt.selectedChar}),Rn("solo",1),Ar(),qh(),bl())}ns.onclick=()=>{if(ai){if(B.guest&&!B.username){F0();return}_l("solo","SOLO · VS BOTS")}};document.getElementById("againBtn").onclick=()=>{if(K.connected())try{K.disconnect()}catch{}Ln=!1,Vn=!1,An=null,rt.onPick=null,Vh(),document.getElementById("endScreen").style.display="none",document.getElementById("hud").style.display="none",document.getElementById("chatBox").style.display="none",document.getElementById("lobby").style.display="flex",ws()};const $f=document.getElementById("shareBtn");$f&&($f.onclick=()=>{const n=m.lastResult;if(!n)return;const e=pt[n.champ]||{};
3660o2({won:n.won,champKey:n.champ,champName:e.name||"CHUD",face:e.face,kills:n.kills,deaths:n.deaths,ranked:n.ranked,tier:n.tier,tierColor:n.tierColor,delta:n.delta,promoted:n.promoted,username:B.username})});const j2=new nm;bt.position.set(0,26,18);Oi||YM();function q0(){requestAnimationFrame(q0);const n=Math.min(j2.getDelta(),.05);m.scene&&(vm(n),m.running&&v0(n),um(m.scene))}q0();export{Q0 as b,J0 as r};

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.